All the examples of defrecord I see seem simple enough and when I
experiment in the REPL I get things to work as they should.  However,
when I move to 'real' code I can't get it to work at all.

The problem at hand is simple enough - I want to create a record that
hold records.   For example I have (defrecord foo [list1, list2])
where list1 and list2 are defined records themselves.   The issue is
that the data in list1 and list2 is dynamic - it is loaded from a file
at run time.    So I do the following:

(def MyFoo (foo. nil nil))

(defn get-data [path]
   (let [list1Data (load-data-from-file path)]   ; fill in the record
for list 1
       (assoc MyFoo :list1 list1Data)              ; assign the data
record to the foo record
      (:list1 foo)
))

As I say, if I do this non-dynamically in the REPL I get the proper
result.

In my program (using let)  (:list1 foo) always remains nil.    What am
I doing wrong?   And how can I get the fields of foo to take on the
dynamic data.

Bill

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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