Hi, I just (mostly) finished reading the Programming Clojure book and
while it gave a great overview of the language, I'm still at a loss
for how to design programs.

Maybe my mind has been polluted by OO concepts.

For example, I'm trying to figure out how to do polymorphism in FP.
Specifically, an electrical circuit "is a" type of graph (vertices and
nodes).  The book specifically says that multimethods are rare, so I'm
thinking I probably shouldn't immediately go to multimethods to do
what I want to do.

What I'm trying to figure out is how to take an abstract concept like
a graph G comprising vertices and edges (V, E), and then "derive" from
this a specific type of graph, specifically an electrical circuit.
I'm also greatly influenced by SICP, but I have yet to "get" how to do
anything really, other than play with small ideas.

In the electrical circuit, you can have the nets be the edges and the
vertices be the pins on a device.  In this case there is exactly one
edge per vertex, but there can be many vertices per edge.  Another way
is to have both nets and nodes be vertices in the graph, with edges
simple indicating a connection.  In an analog circuit there is no
directionality; in a digital circuit there is.  In any case I want an
edge to have a list of its vertices, and a vertex to know its edge.
It can be cyclic or acyclic.

Anyway, so suppose I find a graph library (I know they exist).  How do
I abstract the library into something that looks like a circuit, but
still be able to use the methods for the library?  In OO, suppose the
library class has something like "get-edges", but the circuit class
which derives from it, this method would be called because the circuit
"is a" type of graph.  The implementation of get-edges and the
internal structure of the graph class should be hidden from the user.

So how do I do this?

thanks
Michael


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