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

Re: Functional program design concepts

2011-02-17 Thread MS
On Feb 15, 4:12 pm, James Reeves 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 that data s

Re: Functional program design concepts

2011-02-17 Thread MS
On Feb 15, 3:10 pm, Sean Corfield 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 is going to be

Re: Functional program design concepts

2011-02-15 Thread Laurent PETIT
2011/2/16 Sean Corfield > On Tue, Feb 15, 2011 at 3:11 PM, Raoul Duke 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 probabl

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: http://groups.google.com/group/scala-debate/browse_th

Re: Functional program design concepts

2011-02-15 Thread Sean Corfield
On Tue, Feb 15, 2011 at 3:11 PM, Raoul Duke 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, yeah :) I th

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 imple

Re: Functional program design concepts

2011-02-15 Thread Raoul Duke
On Tue, Feb 15, 2011 at 3:03 PM, Sean Corfield 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 are lots of different

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 structur

Re: Functional program design concepts

2011-02-15 Thread Sean Corfield
On Tue, Feb 15, 2011 at 1:58 PM, Raoul Duke 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 nail. I don't find

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 circu

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 wrote: > On Tue, Feb 15, 2011 at 1:12 PM, Raoul Duke wrote: > > for a functional take: > >http://ac.aua.am/triet

Re: Functional program design concepts

2011-02-15 Thread Raoul Duke
On Tue, Feb 15, 2011 at 1:55 PM, Sean Corfield 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 haskell for an

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 figur

Re: Functional program design concepts

2011-02-15 Thread Raoul Duke
On Tue, Feb 15, 2011 at 1:12 PM, Raoul Duke 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 you are a proce

Re: Functional program design concepts

2011-02-15 Thread Raoul Duke
On Tue, Feb 15, 2011 at 1:07 PM, Saul Hazledine 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: http://ac.aua.am/trietsch/web/Critical%20Path_Holistic%20Appr

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

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

Re: Program design

2010-08-19 Thread Nicolas Oury
A big part of inheritance can be done by using defrecord, keywords and functions instead of method, and getting read of the abstract class. (defrecord Orange [:mass :energy :juice]) (defrecord Apple [:mass :energy :juice : family]) (defn get-juice [fruit] (:juice fruit)) -- You received this

Re: Program design

2010-08-19 Thread Mark Engelberg
On Wed, Aug 18, 2010 at 5:20 PM, Patrick Moriarty wrote: > You should look at Clojure 1.2 protocols and records which provides an easy > way to do polymorphism on types. > See http://clojure.org/protocols. Protocols don't offer inheritance. The original poster specifically mentioned porting code

Re: Program design

2010-08-19 Thread Patrick Moriarty
You should look at Clojure 1.2 protocols and records which provides an easy way to do polymorphism on types. See http://clojure.org/protocols. On 18 August 2010 08:25, Mark Engelberg wrote: > I think the easiest way to port OO code would be to use Clojure's > multimethods, dispatching on the ty

Re: Program design

2010-08-18 Thread Mark Engelberg
I think the easiest way to port OO code would be to use Clojure's multimethods, dispatching on the type of the first argument. -- 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 post

Program design

2010-08-18 Thread prishvin
Dear Friends, I am thinking about porting my existing program to clojure. Is there any way of designing equivalents to classes with simple inheritance? For e.g. if I have base class fruit and derived classes apple and orange. The OOP design gives me a possibility to handle those object in the same

Re: Questions about program design

2010-04-28 Thread Andrew Brookins
On Tue, Apr 27, 2010 at 10:21 AM, Miki wrote: > Hello Andrew, > >> So, for people like me, can any of you suggest some transcribed >> lectures, screencasts, books, blog posts, or other errata that discuss >> the difference between program design in a language like Cloju

Re: Questions about program design

2010-04-27 Thread Miki
Hello Andrew, > So, for people like me, can any of you suggest some transcribed > lectures, screencasts, books, blog posts, or other errata that discuss > the difference between program design in a language like Clojure and > an OO language like Ruby or Java? Two books that helped

Re: Questions about program design

2010-04-26 Thread Andrew Brookins
On Mon, Apr 26, 2010 at 5:49 AM, Paul Drummond wrote: > Hi Andrew, > > It's getting old now but you mind find this helpful: > > http://groups.google.com/group/clojure/browse_thread/thread/6333791e49fbca7f/c724f1681dac3102?lnk=gst&q=drummond#c724f1681dac3102 > > and this: > > http://clojure.org/sta

Re: Questions about program design

2010-04-26 Thread Paul Drummond
ell. While a lot > of Clojure really hits home with me, a nagging voice in my head says, > "These are just blobs of functions divided by namespaces..." > > So, for people like me, can any of you suggest some transcribed > lectures, screencasts, books, blog posts, or other err

Questions about program design

2010-04-26 Thread Andrew Brookins
head says, "These are just blobs of functions divided by namespaces..." So, for people like me, can any of you suggest some transcribed lectures, screencasts, books, blog posts, or other errata that discuss the difference between program design in a language like Clojure and an OO langua