Re: Clojure @ Prague?

2012-07-13 Thread Edward Tsech
What do you think guys about informal meeting at the weekend?

On Monday, July 9, 2012 9:21:51 AM UTC+2, Zuzkins wrote:

 Hi guys,
 I, somehow, missed this thread but I am all up for clojure @ Prague

 On Thu, Jul 5, 2012 at 7:54 PM, Edward Tsech edts...@gmail.com wrote:

 HI Daniel,

 I'm interested in Clojure and I would like to meet some Clojurians in 
 Prague too!

 Ed


 On Friday, June 29, 2012 12:21:58 PM UTC+2, Daniel Skarda wrote:

 Hi,

 are there fellow Clojurians from Prague, Czech Republic using Clojure to 
 attack real problems?
 I started with Clojure about three months ago. At the beginning it was 
 curious experiment, now it is full time engagement. And you know - 
 programming can be fun again :)

 Would you like to meet for a beer and discuss Clojure, ClojureScript or 
 Datomic?

 Cheers,
 Dan


  -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en




 -- 
 :J
  

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Wolodja Wentland
On Wed, Jul 11, 2012 at 14:46 +0200, Tassilo Horn wrote:
 Hm, probably yes.  But you can implement the other arities quiet easily.
 So that version also accepts the version that reads into a byte array.
 The third version is left as an exercise for the reader. ;-)

Thanks, I've done that and had to change your code a little in order to
provide the same behaviour as the Java equivalent. (return -1 when no data can
be read). The following is the implementation I use without problems now:

--- snip ---
(defn concat-input-stream
  Gets one or many input streams and returns a new input stream that
  concatenates the given streams.
  ^java.io.InputStream [^java.io.InputStream is  more]
  (proxy [java.io.InputStream] []
(read
  ([]
   (let [input (.read is)]
 (if (and (== -1 input) (seq more))
   (.read (apply concat-input-stream (first more) (rest more)))
   input)))
  ([arr]
   (loop [i 0]
 (if (== i (alength arr))
   i
   (let [input (.read this)]
 (if (== -1 input)
   (if (== 0 i) input i)
   (do
 (clojure.core/aset arr i (byte input))
 (recur (inc i
  ([arr off len]
   (loop [i 0]
 (if (or (== i len)
 (== (+ off i) (alength arr)))
   i
   (let [input (.read this)]
 (if (== -1 input)
   (if (== 0 i) input i)
   (do
 (clojure.core/aset arr (+ off i) (byte input))
 (recur (inc i)))
--- snip ---

Thanks again for your help. Unfortunately I am still not sure what to use if I
face even more horrible SGML in the future, but I think the best solution
depends on the exact data ... Be that as it may: I am happy now. :)
-- 
Wolodja babi...@gmail.com

4096R/CAF14EFC
081C B7CD FF04 2BA9 94EA  36B2 8B7F 7D30 CAF1 4EFC


signature.asc
Description: Digital signature


Re: Concatenating InputStreams

2012-07-13 Thread Tassilo Horn
Wolodja Wentland babi...@gmail.com writes:

Hi Wolodja,

 Thanks, I've done that and had to change your code a little in order
 to provide the same behaviour as the Java equivalent. (return -1 when
 no data can be read).

Ah, right.  I didn't read the docs too accurate.

 The following is the implementation I use without problems now:
 [...]
 Be that as it may: I am happy now. :)

Great.  By the way, the code is inspired by this blog posting

  http://mattryall.net/blog/2007/03/composition-stream-concatenation

(And frankly, in this case the java version is simpler than the clojure
version.)

Bye,
Tassilo

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Meikel Brandmeyer (kotarak)
Hi,

I think you don't handle the switching of streams correctly. You have to 
keep track with atoms. But then you run into thread-safety issues.

(defn concat-input-stream
  Gets one or many input streams and returns a new input stream that
  concatenates the given streams.
  [is  streams]
  (let [is  (atom is)
streams (atom streams)
switch! (fn []
  (locking is
(.close @is)
(reset! is (first streams))
(swap! streams rest)))
do-read (fn
  ([is] (if is (.read is) -1))
  ([is arr] (if is (.read is arr) -1))
  ([is arr off len] (if is (.read is arr off len) -1)))]
(proxy [java.io.InputStream] []
  (close
[]
(when @is
  (.close @is)
  (doseq [s @streams] (.close s
  (read
([]
 (let [ch (do-read @is)]
   (if (neg? ch)
 (do
   (switch!)
   (if @is
 (.read this)
 -1))
 ch)))
([arr]
 (let [n (do-read @is arr)]
   (if (neg? n)
 (do
   (switch!)
   (if @is
 (.read this arr)
 -1))
 n)))
([arr off len]
 (let [n (do-read @is arr off len)]
   (if (neg? n)
 (do
   (switch!)
   (if @is
 (.read this arr off len)
 -1))
 n)))

You could also use java.io.SequenceInputStream with a small helper.

(defn coll-enumeration
  [coll]
  (let [s (atom coll)]
(reify [java.util.Enumeration] []
  (hasMoreElements [this]
(boolean (swap! s seq)))
  (nextElement [this]
(locking this
  (if-let [sq (seq @s)]
(let [e (first sq)]
  (reset! s (rest sq))
  e)
(throw (java.util.NoSuchElementException.

(defn concat-input-stream
  Gets one or many input streams and returns a new input stream that
  concatenates the given streams.
  [is  streams]
  (java.io.SequenceInputStream. (coll-enumeration (cons is streams

All code untested.

Kind regards
Meikel

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Meikel Brandmeyer (kotarak)
Hi again,

talking about thread safety.

Am Freitag, 13. Juli 2012 16:13:54 UTC+2 schrieb Meikel Brandmeyer 
(kotarak):

   (close
 []
 (when @is
   (.close @is)
   (doseq [s @streams] (.close s


(close
  []
  (locking this
(when @is
  (.close @is)
  (doseq [s @streams] (.close s)

Kind regards
Meikel

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: core cache/memoize issue?

2012-07-13 Thread siyu798
Awesome, thx a lot!!

On Wednesday, July 11, 2012 7:24:29 PM UTC-4, Fogus wrote:

 Thank you for the report. I have a fix for the LRU/LU caches on my box 
 and will have it out in the next day or so. The core.memoize changes 
 will follow soon after. 


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

ICFP Contest in ClojureC

2012-07-13 Thread Mark Probst
Hey ho!

If anybody's up for entering the ICFP programming contest

  http://icfpcontest2012.wordpress.com/task/

with a ClojureC program, email me

  mark.probst at gmail

Obviously most of the work would be getting ClojureC up to the task :-)

Mark

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Kevin Downey
http://docs.oracle.com/javase/1.5.0/docs/api/java/io/SequenceInputStream.html

On Fri, Jul 13, 2012 at 7:29 AM, Meikel Brandmeyer (kotarak)
m...@kotka.de wrote:
 Hi again,

 talking about thread safety.

 Am Freitag, 13. Juli 2012 16:13:54 UTC+2 schrieb Meikel Brandmeyer
 (kotarak):

   (close
 []
 (when @is
   (.close @is)
   (doseq [s @streams] (.close s


 (close
   []
   (locking this
 (when @is
   (.close @is)
   (doseq [s @streams] (.close s)

 Kind regards
 Meikel

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en



-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Clojure on an Erlang-vm-os on Xen?

2012-07-13 Thread Frank Siebenlist
Just became aware of this effort: http://erlangonxen.org/;

which shows off some impressive properties:

* Startup time of a new instance is 100ms
* Instances are provisioned after the request arrival - all requests get handled
* No instances are running waiting for requests - the cloud footprint is zero
* the size of infrastructure is proportional to the maximum load - 8 servers 
may be enough
* …

All that begs the Q: would Clojure on an Elang-VM be feasible and make sense?

-FrankS.


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Alan Malloy
(defn coll-enumeration [coll]
  (clojure.lang.SeqEnumeration. coll))

On Friday, July 13, 2012 7:13:54 AM UTC-7, Meikel Brandmeyer (kotarak) 
wrote:

 Hi,

 I think you don't handle the switching of streams correctly. You have to 
 keep track with atoms. But then you run into thread-safety issues.

 (defn concat-input-stream
   Gets one or many input streams and returns a new input stream that
   concatenates the given streams.
   [is  streams]
   (let [is  (atom is)
 streams (atom streams)
 switch! (fn []
   (locking is
 (.close @is)
 (reset! is (first streams))
 (swap! streams rest)))
 do-read (fn
   ([is] (if is (.read is) -1))
   ([is arr] (if is (.read is arr) -1))
   ([is arr off len] (if is (.read is arr off len) -1)))]
 (proxy [java.io.InputStream] []
   (close
 []
 (when @is
   (.close @is)
   (doseq [s @streams] (.close s
   (read
 ([]
  (let [ch (do-read @is)]
(if (neg? ch)
  (do
(switch!)
(if @is
  (.read this)
  -1))
  ch)))
 ([arr]
  (let [n (do-read @is arr)]
(if (neg? n)
  (do
(switch!)
(if @is
  (.read this arr)
  -1))
  n)))
 ([arr off len]
  (let [n (do-read @is arr off len)]
(if (neg? n)
  (do
(switch!)
(if @is
  (.read this arr off len)
  -1))
  n)))

 You could also use java.io.SequenceInputStream with a small helper.

 (defn coll-enumeration
   [coll]
   (let [s (atom coll)]
 (reify [java.util.Enumeration] []
   (hasMoreElements [this]
 (boolean (swap! s seq)))
   (nextElement [this]
 (locking this
   (if-let [sq (seq @s)]
 (let [e (first sq)]
   (reset! s (rest sq))
   e)
 (throw (java.util.NoSuchElementException.

 (defn concat-input-stream
   Gets one or many input streams and returns a new input stream that
   concatenates the given streams.
   [is  streams]
   (java.io.SequenceInputStream. (coll-enumeration (cons is streams

 All code untested.

 Kind regards
 Meikel



-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

ANN: core.cache version 0.6.1 (SoftCache + bug fixes)

2012-07-13 Thread Fogus
core.cache v0.6.1 Release Notes
===

core.cache is a new Clojure contrib library providing the following 
features:

* An underlying `CacheProtocol` used as the base abstraction for 
implementing new synchronous caches

* A `defcache` macro for hooking your `CacheProtocol` implementations into 
the Clojure associative data capabilities.

* Immutable implementations of some basic caching strategies
  - First-in-first-out (FIFOCache)
  - Least-recently-used (LRUCache)
  - Least-used (LUCache)
  - Time-to-live (TTLCache)
  - Soft-Reference cache (SoftCache)
  - Naive cache (BasicCache)

* Implementation of an efficient buffer replacement policy based on the 
*low inter-reference recency set* algorithm (LIRSCache) described in the 
[LIRS](http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.116.2184) 
paper

* Factory functions for each existing cache type

Absorb
--

You can use core.cache in your 
[Leiningen](https://github.com/technomancy/leiningen) and 
[Cake](https://github.com/flatland/cake) projects with the following 
`:dependencies` directive in your `project.clj` file:

[org.clojure/core.cache 0.6.1]

For Maven-driven projects, use the following slice of XML in your 
`pom.xml`'s `dependencies` section:

dependency
  groupIdorg.clojure/groupId
  artifactIdcore.cache/artifactId
  version0.6.1/version
/dependency

Enjoy!


Places
--

* [Source code](https://github.com/clojure/core.cache)
* [Ticket system](http://dev.clojure.org/jira/browse/CCACHE)
* 
[Announcement](http://groups.google.com/group/clojure/browse_frm/thread/69d08572ab265dc7)
* [API Reference](https://clojure.github.com/core.cache)
* [Examples and documentation](https://github.com/clojure/core.cache/wiki) 
(work in progress)

Changes from v0.5.0
---

The v0.6.1 version of core.cache contains the following changes:

* The addition of a cache built on Java soft references

* Bug fix for LRU and LU caches disabling the eviction of duplicate keys 
prior to threshold.

* The factory function optional argument named `:limit` was changed to 
`:threshold`.

* The default thresholds set by the factory functions were adjusted.

Plans
-

The following capabilities are under design, development, or consideration 
for future versions of core.cache:

* Make ClojureScript compatible
* Asynchronous caching protocol
* FunCache implementation
* `LIRSCache evict`
* Hardening of the `seed` function implementations
* test.generative usage
* Deprecation of Clache
* More documentation and examples

More planning is needed around capabilities not listed nor thought of.

Thanks
--

I would like to thank Paul Stadig for his work in fixing the `SoftCache` 
implementation.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure @ Prague?

2012-07-13 Thread Daniel Skarda
Hi Edward and Jiří,

it would be great to meet Clojurians in Prague. Currently I am in Slovakia
and I will be back on Monday, so I would prefer later next week (Thursday?)
or next weekend.

Do you have some favourite pub or restaurant? (probably we should take this
discussion away from Clojure mailing list, unless some future Prague
visitor is interested in good Czech beer ;)

Dan

On Fri, Jul 13, 2012 at 1:38 PM, Edward Tsech edts...@gmail.com wrote:

 What do you think guys about informal meeting at the weekend?


 On Monday, July 9, 2012 9:21:51 AM UTC+2, Zuzkins wrote:

 Hi guys,
 I, somehow, missed this thread but I am all up for clojure @ Prague

 On Thu, Jul 5, 2012 at 7:54 PM, Edward Tsech edts...@gmail.com wrote:

 HI Daniel,

 I'm interested in Clojure and I would like to meet some Clojurians in
 Prague too!

 Ed


 On Friday, June 29, 2012 12:21:58 PM UTC+2, Daniel Skarda wrote:

 Hi,

 are there fellow Clojurians from Prague, Czech Republic using Clojure
 to attack real problems?
 I started with Clojure about three months ago. At the beginning it was
 curious experiment, now it is full time engagement. And you know -
 programming can be fun again :)

 Would you like to meet for a beer and discuss Clojure, ClojureScript or
 Datomic?

 Cheers,
 Dan


   --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en




 --
 :J

  --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: ClojureC - A Clojure to C compiler - Work in Progress

2012-07-13 Thread Adam King
Hi Mark:

  Just a quick iOS update.  I grabbed the latest from your git repo and
from my initial work at implementing the required glib methods that you're
using, I now have it running on both my iPad and iPhone4S.  I don't look at
the glib source - I just google the missing function name and implement it
based on what the docs describe.   It spits out (to the debug console) the
same output as OSX shows when running ./cljc from the Terminal, which
would be: (4 5)

  I took a snap of xcode running (with the (4 5) ) and dumped it here:
http://antimass.org/clojure/cljc_xcode.png

  As you can see, there are some Unused variable 'env' and Expression
result unused warnings which I'll probably just disable. But the main item
I was trying to determine from all this, was that it would be possible to
use your clojurec work under iOS, which now looks very doable!  The only
change I really had to make to the generated cljc.c file was change main()
- main_ios() which I call from [AppDelegate
application:didFinishLaunchingWithOptions].

  I'll clean it up and commit to my github clojurec repo branch and then
I'll do a pull request later this weekend/Monday.  I'll also pop my signed
Clojure Contribution Agreement in the mail tomorrow incase that's needed.
 Again, thanks for your work on clojurec!  And to David Nolen for
ClojureScript - I do most of my play in ClojureScript and it's REPL (mainly
playing with WebGL as it ties into my day job. :)   I just want to have the
option to compile it out to C and then release in the App Store(s).  Cheers,

  Adam


On Tue, Jul 10, 2012 at 3:29 PM, Mark Probst mark.pro...@gmail.com wrote:

 Hey Adam,

I've spent a couple of hours on this - and have run into a snag.  I've
 got
  libgc compiling/linking with arm iOS and the Xcode project compiles
 cljc.c
  fine. The problem is glib.  From what I've read, iOS can not use glib as
 it
  must be statically linked into the app - but the LGPL doesn't allow that
 (at
  least from what I've read).  Currently, there only seems to be about 7
  methods that you're using that need it - 6 of which at utf8 related.  So,
  I'm thinking that I'll make a 'prepreamble.m' and use NSString's
  utf8/unichar support for simulating those methods.  But before I spend
 time
  on that, any comments or ideas?  For g_file_get_contents(), I can
 probably
  use [NSString stringWithContentsOfFile:encoding:error].

 I see the problem.

 My guess is that on iOS we'd use NSString anyway, even if we use glib2
 or whatever else for command-line programs.  One problem here is that
 you cannot allocate NSString's from Boehm, so you'd have to use
 finalizers to make sure the NSString's are released when the
 corresponding Clojure objects are collected.  See
 GC_register_finalizer in Boehm's gc.h.

 Late on we'll have proper Objective-C bindings, so the glueing will
 become much easier.

 Mark


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Meikel Brandmeyer
Hi,

Am 13.07.2012 um 19:25 schrieb Alan Malloy:

 (defn coll-enumeration [coll]
   (clojure.lang.SeqEnumeration. coll))

Ah. I knew there must be something. But it doesn't seem to be official, public 
API.

Meikel

signature.asc
Description: Message signed with OpenPGP using GPGMail


setting a default route in noir

2012-07-13 Thread Chris McBride
I have a lot of defpages that have a long part of the url in common (ex. 
/client/:clientid/someresource/). So I made a function to encapsulate the 
beginning of the URL, but the defpage macro expects a string and not a 
function call. Is there an easy way to have the begging of the route be the 
same? I'm sure there is a way to do it with middleware but is there a 
faster way using pre-route or something similar?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: ICFP Contest in ClojureC

2012-07-13 Thread Laurent PETIT
2012/7/13 Mark Probst mark.pro...@gmail.com:
 Hey ho!

 If anybody's up for entering the ICFP programming contest

   http://icfpcontest2012.wordpress.com/task/

 with a ClojureC program, email me

   mark.probst at gmail

 Obviously most of the work would be getting ClojureC up to the task :-)

And it would be nice to have a playable version of the game as a
ClojureScript page somewhere :-)


 Mark

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Kevin Downey
thank you for responding personally to me, but I sent my message to
clojure google group.

given the thread has the subject Concatenating InputStreams and I
linked javadocs for a standard part of java.io that does exactly that,
I am surprised that you decided to respond with tl;dr, but I have
noted your response and will in the future let you prattle on endless
reinventing functionality that already exists.

On Fri, Jul 13, 2012 at 12:42 PM, Meikel Brandmeyer m...@kotka.de wrote:
 tl;dr

 Am 13.07.2012 um 18:35 schrieb Kevin Downey:

 http://docs.oracle.com/javase/1.5.0/docs/api/java/io/SequenceInputStream.html




-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ClojureC - A Clojure to C compiler - Work in Progress

2012-07-13 Thread Mark Probst
Adam,

   Just a quick iOS update.  I grabbed the latest from your git repo and from
 my initial work at implementing the required glib methods that you're using,
 I now have it running on both my iPad and iPhone4S.  I don't look at the
 glib source - I just google the missing function name and implement it based
 on what the docs describe.   It spits out (to the debug console) the same
 output as OSX shows when running ./cljc from the Terminal, which would be:
 (4 5)

That's fantastic news!

Reimplementing the glib string functions is not the way to go for iOS,
but I understand why you did it in the first iteration.  As I said,
we'll have proper Objective-C bindings which will make those things
much better.

   As you can see, there are some Unused variable 'env' and Expression
 result unused warnings which I'll probably just disable.

Yes, they're just a result of the compiler being very simple-minded,
and they do no harm.

   I'll clean it up and commit to my github clojurec repo branch and then
 I'll do a pull request later this weekend/Monday.  I'll also pop my signed
 Clojure Contribution Agreement in the mail tomorrow incase that's needed.

I'll have to figure out how to handle this, too.  Thanks for reminding!

Mark

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Alan Malloy
It's a public class in clojure.lang that is not used by any part of the 
Clojure runtime or standard libraries. I can't think what other reason it 
would be included for, if not to be used by you. Just like 
clojure.lang.PersistentQueue - there's no nice Clojure wrapper for it (why 
on Earth not?), but it's still intended to be used by Clojure code.

On Friday, July 13, 2012 12:40:07 PM UTC-7, Meikel Brandmeyer (kotarak) 
wrote:

 Hi, 

 Am 13.07.2012 um 19:25 schrieb Alan Malloy: 

  (defn coll-enumeration [coll] 
(clojure.lang.SeqEnumeration. coll)) 

 Ah. I knew there must be something. But it doesn't seem to be official, 
 public API. 

 Meikel

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Should read-string support \x.. escaped characters?

2012-07-13 Thread Dave Sann
opened: http://dev.clojure.org/jira/browse/CLJ-1025

On Wednesday, 25 April 2012 04:20:11 UTC+10, Brandon Bloom wrote:

 Surprisingly, this differs from JSON, which only supports \u...

 On Friday, December 23, 2011 5:43:00 PM UTC-8, Dave Sann wrote:

 When sending data as strings from clojurescript to clojure there will be 
 issues if the source data contains certain unicode characters. (I think in 
 range 128-255 - extended latin characters mostly).

 This is because the goog string conversion used by pr-str encodes these 
 characters as \x.. not \u00..

 read-string will throw an exception if it encounters these characters.

 Should read-string support these character escapes?



 by way of work around, I am using:

 (require '[clojure.string :as s])

 (defn unescape [string]
   (s/replace 
 string #\\x(..) 
 (fn [m] (str (char (Integer/parseInt (second m) 16))

 (defn my-read-string [s]
   (read-string (unescape s)))

 Causes : https://github.com/ibdknox/pinot/issues/16

 Cheers

 Dave



-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Meikel Brandmeyer
Hi,

Am 13.07.2012 um 23:48 schrieb Kevin Downey:

 thank you for responding personally to me, but I sent my message to
 clojure google group.
 
 given the thread has the subject Concatenating InputStreams and I
 linked javadocs for a standard part of java.io that does exactly that,
 I am surprised that you decided to respond with tl;dr, but I have
 noted your response and will in the future let you prattle on endless
 reinventing functionality that already exists.

Sometimes it is necessary to write an endless prattle of reinvention to show 
that things are not as trivial as they might seem. The devil often lies in the 
details and one must pay close attention. (Even my endless prattle is still 
broken.)

At the end of my message I referred to SequenceInputStream together with a 
reinvention of SeqEnumeration, which I didn't know, but was pointed to by Alan 
Malloy, who obviously – in contrast to you – read my message before responding.

Kind regards
Meikel



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Concatenating InputStreams (was: Re: Parsing SGML)

2012-07-13 Thread Meikel Brandmeyer
Hi,

and more errata: reading is not thread-safe when the result is -1. Then an 
unintended switch! might happen. There things have to be packed into a locking 
together with a second read to verify it's still −1. Details! Details!

Kind regards
Meikel



signature.asc
Description: Message signed with OpenPGP using GPGMail