On Mar 8, 11:57 pm, Adrian Cuthbertson <adrian.cuthbert...@gmail.com>
wrote:
> Hi Ivar,
>
> > ;; Do things such as hash-map comprehensions exist? Should they? ;-)
> > (defn some-eqn3 [obj]
> > (let [{:a a :b b :c c} obj]
> >   (/ (+ (- b) (sqrt (- (* b b) (* 4 a c))))
> >      (* 2 a))))
>
> At least a partial stab at some of your questions...
>
> (def myhash {:a 1 :b 5 :c 6 :x nil})
>
> (defn some-eqn3 [obj]
>   (let [{:keys [a b c]} obj]
>     (/ (+ (- b) (Math/sqrt (- (* b b)
>          (* 4 a c)))) (* 2 a))))
>
> (some-eqn3 myhash)
> -2.0
>
> Have a look athttp://clojure.org/special_forms, regarding
> destructured binding with let.

Great! I thought there must be something equivalent to WITH-SLOTS in
Clojure, I just hadn't run into it yet. Also, I think I am quite happy
without the mutability that WITH-SLOTS exposes as well...


Ivar

-- 
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 this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to