Is it possible to have a structure nested in a structure in Clojure? Consider the following code:
(defstruct rect :height :width) (defstruct color-rect :color (struct rect)) (defn
Of course, this is a contrived example, but there are cases when I want to break a large data structure into smaller substructures in order to simplify the work with the code. Since the comments indicate that if I am making form 1, I get "249 zero zero", but if I am making form 2, I get "Too many arguments for constructor constructor".
If I approach this problem in a different way, tell me what I should do. A search in the Clojure google group showed nothing for me.
Edit:
I think I was not so clear in the statement of my question, as I thought I:
1.) Is it possible to decompose one structure inside another in Clojure? (Judging by the fact that yes.)
2.) If so, what will be the correct syntax? (Again, judging by the bottom, it looks like there are several ways to do this.)
3.) How do you get the value for the specified key when you have a structure nested in another structure?
I think that my sample code did not actually demonstrate what I was trying to do very well. I am adding this here so that others looking for it can more easily find this question and its answers.
struct clojure nested
Onorio catenacci
source share