Re: Literal hash-maps with duplicate keys?

2009-05-30 Thread Meikel Brandmeyer
Hi, Am 30.05.2009 um 02:37 schrieb Brian Carper: Can anyone explain this? user (def x {:foo :bar :foo :baz :foo :quux}) #'user/x user x {:foo :bar, :foo :baz, :foo :quux} user (count (keys x)) 3 user (map x (keys x)) (:bar :bar :bar) If I remember correctly, map literals smaller than a

Learning Clojure - Wiki

2009-05-30 Thread Rock
I'm editing the Reader Macros section. I hope I got this right: For Lists, syntax-quote establishes a template of the corresponding data structure. Within the template, unqualified forms behave as if recursively syntax-quoted. `(x1 x2 x3 ... xn) is interpreted to mean (clojure.core/seq

Is oracle going to make the jvm part proprietary?

2009-05-30 Thread aperotte
This slashdot story is kind of worrisome. http://tech.slashdot.org/story/09/05/29/1711203/Java-Gets-New-Garbage-Collector-But-Only-If-You-Buy-Support?from=rss Do you all think this is the beginning of a trend? --~--~-~--~~~---~--~~ You received this message

Re: Literal hash-maps with duplicate keys?

2009-05-30 Thread Stephen C. Gilardi
On May 30, 2009, at 7:01 AM, Meikel Brandmeyer wrote: If I remember correctly, map literals smaller than a certain size are based on array-map. For speed reasons, this does not check for duplicate keys. If you increase the size of your literal beyond the threshold (was it something around

Re: Is oracle going to make the jvm part proprietary?

2009-05-30 Thread Baishampayan Ghose
http://tech.slashdot.org/story/09/05/29/1711203/Java-Gets-New-Garbage-Collector-But-Only-If-You-Buy-Support?from=rss Who cares? There are many classy JVM implementations from third parties like IBM. BG -- Baishampayan Ghose b.gh...@ocricket.com oCricket.com http://oCricket.com

is there a sibling of fmap that maps keys instead of values?

2009-05-30 Thread Stuart Halloway
clojure.contrib.generic.functor.fmap will return a map with values updated by a function. What if I wany *keys* updated by a function? Does this exist yet? If not, what should I name it for inclusion in contrib? Stu --~--~-~--~~~---~--~~ You received this

Re: Is oracle going to make the jvm part proprietary?

2009-05-30 Thread Tassilo Horn
Baishampayan Ghose b.gh...@ocricket.com writes: http://tech.slashdot.org/story/09/05/29/1711203/Java-Gets-New-Garbage-Collector-But-Only-If-You-Buy-Support?from=rss Who cares? There are many classy JVM implementations from third parties like IBM. Well, at least them IBM one is proprietary.

Re: Instructions for Emacs+SLIME

2009-05-30 Thread Robert Stehwien
I started from scratch and got the starter kit anew. Now on startup I get the following warning in *Messages* (repeated on each startup): -- Installing nxml An error has occurred while loading `/Users/res/.emacs.d/init.el': error: Package 'nxml' not available for installation --

Re: Instructions for Emacs+SLIME

2009-05-30 Thread Vagif Verdi
I would greatly appreciate instructions how to setup emacs to connect to already running clojure. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Is oracle going to make the jvm part proprietary?

2009-05-30 Thread Vagif Verdi
Fear not. G1 is in Open-JDK, so no one can forbid you use it anyway you see fit. The clause in EULA is simply a lawyer talk, to cover their asses if someone uses experimental feature in production and looses his data or crashes server. --~--~-~--~~~---~--~~ You

Re: Currying / Partial Application macro

2009-05-30 Thread eyeris
From a practical position, anonymous functions of the #(+ 5 %) flavor *are* partial application. The ubiquity of these anonymous functions in clojure code is evidence that partial application is just as needed in clojure as it is in haskell. #(+ 5 %) is not much more succinct than (\x - x + 5).

Re: Currying / Partial Application macro

2009-05-30 Thread Daniel Lyons
On May 30, 2009, at 1:58 PM, eyeris wrote: If clojure used partial application by default, then we would see fewer anonymous functions in clojure code; if haskell did not use partial application by default, we would see more anonymous functions in haskell code. You can't have both partial

Re: is there a sibling of fmap that maps keys instead of values?

2009-05-30 Thread Konrad Hinsen
On 30.05.2009, at 17:11, Stuart Halloway wrote: clojure.contrib.generic.functor.fmap will return a map with values updated by a function. What if I wany *keys* updated by a function? Does this exist yet? If not, what should I name it for inclusion in contrib? Speaking strictly from an

Re: is there a sibling of fmap that maps keys instead of values?

2009-05-30 Thread Stuart Halloway
Thanks Konrad. I certainly do not want to add this to fmap. However, I think there are lots of situations where mapping keys is well-defined. For example, you have a tree of data from XML or JSON, and you want to replace the keys (strings) with instances of their actual type. I guess

Re: Instructions for Emacs+SLIME

2009-05-30 Thread Phil Hagelberg
Robert Stehwien rstehw...@gmail.com writes: I started from scratch and got the starter kit anew.  Now on startup I get the following warning in *Messages* (repeated on each startup): -- Installing nxml An error has occurred while loading `/Users/res/.emacs.d/init.el': error:

map closure issue

2009-05-30 Thread Ben
I'm not sure if this is an issue or not. I broke it down to a simple case. When I pass a Java object into a map closure the object doesn't seem to get updated: (let [b (new StringBuffer)] (map #(.. b (append (str % ))) '(blah blah blah)) b) ;= #StringBuffer expected ;= #StringBuffer blah

Re: New reflection warning in r1381

2009-05-30 Thread kotor
Dex, Thanks for the info. It's nice to understand what's going on. I am trying to dig into the source more to get a deeper understanding of the language, but Clojure is my first exposure to Java, so that part is slow going. On May 28, 8:24 pm, Dex Wood slash2...@gmail.com wrote: The change

Re: Currying / Partial Application macro

2009-05-30 Thread kinghajj
On May 30, 1:19 pm, Daniel Lyons fus...@storytotell.org wrote: You can't have both partial application and variable arity functions. Uh, yeah you can. Haskell can have variadic functions, like Text.Printf.printf, and with some explicit type signatures you can still partially apply it. import

Re: map closure issue

2009-05-30 Thread Timothy Pratley
Lazy evaluation strikes again! map doesn't actually do anything until you force it eg with dorun. This is quite a common mistake! Does anyone know how one would go able making a warning be printed when a lazy seq is created and thrown away without any evaluation? I'd be interested in implementing

Re: map closure issue

2009-05-30 Thread Timothy Pratley
Further to explain this behaviour: (let [b (new StringBuffer)]   (map #(.. b (append (str % ))) '(blah blah blah))) #StringBuffer blah blah blah ) If you are using the REPL the return result is the lazy-seq, and this gets forced to display the result. However in your original code you

Re: integer overflow behavior multiply

2009-05-30 Thread ataggart
Yes, the reason the larger one works is because the parameters to * just happen to overflow to values that let the result of * not go out of bounds. As for doing bounds checking during (int), I think that would be a net loss. Generally speaking, casting to a primitive is intended to aid

Re: Instructions for Emacs+SLIME

2009-05-30 Thread Robert Stehwien
I started from scratch and got the starter kit anew. Now on startup I get the following warning in *Messages* (repeated on each startup): -- Installing nxml An error has occurred while loading `/Users/res/.emacs.d/init.el': error: Package 'nxml' not available for

Re: Currying / Partial Application macro

2009-05-30 Thread Daniel Lyons
On May 30, 2009, at 7:25 PM, kinghajj wrote: On May 30, 1:19 pm, Daniel Lyons fus...@storytotell.org wrote: You can't have both partial application and variable arity functions. Uh, yeah you can. Haskell can have variadic functions, like Text.Printf.printf, and with some explicit type