This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-05
Channels
- # beginners (11)
- # boot (121)
- # bristol-clojurians (3)
- # cider (5)
- # cljs-dev (45)
- # clojure (122)
- # clojure-conj (3)
- # clojure-germany (1)
- # clojure-japan (9)
- # clojure-russia (48)
- # clojurescript (129)
- # community-development (2)
- # cursive (17)
- # datomic (11)
- # editors-rus (3)
- # events (2)
- # funcool (32)
- # ldnclj (22)
- # om (110)
- # onyx (15)
- # re-frame (2)
I think full recursion would require a huge amount of rework.
Very unlikely I’ll ever get to that
Nice!!
@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 !!
@seancorfield: likewise
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? http://dev.clojure.org/jira/browse/ASYNC-140
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
@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 protocol I can use in c.j.jdbc to act like a db-spec? Wanting to use something like https://github.com/weavejester/duct-hikaricp-component 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 https://jarkeeper.com/r0man/sablono and https://github.com/hashobject/perun
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
@martinklepsch: How about nesting the routes? https://github.com/weavejester/compojure/wiki/Nesting-routes
@lancefalcon: the question was particularly aimed at bidi https://github.com/juxt/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
@korjavin: You might consider http://www.purelyfunctional.tv/
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
@lfn3: you might consider Java Flight Recorder if you're on jdk8, it's included just type jmc
on the command line
watch @tcrayford's presentation too: https://www.youtube.com/watch?v=0tUrbf6Uzu8
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? Eg
(defn foos [xs y]
(map #(foo % y) xs))
well, it would be somewhat easier if foo
expected 3 arguments instead of a 3-element vector
nah, that’s what I’m thinking, but then a counter argument is that it’s called from multiple places.
still, I think it's a matter of personal opinion, whether functions like that deserve to be
Trying to use figwheel and duct. What am I missing? In https://github.com/weavejester/duct-figwheel-component, the provided code :
(require '[duct.component.figwheel :as figwheel] '[com.stuartsierra.component :as component]) can’t find figwheel.
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.
I’m changing nothing from the default duct project, which includes duct-figwheel-component, and pasting in the how-to code from the readme.
maybe I'm missing something, but I don't see [duct/figwheel-component "0.3.0"]
anywhere in that project.clj
?
Again, the default file. https://gist.github.com/skottk/ac192addeac04c098fd9
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?
jfntn: here's some info: http://dev.clojure.org/jira/browse/ASYNC-104
@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"
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: https://youtu.be/4KqUvG8HPYo?t=52m6s
Oh cool, thanks for linking the relevant bit @scgilardi
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?
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
order of arrival is preserved but that order may not be well-defined if events arrive from multiple threads
from single thread though, you should see the same order
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
not sure if this is idiomatic, but couldn't you put requests into a channel and have your function consume from it?
that would be fine too
or a Java concurrent queue
or the locking macro
whoa locking macro
going to have to look that up
just created a synchronized block effectively
thx for giving me some options— going to investigate
or a ref dosync
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)
?
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
clojure has sorted sets with custom comparators
yeah I was just thinking that I could (ab)use sorted sets for this too
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.
you can thinking of sorting as just one way of detecting duplicates
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
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 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IPersistentSet.java basically all I need?
yeah (and super interfaces of course - IPersistentCollection and Seqable)
hah, this was super easy and fun, thanks @alexmiller
@martinklepsch: Did I hear something about a blog post?
@jeff.terrell: about the stuff above?
I mean, that's what I heard, yeah…
😄 I guess I could give it a try
I'd read it.