Re: Correct mapping from Lisp to Clojure?

2010-01-18 Thread Richard Newman
defvar defparamater def, pretty much. (Some of the niceties of CL semantics don't really apply.) let* let. defconstant No equivalent. Use def and allow the JIT to do the "is this constant?" work. mapcar map. -- You received this message because you are subscribed to the Googl

Re: Lazy recursive walk.

2010-01-18 Thread Nicolas Buduroi
On Jan 18, 10:55 pm, Tom Hicks wrote: > Hey, congratulations on finding and fixing the problem! > > And thanks for the great link to the zipper explanationzippers > were > at the top of my list to learn (seriously). Did you catch this other > useful > link (in the comments of the article you p

Re: Correct mapping from Lisp to Clojure?

2010-01-18 Thread Sean Devlin
Did you watch Rich's video "Clojure for Lispers"? That might help (The only one I can answer for sure is that Clojure's let is CL's let*) http://blip.tv/file/1313398 On Jan 18, 10:49 pm, Conrad Taylor wrote: > Hi, I'm starting to convert some code over from Lisp to Clojure. > Thus, I was wonde

Correct mapping from Lisp to Clojure?

2010-01-18 Thread Conrad Taylor
Hi, I'm starting to convert some code over from Lisp to Clojure. Thus, I was wondering, what's the appropriate mapping for the following forms: defvar defparamater let* defconstant mapcar BTW, I was able to find the "Clojure Programming Tutorials and Tips" but it didn't require the above forms.

clojure box 1.0 failed to connect to emacs server

2010-01-18 Thread limux
when i start the clojure box 1.0, the emacs client window stay on the top of all the other windows, eventually it display a message "** ERROR ** Timeout wating for server", but 1.0RC1 no that issue. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To p

Re: Couverjure: an attempt at a direct bridge between Clojure and Cocoa

2010-01-18 Thread xster
On Jan 17, 11:51 pm, Mark Allerton wrote: > Hi all, > > I've been hacking on a bridge between Clojure and Cocoa, and have been > prompted to break cover by recent discussion of the subject of Objective-C > interfacing here on this list. This is fantastic! In you README.md, you provide the rea

Re: Good "refs" on concurrency?

2010-01-18 Thread David Beckwith
And btw, thanks Erik, Gene, and Abhi for your suggestions! I'll look at those. David :) On Jan 18, 6:14 am, Erik Price wrote: > On Sat, Jan 16, 2010 at 7:02 PM, David Beckwith > > wrote: > > Can you guys recommend any good books, articles or code on > > concurrency?  I'm new to concurrency iss

Re: Good "refs" on concurrency?

2010-01-18 Thread David Beckwith
By the way, I made the suggestion to publish a "concurrency" specific book to Pragmatic Studios, and surprisingly Dave Thomas (of Ruby-world fame: http://pragprog.com/titles/rails2/agile-web-development-with-rails ) wrote back and agreed. He said that he's looking for an author. (See below.) So,

Re: hash literal oddity?

2010-01-18 Thread Timothy Pratley
Here is the previous discussion about duplicate keys in arraymaps, just for reference: http://groups.google.com/group/clojure/browse_thread/thread/5a38a6b61b09e025 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clo

Re: Why "recur"?

2010-01-18 Thread Timothy Pratley
2010/1/18 Alex Ott > But this will not allow to jump to outer loop from inside of inner loop... > > If you require mutual recursion, letfn might be your answer See example here: http://groups.google.com/group/clojure/browse_thread/thread/a7aad1d5b94db748 -- You received this message because you

Re: hash literal oddity?

2010-01-18 Thread Stuart Halloway
=> {1 "this", 1 "is", 1 "strange"} The literal representation is just blasted into an array map when the number of entries are below a certain threshold (8 maybe). I think the general view is that a literal with duplicate keys is the error and to check for dups would sacrifice speed. The firs

Re: Lazy recursive walk.

2010-01-18 Thread Tom Hicks
Hey, congratulations on finding and fixing the problem! And thanks for the great link to the zipper explanationzippers were at the top of my list to learn (seriously). Did you catch this other useful link (in the comments of the article you provided)? http://okmij.org/ftp/Computation/Continua

Re: hash literal oddity?

2010-01-18 Thread Fogus
> This uses a regular hash map. No it doesn't apparently... it uses conj instead. -m -- 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

Re: hash literal oddity?

2010-01-18 Thread ataggart
On Jan 18, 6:46 pm, Stuart Halloway wrote: > Is this expected behavior? > > {1 "this" 1 "is" 1 "strange"} > => {1 "this", 1 "is", 1 "strange"} This can only happen with literal maps containing 8 or fewer entries. Rich has commented on it elsewhere. -- You received this message because you are

Re: hash literal oddity?

2010-01-18 Thread Fogus
> => {1 "this", 1 "is", 1 "strange"} The literal representation is just blasted into an array map when the number of entries are below a certain threshold (8 maybe). I think the general view is that a literal with duplicate keys is the error and to check for dups would sacrifice speed. > (into {

Re: hash literal oddity?

2010-01-18 Thread Kevin Downey
what you are seeing is the transition from arraymap to hashmap On Mon, Jan 18, 2010 at 6:46 PM, Stuart Halloway wrote: > Is this expected behavior? > > {1 "this" 1 "is" 1 "strange"} > => {1 "this", 1 "is", 1 "strange"} > > (into {} {1 "this" 1 "is" 1 "strange"}) > => {1 "strange"} > > {1 "this" 1

hash literal oddity?

2010-01-18 Thread Stuart Halloway
Is this expected behavior? {1 "this" 1 "is" 1 "strange"} => {1 "this", 1 "is", 1 "strange"} (into {} {1 "this" 1 "is" 1 "strange"}) => {1 "strange"} {1 "this" 1 "is" 1 "strange" 1 "but" 1 "if" 1 "I" 1 "try" 1 "hard" 1 "enough"} => {1 "enough"} Stu -- You received this message because

Re: Case-insensitive map?

2010-01-18 Thread Richard Newman
I haven't looked at how hard this would be to implement in Clojure; it would be nice if there was those features (let me specify how to hash keys, let me specify how to compare keys). PersistentHashMap calls Util.hash(key), which calls key.hashCode(). You could use fnmap to replace input String

Re: Lazy recursive walk.

2010-01-18 Thread Nicolas Buduroi
I've now changed my test method to this. (def pit (iterate list "bottom!")) (defn get-bottom [p] (loop [p (first p)] (if (seq? p) (recur (first p)) p))) (defn test-walk [walker shallowest deepest] (doseq [depth (range shallowest deepest)] (println (get-bottom (walker #

Re: Case-insensitive map?

2010-01-18 Thread Howard Lewis Ship
Tapestry 5 includes a case-insenstive Map and the basic idea can be adapted. It was important to that code base that the case of keys be kept, but that lookup by key be case insensitive. The hash code is based on a case normalized version of the true key, and comparisons are based on equalsIgnoreCa

Re: Lazy recursive walk.

2010-01-18 Thread Nicolas Buduroi
I've found the real problem. The overflow was coming from recursion between pr-on and print-method. It must be that way because it's not really useful to print such deeply nested data structure anyway. On Jan 18, 7:06 pm, Nicolas Buduroi wrote: > On Jan 16, 7:33 pm, Laurent PETIT wrote: > > > Fo

Re: Lazy recursive walk.

2010-01-18 Thread Nicolas Buduroi
On Jan 16, 7:33 pm, Laurent PETIT wrote: > For the non lazy version , maybe using clojure.zip would help not blow > up the stack ? > > (using clojure.zip/zip + a loop with recur on clojure.zip/next) ? I've just tried it and it appears to be equivalent to the lazy walk version, which I think is fu

Re: Manual Installation (not using ELPA) of swank-clojure

2010-01-18 Thread Brent Millare
The basic install prerequisites are emacs, slime, java, and git. On Jan 18, 6:22 pm, Mark Hamstra wrote: > Does "from scratch" assume Slime is already installed? > > On Jan 18, 4:42 pm, Brent Millare wrote: > > > I made a write up of my experiences setting up swank-clojure from > > scratch. Alth

Re: Manual Installation (not using ELPA) of swank-clojure

2010-01-18 Thread Mark Hamstra
Does "from scratch" assume Slime is already installed? On Jan 18, 4:42 pm, Brent Millare wrote: > I made a write up of my experiences setting up swank-clojure from > scratch. Although my method ignores matching the versions up because > all is built from the current sources (which can potential

Re: StackOverflowError possible with seq ?

2010-01-18 Thread mudphone
Hi Robert, Thanks for your reply! Very interesting. I see what you're saying. But, your code results in a OutOfMemoryError, rather than a StackOverflow. At least, that's what I see on my machine. Are you seeing the same? Is there some way that this same concept could lead to a StackOverflow?

Re: infinite loop print out of cyclic structure at repl

2010-01-18 Thread Raoul Duke
> Mark > Chouser thanks, all. -- 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 t

Re: Case-insensitive map?

2010-01-18 Thread pmf
On Jan 18, 1:59 pm, Laurent PETIT wrote: > There's a library in clojure.contrib which allows to create your own > getters / setters for maps : > > http://richhickey.github.com/clojure-contrib/fnmap-api.html Not wanting to interrupt this thread, but this is amazing! I could have used this a dozen

Re: infinite loop print out of cyclic structure at repl

2010-01-18 Thread Chouser
> On Jan 18, 4:22 pm, Raoul Duke wrote: >> hi, >> >> hmmm, i wish there were a way (or that it was the default) to tell the >> repl to not continue to loop for ever over things it has already >> "printed" out when i eval something that is a cyclic thing. anybody >> have a patch, or thought on this

Manual Installation (not using ELPA) of swank-clojure

2010-01-18 Thread Brent Millare
I made a write up of my experiences setting up swank-clojure from scratch. Although my method ignores matching the versions up because all is built from the current sources (which can potential cause parts of swank to break), it should at least point in the generally right direction. Hopefully this

Re: infinite loop print out of cyclic structure at repl

2010-01-18 Thread Mark Hamstra
See *print-length* and *print-level* in the core API. On Jan 18, 4:22 pm, Raoul Duke wrote: > hi, > > hmmm, i wish there were a way (or that it was the default) to tell the > repl to not continue to loop for ever over things it has already > "printed" out when i eval something that is a cyclic t

Re: Case-insensitive map?

2010-01-18 Thread C. Florian Ebeling
>> Is there a good way to make a map case-insensitive for string keys? I >> first thought just wrapping some function around it would be it, but >> when I try it, it is really a bit more involved. Has anyone done this, >> or is there a recommended way? > > Do you want real case-insensitivity (i.e.,

infinite loop print out of cyclic structure at repl

2010-01-18 Thread Raoul Duke
hi, hmmm, i wish there were a way (or that it was the default) to tell the repl to not continue to loop for ever over things it has already "printed" out when i eval something that is a cyclic thing. anybody have a patch, or thought on this? thanks! -- You received this message because you are s

Re: Why "recur"?

2010-01-18 Thread Sean Devlin
I'm confused. Shouldn't the inner loop have the proper conditionals to break out of itself properly instead? On Jan 18, 8:48 am, Alex Ott wrote: > Re > > Konrad Hinsen  at "Mon, 18 Jan 2010 12:23:58 +0100" wrote: >  KH> On 18.01.2010, at 12:03, Alex Ott wrote: > >  >> I have a question to Rich -

Interested in creating a Clojure course

2010-01-18 Thread Michael Kohl
Hi all, I'm one of the assistant teachers at RubyLearning (http://rubylearning.org), a site offering free/cheap Ruby courses which are generally quite well-received and we all do this as volunteers without any monetary interest (the paid courses are there to finance the site). More info can be fou

Re: (* BigDecimal double) should result in BigDecimal, not in Double, isn't it?

2010-01-18 Thread Richard Newman
Something like replacing the 1.1 with 1.1M or 11/10 before evaluating the code? I don't think so. The very first step of Clojure's expression processing system, the reader, already interprets 1.1 as a floating- point constant. You would need your own reader to give a different meaning to th

Re: Case-insensitive map?

2010-01-18 Thread Richard Newman
Is there a good way to make a map case-insensitive for string keys? I first thought just wrapping some function around it would be it, but when I try it, it is really a bit more involved. Has anyone done this, or is there a recommended way? Do you want real case-insensitivity (i.e., you preserve

Re: StackOverflowError possible with seq ?

2010-01-18 Thread kirschkernkissen
Hi Kyle! I encountered the same problem: (defn stack-fail "returns an empty lazy seq" [l i] (if (> i 0) (recur (remove #{1} (concat l '(1))) (dec i)) l)) (def foo (stack-fail () 1000)) foo ; Evaluation aborted. if you call a non-lazy function (e.g. doall) on the collection from t

Re: Clojure on Ideone!

2010-01-18 Thread cej38
Hi, This is interesting. I have often wanted something like this. Is there a way to access clojure.contrib? Thanks -- 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 n

Re: Good "refs" on concurrency?

2010-01-18 Thread Erik Price
On Sat, Jan 16, 2010 at 7:02 PM, David Beckwith wrote: > Can you guys recommend any good books, articles or code on > concurrency?  I'm new to concurrency issues, and just finished the > Halloway book, so it would be great to have an introductory reference > with lots of examples of how to make y

Re: Good "refs" on concurrency?

2010-01-18 Thread Erik Price
On Sat, Jan 16, 2010 at 7:02 PM, David Beckwith wrote: > Hi, > > Can you guys recommend any good books, articles or code on > concurrency?  I'm new to concurrency issues, and just finished the > Halloway book, so it would be great to have an introductory reference > with lots of examples of how to

Re: Why "recur"?

2010-01-18 Thread Alex Ott
Re Konrad Hinsen at "Mon, 18 Jan 2010 12:23:58 +0100" wrote: KH> On 18.01.2010, at 12:03, Alex Ott wrote: >> I have a question to Rich - are there plans to introduce "named" >> loop/recur? In Scheme it very handy to create named let, and create nested >> loops. Currently in Clojure, I need

Re: (* BigDecimal double) should result in BigDecimal, not in Double, isn't it?

2010-01-18 Thread Konrad Hinsen
On 17.01.2010, at 23:13, Jevgeni Holodkov wrote: decimal. Entered 0.1 is actually a very precise number and the fact that it gets imprecise somewhere internally should now affect, IMHO, the result of multiplying two very precise numbers. What's the point There is no such thing as a "precise" o

Re: Good "refs" on concurrency?

2010-01-18 Thread Gene Tani
On Jan 16, 4:02 pm, David Beckwith wrote: > Hi, > > Can you guys recommend any good books, articles or code on > concurrency?  I'm new to concurrency issues, and just finished the > Halloway book, so it would be great to have an introductory reference > with lots of examples of how to make your

Re: (* BigDecimal double) should result in BigDecimal, not in Double, isn't it?

2010-01-18 Thread Jevgeni Holodkov
Hi Ben, thanks for the answer. Yes, I understand the problems with representing float-point numbers using iee7654 and now I understand that returing BigDecimal would not solve the actual problem. However, we don't talk about 0.3(3) in my example, which is non-terminating decimal. Entered 0.1 is

Re: Case-insensitive map?

2010-01-18 Thread Laurent PETIT
There's a library in clojure.contrib which allows to create your own getters / setters for maps : http://richhickey.github.com/clojure-contrib/fnmap-api.html HTH, -- Laurent 2010/1/18 C. Florian Ebeling : > Is there a good way to make a map case-insensitive for string keys? I > first thought j

Re: Why "recur"?

2010-01-18 Thread Martin Coxall
On 18 Jan 2010, at 11:23, Konrad Hinsen wrote: On 18.01.2010, at 12:03, Alex Ott wrote: I have a question to Rich - are there plans to introduce "named" loop/recur? In Scheme it very handy to create named let, and create nested loops. Currently in Clojure, I need to split nested loop

Re: Why "recur"?

2010-01-18 Thread Konrad Hinsen
On 18.01.2010, at 12:03, Alex Ott wrote: I have a question to Rich - are there plans to introduce "named" loop/recur? In Scheme it very handy to create named let, and create nested loops. Currently in Clojure, I need to split nested loop into separate function, that not so often good Ne

Re: Clojure on Ideone!

2010-01-18 Thread Alen Ribic
I've been toying around something similar. Here is a rough preview: http://preview.xpojure.com/snippet/view/2/ -Alen On Mon, Jan 18, 2010 at 1:02 PM, Steve Purcell wrote: > For those who didn't click through, this is a really nifty code paste site > that will actually run your pasted code and

Re: Clojure on Ideone!

2010-01-18 Thread Steve Purcell
For those who didn't click through, this is a really nifty code paste site that will actually run your pasted code and display the output next to the paste. Worth a look; it's a nice piece of work. -Steve On 15 Jan 2010, at 21:23, sphere research wrote: > Hi, > > test Clojure on ideone.com

Re: Why "recur"?

2010-01-18 Thread Alex Ott
Hello all I have a question to Rich - are there plans to introduce "named" loop/recur? In Scheme it very handy to create named let, and create nested loops. Currently in Clojure, I need to split nested loop into separate function, that not so often good -- With best wishes, Alex Ott, MBA http

Re: Couverjure: an attempt at a direct bridge between Clojure and Cocoa

2010-01-18 Thread David Nolen
Very cool. On Mon, Jan 18, 2010 at 8:51 AM, Mark Allerton wrote: > Hi all, > > I've been hacking on a bridge between Clojure and Cocoa, and have been > prompted to break cover by recent discussion of the subject of Objective-C > interfacing here on this list. > > The code is strictly "demo" or "p

Case-insensitive map?

2010-01-18 Thread C. Florian Ebeling
Is there a good way to make a map case-insensitive for string keys? I first thought just wrapping some function around it would be it, but when I try it, it is really a bit more involved. Has anyone done this, or is there a recommended way? Florian -- Florian Ebeling florian.ebel...@gmail.com --

Re: (* BigDecimal double) should result in BigDecimal, not in Double, isn't it?

2010-01-18 Thread Lauri Oherd
On page http://clojure.org/data_structures#toc2 there is written: "Any numeric operation involving Doubles yields a Double." Hope this helps, Lauri On Sun, Jan 17, 2010 at 12:13 AM, Jevgeni Holodkov wrote: > Currently, if the result of the multiplication is too small, then the > type will be dou