On 25 February 2010 03:57, pthatcher wrote:
[...]
> (defn count-from [start]
> (iterate inc start))
>
> ; like python
> (defn zip [& lists]
> (apply map vector lists))
>
> ; like python
> (defn enumerate [vals]
> (zip (count-from 0) vals))
[...]
By the way, there's an implementation of "enumer
On Wed, Feb 24, 2010 at 8:57 PM, pthatcher wrote:
> Ouch. Burned by documented behavior :). Thanks for pointing that
> out.
>
> Seriously, though, I'm not the last that will get confused by this.
> My suggestion would be to make (case) copy the value from the *var* at
> compile time and use that
Ouch. Burned by documented behavior :). Thanks for pointing that
out.
Seriously, though, I'm not the last that will get confused by this.
My suggestion would be to make (case) copy the value from the *var* at
compile time and use that. In fact, I decided to do just that and
created (case-eval).
On Feb 23, 2010, at 8:47 PM, pthatcher wrote:
I noticed a funny bug in Clojure 1.2's case macro. It doesn't work
with *vars*. For example:
(def *a* "a")
;this is true
(case "a"
"a" true
false)
;but this is false!
(case "a"
*a* true
false)
If you read the first line or two of the docs for