Re: What sorcery is this? (`reduced`, `reduced?`)

2017-04-25 Thread John Gabriele
Thanks, all! Luke, in `(source reduce)`, that code makes use of clojure.core.protocols/coll-reduce, which I see is in src/clj/clojure/core/protocols.clj. And although I haven't yet made sense of all that, I see that `coll-reduce` calls `seq-reduce`/`iter-reduce`, which in turn call

Re: What sorcery is this? (`reduced`, `reduced?`)

2017-04-25 Thread Alex Miller
The source for both functions is pretty simple (use the source!), although admittedly `reduced?` does some work to optimize perf that obscures it a little. `reduced` is used by a reducing function to indicate to the outer reducing process that a return value should end the reduce. It does this

Re: What sorcery is this? (`reduced`, `reduced?`)

2017-04-25 Thread Luke Burton
To add to Ivh's answer, the source code isn't too hard to follow here. Cursive makes this really easy because you can follow the source right into clojure.lang.RT, but you don't need to go that far to see how `reduced?` is used. You can see that all implementations of `reduce` in

Re: What sorcery is this? (`reduced`, `reduced?`)

2017-04-25 Thread lvh
Hi John, reduced really just wraps a value in a special container; nothing magical. All it does is signal to reduce to stop. reduce knows to stop by checking with reduced?. reduced? is otherwise extremely narrow-use: it's basically only useful if you're trying to write something like reduce but

What sorcery is this? (`reduced`, `reduced?`)

2017-04-25 Thread John Gabriele
Just recently stumbled upon `reduced` and `reduced?`. It seems rather magical... how does the outer `reduce` (or `reductions`) know to stop? That is, how does the function which is being called (`reduced`) affect the function that's calling it (below, `reductions`)? : ~~~clojure (defn main

CUFP 2017 Call for Tutorials

2017-04-25 Thread Runhang Li
Call for Tutorials Commercial Users of Functional Programming (CUFP) 2017 September 7th-9th, 2017, Oxford, United Kingdom Co-located with International Conference on Functional Programming (ICFP)

Re: [ANN] ClojureCUDA: a Clojure library for CUDA GPU computing

2017-04-25 Thread Jay Porcasi
it sounds great, thanks Jay On Tuesday, April 25, 2017 at 6:33:49 AM UTC+7, Dragan Djuric wrote: > > I'll write more in an introductory blog post in a day or two. Until that, > there is a website http://clojurecuda.uncomplicate.org, that has the > details and documentation. > > It is similar to