#clojure log - Nov 24 2014

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

1:18 daniel_: can anyone recommend any talks from the conj?

1:25 amalloy: yes, i recommend any talks from the conj

1:25 daniel_: none stand out?

1:30 amalloy: i haven't actually watched any of them this year. but as a general rule, there aren't many you'll be sad to have watched

2:03 andyf: daniel_: I have only watched a couple. Brian Goetz?s talk was a nice perspective on how to evolve a language while maintaining compatibility (Java), and some new cool things in Java 8 already, and value types coming in Java 9.

2:04 daniel_: thanks andyf

2:04 andyf: daniel_: I liked Colin Fleming?s talk on Cursive just because what Cursive looks like it can do is impressive.

2:04 daniel_: started watching the realtime data pipeline (kafka) one as its sounded relavent to my work

2:05 andyf: value types are in particular something I wished for a few days ago, realizing that something like them should be able to help implement many data structures in Java more efficiently in time and/or memory use.

2:24 littleli: I wonder how will they make them play nice with current implementation of generics

2:59 tephra: justin_smith: theses: iirc javafx is oracles swing replacement http://fxexperience.com/2013/01/modena-new-theme-for-javafx-8/

3:01 oh and that link is to the default look of javafx applications

4:25 pellis: hi all.. anyone using scala with lein?

4:49 gumghouls: anyone familiar with using lein repl :headless in a VM while having a nrepl session in the host ?

4:56 clgv: ~anybody

4:56 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

5:00 gumghouls: Using lein repl :headless in a VM running a nrepl session on port 50505. I can't connect from the host (using emacs and cider [nrepl client]). So I'm looking for docs or references

5:01 (ports are forwarded properly, I tested an http server inside the VM and could `curl`, so I expect the port 50505 redirection to be OK)

5:06 clgv: gumghouls: did you try connecting via lein from the host already?

5:06 gumghouls: just to make sure it is a connection problem and not a cider problem

5:10 gumghouls: clgv: I ran emacs/cider in the VM and connected to the running lein repl session

5:15 clgv: gumghouls: run "lein :connect ..." on the host, since you said you have problems conencting from the host with cider

5:15 ah no "lein repl :connect ..."

5:16 ;)

5:16 gumghouls: working on it

5:17 bars0: Hi all! I am a beginner in clojure and try to setup CIDER. I think I partially

5:17 succeed. But after conneccting with (C-C M-j) I've got message: "; CIDER 0.8.1

5:17 (package: 20141123.1045) (Java nil, Clojure 1.6.0, nREPL 0.2.3). WARNING: The

5:17 following required nREPL ops are not supported: ns-list ns-vars undef. Please,

5:17 install (or update) cider-nrepl 0.8.1 and restart CIDER". But the problem is I

5:17 don't see in melpa or marmelade any newer cider packages. In my project.clj I've

5:17 gumghouls: takes a while to connect but lein repl :connect 50505 works

5:17 bars0: defined [cider/cider-nrepl "0.8.1"] as well as in leiningen profiles.clj. Could

5:17 anybody can point me to any docs how to properly configure cider. BTW I am on

5:17 Win32, Emacs 24.4.

5:17 clgv: bars0: please do use e.g. refheap.com for multiline pastes

5:18 bars0: clgv: OK, sorry for that

5:18 clgv: gumghouls: now you know it is a cider problem

5:20 gumghouls: clgv: I'm still betting on a gumghouls problem, everything works locally inside the VM. I did (or forgot to do) something between the guest VM, the host and networking

5:21 clgv: gumghouls: well, one nrepl client, the one of leiningen, is working

5:22 gumghouls: but yeah, could still be missing configuration for cider instead of a cider bug ;)

5:22 szymanowski: hello, how can I see all class that implement a given interface or protocol?

5:22 clgv: szymanowski: afaik you can't.

5:23 szymanowski: ok :(

5:23 clgv: szymanowski: you could enumerate through the classpath and find out about all class names and then derive that data from these classes

5:23 szymanowski: yes it seems reasonable

5:24 clgv: javadoc can also only do that because it collects the whole information about all classes

5:24 gumghouls: yeah, blame it on the monkey, not the tools

5:24 szymanowski: How can I enumerate the classpath? :)

5:25 clgv: szymanowski: it is not trivial - so I ask the question: do you really need that?

5:25 szymanowski: I suppose no

5:25 :)

5:25 I will try to find do without

5:26 thank you

5:26 I will try to do without *

5:39 honza: java interop question: how can i use a class that mutates? create an instance, call a method that mutates the instance and returns void; and then i'm required to use a getter method to obtain the result

5:40 ddellacosta: honza: you mean, like, how you do you do standard Java interop with a regular Java object?

5:40 honza: are your questions not answered here? http://clojure.org/java_interop

5:42 honza: ddellacosta: it doesn't seem to work the way i understand it; i create a binding for the instance in a let, call the void method but then when i call the getter, the instance appears unchanged

5:43 ddellacosta: honza: paste the code into a refheap/gist etc. and let us take a look

5:44 honza: ddellacosta: here https://gist.github.com/honza/df6b08e8987608c5c898

5:44 ddellacosta: processDocument returns void

5:45 ddellacosta: honza: I mean, that looks right to me. I suspect this is unrelated to Clojure--can you get the same code to work in Java?

5:46 honza: ddellacosta: k, cool, thanks for the sanity check, i'll investigate in java land

5:46 ddellacosta: honza: got the javadocs for this API available publicly?

5:46 honza: sure thing

5:46 honza: ddellacosta: it's straight from the example - http://cssbox.sourceforge.net/pdf2dom/documentation.php

5:46 ddellacosta: javadoc here http://cssbox.sourceforge.net/pdf2dom/api/index.html

5:48 ddellacosta: honza: yeah, that looks like a one-to-one translation from the Java example to me, should work. Maybe check dumb things, like file location and whatnot? Otherwise definitely doesn't seem Clojure-specific. Sorry I can't help more, don't know this lib. :-/

5:48 honza: ddellacosta: np, no need to waste more time :)

5:49 ddellacosta: honza: good luck. ;-)

6:10 clgv: honza: `doto` is helpful for those interop scenarios

7:03 justin_smith: honza: btw, every let has an implicit do block in it, you don't need do there

7:03 honza: justin_smith: welp, thanks

7:04 justin_smith: not a bug, of course, just a bit of verbocity / extra parens you don't need

7:45 honza: does anyone have any ideas why lein repl and the like use very different amounts of memory for different people? (independent of middleware and plugins)

7:46 some details here https://github.com/plexus/chestnut/issues/49

7:46 jaaqo: Yay, by trying to form my problem into a question to be asked here I solved my problem. Thank you!

7:47 justin_smith: jaaqo: rubber duck effect strikes again

7:49 honza: jaaqo: my favorite programmer phenomenon

8:08 i guess i should open an issue with lein

8:10 andyf_: honza: There is a leiningen email list, too

8:14 clgv: and a #leiningen irc channel

8:25 grandy: hello, i was reading the clojars web source and have a question about this file: https://github.com/ato/clojars-web/blob/master/src/clojars/auth.clj

8:25 why is try-account a macro?

8:25 justin_smith: do you happen to be around?

8:26 wondering if it's a macro b/c it's more concise or if there is something more fancy going on

8:35 anyone feel like answering that question -- just switched to a different connection -- still here

8:37 dnolen_: grandy: could be a function but would be uglier would have to take the series of statements to execute as a thunk. this macro is typical boilerplate removal.

8:39 grandy: dnolen_: ahh ok... it would be a thunk just to be lazy or does it have to be a thunk? not sure i understand that aspect fully

8:40 dnolen_: grandy: probably better to think through why it won't work since authentication must come first before anything else.

8:43 grandy: dnolen_: ahh ok, i'll do that :) appreciate the help

8:55 squeedee: conj was ace!

8:55 just putting that out there

9:02 grandy: wish i could have made it -- planning to watch the videos soon.

9:02 sooheon: squeedee: going through some of the talks now; so much goes over my head but the energy seems great

9:03 squeedee: sooheon the ones that go over my head just get filed in the back of my mind for when they make sense :D

9:03 I was lucky, I live in VA, just outside of DC

9:06 clgv: squeedee: did you see the "Clo" talk?

9:06 squeedee: is there a corresponding release?

9:06 squeedee: I saw the talk

9:07 clgv: it's still in its infancy, I think he's holding it to his chest, probably because it's a personal education piece for him

9:07 clgv: :(

9:07 squeedee: holy-moly sized project

9:13 grandy: whose project is that?

9:28 mavbozo: e

9:35 KnightsWhoSayHi: keeds: you don't work in leeds by any chance, do you? :-)

9:43 keeds: KnightsWhoSayHi: Wot! keeds from leeds? Nah.

10:15 mikos: you in the UK, KnightsWhoSayHi?

10:15 KnightsWhoSayHi: mikos: Yes.

10:15 mikos: cool, where?

10:16 KnightsWhoSayHi: Near Leeds - I was just curious if there were any companies using Clojure in and around Yorkshire.

10:16 mikos: i am a couple of hours north of Leeds

10:16 slowly trying to work it into my projects :)

10:17 KnightsWhoSayHi: I'm a sysadmin so there's not much hope for me to weasel it in... I have been using Amazonica though with great success :D

10:17 mikos: ah, cool

10:17 i'd not heard of that

10:18 back soon - gotta walk the dog!

11:26 mikerod: I often run into trouble with leiningen of the form "Could not transfer artifact <artitfact-name-here>from/to <repo-name> <etc> Return code is: 409 , ReasonPhrase:Conflict." then something like "If you are behind a proxy, try setting the 'http_proxy' environment variable."

11:26 However, these projects are also Maven configured and they have no problems with the same dependencies

11:28 I've seen this sort of issue pop up often. I'm not sure where lein differs from Maven in how it searches for dependencies

11:29 I also do not think there is any sort of proxy in place here

11:30 I'm thinking there is something more restrictive in leiningen or than in Maven when it comes to fetching dependencies. Perhaps Maven has some defaults that lein has chosen not to include.

11:31 sveri: mikerod: sounds like a network issue to me, I never saw this error before, you have some sort of a firewall in place?

11:31 jmontleon: justin_smith, so I hit one more issue, which I commented on on that page. Apparently if you have clj files with the same or later date as class files they don't run AOT. Unfortunately maven-shade-plugin sets all the timestamps the same, so you have to fix it with maven-exec-plugin, but after that it works.

11:31 mikerod: sveri: I've used different networks both with and without firewalls

11:32 jmontleon: i can actually run it now, which is a bonus

11:32 mikerod: I know this is a vague question, so I'm probably shooting in the dark to get any useful feedback. I guess I need to understand some more details on how lein fetches dependencies

11:33 I haven't seen these issues as frequently in Maven and often I can build the project in Maven, but not with lein

11:33 With the same dependency names+versions and the same repositories defined

11:33 sveri: mikerod: any specific dependency that this occurs with regularly?

11:34 xemdetia: It almost reads to me that you might be accidentally including the same thing twice because of the 'Conflict' message, not sure how you would check that though

11:44 mikerod: sveri: It seems to always be from globally accessible repos

11:44 The current one I'm seeing is a dependency from cloudera

11:45 xemdetia: that is interesting. so maybe I'm brining in some conflicting versions here I think you're saying?

11:46 sdegutis: This kind of thing looks like it could be useful in Clojure too, but as a macro: http://robots.thoughtbot.com/efficient-json-in-swift-with-functional-concepts-and-generics

11:46 mikerod: when I do `lein deps :tree` it fails before showing me a tree

11:46 :(

11:46 xemdetia: mikerod, it's only a guess. It is saying "ReasonPhrase:Conflict," not "ReasonPhrase:Can'tDownload"

11:47 I'm almost thinking the http_proxy bit is just sort of a catchall failure message that is triggering

12:09 mikerod: When I have dependency problems in lein, I never know how to look for them easily since the :tree command also is out-of-service hah. I'll do some digging though. Thanks for the advice and responses to my vague questions though.

12:15 no7hing: hey, shouldn’t this work? https://www.refheap.com/93886

12:18 bocaj_: Have you implemented Access Control Lists (ACL) with cemerick.friend ?

12:20 mavbozo: &(clojure.string/replace "sheet.name" #"\." "\\")

12:20 lazybot: java.lang.StringIndexOutOfBoundsException: String index out of range: 1

12:20 clgv: no7hing: typical escape pitfall ;)

12:20 ,(clojure.string/replace "sheet.name" #"\." "\\\\")

12:20 clojurebot: "sheet\\name"

12:20 clgv: ,(print (clojure.string/replace "sheet.name" #"\." "\\\\"))

12:20 clojurebot: sheet\name

12:20 no7hing: oh my. thanks @clgv

12:21 clgv: no7hing: you need an insane amount of backslashes as shown above ;)

12:21 ,(print (clojure.string/replace "sheet.name" #"\." \\))

12:21 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to clojure.lang.IFn>

12:21 no7hing: i ran out of backslashes after the first two ;)

12:21 clgv: ,(print (clojure.string/replace "sheet.name" #"\." (constantly \\)))

12:21 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.String>

12:21 Empperi: you have to escape both for strings and regexps and whatnot

12:21 clgv: ,(print (clojure.string/replace "sheet.name" #"\." (str \\)))

12:21 Empperi: horrible world

12:21 clojurebot: #<StringIndexOutOfBoundsException java.lang.StringIndexOutOfBoundsException: String index out of range: 1>

12:21 no7hing: looks like my repl session

12:22 clgv: ,(str \\)

12:22 clojurebot: "\\"

12:22 clgv: ah right. no shortcut in that direction

12:23 no7hing: Clojure's regexps are optimized in that regard

12:23 mavbozo: ,(re-pattern "\")

12:23 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

12:23 mavbozo: ,(re-pattern "\\")

12:23 clojurebot: #<ExceptionInInitializerError java.lang.ExceptionInInitializerError>

12:23 clgv: ,(str #"\.")

12:23 clojurebot: "\\."

12:24 mavbozo: ,(re-pattern "\\\\")

12:24 clojurebot: #"\\"

12:24 mearnsh: looking for workflow advice: using a library in my project but i've made a fork of the library now. how can i deal with this using lein efficiently

12:24 technomancy: mearnsh: there's a FAQ about that

12:24 mearnsh: ah, i'll take a look thanks

12:28 clgv: mearnsh: short answer - usually you just change the group of the artifact, e.g. to "org.clojars.mearnsh"

12:28 mearnsh: if the changes don't get merged into the original library and you diverge farther, you should probably rename the library

12:40 mearnsh: sounds like a plan, will try that

13:00 riley526: Why are multimethods not considered functions by `fn?`?

13:00 technomancy: riley526: you're looking for ifn? probably

13:02 riley526: technomancy: so fn? only returns true for functions defined with (fn [] ...), etc, not just any callable?

13:02 clgv: ,(defmulti bla type)

13:02 clojurebot: #'sandbox/bla

13:02 clgv: ,(ancestors (type bla))

13:02 technomancy: correcto

13:02 clojurebot: #{java.lang.Runnable clojure.lang.AFn java.lang.Object clojure.lang.IFn java.util.concurrent.Callable}

13:02 technomancy: prefer abstractions to concretions

13:03 riley526: polaris (a routing lib) doesn't let you provide a multimethod as a request handler

13:03 because it uses fn? to check its type https://github.com/caribou/polaris/blob/master/src/polaris/core.clj#L28

13:04 technomancy: that's a bug

13:04 riley526: yeah I figured

13:04 justin_smith: riley526: I can get that fixed

13:04 riley526: did you make a ticket for it?

13:04 riley526: justin_smith: oh cool

13:04 justin_smith: no I just discovered it last night

13:04 justin_smith: I can though

13:04 justin_smith: what's the solution, ifn? perhaps?

13:05 I can pull-request it if it's that simple

13:05 justin_smith: yeah, I see it now ##(ifn? :f)

13:05 lazybot: ⇒ true

13:05 justin_smith: yeah, ifn? is the simple fix

13:05 riley526: cool

13:05 clgv: though a lot of stuff satisfies `ifn?`

13:06 sdegutis: git diff -w --color-words HEAD^ # this is amazing for Clojure code

13:06 riley526: true

13:06 does it make sense to accept a keyword as a handler, for instance?

13:06 justin_smith: clgv: our options in that context are: callable, var, or symbol (which gets resolved), so I will move var up in the cond (since vars implement ifn) and all should be good

13:07 actually, I can eliminate the var clause!

13:07 turn the cond into an if, nice

13:07 wait - symbols also implement ifn - so I just check for symbool, and error if not callable

13:07 sdegutis: justin_smith: what do you have against cond?

13:07 justin_smith: you know, there wouldnt even /be/ an if, if it werent for cond

13:08 justin_smith: sdegutis: if you only have two clauses, it's more complex than what is needed

13:08 I like to use the simplest and least powerful construct available

13:08 clgv: justin_smith: sure, depends what is done with that value. I once caused an error in one of my libs by switching from `fn?` to `ifn?`

13:08 justin_smith: and it always feels nice to bump down a notch of power

13:08 clgv: so I wanted to mention it ;)

13:08 justin_smith: clgv: I can see that

13:08 sdegutis: justin_smith: +1

13:08 justin_smith: clgv: and if you handn't mentioned that, I might have missed the symbols implementing ifn case

13:09 clgv: sdegutis: `cond` sucks for unboxed longs and doubles because of its last case that returns nil

13:09 justin_smith: riley526: so it isn't as simple as just checking for ifn?, I will work on a fix

13:09 riley526: alright cool

13:09 clgv: ,(set! *warn-on-reflection* true)

13:09 clojurebot: #<IllegalStateException java.lang.IllegalStateException: Can't change/establish root binding of: *warn-on-reflection* with set>

13:09 riley526: justin_smith: love polaris, fwiw

13:09 llasram: justin_smith: Not knowing the context of this library, but what's the use-case for resolving symbols to vars?

13:09 clgv: awww :(

13:09 sdegutis: clgv: I never think about that kind of optimization. Should I be?

13:10 clgv: sdegutis: seems like you had nothing performance critical wrt this - so no you shouldnt

13:10 sdegutis: I just fixed a reflection warning corresponding to that this morning

13:11 sdegutis: ok :)

13:11 clgv: on first sight I couldn't explain were the autoboxing came from

13:11 sdegutis: clgv: Well, we run our Clojure web (ring/jetty) server on the smallest/cheapest usable EC2 server possible -- does that count as needing critical performance?

13:11 clgv: sdegutis: depends on the operations ;)

13:12 sdegutis: clgv: Uhh, it's a website.

13:12 clgv: and whether you do a lot of numeric calculations

13:12 for the above case, I mean

13:12 sdegutis: Git is so cool. I was able to see how I used a function just before my last commit by doing: git grep -C2 with-eula-sig HEAD^

13:19 justin_smith: llasram: specifying a routing table as a vanilla data structure - symbols, maps, strings, keywords, vectors

13:19 llasram: ie. something that is edn-clean

13:19 in that case, a symbol for the handler's action is resolved to a namespaced var

13:20 llasram: hopefully the advantages of specifying things as pure edn are clear

13:22 EvanR: ,(chr 31)

13:22 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: chr in this context, compiling:(NO_SOURCE_PATH:0:0)>

13:22 EvanR: ,(str \x1f)

13:22 clojurebot: #<RuntimeException java.lang.RuntimeException: Unsupported character: \x1f>

13:22 justin_smith: ,(char 31)

13:22 clojurebot: \

13:22 justin_smith: ,(str 0x1f)

13:22 clojurebot: "31"

13:22 justin_smith: ,(char 0x1f)

13:22 clojurebot: \

13:23 justin_smith: EvanR: ^^^

13:23 EvanR: ok

13:23 justin_smith: ,(str (char 31))

13:23 clojurebot: ""

14:05 amalloy: gfredericks: how many libs have you named (format "lib-%04d" (rand-int 10000))? i thought it was like a one-time joke, but i see there are a fair number of such things

14:07 danielcompton: dnolen_: ping

14:09 clgv: amalloy: 5 according to github ;)

14:10 gfredericks: amalloy: yeah 5 sounds right; only like one or two of them would I use today

14:10 kenrestivo: wait, the last case of cond always returns nil? really? i could swear i've used it and if you catch all the possible input it doesn't return nil

14:10 gfredericks: I tend to wuss out on the joke because I like to fantasize that a lib might get populare and that in real life this only happens if it has a traditionally clever name

14:11 amalloy: kenrestivo: uhhhh, it's not totally clear what you mean but you are probably mistaken

14:11 eg, ##(cond true 1) ;; returns 1, not nil

14:11 lazybot: ⇒ 1

14:11 kenrestivo: < clgv> [13:08:05] sdegutis: `cond` sucks for unboxed longs and doubles because of its last case that returns nil <-- this confused me

14:12 i thought that sounded wrong

14:12 dnolen_: danielcompton: pong

14:12 amalloy: kenrestivo: the compiler can't prove that you actually make it through all the cases

14:12 so it is probably worried that you might return nil, and thus can't unbox the primitives

14:12 danielcompton: dnolen_: is there anything I can do to help with http://dev.clojure.org/jira/browse/LOGIC-118 ?

14:12 kenrestivo: ooh

14:13 reflections: hey

14:13 sdegutis: dnolen_: how do you find all this time for all this apparently non-stop open source work?

14:14 hiredman: ,(macroexpand '(cond a b c d))

14:14 clojurebot: (if a b (clojure.core/cond c d))

14:14 hiredman: ,(macroexpand '(cond c d))

14:14 clojurebot: (if c d (clojure.core/cond))

14:14 hiredman: ,(macroexpand '(cond))

14:14 clojurebot: nil

14:15 reflections: I have some edn which was read out of an H2 DB which I am now trying to use as a basis to populate a DB. I notice that timestamps have been represented as byte arrays (#<byte[]...) but I am not sure how to read these in. Any ideas much appreciated

14:15 hiredman: why do you say it is edn data?

14:16 weavejester: reflections: It sounds like your data has some unreadable forms in it. Byte arrays don't serialise by default.

14:16 reflections: well i assumed i could provide some sort of handler function to the reader to intepret these

14:17 hiredman: so you are serializing via pr-str or simliar, writing to the database, and getting form you can't read out the otherside?

14:18 justin_smith: reflections: you can get a byte-array as a string with the string constructor (String.) or via slurp. But yeah, something seems wrong that you are getting that back, and I don't know if either of those would really give you the original back.

14:18 amalloy: reflections: if it has actually been written as the string "#<byte[] ...>" then you are out of luck, those are totally unusable. you need to write things in a way that doesn't lose the information

14:18 weavejester: reflections: It's the writer that's wrong. You don't have enough information to reconstruct the array.

14:18 reflections: ive read from one db, written to a file, and hoping to read back into a db

14:18 justin_smith: I have had the issue with jdbc sometimes that for certain text data types I get a byte array I need to slurp or construct a string from

14:18 reflections: oh, I see. Sounds like I have serialised incorrectly then

14:19 Bronsa: cond could actually be smarter and short-circuit on truthy literal tests

14:19 weavejester: reflections: You might want to try a serialisation library that can handle arrays, like Nippy, or add a custom serialiser for arrays.

14:19 Nippy is probably the easiest solution.

14:19 sdegutis: ,(defn call-macro [m & args] (eval (apply (resolve m) nil nil args)))

14:19 clojurebot: #'sandbox/call-macro

14:19 sdegutis: ,(call-macro 'when true 123)

14:19 clojurebot: 123

14:20 dnolen_: danielcompton: does that second patch work for you?

14:20 reflections: these are fields of type 'timestamp' in the db

14:20 amalloy: Bronsa: that seems like a reasonable enhancement to me

14:20 danielcompton: Yes, it works for me in kibit

14:20 Bronsa: something like http://sprunge.us/DfUO?clj

14:20 danielcompton: dnolen_: but kibit doesn't use all of core.logic

14:20 justin_smith: reflections: what does the resulting string look like if you slurp one?

14:20 sdegutis: ,(let [macro 'if] (call-macro macro false 123 456))

14:20 clojurebot: #<NullPointerException java.lang.NullPointerException>

14:20 sdegutis: Aww.

14:20 Bronsa: sdegutis: if is not a macro

14:21 sdegutis: Oh.

14:21 ,(let [macro 'cond] (call-macro macro false 123 :else 456))

14:21 clojurebot: 456

14:21 sdegutis: Yay.

14:22 Bronsa: or a little better, http://sprunge.us/edii?clj

14:23 amalloy: meh, this wouldn't be necessary if the compiler did this automatically for if forms

14:24 dnolen_: danielcompton: applied, tested, pushed

14:25 danielcompton: dnolen_: awesome, thanks!

14:25 dnolen_: danielcompton: will have to await another bug before I cut a release

14:25 danielcompton: dnolen_: np

14:27 morfeen: anyone read this article: http://www.lambdassociates.org/blog/bipolar.htm

14:30 augustl: hyPiRion: (off topic) are you aware of any Rust bindings for c-rrb?

14:32 hyPiRion: augustl: I noticed you asking the question in #rust :)

14:33 not afaik

14:33 augustl: :)

14:33 stepping away from the JVM is scary, so few communities other than the Clojure community has embraced persistent data structures

14:35 danielcompton: is it idiomatic to replace all :use's with :require :refer :all, on the way to requiring specific vars?

14:35 I mean referring specific vars

14:35 technomancy: danielcompton: :require/:as is better

14:35 but getting rid of :use is a step in the right direction

14:35 llasram: (inc technomancy)

14:35 lazybot: ⇒ 161

14:35 danielcompton: technomancy: yeah, that's the long term goal, but as an interim step

14:36 augustl: you can't type confuse without :use

14:37 hyPiRion: augustl: yeah, it's a bit sad. Only OCaml and Haskell is out there non-JVM, Rust only provides immutable but not persistent variants

14:38 llasram: augustl: you can't type "confusion" without "nfusi"

14:39 afhammad: whats the most efficient way to convert a lazy seq into a vector? vec, into [] ?

14:39 justin_smith: afhammad: use an algo that outputs a vector in the first place! (being a bit glib there, but really, if it exists it is likely the better option)

14:40 amalloy: afhammad: you'd have to be in a pretty unusual scenario for the conversion from seq to vector to be your bottleneck

14:40 joegallo: iirc (into [] ...) is the fastest, because it takes advantage of transients... but that's just something i think i heard once -- and yeah, amalloy is right, i think this is a somewhat silly exercise

14:40 amalloy: i certainly never worry about whether vec or into[] is faster

14:40 afhammad: amalloy: its not, just wondering

14:40 amalloy: as it happens, into is faster because vec is so old

14:41 danielcompton: is :use deprecated anywhere official or is it just convention?

14:41 afhammad: justin_smith: the lib i'm using returns a lazy-seq, and I'd like to repond to client with a vector. Transit defaults to a list if its a seq

14:42 technomancy: danielcompton: rich told me he didn't like it; not sure how to make it any more official than that =D

14:43 danielcompton: technomancy: haha

14:43 technomancy: putting it in the docstring could be a good place to mark it

14:43 technomancy: eh the docs for ns are a lost cause

14:45 EvanR: ,(re-pattern (str (char 31)))

14:45 clojurebot: #""

14:45 Bronsa: amalloy: well this was easier than expected http://dev.clojure.org/jira/browse/CLJ-1598

14:46 EvanR: ,(re-pattern (str (char 31) "+"))

14:46 clojurebot: #"+"

14:48 llasram: EvanR: Looks like clojurebot is printing strings with control characters rather oddly

14:48 amalloy: llasram: you think it's clojurebot, not your irc client?

14:48 EvanR: might be "raw"

14:49 llasram: amalloy: Oh. You are almost certainly correct.

14:49 EvanR: if theres no way to escape control chars, then there no choice

14:49 llasram: Well, maybe. I see very different things in my emacs ERC client output vs my emacs CIDR REPL output

14:50 EvanR: but you cant type non printable chars into a literal so it doesnt make much sense to show non printables as nothing

14:50 llasram: But IRC/client does seem the more likely culprit

14:50 EvanR: or "raw"

14:50 llasram: EvanR: In my local REPL I see the non-printables as still being part of the resulting string and Pattern

14:51 EvanR: in a terminal?

14:51 llasram: ,(-> 31 char re-pattern str first int)

14:51 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.String>

14:51 llasram: ,(-> 31 char str re-pattern str first int)

14:51 clojurebot: 31

14:51 llasram: It's definitely there

14:52 EvanR: In CIDER, in an Emacs buffer

14:52 EvanR: yes they are there

14:55 gfredericks: llasram: oh hey

14:55 justin_smith: &(char 31)

14:55 lazybot: ⇒ \

14:55 danielcompton: technomancy: the docs for Clojure are fine once you no longer need them

14:55 justin_smith: just checking if lazybot handled it differently

14:55 amalloy: Bronsa: interestingly, it looks like regular expressions don't implement LiteralExpr

14:56 Bronsa: amalloy: uh? don't they get routerd through ConstantExpr?

14:56 technomancy: danielcompton: pretty much

14:56 amalloy: Bronsa: maybe? it was hard for me to find out for sure, but it doesn't look like it

14:58 Bronsa: amalloy: yeah they do in the analyze method no clause matches for regexes so they get to line 6514 and wrapped in a ConstantExpr

14:58 amalloy: i see

14:58 i was looking for references to Pattern specifically, not for lack of references to Pattern

15:00 Bronsa: IIRC all literals + quoted forms are ConstantExprs, except from non-constant map/set/vectors

15:04 sdegutis: ouch, the clean coder took a shot at FP here http://blog.cleancoder.com/uncle-bob/2014/11/24/FPvsOO.html

15:04 llasram: gfredericks: is for horses?

15:07 justin_smith: sdegutis: I don't see any shots there at all

15:07 sdegutis: just a criticism of facile descriptions of the advantages

15:07 sdegutis: it's near the top

15:08 justin_smith: sdegutis: yes, like I said, those are facile descriptions of the advantages

15:08 sdegutis: great

15:08 justin_smith: sdegutis: he doesn't say fp is bad, he says those descriptions are bullshit

15:08 which is true

15:08 sdegutis: i dont understand your words

15:08 * sdegutis googles facile

15:08 justin_smith: sdegutis: superficial

15:08 * sdegutis cancels googling it

15:09 justin_smith: $dict facile

15:09 lazybot: justin_smith: adjective: Done or achieved with little effort or difficulty; easy. See Synonyms at easy.

15:09 dbasch: I stopped reading at “Objects are bags of functions, not bags of data.”

15:09 sdegutis: ok

15:09 my tests fail even though they should be passing

15:10 justin_smith: dbasch: he's playing no true scotsman about objects, but I actually like the version of OO he advocates for, at least

15:10 sdegutis: so im gonna go spend some time on reddit

15:10 danielcompton: polymorphism isn't inherent to OO

15:11 sdegutis: danielcompton: its harder to do in FP without some OO-style constructs

15:11 justin_smith: I'm actually disappointed to lazybot's definition response from dict - it didn't choose the meaning I had in mind, and did not indicate that other meanings exist :(

15:11 sdegutis: danielcompton: hence we have defmulti and defmethod, which have their own limitations/flaws

15:11 danielcompton: sdegutis: fair point

15:12 sdegutis: justin_smith: perhaps theres a reason im just finding out about $dict for the first time

15:12 justin_smith: heh

15:12 sdegutis: (hint: its because it sucks)

15:12 justin_smith: sdegutis: I gained a good overview of the available plugins when I updated lazybot and had to ensure I didn't break them

15:12 sdegutis: (no offense to whoever wrote it; im sure the limitations are because of the third party api it uses, not the clojure coder's job)

15:12 justin_smith: $phrases facile

15:12 lazybot: justin_smith: No phrases found for facile.

15:13 sdegutis: justin_smith: oh wait ur in charge of lazybot?

15:13 (inc justin_smith)

15:13 lazybot: ⇒ 147

15:13 sdegutis: $karma sdegutis

15:13 lazybot: sdegutis has karma 6.

15:13 sdegutis: aww

15:13 justin_smith: sdegutis: not in charge, I just did a big upgrade of the irc client version and clojure version

15:13 sdegutis: (dec justin_smith)

15:13 lazybot: ⇒ 146

15:13 justin_smith: sdegutis: because I whined at Raynes that lazybot went off line too much, and he was like "well, you can fix that"

15:14 dbasch: lazybot is in charge of lazybot obviously

15:15 justin_smith: $wotd

15:15 lazybot: justin_smith: dingle: A small wooded valley; a dell.

15:15 justin_smith: oh, what an excellent word for today

15:15 haha, off to tell the world that a synonym for Dell is Dingle

15:19 sdegutis: ok

15:19 Dude, you're getting a Dell!!

15:21 ok closing reddit; looks like my tests are still failing :(

15:26 cfleming: My award for coolest project I discovered at the conj: Graal & Truffle: http://www.chrisseaton.com/rubytruffle/cext/

15:26 *mind blown*

15:29 sooheon: How does it relate to clojure?

15:29 the java/jvm part?

15:30 sdegutis: cfleming: im also curious

15:31 cfleming: You could implement Clojure using Truffle and run it on Graal. Your Clojure implementation is a simple AST interpreter, you don't have to write bytecode or anything.

15:31 sdegutis: !

15:31 This could revolutionize Clojure as we know it!

15:32 cfleming: Graal is like a standalone hotspot, so Truffle talks to it about the parts of the AST that are running hot, and Graal compiles them.

15:32 hellofunk: does anyone know what "lvar" refers to on this line in a dnolen's sudoku solver: https://gist.github.com/swannodette/3217582#file-gistfile1-clj-L23

15:32 cfleming: The awesome thing is that it can perform all sorts of AST optimisations - inlining var derefs, HOF use, etc etc

15:33 Also the Truffle AST is cross language, so you can inline Java into Clojure, or Clojure into Java

15:33 Or Scala or JRuby into Clojure etc

15:33 That blog post I pasted above is inlining C into Ruby :o

15:33 alejandro2: hellofunk: https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer#Logic_Variables

15:34 dnolen_: hellofunk: that's programmatically constructing logic vars - the soduku example is fun but not a beginner core.logic thing

15:35 hellofunk: alejandro2 i read that but lvar is not in the core.logic api nor is it seen in actual code syntax in the primer. what does it actually point to in this code?

15:36 alejandro2: hellofunk: it's not https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic.clj#L706

15:36 ?

15:37 xelxebar: ithub.com/swannodette/3217582#file-gistfile1-clj-L23 │ amano-

15:37 05:31 cfleming : The awesome thing is that it can perform all sorts of AST optimisations - inlining var derefs, HOF use, etc etc │ ambrosebs

15:38 hellofunk: alejandro2 awesome, thanks. it is not in the API spec, hence i did not know it existed. there is lvaro however: http://clojure.github.io/core.logic/#clojure.core.logic/lvaro

15:39 and LVar is listed as a type but if "lvar" is something worth calling, I'd have expected it in the API docs

15:49 sdegutis: Why is there no cond-let?

15:51 mi6x3m-alt: sdegutis: not needed very often :) time for macros!

15:51 turbofail: there should be a zombo-let

15:51 amalloy: sdegutis: because it's not obvious what it would do

15:51 justin_smith: turbofail: you can do anything, at zombo-let

15:51 amalloy: there was a cond-let in old-contrib, and ninjudd put one in useful, but they did different things

15:51 turbofail: with zombo-let the only limit is you!

15:51 amalloy: (neither of which was particularly useful)

15:52 dnolen_: hellofunk: core.logic docstrings need a lot of work

15:52 sdegutis: amalloy: It would let me combine my (let...(cond...))

15:54 dbasch: sdegutis: maybe you want a cond-reduce-frequencies-println-let

15:54 what with the price of parentheses being sky high these days

15:56 danielcompton: dbasch: they're stockpiled in these warehouses http://www.reuters.com/article/2011/07/29/us-lme-warehousing-idUSTRE76R3YZ20110729

15:56 dbasch: danielcompton: (Reuters)… I see

15:58 danielcompton: cfleming: the rubytruffle thing is bananas

15:58 cfleming: danielcompton: Yeah, no doubt. Since Graal is basically hotspot, I came away thinking that's the future of JVM language design.

15:58 danielcompton: You may think of C as being a language that is natively compiled ahead of time to machine code, but that isn't an essential property of the language. As long as a C interpreter does the same thing with your C program as a C compiler would, it shouldn't make a difference to you.

15:59 cfleming: danielcompton: One problem is that for performance you end up paying the warmup twice - once for Graal and once for Truffle.

16:00 hellofunk: dnolen_ agreed. I guess there are a number of functions lurking in the library that can only be learned about by actually looking at the source.

16:00 cfleming: danielcompton: But Truffle could automatically turn your HOF uses into tight loops.

16:00 dnolen_: hellofunk: yep, docstring patches welcome

16:01 cfleming: danielcompton: Or could inline your JS code running on Nashorn into your Clojure code or your Java code.

16:01 * cfleming *boggles*

16:01 danielcompton: cfleming: it looks like Jruby+Truffle+C extension is faster than MRI with the C extension?

16:02 cfleming: yo dawg

16:02 hyPiRion: cfleming: how problematic is technomancy/leiningen#1768 for cursive? Just wondering how to prioritise issues the upcoming months

16:02 lazybot: memoize makes reuse tricky -- https://github.com/technomancy/leiningen/issues/1768 is open

16:02 cfleming: danielcompton: In that case they tested, yeah

16:02 hellofunk: dnolen_ gotta learn how it all works before i can summarize anything for a docstring

16:03 cfleming: hyPiRion: It's a real problem. Users get extremely confused when trying to figure out why their profiles don't update when they change them on disk.

16:03 dnolen_: hellofunk: core.logic is by the far the most experimental of the libraries I maintain, sudokufd is really not any kind of entrypoint at all

16:04 hellofunk: part of the reason lvar is not doc'ed is because normal code doesn't use it

16:04 cfleming: hyPiRion: #1378 is less of an issue since I can (and do) work around it with a gory hack.

16:04 hellofunk: dnolen_ i understand the sudoku decently now that i know what lvar actually points to.

16:04 dnolen_ but at first i thought it was a typo

16:04 hyPiRion: cfleming: alright, so the faster, the better then. I'll see if I can poke into it during December

16:05 dnolen_: hellofunk: yes but my point remains, sudokufd mixes FP/LP in way I would consider relatively advanced

16:05 cfleming: hyPiRion: I have some other related issues with CWD, since the CWD is always "wrong" when calling into lein.

16:05 hyPiRion: Thanks, I appreciate it. Happy to help with it if required too.

16:06 hellofunk: dnolen_ well advanced is subject, i've been following all of byrd's youtube videos and it seems pretty straightforward to minikanren-style logic

16:06 *subjective

16:06 cfleming: hyPiRion: I'll have some questions about the *cwd* var which might allow some workarounds for the problematic projects, but I haven't investigated much yet.

16:06 gfredericks: llasram: I was your parser thing

16:06 sdegutis: dbasch: good idea

16:06 cfleming: hyPiRion: I actually meant to talk to you at the conj about profiles too but forgot to when I had you

16:07 hyPiRion: I'll send a mail when I'm no longer in an airport.

16:07 hyPiRion: cfleming: sure – feel free to jump into #leiningen as well if you have some specific ones

16:08 and re: profiles, urgh. They are really nasty now, we're going to clean them up for 3.0

16:08 llasram: gfredericks: I'm afraid I'm failing to connect that sentence to semantic referents :-)

16:08 cfleming: hyPiRion: Great, I will do, thanks - I'm going to work on this code soon.

16:08 hyPiRion: My lips are sealed!

16:08 hyPiRion: Is there a rough timeframe for 3.0?

16:08 hellofunk: dnolen_ it's a shame about your posterious page, was all that content ported to your github blog?

16:09 hyPiRion: cfleming: hahah, even I have problems understanding profiles and merging at times

16:10 dnolen_: hellofunk: nope, posterous erased it w/o ever giving me the backup I requested - never again.

16:11 cfleming: dnolen_: That sucks. Did wayback machine or something have a copy?

16:11 dnolen_: cfleming: maybe?

16:11 hyPiRion: cfleming: I think technomancy could give the 3.0 timeframe better, but from what I gather, we just need to figure out what's we need to break from 2.x and 3.x, and how we're going to solve it

16:11 hellofunk: dnolen_ damn that's sucky ducky

16:11 hyPiRion: profiles will get freshed up as mentioned, but we still need to sort out how it's going to be done

16:13 cfleming: hyPiRion: Ok, so it's still a ways off then. I'll definitely need some kind of fix for the memoize issue before then. Everything else I have to do is somewhere on a scale of slightly ugly to really foul, but that I can't fix without fixing lein.

16:16 llasram: cfleming: You can't just load Leiningen all over again in another classloader?

16:16 I mean, that solution is obviously gross, but...

16:18 cfleming: llasram: Yeah, the problem is that I'm embedding lein in a long-running process. I could tear the namespaces down and re-load them every time I call in to lein, but that happens pretty frequently.

16:18 llasram: That would be near the top of my lein-integration-grossness scale, but probably not right at the top.

16:19 hyPiRion: cfleming: alright. Feel free to submit (more) issues you think could benefit both Cursive and Lein. Should be no surprise that we'd love contributions as well, but there are only so many hours in a day :)

16:19 llasram: cfleming: I was suggesting something slightly different. If you look at how hugod does alembic, he uses classlojure to pull Leiningen and all deps (including Clojure) into their own isolated classloader stack

16:20 You could monitor project.clj and profile.clj for changes, and comparatively-easily teardown+reload the whole assemblage when they change

16:20 cfleming: hyPiRion: Yeah, I was planning to do some analysis to try to figure out how many of the memoize calls are totally spurious these days - I suspect some to most probably are. Certainly the profile stuff is. I'll take a look and comment on the issue.

16:21 llasram: Interesting idea, I'll take a look, thanks.

16:21 hyPiRion: that'd be wonderful

16:21 cfleming: llasram: I'm not sure about loading another entire copy of Clojure in the same process, but I'll see if that's required or not.

16:21 llasram: Thanks for the pointer!

16:21 llasram: np!

16:31 gfredericks: llasram: oh wait it was a printer

16:31 sorry I keep dropping out

16:31 anyhow I've thought about this printing problem a lot because of certain pains I've had

16:31 and I was wondering about the case where you want to supply a printing for a custom collection

16:32 which means you want to be able to "recur" for each of the elements

16:32 llasram: Right

16:32 gfredericks: does your library allow for that?

16:32 I didn't think the print-method signature was very compatible with that structure

16:33 llasram: gfredericks: Yep. That's the magic+danger. It swaps the value of the `print-method` var for a MultiFn subclass which injects the dynamic behavior

16:34 dmitrig01: hey! one of my java dependencies requires a JAR on my classpath; how do I add something to the classpath? using leiningen

16:34 llasram: gfredericks: So you can recursively invoke it, and get the same new behavior for each level of recurrence

16:34 gfredericks: llasram: aah gotcha -- so the idea is I call clojure.core/print-method and it magically works

16:34 llasram: Exactly

16:34 gfredericks: llasram: okay; what do you think of the idea of changing the signature so that the custom printer gets an extra arg for recuring?

16:35 (fn [x pw recur-fn] ...)

16:35 I've tried to solve this problem before and failed and I didn't think of that idea until I saw your lib

16:36 llasram: That would definitely be a nice general functional solution, but I don't know how to do it without being a different mechanism than `print-method`

16:37 Or maybe I'm not quite understanding your idea?

16:37 gfredericks: are you trying to piggy-back on the existing print-method functionality and that's the part you're saying wouldn't work?

16:37 llasram: Yes, exactly

16:38 I want all the code out there which already extends print-method to keep working

16:38 And not need to re-implement those printings to get the new behavior I want

16:38 gfredericks: yeah, probably in particular printing collections with the existing print-method wouldn't work anymore

16:38 yeah I think you're right.

16:39 llasram: Alas, the compromises of evolution

16:39 gfredericks: this issue pops up for me when I want to do serialization in a library without imposing on the user's extensions

16:39 I've needed both json & edn in different contexts

16:40 and they both use the same global-only extension points :(

16:40 aav: is there a way to extend built in protocol (IDeref) in my case, with some other protocol?

16:40 llasram: Whelp, if you don't mind the conceptual kludge of monkey-patching `print-method`, I believe letterpress should have you covered for EDN

16:41 I'll be using it in the next release of Parkour for exactly the same reason

16:41 sdegutis: Wht's parkour?

16:41 Petour Parkour?

16:41 llasram: sdegutis: https://github.com/damballa/parkour/

16:42 sdegutis: llasram: you wrote it?

16:42 llasram: yah

16:42 dbasch: aav: see https://groups.google.com/forum/#!topic/clojure/1PYQIItNxg8

16:42 sdegutis: impressive

16:42 * llasram preens

16:42 amalloy: aav: no, because it's an interface, not a protocol

16:43 aav: dbasch, amally: thanx

16:44 jkj: what are protocols to java actually?

16:44 are they anything?

16:44 aav: amalloy: sorry for misspelling your nick :)

16:44 dnolen_: jkj: they are not

16:44 llasram: jkj: In the JVM Clojure implementation they have a backing JVM interface

16:44 aav: i'm in ClojureScript, btw...

16:44 llasram: Oh, nm

16:45 jkj: dnolen_, llasram: ok

16:45 dnolen_: aav: not possible

16:45 amalloy: aav: your client will tab-complete nicks

16:51 gfredericks: llasram: the monkey patching sets up a dynamic var to use for local extension?

16:52 llasram: gfredericks: Pretty much

16:53 gfredericks: yeah I think for putting in a library I'd rather hand-roll something more independent; actually just basing it on a class<->tag sort of thing could be better for that lib

16:54 llasram: gfredericks: Philosophically I agree with you, but in practice I already have `print-method` implementations spread across a number of small libraries, and don't want to revisit them all

16:54 gfredericks: [{:class Foo :tag "bar" :encode #(...) :decode #(...)} ...]

16:54 llasram: yeah I can't argue with pragmatism

16:55 llasram: The monkey-patching is as safe as possible. It stores and stacks with the original value, so should compose with any other monkey-patchers. The replacing value is a MultiFn, and proxies all MultiFn-specific methods to the original value

16:56 It'd certainly be better if the facility were done in core, but I'm not going to lose any sleep over it

16:56 justin_smith: dmitrig01: did someone address your question yet?

16:56 dmitrig01: justin_smith: no, but i was able to sort it out – thanks

16:56 gfredericks: llasram: thanks for the back&forth

16:57 justin_smith: dmitrig01: if the java lib is on maven it's easy, otherwise local install is an option

16:57 llasram: np. Best of luck with your approach :-)

16:57 justin_smith: dmitrig01: glad to hear you worked it out

16:57 dmitrig01: justin_smith: yeah, first i figred out how to do a local install, and then i realizezd it’s on maven anyway

16:57 justin_smith: dmitrig01: so you covered the basic options, awesome!

16:57 technomancy: http://timb.net/popular-languages.html

16:58 llasram: technomancy: huh

16:58 What does that mean?

16:59 The more people like solving toy problems in a language, the more popular it is in Rosetta Code?

16:59 technomancy: llasram: it means any page with numbers on it is a game you can play to win =)

16:59 llasram: heh

16:59 (not implying Racket is only good for toy problems)

17:00 technomancy: llasram: being right next to tcl is not that flattering; I get it =)

17:22 {blake}: REXX at #12!

17:22 engblom: If anyone has a suggestion for how I get rid of needing to write trice (if eaten...) in this I would appreciate. I also take any other suggestion for how to make it better: http://pastebin.com/GqTaWJSN

17:24 amalloy: engblom: (let [[new-snake eaten-food ...] (if eaten [...] [...])] ...) would be one way

17:40 Frozenlock: Is there a plugin to update all project dependencies and run the tests?

17:40 technomancy: why would you do that?

17:40 gfredericks: to get the freshest gems

17:41 er, eggs

17:41 er, ... hacks?

17:42 dbasch: gfredericks: while you’re at it, you might get all deps between t1 and t2, and test all combinations until one passes :P

17:43 Frozenlock: technomancy: Why I would want to get the newest dependencies? To get the all new and shiny things :-p

17:43 gfredericks: yeah search that exponential space for the largest passing sum of dependency versions

17:43 technomancy: in my experience newer things are less likely to work correctly

17:43 gfredericks: also a plugin that detects dependency conflicts and auto-generates PRs to offending libs to update their deps

17:44 Frozenlock: technomancy: that was the 'tests' part.

17:44 technomancy: Frozenlock: that's the other thing; writing a plugin that updates dependencies *and* runs tests is silly; each plugin should do only one thing =)

17:45 justin_smith: Frozenlock: lein-ancient will tell you what has newer versions. But obviously there are philosophical differences with the idea of automatically upping versions

17:45

17:45 technomancy: but yeah, in my experience the breakage caused by library upgrades are usually edge cases that generally have poor test coverage

17:46 Frozenlock: justin_smith: thanks, at least I can quickly see which one is important.

17:46 amalloy: gfredericks: largest passing sum? i'ma make sure my libraries increase version numbers by 10,000 each release

17:46 gfredericks: amalloy: #lifehack #protip

17:46 Frozenlock: Like when compojure/ring updated after the #_ drama.

17:46 amalloy: there was #_ drama?

17:46 are you thinking of #=?

17:46 Frozenlock: Ah, yes

17:47 The thing I use everyday, obviously

17:47 gfredericks: clojurebot: #_ is the safer version of #=

17:47 clojurebot: In Ordnung

17:47 weavejester: It wasn't even #=, I don't think. The problem was that even *read-eval* false is unsafe.

17:47 Though maybe I'm not remembering right.

17:47 Frozenlock: Wasn't that discovered when talking about #=?

17:48 amalloy: weavejester: no, you were right. because of the record syntax

17:48 technomancy: it was both

17:48 amalloy: #java.net.Socket["google.com" 80] or something like that

17:49 weavejester: It was limited to cookie sessions, I remember that.

17:57 teslanick: Are there any patterns out there for "calling back" when some core.async thing has been done? Like: "I hand you a message and let me know when you're done munching on it."

17:58 justin_smith: teslanick: that's why go returns a channel

17:58 the channel will get the return value of the go block

17:59 andyf: amalloy: This link may have the details you were remembering http://clojuredocs.org/clojure.core/read

18:00 amalloy: hey, i guessed the socket one exactly right

18:01 teslanick: justin_smith: I'm thinking more like, "I've put a message on a channel to parts unknown and I'm expecting a 'call back' at some point" - obviously this could be just a callback, but I don't know if there are any worn-in patterns here.

18:01 andyf: Clojure 1.5 may have closed the hole of calling Java constructors when *read-eval* is false but I would think long and hard before relying on that.

18:01 csd_: I'm trying to do a nested loop/recur, and the inner loop's binding isn't resetting after the first iteration. Is this something I have to do on my own?

18:02 hiredman: csd_: what do you mean?

18:02 justin_smith: teslanick: one way I have seen is to pass a channel with the message, such that a result or a "do something" trigger is expected on that channel

18:03 hiredman: the binding doesn't "reset" (I mean technically it does) but the mental model is a recursive function call, a recursive function call doesn't "reset" a binding, it is a new call

18:03 andyf: The FileWriter example is a bit more eye-opening for those who are accustomed to thinking of constructors that only alloc mem

18:03 csd_: I have in the inner loop, begin at [x 0] and then stop recurring when x = 5. So then control transfers back to the outer loop, which then executes another iteration. But then when control comes back to the inner loop again, the binding is still at 5, and so the loop doesn't execute.

18:04 hiredman: csd_: yeah, so if you replaced the loop with a call to a function, would you expect the value of x to change?

18:04 csd_: I would think so

18:04 hiredman: x is an immutable binding, the value doesn't change, recur doesn't change the binding it is like a recursive function call

18:04 teslanick: justin_smith: I can see value in that; I had considered going that road, but thought it might be insane somehow.

18:04 csd_: Shouldn't it be calling a new instance of loop effectively

18:04 which would rebind

18:05 hiredman: (defn f [x] (if (zero? x) x (do (f x) (g x))))

18:05 can f change the value of x that g sees?

18:06 csd_: i don't believe so

18:06 hiredman: (defn f [x] (if (zero? x) x (do (let [x 1] (f x)) (g x))))

18:06 what value of x does g see? does it see 1?

18:06 csd_: yes

18:07 no wait

18:07 no

18:07 hiredman: (defn f [x] (if (zero? x) x (do (loop [x 1] (f x)) (g x))))

18:07 same thing

18:07 the x in the loop is a binding in a different scope form the x that is a function parameter

18:08 even if x was a mutable binding, the new scope means it is different

18:08 amalloy: csd_: do you have a more specific code sample that's not working? your vague description has elicited an answer from hiredman which may be relevant but may be addressing a misunderstanding you don't actually have

18:08 csd_: I do although it's sort of complicated, one moment

18:08 justin_smith: &(loop [a 0] (loop [b 0] (print [a b]) (when (< b 3) (recur (inc b)))) (when (< a 3) (recur (inc a))))

18:08 lazybot: ⇒ [0 0][0 1][0 2][0 3][1 0][1 1][1 2][1 3][2 0][2 1][2 2][2 3][3 0][3 1][3 2][3 3]nil

18:09 justin_smith: nested loops work just fine

18:09 csd_: https://www.refheap.com/93899

18:09 hiredman: (let [x 1] (let [x 2]) x) ; what is the value of x

18:09 (loop [x 1] (loop [x 2]) x) ; what is the value of x

18:10 amalloy: csd_: more usefully trimmed: https://www.refheap.com/96c1de661ede454cd720ec531

18:11 and in that code, of course x starts at 0 there, not at 5 or whatever

18:11 csd_: ama

18:11 I realize that, but when I execute it, when y >= 1, x is always 5

18:11 or 4 i guess

18:11 hiredman: what makes you think that?

18:12 csd_: hiredman: my results after running it

18:12 amalloy: well like, that is just obviously false. so we have to figure out why you think that

18:12 dbasch: csd_: did you try the old (println x) in each iteration?

18:12 hiredman: csd_: put a (println x) at the top of the loop

18:13 you will either see 0, or some succession of numbers, either way you will be able to find the bug in your code

18:14 if you only see 0 it means the when around the recur is never happening, if you see a succession of values, something else is happening which ends up with oyu only seeing 5 on the way out

18:15 sdegutis: Is it possible to create an anonymous var, i.e. without def?

18:15 amalloy: &(doc with-local-vars)

18:15 lazybot: ⇒ "Macro ([name-vals-vec & body]); varbinding=> symbol init-expr Executes the exprs in a context in which the symbols are bound to vars with per-thread bindings to the init-exprs. The symbols refer to the var objects themselves, and must be accessed with var-get and var-set"

18:15 csd_: amalloy: I'm telling you it's what I'm getting after putting those printlns in

18:15 justin_smith: sdegutis: with-local-vars, but in practice it's mostly useless

18:15 csd_: just did it again

18:16 sdegutis: amalloy: Ha, I was just looking at that function out of curious too, assuming it was gonna be completely unrelated.

18:16 danielcompton: Frozenlock: lein ancient can also run tests while upgrading and roll back breaking changes

18:16 sdegutis: justin_smith: I want to run some tests on a function that takes a function var, but I don't want to do a ton of defn.

18:16 hiredman: where did you put the println, and what exactly did it print?

18:16 gfredericks: (inc eastwood)

18:16 lazybot: ⇒ 2

18:16 dbasch: sdegutis: also you can create regular variables without def

18:16 csd_: https://www.refheap.com/93903 and right above the inner if statement

18:17 sdegutis: dbasch: how?

18:17 dbasch: e.g. with intern

18:17 sdegutis: Oh right!

18:17 Thanks :)

18:17 justin_smith: dbasch: that still creates namespace scope

18:18 Frozenlock: danielcompton: Interesting! As a side note, lein-ancien dependencies are 'out-of-date' :-p

18:18 dbasch: justin_smith: yes, that’s what I meant by regular :)

18:18 amalloy: csd_: right, and x is 0 every time. never 5

18:18 danielcompton: teslanick: I think you want https://clojure.github.io/core.async/#clojure.core.async/put!

18:18 hiredman: because the when is getting false and the recur is never happening

18:19 teslanick: danielcompton: That would indeed be my preferred way of putting thing to the "lemme get back to you" channel

18:20 csd_: amalloy: I don't see why the loop wouldn't be resetting though

18:20 Bronsa: ,(with-local-vars [x nil] x)

18:20 clojurebot: #<Var: --unnamed-->

18:20 hiredman: csd_: put in a println for (and (< x *board-size*) (< (inc pos) *board-size*)) right before the when

18:20 amalloy: csd_: i don't have enough ?s on my keyboard for "huh???????????". the loop is obviously "resetting" to 0 every time. x is 0 every time you enter that loop

18:21 csd_: oh crap i see what's wrong now

18:21 hiredman: ,(count (for [x (range 5) y (range 5)] nil))

18:21 clojurebot: 25

18:21 csd_: :-/

18:22 hiredman: so you are not seeing 25 lines there

18:22 * csd_ feels embarrassed

18:25 sdegutis: Thanks everyone for your time.

18:31 teslanick: justin_smith, danielcompton: Thanks for you help -- it appears to be working well!

18:31 danielcompton: teslanick: no problem, I take my payments in bitcoin

18:32 teslanick: I'm bitcoin-poor. I put all my real monies into dogecoin and gold.

18:33 dbasch: (tip teslanick 0.1 :verify)

18:41 TimMc: amalloy: Life hack: You can actually press a key multiple times, you don't need a separate key for each time you want to use a character in a sentence!

18:42 I only have two "?" keys myself.

18:42 amalloy: TimMc: i am trying to support the hard-working americans in the keyboard-manufacturing sector

18:42 i throw out my keyboard and switch to a new one every time a key is used five times

18:42 except E. i'm not made of money

18:43 TimMc: amalloy: http://www.likecool.com/Home/Seating/Wolfgang%20Keyboard%20Bench%20Made%20from%202000%20Keys/Wolfgang-Keyboard-Bench-Made-from-2000-Keys.jpg

18:44 technomancy: amalloy: we should talk

18:45 amalloy: technomancy: i can't buy an atreus. "Nothing quite matches the satisfaction of typing on a keyboard you've constructed with your own hands" just sounds too pretentious to me

18:46 * technomancy abandons his plans to add lazybot karma as a payment option

18:46 {blake}: ,(map #(assoc {} (first %) (:c (second %))) {:one {:a 1 :b 2 :c 3} :two {:a 10 :b 20 :c 30}})

18:46 clojurebot: ({:one 3} {:two 30})

18:47 {blake}: Does what I want but I still =dont= =like= =it=.

18:48 llasram: {blake}: what are you trying to do?

18:48 amalloy: {blake}: that is a weird way to write it, even if that is what you want

18:49 ,(let [m {:one {:a 1 :b 2 :c 3} :two {:a 10 :b 20 :c 30}}] (for [[k v] m] {k (:c v)}))

18:49 clojurebot: ({:one 3} {:two 30})

18:49 {blake}: amalloy: Thanks.

18:49 llasram: That's what I was trying to do. =P

18:50 amalloy: ,(map (comp (partial apply hash-map) (juxt key (comp :c val))) {:one {:a 1 :b 2 :c 3} :two {:a 10 :b 20 :c 30}})

18:50 clojurebot: ({:one 3} {:two 30})

18:50 amalloy: in case readability is not a concern

18:50 {blake}: lol

18:51 (inc amalloy)

18:51 lazybot: ⇒ 199

18:51 {blake}: holy cow...that's close

18:51 turbofail: point-free, as free as the wind blows

18:52 * turbofail bursts into song

18:52 {blake}: Freedom's just another word for no points left to lose.

19:06 dbasch: (inc amalloy) because round numbers

19:07 amalloy: dbasch: and then an automatic dec for a bad inc parser?

19:07 dbasch: (inc amalloy

19:08 at least that didn’t work as expected

19:08 amalloy: )

19:08 dbasch: that reminds me of some episode of a tv show I saw on a plane

19:10 marcuscreo: howdy all

19:10 dbasch: Big Bang Theory, episode named “Closure”

20:12 gfredericks: just ran eastwood on a codebase I hadn't before; it found 1.5 legitimate problems, and dozens of illegitimate ones

20:12 the latter coming from about 4 different classes of warnings

20:13 arguably one of those classes is a decent thing to warn about, but it's caused by a macro from a library

20:16 justin_smith: gfredericks: yeah, I don't think eastwood knows how to tell what came from a perfectly acceptable macroexpansion vs. sketchy code

20:18 gfredericks: andyf mentioned this when I suggested that fully namespace qualified symbols should get a warning (espeically if the namespace is not present anywhere in the require block)

20:18 turns out macros made with syntax quote do that all over, and eastwood can't tell the difference

20:21 gfredericks: yeah

20:21 in this case it's testing a constant

20:21 which could be avoided in the library's macro at the expense of extra complexity

20:27 verma: does clj-refactor require a running repl?

20:28 iow, can I use it with clojurescript etc. as well?

20:28 weavejester: verma: Not for a lot of it

20:29 verma: weavejester, nice, and works for cljs?

20:29 weavejester: verma: I haven't tried, but I don't see why not.

20:29 verma: weavejester, awesome, will give it a shot

20:29 (inc weavejester)

20:29 lazybot: ⇒ 9

20:30 verma: ze what?

20:30 (inc weavejester)

20:30 lazybot: ⇒ 10

20:30 verma: since you answered two questions :P

20:30 weavejester: Okay :)

20:33 kenrestivo: i think sitting in that wolfgang bench would make too much noise

20:37 danielcompton: does build.clojure.org publish snapshots anywhere?

20:38 I can see they were built at http://build.clojure.org/job/core.logic/lastSuccessfulBuild/org.clojure$core.logic/

20:38 but I'm not sure how to specify them

20:40 gfredericks: you should try kibit as well while you're linting

20:55 andyf: gfredericks: What Eastwood version? And is it suspicious-expression warning ?

20:56 If yes, and version 0.2.0, this is the (hopefully short lived) cost of no longer being fooled about things like (-> 1 (= 1)) by doing macro expansion

20:58 Short term improvement might be implementing something like "disable warning type x in macro expansions of my.name.space/bar"

20:59 Over weekend I was experimenting with adding tools.reader support to remember all comments and what forms they precede, in hopes of using specially formatted comments to annotate ASTs

21:24 sdegutis: Just found a new variation on "simple yet powerful", namely, "concise, powerful"! https://github.com/clojure/test.check

21:25 turbofail: simperful, powcise!

21:28 sdegutis: (inc turbofail)

21:28 lazybot: ⇒ 5

21:39 gfredericks: andyf: 0.2.0, yes

21:40 andyf: yeah I have a lot of suspicious-expressions from -> chains ending in (or x)

21:41 andyf: And they were originally created from something besides a 2-arg or, hopefully, since I should have silenced that case

21:43 Wait, they were inside -> expressions, and thus should have had at least 2 args after macro expand?

21:44 abaker: what's the library du jour for logging -- timbre? tools.logging?

21:44 danielcompton: abaker: clojure.tools.logging

21:46 abaker: thanks

21:50 andyf: gfredericks: If it is open source code base, would be interested in testing it myself. If not, and it uses core.match, I have plenty of similar examples already. In any case, some better form of warning suppression that can be limited to some macro expansions but not others is in order.

21:52 I may be worrying over something easy to solve, but syntax quote may be tricky to annotate at expression granularity, inside of the syntax quote expression.

21:53 Because of how the reader transforms those. Makes me curious to know how cfleming does things in Cursive.

22:08 gfredericks: andyf: neither oss nor core.match

22:36 sdegutis: I should look into core.match more furtherly.

22:48 What does this do?

22:48 https://github.com/weavejester/clofor/blob/master/src/clofor/core.clj

22:49 justin_smith: sdegutis: looks like it could be the beginnings of a source code reformatter

22:50 sdegutis: Earlier on, I had guessed it was some kind of ad-hoc language parser.

22:50 Your idea sounds legit.

22:55 legittalon1: ,(= '' 'butts')

22:55 clojurebot: true

22:55 legittalon1: why

22:55 amalloy: legittalon1: ' doesn't delimit strings

22:56 legittalon1: oh, dammit I keep getting bit by that

22:56 amalloy: that's the same as (= (quote (quote (quote butts')))), ie comparing one thing to nothing

22:59 sdegutis: legittalon1: haha

22:59 ,~(= '' 'butts')

22:59 clojurebot: #<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote>

22:59 sdegutis: ,'(= '' 'butts')

22:59 clojurebot: (= (quote (quote (quote butts'))))

22:59 sdegutis: Well there you go.

23:00 (dec amalloy)

23:00 lazybot: ⇒ 198

23:00 legittalon1: usually the syntax highlighting warns me but I was on codewars and the highlighting is deifferent

23:00 sdegutis: legittalon1: same thing happened with me in Swift earlier today

23:00 tried to use '', saw the syntax was weird, switched to ""

23:00 *saw the syntax highlighting was

23:01 amalloy: thanks, sdegutis. i appreciate the extra entropy of your random inc/dec drivebys

23:01 legittalon1: (inc amalloy)

23:01 lazybot: ⇒ 199

23:01 legittalon1: :)

23:01 sdegutis: amalloy: it was gonna be inc but you were getting too close to 200

23:02 (dec legittalon1)

23:02 lazybot: ⇒ -1

23:02 legittalon1: ,(inc legittalon)

23:02 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: legittalon in this context, compiling:(NO_SOURCE_PATH:0:0)>

23:02 legittalon1: ,(def legittalon 1000)

23:02 clojurebot: #'sandbox/legittalon

23:02 legittalon1: (inc legittalon)

23:02 lazybot: ⇒ 1

23:03 sdegutis: LOL

23:03 ,legittalon1

23:03 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: legittalon1 in this context, compiling:(NO_SOURCE_PATH:0:0)>

23:03 legittalon1: well, I'm still pretty new to this lol

23:03 sdegutis: Well I've had some wine.

23:03 legittalon1: aha! I should have some wine

23:04 amalloy: we had a scotch tasting at work today

23:04 insamniac: are you hiring?

23:04 sdegutis: lol

23:05 amalloy: i think so. factual is hiring like always

23:05 insamniac: maybe i can sweep parentheses or something

23:05 sdegutis: I'm using compojure+clout and eschewing its GET-style macros.

23:05 legittalon1: sign me up for factual

23:05 I'll learn real quick

23:06 0 to 100 real quick

23:06 sdegutis: It's nice, I can define routes as functions like (defn ^:login show-products-page [params] ...)

23:06 legittalon1: What's factual?

23:06 justin_smith: sdegutis: what does compojure actually give you without those macros that you wouldn't get from ring/clout by themselves?

23:06 legittalon1: idk I'm guessing this http://www.factual.com/jobs/clojure

23:06 insamniac: sdegutis: http://factual.com/jobs

23:06 (dec insamniac)

23:06 lazybot: You can't adjust your own karma.

23:06 insamniac: :(

23:07 legittalon1: (inc insamniac)

23:07 lazybot: ⇒ 3

23:07 sdegutis: justin_smith: a function that takes handlers and turns them into a single handler that cascades requests among them until it finds one.

23:07 legittalon1: :)

23:07 I'm trying to get a remote gig tbh not ready for a clojure job though. JS is my homeland

23:08 sdegutis: justin_smith: I'm using compojure.core/make-route and /routes

23:08 justin_smith: OK

23:08 sdegutis: justin_smith: And I'm eschewing let-request for something more like this: https://gist.github.com/sdegutis/b376cf100e337941d826

23:10 The exact protocol is a bit in flux right now, but I think I'm settling on: if the first element of :argslist is 'req, pass the request there and precede to the next step omitting the first parameter; then use fancy-call on this with (:params req).

23:10 This allows you to just specify the params, or if need be, to add the request as the first param too.

23:11 justin_smith: sdegutis: have you seen how similar your fancy-call is to prismatic's fnk by the way?Ehttps://github.com/Prismatic/plumbing/tree/master/src/plumbing/fnk#fnk-syntax

23:11 sdegutis: you broke my autolink :)

23:11 justin_smith: https://github.com/Prismatic/plumbing/tree/master/src/plumbing/fnk#fnk-syntax

23:12 sdegutis: justin_smith: Oh nice!

23:12 I feel validated :)

23:13 justin_smith: difference is, instead of making a new kind of call, they make a new kind of defn

23:13 sdegutis: Granted, I'm not a fan of using other people's APIs, only their implementations, so that I have freedom to change my APIs as my own domain evolves.

23:14 Also, I prefer to push it on the caller side, not the callee side, so that I can just use Plain Old Clojure Things™ like defn.

23:14 Using metadata allows me to be creative while still maintaining flexibility and simplicity.

23:14 Like, I can do (defn ^:route ^:eula download-product [] ...) to specify that (1) this is definitely a route and not a typo, and (2) it requires the user to sign a EULA before continuing.

23:15 That doesn't require any special requires or APIs.

23:36 kenrestivo: any ideas what those weird blue and green circles mean in crossclj? i.e. http://crossclj.info/ns/rewrite-clj/0.3.11/project.clj.html

23:37 hiredman: Uses 6 artifacts; transitively uses 110 artifacts

Logging service provided by n01se.net