#clojure logs

2016-04-04

00:00TEttingertwo nested vectors since you used conj to add a new element instead of concat to append a collection
00:00user_ah
00:00user_makes sense
00:00TEttinger,(let [listInput [{:paths [[:node 1, :cost 1], [:node 2, :cost 2]]},{:paths [[:node 2, :cost 1], [:node 3, :cost 2]]},{:paths [[:node 0 :cost 1], [:node 1, :cost 2]]}] ] listInput) ; this is what gave 2
00:00clojurebot[{:paths [[:node 1 :cost 1] [:node 2 :cost 2]]} {:paths [[:node 2 :cost 1] [:node 3 :cost 2]]} {:paths [[:node 0 :cost 1] [:node 1 :cost 2]]}]
00:01TEttinger,(let [listInput [] listInput (concat listInput [{:paths [[:node 1, :cost 1], [:node 2, :cost 2]]},{:paths [[:node 2, :cost 1], [:node 3, :cost 2]]},{:paths [[:node 0 :cost 1], [:node 1, :cost 2]]}])] (print (count (:paths(nth listInput 1)))))
00:01clojurebot2
00:01TEttingerconj to concat works in your existing code
00:01TEttingeryou were 3 characters off, that's all!
00:07user_TEttinger, lol
00:07user_Any good Clojure games worthwhile to play?
00:08user_Even ones written in Clojurescript
00:23libertytraderI have two collection of maps of the same type... i want to merge them. Do I have to convert one to a seq and then I can use conj?
00:23libertytraderor do i have to map conj over the seq or something?
00:27libertytraderoh concat sweet
00:31tolstoyIs there a handy function to remove a matching element from a vector?
00:33dpzmicktolstoy: https://clojuredocs.org/clojure.core/filterv
00:34tolstoyAlas. Nothing as clean is disj, eh? ;)
00:34tolstoyAnyway, thanks!
02:08tolstoyOh, my: https://www.youtube.com/watch?v=pTArJBycP4Y (Beethoven Sympony 3 graphically presented.)
02:09libertytraderI have a problem... when I type "lein run" my app works
02:09libertytraderbut the standalone uberjar does not work
02:09libertytraderno printf output
02:09libertytraderanyone have any ideas
02:10cwgem|macAny good way to get the Clojure source with the various stdlib packages included? It seems like I have to download almost the entire clojure GitHub org repos to achieve that
02:10tolstoyIn project.clj, make sure :main is set to the namespace of your project.
02:44libertytradertolstoy cwgem|mac the problem was i needed to call flush
03:24slester_quick question, is there any reason jdbc's query function would require a lazyseq?
03:25hiredmanwhat do you mean by require?
03:25slester_err, return. sorry. late.
03:26hiredmanquery's return value isn't actually lazy by default, query calls doall on it
03:26slester_I'm doing a (str (j/query db ["select * from table"])) thing and it prints out LazySeq
03:26hiredmanthe type is LazySeq, but by default the seq is entirely realized
03:28hiredmanseqs are sort like an iterator in java in that they represent a traversal of something
03:28hiredmanso query is return a traversal over the results of the query
03:28slester_sorry, there's also a :row-fn :name in there
03:28hiredmanwhich makes so much sense that I bet whoever wrote it didn't even think about it
03:29hiredman(if your question is "what is the
03:30hiredmanso if your question is literally "what is the reason it returns a seq" the answer is basically "that is the default stance of a clojure programmer"
03:32hiredmanif you question is "how do I get a readable printing of a seq" the answer is actually "str doesn't always return readable things, it just calls .toString, if you want to get readable things use the pr and prn family of functions"
03:33slester_the latter was it, thanks, I expected str to do the same thing as print
03:33hiredmannot print, pr
03:34slester_well, in my function I had (let [x (j/query..)] (print x) x) and it printed out things
03:34slester_but I was doing (str "stuff:" (the-fn)) and it did not do what I thought it would do
08:09Lewixmorning
08:36irctcHi There
08:37irctcI am new to clojure and need some help in writing a clojure code to get data from json payload and send an email to interested parties
08:38faxmodemirctc: what did you try?
08:38irctcNeed help in converting json payload which is non repeating into data structure
08:38faxmodemirctc: there's a lib for that I've used some time ago
08:38faxmodemcheshire or something
08:38ridcullyirctc: do you have any specific problems to share? e.g. some code snippet + errors on some paste-site?
08:38MJB47_cheshire is the json goto i think
08:39irctcya I have
08:39irctc{ "apiVersion": "1.0", "messageId": "305536b9-36cf-4781-91d3-0a0600b30101", "timestamp": 1459082055277, "testEvent": false, "projectId": "vof_pratima-hello-world", "events": [ { "eventId": "REVIEW", "projectId": "vof_pratima-hello-world", "timestamp": 1459082038, "data": { "review": { "id": 27, "title": "test", "created": 1459082037700, "modified":
08:39ridcullyplease don't paste into irc. a) it cuts off your text, b) if you paste much the server might kill you because of flooding
08:39irctcI want to send email to the to email value
08:40irctc{ "apiVersion": "1.0", "messageId": "305536b9-36cf-4781-91d3-0a0600b30101", "timestamp": 1459082055277, "testEvent": false, "projectId": "vof_pratima-hello-world", "events": [ { "eventId": "REVIEW", "projectId": "vof_pratima-hello-world", "timestamp": 1459082038, "data": { "review": { "id": 27, "title": "test", "created": 1459082037700, "modified":
08:41irctcThe code I wrote for this is
08:42irctc(defn make-commit-msg [reviewevent] (get-in env ["review" 0 "id"]) ) (defn make-commit-email [event] (apply str (mapv make-commit-msg (get event "events"))) ) (deforch "Generic hook to send email when Merge request is created" (defstart :from :mergehook :when [ (event=? "REVIEW" ["events" 0 "eventId"]) ] :then (let [event (:event context)] (email "pratima.mangena@oracle.com" "[Generic webhook from webho
08:42ridcullywell maybe i'm /ignored...
08:42irctcas of now I have hard coded the target email address however I should pull from the json payload
08:43Empperiirctc: do NOT paste stuff like that to IRC
08:43Empperiuse pastebin, refheap or similar
08:43Empperino one wants to read that from IRC
08:43clojurebotCool story bro.
08:43Emppericlojurebot: ain't it?
08:43clojurebotExcuse me?
08:44Emppericlojurebot: you are a moron, but that's not your fault but your creators so it's cool
08:44clojurebotHuh?
08:44faxmodemclojurebot: consider yourself excused
08:44clojurebotTitim gan éirí ort.
08:44irctcwhere is paste bin
08:44Empperigoogle
08:44Empperifirst hit in google I'd gather
08:47irctchttp://pastebin.com/9XEsvL93
08:48irctcis this accessible
09:13irctcReposting my code
09:13irctchttp://pastebin.com/9XEsvL93
09:13irctcAny clojure experts good at decoding the json payload for me
09:14irctcplease respond
09:17kwladykairctc do you have json and want convert it to edn?
09:17kwladyka(clojure data structure)
09:30irctchere is the json
09:30irctchttp://pastebin.com/9M4EdN84
09:33kwladykairctc what did you do to find a solution? It is in the first position on google. Or i don't understand your problem.
09:33irctcmy json payload is http://pastebin.com/9M4EdN84
09:34irctcthe code I wrote to pull the json payload is http://pastebin.com/9XEsvL93
09:34irctcI need help in traversing the payload using clojure code
09:35irctcI got a blank email with no body
09:35kwladykayou need conver json to end (clojure format) yes? if you use ring you can use wrapper, if you don't use ring you can use for example https://github.com/clojure/data.json (first position after write in google "clojure json")
09:35irctcwhere I expect review ID in the json payload
09:35kwladyka*end = edn
09:37kwladykai don't know what you pass as parameter to this functions, i can only guess you don't paste edn data, but for example string
09:50kwladykairctc please don't write to me on priv. It doesn't work like i will write code for you. I can give hints, fishing rod, sometimes fish, but i wouldn't do job for your.
09:52RedNifreHey there. I'm currently reading JoC and the part about lists sharing their immutable data demonstrates this via "it's not only equal (= l1 l2) but also identical (identical? l1 l2)". This looks to me like "=" means "equal", but I vaguely remember somebody in this channel saying "use == for numbers" a while ago. So what's up with identical? vs = vs == ?
09:54justin_smithRedNifre: = uses structural equality for data structures, == is only for numbers and does value equality. = doesn't work across exact/inexact
09:54ridcullyRedNifre: identical? is basically == from java (same "pointer"). = is basically equals from java. and == is == for numbers
09:54justin_smith,(= 1 1.0)
09:54clojurebotfalse
09:55justin_smith,(= '(1 2) [1 2])
09:55clojurebottrue
09:56justin_smith,(== 1.0 1)
09:56clojurebottrue
10:00RedNifre,(identical? 1 1)
10:00clojurebottrue
10:01RedNifreI find the behaviour of = very strange.
10:01RedNifre,(== '(1 2) [1 2])
10:01clojurebot#error {\n :cause "clojure.lang.PersistentList cannot be cast to java.lang.Number"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.PersistentList cannot be cast to java.lang.Number"\n :at [clojure.lang.Numbers equiv "Numbers.java" 208]}]\n :trace\n [[clojure.lang.Numbers equiv "Numbers.java" 208]\n [sandbox$eval121 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval121 in...
10:01justin_smith,(let [a '(1 2) b (cons 0 a) c (rest b)] (identical? a c))
10:01clojurebottrue
10:02justin_smith== is only for numbers, the above demonstrates what JoC was saying - the fact that it's the same data
10:02RedNifreWould this be a good rule of thumb?: "Use == for numbers and = for everything else. You rarely need 'identical?'"
10:02justin_smithsounds right
10:02justin_smithalso use = for numbers if you care about the precision
10:03RedNifreI find this strange because 1 and 1.0 seem more equal to me than '(1 2) and [1 2]
10:03sdegutisback
10:03justin_smithRedNifre: '(1 2) contains all the information [1 2] does, (float n) can lose information compared to n
10:04RedNifreI thought that '(1 2) was a different type than [1 2] and that 1 and 1.0 are precisely identical, even on the bit level in this case.
10:04sdegutisRedNifre:
10:04justin_smithRedNifre: that may be the case for 1.0 / 1, I forget, but definitely not the case generally for n / (float n)
10:05sdegutis,(map type [1 1.0])
10:05clojurebot(java.lang.Long java.lang.Double)
10:05justin_smithRedNifre: clojure's equality cares about shape more than type
10:05sdegutis,(map type [1 (float 1.0)])
10:05clojurebot(java.lang.Long java.lang.Float)
10:05sdegutis,(map type [(int 1) (float 1.0)])
10:05clojurebot(java.lang.Integer java.lang.Float)
10:05sdegutisHi
10:05sdegutiswhatd i miss
10:06sdegutisgood evening
10:11RedNifreWHat's shape? Is it "potential data"?
10:11justin_smithRedNifre: no, it is the layout (sequential, the count of the sequence, vs. lookup, the keys and vals of the lookup)
10:12justin_smithin general if (into (empty x) y) is the same as x, then x = y, if they agree regarding sequential or associative
10:12justin_smithwait that's bad and not always right
10:18justin_smithRedNifre: any two sequential things that are immutable (list, lazy-seq, vector) are = if their contents are all = in the same order
10:19justin_smithRedNifre: any two hash-maps (PersistentArrayMap, PersistentHashMap) are = if their key / val pairs are =
10:20sdegutisRedNifre: kinda like (= [1 2] '(1 2)) are "the same"
10:20sdegutisRedNifre: because all the things inside are considered equal in value
10:20justin_smithsdegutis: his question started with that
10:20sdegutishaha
10:20sdegutisoops
10:22sdegutisWell, this is not going well.
10:22sdegutisI had an idea to create a macro, but it's causing an infinite redirect-loop.
10:25shafirehi
10:26shafireis someone using clojure with gradle?
10:26sdegutishi
10:26sdegutisprobably not.
10:26shafiremore leiningen?
10:27winklein or boot, yeah
10:28Guest31160is there a way to use everything in a ns except a certain function?
10:31xemdetiaGuest31160, if you look on http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/ns there seems to be an :exclude directive that sounds like what you want
10:32hamidcuriously asking.. why not dynamically specify size of the thread-pool? https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/exec/threadpool.clj
10:33hamidor does that crosses some sort of philosophy in clojure's land?
10:34xemdetiahttps://github.com/clojure/core.async/commit/7b64bd8a22c2b6df69c23dce34eb66d705f5bf1a
10:34xemdetialooks like it was a deliberate change
10:40sdegutisi dont know many people who use boot yet
10:41sdegutisleiningen is still king and for good reason
10:41sdegutisboot may be good but it came in far too late to have a fair chance
10:42phillordI think you need to look at new projects -- if you're environment is already running in lein, why would you change?
10:42phillordbut that's not a good predictor of the future
10:42shafirecursive don't support boot either
10:56sdegutisphillord: support is the main thing; more ides support lein than boot
10:57sdegutisphillord: also lein covers more cases since its older
11:00phillordsdegutis: true, but then boot is, I think, more easily extensible than lein, certainly in place
11:01sdegutisphillord: that may be true, but for 99% of cases, lein doesn't need to be extended because it already covers most use-cases
11:02phillordsdegutis: also true for Java. And,yet, we have clojure.
11:08Glenjaminare you including plugins in that sdegutis ?
11:08sdegutisGlenjamin: nope
11:08sdegutisbut probably
11:09Glenjamini suspect almost all clojure apps have at least one lein plugin
11:09Glenjamini dunno who's point that helps
11:34sdegutisGlenjamin: if our project at work has any, it's brought in by Cider
11:35sdegutisyep, that brings in exactly one plugin: [cider/cider-nrepl "0.11.0"]
11:41sdegutisso yeah, we could probably easily switch to boot
11:41sdegutisbut the last time I tried, it had a bug when used with Cider:
11:42sdegutisif you jumped to the definition of a symbol within your project, instead of bringing you to your own file in that project, it brought you to a copy of it somewhere in ~/.boot or something
11:42sdegutisthat made it pretty useless for me.
11:42sdegutisthe boot folks said it might be fixed soon, and that was like a year ago, so maybe it is fixed now
11:42sdegutisFin.
11:42schmirsdegutis: it's fixed
11:43sdegutisschmir: was it you i talked to about it?
11:43arrdemsdegutis: that's fantastically rude dude
11:43arrdembe nice
11:43schmirsdegutis: no
11:43arrdemthis is a public channel. Take it to pms if you don't want replies
11:43sdegutisarrdem: ... i cant even imagine what anything i said could be rude
11:44sdegutisschmir: oh, thought it might have been
11:44sdegutisschmir: i dont remember who it was i talked to in the boot chan about it
11:44sdegutisarrdem: oh, i see now.. you misinterpreted my reply to schmir in the most negative possible way
11:45schmirsdegutis: I did so too for a second :)
11:45sdegutisarrdem: look, i get that you have a grudge against me for a single thing i said years ago that you misinterpreted.. but stop being a prick to me every few months please, its getting really annoying
11:45sdegutisschmir: noted, sorry about that, ill be more careful
11:45schmirno problem
11:56sdegutisit's snowing.
11:57kenboltonsdegutis: northeast corridor?
11:57sdegutischicago
11:57kenboltonsnowing here 60 miles north of new york city.
11:58sdegutisi guess winter just doesnt want to leave this year
11:59kenboltonit only just arrived this weekend.
12:34sdegutisFixed! Woo!
12:53sdegutis,(update {} :foo (fn [foo] (-> foo (update-in [:bar :quux] (fnil inc 0)) (assoc-in [:string] "string!"))))
12:53sdegutisphew!
12:53clojurebot{:foo {:bar {:quux 1}, :string "string!"}}
12:54kenrestivough https://www.refheap.com/116881 cider now refuses to work at all
13:01sdegutiskenbolton: you dont use cider?
13:02wutfanyone popping a ClojureScript repl from within emacs using C-c M-J as per here under Super Advanced? https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl
13:18justin_smithkenrestivo: monroe or inf-clojure might be better options than nrepl.el these days - worth checking out at least
13:24justin_smithkenrestivo: also, the error you posted reminds me of the weirdness I have seen when updating cider.el in place - it works more cleanly if you nuke it and do a fresh install of another version
13:24justin_smithnuke and re-install clojure mode too, just for voodoo sake
13:26sdegutiskenbolton: I've had a lot of success with Cider fwiw, but ymmv
13:27kenboltonsdegutis: i appreciate that, but it was kenrestivo who was asking.
13:27sdegutisoh sorry kenbolton
13:27kenboltonno worries
13:28sdegutiskenrestivo: I've had a lot of success with Cider fwiw, but ymmv
13:28sdegutisill just blame tab completion and hope it sticks
13:28kenboltongood enough
13:31sdegutiskenbolton: that said, cider is pretty cool
13:32sdegutisim constantly amazed by how good a clojure ide it is
13:32sdegutisplus i like that it integrates so nicely with emacs
13:32sdegutisphew, fixed like 4 major bugs this morning
13:32kenboltoni need to play with it. i know it was recently dropped into the jupyter clojure integration.
13:42kenrestivoit's very slick, but finicky
13:42kenrestivoand not that stable, it seems
14:28j-pbI found a WAT
14:29j-pb,(= Double/NaN Double/NaN)
14:29clojurebotfalse
14:29j-pb,(= '(Double/NaN) '(Double/NaN))
14:29clojurebottrue
14:29j-pbWAT!
14:30arrdemj-pb: that's per the IEEE float spec
14:30arrdemno wat at all
14:30j-pbarrdem: the IEEE float spec says that they are not equal UNLESS in a list?
14:30arrdemj-pb: oh. No. That's a WAT.
14:30tavorisWhat's the reason for them not being equal?
14:30arrdemBug in CLJ equality probably.
14:31j-pbyeah
14:31arrdemtavoris: because NaN could be the result of arbitrary computation. There's no way to tell if two NaN results are from the same source, so NaNs can't be eqaul.
14:31j-pbtest.check ftw this is breaking my code
14:32ystael,(= [Double/NaN] [Double/NaN])
14:32arrdemyeah test.check is one of my favorite libraries
14:32clojurebotfalse
14:32ystael...
14:32arrdemystael: OH. I know what this is.
14:32arrdemj-pb: not a bug!
14:32lumain the second case, you're comparing the symbols
14:32arrdemj-pb: it's the result of quoting. Right.
14:32arrdemluma got it.
14:32ane,(= '(a) '(a))
14:32clojurebottrue
14:33j-pbarrdem: aaar yeah true
14:34j-pbthis thing is really hard to debug I can't copy paste stuff into the repl because it contains lists and NaNs :(
14:35sdegutisToday I replaced two inc with (fnil inc 0). It is a good day.
14:35justin_smith,(pr-str (/ 1.0 0.0))
14:35clojurebot"Infinity"
14:36justin_smith,(pr-str (/ 0.0 0.0))
14:36clojurebot"NaN"
14:36justin_smithyeah, those are not readable
14:36arrdemFor no apparent reason.
14:36j-pbyeah
14:37ptisnovs,(Double/parseDouble "Infinity")
14:37clojurebotInfinity
14:38ptisnovs,(Double/parseDouble "NaN")
14:38clojurebotNaN
14:38ptisnovsstrange...
14:39arrdemtools.reader supports them, it's just that Clojure's built in reader doesn't.
14:39sdegutis,(get {Double/NaN 3} Double/NaN)
14:39clojurebotnil
14:39sdegutisheheheheheh
14:40ptisnovs,(Double/parseDouble "-NaN")
14:40clojurebotNaN
14:43Bronsaj-pb: '(Double/NaN) is a list with the *symbol* Double/NaN, not the NaN value
14:43Bronsatry comparing (list Double/NaN)
14:44j-pbBronsa: yeah arrdem figured it out already ^^
14:44j-pbby bad
14:44Bronsanow if you want a real WAT:
14:44Bronsa,(let [x (identity Double/NaN)] (= x x))
14:44clojurebottrue
14:44Bronsa,(let [x Double/NaN] (= x x))
14:44clojurebotfalse
14:45arrdemBronsa: I'm listening :P
14:45j-pb0o
14:45Bronsaarrdem: where's the fun if I tell you? :) try decompiling the two
14:45arrdemBronsa: my guess is downcast to object and then pointer equality.
14:45Bronsaalmost correct
14:45arrdemI'll disassemble it inna bit.
14:46Bronsawell, let's not nitpick -- that was correct
14:46Bronsatwo Double NaN *objects* can compare identical? but not equal
14:47arrdemRight, of course they are identical?, I guess I'm surprised that's what's being reached here tho.
14:47Bronsa= on double literals will use `lcmp` on the doubleValue, (identity) makes that a Util/equiv comparison
14:47arrdemRight.
14:48ystael,(let [^double x (identity Double/NaN)] (= x x))
14:48clojurebotfalse
14:48octeif they are identitical they should be equal as well?
14:48arrdemocte: by the IEEE float spec they can't be.
14:48octeoh, for things like nan?
14:48arrdemyeah
14:48octeah, gotcha
14:49octethats why you have the isnan functions, etc
14:49arrdemBronsa: I guess I'm surprised that Util/equiv doesn't handle this case...
14:49arrdemocte: right.
14:50Bronsaarrdem: eh, I think it's reasonable to short circuit equality on positive pointer checks
14:51Bronsaarrdem: fun thing is that this leats to difference in NaN handling between array-map and hash-map since they use different comparators
14:51j-pb*grabs a bucket*
14:51arrdemaha
14:51arrdemWhenever I want to find yaks I just grep my logs for whenever Bronsa talks about "fun"
14:51Bronsaheh
14:52j-pbI hate floating point with a passion...
14:52Bronsabtw I wouldn't say that behaviour is inconsistent with the IEEE spec.
14:52sdegutismeh
14:52arrdemI'm surprised that CLJ-1074 Nan/Infinity reader support is the only open NaN ticket
14:52Bronsathe java spec guarantess that primitive doubles will be IEE 754
14:53Bronsaand that Double objects wrap a double primitive
14:53Bronsabut making (Double. NaN) === (Double NaN) is about jvm object semantics, not double semantics
14:54ptisnovsBronsa: yeah, otoh the spec defines, that Double is object and == on objects compares pointers (err references)
14:54Bronsaptisnovs: right, which is consistent with what we're observing
14:54Bronsaa comparing identical? but not equal
14:54Bronsapossibly surprising, sure, but not incorrect or inconsistent
14:55TimMcHow do you feel about that part of the IEEE 754 spec? :-)
14:55arrdemTimMc: a yak beyond shaving :P
14:55Bronsaarrdem: http://dev.clojure.org/jira/browse/CLJ-1792
14:56arrdemBronsa: huh you've found a bug in my JIRA -> org exporter.
14:56Bronsathis behaviour has nothing to do with NaN btw. any (reify Object (equals [_ _] false)) would work
14:57arrdemYeah. JVM object equality is fundamentally hosed.
14:57Bronsaarrdem: is it one beer per bug? :P
14:57TimMcSure, but .equals does declare some expectations of how it will behave.
14:58TimMc(if you override it)
14:58arrdemBronsa: if you ever make it to the states to collect :P
14:58arrdemI should be keeping a scoreboard...
14:58octeTimMc, which is a great source of bugs, when people override it
14:58octe:)
15:00BronsaTimMc: it doesn't say anything about two values having to compare .equal if they are identical though
15:01j-pbarrdem: I just realized that this also occurs somewhere with the values generated by test.check
15:01j-pb(gen/such-that #(= % %) (gen/vector gen/any-printable))
15:01Bronsaoh, it actually does I guess
15:01Bronsa`It is reflexive: for any non-null reference value x, x.equals(x) should return true.`
15:02Bronsawell, I guess the thing is it says it *should*, not it *must*? :P
15:02j-pbarrdem: this means that the NaN's slip past the such-that only to blow up my test (which checks if values serialize correctly to disk and deserialize correctly to memory)
15:03j-pbBronsa: lol, that's just pure evil
15:03Bronsaarrdem: seriously considering next clojure/conj btw
15:06octe,(let [d (Double/parseDouble "NaN")] (.equals d d))
15:06clojurebottrue
15:06octewas that not what you meant?
15:09Bronsayeah of course, no inconsistency there. I was just referring to my prior example of (reify Object (equals [_ _] false)), which after reading the contract for Object.equals is probably wrong
15:09Bronsas/wrong/invalid
15:10octewhen I need to override equals i usually use lombok's @EqualsAndHashCode
15:10j-pbBronsa: any tips on a workaround for that NaN object thing?
15:10Bronsaj-pb: what issue in particular?
15:10j-pbNaN sometimes being equal and sometimes not :/
15:11Bronsaavoid boxed NaN I guess?
15:11j-pbYeah, but it seems that test.check/any already generates those ^^
15:12tavoris,(identical? Double/NaN Double/NaN)
15:12clojurebotfalse
15:12tavoris^ why?
15:12j-pbIEEE float spec
15:12Bronsatavoris: that NaN gets boxed twice, resulting in two different objects
15:12j-pbah really so this is already an autoboxed value?
15:12j-pbcrazy
15:14Bronsaactually that's probably comparing two unboxed NaNs in this case. either way, the only way to get NaN .equals NaN or identical to return true is to use the same boxed object
15:14sdegutisInfix is actually pretty cool.
15:16octe(let [d1 (Double/parseDouble "NaN") d2 (Double/parseDouble "NaN")] (.equals d1 d2))
15:16octe,(let [d1 (Double/parseDouble "NaN") d2 (Double/parseDouble "NaN")] (.equals d1 d2))
15:16clojurebottrue
15:16octelooks like they do compare equal?
15:18Bronsaocte: clojure's = doesn't useq .equals on numbers
15:18Bronsait compares the underlying primitive values
15:18sdegutisBronsa: how tho?
15:18sdegutis,(= 1 1.0)
15:18clojurebotfalse
15:18sdegutismanually? im confused
15:18Bronsait's doing (identical? (.doubleValue Double/NaN) (.doubleValue Doubl/NaN))
15:19j-pbBronsa: not in the example you posted however, right?
15:19j-pbwouldn't that be considered a bug?
15:19Bronsaj-pb: which one?
15:19octeperhaps it's not relevant to the problem, but could always use Object's and .equals instead of clojure's = though
15:20j-pb,(let [x (identity Double/NaN)] (= x x))
15:20clojurebottrue
15:20octemight cause other uses :)
15:20Bronsaj-pb: that's short-circuiting that check alltoghether, because you're comparing two identical objects
15:20j-pbah I see
15:20Bronsaso clojure sees that they're the same object and doesn't even bother comparing their values
15:21ben_vulpesthat feel when (sh "rm" "-rf") is a better solution than the oodles of java on SO
15:21rhg135just remember "rm -rf" is implemented in oodles of C
15:22ben_vulpesuntil i get eval-as-opcode back i doooooon't really care
15:22j-pbBronsa: hm I don't see why this-> is the case though :/
15:22j-pb,(= (read-string (pr-str Double/NaN)) (read-string (pr-str Double/NaN)))
15:22clojurebottrue
15:23j-pbthere they are not the same object, unless the jvm is some dark magic caching stuff
15:23arrdemBronsa: hit me up if you do. I'll be fulltime and more mobile to do fun things as such.
15:25Bronsaj-pb: that's NaN the symbol, not NaN the value :P
15:25Bronsa,(class Double/NaN)
15:25clojurebotjava.lang.Double
15:25Bronsa,(class (read-string (pr-str Double/NaN)))
15:25clojurebotclojure.lang.Symbol
15:26Glenjaminwha
15:28j-pbBronsa: lol again wtf
15:28Bronsaarrdem: ah nice! found a clojure gig? I've been doing clj(s) fulltime since october myself
15:28GlenjaminOh, I see now
15:28Glenjamin,(class (eval (read-string (pr-str Double/NaN)))
15:28clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
15:28arrdemBronsa: neg. Opsy stuff at Twitter.
15:28Glenjamin,(class (eval (read-string (pr-str Double/NaN))))
15:28clojurebot#error {\n :cause "Unable to resolve symbol: NaN in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: NaN in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: NaN in this conte...
15:28j-pbthi is just mean
15:28Bronsaarrdem: well that's just as good. gratz
15:29arrdemBronsa: thanks! Now I just have to keep my fingers crossed that TWTR doesn't implode.
15:29BronsaGlenjamin: no reader support for NaN (unless you use tools.reader)
15:29Glenjamin,*clojure-version*
15:29clojurebot{:major 1, :minor 8, :incremental 0, :qualifier nil}
15:29Bronsaarrdem: uh, why would it?
15:30arrdemBronsa: ongoing drama, stock price recently got thumped etc.
15:30Bronsaah :/
15:30Glenjaminso, interestingly:
15:31Glenjamin,(pr-str Double/NaN)
15:31clojurebot"NaN"
15:31Glenjaminloses the "namespace", although it wouldn't work anyway
15:31Bronsas/interestingly/infuriatingly is probably more appropriate in those cases
15:31BronsaGlenjamin: I think that's just how Double toStrings NaN
15:31arrdemprobably
15:32Glenjaminah
15:32Bronsa,(.toString Double/NaN)
15:32clojurebot"NaN"
15:32Glenjaminyeah
15:33BronsaI guess one could argue that (pr-str Double/NaN) should return #=(java.lang.Double/parseDouble "NaN") or ¯_(ツ)_/¯ the method is called
15:33Bronsas/¯_(ツ)_/¯/whatever/
15:33Bronsa*sigh*
15:33machinewardoes map impliclty turn structure its mapping over into a seq?
15:33arrdemthat's ... awful
15:33Bronsaor just make NaN/Infinity special reader tokens
15:33arrdemWhy would you want to leak that JVM platform detail when you can make NaN/Infinity special.
15:33Bronsalike nil/true/false (that's what tools.reader does)
15:34Bronsaarrdem: because one you can monkey-patch without forking clojure, the other you can't? :P
15:35arrdemBronsa: well I mean... I've cast my dice on that matter.
15:36Bronsawell then there might a patch ready to go in jira
15:37arrdemI think you missed the part where I reformatted literally everything with a commit message along the lines of "yolo"
15:37GlenjaminNaN and Infinity also exist in cljs and have identical semantics
15:37Glenjamindunno about CLR though
15:38Glenjamins/cljs/JS/ i guess
15:38Bronsadon't think you can embed them as literals in cljs
15:38Bronsalast I remember if you tried you'd get the compiler to explode because tools.reader would return a Double/NaN and compiler.clj didn't know what to do with it
15:39Bronsauh -- apparently they made it work
15:39Glenjamini mean, if Clojure defined NaN and Infinity as special in the reader
15:39Glenjaminit could be portable
15:39Glenjaminoh?
15:40BronsaI just tried typing NaN and Infinity in a cljs repl and it worked
15:40Glenjaminyeah, weird
15:40Glenjamini would have expected it to need js/
15:41arrdemRemember, the reader can do whatever it wants to :P Shen implements their entire macro system in the reader...
15:42Bronsaah, nice. [+-]Infinity and NaN are valid javascript constants
15:42Bronsaso it's just working out of the box thanks to tools.reader and Double.toString
15:46Bronsaarrdem: FWIW http://dev.clojure.org/jira/browse/CLJ-1074 patch is trivial
15:48arrdemBronsa: yeah I saw it. Now https://github.com/jaunt-lang/jaunt/issues/125
15:49Bronsathis syntax highlighting.. not even wrong https://github.com/clojure/tools.reader/blob/master/src/main/clojure/clojure/tools/reader.clj#L316
15:49BronsaI can't believe they haven't fixed it yet :/
15:52hiredmanmachinewar: the doc string specifically starts off saying it returns a seq
15:54machinewarthanks for heads up hiredman
16:07sdegutisback
16:18sdegutisIs there a way to dissoc a bunch of keys from a map inside a call to (update) without creating a temporary function?
16:18sdegutisI currently have (update :things (fn [things] (apply dissoc things ks)))
16:18sdegutisAnd it just feels weird, and like it's what as-> was made for, but I don't see how to use as-> here.
16:23ziltiIs there a place I can find some actual documentation of core.logic? All I can find is the official API page which is even incomplete.
16:24AimHerezilti, you can always quiz dnolen about it - hes right here!
16:25amalloysdegutis: (apply dissoc foo :things ks)
16:25amalloyer
16:25amalloy(apply update foo :things dissoc ks)
16:28dnolenzilti: there's a lot of documentation of varying quality - if you really want to understand it though you probably want to read The Reasoned Schemer along with some of the papers.
16:29sdegutisamalloy: ah!
16:29ziltidnolen: Ok. But there isn't like a complete API around? That would already help quite a bit. The "official" one e.g. doesn't even have the core "unify".
16:30dnolenzilti: http://clojure.github.io/core.logic/
16:30dnolenif stuff is missing that's low hanging fruit for someone to work on
16:31ziltidnolen: Yes, that's the API docs I mean. clojure.core.logic/unify is missing there among others
16:32dnolenok, docstring patches are welcome
16:33sdegutisthanks amalloy
16:33ziltidnolen: ok. I'll spend some time with the papers I guess, and reasoned schemer, and keep that in mind.
16:33sdegutisI didn't even consider that.
16:33sdegutisI still have to use as-> outside the apply, but that's fine.
16:40sdegutisYay! Finally found a use for (comment)
16:54Lewishttps://gist.github.com/6ewis/ce8f86f31cf3f00845965a4e888f7331
16:54Lewiswhats that extra stuff on line 5 and 6
16:54arrdemLewis: lines 3,4,5 are fn metadata.
16:55Lewis(fn [x] `(. clojure.lang.Numbers (isPos ~x))
16:55Lewisand this (. clojure.lang.Numbers (isPos x))
16:57arrdemline 4 is an inline macro. If you write (pos? 3) rather than taking pos? as a value, then the compiler will rewrite that to ((fn [x] `(. clojure.lang.Numbers (isPos ~x))) 3) -> (. clojure.lang.Numbers (isPos 3))
16:57arrdemthat's an interop form which makes use of the implementation detail class clojure.lang.Numbers, which provides a Java implementation of the positivity check on many types.
17:48sdegutisWhen is definline useful?
17:55kwladykasdegutis i guess when you really care about performance
17:56kwladykaand also when for some reason want have to run some code exactly at "this" place. For example because it will return some debug information during error with the place where it is call.
17:56kwladykaif you know something about assembler you should catch this immediately
17:57kwladykaif not i don't know how to explain it shortly :)
17:57kwladykai am going to sleep, goodgnight
18:47marudoes anyone know how to fix this cljs compilation error https://gist.github.com/darwin/3aeb13d9e3631a4c421d
18:47maru"Warning: environ value true has been cast to string" WTF
19:16sdegutis,(case 1 2 (prn 2) 3 (prn 3) (prn 1))
19:16clojurebot1\n
19:16sdegutis,(case 1 2 (prn 2) 3 (prn 3))
19:16clojurebot#error {\n :cause "No matching clause: 1"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "No matching clause: 1"\n :at [sandbox$eval51 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval51 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval51 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 6927]\n [clojure.lang.Compiler eval "Compiler.java" 68...
19:16sdegutis,(case 1 2 (prn 2) 3 (prn 3) nil)
19:16clojurebotnil
19:16sdegutisIt short-circuits? Nice.
19:27gizmo385Anyone here familiar with instaparse?
19:29amalloy~anyone
19:29clojurebotanyone is anybody
19:29amalloysigh
19:29amalloy~ask
19:30clojurebotThe Ask To Ask protocol wastes more bandwidth than any version of the Ask protocol, so just ask your question.
19:30sdegutis:)
19:30ben_vulpescute
19:31sfz-q: `lein test` shows 2 FAILs in output but summary prints `0 failures, 0 errors.` Has anyone seen this before or know what the issue might be?
19:35gizmo385I'm trying to parse a C-style language with Instaparse and I'm having issues getting the comments to work. I've tried writing a custom whitespace parser and installing that alongside my C parser, but the comment parsing is breaking the normal parsing. Anyone have experience with parsing comments in Instaparse?
19:36TEttingergizmo385: sorta
19:36TEttingerI know where in the docs it gives it as an example :)
19:36gizmo385I've tried adapting the whitespace example from the experimental features documentation, but it stills seems to break
19:38TEttingerhttps://github.com/Engelberg/instaparse/blob/master/docs/ExperimentalFeatures.md#auto-whitespace
19:38TEttingeroh ok
19:38TEttingeryeah that was what I knew so far
19:38TEttingerI haven't used instaparse myself, I found it when someone asked a few months ago
19:39gizmo385Yeah, I've tried just copy and pasting the auto whitespace example from the docs and just using that and it spits out error messages that I haven't seen before
19:43sfz-Here's the details of my question posed above: http://stackoverflow.com/questions/36414730/clojure-leiningen-test-fails-not-shown-in-error-summary
19:44gizmo385I've managed to get the example in the experimental features to work, but attempting to change the parenthesis to slashes causes grammar parsing errors
19:45TEttingerhm. is / a special char?
19:48gizmo385I think I got it to work? It seems like it might have been an issue with escaping
19:53amalloysfz-: your assertions should be inside (deftest foo ...) definitions, not at the top level of a file
19:54sfz-amalloy: Thank you! That was it. I accidentally put them in a `def` instead of `deftest`. +1 internets for you
20:49wombawombacan I make leiningen run a code snippet whenever any task is started with a particular profile?
20:50wombawombaalternatively, can I make it run a code snippet whenever any task is tarted, with the current profile(s) as argument(s)?
20:51kylepottswombawomba: look up the :prep-tasks option
20:54wombawombakylepotts: afaict, :prep-tasks is only useful for running shell commands
20:54wombawombaI want to run a function in my project, analagously to [:repl-options :welcome]
21:08wombawombais there any way to tell which leiningen profile is being used in my code?
21:10kylepottswombawomba: Look at the Dynamic Eval section here
21:10kylepottshttps://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md
21:11kylepottsthat should answer your first question
21:13wombawombakylepotts: hmm, yeah... but can I call my own code using dynamic eval?
21:13wombawombaseems like it would be run before loading the project namespaces
21:13kylepottsthat is defined in the module? You could eval a section of your code and then run the function
21:15wombawombahmm, so I could do something like #=(eval (do (require '[my-ns :refer [my-code my-val]]) (swap! my-val (my-code "foo")))?
21:16kylepottssomething along those lines
21:17wombawombaand my-val would have the value I set once it's loaded later?
21:17wombawombawhere would I put this?
22:31sdegutisWow. I was so very wrong. Just, wow.
22:32sdegutisCider is really really really cool.
22:32sdegutisWay cooler than I ever realized.
22:34user__sdegutis, very nice
22:34sdegutisHello. Is there a way to "find out" which dependencies (and sub-dependencies) are making my Leiningen project's resulting uberjar so large? (x-post from #leiningen)
22:35sdegutisFor example, it turns out that a certain library I'm depending on depends upon Instaparse, which means I'm indirectly depending on Instaparse, so that it gets pulled into my project.
22:44sdegutisuser__: :)
22:44sdegutisjustin_smith: ping!
22:44justin_smithhi
22:44sdegutisjustin_smith: https://github.com/xsc/lein-ancient
22:44sdegutis"Check your Projects for outdated Dependencies"
22:44sdegutis"Dependencies: out of date"
22:45sdegutisjustin_smith: I thought you'd find that funny :)
22:45sdegutisjustin_smith: also I didn't expect you to be awake && online.
22:45justin_smithamazingly, you caught me just as I got home and on my computer again
22:46sdegutisha!
22:47justin_smithI just walked home (4.5 miles)
22:47justin_smithan hour so of understimulation a day is nice
22:49sdegutisjustin_smith: thats a long walk, is that usual fo you?
22:49justin_smithat least a few times a week, some times both ways in one day but more often just one way
22:50justin_smithit's nice to have time with no real input
22:50justin_smithwalking doesn't take much intellectual activity
23:07user__yes, walking is incredible
23:07user__especially with the better weather coming
23:24sdegutisjustin_smith: that sounds healthy physically and mentally
23:24sdegutisjustin_smith: relatedly, my wife and i have a new rule for our kids, 20 minutes of silence per day at like 3pm
23:25sdegutisjustin_smith: cuz we often read about how important some silence every day is, so we're trying to put it into practice
23:25sdegutiseventually i hope to make it a full hour of silence every day
23:27tolstoysdegutis: Have you tried "lein with-profile production deps :tree"?
23:27sdegutistolstoy: hmm not the with-profile part
23:27sdegutistolstoy: but `lein deps :tree` didn't seem very informative in terms of telling me how big the deps are
23:28tolstoyYeah, not size. The with-profile production is (I think) the profile uberjar uses, so no plugins or test libs, etc.
23:29tolstoysdegutis: My uberjars (standalone) tend to be 19M or so.
23:29sdegutishmm mine are around 60mb
23:29sdegutis:/
23:31tolstoylein with-profile production classpath | sed -e 's/:/ /g' | fmt -1 | grep jar
23:32tolstoyThat'll list all the jars. How to find the sizes? Hm.
23:33sdegutistolstoy: never mind it, I'm not going to pursue it today, thanks though :)
23:33sdegutis,(update {:foo 3} :foo ((constantly nil)))
23:33clojurebot#error {\n :cause nil\n :via\n [{:type java.lang.NullPointerException\n :message nil\n :at [clojure.core$update invokeStatic "core.clj" 5960]}]\n :trace\n [[clojure.core$update invokeStatic "core.clj" 5960]\n [clojure.core$update invoke "core.clj" 5952]\n [sandbox$eval25 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval25 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.j...
23:33sdegutis,(update {:foo 3} :foo (constantly nil))
23:33clojurebot{:foo nil}
23:33sdegutisbwaha
23:34tolstoylein with-profile production classpath | sed -e 's/:/ /g' | fmt -1 | grep jar | xargs ls -l
23:34tolstoyHeh. ;)
23:34justin_smith,(update {:foo 3} :foo :kasldfjlkasdjflkdsa)
23:34clojurebot{:foo nil}
23:34sdegutisjustin_smith: clever
23:34sdegutis,(update {:foo {:kasldfjlkasdjflkdsa 3}} :foo :kasldfjlkasdjflkdsa)
23:34clojurebot{:foo 3}
23:34user__Quick question: If I have a vector in a vector, how do I access one of those sub-vectors for location?
23:34sdegutisjustin_smith: not fool-proof tho
23:35kenrestivotolstoy: lein with-profile production classpath | sed -e 's/:/ /g' | fmt -1 | grep jar | xargs ls -l |awk '{print $5 " " $9}'
23:35user__--(1(:subVectors(someVector)))
23:35tolstoyThere it is. :)
23:35kenrestivotolstoy: lein with-profile production classpath | sed -e 's/:/ /g' | fmt -1 | grep jar | xargs ls -l |awk '{print $5 " " $9}' |sort -nr |less
23:35kenrestivosorry couldn't help myself
23:36justin_smith,(get-in [[] [0 1]] [1 1]) user__
23:36clojurebot1
23:36user__Sorry, the question was: Quick question: If I have vectors in a vector, how do I access one of those sub-vectors for location?
23:36tolstoyYeah, sort.
23:36justin_smith,(get-in [[] [0 1 :foo]] [1 2]) user__
23:36clojurebot:foo
23:36user__justin_smith, very nice
23:37user__I love Clojure's simplicity
23:37tolstoyHm. Clojure and Netty take up about 7MB. Add 2 more for bouncycastle.
23:37user__Interesting
23:38kenrestivoaaand the total is:
23:38kenrestivolein with-profile production classpath | sed -e 's/:/ /g' | fmt -1 | grep jar | xargs ls -l |awk '{print $5}' | paste -sd+ | bc
23:38tolstoyNo paste on osx. ;)
23:38kenrestivowhich i guess will be the size of a uberjar
23:39sdegutisIs jetty the de facto best Clojure HTTP lib?
23:39tolstoyYeah, it's more about figuring out which libs are taking up most of the size.
23:39sdegutisfor simple HTTP that doesn't need any bells and whistles
23:40tolstoysdegutis I use either aleph or http-kit. I bet "de factor" is people making war files (outside of one's own hobby hacking).
23:41sdegutishmm
23:41tolstoyhttp-kit is nice because it's so small. No dependencies.
23:44sdegutisThe only reason I use Jetty is because ring-jetty comes bundled with [ring "0.4.0"] from inside github.com/ring-clojure/ring
23:45sdegutisSo it seemed like a reasonable default to use.
23:54kenrestivois tehre some reason why (slurp "~/some-file-i-know-actually-exists") isn't working anymore?
23:54kenrestivodoes clojure and/or slurp not deal with ~/ ?
23:55tolstoyDoesn't work for me, either.
23:55kenrestivoit used to
23:55kenrestivoi think
23:56tolstoyJust tried it with clojure.java.io: no go.
23:57kenrestivoi'll have to pull $HOME out of the java env then
23:57kenrestivomaybe that's what i did before
23:57tolstoy,(System/getProperty "user.home")
23:58clojurebot#error {\n :cause "denied"\n :via\n [{:type java.lang.SecurityException\n :message "denied"\n :at [clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]}]\n :trace\n [[clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]\n [clojurebot.sandbox.proxy$java.lang.SecurityManager$Door$f500ea40 checkPropertyAccess nil -1]\n [java.lang.System getProperty ...
23:58tolstoyThought so. Nice.
23:59cwgem|macNice to see a language that doesn't explode on you when you try and use string manipulation on multbyte strings
23:59kenrestivo(str (get (System/getenv) "HOME") "/.stuff.edn")