Hi. I'm very new to Clojure, but I've read most of the functional 
programming tutorial <http://java.ociweb.com/mark/clojure/article.html>.

Suppose I have a data structure called "node" that can be in one of a 
number of different states -- namely, "down", "waiting", and "running". 
Suppose that in the "running" state, the node has a "job-id" number 
associated with it, but such a number is not applicable in the other two 
states. Should I add an extra field, and only check that field in the 
"running" state, like so...

(defstruct node :state :job-id)

Or is there some better, or more "clojure-ish", way to approach this?

If I was doing this in Haskell, I think that I would perhaps make some kind 
of algebraic "NodeState" data type, and have the JobId only attached to the 
Running constructor.

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to