Hey, I've been playing with Flow and I really dig it so far! To better
explain what makes this different form "just another cells lib" you should
expound upon the Stream abstraction - maybe show an example in the readme
where you use a chan instead of an atom? Great work though, overall it
definitely has the lego-esque granularity required to be a powerful tool.


On Mon, May 26, 2014 at 7:30 AM, James Henderson <[email protected]> wrote:

> Hi all,
>
> I’ve just released v0.1.0 of ‘Flow’ - a new library to help you write
> dynamic ClojureScript applications in a simple, declarative style.
>
> Fundamentally, it does this by extending the behaviour of Clojure’s let
>  and for constructs to handle changing inputs, but allowing you to write
> pure, value → value functions as you would if the inputs were static.
>
>
> For example, if you were to design an counter widget based on a static
> counter value, you might write something like:
>
> (:require-macros [dommy.macros :refer [node]])
> (defn counter-widget [counter]
>   (node
>    [:p "The counter is currently at " counter]))
>
> To make this dynamic, using Flow, we’d write something like:
>
> (:require [flow.core :refer-macros [el<< let<<]])
> (defn counter-widget [counter-atom]
>   (el<<
>     (let<< [counter (<< counter-atom)]
>       (node
>         [:p "The counter is currently at " counter]))))
>
> I would probably read this function as:
>
> given that counter comes from (<<) counter-atom, give me a dynamic
> element that reads “The counter is currently at <counter>”
>
>
> Flow also has a for<< macro, with predictable semantics. Assuming I have
> a contact list atom containing
>
> [{:first "Rich"
>   :last "Hickey"}
>  {:first "Martin"
>   :last "Odersky"}
>  {:first "James"
>   :last "Gosling"}]
>
> if you’d write this statically as:
>
> (defn contacts-widget [contacts]
>   (node
>     [:ul
>      (for [{:keys [first last]} (sort-by :last contacts)]
>        (node
>          [:li last ", " first]))]))
>
> then you can render this as a dynamic widget with the following Flow code:
>
> (:require [flow.core :refer-macros [el<< for<<]])
> (defn contacts-widget [contacts-atom]
>   (node
>     [:ul
>      (el<<
>        (for<< [{:keys [first last]} (sort-by :last (<< contacts-atom))]
>          (node
>            [:li last ", " first])))]))
>
> Flow will then update the contact list whenever the contacts atom is
> changed.
>
>
> I’d be grateful of any feedback/suggestions you have - please let me know,
> either on here, on GitHub <https://github.com/james-henderson/flow> or
> @jarohen <https://twitter.com/jarohen>.
>
> Thanks!
>
> James
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to