Fork me on GitHub

I think full recursion would require a huge amount of rework.


Very unlikely I’ll ever get to that simple_smile


fair enough, I'll push it out then 😉


and it's up

Alex Miller (Clojure team)00:11:18

@alex.nixon: there is another ticket to flag the creation of a fixed buffer size 0 as an error so this wouldn't be possible to fall into


A pleasure doing business with you @yogthos !!


alexmiller: thanks - the patch looks great! I left a Jira comment before you replied; if you have a sec would you mind weighing in on my last question?


The new core.async build appears to have introduced some errors involving code analysis. It falsely flags certain recurs as being in the tail position when they are not.


@xeqi: re: prismatic/schema -> if we were using protocols, and that was the cause of the problem, do you know of a fix?


@stopachka: the question about protocols is because when you reload a protocol definition, clojure redefines the underlieing class. This means any old instance are not instances of the new protocol. I could see some interaction betwen schema nad clojure doing some psuedo-static thing underneath that requires reloading all usages.


@stopachka: I've moved to a reloadable workflow to help avoid when this could happen

Alex Miller (Clojure team)00:11:51

@pmooser: there is one ticket on this already but I'd be happy to have more examples as it is tricky


@alexmiller I'm a registered contributor but I don't think I have a jira account -- I'll try to sign up later when I get home, and I'll add additional examples because I have one or two slightly different ones (although they do all involve 'case'). Thanks!


is there a blog post on how add-watch works?


thanks @xeqi! Will start playing around with some potential solutions


is there a protocol I can use in c.j.jdbc to act like a db-spec? Wanting to use something like without forcing other components to reach into the :spec key for their queries


Hey does anyone have any experience with profiling clojure and can recommend any specific tooling? We’re considering using timbre or yourkit. Anyone got war stories?


ended up writing an adapter component that reached in hikaricp and stored its datasource in a :datasource key. Then jdbc could destructure it like a map


In case anyone is using jarkeeper and GitHub badges I added new badge to show number of artifact downloads from Clojars (maybe such already exists? wasn’t able to find). See example here and


Is there a mooc course for closure noobs? Something on coursera for instance? I googled a lot but can't find anything.


@korjavin: only written material, as far as I know


podviaznikov: jarkeeper doesn't identify the project name correctly when there is another form before defproject in project.clj


hmmm I was aware you could do stuff like (sys/getenv etc.. in project.clj I didnt know it supported additional forms


it's kinda usefull for version # sometimes, when a project has 10 dependencies from the same parent with the same # for instance


I’m having a bidi question… given the following routes, what would be a good way to implement this:

/DE/de/batterie ;; /country/lang/route
/DE/en/battery ;; /country/lang/route
The issue is that the route bit depends on the language which is part of the route. I thought tagged routes could help but that didn’t work and is probably also not what they’re intended for. Now my solution is to have separate routing trees and handlers (e.g. :en-battery and :de-battery) which will work but doesn’t feel particularly elegant. Any better ideas?


I guess that’s the point where writing functions that generate routes becomes useful, would like to make sure that “built-in” features have been exhausted though simple_smile


@lancefalcon: the question was particularly aimed at bidi — while this kind of passing down of values would help I’m not sure if it’s possible in bidi


oh, right, sorry about that simple_smile


I came up with a solution to my bidi Q: basically I use a parameter segment for the i18n bit that I look up in a predefined map before calling bidi.bidi/path-for. Pretty simple actually simple_smile


@lfn3: you might consider Java Flight Recorder if you're on jdk8, it's included just type jmc on the command line


I’d my team to get rid of the habit of creating functions that are just mappings over another function. But I cannot seem to find the right argument. Can anyone help me out? simple_smile Eg

(defn foos [xs y] 
  (map #(foo % y) xs))


this example doesn't make any sense


l is simply ignored?


oh, makes more sense now simple_smile


Just edited it 😉


well, it would be somewhat easier if foo expected 3 arguments instead of a 3-element vector


(five edits after)


I don't think there's a lot of utility in a one-liner like that


cant you have a "utility" fn that accepts foo as a parameter ?


nah, that’s what I’m thinking, but then a counter argument is that it’s called from multiple places.


(defn map-with
  [f xs & rest]
  (map #(apply f % rest) xs))


to make it a bit more generic


still, I think it's a matter of personal opinion, whether functions like that deserve to be simple_smile


looks good !


Trying to use figwheel and duct. What am I missing? In, the provided code :


(require '[duct.component.figwheel :as figwheel] '[com.stuartsierra.component :as component]) can’t find figwheel.


dependency didn't load, perhaps?


I'd try to restart REPL first


It's only available in the dev profile when you're using duct, that could be your issue also.


Thanks, but I’m still not getting it. I create a new duct project, I try the require, and figwheel can’t be found. I mean, I’m literally pasting in the text from the readme, and it doesn’t work. Trying lein with-profile project/dev, and nrepl-server can't found. I must be missing something about profiles, I guess.


@skottk: perhaps it will be easier if you create a gist with your project.clj and the console session history


In a duct app, when you specify the figwheel option, that code goes into dev/user.clj. It does in mine at least. And that's where the nrepl code gets loaded as well.


:project/dev should have "dev"` in the :source-paths


I'm not sure I'm a huge fan of the duct-figwheel component though. I miss autoloading.


I’m changing nothing from the default duct project, which includes duct-figwheel-component, and pasting in the how-to code from the readme.


@skottk: What does your dev/user.clj look like?


maybe I'm missing something, but I don't see [duct/figwheel-component "0.3.0"] anywhere in that project.clj?


true. and it's missing figwheel as well.


They should both be in :project/dev :dependencies


It looks like you generated your project without the +cljs option. Clojurescript is missing also.


mishok13: Oh, FFS. 😞 Spent all this time trying to fix the a problem in a clean project, which I cleverly created with +figwheel — which doesn’t do anything — instead of +cljs. Thanks for your help, I’m being an idiot.


In core.async’s latest release, I can’t see how offer! and poll! differ from put! and pull!, can anyone give me a hint?


I meant take!, not pull!


@scgilardi: thanks I was reading that, and still confused...


the key feature is they don't block. "try to put!, but if you can't just return a failure indication"


Hmm can’t you use put! in cljs outside of a go block? i.e. non-blocking?


from the recent announcement on the mailing list, here's Rich explaining these features: I should have mentioned that promise-chan, offer!, and poll! were discussed by Rich at last year's Conj talk if anyone is interested in hearing him talk about these:


Oh cool, thanks for linking the relevant bit @scgilardi


@jfntn: you're welcome


anyone have any advice on how to approach the problem: - i want to only allow a single request at a time to flow through a function. so other function calls would block (or have a block-like experience) if another execution was in progress in the function.


imperatively i would reach for a semaphore, but i’m wondering what the idiomatic clojure way would be


i loosely remember that agents are serializable (ordered) — is that (or am i) correct? could i just push fns into an agent to achieve the desired response?

Alex Miller (Clojure team)18:11:24

agents apply one incoming function at a time to their state, but they are async which may or may not be good


is order preserved

Alex Miller (Clojure team)19:11:16

order of arrival is preserved but that order may not be well-defined if events arrive from multiple threads

Alex Miller (Clojure team)19:11:34

from single thread though, you should see the same order

Alex Miller (Clojure team)19:11:46

some logging system use an agent to log messages for example


most examples i’m seeing online with agents are logging or proxying to files

Chris O’Donnell19:11:10

not sure if this is idiomatic, but couldn't you put requests into a channel and have your function consume from it?

Alex Miller (Clojure team)19:11:27

or a Java concurrent queue


whoa locking macro


going to have to look that up

Alex Miller (Clojure team)19:11:33

just created a synchronized block effectively


thx for giving me some options— going to investigate

Alex Miller (Clojure team)19:11:00

although if you're expecting contention, that might be a bad use case for a ref


Is there a name for a datastructure that behaves like a set but determines if two values x and y are equal by comparing the results of f(x) and f(y)?


@pbostrom: thanks, wasn’t even aware there were baked in profiling tools.


martinklepsch: i’d call that a set with a custom comparer — don’t believe clj has that concept baked in, but have used it in other environments

Alex Miller (Clojure team)20:11:32

clojure has sorted sets with custom comparators


yeah I was just thinking that I could (ab)use sorted sets for this too

Alex Miller (Clojure team)20:11:48

the tricky bit in this is that you have to be very careful about declaring things equal only if they really are equal, because the set will remove all but one based on the results of f(x)


my data isn’t really sortable in any meaningful way though and making something sorted just to get set properties doesn’t feel right.

Alex Miller (Clojure team)20:11:47

you can thinking of sorting as just one way of detecting duplicates

Alex Miller (Clojure team)20:11:13

hashing is another (approximate) way - in a hash set, f is hash (kind of)


originally my data was a regular map {str map} but the keys of this map were derived from a key in the values map entries value


there was no need to access data by key though and having a map complicated handling of this data


I hope this gives a bit more context

Alex Miller (Clojure team)20:11:51

this is the kind of thing where you could create a deftype, that implements the key clojure interfaces for a set, and holds a normal set (or map) and applies f appropriately during insertion and lookup


yeah, I think this what I arrived at myself too. I tried looking up which interfaces I have to implement for that but wasn’t sure. Is basically all I need?

Alex Miller (Clojure team)21:11:09

yeah (and super interfaces of course - IPersistentCollection and Seqable)


hah, this was super easy and fun, thanks @alexmiller simple_smile


@martinklepsch: Did I hear something about a blog post? simple_smile


@jeff.terrell: about the stuff above?


I mean, that's what I heard, yeah…


😄 I guess I could give it a try