Fork me on GitHub
Alex Miller (Clojure team)00:01:59

That's where things drop into the compiler


Oh, I think I figured out my problem. I do a depth-first traversal then build the core.async channels 'upward'. Neato!


Q re: clojure.core.reducers/fold — under what circumstances does it decide to use fork/join vs just doing a regular reduce?


I was playing with this using a combinef that actually prints when it is called and so far I’ve only managed to see it called with zero arguments to get the seed value, never to combine the result of reducing multiple partitions...


Never mind, I think I was just confused about reducible collections…


Here’s why I got confused:

(r/fold add-r + (into [] (range 1000)))
;;=> produces two partitions and combines them — add-r prints the addition
(r/fold add-r + (into [] xf (range 2000)))
;;=> produces two partitions — xf filters on odd? so the range needs to be twice as long
(r/fold add-r + (eduction xf (range 2000)))
;;=> only one partition…


Even if I do (r/fold 100 add-r + (eduction xf (range 200000))) I only get one partition. Since eduction produces a reducible collection, I was expecting that would still do some parallelization.

Alex Miller (Clojure team)02:01:21

the inputs must be maps or vectors and it chunks (by default

Alex Miller (Clojure team)02:01:02

eduction won't work for this (currently)


@jonahbenton: kinda late reply (sorry, had to run) but anyway - It's basically event sourcing. I have an event store component which stores raw events as they happen due to - say - the user interacting with the system, for example something like {:event/type :created, :event/version 1 :aggregate/type :user :aggregate/id #uuid ... :event/payload {:username "test" :password "some hash"}} that are returned as a stream matching a given filter (by id, timestamp, type, whatever) and can be then folded into a representation of the current state of an aggregate by a repository component. The fold might need some minimal logic, like for example constructing derived values like means or something from the event data, hence the need for event handlers. I'm recently thinking if even that is not too much logic in event sourcing, but the same issue would be there for command handlers as well (things that validate user input and possibly persist events into the event source).


Hope it makes sense.


@Jean multimethod dipsatching on :event/type?


I had a feeling that was the reason in the end. I look forward to parallel transducer operations.


@nowprovision: yeah, but those can't be used with components effectively, since they are globals, see and on. But as far as I understand a patch to decouple def-ing multimethods from creating them is welcome, so I'll put one together soon hopefully.


any suggestions on getting a backend websocket server going? looking for more of a small library than a equivalent.


Sente is pretty cool, but if you want small


Then webservers like immutant or aleph expose websocket streams directly


oh sorry, I read it wrong, you're not looking for :) well, http-kit supports websockets too


Sure, but it's comparatively less maintained these days, I think.


aleph looks interesting, somehow never came up in my googleing


jaen, can I ask about web-servers? Why http-kit is not maintained? Because I use it, but only because it was on first lines in google (and it's ok in general). Why, for example, aleph is better?


It comes with a lightweight sente like approach for client-server communication both for RPC and streams.


@rm: a) as you probably can guess by I think, it's just my impression basing on how the commit activity graphs look for http-kit and how it looks immutant and aleph. It seems ptaoussanis stepped in to pick up some slack recently, but in general you can see it doesn't seem as active a project as the other two, b) it doesn't support SSL, immutant and aleph do IIRC, c) immutant can be better if you want to have additional services that come in a package (queues, schedulers, distributed transactions, though that last thing is kind of an ewww antipattern IMO) and ability to easily deploy into a Wildfly cluster; aleph can be better if you're interested in your webserver being based on a pervasive abstraction over asynchronous data streams.


http-kit's author (@shenfeng) unfortunately hasn't had much time to maintain http-kit recently. In an attempt to help out I'll be doing issue triage, accepting minor/obvious PRs, etc. My own time's pretty limited so contributors welcome: looking for pull requests, feedback/ideas, and help dealing with GitHub issues, etc. Please contact me if you'd be interested in lending a hand. Thank you! - @ptaoussanis


I, for one, currently use immutant because I really like the additional libraries it gives for free-ish.


@ptaoussanis is an amazing maintainer


Not saying otherwise, but the point still stands that the project is languishing. I guess he stepped in because originally sente was http-kit only, so he must be invested in this webserver.


@niwinz - aware of your library, but I didn't yet have any need to go full async; I would certainly evaluate both it and aleph should I need to move in that direction.


Yeah, I use http-kit because sente; at some point I should probably just make it use aleph


I like aleph because ❤️ netty, and ❤️ manifold


I think there currently are adapters for http-kit, immutant and nginx-clojure; I remember some issue re: aleph support, but it doesn't seem to have resulted in an adapter in the end -


There's some new discussion on an adapter it seems.


hi, brand new here - been dabbling with clojure for a few years now - love the language but still get baffled by package dependencies


can any please explain to me what [org.lwjgl/lwjgl-platform "3.0.0b”] is not found, yet it’s listed on


I have a bunch of events coming in which i shove onto a chan, which then has mult called on it, and the mult is a member of a record. I have a protocol which has one function response-chan which just passes it's args to async/chan and then tap the record's mult and returns the chan. dumb questions: 1) is this a bad idea for any reasons i'm missing? 2) I'm struggling to name the protocol for some reason. ResponseSource? ResponseManager? ResponseChanGenerator?


I’m guessing it’s something to do with os versions in the file name but it would be great to understand exactly what’s going on - thanks


@tomoram: very strange it is also happens on my environment :S


@niwinz: thanks for checking, I’m assuming there’s a good reason but I don’t really know enough about packages for JVM languages - trying to understand it all a bit better


I do not find any info about that 😞


it's a parent pom


you probably want a jar


[org.lwjgl/lwjgl "3.0.0b"]


@dm3: that sounds like it makes sense but I don’t really understand it. Looking on I can see it lists a pom and 3 os specific jars. Can I instruct lein to fetch one of those jars somehow?


@dm3: I’m assuming that’s what I’m trying to do 😉


@tomoram the artifacts on maven require an extra "coordinate" called a classifier


those particular artifacts do


[org.lwjgl/lwjgl-platform "3.0.0b" :classifier "natives-linux"]


@jonahbenton: ah thanks, let me give it a try!


@jonahbenton: that did it, many thanks!