#clojure logs

2015-07-22

01:29crocketHow do I debug java code in cider?
01:29crocketCider can debug clojure code.
01:31justin_smithcrocket: you can run jdb with emacs GUD mode https://www.gnu.org/software/emacs/manual/html_node/emacs/Debuggers.html
01:32justin_smithsomeone should hook up clojure debugging to GUD too
01:39crocketjustin_smith, Does that integrate clojure and java debugging into one session?
03:01crocketIs there a shortcut for if-not?
03:22crocketOh, it is if-not.
03:43crocketHow do I resolve a symbol concisely?
03:44tgoossenscrocket, (eval symbol)
03:45tgoossens,(let [a 2 s 'a] (eval s))
03:45clojurebot#error {\n :cause "Unable to resolve symbol: a in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: a in this context"\n ...
03:45tgoossensmerde
03:46dstockton,(let [a 2 s 'a] s)
03:46clojurebota
03:46dstockton,(let [a 2 s 'a] (resolve s))
03:46clojurebotnil
03:47dstockton,(let [a 2 s 'a] ~s)
03:47clojurebot#error {\n :cause "Attempting to call unbound fn: #'clojure.core/unquote"\n :via\n [{:type java.lang.IllegalStateException\n :message "Attempting to call unbound fn: #'clojure.core/unquote"\n :at [clojure.lang.Var$Unbound throwArity "Var.java" 43]}]\n :trace\n [[clojure.lang.Var$Unbound throwArity "Var.java" 43]\n [clojure.lang.AFn invoke "AFn.java" 32]\n [sandbox$eval97 invoke "NO_SOURCE_FI...
03:47amalloyyou can't do that. eval has no access to lexical scope
03:51dstockton,(let [a 2 s 'a] (prn s))
03:51clojurebota\n
03:52dstockton,(binding [a 2 s 'a] (eval s))
03:52clojurebot#error {\n :cause "Unable to resolve var: a in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve var: a in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6740]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve var: a in this context"\n :at ...
03:53crockettgoossens, What about (resolv symbol?
03:54crocketeval somehow feels awkward.
03:56crocketHow do I evaluate a symbol to a local binding concisely?
03:56crocketeval fails.
03:58crocket(let [abc 3] (eval 'abc)) fails
03:58crocket,(let [abc 3] (eval 'abc))
03:58clojurebot#error {\n :cause "Unable to resolve symbol: abc in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: abc in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: abc in this conte...
03:59crocketHow do I fix (let [abc 3] (eval 'abc)) ?
04:00irctc_Will there be a ClojureScript runtime on V8 anytime this year?
04:00crockethttp://clojure.org/evaluation
04:01crocketirctc_, What is the current ClojureScript runtime?
04:01crocketNashorn?
04:05irctc_It runs thru Closure and then after that it becomes javascript
04:07irctc_ClojureScript is just a pre-compilation artifact that never gets to run anywhere
04:10crocketWhy does https://www.refheap.com/106807 fail?
04:10crocket(format-policy 'rolling-policy) in https://www.refheap.com/106807 seems to fail.
04:11irctc_Nashorn is German for Rhino (literally horn nose). I wish ClojureScript ran on Nashorn/v8/etc but as far as i know it's trapped on the JVM
04:11crocketNashorn is on JVM.
04:13irctc_Nashorn is on JVM but there is no JavaScript based runtime for clojure (only a java based one as far as i know)
04:13crocketAnyway..
04:13crocketHow do I make a symbol evaluate to a local binding?
04:14crocketIn a function, I want to retrieve the symbol and the value of an argument.
04:25irctc_i guess for the beginner it doesn't solve programmer hell, it just creates more, anyway all the best, bye
04:26crocketI may need a macro for that....
04:26crocketirctc_, The programmer hell is mostly scarcity in the real world and artificial scarcity in corporate environments.
04:31irctc_so to answer to crocket's question is there an arguments collection with names+values for a function?
04:33crocketIf you have years of time to learn a platform, it is not hell.
04:35irctc_yup, i guess one has to choose one's hell wisely, since there's enough frustration there to fill MILLIONS of programmers lifetimes, less hot is still burining
04:36irctc_fundamentally i'd reject the fact that it does take years to learn a platform, and that is still the case
04:57kwladykai have function (defn f [[cols rows] [col row]] ... ) and i need lazy sequence from that function in recursive way. So f to count next iteration call themself. Which function should i need to create this lazy seq?
04:59kwladykaand perfect way will be to start from not zero, for example (f [8 8] [3 5]) and next iteration will be (f [8 8] [3 6]), so not start from (f [8 8] [1 1])
05:00kwladykaor there is no way to do that and i have to use "n" parameter for lazy-seq ?
05:01kwladykaoh... maybe it is iterate...
05:02kwladykabut how to pass there [cols rows] in way to not be return as a result
05:02kwladykai can use ref-set but it will be good if i dont have to
05:11crocketIs there a debugger that can debug clojure and java code simultaneously?
05:32r4viintellij + cursive
05:42lambda-smithCan CIDER does that?
05:56crocketlambda-smith, cider can debug clojure code.
05:56crocketI don't know if cider can debug java code.
05:56lambda-smithI see, thanks.
06:38kwladykahttp://clojuredocs.org/clojure.core/recur show example of use recur for denf compute-across without loop, but for my example https://www.refheap.com/d6b0e12cc47d57b0b3b300bc6 i have error CompilerException java.lang.IllegalArgumentException: Mismatched argument count to recur, expected: 0 args, got: 2,
06:38kwladykaWhat am i doing wrong?
06:42sveriHi, I am trying to use re-matches like this: (re-matcher #"id=\"([a-zA-Z]*)\"" "<input class=\"form-control\" id=\"male\" name=\"male\" type=\"checkbox\" />"). I checked that this regex works with an online regex tester and extracts the id part, however in clojure I just get nil returned. What am I doing wrong here?
06:43fi3aiXoakwladyka: recur is for tail recursion
06:44kwladykafi3aiXoa, so it doesn't work because it is nested?
06:45fi3aiXoakwladyka: yes. You can use it only in tail call. Please refer to http://clojure.org/special_forms
06:45fi3aiXoakwladyka: error message could be better though
06:45crocketHow do I make multimethods dispatch according to java classes?
06:46fi3aiXoacrocket: just use `class` or `type` as a dispatch function
06:46kwladykafi3aiXoa, thx
06:46Bronsacrocket: or consider using a protocol instead
06:46crocketDoes a protocol not require defrecord?
06:47fi3aiXoaProtocols is one thing, records is another.
06:47crockethmm......
06:47crocketah
06:47fi3aiXoa(should it be "are one thing"?)
06:47crocketok
06:47kwladykacrocket, http://blog.find-method.de/index.php?/archives/209-Dependency-inversion-in-Clojure.html <- read it, it is very good
06:48fi3aiXoasveri: I'm not sure... Do you have a typo? Is it re-matches or re-matcher?
06:48Bronsacrocket: you can extend a protocol to java classes
06:49Bronsajust like you defmethod on a dispatch value
06:49Bronsaand protocol functions will dispatch much faster than multimethods using `type` or `class` as dispatch function
06:50sverifi3aiXoa: both don't work
06:51sveriI am afraid it interfers with the escaping of the string: \" in the online test tool I don't have them escaped
06:51fi3aiXoasveri: well, re-matches returns non-nil if the *entire* string matches the regexp. It's clearly not the case. Please read the documentation to re-matches and re-find. Also, it's a terrible idea to use regexps on html code.
06:51crocketBronsa, Does a protocol function not dispatch based on the first argument?
06:53kwladykasveri, did you try without \ ? maybe it is a problem like in #"..." it is interpret in another way
06:54kwladykasveri, but it doesn't make sense... but maybe worth to try with something simpler
06:54fi3aiXoasveri: oh, and I actually meant http://clojuredocs.org/clojure.core/re-matches when I said "documentation". It has some examples which should make things clearer.
06:54crocketDoes a protocol function deal with default?
06:55fi3aiXoaYou can extend protocol to Object.
06:59kwladykasveri, oh i see ;; The distinction is that re-find tries to find _any part_ of the string
06:59kwladyka;; that matches the pattern, but re-matches only matches if the _entire_
06:59kwladyka;; string matches the pattern.
07:20tgoossensAny tips on how to debug the following case: When I execute (... code ...) it works, but when it is in a defn: (defn test [a b] (... code ...) ) it doesn't work anymore. Some class (of my own making) gives an exception
07:21tgoossensare there good debugging tools you would recommend?
07:24crocketBoo
07:24crockettgoossens, cider and cursive
07:24crocketcursive is more advanced while cider runs on a lightweight environment.
07:24crocketcursive runs on IntelliJ which is very heavy.
07:25tgoossensi use emacs
07:26kwladykais function like "for" but will stop if nil? Only "loop"?
07:30tgoossenscrocket, ty
07:31snowellkwladyka: Try the :while modifyer for for
07:31snowell*modifier
07:31kwladykasnowell, ahh... so obviously! thx
07:32snowell,(for [x [1 2 3 nil 4 5] :when x] x)
07:32clojurebot(1 2 3 4 5)
07:32snowellDerp
07:32snowell,(for [x [1 2 3 nil 4 5] :while x] x)
07:32clojurebot(1 2 3)
07:36crocketok
07:49Kneiva(inc snowell)
07:49lazybot⇒ 1
07:53sverikwladyka: thank you, re-find does the trick
07:53sverinot sure how I missed this
08:09tgoossenscrocket, cider is really great. thanks a lot!!
08:15crockettgoossens, Did you already succeed in starting a cider debugging session?
08:15crocketHow did you do it?
08:16wasamasait's funny to see emacs described as "lightweight environment"
08:16wasamasahow did people edit code in the eighties?
08:16snowellI've always heard that emacs is a fantastic OS, all it needs is a good text editor :)
08:17wasamasaI bet this joke is older than you
08:17snowellIt's possible
08:18H4nswhen emacs was said to be an acronym for "eight megabytes and constantly swapping", eight megabytes were considered to be a massive amount of memory
08:19hellofunkH4ns: i thought "emacs" stood for "emacs makes all code super" ?
08:20snowellEsc-Meta-Atl-Ctrl-Shift
08:26crocketIt's simple. Moore's law made emacs lightweight.
08:26crocketAfter 20 years, eclipse could be considered lightweight.
08:26crocketProbably in 10
08:28FiredancerThat's pretty optimistic
08:32crocketMoore's law is optimistic.
08:34crocketDoes a protocol always dispatch according to the first argument?
08:35sobelI have some confidence Eclipse will always grow (and/or suck) to consume all benefits of Moore's law
08:37sobel...on return to java coding, i comment all the side-effecting or data-mutating functions, and it's eye-opening.
08:38sobel"how *could* you?"
08:38wasamasamoore's law no longer applies to increasing CPU clocks
08:38H4nswasamasa: it never did.
08:38wasamasaand considering how tricky utilizing more than one core is, I don't have any hope for eclipse
08:39sobelperformance has always been an aggregate figure of i/o and cpu compute speed
08:39sobelbut i think we've been i/o bound a while
08:42Bronsacrocket: yes
08:42crocketBronsa, yes?
08:42Bronsa14:34:50 <crocket> Does a protocol always dispatch according to the first argument?
08:42Bronsayes
08:44H4nsit is, but it is using the jvm's dispatch mechanism, not the one implemented by defmulti/defmethod.
10:47timvisheranyone familiar with how to launch a headless browser using clj-webdriver?
11:13J_Arcanehttps://twitter.com/J_Arcane/status/623873442123808768
11:15justin_smiththis bot is the best use of autocomplete API ever https://twitter.com/autocompletejok
11:30crocketNice....
11:30crocketI finally fixed unilog...
11:34iwilligwhats the best way to strip a namespace off a keyword… I was thinking about doing this (keyword (name :user/name)) but that seems kind of hacky
11:34justin_smith,(name :key/word)
11:34clojurebot"word"
11:35justin_smithiwillig: I think that's the trick - what's the usecase for un-namespacing anyway?
11:35gfredericks`I have this emacs package called align-cljlet and I kind of like it but I don't think it's available in the emacs package managers
11:36gfredericks`does anybody use something similar or...something?
11:36iwilligi want to filter out all user/create-at and task/created-at attributes in a datomic attribute list and i did not want to enumerate all of the possible namespaces
11:36iwilligbut that works.. thanks justin_smith
11:37justin_smithiwillig: in that case, you don't even need the keyword call right?
11:37iwilligyeah.. we can just leave them a strings and compare the strings…
12:01timvisheris core.memoize thread local?
12:52monstaGood evening, could some explain me the value of immutability?
12:54kwladyka(f? {[1 1] [2 1] [2 3]} [[2 1] [3 3]]) - i am look (f a b) which return me false if any of b element is in a. Otherwise true. I am too tired today, but i am so close the final solution :)
12:55kwladykamonsta, in other langauge you can write function (x){x=3;print x} and get result 3. With immutable data you can't change value of x.
12:56kwladykamonsta, and when you creating new data from old data there are not redundant. It is tree with indicators to right places in memory.
12:56kwladykasomething like tree
12:57kwladykawatch "Clojure inside out"
12:58snowellkwladyka: Are the args maps?
12:59kwladykasnowell, sorry my mistake, it is not map
13:00kwladykaha i got it (some? (some #{[1 1] [2 1] [2 3]} [[2 1] [3 3]]))
13:00snowellHahaha my answer was going to be much dirtier than that
13:00snowellGlad you won't be using it :D
13:01kwladyka;)
13:01kwladykaday by day i am learning more and more )
13:03snowellIt looks like it returns true when there's a match
13:03snowellDidn't you want the other way around?
13:04snowellIn that case you'd want nil? instead of some?
13:04kwladykasnowell, this is just detail :)
13:05snowellIncorrect boolean values are probably fine
13:05kwladykasnowell, but you are right
13:10monstanani nani
13:10monsta=?
13:13monstaIf there is a place where I can play with Clojure repl online?
13:15xemdetiamonsta, if it is not something super complex you can always irc message clojurebot
13:16snowellmonsta: There's also tryclj.com
13:16rarebreedand for clojurescript there's https://himera.herokuapp.com/index.html
13:19iamjarvoso i am using http-kit and trying to figure out how to see logs for requests
13:35kwladyka(f boolean value) - is any function which return value if true or empty list if false?
13:36scriptor,(or true [])
13:36clojurebottrue
13:36scriptor,(or false [])
13:36clojurebot[]
13:37scriptorhmm, not quite what you need, since the value is separate
13:38kwladykascriptor, since the value is separate?
13:38scriptorseparate from the boolean
13:39kwladyka,(or false {[1 2] :king [2 3] :queen})
13:39clojurebot{[1 2] :king, [2 3] :queen}
13:39kwladykalooks good
13:39clojurebotExcuse me?
13:39justin_smithscriptor: #(or % ())
13:40kwladykait is still ok, i needed (f boolean value) so the f is or
13:40justin_smithkwladyka: or is not an f, but OK
13:40kwladykajustin_smith, ?
13:40justin_smithkwladyka: ##(map or [1 2 3])
13:40lazybotjava.lang.RuntimeException: Can't take value of a macro: #'clojure.core/or
13:41justin_smithor is not a function
13:41justin_smiththe request was a function
13:41kwladykaoh... i thought everything in Clojure is function, even or
13:41kwladykabut it should be ok
13:41kwladykai will se
13:41kwladykasee
13:42kwladykaah not... it is not what i want
13:42kwladyka(f boolean value) - is any function which return value if true or empty list if false?
13:42kwladyka^it is not this condition
13:43justin_smithoh, sorry
13:43justin_smith#(if % %2 ())
13:43justin_smiththat should work
13:43kwladykaoh it is ok about readable
13:44kwladykabut no function in clojure core like that?
13:44kwladykaor something where i don't have to use #()?
13:44justin_smith(defn or-empty [condition value] (if condition value ()))
13:44justin_smithyou can always replace #() with a proper function
13:44kwladykai know, but i am trying to optimise my code
13:45kwladykaand many times i discover there is something in http://clojure.org/cheatsheet
13:45justin_smith#() is not more optimized than defn
13:45justin_smithno, there is nothing that does that in clojure.core
13:45kwladykaok thx
13:45scriptordon't worry about the function call overhead
13:46scriptorit'll be miniscule compared to everything else, and the jvm already inlines a bunch of stuff
13:46justin_smithscriptor: but the version of some function in clojure.core will be more optimized than one's first try, typically
13:46justin_smithif that funciton exists
13:46scriptortrue
13:46justin_smithso kwladyka wanted to make sure there was no built in function that did that
14:04monstasnowell: Thank you!
14:19sdegutisDoes anyone else among you notice as well that using partial when possible seems inherently cleaner than short-form ad-hoc functions?
14:20sdegutisVery well.
14:22kwladykaHow can i increase memory for lein test?
14:22kwladykamaybe also CPU
14:23winkkwladyka: https://github.com/technomancy/leiningen/blob/master/bin/lein#L141
14:23winki.e. you can probably add some Xms and Xmx there
14:23winkerr, sorry. https://github.com/technomancy/leiningen/blob/master/bin/lein#L223
14:23winkI think it's this one
14:24kwladykawink, is it possible to set this on "get as much as you want"?
14:24winkno clue, sorry. Not that big of a JVM expert :)
14:24winkbut if it's possible it should be a default JVM option
14:24rhg135kwladyka: not as far as I know
14:28sobeli could use a little support figuring out something that's probably simple... i want to write to an output stream using data/csv but what i _really_ need is an inputstream from the csv conversion that i can feed to java that wants to do the reading
14:28sobel(and writing)
14:29sobelshoulda written this as a transducer, but...too late for today
14:31kwladykacan i check is it work in some way in clojure? show me max memory by println?
14:36kwladykabecause i see it works in REPL, but it looks like doesn't work with lein test
14:38sdegutisI will await more answers.
14:42kwladykawhat to do if my algorithm is too slow, how to measure that and check lazy seq, what to do with that
14:42kwladykait takes gb and give me out of memory
14:42kwladyka*4gb
14:42kwladykasomething is wrong
14:47justin_smithsounds like you need to do some profiling
14:48kwladykajustin_smith, ?
14:49justin_smithkwladyka: there are profiling tools, like the tools.trace library, or criterion for microbenchmarking, or jvm based tools like jvisualvm or yourkit
14:52kwladykaoh it looks like a tons of work
14:54kwladykahmm how to check if something is lazy? like (lazy? f)
14:55gfredericksoh man
14:56gfredericksI think cljs stops inlining arithmetic if you use qualified symbols
14:56kwladyka?
14:56kwladykagfredericks, ?
14:56gfrederickskwladyka: unrelated
14:57kwladykaoh ok
14:57justin_smith,(type (map identity nil)) ; kwladyka
14:57clojurebotclojure.lang.LazySeq
14:57kwladykajustin_smith, thx
14:57justin_smithI guess you might see other types that are technically lazy like chunkedseqs...
14:58justin_smith,(type (iterate inc 0))
14:58clojurebotclojure.lang.Iterate
14:58justin_smithoh yeah, you can't just test for LazySeq never mind
14:59sdegutisThank you for your answers.
15:00kwladykajustin_smith, can i debug app after run something in REPL in intellij and check what consume so many memory and why?
15:00kwladykaif yes maybe do you know good video/article how to do that?
15:01justin_smithkwladyka: you can use jvisualvm while your repl is running
15:01justin_smithand see what is using the heap, usually
15:01justin_smithand what is using cpu, etc.
15:01justin_smithkwladyka: https://visualvm.java.net/profiler.html
15:02justin_smithkwladyka: when you start jvisualvm, you'll see a list of running java processes, you can double click your clojure app to open it, then find the tools mentioned in that article to see what your app is doing
15:02kwladykajustin_smith, thank you!
15:02justin_smiths/app/repl (though it works with apps too)
15:02justin_smithkwladyka: jvisualvm comes with the jdk
15:03justin_smithkwladyka: I hear yourkit is much better, but it is a bit more complicated to get ahold of I think
15:11kwladykawhat do you think about hava mission control?
15:12kwladyka*java mission control
15:13kwladykaeh i dont have idea how to check what consume so much memory with this... i will try what you told
15:14justin_smithkwladyka: java mission control does part of what visualvm does (I think like literally the entire app is basically embedded into it)
15:30kwladykai run https://www.refheap.com/1a2497a2260906e30eb26575a and (type all-possible-notations ...) is clojure.lang.LazySeq
15:31kwladykaHow can i optimise this?
15:31kwladykai see how memory consumption rising and rising
15:34kwladykamaybe i should use (nth ...) instead of loop?
15:35amalloykwladyka: are you trying to enumerate all possible positions on a chessboard?
15:36kwladykaamalloy, this is not a problem it is fast, i also assign all permutation for pieces to this possitions
15:36hellofunkamalloy: is that even physically possible?
15:36kwladykaand it takes much more time
15:36agarman51! possible positions AFAIK
15:36agarmanthat's a lot of memory
15:36amalloythere's nothing inefficient in that code, although you are just longhand-implementing a version of filter
15:36hellofunkoh i'm confusing positions with moves
15:36kwladykait works fast for small amount of pieces
15:37amalloyyeah, of course it does
15:37kwladykabut i guess it is because it is trying to read all this seq at once
15:37kwladykaor something like that
15:37amalloyand for large numbers of pieces you will need like more seconds than there are atoms in the universe, or whatever
15:37kwladykamaybe because of loop
15:37kwladykai dont know
15:37agarman51! is games...positions fewer
15:38kwladykaamalloy, anyway i need to do this, i can only optimise a little number of this, but not too much
15:38amalloyagarman: wikipedia claims it's around 10^43
15:38amalloykwladyka: you can't optimize brute-forcing the game of chess
15:38kwladykaor it is some super extreme good algorithm for chess which i dont know
15:39kwladykaamalloy, i can a little
15:39kwladykaamalloy, for pieces like rook or queen
15:39kwladykarook takes whole row and whole column
15:40kwladykaanyway i have something wrong and i dont know it is problem with my code or algorithm
15:40kwladykabut i guess it is problem with loading whole seq at once from lazyseq
15:40kwladykabut i am not sure what to do with that
15:49kwladykammm maybe i will try with nth, i see it is a problem with loop recur and lazy seq
15:49kwladykathey lose they power then
15:49kwladykabecause they incrementally rising instead of iteration
16:25kwladykais it possible when use (for ...) to jump to next iteration without returning value? only with :when?
16:29justin_smithkwladyka: it's because of the size of the problem. But amalloy is right, your code is just re-implementing filter. You can just use (filter (partial notation-pass? board-size) (all-possible-notations board-size pieces)) to get a lazy-seq of solutions
16:30justin_smithand then use (into #{} ...) if you really want to force it to not be lazy, and to put them all in a set.
16:30kwladykajustin_smith, i am doing this now with for and it looks very promising
16:30kwladykano, i want it to be lazy
16:31justin_smithOK, but the filter version is simpler - yeah, don't put the result in a set.
16:31kwladykahow can i prevent REPL to print what function return?
16:32kwladykajust like (not-print f)
16:32kwladykai guess something exist
16:32justin_smiththat's where the memory usage was ending up - in the set. If the consumer of count-solutions doesn't need to hold all the results at once, and can go through them one at a time, that will help your memory usage
16:32justin_smithkwladyka: (do (f) nil)
16:32justin_smiththat's how I do it at least
16:32kwladykajustin_smith, thx
16:33justin_smithor (def result (f)) then access whatever part of result I want (but not the whole thing)
16:33kwladykajustin_smith, need to, but passed results are in small number
16:34slesterAnyone have experience with "ExceptionInfo No such namespace: cljsjs.react, could not locate cljsjs/react.cljs at line 1" kinds of errors in the REPL? Using weasel and om.
16:34martinklepschslester: are you using most recent version of weasel?
16:35martinklepschslester: this has been a problem at some point when repl stuff changed but should be fixed in the most recent release
16:35martinklepschslester: also just FYI there is a #clojurescript channel on Freenode as well :)
16:35slestermartinklepsch: whoops, sorry about that!
16:36martinklepschslester: fine w/ me, just letting you know :)
16:37numbertenany reason test.check doesn't have float generators?
16:42hiredmanI dunno, but a suspect a summary of the reasons would be something like "ugh, floating point"
16:43numbertenhaha fair enough
16:51numberten(gen/fmap float gen/ratio) I think is probably a good alternative
17:04dagda1why does this not print each number on a new line (apply println [0 1 2 3])
17:04kwladyka,(println 0 1 2)
17:04clojurebot0 1 2\n
17:04kwladykaas you can see it still print in one line because prinln works in that way
17:05dagda1kwladyka how do I print each number on a new line
17:05justin_smith,(doseq [i [0 1 2 3]] (prinln i))
17:05clojurebot#error {\n :cause "Unable to resolve symbol: prinln in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: prinln in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: prinln in t...
17:05justin_smitherr
17:05justin_smith,(doseq [i [0 1 2 3]] (println i))
17:05clojurebot0\n1\n2\n3\n
17:06justin_smithor ##(run! println [0 1 2 3]) ;; 1.7+
17:06lazybot⇒ 0 1 2 3 nil
17:06justin_smithwait
17:06justin_smith,(run! println [0 1 2 3])
17:06clojurebot0\n1\n2\n3\n
17:07justin_smithoh, that's just lazybot being silly, OK
17:11gfredericksdnolen: so the new RNG slows down the test suite by 30%-70%, and I'm running out of ideas for optimizing it (I've now started pondering more JS-oriented algorithms); are you interested in taking a look?
17:14kwladykahttps://www.refheap.com/e36238616dcd57a13ac301d47 what am i doing wrong here? Why it is so slow... ?!
17:14kwladykahow to improve it?
17:16justin_smithkwladyka: if you take off the (into #{} ...) part at the end it will be lazy
17:16kwladykajustin_smith, i am showing the end on screen
17:16justin_smiththe into #{} forces it to be strict, so count-solutions can't return until every possible solution is stored in the set
17:16kwladykajustin_smith, and the end has a really small number of sets
17:17justin_smithif you take that into call out, it can start printing the result immediately
17:17kwladykammm i will try without that, but still the number of solutions to print is 92
17:17kwladykait is small number
17:18kwladykathe main problem is other place
17:18kwladykabut i dont know where
17:18kwladykawithout into #{} it is still slow
17:18kwladykaas before
17:20dnolengfredericks: I'm very skeptical that it's RNG, have you looked at profiler yet?
17:21gfredericksdnolen: oh like in a browser? I'd been running on node; I'll try the browser version
17:23dnolengfredericks: I only really recommend profiling in Chrome, for profiling use these settings
17:23dnolen:optimizations :simple, :static-fns true, :pretty-print true
17:23gfredericksdnolen: okay cool, thanks
17:24dnolengfredericks: make sure in Chrome you click the little gear in the dev console and click Hi-resolution Profiling
17:24dnolenthis will give you sub-millisecond sampling
17:25gfredericksoh cool, got it
17:25kwladykajustin_smith, the main problem all-possible-notations takes too much time... maybe i have just rubbish algorithm and that the problem
17:25kwladykamaybe have to do in another way
17:25gfredericksglad I asked
17:26justin_smithkwladyka: you are dealing with a combinatorial explosion, I guess you could hyper-optimize with low level tricks, but it's inherently slow to get all the permutations of a group that large
17:27kwladykajustin_smith, low level tricks?
17:28dnolengfredericks: you may want to pick a illustrative run, anything that runs longer than 10 seconds unless you have a desktop machine is likely to make profiling very painfully slow.
17:28justin_smithusing an iterator instead of a lazy-seq, using mutation on a single data structure instead of using persistent data structures and lettign them get garbage collected
17:28gfredericksdnolen: what does "pick an illustrative run" mean?
17:28justin_smithkwladyka: it won't be especially fun or pretty, and can only speed things up so much...
17:28dnolengfredericks: like don't run all the tests
17:29gfredericksokay just a single test for longer than normal?
17:29justin_smithkwladyka: and at that point you've lost most of the benefit of using clojure in the first place
17:29dnolengfredericks: something like that, I don't know anything about RNG changes so I can't tell you what to try :)
17:29kwladykajustin_smith, oh so Clojure just works slower in cases like this?
17:30gfredericksdnolen: roger
17:30justin_smithkwladyka: it isn't the fastest language - it is up to you whether you want to do 10x more work, risk bigger errors in the code, and do the whole thing in java or C
17:30justin_smith*at least 10x more work, for ~10x speed improvement
17:31kwladykahow it looks vs scala?
17:31justin_smithscala isn't going to be much faster I don't think
17:31justin_smithbut I don't know a lot about scala, better to find someone who uses both and ask for their comparison
17:33seangroveTrying to uberjar a realtively small project for the first time (for this project), and getting this: Uberjar aborting because jar failed: clojure.lang.MapEntry cannot be cast to clojure.lang.IPersistentMap
17:33seangroveThere's not really anything more to go off than that - anything obvious I should be looking at?
17:35justin_smithseangrove: one thing I like to do is have only one ns that gets aot-compiled. It uses require / resolve at runtime to load my actual app and start it
17:35justin_smiththat way I can eliminate a lot of headaches caused by differences between aot-compiled namespaces and ones that are not
17:36justin_smithseangrove: in case that's unclear, that aot compiled namespace is only a stub, and at compile time it doesn't load any other namespaces (thus no other namespaces get compiled while creating the uberjar)
17:37seangrovejustin_smith: How's that affect determinism/load-time/etc.?
17:38justin_smithseangrove: determinism stasy the same - the same libs are in the uberjar.
17:38justin_smithload time is worse, because compiling all happens when starting the jar
17:38justin_smithinstead of pre-compiling
17:38justin_smithseangrove: so that's a tradeoff, I accept it for the added simplicity
17:38seangroveYeah, that's fair
17:38justin_smith(simplicity as in, what happens in my repl is what happens in the jar)
17:39kwladykajustin_smith, hmm i found 3 apps in scala and try it
17:40kwladyka1 do only count solutions without list them.... 2 doesn't work :)... 3 count solutions and i think it is fast
17:41kwladykaso i should understand scala now :D
17:43kwladykawow so fast, magic
17:43kwladykaof course not mine :)
19:17amalloyare you around, cfleming? i was trying to use cursive's debugger support for the first time, and it seems like my breakpoints are not doing anything. i put a breakpoint on the first line of -main and selected the Run|Debug action; but all i get is a console message saying it connected to the target VM, and then disconnected from the target VM
19:44gfredericksdnolen: I haven't tried a more focused run yet, but the total test suite slows down by a couple seconds, and the profiler shows over a second of time spent in goo.math.Long
19:45dnolengfredericks: so top line self time item?
19:46dnolen
19:46gfredericksdnolen: there's GC, then ISeqable, then Long.multiply
19:47gfredericksit might be only 600ms, these numbers confuse me
19:47gfredericksif the top level self column is all disjoint, then it's >1sec
19:48dnolenYou can sort self time column
19:48gfredericksright, it's sorted
19:48dnolenThe numbers don't lie
19:49gfredericksneed to invent a splittable algorithm that's better for 32-bit signed integers
19:51gfrederickslooks like the other half of the slowdown is GC
19:51gfrederickswhich also makes sense
19:52eriktjacobsenReally bizzare problem: I’m getting this error <java.lang.NoClassDefFoundError: clojure/tools/logging/impl/LoggerFactory> , but the problem is that it just started today and the problem exists even 2 months back in our codebase (when its been compiling fine those 2 months). it seems to retroactively breaking builds, and it just occured today simultaniously on all our developer laptops / servers. Has anyone heard anything?
19:52eriktjacobsenI’m totally lost.
19:52dnolengfredericks: what % in Long.multiply though?
19:52eriktjacobsenWe don’t have a centralized maven, so if there is a probem its should be with main public maven
19:52gfredericksdnolen: 3.68%
19:53dnolengfredericks: and Seqable?
19:53gfredericks6.7%
19:54dnolenSo I don't think any change to Long will matter much then. I suspect you made related changes elsewhere for algorithm?
19:54hiredmaneriktjacobsen: have you run `lein clean`? have your cleared your .m2?
19:55eriktjacobsenyes, lein clean before each attempt. will try clearing .m2…. didn’t think local since it hit multiple laptops same time I’m seeing the exact same error from code several hundred commits ago from january. Will try clearing now
19:55gfredericksdnolen: not very much; you're saying changes won't matter because 3.68% is relatively small?
19:56hiredmaneriktjacobsen: are any of your deps AOT compiled?
19:57dnolengfredericks: if twice as much time is spent seq'ing that's where I would spend my time.
19:57gfredericksoh gotcha
19:57dnolenI wonder how Erlang QC does this without seqs
19:58gfredericksthe lazy tree part you mean?
19:59dnolengfredericks: yes when I ported test.check the implementation seemed pretty naive wrt perf
19:59hiredmaneriktjacobsen: it may be some kind of code loading order issue, e.g. the clojure.tools.logging.impl namespace defines LoggerFactory which is something that is backed by a class (protocol, deftype, defrecord, etc)
19:59gfredericksdnolen: yeah at first it was just copied from haskell
19:59hiredmaneriktjacobsen: and something is trying to do stuff with that type before the namespace that defines it has been loaded
20:00dnolengfredericks: I suspect a custom rose tree thing could buy you 10X what you have today
20:00gfredericksdnolen: replacing the seqs you mean?
20:00gfredericksI've been pondering how to do that today and it's a slippery problem
20:00dnolenJust writing a data structure for the problem period
20:00hiredmaneriktjacobsen: so you can make sure you aren't doing that, if your code does anything with LoggerFactory, and if it isn't you, you'll need to check your dependencies
20:01gfrederickswell it already *is* a data structure, it's just made of lazy seqs
20:01eriktjacobsenhiredman: /sigh I got it. We pushed out Ultra-Repl
20:01hiredmanwhat the heck is that
20:01gfredericksan extremely large lazy data structure that basically represents the search space
20:01dnolengfredericks: but not necessarily suited to the problem
20:02dnolenAnyways that's what I would do since that would be a global win not a micro opt like Long
20:02eriktjacobsenhiredman: since it was pushed out to ~/.lein/profiles, it was conflicting regardless of code checkout. (its a colorized repl that also changes output from stacktraces and whatnot)… oddly the code was working fine with repl UNTIL a lein clean was run… so yeah
20:02gfredericksdnolen: okay I'll keep thinking along those lines, thanks
20:02hiredmanright, because at somepoint you aot compiled the project and the classfile was sitting there
20:03gfredericksall the easy thoughts about *ducers don't seem to fit because it's not linear
20:03eriktjacobsenhiredman I should have realized, it was just that we happened to be running ultra for several days without a lein clean… totally forgot about the repl change (since they had been playing nice together for week)
20:03amalloygfredericks: new band name: the starducers
20:04hiredmanyou should track down who ever is touching the class without loading the namespace that generates it and send them a strongly worded letter
20:07eriktjacobsenhiredman: ok. is there a way to exclude from lein plugins?
20:07hiredmandon't put it in?
20:08eriktjacobsenfrom a project.clj? heh… yeah right now fix is toggling out lein profile based on dev workflow using repl vs compiling
20:08eriktjacobsenhmm way to only load a lein plugin during repl and not during compile / install ?
20:09hiredmanwhy bend over backwards to keep using something that is broken?
20:09eriktjacobsenthe colors are pretty
20:11hiredmando you think that is a little crazy?
20:12eriktjacobsennot really the colors are pretty helpful, and a script to toggle them out of lein profile when building takes 30 seconds to write and add a hook for in build scripts =\
20:15hiredmanit just seems like developers will bend over backwards to try to keep using broken stuff, and like, just kick it to the curb, you don't need it, you'll be fine, and you won't accrete more code on top of the broken stuff
20:18eriktjacobsenits just a repl plugin, not part of actual code I’m shipping… outside of disabling it during compile, no code is going to be written on top of it…. meh its an improvement over standard repl. it sucks it doesn’t play nice with rest of code but its still perfectly functional for the repl itself
20:22aamarCLJS newbie question... anyone know since when or & why String length is (.-length foo) instead of (.length foo)?
20:23aamarRelated, I'm seeing the .length form in a few very important libraries, like ajax.core.
20:32amalloyaamar: .-length is a property lookup, like foo.length, and .length is a method call, like foo.length()
20:33amalloyso presumably .-length is used for built in arrays, and .length is used for some other kind of thing like an object defined by ajax.core
20:35aamaramalloy: that makes sense. thanks.
20:35aamarhm... still looks like the cljs-ajax is trying to call it on a String. Maybe it's just a bug.
20:49bostonaholicaamar: length is a property on a String, not a function
21:16justin_smithbostonaholic: to be clear, it's a method on the String class
21:17bostonaholicjustin_smith: you sure? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length
21:18justin_smithbostonaholic: oh, I thought you were talking jvm, don't mind me
21:18justin_smithoh, duh, cljs-ajax, right
21:18bostonaholichaha, yeah. the original question was CLJS
21:35justin_smith,(defn make-name [] (->> (all-ns) (mapcat ns-publics) (mapcat #(clojure.string/split (name (key %)) #"[-*!?]")) shuffle (remove empty?) (take (+ 2 (rand-int 3))) (clojure.string/join "-") symbol))
21:35clojurebot#'sandbox/make-name
21:35justin_smith,(repeatedly make-name)
21:35clojurebot(juxt-compile-special NODE-key-seq-history byte-repeatedly-as timestamp-clojure-triml-array ..-identical-fn ...)
21:35justin_smith,(repeatedly make-name)
21:35clojurebot(unchecked-some-min distinct-root if-char-make-refer unchecked-all-pop re-list-int-sorted ...)
21:38justin_smith,(repeatedly make-name)
21:38clojurebot(descendants-in writer-at bound-aset re-type ex-use-string ...)
21:38justin_smith,(repeatedly make-name)
21:38clojurebot(delay-proxy-booleans declare-with-matches-struct let-method aliases-array zipmap-executor ...)
22:18justin_smith,(defn make-name [] (let [namespaces (all-ns) namespace (->> namespaces (mapcat #(clojure.string/split (name (.name %)) #"[.-]")) shuffle (take (+ 2 (rand-int 4))) (clojure.string/join ".")) variable (->> namespaces (mapcat ns-publics) (mapcat #(clojure.string/split (name (key %)) #"[-*!?]")) shuffle (remove empty?) (take (+ 2 (rand-int 3))) (clojure.string/join "-"))] (symbol (str namespace \/ variable))))
22:18clojurebot#'sandbox/make-name
22:18justin_smith,(repeatedly make-name)
22:18clojurebot(instant.repl.clojure.clojure/select-future-load java.string.clojure.core.uuid/find-subvec-method java.clojure/frequencies-zero-ex-clojure sandbox.clojure.core.user/test-unresolved-not string.core.clojure.clojure.user/while-unchecked-str-unmap ...)