That is a very good explanation.
On Wednesday, October 12, 2011 at 6:28 PM, Kevin Downey wrote:
> refs, called as a function, try to call the value they hold as a
> function with the given arguments
>
> ((first @my-contacts) :fname) ~= (:fname @(first @my-contacts))
>
> basically you have tw
refs, called as a function, try to call the value they hold as a
function with the given arguments
((first @my-contacts) :fname) ~= (:fname @(first @my-contacts))
basically you have two levels of refs, but are only derefing once, but
by happy accident ((first @my-contacts) :fname) works
On Wed,
I was trying out an example from Practical Clojure and I don't
understand why I get different results below? Can someone enlighten
me?
user=> @my-contacts
[# # #]
user=> (:fname (first @my-contacts))
nil
user=> ((first @my-contacts) :fname)
"Luke"
Why would the placement of :fname change how it