On Tue, Feb 15, 2011 at 2:53 PM, MS <5lvqbw...@sneakemail.com> wrote: > Because I'm not sure how else to use (for example) a graph library and > still have it look like a circuit, rather than a graph.
Almost any such graph library is going to be a bunch of functions that operate on a data structure. Your circuit can be that data structure so you can simply use the functions on it. I suspect you're assuming a level of type checking, from statically typed OO languages, that just doesn't need to be there? > The specialization of changing the abstract thing > into the concrete thing is basically to reduce some of the graph > functionality (for example in a circuit a node can't have more than > one unique edge on it) and renaming things so they match the domain > (eg "vertex" become "node", "edge" become "net"), and add extra stuff > such as PCB layer, simulation model, etc. Sounds like you just need a set of functions that match your domain, which wrap the graph library (which in turn operates on the underlying graph data structure that represents your circuit). > Yes, I finally figured out how to have a cyclic structure using refs > and dosyncs. I was thinking of something much simpler - a pure data structure. > In clojure there is a defstruct... This is why I think you're trying to apply a strict type system which will get in the way of a simple solution. You want named types with specific behaviors because that's more like the OO you're used to? As an exercise, forget all about types. Imagine all you have are functions and simple data structures (vectors, sets and maps). Try to build the simplest possible thing that will work. -- Sean A Corfield -- (904) 302-SEAN Railo Technologies, Inc. -- http://getrailo.com/ An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood -- 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