#clojure logs

2015-07-13

01:44gratimaxanyone seen this? http://clochure.org/
01:47dstocktonyes
01:48wasamasalol
01:49wasamasaand what's their vector syntax then?
01:50wasamasaah, it's (2 3 4)
01:50gratimaxparentheses
01:50wasamasaso silly
01:50gratimaxI'm like 90% sure it's an april fool's joke of some sort, just thought it would be fun to share
01:51dstocktonit was an april fools joke
01:51dstocktonhttps://github.com/videlalvaro/clochure/
01:52gratimaxmm
01:52gratimaxlol, in the repl the output is still the clojure representation
02:47wasamasaof course
02:48wasamasahow else are you gonna now it's working??
02:48lazybotwasamasa: Uh, no. Why would you even ask?
05:22lokeI have a dilemma
05:23lokeAnd I need assistance from someone with more clojure experience than me
05:24broquaintloke: Go on ...
05:24lokeyes, typing :-)
05:25lokeI have a value, let's call it "foo" with the following structure: {"key0" {:a "a0" :b "b0"} "key1" {:a "a1" :b "b1"}}. I then have a list of the following form: [{:id "key0" :a "some value"} ...]
05:25lokeI want to create a function that does the following:
05:26lokeUpdate "foo" with the content of the list, but only modify values that are actually included (and non-nil), otherwise the old vlues should be preserved
05:26lokeso the result of the above would be:
05:26loke{"key0" {:a "some value" :b "b0"} ...}
05:27lokeAny new values that are not in "foo" should be added
05:27lokeMy current solution is an incredibly hairy mess of union, remove, conj and reduce
05:28justin_smithloke: sounds like you want update-in
05:28justin_smithor maybe just assoc-in
05:28lokeassoc-in? Hmm, never used
05:28justin_smith,(assoc-in {:a {:b 1}} [:a :c] 2)
05:28clojurebot{:a {:b 1, :c 2}}
05:29lokeHmm... I need to think some more on this
05:31lokerelated: Is there a standard way to do "map" on a map (in other words, transform the elements on a map). The best I have come up with is (reduce (fn [z [k v]] (conj z (THE-UPDATE))) {} THE-MAP)
05:32TEttingerloke: &(map (fn [[k v]] (str k "," v)) {"a" 1, "b" 2})
05:32TEttinger,(map (fn [[k v]] (str k "," v)) {"a" 1, "b" 2})
05:32clojurebot("a,1" "b,2")
05:32lokeThat results in a list though, I want the output to still be a map, but transformed
05:33TEttinger(doc zipmap)
05:33clojurebot"([keys vals]); Returns a map with the keys mapped to the corresponding vals."
05:33TEttingerno...
05:33TEttinger(doc map-kv)
05:33clojurebotTitim gan éirí ort.
05:33TEttinger(doc mapkv)
05:33clojurebotIt's greek to me.
05:33TEttingerwhat was it...
05:33justin_smith(doc reduce-kv)
05:33clojurebot"([f init coll]); Reduces an associative collection. f should be a function of 3 arguments. Returns the result of applying f to init, the first key and the first value in coll, then applying f to that result and the 2nd key and value, etc. If coll contains no entries, returns init and f is not called. Note that reduce-kv is supported on vectors, where the keys will be the ordinals."
05:34lokeSounds very much like what I have. I wonder if the implmenetation is similar
05:35justin_smithit's probably similar but faster (using a transducer and/or transients)
05:35TEttinger,(into {} (map (fn [[k v]] (str k "," v)) {"a" 1, "b" 2}))
05:35clojurebot#error {\n :cause "java.lang.Character cannot be cast to java.util.Map$Entry"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Character cannot be cast to java.util.Map$Entry"\n :at [clojure.lang.ATransientMap conj "ATransientMap.java" 44]}]\n :trace\n [[clojure.lang.ATransientMap conj "ATransientMap.java" 44]\n [clojure.lang.ATransientMap conj "ATransientMap.java" 17]\n [...
05:36justin_smithTEttinger: that's silly, you can only create a map out of two element vectors
05:36TEttingerright yes I forgot what I was doing
05:36TEttinger~ambien dreams
05:36clojurebotPardon?
05:37TEttingerclojurebot: ~~~ is the smooth wave calling you to sleep
05:37clojurebotRoger.
05:37TEttinger~~~~
05:37clojurebot~~~ is the smooth wave calling you to sleep
07:40noncomdoes emacs work over ssh in terminal mode ?
07:41noncomi try to start it like that, on an ssh session, but all i get is the prompt hanging until i ctrl + C and get back to the bash...
07:42H4nsdo you have a DISPLAY variable set in your shell?
07:46noncomnvm, got it.. somehow it was launching without the -nw key :)
07:47noncombut i was thinking it did..
07:47noncomemacs is great!
07:47noncomthe only downside (as i see it) is elisp...
07:48noncombut still much much much better that, say JS, within, say GitHub Atom or Adobe Brackets..
07:48noncomor python you know where
07:54dottedmagnoncom: Do you really need emacs over ssh? tramp FTW
07:55dottedmagnoncom: also with lexical-binding: t elisp is tolerable
07:56noncomhmmm, yeah, tramp is a nice option! but it won't make the shell accessible i think..
07:56algernondottedmag: sometimes you run local commands on the remote host that want an editor, an emacs on the remote host is useful then.
07:58dottedmagnoncom: eshell has some support
07:58dottedmagalgernon: oh right, pretty much the only case when remote emacs is needed.
07:59H4nsdottedmag: what is wrong with using emacs through ssh?
07:59dottedmagH4ns: no GUI? Burden of syncing ~/.emacs? Different Emacs versions?
07:59dottedmagnoncom: http://stackoverflow.com/questions/1346688/ssh-through-emacs-shell/1372805#1372805
08:09wiruzxGood evening
08:12wiruzxCould anyone please help me to fix this macro to be able to use it in threading(->) macro?
08:12wiruzx(defmacro <? [expr]
08:12wiruzx `(throw-err (<! ~expr)))
08:13wiruzxIf I make it function composition, clojure will yell at me because it outside of go block
08:20wasamasaa macro without unquoting??
08:20lazybotwasamasa: What are you, crazy? Of course not!
08:20wasamasaphew, must be me seeing things
08:44noncomhah, so, emacs runs over ssh, yes... but with each new charecter i enter, it.. scrolls the screen and destroys the visual image... unusable... ?
08:44noncom(currently trying without tramp)
08:45noncomyeah, i generally want to replace the need for "nano somefile" with "emacs somefile" over ssh
08:45H4nsnoncom: you've probably not set up your terminal type correctly
08:45H4nsnoncom: try "env TERM=vt100 emacs" to see whether that changes anything.
08:46H4nsnoncom: #emacs may be a more appropriate channel to get help with this, though.
08:46noncomyes, #emacs, but they often just ignore questions.. too much buzz goes over there... but i agree, i must better be asking in #emacs..
08:47H4nsnoncom: no worries.
08:47H4nsnoncom: my experience with #emacs has also not been too good.
08:47noncomheh, term=vt100 works... sort of. it looks better, but still in some situations it cripples the visual.. nano works quite well though!
08:48H4nsnoncom: then your TERM environment variable does not match what your terminal emulator actually supports.
08:48noncomfrankly, i am not even hoping to get this resolved.. just asking what my odds are..
08:48noncomprobably. i will research into this subject and read the manuals
09:39hellofunkif you repeat your question about three or four times in #emacs you will eventually get a good answer
09:39hellofunknot the shining example of good help, but works eventually
09:46kwladykaHow to write this in most readable way? https://www.refheap.com/106526
09:47kwladykai just want check if two conditions are true, but i want check second condition only if (= m n)
09:47kwladykai can write this with "if" but i guess there is shorter way.
09:53TMAkwladyka: personally I would (defn solution-checker-rotate* [m n solutions] (or (not (= m n)) (solution-checker-rotate m n solutions)))
09:53TMAor just inline the (or)
09:54schmirkwladyka: (and (= m n) (solution-checker-rotate ...))
09:57kwladykatma shmir thx
10:22mmeixWhat is the best method to find all possible combinations of n elements?
10:25oddcullyclojure.math.combinatorics/permutations maybe?
10:25mmeixmust work in clojurescript
10:26zerokarmaleftmmeix: I don't think there's any reason those implementations wouldn't work in cljs
10:27mmeixok, will try
10:27mmeixthnx
10:32divyaHello?
10:46mmeixhello
11:07hellofunki am seeking the most elegant way to return the first positive number from a vector like [nil 0 :a 5 6 0]. i get (->> a (filter number?) (filter pos?) first) but seems rather verbose
11:11dstocktonim trying to learn from the datascript source https://github.com/tonsky/datascript/blob/master/src/datascript/core.cljc#L341
11:11dstocktoncan anyone explain the rationale behind defrecord-updatable, rather than having a normal record with mutable refs
11:14dstocktoni think the updatable bit is confusing me, its not really updating
11:21dstocktonits basically a way to defrecord on-the-fly?
11:22jsabeaudryWhen I rename-buffer my cider repl buffer, it does not work anymore, what is the proper way?
11:27aztakbazinga all! Switching to the LRU window (like in vim, C-w C-p) - how do I do that in Spacemacs?
11:27aztakLike C-6 for buffers.
11:31aztakouch - sorry for that - obviously wrong channel!
11:31aztakI'll ask a Clojure question in the Spacemacs channel to compensate!
11:32diyfupecoaztak: Are you a long time vimer who switched to spacemacs?
11:32aztakdiyfupeco: yupp, that's correct :)
11:33diyfupecoaztak: I thought about trying it, where do you see the advantages?
11:34aztakdiyfupeco: it's a bit like comparing apples and oranges.. I get almost all of the text-editing goodness in VIM *and* I get access to all the Emacs ecosystem.
11:35aztakorg-mode is the feature that pushed me over the edge - it's a killer feature.
11:35diyfupecoHm, thanks.
11:35diyfupecoI will try it.
11:46scriptordiyfupeco: I've also picked up emacs+evil-mode for clojure stuff
11:47scriptorit's not too bad, I'll still keep using just vim for non-clojure work
11:50diyfupecoI am so afraid because it totally breaks my workflow. :D
11:52scriptordiyfupeco: what specifically about your workflow are you worried about?
11:56diyfupecoscriptor: My VIM is configured for quick actions with space as the leader key. Also ctrl+p and splits. Next thing is about connecting to the repl and execute something in it. And those little things like signify, multiple cursors and sayonara (all plugins).
11:57diyfupecoAh yeah, and undotree
11:57scriptorevil comes with support for splits, at the very least
11:58scriptorand for the quick actions stuff, you can learn a minimum of elisp to recreate some of that
11:59vaitelI know that there is a multiple cursors plugin on melpa too.,
11:59diyfupecoHm, ok. How about undo[dir|levels]?
12:00diyfupecovaitel: I'd be suprised if emacs wouldn't have one to be honest.
12:01vaiteldiyfupeco: http://www.emacswiki.org/emacs/UndoTree
12:02diyfupecovaitel: cool :)
12:02diyfupecoWell, ok, I promise to try it. :D
12:02wasamasaemacs' undo system is sort of meh
12:02diyfupecoBut please don't burn me when I try to recreate my vim expirience at first. :D
12:02vaitelI use evil-mode, and undo-tree is installed as a dependency.
12:03wasamasaI've had used undo-tree with persistency for some time and found out that the saved history did get truncated after too huge edits
12:03vaiteldiyfupeco: that's pretty much exactly what I did when I first started with emacs.
12:05diyfupecoI think I'll switch to another channel now with my questions. :D
12:07wasamasalike, #emacs?
12:08diyfupecowasamasa: #spacemacs on gitter.im is more suited at the moment I think. I joined #emacs anyway.
12:10wasamasaright
12:10the_frey_multiple cursors on emacs is okay, it's not quite as good as vim
12:10aztakdiyfupeco: also check irc.gitter.im
12:10the_frey_and imho both are worse than sublime text
12:10the_frey_*for multiple cursors
12:11the_frey_the st implementation is just slick
12:12diyfupecoLet's build submacim! :P
12:13diyfupecoaztak: Thanks for the hint. :)
12:34binjureddoes anybody know how to get cljsbuild to build some cljc files from a dependency jar? i have a shared library dependency that contains combined sources (cljc). i can add it as a dependency and require from the jar as clj, but cljsbuild doesn't know about the cljc in the jar.
12:52seangrov`Has anyone tried doing xhr-based file uploads to compojure routes before? I'm not sure what to do with the HttpInput body
13:00dasik`Does it make sense to use JSON Web Encryption (JWE) tokens when I'm writing a basic CRUD webapp? All the writing I've found about token authentication talks about single-page applications.
13:17justin_smithwasamasa: "emacs undo system is kind of meh" -- have you tried undo-tree?
13:17justin_smithoh, never mind, /me goes back to reading
13:17wasamasajustin_smith: it builds upon the built-in undo system
13:18wasamasajustin_smith: so, while it's really handy to have a tree-style redo, I've run into a really weird bug or two with it and persistency enabled
13:18csd_If t represents a java object, and I have a coll of [ts], how can i map .setter to [ts]? I'm having trouble using (map #(.setter %1 %2) ts [vals])
13:18justin_smithsure. But aren't your concerns addressed by upping the amount of history saved? like for similar reasons I always expand the size of my kill ring
13:18wasamasaat some point I did just disable it when I got "Undo canary detected" messages all over the place
13:18justin_smithwasamasa: interesting, you must be using it much more heavily than I ever do
13:19wasamasajustin_smith: well, I just have an eye for spotting bugs, that's all
13:19justin_smithbinjured: which version of clojure is cljsbuild using/
13:21justin_smithbinjured: with clojure 1.7 I have had no issue getting code from cljc files in libs
13:43scriptorhave any evil users here been able to use the eval-buffer keybinding with cider?
13:44justin_smithscriptor: I don't use cider, but I think your best bet is to rebind the command to something that works better with evil
13:45scriptorhmm, I was trying to rebind it on evil's side, but that might be best
13:46justin_smithscriptor: that's what I mean. Find out the actual command that keybinding would run, and bind some other key combo to that command
13:46justin_smithwhich is why I hate it when people document the keypress but not the specific command to run - the command is universal, the keypress is particular and very likely to not work on any given person's emacs setup
13:49scriptoragreed, had to guess where the actual binding is set in the sourc
13:49scriptordidn't take long, but still
14:01wasamasaso you still didn't run F1 k C-c C-k?
14:01justin_smithwasamasa: if the keybinding is broken, asking what a key is bound to isn't going to help much
14:02justin_smithsomething already messed up the binding
14:02wasamasayes and you'd want to know what
14:02justin_smithwasamasa: evil mode
14:02justin_smithhe already knew that
14:02wasamasaI find this somewhat hard to believe considering evil doesn't bind anything to C-c or C-x
14:02wasamasawhich is done on purpose
14:03wasamasain vim C-x would be bound to either the increment or decrement command (evil doesn't ship with any of these, it's an extra package you need to install and bind yourself), C-c would be bound to a quitting command, but isn't here
14:06wasamasaso I'm curious what would be going on here
14:52edwPing
14:52Bronsaedw: hi
14:53edwBronsa: Hey. Slow day…
14:54Bronsaedw: lot of traffic has moved from irc to the slack channel it seems
14:54edwWhu?
14:54edwClojure.org?
14:54Bronsaedw: https://clojurians.slack.com/
14:55edwI was just thinking, "I wish i could connect to Freenode via the Slack (Mac|iOS) app…"
14:57hiredmanreally?
14:58hiredmanthat is too bad
15:01lemonodor“To start using Slack, you'll need to be invited by your team administrator” is it not public?
15:05Bronsalemonodor: http://clojurians.net/ to get an invitation
15:05Bronsahiredman: yeah :( it's not as bad as it could be though, slack has an irc gateway
15:06freeman42xBronsa, irc gateway?
15:06Bronsafreeman42x: https://slack.zendesk.com/hc/en-us/articles/201727913-Connecting-to-Slack-over-IRC-and-XMPP
15:11lemonodorBronsa: thanks
15:14FrozenlockIRC master race
15:14FrozenlockSlack dirty peasants
15:14freeman42xFrozenlock, i for one welcome our new slack overlords
15:15oddcullys/overlord/team administrator/
15:29zphdsGuys, why is the PSQLException in line 5 in this gist not getting caught? https://gist.github.com/sudharsh/6801838e92bc0fc0a985
15:29zphdsIt's late and am scratching my head
15:30zphdsevaluating the map form on the repl throws a PSQLException
15:36amalloyzphds: having not looked at the paste, i'll bet you a million dollars it's because of lazy sequences
15:36amalloyand, indeed, it is
15:36amalloy~map
15:36clojurebotmap is laziness
15:37zphdsamalloy: but why I don't I get lazy-seq when I do it on the repl?
15:38zphdss/I don't/don't/
15:38kwladykai have map {[1 1] :king [1 3] :king [1 2] :rook} and i want change it into {{[1 1] :king [1 3] :king [1 2] :rook}{[2 1] :king [2 3] :king [2 2] :rook}{[3 1] :king [3 3] :king [3 2] :rook}} <- the number are just example. I want do some magic operations on keys and change them. How to do this in most elegant way?
15:39amalloyzphds: your function immediately returns a lazy sequence, realizing no elements of it. then in the repl, you try to evaluate an element, throwing an exception, and there's no handler installed at that point
15:39kwladykasomething like (do-magic-algorithm {[1 1] :king [1 3] :king [3 2] :rook}) to produce me that
15:39zphdsamalloy: is there an implicit doall ?
15:39zphdsah gotcha
15:39amalloyno? i don't understand this question
15:40ToxicFrogkwladyka: your "after" example isn't even a valid map, so I have no idea what you actually want here.
15:40zphdsamalloy: I could do a (doall (map...))
15:40zphdsand realize the lazy-seq
15:40kwladykaToxicFrog, It should be #{}
15:40zphdsamalloy: dorun should be fine, since I can just throw away the results
15:41kwladyka{[1 1] :king [1 3] :king [3 2] :rook} into #{{[1 1] :king [1 3] :king [1 2] :rook}{[2 1] :king [2 3] :king [2 2] :rook}{[3 1] :king [3 3] :king [3 2] :rook}}
15:42amalloykwladyka: nobody can guess what your algorithm is here. how are the outputs related to the inputs? it's like asking "i have the numbers 4, 9, and 17, and i need to get out 491. what function should i use?"
15:42kwladykaamalloy, algorithm it is not important, i just want know which function i can use to produce from one map more maps with different keys
15:43zphdsamalloy: cool, plugging in a dorun is what I needed. Thanks!
15:44zphdsnot worried about the size since the input is going to be less anway. So dorun should be good.
15:46kwladykato be more precise, example input and output https://www.refheap.com/106532
15:47kwladykaamalloy, ^
16:30cryptackI need to integrate with Spring and I’d like to define Spring beans, I’m wondering if anyone knows a way to do this in clojure (it requires Java annotations ontop of a class, I couldn’t find any info online)
16:33cryptackI found something that said you can annotate with deftype, but I don’t know if that corresponds to clojure metadata or Java class annotations
16:41kwladykahow change ([1 1] [1 3] [3 2]) into for example ([1 1+4] [1 3+4] [3 2+4]) ?
16:42justin_smithwhat is "1+4"
16:43kwladyka5 :)
16:44lemonodorkwladyka: you could look at reduce-kv
16:44justin_smith,(map (fn [[a b]] [a (+ b 4)]) '([1 1] [1 3] [3 2]))
16:44scriptorkwladyka: you'll want to map over the list which will let you iterate over the pairs
16:44clojurebot([1 5] [1 7] [3 6])
16:45justin_smithlemonodor: oh, reduce-kv would work for that structure wouldn't it...
16:46justin_smith,(reduce-kv (fn [acc k v] (conj acc [k (+ v 4)])) [] '([1 1] [1 3] [3 2]))
16:46clojurebot#error {\n :cause "No implementation of method: :kv-reduce of protocol: #'clojure.core.protocols/IKVReduce found for class: clojure.lang.PersistentList"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "No implementation of method: :kv-reduce of protocol: #'clojure.core.protocols/IKVReduce found for class: clojure.lang.PersistentList"\n :at [clojure.core$_cache_protocol_fn invoke...
16:46justin_smithno, reduce-kv won't work for that actually
16:46justin_smith(if that was literally the datastructure)
16:47scriptormap seems to make more idiomatic sense in this case, too
16:47scriptorsince it's just a one-to-one...mapping
16:47SeyleriusWhat's the best way to name a new library one's planning to publish? Should it be at one's own domain, if one has such a domain? If I own seriouslyseylerius.com, should it be "com.seriouslyseylerius/astronomy" if I'm making an astronomy library (for calculating full moon dates and whatnot)? And what sort of lein command should I use for declaring it?
16:48justin_smithSeylerius: lein new foo com.seyleruis/astronomy
16:48justin_smithwhere foo is your template
16:48justin_smithif the project is already there, you have to edit a bunch of stuff by hand
16:48lemonodori do prefer the reverse DNS style names, but lots of people just choose a top-level unique name, like “astronomie” or something.
16:49justin_smithyeah, I think that's sloppy / bad form though
16:50SeyleriusOkay, so `lein new com.seriouslyseylerius/astronomy`, then push the thing to github as `seylerius/astronomy` on my profile?
16:50SeyleriusI need to get around to changing my github name from emhs to seylerius, since I'm using that for everything these days...
16:51lemonodorjustin_smith i tend to agree, but i don’t think the community in general necessarily feels the same way. e.g. midje, clj-time, lein-gorilla, gloss, seesaw
16:51kwladykahmm maybe reduce-kv is even better... on the end i want do https://www.refheap.com/106532
16:52kwladykafor now i did https://www.refheap.com/106534
16:52kwladykaand i wanted transform positions in zipmap
16:52justin_smithkwladyka: you need a data-structure that implements the IKVReduce protocol, and you have duplicate "keys"
16:53kwladykajustin_smith, i dont have.
16:54kwladykajustin_smith, so.... my solution with zipmap is a good way or should i use something like reduce-kv?
16:55kwladykaor any other solution
16:55oddcullyisn't (map key) the same as (keys) ?
16:55oddcullysame for val/vals?
16:55kwladykaoddcully, no
16:55amalloyyes
16:56kwladykano, it would throw exception
16:56oddcullyyeahyeah... (map key) is a transducer ;P
16:56amalloyno
16:56amalloyoh, you're not calling it on anything?
16:56amalloyno, you are. (map key x) is the same as (keys x)
16:57amalloythat is the implementation of (keys x)
16:57oddcullythat's what i meant but lazily excluded
16:57kwladykaoh i didn't see "s" on the end of this word...
16:57kwladykasorry
16:57kwladykabut good to know i can write it shorter :)
16:58oddcullyand isn't then (zipmap (keys x) (vals x)) just randomizing your map?
16:58thesaskwatchI'm trying to test a function using midje and I would like to verify content that it printlns. Any idea how to do that?
16:59kwladykaso... do you think my solution with zimap to achive keys transformation for example from ([1 1] [1 3] [3 2]) into ([1 1+4] [1 3+4] [3 2+4]) is good or do you see better solution?
16:59lemonodorjustin_smith: compojure, cascalog, clj-http, enlive, hiccup, instaparse, every lein plugin, ring, secretary (sorry, i went to the trouble to find popular packages i’ve used that don’t use the reverse dns naming scheme)
16:59kwladykaoddcully, it do nothing for now... i have to add something to (keys x) to transform keys
17:01kwladykaoddcully, and i know keys and vals give values in order?
17:07kwladykaif somebody is interested in this is my full worked solution https://www.refheap.com/106535
17:14zerokarmalefthaving a weird compojure issue here...prod env is basically nginx reverse proxied to a clojure app with a couple endpoints. routes match when hitting the app server directly, routes match when hitting a dev setup mimicking the nginx setup, GET routes match when hitting the prod setup, POST routes mysteriously fail to match.
17:14kwladykathank you for discussion and goodnight :)
17:15oddcullykwladyka: yeah sorry, i actually don't know what garanties clojure map holds in that case. i defensively assumed unordered access. but if the seq of elements is the same, then there is no randomization
17:15zerokarmaleftthe headers don't appear mangled in any way, and the URI logged at nginx and at the app is correctly formed
17:15zerokarmaleftany ideas on what I could check next?
17:54jungerhowdie everyone
17:54jungeris someone familiar with om-bootstrap ?
17:54jungerI'm evaluating using it, and I am bumbing into a problem using alerts
17:56oddcullyjunger: just fyi there is also #clojurescript
18:00junger@thanks, will check it out
18:19SeyleriusWhat's the recommended way for an app using one's library to set a library-wide setting, like API usage level?
18:20justin_smithSeylerius: would two parts of one app ever have separate configs for the same lib?
18:21SeyleriusI'm building a rate limiter into an API lib I'm putting together (refactoring all the Wunderground API stuff I'm using in my weather-generator app to a lib of its own), and I want people to be able to specify which API level they've purchased (Developer, Drizzle, Shower, Downpour) and have it automatically cap their usage at the required rate. So it's unlikely they'd have separate configs. It's a per-API-key setting (I'd probably also
18:21Seyleriususe this to allow them to set the API key, too)
18:23Seyleriusjustin_smith: So, very unlikely that they'd have multiple configs per app.
18:23SeyleriusUnless they're using two different API keys in the app, which have different usage levels.
18:23SeyleriusBut what's more likely is there'd be an API key in the dev version and a separate API key in the production version.
18:24justin_smithSeylerius: the reason I ask, is a common thing is a top level atom, but that makes using different API keys impossible
18:24justin_smithso is it OK to make it not possible at all, or is it worth it to do something slightly less simple so that multiple keys is occasionally an option?
18:38lodin_Is there a term for objects that require cleanup? Like objects that should be closed, etc. First thing that came to mind was "stateful" but atoms are also stateful, so that's not quite right.
18:38Seyleriusjustin_smith: I can think of exactly /one/ reason to use multiple API keys in an app: load-balancing requests across different keys.
18:38SeyleriusBut that's probably a violation of the ToS.
18:39SeyleriusHell, I'll bug Gundeep and double-check if it is.
18:39Seylerius'Cause if it is, disallowing it in my lib will probably make the wunderground people like me better.
18:47Seyleriusjustin_smith: Baring an update from Mr Hora to the contrary, I can't think of a good reason to use multiple API keys, so I'll go with the top-level atom approach. Got a decent link on the basics of it?
18:47justin_smithSeylerius: these issues are fresh in my mind because I am setting up our timbre config in an internal project right now, and sometimes I really wish timbre did not have a single global config for all options
18:48justin_smithSeylerius: it's pretty straightforward to implement (def config (atom {:credentials nil}))
18:48justin_smiththen maybe provide a convenience function like set-credentials! or something that mutates the config
18:49Seyleriusjustin_smith: Perfect, thanks.
18:49Seyleriusjustin_smith: Can you think of a good reason for people to need multiple API keys for a weather API?
18:50justin_smithSeylerius: if your app had multiple users, but only had to check the weather once and could share that data between the users in one area
18:50justin_smithwhich is probably a weird use case
18:52Seyleriusjustin_smith: Yeah, that wouldn't be likely with Wunderground unless individual users were adding their API keys to the app, which the API key generating interface seems not to be optimized for.
18:54Seyleriusjustin_smith: Confirmation from Gundeep: load-balancing is against ToS.
18:55justin_smiththen you're probably all set using an atom
18:57SeyleriusThanks
18:57Seylerius(inc justin_smith)
18:57lazybot⇒ 276
18:57Seylerius(Why do you people rock so hard?)
19:17elvis453561How do you use CSS selectors with garden for Ronald Mcdonald's sake
19:17elvis453561?
19:18oddcullyelvis453561: just fyi there is also #clojurescript
19:18elvis453561[:input (not [...]) {...}] render as: input, :not [...]
19:19elvis453561Yeah I could try it but: Usually it's dead compared to here and I'm using garden on the JVM so...
19:21oddcullyjust mentioning it... feel free to do whatever you thing is right
19:56devnanyone here know of an example of using core.async pipeline?
20:13tmtwdhello, I was trying out yesql for fun, and put it in the project.clj file deps,and called lein deps. Then today I installed posgresql for the first time but it would work. Could lein have done something to mess up my path or something?
21:05Shayanjmarrdem: I didn't realize you worked @ Factual
21:05Shayanjmwe just started using factual @ work
21:09arrdemShayanjm: yeah I'm here for the summer giving amalloy and everyone else a headache IRL rather than just over IRC
21:09Shayanjmsweet. We just turned the key on our lead gen engine, so I think we're giving factual a go
21:10arrdemcool!
21:10ShayanjmDo you guys already do google place scraping btw?
21:10arrdemI don't know and probably couldn't say
21:10Shayanjmgotcha
21:43rs0lodin_: "resources," I suppose?
21:43rs0lodin_: in the sense of "automatic resource management"/"try-with-resources"
22:05SeyleriusIs some the best way to see if a given keyword is a member of a specific collection? I've got a map called rates, with a map as each value, and the argument provided to this function needs to be one of the keys in rates.
22:06SeyleriusOr contains? maybe?
22:06justin_smithSeylerius: contains? might be what you are looking for
22:07justin_smithSeylerius: see also find, which returns nil, or the key and value as a vector
22:07justin_smith(doc find)
22:07clojurebot"([map key]); Returns the map entry for key, or nil if key not present."
22:37gcganleyare there any clojure stickers for something like the back of a laptop?
22:39scriptorgcganley: http://clojure.org/swag
23:12sturnerAnyone have an recommendations for handling units/measurements? Frinj looks pretty interesting. I'm a clojure newbie... I've used http://www.squants.com/ before which I found to be powerful but I'm wondering how I might convey values with unit across the network to other systems in a similar manner in clojure. Transmit maybe?
23:17tomjackhmm "Tries to combine Frink's fluent calculation style with idiomatic Clojure"
23:18tomjackdoes it succeed?
23:18tomjack(frinj)
23:28RaynesDoes it?
23:28RaynesYou tell me, sir.
23:28RaynesFor I am not the judge.
23:30RaynesWell, at first glance, there are some pretty horrifying things going on.
23:30RaynesLike override-operators!
23:30RaynesI'm kinda shivering a bit over that one.
23:32sturnerYeah... I'm very much a clojure beginner so I can't comment. Frink is an interesting language in and of itself but the library implementing it seems to only implement a parse().
23:43amalloyfrinj is just super old, isn't it?