#clojure log - Nov 07 2014

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

0:00 jimrthy: And I'm sure it's something stupid I'm doing (like trying to run it through wildfly)

0:03 technomancy: I'll try redeploying that version. Thank you for everything you've done for the community!

0:03 technomancy: sure. =)

0:04 you can test it without redeploying though

0:04 just run java -cp my-uberjar.jar clojure.main

0:04 and call clojure.java.io/resource there

0:07 bodie_: can someone help me make sense of mapv? I just need a very simple example

0:07 all the examples I've seen are a little too fancy to grasp

0:08 ,(mapv #(+ 2 %) [1 2 3] [4 5 6]) ; I expected this to eval to [[3 6] [4 7] [5 8]]

0:09 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox/eval26/fn--27>

0:10 TEttinger: bodie_: it's the same as map, it jist returns a vector

0:10 map can take multiple collections, and if it does, the fn you pass to map is expected to take 2 args

0:10 bodie_: ah

0:11 ohh, I see

0:11 TEttinger: ,(mapv #(vec (+ 2 %1) (+ 2 %2)) [1 2 3] [4 5 6])

0:11 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/vec>

0:11 TEttinger: ,(mapv #(vector (+ 2 %1) (+ 2 %2)) [1 2 3] [4 5 6])

0:11 clojurebot: [[3 6] [4 7] [5 8]]

0:12 TEttinger: the vector is just needed because #() syntax doesn't let you return something with just [] like a normal fn

0:12 ,(mapv #(fn [a b] (+ 2 a) (+ 2 b)]) [1 2 3] [4 5 6])

0:12 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>

0:12 TEttinger: ,(mapv #(fn [a b] [(+ 2 a) (+ 2 b)]) [1 2 3] [4 5 6])

0:12 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox/eval130/fn--131>

0:12 TEttinger: ,(mapv (fn [a b] [(+ 2 a) (+ 2 b)]) [1 2 3] [4 5 6])

0:12 clojurebot: [[3 6] [4 7] [5 8]]

0:12 TEttinger: gah

0:12 bodie_: gotcha

0:12 TEttinger: that does it though

0:13 bodie_: err

0:13 ,(mapv #(+ %1 %2) [1 2 3] [4 5 6])

0:13 clojurebot: [5 7 9]

0:13 bodie_: :)

0:13 TEttinger: yep!

0:13 bodie_: makes sense now!

0:13 thanks

0:13 TEttinger: you could also use there:

0:13 ,(mapv + [1 2 3] [4 5 6])

0:13 clojurebot: [5 7 9]

0:14 bodie_: nice

0:17 TEttinger: ,(mapv #(mapv (partial + 2) %&) [1 2 3] [4 5 6])

0:17 clojurebot: [[3 6] [4 7] [5 8]]

0:17 TEttinger: that is fun.

0:20 %& 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

0:22 ,(#(str %1 ", " %2 "...aaaaaand... " (clojure.string/join ", " %&)) "cat" "dog" "bird" "mouse")

0:22 clojurebot: "cat, dog...aaaaaand... bird, mouse"

0:22 Wild_Cat: neat.

0:22 TEttinger: I learned it from trying to understand swearjure

0:22 ~swearjure

0:22 clojurebot: swearjure is the intersection of clever and terrible

0:23 TEttinger: $google hyPiRion swearjure

0:23 lazybot: [Swearjure - Clojure without alphanumerics - hyPiRion] http://hypirion.com/musings/swearjure

1:01 andyf: technomancy: One less Leiningen plugin that can only be invoked from the command line (Eastwood can now be run from REPL).

1:01 justin_smith: andyf: aesome

1:02 rpaulo_: hahh

1:02 that's brutal

1:23 andyf: Oddity: 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?

1:23 Ugh. I should figure out how to disable smart quotes in this irc client permanently.

1:24 justin_smith: andyf: I think it's like is-thrown-with-message in the is macro

1:24 yeah

1:24 opqdonut: that's because try is the special form, and catch is just a random symbol that try happend to interpret in some way

1:24 *happens

1:25 andyf: opqdonut: And yet both try and catch are in the list of special symbols Clojure keeps in clojure.lang.Compiler/specials

1:25 ,clojure.lang.Compiler/specials

1:25 clojurebot: {& 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>, ...}

1:25 andyf: oops

1:25 ,(keys clojure.lang.Compiler/specials)

1:25 clojurebot: (& monitor-exit case* try reify* ...)

1:25 andyf: Is clojurebot's *print-length* always that short?

1:26 justin_smith: andyf: yeah, but lazybot gives refheap links

1:26 &(keys clojure.lang.Compiler/specials)

1:26 lazybot: java.lang.SecurityException: You tripped the alarm! class clojure.lang.Compiler is bad!

1:26 justin_smith: bleh

1:26 andyf: Anyway, if you look really close, you can see both try and catch in the ...

1:27 no, just the catch :)

1:39 TEttinger: ,(clojure.string/join "; " keys clojure.lang.Compiler/specials))

1:39 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: string/join>

1:39 TEttinger: ,(clojure.string/join "; " (keys clojure.lang.Compiler/specials))

1:39 clojurebot: "&; 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"

1:49 godd2: could 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

1:49 in both, recur happens last, so isn't that the "tail position"?

1:50 justin_smith: godd2: you can't do the * 2 until the recur returns, in the first

1:50 godd2: so it isn't the tail, there is computation left to do

1:50 godd2: I see

1:50 justin_smith: to be in the tail position, there must be no more work to be done in the function

1:51 godd2: this often leads to "accumulator arguments", and a later reduction step

1:52 godd2: okay so recur can only be "inside" certain things then. is that a good way of thinking about it as a beginner?

1:52 like, it can be inside an if

1:53 justin_smith: godd2: it can be in an if, as long as all the if would do is return its value

1:53 godd2: 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

1:54 godd2: ah ok that makes sense

1:54 thank you

1:54 justin_smith: np

1:56 godd2: one more question. in the fizz-buzz example, is the recur recursively doing the loop on line 7 or the fizz-buzz function itself?

1:56 nvm, I see the parameter being passed, it must be the loop

1:57 justin_smith: godd2: yeah, recur will go to the innermost function or loop, moving out from where it is called

1:57 godd2: does it take arity into account when doing that?

1:57 justin_smith: nope, it goes to the innermost containing fn or loop

1:57 godd2: awesome thanks

2:51 nbeloglazov: Why cider uses :load-file nrepl op for code evaluation instead of :eval?

3:19 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 ?

3:24 katratxo: noncom: m] has joined #clojure

3:24 09:19:09 -!- dav__ [~david@unaffiliated/dav] has joined #clojure

3:24 09: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 ?

3:24 sorry about that

3:24 noncom: hehe :)

3:24 katratxo: noncom: https://github.com/flatland/drip https://github.com/technomancy/grenchman

3:26 noncom: uhhh.. not many options for windows.. i need osx/windows crossplatformity

3:27 katratxo: noncom: not sure if nailgun is clossplatform http://www.martiansoftware.com/nailgun/

3:28 noncom: well... if only grenchman provided for windows out-of-the-box...

3:48 andyf: noncom: 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

3:58 noncom: andyf: and that brings us to the questions like "why in the world is it written in ocaml???"

3:58 andyf: Because technomancy wanted to write an ocaml program

4:03 * nathan7 replaces noncom with a small piece of ocaml

4:05 katratxo: noncom: http://technomancy.us/170

4:08 noncom: yeah i know he likes it, but still...

4:08 thanks for the article link though, will read it now, looks interesting

6:15 reborgclj: Hello

6:15 noncom: if i start an nrepl server how do i send it some code for evaluation ?

6:15 reborgclj: can somebody explain me

6:15 ,(let [m {:a :b}] (identical? m (assoc m :a :b)))

6:15 clojurebot: true

6:16 noncom: sending {:op :eval :code "(+ 1 2 3)"} wont work...

6:16 reborgclj: I have the impression it is an implementation detail surfacing with identical? there, but could be wrong

6:17 noncom: reborgclj: per manual, identical? tests whether the object is the same... which is obviously true ini your case

6:18 reborgclj: noncom: then shouldn't

6:18 ,(let [m {:a 500}] (identical? m (assoc m :a 500)))

6:18 clojurebot: false

6:18 reborgclj: be similar?

6:18 clgv: noncom: do you really need a custom nrepl client?

6:19 noncom: technomancy mentioned that his ocaml nrepl client is approx 400-500 lines of code

6:20 noncom: clgv: 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

6:20 clgv: to justify the claim that full protocoll compliant nrepl client is not that easy to write

6:21 noncom: how about RMI and a clojure serialization lib (or EDN if that suffices)?

6:21 noncom: reborgclj: hmmm, well.. you can start from here: https://github.com/clojure/clojure/blob/clojure-1.6.0/src/clj/clojure/core.clj#L734 :)

6:22 clgv: ummmm... not sure, i just need to execute arbitrary clojure code from a scripts file.. will that work ?

6:22 reborgclj: noncom: always sensible thing to do :)

6:22 noncom: basically i have to do some file management and json file parsing, reading/writing and stuff like that

6:22 clgv: noncom: sure

6:23 noncom: clgv: so how would you go about it ? i just want to eliminate the jvm startup time by runing the daemon with an nrepl

6:23 clgv: noncom: 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

6:24 The relevante part of my RMI interface is: public interface Node extends Remote { void sendMessage(byte[] message) throws RemoteException; }

6:25 noncom: you are familiar with Java RMI?

6:25 noncom: sadly, I didnt have time to create a separate lib from it...

6:25 Glenjamin: reborgclj: assoc doesn't make a change if you assoc the same value to a key

6:25 noncom: clgv: only vagually familiar :)

6:26 clgv: your program seems interesting, why dont you make a lib.. :)

6:27 clgv: noncom: the whole thing will be release as a lib in 1-2 months - but the communication part is not separate so far

6:27 reborgclj: Glenjamin: apparently only if your value is interned (keywords and string literals)

6:28 Glenjamin: it's probably identity

6:28 noncom: clgv: looking forward for it, but then what could i do currently to be able to send some code for eval to a nrepl daemon ?

6:28 preferably from command line

6:28 Glenjamin: ,(let [a {:b 1} m {:a a}] (identical? m (assoc m :a a)))

6:28 clojurebot: true

6:28 clgv: noncom: summarizing, you don't need to know that much about RMI just how to define a remote object and how to startup the node

6:30 noncom: 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.

6:30 noncom: hmm a possible shortcut could be to use what ever reply is using as nrepl client

6:30 reborgclj: Glenjamin: if I remember correctly, I think also Integers up to a certain number are interned in Clojure

6:31 clgv: reborgclj: that would be new

6:31 reborgclj: clgv: actually it might be Java directly

6:31 clgv: reborgclj: or do you just mean constants?

6:33 reborgclj: clgv: ah here we go http://stackoverflow.com/a/10149985

6:34 clgv: reborgclj: if that is a Java compiler feature, Clojure probably does not have it

6:34 Glenjamin: reborgclj: the interning isn't the important bit, identity is important

6:34 but interned things have the same identity

6:34 $source assoc

6:34 lazybot: assoc is http://is.gd/r57EpC

6:35 reborgclj: Glenjamin: I think I understand it's identity and not equality, still it confuses me for the assoc I posted above

6:39 Glenjamin: reborgclj: 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

6:39 slighty deeper in that i expected, but the upshot is that if you try and assoc an identical value into the same key, nothing changes

6:40 perplexa: ,(clojure.string/split "abc" #".")

6:40 clojurebot: []

6:40 perplexa: this is a bug, right?

6:40 expected result is ["abc"]

6:40 ;/

6:40 Glenjamin: (doc clojure.string/split)

6:40 clojurebot: "([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."

6:40 perplexa: oh nvm

6:40 :D

6:41 Glenjamin: split doesn't include the splitted char - which is all of them

6:41 perplexa: yeah i forgot to escape the dot ;p

6:41 * perplexa facepalms :D

6:43 reborgclj: Glenjamin: I see, identical? is doing its job on object pointers but somehow assoc knows about it and

6:43 ,(let [m1 {:a :b} m2 (assoc m1 :a :b) m3 (assoc m1 :a :c)] (do (println m1 m2 m3)))

6:43 clojurebot: {:a :b} {:a :b} {:a :c}\n

6:43 perplexa: hmm what would be the best way to replace the first item of a vector?

6:43 reborgclj: something like this is returning the expected result (i.e. persistent data structures)

6:46 pyrtsa: ,(clojure.string/split "...abc.def" #"\.")

6:46 clojurebot: ["" "" "" "abc" "def"]

6:46 pyrtsa: ,(clojure.string/split "abc.def..." #"\.")

6:46 clojurebot: ["abc" "def"]

6:46 pyrtsa: ,(clojure.string/split "abc.def..." #"\." -1) ;; PROTIP!

6:46 clojurebot: ["abc" "def" "" "" ""]

6:47 perplexa: => perplexa | yeah i forgot to escape the dot ;p

6:47 the -1 is handy tho!

6:47 pyrtsa: The standard Java behaviour of split can be confusing at times. The magic constant "-1" changes the behaviour to what's more expected.

6:47 perplexa: (inc pyrtsa)

6:47 lazybot: ⇒ 9

6:48 pyrtsa: Bummer that clojure.string/split wasn't implemented with the better default.

6:49 perplexa: it's pretty inconsistent to have them at the beginning but not at the end ;p

6:50 ah, and i was looking for assoc ;x

7:01 noncom: clgv: 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

7:01 *one

7:01 now it works almost perfectly with sending files to it via cat|netcat

7:46 justin_smith: perplexa: iirc the newer jvm does not provide them at the beginning by default

7:48 perplexa: no, never mind, it must be something else I was thinking of

7:49 perplexa: heh

7:51 sam_: Hi!

7:52 Would someone please tell me heo I can setup clojure REPL in linux?

7:52 perplexa: is (list ...) preferable over (vector ...)? :P

7:52 sam_: get leiningen

7:53 justin_smith: perplexa: that really depeneds, there's a reason we have both

7:53 perplexa: 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.

7:53 otherwise, probably a list.

7:55 perplexa: just yielding tons of 2-item pairs that i just apply on to a function ;x

7:55 justin_smith: yeah, lists ar lighter weight for that

7:55 *are

7:56 perplexa: ty

8:13 clgv: noncom: ah ok

8:19 noncom: clgv: what about your lib though? what space to watch ?

8:22 sam_: perplexa: Could you explain a little more in detail.

8:23 clgv: noncom: not sure. probably an ML announcement

8:25 justin_smith: sam_: leiningen provides a shell script called lein

8:25 you can get it from leinengen.org

8:26 sam_: "lein repl" will download the dependencies and start a repl, "lein new name" will create a new project called name

8:26 sam_: 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.

8:26 clgv: justin_smith: someone should write that leiningen book ;)

8:26 justin_smith: sam_: you download the shell script, change it to executable, install it somewhere on your path, and run "lein repl"

8:27 those are literally all of the steps

8:27 clgv: hmm scala's SBT has a book

8:27 so how about "Leiningen in Action"?

8:27 justin_smith: hah

8:28 sam_: the setup is per project

8:28 sam_: there is very little global config, and you don't really need any global config of lein

8:29 sam_: one of the primary advantages with lein, is library versions, behavioral config, etc., are managed per project not per computer

8:30 rweir: sbt is absurdly complicated though, getting a preojctless lein repl is literally two steps

8:30 1) install the lein bootstrap script 2) lein repl 3) go to the pub

8:30 clgv: rweir: this was just an argument for a leiningen book ;)

8:31 justin_smith: 1.5) wait for all the downloads and the long clojure startup time :P

8:31 clgv: justin_smith: 4-5secs is fair for "lein repl"

8:31 outside a project in this case

8:31 justin_smith: clgv: the first time you run lein, it's a bit longer

8:32 clgv: justin_smith: yeah ok ;)

8:32 justin_smith: just a one time effort per "upgrade"

8:32 justin_smith: right

8:37 mavbozo: are there any implementations of clojure core.cache protocols in memcache or redis?

8:44 randomDOOD: Hi, is there any command to clear the screen while using REPL?

8:44 justin_smith: randomDOOD: have you tried Control-L ?

8:45 randomDOOD: justin_smith: thanks :D

8:46 * clgv just learned something new

8:48 justin_smith: clgv: 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

8:48 ,(def a 1)

8:48 clojurebot: #'sandbox/a

8:49 justin_smith: ,a

8:49 clojurebot: 1

8:49 clgv: justin_smith: yeah, in bash i usually type "clear <ENTER>" ;)

8:50 damn it works in my IM client as well

8:50 justin_smith: clear is different, because it also requests a scrollback buffer clear from the terminal iirc

8:50 clgv: just lost todays scrollback ;)

8:50 justin_smith: clgv: c-l is commonly respected, but just old enough to be obscure

8:51 clgv: well "lost" sounds dramatic which is not the case ;)

8:51 justin_smith: heh

8:54 (inc )

8:54 lazybot: ⇒ 2

9:06 randomDOOD: Hi! 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 :)

9:08 clgv: randomDOOD: have you tried out 4clojure.com?

9:08 justin_smith: randomDOOD: there is a tag in leiningen for issues that are good for a new contributer https://github.com/technomancy/leiningen/labels/Newbie

9:08 daniel__: randomDOOD: think of a project you want to build/would find useful

9:08 try and build it

9:08 hyPiRion: randomDOOD: 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

9:09 daniel__: 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

9:09 randomDOOD: hyPiRion: Well, As I am a little new to Clojure, I'd like to try out something simple.

9:10 justin_smith: randomDOOD: 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

9:11 and, bonus, irc bots are a great way to annoy your friends

9:13 daniel__: randomDOOD: i wrote a tac-tac-toe game when i was learning

9:13 hyPiRion: randomDOOD: 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

9:13 randomDOOD: daniel__: That seems like a good idea :)

9:14 daniel__: its a good exercise, you're often tempted to use mutable state if you come from other languages

9:24 justin_smith: $mail randomDOOD like this

9:24 lazybot: Message saved.

9:25 randomDOOD: :)

9:27 justin_smith: $botsnack

9:27 lazybot: justin_smith: Thanks! Om nom nom!!

10:15 mwfogleman: I wrote some ugly code the other day that I want to clean up. I did two assoc-ins in a row

10:18 the two assoc-in calls go to the same level of a map, so there's some redundancy there.

10:18 clgv: mwfogleman: so update-in + assoc? ;)

10:19 mwfogleman: oh, where assoc is the function passed to update-in?

10:19 great idea, clgv, thanks :)

10:19 clgv: ,(update-in {} [:my :deep :path] assoc :a 1 :b 2)

10:19 clojurebot: {:my {:deep {:path {:b 2, :a 1}}}}

10:19 clgv: hooray for chaining ;)

10:20 mwfogleman: clgv, that was really helpful, thank you. how would i adapt that to a case where there were two paths?

10:20 [:my :deep :path1] and [:my :deep :path2]

10:20 or something like that.

10:20 clgv: no that won't work

10:21 mwfogleman: mmm. luckily that is not the case i have now- but i was just wondering.

10:21 clgv: maybe 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:21 *whose

10:22 mwfogleman: ah yeah, that would make sense.

10:23 clgv: but a multi-arity assoc-in is possible as well. it is probably not implemented that way to be similar to update-in

10:25 mwfogleman: clgv: what kind of clojure projects do you work on?

10:25 clgv: mwfogleman: distributed computations and optimization algorithms

10:25 sometimes visualization of results as charts

10:26 mwfogleman: interesting. what do you use for the charts?

10:26 incanter?

10:26 clgv: I started with incanter but hated it that its charts are not composable

10:27 I started to implement my own chart lib.

10:27 jondot: hey guys. if you're looking for pair partners try this initiative by me :) https://www.hipchat.com/invite/197545/5f045eee8e66d972d8deabea79e8e83d

10:27 mwfogleman: clgv: interesting. do you use incanter for the stats stuff? is your chart lib open source?

10:28 clgv: mwfogleman: no, I mostly dropped incanter though I still have it as dependency for legacy code

10:29 the chart lib is not released so far. It is usable but I think I would rewrite it from scratch for better usability

10:29 mwfogleman: clgv: we have been looking into possibly using incanter, both for stats and graphing. i'd love to see your charts library.

10:30 clgv: adapting your example worked like a charm, thanks so much!

10:31 perplexa: can i combine partial and apply?

10:32 clgv: my 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:32 mwfogleman: ,(apply (partial + 2) '(+ 1 2 3))

10:32 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number>

10:33 clgv: perplexa: yeah why not? ##((partial apply +) (range 3))

10:33 lazybot: ⇒ 3

10:33 mwfogleman: ,(apply (partial + 2) '(1 2 3))

10:33 clojurebot: 8

10:33 mwfogleman: ooh, which one were you thinking, perplexa?

10:33 perplexa: sec

10:34 ,(map #(apply clojure.string.join "/" %) [[1 2] [3 4]]

10:34 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

10:34 perplexa: ,(map #(apply clojure.string.join "/" %) [[1 2] [3 4]])

10:34 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.string.join, compiling:(NO_SOURCE_PATH:0:0)>

10:34 perplexa: ,(map #(apply clojure.string/join "/" %) [[1 2] [3 4]])

10:34 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: string/join>

10:34 perplexa: waah

10:34 well join is a bad example cos it takes only 1 more param

10:35 mwfogleman: clgv: if you do end up rewriting your chart lib, where will i be able to find it?

10:36 perplexa: instead of join i have a function that takes 2 params, 1+2 and 3+4 in my example

10:36 (partial apply myfunc) wouldn't work, right?

10:36 clgv: mwfogleman: ah don't expect it before April 2015

10:37 mwfogleman: clgv: :D

10:37 clgv: mwfogleman: since the current one gets the job done and the important tasks keep me busy

10:37 perplexa: ,(map #(apply (fn [a b] (str a "/" b)) %) [["" 2] [3 4]])

10:37 clojurebot: ("/2" "3/4")

10:37 perplexa: ,(map (partial apply (fn [a b] (str a "/" b))) [["" 2] [3 4]])

10:37 clojurebot: ("/2" "3/4")

10:37 perplexa: oh nice ;p

10:38 clgv: perplexa: `apply` is just a higher order function ;)

10:38 perplexa: yeah don't mind my brain farts ;p

10:38 mwfogleman: perplexa: perfectly normal to have brain farts, you know.

10:39 it's the human condition.

10:39 :P

10:39 perplexa: :D

10:39 mwfogleman: clgv: do you have any code available online, charting lib aside?

10:39 i'd like to take a look at anything you have. :)

10:42 perplexa: what are you working on?

10:43 perplexa: mwfogleman: a framework to bootstrap and cleanup mrjobs

10:43 mwfogleman: mrjobs?

10:43 perplexa: map-reduce jobs

10:43 mwfogleman: ah, ok ok

10:51 TimMc: aka "Steve"

10:55 llasram: perplexa: What do you mean by "bootstrap and cleanup"?

10:56 perplexa: llasram: based on a config file and zookeeper state run cascalog aggregations with different source / sink taps

10:57 llasram: perplexa: You have existing Cascalog pipelines you want to manage through a higher-level scheduler?

10:57 perplexa: and 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:57 llasram: yea

11:15 EvanR: ,(if true 0 1)

11:15 clojurebot: 0

11:16 chrisdone: was just reading this http://blog.getprismatic.com/om-sweet-om-high-functional-frontend-engineering-with-clojurescript-and-react/

11:16 and https://github.com/swannodette/om/wiki/Cursors

11:16 how much do these cursors correspond to the concept of lenses?

11:17 perplexa: ,(complement true)

11:17 clojurebot: #<core$complement$fn__4178 clojure.core$complement$fn__4178@126984f>

11:18 perplexa: ,((complement true) 1)

11:18 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn>

11:18 perplexa: wat

11:18 ,((complement true?) 1)

11:18 clojurebot: true

11:18 perplexa: oh yeah. 1 != true :P

11:18 chrisdone: seems vaguely related

11:18 clgv: perplexa: yeah it is not true but truthy

11:18 perplexa: related to what happened before you joined tho

11:19 clgv: yeah

11:19 ,((complement true?) true)

11:19 clojurebot: false

11:19 perplexa: is what i meant anyway ;p

11:19 chrisdone: clgv: i prefer ``predicable'' =p

11:20 clgv: makes you sound sophisticated

11:25 dnolen_: chrisdone: only a little, I came up w/ them - inspired zippers & lenses - but they are neither

11:26 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:26 "inspired by zippers & lenses"

11:26 chrisdone: dnolen_: 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:27 dnolen_: chrisdone: there's a different React ClojureScript binding called Reacl that provides proper lenses

11:27 chrisdone: I'm not really interested in full lenses - but we'll probably step a little closer to them soon

11:29 chrisdone: dnolen_: cool =) i'm not that big on lenses, just a means to an end while i figure out the design space

11:36 technomancy: oh man it's a chrisdone. now I'll never keep my channels straight. =)

11:36 EvanR: yeah

11:37 get your peanut butter out of my jelly

11:40 Glenjamin: hrm, there doesn't sem to be any docs on the lenses used in reacl :s

11:50 noprompt: dnolen_: 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:55 dnolen_: noprompt: it's simpler/faster with finite domains

11:56 noprompt: dnolen_: will that work in cljs?

11:56 dnolen_: ah no

11:56 need to work on that

11:56 feature expressions!

11:56 noprompt: dnolen_: i noticed there are several namespaces that haven't been "ported" yet.

11:57 :)

11:57 dnolen_: noprompt: since you only have two elements you could use membero for this too

11:57 (membero a [true false])

11:58 couple this with disequality

11:59 noprompt: I'm curious what you are trying to do :) I don't know that many people use core.logic w/ CLJS

12:02 noprompt: dnolen_: 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:02 dnolen_: noprompt: ah k, you looked at DataScript?

12:02 jzinedine: hey guys, anyone used friend with pedestal? I'm looking for a sample project but couldn't find one.

12:03 noprompt: dnolen_: we have. our data is all hierarchical so it hasn't been in the cards yet. :/

12:03 dnolen_: I see

12:04 ohpauleez: jzinedine: I've seen a good number of projects that use Friend and Pedestal, but I don't think any of them are public

12:04 noprompt: dnolen_: as a side project i wanted to see if i could implement a version of the dada engine w/ it.

12:05 ohpauleez: Are you having a specific issue?

12:05 or you're just curious about the path forward?

12:05 noprompt: dnolen_: i could implement it w/o it no problem but i wanted to see how far i could push it.

12:05 dnolen_: i'm also still interested in applying the constraint based stuff to css with the cssom.

12:05 clojurebot: Cool story bro.

12:05 jzinedine: not a specific issue, I'm a newbie, thus looking for a seed project to guide me through

12:06 noprompt: dnolen_: mostly, i'm just getting through TRS, tbaldrid_ logic tutorials, and the sited papers (when i can digest them).

12:06 dnolen_: noprompt: yeah I've pondered CSS w/ core.logic a few times ...

12:07 noprompt: dnolen_: 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:09 edw: I 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:09 noprompt: dnolen_: what needs to happen to get the other nss ported to cljs?

12:10 Bronsa: edw: it happens for inlined functions but there's no way to turn that off

12:10 edw: not sure if that's what you're talking about though

12:10 technomancy: edw: there was also the ^:static experiment in 1.3 snapshot briefly

12:10 Bronsa: also in-ns and ns are not rebindable

12:10 technomancy: but it never made it into a release

12:11 edw: technomancy: Hmm. I'm `alter-var-root`-ing e.g. `+` yet `(+ 1 2)` doesn't eval the fn the var now contains.

12:12 jzinedine: ohpauleez should I write interceptors myself?

12:12 Bronsa: edw: it's because of :inline

12:12 arrdem: puredanger: is ^:static still 1.7 candidate material?

12:13 edw: Ah, yes, that.

12:13 Bronsa: ,(def in-ns 1)

12:13 edw: Frustrating my profiler library.

12:13 clojurebot: #<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>

12:13 puredanger: no. although there are no plans to revive ^:static as is afaik

12:13 Bronsa: oh come on

12:13 ohpauleez: jzinedine: 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:13 arrdem: puredanger: news to me. thanks.

12:14 Bronsa: there should really be an option to disable :inline

12:14 puredanger: arrdem: certainly still interest in faster var invocation paths, but doubt it will take the form of ^:static

12:14 but that work will be 1.8

12:14 ohpauleez: jzinedine: Well actually, all of those are mostly done by hand :) But there are a few that use `defmiddleware`

12:15 Once you do that, you're off to the races

12:15 Bronsa: https://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:16 jzinedine: ohpauleez thanks, I'll look into it, hope that I find my way

12:16 arrdem: Bronsa: oh so you can have local aliases of ns and in-ns

12:16 Bronsa: yeah I'd vote for that

12:17 ohpauleez: jzinedine: Feel free to jump into #pedestal and ask questions as needed. The mailing list is also a good resource

12:18 jzinedine: See this thread: https://groups.google.com/forum/#!searchin/pedestal-users/friend/pedestal-users/mt8qW_1AfBc/7LX_mlz0GmoJ

12:18 there are some examples linked

12:18 arrdem: Bronsa: actually I don't think you need those two ifs at all in theory

12:18 ohpauleez: jzinedine: Maybe a little dated, but: https://github.com/simon-nicholls/friend-form-sample

12:20 Bronsa: arrdem: you do

12:21 arrdem: Bronsa: 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:22 Bronsa: arrdem: *right now* they're needed

12:22 jzinedine: ohpauleez thanks dude, now have a start point and know the way forward

12:22 ohpauleez: no problem! More than happy to help out!

12:23 Bronsa: arrdem: agreed that by changing the behaviour those can be eliminated, that's what I'm doing now

12:23 mmeix: here is a "cosmetic" question (newbish, of course):

12:23 given:

12:23 ,(def names [:c :d :e :f :g :a :b])

12:23 clojurebot: #'sandbox/names

12:24 mmeix: ,(def pure-major [1 9/8 5/4 4/3 3/2 5/3 15/8])

12:24 clojurebot: #'sandbox/pure-major

12:24 mmeix: ,(zipmap names pure-major)

12:24 clojurebot: {:b 15/8, :a 5/3, :g 3/2, :f 4/3, :e 5/4, ...}

12:24 mmeix: so the order gets random (I know, it doesn't matter for a map)

12:25 but this one gets me a prittier output:

12:25 ,(into {} (map vector names pure-major))

12:25 clojurebot: {:c 1, :d 9/8, :e 5/4, :f 4/3, :g 3/2, ...}

12:26 mmeix: is the order produced by zipmap expected to be random?

12:26 hiredman: maps are not ordered unless you use a map that explicitly says it is

12:27 mmeix: so sorted-map should be used, if that matters

12:28 ok

12:28 thanks

12:30 arrdem: Bronsa: random brainfiring as you're playing with that... should ns unmap itself?

12:32 Bronsa: arrdem: looks like it's actually not possible to map in-ns and ns, circular dep while bootstrapping

12:33 arrdem: Bronsa: hum... I claim it can be done, been thinking about how to do it for Kiss/Oxlang for a while now

12:33 Bronsa: however I have no idea how to do it in 1.6 :P

12:34 Bronsa: arrdem: it can be done if creating a namespace + adding default mappings is not an atomic operation

12:34 bcarrell: mmeix: 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:35 clgv: Bronsa: 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:37 mmeix: bcarell 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:38 Bronsa: clgv: for some of definition of nice that approaces horrible, sure

12:39 Jesterman81: Hey 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:40 I’ve installed immutnat according to the docs and set it up in my .project.clj under .lein

12:40 i mean profiles

12:42 tcrawley: Jesterman81: what version of Immutant is this? and what action are you doing to trigger that?

12:43 Jesterman81: 1.2.2 and trying to run lein autoexpect…also get the problem when I try and just compile the singe file

12:43 I

12:43 Im pretty new so I am probably doing something wrong

12:43 i mean 1.1.4

12:43 Bronsa: arrdem: http://dev.clojure.org/jira/browse/CLJ-1582

12:43 Jesterman81: sorry wrong line

12:44 jcrossley3: Jesterman81: if you're new, you'll have a better experience with 2.0.0-alpha2. do you need 1.1.4?

12:44 arrdem: Bronsa: looks good to me

12:45 Jesterman81: yeah, 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:45 arrdem: so... why the three different tools for resolving something tho?

12:47 Bronsa: arrdem: don't ask me.

12:47 arrdem: Bronsa: lol

12:50 Bronsa: TEJVM still at 0.1.0-SNAPSHOT?

12:52 Bronsa: arrdem: yeah, haven't had much time to test nothing broke w/ the recent t.a.jvm versions

12:56 arrdem: 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:56 arrdem: Bronsa: ooh NoSuchFieldError. Looks like you broke something :P

12:56 Bronsa: oh well.

12:56 arrdem: how did you get that?

12:56 arrdem: make sure you're using lastest t.a.jvm btw

12:57 arrdem: Bronsa: `goto oxcart; lein test;` in tests/oxcart/passes/defs_test.clj

12:57 technomancy: "goto"??

12:57 lazybot: technomancy: What are you, crazy? Of course not!

12:57 arrdem: $google arrdem zsh goto

12:57 lazybot: [Elvish – An experimental Unix shell in Go | Hacker News] https://news.ycombinator.com/item?id=8090534

12:58 arrdem: lol that's not it

12:58 Bronsa: arrdem: I'm 60% sure that's oxcart's fault

12:58 arrdem: I moved a bunch of passes to the emitter, it's possible that since oxcart is not updated it's not running those

12:59 arrdem: Bronsa: that wouldn't surprise me

12:59 * arrdem berates Bronsa for releasing a patch version with breaking changes

13:00 Bronsa: arrdem: 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:01 arrdem: Bronsa: that's fine I don't have time to work on Oxcart anyway. If I do I'll just patch your shit <3

13:06 tcrawley: Jesterman81: sorry, I stepped away for minute.

13:06 Jesterman81: no prob, I think it has something todo with lein-autoexpect

13:07 taking out the immutnant.cache and it will fails on immutant.messaging

13:07 tcrawley: with 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:07 and, many of the fns will be no-ops, since the services they rely on aren't available

13:08 if you have tests that rely on those services, you'll want to use `lein immutant test`

13:08 Jesterman81: got ya

13:08 tcrawley: which will spin up the container, deploy your app, run the tests, then shut it down

13:08 but you won't have autoexpect functionality - each run is manual

13:09 Jesterman81: so I would be adding something like [immutant.cache] under dependecies in project.clj

13:10 tcrawley: [org.immutant/immutant-cache "1.1.4"]

13:10 or [org.immutant/immutant "1.1.4"] to load them all

13:10 Jesterman81: thx a bunch for your help

13:10 tcrawley: my pleasure!

13:10 there's also #immutant if you want to join us there

13:10 clojurebot: No entiendo

13:11 Jesterman81: i will check that out

13:11 thx

13:12 sdegutis: I am finding that my JVM instance runs ridiculously slow on my EC2 instance.

13:28 sritchie: hey all, is anyone using sente’s csrf token feature?

13:28 I’m getting a warning that the csrf token isn’t provided (makes sense since I haven’t given it one),

13:28 but sente seems to say that it does all this for yuo

13:28 you*

13:30 ah, I need a session store first

13:39 TimMc: sdegutis: Is it a t1.micro?

13:40 sdegutis: Nope, m1.small

13:40 Has ~1.8 GB of memory, but can't find CPU specs.

13:41 wink: sdegutis: 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:42 sdegutis: wink: Thanks.

13:42 wink: it's something you have to learn the hard way. treat them as ephemeral ;)

13:44 sdegutis: We 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:45 This week I set up a personal website on a small DigitalOcean server and it's running like a charm. Much, much simpler overall.

13:45 Granted, 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:48 technomancy: how do you like stripe?

13:48 sritchie: technomancy: stripe’s been great for us

13:48 sdegutis: technomancy: Honestly I love it.

13:49 sritchie: I didn’t announce it, really, but I wrote this library that wraps the API: https://github.com/racehub/stripe-clj

13:49 core.async support, and schemas on all stripe types

13:49 sdegutis: technomancy: We've used it at work (cleancoders.com) for about a 1.5 years now, and it's been really easy to use.

13:49 technomancy: I've been using square cash which is super great but only works for US cards

13:49 sritchie: charge events, for example: https://github.com/racehub/stripe-clj/blob/develop/src/clj/stripe/charge.clj

13:49 sdegutis: technomancy: And for my little side project, it made my store pays /much/ nicer than with FastSpring: https://tinyrobotsoftware.com/gistrecall/store.html

13:50 technomancy: cool

13:50 sdegutis: I haven't made a single sale yet, but at least the store page is much prettier.

13:50 dbasch: sdegutis: I have jvms running on small instances, they run just fine

13:50 sdegutis: s/my store pays/my store page is/

13:50 technomancy: I really want to get off paypal for international orders

13:50 danneu: sdegutis: that describes all my prjects

13:50 sdegutis: :D

13:51 dbasch: you 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:51 technomancy: I'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:51 sritchie: does clojurescript not have “update” yet?

13:52 sdegutis: Compare 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:52 zanes: What’s the Clojure version of unfold?

13:52 sdegutis: Previously the user had to enter address, city, state, zip code, and phone number. Now they don't!

13:53 technomancy: actually 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:53 sdegutis: technomancy: sounds good

13:54 technomancy: fewer steps between hitting the site and placing the order is best

13:54 Bronsa: sritchie: https://github.com/clojure/clojurescript/commit/15fbbf5d63fbc860e0fe4f7d45c7f00a27ebc0ba

13:54 sritchie: nice

13:54 technomancy: zanes: what is unfold?

13:55 Bronsa: sritchie: no release yet though

13:55 zanes: technomancy: A-la SRFI-1: http://srfi.schemers.org/srfi-1/srfi-1.html#FoldUnfoldMap

13:55 I’m guessing I’m just supposed to use lazy-seq for this kind of thing and roll my own?

13:56 technomancy: zanes: sounds like take-while+iterate

13:56 zanes: Yeah, I was reaching for iterate.

13:56 Thanks!

14:04 EvanR: is 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:05 zanes: technomancy: In the case where f has side effects do I want to roll my own with lazy-seq instead?

14:06 technomancy: zanes: that's orthogonal to side-effects

14:06 zanes: if you have side effects you shouldn't be using lazy seqs at all

14:06 zanes: I must be confused, then. iterate stipulates that f must not have side effects.

14:06 Oh?

14:07 What would be more idiomatic?

14:07 technomancy: doseq or loop/recur typically

14:07 justin_smith: EvanR: you could use a proper logger (log4j, sl4j, timbre (which wraps those))

14:07 EvanR: ok

14:08 technomancy: zanes: maybe construct a lazy seq of pure values with iterate and consume it and issue side-effects with doseq

14:08 llasram: EvanR: my vote would be clojure.tools.logging w/ log4j

14:08 technomancy: I don't know what you're doing really

14:08 EvanR: its really impressive of all the ways it could print wrong, its the one way that is most unhelpful to me

14:08 justin_smith: EvanR: Sometimes all it takes is changing (println a b c) to (println (string/join \space [a b c]))

14:09 zanes: technomancy: Paging through an API. Getting the next URL to fetch requires issuing a HTTP request.

14:11 technomancy: zanes: gotcha. I am tempted to say that kind of network request shouldn't be counted as a side-effect.

14:11 assuming it's a GET

14:11 zanes: It’s a GET, yeah.

14:11 Hmm.

14:12 justin_smith: technomancy: zanes: regardless, itereate is guaranteed in order, and doesn't retry, so side effects should be fine

14:18 amalloy: https://github.com/amalloy/useful/blob/develop/src/flatland/useful/seq.clj#L128 is the implementation of unfold in useful

14:18 it 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:26 david123987: What's the best way to write gui applications in clojure?

14:27 danneu: david123987: have you looked at https://github.com/daveray/seesaw?

14:29 david123987: I 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:29 danneu: clojure is not a hot candidate if you want that sort of tooling

14:31 david123987: ook, thank you!

14:31 justin_smith: danneu: that said, you could use a standard swing GUI builder, and interact with the resulting java code via interop

14:33 danneu: :/

14:34 justin_smith: ?

14:35 danneu: justin_smith: do you have java experience?

14:36 justin_smith: some

14:37 enough to write some java code and then use it via interop

14:37 danneu: the 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:38 i wonder if that is rare among people using clojure

14:38 robholland: I don't think it is

14:39 But then I'm the same, so bias

14:39 +ed

14:39 justin_smith: danneu: java is mind numbingly strightforward - it can be tedious, but it isn't hard

14:39 I 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:59 zanes: Wow. mapcat isn’t lazy?

15:00 Bronsa: zanes: it is

15:01 zanes: (first (mapcat #(do (print %) [%]) '(1 2 3 4 5 6 7)))

15:01 There’s something subtle going on here that I don’t understand.

15:01 amalloy: it's faiiiirly lazy

15:01 noonian: ,(first (mapcat #(do (print %) [%]) '(1 2 3 4 5 6 7)))

15:01 clojurebot: 12341

15:01 zanes: Is it the concat? Instead of lazy-cat?

15:02 justin_smith: laziness isn't guaranteed conservative

15:02 amalloy: zanes: it's the apply combined with the concat

15:02 as i recall

15:02 * zanes nods.

15:02 zanes: Would apply with lazy-cat fix my issue here?

15:02 Or is there some other way I want to do this?

15:02 amalloy: well like, you can't do that?

15:03 noonian: apply will realize the seq of args to evaluate each one for the function to apply

15:03 amalloy: noonian: 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:04 zanes: 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:04 * zanes grimaces.

15:04 noonian: amalloy: but in the case of an n-arity fn it would right?

15:05 amalloy: noonian: that's not a specific enough question to answer. what does n-arity mean?

15:05 noonian: (fn [& args] ...)

15:05 amalloy: in that case apply does not realize any args at all

15:06 Bronsa: amalloy: it's the apply combined with map actually in this case

15:06 noonian: ah i see, i mean the args will be realized when the fn is called because thats the semantics for fns?

15:06 zanes: http://dev.clojure.org/jira/browse/CLJ-1218

15:06 amalloy: noonian: only if the function needs them

15:06 ,(apply (fn [& args] nil) (range))

15:06 clojurebot: nil

15:07 noonian: huh, thanks i didn't know it worked like that

15:07 amalloy: Bronsa: are you sure? the jira issue zanes linked agrees with me re apply/concat

15:08 Bronsa: amalloy: it's map that has the 3+vararg arity, concat only needs to realize 2

15:08 amalloy: ~source mapcat

15:09 ugh, you're right. i forgot that mapcat isn't unrolled at all

15:09 if it were, this wouldn't be a problem

15:09 or at any rate i'd be right and it'd only be a concat problem, not a map problem :P

15:10 Bronsa: amalloy: uhm I take it back.

15:10 amalloy: hurrah!

15:11 zanes: Is there something like the join from that ticket in core?

15:11 It feels really weird that there’s no clear fix for this.

15:12 Bronsa: amalloy: looks like apply could be "lazier" then, it's seems to be realizing 1 more element than necessary

15:12 amalloy: Bronsa: i don't think that's true

15:12 Bronsa: concat has 2fixed+1vararg yet it's realizing 4 elements

15:13 I would expect it to realize only 3

15:13 amalloy: ~source concat

15:18 Bronsa: turns out I don't remember at all how the implementation of apply works

15:21 ,(clojure.lang.RT/boundedLength (map println (iterate inc 0)) 2)

15:21 clojurebot: 0\n1\n2\n3\n3

15:23 sritchie: technomancy: when does the user.clj file get evaluated?

15:23 technomancy: I can’t seem to get cljx to run before that happens

15:24 zanes: I guess this is why aconcat exists in plumbing.core.

15:26 ~source apply

15:26 EvanR: what is so lazy about lazy seq?

15:26 ,(first (map (fn [x] (+ 1 x)) [1 2 3 4 nil 6]))

15:26 clojurebot: #<NullPointerException java.lang.NullPointerException>

15:27 Bronsa: amalloy: http://sprunge.us/BBLh?clj

15:27 well

15:27 http://sprunge.us/BBLh?diff rather

15:28 trptcolin: sritchie: 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:28 i don't think you're going to get around it unless you find a way to avoid loading RT

15:29 sritchie: yeah, I ended up doing what the pedestal team does, and having this in user.clj: (defn dev [] (require ‘dev) (in-ns ‘dev))

15:29 and moving all my other code into dev.clj

15:29 trptcolin: yeah

15:29 technomancy: sritchie: lein doesn't control user.clj; it's an undocumented clojure feature

15:29 sritchie: gotcha, makes sense after seeing the RT stuff

15:30 Duke-: EvanR: http://www.markhneedham.com/blog/2014/04/06/clojure-not-so-lazy-sequences-a-k-a-chunking-behaviour/

15:31 EvanR: thx

15:32 "lazy sequences play badly with side effects" yeah that makes sense, but i guess errors now count as a side effect

15:32 errors, infinite loops

15:35 "lazy sequences play badly with non-total code"

15:36 ,(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:36 clojurebot: 2

15:42 amalloy: ,(clojure.lang.RT/boundedLength nil 0)

15:42 clojurebot: 0

15:42 amalloy: ,(clojure.lang.RT/boundedLength () 0)

15:42 clojurebot: 1

15:42 amalloy: weird world. i guess you're not supposed to call it with 0

15:46 csd_: have any of you guys done hacker school in nyc?

15:48 Bronsa``: amalloy kinda makes sense, vararg has at least 1 arg

15:50 tuft: for the HID geeks -- my DataHand setup is coming along: https://www.dropbox.com/sh/74f80r0oyjy0au6/AABp0g68bb2ykfiHABfFxkEYa?dl=0

15:50 jeremyheiler: skdjfksdjfkdfjsdkfjksd~.

15:52 TimMc: tuft: Nice.

15:52 justin_smith: jeremyheiler: "VG9#J9" ? what do you mean by "VG9#J9"?

15:52 https://www.refheap.com/90612

15:54 jeremyheiler: justin_smith: lol sorry

15:54 justin_smith: np, I was just joking anyway

15:54 jeremyheiler: my ssh connection died, hence the ~.

15:55 justin_smith: I just coincidentally have a silly function that "encodes" and "decodes" asdfjkl;-speak

15:55 jeremyheiler: lol nice

15:55 justin_smith: your message is safe, if the adversary mistakes it for random pounding on a keyboard

15:56 * not recommended for any actual cryptographic or opsec usage

16:02 sdegutis: Is clojured.typed stable or complete yet?

16:03 justin_smith: core.typed? definitely not complete, I don't know about the stability, though ambrosebs probably has a good answer.

16:03 aperiodic: go dork

16:03 oops

16:04 sdegutis: aperiodic: Ah, you read that thread too?

16:04 justin_smith: Thanks.

16:08 ambrosebs: sdegutis: It supports the main clojure idioms

16:08 sdegutis: it's relatively easy to port core.typed code from 0.2.* to 0.2.72

16:08 so the last year has been "stable"

16:09 mostly backwards compatible changes

16:09 definitely not complete.

16:10 mearnsh: any way i can preserve metadata here? https://www.refheap.com/92875

16:20 sdegutis: Who makes refheap.com ?

16:21 arrdem: mearnsh: you could define a wrapper to map that preserves metadata in the single sequence update case, but generally that doesn't make sense

16:21 (defn update-map [update-fn seq] (with-meta (map update-fn seq) (meta seq)))

16:22 probably a better name for that too... updating-map perhaps.

16:23 amalloy: sdegutis: Raynes

16:24 Raynes: Oh dear

16:24 What have I done now

16:24 arrdem: Raynes: you dared draw breath

16:44 mearnsh: arrdem: alright, guess i ought to rethink

16:45 arrdem: mearnsh: I would be careful about whether your "metadata" is really data or not

16:45 mearnsh: 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:46 mearnsh: ok that makes sense yeah

16:46 i'll rejig my data

16:48 ingsoc: Hi, what is the current goto clojure book

16:51 justin_smith: ~books

16:51 clojurebot: books is http://www.pragprog.com/titles/shcloj/programming-clojure

16:51 postpunkjustin: ingsoc: there are some good choices out there, but I wouldn't say any really qualifies as "the current goto book" in general

16:51 I like Joy of Clojure for a fast-paced overview for people with some relevant experience

16:52 Clojure in Action is a little more detailed and geared towards real-world applications

16:52 technomancy: ~book

16:53 clojurebot: book is programming clojure

16:53 technomancy: ~books

16:53 clojurebot: books is http://clojurebook.com/ http://joyofclojure.com/

16:53 technomancy: ^ my favourites

16:53 justin_smith: good old indeterminate factoids

16:53 arrdem: JoC is good

16:53 postpunkjustin: I think the O'Reilly book is a terrible way to get started, but indispensable later on

16:53 ingsoc: is JOC a bit more academic ?

16:54 justin_smith: ingsoc: not academic, but more assuming of lisp background

16:54 ingsoc: Clojure Programming

16:58 mearnsh: ingsoc: the 1st ed. of JoC introduces a toy SQL DSL on page 9

16:58 the 2nd ed. (just picked up a copy) goes into core.logic

16:58 for example

16:59 it's a bit different but very good (so far). but an absolute beginner might feel out of their depth

17:02 ingsoc: I 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:02 tooling and the eclipse plugin seems better/more mature for clojure

17:03 what are the key features of clojure that stand out from other languages ?

17:03 technomancy: learn them both; they're both very useful for different things

17:04 since clojure is on the jvm its strengths are for server-side applications

17:04 it has a much bigger community and library selection than ocaml

17:04 ingsoc: clojurescript interests me also

17:05 technomancy: learning clojurescript without knowing clojure appears to be very difficult from what I've observed on irc

17:05 ingsoc: (which i assume clojure is a good stepping stone)

17:08 wombawomba: Is there a nicer way to do the following?

17:08 (vec (filter identity [(when cond1? var1) (when cond2? var2)]))

17:11 mgaare: (cond-> [] cond1? (conj var1) cond2? (conj var2))

17:12 wombawomba: neat

17:17 amalloy: `(~@(when cond1? [var1]) ~@(when cond2 [var2])) works too

17:18 noonian: or the original with filterv

17:26 mgaare: fwiw cond-> is the fastest :D

17:56 SagiCZ1: is there a subvec for lists?

17:56 (foo '(4 5 3 2 1) 1 3) --> '(5 3)

18:01 amalloy: SagiCZ1: no. it exists for vectors because it's free: they support indexed access, so a "narrowed" view is cheap. lists don't

18:02 joelt: what structure allows adding an element to the beginning of the list in O(1) time?

18:02 plain ol' list?

18:03 arrdem: joelt: cons

18:03 &(cons 1 (cons 2 nil))

18:03 lazybot: ⇒ (1 2)

18:03 SagiCZ1: amalloy: that reasoning is so weird though.. i thing there are functions in clojure that have different performance for different datastructures

18:03 *think

18:04 arrdem: joelt: note that it's not really "add", it's "returns a new list sharing the old list as a tail"

18:04 akkad: clojure:Common Lisp Only Just Uses Recursive Expressions

18:04 justin_smith: SagiCZ1: in general that is avoided

18:04 SagiCZ1: and then there are functions that actually DO diffrent things for diffrent data structures like conj

18:05 if i come back later and change my vectors to lists for some reason, i break every conj call

18:05 justin_smith: SagiCZ1: and this is explicitly so it can do the most efficient thing with each kind of arg

18:06 SagiCZ1: justin_smith: it just seems like such an odd idea.. maybe i just didnt benefit from it yet

18:09 joelt: so, i'd need to use Java LinkedList to ensure saneness?

18:09 amalloy: SagiCZ1: not very many. nth is the only common one, and it's kinda a weird function in various ways

18:09 justin_smith: joelt: who said anything about LinkedList?

18:09 ,(list 1 2 3)

18:09 clojurebot: (1 2 3)

18:09 joelt: well, if i don't want it recreating the structure so i have control over it.

18:10 i really want to know its inserting at the beginning, and i have an O(1) time function.

18:10 amalloy: joelt: using a mutable linked list doesn't sound terribly sane unless you're in some unusual circumstances

18:10 joelt: im optimizing at this point.

18:10 amalloy: cons 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:11 it gives you a new list which is longer by one than the input list was

18:11 joelt: amalloy: k' that's good enuogh for me, just didn't know where this is doc'd

18:12 amalloy: joelt: 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:16 TimMc: unless coll is something awful

18:17 But then, everything is constant time with a long enough time horizon. All your works will eventually crumble to dust.

18:18 O(zymandias)

18:18 justin_smith: O(zymandius)

18:18 lol

18:18 TimMc: ha!

18:18 arrdem: haha

18:18 joelt: all we are is dust in the wind.

18:18 arrdem: (inc TimMc)

18:18 lazybot: ⇒ 78

18:18 arrdem: read that yesterday for class..

18:18 annelies: hi

18:19 technomancy: look upon my data structures, ye mighty, and despair.

18:19 TimMc: justin_smith: I'm pretty proud of that and don't at all mind that the joke was (apparently) inevitable and within easy reach.

18:19 justin_smith: heh

18:20 technomancy: (inc TimMc)

18:20 lazybot: ⇒ 79

18:20 Travisty: O(zymandias) is awesome

18:20 technomancy: :D

18:25 justin_smith: TimMc: I was foolish enough to think I figured that gag out myself.

18:37 hyPiRion: Clojure, where O(log n) is O(1)

18:37 arrdem: hyPiRion: still on the immutable vector kick I see :P

18:37 hyPiRion: Yeah. I feel like I'll never end that series

18:38 arrdem: yeah no I'm with you on the log(n) is effectively constant thing

18:43 hyPiRion: Yeah – At some point Big-O notation isn't that helpful in and of itself

18:43 TimMc: justin_smith: Well, it wasn't planned on my part. The only planning was actually looking up the spelling.

18:43 justin_smith: hah

18:44 arrdem: I do like T notation, but O/o/Ω/ω have very specific meanings :P

18:45 justin_smith: hyPiRion: arrdem: the approach "clojure high performance programming" takes is to notate it as O(log₃₂n)

18:45 which I have definitely seen objections to

18:46 arrdem: justin_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:46 or even "Oh it's T(6) in any reasonable case"

18:47 sure I could fill Stampede's memory with a T(10) or smaller tree, but that's not the point

18:47 hyPiRion: justin_smith: right, persistent data structures aren't exactly fit for HPC

18:48 justin_smith: brb downgrading cider

18:52 technomancy: we'll send a search team if we don't hear back

18:53 * arrdem dons boots, goggles, parachute

18:53 AeroNotix: damn CIDER is so bad for upgrading

18:53 it literally breaks every release

18:53 technomancy: fool me once, shame on you...

18:54 AeroNotix: technomancy: what am I supposed to do? I do like to keep updated..

18:54 arrdem: hehehe

18:54 AeroNotix: I just git reset when I upgrade

18:54 technomancy: AeroNotix: why?

18:54 AeroNotix: technomancy: new features, obsession :)

18:54 arrdem: technomancy: because most upgrades fix bugs, not add them :P

18:54 AeroNotix: haha

18:54 Yeah but CIDER really went downhill after 0.5

18:54 technomancy: AeroNotix: eventually you will develop the correct pavlovian response

18:54 oh, and 0.6 worked fine too

18:55 AeroNotix: I just update when I get bored, try to open a project and then git reset my .emacs.d

18:55 justin_smith: technomancy: testing that now, I just checkout out 0.6.0

18:55 AeroNotix: Think I'm on 0.8 with some workflow workarounds

18:55 0.5-0.6 was dreamy

18:55 * arrdem 0.8.0-SNAPSHOT

18:56 technomancy: it's a lucky coincidence that 0.6 was the last version to be released on marmalade

18:58 justin_smith: WOOOOO

18:58 finally, I can do a defrecord in a repl inside emacs

18:58 and my argument hinting is back

18:58 and tab completion is working again too

18:58 AeroNotix: sigh

18:58 justin_smith: (inc cider-0.6.0)

18:58 lazybot: ⇒ 1

18:59 AeroNotix: yeah I might downgrade

18:59 Bronsa: it has never stopped working using slime.

18:59 justin_smith: AeroNotix: all the featuers I actually rely on are working now, finally

19:00 AeroNotix: I've been writing far too much Erlang recently, not enough Clojure.

19:06 https://github.com/AeroNotix/crap/commit/089bfd9b62a08c956fa2dc288214ce220d8f7789

19:07 andyf: Is this T(6) notation explained somewhere, or what is the short version of its meaning?

19:08 justin_smith: AeroNotix: my I suggest a backronym like Convenient Resources And Procedures ?

19:09 andyf: I find emacs clojure-mode to be rock solid :-)

19:09 justin_smith: andyf: I think this http://mathworld.wolfram.com/Big-ThetaNotation.html

19:09 andyf: clojure-mode is great

19:09 cider is another thing entirely

19:09 Bronsa: I have frozen my clojure-mode checkout

19:10 the lastest versions have weird syntax highlighting :(

19:10 justin_smith: Bronsa: at that point you may as well clone and branch, right?

19:10 that's what I did with cider - I check out different tags to try other versions

19:10 arrdem: andyf: 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:11 andyf: But why are folks here distinguishing T(10) and T(6) above, or is that a joke?

19:11 Bronsa: justin_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:11 arrdem: andyf: because the point of T is that it _includes_ all constants rather than discarding them as O does

19:12 Bronsa: justin_smith: I use git submodules for all the modes I use, it's not hard to freeze one to a checkout

19:12 justin_smith: Bronsa: as in, your own git repo for all elisp stuff

19:13 Bronsa: https://github.com/Bronsa/.emacs.d/tree/master/lib

19:13 justin_smith: right

19:13 as long as you never have to deal with a merge conflict in a .elc file, more power to your :)

19:13 Bronsa: heh

19:14 the only annoying thing is that I have to deal with pulling dependencies by hand

19:14 andyf: arrdem: If it includes all constants but no units, it is as vague as O :-)

19:16 Bronsa: if 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:16 justin_smith: arrdem: 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:17 Bronsa: justin_smith: reminds me of when I grep for "ns" in Compiler.java

19:17 justin_smith: hah

19:20 SagiCZ1: could anyone help me find memory leak?

19:21 justin_smith: SagiCZ1: maybe - first thing is I recommend using a profiler

19:21 ~profiler

19:21 clojurebot: Excuse me?

19:21 SagiCZ1: well.. 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:22 justin_smith: SagiCZ1: feel free to share a refheap of the code

19:22 SagiCZ1: ok

19:23 https://www.refheap.com/92888

19:23 andyf: I 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:23 I think right now they often use only a small part of each cache line fetched

19:23 SagiCZ1: once 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:24 maybe it is some internal seesaw thing

19:25 justin_smith: SagiCZ1: are you sure the memory isn't being reclaimed? are you hitting some limit?

19:26 SagiCZ1: justin_smith: it throws java.lang.OutOfMemoryError, java heap space

19:26 and i can see the process eating up the memory when i move the slider

19:26 justin_smith: OK

19:26 yeah, so it is definitely happening

19:27 SagiCZ1: maybe the panel still holds references to all the old ChartPanel instances

19:27 even though you cannot see them?

19:27 I don't know swing / seesaw well enough to verify or not

19:28 SagiCZ1: yeah, it seems like it.. is the author of seesaw regular here by any chance?

19:28 justin_smith: Perhaps you need to keep the ChartPanel and mutate it instead of creating new ones

19:28 $seen daveray

19:28 lazybot: I have never seen daveray.

19:28 SagiCZ1: justin_smith: that might be a solution, i just have to find how it can be mutated

19:28 justin_smith: SagiCZ1: he's on twitter with that nick

19:29 http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/ChartPanel.html

19:29 SagiCZ1: thank you

19:30 justin_smith: SagiCZ1: maybe you want the .setChart method?

19:30 or maybe you need to mutate the chart itself http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/JFreeChart.html

19:30 SagiCZ1: profiler says i have 700 MB worth of int[] .. interesting

19:31 justin_smith: I bet the chart graphics are in int arrays

19:31 SagiCZ1: justin_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:32 justin_smith: SagiCZ1: there is a paint or repaint function, right? maybe with a ! in the name

19:32 the JFreeChart class has a .draw method if nothing else

19:33 SagiCZ1: yes there is one for every swing component

19:33 justin_smith: mutate chart, invoke .draw

19:33 nestastubbs: ok, so, how much code can I write while babysitting hcarge is asleep. must type really quiet

19:33 and can't set off the emacs bell!

19:33 justin_smith: nestastubbs: woah, you leave the audible bell on?

19:35 nestastubbs: justin_smith: it's like "Operation" around here 8)

19:35 I live in a permanent define-kbd-macro!

19:37 justin_smith: nestastubbs: the first thing I do when setting up a new computer is turn off every audible alert

19:39 andyf: I bet sorted maps and sets could be made much more cache friendly, by branching by 32 per node rather than 2

19:41 justin_smith: andyf: that's what vectors already do, right?

19:43 Bronsa: justin_smith: I believe phms do too

19:45 TEttinger: IIRC, the persistent hash maps use a 32-branch (not sure the term) trie

19:45 EvanR: ,(eval ('''A))

19:45 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn>

19:46 EvanR: in pm i got java.lang.SecurityException: You tripped the alarm! eval is bad! instead

19:47 justin_smith: ,('''A)

19:47 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn>

19:47 justin_smith: that's your issue

19:47 ,'('''A)

19:47 clojurebot: ((quote (quote (quote A))))

19:48 TEttinger: ,(eval (read-string "(+ 1 2 3)"))

19:48 clojurebot: 6

19:49 EvanR: oh

19:49 ,(eval '''A)

19:49 clojurebot: (quote A)

19:49 EvanR: k

19:50 SagiCZ1: justin_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:50 justin_smith: SagiCZ1: aha - I suspected it might be something like that

19:50 so you could explicitly remove the old one

19:51 though just mutating may be better, if you keep an immutible reference data that is updated cleanly

19:51 SagiCZ1: justin_smith: the thing is, i am not sure i can mutate it through seesaw

19:52 justin_smith: SagiCZ1: you don't have a handle to the object?

19:52 in my experience it works, you just have to make sure the right repaints all happen

19:52 (it's been a while though)

19:53 TEttinger: SagiCZ1: what you should be doing with seesaw is getting the right items with selectors

19:53 SagiCZ1: TEttinger: i am not sure i follow?

19:54 TEttinger: it's one of the things seesaw provides to get an element by an id or a class, a la CSS

19:54 https://github.com/daveray/seesaw/wiki/Selectors

19:55 SagiCZ1: TEttinger: and then do what with the object?

19:55 TEttinger: like how this will disable a full sub-tree (config! (select my-panel [:*]) :enabled? false)

19:55 SagiCZ1: remove it and replace it right?

19:55 TEttinger: you can use config! if you have the right thing

19:55 SagiCZ1: wicked

19:55 justin_smith: SagiCZ1: you get a direct reference to the object, you can use the update methods to just change it

19:57 TEttinger: one 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:57 andyf: Sorry, 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:57 SagiCZ1: justin_smith: i hear what you saying, but the object is jfreechart, and updating it is a hassle..

19:57 TEttinger: similar to ##(doc declare)

19:57 lazybot: ⇒ "Macro ([& names]); defs the supplied var names with no bindings, useful for making forward declarations."

19:58 andyf: Replace "in sorted" with "unsorted" there, aka hashed

19:59 SagiCZ1: TEttinger: should this work? (s/remove! panel (s/select panel [:ChartPanel]))

19:59 TEttinger: where s is seesaw?

20:00 does the ChartPanel have an :id defined?

20:00 SagiCZ1: select doc says you can also select by simple class name

20:00 arrdem: justin_smith: haha well done

20:00 TEttinger: I can't quite remember what [:the-button] does instead of [:#the-button]

20:00 justin_smith: arrdem: ?

20:00 SagiCZ1: TEttinger: it is :tag .. and it is class name of object you want to select

20:01 TEttinger: oh neat: A "tag" selector, e.g. [:JLabel] matches the literal Java class name (without package) of the widget type.

20:01 arrdem: justin_smith: I'm 44 miutes ago

20:01 justin_smith: got it, the O(zymandius) thing?

20:01 arrdem: justin_smith: the "search for T thing"

20:01 justin_smith: ahh, OK

20:01 TEttinger: yeah, that should work if your ChartPanel is one of the children of panel

20:01 SagiCZ1: TEttinger: nevermind, it actually works fine!

20:02 TEttinger: sweet

20:02 justin_smith: arrdem: mathematics in general really eneds to work on its seo

20:02 SagiCZ1: wow this is...... great

20:02 i will probably later look into mutating the jfreechart directly but this should work for now

20:02 TEttinger: cool, SagiCZ1

20:02 arrdem: justin_smith: that could be said of programming in general too. symbolhound is a godsend.

20:03 thinking of which I guess I can hack in Grimoire some now..

20:04 justin_smith: off to search symbolhound for "T"

20:04 SagiCZ1: no 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:05 TEttinger: glad to help!

22:05 rritoch: Hi, does anyone know how to get leiningen/clojure to output proper UTF-8 or UTF-16 in a windows console?

22:07 justin_smith: rritoch: the default is utf-8

22:07 rritoch: justin_smith: I'm not sure what the problem is, I'm getting output's of ?????? for russian

22:07 justin_smith: rritoch: and you are sure the input is utf-8?

22:08 rritoch: Using font Lucida Console, I've tried this with power shell and windows 8 shell, and they're both dumping the same garbage

22:09 justin_smith: slurp 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:09 where is the russian text coming from?

22:09 rritoch: A website

22:09 justin_smith: can you share the URL?

22:10 rritoch: Unfortunatly no, I'm trying to see now if I can demonstrate the issue

22:10 justin_smith: rritoch: OK. I would double check the encoding in the page headers. It may be reporting the wrong encoding in the http headers?

22:12 rritoch: 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:12 ,(String. (.getBytes "☃") "UTF-8")

22:12 clojurebot: "☃"

22:12 justin_smith: ,(String. (.getBytes "☃") "UTF-16")

22:12 clojurebot: "�"

22:13 justin_smith: so with some experimentation with encodings, you should find the re-interpretation that has the right output

22:20 rritoch: justin_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:21 Grumble

22:21 justin_smith: rritoch: what shell?

22:21 rritoch: This is really leiningen acting crazy (Windows 8)

22:22 Ex. туда

22:22 justin_smith: I don't think lein does anything to text encoding at all

22:22 rritoch: Outside leiningen I can paste that, but inside the REPL the paste is ignored

22:22 justin_smith: rritoch: odd

22:22 rritoch: what about java -jar path/to/clojure.jar

22:23 rritoch: ,(print "туда")

22:23 clojurebot: туда

22:23 justin_smith: that will run a repl

22:23 (a very limited one)

22:23 rritoch: It won't though, thats my problem

22:23 It runs on the bot though

22:23 justin_smith: it won't run a repl?

22:23 rritoch: It won't run in a repl

22:23 justin_smith: I am saying you can bypass lein

22:24 and just run the clojure jar with java, to rule out lein (or establish that lein is the problem)

22:24 rritoch: ,(print (java.net.URLDecoder/decode "%D1%82%D1%83%D0%B4%D0%B0"))

22:24 clojurebot: туда

22:24 rritoch: Hmm

22:24 In my shell that outputs "????"

22:25 justin_smith: standard windows console? putty?

22:25 rritoch: Standard console (cmd.exe)

22:26 justin_smith: and things other than lein/clojure in cmd.exe display the same text properly?

22:27 rritoch: > echo "туда"

22:27 works fine...

22:27 justin_smith: OK

22:27 rritoch: This has got to be a windows issue

22:27 justin_smith: try java -jar clojure.jar

22:28 rritoch: I'm going to try on linux to see if I get better results

22:28 justin_smith: pointing that at whereever your clojure jar is of course

22:28 rritoch: utf-8 in clojure / lein on linux just works for me, and always has

22:30 rritoch: In linux/putty it works fine

22:32 This must be a bug in Java with how it interacts with stdout to windows console

22:32 Leiningen 2.3.4 on Java 1.8.0_20-ea Java HotSpot(TM) 64-Bit Server VM

22:32 justin_smith: rritoch: have you tried running the clojure jar directly without lein yet?

22:33 rritoch: No but running this outside leiningen isn't an option

22:33 justin_smith: rritoch: no, just try running clojure.jar, that will start a repl

22:33 and you can see if that text is handled properly in that repl

22:37 rritoch: It didn't help but this time the result was crazy

22:37 justin_smith: so a clojure and/or jvm bug?

22:37 rritoch: Running repl from clojure directly I was able to paste in the туда

22:37 I ended up with ....

22:37 justin_smith: OK

22:37 rritoch: user=> (print "туда")

22:38 ????nil

22:38 justin_smith: wasn't that pretty much what you got before? the nil is the return value of the print

22:38 ,(print "???")

22:38 clojurebot: ???

22:38 justin_smith: oh, clojurebot does not show the return value

22:38 &(print "???")

22:38 lazybot: ⇒ ???nil

22:39 rritoch: It 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:40 So the problem is either with Java or Windows

22:42 I get the same ??? using (.println System/out "туда")

22:43 So this isn't really a clojure problem, the bug is inherited from Java.

22:50 justin_smith: rritoch: I am amazed someone did not find that - I guess it doesn't show up in an IDE?

22:51 rritoch: I have no idea, I'm trying to figure out what encoding the system is trying to use now though

22:54 I 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:54 justin_smith: http://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html here's a list of possible encodings to try

22:55 ,(String. (.getBytes "☃") "ISO-8859-1") ; etc.

22:55 clojurebot: "☃"

22:58 rritoch: Hmm

22:58 I think I found the problem

22:58 justin_smith: do tell

22:58 rritoch: ,(.getProperty (System/getProperties) "file.encoding")

22:58 clojurebot: #<SecurityException java.lang.SecurityException: denied>

22:58 rritoch: Bah

22:58 Anyhow, on my machine that is responding with Cp1252

22:59 justin_smith: aha

22:59 yeah, that would likely be a problem :)

22:59 btw (System/getProperty "file.encoding") does the same thing

23:00 I totally should have thought of that one

23:00 slipped my mind

23:00 rritoch: Damn geolocation!

23:00 justin_smith: it likely gets that from the registry?

23:00 arrdem: can core.logic contain repetitions of facts?

23:01 justin_smith: rritoch: does (System/setProperty "file.encoding" "UTF-8") magically fix it?

23:01 arrdem: never mind that doesn't make any sense

23:01 justin_smith: worth a shot maybe :)

23:02 rritoch: Sadly no

23:02 But at least I'm closer to a solution

23:03 justin_smith: rritoch: 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:04 ,(String. (.getBytes "☃") "UTF-8")

23:04 clojurebot: "☃"

23:04 rritoch: No, output is still garbage

23:04 justin_smith: or maybe not - because the conversion from your system encoding to java's native encoding likely breaks something already

23:05 rritoch: Because System/out charset is set when Java starts

23:05 justin_smith: what about putting it in a file, and specifying (slurp f "UTF-8")

23:05 rritoch: I just need to change the default or jack leiningen to set the file encoding from the command line

23:49 I tried adding "set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8" to the top of lein.bat and it still doesn't output properly.

23:50 justin_smith: I usually use -DJAVA_OPTIONS=-D...

23:50 for setting system propterties

23:51 rritoch: It set the system property, but the output was still mangled

23:51 justin_smith: erro, I mean JAVA_OPTIONS=-D...

23:51 right, I mean using JAVA_OPTIONS so it is set at startup

23:51 JAVA_TOOL_OPTIONS I am unfamiliar with

23:51 rritoch: It is this stupid geolocation, I swear microsoft intentionally fubar's their apps when used outside their big $$$ regions

23:53 I don't have this problem from linux so I'm writing it off as a windows bug

23:55 I don't even speak Russian anyhow, but there are no Russian programmers on our team so I'm stuck with this mess.

23:59 This code is working properly in JavaFX so it isn't a big problem, but it isn't maintainable since all console output is garbled.

Logging service provided by n01se.net