Re: Functional program design concepts

2011-02-18 Thread Stuart Sierra
For examples of polymorphism mixing Java and Clojure, try my article on Developer Works: http://www.ibm.com/developerworks/java/library/j-clojure-protocols/ -Stuart Sierra clojure.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: Functional program design concepts

2011-02-17 Thread MS
On Feb 15, 3:10 pm, Sean Corfield seancorfi...@gmail.com wrote: 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

Re: Functional program design concepts

2011-02-17 Thread MS
On Feb 15, 4:12 pm, James Reeves jree...@weavejester.com wrote: On 15 February 2011 22:53, MS 5lvqbw...@sneakemail.com wrote: So an electrical circuit is a data structure containing vertices and edges and describing how they are connected. Then you'll have some functions that operate on

Re: Functional program design concepts

2011-02-17 Thread MS
If your domain model can be represented by a simple vector / map / set, then you have a very rich set of tools (in Clojure) to operate on your domain model. If your domain model is represented by fixed types, you have to write all sorts of wrapper functions to be able to apply those

Functional program design concepts

2011-02-15 Thread MS
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,

Re: Functional program design concepts

2011-02-15 Thread Saul Hazledine
On Feb 15, 9:04 pm, MS 5lvqbw...@sneakemail.com wrote: 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. You'll get better answers later but here is my take on it. Maybe my

Re: Functional program design concepts

2011-02-15 Thread Raoul Duke
On Tue, Feb 15, 2011 at 1:07 PM, Saul Hazledine shaz...@gmail.com wrote: On Feb 15, 9:04 pm, MS 5lvqbw...@sneakemail.com wrote: Maybe my mind has been polluted by OO concepts. Maybe a combination of OO and static typing. for a functional take:

Re: Functional program design concepts

2011-02-15 Thread Raoul Duke
On Tue, Feb 15, 2011 at 1:12 PM, Raoul Duke rao...@gmail.com wrote: for a functional take: http://ac.aua.am/trietsch/web/Critical%20Path_Holistic%20Approach_final.pdf aw, crap. http://www.htdp.org/ is the link i really wanted to copy-paste. (i think the one i did paste is good reading if

Re: Functional program design concepts

2011-02-15 Thread Sean Corfield
On Tue, Feb 15, 2011 at 12:04 PM, MS 5lvqbw...@sneakemail.com wrote: Maybe my mind has been polluted by OO concepts. I was having this discussion on another list and it seems that the less OO folks know, the easier they find FP... so you may well be right :) For example, I'm trying to figure

Re: Functional program design concepts

2011-02-15 Thread Raoul Duke
On Tue, Feb 15, 2011 at 1:55 PM, Sean Corfield seancorfi...@gmail.com wrote: On Tue, Feb 15, 2011 at 12:04 PM, MS 5lvqbw...@sneakemail.com wrote: For example, I'm trying to figure out how to do polymorphism in FP. Why? because polymorphism makes code suck less, if done well. see typeclasses in

Re: Functional program design concepts

2011-02-15 Thread MS
Thanks, I have HTDP on my computer but after the first chapter I got distracted and have been meaning to get to itI'll look for my answers there! :) On Feb 15, 1:13 pm, Raoul Duke rao...@gmail.com wrote: On Tue, Feb 15, 2011 at 1:12 PM, Raoul Duke rao...@gmail.com wrote: for a functional

Re: Functional program design concepts

2011-02-15 Thread MS
Cool, thanks for the tips. More inline below: For example, I'm trying to figure out how to do polymorphism in FP. Why? 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. Specifically, an electrical circuit is a

Re: Functional program design concepts

2011-02-15 Thread Sean Corfield
On Tue, Feb 15, 2011 at 1:58 PM, Raoul Duke rao...@gmail.com wrote: because polymorphism makes code suck less, if done well. If polymorphism is the appropriate solution, yes. But for a lot of people steeped in OO thinking, polymorphism is a bit of a hammer for every problem that looks like a

Re: Functional program design concepts

2011-02-15 Thread Sean Corfield
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.

Re: Functional program design concepts

2011-02-15 Thread Raoul Duke
On Tue, Feb 15, 2011 at 3:03 PM, Sean Corfield seancorfi...@gmail.com wrote: If polymorphism is the appropriate solution, yes. But for a lot of people steeped in OO thinking, polymorphism is a bit of a hammer for every problem that looks like a nail. you might also sorta be saying that there

Re: Functional program design concepts

2011-02-15 Thread James Reeves
On 15 February 2011 22:53, MS 5lvqbw...@sneakemail.com wrote: So an electrical circuit is a data structure containing vertices and edges and describing how they are connected. Then you'll have some functions that operate on that data structure. So... how do I use someone else's implementation

Re: Functional program design concepts

2011-02-15 Thread Sean Corfield
On Tue, Feb 15, 2011 at 3:11 PM, Raoul Duke rao...@gmail.com wrote: you might also sorta be saying that there are lots of different kinds of polymorphism in programming, and that we need to know when to/not use any given form of it, which i'd agree with :-) We're probably in violent agreement,

Re: Functional program design concepts

2011-02-15 Thread Sean Corfield
There are two very interesting threads over on the Scala mailing lists at the moment that have some bearing on this thread - and I think illustrate the two very different ways of thinking about types and type systems: Benefits of static typing: