[cells-devel] functional programming

Kenneth Tilton kentilton at gmail.com
Mon Mar 19 14:24:21 UTC 2012


On 3/18/2012 2:20 PM, Dan Lentz wrote:
> I'm an extreme newbie to cells and have just begun reviewing the
> literature so this may be a FAQ, but in general how does cells relate
> to "functional" programming practice?  My first reaction is that is
> seems antithetical, as it inherently introduces state and eliminates
> referential transparency. However if one looks at it as a declarative
> approach in making statements about relations, perhaps not. maybe it
> can therefore be used in a functional style along the same lines as
> standard clos/mop, which can also be considered stateful if evaluated
> at the level of the individual sub protocols etc.
>
> Really my question is "is cells something one should consider if
> otherwise one has worked hard to achieve functional style practices?"

I think you have it about right: Cell rules are nicely declarative and 
generally functional, but in the end Cells is all about managing a 
complex pile of application state representing <whatever real-world 
system we are modelling>. So, for example, the RoboCells implementation 
kept its own internal model of the game, with players and the ball 
modelled as CLOS instances. This model got updated as new sensory inputs 
were received. Sounds like "state" to me. :) That said, I imagine even 
functional programmers have to deal with long-lived models so maybe 
....a monad? Sorry, I wish I knew more about the functional game.

One thought that crosses my mind is Clojure with its functional state 
(if I have that right) and I know some folks over there were playing 
with implementing something Cells-ish in Clojure. Maybe chack in with 
those folks for thoughts from folks more functionally inclined than myself.

> ----
> Replace the method
> the carefully chosen name
> deletes the comment

Haha, I always love when during refactoring I come to a comment that is 
no longer needed because the comment was explaining something the 
refactoring fixed.

Best, ken





More information about the cells-devel mailing list