#clojure logs

2014-09-18

00:45RakkoI've been playing with Cider in Emacs. I definitely remember that a few days ago when I started a REPL in it, there was no warning about nREPL ops not supported. But now it's saying "WARNING: The following required nREPL ops are not supported: macroexpand-1 macroexpand-all". Are those features supposed to be supported?
00:45Rakko(I'm 99% sure a few times I brought up REPLs using the same versions of Cider and nrepl-cider I didn't get that warning)
00:45danielcomptonIs there a way to pretty prent exceptions in the REPL?
00:46JaoodRakko: update cider
00:47JaoodRakko: cider-nrepl was probably updated by lein
00:47RakkoJaood: I have the latest one from MELPA's normal repository (0.8.0alpha (package: 20140912.181))
00:47Jaoodautomagically
00:48Jaoodthat's not the latest
00:48RakkoHmm. Another question about lein: should the cider-nrepl plugin be specified as 0.8.0-snapshot, or 0.8.0-SNAPSHOT?
00:49RakkoOh, I see the updates now.
00:50RakkoUpgrading it did take away the warnings.
00:52RakkoThird question: why does cider-connect sometimes autodetect the port of a running REPL, but other times it doesn't?
02:21paomianhello
02:37kyunCould clojure have a gui lib, swing?
02:38scottjkyun: clojure can use swing, and there's a wrapper called seesaw
02:41kyunIt seem like what I find, thank you.
02:42ddellacostahrm, what's that function for swapping out key names again? forget
02:43ddellacostaoh, it's in clojure.set
02:43ddellacostarename-keys
02:43ddellacosta,(rename-keys {:foo "foo"} {:foo :bar})
02:44clojureboteval service is offline
02:44ddellacostaright, thank you so much hiredman
02:44ddellacosta&(rename-keys {:foo "foo"} {:foo :bar})
02:44lazybotjava.lang.RuntimeException: Unable to resolve symbol: rename-keys in this context
02:44ddellacosta&(clojure.set/rename-keys {:foo "foo"} {:foo :bar})
02:44lazybot⇒ {:bar "foo"}
03:09kenrestivoddellacosta: say, are you interested in patches for friend-oath-examples to deal with this? https://github.com/cemerick/friend/issues/117#issuecomment-53210040
03:10ddellacostakenrestivo: most definitely, I've been busy as hell and slack on friend-oauth2 for now, but definitely think that stuff should get in there. And friend-oauth2 should definitely be extended to handle that in a non-hacky way, as much as possible.
03:11kenrestivook, i don't know how much time i'll have to do it, but i have to do it before april next year when google turns off their openid stuff
03:12ddellacostakenrestivo: huh, I thought there was an ongoing conversation just about this somewhere in friend-oauth2, actually, but can't find it now...hrm
03:13kenrestivoif you find it, maybe reference it to that issue? or let me know here. i do have it working, just untested.
03:13kenrestivowell, lightly-tested
03:13ddellacostakenrestivo: oh yeah, there was this conversation, I think my thinking has shifted now that OpenID is a "real thing"
03:13ddellacostahttps://github.com/ddellacosta/friend-oauth2/issues/19
03:13ddellacostasure
03:15ddellacostakenrestivo: in any case, if you have a real solution go ahead and submit a pull request, if you'd like--or start an issue and we can talk through it there, what we think the best approach is. I'm definitely open to whatever
03:16kenrestivook, i just linked that issue together, just to leave breadcrumbs. i'll have a closer look at it, again, it has to happen before april anyway.
03:18ddellacostacool, sounds good.
03:18ddellacostaif it's just by April I'm sure we can come up with something solid by then, I should have more time myself.
03:26ddellacostaHoly crap, there is this one key in a map that is giving me null when I try to get it out, but when I dump out the hash-map it's clearly got a non-nil value. WTF? Has anyone seen anything like this before?
03:27ddellacostagiving me *nil* rather
03:34ddellacostathanks kenrestivo, I'll look at that and merge it in as soon as I've got time. May take a little while, but ping me if I disappear on you...
03:35kenrestivonp
04:02ddellacostaI am seriously going crazy here
04:02ddellacostawtf is this? https://gist.githubusercontent.com/ddellacosta/9a72a6ce52283ecbb1ae/raw/b503b25d28ccdf6293ac0913013492ee37573015/I%20am%20going%20insane
04:04ddellacostawhoops, mistake.
04:04ddellacostahttps://gist.githubusercontent.com/ddellacosta/9a72a6ce52283ecbb1ae/raw/16ff3e9a3acafd467ac816c611caf734c01f4927/I%20am%20going%20insane
04:04sm0kedoes the latest release of clojurescript only works with 1.6.0?
04:05sm0keI keep getting. clojure.lang.ExceptionInfo: {:tag :cljs/analysis-error}
04:07ddellacostasm0ke: https://groups.google.com/forum/#!topic/clojurescript/MEFJ5D7g8yM
04:08sm0keyea sucks
04:08sm0kewhat a leap
04:08sm0kereminds me of scala and typesafe
04:09hyPiRionddellacosta: you're going crazy, that's working for me
04:09ddellacostahyPiRion: I know, and I just copied and pasted it in and it's working there too. WHAT is going on
04:10ddellacostahyPiRion: thanks for checking though. :-(
04:11hyPiRionddellacosta: I guess a mean whitespace somewhere? :s
04:11ddellacostahyPiRion: I don't know, it's clearly not showing up if I do pr-str though
04:12hyPiRion,(let [  2 a  ] a)
04:12clojurebot2
04:12hyPiRionI don't know
04:12ddellacostahyPiRion: I'm importing from CSV -> hash-map, and it's just this one key (which of course, happens to be one I need) that is giving me this bizarre trouble
04:13ddellacostathe only other time I've seen something like this is because of non-existent date hashing in ClojureScript
04:13kenrestivofwiw, i lost several hours last night due to (for that should have been (doseq. worked in the repl, didn't work in production, should have known better.
04:14hyPiRionWhat clojure version are you running on? I think 1.5 had some exceptionally rare hash collisions for transients which was fixed in 1.6
04:14ddellacostabut this is all just strings, and it's all Clojure 1.6. Tried it in 1.7 and that was fine.
04:14ddellacostahyPiRion: yeah, I was wondering exactly that, but no. :-(
04:14hyPiRionmaybe it was for 1.6
04:14hyPiRionhuh
04:14ddellacostahyPiRion: er, sorry, I tried it in 1.7 and it's *the same*
04:14ddellacostad'oh
04:14ddellacosta*not fine, that is
04:15hyPiRionalright, that's an amazing bug
04:15hyPiRionCould you manage to pop up a minimal repro case?
04:15kenrestivomaybe, string equality test problem?
04:16ddellacostahyPiRion: yeah, I've got to figure out how to reproduce it. Oh, the other lovely thing is--I tested this 'cause I saw it with the CLJS date/hash-map hashing bug--if I reduce the data I'm importing, it goes away. Like, chop off the last twenty columns of the csv, then it's fine.
04:16ddellacostahyPiRion: dunno, I'll give that a shot. This is freaking me out
04:16ddellacostakenrestivo: yeah, just dunno
04:17hyPiRionddellacosta: oh boy. I wonder if you can use test.check to reduce the input somehow
04:17ddellacostahyPiRion: sorry, I don't get what you mean--how would I do that w/test.check?
04:17hyPiRion(Not that it's very important really)
04:18ddellacostaI thought it generated data, not processed it? although been a while since I've touched it
04:18hyPiRionddellacosta: Right. test.check has generators, and they can shrink the test case
04:19ddellacostahyPiRion: ah, I see what you mean--so I'd have to model this data somehow first I guess? Well, it's starting out as just a csv file so I'm not sure it makes sense at the point it would interact with test.check.
04:19hyPiRionBut it's probably too much work
04:19hyPiRionyeah
04:19ddellacostaI mean, first I guess I have to nail down where this is happening. Seems like there is some weirdness going on in generation of the hash-map though
04:25ddellacostahahaha, I filter out the company specific data and the bug goes away. Awesome
04:25hyPiRionamazing
04:25ddellacostaI suppose that's a clue of some sort.
04:28hyPiRionddellacosta: could you do (apply distinct? (map #(.hashCode %) my-set)) on the set with the bug?
04:29ddellacostahyPiRion: yeah, let me give that a shot
04:30hyPiRionI guess that's probably not useful if (filter #(= s %) my-set) doesn't work, but at least worth a shot.
04:30ddellacostatrue
04:30hyPiRionoh
04:30ddellacostathat is, the output was true
04:30ddellacostaso, not a hash collision? huh
04:30hyPiRionAw, was hoping it was false
04:30hyPiRionWell, in theory.
04:31ddellacostayeah, that would have been easier to understand. This is just bizarre
04:32TEttingerunless it's a string equality thing that distinct? is fooled by as well
04:33kenrestivois it possible to make those all keywords instead of strings?
04:33ddellacostaTEttinger: well, .hashCode is going to dump out the hashcode for each set value, so I don't think it's in distinct?
04:33ddellacostakenrestivo: I actually started with keywords and just got rid of them when I was having the same problem
04:33hyPiRionTEttinger: yeah well, if we can't trust our strings then what do we do?
04:33hyPiRion:p
04:34TEttingeris it possible the data itself is flawed?
04:34hyPiRion"Thousands of programmers evacuate the JVM when they realise when strings can't be properly compared"
04:34TEttingerlike you are doing some processing on it to turn _ into -, and you have my-name and my_name in there
04:34ddellacostaTEttinger: I'm doing very little processing; just importing from CSV
04:34ddellacostaTEttinger: splitting on a regex and then trimming (which I started doing *after* I saw this)
04:35TEttingerwell you know the bad data is in company specific stuff -- how big is that?
04:35ddellacostaTEttinger: how big, in terms of the company-specific bits? I mean, that's going to change later on
04:35ddellacostaI wonder if there are encoding issues here somehow
04:36TEttingerI mean just if you were going to go through and check it. encoding seems likely if strings are involved
04:36kenrestivomap them all to numbers, see what the char codes are?
04:36ddellacostakenrestivo: interesting, let me try that.
04:36TEttingeryeah, could even be invisible chars that the map to numbers would check
04:37clgvddellacosta: if encoding is involved two strings looking the same on output should have different hashcodes, which you can check
04:37TEttinger,(map int "A lovely \u0006day wouldn'")
04:37clojurebot(65 32 108 111 118 ...)
04:37TEttinger##(map int "A lovely \u0006day wouldn't you say?")
04:37lazybot⇒ (65 32 108 111 118 101 108 121 32 6 100 97 121 32 119 111 117 108 100 110 39 116 32 121 111 117 32 115 97 121 63)
04:38clgvbuild a map for string to hashcode and see what the offending string hashes to
04:38ddellacostaclgv: right, can just call .hashCode huh
04:39hyPiRionsomething like (into {} (for [s my-set] [s (.hashCode s)]))
04:39ddellacostayeah, I did map (juxt #(.hashCode %) identity) (into #{} (keys (first ed))))
04:40ddellacostaer, (map ...)
04:40hyPiRionright
04:40ddellacostaalthough, not sure what I'm looking for. Now, should I get the same result from .hashCode for the same string, always?
04:40hyPiRionddellacosta: yes
04:40ddellacostaokay, I can see a problem right here
04:41ddellacosta&(.hashCode "PersonnelNbr")
04:41lazybot⇒ 272039710
04:41ddellacostaright, that's what I get in my repl as well
04:41kenrestivowhyzat a problem?
04:41ddellacostabut, the output from the map above shows me for that string's entry: [-1523681379 "PersonnelNbr"]
04:42ddellacostaha, now I have an idea, what if I filter on that hashcode
04:42hyPiRionAw dang. And here I was hoping I could fix a bug in the Clojure hashmap :(
04:42ddellacostahahaha
04:42ddellacostawell, I'm a bit relieved actually because that kind of a bug would be really, really bad
04:42ddellacostafor us and everyone.
04:43kenrestivowhy are they different? unicode?
04:43clgvbut a string without any special signs hashing to two different values? are there such incompatible encodings? I thought ASCII is embedded everywhere the same
04:43ddellacostaclgv: yeah, I'm a bit confused by what is going on there
04:43hyPiRion(map int string)
04:43clgvor is there some magic in the string hashcode impl that adds the encoding to the hashcode?
04:43hyPiRion&(map int "PersonnelNbr") ; You should not get this
04:43lazybot⇒ (80 101 114 115 111 110 110 101 108 78 98 114)
04:44ddellacostahyPiRion: k, let me try that too
04:44hyPiRionclgv: oh wow. That would be... bad
04:44clgvbut hey, you can check that by converting both to the same target encoding
04:44ddellacosta(filter #(= (.hashCode %) -1523681379) my-set) in my repl gives me the string: ("PersonnelNbr")
04:44hyPiRionclgv: I don't think that's reasonable to assume actually. Java HashMap would've experienced same problems if that were the case.
04:44ddellacostaand then applying hyPiRion's map
04:45clgvhyPiRion: ah ok, it does not?
04:45ddellacosta(map int (first (filter #(= (.hashCode %) -1523681379) my-set))
04:45ddellacosta65279 80 101 114 115 111 110 110 101 108 78 98 114) !
04:45ddellacostaer, w/parens at front
04:45hyPiRionclgv: I presume not? Java devs all over would cry
04:45clgvhyPiRion: I meant for the specific case here
04:45ddellacostaall the same but that 65279 at the beginning, must be some weird character artifact. Huh
04:46clgvinvisible UTF-8 code?
04:46ddellacostaclgv: or something got chopped off/in half? but yeah
04:46kenrestivoninja steganography
04:46ddellacostaha
04:46ddellacostaseriously, if you knew how to do this purposefully you could encode all kinds of random messages I guess
04:46ddellacostapull the first byte from every string and put 'em together
04:46ddellacostabut I digress
04:47hyPiRion,(Character/getName 65279)
04:47clojurebot#<CompilerException java.lang.IllegalArgumentException: No matching method: getName, compiling:(NO_SOURCE_PATH:0:0)>
04:47ddellacosta"ZERO WIDTH NO-BREAK SPACE"
04:47clgv"BOM character" whatever that is?
04:47ddellacostathat sounds like the most useless character ever
04:47kenrestivothat is awesome
04:47hyPiRionAh, the prediction
04:47kenrestivoa totally stealth character
04:47ddellacostamay as well name it "CHARACTER CREATED TO MESS WITH YOU, YES, YOU DAVE"
04:47hyPiRion10:10| hyPiRion| ddellacosta: I guess a mean whitespace somewhere? :s
04:48clgvhttp://stackoverflow.com/questions/6538203/how-to-avoid-echoing-character-65279-in-php-this-question-also-relates-to-java
04:48ddellacostahyPiRion: yeah, you nailed it. :-)
04:48ddellacosta(inc hyPiRion)
04:48lazybot⇒ 47
04:48kenrestivowho had stealth character in the pool?
04:48ddellacostaand then another for all the help!
04:48ddellacostaand then another for all the help!
04:48ddellacosta(inc hyPiRion)
04:48lazybot⇒ 48
04:48ddellacostawhoops, dupe
04:48TEttingerthat's incredible.
04:48TEttinger(inc ddellacosta)
04:48lazybot⇒ 7
04:48kenrestivohow the hell did it get in there?
04:48ddellacostaTEttinger: :-)
04:48hyPiRionddellacosta: Well I didn't really. :p I just guessed that it was the issue based on bad experience myself
04:49ddellacostakenrestivo: must be something stupid I'm doing in the import.
04:49ddellacostaactually, isn't there a CSV import lib for Clojure? I should be using that
04:49hyPiRionddellacosta: yeah, data.csv I think
04:49kenrestivoyes there is, and that'd be wise.
04:49clgvhttps://github.com/tilo/smarter_csv/issues/27
04:49TEttingerI wrote one and didn't publish it.
04:49ddellacostaclgv: nice
04:49TEttingerit was uh not too hard
04:50ddellacostaTEttinger: yeah, that's the thing huh? My csv import is like five lines
04:50ddellacostabut if there is a lib that prevents these issues specifically, I want to use it
04:50hyPiRionah dang. http://dev.clojure.org/jira/browse/DCSV-7 seems to be unresolved
04:51ddellacostahyPiRion: aha!
04:51ddellacostawell, good to know I'm in good company at least
04:51kenrestivo..." in Microsoft Land. " it figurs
04:51ddellacostakenrestivo: seriously, I'll bet dollars to donuts the folks we got this from are on Windows
04:52kenrestivo \r\n
04:52TEttingerI think a regex replace that does all characters matching #"\p{Cf}|\p{Cc}" and replaces with nothing will work
04:52ddellacostaTEttinger: thanks, maybe I'll try that
04:52TEttinger\p{Cf} or \p{Format}: invisible formatting indicator.
04:52hyPiRionddellacosta: oh dang, this is a serious issue in Clojure as well it seems
04:52TEttinger\p{Cc} or \p{Control}: an ASCII 0x00–0x1F or Latin-1 0x80–0x9F control character.
04:52ddellacostahyPiRion: really? What else'd you find?
04:52hyPiRion,"\ufeffPersonnelNbr"
04:52clojurebot"PersonnelNbr"
04:52hyPiRion,(pr-str "\ufeffPersonnelNbr")
04:52ddellacostaohhoho
04:52clojurebot"\"PersonnelNbr\""
04:53kenrestivofeff is unicode cruft IRC
04:53ddellacostawow
04:53kenrestivoIIRC
04:53hyPiRion,(let [x "\ufeffPersonnelNbr"] (= (read-string (pr-str x)) x))
04:53clojurebottrue
04:53hyPiRionwat
04:53ddellacostahaha
04:53hyPiRionOh, it's actually printed. Nevermind.
04:53hyPiRionThis is the words
04:53hyPiRion*worst
04:54ddellacostayeah, not happy about this little problem, but at least I can work around it
04:54clgvwell pr-str and read-string prove consistent ,)
04:54ddellacostayou know, there's that saying, something like the only hard thing in programming is naming things and cache invalidation
04:54hyPiRion,(let [x "\ufeffPersonnelNbr"] (= (.trim x) x))
04:54clojurebottrue
04:54clgvyou need a specialized trim^^
04:54ddellacostaI think encoding should be in there. I've had issues w/encoding throughout my career
04:54ddellacostaright
04:55hyPiRionIt's not even considered whitespace? This is amazing.
04:55TEttinger,(let [x (clojure.string/replace "\ufeffPersonnelNbr" #"\p{Cf}|\p{Cc}" "")] (= (read-string (pr-str x)) x))
04:55clojurebottrue
04:55clgvddellacosta: http://stackoverflow.com/questions/6198986/how-can-i-replace-non-printable-unicode-characters-in-java
04:55TEttingerhm, that should be true
04:55clgvor what TEttinger said ;)
04:56clgv,(let [x (clojure.string/replace "\ufeffPersonnelNbr" #"\p{Cf}|\p{Cc}" "")] (= (read-string (pr-str x)) "\ufeffPersonnelNbr"))
04:56clojurebotfalse
04:56TEttinger,(let [y "\ufeffPersonnelNbr" x (clojure.string/replace y #"\p{Cf}|\p{Cc}" "")] (= (read-string (pr-str x)) x (read-string (pr-str y)) y))
04:56clojurebotfalse
04:57kenrestivowhich of those is false tho
04:59TEttinger,(let [y "\ufeffPersonnelNbr" x (clojure.string/replace y #"\p{Cf}|\p{Cc}" "")] (= x y))
04:59clojurebotfalse
05:00TEttinger,(let [y "\ufeffPersonnelNbr" x (clojure.string/replace y #"\p{Cf}|\p{Cc}" "")] (= (read-string (pr-str x)) (read-string (pr-str y))))
05:00clojurebotfalse
05:00borkdudeIs it possible to combine lein ring with lein gorilla?
05:01borkdudecan't find the option in lein gorilla to connect to an existing repl
05:01ddellacostanice, it's working for me now. (:PersonnelNbr (first ed)) -> "00800113"
05:01ddellacostaヽ(;▽;)ノ
05:01ddellacostathanks to kenrestivo, TEttinger, clgv, and especially hyPiRion, you folks are awesome
05:01kenrestivohyPiRion nailed it
05:01ddellacostaseriously
05:02TEttingeryep, hyPiRion wins with non-alphanumeric characters especially :)
05:02TEttinger(inc hyPiRion) ; another!
05:02lazybot⇒ 49
05:03kenrestivoi'd love to find the preson who thought a non-printing zero-space invisible whitespace character that isn't even whitespace was a good idea
05:03kenrestivoin the unicode spec
05:03ddellacostakenrestivo: I bet they were on the Word project team at Microsoft
05:07clgvkenrestivo: they wanted some metadata ;)
05:08kenrestivowait, now i'm confused. is that non-printing thing just FEFF, the BOM marker? in which case, its presence at least has some purpose.
05:08clgvyes it is. what purpose does it have?
05:09kenrestivoother than screwing up people's files, it seems to be there to indicate he byte order, hence its name.
05:09clgvah that' what it abbreviates
05:09kenrestivohuh, it has an html entity too http://www.fileformat.info/info/unicode/char/feff/index.htm
05:09clgvbut it does not make sense to add this to text files ^^
05:10kenrestivoanyway, i've run into this thing before, importing XML or something IIRC
05:11hyPiRionTEttinger: hahah, I wonder if I can use this in swearjure somehow
05:11TEttingerlol
05:12hyPiRionAlright, back to work before I actually start thinking about it
05:12TEttingerfeff is alphanumeric, but the actual char is not...
05:21justin_smith,(count "fefffeff")
05:21clojurebot9
05:22justin_smith,(count "")
05:22clojurebot1
05:22justin_smithevil
05:22justin_smith,(let [1])
05:22clojurebot#<CompilerException java.lang.IllegalArgumentException: let requires an even number of forms in binding vector in sandbox:, compiling:(NO_SOURCE_FILE:0:0)>
05:23justin_smithoh, clojure considers it whitespace
05:23justin_smithsomewhat less evil
05:25clgvinteresting.
05:27clgvjustin_smith: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L62
05:27hyPiRionOh, while we're at it: https://www.refheap.com/35602
05:27clgvhyPiRion: will that erase my harddrive? :P
05:28hyPiRionclgv: no :p
05:29hyPiRionBut it will compile and work, because \u0022 is " (etc.), and it's presumably preprocessed before the java compiler actually tries to read the input
05:29justin_smithit's like the java version of trigraphs
05:37TEttinger,(let [map (fn [f coll] (identity coll))] (map int "whee"))
05:37clojurebot(119 104 101 101)
05:37TEttingerjustin_smith, \ufeff is a valid part of identifiers
05:38TEttingerthe map in that let binding is named with one inside it :D
05:41TEttinger,(let [map (fn [f coll] (identity coll))] (map char (map (fn [_] (.toString nil)) [66 67 68])))
05:41clojurebot(\B \C \D)
05:44justin_smith,#{:a :a :a}
05:44clojurebot#{:a :a :a}
05:44justin_smithfun
05:44justin_smithand evil
05:59borkdudedoes slamhound also support clojurescript?
05:59borkdudeI guess not
06:00borkdudeI really need to clean up some namespace decl in cljs and hoped I could use smth like that
06:08rstandyhello clojurians
06:09rstandyI'm tying to learn Om right now and I am really puzzled on Om cursors
06:11rstandyhow can be that you can change the app state atom when an Om component receives something like: (vals (:classes app))
06:11rstandy?
06:12rstandycan someone help me understand? I'm aware of the fact that coursors maintain internally a path to get at the portion of the state that component manages, but what happens when a component receives a new value like in the example above?
06:16clgvrstandy: probably you'll have more success later today when all the US folks are around here
06:17rstandyclgv: ok, thanks for the suggestion :-)
06:25ddellacostarstandy: also check out #clojurescript
06:26ddellacostarstandy: but I'm not sure exactly what you're asking--each component gets its own cursor, so
06:26ddellacostarstandy: er, just not sure exactly what you mean
06:31rstandyddellacosta: thanks for pointing me to #clojurescript
06:32ddellacostarstandy: sure thing.
06:34rstandyddellacosta: anyway I was trying to uderstand how we can pass to a component a calculated value like in this expression: (om/build-all editable (vals (:classes app)))
06:35rstandyddellacosta: taken from the Om Basic Tutorial from David Nolen
06:35rstandyddellacosta: anyway I'll ask on #clojurescript also
06:35ddellacostarstandy: ah, I see. Well, the basic idea is that when you apply some functions to a cursor, those will return a cursor as well. It's not everything, but that's baked into the cursor implementation.
06:36ddellacostarstandy: because a cursor is basically a protocol that is applied to standard Clojure data structures
06:38ddellacostafor example, conj called on a MapCursor is going to return a MapCursor: https://github.com/swannodette/om/blob/master/src/om/core.cljs#L387
06:38ddellacostarstandy: sorry, I have that backwards: a cursor is a type that extends base Clojure protocols
06:38rstandyddellacosta: wow! Impressive! so every function in the library operating on associative collections is supported?
06:38ddellacostait wouldn't make sense the other way around. :-p
06:39rstandyddellacosta: yeah right, I've got the point anyway
06:39ddellacostarstandy: I don't know the answer to that, sorry
06:39rstandyddellacosta: but now everything starts to make sense, many thanks for lighting me ;-)
06:39ddellacostarstandy: but yeah, it's pretty powerful. At one point we had a SetCursor mostly working, although it had other issues so we dropped it...
06:39ddellacostarstandy: great. :-)
06:41rstandyddellacosta: anyway, I must say that starting to learn Om after reading a Clojure book is like a course on applied magic :-)
06:42ddellacostarstandy: haha, I know what you mean. Om really takes advantage of core Clojure concepts in some smart ways, that's definitely part of why it appeals to me.
06:45rstandyddellacosta: yeah, I basically thought that following some David Nolen's projects would have made me a magician
06:45ddellacostarstandy: heh. :-)
06:46rstandyddellacosta: but I usually see madness waiting me on some corners :D
06:46ddellacostarstandy: definitely taking some time to read through his source code is very enlightening. Reading Om's core.cljs has been instrumental in my understanding of it.
06:46ddellacostarstandy: well, there's always more to learn!
06:47rstandyddellacosta: yeah great suggestion! I will read the code after finishing the tutorials
06:47rstandyddellacosta: again, many thanks for your enlightening answer
06:48ddellacostarstandy: sure thing, glad I could help!
06:58conorbevHi there
07:01agarmanhi
07:05conorbevSorry if this is a dumb question. I'm new to Clojure and using Cider in Emacs along with lein. M-x cider-jack-in works fine, but, I believe that it downloads the latest version of the cider-nrepl middleware each time that runs? (or at least it didn't seem to work when my wifi dropped!) Is there a way to make lein store the plugin away somewhere so that I do cider-jack-in without a network and upgrade the middleware myself wh
07:05conorbevthe cider Emacs package?
07:05justin_smithconorbev: are you using a snapshot version?
07:08justin_smithyou can add :snapshot :never to the :repositories entry to prevent updates of snapshot versions https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L78
07:08conorbevjustin_smith: yes, I am using from Melpa rather than Melpa Stable. I had some issues with stable version (this was a couple of months back when I last played with it. I can't remember for sure what the problems were).
07:09justin_smithbut also, you can just not use SNAPSHOT dependencies - they are meant to be frequently updated
07:10conorbevjustin_smith: Thanks, I will try that. Am I right in thinking the cider-nrepl middleware snapshot is going to be closely tied to a particular cider Emacs package version? So if I upgrade one I should update the other, but probably no point having one being newer than the other?
07:11justin_smithconorbev: the 0.7.0 release was intended to be stable, but there is little to no priority given to stability by the cider team
07:13agarmanconorbev: as a cider user, let me pipe in. What justin_smith says about stability is spot on. I get a working version of emacs then only try out new versions in a sandbox.
07:14justin_smith"welcome to a confusing new language, first, before you can do anything else, play around with weird brittle configs that are usually broken"
07:14clgvwhen implementing a mouselistener I get "CompilerException java.lang.IllegalArgumentException: Mismatched return type: mouseClicked, expected: void, had: java.lang.Object"
07:14clgvwhat is going wrong?
07:15clgvI know that it does return void is the Clojure compiler malfunctioning here?
07:15jazz2hello
07:16justin_smithclgv: clojure can compile things that return void?
07:16clgvwell reify should automatically match the signature of the interface - hence clojure must support that, otherwise reify is broken
07:17conorbevagarman: Thanks, and do you put :snapshot :never into your lein config? I was playing with clojure several weeks ago and went to try again just now. When I did M-x cider-jack-in it complained that macroexpand and macroexpand-1 wouldn't work unless I upgraded my Emacs cider package (this along with noticing it didn't work without wifi was what tipped me off that the underlying middleware must be changing). So it seems having
07:17conorbev"working version depends not only on carefully upgrading Emacs package but not allowing the middleware to update automagically either
07:17agarmanconorbev: I don't use melpa, I download cider from github
07:18justin_smithagarman: the issue here is that the clojure side middleware is auto-upgrading
07:18justin_smithas it is a snapshot version
07:18justin_smithand they released an incompatible version without changing the version string
07:19clgvjustin_smith: interesting, removing the typehint for MouseEvent worked. so reify added implicit Object typehints because I specified the MouseEvent typehint...
07:19justin_smithclgv: under "Aliases" here I see that void is available for typehinting http://clojure.org/java_interop
07:19justin_smithTIL
07:20justin_smithclgv: that's kind of unexpected, but I guess you got it figured out?
07:21clgvjustin_smith: yeah just removed the explicit MouseEvent typehitn since it is implicitely derived anyway
07:41lvhHi! I'm getting the following exception when configuring a lein alias in project.clj; even though the same alias works fine in ~/.lein/profiles.clj: https://gist.github.com/lvh/46fce7e6eed268015a1e
07:42lvh(final exception: java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to java.lang.String)
07:44clgvlvh: why do you have nested vectors there?
07:44clgvlvh: I didn't know that this nested notation is possible
07:45clgvhumm seems valid according to the sample
07:48lvhclgv: I don't know, I picked it up from an article.
07:48lvhclgv: Seems to work in profiles.clj, though
07:49lvhTrying without the nested vecs
07:49lvhYeah, same deal.
07:52clgvwhere is the project.clj?
07:52lvhinterstingly, *none* of these aliases work, not even lein slamhound :)
07:53lvhclgv: Sorry, adding it to the gist now
07:53lvhtry again: https://gist.github.com/lvh/46fce7e6eed268015a1e
07:54clgvdo you have them set in both at the same time?
07:56lvhyes
07:56lvhis that not okay?
07:57lvhI would expect the local to override the global :)
08:00lvhclgv: welp, that is apparently the bug
08:01clgvlvh: leiningen has a profile merge logic. I suspected this might fail here
08:02clgvlvh: you have to explicitely use ^:replace to override some value
08:09lvhclgv: Cool, thanks! I'm trying to figure out how that works: https://github.com/technomancy/leiningen/blob/b497494b0445cb361381c71ff86517b4697a5419/leiningen-core/src/leiningen/core/project.clj#L432-L461
08:09lvhdoesn't seem to handle :replace in meta
08:10lvhI guess that just merges?
08:10clgvyou can use "lein pprint" so see the merged profile
08:11clgvlvh: ^:replace definitely works on top-level values, I use it for :jvm-args
08:11lvhclgv: Oh, I have no doubt that it works :)
08:12clgvok maybe I misunderstood your previous comment
08:12lvhclgv: I'm just figuring out how leiningen does that :)
08:13clgvlvh: see `pick-prioritized`
08:13lvh'pprint' is not a task. See 'lein help'.
08:13lvhclgv: Thanks!
08:16lvhAlso, clojure.org https keeps showing me wikispaces.com certs; where do I file bug reports for that?
08:17clgvok then pprint is still a plugin ;)
08:18clgvlvh: dont know what you mean
08:18clgvlvh: ah you mean when you access it via https?
08:18lvhyep
08:19clgvhuh that's broken
08:19clgvhumm mailing list?
08:20lvhon it :)
08:21justin_smithamalloy_: BTW, I figured out my issue - for lower primes the gap between even / odd streams is reasonable, but it grows linearly with the size of the numbers - so as the process runs more and more of the lazy seq is held onto as the odds trail behind the evens by larger and larger degree
08:22justin_smith*lower palindromes, not lower primes
08:29lvhclgv: Interestingly, lein show-profiles dev shows it correctly
08:30clgvlvh: probably because no merge happens if you only show a specific project
08:30clgvtry "lein show-profiles user,dev"
08:32lvhlein cprint also shows both maps in different places
08:34eskatremhey, yesterday I had some problem to update some fields in mongodb from clojure. I found the solution to my problem, not sure the guy who tried to help me is here. Anyway, my mistake was to search stuff with {:id "1"} instead of {:id 1}.
08:35visofhi
08:35eskatremhi visof
08:35visofi have packaged my app as jar and tested it using java -jar app.jar and it's working very good, but when i package it as war and deploy in tomcat i got all routes 404
08:36visofwhat is the best way to figure out it?
08:42clgvlogging
08:43justin_smithvisof: tomcat has extensive logs, have you checked those out at all?
08:45dnolen_just released ClojureScript 0.0-2341, quite a lot of changes around analysis, feedback welcome if you run into any issues
08:50visofjustin_smith: yeah i got 404 not found for the routes
08:50lvhclgv: :aliases ^:replace {...} fixed it; thank you so much :)
08:51justin_smithvisof: I mean, in the tomcat logs it should show which endpoints are being hit, any errors it may have, under which route it is mounting a particular war file...
08:55jazz2If you master the clojure ,what's you feel about scala program language
08:55agarmanI spent 4 years programming Scala every day
08:55agarmanI'd rather never write a line in that language ever again
08:56jazz2:agarman but now you are clojure channel ,why
08:56agarmanI write Clojure for work.
08:57agarmanand occasionally Java
08:57agarmanand sometimes I have to support erlang code base
08:57mavbozoagarman: how you convince your boss to let you program in clojure?
08:58agarmanmavbozo: they hired me to introduce the team to functional programming. the cto has a dev background; he wrote the erlang code we use in production.
09:01agarmanmavbozo: there was little convincing needed. At the weather channel, we had to make the case for moving from C# -> F# and from Java -> Scala
09:02jazz2what is major difference between clojore and scala .
09:03agarmanScala is an okay language aside from a few really ugly warts: implicits, package objects (which make implicits transitive) and heavy reliance on concrete inheritance as an idiomatic design pattern
09:04agarmanClojure has some uglies too, but none cause anywhere near the confusion that those big three warts induce.
09:05lvhWhen I do lein deps :tree, the suggested exclusions always seem to suggest the lowest version. Is that intentional, or just a side effect of how they happened to be organized in my projects.clj?
09:08jazz2agarman: you say implicits is ugly ?
09:13agarmanjazz2: let's not talk about #scala in #clojure
09:13justin_smithlvh: I think the assumption is that you would more likely want to exlude earlier versions vs. later ones
09:14daniel___agarman: what are clojures uglies
09:14agarmandaniel___: as a lisp, it's confusing that () isn't falsy
09:16hyPiRionlvh: We peek into the dependencies and find the highest version of all dependencies. If the version used is lower, we suggest exclusions which cause the highest one to be picked
09:16hyPiRionand yes, it has partly to do with ordering
09:21lvhhyPiRion: So, for example: https://gist.github.com/lvh/aaae39e7bb1170420705
09:21lvhWouldn't [com.novemberain/welle "3.0.0" :exclusions [potemkin]] disable the 0.3.4 pulled in from welle?
09:25hyPiRionlvh: Whoops, inverse logic there. Yes – it suggests all the ones not used
09:25borkdudethere is something with my subscription channel. It only receives a message once....
09:26hyPiRionLet me drag up the actual cheatsheet on that – My memory is apparently not 100% correct
09:26hyPiRionlvh: https://github.com/technomancy/leiningen/issues/1337#issuecomment-25924936
09:27lvhhyPiRion: So what do I do to make it use the newer one, ideally in such a way that is future-proof? (I don't think lein-ancient checks deps transiently, but I could be mistaken)
09:27lvhhyPiRion: thanks!
09:28hyPiRionIf lein-ancient doesn't check transient dependencies, then I'll add exclusions the opposite of what lein pedantic recommends
09:28hyPiRionor, even better, I specify the dependency and its version in the :dependency vector
09:29lvhhyPiRion: okay, cool; so in this case I specify [potemkin 0.3.4] (or whatever I don't remmeber the version) in *my* project.clj's :dependencies?
09:29lvhEven though I don't actually depend on potemkin myself :)
09:29hyPiRionyes
09:40foucistso everyone here realizes that tests (TDD/BDD) are just a step away from some sort of constraint/logic programming right? so if we take something like tests or a better form of constraint-based DSL, and then hook it up with machine learning or evolutionary computation, it'll generate the solution to the problem given by the constraints
09:40foucistso any thoughts about how to approach this in clojure?
09:42borkdudetricky, I thought sub would return the channel to read from
09:43borkdudeI don't know what it is that it returns though, but you can read from it
09:47borkdudeit was not the solution for my problem however
09:48hyPiRionfoucist: https://www.youtube.com/watch?v=5Q9x16uIsKA#t=1159
09:49foucisthyPiRion: would you use that for TDD though? :P
09:49foucisti probably want a hybrid spec/logic DSL
09:49hyPiRionfoucist: I don't use TDD, but if I were to, I'd use test.check
09:50hyPiRionQuickcheck sounds similar to what you want, although not exactly the smae
09:50hyPiRion*same
09:51foucistnot bad
10:11TimMcfoucist: You would need to make sure to represent *all* the constraints, and that's very, very hard when you include things like run time and GC perf.
10:13foucistTimMc: well i'm really talking about something that generates a programmatic solution that can then be run from then on
10:14foucistand not sure if all constraints are necessary, could give it leeway to do whatever, all i'd really be checking for is input/output & no side effects..
10:16clgvfoucist: there is PushGP whose current main implementation is in clojure
10:16TimMcIn real code, heap allocation, GC pauses, and stack consumption have to be considered as side effects...
10:17clgvah it's actually called Clojush https://github.com/lspector/Clojush
10:18TimMcYou might say "nah, it's OK to have massive GC pauses on this batch job", and that's fine, but you have to at least answer taht question...
10:21eristicHi everyone! I'm a Clojure/functional language n00b coming out of Ruby, and I'm looking for a list of essential reading material. Any suggestions?
10:21borkdudeeristic Clojure Programming is nice
10:22borkdudeeristic there are a lot of good books now
10:24mavbozofor lightreading, you can start from clojure from the ground up by Aphyr http://aphyr.com/posts/301-clojure-from-the-ground-up-welcome
10:24eristicI'm starting with Marick's Functional Programming for OO Programmers
10:24sveriOk, a quick survey, which build server has the best clojure / leiningen support?
10:25eristicThanks borkdude and mavbozo
10:25mavbozoeristic: I also found that doing 4clojure.com helps me understand quickly
10:25mavbozosveri: pardon me, but what is "build server"?
10:26sverimavbozo: jenkins is one, bamboo and some others, something that builds your artifact and deploys it somewhere
10:29mavbozosveri: oh, that continuous integration thing
10:30foucisthmm, a grammar could be a good constraint-based DSL
10:30mavbozosveri: circleci is quite good, plus it's cheaper than others
10:31TimMceristic: A couple warnings: clojure.org has bad getting-started instructions (use leiningen!); clojuredocs.org is a couple versions out of date.
10:32eristicTimMc: Noted!
10:32daniel___eristic: i liked the clojure cookbook
10:34mavbozoeristic: and you can use http://grimoire.arrdem.com/ as your clojure cheatsheet. It's nicer than http://clojuredocs.org or http://clojure.org/cheatsheet
10:34daniel___its a more practical introduction, you can fill the rest in from other sources
10:50stuartsierra,(sort [[1 2 3] [4 5]])
10:50clojurebot([4 5] [1 2 3])
10:50stuartsierraGets me every time.
10:51TimMcheh
10:54clgvare there known problems with canceling futures? I do (let [f (future ....), result (deref f timeout :timed-out)] (when (= result :timed-out) (future-cancel)) result)
10:54clgvbut some threads seem to stay around and are not canceled
10:55stuartsierraThe KVM offers no guarantees about the ability to destroy a thread.
10:55stuartsierra*JVM
10:55perplexastuartsierra: so it sorts by size?
10:55perplexaor how does that happen?
10:55stuartsierraperplexa: size first, then by contents
10:55perplexa,(sort [[1 2] [4 5]])
10:55clojurebot([1 2] [4 5])
10:55loliveiraHi, I’m staring to use stuartsierra’s compoment library and I am dealing with a kind of leak. The system still has a reference to a subsystem after stop have been called. Could you please help me to point what I am doing wrong? https://www.refheap.com/90396
10:55perplexacos that works ;x
10:55perplexastuartsierra: ye ok :)
10:55lvhHm; why is (a/<!! (a/go (assert false))) ;; => nil? I was expecting that assertion error.
10:55lvhNot raised, but as avalue.
10:56clgvthen it would be nice if the doc string of future-cancel mentions this fact
10:56stuartsierraloliveira: If you're implementing your own system records, you have to call `start-system` / `stop-system`.
10:57stuartsierraIn your implementations of start/stop.
10:57stuartsierraBut you probably don't need nested systems.
10:57foucist,(sort [[1 2 3] [5 4]])
10:57clojurebot([5 4] [1 2 3])
10:58loliveirastuartsierra: I’m not using nested systems. Am I?
10:58stuartsierraloliveira: Yes, you are.
10:58stuartsierraYour `SuperSystem` record?
10:59stuartsierraYou haven't shown the `new-system` constructor, but you're calling it inside `system-map`
10:59stuartsierraAlso, `component` does not promise to dissoc dependencies on `stop`.
10:59daniel___,(sort [[1 2 3 4 5 6] [1e5]])
10:59clojurebot([100000.0] [1 2 3 4 5 ...])
11:00loliveirastuartsierra:(defn new-system [args]
11:00loliveira (map->SuperSystem args))
11:00stuartsierraloliveira: OK, I was confused by the name 'SuperSystem'
11:02loliveirastuartsierra: SuperSystem is just a component. I agreed i choose a bad name.
11:02stuartsierraloliveira: Right, so 'Component' doesn't dissoc dependencies on `stop`.
11:03stuartsierraSee discussion at https://github.com/stuartsierra/component/issues/9
11:03loliveirastuartsierra: yes. It dissoc on (-> system :io ), but not on (-> system :app :io)
11:04stuartsierraloliveira: You did that, at line 17, `(dissoc component :io)`
11:07loliveirastuartsierra: yes, I did it, but I sttil have a reference to the io subsystem through (-> system :app :io). I was expecting the reference was removed after calling stop.
11:08stuartsierraloliveira: No, it doesn't do that.
11:09loliveirastuartsierra: I’ll read the link that you send me. Thank you for your help. It doesn’t do that, but shouldn’t do it? It seems natural.
11:09stuartsierraloliveira: there are reasons, discussed on Github
11:10loliveirastuartsierra: Ok, thank you again. Component is a great library. Thank you.
11:10stuartsierrayou're welcome
11:23seangrovednolen_: Does https://github.com/clojure/clojurescript/commit/877b1ab2e6bb1c09d1988348d6cb384f8ba16414 (CLJS-858) mean that if a function in another ns isn't defined, the compiler will give a warning now?
11:24kyrreI am experiencing some issues when trying to initialize a Java singleton class in clj: https://gist.github.com/kyrre/8caadbe2730642157326
11:26boodletrying to change a string from "om [clj js] testing" -> ["om" "[clj js]" "testing"]
11:26boodleregexps/split get me close but stuck on preserving the quoted "[]"
11:39lvhDoes clojure.core.test have any utilities for skipping tests, or does that mean moving to midje?
11:40clgvlvh: aren't ther filter options via metadata? "lein help test" could help
11:40lvhthere is for midje, I couldn't find anything about it for c.c.t; checking now :)
11:40lvhoh, hey, test-selectors!
11:40clgv;)
11:41lvhthanks clgv!
11:41clgvyou're welcome
11:45borkdudeWhy is my counter only inced once in this snippet? https://www.refheap.com/90399
11:48lvh(inc clgv)
11:48lazybot⇒ 26
11:48lvhI think I owe you more than a few incs there, clgv
11:49lvhby the way, is there a way to :exclude in :require? I want to clojure.core.async :refer :all, but clojure.core.async has a thing called "reduce"; I'd much rather have the core reduce than c.a's reduce :/
11:54clgvlvh: lol no problem ;)
11:55clgvlvh: there is :rename
11:56clgvlvh: but yeah, there is also :exclude
11:57lvhclgv: I tried that, watched it fail, but apparently that's for a different reason... *tries*
11:57clgvlvh: should work though, cf https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4052
11:57lvhclgv: There's something weird going on; suddenly it can't find core.async anymore :/
11:58clgvdoomsday is near...
11:58clgv;)
12:07lvhIs it possible to write macros that use "<!" given that it wants to be used it a go block so badly?
12:08lvhI've got https://gist.github.com/lvh/0d7ddbd05196c777eb69
12:09clgvlvh: yeah, why not? as long as the macro expands within the go block
12:13borkdudehelp. http://stackoverflow.com/questions/25917557/core-async-pub-sub-in-om-clojurescript
12:14lvhIs there a way to "purge" namespaces when I start getting errors like "x already refers to this-specific-x in namespace..."?
12:14lvhOther than "restart the nrepl process" because that takes unacceptably long
12:14lvhmaybe I should just buy a faster machine :)
12:14clgvmanually `ns-unmap`
12:16lvh(dotimes [_ 10] (inc clgv))
12:16lvhno dice huh
12:21clgv2d6
12:21clojurebot9
12:21clgvthis is a dice roll ^^ ;)
12:22clgvtwo to be exact...
12:22lvhNice :)
12:22lvhSo, I wrote some macros in terms of some other macros; are there ways to make this neater still? https://gist.github.com/lvh/0d7ddbd05196c777eb69
12:22lvhalso has someone put that in a library? there's several blog posts and tutorial videos that mention that fn, it seems like it'd be useful to either have in clojure.core.async or at least in some lib
12:23clgvseems pretty concise
12:23noonianlooks good to me, except i keep reading 'throwing-up' instead of 'throwing-op'
12:25lvhnoonian: same here
12:57kenrestivois doing lots of stuff inside of a let kind of smelly?
12:58dnolen_kenrestivo: just depends, in the past you often didn't have another option there are some neat macros for common cases now
12:59kenrestivo(let [foo <10 lines of code> bar <10 more lines of code> baz <10 more lines>] (something-simple! foo bar baz) foo) has a bit of an odor to me
13:00kenrestivohint: some of those 10 lines include calls to client/get
13:04justin_smithclgv: regarding cancelling, the doc string for future-cancel does say "if possible" - if your future code is a loop of some sort, add a check as to whether the current thread is cancelled, and exit the loop if it is
13:04justin_smithclgv: future-cancel will set that cancelled flag, you need to check for it and act on it though
13:05danneui've changed up my development workflow so that i can now spam (start-server!) in my emacs buffer as i code. it reset!'s my `server` atom. but now none of the printlns within my handler show up anywhere.
13:05danneuwhat's the main culprit for this?
13:06justin_smith,(.isInterrupted (Thread/currentThread)) ; clgv
13:06clojurebotfalse
13:07clgvjustin_smith: well that's not possible without much effort.
13:08justin_smithOK, maybe it would be easier with a go block and a poison channel
13:08clgvI'd prefer that the jvm would just kill thread from the threadpool and start a new one
13:08justin_smithhell, I wish the jvm supported proper tail recursion
13:08justin_smithtail calls even, while we are at it
13:08clgvwell can live without it
13:09clgvsince the jvm supporting tail call optimization would have not much impact on the programmer since the hard part is to find the tail recursion which you have to do anyway
13:10justin_smitha compiler can trivially detect and optimize tail calls, if it knows what they are and has some mechanism for them
13:12justin_smithnot just self calls mind you, but general calls from the tail position
13:18noonianproper tail calls would be amazing
13:22CookedGryphonI like that clojure makes you be explicit about tail calls, quite often, especially when learning I thought I was doing tail calls, only to find I wasn't
13:22CookedGryphonif I wasn't using the recur form, I would have carried on blissfully unaware until it exploded
13:23CookedGryphonit's doubly relevant when editing code and not realising that your innocuous log is actually breaking your tail call
13:29noonianCookedGryphon: but unfortunately you can't use recur to do mutual recursion, only self recursion, and trampoline adds more cognitive overhead for the programmer
13:33clgvjustin_smith: but the compiler cant transform arbitrary recursion to tail-call recursions
13:33justin_smithsure
13:33rweirnot with that attitude
13:33justin_smithno compiler can do that
13:34clgvjustin_smith: so what exactly is the benefit you talk about?
13:34justin_smithautomatic optimization of tail calls - not just self calls, but general tail calls
13:34justin_smithreduced stack usage, better performance
13:34noonian^
13:34clgvah you mean calls to other functions...
13:35rweiris it wise to have /some/ recursion magically use TCO and some not, with no indication in the source of which is which?
13:35noonianthe indication is whether not the call is a tail call
13:35rweirhm, right
13:36justin_smithrweir: it isn't wise to count on it, but why object to getting it for free
13:51PigDudeCookedGryphon: sounds like stockholm syndrome
13:52PigDudeCookedGryphon: being unaware of the difference between tail-recursive and non-tail-recursive code is a different matter than clojure requiring (recur) for TCO, the former is confusion, the latter a real limitation
13:53amalloyjustin_smith: the argument is that if you get it for free you'll end up counting on it. then when you edit some tail-recursive code and accidentally make it not tail-recursive, the compiler won't tell you
13:54amalloyand you aren't really checking for that, because you have lots of code that's not tail-recursive; it usually doesn't matter
13:55nopromptdnolen_: hey david, this backtick thing is a bit intimidating. how should i approach it?
13:56dbaschis this (if (> idx 9) 9 idx)) the same as (min 9 idx) or do I need coffee?
13:56dbasch:P
13:56amalloydbasch: looks like it to me
13:56dbasch(doing a code review)
13:56nopromptdnolen_: it seems like a reader problem.
13:56justin_smithdbasch: modulo the extra close paren
13:56dnolen_noprompt: yes it's a reader thing
13:57dnolen_noprompt: probably worth asking Bronsa about this too
13:59nopromptBronsa: for context, the problem is with reading forms like `{:x 1} returning a form like (clojure.core/with-meta (clojure.core/apply clojure.core/hash-map ...)
14:01nopromptBronsa: this affects the cljs compiler resulting in meta leaking into the compiled source.
14:01nopromptBronsa: https://gist.github.com/noprompt/55b7e79887be24da458c
14:01dnolen_Bronsa: another case of :file, :line, :column leaking, not immediately obvious to me how to remove it.
14:05Bronsaah, uhm, yeah that's problematic
14:07Bronsanoprompt: dnolen_ I'm considering decomposing the reader into a parser+emitter, that way source info could be attached to the parse tree & only optionally to the emitted forms, I suppose this should help cljs?
14:10Bronsae.g. (parse "`foo") -> {:op :backtick :item {:op :symbol :form 'foo :line 1} :line 1}, (emit (parse "`foo")) -> ns/foo, (emit (parse "`foo") {:source-info? true}) -> ^{:line 1} ns/foo
14:11Bronsaso the cljs compiler could use parse, extract the source info & call emit on the parse tree w/o worrying about it being attached as metadata
14:20dnolen_Bronsa: I think I would prefer something simpler in this case for ClojureScript which is just an option to discard that stuff from backtick
14:20dnolen_I can't think of case where this would be problem given macros are written in Clojure
14:27Bronsadnolen_: noprompt turns out the reader was already supposed to avoid attaching meta on syntax-quoted forms if meta consistend only of source-info but there is a bug.
14:28ckirkendallBronsa - Nothing about the dissoc in reader/add-meta makes sense to me. The syntax-quote* should be on the dissoc meta.
14:28Bronsackirkendall: I just pushed a fix for that
14:29dnolen_Bronsa: k great
14:29dnolen_noprompt: done :)
14:30ckirkendallI don't think that fixes the problem.
14:30Bronsadnolen_: so is this current behaviour acceptable for cljs? https://github.com/clojure/tools.reader/commit/0c4910fb59ee1ce39de48590ab851f75b86b4ffb
14:30Bronsa`foo -> ns/foo, `^:foo foo -> ^{:line 1 :foo true} foo
14:30ckirkendallnevermind
14:30dnolen_Bronsa: yes
14:31Bronsacool, I'll release new tools.reader version then
14:31dnolen_Bronsa: thanks!
14:31Bronsanp
14:31nopromptawesome!
14:31noprompthurrah for edge cases!
14:33nopromptdnolen_: how soon will we see that in master?
14:35nopromptthat seems like a pretty critical patch. :-)
14:36Bronsa0.8.9 is out
14:36nopromptBronsa: you rock!
14:37SegFaultAXBronsa: Need to bump the README versions?
14:37Bronsanoprompt: perspective, I'm the one who put the bug there in the first place :P
14:37BronsaSegFaultAX: yeah I'm doing that
14:38dnolen_noprompt: whenever tools.reader makes it to Maven Central
14:38dnolen_noprompt: I'll cut a new CLJS release just for this
14:41nopromptdnolen_: sweet. for some of the things we're doing that's going to reduce the output significantly.
14:41nopromptBronsa: no worries! :-)
14:43ckirkendallBronsa: It feels odd that we are only looking for those keys and if a new key is ever added it will leak all of them. Should we not just strip them out before we syntaxt-quote them.
14:44ckirkendallBronsa: It fixes this case but feels fragile because it will leak all the keys if any new key exists.
14:45Bronsackirkendall: this behaviour is consistent with how LispReader does it
14:46Bronsackirkendall: https://github.com/clojure/clojure/blob/a989c01eed7ce29cc7672b7a402e4f335d792882/src/jvm/clojure/lang/LispReader.java#L855-L857
14:47nopromptbah! to hell with consistency! :-P
14:51ckirkendallBronsa: This is a bit different we are leaking a bit more information including directory structures on the machine it created on. Maybe we should be using namespaced keys for this and striping them out.
14:51nopromptit seems like those keys oughta be namespaced or something.
14:52nopromptckirkendall and i not working together. this is purely a coincidence.
14:53dnolen_ckirkendall: noprompt: I don't think LispReader is going to add anymore of these and thus equally unlikely for tools.reader
14:54dnolen_more importantly code exists that relies on this stuff, it is effectively set in stone
14:55Bronsackirkendall: I can only assume you're talking about :file, that is handled the same way as by LispReader and binding *file* to nil is all it takes to strip it
14:56nopromptBronsa: but how can we handle that when we're using cljsbuild?
14:57Bronsanoprompt: clojurescript controls tools.reader at that point
14:58nopromptdnolen_: for :advanced builds is that bound to nil?
15:00nopromptdnolen_: nevermind.
15:00Bronsanoprompt: to be clear, I'm not opposed to adding a knob to tune what/where source-info metadata is attached in tools.reader, I just don't have the time for that right now. If you or ckirkendall or anybody else wants to submit a patch for that, be welcome to do so :)
15:01nopromptBronsa: ok, that works. :-)
15:04dnolen_noprompt: just cut 0.0-2342, just waiting for a build executor on Hudson and of the course the delay to Maven Central
15:05nopromptdnolen_: thanks for the quick turn around. :-)
15:06nopromptdnolen_: clojurescript is truly an anomaly.
15:07foucistanomaly?
15:07nopromptfoucist: the patch/release cycle turn around is quick.
15:08foucistah
15:08nopromptfoucist: how many languages can you just say, hey, fix this now and it get's fixed now?
15:08noprompt(inc clojurescript)
15:08lazybot⇒ 1
15:08foucistheh
15:08noprompt:-/
15:09foucist(inc clojurescript)
15:09lazybot⇒ 2
15:09nopromptreally? *no one* has inc'd clojurescript.
15:09hfaafb(dec clojurebot)
15:09lazybot⇒ 42
15:20dbaschwhat’s the standard way to do fmap these days, i.e. apply a function to the values of a map?
15:20Bronsadbasch: I usually use reduce-kv
15:21Bronsabut I guess you can use zipmap and map over the vals
15:22justin_smiththere is also (into {} (map (fn [[k v]] [k (f v)]) m))
15:25TimMcdbasch: clojure.algo.generic.functor/fmap
15:25dbaschTimMc: that’s where it went. Thanks.
15:27eskatremnoonian: hey, you tried to help me yesterday with a problem to update a field with mongo/monger
15:27eskatremnoonian: I fixed it, actually I tried to update the fields were ids are like {:id 1} by looking for {:id "1"}
15:28justin_smithamalloy: dunno if you saw in the scrollback, the heap usage issue was because the generation of odd count palindromes and even count palindromes diverged. By generating the input sequence twice I eliminated the issue.
15:29justin_smiththat is, the range from 11 to 111 is not a huge problem, but the range from 12321 to 123321 is a bit more of a problem, etc.
15:32dnolen_noprompt: curious to hear what you think of the analysis changes :) they of course uncovered several issues in the standard library and core.async itself :P
15:32dnolen_also should make deftype/defrecord/reify/specify code way more pleasant to write
15:55noonianeskatrem: ah, that makes sense. I'm glad you figured it out!
16:03amalloyah. thanks, justin_smith, i didn't see that
16:05amalloymakes sense
16:07eskatremnoonian: yeah, I was really getting crazy over this.
16:08jdeisenbergWhat is the advantage of saying lein new app com.example/myproject vs. lein new app myproject ?
16:09justin_smithjdeisenberg: it sets up the directory structure properly
16:10justin_smithso instead of src/myproject/core.clj you get src/com/example/myproject.clj
16:10justin_smithand that saves some busywork of fixing it
16:11jdeisenbergjustin_smith: thank you. I just see all the tutorials starting with "lein new app my-project" or such-like.
16:11jdeisenberg...and then you get core.clj
16:12jdeisenbergUsing the long notation appears to produce (ns com.example.myproject ...), which, I presume, is better because you avoid collisions with existing libraries,etc.?
16:13justin_smithit's actually meaningful
16:13justin_smithcore.clj is just a filler
16:16nopromptdnolen_: sure. i suspect i'll have a chance to take a look at it when i make another round of patches to clairvoyant. hopefully that'll be soon. :-)