#clojure log - Jun 02 2015

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:15 dumptruckman: hmm

0:19 how about combining seqs contained in different maps under the same key?

0:19 currentoor: has anyone here used lobos for migrations?

0:21 dumptruckman: like a merge-with but only for a specific key

4:49 ollivera: Him how can I get the component name from the structure below?

4:49 {"id" : "1", "versions" : [ { "news" : [ {"id" : 3, "parameters" : { "component" : "myNameHere" } }]}]}

4:51 SagiCZ: ,(-> {"id" : "1", "versions" : [ { "news" : [ {"id" : 3, "parameters" : { "component" : "myNameHere" } }]}]} "versions" first "news" first "parameters" "component")

4:51 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: :>

4:51 mnngfltg: Help! When I type in "(str (java.util.Locale/getDefault))" in a pristine `lein repl`, I get "en_MT"

4:52 I'm not in Malta though. Does anyone see the same?

4:52 ,(str (java.util.Locale/getDefault))

4:52 clojurebot: "en_US"

4:52 SagiCZ: ollivera: what kind of structure is it? is that string?

4:53 mnngfltg: i think this is taken from JVM properties

4:53 mnngfltg: I tried this: -Duser.language=de -Duser.country=DE (or en resp. US)

4:53 ollivera: SagiCZ: (get-in page-name [:versions 1 :news 1 :parameters :component]) works ... but I specified the indexes (1) ... it should be able to find all ocorrences in the nested arrays

4:54 mnngfltg: but it doesn't help (I used the :jvm-opts key in project.clj)

4:56 kwladyka: i am writing short article to help people choose template library for web. Answer for this question will help me be more objective: Who use Enlive? Why you use Enlive instead Selmer?

5:01 ollivera: SagiCZ: what I want to do is walk thought all versions and news, not only the first. My example only had one to simplify the structure

5:01 SagiCZ: this just isnt a valid clojure map {"id" : "1", "versions" : [ { "news" : [ {"id" : 3, "parameters" : { "component" : "myNameHere" } }]}]} .. so i was asking what datatype it is

5:02 oddcully: smells like json

5:02 SagiCZ: yeah.. so if it is JSON.. get a JSON parser.. dont do it manually

5:02 I loved the Jackson library for java im sure there is something for clojure too

5:12 stain: mnngfltg: unix? Try running "locale" in the shell to see what your LANG is

5:12 mnngfltg: stain: LANG=en_US.UTF-8

5:14 stain: mnngfltg: hm, I get en_US if I set such a LANG with OpenJDK 1.8.0_45-internal

5:14 mnngfltg: stain, I now see that the strange behavior disappears when I get rid of my ~/.lein/profiles.clj

5:14 stain: mnngfltg: I guess you'll just have to pack up and move to Malta! I think it's actually quite nice there.. :)

5:15 mnngfltg: stain, I'd love to, believe me :)

5:19 Wow! If I add [cider/cider-nrepl "0.9.0-SNAPSHOT"] to an empty profiles.clj, it relocates me to Malta.

5:23 mbuf: are there any performance benchmarks available for Clojure?

5:24 mnngfltg: mbuf, compare to other languages you mean?

5:24 mbuf: mnngfltg, yes, I have seen the alioth one already

5:24 mnngfltg, at least with C

5:25 mnngfltg: mbuf, well it compiles to java bytecode, so it could be similar to java in the best case

5:25 mbuf: mnngfltg, I see

5:26 SagiCZ: it is quite a bit slower than java in most cases

5:26 since you've got immutable collections

5:27 mbuf: SagiCZ, I see

5:28 SagiCZ: but then again you could design your application in a more efficient way with functional programming.. using lazy sequences and all that.. so in the end it could actually be faster then traditional java design

5:28 stain: it is like comparing apples and oranges

5:28 exactly.. you should not compare how fast you can iterate over a billion integers

5:28 mbuf: SagiCZ, stain I get the picture

5:29 stain: however those kind of algorithms can be made insanely fast also with clojure and the odd type hint

5:30 building with immutable datastructures also makes it so much easier to parallelize a clojure app, while in Java you have to go through everything like a tax inspector to see where it could fall over

5:31 SagiCZ: stain, to be honest, its not as easy as slapping pmap wherever you have a map.. you do have to think about it a bit

5:31 mbuf: okay

5:32 mnngfltg: mbuf, I'd say it's fast enough for many things, and you can always drop down to java for your inner loops if you wish

5:32 mbuf: mnngfltg, okay

5:33 SagiCZ: and Java is fast enough for anything apart from games and HFT

5:33 stain: SagiCZ: of course, unless you have one of those "embarassingly parallelizable" problems it still requires planning. What I mean is that you will more easily have put in the foundations in order to do so anyway if you do it the Clojure way

5:33 SagiCZ: stain: agreed

5:33 stain: but with Java 8 you are also getting that with Streams

5:33 which I found accidentally breaks lots of the classic coding patterns

5:33 mnngfltg: there are also many optimizations you can do with Clojure -- transients, memoization, type hints, ..., and you can add them when you notice performance problems

5:33 SagiCZ: Java 8 made me really rethink if I need clojure at all and I am still not sure.. I love Java 8

5:34 streams, lambdas, filters.. just fantastic additions IMO

5:35 stain: e.g. trying to populate a classical Hashmap from Stream.forEach gave me randomly missing elements as I forgot that Hashmap was not threadsafe and that I was actually using threads under the hood

5:35 yeah, I think it's a great way forward.. and it's a paradigm shift for javacoders as finally you are "allowed" to write 'just functions' again

5:35 I can see why they took so long

5:36 as in Java 8 it's quite a substantial change all over

5:36 SagiCZ: to me the new stuff seemed very polished, useful and intuitive

5:36 stain: exactly.. it is not just thrown together like "Oh, we need lambdas, right"

5:37 here's the longest Stream call I've written so far: https://github.com/apache/incubator-commonsrdf/blob/master/api/src/test/java/org/apache/commons/rdf/api/AbstractGraphTest.java#L281

5:37 it does get a bit weird.. but if you read it with Clojure eyes it's quite understandable

5:37 but of course the casting comes in there to ruing everything :)

5:39 SagiCZ: i think the code is pretty readable.. also you can always split .. and you can define your lambdas as variables to name them (self-doc) and later combine them etc

5:39 i do this with filter lambdas that I use more than once in a class

5:40 stain: exactly, just introducing some names.. like in Java's lambda you have to give a name to the lambda parameters, but don't need to say their type. That is quite neat, and also has a nice step-up from the for-each syntax.

5:41 TEttinger: SagiCZ, java's fast enough for many games too, since everything just calls into OpenGL anyway

5:42 and since games are typically long-running, JIT can kick in

5:42 SagiCZ: TEttinger: I know.. just didnt want to complicate the argument

5:42 wasamasa: the question is of course whether the programmer will not screw up when making the game :P

5:43 TEttinger: yeah, I think the main issue with java is that you don't know if end users have a JVM anymore. stuff like Packr helps with that

5:43 wasamasa: so far I've seen only one that didn't go all bonkers, nullpomino

5:43 oddcully: wasamasa: s/game/program/ fixed it

5:43 wasamasa: and ran wonderfully on a netbook

5:44 SagiCZ: TEttinger: I wished Microsoft packed JVM to regular Windows updates as is done with .NET framework

5:44 s/wished/wish

5:44 stain: what I have not tried yet in Java 8 is to try to make my own functional interfaces outside Streams. That is still just flows much more naturally in Clojure, while in Java 8 you have to think a bit about it (and be inspired by Stream) to do it right, and not just build a light-weight Inversion of Control pattern

5:44 TEttinger: SagiCZ, you don't even know if the end users have windows update

5:44 some people running win7 have windows update permanently turned off (pirates, probably)

5:45 stain: I've used install4j which bundles whatever JDK you want for any OS

5:45 TEttinger: yeah, I use Packr for the same thing

5:45 you don't need a mac to make a mac app, etc.

5:45 SagiCZ: TEttinger: Well you don't even know if the end users have a computer.. what kind of argument is that?

5:46 TEttinger: stain and I are talking about bundling the VM with the app

5:46 which works pretty wel

5:46 l

5:46 it's better when the VM is tiny, like for Lua

5:46 oddcully: TEttinger: libgdx packr?

5:46 TEttinger: yes

5:46 oddcully: this working well?

5:46 clojurebot: Titim gan éirí ort.

5:46 TEttinger: I made lein-packr too

5:46 try it out maybe?

5:47 https://github.com/tommyettinger/lein-packr

5:47 lein-packr only works for 32-bit windows, 64-bit linux, and 64-bit mac

5:47 oddcully: i fooled around with libgdx and groovy some time ago. and i came by that, as i thought halfway (?) is using it

5:47 stain: TEttinger: ah, good to know I am not the only one relying on alexkasko's OpenJDK builds :)

5:48 TEttinger: stain: I'd encourage switching to Zulu soon

5:48 more recent packr works with linux 32 bit as well, but breaks the passing of VM args to clojure and scala apps

5:48 which is weird

5:49 if you do lein uberjar, and try to run the jar the way packr 1.3 does, it will always fail

5:49 wasamasa: hotspot, why do you keep gobbling my RAM

5:49 stain: TEttinger: ok, well, in fact we have to switch to Oracle JRE for some strange reason.. as our project moved to Apache Software Foundation which don't like GPL

5:49 but commercial stuff is OK

5:49 TEttinger: but if you use packr 1.1 like I do, it works fine

5:49 zulu isn't actually commercial, but they have a commercial product too

5:50 http://www.azulsystems.com/products/zulu/downloads

5:53 stain: TEttinger: thanks for the links, I see they have docker images as well, which I appreciate

5:54 TEttinger: cool!

6:31 SagiCZ: ,(require '[clojure.core.async :refer [<!! chan merge]])

6:31 clojurebot: #error {\n :cause "Could not locate clojure/core/async__init.class or clojure/core/async.clj on classpath."\n :via\n [{:type java.io.FileNotFoundException\n :message "Could not locate clojure/core/async__init.class or clojure/core/async.clj on classpath."\n :at [clojure.lang.RT load "RT.java" 449]}]\n :trace\n [[clojure.lang.RT load "RT.java" 449]\n [clojure.lang.RT load "RT.java" 412]\n [cl...

9:53 J_Arcane: This might be helpful to someone as dense as me: https://github.com/jarcane/multipage-reagent

10:10 istate: yea.. true.. css alwas gets so messykkkllkkkjjjkkkkkkjclo

10:58 fourq: Does Clojure/conj have a location yet or still TBD? (Nashville please)

11:37 damian_: Hello. Is anyone familiar with using hiphip library?

11:39 I'm trying to use dot-product function (https://gist.githubusercontent.com/w01fe/5963993/raw/hiphip_dot_product.clj)

11:41 Yet input: (dbl/dot-product (1 2) (1 2)) gives me error: ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn

11:41 oddcully: damian_: this would call 1 as fn

11:42 damian_: '(1 2)

11:43 damian_: Oh, typo. I've already tried [1 2], '(1 2) and (1 2). Everything with the same effect

11:45 => (dbl/dot-product '(1 2) '(1 2)) ClassCastException clojure.lang.PersistentList cannot be cast to [D

11:47 oddcully: but that's a different error

11:47 have you tried http://conj.io/store/v1/org.clojure/clojure/1.7.0-alpha4/clj/clojure.core/double-array/

11:47 thomlawrence: seems from the docs that hiphip works with arrays

11:47 oddcully: , (.getClass (double-array 1))

11:47 clojurebot: [D

11:47 oddcully: erm

11:49 gfredericks: is there a thing for clojure.test that runs tests as files change?

11:50 thomlawrence: https://github.com/jakepearson/quickie works pretty nicely

11:50 justin_smith: gfredericks: I know there is a lein plugin for that

11:51 thomlawrence: also if you're in emacs it's reasonably easy to have a hook that runs tests in your REPL when you save

11:51 damian_: Ok, works like thaht:

11:51 => (dbl/dot-product (double-array '(1 2)) (double-array '(2 3))) 8.0

11:52 Many thanks

11:52 oddcully: yw

11:54 gfredericks: thomlawrence: yeah emacs works fine, this is for non-emacs :)

11:54 thomlawrence: quickie looks good, thanks!

12:21 arav93: Hi, how does is-tc-e and is-tc-err work?

12:22 If there is anyone who is familiar with it, please help me out!

12:22 :)

12:25 justin_smith: arav93: do you want to know how it is implemented or how to use it? the implementation seems simple enough https://crossclj.info/ns/org.clojure/core.typed/0.3.0-alpha4/clojure.core.typed.test.test-utils.html#_is-tc-e

12:26 arav93: I want to know how it is used justin_smith

12:27 justin_smith: arav93: it's meant to be called in a deftest, using clojure.test

12:27 as a replacement for clojure.test/is

12:28 arav93: Oh ok

12:28 justin_smith: arav93: sadly I can't point to a good example - the reason that's a crossclj.info link is I intended to point out how some project was using it in their tests, but no project followed by crossclj.info is using it

12:29 arav93: It's ok, thanks for your help anyways justin_smith :)

12:29 justin_smith: I should qualify what I said a bit - it isn't a general replacement for test/is - it's a variant that simply tests if something is properly / improperly typed

12:43 Shayanjm: I'm trying to export a large list of maps to csv. Here's what i've got so far: https://gist.github.com/shayanjm/5cc95e71a3f3492084e6

12:43 in the CSV, however, it looks like the vector elements are getting quoted unnecessarily

12:44 any idea how I can prevent that from happening? I'm using clojure.data.csv but couldn't find any documentation re: using the quote? predicate

12:45 justin_smith: Shayanjm: csv doesn't do trees, so the compromise there is to represent the nested collection as a single string

12:46 Shayanjm: justin_smith: sure - but the inner elements are also getting double quoted, is this the expected behavior?

12:46 justin_smith: Shayanjm: one alternative would be to make a line in a separate csv for each vector, with a linked unique id

12:46 Shayanjm: that's the only way to represent something inside a string that should itself be a string

12:46 Shayanjm: Right, didn't think that one through

12:47 is there a way to change the quote delimiter?

12:47 i.e use single quote vs double for clarity?

14:25 andyf_: gfredericks: seventy-one. So ... much ... pull request ... discussion ....

14:26 Is this performance art?

14:27 chouser: spontaneous performance art? Like a drum ciricle?

14:30 andyf_: Shoot, now I'm actually going to spend a few minutes wondering what kind of pull request to submit to that repo.

14:34 gfredericks: (inc andyf_) ;; for contributing to open source

14:35 andyf_: I mentioned earlier that I'd accept (defn seventy-one? [x] (= x seventy-one)) and don't think anybody's bothered yet

14:39 SagiCZ: i was thinking of adding some id to my entity objects .. (they are just maps) .. is there some mechanism in clojure core for generating random ids? i dont need zillions of them so UUID seems like an overkill

14:40 gfredericks: &(gensym) like this?

14:40 SagiCZ: something like {:name "Jack" :id "#6421" :age 45}

14:40 gfredericks: whar ar the bots!!

14:40 SagiCZ: ,(gensym)

14:40 clojurebot: G__27

14:40 SagiCZ: um.. that sounds like something you would use in a macro..

14:41 andyf_: This #clojure channel log hasn't been appended to in a couple of days, probably because the bot that does it is down: http://logs.lazybot.org/irc.freenode.net/%23clojure

14:41 tbaldrid_: I often do this:

14:41 ,(do (let [a (atom 0)] (defn make-id [] (swap! a inc))) (make-id))

14:41 clojurebot: 1

14:42 gfredericks: ,(defn make-id (partial swap! (atom 0) inc))

14:42 clojurebot: #error {\n :cause "Parameter declaration \"partial\" should be a vector"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.IllegalArgumentException: Parameter declaration \"partial\" should be a vector, compiling:(NO_SOURCE_FILE:0:0)"\n :at [clojure.lang.Compiler macroexpand1 "Compiler.java" 6644]}\n {:type java.lang.IllegalArgumentException\n :message "Paramete...

14:42 SagiCZ: tbaldrid_: I see. thats something I would do too.. I was just wondering if there is some mechanism already bundled with clojure

14:42 gfredericks: ,(def make-id (partial swap! (atom 0) inc))

14:42 clojurebot: #'sandbox/make-id

14:42 tbaldrid_: although you did say "random IDs" so I'm not sure what you mean by that

14:42 gfredericks: ,(make-id)

14:42 clojurebot: 1

14:42 tbaldrid_: ooooh partial, I like it

14:42 SagiCZ: tbaldrid_: something like UUID generator returns.. they are not sequential

14:43 amalloy: dangit i restarted lazybot recently, andyf_. why is he dead again. i blame you

14:44 tbaldrid_: SagiCZ: what do you need the randomness for?

14:44 puredanger: fourq: re your question about the conj, no location yet but unlikely to be Nashville :)

14:44 andyf_: amalloy: I must have killed it at least once some time, so accepted.

14:44 SagiCZ: tbaldrid_: I guess I don't really need it to be random.. just thought it would look better.. but as I think about it the generator would more efficient if it just inc'ed

14:45 amalloy: anyway he's back

14:45 chouser: Nashville would be fun. Or New York City, if you think they can handle the extra traffic the Conj would create.

14:45 fourq: puredanger =)

14:46 Nashville is having CodeConf here this year

14:51 SagiCZ: gfredericks: why did you use partial when you dont want to add any more arguments later when calling the make-id?

14:52 amalloy: SagiCZ: to close over (atom 0) instead of recreating it each time the function is called

14:54 SagiCZ: thanks

14:55 so I could create the same thing like this?

14:55 (def make-id (let [a (atom 0)] (fn [] (swap! a inc))))

14:55 amalloy: SagiCZ: that is exactly the thing tbaldrid_ described, before gfredericks proposed the partial version as an improvement

14:56 personally i like the partial version less

14:56 tbaldridge: partial and comp make everything better ;)

14:56 SagiCZ: yeah I was just trying to rewrite it into something I understand

14:56 i didnt know partial creates closure like this

14:57 amalloy: SagiCZ: it just follows naturally from the fact that partial is a function

14:57 tbaldridge: SagiCZ: the source of partial is pretty simple: https://github.com/clojure/clojure/blob/clojure-1.6.0/src/clj/clojure/core.clj#L2460

14:57 amalloy: (partial (atom 0) ...) must evaluate (atom 0) exactly once, before even calling partial

14:58 and then the value of that (which is an atom) is used thereafter, rather than the expression being re-evaluated each time

14:58 SagiCZ: i understand

14:58 thanks

15:08 how could I drain a core async channel? I know "into" but it waits until the chan closes

15:08 tbaldridge: as in take as many things as you can, but don't wait for closing?

15:08 SagiCZ: yep

15:09 tbaldridge: put async/poll! in a loop

15:09 but that's only in the SNAPSHOT versions of core-async

15:09 SagiCZ: yeah i dont have poll

15:09 nevermind

15:09 tbaldridge: you can also use (alts! [c] :default nil)

15:09 SagiCZ: can i just put <!! in a loop?

15:09 tbaldridge: that'll block when you take the last item

15:10 SagiCZ: i see

15:11 what does "alt" mean? alternative?

15:13 tbaldridge: SagiCZ: if you do this: (alts! [c1 c2]) it will take one value from one channel, or the other, but not both

15:13 So it's a `select` if you're familiar with async io in C

15:13 _alejandro: SagiCZ: it's like a select (lets you receive a value among multiple channels); I imagine it is named after alternative

15:14 tbaldridge: (alts! [c] :default nil) says "take a value from c, but if there isn't one available, return nil instead)

15:14 so that will either return [c val] or [:default nil] to let you know what happened.

15:14 SagiCZ: tbaldridge: well thats handy!

15:15 i want to use channels for the event flow in my application.. just dont know how to avoid "over"using them.. is there anything channels are particulary bad at?

15:17 tbaldridge: yeah, they aren't exactly super fast. Not slow mind you, but there's a few locks inside of them. So don't send super small messages super fast.

15:17 But besides that, not really.

15:17 _alejandro: SagiCZ: I think there's some overhead to each channel, so depending on your performance needs it could be an issue

15:17 stuartsierra: Don't mix channel operations with computation or side effects. Try to keep them separate.

15:18 tbaldridge: Also, try to keep you go blocks and channels alive. Don't create whole graphs just to throw them away.

15:18 _alejandro: SagiCZ: I think you can reduce that overhead via transducers (assuming the operations happening between channels are cheap)

15:18 tbaldridge: If you can create a static graph and flow data through it, perfect!

15:18 _alejandro: tbaldridge: would you say that's true of thread blocks too?

15:18 SagiCZ: tbaldridge: i have drawn a static graph on paper already... that will get built and initialized on start and stay that way forever

15:19 however I will send small messages.. up to about 5 times a second.. is that considered too fast for channels?

15:19 tbaldridge: _alejandro: yeah, it's pretty much true of all of core.async.

15:20 SagiCZ: oh no, I'm saying don't send 1million ints a second over a channel

15:20 SagiCZ: tbaldridge: oh thats alright then!

15:20 and when I mult a channel.. do the values get physically copied? as in do they take up more space in memory?

15:20 tbaldridge: SagiCZ: no, nothing is copied, so use immutable data :)

15:21 SagiCZ: great

15:22 why do people say that channels break immutability? or do they mean that the channel itself is mutable?

15:22 tbaldridge: SagiCZ: yes channels are mutable, hence the ! in <! and >!

15:22 SagiCZ: oh.. i thought they were excited funnels

15:26 m1dnight_: Can I apply recur?

15:26 It seems like I cant? OR am I mistaking?

15:27 amalloy: m1dnight_: you can't, but you probably don't want to

15:27 do you have an example where you think you want to?

15:27 m1dnight_: Well, i'm doing some convoluted stuff for my thesis.

15:28 What I want to achieve is evaluate the arguments to recur, apply a function to them and then put them back to recur

15:28 so something like (recur x y) --> (let [recurargs [x y] processed (process-args [x y])] (recur processed))

15:28 amalloy: m1dnight_: the thing is, you always have a fixed number of arguments at a recur point, so applying a list doesn't really make a lot of sense

15:29 m1dnight_: I know.

15:29 Just wondering how I could achieve something like that.

15:29 amalloy: you can just write (let [[x y] (process-args [x y])] (recur x y))

15:29 m1dnight_: yeah but its a macro so all I have is a list

15:30 I have a walker that handles each clause that matches (= (first form) 'recur)

15:30 amalloy: you want a macro to replace the call to recur?

15:30 m1dnight_: yeah, I have a macro that allows the user to use recur, and inside that macro I want to process the arguments to recur.

15:30 Not sure if im conveying what I want to achieve

15:30 amalloy: m1dnight_: sure, so you have a list like '(recur (f x) (g y))

15:31 m1dnight_: derp

15:31 why didnt I think of that lol

15:31 oh wait.

15:31 but suppose I have the original form (recur x y z)

15:31 amalloy: that's my point, that's the list you already have

15:31 and it's not hard to transform that into the list '(let [[x# y#] (process [(f x) (g y)])] (recur x# y#))

15:31 m1dnight_: I want to pass x, y, and z as 1 parameter to a function. So I have to pass them as a list/array and I can only return a list/array.

15:32 And then im stuck in applying recur to those arguments.

15:33 amalloy: i feel like you're not hearing what i'm saying. what i'm saying is, you have a list already, which has recur as its first element

15:33 and you want to transform it into another list, which looks like (let [...] (recur ...))

15:33 looking like the most recent snippet i posted

15:33 m1dnight_: ooohhhh

15:33 amalloy: and that is not a difficult transformation to do, so you can just do it

15:33 m1dnight_: right, now im getting it

15:33 right, right, right :)

15:34 Haha, sorry I was a bit slow on that one.

15:34 Thanks amalloy

15:34 (inc amalloy)

15:34 lazybot: ⇒ 276

15:35 amalloy: (defmacro silly-recur [& args] (let [syms (map (fn [_] (gensym)) args)] `(let [~@syms (process [~@args])] (recur ~@syms))))

15:35 something like that, anyway. i haven't tested it, just typed it into irc

15:37 where you won't actually define silly-recur as a macro, but use that logic in whatever weird code-walker you already have

15:37 m1dnight_: hehe, weird indeed :)

15:37 I think i got it working amalloy

15:37 thanks for the patience

15:39 SagiCZ: whats the thing one should use when one wants to "map" over seq but ignore the result?

15:39 doseq?

15:39 clojurebot: doseq is like for, but for side effects instead of values

15:39 SagiCZ: haha I dont even need humans!

15:40 amalloy: #clojure is finally fully-automated

15:40 SagiCZ: :D

15:40 andyf_: for?

15:40 clojurebot: for is awesome

15:41 SagiCZ: very helpful

15:41 (inc clojurebot)

15:41 lazybot: ⇒ 51

15:41 adereth: (inc clojurebot)

15:41 lazybot: ⇒ 52

15:41 andyf_: I was wondering whether it would respond "for is like dose, but for values instead of side effects" :)

15:42 amalloy: there are a few examples of corecursion in clojurebot's factoid list, but i don't remember where they are

15:59 justin_smith: ~corecursion

15:59 clojurebot: I don't understand.

15:59 justin_smith: ~corecursion is a definition cycle

15:59 clojurebot: A nod, you know, is as good as a wink to a blind horse.

15:59 justin_smith: ~definition cycle is a corecursion

15:59 clojurebot: A nod, you know, is as good as a wink to a blind horse.

15:59 SagiCZ: ~SagiCZ

15:59 clojurebot: No entiendo

16:00 tmtwd: ~( + 32 32)

16:00 clojurebot: No entiendo

16:01 tmtwd: (inc 2)

16:01 lazybot: ⇒ 3

16:01 tmtwd: what is the whole point of ~

16:01 ?

16:01 SagiCZ: ~doseq

16:01 clojurebot: doseq is like for, but for side effects instead of values

16:01 SagiCZ: ~clojurebot

16:01 justin_smith: tmtwd: it invokes clojurebot's factoid functionality

16:01 clojurebot: clojurebot has a poetic soul

16:02 justin_smith: tmtwd: which is distinct from its clojure evaluation

16:02 tmtwd: oh

16:05 test

16:09 creese: I'm using rabbitmq and core.async. Does anyone know what this exception means? "java.lang.AssertionError: Assert failed: No more than 1024 pending puts are allowed on a single channel. Consider using a windowed buffer."

16:09 https://gist.github.com/creese/7008cb444a042b894fa9 <— full stack trace

16:10 tbaldridge: creese: yes

16:10 do you have a copy of the code?

16:10 amalloy: it means you are putting a zillion things into a channel and not reading them out

16:10 tbaldridge: it's more nuanced than that'

16:11 you have more than 1024 things parking on a channel. You can have as many things as you want in a channel as long as you give it a buffer

16:11 So either you're spining up more than 1024 go blocks and they're all trying to >! onto the channel

16:11 amalloy: tbaldridge: in that it suggests there are a zillion different go blocks also?

16:11 tbaldridge: or you're using put! without respecting backpressure

16:15 SagiCZ: calling mult multiple times on the same channel returns different mults?

16:15 creese: tbaldridge: Here's a code snippet. LMK if you need more. https://gist.github.com/creese/063193bd3b6fce1ae480

16:17 m1dnight_: amalloy: could you have a look at my macro? Im still nog getting it right.

16:17 hiredman: what is there to say? you are put!'ing things in to a channel as fast as you can as they come off rabbit, without waiting waiting for the consumer on the other end of the channel

16:17 amalloy: hiredman: better than that, there isn't even a consumer afaict

16:18 creese: there is

16:18 SagiCZ: does calling mult multiple times on the same channel returns different mults?

16:18 hiredman: creese: so stop doing that

16:19 m1dnight_: I dont understand quite yet how I can expand a list that is bound to a symbol defined inside my `(..) expression

16:19 creese: https://gist.github.com/creese/063193bd3b6fce1ae480 <— I've updated this with the code for the consumer

16:19 amalloy: m1dnight_: sure, i guess. have you tried just copying the one i gave, and fixing the [] i forgot to put in, though?

16:19 tbaldridge: creese: hiredman is right. put a callback at the end of the call to put!

16:20 m1dnight_: yeah, well based on that one though

16:20 hiredman: or use the blocking version of put

16:21 tbaldridge: yeah, or that

16:21 hiredman: (if however whatever rabbit library you are using is ok with you blocking the handler thread)

16:21 m1dnight_: hld on, its rather small

16:21 https://www.refheap.com/102029

16:21 this is what I have so far

16:22 And now I get the rror that long can not be cast to fn, so it's probably evaluating the res#, instead of interpreting it as a list. So all I have to do now is expand it and wrap it in a seq (to prepend to it)

16:22 But i cant figure it out.

16:22 Macro tutorials are not really elaborate about it either.

16:23 brb doorbell

16:23 amalloy: line 10 is just total gobbledegook

16:24 honestly just replace it with something that looks exactly like the paste i gave you: (let [syms (map (fn [_] (gensym)) recur-args)] `(let [[~@syms] (process [~@recur-args])] (recur ~@syms))))

16:26 m1dnight_: okay ill give it a shot

16:27 amalloy: that is, replace lines 9 and 10 with that

16:31 m1dnight_: right right right right

16:32 now I get it, the part with the gensyms is the trick i didnt get

16:32 thanks amalloy

16:32 (inc amalloy) and again!

16:33 creese: hiredman: thanks, I'll try the blocking put

16:34 m1dnight_: finally :) thanks man, realy

16:34 really*

16:34 tbaldridge: creese: be sure to read the specs to make sure your Rabbit library won't freak out if you block the callback thread

16:39 SagiCZ: so this is the graph I want to build with channels https://i.imgur.com/4rSQS1d.png .. so far I have this https://www.refheap.com/102030 .. am I doing something completely wrong? I am kind of thrown off by all the options core.async has.. not sure if I should use pipes, pipelines, transducers and what-nots.. this seems to work as I expected

16:42 i have just the first two levels of course

16:42 donbonifacio: I have a service that boots in 5s (aot), if I add javaagent:newrelic, it takes 23s. Anywone knows if I can make this better?

16:45 tbaldrid_: dogonthehorizon: sounds like a question for newrelic

16:47 donbonifacio: true

16:48 SagiCZ: ~am I here?

16:48 clojurebot: I don't understand.

16:48 SagiCZ: ok

17:04 Seylerius: If the listener function on a GUI button takes a bunch of GUI data, passes it through a parser and a solver, and gets a set of solutions back that I want to move around through using a slider, what's the best place to put the vector of solutions?

17:04 SagiCZ: local variable?

17:05 Seylerius: SagiCZ: Wouldn't that be local to the listener function?

17:05 SagiCZ: it would

17:05 but the computation should be on a non GUI thread anyways

17:05 Seylerius: I need the button's listener function to stash the vector of solutions somewhere that the slider's listener function can get at it.

17:06 Because when the slider gets slid, it needs to display a different solution.

17:07 SagiCZ: I don't want to stick it in a global...

17:07 SagiCZ: i understand that

17:08 you could close over the listener function though

17:08 Seylerius: Hmm... Since the slider doesn't appear until after the solver's done solving, the solve-button's listener function could create the slider's listener function.

17:08 SagiCZ: Example?

17:10 SagiCZ: what gui framework are you using?

17:14 Seylerius: SagiCZ: Seesaw

17:14 SagiCZ: yeah seesaw has a binding api if I recall correctly.. so maybe you could bind the solution vector to the slider?

17:17 Seylerius: SagiCZ: That's gonna be a negatory. A combobox will do it, but a slider just does numbers.

17:17 SagiCZ: umm.. i thought you could do very custom bindings.. but maybe its mixing up with my JavaFX experience

17:20 Seylerius: If I use fn, then any variables in scope when I do that are available, right?

17:20 Actually, easy test:

17:20 SagiCZ: yes.. thats called "closure" or "closing over fn"

17:20 Seylerius: Thought so.

17:21 SagiCZ: it usually solves those problems but unfortunetely my clojure is very rusty so i cant throw in an example that would solve your problem

17:21 Seylerius: That's clear enough, though, so I can work with it. Thanks.

17:21 ,(let [foo "foo"] (map #(str foo %) (range 3)))

17:21 clojurebot: ("foo0" "foo1" "foo2")

17:21 Seylerius: Yep

17:23 marthall: Hello everyone!

17:24 Seylerius: Hello marthall

17:24 SagiCZ: hi

17:25 marthall: I'm a beginner in clojure, and I'm trying to update a variable inside a loop. Of course this is not working, as I'm familiar with the immutability: I think this gist explains my problem, but I can't find a good solution. Any tips? https://gist.github.com/marthall/5b09e3b2c1a07dd41d3d

17:25 SagiCZ: marthall: taking a look

17:26 marthall: Thank you SagiCZ

17:27 SagiCZ: marthall: I think you want reduce and not doseq.. reduce goes through a sequence computing something from accumulated value and the next value in sequence finally producing one result (your input)

17:27 reduce?

17:27 clojurebot: reduce accumulates the men from the boys

17:27 SagiCZ: ~reduce

17:27 clojurebot: reduce accumulates the men from the boys

17:27 m1dnight_: :D :D :D

17:27 SagiCZ: so helpful

17:27 m1dnight_: what do you want to know SagiCZ ?

17:28 SagiCZ: (doc reduce)

17:28 clojurebot: "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val is supplied, returns the result of appl

17:28 SagiCZ: i just wanted to show the doc for marthall

17:28 m1dnight_: oh

17:29 marthall: Thanks alot SagiCZ. I've used reduce in python, and thought that was the one, but I was not sure. I'll look further into it :)

17:30 amalloy: marthall: you want (reduce (fn [input [w b]] (sigmoid ...)) input (map vector ...))

17:30 SagiCZ: marthall: more imperative solution would be to use loop and update your input var via "recur".. something like

17:30 (loop [[w b] coll, input input] ... (recur (next coll) (sigmoid (+ (dot w input) b)))

17:31 but yeah.. its a classic reduce problem

17:31 amalloy: SagiCZ: not quite: you'd need [[w b]] coll, at least. it's still hard to detect when coll is empty, though, which is one reason reduce is nicer

17:32 SagiCZ: ,(not (seq []))

17:32 clojurebot: true

17:32 SagiCZ: ,(empty? [])

17:32 clojurebot: true

17:32 amalloy: SagiCZ: uh huh, but my point is you never actually have a coll to call seq on, in the snippet you laid out

17:33 you just have w and b

17:33 SagiCZ: amalloy: you are right.. sorry

17:33 you would need another var to keep the coll in

17:34 marthall: amalloy & SagiCZ: Thanks guys, I'll give it a shot and come back if I fail. This is my first time in this channel, and I have to say I'm astonished by how helpful you are!

17:34 SagiCZ: marthall: as was I my first time here.. this channel is nothing like other channels on freenode

17:35 * m1dnight_ points at some other JVM language channels

17:36 SagiCZ: m1dnight_: oh yes.. very much that.

17:36 m1dnight_: friendly bunch in here <3 :>

17:39 uptown: oh yeah? let's put that to the test haha. i'm using boot, and thus defclifn in my app, which is made up of system/components. What's the best way for compponents to supply their own defclifn option definitions and for the top scope to aggregate them?

17:40 m1dnight_: Id help, but I have no idea what any of those things are :p

17:40 uptown: you're excused

17:43 justin_smith: uptown: so things that are initialized by the component system need to be able to provide configuration to boot?

17:44 uptown: justin_smith: it would be DRY-er that way

17:45 SagiCZ: [[:a 0] [:b 3]] -> {:b 3, :a 0} ?

17:46 justin_smith: SagiCZ: ##(into {} [[:a 0] [:b 3]])

17:46 lazybot: ⇒ {:a 0, :b 3}

17:47 SagiCZ: thank you

17:47 justin_smith: np

17:59 alexyakushev: Bronsa: Hello, can I still ask you that classloader question?

18:20 sdegutis: Given two collections of items with some overlap, is there a way to tell how many of one collection are in the other?

18:21 (f #{1 2 3} #{2 3 4 5}) => 2

18:21 What's f?

18:21 SagiCZ: ,(count (intersection #{1 2 3} #{2 3 4 5}))

18:21 clojurebot: #error {\n :cause "Unable to resolve symbol: intersection in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: intersection in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol:...

18:21 sdegutis: Nice, thanks.

18:22 SagiCZ: its in clojure.set

18:23 amalloy: sdegutis: (comp count filter) works too

18:24 sdegutis: Neat.

18:35 amalloy: your way is so cool

18:35 it's almost abusive

18:35 (in the original, non-evil sense of the word)

19:31 andyf_: Any reference to the original, non-evil sense of the word "abusive"? Never heard of that.

19:47 Seylerius: Somehow, this code (http://sprunge.us/MDEa) is giving me "IllegalArgumentException Don't know how to create ISeq from: cube_sudoku_solver.core$gui_grid_box$fn__7607 clojure.lang.RT.seqFrom (RT.java:528)"

19:49 andyf_: Seylerius: A stack trace from (clojure.repl/pst *e) done immediately after the exception occurs could contain function names and line numbers that might help narrow down where your code was last involved.

19:49 Seylerius: andyf_: Coming up.

19:50 Stack trace from cider: http://sprunge.us/GMcJ

19:52 andyf_: The part where you do (map gui-square #(->> % ...)) looks suspicious. gui-square does not expect to take a function, does it?

19:52 Maybe #(->> % ...) should be (->> % ...) instead?

19:53 Seylerius: andyf_: I might be missing another map...

19:54 andyf_: This is not the problem, but this: (#(quot % 3) (dec num)) is more clearly written as this: (quot (dec num) 3)

19:54 Seylerius: Or... drop gui-square at the bottom of the ->>

19:58 amalloy: yeah the problem is definitely that (map gui-square f xs) line, but it's not totally clear what the actual fix is because it's hard to see what you're trying to d

20:21 Seylerius: Okay, this is my GUI setup function (http://sprunge.us/MDPi), but although the GUI is getting setup, the listeners do not seem to be firing.

20:23 mrcheeks: Seylerius:Is it some kind of toolkit such as seesaw vs pure swing?

20:23 Seylerius: mrcheeks: Seesaw.

20:24 amalloy: ~map

20:24 clojurebot: map is slightly retarded

20:24 amalloy: well. close enough, i guess

20:24 Seylerius: map is lazy

20:25 your listener function just returns a lazy sequence, and realizes zero elements of that sequence

20:25 gfredericks: clojurebot: forget map |is| slightly retarded

20:25 clojurebot: I forgot that map is slightly retarded

20:25 Seylerius: amalloy: Huh. But why isn't the mode-switch listener firing?

20:26 The line that starts (sc/listen mode-group selection ...)

20:26 amalloy: i dunno. i don't use seesaw, and i don't want to read that whole giant snippet. i just scrolled to the bottom and found one thing that was obviously wrong

20:27 Seylerius: amalloy: Well, thanks for that one. I swapped it for a mapv, to force it to complete immediately.

20:27 amalloy: What do you use for GUIs?

20:27 amalloy: i dunno. javascript? i don't really do any

20:27 Seylerius: Gotcha.

20:28 amalloy: like a decade ago i used swing by itself in java, but since then there hasn't been much of a compelling need

20:28 mrcheeks: Seylerius:Did you try the show-events of seesaw, debugging, etc?

20:30 Seylerius: mrcheeks: No. Do you have a debugger recommendation (I'm using Emacs+cider at the moment)

20:30 mrcheeks: Seylerius: I'm not clojure developer, just an enthusiast, but looking at your code, it is easily done in plain swing...

20:30 Seylerius: mrcheeks: I don't particularly know swing, or normal java.

20:31 mrcheeks: Seylerius:I believe that Arthur Malarba implemented some kind of debugger for Cider, few months ago, likely not complete but probably usable.

20:31 wildnux: Seylerius: i get "Unable to resolve var: cider.nrepl.middleware.debug/wrap-debug in this context" when i try to use cider-debug, how do you make it work?

20:32 I am trying to learn debugging clojure, but emacs and clojure both are new

20:32 mrcheeks: Seylerius:http://endlessparentheses.com/cider-debug-a-visual-interactive-debugger-for-clojure.html, I rarely use debuggers in general unless I'm completely clueless about what's going on after reading.

20:33 Seylerius:Again, I only do Clojure for fun, my paid work is all Java and sometimes Groovy.

20:34 Seylerius: mrcheeks: Thanks for the tip. That looks helpful

20:34 wildnux: Are you using cider 0.8 or 0.9?

20:34 wildnux: Seylerius: [cider/cider-nrepl "0.8.2"]

20:35 Seylerius: wildnux: Take a look at the link mrcheeks gave. You want 0.9.

20:35 wildnux: Seylerius: was just looking at it

20:35 :)

20:35 mrcheeks: thanks a lot.. I have been scratching my head for long time

20:36 Seylerius: (inc mrcheeks)

20:36 lazybot: ⇒ 1

20:39 mrcheeks: np, :-), life would be more enjoyable hacking some Clojure on daily basis with $$, all that Java, etc. is getting kind of boring. If I were a Clojure professional I'd have tried implementing a full debugger for Cider based on the previous work of Ritz (https://github.com/pallet/ritz -> JPDA)

20:41 wildnux: mrcheeks: I do java only at work, but clojure is the language I love, I am trying to be better so I can try finding clojure for next job ;)

20:42 gfredericks: monolithic macros make repl-driven development stupider

20:42 (M.M.M.R.D.D.S.)

20:43 it0a: a job in clojure would be so nice

20:43 mrcheeks: wildnux:nice not much Clojure happening in Canada as far as I know unless I build my own product. I'm "die hard" Emacs user, but maybe Cursive for IntelliJ is free, I think that it has a "good enough" debugger.

20:43 it0a: also sick of the day in/day out java nonsense

20:44 ~_~

20:44 clojurebot: No entiendo

20:44 TEttinger: it is unintended, yes

20:44 it0a: haha

20:44 TEttinger: $seen damian_

20:44 lazybot: I have never seen damian_.

20:45 TEttinger: what...

20:45 just this morning, [08:41;33] <damian_> Yet input: (dbl/dot-product (1 2) (1 2)) gives me error: ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn

20:45 TimMc: it0a: It is indeed pretty nice!

20:46 it0a: TimMc: so envious :P

20:46 TimMc: functionaljobs.com has Clojure positions here and there

20:46 TEttinger: TimMc, do you have a webslinging development job, or something more unusual?

20:47 TimMc: Web servers, yeah.

20:47 TEttinger: (I'd consider something like clojure backends for websites or clojurescript frontends to be the most common use?)

20:47 TimMc: A tiny bit of front end, a little Java here and there.

20:48 TEttinger: with more traditional lisp stuff like AI or other learning algorithm stuff probably being rare, but that's what Prismatic does, kinda

20:48 TimMc: Right now I'm on a non-Clojure project but I hope to be back in it in a month or so.

20:48 TEttinger: man, could Prismatic have picked a worse time to choose a name with PRISM in it for their data collection/recommendation service

20:48 Seylerius: TEttinger: You mess around with seesaw much?

20:49 TEttinger: yeah, a bit

20:49 Seylerius: My listeners are deaf.

20:49 TEttinger: not in a while

20:49 TimMc: TEttinger: Or a BETTER time? :-D

20:49 TEttinger: dun dun DUN

20:49 m1dnight_: do watched and atoms get recycled once they are out of scope?

20:49 Seylerius: Heh

20:49 m1dnight_: watches*

20:50 s/are out of scope/you leav their defining scope/

20:50 TEttinger: m1dnight_, I'd hope so, they are internally handled by java objects and java objects are garbage collected...

20:50 amalloy: m1dnight_: objects get garbage collected when there is no longer a path to them from a GC root (ie, a class's static members or a stack frame's local variables)

20:50 m1dnight_: okay then :)

20:50 amalloy: this applies to atoms as much as to anything else

20:50 m1dnight_: I was just wondering about the watchers in particular.

20:50 amalloy: watchers are just objects pointed at by the atom

20:50 m1dnight_: oh okay

20:51 Seylerius: TEttinger: Mind taking a look at this function (obviously it creates my GUI crap), and see if you can spot why the listeners refuse to listen? I've aliased seesaw/core to sc. http://sprunge.us/MDPi

20:51 TEttinger: sure, Seylerius

20:51 Seylerius: TEttinger: Thanks. What do you normally use for GUIs in clojure these days?

20:52 I'm quite certain the listener functions aren't actually getting called, because I've stuck a println in a couple and never see an output. A println before or after gets called, though, so the sc/listen lines are getting eval'd.

20:53 amalloy: Seylerius: printlns might go to a different stream than you expect, if they're being run from the swing dispatch thread

20:53 try looking in your *cider-nrepl* buffer or whatever it's called

20:54 Seylerius: amalloy: Yeah, that's where I'm looking. I've stuck a println right before and after the listener functions, and I see those outputs, but I never see the ones _inside_ the listeners.

20:54 TEttinger: Seylerius, it looks like you aren't ever adding stuff to the frame

20:55 are the buttons appearing?

20:55 Seylerius: TEttinger: Yeah, everything gets drawn right.

20:55 TEttinger: hm

20:55 Seylerius: TEttinger: Want the whole thing to try running it?

20:55 TEttinger: oh, nvm :content main-panel

20:55 Seylerius: TEttinger: Yep

20:55 TEttinger: nah, I'll keep looking at this for now

20:55 Seylerius: Kay, thanks.

20:56 TEttinger: I'm pretty sure I see something off

20:56 amalloy: Seylerius: i mean not your repl buffer, but the one that contains debug output from cider itself. in slime/swank that buffer was called *swank*; i'm not sure what it is in cider

20:58 Seylerius: amalloy: Nope.

21:07 TEttinger: Seylerius: so there's some examples in the tests, and they really look the same as your listen calls. https://github.com/daveray/seesaw/blob/develop/test/seesaw/test/event.clj#L110

21:08 oh!

21:08 there's a thing, Seylerius

21:08 your reset button should use doseq because its goal is to cause side effects, instead of using map

21:09 (at the bottom)

21:11 so I'm guessing with that being lazy, and the other listeners using when-let and possibly always getting nil in the binding, it's never getting to the bodies of the listeners

21:13 Seylerius: Hmm...

21:13 TEttinger: Seylerius: try using let instead of when-let and when you would get a value, insert some debug code to see if you got nil (like a case that handles nil in the first listen)

21:14 after :3d

21:14 Seylerius: TEttinger: Will do.

21:14 TEttinger: Simply returning nil oughta do for the nil cases, right?

21:15 TEttinger: I would print, which would return nil anyway

21:15 that way you can see what it's getting

21:16 it's been weird, I built up some experience with some kinda uncommon libraries when I was working on clojure games using some odd choices of library. in the last 24 hours, hiphip has been mentioned, Packr I managed to save someone's bacon, and now Seesaw is coming into play...

21:16 I hadn't thought about seesaw in like a year

21:17 m1dnight_: i recall that a few days/hours ago somebody was talking about a diff function for maps, am I right?

21:18 aha got it!

21:19 Seylerius: TEttinger: What are you using for GUI work these days?

21:19 If not seesaw?

21:19 TEttinger: I haven't done GUI work recently, when I do graphics stuff it's for games, using (very indirectly) OpenGL through many layers of nice wrappers

21:20 so I intended to use play-clj with a game, and use a java lib for certain aspects of the logic, things that are very array-heavy

21:21 I ended up just expanding on the java lib like mad

21:21 Seylerius: Wow

21:21 TEttinger: I'm still going to use clojure eventually with it

21:21 play-clj is really nice

21:22 relatively idiomatic clojure style that can do fancy stuff that's really verbose with libGDX (the library it wraps, which in turn makes OpenGL easy to use, relatively, from java)

21:23 Seylerius: TEttinger: That's interesting. I'll have to check that out...

21:23 What kind of game are/were you working on?

21:24 Also, I've swapped all the when-lets for lets, and the map for a mapv (to avoid laziness), but it's still not doing anything.

21:29 TEttinger: Hrm. Swapping when-let for let across the listeners didn't work, and swapping map for mapv didn't either. Nothing's getting called.

21:29 Oh, wait...

21:30 AHAH!

21:30 We have a useful error now!

21:31 TEttinger: Error output: http://sprunge.us/bgjX

21:31 The mode listener is what's failing.

21:33 TEttinger: ah cool!

21:33 Seylerius, sorry I was away, eating chinese food (it was good!)

21:33 Seylerius: Sounds good.

21:35 TEttinger: so the mode listener, that's (sc/listen mode-group :selection ...

21:36 Seylerius: TEttinger: Yep

21:36 TEttinger: it's selecting a widget rather than its value

21:37 you want to try to get the :id of the widget, with some sensible default if that fails

21:37 like (get s :id (println "this returns nil so don't use the result"))

21:38 then if whatever that returns is non-nil, you have :2d or :3d

21:40 Seylerius: TEttinger: Okay, now I'm getting two annoyances. One old (it takes two clicks to select a radio button), and one new ("Wrong number of args passed to keyowrd: :3d").

21:40 TEttinger: are you using a keyword as a function?

21:41 ,(:a {:a 1 :b 2})

21:41 clojurebot: 1

21:41 TEttinger: ,(:c {:a 1 :b 2})

21:41 clojurebot: nil

21:41 TEttinger: ,(:c {:a 1 :b 2} :default)

21:41 clojurebot: :default

21:41 Seylerius: Not meaning to, but I think it's trying to in the listener.

21:41 clojurebot: Gabh mo leithscéal?

21:41 TEttinger: can you sprunge up the code again?

21:42 xeqi: Seylerius: did you get your solver working?

21:42 TEttinger: that's this, xeqi :)

21:42 Seylerius: xeqi: Solver works great, GUI sucks balls.

21:42 xeqi: well, this is the gui for it

21:42 haha

21:42 Seylerius: TEttinger: http://sprunge.us/jGCQ

21:43 xeqi: Seylerius: anyone recommended making all those defs into a let binding yet?

21:44 Seylerius: xeqi: Not yet, but I can see it being a good idea.

21:44 xeqi: since they're in a defn, and def in a defn will still mutate the namespace

21:44 not just make a local definition

21:45 TEttinger: ah! (let [s (sc/id-of (sc/selection mode-group))]

21:45 if the selection isn't something that has an id, this could be trouble (like if it's nil)

21:46 Seylerius: TEttinger: Good catch.

21:46 TEttinger: so the body of (sc/listen mode-group :selection ... is where it's throwing the exception?

21:47 ah, I think I may have an idea here

21:47 the two clicks thing may mean you are listening to the group when you want to be listening to all the buttons, which is pretty easy to do with seesaw

21:49 Seylerius: TEttinger: Okay, that's easy enough to fix; listen to mode-buttons instead of mode-group.

21:49 TEttinger: https://github.com/daveray/seesaw/blob/develop/test/seesaw/test/event.clj#L206-L215

21:50 yeah, pass listen a vector of widgets, and when one has its selection change, you'll get notified, twice I think (once for one losing selection, once for gaining)

21:51 I think the selection is nil if a :selection event is triggered by being deselected?

21:51 it might not give events on deselection at all

21:51 Seylerius: TEttinger: Which is why it was a when-let binding, actually, according to the tutorial I'd looked at.

21:51 TEttinger: ahhhh

21:52 so going back to when-let, still getting the id, should work?

21:52 Seylerius: TEttinger: Yeah, that should do it.

21:52 TEttinger: and of course the listening to single widgets, I think that should be all for that fn...

22:00 Seylerius: TEttinger: Here's the tutorial, and I know this particular snippet worked. So this is weird. Changing to listening to the buttons themselves fixed the two click problem, though. https://gist.github.com/daveray/1441520#file-seesaw-repl-tutorial-clj-L446

22:04 Stepping out for food.

22:04 TEttinger: ah, that's the problem then

22:04 before it was listening to the group and getting a radiobutton back, and you were checking only for keywords (the :id of those radio buttons)

23:44 currentoor: I'm using the lobos library for writing migrations and lately I've had problems connecting to the DB. I keep getting the following error Attempting to call unbound fn: #'clojure.java.jdbc.deprecated/

23:44 Anyone else deal with this?

23:45 karan: .

Logging service provided by n01se.net