This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-23
Channels
- # aleph (9)
- # beginners (30)
- # boot (42)
- # carry (1)
- # cider (148)
- # clara (2)
- # cljsrn (13)
- # clojars (2)
- # clojure (90)
- # clojure-dev (1)
- # clojure-dusseldorf (2)
- # clojure-italy (7)
- # clojure-madison (1)
- # clojure-quebec (1)
- # clojure-russia (19)
- # clojure-sg (1)
- # clojure-spec (14)
- # clojure-uk (90)
- # clojurebridge (1)
- # clojurescript (70)
- # clr (7)
- # core-async (24)
- # cursive (26)
- # data-science (2)
- # datascript (3)
- # datomic (46)
- # devops (2)
- # emacs (6)
- # events (1)
- # figwheel (2)
- # hoplon (200)
- # klipse (2)
- # ldnclj (1)
- # lein-figwheel (4)
- # leiningen (3)
- # off-topic (44)
- # om (70)
- # other-languages (6)
- # pedestal (5)
- # protorepl (1)
- # re-frame (17)
- # reagent (14)
- # schema (2)
- # spacemacs (1)
- # specter (3)
- # test-check (38)
- # unrepl (38)
- # untangled (19)
- # yada (16)
in that ring buffer code @noisesmith linked to, what’s the purpose of the lazy-seq
here:
Object
(toString [this]
(pr-str (lazy-seq (seq this))))
Honestly, I don't know I'd think str of seq would suffice
@iluk true?
returns true only if param is a single true
value (using identical
) - see doc and source. you'll get the same result if you create a new Boolean instance:
filter and remove doesn't work on my collection which consists from those kind of 'true"s
I read about reducers and transducers the other day. Of course they make perfect sense, and also exist in other languages, sometimes at the core.
Why or when however, should we ever opt for reducers rather than transducers, at present time?
@matan see here: https://www.reddit.com/r/Clojure/comments/5lhz7q/seq_functions_reducers_transducers_when_do_i_use/dbw3fph/
It's an answer by Alex Miller, so pretty authoritative I would say
@matan by the way, in what other languages have you seen transducers ?
@val_waeselynck and @alexmiller thanks! this kind of clears it up!! 🙂 maybe I'll grab a copy of https://www.amazon.com/Clojure-Applied-Practitioner-Ben-Vandgrift/dp/1680500740, hopefully the kindle version is readable on a kindle device, with non-prose you never know 😩
What else I didn't get about transducers is the fine print at https://clojure.org/reference/transducers > If you have a new context for applying transducers, there are a few general rules to be aware of: > • If a step function returns a reduced value, the transducible process must not supply any more inputs to the step function. The reduced value must be unwrapped with deref before completion. > • A completing process must call the completion operation on the final accumulated value exactly once. > • A transducing process must encapsulate references to the function returned by invoking a transducer - these may be stateful and unsafe for use across threads.
@matan I read it on Kindle and it was quite good compared to many other programming books
@U054D2JUV which form factor was it actually? a physical kindle device?
I must be too idiotic to fathom those important caveats and comments without an example
@matan @cgrand recently gave a talk where he talks about the pitfalls that those caveats present for someone writing a transducer or a transduction context: https://youtu.be/XiCwN-fv7os
and his xforms library has a cool trial
transduction context function for testing that a transducer respects these contracts
https://github.com/MastodonC/kixi.stats is a cool library that performs statistical computations using transducers
> "often left me in a deep state of despair and frustration" what a nice opening for a video about transducers 😂
anyone know how to make sure data_readers.clj
gets loaded when running from an uberjar? I have this src/data_readers.clj
, which locally gets picked up by Clojure automatically, but somehow when running from an uberjar it doesn't get loaded
{joda/inst lambdaisland.util.time/->joda-inst}
@plexus, lein or boot?
can you verify that data_readers.clj
is in the jar?
it needs to be in the root of the classpath
@qqq it depends on a lot of things (are there a .clj or .cljs files shadowing the .cljc, which cljs do you target etc.)
@qqq I made that helper lib https://github.com/cgrand/macrovich
@pesterhazy the jar is created with lein uberjar
, data_readers.clj
is definitely there, in the root of the jar
owww but it's a different data_readers.clj
, some other version of it is getting pulled in
working around it with doing an explicit (alter-var-root #'*data-readers* (fn [r] (assoc r 'joda/inst #'lambdaisland.util.time/->joda-inst)))
I think.... there can be multipiple data_readers.clj:
>>> When Clojure starts, it searches for files named data_readers.clj at the root of the classpath. Each such file must contain a Clojure map of symbols, like this:
not sure how a jar can contain multiple files names data_readers.clj in the same path though
hm I guess the answer is that a jar cannot contain multiple files with the same name, but running clojure with a classpath containing multiple jars or directories can
I'm getting the impression that lein uberjar
merges multiple data_readers.clj into one, since there's stuff in there provided by several different libraries, and there seems to be some merging logic in lein uberjar
, as well as an undocumented :uberjar-merge-with
configuration flag. I tried this though, based on what I could find, but doesn't seem to help :uberjar-merge-with {"data_readers.clj" leiningen.uberjar/clj-map-merger}
I heard concat is bad because it is lazy. What is the ocrrect wa yto concat [[1 2] [3 4] [5 6]] into [1 2 3 4 5 6] ?
@qqq it's recursive concat you have to watch out for
unbounded recursive concat at that
I’d say the issue is as much strictness as laziness - people use a strict looping construct like reduce or loop to stack calls to lazy concat without realizing any of them - take either factor out and the problem goes away
just lazy or just strict doesn’t hit the issue
@mpenet oh interesting. i didn't really think that there was a true intermediate product there.
@spei clojure doesn’t do “stream fusion” - if something returns lazy seq, that is never optimized out, no matter what you use the lazy seq for
(I guess you could call the way reduce uses eg. range an optimization of that sort, but that’s built into the definition of range…)
what's the best way to provide a clean way to create objects (deftype...) that can come in x kinds of y varieties of z types ? I'm guessing multimethods
what are the types for? why do you need all these types?
for different implementations of the same protocol varying according to different algorithms
...and the algorithms come in different categories
you might look at multimethods and keyword hierarchies as another possible option
right - have never used hierarchies ok will read up
it's basically a way to organize a big cube of algorithms all of which have a common simple interface
Hey, anyone have any recommended machine learning (in clojure) resources? Open source library's, blog posts, books, etc.
@byron-woodfork I've only heard about this: https://www.packtpub.com/big-data-and-business-intelligence/clojure-data-science
Incanter is an R-like environment for data exploration: https://github.com/incanter/incanter
and Cortex is a neat new neural network implementation: https://github.com/thinktopic/cortex
@byron-woodfork I have a distributions library that i am working on, with base distributions that are wrappers of apache commons math distributions, though i havent written any documentation. https://github.com/michaellindon/distributions/tree/master/src/distributions
I also have some software for feature selection in regression models: https://michaellindon.github.io/software/sss4clj/index.html
and there's Anglican http://www.robots.ox.ac.uk/~fwood/anglican/index.html
i haven’t been able to find a word2vec implementation in java/clojure that is fast enough to be usable, unfortunately.
yes, and it was much slower than e.g. python’s gensim library. i haven’t tried in a few months though, i could give it another go
@U07HVL0F7 why do you need it in java? typically a word embedding is generated just once (can use word2vec as a bash command from clojure) and then put to work in an application which can be clojure in our case
in python, loading e.g. the pre-trained GoogleNews word2vec model takes a minute or two, and then queries are sub-second. in java, just querying the model takes several seconds--enough to make it unusable for interactive use.
so sure, i could just use some sort of IPC and not actually use a java implementation--but that’s not my ideal situation
This also seems cool, for NLP work: https://github.com/fekr/postagga
GigaSquid also has a bunch of great Clojure/ML related blog posts worth reading: http://gigasquidsoftware.com/#/blog/archives/index
@byron-woodfork There are actually quite a few of these - some noted here. Try #data-science, that is where people working with this more typically hang out.