Transducers eduction vs sequence

2017-12-22 Thread Jonathon McKitrick
I have a `get-summary` function that builds stats and returns them as a web service. Under the hood, it calls quite a few map, group-by, filter, etc. functions. I’m experimenting with transducers, and `sequence xform` does the trick most of the time. But I want to understand `eduction` use

Re: Understanding remove-ns and require

2017-12-22 Thread Stuart Sierra
> > => CompilerException java.lang.Exception: namespace 'foo.bar' not found > after loading '/foo/bar', compiling:(*cider-repl foo*:65:7) > An error like this usually means that the ns declaration does not match the expected namespace name, based on the file path. Also be aware that

RE: Transducers eduction vs sequence

2017-12-22 Thread Sean Corfield
Their respective docstrings give a hint here: Sequence – “returns a lazy sequence”. Eduction – “returns a reducible/iterable …”. (type (sequence identity [1 2 3])) => clojure.lang.LazySeq (type (eduction identity [1 2 3])) => clojure.core.Eduction If you look at that cheshire.generate/generate

Re: Understanding remove-ns and require

2017-12-22 Thread Andy Fingerhut
If you do have namespace names that do not correspond with the file name they are placed in, in a Clojure/Java files, Eastwood can find them for you quickly. Eastwood doesn't analyze ClojureScript files, though. Andy https://github.com/jonase/eastwood On Fri, Dec 22, 2017 at 9:41 AM, Stuart

Re: Transducers eduction vs sequence

2017-12-22 Thread Francis Avila
Even though evaluation and realization of sequences is lazy, they cache their result after evaluation. If you consume an object from the `sequence` function more than once, the work is only done once. Sequences are iterable and reducible, but not as efficiently because of the caching and

Re: Transducers eduction vs sequence

2017-12-22 Thread Jonathon McKitrick
Ah, ok. I guess I was thrown off because evaluating sequence and eduction results both produce output at the REPL, but only sequence can be output as JSON at the REPL. On Friday, December 22, 2017 at 1:46:59 PM UTC-5, Sean Corfield wrote: > > Their respective docstrings give a hint here: > >

Re: Understanding remove-ns and require

2017-12-22 Thread Mikhail Gusarov
On Fri, 22 Dec 2017, at 18:41, Stuart Sierra wrote: > Also be aware that AOT-compilation[1] causes all sorts of havoc with > namespace reloading, because AOT-compiled .class files get read by a > different ClassLoader.> Is there any place explaining how exactly Clojure compiles and loads the