On Feb 16, 7:52 pm, samppi <rbysam...@gmail.com> wrote:
> You can nest structs in structs like this:
>
> (defstruct rect :height :width)
> (defstruct colored-rect :color :shape)
>
> (def subject (struct colored-rect :red (struct rect 50 30)))
>
> (println subject) ; prints {:color :red, :shape {:height 50, :width
> 30}}
>
> The defstruct macro takes a var and a bunch of keys for the struct.
> Trying to do:
>   (defstruct color-rect :color (struct rect))
> means you're trying to pass in a rectangle struct itself as a key.
>

Thank you samppi.  That's exactly what I was looking for.

--
Onorio
--~--~---------~--~----~------------~-------~--~----~
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
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