#clojure logs

2014-11-07

00:00jimrthyAnd I'm sure it's something stupid I'm doing (like trying to run it through wildfly)
00:03jimrthytechnomancy: I'll try redeploying that version. Thank you for everything you've done for the community!
00:03technomancysure. =)
00:04technomancyyou can test it without redeploying though
00:04technomancyjust run java -cp my-uberjar.jar clojure.main
00:04technomancyand call clojure.java.io/resource there
00:07bodie_can someone help me make sense of mapv? I just need a very simple example
00:07bodie_all the examples I've seen are a little too fancy to grasp
00:08bodie_,(mapv #(+ 2 %) [1 2 3] [4 5 6]) ; I expected this to eval to [[3 6] [4 7] [5 8]]
00:09clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox/eval26/fn--27>
00:10TEttingerbodie_: it's the same as map, it jist returns a vector
00:10TEttingermap can take multiple collections, and if it does, the fn you pass to map is expected to take 2 args
00:10bodie_ah
00:11bodie_ohh, I see
00:11TEttinger,(mapv #(vec (+ 2 %1) (+ 2 %2)) [1 2 3] [4 5 6])
00:11clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/vec>
00:11TEttinger,(mapv #(vector (+ 2 %1) (+ 2 %2)) [1 2 3] [4 5 6])
00:11clojurebot[[3 6] [4 7] [5 8]]
00:12TEttingerthe vector is just needed because #() syntax doesn't let you return something with just [] like a normal fn
00:12TEttinger,(mapv #(fn [a b] (+ 2 a) (+ 2 b)]) [1 2 3] [4 5 6])
00:12clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
00:12TEttinger,(mapv #(fn [a b] [(+ 2 a) (+ 2 b)]) [1 2 3] [4 5 6])
00:12clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox/eval130/fn--131>
00:12TEttinger,(mapv (fn [a b] [(+ 2 a) (+ 2 b)]) [1 2 3] [4 5 6])
00:12clojurebot[[3 6] [4 7] [5 8]]
00:12TEttingergah
00:12bodie_gotcha
00:12TEttingerthat does it though
00:13bodie_err
00:13bodie_,(mapv #(+ %1 %2) [1 2 3] [4 5 6])
00:13clojurebot[5 7 9]
00:13bodie_:)
00:13TEttingeryep!
00:13bodie_makes sense now!
00:13bodie_thanks
00:13TEttingeryou could also use there:
00:13TEttinger,(mapv + [1 2 3] [4 5 6])
00:13clojurebot[5 7 9]
00:14bodie_nice
00:17TEttinger,(mapv #(mapv (partial + 2) %&) [1 2 3] [4 5 6])
00:17clojurebot[[3 6] [4 7] [5 8]]
00:17TEttingerthat is fun.
00:20TEttinger%& is a neat trick in anonymous fns, it is the variable that receives all arguments passed to the fn that aren't already bound to %1 (also known as %), %2, or another numbered arg. if you pass 4 args to an anonymous fn that already has %1 and %2 in it, %& will be a 2-element seq with the third and fourth args
00:22TEttinger,(#(str %1 ", " %2 "...aaaaaand... " (clojure.string/join ", " %&)) "cat" "dog" "bird" "mouse")
00:22clojurebot"cat, dog...aaaaaand... bird, mouse"
00:22Wild_Catneat.
00:22TEttingerI learned it from trying to understand swearjure
00:22TEttinger~swearjure
00:22clojurebotswearjure is the intersection of clever and terrible
00:23TEttinger$google hyPiRion swearjure
00:23lazybot[Swearjure - Clojure without alphanumerics - hyPiRion] http://hypirion.com/musings/swearjure
01:01andyftechnomancy: One less Leiningen plugin that can only be invoked from the command line (Eastwood can now be run from REPL).
01:01justin_smithandyf: aesome
01:02rpaulo_hahh
01:02rpaulo_that's brutal
01:23andyfOddity: Did you know you can define a function catch and call it, but if you define a function ?try? and try to call it, it is still the special form version?
01:23andyfUgh. I should figure out how to disable smart quotes in this irc client permanently.
01:24justin_smithandyf: I think it's like is-thrown-with-message in the is macro
01:24justin_smithyeah
01:24opqdonutthat's because try is the special form, and catch is just a random symbol that try happend to interpret in some way
01:24opqdonut*happens
01:25andyfopqdonut: And yet both try and catch are in the list of special symbols Clojure keeps in clojure.lang.Compiler/specials
01:25andyf,clojure.lang.Compiler/specials
01:25clojurebot{& nil, monitor-exit #<Parser clojure.lang.Compiler$MonitorExitExpr$Parser@19a8a97>, case* #<Parser clojure.lang.Compiler$CaseExpr$Parser@10e2229>, try #<Parser clojure.lang.Compiler$TryExpr$Parser@b786e6>, reify* #<ReifyParser clojure.lang.Compiler$NewInstanceExpr$ReifyParser@12abfb4>, ...}
01:25andyfoops
01:25andyf,(keys clojure.lang.Compiler/specials)
01:25clojurebot(& monitor-exit case* try reify* ...)
01:25andyfIs clojurebot's *print-length* always that short?
01:26justin_smithandyf: yeah, but lazybot gives refheap links
01:26justin_smith&(keys clojure.lang.Compiler/specials)
01:26lazybotjava.lang.SecurityException: You tripped the alarm! class clojure.lang.Compiler is bad!
01:26justin_smithbleh
01:26andyfAnyway, if you look really close, you can see both try and catch in the ...
01:27andyfno, just the catch :)
01:39TEttinger,(clojure.string/join "; " keys clojure.lang.Compiler/specials))
01:39clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: string/join>
01:39TEttinger,(clojure.string/join "; " (keys clojure.lang.Compiler/specials))
01:39clojurebot"&; monitor-exit; case*; try; reify*; finally; loop*; do; letfn*; if; clojure.core/import*; new; deftype*; let*; fn*; recur; set!; .; var; quote; catch; throw; monitor-enter; def"
01:49godd2could someone explain why in the first function, the recur is not in the tail position, but in the second one, it is: https://gist.github.com/nicklink483/109af8900d4ada1a3b49
01:49godd2in both, recur happens last, so isn't that the "tail position"?
01:50justin_smithgodd2: you can't do the * 2 until the recur returns, in the first
01:50justin_smithgodd2: so it isn't the tail, there is computation left to do
01:50godd2I see
01:50justin_smithto be in the tail position, there must be no more work to be done in the function
01:51justin_smithgodd2: this often leads to "accumulator arguments", and a later reduction step
01:52godd2okay so recur can only be "inside" certain things then. is that a good way of thinking about it as a beginner?
01:52godd2like, it can be inside an if
01:53justin_smithgodd2: it can be in an if, as long as all the if would do is return its value
01:53justin_smithgodd2: the easiest way to think of it is "what is left for this function to do after this call" - if the answer is "return the value" or "nothing" than it is a tail position
01:54godd2ah ok that makes sense
01:54godd2thank you
01:54justin_smithnp
01:56godd2one more question. in the fizz-buzz example, is the recur recursively doing the loop on line 7 or the fizz-buzz function itself?
01:56godd2nvm, I see the parameter being passed, it must be the loop
01:57justin_smithgodd2: yeah, recur will go to the innermost function or loop, moving out from where it is called
01:57godd2does it take arity into account when doing that?
01:57justin_smithnope, it goes to the innermost containing fn or loop
01:57godd2awesome thanks
02:51nbeloglazovWhy cider uses :load-file nrepl op for code evaluation instead of :eval?
03:19noncomi want to use clojure for crosspatform system scripting. i know that there is the problem of jvm startup time and clojure load time.. are there any options of dealing with these two problems ?
03:24katratxononcom: m] has joined #clojure
03:24katratxo09:19:09 -!- dav__ [~david@unaffiliated/dav] has joined #clojure
03:24katratxo09:19:28 < noncom> i want to use clojure for crosspatform system scripting. i know that there is the problem of jvm startup time and clojure load time.. are there any options of dealing with these two problems ?
03:24katratxosorry about that
03:24noncomhehe :)
03:24katratxononcom: https://github.com/flatland/drip https://github.com/technomancy/grenchman
03:26noncomuhhh.. not many options for windows.. i need osx/windows crossplatformity
03:27katratxononcom: not sure if nailgun is clossplatform http://www.martiansoftware.com/nailgun/
03:28noncomwell... if only grenchman provided for windows out-of-the-box...
03:48andyfnoncom: If you build a Windows binary, I bet they'd serve it for others, but yeah, doesn't look like building it for Windows would be a simple task
03:58noncomandyf: and that brings us to the questions like "why in the world is it written in ocaml???"
03:58andyfBecause technomancy wanted to write an ocaml program
04:05katratxononcom: http://technomancy.us/170
04:08noncomyeah i know he likes it, but still...
04:08noncomthanks for the article link though, will read it now, looks interesting
06:15reborgcljHello
06:15noncomif i start an nrepl server how do i send it some code for evaluation ?
06:15reborgcljcan somebody explain me
06:15reborgclj,(let [m {:a :b}] (identical? m (assoc m :a :b)))
06:15clojurebottrue
06:16noncomsending {:op :eval :code "(+ 1 2 3)"} wont work...
06:16reborgcljI have the impression it is an implementation detail surfacing with identical? there, but could be wrong
06:17noncomreborgclj: per manual, identical? tests whether the object is the same... which is obviously true ini your case
06:18reborgcljnoncom: then shouldn't
06:18reborgclj,(let [m {:a 500}] (identical? m (assoc m :a 500)))
06:18clojurebotfalse
06:18reborgcljbe similar?
06:18clgvnoncom: do you really need a custom nrepl client?
06:19clgvnoncom: technomancy mentioned that his ocaml nrepl client is approx 400-500 lines of code
06:20noncomclgv: actually i only need to send some code for eval. i want to be able to do that with netcat or telnet... :) trying to use a clojure daemon for system scripting
06:20clgvto justify the claim that full protocoll compliant nrepl client is not that easy to write
06:21clgvnoncom: how about RMI and a clojure serialization lib (or EDN if that suffices)?
06:21noncomreborgclj: hmmm, well.. you can start from here: https://github.com/clojure/clojure/blob/clojure-1.6.0/src/clj/clojure/core.clj#L734 :)
06:22noncomclgv: ummmm... not sure, i just need to execute arbitrary clojure code from a scripts file.. will that work ?
06:22reborgcljnoncom: always sensible thing to do :)
06:22noncombasically i have to do some file management and json file parsing, reading/writing and stuff like that
06:22clgvnoncom: sure
06:23noncomclgv: so how would you go about it ? i just want to eliminate the jvm startup time by runing the daemon with an nrepl
06:23clgvnoncom: I do more sophisticated stuff that way, i.e. my communication is based on Java RMI (only a small stub) and messages are sent as clojure maps as well
06:24clgvThe relevante part of my RMI interface is: public interface Node extends Remote { void sendMessage(byte[] message) throws RemoteException; }
06:25clgvnoncom: you are familiar with Java RMI?
06:25clgvnoncom: sadly, I didnt have time to create a separate lib from it...
06:25Glenjaminreborgclj: assoc doesn't make a change if you assoc the same value to a key
06:25noncomclgv: only vagually familiar :)
06:26noncomclgv: your program seems interesting, why dont you make a lib.. :)
06:27clgvnoncom: the whole thing will be release as a lib in 1-2 months - but the communication part is not separate so far
06:27reborgcljGlenjamin: apparently only if your value is interned (keywords and string literals)
06:28Glenjaminit's probably identity
06:28noncomclgv: looking forward for it, but then what could i do currently to be able to send some code for eval to a nrepl daemon ?
06:28noncompreferably from command line
06:28Glenjamin,(let [a {:b 1} m {:a a}] (identical? m (assoc m :a a)))
06:28clojurebottrue
06:28clgvnoncom: summarizing, you don't need to know that much about RMI just how to define a remote object and how to startup the node
06:30clgvnoncom: well, I chose RMI since it can be used to reliably send messages. any other lib that offers you the same, will do as well. the whole approach is more high level than an nrepl client.
06:30clgvnoncom: hmm a possible shortcut could be to use what ever reply is using as nrepl client
06:30reborgcljGlenjamin: if I remember correctly, I think also Integers up to a certain number are interned in Clojure
06:31clgvreborgclj: that would be new
06:31reborgcljclgv: actually it might be Java directly
06:31clgvreborgclj: or do you just mean constants?
06:33reborgcljclgv: ah here we go http://stackoverflow.com/a/10149985
06:34clgvreborgclj: if that is a Java compiler feature, Clojure probably does not have it
06:34Glenjaminreborgclj: the interning isn't the important bit, identity is important
06:34Glenjaminbut interned things have the same identity
06:34Glenjamin$source assoc
06:34lazybotassoc is http://is.gd/r57EpC
06:35reborgcljGlenjamin: I think I understand it's identity and not equality, still it confuses me for the assoc I posted above
06:39Glenjaminreborgclj: this is the relevant line of code afaict https://github.com/clojure/clojure/blob/clojure-1.6.0/src/jvm/clojure/lang/PersistentHashMap.java#L602
06:39Glenjaminslighty deeper in that i expected, but the upshot is that if you try and assoc an identical value into the same key, nothing changes
06:40perplexa,(clojure.string/split "abc" #".")
06:40clojurebot[]
06:40perplexathis is a bug, right?
06:40perplexaexpected result is ["abc"]
06:40perplexa;/
06:40Glenjamin(doc clojure.string/split)
06:40clojurebot"([s re] [s re limit]); Splits string on a regular expression. Optional argument limit is the maximum number of splits. Not lazy. Returns vector of the splits."
06:40perplexaoh nvm
06:40perplexa:D
06:41Glenjaminsplit doesn't include the splitted char - which is all of them
06:41perplexayeah i forgot to escape the dot ;p
06:43reborgcljGlenjamin: I see, identical? is doing its job on object pointers but somehow assoc knows about it and
06:43reborgclj,(let [m1 {:a :b} m2 (assoc m1 :a :b) m3 (assoc m1 :a :c)] (do (println m1 m2 m3)))
06:43clojurebot{:a :b} {:a :b} {:a :c}\n
06:43perplexahmm what would be the best way to replace the first item of a vector?
06:43reborgcljsomething like this is returning the expected result (i.e. persistent data structures)
06:46pyrtsa,(clojure.string/split "...abc.def" #"\.")
06:46clojurebot["" "" "" "abc" "def"]
06:46pyrtsa,(clojure.string/split "abc.def..." #"\.")
06:46clojurebot["abc" "def"]
06:46pyrtsa,(clojure.string/split "abc.def..." #"\." -1) ;; PROTIP!
06:46clojurebot["abc" "def" "" "" ""]
06:47perplexa=> perplexa | yeah i forgot to escape the dot ;p
06:47perplexathe -1 is handy tho!
06:47pyrtsaThe standard Java behaviour of split can be confusing at times. The magic constant "-1" changes the behaviour to what's more expected.
06:47perplexa(inc pyrtsa)
06:47lazybot⇒ 9
06:48pyrtsaBummer that clojure.string/split wasn't implemented with the better default.
06:49perplexait's pretty inconsistent to have them at the beginning but not at the end ;p
06:50perplexaah, and i was looking for assoc ;x
07:01noncomclgv: finally, i have learnt that in order to use netcat to send data to the nrepl, i have to start it with the TTY transport and not the default ont
07:01noncom*one
07:01noncomnow it works almost perfectly with sending files to it via cat|netcat
07:46justin_smithperplexa: iirc the newer jvm does not provide them at the beginning by default
07:48justin_smithperplexa: no, never mind, it must be something else I was thinking of
07:49perplexaheh
07:51sam_Hi!
07:52sam_Would someone please tell me heo I can setup clojure REPL in linux?
07:52perplexais (list ...) preferable over (vector ...)? :P
07:52perplexasam_: get leiningen
07:53justin_smithperplexa: that really depeneds, there's a reason we have both
07:53justin_smithperplexa: do you need fast lookup by index? do you need fast insertion/removal from the tail end? a yes to either of those means you want a vector.
07:53justin_smithotherwise, probably a list.
07:55perplexajust yielding tons of 2-item pairs that i just apply on to a function ;x
07:55justin_smithyeah, lists ar lighter weight for that
07:55justin_smith*are
07:56perplexaty
08:13clgvnoncom: ah ok
08:19noncomclgv: what about your lib though? what space to watch ?
08:22sam_perplexa: Could you explain a little more in detail.
08:23clgvnoncom: not sure. probably an ML announcement
08:25justin_smithsam_: leiningen provides a shell script called lein
08:25justin_smithyou can get it from leinengen.org
08:26justin_smithsam_: "lein repl" will download the dependencies and start a repl, "lein new name" will create a new project called name
08:26sam_justin_smith: I know that. But could you explain the steps a little more in detail. I'm relatively new to Clojure and I would like to set it up.
08:26clgvjustin_smith: someone should write that leiningen book ;)
08:26justin_smithsam_: you download the shell script, change it to executable, install it somewhere on your path, and run "lein repl"
08:27justin_smiththose are literally all of the steps
08:27clgvhmm scala's SBT has a book
08:27clgvso how about "Leiningen in Action"?
08:27justin_smithhah
08:28justin_smithsam_: the setup is per project
08:28justin_smithsam_: there is very little global config, and you don't really need any global config of lein
08:29justin_smithsam_: one of the primary advantages with lein, is library versions, behavioral config, etc., are managed per project not per computer
08:30rweirsbt is absurdly complicated though, getting a preojctless lein repl is literally two steps
08:30rweir1) install the lein bootstrap script 2) lein repl 3) go to the pub
08:30clgvrweir: this was just an argument for a leiningen book ;)
08:31justin_smith1.5) wait for all the downloads and the long clojure startup time :P
08:31clgvjustin_smith: 4-5secs is fair for "lein repl"
08:31clgvoutside a project in this case
08:31justin_smithclgv: the first time you run lein, it's a bit longer
08:32clgvjustin_smith: yeah ok ;)
08:32clgvjustin_smith: just a one time effort per "upgrade"
08:32justin_smithright
08:37mavbozoare there any implementations of clojure core.cache protocols in memcache or redis?
08:44randomDOODHi, is there any command to clear the screen while using REPL?
08:44justin_smithrandomDOOD: have you tried Control-L ?
08:45randomDOODjustin_smith: thanks :D
08:48justin_smithclgv: C-L? it's ascii for "page break" so it can be used to force a new page when printing, to clear the screen in a terminal, and old editors (including emacs) respect C-L (treated by any lang as whitespace) in code as a target for page-down navigation
08:48justin_smith,(def a 1)
08:48clojurebot#'sandbox/a
08:49justin_smith,a
08:49clojurebot1
08:49clgvjustin_smith: yeah, in bash i usually type "clear <ENTER>" ;)
08:50clgvdamn it works in my IM client as well
08:50justin_smithclear is different, because it also requests a scrollback buffer clear from the terminal iirc
08:50clgvjust lost todays scrollback ;)
08:50justin_smithclgv: c-l is commonly respected, but just old enough to be obscure
08:51clgvwell "lost" sounds dramatic which is not the case ;)
08:51justin_smithheh
08:54justin_smith(inc )
08:54lazybot⇒ 2
09:06randomDOODHi! I'm relatively new to Clojure. I learnt a little bit through braveclojure, and various ebooks as well online resources. I feel I'd be able to learn more only when I start working on actual projects! Would someone suggest what I must do? Thanks for the help in advance :)
09:08clgvrandomDOOD: have you tried out 4clojure.com?
09:08justin_smithrandomDOOD: there is a tag in leiningen for issues that are good for a new contributer https://github.com/technomancy/leiningen/labels/Newbie
09:08daniel__randomDOOD: think of a project you want to build/would find useful
09:08daniel__try and build it
09:08hyPiRionrandomDOOD: What would you like to do in Clojure? :) Usually I think about stuff I need or want, and see if I can help over there
09:09daniel__i wouldn't say jumping in to an open source project is the best way, better to try and build something from the ground up first
09:09randomDOODhyPiRion: Well, As I am a little new to Clojure, I'd like to try out something simple.
09:10justin_smithrandomDOOD: I just did some work on lazybot - the format for defining a new plugin for the irc bot is pretty straightforward, and each plugin is a small self-contained program
09:11justin_smithand, bonus, irc bots are a great way to annoy your friends
09:13daniel__randomDOOD: i wrote a tac-tac-toe game when i was learning
09:13hyPiRionrandomDOOD: I started out with a small website engine running compojure, which connects to a database and those things. It's still responsible for my website, so it was good for getting more experience with Clojure
09:13randomDOODdaniel__: That seems like a good idea :)
09:14daniel__its a good exercise, you're often tempted to use mutable state if you come from other languages
09:24justin_smith$mail randomDOOD like this
09:24lazybotMessage saved.
09:25randomDOOD:)
09:27justin_smith$botsnack
09:27lazybotjustin_smith: Thanks! Om nom nom!!
10:15mwfoglemanI wrote some ugly code the other day that I want to clean up. I did two assoc-ins in a row
10:18mwfoglemanthe two assoc-in calls go to the same level of a map, so there's some redundancy there.
10:18clgvmwfogleman: so update-in + assoc? ;)
10:19mwfoglemanoh, where assoc is the function passed to update-in?
10:19mwfoglemangreat idea, clgv, thanks :)
10:19clgv,(update-in {} [:my :deep :path] assoc :a 1 :b 2)
10:19clojurebot{:my {:deep {:path {:b 2, :a 1}}}}
10:19clgvhooray for chaining ;)
10:20mwfoglemanclgv, that was really helpful, thank you. how would i adapt that to a case where there were two paths?
10:20mwfogleman[:my :deep :path1] and [:my :deep :path2]
10:20mwfoglemanor something like that.
10:20clgvno that won't work
10:21mwfoglemanmmm. luckily that is not the case i have now- but i was just wondering.
10:21clgvmaybe then you want to write a function any way since the map at [:my :deep] seems to be an entity which attributes are updated at once
10:21clgv*whose
10:22mwfoglemanah yeah, that would make sense.
10:23clgvbut a multi-arity assoc-in is possible as well. it is probably not implemented that way to be similar to update-in
10:25mwfoglemanclgv: what kind of clojure projects do you work on?
10:25clgvmwfogleman: distributed computations and optimization algorithms
10:25clgvsometimes visualization of results as charts
10:26mwfoglemaninteresting. what do you use for the charts?
10:26mwfoglemanincanter?
10:26clgvI started with incanter but hated it that its charts are not composable
10:27clgvI started to implement my own chart lib.
10:27jondothey guys. if you're looking for pair partners try this initiative by me :) https://www.hipchat.com/invite/197545/5f045eee8e66d972d8deabea79e8e83d
10:27mwfoglemanclgv: interesting. do you use incanter for the stats stuff? is your chart lib open source?
10:28clgvmwfogleman: no, I mostly dropped incanter though I still have it as dependency for legacy code
10:29clgvthe chart lib is not released so far. It is usable but I think I would rewrite it from scratch for better usability
10:29mwfoglemanclgv: we have been looking into possibly using incanter, both for stats and graphing. i'd love to see your charts library.
10:30mwfoglemanclgv: adapting your example worked like a charm, thanks so much!
10:31perplexacan i combine partial and apply?
10:32clgvmy suggestion if you happen to build a chart lib before I rewrote mine -> build the logical structure as data graph and render the graph to JFreeChart
10:32mwfogleman,(apply (partial + 2) '(+ 1 2 3))
10:32clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number>
10:33clgvperplexa: yeah why not? ##((partial apply +) (range 3))
10:33lazybot⇒ 3
10:33mwfogleman,(apply (partial + 2) '(1 2 3))
10:33clojurebot8
10:33mwfoglemanooh, which one were you thinking, perplexa?
10:33perplexasec
10:34perplexa,(map #(apply clojure.string.join "/" %) [[1 2] [3 4]]
10:34clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
10:34perplexa,(map #(apply clojure.string.join "/" %) [[1 2] [3 4]])
10:34clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.string.join, compiling:(NO_SOURCE_PATH:0:0)>
10:34perplexa,(map #(apply clojure.string/join "/" %) [[1 2] [3 4]])
10:34clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: string/join>
10:34perplexawaah
10:34perplexawell join is a bad example cos it takes only 1 more param
10:35mwfoglemanclgv: if you do end up rewriting your chart lib, where will i be able to find it?
10:36perplexainstead of join i have a function that takes 2 params, 1+2 and 3+4 in my example
10:36perplexa(partial apply myfunc) wouldn't work, right?
10:36clgvmwfogleman: ah don't expect it before April 2015
10:37mwfoglemanclgv: :D
10:37clgvmwfogleman: since the current one gets the job done and the important tasks keep me busy
10:37perplexa,(map #(apply (fn [a b] (str a "/" b)) %) [["" 2] [3 4]])
10:37clojurebot("/2" "3/4")
10:37perplexa,(map (partial apply (fn [a b] (str a "/" b))) [["" 2] [3 4]])
10:37clojurebot("/2" "3/4")
10:37perplexaoh nice ;p
10:38clgvperplexa: `apply` is just a higher order function ;)
10:38perplexayeah don't mind my brain farts ;p
10:38mwfoglemanperplexa: perfectly normal to have brain farts, you know.
10:39mwfoglemanit's the human condition.
10:39mwfogleman:P
10:39perplexa:D
10:39mwfoglemanclgv: do you have any code available online, charting lib aside?
10:39mwfoglemani'd like to take a look at anything you have. :)
10:42mwfoglemanperplexa: what are you working on?
10:43perplexamwfogleman: a framework to bootstrap and cleanup mrjobs
10:43mwfoglemanmrjobs?
10:43perplexamap-reduce jobs
10:43mwfoglemanah, ok ok
10:51TimMcaka "Steve"
10:55llasramperplexa: What do you mean by "bootstrap and cleanup"?
10:56perplexallasram: based on a config file and zookeeper state run cascalog aggregations with different source / sink taps
10:57llasramperplexa: You have existing Cascalog pipelines you want to manage through a higher-level scheduler?
10:57perplexaand since cascading's template tap is broken from the core and has tons of race conditions have to work around that by moving files around ;x
10:57perplexallasram: yea
11:15EvanR,(if true 0 1)
11:15clojurebot0
11:16chrisdonewas just reading this http://blog.getprismatic.com/om-sweet-om-high-functional-frontend-engineering-with-clojurescript-and-react/
11:16chrisdoneand https://github.com/swannodette/om/wiki/Cursors
11:16chrisdonehow much do these cursors correspond to the concept of lenses?
11:17perplexa,(complement true)
11:17clojurebot#<core$complement$fn__4178 clojure.core$complement$fn__4178@126984f>
11:18perplexa,((complement true) 1)
11:18clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn>
11:18perplexawat
11:18perplexa,((complement true?) 1)
11:18clojurebottrue
11:18perplexaoh yeah. 1 != true :P
11:18chrisdoneseems vaguely related
11:18clgvperplexa: yeah it is not true but truthy
11:18perplexarelated to what happened before you joined tho
11:19perplexaclgv: yeah
11:19perplexa,((complement true?) true)
11:19clojurebotfalse
11:19perplexais what i meant anyway ;p
11:19chrisdoneclgv: i prefer ``predicable'' =p
11:20chrisdoneclgv: makes you sound sophisticated
11:25dnolen_chrisdone: only a little, I came up w/ them - inspired zippers & lenses - but they are neither
11:26dnolen_chrisdone: the idea is that you want access patterns on associative collections to return something that continues to work like a collection but maintains it's location in the application state
11:26dnolen_"inspired by zippers & lenses"
11:26chrisdonednolen_: figures. i'm working on an equivalent to Om for haskell, and was thinking components could specify a lens which indicates what part of the state it depends on and such
11:27dnolen_chrisdone: there's a different React ClojureScript binding called Reacl that provides proper lenses
11:27dnolen_chrisdone: I'm not really interested in full lenses - but we'll probably step a little closer to them soon
11:29chrisdonednolen_: cool =) i'm not that big on lenses, just a means to an end while i figure out the design space
11:36technomancyoh man it's a chrisdone. now I'll never keep my channels straight. =)
11:36EvanRyeah
11:37EvanRget your peanut butter out of my jelly
11:40Glenjaminhrm, there doesn't sem to be any docs on the lenses used in reacl :s
11:50nopromptdnolen_: short question about core.logic. still learning here but i'm trying to figure out how to represent an opposite but i don't know how to extract it into something i can use elsewhere. https://gist.github.com/noprompt/edcaadf12c994869382d
11:55dnolen_noprompt: it's simpler/faster with finite domains
11:56nopromptdnolen_: will that work in cljs?
11:56dnolen_ah no
11:56dnolen_need to work on that
11:56dnolen_feature expressions!
11:56nopromptdnolen_: i noticed there are several namespaces that haven't been "ported" yet.
11:57noprompt:)
11:57dnolen_noprompt: since you only have two elements you could use membero for this too
11:57dnolen_(membero a [true false])
11:58dnolen_couple this with disequality
11:59dnolen_noprompt: I'm curious what you are trying to do :) I don't know that many people use core.logic w/ CLJS
12:02nopromptdnolen_: well, like i said i'm still picking this stuff up (TRS just came in the mail a few weeks ago). but i've been interested in seeing if we could improve a micro query language we use on the client w/ it.
12:02dnolen_noprompt: ah k, you looked at DataScript?
12:02jzinedinehey guys, anyone used friend with pedestal? I'm looking for a sample project but couldn't find one.
12:03nopromptdnolen_: we have. our data is all hierarchical so it hasn't been in the cards yet. :/
12:03dnolen_I see
12:04ohpauleezjzinedine: I've seen a good number of projects that use Friend and Pedestal, but I don't think any of them are public
12:04nopromptdnolen_: as a side project i wanted to see if i could implement a version of the dada engine w/ it.
12:05ohpauleezAre you having a specific issue?
12:05ohpauleezor you're just curious about the path forward?
12:05nopromptdnolen_: i could implement it w/o it no problem but i wanted to see how far i could push it.
12:05nopromptdnolen_: i'm also still interested in applying the constraint based stuff to css with the cssom.
12:05clojurebotCool story bro.
12:05jzinedinenot a specific issue, I'm a newbie, thus looking for a seed project to guide me through
12:06nopromptdnolen_: mostly, i'm just getting through TRS, tbaldrid_ logic tutorials, and the sited papers (when i can digest them).
12:06dnolen_noprompt: yeah I've pondered CSS w/ core.logic a few times ...
12:07nopromptdnolen_: it's just a time thing. i figure if i can catch up to your skill level in 3 years i'll be doing alright. :)
12:09edwI have a foggy memory of something that happened back in 1.4 or so that leads to the compiler ignoring rebinding of clojure.core fns, and that there is a way to turn this optimization off. Anyone know what I'm referring to?
12:09nopromptdnolen_: what needs to happen to get the other nss ported to cljs?
12:10Bronsaedw: it happens for inlined functions but there's no way to turn that off
12:10Bronsaedw: not sure if that's what you're talking about though
12:10technomancyedw: there was also the ^:static experiment in 1.3 snapshot briefly
12:10Bronsaalso in-ns and ns are not rebindable
12:10technomancybut it never made it into a release
12:11edwtechnomancy: Hmm. I'm `alter-var-root`-ing e.g. `+` yet `(+ 1 2)` doesn't eval the fn the var now contains.
12:12jzinedineohpauleez should I write interceptors myself?
12:12Bronsaedw: it's because of :inline
12:12arrdempuredanger: is ^:static still 1.7 candidate material?
12:13edwAh, yes, that.
12:13Bronsa,(def in-ns 1)
12:13edwFrustrating my profiler library.
12:13clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
12:13puredangerno. although there are no plans to revive ^:static as is afaik
12:13Bronsaoh come on
12:13ohpauleezjzinedine: Pedestal provides a way to take Ring Middlewares and turn them into Interceptors. For example, see: https://github.com/pedestal/pedestal/blob/master/service/src/io/pedestal/http/ring_middlewares.clj
12:13arrdempuredanger: news to me. thanks.
12:14Bronsathere should really be an option to disable :inline
12:14puredangerarrdem: certainly still interest in faster var invocation paths, but doubt it will take the form of ^:static
12:14puredangerbut that work will be 1.8
12:14ohpauleezjzinedine: Well actually, all of those are mostly done by hand :) But there are a few that use `defmiddleware`
12:15ohpauleezOnce you do that, you're off to the races
12:15Bronsahttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L7057-L7060 this should really go after looking in the ns-map
12:16jzinedineohpauleez thanks, I'll look into it, hope that I find my way
12:16arrdemBronsa: oh so you can have local aliases of ns and in-ns
12:16arrdemBronsa: yeah I'd vote for that
12:17ohpauleezjzinedine: Feel free to jump into #pedestal and ask questions as needed. The mailing list is also a good resource
12:18ohpauleezjzinedine: See this thread: https://groups.google.com/forum/#!searchin/pedestal-users/friend/pedestal-users/mt8qW_1AfBc/7LX_mlz0GmoJ
12:18ohpauleezthere are some examples linked
12:18arrdemBronsa: actually I don't think you need those two ifs at all in theory
12:18ohpauleezjzinedine: Maybe a little dated, but: https://github.com/simon-nicholls/friend-form-sample
12:20Bronsaarrdem: you do
12:21arrdemBronsa: no... really all that's doing is saying that the "empty" environment really isn't empty. You're preloading those two symbols into all contexts.
12:22Bronsaarrdem: *right now* they're needed
12:22jzinedineohpauleez thanks dude, now have a start point and know the way forward
12:22ohpauleezno problem! More than happy to help out!
12:23Bronsaarrdem: agreed that by changing the behaviour those can be eliminated, that's what I'm doing now
12:23mmeixhere is a "cosmetic" question (newbish, of course):
12:23mmeixgiven:
12:23mmeix,(def names [:c :d :e :f :g :a :b])
12:23clojurebot#'sandbox/names
12:24mmeix,(def pure-major [1 9/8 5/4 4/3 3/2 5/3 15/8])
12:24clojurebot#'sandbox/pure-major
12:24mmeix,(zipmap names pure-major)
12:24clojurebot{:b 15/8, :a 5/3, :g 3/2, :f 4/3, :e 5/4, ...}
12:24mmeixso the order gets random (I know, it doesn't matter for a map)
12:25mmeixbut this one gets me a prittier output:
12:25mmeix,(into {} (map vector names pure-major))
12:25clojurebot{:c 1, :d 9/8, :e 5/4, :f 4/3, :g 3/2, ...}
12:26mmeixis the order produced by zipmap expected to be random?
12:26hiredmanmaps are not ordered unless you use a map that explicitly says it is
12:27mmeixso sorted-map should be used, if that matters
12:28mmeixok
12:28mmeixthanks
12:30arrdemBronsa: random brainfiring as you're playing with that... should ns unmap itself?
12:32Bronsaarrdem: looks like it's actually not possible to map in-ns and ns, circular dep while bootstrapping
12:33arrdemBronsa: hum... I claim it can be done, been thinking about how to do it for Kiss/Oxlang for a while now
12:33arrdemBronsa: however I have no idea how to do it in 1.6 :P
12:34Bronsaarrdem: it can be done if creating a namespace + adding default mappings is not an atomic operation
12:34bcarrellmmeix: what you're seeing with your pseudo-ordering of your `into` example is the difference between PersistentArrayMap and PersistentHashMap. Add a few more values to your collections and try again and you'll see why ordinary maps cannot be trusted to be ordered in any way.
12:35clgvBronsa: did you ever notice that `ns` is evil. it claims itself to be loaded after it is evaluated though the functions of the namespace might not even be loaded. that's really nice for parallel `require` ;)
12:37mmeixbcarell aha - I see ... will try that - for the functionality I doesn't matter of course, or only if I wanted to create an ordered display of the map entries. Didn't know about PersistentArrayMap and PersistentHashMap though, thanks for that!
12:38Bronsaclgv: for some of definition of nice that approaces horrible, sure
12:39Jesterman81Hey guys/gals…anyone know why I might be getting CompilerException java.io.FileNotFoundException: Could not locate immutant/cache__init.class or immutant/cache.clj on classpath
12:40Jesterman81I’ve installed immutnat according to the docs and set it up in my .project.clj under .lein
12:40Jesterman81i mean profiles
12:42tcrawleyJesterman81: what version of Immutant is this? and what action are you doing to trigger that?
12:43Jesterman811.2.2 and trying to run lein autoexpect…also get the problem when I try and just compile the singe file
12:43Jesterman81I
12:43Jesterman81Im pretty new so I am probably doing something wrong
12:43Jesterman81i mean 1.1.4
12:43Bronsaarrdem: http://dev.clojure.org/jira/browse/CLJ-1582
12:43Jesterman81sorry wrong line
12:44jcrossley3Jesterman81: if you're new, you'll have a better experience with 2.0.0-alpha2. do you need 1.1.4?
12:44arrdemBronsa: looks good to me
12:45Jesterman81yeah, its an app that someone left behind and I am trying to wrap my head around some of the functions they created…hence trying to get unit tests around them
12:45arrdemso... why the three different tools for resolving something tho?
12:47Bronsaarrdem: don't ask me.
12:47arrdemBronsa: lol
12:50arrdemBronsa: TEJVM still at 0.1.0-SNAPSHOT?
12:52Bronsaarrdem: yeah, haven't had much time to test nothing broke w/ the recent t.a.jvm versions
12:56Bronsaarrdem: it *should* work fine but there are a couple of issues I want to solve in t.a.jvm before cutting another t.e.jvm beta
12:56arrdemBronsa: ooh NoSuchFieldError. Looks like you broke something :P
12:56Bronsaoh well.
12:56Bronsaarrdem: how did you get that?
12:56Bronsaarrdem: make sure you're using lastest t.a.jvm btw
12:57arrdemBronsa: `goto oxcart; lein test;` in tests/oxcart/passes/defs_test.clj
12:57technomancy"goto"??
12:57lazybottechnomancy: What are you, crazy? Of course not!
12:57arrdem$google arrdem zsh goto
12:57lazybot[Elvish – An experimental Unix shell in Go | Hacker News] https://news.ycombinator.com/item?id=8090534
12:58arrdemlol that's not it
12:58Bronsaarrdem: I'm 60% sure that's oxcart's fault
12:58Bronsaarrdem: I moved a bunch of passes to the emitter, it's possible that since oxcart is not updated it's not running those
12:59arrdemBronsa: that wouldn't surprise me
13:00Bronsaarrdem: but yeah, even if it broke I'm not going to look into it soon. need to fix the damn method matcher in t.a.jvm before
13:01arrdemBronsa: that's fine I don't have time to work on Oxcart anyway. If I do I'll just patch your shit <3
13:06tcrawleyJesterman81: sorry, I stepped away for minute.
13:06Jesterman81no prob, I think it has something todo with lein-autoexpect
13:07Jesterman81taking out the immutnant.cache and it will fails on immutant.messaging
13:07tcrawleywith Immutant 1, you have to add the Immutant artifacts as dependencies to your project.clj if you want to load the project outside of the Immutant container
13:07tcrawleyand, many of the fns will be no-ops, since the services they rely on aren't available
13:08tcrawleyif you have tests that rely on those services, you'll want to use `lein immutant test`
13:08Jesterman81got ya
13:08tcrawleywhich will spin up the container, deploy your app, run the tests, then shut it down
13:08tcrawleybut you won't have autoexpect functionality - each run is manual
13:09Jesterman81so I would be adding something like [immutant.cache] under dependecies in project.clj
13:10tcrawley[org.immutant/immutant-cache "1.1.4"]
13:10tcrawleyor [org.immutant/immutant "1.1.4"] to load them all
13:10Jesterman81thx a bunch for your help
13:10tcrawleymy pleasure!
13:10tcrawleythere's also #immutant if you want to join us there
13:10clojurebotNo entiendo
13:11Jesterman81i will check that out
13:11Jesterman81thx
13:12sdegutisI am finding that my JVM instance runs ridiculously slow on my EC2 instance.
13:28sritchiehey all, is anyone using sente’s csrf token feature?
13:28sritchieI’m getting a warning that the csrf token isn’t provided (makes sense since I haven’t given it one),
13:28sritchiebut sente seems to say that it does all this for yuo
13:28sritchieyou*
13:30sritchieah, I need a session store first
13:39TimMcsdegutis: Is it a t1.micro?
13:40sdegutisNope, m1.small
13:40sdegutisHas ~1.8 GB of memory, but can't find CPU specs.
13:41winksdegutis: I had that a while ago with php. have you tried just spinning up another one and replacing it? sometimes it's not really worth debugging
13:42sdegutiswink: Thanks.
13:42winkit's something you have to learn the hard way. treat them as ephemeral ;)
13:44sdegutisWe use EC2 for work with some pretty old settings, since it was set up in 2010 or 2011 and hasn't been changed since.
13:45sdegutisThis week I set up a personal website on a small DigitalOcean server and it's running like a charm. Much, much simpler overall.
13:45sdegutisGranted, my site is mostly static pages with a Sinatra app running in the background to accept payments (via Stripe) and generate licenses: https://tinyrobotsoftware.com/
13:48technomancyhow do you like stripe?
13:48sritchietechnomancy: stripe’s been great for us
13:48sdegutistechnomancy: Honestly I love it.
13:49sritchieI didn’t announce it, really, but I wrote this library that wraps the API: https://github.com/racehub/stripe-clj
13:49sritchiecore.async support, and schemas on all stripe types
13:49sdegutistechnomancy: We've used it at work (cleancoders.com) for about a 1.5 years now, and it's been really easy to use.
13:49technomancyI've been using square cash which is super great but only works for US cards
13:49sritchiecharge events, for example: https://github.com/racehub/stripe-clj/blob/develop/src/clj/stripe/charge.clj
13:49sdegutistechnomancy: And for my little side project, it made my store pays /much/ nicer than with FastSpring: https://tinyrobotsoftware.com/gistrecall/store.html
13:50technomancycool
13:50sdegutisI haven't made a single sale yet, but at least the store page is much prettier.
13:50dbaschsdegutis: I have jvms running on small instances, they run just fine
13:50sdegutiss/my store pays/my store page is/
13:50technomancyI really want to get off paypal for international orders
13:50danneusdegutis: that describes all my prjects
13:50sdegutis:D
13:51dbaschyou just have to make sure to set the jvm parametes right, and that you don’t get throttled by amazon because of too much resource usage
13:51technomancyI'd prefer something where I can initiate a charge by email like square cash, but this would still be a step up from paypal
13:51sritchiedoes clojurescript not have “update” yet?
13:52sdegutisCompare the old order form (https://sites.fastspring.com/tinyrobotsoftware/instant/appgrid) to the new one (https://tinyrobotsoftware.com/gistrecall/store.html) and honestly I'm quite happy to move from FastSpring to Stripe.
13:52zanesWhat’s the Clojure version of unfold?
13:52sdegutisPreviously the user had to enter address, city, state, zip code, and phone number. Now they don't!
13:53technomancyactually I'm not too sure collecting the billing data up-front is the best flow for me. better to get the order recorded and bill later right before it ships.
13:53sdegutistechnomancy: sounds good
13:54technomancyfewer steps between hitting the site and placing the order is best
13:54Bronsasritchie: https://github.com/clojure/clojurescript/commit/15fbbf5d63fbc860e0fe4f7d45c7f00a27ebc0ba
13:54sritchienice
13:54technomancyzanes: what is unfold?
13:55Bronsasritchie: no release yet though
13:55zanestechnomancy: A-la SRFI-1: http://srfi.schemers.org/srfi-1/srfi-1.html#FoldUnfoldMap
13:55zanesI’m guessing I’m just supposed to use lazy-seq for this kind of thing and roll my own?
13:56technomancyzanes: sounds like take-while+iterate
13:56zanesYeah, I was reaching for iterate.
13:56zanesThanks!
14:04EvanRis there a way to make printing out "sync", as it stands i keep getting a mixture of the precise pprint i want is not happening relative to the ones around it, and when it does, it prints half way and then prints an exception backtrace
14:05zanestechnomancy: In the case where f has side effects do I want to roll my own with lazy-seq instead?
14:06technomancyzanes: that's orthogonal to side-effects
14:06technomancyzanes: if you have side effects you shouldn't be using lazy seqs at all
14:06zanesI must be confused, then. iterate stipulates that f must not have side effects.
14:06zanesOh?
14:07zanesWhat would be more idiomatic?
14:07technomancydoseq or loop/recur typically
14:07justin_smithEvanR: you could use a proper logger (log4j, sl4j, timbre (which wraps those))
14:07EvanRok
14:08technomancyzanes: maybe construct a lazy seq of pure values with iterate and consume it and issue side-effects with doseq
14:08llasramEvanR: my vote would be clojure.tools.logging w/ log4j
14:08technomancyI don't know what you're doing really
14:08EvanRits really impressive of all the ways it could print wrong, its the one way that is most unhelpful to me
14:08justin_smithEvanR: Sometimes all it takes is changing (println a b c) to (println (string/join \space [a b c]))
14:09zanestechnomancy: Paging through an API. Getting the next URL to fetch requires issuing a HTTP request.
14:11technomancyzanes: gotcha. I am tempted to say that kind of network request shouldn't be counted as a side-effect.
14:11technomancyassuming it's a GET
14:11zanesIt’s a GET, yeah.
14:11zanesHmm.
14:12justin_smithtechnomancy: zanes: regardless, itereate is guaranteed in order, and doesn't retry, so side effects should be fine
14:18amalloyhttps://github.com/amalloy/useful/blob/develop/src/flatland/useful/seq.clj#L128 is the implementation of unfold in useful
14:18amalloyit uses useful's lazy-loop, so you can't just copy/paste the implementation, but of course you can add a dependency on useful
14:26david123987What's the best way to write gui applications in clojure?
14:27danneudavid123987: have you looked at https://github.com/daveray/seesaw?
14:29david123987I messed around with that library but I don't know swing elements in java to begin with, does an intellij like gui editor exist to make a gui?
14:29danneuclojure is not a hot candidate if you want that sort of tooling
14:31david123987ook, thank you!
14:31justin_smithdanneu: that said, you could use a standard swing GUI builder, and interact with the resulting java code via interop
14:33danneu:/
14:34justin_smith?
14:35danneujustin_smith: do you have java experience?
14:36justin_smithsome
14:37justin_smithenough to write some java code and then use it via interop
14:37danneuthe only java experience i have is what i've learned through having to interop with java libs from clojure. i wouldn't really know where to start
14:38danneui wonder if that is rare among people using clojure
14:38robhollandI don't think it is
14:39robhollandBut then I'm the same, so bias
14:39robholland+ed
14:39justin_smithdanneu: java is mind numbingly strightforward - it can be tedious, but it isn't hard
14:39justin_smithI learned clojure before I learned java, learned java in order to up my clojure game (and be a bit more flexible in the workplace)
14:59zanesWow. mapcat isn’t lazy?
15:00Bronsazanes: it is
15:01zanes(first (mapcat #(do (print %) [%]) '(1 2 3 4 5 6 7)))
15:01zanesThere’s something subtle going on here that I don’t understand.
15:01amalloyit's faiiiirly lazy
15:01noonian,(first (mapcat #(do (print %) [%]) '(1 2 3 4 5 6 7)))
15:01clojurebot12341
15:01zanesIs it the concat? Instead of lazy-cat?
15:02justin_smithlaziness isn't guaranteed conservative
15:02amalloyzanes: it's the apply combined with the concat
15:02amalloyas i recall
15:02zanesWould apply with lazy-cat fix my issue here?
15:02zanesOr is there some other way I want to do this?
15:02amalloywell like, you can't do that?
15:03noonianapply will realize the seq of args to evaluate each one for the function to apply
15:03amalloynoonian: it will realize as many elements as it needs to decide which arity to dispatch to. it certainly doesn't realize the whole thing
15:04amalloyzanes: you can write a version of mapcat that's less "flexible" but doesn't have this issue. i think this involves writing a version of concat with only one arity, and then a version of mapcat that uses your concat'
15:04noonianamalloy: but in the case of an n-arity fn it would right?
15:05amalloynoonian: that's not a specific enough question to answer. what does n-arity mean?
15:05noonian(fn [& args] ...)
15:05amalloyin that case apply does not realize any args at all
15:06Bronsaamalloy: it's the apply combined with map actually in this case
15:06noonianah i see, i mean the args will be realized when the fn is called because thats the semantics for fns?
15:06zaneshttp://dev.clojure.org/jira/browse/CLJ-1218
15:06amalloynoonian: only if the function needs them
15:06amalloy,(apply (fn [& args] nil) (range))
15:06clojurebotnil
15:07noonianhuh, thanks i didn't know it worked like that
15:07amalloyBronsa: are you sure? the jira issue zanes linked agrees with me re apply/concat
15:08Bronsaamalloy: it's map that has the 3+vararg arity, concat only needs to realize 2
15:08amalloy~source mapcat
15:09amalloyugh, you're right. i forgot that mapcat isn't unrolled at all
15:09amalloyif it were, this wouldn't be a problem
15:09amalloyor at any rate i'd be right and it'd only be a concat problem, not a map problem :P
15:10Bronsaamalloy: uhm I take it back.
15:10amalloyhurrah!
15:11zanesIs there something like the join from that ticket in core?
15:11zanesIt feels really weird that there’s no clear fix for this.
15:12Bronsaamalloy: looks like apply could be "lazier" then, it's seems to be realizing 1 more element than necessary
15:12amalloyBronsa: i don't think that's true
15:12Bronsaconcat has 2fixed+1vararg yet it's realizing 4 elements
15:13BronsaI would expect it to realize only 3
15:13amalloy~source concat
15:18Bronsaturns out I don't remember at all how the implementation of apply works
15:21Bronsa,(clojure.lang.RT/boundedLength (map println (iterate inc 0)) 2)
15:21clojurebot0\n1\n2\n3\n3
15:23sritchietechnomancy: when does the user.clj file get evaluated?
15:23sritchietechnomancy: I can’t seem to get cljx to run before that happens
15:24zanesI guess this is why aconcat exists in plumbing.core.
15:26zanes~source apply
15:26EvanRwhat is so lazy about lazy seq?
15:26EvanR,(first (map (fn [x] (+ 1 x)) [1 2 3 4 nil 6]))
15:26clojurebot#<NullPointerException java.lang.NullPointerException>
15:27Bronsaamalloy: http://sprunge.us/BBLh?clj
15:27Bronsawell
15:27Bronsahttp://sprunge.us/BBLh?diff rather
15:28trptcolinsritchie: https://github.com/clojure/clojure/blob/b01adb859c66322c5cff1ca9dc1ad98585f2cdc1/src/jvm/clojure/lang/RT.java#L447-L467 + https://github.com/clojure/clojure/blob/b01adb859c66322c5cff1ca9dc1ad98585f2cdc1/src/jvm/clojure/lang/RT.java#L329
15:28trptcolini don't think you're going to get around it unless you find a way to avoid loading RT
15:29sritchieyeah, I ended up doing what the pedestal team does, and having this in user.clj: (defn dev [] (require ‘dev) (in-ns ‘dev))
15:29sritchieand moving all my other code into dev.clj
15:29trptcolinyeah
15:29technomancysritchie: lein doesn't control user.clj; it's an undocumented clojure feature
15:29sritchiegotcha, makes sense after seeing the RT stuff
15:30Duke-EvanR: http://www.markhneedham.com/blog/2014/04/06/clojure-not-so-lazy-sequences-a-k-a-chunking-behaviour/
15:31EvanRthx
15:32EvanR"lazy sequences play badly with side effects" yeah that makes sense, but i guess errors now count as a side effect
15:32EvanRerrors, infinite loops
15:35EvanR"lazy sequences play badly with non-total code"
15:36EvanR,(first (map (fn [x] (+ 1 x)) [1 2 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 nil 6]))
15:36clojurebot2
15:42amalloy,(clojure.lang.RT/boundedLength nil 0)
15:42clojurebot0
15:42amalloy,(clojure.lang.RT/boundedLength () 0)
15:42clojurebot1
15:42amalloyweird world. i guess you're not supposed to call it with 0
15:46csd_have any of you guys done hacker school in nyc?
15:48Bronsa``amalloy kinda makes sense, vararg has at least 1 arg
15:50tuftfor the HID geeks -- my DataHand setup is coming along: https://www.dropbox.com/sh/74f80r0oyjy0au6/AABp0g68bb2ykfiHABfFxkEYa?dl=0
15:50jeremyheilerskdjfksdjfkdfjsdkfjksd~.
15:52TimMctuft: Nice.
15:52justin_smithjeremyheiler: "VG9#J9" ? what do you mean by "VG9#J9"?
15:52justin_smithhttps://www.refheap.com/90612
15:54jeremyheilerjustin_smith: lol sorry
15:54justin_smithnp, I was just joking anyway
15:54jeremyheilermy ssh connection died, hence the ~.
15:55justin_smithI just coincidentally have a silly function that "encodes" and "decodes" asdfjkl;-speak
15:55jeremyheilerlol nice
15:55justin_smithyour message is safe, if the adversary mistakes it for random pounding on a keyboard
15:56justin_smith* not recommended for any actual cryptographic or opsec usage
16:02sdegutisIs clojured.typed stable or complete yet?
16:03justin_smithcore.typed? definitely not complete, I don't know about the stability, though ambrosebs probably has a good answer.
16:03aperiodicgo dork
16:03aperiodicoops
16:04sdegutisaperiodic: Ah, you read that thread too?
16:04sdegutisjustin_smith: Thanks.
16:08ambrosebssdegutis: It supports the main clojure idioms
16:08ambrosebssdegutis: it's relatively easy to port core.typed code from 0.2.* to 0.2.72
16:08ambrosebsso the last year has been "stable"
16:09ambrosebsmostly backwards compatible changes
16:09ambrosebsdefinitely not complete.
16:10mearnshany way i can preserve metadata here? https://www.refheap.com/92875
16:20sdegutisWho makes refheap.com ?
16:21arrdemmearnsh: you could define a wrapper to map that preserves metadata in the single sequence update case, but generally that doesn't make sense
16:21arrdem(defn update-map [update-fn seq] (with-meta (map update-fn seq) (meta seq)))
16:22arrdemprobably a better name for that too... updating-map perhaps.
16:23amalloysdegutis: Raynes
16:24RaynesOh dear
16:24RaynesWhat have I done now
16:24arrdemRaynes: you dared draw breath
16:44mearnsharrdem: alright, guess i ought to rethink
16:45arrdemmearnsh: I would be careful about whether your "metadata" is really data or not
16:45arrdemmearnsh: metadata should only be things you can stand throwing away... if you need to be able to get it back then it's data not meta
16:46mearnshok that makes sense yeah
16:46mearnshi'll rejig my data
16:48ingsocHi, what is the current goto clojure book
16:51justin_smith~books
16:51clojurebotbooks is http://www.pragprog.com/titles/shcloj/programming-clojure
16:51postpunkjustiningsoc: there are some good choices out there, but I wouldn't say any really qualifies as "the current goto book" in general
16:51postpunkjustinI like Joy of Clojure for a fast-paced overview for people with some relevant experience
16:52postpunkjustinClojure in Action is a little more detailed and geared towards real-world applications
16:52technomancy~book
16:53clojurebotbook is programming clojure
16:53technomancy~books
16:53clojurebotbooks is http://clojurebook.com/ http://joyofclojure.com/
16:53technomancy^ my favourites
16:53justin_smithgood old indeterminate factoids
16:53arrdemJoC is good
16:53postpunkjustinI think the O'Reilly book is a terrible way to get started, but indispensable later on
16:53ingsocis JOC a bit more academic ?
16:54justin_smithingsoc: not academic, but more assuming of lisp background
16:54ingsocClojure Programming
16:58mearnshingsoc: the 1st ed. of JoC introduces a toy SQL DSL on page 9
16:58mearnshthe 2nd ed. (just picked up a copy) goes into core.logic
16:58mearnshfor example
16:59mearnshit's a bit different but very good (so far). but an absolute beginner might feel out of their depth
17:02ingsocI wanted to learn a new language and had narrowed it down to Ocaml and Clojure. I have just tried to get started with Ocaml and it was just not as smooth as clojure seems.
17:02ingsoctooling and the eclipse plugin seems better/more mature for clojure
17:03ingsocwhat are the key features of clojure that stand out from other languages ?
17:03technomancylearn them both; they're both very useful for different things
17:04technomancysince clojure is on the jvm its strengths are for server-side applications
17:04technomancyit has a much bigger community and library selection than ocaml
17:04ingsocclojurescript interests me also
17:05technomancylearning clojurescript without knowing clojure appears to be very difficult from what I've observed on irc
17:05ingsoc(which i assume clojure is a good stepping stone)
17:08wombawombaIs there a nicer way to do the following?
17:08wombawomba(vec (filter identity [(when cond1? var1) (when cond2? var2)]))
17:11mgaare(cond-> [] cond1? (conj var1) cond2? (conj var2))
17:12wombawombaneat
17:17amalloy`(~@(when cond1? [var1]) ~@(when cond2 [var2])) works too
17:18noonianor the original with filterv
17:26mgaarefwiw cond-> is the fastest :D
17:56SagiCZ1is there a subvec for lists?
17:56SagiCZ1(foo '(4 5 3 2 1) 1 3) --> '(5 3)
18:01amalloySagiCZ1: no. it exists for vectors because it's free: they support indexed access, so a "narrowed" view is cheap. lists don't
18:02joeltwhat structure allows adding an element to the beginning of the list in O(1) time?
18:02joeltplain ol' list?
18:03arrdemjoelt: cons
18:03arrdem&(cons 1 (cons 2 nil))
18:03lazybot⇒ (1 2)
18:03SagiCZ1amalloy: that reasoning is so weird though.. i thing there are functions in clojure that have different performance for different datastructures
18:03SagiCZ1*think
18:04arrdemjoelt: note that it's not really "add", it's "returns a new list sharing the old list as a tail"
18:04akkadclojure:Common Lisp Only Just Uses Recursive Expressions
18:04justin_smithSagiCZ1: in general that is avoided
18:04SagiCZ1and then there are functions that actually DO diffrent things for diffrent data structures like conj
18:05SagiCZ1if i come back later and change my vectors to lists for some reason, i break every conj call
18:05justin_smithSagiCZ1: and this is explicitly so it can do the most efficient thing with each kind of arg
18:06SagiCZ1justin_smith: it just seems like such an odd idea.. maybe i just didnt benefit from it yet
18:09joeltso, i'd need to use Java LinkedList to ensure saneness?
18:09amalloySagiCZ1: not very many. nth is the only common one, and it's kinda a weird function in various ways
18:09justin_smithjoelt: who said anything about LinkedList?
18:09justin_smith,(list 1 2 3)
18:09clojurebot(1 2 3)
18:09joeltwell, if i don't want it recreating the structure so i have control over it.
18:10joelti really want to know its inserting at the beginning, and i have an O(1) time function.
18:10amalloyjoelt: using a mutable linked list doesn't sound terribly sane unless you're in some unusual circumstances
18:10joeltim optimizing at this point.
18:10amalloycons always adds to the front of a sequence, and is always constant time. it doesn't do any copying, but it doesn't do any mutating either
18:11amalloyit gives you a new list which is longer by one than the input list was
18:11joeltamalloy: k' that's good enuogh for me, just didn't know where this is doc'd
18:12amalloyjoelt: fwiw the source of cons is like (defn cons [x coll] (clojure.lang.Cons. x (seq coll))), which is pretty clearly constant time: one call to seq, and one constructor invocation
18:16TimMcunless coll is something awful
18:17TimMcBut then, everything is constant time with a long enough time horizon. All your works will eventually crumble to dust.
18:18TimMcO(zymandias)
18:18justin_smithO(zymandius)
18:18justin_smithlol
18:18TimMcha!
18:18arrdemhaha
18:18joeltall we are is dust in the wind.
18:18arrdem(inc TimMc)
18:18lazybot⇒ 78
18:18arrdemread that yesterday for class..
18:18annelieshi
18:19technomancylook upon my data structures, ye mighty, and despair.
18:19TimMcjustin_smith: I'm pretty proud of that and don't at all mind that the joke was (apparently) inevitable and within easy reach.
18:19justin_smithheh
18:20technomancy(inc TimMc)
18:20lazybot⇒ 79
18:20TravistyO(zymandias) is awesome
18:20Travistytechnomancy: :D
18:25justin_smithTimMc: I was foolish enough to think I figured that gag out myself.
18:37hyPiRionClojure, where O(log n) is O(1)
18:37arrdemhyPiRion: still on the immutable vector kick I see :P
18:37hyPiRionYeah. I feel like I'll never end that series
18:38arrdemyeah no I'm with you on the log(n) is effectively constant thing
18:43hyPiRionYeah – At some point Big-O notation isn't that helpful in and of itself
18:43TimMcjustin_smith: Well, it wasn't planned on my part. The only planning was actually looking up the spelling.
18:43justin_smithhah
18:44arrdemI do like T notation, but O/o/Ω/ω have very specific meanings :P
18:45justin_smithhyPiRion: arrdem: the approach "clojure high performance programming" takes is to notate it as O(log₃₂n)
18:45justin_smithwhich I have definitely seen objections to
18:46arrdemjustin_smith: that's technically correct, what's not correct is the assertion that "Oh it's log₃₂, so it's T(6) in the worst case
18:46arrdemor even "Oh it's T(6) in any reasonable case"
18:47arrdemsure I could fill Stampede's memory with a T(10) or smaller tree, but that's not the point
18:47hyPiRionjustin_smith: right, persistent data structures aren't exactly fit for HPC
18:48justin_smithbrb downgrading cider
18:52technomancywe'll send a search team if we don't hear back
18:53AeroNotixdamn CIDER is so bad for upgrading
18:53AeroNotixit literally breaks every release
18:53technomancyfool me once, shame on you...
18:54AeroNotixtechnomancy: what am I supposed to do? I do like to keep updated..
18:54arrdemhehehe
18:54AeroNotixI just git reset when I upgrade
18:54technomancyAeroNotix: why?
18:54AeroNotixtechnomancy: new features, obsession :)
18:54arrdemtechnomancy: because most upgrades fix bugs, not add them :P
18:54AeroNotixhaha
18:54AeroNotixYeah but CIDER really went downhill after 0.5
18:54technomancyAeroNotix: eventually you will develop the correct pavlovian response
18:54technomancyoh, and 0.6 worked fine too
18:55AeroNotixI just update when I get bored, try to open a project and then git reset my .emacs.d
18:55justin_smithtechnomancy: testing that now, I just checkout out 0.6.0
18:55AeroNotixThink I'm on 0.8 with some workflow workarounds
18:55AeroNotix0.5-0.6 was dreamy
18:56technomancyit's a lucky coincidence that 0.6 was the last version to be released on marmalade
18:58justin_smithWOOOOO
18:58justin_smithfinally, I can do a defrecord in a repl inside emacs
18:58justin_smithand my argument hinting is back
18:58justin_smithand tab completion is working again too
18:58AeroNotixsigh
18:58justin_smith(inc cider-0.6.0)
18:58lazybot⇒ 1
18:59AeroNotixyeah I might downgrade
18:59Bronsait has never stopped working using slime.
18:59justin_smithAeroNotix: all the featuers I actually rely on are working now, finally
19:00AeroNotixI've been writing far too much Erlang recently, not enough Clojure.
19:06AeroNotixhttps://github.com/AeroNotix/crap/commit/089bfd9b62a08c956fa2dc288214ce220d8f7789
19:07andyfIs this T(6) notation explained somewhere, or what is the short version of its meaning?
19:08justin_smithAeroNotix: my I suggest a backronym like Convenient Resources And Procedures ?
19:09andyfI find emacs clojure-mode to be rock solid :-)
19:09justin_smithandyf: I think this http://mathworld.wolfram.com/Big-ThetaNotation.html
19:09justin_smithandyf: clojure-mode is great
19:09justin_smithcider is another thing entirely
19:09BronsaI have frozen my clojure-mode checkout
19:10Bronsathe lastest versions have weird syntax highlighting :(
19:10justin_smithBronsa: at that point you may as well clone and branch, right?
19:10justin_smiththat's what I did with cider - I check out different tags to try other versions
19:10arrdemandyf: yeah T(n) is a Θ bound with an error of 0. http://en.wikipedia.org/wiki/Big_O_notation#Use_in_computer_science the T(n) presented here is OK for instance in that it's not an O(N) bound and reflects the algorithmic constants
19:11andyfBut why are folks here distinguishing T(10) and T(6) above, or is that a joke?
19:11Bronsajustin_smith: meh. it works fine for me as is, I see no point in bothering with keeping it up to date with my own changes
19:11arrdemandyf: because the point of T is that it _includes_ all constants rather than discarding them as O does
19:12Bronsajustin_smith: I use git submodules for all the modes I use, it's not hard to freeze one to a checkout
19:12justin_smithBronsa: as in, your own git repo for all elisp stuff
19:13Bronsahttps://github.com/Bronsa/.emacs.d/tree/master/lib
19:13justin_smithright
19:13justin_smithas long as you never have to deal with a merge conflict in a .elc file, more power to your :)
19:13Bronsaheh
19:14Bronsathe only annoying thing is that I have to deal with pulling dependencies by hand
19:14andyfarrdem: If it includes all constants but no units, it is as vague as O :-)
19:16Bronsaif anybody was following the discussion on apply's lazyness before btw, I've opened a ticket w/ patch http://dev.clojure.org/jira/browse/CLJ-1583
19:16justin_smitharrdem: andyf: haha, I can't believe I actually thought "I know, I can jump to info about this notation in that page by searching for 'T""
19:17Bronsajustin_smith: reminds me of when I grep for "ns" in Compiler.java
19:17justin_smithhah
19:20SagiCZ1could anyone help me find memory leak?
19:21justin_smithSagiCZ1: maybe - first thing is I recommend using a profiler
19:21justin_smith~profiler
19:21clojurebotExcuse me?
19:21SagiCZ1well.. i guess i know what object is being created, i just dont know why isnt it being GC'ed, who is holding some references to it
19:22justin_smithSagiCZ1: feel free to share a refheap of the code
19:22SagiCZ1ok
19:23SagiCZ1https://www.refheap.com/92888
19:23andyfI wonder if there is a modified implementation of persistent data structs that use more of each cache line fetched, to reduce number of cache lines fetched in worst case, or avg case?
19:23andyfI think right now they often use only a small part of each cache line fetched
19:23SagiCZ1once i start moving the slider, the :change fn is getting called.. and it is creating ChartPanel on each :change.. but i would think the old ChartPanels should get scraped..
19:24SagiCZ1maybe it is some internal seesaw thing
19:25justin_smithSagiCZ1: are you sure the memory isn't being reclaimed? are you hitting some limit?
19:26SagiCZ1justin_smith: it throws java.lang.OutOfMemoryError, java heap space
19:26SagiCZ1and i can see the process eating up the memory when i move the slider
19:26justin_smithOK
19:26justin_smithyeah, so it is definitely happening
19:27justin_smithSagiCZ1: maybe the panel still holds references to all the old ChartPanel instances
19:27justin_smitheven though you cannot see them?
19:27justin_smithI don't know swing / seesaw well enough to verify or not
19:28SagiCZ1yeah, it seems like it.. is the author of seesaw regular here by any chance?
19:28justin_smithPerhaps you need to keep the ChartPanel and mutate it instead of creating new ones
19:28justin_smith$seen daveray
19:28lazybotI have never seen daveray.
19:28SagiCZ1justin_smith: that might be a solution, i just have to find how it can be mutated
19:28justin_smithSagiCZ1: he's on twitter with that nick
19:29justin_smithhttp://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/ChartPanel.html
19:29SagiCZ1thank you
19:30justin_smithSagiCZ1: maybe you want the .setChart method?
19:30justin_smithor maybe you need to mutate the chart itself http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/JFreeChart.html
19:30SagiCZ1profiler says i have 700 MB worth of int[] .. interesting
19:31justin_smithI bet the chart graphics are in int arrays
19:31SagiCZ1justin_smith: yeah mutating the chart was the first obvious solution, it just doesnt work with this particular rendering, so i thought i could keep swapping the charts.. it works pretty well until it hits the memory limit
19:32justin_smithSagiCZ1: there is a paint or repaint function, right? maybe with a ! in the name
19:32justin_smiththe JFreeChart class has a .draw method if nothing else
19:33SagiCZ1yes there is one for every swing component
19:33justin_smithmutate chart, invoke .draw
19:33nestastubbsok, so, how much code can I write while babysitting hcarge is asleep. must type really quiet
19:33nestastubbsand can't set off the emacs bell!
19:33justin_smithnestastubbs: woah, you leave the audible bell on?
19:35nestastubbsjustin_smith: it's like "Operation" around here 8)
19:35nestastubbsI live in a permanent define-kbd-macro!
19:37justin_smithnestastubbs: the first thing I do when setting up a new computer is turn off every audible alert
19:39andyfI bet sorted maps and sets could be made much more cache friendly, by branching by 32 per node rather than 2
19:41justin_smithandyf: that's what vectors already do, right?
19:43Bronsajustin_smith: I believe phms do too
19:45TEttingerIIRC, the persistent hash maps use a 32-branch (not sure the term) trie
19:45EvanR,(eval ('''A))
19:45clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn>
19:46EvanRin pm i got java.lang.SecurityException: You tripped the alarm! eval is bad! instead
19:47justin_smith,('''A)
19:47clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn>
19:47justin_smiththat's your issue
19:47justin_smith,'('''A)
19:47clojurebot((quote (quote (quote A))))
19:48TEttinger,(eval (read-string "(+ 1 2 3)"))
19:48clojurebot6
19:49EvanRoh
19:49EvanR,(eval '''A)
19:49clojurebot(quote A)
19:49EvanRk
19:50SagiCZ1justin_smith: i found the problem, when i call (config! :center newpanel) seesaw just does panel.add(newpanel, constraint) from swing.. this does not remove or replace the old component.. the latest addition is shown, but all the old ones are still in the object tree
19:50justin_smithSagiCZ1: aha - I suspected it might be something like that
19:50justin_smithso you could explicitly remove the old one
19:51justin_smiththough just mutating may be better, if you keep an immutible reference data that is updated cleanly
19:51SagiCZ1justin_smith: the thing is, i am not sure i can mutate it through seesaw
19:52justin_smithSagiCZ1: you don't have a handle to the object?
19:52justin_smithin my experience it works, you just have to make sure the right repaints all happen
19:52justin_smith(it's been a while though)
19:53TEttingerSagiCZ1: what you should be doing with seesaw is getting the right items with selectors
19:53SagiCZ1TEttinger: i am not sure i follow?
19:54TEttingerit's one of the things seesaw provides to get an element by an id or a class, a la CSS
19:54TEttingerhttps://github.com/daveray/seesaw/wiki/Selectors
19:55SagiCZ1TEttinger: and then do what with the object?
19:55TEttingerlike how this will disable a full sub-tree (config! (select my-panel [:*]) :enabled? false)
19:55SagiCZ1remove it and replace it right?
19:55TEttingeryou can use config! if you have the right thing
19:55SagiCZ1wicked
19:55justin_smithSagiCZ1: you get a direct reference to the object, you can use the update methods to just change it
19:57TEttingerone of the neat things about seesaw's selectors is that you can make some callback that updates an item it acquires using a selector, and then only later in the code define the item that will be acquired
19:57andyfSorry, phone battery ran out. Yes, it is more difficult for me to see how to make in sorted maps & sets more cache friendly, but the sorted ones are not as good in their implementation now
19:57SagiCZ1justin_smith: i hear what you saying, but the object is jfreechart, and updating it is a hassle..
19:57TEttingersimilar to ##(doc declare)
19:57lazybot⇒ "Macro ([& names]); defs the supplied var names with no bindings, useful for making forward declarations."
19:58andyfReplace "in sorted" with "unsorted" there, aka hashed
19:59SagiCZ1TEttinger: should this work? (s/remove! panel (s/select panel [:ChartPanel]))
19:59TEttingerwhere s is seesaw?
20:00TEttingerdoes the ChartPanel have an :id defined?
20:00SagiCZ1select doc says you can also select by simple class name
20:00arrdemjustin_smith: haha well done
20:00TEttingerI can't quite remember what [:the-button] does instead of [:#the-button]
20:00justin_smitharrdem: ?
20:00SagiCZ1TEttinger: it is :tag .. and it is class name of object you want to select
20:01TEttingeroh neat: A "tag" selector, e.g. [:JLabel] matches the literal Java class name (without package) of the widget type.
20:01arrdemjustin_smith: I'm 44 miutes ago
20:01justin_smithgot it, the O(zymandius) thing?
20:01arrdemjustin_smith: the "search for T thing"
20:01justin_smithahh, OK
20:01TEttingeryeah, that should work if your ChartPanel is one of the children of panel
20:01SagiCZ1TEttinger: nevermind, it actually works fine!
20:02TEttingersweet
20:02justin_smitharrdem: mathematics in general really eneds to work on its seo
20:02SagiCZ1wow this is...... great
20:02SagiCZ1i will probably later look into mutating the jfreechart directly but this should work for now
20:02TEttingercool, SagiCZ1
20:02arrdemjustin_smith: that could be said of programming in general too. symbolhound is a godsend.
20:03arrdemthinking of which I guess I can hack in Grimoire some now..
20:04justin_smithoff to search symbolhound for "T"
20:04SagiCZ1no crashes anymore.. i can see the heap rising in the profiler, getting knocked down by the GC but now i am not holding the old references so it can GC everything.. justin_smith, TEttinger: thanks again
20:05TEttingerglad to help!
22:05rritochHi, does anyone know how to get leiningen/clojure to output proper UTF-8 or UTF-16 in a windows console?
22:07justin_smithrritoch: the default is utf-8
22:07rritochjustin_smith: I'm not sure what the problem is, I'm getting output's of ?????? for russian
22:07justin_smithrritoch: and you are sure the input is utf-8?
22:08rritochUsing font Lucida Console, I've tried this with power shell and windows 8 shell, and they're both dumping the same garbage
22:09justin_smithslurp takes an encoding option, so you can tell it what the encoding of an input file is. Source files are assumed to be utf-8
22:09justin_smithwhere is the russian text coming from?
22:09rritochA website
22:09justin_smithcan you share the URL?
22:10rritochUnfortunatly no, I'm trying to see now if I can demonstrate the issue
22:10justin_smithrritoch: OK. I would double check the encoding in the page headers. It may be reporting the wrong encoding in the http headers?
22:12justin_smithrritoch: it is also possible to get the raw bytes from a string, and then get a string from those bytes, explicitly specifying the encoding
22:12justin_smith,(String. (.getBytes "☃") "UTF-8")
22:12clojurebot"☃"
22:12justin_smith,(String. (.getBytes "☃") "UTF-16")
22:12clojurebot"�"
22:13justin_smithso with some experimentation with encodings, you should find the re-interpretation that has the right output
22:20rritochjustin_smith: I'm not sure what's going on, but it's still outputing garbage, I verified using with-out-str that there's no transformation on clojure's side so I believe the problem is with the shell
22:21rritochGrumble
22:21justin_smithrritoch: what shell?
22:21rritochThis is really leiningen acting crazy (Windows 8)
22:22rritochEx. туда
22:22justin_smithI don't think lein does anything to text encoding at all
22:22rritochOutside leiningen I can paste that, but inside the REPL the paste is ignored
22:22justin_smithrritoch: odd
22:22justin_smithrritoch: what about java -jar path/to/clojure.jar
22:23rritoch,(print "туда")
22:23clojurebotтуда
22:23justin_smiththat will run a repl
22:23justin_smith(a very limited one)
22:23rritochIt won't though, thats my problem
22:23rritochIt runs on the bot though
22:23justin_smithit won't run a repl?
22:23rritochIt won't run in a repl
22:23justin_smithI am saying you can bypass lein
22:24justin_smithand just run the clojure jar with java, to rule out lein (or establish that lein is the problem)
22:24rritoch,(print (java.net.URLDecoder/decode "%D1%82%D1%83%D0%B4%D0%B0"))
22:24clojurebotтуда
22:24rritochHmm
22:24rritochIn my shell that outputs "????"
22:25justin_smithstandard windows console? putty?
22:25rritochStandard console (cmd.exe)
22:26justin_smithand things other than lein/clojure in cmd.exe display the same text properly?
22:27rritoch> echo "туда"
22:27rritochworks fine...
22:27justin_smithOK
22:27rritochThis has got to be a windows issue
22:27justin_smithtry java -jar clojure.jar
22:28rritochI'm going to try on linux to see if I get better results
22:28justin_smithpointing that at whereever your clojure jar is of course
22:28justin_smithrritoch: utf-8 in clojure / lein on linux just works for me, and always has
22:30rritochIn linux/putty it works fine
22:32rritochThis must be a bug in Java with how it interacts with stdout to windows console
22:32rritochLeiningen 2.3.4 on Java 1.8.0_20-ea Java HotSpot(TM) 64-Bit Server VM
22:32justin_smithrritoch: have you tried running the clojure jar directly without lein yet?
22:33rritochNo but running this outside leiningen isn't an option
22:33justin_smithrritoch: no, just try running clojure.jar, that will start a repl
22:33justin_smithand you can see if that text is handled properly in that repl
22:37rritochIt didn't help but this time the result was crazy
22:37justin_smithso a clojure and/or jvm bug?
22:37rritochRunning repl from clojure directly I was able to paste in the туда
22:37rritochI ended up with ....
22:37justin_smithOK
22:37rritochuser=> (print "туда")
22:38rritoch????nil
22:38justin_smithwasn't that pretty much what you got before? the nil is the return value of the print
22:38justin_smith,(print "???")
22:38clojurebot???
22:38justin_smithoh, clojurebot does not show the return value
22:38justin_smith&(print "???")
22:38lazybot⇒ ???nil
22:39rritochIt was an improvement, slightly, because with leiningen I couldn't paste in the russian text, with clojure.jar I could, but the output is the same
22:40rritochSo the problem is either with Java or Windows
22:42rritochI get the same ??? using (.println System/out "туда")
22:43rritochSo this isn't really a clojure problem, the bug is inherited from Java.
22:50justin_smithrritoch: I am amazed someone did not find that - I guess it doesn't show up in an IDE?
22:51rritochI have no idea, I'm trying to figure out what encoding the system is trying to use now though
22:54rritochI guess I can't, System/out is a java.io.PrintStream but doesn't export any method to access the charset it's using
22:54justin_smithhttp://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html here's a list of possible encodings to try
22:55justin_smith,(String. (.getBytes "☃") "ISO-8859-1") ; etc.
22:55clojurebot"☃"
22:58rritochHmm
22:58rritochI think I found the problem
22:58justin_smithdo tell
22:58rritoch,(.getProperty (System/getProperties) "file.encoding")
22:58clojurebot#<SecurityException java.lang.SecurityException: denied>
22:58rritochBah
22:58rritochAnyhow, on my machine that is responding with Cp1252
22:59justin_smithaha
22:59justin_smithyeah, that would likely be a problem :)
22:59justin_smithbtw (System/getProperty "file.encoding") does the same thing
23:00justin_smithI totally should have thought of that one
23:00justin_smithslipped my mind
23:00rritochDamn geolocation!
23:00justin_smithit likely gets that from the registry?
23:00arrdemcan core.logic contain repetitions of facts?
23:01justin_smithrritoch: does (System/setProperty "file.encoding" "UTF-8") magically fix it?
23:01arrdemnever mind that doesn't make any sense
23:01justin_smithworth a shot maybe :)
23:02rritochSadly no
23:02rritochBut at least I'm closer to a solution
23:03justin_smithrritoch: in that case, if what you are getting is actually UTF-8, but is being misenterpreted, then the (String. s "UTF-8") trick should fix it
23:04justin_smith,(String. (.getBytes "☃") "UTF-8")
23:04clojurebot"☃"
23:04rritochNo, output is still garbage
23:04justin_smithor maybe not - because the conversion from your system encoding to java's native encoding likely breaks something already
23:05rritochBecause System/out charset is set when Java starts
23:05justin_smithwhat about putting it in a file, and specifying (slurp f "UTF-8")
23:05rritochI just need to change the default or jack leiningen to set the file encoding from the command line
23:49rritochI tried adding "set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8" to the top of lein.bat and it still doesn't output properly.
23:50justin_smithI usually use -DJAVA_OPTIONS=-D...
23:50justin_smithfor setting system propterties
23:51rritochIt set the system property, but the output was still mangled
23:51justin_smitherro, I mean JAVA_OPTIONS=-D...
23:51justin_smithright, I mean using JAVA_OPTIONS so it is set at startup
23:51justin_smithJAVA_TOOL_OPTIONS I am unfamiliar with
23:51rritochIt is this stupid geolocation, I swear microsoft intentionally fubar's their apps when used outside their big $$$ regions
23:53rritochI don't have this problem from linux so I'm writing it off as a windows bug
23:55rritochI don't even speak Russian anyhow, but there are no Russian programmers on our team so I'm stuck with this mess.
23:59rritochThis code is working properly in JavaFX so it isn't a big problem, but it isn't maintainable since all console output is garbled.