I haven't used them much myself but the idea of "reified control flow" is 
called a continuation <https://en.wikipedia.org/wiki/Continuation>. Some 
other lisps implement continuations, Clojure does not. I'm sure there's 
plenty of material out there about why Clojure/Rich did not provide 
continuations.


On Monday, December 11, 2017 at 5:56:29 PM UTC-6, Stephen Feyrer wrote:
>
> Hi there,
>
> I have been trying to shake this thought for a while now.  Essentially, my 
> thought was if you can return a function why not decision component of an 
> IF, WHEN or SOME statement?  That would give you a re-usable named choice.
>
> Then you could write:
>
> (celebration: do-something do-something-else)
>
>
> This would be equivalent to writing:
>
> (def success [apples bananas pears])
>
> (defn celebration: [x y] (if (empty? success) x y))
>
> (celebration: (do-something do-something-else))
>
>
> I'm reasonably certain of the foolishness of this thought but 
> occasionally, I have doubts.
>
> Maybe I'm barking up the wrong tree or possibly I've seen something like 
> this before and forgotten about it.  Perhaps, this is just taking things 
> too far...  Either way, it's deferring the choice until it's needed.  In 
> the right hands it could make for more readable code.
>
> For completeness sake, to define the first form above you'd use:
>
> (defc celebration: (if (empty? success)))
>
>
> A more usable example might look like:
>
> (def nums [1 2 3 4 5 6 7 8])
>
> (defc even-nums: (some (even? nums)))
>
> I guess this makes the real question, is it a good thing to be able to 
> defer choice like this?
>
>
> Btw, defc would be like def-choice but other options might be deft - 
> def-test or defp - def-predicate.
>
>
> --
> Kind regards
>
> Stephen
>

-- 
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.

Reply via email to