The title is not that great, but it is difficult to find a good one-liner :)
The question is the following. Given the declaration:
(def mystruct (create-struct :a :b :c))
is it possible to build an instance the following way (something similar, obviously):
(struct-map mystruct :a 1 :b 2 :c (inc (:b this)))
I managed to get something like this in the following bizzaro way:
(def mystructinst (struct-map mystruct :a 1 :b 2 :c (inc (:b mystructinst))))
But to be honest, I don't know why that worked. I thought mystructinst is only bound after the evaluation of the contained forms. Is this a clean way of performing this task? Is there any better one?
Thank you for your time.