#clojure log - Apr 27 2014

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

0:01 ToxicFrog: Argh. I cannot figure out what is going on here.

0:02 *state* starts out as {}. It does (set! *state* (assoc *state* :pass foo)) and gets {:pass foo}

0:02 Then it does (set! *state* (assoc *state* :user bar)) and gets {:pass foo :user bar}

0:03 And then it does (set! *state* (assoc *state* :channels [x y z])) and gets... {:pass foo :channels [x y z]}

0:03 I cannot figure out what is going wrong.

0:07 akhudek: ToxicFrog: why are you using set! ?

0:08 ToxicFrog: akhudek: because I have given up on making sense of Saturnine's poorly documented state management API

0:10 akhudek: :-(

0:10 ToxicFrog: Honestly the only reason I haven't punted Saturnine entirely and reimplemented the parts I want is the lack of a convenient clojure wrapper around the java sockets API

0:15 toan: Hi guys, i'm new to clojure and trying this tutorial. https://github.com/swannodette/enlive-tutorial/

0:15 everything is fine until i run > (hn-headlines)

0:17 i get a 403 (forbidden). i've look it up but there is not much info on faking "user-agent"

0:18 akhudek: try scraping http://webcache.googleusercontent.com/search?q=cache:DjfN_3WYfIsJ:https://news.ycombinator.com/+&cd=1&hl=en&ct=clnk&gl=ca maybe?

0:19 though I don’t know why you would get a 403

0:19 I was just able to wget hn just fine

0:20 toan: interesting

0:20 thx

0:23 ToxicFrog: Oh goddamnit.

0:23 It's a race condition.

0:24 Made possible because apparently saturnine spawns a separate thread for each socket, so the upstream handler can run while the downstream handler is still constructing the new state

0:24 crispin: ToxicFrog: can you use channels to consume it on a single thread

0:24 using core.async

0:26 ToxicFrog: crispin: not without replacing saturnine, I think

0:26 For some reason I thought it did that already specifically to avoid this sort of problem

0:27 crispin: Im not familiar with saturnine

0:27 ToxicFrog: This also explains a lot of my confusion around how saturnine's state management works

0:28 Library for networking, basic idea is that it lets you install a stack of "handlers" between two sockets (which may be send/recv halves of the same connection) and as messages arrive the appropriate handler functions are called

0:28 Each handler starts with a blank "state" passed to each function, and whatever that function returns becomes the new state

0:28 crispin: ah its already async

0:29 ToxicFrog: ...except apparently it's possible for a handler to send a message, and that message to trigger another handler invocation, and that invocation executes concurrently with the first handler, before it has returned the new state

0:29 So the second handler gets stale state and everything goes horribly wrong

0:30 toan: akhudek, i just tried the cached page but got 403 still... maybe it has something to do with the fact i'm tethering the connect through phone... maybe

0:31 akhudek: toan: that’s very odd. Does wget work? If not, it’s definitely something in your networking.

0:32 ToxicFrog: I have implemented a fairly ugly workaround here but I really have no idea how to solve this in the general case.

0:32 Within the framework of this library, I mean.

0:32 clojurebot: It's greek to me.

0:32 crispin: should you not be using vars?

0:33 saturnines examples don't use any refs except for @users

0:33 the handler just assoc's and returns it

0:33 what is your *state* ref doing?

0:33 toan: ok, will try. interestingly, yahoo.com returned "()"

0:35 ToxicFrog: crispin: that's not the problem here. Within a handler, it does (binding [*state* state] (dispatch function) *state*); the dispatch function may find it more convenient to (set-state) (a wrapper around (set! *state* foo) than to return a new state.

0:35 toan: wget work just find

0:35 fine

0:36 akhudek: toan: well, as a temporary measure you can always just load the file from the disk instead. Just use (html-resource (io/file “myfile”))

0:37 toan: ok. cool. thanks so much.

0:38 ToxicFrog: crispin: I could rewrite parts of it to avoid needing set!, and I may even do so at some point, but first I want to fix this.

0:38 crispin: well set! is java interop, yet you're using it across threads? the assoc calls with :pass in the hashes two threads

0:39 can the STM help you?

0:39 seems you want a shared state between threads?

0:39 not sure what is going on, just thinking out loud

0:40 setting refs inside dosync is safe from that behavoir

0:40 ToxicFrog: Er

0:40 I am not deliberately using it across threads

0:41 This does not mean Saturnine is not creating its own threads and invoking different handlers of mine in different threads

0:41 Which shouldn't make a difference, except that the value used for (binding) *state* is passed in by Saturnine, and if one message handler runs before a currently-running one completes, they both get the same state passed in even the currently-running one needed to update it.

0:42 That said, I have now figured out how to activate Saturnine's threadless mode and reproduce this, so threads are not the problem.

0:42 I think what's happening is this:

0:43 crispin: so handler 1 puts :pass on *state*

0:43 ToxicFrog: - upstream handler is invoked, binds *state* containing :pass, calls set-state to add :nick, and generates an upstream message

0:43 crispin: then handler 2 and 3 run "simultaneously" and h2 puts :user, and h3 puts :channels

0:43 ToxicFrog: ...wait, no, that doesn't make any sense

0:44 * ToxicFrog adds more logging

0:44 ToxicFrog: crispin: that's what I thought was happening, but I have now reproduced this behaviour in a mode that, if the documentation is accurate, is singlethreaded

1:33 danlamanna: can someone point me to the clojure-way of building up a hashmap from a list of strings, that need processing?

1:34 Frozenlock: danlamanna: A list of strings? Like ["hello" "evening" "math" "computer"] ---> {"hello" "evening" "math" "computer"} ?

1:35 danlamanna: Frozenlock: more like ["foo bar" "baz qux"] ---> {:foo "bar" :baz "qux"}

1:36 its just the mindset of doing it without mutable variables

1:36 thats tripping me up.

1:38 Frozenlock: ,(into {} (map #(clojure.string/split % #" ") ["foo bar" "baz qux"]))

1:38 clojurebot: {"foo" "bar", "baz" "qux"}

1:38 Frozenlock: Do you want keywords as keys?

1:39 danlamanna: yeah, i have the idea now though, not sure why i was trying to loop...

1:39 arrdem: danlamanna: because that's what you're used to :P

1:40 Frozenlock: arrdem: that's my worst enemy. Mr What-im-used-to.

1:40 I get stuck on stupid things because of him.

1:43 bitemyapp: arrdem: up for a round?

1:43 arrdem: I'm ready to take a break, just made some progress.

1:43 arrdem: bitemyapp: wat? no. setting up log rotation and going to bed.

1:44 bitemyapp: arrdem: fair nuff. Just turned on -Wall on my project and got blasted in the face.

1:45 I thought the types alone were good but this compiler is ridiculous. IT SEES ALL

1:48 arrdem: bitemyapp: the malevolence engine sees all your flaws and it is not pleased

1:49 kelseygi: blargh i keep getting this streaming json error & i can't figure out why

1:49 EOFException java.io.EOFException: JSON error (end-of-file inside array)

1:49 bitemyapp: arrdem: you have been measured and you have been found WANTING!

1:51 danlamanna: ended up doing a zipmap on two mapping functions... 3 lines :)

2:08 amalloy: danlamanna: instead of (zipmap (map f xs) (map g xs)), you want (into {} (map (juxt f g) xs))

2:51 derek_c: why would repl complains "namespace not found" when the namespace is actually there? I'm doing (use 'some-namespace)

3:03 Geeky_Vin: Hi Everyone, I'm trying to call/create a model in my fuseki server from clojure program but donno how, can someone help me pls?

3:08 kelseygi: so i'm trying to use the twitter-api library for a streaming call (https://github.com/adamwynne/twitter-api)

3:08 i ahve code very similar to the example there, but with some exception handling

3:08 and it seems to not be chunking on the right boundaries

3:09 any ideas about where to look to debug that?

3:37 derek_c: this channel doesn't have many people answering newbie questions :(

3:42 guns: derek_c: what's your question

3:44 derek_c: guns: i'm trying to (use my-namespace) in a repl but it says namespace not found. but I'm pretty sure it's there

3:45 guns: derek_c: Does your file have dashes?

3:45 derek_c: in fact when I did it earlier, it works and it's complaining the said namespace using some unresolved symbols

3:45 guns: no

3:45 guns: derek_c: that sounds like a compiler error; you probably need to fix your ns

3:46 derek_c: guns: huh?

3:46 guns: derek_c: I'll be glad to help if you post a paste

3:46 refheap.com

3:47 derek_c: guns: I wonder if it's caused by the same problem that caused this issue: https://github.com/marick/Midje/issues/215

3:48 guns: derek_c: I'm sure the problem is hidden in plain sight. it will be easier to look at some code

3:48 derek_c: guns: thanks: https://www.refheap.com/81463

3:49 so I'm doing (use 'twopc.coordinator)

3:49 guns: derek_c: and what's the exact compiler error?

3:50 derek_c: CompilerException java.lang.Exception: namespace 'twopc.coordinator' not found, compiling:(/tmp/form-init4988673516715825549.clj:1:1)

3:51 guns: derek_c: This is how I usually debug this kind of error: comment out the body of the ns, then try to re-require

3:52 then uncomment a hunk/def at a time till you find the error

3:52 A manual scan over your code doesn't reveal anything obvious, but something is wrong

3:52 Frozenlock: derek_c: "this channel doesn't have many people answering newbie questions :(" Dude, it's like 4 am

3:53 guns: Frozenlock: he might be russian for instance

3:53 Frozenlock: And #clojure is especially calm on the weekends.

3:53 derek_c: lol I'm in the U.S. yeah didn't realize it's this late already

3:54 why do hackers have to sleep

3:54 Frozenlock: guns: Sure, doesn't change the fact that at these hours freenode channels somewhat less active.

3:54 *are

3:54 guns: it's true. #clojure is very US centric

3:54 #archlinux never stops talking for instance

3:55 Frozenlock: I like to think it's Canada centric. :-p

3:55 derek_c: guns: it turns out I just needed to add :reload

3:56 guns: derek_c: you might want to look into tools.namespace if you'd like more control over namespaces

3:58 derek_c: how do you use require and :refer in a repl?

3:58 guns: (require '[my.ns :refer [α β]])

3:59 derek_c: ah, I was placing the ' inside the brackets

3:59 guns: thanks man

3:59 guns: np

4:02 derek_c: are you guys actually using Clojure in production, or just as a hobby? just curious

4:06 guns: production; but nothing big yet. Writing an IMAP client ATM

4:08 derek_c: guns: oh. what kind of company are you working at?

4:08 is there a way to *clear* everything that has been imported in a repl?

4:08 guns: derek_c: I'm doing contract work; I tried starting a company in the past year, but it didn't turn out well

4:09 the Clojure part was great though

4:09 derek_c: tools.namespace can do that

4:09 but you can always (remove-ns 'ns-sym)

4:10 and individually (ns-unmap *ns* 'var-sym)

4:10 Frozenlock: I usually just restart my repl. Just to be sure.

4:10 derek_c: guns: kk. thanks!

4:10 guns: Frozenlock: I hate restarting the damn repl. it really magnifies the one thing Clojure sucks at

4:12 I hope this "Lean runtime" initiative bears fruit. I love Daniel Gomez

4:12 hear that deepbluelambda? You are awesp,e

4:53 derek_c: what's the idiomatic way to write a function that takes an arbitrary number of arguments but simply returns a value? I came up with (fn [& _] addr)

4:53 where addr is the thing I want to return

4:54 Frozenlock: ,(apply (constantly "hello") [1 2 3])

4:54 clojurebot: "hello"

4:55 Frozenlock: Not sure if it's the idiomatic way...

4:55 ,(doc constantly)

4:55 clojurebot: "([x]); Returns a function that takes any number of arguments and returns x."

4:55 Frozenlock: But it does seem to be exactly what you need :-)

4:56 eh, I didn't even need apply for that

4:56 ,((constantly "hello") [1 2 3])

4:56 clojurebot: "hello"

4:58 Frozenlock: derek_c: ah! You reimplemented `constantly'

4:58 ,(source constantly)

4:58 clojurebot: Source not found\n

4:58 Frozenlock: -_-

4:59 derek_c: Frozenlock: ah, thanks!

4:59 Frozenlock: derek_c: https://www.refheap.com/81532

6:12 rurumate: has anyone accessed the distributed cache in a cascalog job?

6:13 there should be a way.. or is there another standard way to access shared "static" data

6:35 Glenjamin: Hi guys, is there a way to write clojure so it goes from high-level functions to low-level functions top-to-bottom?

6:36 would it be considered bad style to (declare) everything at the top, then do this?

6:38 ivan: Glenjamin: I guess almost everyone expects the opposite

6:38 some people mentioned this uniformity as an advantage in mailing list posts about this

6:39 Glenjamin: when i'm not doing clojure, i generally expect the reader to be able to gain more detail by reading further down the file

6:39 but without hiding things in namespaces, i seem to end up with all the detail at the top hiding the "public" api at the bottom

6:40 Frozenlock: Glenjamin: You'd probably need to use 'declare' everywhere... that'd be nasty

6:40 Glenjamin: i could wrap my whole ns in a (reverse) macro :D

6:42 i guess i'll just have to get used to it

6:44 Frozenlock: wtfffff

6:44 I think there's a memory leak with my brepl

6:44 Glenjamin: here's a good example ";; top-level API for actual SQL operations" -> line 782

6:45 Frozenlock: My CPUs are working and I have near 6GB of ram that shouldn't be used o_O

6:46 'killall java' just freed 7GB of ram. o_O

7:25 ashnur: hi. is running `clojure helloworld.clj` with just (println "hello world") in it supposed to take 5-10 seconds to compile and run?

7:27 because although i have a fairly slow machine, this still seems very slow for me.

7:28 Frozenlock: ashnur: yes

7:28 ashnur: :(

7:29 how do people deal with this?

7:29 beamso: they don't kill the JVM but code in a repl

7:30 ashnur: i like having files to run them

7:30 beamso: you can reload the files and recompile them at runtime

7:30 Frozenlock: ashnur: You won't once you try a REPL ;-)

7:31 ashnur: Frozenlock: i use repl every day, all day, for javascript

7:31 is there any reason why using the clojure repl would give me a different experience(other than clojure being a superior language of course)

7:31 not trying to insult anyone :-S

7:32 * Frozenlock just realized that inferior-lisp has a prettier syntax highlighting than clojure-mode

7:32 ashnur: beamso: so there is a way to reload/compile files from within the repl?

7:34 beamso: (use 'your.namespace :reload-all)

7:34 Frozenlock: ashnur: if you are working in emacs, C-c C-k will load the current buffer into the repl

7:34 ashnur: using vim :(

7:35 beamso: ok, will read up on that, thanks

7:35 beamso: https://github.com/guns/vim-clojure-static/wiki/Clojure-REPL-Plugins

7:37 ashnur: thank you

7:38 beamso: not a problem. i think fireplace.vim is what most people use.

7:39 ashnur: i have it installed :)

7:40 but the fact is, that i only ever used vim as an editor, no fancy features

7:40 Glenjamin: https://github.com/clojure/tools.namespace#reloading-code-usage can be used to reload things

7:40 ashnur: because it was usually less convenient, and slower

7:52 Glenjamin: anyone know if there's a technical reason transients aren't sequences?

7:52 ,(into [] (map identity (transient [1 2 3])))

7:52 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.PersistentVector$TransientVector>

7:59 TEttinger: Glenjamin: transients are really weird, is what I have to say.

7:59 they are mutable, kinda, so they can't really be treated like seqs

8:17 ambrosebs: Glenjamin: my interpretation is transients should *only* be used to construct a new sequence, and shouldn't be used

8:17 there are lots of seqable things that are mutable, so no technical reason I can think of

8:17 don't have much experience with transients tho

8:38 yotsov: how come that redefining static vars makes their new value visible to all threads? afaik the jvm is doing per-thread caching... Are static vars implemented via "volatile" or some other such mechanism to specifically make sure threads do not keep cached copies of them? If such is the case, doesn't that come at a quite big cost?

8:39 bob2: static var?

8:39 yotsov: I mean a default var, one that is not ^:dynamic

8:40 bob2: blithely rebinding them is not a common thing to do

8:40 normally you'd use an atom or a agent or a ...

8:40 yotsov: sure

8:40 bob2: but I do not know if they are volatile or not (but have never needed to care)

8:41 yotsov: I actually do not need to care either, it is just that suddenly this struck me as strange

8:41 although since indeed they are not expected to change, having them as volatile should not have a cost, you are right

9:02 AWizzArd: In Om these both work, which is preferrable? 1. (:my-key (om/get-state owner)) 2. (om/get-state owner :my-key)

9:12 owl-v-: what's clojure on llvm?

9:13 TEttinger: owl-v-: hm? I've seen clojurec

9:14 https://github.com/schani/clojurec

9:27 owl-v-: is clojurec for c or for objective-c ?

9:37 TEttinger: owl-v-, both I think, I think it uses LLVM to communicate with C

9:38 if it runs on iOS it likely uses clang which means C and Obj-C and LLVM

9:38 owl-v-: so, this works only on osx?

9:41 TEttinger: owl-v-, no, there's clang for windows, mac and linux now

9:41 clang was funded by Apple to replace GCC on macs, but it has more platforms that it runs on than just macs

10:13 Morgawr: let's say I wanted to have a map that mapped keys to methods in a java class, how do I pass a method as a higher order function? Do I need to use lambdas wrapping?

10:13 what I want is something like

10:13 { :keyword MyJavaClass/myMethod }

10:13 so I could do something like ((:keyword map) class-instance parameters)

10:13 is that possible?

10:16 Glenjamin: Morgawr: i think you want (.)

10:18 Morgawr: Glenjamin: how do I get a behavior like ((:keyword map) class-instance parameters) with .?

10:18 usually it's (. instance methodname parameters)

10:18 but methodname is defined by a call to a map

10:19 (. instance (:keyword map) parameters)

10:19 if I try to return something like 'myMethodName it doesn't work because "Malformed member expression"

10:19 Glenjamin: hrm

10:20 yeah, i assumed that would work

10:22 i feel like this should work:

10:22 ,(. (Runtime/getRuntime) (symbol "totalMemory"))

10:22 clojurebot: #<CompilerException java.lang.SecurityException: Reference To Runtime is not allowed, compiling:(NO_SOURCE_PATH:0:0)>

10:22 Glenjamin: meh

10:23 Morgawr: I could do something like

10:23 Glenjamin: perhaps with eval

10:23 or a macro

10:23 Morgawr: #(.methodName %1 %2)

10:23 I mean, I know that works

10:24 I was hoping for a more elegant solution ,but I guess this'll do

10:24 gfredericks: Morgawr: yes you need to wrap methods in functions if you want to pass them around

10:24 memfn is a helper for that, but not very useful

10:24 Morgawr: oh, never heard of memfn

10:24 * Morgawr looks it up

10:25 gfredericks: ,((memfn toString) 42)

10:25 clojurebot: "42"

10:25 Glenjamin: (eval (list '. (Runtime/getRuntime) (symbol "totalMemory")))

10:26 gfredericks: Morgawr: your map from keywords to methods is fixed at compile-time?

10:26 Morgawr: Glenjamin: that's not very elegant, it's better to wrap it in a lambda

10:26 Glenjamin: "Use when you want to treat a Java method as a first-class fn. "

10:26 Morgawr: gfredericks: yes

10:26 gfredericks: Morgawr: yeah you could do it with minimal repetition using a macro

10:26 Morgawr: do you want the wrapper functions to take varargs or a single list of arguments?

10:27 Glenjamin: Morgawr: you'd only need a map of keyword -> symbol and eval in one place, but memfn is clearly better than lambda/eval

10:27 Morgawr: gfredericks: the methods just take one single parameter

10:28 (plus the instance ofc)

10:28 gfredericks: Morgawr: and they're all methods on the same class?

10:28 Morgawr: yes

10:28 basically, I'm just wrapping a library from Java that takes a "Settings" class and calls some setWhatever on it

10:28 and I want to pass a dictioanry of keywords and value and repeatedly call ((:keyword mapping) settings-instance value)

10:29 gfredericks: roger

10:29 TEttinger: memfn ?

10:29 ,(doc memfn)

10:29 clojurebot: "([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn. name may be type-hinted with the method receiver's type in order to avoid reflective calls."

10:29 TEttinger: oh I'm too late

10:30 Morgawr: I'm trying to understand how this memfn works...

10:30 TEttinger: hey Morgawr, I noticed 4 new issues popped up on Cloister... glad you're working on it

10:30 gfredericks: ,(defmacro memfns [& key-syms] (into {} (for [[key sym] (partition 2 key-syms)] [key `(memfn ~sym)])))

10:30 clojurebot: #'sandbox/memfns

10:30 owl-v-: lol clochure~* http://clochure.org/

10:30 Morgawr: TEttinger: yeah, I'm slowly trying to implement the physics engine around it (this is related :P)

10:31 owl-v-: replacing () with []

10:31 Morgawr: owl-v-: haha

10:31 gfredericks: ,(def fns (memfns :foo toString))

10:31 clojurebot: #'sandbox/fns

10:31 gfredericks: ,fns

10:31 clojurebot: {:foo #<sandbox$fn__141 sandbox$fn__141@e8a53f>}

10:31 gfredericks: ,((:foo fns) 42)

10:31 clojurebot: "42"

10:31 gfredericks: Morgawr: ^ there you go

10:31 Morgawr: gfredericks: neat, thanks

10:33 gfredericks: since this is a settings object it's probably not an issue, but for low-level code those memfns will be slow because reflection

10:33 Morgawr: gfredericks: yeah, thnks

10:34 owl-v-: what's the purpose of clochure, lol

10:36 TEttinger: made April 1

10:43 Glenjamin: if i have a transient map of maps, is there a nice way to make everything persistent?

10:43 currently doing (fmap persistent! (persistent! collection))

10:43 sdegutis: Looks good to me.

10:45 Glenjamin: i suspect i'm overthinking, but it feels slightly silly to make the outer persistent, then have fmap use into to create a new outer collection via a transient

10:51 felher: Hey folks. Can I overload contains? (maybe via defmethod) for my own types? Or would that be a bad idea anyways?

10:55 gfredericks: I think that's ILookup

10:55 which is a java interface

10:57 no it's not ILookup

10:57 it's clojure.lang.Associative

10:57 ,(def my-thing (reify clojure.lang.Associative (containsKey [_ k] (even? k))))

10:57 clojurebot: #'sandbox/my-thing

10:57 gfredericks: ,(contains? my-thing 37)

10:57 clojurebot: false

10:57 gfredericks: ,(contains? my-thing 38)

10:57 clojurebot: true

10:57 Glenjamin: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L705

10:58 felher: Awesome. Thanks :)

11:15 jjl`: i'm pretty sure i'm being an idiot, but i can't seem to make 'lein deps' find some dependencies. i'm using lein deploy file://$HOME/.m2/repository group/artifact version path.jar to deploy, have added a "local" repo in project.clj

11:23 stask: jjl`: is your missing dependency a snapshot? if yes, you will probably need to do something like "lein -U deps"

11:33 jjl`: stask: it is indeed a SNAPSHOT

11:34 excellent, -U worked. thanks.

12:13 Rotwang: hi

12:13 danlamanna: amalloy_: not sure if juxt would work, since its a vector of strings like ["foo bar" "baz "qux"] and i want it to be a map such as {"bar" "foo", "qux" "baz"}

12:14 Rotwang: why does the clojure.java.shell causes ~1 minute exit?

12:16 danlamanna: so i map on (second (split ..)) and (first (split ..))

12:19 jjl`: how is performance using (seq "string")? is there a large penalty?

12:21 AWizzArd: jjl`: no large penalty

12:24 jjl`: AWizzArd: excellent. thanks.

12:27 arrdem: until it chokes your app, no penalty is large :P

12:27 jjl`: well, there's a certain degree of that

12:32 grimmulfr: So I'm really new to Clojure (mediocre with any Lisp really, but learned enough to set up my Emacs - editor of choice - and StumpWm when I was still using that). What would be some of the best resources I should go through at this point? For now I went trough the "Intro to Clojure" videos.

12:33 I will eventually go into web developing with it if I find that it could replace or add to what I'm using now. I do a lot of Javascript anyway, so I though why not try Clojure/ClojureScript too I guess.

12:33 AimHere: For a bunch of problems to test your skillz, there's 4clojure. The clojure cheatsheet on the main website is what I use to find out which function does what

12:34 arrdem: grimmulfr: there are some good books on Clojure, but what really did it for me was hanging around here asking questions.

12:34 grimmulfr: How is the community? :D

12:34 AimHere: Also, if you're not already using leiningen, go use it.

12:34 arrdem: grimmulfr: amazingly helpful.

12:34 jjl`: i suspect 4clojure and a link to the cheatsheet would probably do what you want the best

12:34 grimmulfr: Indeed, I have everything set up for now. Running lein 2 + emacs + autocomplete + eldoc on Ubuntu

12:35 jjl`: oh and if you're doing frontendy stuff, you should definitely play with Om

12:35 grimmulfr: Probably the same at work, as I have a working virtual machine for it

12:35 Guest86190: Anyone know how to convert ["email@email.com" "other@email.com"] into [["email@email.com"] ["other@email.com"]]

12:35 (please)

12:35 grimmulfr: Well, frontend and backend. In my line of work I do facebook apps most of the time

12:35 I;m a flash developer but I do javascript too where it's needed

12:35 AimHere: ,(map vector ["string1" "string2"])

12:35 clojurebot: (["string1"] ["string2"])

12:35 AimHere: Okay, mapv instead

12:35 ,(mapv vector ["string1" "string2"])

12:35 clojurebot: [["string1"] ["string2"]]

12:35 Guest86190: Thanks AimHere :-)

12:36 That's Awesome!

12:36 jjl`: grimmulfr: clojure is a bit of a departure from actionscript. good luck :)

12:36 arrdem: grimmulfr: got an .emacs snippet for auto enabling ac-mode and ac-nrepl when in clojure-mode?

12:37 jjl`: arrdem: (add-hook 'clojure-mode-hook (lambda () (ac-mode) (ac-nrepl-mode))) should do it

12:37 grimmulfr: Well, I took coding as a hobby a long time ago, I went through most if not all big languages, one extra wouldn't hurt heh.

12:38 jjl`: Already set those up :)

12:38 and using moe-theme which is simply godly (well structured code + colored parantheses looks really nice)

12:38 * jjl` uses solarized-dark at the minute

12:38 jjl`: you have rainbow-parens-mode ?

12:38 grimmulfr: yes

12:39 jjl`: editing lisp without that is hell

12:39 grimmulfr: It helps a lot. Weirdly enough, I learned about it while setting up my Clojure environment. I had no idea that exists

12:40 jjl`: unsurprising that lots of people are recommending it

12:40 arrdem: there's also a lot of love for paredit around here... can't say that I use it yet.

12:40 grimmulfr: I enabled that one. Didn't like it much

12:41 jjl`: https://github.com/jjl/elisp/blob/master/site/jjl-font.el here's how you do fallback over a bunch of fonts

12:41 grimmulfr: I guess that's what happens when you try something different but heck, I'm used to my way. I'm not really lazy, I can put my own paren on there

12:41 I use EnvyCodeR for years

12:41 I have yet to find a better programming font

12:42 (for me, obviouslly)

12:42 jjl`: i really wish paredit would work for me. i already visualise the code as an AST, but something about it just irks me

12:42 Glenjamin: grimmulfr: i'm a big fan of http://aphyr.com/tags/Clojure-from-the-ground-up as an intro series

12:42 grimmulfr: scratch an l from there :)

12:42 arrdem: yay got automagical autocomplete working!

12:42 grimmulfr: Glenjamin: thanks, will give those a go

12:42 arrdem: what editor?

12:42 Glenjamin: i'd love to use paredit, but i can't decide what keys to bind it to in lighttable

12:43 jjl`: arrdem: which method? there are about 4

12:43 arrdem: grimmulfr: emacs

12:43 jjl`: I already had what you described in place, but I had my add-hooks in an eval-after-load

12:43 grimmulfr: I feel like mine is set up all wrong, I should go back to editing it. I've had it set up this way for 1-2 years.

12:43 arrdem: jjl`: so it wasn't working :P

12:44 jjl`: oh. i'm using ac-cider-nrepl-compliment (which seems less popular)

12:44 arrdem: https://www.refheap.com/81685

12:44 jjl`: er ac-nrepl-compliment

12:44 grimmulfr: ac-source-words-in-buffer, ac-source-words-in-same-mode-buffers and ac-source-words-in-all-buffer help too

12:44 I love it when I do php with this, but it's kind of overkill

12:51 Should remember to not kill emacs while rcirc is running :)

12:54 Is there a differencet between nrepl.el and cider? It seems that my setup only uses nrepl (it's what I found while setting stuff uo and it works), so what am I missing by not having cider?

12:54 jjl`: surely you only kill emacs when it hangs anyway?

12:55 arrdem: cider is the maintained version of nrepl.el

12:55 grimmulfr: Usually yes, but now I killed it to refresh all my init.el (I know I shouldn't as I can eval on the fly, but it's a bit faster for me)

12:55 so I should remove nrepl and go cider?

12:56 I'm guessing yes

12:56 arrdem: doing so will likely break your config..

12:56 grimmulfr: Yeah, it's what I'm afraid of

12:56 arrdem: I don't see a strong reason for doing so unless you have a few hours today to debug it.

12:56 jjl`: that. especially if you if you use a lot of nrepl plugins and such

12:56 grimmulfr: I don;t have much of a config for nrepl for now though.

12:56 jjl`: (although if you want to use ac-nrepl-compliment, i've patched it)

12:58 grimmulfr: All I want is an environment to run code in. Open bla.clj, C-c C-k to "compile", C-c M-n to switch to the ns, and then run my DEFNs

12:58 Auto complete in the REPL is a nice bonus though

12:58 arrdem: grimmulfr: you should be able to take the 90-clojure.el I linked above and run...

12:58 grimmulfr: it does all that and not much more for cider

13:00 grimmulfr: All I had set up for nrepl was autocomplete (which should be fixed by you earlier snippet) and eldoc (not that hard to redo for cider I assume)

13:03 hehe, cider switches the ns automagically

13:03 That's one plus :)

13:04 arrdem: there's also a nice chord for jumping between your test namespace and your code namespace...

13:04 jjl`: arrdem: oh that's a handy one

13:04 grimmulfr: I'm sure that'll come in handly, for now it's just one ns that I learn the language in :D

13:05 but for now*

13:10 Yeah, cider autocomplete doesn't work. Can't find nREPL middleware providing op autocomplete. Please, install cider-nrepl and restart CIDER. Might just do that

13:11 arrdem: grimmulfr: you need ac-nrepl still

13:12 grimmulfr: Well I have (require 'ac-nrepl) on there

13:12 then I set up the hooks for cider-repl-mode-hook and cider-mode-hook

13:12 and I add cider-mode to ac-modes

13:12 arrdem: (add-hook 'clojure-mode-hook (lambda () (auto-complete-mode) (ac-nrepl-setup)))


13:15 grimmulfr: Still no go :(

13:15 With the regular nrepl I could tab complete my DEFNs, now I get that error above

13:19 fixed it

13:20 Guest86190: hmmm how would I create a vector with one node from a string..?

13:21 ToxicFrog: As in, turn the string into a vector with a single element, that element being the string?

13:21 Guest86190: 'cos (vec "I am a string") gives me [\I \space \a \m \space \a \space \s \t \r \i \n \g]

13:22 ToxicFrog: ,(let [the-str "asdf"] [asdf])

13:22 Guest86190: ToxicFrog exactly

13:22 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: asdf in this context, compiling:(NO_SOURCE_PATH:0:0)>

13:22 ToxicFrog: ,(let [the-str "asdf"] [the-str])

13:22 clojurebot: ["asdf"]

13:22 ToxicFrog: Just wrap it in []

13:22 Guest86190: Ah, I see, ok - thanks

13:24 ToxicFrog: (vec) is for converting sequables to vectors with the same elements; (vec str) treats str as a seq of chars and vectorizes that

13:26 Guest86190: *nods* That makes a lot of sense - thanks very much

13:26 :-)

13:28 kelseygi: morrrrnning

13:28 i got streaming problems

13:28 with http.async.client

13:28 grimmulfr: So do you guys/(gals maybe?!) generally use Clojure for? Just trying to test the market :)

13:29 kelseygi: are the chunk boundaries determined by some kinda header?

13:30 jjl`: grimmulfr: let me guess, you didn't have the clojure side of it?

13:32 grimmulfr: Something like that :D

13:41 Glenjamin: if i'm running something at the repl and i don't want to see the return value, is there a better option than (do form nil) ?

13:44 jjl`: why do you not want to see the return value?

13:45 grimmulfr: Is there a way of getting the value of a certain vector key besiders "get"? Or is that the way it should be done? Let's say I have my [1 2 3] x vector. I want to get the value at 2. Any other way besides using (get x 1) ?

13:45 * grimmulfr should hit the books first :D

13:46 jeremyheiler: grimmulfr: nth

13:46 grimmulfr: basically looking for the equivalent of x[1]

13:46 oh, nice :D

13:46 Thank you

13:46 jeremyheiler: np

13:46 kelseygi: anyone have any ideas/other places to look for my chunk problem?

13:46 i do like typing "chunk" over and over

13:46 CHUNK

13:53 …chunk?

14:05 pdurbin: sloth love chunk

14:09 seangrove: dnolen_: Is there a hook in Om before you start re-rendering from root to let me run some function (layout function in this case) to pre-compute properties that around going to be needed for all of the components?

14:10 are going to be needed*

14:10 dnolen_: seangrove: not really, but you can do this in the root component.

14:11 IWillUpdate

14:12 seangrove: dnolen_: Makes sense, we have an explicit root component right now, so we could do that. I'd like to just pass it down to children (ideally in om/get-shared, probably) as a value and not a reference - any way to do that from IWillUpdate?

14:20 kelseygi: do ppl use anything besides lighttable or a text editor, ide wise?

14:20 kinda done with light table i think

14:26 damn i can't even get an editor war going?

14:27 jeremyheiler: kelseygi: intellij + cursive is a good combo

14:32 katratxo: kelseygi: ccw http://doc.ccw-ide.org/

14:33 ambrosebs: kelseygi: try cursive

14:35 kelseygi: there we go!

14:37 grimmulfr: Emacs all the way. Funny thing, I started using it a long time ago, but not for Lisp hehe

14:37 jjl`: what do you use instead of apply with java interop method calls?

14:37 dnolen_: seangrove: hmm, no obvious simple way to do that besides passing a ref down shared that I can see.

14:38 seangrove: dnolen_: No worries, that'll work for the time being

14:40 jeremyheiler: jjl`: wrap the method with a fn

14:40 &(apply #(.length %) ["foo"])

14:40 lazybot: ⇒ 3

14:42 jjl`: but i can't use variable arity with that?

14:43 jeremyheiler: yes you can, %&

14:44 though, methods dont really have variable arity

14:45 so im not sure what you mean

14:51 jjl`: no, but there are a few overloads, and really i'd rather not have to hardcode them all :)

14:54 jeremyheiler: gotcha. i don't think there's any other way

14:56 jjl`: cool. thanks. i didn't realise %& existed

15:04 yedi: did bitemyapp leave the clj community?

15:06 whodidthis: how do you write (fn [a] [a]) in #() style

15:06 dnolen_: whodidthis: #(do [%]) or #(vector %)

15:07 maxthour1ie: Is there any tool that can remove unused parts to shrink the size of an uberjar?

15:08 whodidthis: oh right them functions, was wondering if theres some super secret syntax instead

15:09 ucb: gfredericks: apologies for the late reply. The problem is that having a multimethod that dispatches on type A, and having type B use this multimethod, when both A and B are on the same namespace simply doesn't work.

15:09 gfredericks: so, to make it more concrete. List/eval eventually uses the multimethod apply, which dispatches on the first item of the List. When this item is an Atom, then you're good to go.

15:10 gfredericks: the issue is that both Atom and List resided inside faust.types.

15:10 gfredericks: if I put the defmethod in faust.types, but the defmulti in faust.eval, that works just fine.

15:10 (but it's ugh)

15:10 gfredericks: in sum: keeping Atom and Lisp in separate namespaces is necessary unfortunately.

15:14 grimmulfr: http://pastie.org/9117829

15:14 Am I doing this right? :)

15:17 ucb: grimmulfr: what are you trying to do?

15:18 grimmulfr: Just learning the language. It does work, just wondering if that's the correct way of iterating through "arrays" like that

15:18 Just took an everyday example from what I work with and tried to translate to clojure

15:19 ucb: grimmulfr: if it works, then fine. Keep in mind that you're hiding the function keys though.

15:19 grimmulfr: Oh, wait, there's an actual "keys" in clojure

15:20 ucb: yes

15:20 ,(keys {:foo :bar})

15:20 clojurebot: (:foo)

15:20 grimmulfr: Nice, thank you for that

15:20 ucb: no bother

15:21 maxthour1ie: grimmulfr: maybe some destructing:

15:21 ,(doseq [{:keys [name job]} map2d] (println name "works as a" job))

15:21 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: map2d in this context, compiling:(NO_SOURCE_PATH:0:0)>

15:21 maxthour1ie: ah, rats, you get the idea

15:21 grimmulfr: Indeed, really helpful that

15:22 maxthour1ie: grimmulfr: for this small example, I think I would build a string first, then print it

15:23 but on the other hand, then you have to add newlines, which gets ugly too

15:23 grimmulfr: I'll play with it sme more. I'm just learning iteration onad though I apply them to maps as I use them quite often in other languages. They are basically the arrays of clojure, did I get this right?

15:24 and thought*

15:25 maxthour1ie: grimmulfr: the part about putting maps in vectors is definetly how you do it

15:26 definitely - such hard word

15:26 grimmulfr: Took me years to master

15:26 (not a native english speaker, by far)

15:27 maxthour1ie: www.d-e-f-i-n-i-t-e-l-y.com helps, but the you have to know how to spell it :)

15:27 grimmulfr: Indeed, kinda like the Japanese kanjis hehe

15:28 What does this mean? Look it up in the dictionary. But..oh...wait :))

15:28 maxthour1ie: indeed :)

16:37 dazld: hey, i'm playing with clojure (coming from a JS background)

16:37 jjl`: i have a class on which i can call getProperty(name) and getPropertyNames(). I'd like to construct a lazy map such that attempting to access the value for the map triggers it to be created (getting the value involves network traffic so can be slow). Is there any way of doing this without making all the values be lambdas that will compute the value upon request?

16:37 dazld: just been doing something that seems like it should be fine, but getting consistent 'out of memory' errors

16:38 jjl`: dazld: please pastebin

16:38 dazld: sec

16:38 sveri: hi, looking at cljs-time the docs say that you can set the time-zone-offset, now my question is, how do I get the current time-zone-offset in cljs? Or, how do I parse a date in a different timezone than utc?

16:39 dazld: https://gist.github.com/dazld/11355058

16:40 jjl`: dazld: you do realise *why* that runs out of memory, right?

16:40 dazld: i am a total newb, assume i know nothing

16:40 jjl`: you're allocating rather a lot of integers there

16:41 that's 1024^2

16:41 dazld: yep

16:41 i was thinking about image data

16:41 so, was wanting to buffer up an image, and its rgba values

16:41 jjl`: oh

16:42 dazld: looking at top, it didnt seem to be using that much memory

16:42 the java process

16:42 sveri: isnt the closure library available in cljs..?

16:45 maxthour1ie: dazld: it runs fine here

16:45 sveri: dazld: it is

16:46 maxthour1ie: dazld: maybe play with your -Xmx setting?

16:46 Frozenlock: maxthour1ie: Really? I had to kill it after it chugged away 4gb of ram

16:46 jjl`: yeah, it works here too.

16:46 maxthour1ie: Frozenlock: 4gb? gosh

16:46 dazld: sveri: http://docs.closure-library.googlecode.com/git/class_goog_i18n_TimeZone.html

16:46 it did not use 4gb here

16:47 Frozenlock: I'll retry to make sure I did exactly what's pasted

16:47 dazld: maxthour1ie: is that a repl setting

16:47 ?

16:47 sveri: dazld: I see, thank you, I will try that

16:47 maxthour1ie: dazld: it's a jvm option

16:47 jjl`: i think what you're seeing is call stack overflow. perhaps your version of clojure wasn't dealing with such sequences properly?

16:48 dazld: sounds reasonable

16:48 maxthour1ie: jjl`: but it's says OOM heap space

16:48 jjl`: not stack space

16:48 Frozenlock: ah I think I found why

16:48 dazld: sveri: you could try momentjs.com too, really nice date/time library for js

16:48 Frozenlock: (last/first (vect n128)) works fine

16:49 *vec

16:49 but (vec n128) tries to print everything

16:49 jjl`: yes. it prints successfully here

16:49 grimmulfr: Why is 4clojure failing this test: (= [__] (list :a :b :c) (vec '(:a :b :c)) (vector :a :b :c)) . My input was: (:a :b :c)[:a :b :c][:a :b :c]

16:49 dazld: without casting it to a vec, it returns a lazy seq, right..?

16:49 Frozenlock: jjl`: o_O

16:49 grimmulfr: What am I getting wrong there?!

16:49 sveri: dazld: I want to stay as close to cljs as possible and cljs-time is awesome already, but thanks anyway :-)

16:49 dazld: np

16:50 jjl`: Frozenlock: 'lein repl' on osx. nothing special

16:50 dazld: clojure 1.5.1, lein 2.3.4

16:51 maxthour1ie: ,(.maxMemory (Runtime/getRuntime))

16:51 clojurebot: #<CompilerException java.lang.SecurityException: Reference To Runtime is not allowed, compiling:(NO_SOURCE_PATH:0:0)>

16:51 jjl`: clojure 1.6.0, lein 2.3.3

16:52 dazld: :I

16:52 maxthour1ie: dazld: you can run (.maxMemory (Runtime/getRuntime)) to get the maximum amount of memory avail to the jvm

16:52 dazld: ty tring

16:52 trying even

16:52 Frozenlock: jjl`: Can you see the first values, or are they erased once they get out of the screen?

16:52 maxthour1ie: (but the bot didn't like it :)

16:52 I have like 1,8 GB avail to my jvm

16:52 dazld: thats in kb?

16:53 jjl`: Frozenlock: i can see lots of values, but i'm not scrolling all the way back up to see if i got them all

16:53 Frozenlock: Oh boy, it printed. But Emacs is dying....

16:53 dazld: its a lot of numbers :p

16:53 but thats normal for image data

16:53 maxthour1ie: dazld: it's in bytes

16:53 jjl`: dazld: try editing your project.clj to specify clojure 1.6 and see if that fixed anyway

16:54 dazld: ok.. but in general, clojure does not choke when making very large data structures?

16:54 this is just some weirdness that i need to work out, right..?

16:54 jjl`: that isn't "very large"

16:54 dazld: well, its complaining about memory

16:54 jjl`: and i've failed to make clojure choke doing silly things

16:54 dazld: but yeah, as things go, its not that big

16:55 uncompressed images should be no problem...?

16:55 actually thats a dumb question, ignore me

16:55 keep forgetting this is all on top of java

16:55 jjl`: i'm aware of financial institutions doing automated trading on clojure. that's a lot more data than you'll ever process

16:55 dazld: for sure

16:56 Frozenlock: lein repl prints it fine on the shell, but it erases most of it

16:56 Emacs was printing everything into a buffer

16:56 dazld: whats the idiomatic way of creating and manipulating large data sets..?

16:56 Frozenlock: Not printing them in nrepl I suppose. :-p

16:57 dazld: ;)

16:57 jjl`: er... worry less about idiom and more about solving your problem

16:57 dazld: kk

16:58 Glenjamin: jjl`: did you get an answer to your magic map thing?

16:58 jjl`: Glenjamin: i did not

16:58 Glenjamin: i suspect you might be able to (deftype) and extend the Map protocol onto your type

16:58 jjl`: i mean the only other answer i can come up with involves creating a custom ISeq

17:01 grimmulfr: Oh, nvm. I didn;t have to input the actual conversion, I had to input :a :b :c :0

17:03 Glenjamin: is there a variant of (type) that works on primitives?

17:03 ,(type (int 1))

17:03 clojurebot: java.lang.Integer

17:08 dazld: 1024^2 longs should take up 8MB..

17:08 the runtime has ~130MB available

17:10 jjl`: did you try upgrading your clojure dependency in project.clj and see if that fixed things?

17:10 dazld: yep

17:10 same

17:11 jjl`: do you get the same results trying it at java -jar clojure.jar ?

17:11 (i can't imagine why lein would be the problem, but you never know)

17:11 dazld: im sorry, but really a newb with java

17:12 what does that command do?

17:12 jjl`: java is obviously java. -jar says "i'm specifying a jar file" and clojure.jar is a clojure release. you can get one here http://central.maven.org/maven2/org/clojure/clojure/1.6.0/clojure-1.6.0.jar

17:13 it should spin you up a repl

17:13 dazld: awesome

17:13 jplur: Is there a way to print runtime data with atoms so I can inline it as code?

17:14 Without atoms I can do something like (read-string (print-str [:data]))

17:14 jjl`: and what are you writing now?

17:15 jplur: levels for a game jam

17:16 jjl`: i'm trying to understand what the problem is. could you show some code?

17:16 dazld: jjl`: that works fine, great tip

17:16 seems a lot faster too

17:16 Glenjamin: Runtime.gc do something different to a normal garbage collect?

17:16 jjl`: dazld: in that case. please file a bug against leiningen on github

17:17 dazld: same amount of memory available

17:17 sure, will do

17:17 jjl`: https://github.com/technomancy/leiningen/issues

17:17 dazld: you think its definitely a bug?

17:17 jjl`: i think that that should work. it appears to work without lein. whether it's lein's fault is another matter

17:18 but at the very least, someone who knows better than me will be able to help better

17:18 dazld: ill go write it up

17:18 jjl`: please note that it works in the plain clojure repl on your bug report

17:18 dazld: will do

17:19 jplur: jjl`: http://www.pasteall.org/pic/show.php?id=70413

17:20 jjl`: I guess my question is can atoms be used for edn?

17:21 jjl`: jplur: atoms are not part of edn. you can make that work by using deref, try shoving and @ before (atom 6)

17:21 an*

17:21 jplur: jjl`: understood, thanks!

17:21 dazld: https://github.com/technomancy/leiningen/issues/1516

17:22 jjl`: i assume you've simplified the code, but that doesn't need to be an atom at all from what i can see

17:22 dazld: could include the free memory reports too

17:22 jjl`: jplur: oh, it won't work of course, read-str. sorry, half asleep. no, doesn't work in edn

17:23 but by the time it hits print-str, it'll be realised because of the @

17:23 so it'll just be 6

17:28 dazld: thanks

17:29 dazld: np, back to playing ;) thanks for help

17:29 jjl`: yw

18:17 kelseygi: hi i need some help trying to handle something w/o using mutable state

18:18 i will try not to use the word "chunk" too much

18:18 i'm using the twitter-api library to process streaming tweets (https://github.com/adamwynne/twitter-api)

18:18 it takes a callback to handle each, uh….chunk of data

18:19 unfortunately some response bodies are spread across multiple chunks

18:19 i can add a parameter to get the expected length & check across that

18:19 to know whether a given bodypart has the whole response or not

18:19 but i'm not sure how to concatenate multiples ones for processing

18:19 multiple bodyparts

18:20 should i use an atom? that feels sucky

18:20 TerranceWarrior: j #scheme

18:21 jjl`: kelseygi: you could also model it with a promise

18:21 kelseygi: ok, so have the callback i pass in return a promise?

18:22 dbasch: jjl`: that’s definitely not a leiningen bug, dazld was running with a tiny heap

18:22 jjl`: i don't know what mechanism you have for dealing with repeated data

18:22 TerranceWarrior: where can I download locally SICP?

18:23 kelseygi: the callback for handling each chunk of data only takes the response map and the byte string from that chunk :(

18:23 jjl`: dbasch: he didn't know what a heap was. how on earth did he end up running with it set low?

18:23 dbasch: jjl`: probably a bad default

18:23 jjl`: dbasch: i'm running lein on osx and it worked here

18:24 i haven't changed heap size or anything

18:24 TerranceWarrior: nevermind

18:24 dbasch: jjl`: different jvms have different default heap sizes, that’s the first thing you check

18:24 kelseygi: i feel like i'm missing something that the library itself doesn't handle this?

18:25 jjl`: dbasch: *nod* i'm still fairly new to javaland

18:25 dbasch: jjl`: it’s not right to file a bug against leiningen without doing some research first in that case

18:26 jjl`: most likely he was hitting the limits of the default heap size of his jvm while running inside the lein repl but not in a barebones repl

18:27 jjl`: because there was less stuff loaded

18:27 jjl`: yes, that was my assumption when you said it was his default heap size

18:28 dbasch: jjl`: for one, lein uses readline and keeps a history of commands

18:28 jjl`: *nod*, quite sensibly

18:29 i've been spending a lot of time with an orientdb console lately and they didn't appear to be aware readline exists, so it's horrible

18:32 dbasch: jjl`: also, java objects take more memory than you would imagine

18:32 jjl`: and it’s possible that the repl already had earlier results in * variables taking up memory

18:36 kelseygi: if anyone was superconcerned for my fate

18:36 i decided it was a bug in the library and filed an issue and moved on

18:36 haha

18:39 (WITH a repro case before anyone freaks out)

18:43 Glenjamin: should i be using symbols or keywords in my (ns) form?

18:43 i've just noticed the docs show keywords, but my symbols seem to be working

18:45 fifosine: Does anyone have any ideas of why my function might be returning a list within parenthesies when I'm expecting it to just be returning the list?

18:45 Glenjamin: fifosine: can you give some example code?

18:46 fifosine: Glenjamin: http://pastebin.com/3AtPHdhP

18:46 hope it's readable

18:46 The first time the function is called, plan is the empty list

18:46 []

18:47 Glenjamin: i suspect you want your (for) inside the (into)

18:48 fifosine: Why?

18:48 clojurebot: http://clojure.org/rationale

18:48 fifosine: In english, I'm trying to say, "for each clear block, add these functions to the list"

18:48 Glenjamin: because otherwise you're returning the value of the (for)

18:48 when you want to return the accumulated list

18:48 fifosine: ohh

18:48 ok, so what will the expression inside the for be?

18:49 Glenjamin: i think it's the same

18:49 dbasch: fifosine: you probably want to use filter, not for

18:49 Glenjamin: oh, good point ^

18:50 fifosine: actually, I think I want map

18:50 :D

18:50 cause I can grab the clear blocks easily

18:50 I hate that for loops and while loops exist in clojure

18:51 dbasch: fifosine: for is not a loop

18:51 fifosine: what makes it distinct

18:51 from a loop?

18:51 dbasch: fifosine: for one, it’s lazy

18:51 Glenjamin: it's more of a list comprehension

18:51 dbasch: fifosine: it’s list comprehension

18:52 ,(take 5 (for [x (range)] (* 2 x)))

18:52 clojurebot: (0 2 4 6 8)

18:53 Glenjamin: think of it as an expression that declares how to build a list

18:56 ToBeReplaced: how would i execute an arbitrary script (and wait for its completion) before repl or run in leiningen?

18:56 i want to run a script which updates my resources

18:56 so i guess before jar / uberjar as well

18:59 akhudek: ToBeReplaced: I do it the old fasioned way, with a shell script.

19:00 ToBeReplaced: akhudek: right, so if i have a script add_resources.sh, how do i make "lein deps" run "add_resources.sh" first?

19:01 akhudek: ToBeReplaced: There is actually a way to hook into lein’s build process, but I don’t know what it is. I just use a shell script that runs e.g. lein deps && add_resources.sh && lein run

19:01 ToBeReplaced: Maybe not fancy, but it works.

19:09 ToBeReplaced: akhudek: acknowledged... answer for me is to use the "lein-shell" plugin and add a value to :prep-tasks like ["shell" "add_resources.sh"]

19:10 akhudek: ToBeReplaced: ooh interesting. I’ll have to checkout lein-shell sometime.

20:47 brad1: help

20:47 quit

21:02 danlamanna: is there a way to get clojure working with gtk, to create a system tray icon of some type?

21:03 beamso: java has http://docs.oracle.com/javase/7/docs/api/java/awt/TrayIcon.html

21:09 TerranceWarrior: could the dox for using vim with clojure be any more retarded?

21:10 like all lisps before it, installing lispy things is still hard as shit and very poorly documented.

21:13 dbasch: TerranceWarrior: have you tried LightTable?

21:15 TerranceWarrior: dbasch: looking into it

21:16 dbasch: do you need to put the .jar in $PATH?

21:16 for clojure that it?

21:16 for clojure that is.

21:16 dbasch: no

21:17 TerranceWarrior: i want to run the repl from anywhere though.

21:17 dbasch: TerranceWarrior: if I remember correctly, you just create a clojure project and it does the right thing

21:17 you can always go to the project and run lein repl if you need to

21:17 but typically you use LightTable's

21:18 TerranceWarrior: i get this when trying to run cpr from within vim:

21:18 FileNotFoundException Could not locate user__init.class or user.clj on classpath

21:18 : clojure.lang.RT.load (RT.java:443)

21:18 ok

21:21 how do I get the version number of the current repl?

21:21 and where is the dox for such things?

21:22 dbasch: ,(clojure-version)

21:22 clojurebot: "1.6.0"

21:22 TerranceWarrior: hm, my lighttabl is using 1.5.1 how do I upgrade it?

21:23 dbasch: TerranceWarrior: it’s not LightTable, it’s your project

21:23 edit project.clj and change it

21:23 TerranceWarrior: there is no way in hell it's going to know where my clojure.jar is.

21:24 dbasch: TerranceWarrior: you don’t need to

21:24 TerranceWarrior: of course you need to

21:24 dbasch: TerranceWarrior: are you new to clojure?

21:24 TerranceWarrior: yes

21:24 i have the clojure 1.6 .jar is a subdirect 6 foot below.

21:24 dbasch: TerranceWarrior: leiningen manages dependencies such as the clojure version for you

21:24 TerranceWarrior: you’re doing it wrong

21:25 TerranceWarrior: yes, and lein has been pleasent enough to be using 1.5.1

21:25 dbasch: no, i'm not doing anything. something needs to be done.

21:25 dbasch: TerranceWarrior: when you create a project with “lein new” it generates a tree

21:25 inside, there is a file named project.clj

21:25 TerranceWarrior: yes?

21:25 clojurebot: yes isn't is

21:25 dbasch: that file contains your clojure version

21:25 TerranceWarrior: ok

21:25 and?

21:26 dbasch: if you want 1.6.0, just change the setting

21:26 TerranceWarrior: did already

21:26 johnwalker: be nice now

21:26 TerranceWarrior: the operating system and lein have no idea where my clojure jar is located.

21:26 dbasch: TerranceWarrior: you don’t need a clojure jar that you downloaded independently

21:27 TerranceWarrior: dbasch: oh?

21:27 dbasch: TerranceWarrior: lein doesn’t care, it just treats clojure as another dependency and downloads the right jar for each project

21:27 TerranceWarrior: dbasch: did you just want me to use the default 1.5.1 instead?

21:27 hm.

21:27 it didn't appear to.

21:27 dbasch: TerranceWarrior: like I said, change the setting *for that project*

21:27 TerranceWarrior: it's been using 1.5.1

21:27 dbasch: exit lein repl, run it again

21:29 TerranceWarrior: son of a gun.

21:30 ok that worked

21:30 but lighttable is still in the past.

21:30 thanks by the way.

21:30 johnwalker: what do you mean by in the past?

21:31 TerranceWarrior: what I do mean by in the past is it's 1.5.1

21:31 johnwalker: are you trying to build lighttable with 1.5.1?

21:31 sorry, 1.6.0?

21:32 TerranceWarrior: nope just running it as a 64 linux bin.

21:32 johnwalker: so you're saying that lighttable is ignoring project.clj and using 1.5.1 instead?

21:34 TerranceWarrior: i opened project.clj and there is no magic to upgrade.

21:35 johnwalker: what magic?

21:35 TerranceWarrior: 1) start lightpath 2) load project.clj 3) wa lah a file is loaded and (clojure-repl) remains 1.5.1.

21:36 I'm not that intuitive to guess the designers intentions.

21:39 johnwalker: hold on, trying that out

21:43 TerranceWarrior: it's a file, it needs a configuration setting from within lightpath i'd imagine.

21:43 johnwalker: well, lighttable's connection just crashes for me so i dunno man. i just use emacs.

21:45 TerranceWarrior: johnwalker: thanks anyway.

21:45 any vim users in the house tonight?

21:45 SegFaultAX: TerranceWarrior: Voila*

21:46 Also, yes, I'm a vim user.

21:46 johnwalker: sorry

21:46 TerranceWarrior: SegFaultAX: can you agree with me that http://clojure-doc.org/articles/tutorials/vim_fireplace.html is pretty crumby as far as documentation goes?

21:47 SegFaultAX: TerranceWarrior: Contributions are welcome.

21:50 TerranceWarrior: funny how there is no ready documentation to upgraade lein itself on all new projects.

21:51 dbasch: TerranceWarrior: leiningen is really well documented. http://leiningen.org/

21:51 johnwalker: you mean $ lein upgrade?

21:52 SegFaultAX: TerranceWarrior: What's your specific issue with fireplace?

21:54 TerranceWarrior: SegFaultAX: scroll up (if you can) to see my 'cpr' attempt from within vim.

21:54 otherwise i can repaste.

21:56 SegFaultAX: TerranceWarrior: Were you in a clojure project for that? Or were you just editing a file by itself?

21:56 Outside of a clojure project.

21:56 TerranceWarrior: wow, now my vim hangs if i load project.clj.

21:56 brilliant

21:57 SegFaultAX: i believe i had a clojure file loaded, source.

21:57 SegFaultAX: TerranceWarrior: But were you in a clojure project?

21:57 TerranceWarrior: oh i don't know.

21:58 SegFaultAX: TerranceWarrior: I'm going to guess that you probably weren't. That's why you got the above error.

21:59 TerranceWarrior: http://pastie.org/9118490

22:00 It's pretty obvious vim needs to know about the clojure jar.

22:01 I'm tempted to write documentation for all the poor losers after me.

22:02 dreverri: are you running a repl (lein repl)?

22:02 SegFaultAX: TerranceWarrior: First of all, there is no need to be so negative. Second of all, the error message is telling you exactly what you need to do.

22:02 dreverri: the installation section discusses classpath.vim: https://github.com/tpope/vim-fireplace#installation

22:03 SegFaultAX: fireplace is trying to create a repl, but it can't determine the classpath without vim-classpath.

22:03 TerranceWarrior: this is very suiting to me right now: https://www.youtube.com/watch?v=iNwC0sp-uA4

22:03 SegFaultAX: So you can either install that plugin, or manually connect to nrepl.

22:03 patrickod: when using korma is there a neat way to use aliases to refer to related entities ?

22:03 i.e. (belongs-to recipient-user {:fk recipient_user_id :entity user}) L

22:06 TerranceWarrior: wow, it says First, set up [cider-repl][].

22:06 that is telling me authors like, 'meh'. just do it.

22:07 SegFaultAX: ok

22:09 SegFaultAX: TerranceWarrior: fireplace works best in the context of a project.

22:09 TerranceWarrior: SegFaultAX: ok appear to work now. (require command-line-args.core :reload) (clojure.test/run-tests)

22:09 Pthats what I get if I cpr.

22:10 SegFaultAX: Cool.

22:11 cpR for reload-all.

22:12 TerranceWarrior: apparen't i can :Connect

22:12 but I get no astouding feedback from doing so.

22:12 but I get no astounding feedback from doing so.

22:13 SegFaultAX: Try doing `:Eval (+ 1 1)`

22:14 TerranceWarrior: ah sweet.

22:14 works.

22:14 thanks SegFaultAX.

22:15 SegFaultAX: TerranceWarrior: `:help fireplace`

22:16 TerranceWarrior: sweet. Eval (foo 1)

22:16 E149: sorry no help for fireplace

22:17 SegFaultAX: TerranceWarrior: Did you install through pathogen?

22:17 TerranceWarrior: SegFaultAX: yes.

22:18 SegFaultAX: `call pathogen#helptags()`

22:18 `:help fireplace`

22:18 Sorry, that was supposed to be :call

22:19 TerranceWarrior: wow, now it works.

22:19 i am expecting hal9000 to read my lips next. ha!

22:20 johnwalker: sorry, didn't see you.

22:21 SegFaultAX: TerranceWarrior: Add the call to pathogen#helptags to your vimrc after pathogen#infect

22:21 TerranceWarrior: SegFaultAX: that is clearly something that needs documentation flow.

22:23 SegFaultAX: TerranceWarrior: https://github.com/tpope/vim-pathogen#runtime-path-manipulation Last two paragraphs

22:23 You need to learn to read documentation more closely. ;)

22:26 TerranceWarrior: call pathogen#helpstags() is clearly not present. The documentation eludes to it but does not at all give you the proper syntax. so fail.

22:27 SegFaultAX: Well there is the :Helptags shorthand.

22:27 Which he clearly talks about in that paragraph.

22:28 TerranceWarrior: SegFaultAX: Thats like saying context is not important but the word in it only is.

22:30 SegFaultAX: Uh.

22:31 TerranceWarrior: what is this magical beast [cider-repl][]. is this some sort of new devilry?

22:32 '..roam, if you want too... roam around the world.'

22:35 danlamanna: beamso: yeah that does seem to work. surprised there isn't a clojure lib wrapping it.

22:36 beamso: i don't really hear of anyone doing new java desktop development :/

22:36 * pdurbin has heard of a little new javafx development

22:37 TerranceWarrior: SegFaultAX: well, aparently things are working. but the documentation needs improvement. some of it, is rather nervy and anxious because of the implied magicness of it.

22:37 danlamanna: i just want to make a system tray icon to control virtualboxes, sick of that dumb window taking up space.

22:53 TerranceWarrior: can someone parse this sentence for me? "Where possible, I favor enhancing built-ins over inventing a bunch of <Leader> maps."

22:56 tuft: danlamanna: or use vagrant?

22:56 danlamanna: tuft: i have non vagrant virtualboxes. just like knowing which are on/off at a given time.

22:57 tuft: i actually have some abomination of a shell script that shows via conky which are running.

22:57 tuft: ah cool

23:00 TerranceWarrior: Am I correct in saying a REPL won't recieve vim Evals?

23:08 kelseygi: what am i doing wrong here? http://pastebin.com/4XgHbcEp

23:08 i get java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn

23:08 i can't figure out if i'm using "if" wrong, or equality, or the atom, or what

23:11 beamso: shouldn't lines 3 and 5 start with do rather than just a bracket?

23:12 TerranceWarrior: kelseygi: does let need a lamba function?

23:12 because it is an environmental function afaik.

23:12 so wrap it in a function.

23:13 beamso: i thought it was more that reset! returns the new value, so clojure is trying to execute (1 (println ...))

23:13 technomancy: kelseygi: you need to wrap your branches of if in a do block

23:13 dbasch: beamso is correct

23:13 technomancy: (if pred (do x y z) (do a b c))

23:14 oh right

23:14 too slow

23:16 dbasch: technomancy: btw, someone here earlier filed an issue against leiningen because his jvm had a small default heap size (?)

23:17 technomancy: he didn’t know how to increase the jvm heap so he was blowing the repl heap and blaming it on leiningen

23:21 technomancy: dbasch: I think my fellow conspirators are fielding that one decently =)

23:26 kelseygi: ah it's the return value of reset! that makes sense

23:26 lol i was bemoaning ahving to use the atoms cause it's not functional and i neglected the return value there

23:26 thanks beamso & co

23:32 TerranceWarrior: how does one upgrade the version of closure for Lein without having to hack a .clj file?

23:33 dbasch: TerranceWarrior: what exactly do you mean?

23:34 TerranceWarrior: dbasch: I would like 'lein new' or 'lein repl' to default to 1.6.0.

23:37 Jaood: TerranceWarrior: yeah, weird there isn't a release that defaults to 1.6 yet

23:37 a lein release I mean

23:37 TerranceWarrior: use the master branch from github

23:38 TerranceWarrior: Jaood: ok

23:39 Jaood: isn't the zip master?

23:43 Frozenlock: What's the idiomatic way in compojure to get /:the-rest-of-the-path ?

23:45 TerranceWarrior: ha! the git clone version of lein has BUGS.

23:46 technomancy: software with BUGS?!

23:46 Frozenlock: gasp

23:47 dbasch: Frozenlock: get the uri from the request and parse it

23:47 technomancy: inconcieveble

23:47 Frozenlock: dbasch: I think there's a simpler way. https://github.com/weavejester/clout

23:47 "*"

23:47 But I still need to test it

23:48 dbasch: Frozenlock: it depends on what you want the rest of the path for

23:49 Frozenlock: matching a route is not the same as getting the path

23:50 TerranceWarrior: whatever you do, don't exit your repl session with a vim-fireplace hooked it it or else the vim session hangs terribly.

23:50 but this, this is all rather academic.

23:51 ;)

23:55 TravisD: Does anyone know of a library (java or clojure) that has several different random number generators, and ways for sampling from a variety of distributions?

23:56 beamso: maybe http://commons.apache.org/proper/commons-math/userguide/random.html ?

23:57 TravisD: beamso: Cool, thanks. I'll look into it

23:57 beamso: Seems to be exactly what I am looking for. Thanks!

23:59 beamso: not a problem. i haven't used it but there seemed to be more there than using java.util.Random.

23:59 TravisD: Yeah, sounds like it uses java.util.Random by default, but you can swap in other generators if you want

Logging service provided by n01se.net