#clojure log - Jan 09 2014

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

0:02 dsrx: cerealklr: btw http://symbolhound.com/?q=clojure&l=&e=%40&n=&u= (the "@" was included in the exact phrase via advanced search)

0:02 (needed to do that to not see a lot of @mention noise in github issues and stackoverflow and such)

0:08 cerealklr: dsrx: That's an awesome tool. Thanks!

0:21 seancorfield: dare i ask who here is using mongodb and what library you are using?

0:21 currently evaluating options, after using congomongo for a couple of years

0:28 egghead: seancorfield: i've been using congomongo for some time too, but monger looks pretty nice

0:33 maravillas: b

0:40 seancorfield: egghead: yeah, that's where i'm leaning atm... monger would allow me to get away from dynamic global variables, and has much better documentation

0:44 hiredman: /win 11

0:59 noprompt: dnolen: if you're around i have a design question around building a generic component.

0:59 abaranosky: seancorfield: I used monger a little, but honestly not enough to say much... bu tit does have nice docs

1:00 noonian: i'm also interested in how best to build generic components

1:02 noprompt: noonian: have you any thoughts about it?

1:03 seancorfield: abaranosky: anything that bothered you about monger?

1:03 noonian: i haven't thought too hard about it, but i have gone down a few paths that probably aren't the right way to do it

1:05 i've been using sablono for hiccup like syntax, and one thing you can do with that is instead of writing components at all, just right pure functions that return sablono data and call them from your components. This works fine, and allow you to just use normal function calling syntax instead of the build interface, but it wouldn't work for someone who isn't using sablono and wrapping their sablono syntax with (html ...)

1:06 xpika: i have lein installed but i can't find standalone clojure? Where could it be?

1:06 seancorfield: xpika: what do you mean by "standalone clojure"?

1:06 can you do this? lein repl

1:06 xpika: clojure file.clj ... *run file*

1:06 noonian: i have some more general questions about how you should treat your app's state; for example, should i avoid storing any mutable state there? (like objects from 3rd party js libs)

1:07 seancorfield: lein expects you to use a project to run code

1:07 lein new app myapp

1:07 then cd myapp; lein run

1:07 and it will run src/myapp/core.clj

1:08 (since you said lein new _app_ to create the project)

1:08 xpika: seancorfield: could it be that i have individual file running program somewhere anyway?

1:08 seancorfield: you pretty much can't run a standalone file without dependencies / classpath etc...

1:09 but there's probably a leiningen plugin that will let you run a standalone non-project file

1:10 noonian: but as far as components go, to me it's unclear whether a component should prefer to take structure it's logic around the state of the cursor it's given, or the :opts map that you can pass in. Doing it in the cursor results in nicer calling syntax imo, but it feels weird that third party components would influence how you have to structure your apps 'state' so you can pass them the appropriate data to render themselves.

1:10 abaranosky: seancorfield: there were some small warts in the api, like needing to explicitly use call to (array-map ...)

1:11 ddellacosta: how can I run a single clojure.test test in the repl?

1:16 ah, I see that you can run it directly, but fixtures get borked. Also, http://dev.clojure.org/jira/browse/CLJ-866?page=com.atlassian.streams.streams-jira-plugin:activity-stream-issue-tab

1:17 looks like it's in 1.6, huh

1:40 bitemyapp: ddellacosta: I've never actually used fixtures.

1:41 ddellacosta: bitemyapp: I use them a fair amount with clojure.test. Very handy for some things.

1:46 shaunxcode: anyone know what the status of avout is?

1:48 sm0ke: unmaintained i would say

1:48 bitemyapp: ddellacosta: I think I accomplish the same thing via simple function calls, but it's entirely likely I could be wrong as I don't really know what people use them for.

2:03 Tolstoy: Do you guys know what it is about this: "{:id :3fc334c0-2214-4f0f-baba-5485c11e1b1f}" that kills the clojurescript edn reader?

2:03 seancorfield: ddellacosta: you can run a test fn manually but it's ugly

2:03 see https://www.refheap.com/22653

2:03 Tolstoy: Ah, starts with a number.

2:03 Jeez.

2:03 seancorfield: that runs an each fixture (each-fn) around the foo test fn

2:05 TEttinger: ,:3

2:05 ddellacosta: seancorfield: thanks, that's better than nothing

2:05 clojurebot: :3

2:05 TEttinger: hm

2:06 seancorfield: if you need a once fixture you'll need to improve a bit :)

2:06 TEttinger: Tolstoy, that looks like uh... it shouldn't be a problem huh

2:06 clojure can handle it on JVM...

2:06 Tolstoy: TEttinger: It's definitely that the keyword starts with a number. Works okay in Clojure, just not Clojurescript.

2:06 TEttinger: ,{:id :3fc334c0-2214-4f0f-baba-5485c11e1b1f}

2:06 clojurebot: {:id :3fc334c0-2214-4f0f-baba-5485c11e1b1f}

2:06 seancorfield: TEttinger: for EDN, keywords cannot begin with a digit - for Clojure they can

2:07 TEttinger: huh

2:07 seancorfield: Tolstoy: use a regular clojure(script) reader instead of edn?

2:08 Tolstoy: seancorfield: Using cljs-ajax, decided to ditch JSON for fun.

2:08 seancorfield: It uses cljs.reader/read-string.

2:08 seancorfield: not edn then? (you said edn earlier)

2:09 Tolstoy: Does clojurescript have an edn reader outside of cljs.reader?

2:09 (I know about clojure.edn.)

2:10 seancorfield: edn reader != regular clojure/cljs reader

2:10 but it sounds like you hit a bug in the cljs reader - you should file a bug on JIRA

2:11 Tolstoy: You mean it's not official that keywords can't start with a number?

2:11 seancorfield: it's de facto allowed - since clojure's reader allows it - but edn does not allow it

2:12 1.6 master introduced a change to disallow it recently but then reverted that change (for clojure)

2:12 the thread is probably on the clojure-dev mailing list

2:12 Tolstoy: Interesting. I use clojure.edn on the server side, and it read those keywords back in (from the file system) just fine.

2:13 seancorfield: hmm, check the edn spec - pretty sure that shouldn't be legal in edn, only in clojure itself

2:13 (i may be wrong of course)

2:14 shaunxcode: yeah that is a valid bug in clojure.edn/read-string

2:14 Tolstoy: shaunxcode: that it ALLOWS :34abc?

2:15 shaunxcode: yeah that should not be allowed

2:31 abaranosky: /msg bbloom already found a use for map-state

2:56 derek_c: how do you update leiningen?

2:56 ah, I see a upgrade command

3:25 riley526: With dommy, how do you make a selection by attribute, e.g. $('tr[data-id=1]')? I tried (sel1 "tr[data-id=1]") but I got "Uncaught SyntaxError: Failed to execute query: 'tr[data-id=1]' is not a valid selector."

3:25 The jQuery version definitely returns the right thing.

3:25 daGrevis: so clojure is compiled to java byte-code?

3:27 TEttinger: daGrevis, yes. clojurescript is compiled to JS

3:28 clojure is compiled to .class files

3:53 logic_prog: the top result on google for "clojure etags" is this so answer: http://stackoverflow.com/questions/1481842/clojure-emacs-etags -- is there a better way to use clojure / tags ? (all I want is to be able to specify a function name, and jump to that function). Node: I'm using cljx, so a nrepl-based-solution would probably jump me to the auto-generated *.clj file rather than the *.cljx file it comes from.

4:11 augustl: logic_prog: nrepl has this

4:11 logic_prog: augustl: can you point me at docs / a blog entry ?

4:13 augustl: logic_prog: I could google it for you :)

4:13 don't have anything bookmarked ^^

4:13 logic_prog: what am I googling for ? "nrepl tags" ?

4:13 and how do I jump back to the cljx file

4:13 augustl: nrepl emacs jump to implementation maybe

4:14 logic_prog: augustl: I don't see it on the first 3 pages of results

4:14 why don't you google it for me? :-)

4:14 my google fu is weak

4:14 augustl: to jump back, C-x b RET will do that (jumps back to the previous buffer)

4:23 Southy: I find having the repl in another pane makes life easier, then C-x o swithes between panes

4:25 katox: c-c c-z to jump back and forth between repl and a file

4:25 plus I can't recommend winner-mode enough

4:25 clgv: Southy: additional REPL monitor for the win ;)

4:27 Southy: clgv: given how muc a second monitor on my iMac would be cost, I think I will give that a miss!

4:28 clgv: yeah, the advantage of a non-aplle product ^^

4:28 *apple

4:29 cheaper and extensible :D

4:30 Southy: I love apple stuff, but I could never convince anyone that it is better than a custom desktop with Linux, due to the cost

4:30 I do a bunch of iOS development so it is a no brainer for me

4:31 switching between clojure in my spare time and objective-c at work is feeling weird at the moment!

4:32 kzar: (Has anyone made a linux laptop comparable to the MBP yet? The pixel is the only one that looked close to me but it has a tiny hard drive.)

4:33 Southy: The specs on the MBP are really high, hence the price. Dell come close, but the price is similar, and then don't supply linux on their top end laptops

4:33 ahihi: Southy: you know you can connect any display to a mac, right?

4:34 Southy: Yeah, but not with full thunderbolt connectivity, and there aren't many monitors less money than the apple one with the same resolution

4:36 not a fan of mismatched resolutions! there are some promising ones coming from china, they are the rejected apple panels put in a similar body, for half the price, if you can actually find someone selling them

4:37 ahihi: right, thunderbolt... my mac pro is old enough that I don't need to worry about that :P

4:38 I have three displays, all with different resolutions. ;) it's not optimal, but it sure beats having only one

4:38 Southy: plus it is an iMac, so you need extra connectors :P my macbook is connected to a normal monitor over HDMI

4:38 kzar: (I want to get occulus rift when it comes otu and use a 3D window manager that would give the illusion of a wall of amazing monitors... if that's possible?!)

5:17 yogsototh: Hi all! Using leiningen2 where should I put my .jar for the plugins?

5:18 lein install in my project dir create a local jar, but I don't know what to do with it. I can't find it by putting the information in .lein/profile.clj

5:25 turbopape: Hi guys,

5:25 would you recommend openjdk for production ?

5:25 or shall you strictly stick with oracle's vm ?

5:26 Southy: they are basically the same these days

5:26 turbopape: ok...

5:26 Southy: java 8 is being developed by the openjdk people

5:26 TEttinger: is oracle more optimized in any way? or does OpenJDK have the same HotSpot JIT?

5:27 turbopape: Think it's the same Engine HotSpot-wise...

5:27 Southy: yeah, pretty sure the compiler is the same

5:29 turbopape: okay, I have another question : How many times does one have to turn back to java... I mean, to optimize calculations, etc...

5:29 Or (Hopefully) will I stay with Clojure (Hopefully) ?

5:30 I mean, these are to assess your feelings in productions, that's why I am asking ... :)

5:33 oskarkv: turbopape I think not a lot. The things that might be too slow sometimes is the datastructures and primitives (boxing). But one can avoid boxing a lot of the time.

5:34 turbopape: oskarkv, by datastructures you mean like (defrecord) ?

5:34 oskarkv: are* :P

5:35 no i mean the standard ones, like vectors and maps. I don't know how fast they are, but they are doing more work than mutable ones.

5:36 turbopape: okay oskarkv , so what is boxing about basically, If i may ask ? (excuse for the n00bness )

5:37 oskarkv: turbopape it's when primitives (int, double, etc) are put into objects (Integer, Double) to fit into certain arguments and data structures

5:37 turbopape: ok ...

5:37 oskarkv, so you are talking java interop ?

5:38 oskarkv: no

5:38 And boxing can happen in pure java too'

5:38 turbopape: okay

5:39 So oskarkv, If I write my whole greedy algorithm in pure clojure, can I rely on - say - map to be performant ?

5:40 (map #(+ % %) vect1 vect2) for instance...

5:40 where vect1 et vect2 would be huuuuuge :)

5:40 kzar: ,(map + (range 10) (range 10))

5:40 clojurebot: (0 2 4 6 8 ...)

5:41 kzar: ,(nth (map + (range) (range)) 1000000)

5:41 clojurebot: 2000000

5:41 turbopape: yeah, kzar, thank you

5:41 :)

5:42 I suppose that if the bot handles it,that says all about it :)

5:42 darthdeus: why do i need to write (-> 5 #(/ % 3) #(+ 4 %)) like (->> 5 (#(/ % 3)) (#(+ 4 %))) ?

5:43 marianoguerra: I find myself using pretty offten (swap! atom-with-map #(assoc[-in]/dissoc[-in] % k [v])) is there a simple lib that provides me a "bucket" kind of thing where I can do (get bucket & ks) (set bucket & ks value) (delete bucket & ks)?

5:43 or am I missing something?

5:43 (I only use this when I need it, I'm not simulating mutability all over the place with this :D

5:43 DerGuteMoritz: darthdeus: because #() creates a function but -> only does a code surface transformation. try (-> 5 (/ 3) (+ 4)) inst ead

5:44 *instead

5:44 darthdeus: that is transformed to (+ (/ 5 3) 4)

5:44 darthdeus: DerGuteMoritz: (/ 3) doesn't do what i want, since i want 3/x and not x/3 :)

5:44 the other way around

5:44 oskarkv: darthdeus because the reader macro #() is expanded first to (fn ....)

5:44 DerGuteMoritz: darthdeus: ok then use ->> instead

5:45 darthdeus: hmhmm

5:45 DerGuteMoritz: that will be transformed to (+ 4 (/ 3 5))

5:46 oskarkv: note that you can write (-> 5 (/ 3) (+ 4)), and that in the case of (#(...)) it does not matter if you use -> or ->>

5:46 darthdeus

5:46 darthdeus: but how does the extra parens with #(...) help there?

5:46 oskarkv: ,(macroexpand '(-> 1 #(+ % 1)))

5:46 clojurebot: (fn* 1 [p1__73#] (+ p1__73# 1))

5:47 oskarkv: see the 1 after fn*?

5:47 that's not right

5:47 ,(macroexpand '(-> 1 (#(+ % 1))))

5:47 clojurebot: ((fn* [p1__98#] (+ p1__98# 1)) 1)

5:48 darthdeus: hmm interesting

5:48 DerGuteMoritz: the extra parens result in the anonymous function created with #() to be applied

5:48 oskarkv: but as i said

5:48 ,(macroexpand '(-> 1 (+ 1)))

5:48 clojurebot: (+ 1 1)

5:48 oskarkv: works

5:48 DerGuteMoritz: yeah no need for #()

5:49 oskarkv: a lot of the time anyway :P

5:49 DerGuteMoritz: yeah :-)

5:49 unless you feel like adding a dash of perl to your code

5:49 darthdeus: i guess i was confused because i thought (+ 1) is a partial application

5:50 Jarda: hey! https://github.com/mylesmegyesi/metis is a great tool for validating input. But do you know a similar that would also return the input sanitized (would remove additional properties and transform numbers from strings to numbers etc)

5:50 oskarkv: darthdeus oh, but clojure does not do implicit partial application

5:51 darthdeus: my brain still thinks every FP language is like haskell

5:52 whilo_: ibdknox: thanks for opensourcing!!!

5:52 oskarkv: darthdeus also not that (+), (+ 1), (+ 1 2 3 4 5) etc are all valid expressoins

5:52 note*

5:56 marianoguerra you dont need #() around assoc there. (swap! atom assoc-in [:a :b] 1) works. Also, there is (reset! atom value) to just set the value without using a function

5:57 marianoguerra and get is of course @atom

5:58 (get-in @atom [k k2])

7:30 derek_c: when you are on REPL, how do you clear the input? ctrl+c terminates the whole REPL

7:30 sm0ke: ctrl-l

7:30 depends actually on the readline config

7:30 oh you said input

7:31 whaever you use in emacs i guess

7:31 C-k?

7:32 well the support for readline in clojure repl sucks big time

7:32 its basically the problem of jline

7:32 no blame on lein

7:40 is it possible to get a fully resolved name from a macro of a function

7:40 so i want a macro like (weird-macro inc 1) which returns 2 and prints "clojure.core/inc"

7:42 hyPiRion: sm0ke: readline issues are dependent on the JVM, not packages trying to solve the issue, trust me on that

7:42 sm0ke: ,(defmacro weird-macro [f & body] `(do (~f ~@body) (prn ~f))))

7:42 clojurebot: #'sandbox/weird-macro

7:42 sm0ke: ,(weirdmacro inc 1)

7:42 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: weirdmacro in this context, compiling:(NO_SOURCE_PATH:0:0)>

7:42 hyPiRion: it's hard to get it working right on JVM

7:43 sm0ke: ,(weird-macro inc 1)

7:43 clojurebot: #<core$inc clojure.core$inc@102e37e>\n

7:43 DerGuteMoritz: ,(defmacro weird-macro [f & body] `(do (prn `~f) (~f ~@body)))

7:43 clojurebot: #'sandbox/weird-macro

7:43 DerGuteMoritz: ,(weird-macro inc 1)

7:43 clojurebot: #<CompilerException java.lang.RuntimeException: No such var: sandbox/f, compiling:(NO_SOURCE_PATH:0:0)>

7:43 DerGuteMoritz: ,(defmacro weird-macro [f & body] `(do (prn `~~f) (~f ~@body)))

7:43 clojurebot: #'sandbox/weird-macro

7:43 DerGuteMoritz: ,(weird-macro inc 1)

7:43 clojurebot: #<core$inc clojure.core$inc@102e37e>\n2

7:43 DerGuteMoritz: arg

7:44 sm0ke: DerGuteMoritz: doesnt works

7:44 DerGuteMoritz: i checked on my repl

7:44 DerGuteMoritz: nested quasiquote is tricky

7:44 just a sec, will not spam the channel

7:44 sm0ke: hyPiRion: no

7:44 hyPiRion: i dont agree

7:44 hyPiRion: python did a pretty good job man

7:44 its really barebones

7:45 all you had to do was wrap readline already present in unix

7:45 !!!

7:45 really!

7:46 ,(defmacro weird-macro [f & body] `(vec (~f ~@body)))

7:46 clojurebot: #'sandbox/weird-macro

7:46 sm0ke: ,(weird-macro inc 1)

7:46 clojurebot: #<RuntimeException java.lang.RuntimeException: Unable to convert: class java.lang.Long to Object[]>

7:46 hyPiRion: ,(defmacro weird-macro [f & body] `(do (prn (var ~f)) (~f ~@body)))

7:46 clojurebot: #'sandbox/weird-macro

7:46 sm0ke: ,(weird-macro inc 1)

7:46 clojurebot: #'clojure.core/inc\n2

7:46 sm0ke: whoa!

7:46 you are a genius

7:47 hyPiRion: I have my moments :p

7:47 DerGuteMoritz: var is a good idea

7:47 rurumate: is there a library to do something like curl -O, i.e. streaming http (to file, or to seq)

7:48 sm0ke: rurumate: well http libs normally return inputstreams

7:48 you can write that to file or whatever by reading chunks

7:49 rurumate: sm0ke: oh really? I'll chek if clj-http has that

7:50 ok there is {:as :stream}, thanks for the hint

7:50 sm0ke: ,(doc var)

7:50 clojurebot: Titim gan éirí ort.

7:50 TEttinger: I'm wondering what can be accomplished with code-golf to make as short of a gcd function as possible. you have 10 chars. Can it be done?

7:50 sm0ke: what!

7:51 hyPiRion: hey how did you figure that out?

7:51 hyPiRion: how do you 'think in macros'?

7:52 hyPiRion: sm0ke: first, think what you want the macro to expand to

7:52 secondly, use macroexpand-1 to check if the expansion you do is correct

7:52 well, that's essentially it for me really.

7:53 sm0ke: hyPiRion: so you think like a compiler ?

7:53 lol

7:53 TEttinger: BE the compiler

7:53 * rurumate has-a compiler

7:53 hyPiRion: sm0ke: well, sort of

7:53 sm0ke: hmm its weird, although i know macros would work on the code a data, but its easy to forget they can also execute code normally

7:54 hyPiRion: except you just transform one piece of code to another piece of same code

7:54 sm0ke: hyPiRion: you can have a macro just starting with (if) or (when) too right?

7:54 hyPiRion: yeah, sure thing

7:54 sm0ke: thats where its sucks to reason about it

7:55 i mean if it starts with `() as top level form, its really easy to reason about

7:55 otherwise not so easy

7:56 hyPiRion: indeed. It's usually very, very smart to use macroexpand-1

7:56 sm0ke: joc has some complex macros

7:56 yea sure thing

7:56 hyPiRion: or walk/macroexpand-all

7:56 sm0ke: nah

7:56 TEttinger: so someone challenged me to a FizzBuzz code golf competition (I used clojure, he used Chicken Scheme), and while this works on my bot on quakenet because I pre-import a numeric tower lib, it won't here. My solution is 70 chars, his is 78.

7:56 ,(map #(if-let[n({15"FizzBuzz"3"Fizz"5"Buzz"}(gcd% 15))]n%)(range 101))

7:56 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: gcd% in this context, compiling:(NO_SOURCE_PATH:0:0)>

7:57 hyPiRion: TEttinger: because 1.5 and onwards doesn't do read `hey%` as `hey %` anymore

7:57 or 1.6, not sure

7:57 TEttinger: also gcd isn't defined

7:58 hyPiRion: oh yeah

7:58 TEttinger: ,(map #(if-let[n({15"FizzBuzz"3"Fizz"5"Buzz"}(gcd % 15))]n %)(range 101))

7:58 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: gcd in this context, compiling:(NO_SOURCE_PATH:0:0)>

7:58 TEttinger: so 8 chars

7:58 dav: if I (use) a namespace A that's already (use)ing a namespace B, shoulding I see both the functions of A and B ?

7:58 hyPiRion: ,(defn gcd [a b] (if (zero? b) a (recur b (mod a b)))) ;; TEttinger, try now

7:58 clojurebot: #'sandbox/gcd

7:59 hyPiRion: dav: no

7:59 TEttinger: ,(map #(if-let[n({15"FizzBuzz"3"Fizz"5"Buzz"}(gcd % 15))]n %)(range 101))

7:59 clojurebot: ("FizzBuzz" 1 2 "Fizz" 4 ...)

7:59 TEttinger: yep

7:59 dav: hyPiRion: is there a way to ?

7:59 TEttinger: but I'm running a lazybot and can't define

8:00 hyPiRion: dav: https://github.com/ztellman/potemkin has some ways of handling that

8:00 derek_c: when you are on REPL, how do you clear the input? ctrl+c terminates the whole REPL

8:00 dav: hyPiRion: thanks.

8:00 derek_c: Ctrl+L

8:01 derek_c: then backspaces :)

8:01 derek_c: I mean, how do you clear the thing you already type in a line

8:01 hyPiRion: derek_c: C-a C-k

8:01 derek_c: hyPiRion: that works :)

8:01 dav: derek_c: Ctrl+C doesn't terminate the whole REPL for me btw.

8:01 sm0ke: fking jline doesnt let me use my awesome vim bindings

8:01 rurumate: How to consume and open InputStream? I usually call file-seq, but this is not a file, and it might not be newline-delimited

8:01 derek_c: dav: does for me

8:02 sm0ke: and moeover it braks everything else

8:02 rurumate: *an open InputStream

8:02 hyPiRion: sm0ke: I think they would be very happy to get some contributions

8:02 sm0ke: da da da

8:02 dav: derek_c: http://tiswww.case.edu/php/chet/readline/readline.html#SEC4

8:04 rurumate: oh I see, clojure.java.io/copy may help

8:07 sm0ke: is there a way to write a function in clojure which dispatches on type?

8:08 i mean a multivariate based on type

8:08 dav: sm0ke: you don't want to do (if (= (class.. ?

8:08 sm0ke: multivariate is the wrong term*

8:09 dav: no

8:09 dav: sm0ke: because it's ugly or because you have another reason ?

8:09 sm0ke: its ugly

8:09 hyPiRion: defmulti on type?

8:09 dav: sm0ke: maybe with core.match :guards ?

8:09 hyPiRion: or just, you know, protocols

8:10 sm0ke: what~ thats 3x ugly!!

8:10 dav: yeah I guess that is kind of point or protocols ;-)

8:11 dnolen: TEttinger: (map #({15"FizzBuzz"3"Fizz"5"Buzz"}(gcd % 15) %)(range 101))

8:11 TEttinger: quite a bit shorter

8:12 sm0ke: or may be one can write a macro for me, defnt

8:12 some macro expert

8:12 * sm0ke looks at hyPiRion

8:13 dnolen: sm0ke: multimethods

8:13 sm0ke: but protocols work just as well in the simple case

8:13 sm0ke: multiethods dispatched on types?

8:13 TEttinger: dnolen, maps have an else case when the lookup fails?

8:13 sm0ke: dispatches*

8:13 TEttinger: wow

8:13 dnolen: sm0ke: they can dispatch on anything the dispatch-fn returns

8:14 TEttinger: yep

8:14 TEttinger: neat

8:14 sm0ke: hmm weird how come i never used multimethods

8:15 ah nice

8:15 multimethods is the way i guess

8:15 thanks

8:18 ,(isa? 1 2)

8:18 clojurebot: false

8:18 sm0ke: whats so special about isa?

8:19 why are multimethds using isa??

8:19 lazybot: sm0ke: What are you, crazy? Of course not!

8:19 sm0ke: lol

8:20 unless the whole point was to dispatch on types

8:21 dnolen: sm0ke: ad-hoc hierarchies not connected to types

8:22 sm0ke: what?

8:22 clojurebot: what is exceptions

8:23 sm0ke: ok

8:24 later!

8:27 TEttinger: ,(map #(condp(fn[x y](= 0(mod y x)))% 15"FizzBuzz"3"Fizz"5"Buzz"%)(range 101))

8:27 clojurebot: ("FizzBuzz" 1 2 "Fizz" 4 ...)

8:28 TEttinger: even without the numerics lib predefining gcd, it can be done in one less char

8:47 alew: dnolen: the reason maps have an else case is because it is just using get underneath, right?

8:48 dnolen: alew: ILookup

8:48 alew: which is what get uses too

8:48 oracle123: what's the differnt for the following 2? one has "do" while another doesn't

8:48 (defn bond [] (send b #((Thread/sleep %1) (inc %1))))

8:48 (defn bond [] (send b #(do (Thread/sleep %1) (inc %1))))

8:48 the one with "do" work as (await b) it will wait

8:49 dnolen: ,(nil (inc 1))

8:49 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)>

8:49 dnolen: oracle123: ^

8:49 oracle123: w/o do you have function call on the result of Thread/sleep

8:50 oracle123: I just want to run the them one by one, so I need to use "do", correct?

8:50 dnolen: oracle123: sure, but you should understand why the first one doesn't work

8:50 alew: It always a shock when you realize you have java interfaces underneath everything in clojure

8:51 Kallikrates1: Can anyone recommend some resources on workflow (excluding emacs?)

8:53 oracle123: understand now: without do, the first position of the out most list is (Thread/sleep 100) which is evaluated as nil, and nil is not a sepecial form or function. thanks very much

9:01 jcromartie: blerg

9:02 having an argument with a teammate about how to do "dependency injection" in Clojure

9:02 because he doesn't like the fact that a route handler function has to know that a database exists in order to get business objects from the database

9:02 pyykkis: jcromartie: partial application?

9:03 jcromartie: pyykkis: that's a possibility

9:04 pyykkis: jcromartie: this was lot's of fun to watch :) http://www.youtube.com/watch?v=ZasXwtTRkio

9:04 goraci: hi there is there any way to update repo in maven ? any tools ? or native maven commands ?

9:04 pyykkis: (about scala, but with relevant topic)

9:05 tbaldridge: jcromartie: the more I use stuartsierra's component lib, the more I'm convinced that it does it right.

9:05 jcromartie: so instead of passing a db connection that the handlers use to call model functions, you pass partially-applied versions of the model functions?

9:06 that's exactly what I advocate tbaldridge

9:06 well, not specifically stuartsierra's component

9:07 IoC = taking arguments

9:07 and just a simple map of services

9:13 goraci: so any one familiar with maven here ?

9:17 alew: how do you accomplish reification with stuart sierra's components if you want to work at a lower level than the interface provides?

9:18 TEttinger: goraci, I have some basic experience making java projects into maven projects

9:19 stuartsierra: alew: Not sure I understand your question.

9:19 goraci: TEttinger: so any way to update repos in maven repo ? with depencies

9:19 katox: goraci: st like mvn clean install -U

9:20 goraci: katox: it will update all the packages ?

9:21 jcromartie: as nice as stuart's component library is, we don't actually have any lifecycle :P they are all outside APIs

9:21 i.e. no connection pools

9:21 katox: goraci: packages in project deps

9:21 alew: I'm probably abusing terminology, and the question I am asking is probably a victim of any abstraction, but how would I take advantage of lower level optimizations of an underlying implementation of a component when needed?

9:21 stuartsierra: jcromartie: You don't have to use the Lifecycle protocol; it defaults to a no-op.

9:22 katox: goraci: transitively

9:22 AeroNotix: hi guys/gals. I have a Java jar I built with ant and I want to use it in my Clojure project. Any documentation on how to do that?

9:22 jcromartie: stuartsierra: what is the advantage over just using a map if there's no lifecycle?

9:22 goraci: katox: and what about lein update-in ? it will not do the thing ?

9:22 AeroNotix: (I'm using/learning Lein, too, so any documentation including that would be great)

9:22 jcromartie: stuartsierra: except the ease of adding lifecycle when the requirement inevitably comes along :)

9:23 stuartsierra: jcromartie: The dependency-injection part still works. You can subdivide your app into smaller components. Instead of passing one big map containing everything to every function, you can pass exactly what each component needs.

9:24 vijaykiran: AeroNotix: one way would be to add your jar to local maven repo, and add dependency in your project.clj

9:24 AeroNotix: vijaykiran: I have the .jar in my project's lib dir

9:24 stuartsierra: jcromartie: It's not a huge benefit for small apps, but it helps when you have 20+ components.

9:25 jcromartie: I see

9:25 katox: goraci: unusure, I use this http://dev.xscheme.de/2013/07/upgrade-your-projects-dependencies-using-lein-ancient-wip/

9:25 alew: btw, is there any refactoring tools for clojure right now? I'm guessing not

9:25 vijaykiran: AeroNotix: in your lib dir do a maven install with your desired groupId and artifactId, that will install the jar into your local maven repo

9:26 AeroNotix: then you can add a dependency

9:26 AeroNotix: vijaykiran: any docs on that? I'm not a java programmer so the maven stuff I don't understand

9:26 stuartsierra: alew: Sorry, still not understanding the question. Components are just records or maps, you can do whatever you want to them.

9:27 vijaykiran: AeroNotix: try http://www.elangocheran.com/blog/2013/03/installing-jar-files-locally-for-leiningen-2/

9:27 edw: A bit confused about this:

9:28 vijaykiran: AeroNotix: you need to customize the mvn install command in that post

9:28 edw: ,(cond-> 42 even? inc)

9:28 clojurebot: 43

9:28 edw: Yet:

9:28 alew: stuartsierra: I was confusing your library with another one which worked with protocols for the actual dependencies, sorry about that

9:28 stuartsierra: alew: Ah, I see. No worries.

9:28 edw: ,(cond-> 42 (even?) inc)

9:28 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core/even?>

9:28 edw: What's up with that?

9:28 Because:

9:29 ,(cond-> 42 (> 1) inc)

9:29 clojurebot: 43

9:29 alew: ,(macroexpand-1 (cond-> 42 (even?) inc))

9:29 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core/even?>

9:29 alew: ,(macroexpand-1 '(cond-> 42 (even?) inc))

9:29 clojurebot: (clojure.core/let [G__127 42 G__127 (if (even?) (clojure.core/-> G__127 inc) G__127)] G__127)

9:30 alew: ,(macroexpand-1 '(cond-> 42 even? inc))

9:30 clojurebot: (clojure.core/let [G__152 42 G__152 (if even? (clojure.core/-> G__152 inc) G__152)] G__152)

9:31 AeroNotix: vijaykiran: ok that's done, I think?

9:31 vijaykiran: AeroNotix: ?

9:31 edw: Ah, I see: the tests don't get the value threaded through. I misunderstood what cond-> does.

9:31 AeroNotix: vijaykiran: I mean, I did that and now I have the repo in the ~/.m2 directory

9:32 vijaykiran: AeroNotix: ok, now you can add it as a dependency to your project

9:32 edw: I thought (cond-> 42 (even?) inc) would expand to (if (even? 42) (inc 42)).

9:32 AeroNotix: vijaykiran: done, just need to figure out how to import classes from it now.

9:33 vijaykiran: is there a way to enumerate the available classes?

9:34 vijaykiran: AeroNotix: just try importing one of the known classes in repl, it should also have auto completion

9:34 AeroNotix: vijaykiran: hmm

9:35 in a lein repl: (:import [local/<TAB>] == nothing

9:35 stuartsierra: AeroNotix: If you really don't know the pakcage/class names, you can examine the contents of the JAR file with `jar tf file.jar`

9:35 AeroNotix: stuartsierra: cheers, checking

9:36 stuartsierra: There's no easy way to enumerate packages on the classpath, and I don't think any of the Clojure-based tools do so.

9:36 vijaykiran: AeroNotix: Do you know the source of the jar file ? "local" doesn't look like a plausible package name

9:37 AeroNotix: stuartsierra: ok I see that a class is available as "net/authorize/Market.class"

9:37 and I'm trying to import it as: (:import [local/authnet.net.authorize Merchant]))

9:37 vijaykiran: AeroNotix: you don't need local/

9:37 AeroNotix: ok trying

9:38 vijaykiran: class not found

9:38 (:import [authnet.net.authorize Merchant])

9:38 stuartsierra: If the file name is "net/authorize/Market.class" you would import it as (ns (:import (net.authorize Market)))

9:38 vijaykiran: AeroNotix: use (:import [net.authorize Market])

9:38 AeroNotix: the pacakge = folder path (with dots instead of /)

9:38 AeroNotix: vijaykiran: ok it RUNS

9:39 stuartsierra: That is (ns foo (:import (net.authorize Market)))

9:39 AeroNotix: stuartsierra: ahhhh good tip

9:39 thanks both

9:39 vijaykiran: yw

9:40 stuartsierra: you're welcome

9:45 AeroNotix: so, what happens when two jars provide e.g. net.authorize?

9:46 joegallo: first one on the classpath wins

9:46 AeroNotix: oke doke

9:48 jcromartie: so, for example, using stuart's component, would you build a web app with the db as a component, and with the data model as a component that depends on the db? and with a web handler as a component that depends on the data model?

9:49 obviously then I'd need a lot more protocol functions for the components

9:50 or am I misunderstanding

10:03 ToBeReplaced: jcromartie: your connection pool is a component. by web handler, the pure function wouldn't be, but the jetty/tomcat/whatever instance would be

10:05 your system map would include the handlers and the like, but they aren't components in the same way since they have no setup/teardown... you would be including them in the system map so that you can poke and prod easier for testing and simulation

10:11 stuartsierra: jcromartie: The component operations don't have to be protocols. Again, they're just records or maps, so they can just be containers for things like DB connections.

10:13 jcromartie: I think I grok it now stuartsierra

10:14 I'm more confused by the argument with my coworker here :P

10:14 basically he's tired of passing dependencies to functions

10:14 like, the web app literally depends on 6 other services

10:14 outside things

10:15 so at the top level it needs to receive all 6, and then pass down what is needed at different levels

10:15 stuartsierra: Sure, that's a common situation.

10:15 jcromartie: yeah

10:15 I just don't see the problem with passing arguments

10:15 not that I want 6 arguments

10:15 but pass a map of services

10:16 at least until you get to a function that only needs to coordinate one or two services

10:17 I don't see a lot of consistency though... the get-project function just takes the database and a key

10:17 but the create-project function takes the database, and 3 other API connections

10:17 stuartsierra: Yep. The 'Component' lib just helps create maps/records only include a subset of the services.

10:17 Obviously, you have to refactor your functions to take the maps as arguments, and be consistent about keys/names.

10:17 clojurebot: No entiendo

10:18 jcromartie: I guess the question is where to draw the line at components

10:19 stuartsierra: Yes.

10:19 You can go overboard and make too many small components.

10:20 gfredericks: this surprised me: ##(let [^double x 4/5] (Math/abs x))

10:20 lazybot: java.lang.IllegalArgumentException: No matching method found: abs

10:20 gfredericks: um wait

10:20 stuartsierra: gfredericks: type hints are not casts

10:20 gfredericks: stuartsierra: this worked in another process

10:20 the above result is what I expected

10:20 derek_c: has anyone here used lein-droid

10:20 ?

10:20 gfredericks: &*clojure-version*

10:20 lazybot: ⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}

10:20 gfredericks: ,(let [^double x 4/5] (Math/abs x))

10:20 clojurebot: 0.8

10:21 gfredericks: stuartsierra: ^

10:21 TimMc: ...huh

10:21 stuartsierra: gfredericks: That's probably just an implementation side-effect.

10:21 TimMc: Works By Accident?

10:21 stuartsierra: yep

10:21 type hints are weird

10:22 TimMc: I don't see a mechanism for this to work, though.

10:22 gfredericks: Might be worth compiling and disassembling it.

10:23 stuartsierra: For the record, I think it should be (let [x (double 4/5)] (Math/abs x))

10:24 gfredericks: oh for sure

10:25 ,(let [x 4/5, ^double y x] (Math/abs y))

10:25 clojurebot: 0.8

10:31 CookedGryphon: derek_c: yeah, I'm using it right now

10:32 edbond: Hello everyone, lein cljsbuild produce file with mtime Jan 1 1970. why? how to fix this?

10:32 derek_c: CookedGryphon: do you have to do a `lein droid doall` whenever you change something to test it out? It's quite slow

10:32 edbond: simple project 'lein new mies test; lein cljsbuild once' and file date is Jan 1 1970 :(

10:33 (spit) creates a file with current date, java is sun 1.7.0

10:33 CookedGryphon: derek_c: no, it opens up a repl on port 9999

10:34 derek_c: so you can connect to it from emacs/your editor of choice

10:34 derek_c: and apply your changes without even restarting the app

10:36 edbond: other files have proper date, .js content is also fine. Incorrect date only

10:36 derek_c: CookedGryphon: sorry I'm confused. how do you do it?

10:37 CookedGryphon: derek_c: what's your normal setup for editing normal clojure code?

10:37 do you know emacs or anything?

10:38 derek_c: CookedGryphon: I use Sublime

10:39 gfredericks: is there some reason why `lein test` would fail to hang due to thread-leak?

10:40 i.e., when I do something via `lein run` it hangs because I didn't shut some things down; but doing the same thing within `lein test` exits anyways

10:40 CookedGryphon: or do you use lein repl?

10:40 derek_c: hm, I'm afraid I don't know how to set up a repl/evaluate forms in sublime....

10:41 you can however do lein repl :connect 9999

10:42 and interact with it at least

10:43 derek_c: CookedGryphon: interesting.. thanks I will dig into it

10:43 gfredericks: ah I see `lein test` uses System/exit

10:44 xeqi: gfredericks: I would guess you have something happening on the agent thread pool. That stays alive for a bit after finishing and keeps the jvm alive

10:45 derek_c: CookedGryphon: are you aware of any open-source app that uses lein-droid? Wanna take a look for reference

10:46 CookedGryphon: derek_c: https://nightweb.net/

10:46 gfredericks: xeqi: I wasn't asking why it was hanging, I was asking why it didn't hang in `lein test` as well

10:47 the answer being `lein test` uses System/exit

10:48 CookedGryphon: derek_c: https://github.com/oakes/Nightweb sorry

10:48 derek_c: CookedGryphon: got it. thanks!

10:49 gfredericks: what's the community opinion on varargs for option-maps?

10:50 I thought there was mild dislike for it

10:50 nDuff: ...it's nasty, but it's also a widely-accepted idiom?

10:50 TimMc: Definitely nasty.

10:50 derek_c: CookedGryphon: Is there a tutorial for setting things up like you said with Emacs?

10:51 gfredericks: what I was surprised by is that this page explicitly recommends _always_ using varargs: http://dev.clojure.org/display/community/Library+Coding+Standards

10:51 TimMc: Let's compromise and use a pattern like (grovel 1 2 [:foo 3] [:bar 4])

10:51 and *everybody* can be angry

10:51 that's what compromise means right

10:52 Southy: http://www.braveclojure.com/ has a bunch of stuff for setting up emacs

10:52 pyrtsa: FWIW, it's much easier to pass a simple `opts` map on to another function, (f x opts), compared to something like (apply f x (apply concat opts)).

10:52 Southy: he has a gitrepo with a bunch of pre-installed stuff, which you can cherry pick if you don't like his settings

10:52 I like white text on black background but some people done

10:52 *don't

10:53 gfredericks: pyrtsa: yeah that's why I'd avoid the varargs

10:53 pyrtsa: Likewise.

10:53 pandeiro: anyone using swag to produce REST API documentation?

10:53 CookedGryphon: derek_c: so I'd recommend trying out the normal emacs workflow a bit, beyond that it's just a case of instead of doing nrepl-jack-in, do nrepl and enter 127.0.0.1, port 9999 when prompted

10:54 gfredericks: any guesses what is the best avenue for proposing changes to that page?

10:54 clojure ML? clojure-dev?

10:54 derek_c: CookedGryphon: I'm thinking about still using Sublime for normal editing, and use Emacs just to interact with nrepl. do you think that will work?

10:55 CookedGryphon: derek_c: not really, the power comes from saying "evaluate this form my cursor is on in my editor"

10:55 derek_c: if you want to avoid learning emacs, maybe try nightcode

10:55 that's got templates for android projects and should set you up with a repl and simple evaluation keyboard shortcuts

10:56 in a fairly "normal" editor

11:05 stuartsierra: gfredericks: opinion varies on varags vs maps for optional named arguments.

11:06 In the past, Rich has recommended varargs for optional named arguments.

11:06 But if a map makes more sense, for example if you're going to create a map once and reuse it, then use a map.

11:09 clgv: pyrtsa: gfredericks: you might be interested in https://github.com/guv/clojure.options

11:10 Wild_Cat: woo, just submitted a pull request for Cheshire. This marks my very first attempt at actually contributing Clojure code.

11:10 hyPiRion: (inc Wild_Cat) ; :D

11:10 lazybot: ⇒ 1

11:10 Wild_Cat: :D

11:14 derek_c: CookedGryphon: I'm afraid I'm still missing something. So I got nightcode running and I got a repl. now am I suppose to type something into the repl to make the app reflect the changes I made?

11:14 gfredericks: stuartsierra: there's also the issue of composability

11:14 if I want to wrap a function with some partial set of options it's quite clunky

11:17 stuartsierra: gfredericks: yes, a common complaint about that style

11:18 gfredericks: okay, so it's not worth suggesting a change to the "always use varargs" recommendation?

11:19 stuartsierra: gfredericks: I don't think so.

11:19 gfredericks: okay, thanks

11:20 stuartsierra: you're welcome

11:20 CookedGryphon: derek_c: oops, seems I overestimated nightcode :( sorry, it doesn't have the ability to evaluate forms, I thought it did

11:20 derek_c: your biggest long term payoff will come from learning the emacs toolset, as that's what most clojure stuff is geared towards

11:21 derek_c: CookedGryphon: I see :(

11:30 pyrtsa: "In the past, Rich has recommended varargs for optional named arguments." <- Gotta love that as an argument. :o)

11:37 hyPiRion: Emphasis on "In the past" I guess

11:41 gfredericks: In the future, Rich has recommended writing all code comments in Zorblaxian to please the overlords

11:44 logic_prog: I normally fire up lein, from a shell, via "lein pdo cljx auto, run -m server.main" and then connect to it via emacs with M-x nrepl. Is there a way to launch the nrepl directly from emacs ?

11:45 justin_smith: logic_prog: do you need those exact lein args? if not you can nrepl-jack-in while visiting a file in the project

11:46 and if so there may be a way to make it happen still

11:46 logic_prog: I need those exact args

11:47 stuartsierra: pyrtsa: not intended an argument, but that was the source of the recommendation on dev.clojure.org/display/community/Library+Coding+Standards

11:47 justin_smith: logic_prog: to tell the truth, I prefer to run clojure in a terminal and connect, maybe a happy medium is making a shell script that runs that and putting it at the top level of your project?

11:48 logic_prog: justin_smith: I often find myself in the situation that something goes wrong in my clojure code,

11:48 I look at teh terminal for the stack frame

11:48 then try to navigate to the location.

11:48 If all this data was in emacs, I'd be easiser to "jum pto this stack frame"

11:48 perhaps there's a simpler way to solve this problem

11:50 justin_smith: hmm - M-x compile with the above lein command as the "compile command"? that should make any errors indicating file positions into clickable links

11:50 that is a hack though

11:50 dnolen: logic_prog: most of the development environment provide this for you

11:51 logic_prog: dnolen: what are you referring to? I'm using clojure-mode in emacs already

11:51 justin_smith: dnolen: yeah, nrepl-jack-in would do what he wants, except he needs a custom set of args that runs his app, and I don't think jack-in provides for that

11:52 logic_prog: dnolen: are you using a different ide ?

11:52 dnolen: logic_prog: I use cider mostly

11:52 logic_prog: but Cursive Clojure is probably the coolest environment I've played around with

11:52 logic_prog: dnolen: isn't that some proprietary crap with intellij ?

11:52 dnolen: logic_prog: I'm just tied to Emacs for other reasons

11:52 logic_prog: dnolen: is it that goo d?

11:52 dnolen: logic_prog: "crap" lol

11:52 logic_prog: it's amazing

11:53 logic_prog: most people I know who prefer more human environment that don't care about random Emacs goodies have moved on

11:53 s/human/humane

11:53 logic_prog: dnolen: I used vim for 15 years before recently switching to emacs in the past year due to clojure

11:53 dnolen: you're now telling me to use something with buttons and pretty pictures?

11:54 dnolen: logic_prog: no, but it's worth taking a look at

11:54 logic_prog: I've tried nearly every setup just to see what different things offer

11:54 arkh: are closures discouraged in clojure or just uncommon?

11:54 logic_prog: downloading intellij free edition now

11:54 dnolen: arkh: they are common

11:55 logic_prog: it's worth reading the Cursive introduction to get things setup, that's the main hurdle IntelliJ in it's default state is not that nice.

11:55 logic_prog: damn it

11:55 it rquires java 6, so can't work on java 7?

11:55 dnolen: logic_prog: you've also got light table which I have to say is a way better CLJS than Emacs today

11:55 TEttinger: hm?

11:56 logic_prog: dnolen: I do mostly cljx

11:56 Wild_Cat: so I'm reading the lib coding standards -- how exactly does one define a function with optional named arguments?

11:56 dnolen: logic_prog: got it

11:56 logic_prog: dnolen: how is light table?

11:56 TEttinger: java 6 is incompatible with 7 in what ways?

11:56 dnolen: logic_prog: great for CLJS, seems passable for Clojure

11:56 arkh: dnolen: are we talking about the same thing? Writing a function that creates local state which returns a function accessing that state? (<- I'm sure there's much better explanations ...)

11:56 TEttinger: logic_prog, it's still a little rough around the edges, but it's quite nice

11:56 dnolen: arkh: that's not what a closure is

11:56 arkh: dnolen: oh

11:57 dnolen: arkh: the only important part is capturing the environment

11:57 TEttinger: a closure is a kind of function that can access the environment/scope it was created in

11:57 jballanc: TEttinger: I don't think it has to be a function...could be a data structure just as easily

11:57 arkh: Tettinger: right - that's what I meant

11:57 dnolen: arkh: and no the pattern you're describing is not that common

11:58 TEttinger: jballanc, you could be right, though I admit I've never seen that usage

11:58 logic_prog: dnolen: let's make a deal

11:58 justin_smith: it is a block of code that captures bindings

11:58 jballanc: TEttinger: I think it's more common in scheme

11:58 logic_prog: dnolen: for each of {cursive, cider, lighttable} I try, you write a blog post :-)

11:58 justin_smith: let and fn are both closure creating

11:58 dnolen: logic_prog: no deal

11:59 justin_smith: in some languages let is built in terms of fn

11:59 TEttinger: dnolen, 2 blog posts then

11:59 justin_smith: (or lambda or whatever they call it)

11:59 dnolen: TEttinger: heh

11:59 TEttinger: I don't even know what your blog is!

12:00 * arkh huge fan of dnolen blog posts

12:00 logic_prog: dnolen: I installed cursive plugin + restart intellij

12:00 how do I create a clojure project ?

12:00 http://cursiveclojure.com/userguide/ui.html is rather light on "how the fuc do I get started"

12:01 dnolen: logic_prog: yeah it could be a little bit clearer but you can just open an existing project

12:01 logic_prog: pretty sure there's a cursive IRC channel ask there

12:03 logic_prog: dnolen: alright, got it opened

12:03 dnolen: and now I'm missing my evil-mode keys

12:04 dnolen: logic_prog: it's a big world and people share your problems ;) http://plugins.jetbrains.com/plugin/164

12:04 logic_prog: dnolen: I am out of excuses and will not spend some time investiating

12:10 TimMc: TEttinger: http://swannodette.github.io/

12:19 pyrtsa: stuartsierra: Sorry, just meant to say it's probably better to point out the actual reasoning (" Callers should not have to wrap optional named arguments in a map literal") instead of who said it.

12:21 I think the above guideline makes sense when you don't have many arguments, counting both the required and optional ones. When you do, it's better to pass in maps instead.

12:30 arrdem: 'mornin

12:35 stcredzero: my prediction from last night came true

12:35 technomancy: nice; suddenly the percentage of clojure users using non-oss editors dropped to under 10%

12:36 stcredzero: technomancy: where are you getting the 10% from?

12:36 technomancy: stcredzero: from cemerick's survey data

12:36 http://cemerick.com/2013/11/18/results-of-the-2013-state-of-clojure-clojurescript-survey/

12:37 specifically http://p.hagelb.org/clojure-editors-2013.png

12:37 stcredzero: Oh, I thought you were referring to Light Table being GPL'd.

12:37 hiredman: «A proposal (by others) for some sort of Value»

12:37 whoops

12:37 stupid pasting

12:38 "A proposal (by others) for some sort of Value Types seems to be a sure thing." -- Doug Lea

12:38 yay!

12:38 llasram: hiredman: What does that mean?

12:40 technomancy: stcredzero: yes, that was the "suddenly" part =)

12:41 stcredzero: technomancy: from the URL, it seems this dates from Nov 18. I thought Light Table was GPL'd more recently.

12:41 technomancy: stcredzero: right; I'm assuming the numbers haven't changed dramatically in the last couple months

12:42 stcredzero: technomancy: so then it has nothing to do with Light table and you were being ironic

12:42 hiredman: llasram: long:Long::value types:regular jvm object types basically

12:42 technomancy: stcredzero: not really?

12:43 stcredzero: technoman: You gots some 'splainin to do.

12:43 technomancy: up till two days ago, there were ~18% of clojure users using non-oss editors

12:43 now it is under 10%

12:43 darthdeus: how can i tell what's the current directory for (slurp "something") ?

12:43 rukor: dnolen: please what's the best way of making this work? https://www.refheap.com/22727

12:44 stcredzero: Ah, I see, you were treating both numbers as a gauge of the same thing.

12:44 dnolen: rukor: gist w/o explanations of what's going on isn't very helpful :)

12:44 rukor: dnolen: sorry

12:44 stcredzero: Interesting: "more than a quarter of ClojureScript developers don?t use a REPL at all" -- from http://cemerick.com/2013/11/18/results-of-the-2013-state-of-clojure-clojurescript-survey/

12:45 technomancy: sobering =(

12:45 rukor: dnolen: trying to use the rhizome function to build a component from derived data

12:45 technomancy: but given how complicated the process is, I can't say it's surprising

12:47 dnolen: rukor: there's quite a few things wrong at first glance in that paste

12:47 rukor: row isn't returning a component

12:47 stcredzero: technomancy: entirely agree. ClojureScript REPL has been the epitome of stovepipe software. It's way to easy for it to fall over, requiring another litany to get it running again

12:47 llasram: hiredman: That's what I thought. Interesting

12:47 hiredman: http://cs.oswego.edu/pipermail/concurrency-interest/2014-January/012169.html is the email the quote is from

12:48 justin_smith: darthdeus: (System/getenv "PWD")

12:48 dnolen: rukor: what's the point of using om component facilities at all here, nothing is really based on app state

12:48 rukor: just make a function that returns React stuff

12:48 darthdeus: justin_smith: i'm getting nil

12:48 justin_smith: darthdeus: you can use (slurp (io/resource "something")) to look something up relative to the classpath

12:48 technomancy: darthdeus: also (system/getProperty "user.dir") probably more portable

12:49 justin_smith: technomancy: ahh, thanks, I didn't know PWD wasn't universal

12:49 darthdeus: ah good, thanks :) getProperty "user.dir" works

12:49 justin_smith: where the hell do those other systems get off not being POSIX anyway

12:50 darthdeus: justin_smith: i have $PWD, but i guess it's not when i launch lighttable as an .app

12:50 rukor: dnolen: i see. Reusable components so not need to use om/component righr?

12:50 dnolen: rukor: nope

12:50 justin_smith: darthdeus: interesting, I intended the above to be sarcastic if it wasn't clearly so

12:50 dnolen: rukor: unless you need to interact with app state or local state, just use React stuff

12:51 rukor: dnolen: thanks. That solves my problem indeed.

12:51 darthdeus: justin_smith: i got the sarcasm :P

12:51 justin_smith: darthdeus: I just forget that anyone uses anything but a GNU/Linux stack sometimes

12:51 I mean why would anyone use a system I wouldn't use? silly people

12:51 technomancy: justin_smith: ignorance: sweet sweet bliss

12:51 darthdeus: OS X is more posix than linux :) at least it's BSD core :P

12:52 justin_smith: darthdeus: well all posix shell must provide PWD, which means whatever "shell" runs a .app is not posix

12:53 technomancy: there is a really great quotation I wish I could find about how posix compliance has as much to do with unix as the post-WWI restrictions on naval tonnage have to do with actual treaties

12:54 stcredzero: technomancy: there's probably an apt analogy to go with that having to do with battleships being obsoleted by aircraft carriers

12:54 darthdeus: justin_smith: i'm not running it through the shell, which is why this is happening i guess

12:54 justin_smith: technomancy: well if "is it UNIX™" is the standard, your answer is based on "did they pay for and pass the cert"

12:55 darthdeus: to me anything that launches a program is a shell - I guess that may not be a universal opinion

12:55 technomancy: justin_smith: true unix is in the heart

12:55 llasram: I'd get that on a bumper sticker

12:55 (if I were inclined to bumper stickers)

12:56 stcredzero: I can imagine that as alternative lyrics to "Grove Is In the Heart"

12:56 technomancy: I have debugged this problem so many times with Emacs users that any time someone says their PATH doesn't include their .profile customizations I am tempted to yell at them to stop using the gui

12:56 especially considering the "official fix" from apple is to edit a plist.xml file, and I don't want to have that blood on my hands

12:57 bbloom: tpope: apparently you're going to get rich off of cljs support

12:57 justin_smith: YUCK 😛

12:57 technomancy: llasram: http://wondermark.com/175/

12:57 darthdeus: how can i pass a record constructor to apply?

12:57 (apply Thing. '(1 2 3)) doesn't work

12:58 llasram: technomancy: Heh. Nice.

12:58 justin_smith: darthdeus: hmm, (apply map->Thing [map]) should work

12:58 dnolen: justin_smith: darthdeus: you want ->Thing

12:58 justin_smith: map->Thing is automatically defined when you define the record

12:58 ahh, much better :)

12:59 dnolen: (apply ->Thing positional-values)

12:59 justin_smith: though using map->Thing may be a cleaner position to building it than apply ->Thing is, big picture

12:59 depending on what you are doing

12:59 s/position/option

13:00 darthdeus: hmm interesting, thanks guys

13:20 logic_prog_: is there any down sies to using cider vs nrepl?

13:21 stcredzero: You mean nrepl.el?

13:21 I thought CIDER was just the new name for nrepl.el

13:21 seangrove: stcredzero: It is, you're right

13:21 stcredzero: At last, I'm right about something!

13:21 seangrove: logic_prog_: I use cider, but I don't know if it's fully baked yet

13:22 logic_prog: correct me if I'm wrong, cider is only _client/emacs side_ ... it still uses nrepl server (i.e. lein) side

13:22 seangrove: The name change happened without updating it everywhere it should have been

13:22 stcredzero: seangrove: shouldn't that be "fully fermented"?

13:22 seangrove: I use it, and it's stable enough for me, but there's no major reason to switch over yet, from what I can tell.

13:22 technomancy: logic_prog: ritz doesn't work with cider yet

13:22 seangrove: stcredzero: Well played, sir

13:22 technomancy: logic_prog: but yeah, same thing on the server side

13:23 logic_prog: wtf is ritz ?

13:23 oh, it'sa debugger supporter

13:23 seangrove: I hope clojure gets a debugger/stepper similar to ritz that's a bit easier to configure/use and clients can easily connect to, a la nrepl

13:23 technomancy: be the change you want to see in the world.

13:24 stcredzero: Has someone named software wtf yet? That way someone can ask...

13:24 pandeiro: technomancy: do you know if cider has something akin to eldoc for using inside clojure-mode buffers? didn't nrepl.el have that?

13:24 seangrove: technomancy: True, true. One thing at a time

13:24 technomancy: not that I know of, but there is a license named that

13:24 pandeiro: yeah, that works

13:24 pandeiro: what's the function called, do you know?

13:24 technomancy: it's in the readme

13:24 pandeiro: gah

13:25 seangrove: pandeiro: http://p.hagelb.org/mystery.gif

13:25 technomancy: lots of mileage to be gotten from that gif

13:26 jergason: the things that ghost has seen

13:26 pandeiro: must be a new cider thing, my emacs says that function doesn't exist

13:26 stcredzero: jergason: if gifs can be conscious...

13:30 So, how would one implement a cache that only keeps the last n items in Clojure?

13:31 dnolen: stcredzero: you might want to look at core.cache https://github.com/clojure/core.cache

13:32 edbond: om/reactjs question: What does "Danger: Discarding unexpected node" means? How to fix?

13:33 dnolen: edbond: that's a React warning, and I haven't seen that before

13:33 edbond: might want to ask in #reactjs

14:16 arcatan: i'm running criterium benchmark for a function and during the warmup, criterium reports "classes loaded before n iterations" for almost every iteration

14:17 what does that mean in practice? that my running my code causes classes being loaded

14:18 +?

14:20 hmm. i started a new repl session and it doesn't happen again.

14:21 whoops, it didn't

14:23 jcromartie: OK, fine, tools.namespace, you win

14:23 tbaldridge: arcatan: I've seen that happen if you use eval

14:24 stuartsierra: jcromartie: :)

14:24 jcromartie: which is to say stuartsierra wins

14:24 :P

14:24 * jcromartie tires of playing the "kill the REPL and start it up again to see if your code that supposedly works actually still works"

14:25 technomancy: defeated by defrecord?

14:25 jcromartie: technomancy: I want no part in your anti-record crusade

14:25 technomancy: but no

14:25 stuartsierra: haha

14:26 technomancy: just checking

14:27 gfredericks: (defeated :hamburger :fries)

14:27 ^ meal reporting

14:31 jcromartie: (->> tacos (take 3) (map al-pastor) nom)

14:32 arcatan: tbaldridge: oh, right, we have some code generation stuff in there which i always forget about. not eval, but yeah.

14:33 hadronzoo: What is the best way to eliminate Ratio operations from a namespace. I know I can insert doubles into each calculation, but I was hoping for a cleaner solution.

14:34 octagon: stuartsierra: what's the best reference for understanding the tools.namespace reloading? I read your blog posts but I'm having a hard time knowing how all the pieces of my app act under reloading.

14:35 hadronzoo: Profiling has revealed that my code is spending a lot of time in Ratio division, but I don't need this additional precision--doubles are good enough.

14:35 hiredman: hadronzoo: if you start with doubles you will end with doubles

14:35 stuartsierra: octagon: the tools.namespace README goes into all the edge cases

14:36 hiredman: ,(/ (+ 1.0 1) 2)

14:36 clojurebot: 1.0

14:37 hiredman: hadronzoo: if you are seeing ratios it means you aren't using floating point numbers somewhere

14:37 hadronzoo: hiredman: I know, but many of the functions I use return Longs.

14:37 justin_smith: hadronzoo: also, if you have numeric bottlenecks, primitive-math and hiphip may be good options to consider https://github.com/ztellman/primitive-math https://github.com/prismatic/hiphip

14:37 hadronzoo: justin_smith: Perfect, I'll take a look. Thank you

14:38 coventry`: How can I add arguments to the lein command executed by nrepl/cider.el's nrepl-jack-in?

14:38 justin_smith: hadronzoo: many clojure operators are varargs, so you can change (* x y) to (* 1.0 x y) or (+ x y) to (+ 0.0 x y) to force doubles

14:39 hadronzoo: justin_smith: Yes, that's what I started to do, but this library is very math heavy, so it was getting ugly and tedious.

14:39 justin_smith: makes sense

14:39 steerio: justin_smith: isn't (* (double x) y) better? performance-wise just as well as idiomatically

14:39 justin_smith: and the unboxing / arrays will likely be a big gain

14:39 steerio: probably

14:39 technomancy: coventry`: M-x apropos-value lein-repl

14:40 steerio: hadronzoo: you could create your own operators with macros that would force doubles

14:40 technomancy: sorry, "lein repl"

14:40 justin_smith: steerio: that is part of what the above referenced primitive-math does (along with unboxing etc.)

14:40 steerio: sorry, didn't scroll back :)

14:40 hadronzoo: steerio: essentially converting the arguments using (double x)? I'll check those libraries to see if that's been done already :)

14:42 justin_smith: hiphip doesn't even make sense without unityped arrays, and primitive-math specializes everything for each numeric type - which is needed to guarantee things staying unboxed

14:42 coventry`: technomancy: Thanks. That was too much output to assimilate, but I found nrepl-server-command by reading nrepl-jack-in.

14:42 hadronzoo: justin_smith: primitive-math is exactly what I was looking for

14:42 justin_smith: cool

14:42 technomancy: coventry`: it's the third entry for me

14:44 coventry`: Huh, I get clojure-inf-lisp-command early on, but nrepl-server-command is on line 5584.

14:45 technomancy: coventry`: inf-lisp is for simplistic comint-style work; doesn't involve nrepl

14:46 coventry`: I know. I just mean that's the closest reasonably positioned match I got.

14:46 technomancy: oh geez, line 5584 of the apropos; I see

14:47 ouch

14:47 yeah, apropos-value must have some way to accept literal input, but I don't know it off the top of my head

14:47 Wild_Cat: I don't know who made it so Leiningen on Windows does support bash-type keyboard shortcuts, but whoever you are, you have my deepest thanks

14:48 (lein repl, that is)

14:48 Odin-: Readline, innit?

14:48 technomancy: Wild_Cat: that was trptcolin

14:48 who is a hero of the highest order

14:48 Wild_Cat: ,(inc trptcolin)

14:48 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: trptcolin in this context, compiling:(NO_SOURCE_PATH:0:0)>

14:48 Wild_Cat: (inc trptcolin)

14:48 lazybot: ⇒ 3

14:49 Wild_Cat: there. ^^

14:49 technomancy: nice.

14:49 technomancy: Odin-: can't link to readline from Clojure due to the EPL

14:49 Odin-: technomancy: Ah, right. 'course.

14:49 Wild_Cat: now the only thing that's missing is proper text selection support, but I don't think the Windows console widget can be made to work

14:49 Odin-: technomancy: In which case it actually is quite heroic.

14:50 technomancy: Odin-: well he's using an existing lib, but he's had to contribute a number of bugfixes to it from what I recall

14:50 Wild_Cat: (unrelated: wow, AGDQ now have the programmer of The Mask for the SNES speedrunning his very own game -- very cool)

14:50 jcromartie: I take it all back stuartsierra: tools.namespace blows up on my project

14:50 technomancy: grenchman on the other hand does link directly to libreadline

14:51 but it doesn't have completion support =(

14:51 mdrogalis: lol. I take it back! I totally hate you dude!

14:51 stuartsierra: jcromartie: Sorry about that. I may be able to help with some more info.

14:52 jcromartie: stuartsierra: the first time I call (refresh) it tries to reload everything

14:52 stuartsierra: jcromartie: Yes, that's how it works.

14:52 jcromartie: and even though it loads a certain namespace first, another namespace which relies on that one then fails to load

14:52 stuartsierra: jcromartie: In what way does it fail?

14:53 jcromartie: say I have namespace A and B

14:53 B requires A, and (refresh) indicates that it is reloading A then B

14:53 but it fails loading B saying that A is missing

14:54 stuartsierra: jcromartie: I've seen this happen in some situations, usually when there are AOT-compiled .class files on the classpath.

14:54 jcromartie: ah, yes

14:54 it's my "main" namespace that the failing one depends on

14:54 stuartsierra: Unfortunately, I don't know how to fix the AOT problem. AOT does weird things to loading.

14:54 jcromartie: yes

14:55 stuartsierra: I generally restrict AOT-compilation to an :uberjar profile in Leiningen to avoid it when I'm working at the REPL.

14:55 technomancy: inc

14:55 (inc *2) ; rather

14:55 lazybot: ⇒ 1

14:56 davidbe: I'm struggling with clojure.lang.LazySeq. I read everywhere I should use doall, but that seems not to work. Any help? I map a function over a collection of hashmaps. code: https://www.refheap.com/22736

14:57 where do I have to use doall?

14:57 gtrak: you don't have to use doall unless you care about when the calculations actually take place?

14:58 ah, I see you have side-effects

14:58 hiredman: davidbe: lazy-seqs don't print well with println, use pr-str and pass the result to println

14:58 davidbe: hiredman: ok, I'll try

14:59 hyPiRion: davidbe: the issue is the `str`-call, not the println itself

14:59 instead of str, use pr-str as mentioned

14:59 hiredman: although, you are missing some critical bits from your example, what you are actually calling, what arguments, etc

15:00 it is hard to tell from what I assume is the example output what is printed and what is a return value returned

15:00 davidbe: hiredman, hyPiRion : thanks alot

15:03 lazyness seems to be harder in Clojure than in Haskell - or I might miss a point...

15:04 bitemyapp: davidbe: that's an accurate sentiment.

15:04 hiredman: *shrug* if you are new to clojure then everything about it seems harder, no?

15:05 technomancy: davidbe: laziness in clojure only applies to seqs

15:05 gfredericks: and only the lazy ones

15:05 pyrtsa: hiredman: Well, I guess the eager-by-default of the Clojure language is what makes the difference. You have to jump through hoops like lazy-seq to make things lazy yourself.

15:05 technomancy: so some things are harder and other things are easier; for instance understanding when a certain piece of code will be called is much easier

15:05 pyrtsa: (eager evaluation, I mean)

15:07 hiredman: pyrtsa: if you say so, from the perspective of someone who has been writing lots of clojure for a few years it just is

15:07 pyrtsa: Besides lazy seqs, there's clojure.core/delay as well, not that it's used much.

15:07 davidbe: okay... good to know laziness applies only to some seqs and that clojure is eager-by-default

15:08 pyrtsa: hiredman: From the way davidbe put it, I supposed he had played a bit with Haskell as well.

15:08 hiredman: I should say from my perspective, other people with a similar amount of clojrue exposure are bound to have different perspectives

15:09 pyrtsa: hiredman: For someone with less experience with Clojure, the laziness gets more complicated when you actually want to prevent side effects from happening eagerly.

15:09 E.g. chunked sequences can be surprising.

15:10 hiredman: chunked sequences are just gross

15:11 I am sure if rich wasn't so into preserving backwards compatibility they would be gone

15:11 well, maybe not, but I would hope

15:11 DerGuteMoritz: weren't they added relatively late? 1.2 or so?

15:11 pyrtsa: DerGuteMoritz: I think so, yeah.

15:11 tbaldridge: (inc hiredman)

15:11 lazybot: ⇒ 32

15:11 hiredman: well, 1.2 was a long time ago

15:12 pyrtsa: I guess reducers tried to be a better improvement.

15:12 DerGuteMoritz: yeah but at least past the experimentation period

15:13 ivan: re: ICloneable in clojurescript, what's the point of cloning immutable objects?

15:13 gfredericks: hiredman: gone in favor of slower unchunked seqs?

15:13 stuartsierra: People usually run into trouble when they try to mix laziness and side effects.

15:13 hiredman: DerGuteMoritz: rich really does not like removing stuff once it has gone in, from what I have seen

15:13 gfredericks: I heard him reference java.util.Date as a good example

15:13 hiredman: gfredericks: right, use some other mechanism if you need performance (like reducers)

15:13 gfredericks: of not removing bad things

15:14 technomancy: hiredman: are chunked sequences part of the language semantics though?

15:15 seems like the kind of thing you could safely remove without causing incompatibilities?

15:15 arkh: gfredericks: why is java.util.Date bad?

15:15 pyrtsa: Mutable.

15:15 hiredman: technomancy: if someone built custom chunked sequences types

15:15 technomancy: arkh: voluminous tomes could be written on the subject

15:15 teslanick: (inc technomancy)

15:15 lazybot: ⇒ 89

15:16 gfredericks: technomancy: man that'd be the nerdiest pile of tomes ever

15:16 * gfredericks imagines the "collect them all!" exhortation on the covers

15:16 technomancy: hiredman: ah sure. they could be removed from all call paths without the underlying classes going away though.

15:16 all pure-clojure-accessible call paths

15:16 gfredericks: this is the first time I've heard chunked seqs described as regretable

15:17 Odin-: gfredericks: Try browsing through the history section of a local library sometime.

15:17 pyrtsa: Speaking of Date, it keeps surprising me every time that the JVM (and thus, Clojure) has no standard way representing durations with a single value.

15:17 technomancy: pyrtsa: ms since epoch is not uncommon

15:17 (System/currentTimeMillis) or whatever

15:17 pyrtsa: technomancy: Yeah, but it's milliseconds only!

15:17 hiredman: gfredericks: maybe you need to get out more :)

15:18 gfredericks: hiredman: that would explain it

15:18 arrdem: 2038! the doom comes!

15:18 technomancy: pyrtsa: beggars can't be choosers

15:18 pyrtsa: Heh, I wrote my own already.

15:18 gfredericks: clojurebot: beggars |can't be| choosers

15:18 technomancy: At Least It's Not j.u.Date. (tm)

15:18 clojurebot: Ack. Ack.

15:18 Ember-: there is also (System/nanoTime)

15:18 pyrtsa: Ember-: But they both return integers which could represent anything.

15:19 Ember-: longs, not integers but yes

15:19 pyrtsa: Sure.

15:19 DerGuteMoritz: wait, that would be like using plain maps to represent something!!

15:19 arrdem: pyrtsa: and you expectedm them to return what...?

15:19 (inc DerGuteMoritz)

15:19 lazybot: ⇒ 1

15:19 Ember-: anyway, java.util.Date is just plain horrid and it only starts from it being mutable

15:19 DerGuteMoritz: defrecord all the way

15:19 arrdem: (dec DerGuteMoritz)

15:19 lazybot: ⇒ 0

15:20 DerGuteMoritz: arrdem: that was ironic, of course!

15:20 technomancy: hehe

15:20 arrdem: DerGuteMoritz: I can't tell if you're trolling me so I'm gonna stop voting.

15:20 :P

15:20 DerGuteMoritz: :-D

15:20 pyrtsa: DerGuteMoritz, arrdem: Well, why not e.g. {:unit 1/1000, :value number}

15:20 gfredericks: (inc the fact that you can have spaces in things that you inc)

15:20 lazybot: ⇒ 1

15:20 DerGuteMoritz: pyrtsa: ok!

15:20 arrdem: (inc roomba)

15:20 lazybot: ⇒ 1

15:21 TimMc: Numbers without types or consistent expectations are fairly pernicious.

15:21 Ember-: pyrtsa: use clj-time, it uses jodatime internally which is great

15:21 TimMc: The number of times I've seen bugs from things being off by a factor of 1000...

15:21 DerGuteMoritz: (inc 1)

15:21 lazybot: ⇒ 6

15:21 Ember-: with java 8 we finally get good date and time api

15:21 DerGuteMoritz: lazybot: wrong

15:21 pyrtsa: Ember-: I tried to. Turned out they skipped the handling of the exact duration type that I'm after!

15:21 arrdem: also lambdas...

15:21 Ember-: pyrtsa: which is?

15:21 pyrtsa: ...because of overload ambiguities.

15:22 Just a sec...

15:22 Ember-: I'm kinda sceptic that jodatime would have skipped that even if clj-time has

15:22 pyrtsa: It exists in JodaTime, not in clj-time.

15:22 Ember-: and it's safe to use jodatime in clojure since all it's objects are immutable

15:22 TimMc: pyrtsa: Send a PR.

15:22 gfredericks: clojure/west is going to have a pretty short talk-submission process at this point o_O

15:23 pyrtsa: TimMc: It can't be fixed without either using Java reflection or adding a whole different set of functions.

15:23 Ember-: no reasonable java developer uses java.util.Date either, why would clojure developers use it :)

15:23 pyrtsa: That's why, I guess, it isn't there.

15:23 gfredericks: ,(type #inst "2014")

15:23 clojurebot: #<SecurityException java.lang.SecurityException: denied>

15:23 pyrtsa: Periods and Intervals are there in clj-time, Durations not.

15:24 And Duration is the type that you use for measuring the elapsed time, i.e. pretty often!

15:25 Ember-: pyrtsa: (Duration. (time/local-date 2014 1 1) (time/local-date 2014 2 1))

15:25 assuming Duration is imported and clj-time is in time alias

15:25 pyrtsa: Clumsy.

15:25 Ember-: not that much compared to (time/duration (time/local-date 2014 1 1) (time/local-date 2014 2 1))

15:26 I understand where you are going to, but in this use case scenario there is pretty much no difference

15:26 pyrtsa: But then how about Instant + Duration -> Instant?

15:26 Ember-: the difference comes when you really want that duration *function*, not a constructor

15:26 http://joda-time.sourceforge.net/apidocs/org/joda/time/Duration.html

15:26 there you go

15:29 pyrtsa: Ember-: But what good is clj-time if (time/plus instant duration) doesn't work and I must resort to something like (.plus ^Instant instant ^Duration duration) to make the Clojure compiler happy?

15:30 Ember-: pyrtsa: for one, what would you expect from that plus operation?

15:30 to me that looks like an illegal operation

15:30 pyrtsa: Another instant!

15:30 Ember-: you just cannot add a duration to an instant

15:30 pyrtsa: Wat?

15:30 Ember-: duration is not an instant

15:30 duration is what it says: a duration

15:30 an instant is an instant in time

15:31 pyrtsa: Ember-: NO! You *cannot* add two instants. What the *** would that ever mean?

15:31 Ember-: what you can do, is ask for the two instants which define the range of that duration

15:31 pyrtsa: Yeah right.

15:31 TimMc: Pretty sure you two are talking right past eash other.

15:31 pyrtsa: TimMc: I guess so. Sorry.

15:32 Ember-: What are you trying to say? Am I misunderstanding Instant?

15:32 Ember-: http://joda-time.sourceforge.net/apidocs/org/joda/time/ReadableInstant.html

15:32 it defines a single specfic instant in time

15:32 like 22:30 GMT+3

15:32 if timezones are added

15:33 pyrtsa: Yeah, and if you add a duration to it, you move the instant by that amount of time units.

15:33 Ember-: duration is made of two separate instants

15:33 or one instant with some time added into it

15:33 pyrtsa: I don't think so and that's what I'm telling.

15:34 Duration is just the number of (fractional) seconds.

15:34 Ember-: like that time I said earlier and for example 1000ms forward

15:34 pyrtsa: Period or Interval is more like what you're after.

15:34 Ember-: aww crap, you are so right

15:34 <- ashamed

15:34 pyrtsa: :D

15:34 And what I'm saying is it was stupid clj-time decided to drop Duration in favour of the other two.

15:35 Ember-: anyway, I think plus can handle for example Seconds

15:35 or Minutes

15:35 http://joda-time.sourceforge.net/apidocs/org/joda/time/Duration.html#toStandardSeconds()

15:35 pyrtsa: But that's different from what a duration is .

15:37 jcromartie: grrrr hiccup.form/drop-down is broken

15:37 Ember-: pyrtsa: you will end up into what you'd expect by using that

15:38 pyrtsa: Construting Period objects is just a bit clumsy when what you need is just ms, µs or ns.

15:39 Ember-: (defn duration-ms [a b] (- (.getMillis b) (.getMillis a)))

15:39 :P

15:39 yeah, yeah... I know

15:42 fgallina: Hi guys, I was playing with clojure a bit and found out a weird behavior that looks like a bug to me

15:42 https://gist.github.com/fgallina/8341562

15:43 can anyone shed some light on that thing?

15:43 TimMc: Yes, it's Cicindella sexgutatta, the six-spotted tiger beetle.

15:43 Technically, it's a beetle, not a bug.

15:44 Ember-: http://geekwhisperin.files.wordpress.com/2009/09/bug-vs-feature.jpg%3Fw%3D618

15:44 TimMc: fgallina: What version of Clojure are you using?

15:44 gfredericks: ,(keys [])

15:44 clojurebot: nil

15:44 gfredericks: &(keys [])

15:44 lazybot: ⇒ nil

15:44 gfredericks: ,(keys [1])

15:44 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry>

15:44 gfredericks: ,(try (keys [1] :yes)

15:44 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

15:44 gfredericks: ,(try (keys [1]) :yes)

15:44 clojurebot: :yes

15:45 TimMc: That's pretty weird!

15:45 gfredericks: that's the weirdest thing I've seen since the ^double thing this morning

15:45 fgallina: TimMc: 1.5.1

15:45 gfredericks: &(keys [1])

15:45 lazybot: java.lang.ClassCastException

15:45 gfredericks: &(try (keys [1]) :waaat)

15:45 lazybot: ⇒ :waaat

15:45 stuartsierra: My favorite is ##(get "foo" :thing)

15:45 lazybot: ⇒ nil

15:45 TimMc: &(try (keys [1]))

15:45 lazybot: java.lang.ClassCastException

15:45 hiredman: the exception is from the printing, not the actually operation

15:46 TimMc: hiredman: Oh jeez, that's right.

15:46 &(class (keys [1]))

15:46 lazybot: ⇒ clojure.lang.APersistentMap$KeySeq

15:46 TimMc: That's the laziest thing I've ever seen.

15:47 fgallina: uh oh

15:47 didn't thought of that one.

15:47 stuartsierra: Here's another one: http://dev.clojure.org/jira/browse/CLJ-1319

15:47 bellkev: I've seen some documentation (I think from Technomancy) that says it's not a bad idea to set :aot :all when building, say, a ring uberjar (to make the compiler check things, speed things up, etc). However, this just takes forever and hangs when I run `lein ring uberjar`, as opposed to finishing in a minute with the default :aot. Is it possible there's something obviously stupid in my project.clj that's making it hang?

15:47 gfredericks: TimMc: oh right because it just does (map key thing)

15:50 TimMc: bellkev: I wrote a script that can help debug this, hold on.

15:50 bellkev: TimMc: Sweet!

15:51 TimMc: bellkev: This script will sprinkle your codebase with print statements (stash or commit your work first!) so you can see uberjar or compile making progress through your namespaces: https://gist.github.com/timmc/7359898

15:51 ucb: ,(try (let [a (keys [1])] :ok))

15:51 clojurebot: :ok

15:51 ro_st: dnolen: forgive the probably naive question, but why both om/transact! and set-state! ?

15:51 dnolen: ro_st: you need component local satte

15:51 s/satte/state

15:51 Wild_Cat: ,(clojure.data.json/decode "[1, 2, 3]")

15:51 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.data.json>

15:51 fgallina: given the exception is thrown at printing because this is lazy, take on that thing should bring the exception or am I missing something?

15:52 ro_st: ok. get/set-state for local-to-compnent, transact for global state

15:52 bellkev: TimMc: Awesome! I'll check it out. Thanks

15:52 dnolen: ro_st: yep

15:52 fgallina: ,(try (take 1 (keys [1])) :ok)

15:52 clojurebot: :ok

15:52 dnolen: ro_st: components local state is very useful, thinking draggable / sortable and other things that have a lot of transient state

15:52 ro_st: there's no point putting that stuff into the global state

15:52 ro_st: yes - like text inputs

15:52 dnolen: ro_st: the global state is your DB

15:52 TimMc: bellkev: In my case I found that compilation was just really slow. :-/

15:53 ro_st: ok, thanks, i got it

15:53 ok. next one. why the async/map in the mouse example? could that not be simpler?

15:53 TimMc: fgallina: take is also lazy :-P

15:53 bellkev: TimMc:Hmm, I left mine going overnight and it never finished :P

15:53 ro_st: (i'm still totally green with async)

15:53 dnolen: ro_st: yes, but core.async is a good fit in general for Om, so just wanted to illustrate how to do it

15:54 ro_st: ok. so not for a technical reason, but for illustrative purposes. cool

15:54 fgallina: TimMc: and what about the let form ucb tried?

15:54 ro_st: i mean, could you not have used the async code in counters to simply put on a single channel, rather than use async/map

15:54 bellkev: TimMc: :aot :all compiles all dependencies too, right? Is it possible that the problem could be in them? And Does your script monitor that? (I haven't quite mentally parsed your sed arguments yet :P)

15:55 TimMc: fgallina: The value is never used by anything that tries to ask for its elements.

15:55 Basically, it's a time bomb.

15:55 bellkev: This just mucks with whatever directory you point it at.

15:56 fgallina: ,(try (let [a (keys [1])] a :ok))

15:56 clojurebot: :ok

15:56 ro_st: tbaldridge: i really enjoyed your async talk. looking forward to digging into the macro deep dives, too.

15:56 bellkev: TimMc:Okay, got it, thanks

15:56 TimMc: It puts a println before every def or defn and makes the :require and :use clauses of ns noisy.

15:56 Very basic.

15:56 ro_st: writing that macro must have been quite a challenge

15:56 dnolen: ro_st: the point of async map is to convert mouse data into a vector, it's just for fun

15:57 ordnungswidrig: ro_st: I guess he secretly used core.logic to derive the macro from the specification :)

15:57 ro_st: cool dnolen. juuust checking

15:57 bellkev: TimMc: When you say the project you were debugging was slow to compile, was it like, hours? If so, it seems like the :aot :all is only worth it under extreme circumstances...

15:58 ro_st: ordnungswidrig: gosh. that'd be something :-)

15:58 TimMc: Nah, 3-4 minutes. Annoyingly long for my development loop, but not a work-stopper.

15:58 mischov: What's the difference between APersistentMap and IPersistentMap?

15:58 luxbock: is this the latest stable version of tools.reader? I'm trying to get CLJS repl to work and Google told me to update it

16:00 bellkev: TimMc: Okay must have something really screwed up somehow...

16:00 ordnungswidrig: mischov: IPersistentMap is a java interface while APeristentMap is an abstract base implementation

16:01 luxbock: oops, forgot the link

16:01 https://clojars.org/ibdknox/tools.reader

16:02 ro_st: dnolen: i watched the leanpub guy's react talk. the difference in browser perf is sick

16:02 dnolen: ro_st: it's amazing technology yes

16:02 ro_st: really great example, using the web audio api

16:02 dnolen: ro_st: we'll likely send patches their way in the future which will make React even faster for the Om model

16:03 stcredzero: Is there a big difference with robustness of the repl with Light Table? (Versus CIDER/nrepl.el in emacs?)

16:03 ro_st: that rocks. i'm amazed you can still squeeze more out of it

16:03 luxbock: https://gist.github.com/8341931

16:04 any ideas what might be causing this? I'm running Windows / Cygwin

16:04 dnolen: ro_st: there's a lot of optimizations they don't do that we could use because they have a different design and also they have less information about what's happening

16:04 ro_st: in the Om model we always know exactly what data in the app state changes

16:05 mischov: ordnungswidrig: If you were looking to match a map in an extend-protocol, would you use IPersistentMap or APersistentMap?

16:05 ro_st: luxbock: share your project.clj too, please

16:05 seangrove: ro_st: What talk was this?

16:05 ro_st: seangrove: http://facebook.github.io/react/docs/videos.html just beneath the podcast

16:05 luxbock: https://gist.github.com/8341986

16:05 ro_st: sorry, the one beneath that. 4th one down

16:06 seangrove: Oh yes, forgot that I had seen that one. It was definitely a fun presentation

16:06 ro_st: dnolen: so somehow, the persistent data structures kinda do most of the diffing work for them?

16:06 or, it could

16:06 dnolen: ro_st: the transact! api gives us this information we track the path

16:06 ordnungswidrig: mischov: it depends

16:06 dnolen: ro_st: this means we know exactly what path in the render tree changed

16:07 ro_st: ah - so then that makes using transact! mandatory for global state?

16:07 dnolen: ro_st: no

16:07 ro_st: you just won't get rocket fuel

16:08 luxbock: alright, now it works after I switched to using [org.clojure/tools.reader "0.8.3"] instead

16:09 ro_st: dnolen: gotcha. i ask because we'll likely use om with pedestal, and pedestal will deliver deltas to om to somehow render

16:09 so our state won't use transact!

16:09 dnolen: ro_st: I don't know pedestal but I would say not to bother with whatever it provides to the front end

16:10 ro_st: it's a dataflow engine. messages in, transactions inside, deltas out

16:10 ordnungswidrig: mischov: there's also associative

16:11 dnolen: ro_st: yes I know - I'm just unsure of the integration, it might just work

16:11 ro_st: or pedestal might drop the client stuff and simplify

16:11 and let people use whatever they're going to use

16:11 ro_st: ya. looking at the 0.3 walkthrough, that's likely

16:12 what's nice is that you get a block of deltas for the whole dataflow transaction, which om/react will happily handle in a single RAF

16:13 dnolen: ro_st: that's definitely an interesting possibility to explore, I don't intend Om to be so opinionated that you can't do what you want.

16:13 logic_prog: in cljs, what is the best way to check "if foo a DOM element" ?

16:13 mischov: ordnungswidrig: Thanks.

16:13 logic_prog: err, "is foo a DOM element" ?

16:13 dnolen: logic_prog: instance? should work

16:13 logic_prog: (intance? js/Element foo)

16:14 er instance?

16:14 logic_prog: dnolen: hmm, assertion passes, so it's not too tight, but not sure if it's restrictive enough

16:14 dnolen: logic_prog: don't know what you're trying to do so can't much more

16:15 logic_prog: dnolen: https://gist.github.com/anonymous/8342140

16:15 defenstve programming

16:15 setting attributes of a dom element

16:15 can I make it much more defensive than that?

16:16 dnolen: logic_prog: seems OK to me, hard to say w/o checking the mainstream browsers w/ that. Might be something more robust in Google Closure too.

16:16 logic_prog: writing your own attribute setting code seems pointless and error prone to me

16:17 logic_prog: dnolen: what should I be doing instead?

16:17 i have a "virtual svg dom"

16:17 which I'm converting to a "svg dom"

16:17 dnolen: logic_prog: using Google Closure if possible

16:17 logic_prog: if you care about cross browser issues, that is

16:17 logic_prog: no

16:17 this will run on chrome

16:17 and I don't care about anything else

16:18 dnolen: logic_prog: then I don't have many opinions about it

16:18 logic_prog: dnolen: if you wrote a blog post about google closure best practices, I'd read it :-)

16:18 dnolen: logic_prog: unlikely

16:19 logic_prog: I only write about stuff that doesn't bore me can't be googled :)

16:19 danneu: Datomic question: Imagine a private-message system where you can start Conversations where convos have many Messages and many Participants (users). What would be a sensible way to track whether a convo has unread messages for each user (to display a "new message" UI)?

16:20 I was thinking of some an "Ack" entity with :ack/time, :ack/entity (ref to convo), and :ack/user (ref to user that read the convo at that time).

16:21 ro_st: you could store an ack list of participants on each message

16:21 the tx time gives you your when

16:21 stuartsierra: danneu: You might be able to use a single ref attribute from convo to user. Transactions give you time.

16:21 ro_st: :message/acks

16:22 if a user's on the list, it's read. if not, it isn't :-). assertion time is read time.

16:22 technomancy: gdev_: hey, thanks for the package. should prove a handy addition to my coffee travel gear =)

16:26 danneu: stuartsierra: So, when user1 clicks in to a Convo to read it, they are added to `:convo/acks #{user1}`?

16:27 stuartsierra: danneu: yes

16:27 danneu: ro_st: That was my first brainstorm, but I considered attaching the acknowledgement at the convo-level instead of the message level.

16:28 ro_st: but then you're forced to put a collection of collections on convo

16:28 danneu: stuartsierra: i've never set noHistory before, but would this be a snesible case for that?

16:28 ro_st: better on the message since you care about per-message acks

16:28 stuartsierra: danneu: not sure. once a user has read a message, you aren't going to record that they've read it again, right?

16:29 I'm not sure how noHistory interacts with multi-valued attributes.

16:29 luxbock: in the ClojureScript Windows installation instructions it says to add a few lines to setup_classpath.sh, but I don't see such a file in my cloned repo

16:29 has it been removed?

16:30 RMacy: Hey all if you're in Nashville and want to join a clojure study group I encourage you to join #nash-clojurians

16:30 danneu: stuartsierra: a Convo has many Messages. messages are "unread" if they were created after the last time the user ack'ed the Convo itself.

16:31 luxbock: Clojure complains that it can't find the cljs.repl namespace, which I'm guessing is because I haven't properly set the path for it

16:31 but I'm not entirely sure how to do so

16:31 stuartsierra: danneu: might be easier to record acks on the messages as ro_st said.

16:32 luxbock: I set $CLOJURESCRIPT_HOME to the directory I cloned the repo to, but then the instructions for Windows/Cygwin talks about setting CLJSC_CP in the setup_classpath.sh file, but like I said I have no such file

16:33 dnolen: luxbock: there's just not many Windows ClojureScript users, you might want to ask your question on the ClojureScript mailing list

16:33 luxbock: also patches for troubles or testing existing ones would be helpful

16:34 luxbock: alright

16:35 danneu: stuartsierra: would this kind of thing scale if i wanted to track acks for all Posts (Topics have many Posts) in the forum?

16:35 luxbock: how come installing CS is such a pita when Clojure on the JVM is simply a lein dependency

16:36 technomancy: luxbock: http://p.hagelb.org/mystery.gif

16:36 luxbock: :)

16:36 danneu: stuartsierra: this is definitely easier than what I had in mind though. thanks.

16:37 dnolen: luxbock: but I'm also confused as to what you are attempting to do

16:37 luxbock: ClojureScript is a JAR, you don't need to set it up locally unless you're going to dev it

16:37 stuartsierra: danneu: Scaling is hard to predict. This talk may help: http://www.infoq.com/presentations/datomic-use-case

16:37 luxbock: hmm maybe I'm missing something then

16:37 dnolen: luxbock: you include ClojureScript like any other dependecy with lein

16:37 luxbock: done

16:38 danneu: stuartsierra: yeah, i guess i will find out. that's a good talk.

16:38 gtrak: luxbock: if you're just trying to use cljs in your project, try lein-cljsbuild

16:38 luxbock: yeah I have included [org.clojure/clojurescript "0.0-1934"] in my project.clj file. do I also have to include cljs.repl separately? or how do I access the CLJS repl?

16:38 Wild_Cat: dakrone: is there any specific reason why the default parse-string behavior for Cheshire is to return lazy seqs for top-level arrays?

16:39 dnolen: luxbock: use lein-cljsbuild as gtrak suggested that's the standard tool everyone is behind these days for CLJS dev

16:39 Wild_Cat: s/parse-string/parse/

16:40 luxbock: do I have to use either Austin or piggieback to get a working CLJS repl with nrepl.el?

16:43 dakrone: Wild_Cat: it actually increases performance

16:45 amalloy: especially for infinite streams!

16:46 Wild_Cat: dakrone: Fair enough. Either way see my pull request for the fix to parse-string-strict, but it *is* surprising behavior still.

16:47 dakrone: Wild_Cat: I saw that, will commit it tonight after work, thanks for finding that! (dumb mistake on my part)

16:47 stuartsierra: luxbock: Yes. The Browser repl included with ClojureScript only works at the command-line.

16:47 Wild_Cat: dakrone: how do you feel about changing clj-http so that it does call parse-string-strict?

16:48 (yes, I know that returning top-level arrays is a terribad HTTP practice, but that's Riot's API, not mine :p )

16:48 dakrone: Wild_Cat: I am open to it, do you have a particular use-case in mind why?

16:49 Wild_Cat: dakrone: I'm making an HTTP request that returns a JSON array (see above) and getting a lazy seq (parsed with parse-string, not parse-stream) as a result, which I find highly surprising.

16:50 egghead: why would my cljsbuild not output a goog/base.js file?

16:50 dnolen: egghead: not needed if you use a concatenating optimization setting

16:50 Wild_Cat: I can work around it if you'd rather keep the seq behavior (it's a simple vec call), but I do feel that since JSON arrays are semantically equivalent to vectors, they should parse as such whereever possible.

16:52 egghead: dnolen: ya, no such optimization, weird: https://www.refheap.com/22740

16:53 dakrone: Wild_Cat: it makes sense, but at the same time, almost all of the abstractions for vectors will work with lazy sequences as well, is the type biting you somewhere?

16:53 Wild_Cat: (https://developer.riotgames.com/api/methods#!/310/1058 is the API I'm hitting, btw)

16:53 dnolen: egghead: you are using an optimization setting that concatenates

16:53 dakrone: (biting.. he's a cat... see my joke... haha...)

16:53 (or she)

16:53 egghead: oh, WELP

16:53 luxbock: stuartsierra: ah I see, thanks

16:53 egghead: thanks dnolen

16:53 problem exists between keyboard and chair...

16:54 dakrone: Wild_Cat: we could also possible add a {:as :json-strict} option to clj-http

16:55 bitemyapp: dakrone: maybe nth'ing a large seq over and over?

16:56 dakrone: bitemyapp: yea, that would do it, I just want to understand what particular pain point is being hit

16:56 bitemyapp: dakrone: oh sure, I'm just contriving a reason a seq would be problematic.

16:56 Wild_Cat: dakrone: Direct indexing is biting me, e.g. ,([1 2 3] 1)

16:56 ,([1 2 3] 1)

16:56 clojurebot: 2

16:57 Wild_Cat: ,('(1 2 3) 1)

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

16:57 dakrone: Wild_Cat: gotcha, that's exactly the case it would

16:57 Wild_Cat: I propose adding a {:as :json-strict} option to clj-http, what do you think about that?

16:57 bitemyapp: Wild_Cat: I would avoid doing that, honestly.

16:57 Wild_Cat: using vectors as functions is a good way to run into a lot of hard-to-trace type errors.

16:57 Wild_Cat: dakrone: works for me.

16:57 bitemyapp: Wild_Cat: this way lies madness and all that.

16:58 Wild_Cat: bitemyapp: The problem also exists with get

16:58 gfredericks: this is funny because I've often wanted it to be even lazier and parse maps lazily

16:58 Wild_Cat: ,(get '(1 2 3) 1)

16:58 clojurebot: nil

16:59 bitemyapp: dakrone: I'm in gfredericks's neck of the woods.

16:59 Wild_Cat: oh sure, seq isn't associative. Use nth?

16:59 arrdem: Wild_Cat: care... just go use nth unless you want a lecture on types and implicit behaviors.

16:59 dakrone: bitemyapp: gfredericks: yes, I'd love to have more laziness (especially maps)

16:59 bitemyapp: dakrone: seq of pairs?

16:59 dakrone: lol :)

16:59 dakrone: it's doing laziness while maintaining performance that's the tricky part :)

16:59 gfredericks: bitemyapp: there are a few lazy map impls floating around

17:00 dakrone: but, that's why cheshire.experimental exists

17:00 bitemyapp: Wild_Cat: you should probably follow arrdem's advice. I'm pretty close to giving a lecture on how these type errors are unnecessary if you use a refined weapon from a more civilized age.

17:00 dakrone: ahhh the old battle.

17:00 Wild_Cat: dakrone: well, if you're planning to make things even lazier the {:as :json-strict} makes even more sense.

17:00 hyPiRion: gfredericks: how would you implement lazy maps?

17:00 gtrak: bean is a lazy map

17:00 arrdem: hyPiRion: lazy key updates.

17:00 gfredericks: hyPiRion: https://github.com/fredericksgary/lazy-map

17:01 I think ztellman might have a better one

17:01 or at least a lib that makes them easy to make

17:01 dakrone: gtrak: bean has all kinds of issues though

17:01 Cr8: i didn't know bean was lazy

17:01 dakrone: bean maps, that is

17:01 gtrak: yes, I've hit a few

17:02 dakrone: I'd probably use ztellman's potemkin to implement it

17:02 bitemyapp: hyPiRion: Data.Map.Lazy in Haskell is strict in the keys, lazy in the values.

17:02 which I think is a good balance.

17:02 Cr8: ah

17:02 well now that I (source bean)

17:02 gfredericks: bitemyapp: that wouldn't suffice for my json parsing use case

17:02 hyPiRion: bitemyapp: yeah, that makes sense, but if you can have multiple keys mapping to different values, the whole shebang goes bogo

17:03 dakrone: Wild_Cat: can you open an issue for the :as :json-strict thing on clj-http so I don't forget?

17:03 TimMc: Yeah, I would be pretty surprised to see a JSON array parse as anything other than vector.

17:03 There's some neat stuff you could do with streaming JSON using seqs, but that's a pretty rare use-case.

17:03 gfredericks: which is for parsing: {"foo":[1,...,100000],"bar":42}

17:03 bitemyapp: gfredericks: Data.Map.Lazy isn't really for "parsing", it's more of a generic data structure that's designed to respect the laziness of downstream thunks.

17:04 gfredericks: you'd probably do something closer to what you have in mind for parsing. lazy association lists or something.

17:04 arrdem: hyPiRion: what? no. that's why it's strict in the keys, that allows you to escape a multiple keying case.

17:04 bitemyapp: Most interestingly, the strict and lazy versions share the same "Map".

17:04 hyPiRion: arrdem: was referring to the gfredericks impl

17:04 arrdem: hyPiRion: ah.

17:05 bitemyapp: but I'm glad people understood why I brought up the alternative approach.

17:06 squidz: i'm using react with clojurescript and need to use reacts componentSetState which assigns which data is to be used. I am also using clojurescipt with core.async. Does anybody know a good way to set this state with core.async instead of using a jquery ajax call? As far as I can tell I can only call funcitons with the data inside a go block but I somehow need that data pulled into this 'react compononent'

17:07 Wild_Cat: dakrone: done.

17:07 dakrone: Wild_Cat: thanks!

17:07 Wild_Cat: on a semi-related topic, is the source to clojurebot available somewhere?

17:08 bitemyapp: squidz: well have you used core.async in a manner such that it gets "fed" by callbacks?

17:08 dnolen: squidz: pass a channel to your React component

17:08 noonian: squidz: you create a function that creates a channel in a let block, then call your ajax call and in the callback push the value onto that channel, then return the channel from the funtion and call the function and read from it inside a go block where you set the state

17:08 bitemyapp: squidz: seems to me if that if you have any callbacks flying around, you can strip them down and make them feed channels which leads to functions running into the React part.

17:08 squidz: part of the idea behind core.async is to keep your callbacks dumb/simple and make them do "less".

17:09 dakrone: Wild_Cat: https://github.com/hiredman/clojurebot

17:09 Wild_Cat: thanks!

17:10 final question while I'm at it, what would you consider the best way to store things like API keys, usernames and passwords that a piece of software requires to function? I'm thinking environment variables, but is there a better, commonly-accepted Clojure way?

17:10 squidz: dnolen: how do I work with that channel though then within react?

17:10 * seangrove baffles that clojurescript devs still use jquery

17:10 dakrone: Wild_Cat: I am partial to https://github.com/sonian/carica

17:11 squidz: how do I (<! chan) for example

17:11 dnolen: squidz: make a go loop when the component mounts that listens on that channel

17:11 noonian: (go (let [value (<! chan)] (.log js/console value)))

17:11 dnolen: squidz: the component will receive the channel as one of its props

17:11 bitemyapp: Wild_Cat: I'd like to reinforce what seangrove just said, if you're using something like Fay or ClojureScript, you probably don't need stuff like jQuery so much.

17:12 Wild_Cat: I am partial to: https://github.com/weavejester/environ/

17:12 Wild_Cat: environment variables > configuration files

17:12 bellkev: TimMc: I'm trying out your bash script now and realizing how non-portable sed is... (I'm using a mac)

17:12 bitemyapp: Wild_Cat: rigid configuration files are a terrible, terrible idea, there's already a modular solution to the problem. It's environment variables and system properties. I highly recommend you use environ.

17:13 squidz: dnolen: do you have an example? I am not sure how I would then take from a channel

17:13 Wild_Cat: bitemyapp: that's what I was leaning towards, yeah. Thanks.

17:13 Carica still looks neat, though. I'm filing it for future reference.

17:13 dnolen: squidz: I don't have an example handle, but you can look at the Om example and something similar should work for you.

17:13 s/handle/handy

17:14 squidz: dnolen: okay which om example is similar

17:14 dnolen: squidz: just look at them, there are several that use core.async

17:14 bitemyapp: Wild_Cat: I produce unified "config" namespaces with environ that are superficially similar to Carica.

17:15 Wild_Cat: the difference is that individual configuration options can be overridden at will by overriding the defaults at the command-line or via an outer layer of scripting.

17:15 squidz: okay thanks

17:15 bitemyapp: Wild_Cat: another bonus is that since it's just "code", you can pull in a third source of configuration settings, like zookeeper if one liked, for dynamically configuring your apps.

17:15 using "configuration files" was one of the great sins the Django community committed.

17:16 configuration is part of your deployment and provisioning, not your application code.

17:16 sritchie: cemerick: seeing a null pointer exception when I try to fire up my austin repl

17:16 cemerick: are there any cljs version requirements for 0.1.3?

17:16 Wild_Cat: not really sure how it's done in Django (I'm more of a Pyramid guy).

17:17 cemerick: sritchie: only >= what's in its project.clj AFAIK

17:17 bitemyapp: Wild_Cat: sigh, settings.py

17:17 Wild_Cat: it's uniformly horrific.

17:17 sritchie: cemerick: NullPointerException clojure.core/deref-future (core.clj:2108)

17:17 Wild_Cat: bitemyapp: settings*.py*? Oh no.

17:17 cemerick: oooh, yeah

17:17 sritchie: cemerick: that happens after I call "cljs-repl", and destroys my entire repl

17:17 cemerick: sritchie: 2s

17:17 technomancy: bitemyapp: it always cracks me up when I see python programs that use .ini files

17:18 bitemyapp: Wild_Cat: speaking of pyramid, I have a content negotiation middleware I use in my Ring apps that is similar to how Pyramid does tests.

17:18 technomancy: it's disgusting.

17:18 Wild_Cat: (Pyramid does the .ini thing -- it's not awesome, but it's less disgusting than having your settings as a .py file)

17:18 cemerick: sritchie: Only place I've seen that prompted this: https://github.com/cemerick/austin/issues/37

17:18 any chance you're using cljx too?

17:18 bitemyapp: Wild_Cat: https://github.com/bitemyapp/berossus/blob/master/src/berossus/rocks/your/data/middleware.clj#L44-L51

17:18 Wild_Cat: (also, more and more things are moved towards env. variables)

17:18 * arrdem find / -name "*.ini" -exec rm {} \;

17:18 bitemyapp: Wild_Cat: .ini is worse.

17:18 sritchie: cemerick: yes

17:18 bitemyapp: Wild_Cat: you're missing the lesson here if you think .ini is better than .py

17:18 Odin-: 22:13:16 *** shira QUIT Remote host closed the connection

17:19 Uh.

17:19 Sorry about that. term weirdness.

17:19 technomancy: that said, the fact that json explicitly refuses to support comments is the one reasonable defense there is for using .ini or .py for config

17:19 bitemyapp: arrdem: justice.

17:19 sritchie: cemerick: hmmmm,

17:19 I'm using "cljx" in provided, and austin in dev

17:19 let me move austin over

17:19 cemerick: sritchie: it's likely some gnarly dep order-sensitive resolution, but having the REPL die made it hard to diagnose.

17:19 Cr8: oh man

17:19 bitemyapp: Cr8: ?

17:19 Odin-: technomancy: Is there any reasoning for not allowing comments in JSON, or just someone going "because I say so"?

17:20 Cr8: we have some projects around here with a custom-hacked json parser that adds multiline strings and comments

17:20 cemerick: I'm actually hoping xeqi will take that one on, since he's the aether mofo these days. ;-)

17:20 Cr8: so that it could be used for configuration

17:20 Wild_Cat: bitemyapp: there's some things in that ini file that describe part of how the application works -- most of the ini file are, actually. They'not (necessarily) credentials/deployment configuration.

17:20 sritchie: cemerick: this, then that other AOT compilation issue with austin… must be doing some crazy stuff

17:20 bitemyapp: Cr8: :|

17:20 technomancy: Odin-: as far as I know it's the latter

17:20 bitemyapp: Wild_Cat: it should just be code...

17:20 Wild_Cat: ...and yeah, lack of comments in JSON blows.

17:20 cemerick: sritchie: which AOT issue?

17:21 oh, 23

17:21 arrdem: bitemyapp: so that processor design post series. "Region has 821 lines, 6342 words, and 40422 characters."

17:21 technomancy: of course, it's up to the individual parser to honor or ignore that particular part of the spec

17:21 arrdem: do I qualify for book status yet?

17:21 sritchie: cemerick: https://github.com/cemerick/austin/issues/23

17:21 yeah

17:21 Wild_Cat: bitemyapp: in a language like Python, with its limitations on importing mechanics, I disagree.

17:21 sritchie: cemerick: I did some exclusion mangling

17:22 Wild_Cat: (the ini file parsing produces fairly easy-to-understand errors.)

17:22 bitemyapp: Wild_Cat: there are ways to handle such things, the limited imagination of the Pyramid team not-with-standing.

17:22 sritchie: cemerick: I had to exclude austin from production to get it to work, leading to this: https://gist.github.com/sritchie/8343152

17:22 bitemyapp: arrdem: that's a lot.

17:22 cemerick: sritchie: you mean the :production profile?

17:23 sritchie: cemerick: yeah, from the uberjar profile

17:23 TimMc: bellkev: Oh, that's too bad. What's different about it?

17:23 cemerick: sritchie: doesn't just using :dev accomplish the same thing?

17:23 bellkev: Eeeh, lot's of stuff...

17:23 Cr8: oh wait

17:23 i read it

17:23 bellkev: brew install gnu-sed did the trick though

17:23 sritchie: cemerick: what I mean is, I had to add these switches into my code,

17:23 Cr8: it's not even a modified parser

17:23 it's a preprocessor

17:23 sritchie: since austin is only present in the :dev profile

17:23 I didn't have to explicitly exclude in the uberjar

17:24 cemerick: but because it was missing, and I still wanted it in my code (to inject the repl call in dev mode)

17:24 I had to get fancy

17:25 cemerick: so, that doesn't work

17:25 placing it below cljx

17:25 cemerick: shit

17:25 bitemyapp: bellkev: yeah the BSD sed is a killer.

17:25 driven me nuts many times over.

17:25 cemerick: sritchie: have you been using cljx + austin, and it just busted, or is this all new for you?

17:26 sritchie: I haven't touched the cljs repl in a while

17:26 but it used to work

17:26 cemerick: that's a little nuts

17:26 sritchie: I'm on 0.3.1 cljx...

17:26 maybe I'll try 0.3.2?

17:26 cemerick: might as well

17:26 sritchie: can you gist your project.clj (msg if necessary)?

17:27 sritchie: oh, well then, it works in the OPPOSITE order as you mentioned

17:27 cemerick: I'm being trolled.

17:28 sritchie: not fucking with you

17:28 let me try w/ 0.3.2

17:28 as you have in the github issues

17:29 cemerick: this sounds like the nondeterminism mentioned in https://github.com/cemerick/pomegranate/issues/51, but there's no version ranges

17:30 bellkev: TimMc: So when doing either `lein ring uberjar` or `lein uberjar` it flies through all the print statements from your script and then hangs forever as before...

17:31 sritchie: cemerick: you're getting hit pretty hard w/ this stuff, looks like :)

17:31 bellkev: Maybe I should start sniffing around at what files that jvm is reading/writing? Maybe it's getting stuck compiling some del?...

17:31 dep*

17:31 cemerick: sritchie: just chillin' @ on the shooting range

17:32 AeroNotix: should I put target/ into the .gitignore of a Clojure project. Seems like I don't need that in the VCS

17:33 technomancy: AeroNotix: yeap

17:33 bitemyapp: AeroNotix: yeap

17:33 damn, you guys were all supposed to say the same thing.

17:33 AeroNotix: cool ok

17:33 oh wait, lein already does this

17:33 derp

17:34 mikerod_: has anyone ever encounterd "CodeCache is full. Compiler has been disabled" when dealing with AOT compilation?

17:34 "Java HotSpot(TM) 64-Bit Server VM warning: CodeCache is full. Compiler has been disabled."

17:34 to be more specific

17:34 hiredman: mikerod_: that is a jvm thing

17:34 sritchie: cemerick: oh boy. does this repl work behind https?

17:34 the browser repl

17:34 ?

17:34 hiredman: mikerod_: the codecache is where jitted code goes

17:34 cemerick: sritchie: I have no idea

17:34 should?

17:34 mikerod_: hiredman: indeed, this is what I'm reading. Is this expected from AOT code?

17:35 should I expect to need to bump up the cache size?

17:35 hiredman: mikerod_: it doesn't have anything to do with aot or not

17:35 sritchie: cemerick:

17:35 [blocked] The page at 'https://local.paddleguru.com/races/MikeEatonsLaJollaCovePaddleboardRace2014/register' was loaded over HTTPS, but ran insecure content from 'http://localhost:50210/6767/repl?xpc=%7B%22cn%22%3A%22Ysu2eIXd7I%22%2C%22tp….txt%22%2C%22lpu%22%3A%22http%3A%2F%2Flocalhost%3A50210%2Frobots.txt%22%7D': this content should also be loaded over HTTPS.

17:35 cemerick: hoo-boy, wonder where the hardcoded scheme is

17:35 sritchie: issues, please. :-( Cutting out...

17:36 sritchie: sure

17:36 mikerod_: hiredman: Interesting. We encountered it when switching to AOT and then running tests. So I just figured that was the cause. That could obviously be a wrong conclusion.

17:36 bitemyapp: hah, he has issues.

17:37 hiredman: mikerod_: it is completely about the jvm jitting bytecode to native code, and clojure compiles to bytecode aot or not

17:37 ordnungswidrig: sritchie: did you see https://github.com/clojure-liberator/liberator/pull/97

17:37 sritchie: ordnungswidrig: so a map can be the first option?

17:38 mikerod_: hiredman: that makes sense. would there be a chance that the jvm may jit some extra bytecode than normal, when the clojure code because aot-compiled. since there would be more bytecode "available upfront" in the JVM.

17:39 when the clojure code *became* aot-compiled

17:39 ordnungswidrig: sritchie: like that. however the proposed patch only adds this for defresource. But the idea looks good. Why did you need the advanced merge logic?

17:39 sritchie: did you see my example? I wanted to add content handlers for a bunch of diff content types in the base,

17:40 then have the ability to override just one or two (but still let all the defaults work)

17:40 ordnungswidrig: ah, I will look at it again

17:40 hiredman: mikerod_: clojure does compile to byte code on demand though, when it encounters a form -> bytecode

17:41 mikerod_: hiredman: that was the distinction I was making. on-demand byte code vs all of it eagerly generated.

17:41 hiredman: mikerod_: right, clojure doesn't do that

17:41 mikerod_: except, I can't imagine why there'd be excessive jitting of byte code that wasn't being used

17:42 hiredman: mikerod_: everything is compiled before you start running, unless you are loading code at runtime, which would be just the same in aot

17:43 mikerod_: hiredman: yes, I was referring to loading new code at runtime. however, it does seem to be the same thing as in the aot case anyways.

17:43 ordnungswidrig: sritchie: I would solve this by having a base map for the media-typed dispatch and use (assoc base-handler "application/json" my-custom-function)

17:44 mikerod_: so, conclusion: This new HotSpot warning is quite mysterious

17:45 ordnungswidrig: sritchie: I don't see how the :success key is used in the example

17:45 sritchie: ordnungswidrig: that's my application's return value

17:45 ordnungswidrig: sritchie: oh dear

17:45 sritchie: :-) It's late over here

17:46 sritchie: :) no worries

17:46 yeah, media-typed takes the map -

17:46 I would just use a map,

17:46 amalloy: mikerod_: i can't imagine that being AOT-related either. there should be the same amount of total bytecode

17:46 sritchie: but I can't define custom keys,

17:46 and make my handlers functions of custom keys

17:46 right?

17:46 ordnungswidrig: I guess I could just jam some stuff into the resource,

17:46 and have media-typed look up that custom key

17:47 amalloy: and running out of that cache space seems like it would be really hard to do. perhaps you have macros generating very large methods, or some very large constants/literals?

17:47 ordnungswidrig: you can, but I want to keep the option to make liberator strict on the accepted key in the future.

17:47 mikerod_: amalloy: yeah, that's what it is sounding like. On repeated runs, the warning actually stopped happening. So it looks like this is a "hiccup" of the HotSpot compiler.

17:47 amalloy: no large methods. I should look into the constant/literal thing

17:48 amalloy: how do you know you have no large methods? macros do surprising things sometimes

17:48 mikerod_: I do not believe so, but that'd make sense as problematic

17:48 amalloy: like, are you using midje?

17:48 mikerod_: no midje

17:48 *but* we do have a DSL going on

17:48 hiredman: I laughed

17:48 amalloy: i hoped you'd appreciate that, hiredman

17:48 mikerod_: so you're probably right, I need to look into large methods just as well

17:49 hiredman: there are aother options to turn on to print out compilation so you can see what is being compiled

17:50 mikerod_: hiredman: Clojure compiler options?

17:50 hiredman: jvm options

17:50 mikerod_: ah ok

17:50 ordnungswidrig: sritchie: Why would this not work? https://gist.github.com/ordnungswidrig/8343552

17:51 hiredman: you may also want to add :jvm-opts ^:replace [] to your project.clj

17:51 ordnungswidrig: ordnungswidrig: :handle-not-acceptable would be overridden in my-resource

17:51 sritchie: ordnungswidrig: imagine the base has 5 media types it supports

17:51 ordnungswidrig: and I want to override only the json

17:51 ordnungswidrig: sritchie: ah, I see

17:51 hiredman: because lein doesn't pass jvm options good for long running server processes

17:51 mikerod_: hiredman: interesting, haven't seen that one

17:52 I'll try experimenting some with the compile-print opts. Seems like I only got the warning one time. Then again JIT may be unpredictable, I don't know enough to say.

17:52 jergason: where does leiningen put dependencies?

17:53 bitemyapp: jergason: leiningen doesn't put them anywhere, maven does.

17:53 jergason:

17:53 jergason: ~/.m2/

17:53 jergason: thank you, that is great

17:54 technomancy: s/maven/aether/ but yeah

17:54 jergason: when in doubt, `lein classpath` will tell you

17:54 bellkev: TimMc: Thanks again for your script, but it looks like I was just being stupid... I had some "hello-world" style Datomic code pasted into my ring app that just did a `(def conn (connect uri))` when the namespace is loaded, which must have been preventing the compilation process from exiting... Now it finishes in about 2min

17:55 jergason: technomancy oh neato

17:56 ordnungswidrig: sritchie: what about this: https://gist.github.com/ordnungswidrig/8343552

17:57 sritchie: ordnungswidrig: that'd work, though it's a little ugly

17:57 ordnungswidrig: but the merge-with would probably be confusing to folks

17:57 lgtm

17:58 ordnungswidrig: sritchie: oh, that should be ommited

17:59 sritchie: I think this way is more explicit to the user

17:59 sritchie: yeah, I agree

17:59 ordnungswidrig: brb

18:03 bitemyapp: ucb: http://kasperrosa.bandcamp.com/track/coronal-mass-ejection

18:04 ordnungswidrig: sritchie: I can also imagine this: https://gist.github.com/ordnungswidrig/8343552/57400363a3c633e7bcefd8d43d88cbd4c6e8f523

18:05 sritchie: yeah, that's true

18:05 that does fit the pattern

18:05 ordnungswidrig: sritchie: so every function that takes a map, also can optionally accept a base map for the defaults

18:16 seangrove: ,(keyword 1)

18:16 clojurebot: nil

18:16 seangrove: ,(keyword (str 1))

18:16 clojurebot: :1

18:16 seangrove: Yikes.

18:17 arrdem: ,(type :1)

18:17 clojurebot: clojure.lang.Keyword

18:17 arrdem: <::1

18:17 ,::1

18:17 clojurebot: :sandbox/1

18:17 mikerod_: :::1

18:17 ,:::1

18:17 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: :::1>

18:17 seangrove: I think it's likely we're going to need to move over to edn. Lots of mangling happening between clojure->json->clojurescript

18:22 TimMc: bellkev: Ah! So it had an open thread or something?

18:22 bitemyapp: seangrove: interesting. What I've seen Fay/Haskell users do is share data-types between server and client, and use Aeson (JSON) to keep things a safe isomorphism.

18:22 seangrove: doesn't cause any problems because the tests and types make certain it *stays* an isomorphism, no lossyness.

18:22 seangrove: bonus? non-haskell clients/peers can participate if they want.

18:22 it's just JSON after all.

18:23 seangrove: bitemyapp: edn would get us a bit closer in any case

18:23 I was just worried because of the amount of data we load into the client, and the parsing differences between edn vs json

18:23 bitemyapp: seangrove: that's my point about the isomorphism.

18:23 bellkev: TimMc: Something like that. The connection was definitely keeping compilation from finishing. The build process needing to create a database connection during compilation is obviously stupid though, so I just need to make the Datomic connection handling slightly more realistic to expect it to AOT in a sane way...

18:24 bitemyapp: seangrove: "differences" are meaningless when it's a faithful invertible encoding.

18:24 seangrove: using edn is bringing you closer to eval rather than invertibility.

18:25 It is true that using edn here is probably going to play nicer in an otherwise clojure-y environment. Just seems like too much pain for a simple problem.

18:30 Cr8: bitemyapp: what does that do with numbers?

18:31 bitemyapp: Cr8: there have been multiple rounds of enhancements to how Aeson handles numbers.

18:33 Cr8: https://github.com/bos/aeson/pull/156

18:33 Cr8: Haskell gets used a lot in finance, relatively speaking, so there's a strong emphasis on sane handling of precision.

18:34 Cr8: sure, my concern is more taking the output JSON and trucking it through some non-Haskell tool

18:34 many of which are wont to handle numbers as doubles

18:34 darthdeus: any idea why when i use basically any clojure web framework i don't see any content in chrome, but i do see it in safari?

18:34 bitemyapp: non-Haskell intermediaries are what they are, they doesn't really reduce the value of a higher fidelity parser though.

18:34 darthdeus: for luminus i saw it was sending weird content-length

18:35 Cr8: as long as that's the only parser/encoder I use

18:35 gregorstocks: Cr8: just don't use any integers greater than like 2**52, problem solved

18:35 Cr8: Cr8: and never need to represent NaN or +-Infinity

18:36 s/Cr8/you/

18:36 gregorstocks: you can use 2**52 + 1 for NaN

18:36 uh, well I guess 2**52 + 2

18:38 bitemyapp: Cr8: so because some shitty tools exist, we shouldn't use better tools? Are you serious man?

18:39 Cr8: more that that tool doesn't fit into the larger ecosystem of "JSON tools"

18:40 if my data will get trashed if other tools touch it

18:40 so I'd rather just.. not use JSON

18:40 rather than use something that calls itself JSON and breaks when I'm not expecting it to

18:40 bitemyapp: Cr8: I think you might be missing the point

18:41 Cr8: there is an ecosystem of financial tooling all using vanilla JSON but that have better designed types around the precision of the numbers.

18:41 Cr8: some of those changes are focused on making Aeson one of those better JSON libraries.

18:41 Cr8: nothing breaks here, I don't think you understand at all what I've shown you.

18:42 Cr8: so how do numbers that would get trashed get represented?

18:42 bitemyapp: Cr8: JSON is a text based format. What do you think enhancing the precision of the underlying number types means?

18:43 Cr8: it doesn't change the output, it just ups the ceiling on what you can accurately represent without loss than if you used IEEE-754.

18:43 Cr8: sure, but assume there's some guy in the middle that parses the json, doesn't modify what's there but adds some stuff, and re-encodes it

18:43 bitemyapp: it doesn't actually *change* anything for people use hum-drum JSON parsers.

18:43 Cr8: that doesn't use these tools

18:43 bitemyapp: so don't be an idiot?

18:44 Cr8: hm?

18:44 bitemyapp: it doesn't hurt anybody to up the ceiling on the precision.

18:44 If you're *counting* on the precision then the assumption is you also care about your data pipeline.

18:44 you either care or you don't.

18:44 you don't get to care about precision but then ignore where your data goes like a jackass and blame it on the use of a superior tool

18:45 that's asinine.

18:45 gregorstocks: if you're emitting numbers with higher precision than IEEE 754 doubles, is it even valid json any more?

18:45 Cr8: I think what I'm debating is whether said tool speaks what is colloquial JSON

18:45 and I would say that since it *isn't*

18:45 what is the value of using JSON?

18:46 bitemyapp: Aeson is a standards compliant JSON parser.

18:46 Cr8: Which is why I said colloquial

18:46 bitemyapp: it even follows the standard on only allowing arrays or objects at the top level.

18:46 Cr8: I'll still get my data trashed if I store it in CouchDB or RethinkDB

18:47 bitemyapp: decode "1" :: Maybe Int returns Nothing.

18:47 Cr8: fixing retarded data stores is outside the purview of Data.Aeson.

18:47 Cr8: sure

18:47 bitemyapp: Cr8: it bumped the precision. People are using this faculty in production happily.

18:48 seangrove: (meta (<!! (let [x 10] (go ^:yolo {:val x}))))

18:48 bitemyapp: Cr8: Number in Data.Aeson defaults to the precision of a Double.

18:48 seangrove: I love it

18:49 bitemyapp: seangrove: is the ^:yolo a war-cry?

18:49 seangrove: bitemyapp: Apparently - one cannot take the repl too seriously, apparently.

18:50 Cr8: I think my lament is more that the JSON standard isn't well-specified enough to guarantee that everything that can call it self "compliant" will safely roundtrip all "compliant" output

18:51 bitemyapp: Cr8: yeah, JSON is dumb, but we can still do our best.

18:52 technomancy: does "compliant" mean "barfs on input containing comments"?

18:52 Cr8: i believe you have to barf on comments to be a JSON parser yes

18:52 arrdem: technomancy: does EDN support comments? I don't think so...

18:52 gregorstocks: is there a decent way to diagnose "Don't know how to create ISeq from: clojure.lang.Keyword" beyond carefully rereading every single line of code that I've written since it last compiled? i'm pretty sure all my (ns) stuff is fine

18:52 bitemyapp: arrdem: wat

18:53 Cr8: https://github.com/edn-format/edn#comments

18:53 arrdem: bitemyapp: what. we only have (comment) and ;. I'd be shocked if either works in EDN.

18:53 gregorstocks: never mind i found it

18:53 bitemyapp: Cr8: from the standard, "JSON is agnostic about numbers. In any programming language, there can be a variety of number types of various capacities and complements, fixed or floating, binary or decimal. That can make interchange between different programming languages difficult. JSON instead offers only the representation of numbers that humans use: a sequence of digits. All programming languages know how to make sense of digit sequences even if they disa

18:53 technomancy: arrdem: no idea, but if it doesn't then it's dumb

18:53 Cr8: arrdem: ; works in EDN, and EDN also specifies discard. #_

18:53 arrdem: technomancy: apparently it does. we may be notation snobs.

18:53 bitemyapp: Cr8: I know this because I've had shitty edn parsers choke on both recently.

18:54 Cr8: thing is, you're complaining about #FirstWorldProblems with JSON and I'm losing my fucking mind getting edn stuff to work.

18:54 Cr8: heh

18:54 true

18:54 I've got a C++ project here that I'm working on that has a JSON parser in it that will only hand me doubles

18:54 bitemyapp: Cr8: ugh, just use protobufs.

18:54 Cr8: which is actually causing me a problem

18:55 bitemyapp: Cr8: or Cap'n Proto :P

18:55 Cr8: I literally fought for us to use protobuf for like

18:55 two months

18:55 bitemyapp: Cr8: cry

18:55 arrdem: bitemyapp: errytime

18:56 Cr8: apparently we might improve things "this year"

18:56 bitemyapp: Cr8: why is every anecdote I hear about your workplace a carnival of horror?

18:56 coventry`: What is the "clojure config" doing in (use '[backtype.storm clojure config])? Is it some way of accessing backtype.storm.config?

18:56 arrdem: coventry`: yeah

18:56 bitemyapp: man. use? that's old-school as fuck.

18:56 arrdem: coventry`: it's shorthand for (require '[backtype.storm [clojure] [config]])

18:57 coventry`: Oh, I remember now. And backtype.storm.clojure. Thanks.

18:57 bitemyapp: Nathan Marz gives no fucks, brooks no fools, etc.

18:57 arrdem: the various linter projects had better bitch about (use)...

18:57 bitemyapp: arrdem: good question. I should check kibit and eastwood.

18:57 I've been banging the drum on that one for awhile.

18:57 seangrove: I wish technomancy would push for s simplified ns format, I don't know he's so hellbent on having 12 different ways to specify things in there

18:57 bitemyapp: arrdem: I get mad when Haskell code does a blank import.

18:58 arrdem: seangrove: what bugs you about ns? I think it's pretty straightforwards...

18:58 Cr8: bitemyapp: I have some theories. But I think at the end of the day most of it comes down to there not being agreement on what we're trying to build.

18:59 technomancy: seangrove: I'm too jaded to push for anything on jira

19:00 you will have to find a younger slash less-disillusioned champion

19:00 bitemyapp: seangrove: I jumped ship, so don't look at me. 80% of the people on JIRA hate me as it is.

19:00 seangrove: bitemyapp: You do have a way about you with others

19:00 gregorstocks: to be fair 90% of the people not on JIRA hate bitemyapp

19:01 bitemyapp: seangrove: I take inspiration from my Greek master Diogenes :)

19:01 gregorstocks: low-ball.

19:02 gregorstocks: well i'm including people who don't know who you are

19:02 arrdem: gregorstocks: you assume that people in ignorance are neutral

19:02 gregorstocks: I contend that they are hostile

19:02 seangrove: arrdem: I was wondering about that point as well

19:03 gregorstocks: this warrants an experiment

19:03 arrdem: everyone in this channel is disqualified.

19:03 gregorstocks: let's send 10 random people (pizza delivery folks perhaps) to bitemyapp's home and see how many of them punch him immediately upon him opening the door

19:03 sub-experiment: see how long it takes him to stop opening the door

19:04 arrdem: gregorstocks: this will take a while based on the ammount of take-out that bitemyapp orders.

19:05 bitemyapp: ^^ truth.

19:07 Cr8: is that that bitemyapp orders very little takeout, or so much takeout that there is resource contention for his door

19:07 justin_smith: I am very interested to find out what the answer ends up being to this clojurescript / core.async question on SO http://stackoverflow.com/questions/21033068/core-async-and-10-000-processes-for-animation-what-is-the-actual-benefit-in-th

19:08 bitemyapp: justin_smith: you don't see it for yourself?

19:08 arrdem: Cr8: resource contention I suspect...

19:09 bitemyapp: arrdem: not even that.

19:11 ucb: http://dumbsaint.bandcamp.com/album/something-that-you-feel-will-find-its-own-form

19:11 Cr8: neither. I already know all the people that deliver food in SF. I've drained the pool.

19:11 resource exhaustion! not contention.

19:13 danneu: what kind of lib would help me encode ["abc" "def"] to the url params ?to[]=abc&to[]=def

19:13 bitemyapp: danneu: Clojure

19:14 gregorstocks: danneu: you might be able to get away with just (str "?to[]=" (clojure.string/join "&to[]=" args)), if that's all you need

19:15 noonian: ,(apply format "?to[]=%s&th[]=%s" ["abc" "def"])

19:15 clojurebot: "?to[]=abc&th[]=def"

19:15 bitemyapp: I'm pretty sure there's already a way to do this.

19:16 * bitemyapp investigates

19:16 xeqi: cemerick: any summary of the problem?

19:17 justin_smith: danneu: apache.util.codec has a url parameter encoder, if that is what you are really looking for

19:18 sorry, I mean org.apache.commons.codec.net http://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/net/URLCodec.html

19:18 http://docs.oracle.com/javase/6/docs/api/java/net/URLEncoder.html?is-external=true actually just use this

19:19 (if url encoding is what you want, that is)

19:19 danneu: for url encoding itself i was just using http://ring-clojure.github.io/ring-codec/ring.util.codec.html#var-url-encode

19:25 alew: http-kit does param encoding

19:28 bitemyapp: danneu: :query-params {blah [1 2]} from http://localhost:3000/api/dump/?blah=1&blah=2

19:28 danneu: alew is right, I just tested it myself.

19:29 no idea if Jetty is nearly as cool as http-kit though >:)

19:29 alew: way to beat me to the punch by being braver.

19:29 technomancy: jetty is pretty boring

19:30 hiredman: good?

19:30 technomancy: hiredman: boring is good

19:30 for libraries anyway

19:32 alew: http-kit was built from the ground up to work with clojure, so it has a really nice interface

19:38 danneu: bitemyapp: i would've expected blah[]=1&blah[]=2

19:39 else i believe blah is either going to be 1 or 2

19:39 but i guess http-kit's decoder handles that

19:40 TimMc: So you want PHP-style parameters.

19:40 PHP/Ruby/I forget what else

19:41 bitemyapp: danneu: why would you need []? That's friggin' ugly.

19:41 if the name is provided multiple values, it's no longer scalar. Really simple.

19:45 tpope: simple except on the other end where now you have a sometimes-scalar-sometimes-collection

19:45 it's a not-wholy-unreasonable pragmatic compromise

19:46 bitemyapp: tpope: you should generally not breach cardinality barriers in your application

19:46 tpope: what does that mean

19:46 bitemyapp: partly because if you are forced to adopt merge semantics for multiple scalars->vector, you can end up producing data splits.

19:46 tpope: scalars stay scalar and vice versa.

19:47 this also means that any data type for which it is known that it is [], an instance of "a" should should be promoted to "[a]"

19:47 but if you violate the defaults in either direction a scalar promotion to vector can produce a data split where a sequence of overriding scalars were intended

19:47 that gets ugly ugly ugly

19:48 tpope: so is there a clojure idiom for that?

19:48 arrdem: tpope: no.. it's your application

19:48 bitemyapp: tpope: it's application and persistence semantics. Of course Clojure doesn't do anything to help you keep things straight.

19:48 arrdem: tpope: it's a type issue

19:48 tpope: I mean I have a parameter coming in that's nil if there were zero and a string if there was one and a collection if more than one

19:49 bitemyapp: tpope: if you had an HTTP/serialization interface in a language like Haskell it could keep things safe and handle promotion.

19:49 tpope: but we don't now do we

19:49 bitemyapp: no. *grump*

19:49 tpope: String if scalar, coll if more than one? yikes.

19:49 Seqable Strings lel.

19:50 technomancy: http://thisotplife.tumblr.com/post/58367979425/string-or-list-of-integers

19:50 bitemyapp: (inc technomancy)

19:50 lazybot: ⇒ 90

19:50 bitemyapp: choked laughing

19:50 technomancy: bitemyapp: that blog is a gold mine

19:51 bitemyapp: technomancy: This PLT Life is too Lisp dominated and not representative of actual PLT. Sad. :(

19:51 Common Lisper land-grab.

19:52 technomancy: continual status: http://thisotplife.tumblr.com/post/68065614838/when-i-hear-about-the-newest-database-or-web-framework

19:52 tpope: haha

19:52 (inc technomancy)

19:52 lazybot: ⇒ 91

19:53 S11001001: bitemyapp: that was my impression

19:53 bitemyapp: arrdem: Haskell or doters?

19:54 S11001001: a waste, but it's funny sometimes in spite of itself.

19:54 technomancy: clojurebot: mutable data structures is http://thisotplife.tumblr.com/post/63360807823/mutable-data-structures

19:54 clojurebot: You don't have to tell me twice.

19:54 dsrx: technomancy: lol

19:54 arrdem: hahaha

19:55 technomancy: nicely done

19:55 dsrx: great blog

19:55 arrdem: https://infosecreactions.tumblr.com

19:55 egghead: hi dsrx

19:55 dsrx: sup egghead

19:55 arrdem: http://securityreactions.tumblr.com/

19:56 egghead: everyone, I just got the okay to write an open sores clj+cljs app at work hooray

19:56 bitemyapp: arrdem: aloria is great.

19:58 arrdem: bitemyapp: just finished the inteded topic range.. 8090 words.

19:58 beer and dotaz.

19:58 bitemyapp: arrdem: noice. I WFM'd today, so I'm already at my desk! yey.

19:59 technomancy: I don't even mind Akka for being Scala as much as I mind them seeming to have ignored half or more of the things Erlang and OTP did right.

20:00 http://thisotplife.tumblr.com/post/58644976599/when-your-boss-suggests-switching-to-java

20:01 technomancy: bitemyapp: blissful ignorance on that one so far

20:01 bitemyapp: technomancy: the people happiest about Clojure at work were the people that had used Java on the job before.

20:01 seubert: hi dsrx egghead

20:02 dsrx: cobol is leaking...

20:02 bitemyapp: technomancy: even if they didn't intend on using it immediately, they were just happy to have a nice way to do JVM stuff.

20:06 egghead: :)

20:08 arrdem: bitemyapp: position assumed

20:09 bitemyapp: arrdem: you are not in mumbur :(

20:12 coventry`: If I "lein uberjar" a project with ":main clojure.main", why does "java -jar uberjar.jar clojure.main -m myns" fail with "FileNotFoundException: clojure.main"? Is there a way to work around this, so I can use clojure's main to specify different entry points to the jar?

20:13 technomancy: coventry`: you can't specify a main with -jar; use java -cp uberjar.jar ...

20:14 coventry`: Oh, right. Thanks.

20:14 technomancy: stupid java CLI behaviour at its finest

20:25 seangrove: bitemyapp: Mind rsvp'ing here and mentioning the topic of your lightning talk? http://www.meetup.com/SF-Clojurescript-Meetup/events/159485492

20:42 hadronzoo: How does one call the "/" (division) function from a different namespace? I need to refer to two different division definitions.

20:42 "some.namespace//" fails

20:43 alew: seangrove: didn't know there was a cljs meetup in SF. I'll try to make it out!

20:43 technomancy: hadronzoo: that's technically not a legal function name

20:44 yes, clojure breaks its own rules

20:45 hadronzoo: technomancy: I see. I'll alias it. Thanks

20:47 alew: technomancy: thanks for slamhound, extremely useful. do you think it could serve as a basis for a good refactoring tool? or does one already exist?

20:50 technomancy: alew: I don't think it's a good basis for refactoring; it's much too coarse-grained for the kinds of things you'd need for that

20:51 "does this explode horribly when you try to compile it? [Y\n]"

20:51 alew: Ah I see

20:56 is there a way to force cider to reload all namespaces?

20:57 TimMc: technomancy: I think 1.6 allows you to define /

20:57 S11001001: alew: like clojure.core?

20:57 alew: or I guess just the repl

20:57 well, just project namespaces would be fine

20:59 I guess tools.namespace is what I want to look at

21:03 testcloj: ha

21:03 c

21:03 when use required, why we need to quota it if use it standalone, but could not use quota if put it inside namespace?

21:03 no quota here

21:03 (ns test (:require clojure.string))

21:03 but need quota here

21:03 (require 'clojure.string)

21:06 TimMc: testcloj: This is because the ns form is a macro (or similar to one) so it can do the quoting for you.

21:12 technomancy: TimMc: define or refer?

21:16 logic_prog: is there a way, using core.async, to say: "resize buffer of channel if necessary, but force this message on" -- the reason I need this is as follows: ... I have a websocket, and for the "on-close" of the websocket, I need to push a message saying [:socket-is-closed-with-status status] (thus, just closing the chnanel is not enough, since I need to also give the status). Thus, I need some way to "force the message onto the channel,

21:16 is there a way to do the above?

21:22 ToBeReplaced: i don't understand prismatic/schema -- what does this get you that :pre/:post doesn't? not including coercion

21:25 logic_prog: no... but your consumer could alt! between two channels, and your producer could only put on the second channel the "close" message before shutting both

21:27 logic_prog: ToBeReplaced: suppose I have (let [msg-chan (...) signal-chan (...)])

21:27 how do I ensure that alt! only reads from signal-chan after msg-chan is empty?

21:27 ToBeReplaced: close msg-chan, put to signal-chan, have the consumer use alt!

21:28 if that's not clear, PM is okay

21:29 logic_prog: ToBeReplaced: https://gist.github.com/anonymous/8345977 <- hk = org.httpkit.server

21:29 this code is clearly still broken

21:29 currently working on lines 11-13

21:32 ToBeReplaced: logic_prog: i don't have httpkit experience so i can't quite follow it, i'm sorry

21:38 logic_prog: ToBeReplaced: I think your idea works, I just need to think it through.

21:55 TimMc: technomancy: Sorry, what?

21:56 Oh, /. Uh, I thought you could define.

22:45 [Neurotic]: Hey, if I'm in a ClojureScript file in which I've defined a macro (so a .clj file), how do I import in a macro from another namespace. I keep getting "No such var: clojure.core/use-macros" - but I just :use or :require it doesn't seem to work?

22:45 TimMc: ibdknox: Congrats on the release! This is great.

22:45 Now that the plugins are in place, I'll have my paredit (or write it myself.)

23:00 Tolstoy: How do you change the font in LightTable? :)

23:02 Ah!

23:05 arrdem: TimMc: I think there already is one...

23:16 seangrove: Anyone have any guidance on clojurescript compilation failing with a heap space error? https://www.refheap.com/a0d7672674da0eb7724a10a5e

23:19 Actually, seeing Error occurred during initialization of VM: Too small initial heap

23:19 amalloy: seangrove: that stacktrace looks like it ran out of memory while trying to construct an error message for some other problem

23:20 seangrove: amalloy: How strange ... I wonder what I changed to cause that.

23:21 amalloy: yeah, seems pretty weird to me too. i don't do any cljs, so take my analysis with a grain of salt

23:21 but check out lines 53-64 of your paste

23:22 seangrove: Maybe I just need a good restart

23:22 amalloy: i guess it catches all Throwables

23:23 seangrove: amalloy: What is the "Caused by:" telling me here?

23:23 Is the error on line #5 caused by the lines referenced in #52-53?

23:23 amalloy: man. allocating memory to produce an error message, after you've just caught an OOM, is a pretty sad thing for a compiler to do

23:24 seangrove: the exception on 53 happened, then it was caught/wrapped/thrown in the exception at 52, and then that was caught/wrapped/thrown by the one on line 5

23:24 seangrove: amalloy: Ahh, I was reading it backwards then

23:25 amalloy: the problem here is that the exception on 53 had already caught some other, more useful, error, and then OOMed before it could tell you what the message from that error was :P

23:26 IMO that wrapping-errors in cljs.analyzer should really be (catch Exception e), or at least something less blunt than (catch Throwable t)

23:26 bitemyapp: seangrove: I RSVP'd and mentioned what I was offering to give a talk on.

23:27 amalloy: bbloom, you around?

23:27 seangrove: amalloy: I just bumped up the memory with :jvm-opts ["-Xmx6g"] and seems like it's working-ish, thanks

23:28 bitemyapp: Awesome, looks good

23:29 amalloy: $mail bbloom https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/analyzer.clj#L274 is catching an OOM error, then attempting to allocate more memory to display it more prettily, so that the original stacktrace is lost. see https://www.refheap.com/a0d7672674da0eb7724a10a5e for an example stacktrace

23:29 lazybot: Message saved.

23:30 * arrdem adds $mail to the wiki

23:31 bitemyapp: arrdem: really?

23:31 arrdem: I don't see it.

23:32 arrdem: bitemyapp: editing it now

23:32 bitemyapp: do we have a policy on user pages?

23:32 s/we/you/g

23:32 bitemyapp: arrdem: Not at all.

23:32 arrdem: bitemyapp: kay. hiredman now has a stub page.

23:33 bitemyapp: arrdem: I am hella confused, I don't see what you're doing on clojurewiki.com

23:33 arrdem: bitemyapp: hold please.

23:34 (inc)

23:34 (inc foo)

23:34 lazybot: ⇒ 3

23:34 amalloy: huh. i just realized you can use '->> and 'let to effectively mimic haskell's "where": (->> (+ x y) (let [x 1, y 2])). like, i've seen people write that code before, and laughed at the silly trick, but only just now noticed it's the same as where

23:36 tbaldridge: but....ick.....

23:37 bitemyapp: tbaldridge: why the ick?

23:37 tbaldridge: It'd be really easy to shoot yourself in the foot with that, pick up a local from an outer scope or something.

23:39 bitemyapp: oogly. :)

23:46 arrdem: bitemyapp: there's your first bot page...

23:46 bitemyapp: sure I missed something.

23:46 $google foo

23:46 lazybot: [Foobar - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Foobar

23:48 arrdem: $help

23:48 lazybot: You're going to need to tell me what you want help with.

23:48 clojurebot: Titim gan éirí ort.

23:49 arrdem: ~inventory

23:49 clojurebot: I am carrying 0) a poorly-calibrated inference engine, currently leaking 1) a well-worn copy of clojure 1.2 tucked deep away inside a classloader 2) the last shreds of what was once my sanity

23:53 bitemyapp: arrdem: thank you :)

23:57 arrdem: bitemyapp: so lazybot has a silly number of plugins

23:57 and we never use them

23:57 I will not attempt to document anything more than what I have seen used in here.

23:57 &&(println "hell yes")

23:57 lazybot: java.lang.RuntimeException: Unable to resolve symbol: & in this context

23:58 arrdem: foo bar &(println "hell yes")

23:58 is it && or ##.. I always forget...

Logging service provided by n01se.net