#clojure log - Nov 06 2014

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

0:08 Frozenlo`: My 'lein uberjar' keeps running forever. Any idea what could be the problem?

0:09 justin_smith: Frozenlo`: are you calling shutdown-agents when the program is done

0:09 ?

0:09 Frozenlo`: Not that I know of...

0:09 justin_smith: oh, you mean the process of creating the jar

0:09 Frozenlo`: Yes

0:09 justin_smith: shutdown-agents is for when you see a program hang at runtime, sorry

0:10 Frozenlo`: jstack will tell you what the program is doing

0:10 (in the form of a bunch of stack traces)

0:10 Frozenlo`: I see 'Compiling <bunch of files>...' and then it just hangs there.

0:10 justin_smith: jstack comes with the jdk, so you could have it already

0:11 Frozenlo`: justin_smith: thanks, I'll try that.

0:18 amalloy: Frozenlo`: the last thing it says it is compiling probably includes a top-level def with side effects like spinning up a server

0:21 Frozenlo`: amalloy: Yup, it crashes at a namespace where I start a repl

0:21 amalloy: anything you do at the top level is *at compile time*

0:21 stuff you only want to happen when running your program belongs in a defn

0:22 Frozenlock: Okay, so if I place that in the -main function I should be fine?

0:22 amalloy: yes

0:22 Frozenlock: Great, thanks!

0:25 amalloy: Worked like a charm! (tho I'm sure you're not surprised...)

0:25 Thanks again!

0:26 amalloy: well, i'm a *little* surprised, since often programs with one such problem have more than one, but i'm glad it worked

1:07 nonuby: any thoughts for best approach to delete a file after its being served (wkhtmltopdf generated) by ring since returning { :body (FileInputStream. "/tmp/123324.pdf") }. Im thinking of decorator approach where .close then delete the files after passing .close to the inner inputstream

1:09 justin_smith: nonuby: what if you never put it on disk in the first place, and just handed an input stream that would be garbage collected to the client?

1:09 nonuby: either generate it directly into the stream, or if that can't be done, put the contents in an input stream, delete, then return the stream

1:09 nonuby: i dont think wkhtmltopdf executable can output to stdout, let me check

1:10 justin_smith: nonuby: bonus, on a linux system you can delete a file that you have open, and you can continue using your file handle until you close it

1:10 and only then is the space on disk reclaimed

1:10 nonuby: nice

1:10 justin_smith: so if you can be linux specific, that may be your best bet

1:11 but really, the part where you put it on disk is just a performance bottleneck, so avoid that if you can

1:11 putting it on a ramdisk /tmp/ directory for example

1:12 (the file operators think it is a file, the OS never puts it on disk, win / win)

1:13 nonuby: just give me a idea from something i read a while ago, moment

1:14 in absence of no stdout from wkhtmltopdf, mkfifo fits perfect, once read its gone

1:14 justin_smith: oh, that's another option for sure

1:14 well - won't the fifo still exist? it won't take up much space though

1:14 nonuby: no its gone once its read

1:15 ah no its not

1:15 justin_smith: oh, when I call mkfifo in the shell, that creates an actual thing

1:15 nonuby: yeah hmm.. i still need to clean up hmmm..

1:16 justin_smith: yeah, but once again, on a linux system you can delete it before you are done using it

1:16 browsers use this trick to hide the mp4 files that go with streaming video

1:16 nonuby: so if I combined mkfifo with the delete once I have the file handle, I presume it won't touch disk except for creating the handle?

1:17 justin_smith: it used to be very easy to grab streaming video into video files on a linux box :)

1:17 nonuby: right, creating and removing the handle, which is lightweight

1:17 nonuby: awesome, mkfifo, and delete open I have the file handle it is! thanks

1:57 calihomer: Hi all. Clojure noob here. Here is a Gist that has me confused: https://gist.github.com/jayp/8bf732aa1622f642bfa2 . It's about a LazySeq that's actually a map... and why I can't destructure it without using "into".

1:59 seancorfield: calihomer: you're getting a sequence of maps, not just a single map

1:59 Ember-: yup

1:59 was just about to say the same thing :)

1:59 calihomer: ahh

1:59 Ember-: 1..n db rows, single row represented by a map

2:00 seancorfield: so (let [{:keys [value]} (first (db/get-value "foo"))] ...)

2:00 calihomer: haha. makes sense!

2:00 thanks all

3:23 Viesti: has anyone here used amazonica with dynamodb JSON support?

3:37 Glenjamin: is there a good way to get cljs docs? (doc) not existing in the cljs repl is starting to get annoying :(

4:10 dysfun: is there a 'design patterns with clojure STM' document anywhere? The system I'm building, i can think of several ways to implement it and i've got no idea what the impacts of those design decisions will be

4:17 ordnungswidrig: what are you thinking about?

4:19 dysfun: loosely, i have a data structure and indices int it. I *could* bang the whole lot in an atom, but i suspect some of those updates might take a little time, so i'm wondering if keeping them as separate refs might be a better idea

4:20 ordnungswidrig: what's the concurrency you're expecting on this data structure?

4:21 dysfun: probably read-heavy, but potentially intense load

4:22 many threads will be working with them

4:22 ordnungswidrig: if the update takes time, other threads will see the old version for the refs

4:22 dysfun: and to deal with some interlinking, there are liable to be atoms inside it

4:22 yes, i have no problem with old versions being seen. that's perfectly okay :)

4:22 for this case

4:22 ordnungswidrig: are you aware that atoms are not integrated with the STM?

4:23 dysfun: oh, i presumed they were just the simplest form of it

4:23 ordnungswidrig: no, only refs (and agents) are coordinated. atoms are uncoordinated.

4:24 If you don't have a lot of concurrent write access to the data then you can use a single reference to hold id.

4:24 dysfun: well, i see it more as being the ability to deal with one datum vs many in a coordinated fashion

4:24 but semantics

4:25 but if i get more writes, it's liable to be more efficient to do multiple refs?

4:26 well, on throughput

4:26 ordnungswidrig: I guess: yes. As long as you're writing on distinct refs. Writing to multiple refs is still coordinated/atomic when it occurs in a single (dosync) block.

4:26 dysfun: *nod*

4:27 since these are indices into the data though, i wonder if we could let them go out of date a little

4:27 ordnungswidrig: Your should measure and decide basedon that data.

4:28 ddellacosta: what the heck is going on when my lein uberjar compile just stops?

4:29 like, just waiting for minutes

4:29 if I ctrl-c it and start again it finishes right away, but if I lein clean and then do it again, same thing, hanging

4:29 don't get it

4:29 Ember-: lein clean is superslow at least on windows

4:29 like superduperslow

4:30 not lightning fast on osx either

4:30 but waaaay faster

4:30 ddellacosta: Ember-: lein clean is not that slow, but lein uberjar hangs

4:31 Ember-: well, does the uberjar print any output for you before it hangs?

4:31 mnngfltg: Is there a name for this function: #(vec %&)

4:31 ?

4:32 It would be cool if it had a name, just as (fn [x] x) is available as `identity`

4:32 ddellacosta: Ember-: it looks like it's compiling a bunch of namespaces

4:32 Ember-: maybe you just have a large project? :)

4:33 ddellacosta: Ember-: I do, but it doesn't make sense to me that it stops where it does, then I ctrl-c it, then I run the command again and it finishes rather quickly. Just wish I understood what it was doing

4:33 Ember-: mnngfltg: that is a reader macro for anonymous function declaration

4:33 so it will create a similar function as (fn [x] x)

4:33 mnngfltg: Ember-, similar but not the same

4:34 Ember-, because it accepts >1 args

4:34 Ember-: well, the content is different there :)

4:34 mnngfltg: my point is that this is a pretty useful function, almost as useful as identity

4:35 dysfun: i'm not convinced it is

4:35 Ember-: well, why don't you write one for yourself then

4:35 dysfun: but actually, isn't that the vector function?

4:35 Ember-: (fn [& args] (apply vec args))

4:36 and yes, that is the vec function, no need to wrap it

4:36 dysfun: except with a bit more magic inside

4:36 no, the function 'vector'

4:36 Ember-: ,(vec 1 2 3)

4:36 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/vec>

4:36 dysfun: ,(vector 1 2 3)

4:36 clojurebot: [1 2 3]

4:36 mnngfltg: dysfun, yes! amazing!

4:36 Ember-: ,(apply vec 1 2 3)

4:36 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>

4:36 Ember-: aww

4:36 dysfun: ,(apply vec [1 2 3])

4:36 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/vec>

4:37 Ember-: but anyway, vector is the function

4:37 and hash-map and so forth

4:37 mnngfltg: perfect, that's what I was looking for

4:37 Ember-: you can also do (which isn't exactly the same):

4:37 dysfun: http://clojure.org/cheatsheet

4:37 ddellacosta: vector is very semantically different from #(vec %&) though

4:37 Ember-: ,(into [] (range 1 10))

4:37 clojurebot: [1 2 3 4 5 ...]

4:38 mnngfltg: ddellacosta, vector, not vec!

4:38 Glenjamin: ddellacosta: is it? i'd have said it's semantically the same, but functionally different

4:38 well, same effect, different implementation

4:38 dysfun: that's what i'd have said

4:38 ddellacosta: mnngfltg: your example used vec, no? I'm comparing your original example to vector

4:38 Ember-: different API for different usage scenarios

4:38 ddellacosta: ...

4:38 Ember-: same end result

4:39 Glenjamin: well, there's no use case for #(vec %&)

4:39 Ember-: yup, there is none :)

4:39 just use vector and vec directly

4:39 mnngfltg: ddellacosta, well #(vec %&) gives the same results as `vector`

4:39 Ember-: ,(apply vector '(1 2 3))

4:39 clojurebot: [1 2 3]

4:40 ddellacosta: mnngfltg: Okay, but it wasn't clear what you were focusing on--the rest arg literal or the vec fn inside, or the anonymous fn, etc.

4:40 Ember-: (vec '(1 2 3))

4:40 ,(vec '(1 2 3))

4:40 clojurebot: [1 2 3]

4:40 Ember-: same thing

4:40 mnngfltg: Here's my use case: I'll use it for programming in the repl. If I want to work with a (map) with two collections, I'll start with (map vector coll1 coll2) first and see what it gives me

4:40 ddellacosta: if you just want something to return a vector there's a ton of ways to do so

4:40 mnngfltg: ddellacosta, yeah, I didn't explain fully

4:41 `vector` is prefect for this (as `identity` is when using single-collection (map))

4:42 Glenjamin: also (list)

4:42 ddellacosta: still not really getting it, alas

4:43 dysfun: i'm still not really getting why we're bikeshedding when he just wants a vector out and he's found a function that does it

4:43 ddellacosta: dysfun: haha, fair enough. I was curious because comparing it to identity in utility makes no sense to me

4:44 dysfun: i don't think it's quite so useful either

4:44 ddellacosta: dysfun: so seems like there is more there than s/he just wants something that returns a vector

4:44 * dysfun rarely if ever explicitly wants a vec

4:44 ddellacosta: like, maybe mnngfltg is trying to define some category theoretic concept or something

4:45 mnngfltg: ddellacosta, I'm really not :)(

4:45 I'm a pratical guy

4:46 ddellacosta: mnngfltg: I wasn't saying you weren't

4:46 dysfun: is there a reason you care about it explicitly being a vec?

4:46 what's wrong with a seq?

4:46 M-x: Hi. Anyone using yesql here? Will there be any problems if I will use transactions in the sql queries?

4:46 mnngfltg: dysfun, no it could be a list of vec or any other seq

4:47 dysfun, I just want a function that returns all its arguments for me to expect them :)

4:47 identity doesn't cut it because you can only call it with one argument

4:47 M-x: I mean, transactions in the sql file itself, not clojure.java.jdbc transactions. Could there be some collisions with jdbc driver's management of transactions or something like that?

4:47 mnngfltg: `list` or `vector` fit the bill

4:48 dysfun: so does 'seq'

4:48 ddellacosta: M-x: I don't know how yesql deals with that, but you can explicitly turn on/off transactions in c.j.j

4:48 dysfun: well, not with the multiple args

4:48 M-x: dysfun: seq do not returns all its arguments on call.

4:49 *does not return. Sorry, not really good in english.

4:50 dysfun: mnngfltg: i think i know what you're trying to, and i think there's an easier way

4:50 mnngfltg: M-x, what's the worst that could happen - having nested transactions, right?

4:50 ddellacosta: good point

4:50 dysfun: i think you want interleave

4:50 M-x: ddellacosta: thanks for the heads up. Guess no problems should occur when they are turned off.

4:51 ddellacosta: dysfun: it's amazing how much you've been able to discern about mnngfltg's goals, I cannot make heads or tails of what's going on there

4:51 M-x: np

4:51 M-x: mnngfltg: well, I guess so...

4:51 ddellacosta: M-x: but agree w/mnngfltg, that is wrapping them shouldn't cause issues as far as I know

4:51 dysfun: ddellacosta: i've almost finished my first pot of coffee. i don't claim it makes awesome sense, but hey, i'm not awake yet either :)

4:51 ddellacosta: dysfun: ha. :-)

4:52 dysfun: of course i'm intuiting here and i could be completely wrong

4:52 but it's sort of like 'clojure golf' on steroids (Where unlike perl golf, the idea is to write cleaner code by using the basic functions better)

4:53 throw in a bit of mind reading :)

4:53 M-x: ddellacosta: by the way, do you know of any pure-java lib similar to yesql?

4:54 mnngfltg: dysfun, I think I'm fine with `vector` !

4:54 M-x: I'd like to reuse the queries I've written for yesql from java code without writing parsing code myself

4:54 ddellacosta: M-x: you mean, SQL in separate files (that's how yesql works, right?) but implemented in Java vs. Clojure? I do not, I'm sorry

4:55 dysfun: ,(interleave [1 2 3] [4 5 6])

4:55 clojurebot: (1 4 2 5 3 ...)

4:55 ssideris: M-x: could you not use yesql from java?

4:55 dysfun: oh no, it's not nested like vec would be

4:55 M-x: ddellacosta: yeah, that's what I mean. Haven't googled anything similar too, I guess I'll have to write some simple parser myself.

4:56 ssideris: well, technically I can, but I would like to see pure java solution.

5:01 * dysfun finds that an odd thing to say for someone in #clojure

5:07 ssideris: yes, THIS. IS. CLOJUREEEEEE

5:07 :-D

5:15 M-x: %)

5:18 kenrestivo: personal pet peeve: keys with names like :?data

5:18 it's :?ugly

5:19 and smells of hungarian notation. if the key is optional, just name it :data and document that

5:19 /rant

5:19 ssideris: oh I've never seen that before

5:20 daniel__: i think it's highly clever

5:20 clgv: :?data! :D

5:21 yocapybara: hey guys, anyone using cursive? I'm currently rocking cider and emacs but normally spend my day in intellij, wondering whether anyone had any experiences, good or bad...

5:26 clgv: yocapybara: a student of mine is using it and it definitely gets the job done.

5:27 TEttinger: cfleming makes it and could help if you have trouble, I'm sure

5:27 clgv: yocapybara: but he didn't use emacs, so I can't ask him for a comparison ;)

5:44 yocapybara: clgv: thanks for the info

5:45 TEttinger: thanks also :)

5:48 kenrestivo: i don't think it's clever at all. say you want to make that a not-optional key. what do you do, change it's name?

5:49 plus, is it a predicate backwards? ?foo is optional key, foo? is a predicate. also when you destructure it, it's now an ugly var, ?foo. what, is the var now optional too?

5:50 anyway, dunno why this gets up my nose but it does

6:17 kungi: a 2ls

6:18 justin_smith: lazybot: would a name like ??data be better??

6:18 lazybot: justin_smith: Uh, no. Why would you even ask?

6:23 Kneiva: ?oof

6:23 clgv: lazybot: is justin_smith asking strange questions???

6:23 lazybot: clgv: Oh, absolutely.

6:29 justin_smith: hide your iphones, hide your macbooks http://www.zdziarski.com/blog/?p=4140

6:33 dysfun: ...if you're downloading dodgy chinese software?

6:33 "[+] Your OS X system isn't infected by the WireLurker. Thank you!"

6:35 justin_smith: ,(map #(do %&) (range 10) (range 20 100)) ; mnngfltg:

6:35 clojurebot: ((0 20) (1 21) (2 22) (3 23) (4 24) ...)

6:35 justin_smith: ,(map #(identity %&) (range 10) (range 20 100)) ; mnngfltg:

6:35 clojurebot: ((0 20) (1 21) (2 22) (3 23) (4 24) ...)

6:37 clgv: so what?

6:38 ,(map list (range 10) (range 20 100))

6:38 clojurebot: ((0 20) (1 21) (2 22) (3 23) (4 24) ...)

6:38 mnngfltg: justin_smith, interesting

6:38 clgv: is shorter ;)

6:38 justin_smith: #(identity %&) seems to be getting at your intention semantically though

6:39 mnngfltg: how does #(identity %&) even work?

6:39 clgv: rest args

6:39 justin_smith: %& is a list of all arguments

6:40 mnngfltg: ah yes, and identity just returns its sole argument

6:40 justin_smith: ,(map (fn [& args] args) (range 10) (range 20 100))

6:40 clojurebot: ((0 20) (1 21) (2 22) (3 23) (4 24) ...)

6:40 justin_smith: that's the equivalent

6:40 mnngfltg: sure

6:41 #(do ...) -- is that an idiom?

6:41 justin_smith: mnngfltg: yes, some people hate it

6:41 dysfun: it's quite handy sometimes though

6:41 mnngfltg: "do" screams side-effects to me

6:41 justin_smith: right, exactly the reason it is disliked

6:41 mnngfltg: but it's short :)

6:41 justin_smith: ,(map #(-> %&) (range 10) (range 20 100)) ; equivalent

6:41 dysfun: once you've written a handful of macros that expand into dos, i think it loses its teeeth

6:41 clojurebot: ((0 20) (1 21) (2 22) (3 23) (4 24) ...)

6:42 justin_smith: yeah, every fn body, every let body, are do

6:42 dysfun: i've written a lot

6:42 of things that look like lets or defns

6:43 Glenjamin: all of those are more cyptic than (map list ...) imo :)

6:44 clgv: huh? #(do %&) is an idom? I doubt that. the lambda shortcut is one though

6:46 justin_smith: clgv: more common is #(do [:a %& b]) or #(do {:a %&}) and variations

6:46 grabarz: guys, newbe's question. how to wrap argument into vector if it wasn't a vector and return it as it is otherwise? eg. (myfun "abc") -> ["abc"] and (myfun ["abc"]) -> ["abc"]

6:46 clgv: justin_smith: didn't see that in any codebase yet

6:46 just use the function instead of the literal in these cases...

6:47 mnngfltg: grabarz, maybe that's not a good idea?

6:47 clgv: #(vector :a %& :b) is not really longer

6:48 grabarz: just query if it is a vector - (if (vector? x) x [x])

6:48 mnngfltg: grabarz, (if (seq x) x (vector x))

6:48 clgv: well that works for atoms and vectors only ;)

6:48 grabarz: I usually use (if (sequential? x) x [x])

6:48 justin_smith: ,(vector? {}) ; what?

6:49 clojurebot: false

6:49 grabarz: mnngfltg: well, I'd like to always operate on a vector inside my fun, but allow pass a single arg just as single arg not a vector, eg (myfun "abc") or (myfun ["abc" "def"])

6:49 clgv: grabarz: that's exactly the use case where I use the above form ;)

6:49 justin_smith: grabarz: change your fun to (defn f [& args]) and let users use apply if they want to provide a vector / list

6:49 clgv: grabarz: make it a helperfunction

6:50 grabarz: clgv: thanks, i'm checking it out

6:51 clgv: justin_smith: that does not work for e.g. (defn foo [atom-or-seq, & other-params] ...)

6:51 mnngfltg: grabarz, maybe use "& args" ?

6:51 clgv: justin_smith: you'd need similar logic as in the defn implementation then, which is a big overhead

6:51 mnngfltg: grabarz, that seems like a less confusing way to have a function that takes one or more arguments

6:51 justin_smith: clgv: fair point

6:52 clgv: mnngfltg: no there are valid use cases where you want to have a single param that can be both, atom or sequence of params

6:52 grabarz: mnngfltg: good point. thanks for help.

6:54 clgv: grabarz: I have a similar logic in an "iteration macro" if only `x` is used `x` is bound to the current value. if I specify `[x i]` `x` is bound to the value while `i` is bound to the index

6:56 mnngfltg: clgv, yeah but that's pretty rare no?

6:57 grabarz: clgv: yup, I've just solved my problem this way :) thx a lot!

6:57 clgv: mnngfltg: no. I also have functions where something similar is pretty handy

6:58 mnngfltg: ok

6:59 clgv: mnngfltg: my chart generation code has several use cases therefore. but it might be pretty rare for your scenarios...

7:06 M-x: Is prismatic/Schema suitable for validating user input or is it more like contract programming stuff?

7:09 vijaykiran: M-x: both AFAIK

7:11 M-x: vijaykiran: thanks, I'll dig more into it then

8:33 martinklepsch: is there any reasonable difference to prefer compojure.route/files over ring.middleware.file/wrap-file or the other way around?

9:17 vijaykiran: martinklepsch: I think they are more or less same since compojure uses ring file-response anyway

9:18 ordnungswidrig: m-x: schema has pretty un-humane error messages

9:19 m-x: but I saw a lib to humanize the error, the other day.

9:21 vijaykiran: https://github.com/cddr/integrity ?

9:46 perplexa: hmm, does (repeat) memoize or just call the inner form once and repeat the result?

9:46 ,(take 3 (repeat (str (java.util.UUID/randomUUID))))

9:46 clojurebot: ("049c17a4-814d-4f52-adb1-c8ca0c60f8a4" "049c17a4-814d-4f52-adb1-c8ca0c60f8a4" "049c17a4-814d-4f52-adb1-c8ca0c60f8a4")

9:46 perplexa: ;/

9:47 opqdonut: repeat takes a value

9:47 so it's already "memoized" :)

9:47 perplexa: hm ;x

9:47 clgv: perplexa: repeat is a fuction and just gets the value

9:47 perplexa: yeah damnit

9:47 clojurebot: It's greek to me.

9:47 mgaare: maybe you're thinking of repeatedly

9:47 perplexa: i thought it was a macro :(

9:47 clgv: perplexa: that's why `repeatedly` wants a function ;)

9:47 perplexa: ah!

9:47 thank you

9:48 opqdonut: the interesting question is whether forcing a long prefix of repeat uses lots of memory

9:48 perplexa: ,(take 3 (repeat #(str (java.util.UUID/randomUUID))))

9:48 clojurebot: (#<sandbox$eval49$fn__50 sandbox$eval49$fn__50@1f374e5> #<sandbox$eval49$fn__50 sandbox$eval49$fn__50@1f374e5> #<sandbox$eval49$fn__50 sandbox$eval49$fn__50@1f374e5>)

9:48 perplexa: wat :P

9:48 ,(take 3 (repeatedly #(str (java.util.UUID/randomUUID))))

9:48 clojurebot: ("cd9d869b-ac39-40f7-8886-30d94d7b3ca3" "8a85b98d-696b-469d-817f-a4e4eb31a5d6" "e3ed6c77-2cb9-483c-a1ef-1a9ba1486701")

9:48 perplexa: better \o/

9:49 clgv: opqdonut: well you pay for the `cons` and the LazySeq instances

9:49 opqdonut: one wouldn't need to

9:49 I think

9:49 yeah, it gobbles up memory, just checked via top

9:49 but you could have a cyclic structure, at least with a suitable implementation of LazySeq

9:49 clgv: but that is not due to the repeated object

9:50 opqdonut: yeah, it's an arbitrary object that might not be copyable in any way

9:50 clgv: opqdonut: you could write a reducer to do the same ;)

9:50 opqdonut: (c.f. haskell's repeat which uses O(1) space by just having "let xs = value:xs"(

9:50 )

9:51 clgv: well the lazy-seq also uses O(1) memory - it starts to consume more if you realize a part of it

9:51 opqdonut: I mean haskell's uses O(1) space no matter what

9:52 clgv: opqdonut: that comparison is not valid since you need to store the elements somewhere ;)

9:52 opqdonut: now I'm not following you

9:52 clgv: since you certainly want a list of 5 elements to process further after (take 5 (repeat obj)) even in haskel ;)

9:52 opqdonut: oh, sure

9:52 yeah it doesn't really matter in practice

9:54 sm0ke: is this good enough to resolve afunction from symbol ##(resolve 'inc)

9:54 lazybot: java.lang.SecurityException: You tripped the alarm! resolve is bad!

9:55 sm0ke: i am facing some problem resolving functions this way, when it is getting callel indirectly from another namespace

9:57 clgv: smoke: depends - is the namespace required and the symbol referred into the current namespace?

9:58 sm0ke: umm no actually i have something like (let [f (resolve 'sym)]..) inside a function in one namespace, when i execute the form it resolves correctly

9:58 clgv: smoke: you gotta do something similar to (defn load-fn [symb] (when-let [ns (namespace symb)] (require (symbol ns))) (some-> symb resolve var-get))

9:59 sm0ke: but when i call this from another it resolves to nil

9:59 clgv: sm0ke: yeah you need to provide the namespace of the symbol when it is not referred in the other namespace

10:01 ,(do (require 'clojure.string) (ns 'bla) (resolve 'clojure.string/join))

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

10:01 clgv: ,(do (require 'clojure.string) (ns bla) (resolve 'clojure.string/join))

10:01 clojurebot: #'clojure.string/join

10:01 clgv: ,(do (require 'clojure.string) (ns bla) (resolve 'join))

10:01 clojurebot: nil

10:01 clgv: sm0ke: see? ^^

10:03 sm0ke: sorry brb, thanks clgv i will try this

10:05 clgv: thanks, worked perfectly

10:05 (inc clgv)

10:05 lazybot: ⇒ 35

10:05 clgv: great :)

10:05 sm0ke: your application is single threaded right?

10:20 the_danko: cfleming: so i upgraded to intellij 14, and it auto-suggested la clojure and some other one. i knew where to get the plugin link, but others may be tempted just to click yes on the lesser plugins. also it makes them look more official. i am sure you are aware of this already.

11:20 perplexa: ?paste

11:20 ;x

11:21 https://www.refheap.com/92804 is that okay or would i use some fancy function instead that i don't know of, instead of flatten+map?

11:22 llasram: perplexa: mapcat

11:23 perplexa: yeah i thought so but my implementation failed ;x

11:23 gonna give it another shot

11:24 llasram: perplexa: OOC, what is the `h/` namespace prefix here?

11:24 perplexa: hdfs-clj

11:24 https://github.com/r0man/hdfs-clj/blob/master/src/hdfs/core.clj

11:25 llasram: Interesting. You might also be interested in https://github.com/damballa/parkour/

11:25 Even if just interacting with HDFS, parkour.fs add some nice things like extending clojure.java.io to HDFS Path objects

11:25 perplexa: mapcat yields funny char maps of the split strings ;x

11:26 llasram: So e.g. you can just `clojure.core/slurp` them

11:26 perplexa: mapcat requires every return value of the function be a collection. Wrap the atomic case as a single-element vector

11:26 perplexa: thanks, i'm just moving files around, though :)

11:26 yep will do

11:27 yay it works, will also remove the tl macro \o/

11:27 clgv: ~flatten

11:27 clojurebot: flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.

11:28 * perplexa bows

11:28 perplexa: https://www.refheap.com/92805 :)

11:32 llasram: perplexa: BTW, the Hadoop API actually provides `.listFiles` method which takes a `recursive` option. It'll be a bit more Java interop for you, but won't hammer on your nameserver quite so hard

11:34 perplexa: llasram: thanks for advice :)

11:37 gonna use that :)

11:44 EvanR: does anyone have gripes about performance of core.match

11:58 perplexa: llasram: on the returning iterator, i'm using (while (.hasNext iter) (println (.next iter))) for now and it seems to not work ;/

12:00 mmg: I’ve got a java interop heavy fn. if it throws I want to catch and stop looping, otherwise I want to call recur. Because recur has to be in the tail position I’m having an annoying time with this. is there a good clojure abstraction around breaking out of a loop or something similar for this case?

12:00 llasram: perplexa: "not to work" is a bit vague for a diagnosis

12:00 perplexa: .hasNext is always true apparently, eventually the code ends with NoSuchElementException No more entry in /Users/perplexa/test org.apache.hadoop.fs.FileSystem$5.next

12:00 llasram: perplexa: refheap?

12:01 perplexa: llasram: sorry?

12:01 llasram: perplexa: show the code

12:01 perplexa: oh

12:02 llasram: mmg: The usual pattern is to have a (try ...) expression which yields a vector of two values: nil/exception and results/nil for success/failure respectively

12:02 perplexa: https://www.refheap.com/92807

12:02 llasram: mmg: Then you can `recur` on success or re-`throw` on failure

12:02 Bronsa: perplexa: remove the #

12:02 mmg: thanks Ilasram

12:02 perplexa: oh, hmpf :D

12:02 thanks, Bronsa. yeah it's working now

12:05 llasram: perplexa: I use reducers pretty heavily, and encapsulated that as https://www.refheap.com/92809, as for some reason it isn't just a regular `Iterator` and thus the standard clojure.core functions do not work

12:08 perplexa: llasram: difference between coll-reduce and CollReduce?

12:09 llasram: perplexa: What now?

12:11 noonian: perplexa: CollReduce is a protocol, coll-reduce is the function that the protocol specifies and he's reifying CollReduce by implementing coll-reduce

12:11 perplexa: ok, thanks :)

12:11 justin_smith: ,(java.util.UUID/randomUUID) ; perplexa - it has a nice readable form if you don't apply str to it

12:11 clojurebot: #uuid "e521229f-c18d-4ba1-b38a-0ad2b86c44bf"

12:12 perplexa: i've never seen reify before, just opened the docs and BAM, it's a lot ;x

12:12 justin_smith: i know, but i was just putting the output into for i in a b c d; do mkdir $i/some/stuff; done for testing in my shell ;p

12:12 noonian: just returns an object that implements the reified protocols

12:12 perplexa: so kinda needed the strings :)

12:15 noonian: meh, so much new to learn every day :D

12:15 bbloom: guys: immutable data is awesome.

12:15 i just keep finding fun new uses for it

12:19 jackjames: bbloom: blog post incoming?

12:19 verma: in compojure is there a way to apply middleware to a certain context only?

12:20 like I want wrap json middleware applied to /api/ context

12:20 and leave all other alone

12:20 right now ring json middleware blindly JSONifies everything without looking at response's content type

12:21 which is not what I want

12:21 justin_smith: verma: you can wrap a specific route in a middleware, yeah - I don't recall off the top of my head how it is normally done in compojure

12:21 verma: I guess I could write my own middleware as well

12:21 justin_smith: verma: wouldn't it look at the accept field on the incoming request?

12:21 verma: justin_smith, checking

12:21 justin_smith: verma: a middleware can be applied to a specif handler, or even a specific action

12:22 bbloom: jackjames: i have about 38754835 blog posts coming, but i rather have > 0 code coming ;-)

12:22 verma: justin_smith, sure thanks, here is the middleware code: https://github.com/ring-clojure/ring-json/blob/master/src/ring/middleware/json.clj#L76 for wrap-response, it only checks if response is a coll?

12:23 justin_smith: well that's dum

12:23 enn: lein test doesn't seem to be running my test.check defspecs, though they run fine in the repl with test-vars. Any idea what I might be missing?

12:24 justin_smith: or at least more eager than you thought it would be

12:24 verma: justin_smith, I see a wrap-routes method, let me see what it does

12:24 justin_smith: verma: anyway, you can (wrap-json-response my-endpoint-function)

12:24 or that if you want to wrap multiple, sure

12:24 jackjames: bbloom: maybe there's a reason/history i'm not aware of, but i think #clojurescript would be better if you joined us there

12:25 verma: justin_smith, thanks, let me try

12:25 jackjames: bbloom: i'm hacking on the circleci frontend and no-local-state om stuff that i assume is mostly your original ideas?

12:26 perplexa: llasram: thanks for that, i've integrated it using (reduce conj [] (riterator-reducer iter)) :P

12:26 i really like!

12:26 (inc llasram)

12:26 lazybot: ⇒ 40

12:27 bbloom: jackjames: i was working on something like that prior to the release of React/Om. when dnolen_ originally built Om, I had planted the globalization-of-local-state idea in his head early (and repeatedly)

12:27 jackjames: dnolen_ did the hard work of implementing all the intercession stuff, all i did was push it over the edge & convince daniel at circle that it was a damn good idea

12:28 {blake}: Is there a clojure idiom for a chain of when-let? Like "(when-let [x f1] (when-let [y (f2 x)] (when-let [z (f3 y)].."?

12:30 verma: what's the general opinion about boot here?

12:30 {blake}: The conditionals being necessary because the functions may return nils but error out when receiving nils?

12:31 justin_smith: ,(cond-> 1 number? inc even? inc) ; blake

12:31 clojurebot: 3

12:31 justin_smith: ,(cond-> 2 number? inc even? inc) ; blake

12:31 clojurebot: 4

12:31 verma: nodeso is spamming me :(

12:32 {blake}: justin_smith, Let me try that, thanx.

12:33 justin_smith: {blake}: it's not quite doing what I expected, I am likely getting the syntax wrong

12:33 {blake}: justin_smith, No worries. I had forgotten the whole "cond->", "cond->>" area.

12:33 Gives me some place to look.

12:34 justin_smith: {blake}: the tests don't get the chained val as args, is the problem

12:36 {blake}: justin_smith Ahhhhhh. Yeah, that's the problem all right.

12:37 justin_smith, cond->>?

12:37 justin_smith, Nope, that's just cond-> that doesn't short-circuit, apparently.

12:39 mgaare: {blake}: some->

12:39 ah, but do you need all of the bindings?

12:40 justin_smith: oh yeah, some-> is likely what he wants

12:40 {blake}: mgaare, justin_smith Checking it out.

12:41 mgaare: {blake}: some-> is just -> with short-circuiting of nils

12:42 Glenjamin: chains of when-let are awkware, last time i had to do this i ended up using a trick from useful

12:43 http://flatland.org/useful/flatland.useful.utils.html#var-let-later

12:43 {blake}: mgaare, Yes! some-> is exactly what I was looking for, thanx.

12:43 (inc mgaare)

12:43 lazybot: ⇒ 1

12:44 mgaare: if you need that plus you need access to bindings from previous forms, one possibility is using maybe-m from clojure.algo.monads

12:44 {blake}: mgaare, Cool, thanks. I'll check it out.

12:44 Glenjamin, And I need to go through "useful", too, for sure.

12:45 mgaare: {blake}: yw!

12:46 {blake}: Is it just me, or does one spend a remarkable amount of time in Clojure (and I presume all functional languages) focused on manner of expression?

12:47 technomancy: {blake}: you mean style issues in particular?

12:47 {blake}: technomancy, No, I don't think "style" is the right word. Maybe, though.

12:47 technomancy, Contrast with (my experience of) Python.

12:47 technomancy: "manner of expression" is pretty board in a language where everything is an expression =)

12:47 mgaare: such is the nature of things in an expressive language

12:47 {blake}: technomancy, Ha! Good point.

12:48 technomancy: {blake}: well python is kind of unique in it's "one way to do it" mantra

12:48 justin_smith: {blake}: like which way to express code among options that may use different functions but be functionally equivalent

12:48 (meant to end that with a ?)

12:48 {blake}: But, in Python, there is, e.g., "Code Golf". But it's a gimmick. Fun, but you shouldn't really be doing it in production.

12:49 cbryan: functional languages seem to inspire that lovable mix of "how can i do this better?" and "how can i do this so no one else can understand it?"

12:49 technomancy: cbryan: that's point-free style for ya

12:50 cbryan: yeah, definitely worse in haskell than clojure ;)

12:50 {blake}: Whereas, in Clojure, it's more like "Have I really expressed (and =understood=!) the problem correctly?"

12:50 "Have I complected?"

12:50 "Am I being lazy? And is it good lazy or bad lazy?" =P

12:53 clgv: {blake}: you can code golf on 4clojure.com ;)

12:54 {blake}: clgv, Indeed. And there is some of that "how can I do this so no one else can understand it?" there.

12:58 justin_smith: {blake}: cbryan: I think the "so nobody else can understand it" can often be more charitably described as "I just learned about this cool new concept, don't totally get it yet, and was looking for an excuse to try to apply it"

12:58 clgv: {blake}: yeah code golf beyond a certain threshold leads to hard to understand code ;)

12:59 technomancy: juxt!

12:59 {blake}: Heh.

13:00 justin_smith: clgv: I forget where I read this, but there is a concept that readability is one of a number of parameters you can optimize (tersness, performance being others) and often if you optimize one parameter others suffer

13:01 {blake}: I've always taken "readable" over "clever". But I think Clojure encourages you to--well, I guess it's the whole simple vs. easy thing.

13:04 clgv: justin_smith: you need to find your preferred spot on the pareto front ;)

13:11 arrdem: to quote djikstra, cleaver tricks should be avoided like the plague

13:13 pyrtsa: Except if you're a butcher.

13:15 EvanR: ,(concat [1 2 3] [2 3 4])

13:15 clojurebot: (1 2 3 2 3 ...)

13:15 EvanR: ,(concat [1 2 3] [2 3 4] [5 6 7])

13:15 clojurebot: (1 2 3 2 3 ...)

13:17 justin_smith: ,(apply concat (partition 3 1 (range)))

13:17 clojurebot: (0 1 2 1 2 ...)

13:17 justin_smith: ,(apply concat (partition 3 1 (range 1 10)))

13:17 clojurebot: (1 2 3 2 3 ...)

13:27 clgv: arrdem: I like that Dijkstra quote better: "It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: As potential programmers they are mentally mutilated beyond hope of regeneration." :D ;)

13:27 mgaare: these days that applies to Java instead of BASIC

13:28 clgv: mgaare: hmm no, not really

13:29 dnolen_: I learned w/ BASIC - guess I'm screwed

13:29 devn: Is there a specify!/specify in clojure?

13:29 dnolen_: devn: no

13:29 arrdem: if dnolen_ is screwed we have no hope :P

13:29 {blake}: I did Basic (and Assembler) for five years. It was so painful, it encouraged me to conceive of structured, OO and functional programming techniques.

13:29 devn: I guess I knew that, my question is more along the lines of, what would that look like if I wanted it in Clojure? Thoughts?

13:29 clgv: dnolen_: beyond repair - that's why you are doing all this weird clojurescript stuff ;) :D

13:30 dnolen_: devn: probably would require invokeDynamic

13:30 clgv: devn: what would that do?

13:31 mgaare: dnolen_: cljs, om, core.logic are like physical therapy for the BASIC brain damage

13:31 EvanR: ,(flatten [[1 2 3] [3 4 5]])

13:31 clojurebot: (1 2 3 3 4 ...)

13:31 dnolen_: devn: well probably lots of slow ways to do it - but I don't think it would get implemented if it can't be fast

13:31 EvanR: ,(flatten [[1 2 3] '(1 2 3)])

13:31 clojurebot: (1 2 3 1 2 ...)

13:31 noprompt: dnolen_: for our particular problem speed is not necessary.

13:32 dnolen_: basically we need to add a marker protocol.

13:32 dnolen_: noprompt: definitely many cases where speed is not an issue - just saying I don't seeing it happening unless that is addressed

13:33 noprompt: dnolen_: how much effort does it require to implement it for our purposes?

13:33 dnolen_: noprompt: way beyond my understanding of the Clojure compiler

13:33 noprompt: lol

13:33 dnolen_: any other clever ideas then? :P

13:34 i guess we could just model the problem differently in clojure

13:34 dnolen_: yeah I would just do it differently

13:35 EvanR: i seem to be putting (into [], and (into #{} in a lot of places when i use map

13:35 noprompt: seems like the best way to go.

13:35 * EvanR dreams up a map which had the right types to the begin with

13:35 noprompt: dnolen_: btw sorry for lagging on finishing up that patch. been a bit busy w/ work and family.

13:35 dnolen_: no worries

13:36 clgv: EvanR: you can replace (into [] (map ...)) by (mapv ...)

13:36 EvanR: ah

13:36 noprompt: dnolen_: i did want to ask however, apply in clojurescript can be a bit annoying on the error message front if it ever ends up with nil instead of a function.

13:37 dnolen_: could we not check and fail with a better error than the maxLangArity whatever?

13:37 some folks have lost a bit of time over it. :/

13:37 dnolen_: I guess so, but I don't see how this isn't immediately obvious via source maps

13:37 noprompt: cause they didn't understand the message

13:38 dnolen_: and they didn't turn on debugging?

13:38 Break on uncaught exceptions - is useful

13:38 noprompt: i'm not sure. i'm familiar with the message so it was easy for me to tell them what the problem was.

13:39 dnolen_: I think it's better to get people to immediately lean on the debugger than to any checks here

13:39 what's the point of all that source map work if people don't use it

13:39 noprompt: yep.

13:39 devn: point, dnolen.

13:39 EvanR: ,(flatten [1 2 3] [3])

13:39 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/flatten>

13:39 devn: game, set, match.

13:40 noprompt: oh man, the weirdest error message i've seen so far in clojure is the EOF errors when you accidentally doo #foo and not foo# in a macro.

13:42 ,(defmacro lol [x]

13:42 `(let [#foo "b"]

13:42 (str ~x foo#)))

13:42 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

13:42 noprompt: :(

13:42 devn: you fail at IRC

13:43 noprompt: ,(defmacro lol [x] `(let [#foo "b"] (str ~x foo#)))

13:43 clojurebot: #<RuntimeException java.lang.RuntimeException: No reader function for tag foo>

13:43 justin_smith: that's perfectly reasonable - #foo should be a reader function

13:43 noprompt: 1. Caused by java.lang.RuntimeException Unmatched delimiter: )

13:43 justin_smith: &(defmacro lol [x] `(let [#foo "b"] (str ~x foo#)))

13:43 lazybot: java.lang.RuntimeException: No reader function for tag foo

13:43 noprompt: 2. Unhandled clojure.lang.LispReader$ReaderException java.lang.RuntimeException: Unmatched delimiter: ) Util.java: 221

13:44 justin_smith: noprompt: weird, both of the bots give the right error here

13:44 noprompt: justin_smith: nah, try and evaluate that in a real repl

13:44 justin_smith: RuntimeException No reader function for tag foo clojure.lang.LispReader$CtorReader.readTagged (LispReader.java:1180)

13:45 devn: ,*clojure-version*

13:45 clojurebot: {:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}

13:45 atyz: Is anyone here using docker/fig for their development environement?

13:45 devn: &*clojure-version*

13:45 lazybot: ⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}

13:45 noprompt: ,(let [x 1] `(let [#foo "b"] (str ~x foo#)))

13:45 clojurebot: #<RuntimeException java.lang.RuntimeException: No reader function for tag foo>

13:45 devn: weird

13:45 noprompt: nah clojurebot is just wrong in this case

13:45 that's not the correct error.

13:46 justin_smith: what?

13:46 clojurebot: what is a better one i think: https://github.com/michaelklishin/neocons

13:46 EvanR: "correct error"

13:46 noprompt: or at least not the one i see in 1.6.1

13:46 justin_smith: noprompt: that's the correct error

13:46 EvanR: how many errors can a correct error correct

13:46 if a correct error could correct errors

13:47 justin_smith: noprompt: I get the no reader function for tag foo in 1.6.0 as well

13:47 noprompt: i get it if i try to use read-string

13:47 which makes since

13:47 *sense

13:48 justin_smith: noprompt: why should reading from the repl vs. reading from a string change the error that you get when reading?

13:53 noprompt: justin_smith: did you copy that let expr up there in to a real repl and run it?

13:54 i don't have anything to gain by making stuff up. devn is sitting here w/ me and seeing the same error that i pasted.

13:56 devn: I get the same thing locally: RuntimeException with Unmatched delimiter: )

13:56 If I read-string it, I get the no reader fn for tag foo

14:06 justin_smith: noprompt: I pasted the result of doing it in a real repl, yes

14:06 I did not make anything up

14:07 yeah, that's weird

14:11 amalloy: devn, noprompt: what clojure version, and what is the value of *data-readers*? i can't think of a data reader that would cause that behavior (clojurebot's is the only one that makes sense), but it would help narrow down the issue

14:11 llasram: And what REPL client

14:11 amalloy: oh yes, that's quite likely to be important too

14:12 justin_smith: oh yeah, a repl client or middleware could effect this, right?

14:12 technomancy: middleware can do anything

14:12 that's what's so scary about it

14:12 amalloy: technomancy: why haven't we harnessed this awesome power?

14:13 let's cure cancer, feed the poor, all with middleware!

14:13 technomancy: amalloy: with great power comes great responsibility

14:13 dbasch: technomancy: nah, that’s the guilt-tripping attempt of those who do not have the power :P

14:14 justin_smith: reminds me of a certain kind of theology - all the power in the world, and what it really wants to do is give you the wrong error message when you do a typo in a macro

14:16 or even Q in Star Trek

14:16 technomancy: my favourite idea for middleware would be to prank an nrepl client that can display pictures by rendering the stack trace as an image and introducing a ton of compression artifacts

14:16 it really bums me out that the cider content-type work fizzled out

14:18 noprompt: amalloy: just cider.

14:18 justin_smith: technomancy: I'd just settle for cider working as documented at this point. Maybe my emacs is fubared, I don't even know.

14:18 technomancy: justin_smith: come on; priorities, man

14:19 justin_smith: heh

14:19 noprompt: amalloy: clojure version is 1.6.1

14:20 justin_smith: technomancy: for example, I have the cider middleware in my profiles.clj, it shows up in my deps tree and I can successfully access the namespaces that it defines, but cider gives me the same "you have the wrong middleware" popup message each time I connect.

14:20 s/popup/splash

14:20 technomancy: justin_smith: the hilarious part of that is how this used to happen all the time in slime

14:20 justin_smith: right, at this point I miss slime

14:20 technomancy: and it was one of the big reasons to ditch slime and create nrepl.el

14:20 justin_smith: the eternal cycle of features and breakage

14:21 technomancy: yeah at this point we're just waiting for the frost giants to show up

14:21 kenrestivo: is it just me or are simple case statements or core.match much easier to read and reason about than multimethod dispatch?

14:21 bbloom: kenrestivo: surely that depends on the problem at hand

14:22 dysfun: some problems suggest some approaches more than others

14:22 amalloy: PS guys 2010 slime still works great

14:22 justin_smith: technomancy: M-x fenris

14:22 kenrestivo: yep, i think it's an overhead thing. multimethods with functions of 2 lines each, the overhead is so noisy, it's confusing. if i had huge functions then maybe a core.match or case would be too unweildy and fragile

14:23 dysfun: quite a lot of my functions are simple ifs or condps

14:23 llasram: kenrestivo: I'll just say straight up "yes," which is why I try to only use multimethods where the set of dispatch values is not known exhaustively to the interface

14:24 kenrestivo: good rule of thumb, thanks

14:24 dysfun: but protocols can do that too

14:24 well, to some degree

14:24 again, depends on the individual case

14:25 llasram: dysfun: Sure, by "multimethods" there I meant "multimethod or protocol; whichever is most appropriate to the particular problem requiring open dispatch"

14:25 justin_smith: dysfun: to me multimethod and protocols are both about allowing external extension, with a flexibility+reloadability vs. performance tradeoff

14:25 dysfun: and yet i find myself writing protocols to tie things up quite commonly even where i've only got one case, because they seem like a convenient way of organising things

14:26 llasram: doooooom

14:26 TimMc: Did you hear something?

14:27 bbloom: dysfun: eh gads, insert YAGNI or some other acronym or design principal here

14:27 technomancy: justin_smith: have you tried falling back to an earlier cider?

14:27 llasram: I was just tolling the doom of functional style by the death of a thousand objects

14:27 technomancy: I've had good luck with 0.6

14:28 justin_smith: technomancy: yeah, I think there is something in an elc file or I don't know what

14:28 dysfun: bbloom: again, depends on what you're trying to do. there's more than one way to build software and all that

14:28 justin_smith: technomancy: OK, I will check 0.6 out next time I feel like shaving a yak, thanks

14:28 technomancy: justin_smith: mv ~/.emacs.d/elpa/cider* ~ then M-x package-install from marmalade

14:28 bbloom: dysfun: by "only one case" you mean 1 object implementing the protocol and 1 method in the protocol? seems like a total waste, when a function would do

14:28 technomancy: should do the trick

14:29 if not you can always move it back

14:29 justin_smith: technomancy: I moved the whole elpa dir last time :P

14:29 dysfun: bbloom: no, multiple methods in the protocol

14:29 TimMc: version your shit

14:29 dbasch: (inc 0.6)

14:29 lazybot: ⇒ 1

14:29 bbloom: dysfun: *shrug* ok

14:29 amalloy: dbasch: math is broken

14:29 technomancy: dbasch: lol

14:29 TimMc: (inc 0)

14:29 lazybot: ⇒ 1

14:29 TimMc: phew

14:29 llasram: (inc 0)

14:29 bbloom: (inc 0)

14:29 lazybot: ⇒ 2

14:29 ⇒ 3

14:30 bbloom: :-D

14:30 llasram: Uh oh

14:30 TimMc: noooo

14:30 justin_smith: (inc 42)

14:30 lazybot: ⇒ 8

14:30 dbasch: I saw a black sheep => all sheep are black

14:30 nathan7: uh oh, we broke the universe

14:30 dysfun: :D

14:30 technomancy: I won't tell ify ou ddon't

14:30 amalloy: dbasch: well, being more careful is too tiring: i saw a black sheep => at least one sheep is black on at least one side

14:30 nathan7: don't you understand the graveness of our impending doom? :(

14:31 amalloy: is graveness a word? seems like it would be squished out by all the gravity

14:31 dbasch: this universe is an alpha release anyway, it’s supposed to crash or fizzle out

14:31 justin_smith: nathan7: all we need is for 36 people to clap their hands, and tinkerbell will live

14:32 dbasch: amalloy: that assumes that sheep are immutable. Maybe it’s black on one side no more.

14:32 TimMc: Spoiler: Tinkerbell kills Wendy

14:33 dbasch: we know that yaks are mutable

14:33 dysfun: dbasch: a friend accused me of genetically engineering a bigger yak the other day to give me more to tackle

14:33 dbasch: dysfun: you think we’ll need a bigger yak?

14:34 dysfun: you never *need* a bigger yak

14:34 noprompt: isn't that part of joke regarding a mathematician and some other non-mathematician folks?

14:34 dysfun: i can't speak for you, but i'm permanently waist-deep in yak hair

14:34 noprompt: something about being on a train in scotland.

14:35 dbasch: noprompt: it’s even on wikipedia http://en.wikipedia.org/wiki/Mathematical_joke

14:35 noprompt: there is at least one sheep in scotland with one black side.

14:35 justin_smith: noprompt: my favorite is the one about the topologist in Africa, who climbs into a cage and declares that he has captured the lion.

14:35 noprompt: haven't read that one.

14:36 dbasch: the mathematician actually contemplates the possibility of mutation

14:36 noprompt: but just the gist of it made me laugh.

14:37 justin_smith: noprompt: not what I had in mind, but amusing - http://komplexify.com/math/humor_pure/HuntingLions4.html

14:37 oh, this one http://komplexify.com/math/humor_pure/HuntingLions.html

14:39 or not...

14:39 I had no idea this was a whole genre

14:41 http://www.math.wichita.edu/~pparker/augtat/jokes1.htm

14:43 bbloom: since clojure has hijacked the word "atom"... have we agreed upon a word to use for things that are not "composites"?

14:43 technomancy: bbloom: joc uses "scalars"

14:43 bbloom: joc?

14:44 justin_smith: implementation wise, couldn't we say anything other than a primitive is composite?

14:44 technomancy: bbloom: joy of clojure

14:44 bbloom: justin_smith: strings are not primitive... but are they composite?

14:45 justin_smith: well, they implement CharSequence

14:45 bbloom: technomancy: seems unfortunate to steal another word, but i the word "vector" is already stollen :-P

14:46 but i guess i'll do with that

14:46 s/do/go

14:46 thanks

14:47 justin_smith: bbloom: I would say the fact I can map on a string makes it effectively composite

14:48 amalloy: justin_smith: you can map over nil, too

14:49 justin_smith: hmm

14:49 bbloom: justin_smith: surely (seq 2) should return (0 1)

14:50 ie a bit string in little endian order

14:50 does that make numbers composites?

14:50 amalloy: bbloom: hah, i thought you were proposing (seq 2) be the same as (range 2)

14:50 bbloom: amalloy: TDD strikes again :-P

14:51 amalloy: (inc bbloom)

14:51 lazybot: ⇒ 48

14:51 bbloom: i'm kinda not kidding about (seq Number) tho :-P

14:51 i've wanted that, heh

14:51 llasram: Ruby: [0, 1, 2].collect { |x| 5[x] } ;;=> [1, 0, 1]

14:52 amalloy: bbloom: i'm quite certain that would produce errors far outweighing the convenience it adds

14:53 bbloom: amalloy: *sigh* you're probably right

14:53 amalloy: bbloom: you're allowed to want it anyway, though

14:54 justin_smith: gigo, after all

14:54 bbloom: amalloy: more than that, i want "modular type classes"

14:54 amalloy: modular how?

14:54 bbloom: ie the ability to scope the availability of a protocol to a particular lexical context

14:54 justin_smith: first class protocols?

14:55 bbloom: "for this namespace, numbers are colls of bits"

14:55 amalloy: http://www.mpi-sws.org/~dreyer/papers/mtc/main-long.pdf

14:56 little odd that paper doesn't mention scala though

14:56 dbasch: that’s like redefining operators to do unexpected things

14:56 amalloy: bbloom: so you mean scoping particular implementations of a protocol, rather than the entire protocol itself? if the whole protocol is limited in lexical scope, that means it's not open at all: you know at compile time all the instances, and could hard-code everything just as easily

14:56 justin_smith: bbloom: oh, so the other half - first class / scoped implementation of protocols

14:56 dbasch: the kind of things programmer do because they (we) can

14:56 bbloom: amalloy: well you know i've wanted modules :-)

14:57 amalloy: man, i don't keep track of the crazy things wanted by everyone in #clojure

14:57 bbloom: amalloy: protocols are a dynamic mechanism for both open dispatch and dependency injection

14:57 amalloy: i just remember technomancy doesn't like the MIT license, and derive everything else from that

14:57 justin_smith: $learn bblom wants modular type classes

14:57 lazybot: My memory is more powerful than M-x butterfly. I won't forget it.

14:57 bbloom: type classes are a static mechanism for open dispatch, but not really for dependency injection ... you need an extenistential for that

14:58 technomancy: it's fine for personal projects, just crappy for work things

14:58 bbloom: who is bblom? :-P

14:58 justin_smith: $rmtopic bblom

14:58 lazybot: Topic: "bblom" doesn't exist!

14:58 justin_smith: $learn bbloom wants modular type classes

14:58 lazybot: My memory is more powerful than M-x butterfly. I won't forget it.

14:59 amalloy: bbloom: i recently printed something with kerning so bad that my last name appeared to be "Malby"

14:59 you should be happy with bblom, or even bblorn

14:59 Baluse: http://raw.pro-chan.com/Raw/t/674_1382207920 watch

14:59 bbloom: i used to sign my full name, then just BBloom, then just Bloom, then just BL-squiggle. now it's basically just a stylized B

14:59 justin_smith: with bad enough kerning, it could become bloloorn

15:00 amalloy: justin_smith: how does the first B split apart but not the second? i would like to meet mister lololoom

15:01 bbloom: MWAHHAHAHA sewing

15:01 dbasch: BB Loom sounds like an apparel brand to me

15:01 justin_smith: hah

15:01 Baluse: http://raw.pro-chan.com/Raw/t/674_1382207920

15:01 bnan

15:01 ban

15:01 bbloom: BB Looms are super comfortable. I should know, we've been making them with only the highest quality fabrics, since 1949

15:02 verma: the hell was that

15:02 justin_smith: some gore

15:03 verma: I mean Baluse pasted those links and then requested ban?

15:03 justin_smith: "ban me, I dare you!"

15:03 mearnsh: bnan

15:04 TimMc: bnana

15:04 verma: lol

15:04 dbasch: pro tip: in chrome you can set flash to “click to play”, save memory and avoid being exposed to unwanted content

15:04 mearnsh: nodeso is PMing spam...

15:08 technomancy: sometimes I wonder if it'd save time to just not deop

15:08 =\

15:08 justin_smith: technomancy: if only you had some tool that would acquire ops, do the thing, and give them up again

15:11 technomancy: fascinating

15:13 nathan7: dbasch: I just have flash blocked

15:13 dbasch: ah, yes, that's the click-to-play, nvm

15:14 bbloom: technomancy: yeah, can't you just create a command alias that enables / bans / disables ?

15:17 justin_smith: bbloom: I bet he could make a keyboard with a dedicated "ban somebody" button

15:17 bbloom: lol

15:19 gfredericks: when I do C-c C-d w/ cider, a yellow dialog is displayed with the docstring; how do I scroll up and down in that window?

15:21 shem: AI bot that bans too imperative channel members?

15:22 justin_smith: gfredericks: there are commands scroll-other-window and scroll-other-window-down

15:22 C-M-v, C-M-S-v

15:23 gfredericks: I cannot guarantee they work in your situation, C-c C-d is totally broken in my cider

15:28 gfredericks: hmm. doesn't work immediately but you've pointed me somewhere; thanks

15:29 justin_smith: gfredericks: if you don't use it yet, M-x apropos is pretty cool

15:35 cfleming: justin_smith: Does apropos search docstrings as well, or just function/var names?

15:35 justin_smith: cfleming: iirc doc strings, checking that now

15:36 cfleming: (apropos "ARG") returned enough to tell me "doc strings too"

15:36 it's a regex search, as well

15:37 cfleming: justin_smith: Interesting, thanks.

15:37 justin_smith: keeping up with the joneses ?

15:37 cfleming: justin_smith: Yeah, I saw that - nice. Thought I'd be interested to know if that's ever actually that useful.

15:37 Haha, a mix of that, general interest, and planning the competition :-)

15:38 justin_smith: cfleming: yeah, I use it when I know a few keywords to look for, but maybe not the proper command name

15:39 cfleming: like I used (apropos "scroll.*other") to find the function that may help gfredericks with scrolling the other window

15:40 cfleming: justin_smith: I see. IntelliJ generally does partial string matching which works pretty well for that. So you'd search for "scroll other" and it would match.

15:40 There's no equivalent to apropos's "match two words" thing though.

15:40 justin_smith: cool, yeah, similar concept - with doc strings?

15:41 cfleming: Well, I'd have to add that. I'll start with just var names since they're already indexed.

15:41 justin_smith: or help contents, or whatever the equivalent is I guess

15:41 cfleming: You can already navigate to any symbol by name, but showing the doc would be good.

15:42 justin_smith: cfleming: wait, are we talking about searching for code properties or editor commands now?

15:42 cfleming: Actually, I just realised you can already see the doc or the implementation in that popup - cool.

15:42 justin_smith: Oh right, I'm talking about code search.

15:42 IntelliJ already allows you to search for editor commands.

15:43 Sorry, wasn't thinking straight.

15:43 justin_smith: cfleming: it's overloaded, because he found the issue while searching for info about a symbol, and the potential solution was found by searching for info about a command, and both are implemented by "apropos" in two different languages

15:44 cfleming: So apropos returns both?

15:44 justin_smith: cfleming: clojure.repl/apropos vs the elisp function arpopos

15:44 both are lisps with similar influences

15:44 cfleming: justin_smith: Ah, I see.

15:44 zerokarmaleft: that guy got banned for the same crap in #haskell, guess he's making the rounds

15:52 arrdem: who are we not banning today?

15:53 justin_smith: alternate idea for technomancy: a usb enabled hammer, activated by pounding a solid surface, that bans the username under the cursor.

15:56 arrdem: naw come on technomancy totally needs an Atreus key for banning

15:57 dbasch: I would buy a keyboard that had “coffee” and “pizza” keys

15:58 justin_smith: arrdem: when your user interface is a physical hammer, every problem looks like a user you can ban

16:00 arrdem: justin_smith: technomancy is an amazingly gentle dictator, don't go giving him ideas

16:00 amalloy: fwiw lazybot has an ops plugin

16:00 arrdem: amalloy: we totally talked about an ops bot before and decided it'd never happen

16:00 amalloy: yeah, i don't really expect anyone to give lazybot ops

16:01 they won't even give 'em to me

16:01 justin_smith: amalloy: yeah, the ops plugin was kind of broken but I fixed it with my patch (it was taking the first arg, so if you sent "+b butthead" only "+b" would get run)

16:01 TimMc: lazybot: Should you be given ops??

16:01 lazybot: TimMc: Definitely not.

16:02 arrdem: TimMc: I c u cheating

16:02 lazybot: do you deserve ops???

16:02 lazybot: arrdem: Yes, 100% for sure.

16:02 llasram: lazybot: Is that an honest answer???

16:02 lazybot: llasram: Yes, 100% for sure.

16:02 llasram: Well, there we go

16:02 TimMc: lazybot doesn't want power, so it is a good candidate for dictator.

16:02 arrdem: clearly we should op the bot

16:02 justin_smith: $will the fun ever stop?

16:02 arrdem: because it said so

16:02 lazybot: justin_smith: Yes.

16:02 justin_smith: :(

16:02 llasram: hah

16:02 arrdem: T_T

16:02 llasram: existentialbot

16:02 amalloy: justin_smith: i mean, you're not supposed to put that +b in there, right? isn't that just a user error?

16:02 TimMc: Usable energy is finite.

16:03 arrdem: lazybot: can the ammount of entropy in the universe be significantly decreased?

16:03 dbasch: but the alternative would be for fun to slow down to an infinitesimal trickle, which is worse than stopping

16:03 justin_smith: amalloy: you send lazybot /ban butthead, lazybot generates a mode command, and sends "mode +b", cutting off the "butthead" part

16:03 @ban of course, but yeah

16:03 amalloy: huh. well, if you say so

16:04 EvanR: so this api wants a quoted vector of symbols and vectors and shit, is it possible to programmatically compute this quoted structure? because right now i only know how to quote the fully expanded literal representation, typed out

16:04 technomancy: bots with ops... I've been following SwiftOnSecurity with her doomsday machine-apocalypse warnings too much for me to feel comfortable with that

16:04 Glenjamin: i think the operator services can do that stuff

16:04 TimMc: dbasch: I think fun is quantized.

16:04 justin_smith: amalloy: or I could be misremembering, this could be an interaction with the newer irclj version actually

16:04 Glenjamin: you can /msg chanserv and it does something

16:04 justin_smith: amalloy: either way, I got it working before submitting the patch

16:05 dbasch: EvanR: what api is that?

16:05 EvanR: datomic

16:05 technomancy: http://imgur.com/a/1PDRJ

16:05 EvanR: ,'[1 2 3]

16:05 clojurebot: [1 2 3]

16:05 EvanR: ,'[1 2 (+ 1 2)]

16:05 clojurebot: [1 2 (+ 1 2)]

16:05 EvanR: ,(eval '[1 2 (+ 1 2)])

16:05 clojurebot: [1 2 3]

16:05 arrdem: technomancy: @swiftonsecurity is one of my fav joke accounts rn since doge_js got banned/deleted

16:06 EvanR: ,(eval '[1 ?x (+ 1 2)])

16:06 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ?x in this context, compiling:(NO_SOURCE_PATH:0:0)>

16:06 justin_smith: ,(vector 1 2 (list '+ 1 2)) ; EvanR

16:06 clojurebot: [1 2 (+ 1 2)]

16:06 technomancy: arrdem: high art

16:06 EvanR: ,[1 '?x (+ 1 2)]

16:06 clojurebot: [1 ?x 3]

16:06 technomancy: http://i.imgur.com/w1PsvYS.jpg is particularly chilling

16:07 EvanR: trying it

16:07 technomancy: you hear that lazybot?

16:08 EvanR: '[1 ?x 3] is the same as [1 '?x 3] ?

16:08 amalloy: technomancy: the internet is a weird place

16:08 EvanR: certainly

16:08 arrdem: technomancy: art yes... high I'm not so sure about

16:09 technomancy: arrdem: in particular I'm thinking of when she was like "I'm Taylor Swift, and this is my keybase.io account"

16:09 EvanR: amalloy: is there some law or experiment i can use to prove that?

16:09 justin_smith: to prove that the internet is a weird place?

16:09 EvanR: ,(first '[1 ?? 2])

16:09 clojurebot: 1

16:10 EvanR: guess thats that

16:10 ,(second '[1 ?? 2])

16:10 clojurebot: ??

16:10 amalloy: EvanR: that is what quoting does. '[a b c] is the same as ['a 'b 'c], because that is how quoting is defined. and '3 is the same as 3, because 3 evaluates to itself

16:10 justin_smith: ,(= [1 '?x 3] '[1 ?x 3] (conj [1 '?x] 3))

16:10 clojurebot: true

16:10 EvanR: ,(type '?)

16:10 clojurebot: clojure.lang.Symbol

16:11 EvanR: yok

16:11 Glenjamin: doge_js got banned?!

16:11 outrageous

16:11 justin_smith: Glenjamin: top post here http://dogejs.tumblr.com/

16:11 arrdem: justin_smith: .... I love you

16:12 EvanR: ,'(a b { [ } ] d)

16:12 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: }>

16:12 EvanR: hah

16:12 justin_smith: arrdem: any particular reason?

16:12 arrdem: justin_smith: I didn't know that tumblr existed

16:13 EvanR: ,(type '(1 2))

16:13 clojurebot: clojure.lang.PersistentList

16:18 justin_smith: EvanR: btw, if you don't need to show the result to everyone, you can send a /msg to the bot. Or run your own repl, of course.

16:19 EvanR: (str '?)

16:19 ,(str '?)

16:19 clojurebot: "?"

16:19 EvanR: ok

16:19 godd2: No, I think you confused him.

16:19 EvanR: what is unquotable?

16:19 justin_smith: EvanR: I think the more important question is what is readable

16:19 EvanR: if the form is unreadable, you can't get a quoted version

16:19 mdrogalis: Has anyone used lein-ring with Component? That plugin requires you give it the handler var name in project.clj, which is at odds with Component.

16:19 Glenjamin: it amuses me slightly that /msg to clojurebot is faster than starting a clojure repl on my own machine. even if not already on IRC

16:19 justin_smith: Glenjamin: it is quite easy to use ring without lein-ring

16:19 Glenjamin: you mean mdrogalis

16:19 justin_smith: err, oops, yeah

16:19 Glenjamin: and you can also create a ring-entry-point namespace which just calls your component (main) function and throws the ring server into a var

16:19 justin_smith: Glenjamin: clearly you need more ram, so that you always have 4 or 5 random clojure repls around

16:19 mdrogalis: justin_smith: I'm trying to generate a war file.

16:19 Glenjamin: current JVM count: 4

16:20 arrdem: Glenjamin: don't forget the JVMs that lein leaves around :P

16:20 mdrogalis: Glenjamin: There we go. thanks :)

16:20 Glenjamin: arrdem: trampoine!

16:20 poline even

16:20 justin_smith: $ ps x | grep java | wc -l => 8

16:20 arrdem: trampoline is good juju

16:20 dbasch: output of “pgrep java” : 14 lines

16:20 justin_smith: that count is after some trampolines

16:20 * arrdem zero clojure instances

16:20 Glenjamin: i'm suspicious of activity monitor though, it claims 1 JVM is using 3.1MB RAM and one is using 1012KB :s

16:21 dbasch: justin_smith: ps x|grep -c java

16:21 justin_smith: dbasch: oh, right :)

16:21 Glenjamin: unix philosophy: one thing well

16:21 mdrogalis: Glenjamin: I don't see any docs for that. Can you help me locate that?

16:21 dbasch: 50% of the pipes :)

16:22 Glenjamin: mdrogalis: dunno if there are, just define (ns myapp.ring-entry-point)

16:22 mdrogalis: Glenjamin: Ah, okay. Thanks mate.

16:23 justin_smith: bringing it all together: pgrep -c java => 8

16:23 dbasch: justin_smith: only that doesn’t work on osx

16:23 justin_smith: OK

16:23 Glenjamin: brew install proctools

16:24 whenever i do clojure stuff i keep OS X's activity monitor on all the time filtered by java, i always seem to loose JVMs by accident otherwise

16:24 i blame lighttable

16:25 dbasch: loose JVMs contribute to global warming, we should all do our part

16:25 do global variables contribue to global warming?

16:26 technomancy: dbasch: only if optimized by hotspot

16:27 justin_smith: dbasch: I think physics tells us that the more they move the higher the temperature, so immutible values help here

16:27 dbasch: or in js, of course, you can freeze them

16:28 dbasch: justin_smith: but freezing something definitely contributes to global warming

16:29 spei: Does anyone have a problem getting popups to work in the cider-repl for emacs 24.3?

16:29 popups from company-mode

16:29 dbasch: spei: which cider?

16:29 spei: 0.7

16:29 dbasch: spei: that’s one of the reasons I downgraded to 0.6

16:30 spei: so, it works in 0.6 but not 0.7? company mode seems to work in the normal .clj file buffer

16:30 justin_smith: dbasch: does 0.6 use an nrepl middleware dep on the jvm side?

16:31 technomancy: 0.6 is "cider classic"

16:31 basically just nrepl.el with a new name

16:31 justin_smith: awesome... I am getting more tempted to switch

16:31 dbasch: it works with 0.6 for me, in 0.7 I was experiencing random freezes

16:31 * arrdem on 0.8.0-SNAPSHOT with no issues

16:33 spei: where do I get cider 0.8.0-SNAPSHOT?

16:33 zerokarmaleft: I'm on 0.8.0-SNAPSHOT too, much more stable, though in certain cases company-mode still gets hung up

16:34 but at least that's interruptible

16:35 spei: is that the cider nrepl middleware part for leiningen?

16:37 justin_smith: spei: no, but you can pull it in via ~/.lein/profiles.clj

16:37 perplexa: some offtopic, but damn boy, the new pink floyd album is nice :)

16:38 spei: justin_smith: that won't align to the emacs CIDER version, right?

16:38 justin_smith: spei: there is no way to do that automatically

16:38 spei: you have to make sure you ask for the right version for your current emacs cider version

16:39 technomancy: there is

16:39 justin_smith: oh?

16:39 technomancy: cider just doesn't do it

16:39 (setq cider-lein-command "lein update-in :repl-options:middleware assoc whetevs -- repl")

16:41 I guess it's a different defvar now but whatever

16:44 you should only have to specify nrepl middleware if you're launching your server by hand; this is dumb.

16:45 spei: is there a suggested way to launch a repl on a remote server?

16:46 technomancy: spei: check out the tools.nrepl readme; it covers that

16:47 spei: thanks

17:06 technomancy: bahaha "I'm reluctant to add increasingly special purpose builtin functions." <- re: map and filter in google go

17:06 https://groups.google.com/forum/?_escaped_fragment_=topic/golang-nuts/RKymTuSCHS0#!topic/golang-nuts/RKymTuSCHS0

17:06 "Where will this end? next you'll be saying you want reduce!"

17:07 tbaldridge: technomancy: that's why you don't, you just implement .reduce and then let everyone else built map, filter, etc ;-)

17:08 technomancy: considering google go's popularity among python refugees, being freaked out about reduce would almost make sense.

17:11 the best part is how some of the people in the thread have "everything should be as simple as possible, but not simpler" in their signature

17:13 oh man, it just keeps getting better

17:14 «"bar = map(foo, f)" isn't actually any shorter than a for loop, because you have to write f somewhere, which you've conveniently omitted.»

17:14 dbasch: that’s why we all use one-instruction-set computers. Simple is always better, because Einstein said so.

17:14 technomancy: http://p.hagelb.org/eyebrow.gif

17:15 dbasch: brb, rewinding my turing tape

17:16 hiredman: I would prefer to have someway to write a generic map datatype without relying on interface {} over map/filter/reduce

17:17 technomancy: do they talk about making the functions typesafe? I don't think you can in go

17:17 Glenjamin: basically go rejects re-use

17:17 or at least, the people who make the language seem to

17:18 also how did you get this google groups view? it's much better than the usual GWT mess

17:20 technomancy: hiredman: I get the feeling they have gone through pavlovian training which keeps them from mentioning the topic of generics outright, and thus they are forced to dance around the actual issues at play.

17:20 Glenjamin: noscript!

17:21 Glenjamin: bah, it's only really mobile where i find it's a problem :(

17:21 technomancy: Glenjamin: it really needs a simple <hr> between messages, but other than that it's great

17:21 Glenjamin: yeah, userStyle.css to add a bottom border on those table cells would be neat

17:21 hiredman: technomancy: sounds about right

17:21 technomancy: hm. well if you end up writing one, let me know =)

17:22 zerokarmaleft: "You'd need two versions of map, one that mutated and one that copied." aw man, this is just full of depressing

17:22 amalloy: technomancy: <hr>? ITYM <hr /> #justxhtmlthings

17:22 hiredman: it does say "golang-nuts" in the url

17:23 TimMc: qft

17:23 technomancy: amalloy: I actually have to stop myself from being xhtml-pedantic still even after all these years

17:24 TimMc: technomancy: This interface has the same problem LJ has where it puts the attribution block vertically centered next to the post.

17:24 Or had, I guess. That was an interface or two back.

17:24 amalloy: technomancy: stopping yourself from being pedantic doesn't sound like a fun way to live

17:25 Glenjamin: xhtml-pedanticity is great

17:25 XML parsers are like a million times easier than tag-soup SGML

17:25 technomancy: amalloy: I'm trying to kick the habit, man

17:25 amalloy: "pedanticity" - a word you threw in for the english pedants?

17:26 TimMc: amalloy: Language is generative, deal.

17:26 (is what I would say to anyone who objected)

17:26 amalloy: TimMc: well like...while that's true and i wish it weren't, i don't think that is enough to conclude that any sequence of letters someone mashes together once is a new word

17:26 TimMc: that's total lavfiwkegw

17:27 technomancy: the word is cromulent.

17:28 heh; wiktionary cites Real World Haskell for "cromulent"

17:28 amalloy: whaaaaat

17:28 technomancy: https://en.wiktionary.org/wiki/cromulent

17:29 amalloy: man, that reminds me. a while ago i talked to someone who believed that the tv show Lost was the originator of "you make your own luck"

17:29 dbasch: technomancy: I don’t think wikitionary is a cromulent source of information

17:29 technomancy: dbasch: fine lemme check the urban dictionary

17:30 after all https://twitter.com/freebsdgirl/status/530462940823310337/photo/1

17:31 turbofail: fantabular

17:32 Glenjamin: technomancy: https://userstyles.org/styles/107024/google-groups-noscript-separate-posts

17:33 technomancy: Glenjamin: top-notch

17:33 thanks

17:33 Glenjamin: oh right, pedantry

17:34 meh, pedanticity sounds better imo

17:35 aperiodic: Heh, I agglutinate words into longer versions of existing words all the time.

17:35 Glenjamin: oh god, i've stopped adjusting the CSS and started reading this thread

17:35 dbasch: aperiodic: it sounds like you’re in a real quyzbuk

17:35 Glenjamin: this is horrifying

17:36 and people keep flocking to Go

17:36 hfaafb: anyone here know how to make a lot of money with clojure?

17:36 aperiodic: dbasch: I'll probably be able to hoistificate myself out of it

17:36 dbasch: aperiodic: https://www.youtube.com/watch?v=pHw4_oPJ6s8 :)

17:36 amalloy: hfaafb: (nth 1000 (iterate better product))

17:36 (repeatedly cash-in)

17:37 Glenjamin: " functions can span multiple line's / pages"

17:37 dbasch: (reduce costs)

17:37 Glenjamin: whaaat

17:37 it gets worse

17:37 "and have a syntax that allow that body of code of that size to be legible"

17:38 dbasch: hfaafb: it depends on how you define “a lot” of course, but clojure jobs pay reasonably well

17:38 hfaafb: ugh but i hate workin for the man

17:38 i applied to circleCI but i wasn't smart enough v0v

17:39 s/applied/interviewed with

17:40 dbasch: hfaafb: I don’t know, create a clojure-based cryptocurrency? HickeyCoin?

17:40 Glenjamin: i guess you get more bang-per-buck from clojure than, say, Java - so there's bound to be less jobs D:

17:40 dbasch: after all he is Rich already

17:40 * dbasch goes to a corner in shame

17:40 turbofail: lol

17:40 TimMc: juxtcoin

17:40 hfaafb: i enjoyed it

17:41 TimMc: ~juxt

17:41 clojurebot: juxt is usually the right answer

17:42 mysamdog: What do you guys think about intellij + cursive?

17:42 I usually use vim, but I'm installing intellij now to try it out

17:42 amalloy: i hear cursive is fine. but if you like vim, you don't have to switch

17:42 TimMc: hfaafb: (println "This is a stick-up")

17:43 mysamdog: Yeah, I do love vim, but tbh having multiple files open is a bit difficult

17:43 dbasch: if you believe clojure gives companies a competitive edge, you could invest in a basket of companies that are primarily clojure shops

17:43 TimMc: There are some additional side-effects, though.

17:43 amalloy: hfaafb: (-> "This is a sideways stick")

17:43 mysamdog: And I tried sublime, but lack of a proper REPL killed it for me

17:45 dbasch: hfaafb: I have an idea, you could create a better development environment for Clojure developers and sell it. I have the perfect name for you: BrightDesk

17:46 cfleming: mysamdog: I like Cursive, but then I develop it, so I'm biased. Let me know if you have questions though.

17:46 hfaafb: I'll probably abandon it and start an even more nebulous project

17:47 amalloy: dbasch: LuminiferousCounter

17:48 dbasch: amalloy: that sounds like a development environment for nuclear reactor software

17:49 amalloy: java is no good for nuclear power plants

17:49 dbasch: amalloy: Homer Simpson would use IdiotiJ

17:50 but actually the drinking bird would do all the coding

17:52 amalloy: apparently C++ is… http://www.nrc.gov/reading-rm/doc-collections/nuregs/contract/cr6463/

17:52 amalloy: dbasch: why you gotta put nuclear-reactor documents in my browser history? i don't need the NSA interested in why i'm reading that stuff

17:53 dbasch: (dec nsa)

17:53 lazybot: ⇒ -1

17:54 turbofail: they also use C++ in avionics

17:54 i'm not entirely sure which use is more terrifying

17:56 dbasch: turbofail: in a class I took decades ago the professor said that some boeing aircraft (perhaps the 777) had several computers that voted, where all but one had the same software written in ADA, and the other one was in C++

17:57 technomancy: fault-detection with multiple implementations is a thing in aerospace

17:57 it's kind of clever, modulo the C++ part

17:58 they're both clean-room implementations from the same spec

17:58 dbasch: some defense contractors had a process in which developers were not even allowed to compile their code

17:59 turbofail: huh. how would they even enforce that?

17:59 TimMc: Process.

18:00 dbasch: I don't see the point of having quorum or average where you don't have at least 3 impls.

18:01 OK, getting kind of tired of the REPL printing the 2nd-from-top (or is it root?) exception in a stack trace.

18:01 technomancy: TimMc: the 3rd is a human

18:02 as soon as a discrepancy is noticed, the problem gets surfaced to the pilot or whatever

18:02 TimMc: hrm

18:02 And a pilot is supposed to do what?

18:02 turbofail: i prefer to envision a human crammed into the nose of an airplane, furiously working an abacus

18:02 TimMc: File it in JIRA?

18:03 dbasch: turbofail: you could mandate the use of a language for which only the testers have the compiler, for example

18:03 turbofail: or need libraries that only the testers have

18:04 turbofail: so... what if you write code that doesn't compile? you'd have to wait for your testing department to come back to you and hand you a printout with your compile errors?

18:04 dbasch: turbofail: exactly

18:04 turbofail: i don't really see the benefit of this approach

18:05 dbasch: it’s software that takes 5-10 years to develop

18:05 turbofail: i can certainly see the benefit of having a testing department that has no contact with the people writing the code

18:06 dbasch: turbofail: https://groups.google.com/d/msg/comp.sys.amiga.programmer/bIvakgEKj9s/QUe_dJYuZvgJ (1992)

18:10 turbofail: i'd like to see the original study

18:11 m1dnight_: hmm, another namespace question guys :p

18:12 danielcompton: I'm wanting to write an online pretty printer. However I'm a little concerned about prettyprinting arbitrary code from the internet. What should I be looking out for/thinking about?

18:12 m1dnight_: I have a file RetryEx.clj that contains exactly this: (ns meta-clojure.stm.RetryEx (:gen-class :extends java.lang.Error))

18:12 and now I want to use it in an other file to throw as en error

18:12 Now it says (throw (new Error))

18:13 and in the source i cloned it said (throw (new meta-clojure.stm.RetryEx)) but that does not seem to compile

18:13 the file I try to throw it in is the following:

18:13 (ns meta-clojure.stm.v5-mvcc-fine-grained-barging)

18:13 any clues?

18:16 dbasch: danielcompton that’s what clojail is for

18:17 amalloy: danielcompton: if you don't *run* the code there's not much to worry about

18:17 danielcompton: amalloy: that's what I was thinking, I'm not actually running it

18:17 dbasch: I assumed it was about pretty-printing the output, my bad

18:17 amalloy: just read it with clojure.edn, and produce a string from the data structure

18:18 definitely don't read it with the clojure reader, which can do sneaky evals when you aren't expecting them

18:18 danielcompton: Although I think to pass input to fipp it needs to be a clojure data structure, so that means I'd need to first parse the inpute

18:19 amalloy: right, you need a reader. and clojure.edn is the one for you

18:22 danielcompton: amalloy: great. And I use clojure.edn, not org.edn-format.data.edn?

18:22 m1dnight_: anyone?

18:22 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

18:23 m1dnight_: I can't get it to work and it's frustrating me :p

18:23 (:use [meta-clojure.stm.RetryEx])) putting the :use in my file seems to work fine, which should imply the compiler can find it, right?

18:23 danielcompton: m1dnight_: do you want to put your stacktrace in a pastebin?

18:23 justin_smith: meta-clojure.stm.Retryx is not a valid class name

18:24 m1dnight_: because of the capitalisation?

18:24 justin_smith: so it can't be used as an arg to new

18:24 because of the -

18:24 amalloy: danielcompton: i don't really know what edn-format is all about. it looks like it is an edn writer, not reader

18:24 m1dnight_: oh

18:24 justin_smith: meta_clojure.stm.Retryx should work

18:24 also (meta_clojure.stm.Retryx.) is better than (new meta_clojure.stm.Retryx)

18:24 (but they do the same thing)

18:25 m1dnight_: https://www.refheap.com/92830

18:25 that's the stacktrace

18:25 bbloom: danielcompton: fipp is a pretty printing engine with a built in formatter for clojure data

18:25 m1dnight_: let me post a tree hold on

18:25 bbloom: danielcompton: the engine operates on a particular shape of clojure data, which you can generate yourself from any input you want

18:25 you need to create a "pretty document". see https://github.com/brandonbloom/fipp/blob/master/src/fipp/edn.clj for how that works on normal clojure data

18:25 justin_smith: m1dnight_: also, :use is for namespaces (which can have -), :import is for classes

18:25 m1dnight_: https://www.refheap.com/92831 <- the tree

18:26 danielcompton: bbloom: what do you mean "a particular shape"?

18:26 dbasch: m1dnight_: did you change the RetryEx namespace?

18:26 justin_smith: m1dnight_: there is a cool config in emacs to put the ~ files in a . directory instead of alongside your files

18:27 (setq auto-save-file-name-transforms '((".*" "~/.emacs.d/backups/" t)))

18:27 m1dnight_: yes, I changed the namespace (to (ns meta_clojure.stm.RetryEx) that is)

18:28 justin_smith: m1dnight_: the namespace name is fine

18:28 you just can't address the class that way

18:28 m1dnight_: yueah, i tried that first, doesn't work either

18:28 bbloom: danielcompton: it's a little language for describing how you want your stuff pretty printed, look at that file

18:28 m1dnight_: I also recompile the RetryEx everytime in Emacs, so that should be fine

18:28 Glenjamin: danielcompton: Maybe use the cljs reader?

18:29 danielcompton: Glenjamin: I don't think theres a cljs pprint library yet

18:29 Glenjamin: Sounds like a golden opportunity!

18:30 It would solve any security issues anyway

18:30 danielcompton: Glenjamin: theres a few places where it's being worked on https://github.com/brandonbloom/fipp/issues/7

18:30 Glenjamin: http://dev.clojure.org/jira/browse/CLJS-710

18:30 justin_smith: m1dnight_: OK, the namespace can be meta-clojure.stm.RetryEx, and you should :require that namespace, and then (:import (meta_clojure.stm RetryEx)) and then you can create an instance with (RetryEx.)

18:30 noonian: should write cljs format while your at it

18:30 danielcompton: noonian: not sure if I'm able to shave that yak at the same time

18:32 m1dnight_: hrm, still not working

18:32 justin_smith: m1dnight_: the same error?

18:32 m1dnight_: yes, classnotfount meta_clojure.stm.RetryEx, compiling /path../usingfile.clj

18:32 found*

18:33 I have put the following in usingfile.clj:

18:33 (:require [meta-clojure.stm.RetryEx])

18:33 (:import [meta_clojure.stm RetryEx])

18:33 oh, sorry for paste on multiline

18:33 justin_smith: unless there is some error in how RetryEx is defined, that should work...

18:34 in the repl can you create an instance of that class?

18:34 m1dnight_: let me try, hold on

18:34 amalloy: remember that :gen-class doesn't do anything except when AOT compiling

18:34 justin_smith: yeah, if you are only doing this inside emacs, it likely won't work

18:36 m1dnight_: okay, so lein repl, eval (ns meta-/_clojure.stm.RetryEx), eval (RetryEx.) results in illegalargument, unable to resolve classname

18:36 how can this be so hard

18:36 justin_smith: what is meta-/_clojure.stm.RetryEx

18:37 m1dnight_: i tried meta-clojure and meta_clojure

18:37 justin_smith: take out the -/

18:37 m1dnight_: that's what I meant, sorry

18:37 justin_smith: sure

18:37 mysamdog: After switching DEs and installing a 600mb package, I can confirm that intellij isn't as nice as vim

18:37 justin_smith: m1dnight_: did you load the namespace before trying that?

18:37 mysamdog: I like xfce4 over my old hlwm setup tho

18:37 m1dnight_: yes I did, I executed (ns meta-clojure.stm.RetryEx), then (RetryEx.), that failed

18:37 justin_smith: no

18:37 that's not how you load a namespace

18:38 (require 'meta-clojure.stm.RetryEx)

18:38 mysamdog: wait, I'm using cursive wrong

18:38 noonian: ,(macroexpand '(ns foo))

18:38 m1dnight_: the require returns nil, so that went fine

18:38 clojurebot: (do (clojure.core/in-ns (quote foo)) (clojure.core/with-loading-context (clojure.core/refer (quote clojure.core))) (if (.equals (quote foo) (quote clojure.core)) nil (do (clojure.core/dosync (clojure.core/commute (clojure.core/deref (var clojure.core/*loaded-libs*)) clojure.core/conj (quote foo))) nil)))

18:38 justin_smith: m1dnight_: ok - just using (ns 'foo) creates the ns, it does not look up or load any code

18:39 m1dnight_: but then trying to throw a RetryEx fails

18:39 justin_smith: also, you probably need a :reload if you already used ns

18:39 because require does nothing if the namespace already exists, unless you specify :reload

18:40 ,(require 'meta-clojure.stm.RetryEx :reload)

18:40 clojurebot: #<FileNotFoundException java.io.FileNotFoundException: Could not locate meta_clojure/stm/RetryEx__init.class or meta_clojure/stm/RetryEx.clj on classpath: >

18:40 justin_smith: err, sorry

18:40 amalloy: clojurebot: feature request: put code from every clojure project in the universe on your classpath

18:40 clojurebot: Huh?

18:40 m1dnight_: well, that doesn't work either

18:41 would it help if I showed you my repo?

18:41 justin_smith: m1dnight_: sure, if you don't mind sharing I can check it out

18:41 m1dnight_: https://github.com/m1dnight/meta-clojure

18:42 thanks for your paitence all, btw

18:42 justin_smith: m1dnight_: and remember that you need an explicit aot step for the genclass to work, I honestly forget how to combine that with running a repl

18:42 m1dnight_: patience

18:42 so adding :aot :all in my project.clj is not enough then?

18:43 justin_smith: m1dnight_: well, that's in your uberjar profile

18:43 so for that to work I think you would need to create an uberjar, and run from that

18:43 m1dnight_: is this code checked into your repo? maybe it is in a branch?

18:43 m1dnight_: oh right, btw, the file I'm trying to compile and run is v5 in src/meta-clojure/stm/

18:43 errr

18:44 justin_smith: found it in the dev branch I think

18:44 m1dnight_: right, branch dev

18:44 forgot about that :x

18:44 justin_smith: m1dnight_: this particular case of gen-class could be done much more easily with reify I think

18:47 m1dnight_: hey i think I got it working in my core.clj file

18:47 (:import (meta_clojure.stm RetryEx)) in the (ns) macro

18:47 and then just (throw (RetryEx. "message")) and that works

18:48 justin_smith: awesome

18:48 glad you got it sorted out then

18:48 m1dnight_: I think :aot :all did the trick

18:48 justin_smith: oh, added at the top level?

18:48 m1dnight_: (i got it working using lein run, though)

18:48 in core.clj justin_smith

18:48 it compiled everything and then it just worked

18:49 justin_smith: also, I noticed in one of your namespaces (ns foo (:require [foo.bar]) (:require [foo.baz])) and it's better to make that (ns foo (:require [foo.bar] [foo.baz]))

18:49 m1dnight_: awesome

18:50 mysamdog: hey cfleming: after playing around with cursive a bit, I really like it

18:51 m1dnight_: justin_smith: yeah I should fix those, but it has been of a fight, me and namespaces. Admittedly, It's because I lack understanding though, i think

18:51 justin_smith: m1dnight_: once you get it, you'll miss them in the langs that don't have them

18:52 mysamdog: Only complaint so far is that with structural editing I can't seem to insert a )

18:52 technomancy: gen-class seems like a rough place to start

18:52 justin_smith: m1dnight_: something that helped me a lot was looking at the docs for refer, alias, and other related functions that build up the namespace ops like require and use. ymmv though

18:52 m1dnight_: hah, now it's just emacs that can't work with it

18:52 oh

18:52 amalloy: mysamdog: that's on purpose

18:52 justin_smith: technomancy: yeah, and it's so appealing to new clojure programmers whose go-to for any problem is "make a class"

18:53 m1dnight_: well, I intend to get a deeper understanding of clojure the coming months, so i might as well might :p

18:53 mysamdog: I understand why it wants to handle them automatically, but this code was shitty and I didn't balence the parens when I wrote it

18:53 technomancy: you can run clojure.core/compile from any repl

18:53 justin_smith: mysamdog: in emacs?

18:53 amalloy: mysamdog: i don't know about cursive specifically, but every other paren balancer i know of has some kind of override

18:53 mysamdog: nope, vim

18:54 dbasch: mysamdog: disable it, fix it and re-enable it

18:54 mysamdog: dbasch: yep, thats what I did

18:54 But so far, I'm really impressed

18:57 justin_smith: mysamdog: there's a conversion process, and then you are hooked

18:57 mysamdog: complete with withdrawal when you lose it

18:57 amalloy: like the borg

18:57 mysamdog: Oh, I love the structural editing, I missed it when I switched from emacs to vim

18:58 I now realize why people love intellij so much

18:59 aperiodic: mysamdog: paredit.vim

19:01 mysamdog: aperiodic: got it, will be nice to have when I need to make some quick edits

19:02 amalloy: don't you vimmers have sweet navigation commands anyway? like %[ or something?

19:03 mysamdog: Yeah, they were actually really great, they just didn't really do it for me

19:03 I wanted to love it

19:07 aperiodic: paredit.vim doesn't have much in the way of navigation commands besides [[ / ]] (go to beginning or end of top-level form)

19:08 I mainly move around by searching

19:09 amalloy: aperiodic: my favorite "advanced" paredit commands in emacs are paredit-forward-up and paredit-backward-up

19:10 technomancy: what no love for convolute?

19:10 amalloy: for navigation, anyway. for editing i'm a big fan of paredit-convolute-sexp

19:10 since aperiodic was talking about navigation

19:11 technomancy: I see. carry on.

19:11 aperiodic: what does forward-up do?

19:11 amalloy: aperiodic: moves up one level of nesting (to a less nested form), and puts point at the end of it

19:12 so like, "go to the end of the current form", and if you repeat it it goes to the end of the next-outermost form

19:12 aperiodic: so if you were in the middle of a value in a let block it'd take you to the end of the bindings?

19:12 amalloy: yes

19:12 well

19:12 assuming that value was just something like a numeric literal, yes

19:13 aperiodic: what if it was a single function call?

19:13 amalloy: then you get put to the end of that function call

19:13 danielcompton: mysamdog: toggle structural editing is the command you're after

19:13 amalloy: which leaves you in position to add another thing to let-bind

19:13 danielcompton: Command+Shift+A brings up the super command bar

19:14 amalloy: really i use backward-up more often, for like "i'm in the middle of the body of a let, and i want to be in the let bindings": just hold down backward-up until i'm at the right level of nesting

19:14 mysamdog: danielcompton: thanks

19:14 Where is the best place to get a crash course on intellij?

19:14 danielcompton: Command+E is another handy one

19:15 aperiodic: but if that were in the middle of the bindings, if you invoked it twice, then you'd be at the end?

19:15 danielcompton: mysamdog: the cursive website has a pretty good one

19:15 amalloy: aperiodic: if the current state is like (let [x 1, y (+ |x 2)] ...), then pressing it twice would get you (let [x 1, y (+ x 2)]| ...), where | is point

19:16 it's not clear whether this is exactly what you were asking

19:16 postpunkjustin: Woah, that's not even on the paredit refcard I have. I'm going to have to up my game.

19:17 amalloy: postpunkjustin: i don't know if it's bound to any keys by default

19:17 aperiodic: ah, I thought the point would be one character to the left, but okay.

19:17 postpunkjustin: Ok, well I'm going to bind the hell out of it right now.

19:17 amalloy: i put forward/backward up/down on C-M-{W,E,S,D}

19:18 postpunkjustin: Cool, thanks

19:18 amalloy: the orientation of those on a square helps me remember which is which

19:18 postpunkjustin: if you are upping your game, you should bind paredit-convolute-sexp too

19:18 postpunkjustin: It sounds awesome, but what is it?

19:19 amalloy: postpunkjustin: (fn [x] (let [y 1] |(+ x y))) => |(let [y 1] (fn [x] (+ x y)))

19:19 aperiodic: postpunkjustin: are your dotfiles on github or other publicly-accessable bit store? (or anybody else that uses emacs & evil?)

19:20 postpunkjustin: amalloy: my mind is blown.

19:20 amalloy: speaking of which, if anyone has a suggestion for a good place to put convolute-sexp, i am happy to hear it. i put mine on M-<LEFT> back before i quit using the arrow keys

19:20 postpunkjustin: aperiodic: https://github.com/holguinj/evil-clojure-emacs/

19:21 amalloy: (technomancy?)

19:21 technomancy: amalloy: man

19:21 amalloy: when I find a chance to run paredit-convolute-sexp... I savour it.

19:21 I type the whole damn thing out

19:21 TimMc: Same here!

19:22 Well... I autocomplete, actually.

19:22 technomancy: then I kick off for the rest of the day, because my work here is done

19:22 amalloy: turns out clojure users don't hate useless ceremony as much as rich thinks...?

19:23 arrdem: amalloy: so when do we get the lazybot redeploy?!

19:23 amalloy: arrdem: talk to Raynes. i'm not really set up to test it anymore, and i'm not gonna redeploy without testing

19:24 arrdem: kk

19:31 MC-Escherichia: If I have a sequence of maps which form the leaves of a tree, and contain a reference to their ancestor (which belongs to it's own generation of leaves, and has a pointer to its ancestor) is there an idomatic way to list all the nodes in the tree? (it's sort of the opposite starting point of `tree-seq`)

19:32 i.e. nodes only know their parents, unlike tree-seq and zippers which assumes they know their children

19:34 amalloy: i think the only thing you can do is treat it like a walk of a graph (not a tree), and keep a set of visited nodes so you can avoid revisiting them. the seq of leaves is one additional "virtual root" which acts as your starting point

19:35 noonian: yeah, i'd write a recursive fn that traverses upwards and mapcat it over the seq of leaves

19:37 MC-Escherichia: i think amalloy's solution is more effient algorithmically but as long as someone else suggested the traverse upwards and mapcat solution I don't feel so bad starting with that

19:42 cfleming: mysamdog: You can toggle paredit in the status bar at the bottom of the window too

19:42 Where it says Structural: On

19:45 MC-Escherichia: just looked up convolute-sexp had a chance to use it today, paused to wonder what the emacs command for that move was called and awkwardly copied the inner part, slurped the outer, and removed detritus

19:47 technomancy: if you convolute a sexp that includes juxt you get a combo bonus

19:48 TEttinger: (inc technomancy)

19:48 lazybot: ⇒ 155

19:48 TEttinger: (inc juxt)

19:48 lazybot: ⇒ 16

20:33 akurilin: Question: were there any recent lein issues with uberjar? Seems as of the latest version when I uberjar my ring app I get "Error: Could not find or load main class classroom.handler.main"

20:34 This only happens in uberjar mode, works just fine in dev

20:34 TimMc: lein did hcnage some stuff around main class specification ~recently

20:38 akurilin: TimMc: yeah it looks like you might need a :main now in project.clj

20:38 Not sure where my main is since I'm using lein-ring

20:54 cfleming: How do I need to read a form in for it to have the metadata added by the reader?

20:54 arrdem: cfleming: example form?

20:54 cfleming: the reader should always add metadata...

20:55 cfleming: ,(binding [*print-meta* true] (pr-str (read-string "(+ (+ 1 2) (+ 3 4))")))

20:55 clojurebot: "(+ (+ 1 2) (+ 3 4))"

20:55 cfleming: Is there a reason there's no line info on those forms?

20:55 Am I misunderstanding how this works?

20:56 danielcompton: whats the name of the ring middleware that catches exceptions and displays them nicely?

20:56 I don't think it was a core ring one

20:57 cfleming: danielcompton: There was one discussed on the ML a while back, one sec

20:58 danielcompton: cfleming: I think it's prone

20:58 cfleming: danielcompton: That's the one.

20:58 danielcompton: I've never used it but it looks nice.

20:59 danielcompton: cfleming: sure does

20:59 cfleming: when are you going to start charging for cursive?

21:00 cfleming: danielcompton: Two months, maybe? I have a list for 1.0, it's getting shorter and shorter.

21:00 danielcompton: cfleming: sweet

21:00 cfleming: you planning on skipping Christmas?

21:01 cfleming: danielcompton: Skipping in what sense?

21:01 danielcompton: Working on Cursive instead?

21:01 danielcompton: a release in two months will be just after Christmas

21:01 cfleming: danielcompton: Ok, maybe 2.5 months :)

21:02 arrdem: I must be crazy, I thought there was a :column field in the metadata, and I'd assumed that would be added to forms by read-string.

21:02 arrdem: Neither appear to be true.

21:05 arrdem: cfleming: so :line, :file and :column will be added by I think it's LineNumberingReader... but yeah read-string doesn't set that stuff AFAIK

21:08 cfleming: ,(binding [*print-meta* true] (pr-str (read (clojure.lang.LineNumberingPushbackReader. (java.io.StringReader. "(+ (+ 1 2) (+ 3 4))")))))

21:08 clojurebot: "^{:line 1, :column 1} (+ ^{:line 1, :column 4} (+ 1 2) ^{:line 1, :column 12} (+ 3 4))"

21:08 cfleming: arrdem: There you go, right.

21:33 danielcompton: cfleming: thread form is nice

21:33 cfleming: it even does the right thing when you've already got a threaded form there (adding to it, rather than making a new thread)

21:33 cfleming: danielcompton: Thanks! Yeah, the only problem with it is that unthread messes up the whitespace sometimes.

21:34 danielcompton: But mostly it works well. I'm going to have a release dedicated to fixing a bunch of niggles with paredit post-conj.

21:35 danielcompton: cfleming: wrapping quotes would be a nice one to fix

21:36 cfleming: danielcompton: What's the problem with wrapping quotes?

21:38 danielcompton: cfleming: can't find it in the tracker atm but a paredit wrap round doesn't work with quotes

21:39 "|" sym -> "sym|"

21:39 cfleming: it doesn't do anything in that case

21:39 cfleming: danielcompton: Oh, you mean slurp/barf?

21:39 danielcompton: ah yes, not wrap

21:39 cfleming: danielcompton: Wrapping directly does work (Cmd-Shift-')

21:40 danielcompton: Yeah, that's up near the top of the list.

21:41 danielcompton: cfleming: choice. Gotta head off, see you later.

21:57 mlb-: has anyone here experience with ElasticSearch?

21:58 bhenry: mlb-: what do you need to know?

21:58 mlb-: At $DAYJOB, which is very enterprise, I want our product to use it for log data visualization. However, customers won't allow "calling home" to our ElasticSearch servers. Therefore, I want to embed ElasticSearch with the product.

22:00 bhenry: you can do that i think. in all their beginner tutorials you use a standalone java process.

22:00 mlb-: The ideal being, the product can expose REST APIs for graphs that merely proxy requests to Kibana3, and when I need to download logs for support cases, I simply have them supply me with a ElasticSearch DB dump.

22:02 bhenry: alright, I'll play with it. Thanks =]

22:35 dogonthehorizon: Greetings folks. I'm using a record from a separate library that I'd like to return as a list in a static method that will be used from Java. So, in the :methods section of my gen-class I have "[Lwatchlist_models.models.User;" to define a list of type User, however whenever I attempt to create an uberjar from lein, it complains that it can't find the User class in my classpath. Should I be manually

22:35 manipulating my classpath to resolve this issue?

22:36 TEttinger: dogonthehorizon: can you make the java code that defines watchlist_models.models.User a dependency of the clojure project?

22:36 you can also mix java and clojure source

22:37 &google leiningen sample

22:37 lazybot: java.lang.RuntimeException: Unable to resolve symbol: google in this context

22:37 TEttinger: $google leiningen sample

22:37 lazybot: [leiningen/sample.project.clj at master · technomancy ... - GitHub] https://github.com/technomancy/leiningen/blob/master/sample.project.clj

22:38 TEttinger: it can be specified like this, dogonthehorizon: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L276

22:40 dogonthehorizon: TEttinger: It's not Java that's defining User, User is a record that I've created with defrecord in the watchlist-models project. The project I'm currently in is intended to be a library for a separate Java project. I can simply say java.util.ArrayList as the return type and go about my way, but this means that in Java I will need to typecast the list because Clojure will produce a return type of

22:40 ArrayList<Object> :/

22:41 TEttinger: oh, gotcha.

22:41 well thanks to runtime erasure of generics, the two of those are identical at runtime

22:42 ArrayList<Object> and ArrayList<User> will be the same at runtime, only different during compiles

22:43 dogonthehorizon: Right, so in my Java code I can simply treat the returned list as usual by doing (ArrayList<User>) list, but I'd rather like to avoid having to typecast everything :/

22:43 TEttinger: also, [L is a fixed-length 1D array, which might not be what you want

22:44 dogonthehorizon: If I specify the return of my method as java.util.ArrayList and then in the method itself return my list using clojure.core/into-array, will this have the desired effect?

22:45 TEttinger: it seems like it hasn't executed and compiled the defrecord by the time it gets to the type hint for the array

22:45 so there just isn't a User class on the classpath by the time it reads the type hint, and it complains

22:45 dogonthehorizon: Hum... can I solve this by wrapping the ns that defines my models with a :gen-class?

22:49 wodnt: does anybody have experience working with postgres extensions with java.jdbc?

22:50 dogonthehorizon: TEttinger: This sounds promising - "When AOT compiling, generates compiled bytecode for a class with the

22:50 given name (a symbol)"

22:50 wodnt: I'm trying to use RETURNING with insert, but I'm not sure how to use it

22:50 with the clojure.java.jdbc library. I'm open to using another interface too, if

22:50 one comes to mind

22:50 dogonthehorizon: I'll give that a shot and report back, thanks for your help so far!

22:56 TEttinger: np, dogonthehorizon, you could definitely fiddle with :aot namespaces in your project.clj, or try :aot :all

23:00 dogonthehorizon: I threw an :aot :all in the watchlist-models project since I'm only defining records there to be shared across several projects. Now when packaging an uberjar for a library that uses these models I don't run into any undefined errors. Thanks again for helping me work through this TEttinger :)!

23:01 TEttinger: no prob, it's something I've run into before, and it can be painful. glad it wasn't too bad this time!

23:15 celwell: Hi, what would be a smart/safe way to store an encryption key for use in a clojure web app? (I augmented the clojure jdbc library to allow for use of mysql's AES_ENCRYPT() function, but I'm currently storing the 128-bit encryption in plain hex text in a (def ...))

23:16 Wild_Cat: celwell: environment variable?

23:16 possibly pointing to a file if you want extra indirection

23:18 celwell: Wild_Cat: by pointing to a file do you mean to pull in the key with slurp or something?

23:18 Wild_Cat: celwell: yeah. Do it once at app initialization, of course.

23:19 celwell: Wild_Cat: I was thinking something along those lines. I didn't know if there was some better practice though, but thanks for the input.

23:41 jimrthy: I'm running into what seems like an old issue: the resource/ directory in my project disappears when I create an uberjar. Does anyone have a link handy that's newer than ~2011?

23:53 technomancy: jimrthy: the point of the resources directory is to get files on the classpath

23:53 if the files are in the uberjar, they're on the classpath

23:55 jimrthy: technomancy: I'm probably thinking about this backwards

23:58 technomancy: jimrthy: try clojure.java.io/resource

23:59 jimrthy: That's returning either an empty string or a 404

Logging service provided by n01se.net