Re: Is still idiomatic the ant simulation code?

2014-07-28 Thread Yu Shen
What's the meaning of the following code: (([move #(turn % -1) #(turn % 1)] (wrand [(if (:ant @ahead) 0 (ranks ahead)) (ranks ahead-left) (ranks ahead-right)])) loc))) in https://www.refheap.com/paste/3099 from line 192 to 195? Sorry to bother

Re: Is still idiomatic the ant simulation code?

2014-07-28 Thread Gary Johnson
Hi Yu, This is a pretty dense (and IMHO non-idiomatic) piece of Clojure code. Without reading the paste you provided, I can at least tell you what appears to be happening here, given Clojure's evaluation semantics: 1. The [move ...] expression creates a vector of three functions. 2. The [(if

Re: Is still idiomatic the ant simulation code?

2014-07-28 Thread Yu Shen
Hi Gary, Your examination makes perfect sense in the context. Thanks for your help! Yu On Tue, Jul 29, 2014 at 8:01 AM, Gary Johnson gwjoh...@uvm.edu wrote: Hi Yu, This is a pretty dense (and IMHO non-idiomatic) piece of Clojure code. Without reading the paste you provided, I can at

Re: Is still idiomatic the ant simulation code?

2012-06-12 Thread Yann Schwartz
That's great. I've also noticed the sample still uses defstruct which is made obsolete by defrecord. On Tue, Jun 12, 2012 at 7:59 AM, Baishampayan Ghose b.gh...@gmail.comwrote: Can you elaborate some suggestions? I have updated the Ants sim code to use the idiomatic JVM inter-op constructs

Re: Is still idiomatic the ant simulation code?

2012-06-12 Thread Baishampayan Ghose
On Tue, Jun 12, 2012 at 1:37 PM, Yann Schwartz abolibibe...@gmail.com wrote: That's great. I've also noticed the sample still uses defstruct which is made obsolete by defrecord. While I agree that one could use a record in place of a struct, I don't think structs are obsolete, at least not

Re: Is still idiomatic the ant simulation code?

2012-06-12 Thread Meikel Brandmeyer (kotarak)
Hi, Am Dienstag, 12. Juni 2012 10:24:31 UTC+2 schrieb Baishampayan Ghose: While I agree that one could use a record in place of a struct, I don't think structs are obsolete, at least not officially. From http://clojure.org/datatypes: Overall, records will be better than structmaps for

Re: Is still idiomatic the ant simulation code?

2012-06-12 Thread Baishampayan Ghose
While I agree that one could use a record in place of a struct, I don't think structs are obsolete, at least not officially. From http://clojure.org/datatypes: Overall, records will be better than structmaps for all information-bearing purposes, and you should move such structmaps to

Re: Is still idiomatic the ant simulation code?

2012-06-11 Thread Alexey Kachayev
Guys, can you please share link where I can find the ants demo code? -- Alexey Kachayev, CTO at KitApp, Inc. On Friday, June 8, 2012 at 4:44 PM, Stuart Sierra wrote: The ants demo is definitely dated. It's not terrible, but the code could use some polishing/simplifying using newer

Re: Is still idiomatic the ant simulation code?

2012-06-11 Thread Curtis Gagliardi
Here's the video: http://blip.tv/clojure/clojure-concurrency-819147 and you can get the code here (ants.clj): http://www.lisptoronto.org/past-meetings/2009-05-clojure-ants-demo or here if you don't want to download it: https://www.refheap.com/paste/3096 On Jun 10, 8:00 am, Alexey Kachayev

Re: Is still idiomatic the ant simulation code?

2012-06-11 Thread Baishampayan Ghose
Can you elaborate some suggestions? I have updated the Ants sim code to use the idiomatic JVM inter-op constructs and made some other minor changes. Will work fine on Clojure 1.4 Here is the updated code - https://www.refheap.com/paste/3099 This is the unified diff -

Re: Is still idiomatic the ant simulation code?

2012-06-09 Thread JuanManuel Gimeno Illa
Can you elaborate some suggestions? Juan Manuel On Friday, June 8, 2012 3:44:16 PM UTC+2, Stuart Sierra wrote: The ants demo is definitely dated. It's not terrible, but the code could use some polishing/simplifying using newer additions to the language. -S -- You received this message

Re: Is still idiomatic the ant simulation code?

2012-06-08 Thread Stuart Sierra
The ants demo is definitely dated. It's not terrible, but the code could use some polishing/simplifying using newer additions to the language. -S -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Is still idiomatic the ant simulation code?

2012-05-29 Thread JuanManuel Gimeno Illa
I'm preparing an informal presentation about clojure concurrency and my plan is use the ant colony demo. Given the amount of changes in clojure since the time that code was written I wonder if the code is still idiomatic or parts of it should be adapted to modern clojure. Any ideas would be