On Nov 30, 2013, at 10:39 AM, Sam Ritchie <[email protected]> wrote:
> Brian, I like that too. It looks like you're providing the state when you do
> the def-action?
If I understand the question right, yes. A test of a state function would look
like:
(fact
(incrementer {:value 1} 3) => {:value 4}))
> Is the "self" variable "state", captured through the closure?
`self` is the agent, whose dereference is passed in as the symbol named `state`.
That part I'm uncomfortable with. I've put each agent in a namespace with its
action functions. The convention is that the agent is named `self`, and
`def-action` knows that convention. It works, but it reminds me too much of
singletons and all those cases where you start out thinking a single instance
is all you'll ever need and then discover you were wrong.
--------
Latest book: /Functional Programming for the Object-Oriented Programmer/
https://leanpub.com/fp-oo
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.