I'd love to be able to do this:
(defstruct person-s :name :gender)
(def name-a (accessor person-s :name))
(def gender-a (accessor person-s :gender))
(def person-1 (struct person-s Jane :female))
(let [{name name-a, gender gender-a, :as person} person-1]
(println name gender person))
On Jun 8, 2009, at 17:46, samppi wrote:
...I'd love it if the values of symbol keys could be any symbol, not
just keywords, so that the key symbol is bound to (val-symbol
the-map):
(let [{name this-is-a-symbol} person-1] ...) ; name is bound to
(this-is-a-symbol person-1)
It's
Oh, I didn't know that. It makes me wonder, then, why integers were
not implemented as functions of sequential collections: (3
[:a :b :c]).
Ah, well. I guess since let can't be changed, it's then a choice
between using accessors or being more elegant. Thanks for the reply.
On Jun 8, 9:25 am,