[Haskell-beginners] Applicability of FP unchanging things to real world changing things

John Li jli at circularly.org
Sun Dec 13 00:04:29 EST 2009


On Sun, Dec 13, 2009 at 02:11:28AM +0000, Glurk wrote:
> What's got me a little puzzled at the moment is non mutable data.
[...]
> How do people see this kind of situation ?
> Is it just the way of looking at it... ?
> Do I just accept that I toss out my old library object, and have a new one, 
> which happens to be the same as the old one, except for the "new" book which 
> is now borrowed ?
> 
> Do I really need to get over thinking of objects in the first place, even 
> though it's what I see exist in the real world ?

Mutability perhaps more directly matches how we look at the world, in
which objects have states that change over time.

Purely functional programming doesn't allow mutating data in place, so
we have the "evolution" of an object through time. We get multiple
snapshots. I like to think of it as having 1 dimensional objects
instead of having 0 dimensional objects, in direct analogy to thinking
of objects in the world as being 4 dimensional: 3 spatial and 1 time
dimension.

Rich Hickey (the Clojure guy) gave a keynote talk about this kind of
thing: http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey

Here's an interview about the same thing:
http://www.artima.com/articles/hickey_on_time.html

I've only watched the keynote, which I found really interesting. Maybe
these will better help you get a grasp on a "functional" way of
thinking?


Hope that helps,
John


More information about the Beginners mailing list