Thank you for that. I'm curious, when Stuart Sierra mentions a "sequence 
monad", does he offer this example simply to keep the Haskell programmers 
happy, or is he suggesting that Clojure programmers sometimes use this 
pattern? I am especially puzzled by this code that he offers, since this 
does not resemble anything that I am familiar with: 


(defn chain-consequences [initial-state consequence-fns]
  (loop [state   initial-state
         fs      consequense-fns
         output  []]
    (if (seq fs)
      (let [events     ((first fs) state)
            new-state  (reduce update-state state events)]
        (recur new-state (rest fs) (into output events)))
    output)))
         





On Sunday, May 24, 2015 at 11:11:03 AM UTC-4, tbc++ wrote:
>
> Almost any event-sourcing system is built like this. Datomic is 
> (more-or-less) an example of this as it tracks all past transactions and 
> keeps indexes that are aggregates of the entire state of the DB. 
>
> In addition, Greg Young introduced a event store at CodeMesh 2013 that 
> uses this model: https://vimeo.com/84314441
>
> Timothy
>
> On Sat, May 23, 2015 at 10:15 PM, <[email protected] <javascript:>> 
> wrote:
>
>> I am watching this video, Stuart Sierra's 2012 talk about Functional 
>> Design Patterns: 
>>
>> http://www.infoq.com/presentations/Clojure-Design-Patterns
>>
>> His description of event sourcing for functional programming emphasizes: 
>> ---- recreate past states
>> ---- recreate any past state by reducing over events
>> ---- just store the inputs
>> ---- cache any intermediate state
>> ---- lost of flexibility
>> ---- every event to the system is a data structure
>> ---- problem: perhaps too many data structures
>>
>>
>> I'm curious where is this pattern actually used? 
>>
>>
>>
>>
>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to [email protected] 
>> <javascript:>
>> 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] <javascript:>
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> “One of the main causes of the fall of the Roman Empire was that–lacking 
> zero–they had no way to indicate successful termination of their C 
> programs.”
> (Robert Firth) 
>  

-- 
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/d/optout.

Reply via email to