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 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 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 least tell you

Code clinic: Idiomatic and performance; finding the closest match of words in two phases independent of order

2014-10-15 Thread Yu Shen
, and recur) a lot, but for readability and expressiveness, some of such loop structure could be more elegantly expressed as list expressions of filters, etc. I'd like to seek your advise, whether my following code could be improved in both purposes? Thanks a lot for your help! Yu Shen

Re: Code clinic: Idiomatic and performance; finding the closest match of words in two phases independent of order

2014-10-15 Thread Yu Shen
Here is the link to the gist for the code https://gist.github.com/yubrshen/63ffda973aff27d39868 On Wednesday, October 15, 2014 4:12:56 PM UTC+8, Yu Shen wrote: > > In the following code, I'm struggling to be idiomatic and at the same time > to consider save times of iterations. I