I'd like to use automat as a core engine for web applications. It should
be able to hold state, as a state machine does :). However, I can only see
'forward' paths in automat (which is probably what a state machine is
about). Taking 'the short example' on the webpage:
> (def pages [:cart :checkout :cart])
#'pages
> (def page-pattern (vec (interpose (a/* a/any) pages)))
#'page-pattern
returns a state machine for a web shop (omitting the reducers for now,
since they don't matter). So, one can advance: :cart to :checkout, going
'forward' after a :cart-trigger again, saving some data and sending an
offer on the way. However, from the checkout, one should be able to 'go
back' to the cart, so to have a 'cyclic' path:
:checkout/:save
------------------->
/ :init :cart/:save / \
:cart/:offer,:save
----------> 0 ---------------> 1 2
----------------------> 3
\ /
<-------------------
:go-back/:revert
I can imagine something like:
:cart /
:offer,:save
-----------------------> 3
/ :init :cart/:save :checkout/:save /
----------> 0 ---------------> 1 ------------------> 2
\
-----------------------> 4
:go-back /
:revert
might be part of the solution: after step 4, advancing through a new finite
state machine to step 1 gives a similar model. However, I wouldn't like to
loose the data stored in step 4. So initializing the new finite state
machine is extremely important.
So... is this the right way of modelling this kind of 'reverse paths' (of
which I may have quite a few in my machines, so it may be not very elegant
to model it this way). How would I model this in automat? (Or should I
stick to what I do now, which is using core.async and a separate state map.)
Thx, qsys
--
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 posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.