#clojure log - May 21 2010

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

0:01 Licenser: nice :) now the ident token is faster then the space token

0:05 well thank you all for the help so now I got to go to bed

0:15 mmarczyk: Licenser: see you next time :-)

0:15 (even though it's a bit of a pleonasm ;-))

0:33 Licenser: got a non-regex solution for (re-find basic-identifier-re some-string) which appears to be twice as fast in some cases, need to squeeze it a bit more :-)

0:34 (well actually it is partly regex based at this proof-of-concept stage, but it won't stay this way long)

0:47 tomoj: b

0:47 oops

1:21 mmarczyk: got it down to up to 16x faster, but I am in fact still using regexes... oh well.

1:22 remleduff: Darn ;)

1:26 mmarczyk: actually, I found a bug

1:26 so it's not going to be quite that nice :-(

1:47 Blackfoot: can i use :as in (import)? I want to refer to SomeCrazy$InnerClass as just Inner

1:59 mmarczyk: Blackfoot: nope :-(

1:59 is this for the purpose of calling static methods?

2:00 or for construction etc. too?

2:00 Blackfoot: mostly a static method and it's enums

2:01 mmarczyk: in this case I think I'll plug an answer I posted on SO

2:01 maybe it'll be useful to you

2:01 and I'd love to hear some feedback ("it's insane" etc.)

2:01 Blackfoot: ha, sure

2:02 mmarczyk: http://stackoverflow.com/questions/2852133/clojure-vars-and-java-static-methods

2:02 sexpbot: "Clojure vars and Java static methods - Stack Overflow"

2:02 mmarczyk: it's the accepted answer

2:03 actually it has occurred to me that creating the "gensymed" ns is probably pointless as written there

2:03 I meant to use a dot in the ns name

2:04 (should be "adapter.")

2:07 Blackfoot: mmarczyk: i think i understand it, thought not sure how it would work with the enums. since i'm only using it in a few places, i'll probably use the whole name for now, but try it out if usage grows

2:07 thanks

2:07 mmarczyk: sure

3:07 bartj: hi

3:08 can anyone please tell me the difference between doseq and for in clojure?

3:09 er is anyone there?

3:10 hello?

3:10 clojurebot: BUENOS DING DONG DIDDLY DIOS, fRaUline bartj

3:11 technomancy: bartj: for is lazy, doseq is used for side effects

3:17 bartj: (defn t[i] (for [j i] (println j) (inc i))) - how is this wrong?

3:17 (defn t [i] (for [j i] (println j)))

3:18 technomancy: bartj: "i" would need to be a seq or "for" can't work on it

3:18 and you can't inc a seq

3:18 ,((fn [i] (for [j i] (println j) (inc j))) [1 2 3])

3:18 clojurebot: java.lang.RuntimeException: java.lang.IllegalArgumentException: Wrong number of args passed to: core$for

3:18 technomancy: ,((fn [i] (for [j i] (do (println j) (inc j)))) [1 2 3])

3:18 clojurebot: (2 3 4)

3:19 technomancy: ,(map inc [1 2 3]) ; <= essentially the same thing

3:19 clojurebot: (2 3 4)

3:22 danlarkin: clojurebot: donkeyballs

3:22 clojurebot: Titim gan éirí ort.

3:22 bartj: well that actually returns: (1 \n 2 \n 2 3 \n3 4)

3:22 "\n" = equals

3:22 ,((fn [i] (for [j i] (do (inc j)))) [1 2 3])

3:22 clojurebot: (2 3 4)

3:23 technomancy: bartj: I think the output getting interleaved with the return value is confusing you

3:24 bartj: technomancy: yes

3:24 technomancy: which is why I removed it :)

3:24 technomancy: you don't need the "do" if you're only performing one function call in the body of the "for"

3:25 bartj: technomancy: yes, thanks

3:25 is the usage of doseq instead of "for" purely idiomatic - to indicate that side-effects occur?

3:27 technomancy: bartj: it's more than just a style thing--doseq returns nil, while for returns a lazy sequence

3:27 so side-effects simply don't happen with "for" until the return value gets forced

3:29 bartj: technomancy: thank you so much

3:29 technomancy: sure

3:31 bartj: technomancy: I was confused because the doc string for "for" does not mention anything about the return value. :)

3:50 vegai: hmm, isn't there a simple split function in core?

3:50 (split "a,b,c,d" ",") => [a b c d] sorta thing

3:51 bartj: vegai: you need to use ".split"

3:51 cgrand: ,(vec (.split "a,b,c,d" ","))

3:51 clojurebot: ["a" "b" "c" "d"]

3:52 cgrand: ,(vec (.split #"," "a,b,c,d"))

3:52 clojurebot: ["a" "b" "c" "d"]

3:52 vegai: ah, through Java?

3:52 bartj: yeah - atleast that is what I know

3:53 vegai: thanks

3:53 I'm finally starting to regret that I ignored Java for so many years..

3:55 another one: strip?

3:55 (strip " abc ") => "abc"

3:55 Chousuke: vegai: you only need to learn to read javadoc :(

3:55 :) even :P

3:56 vegai: yea..

3:56 Chousuke: anyway, there's the .trim method

3:56 http://java.sun.com/javase/6/docs/api/java/lang/String.html

3:56 sexpbot: "String (Java Platform SE 6)"

3:56 Chousuke: Those are good to know

3:56 vegai: ah, great. I'll read that

3:57 technomancy: slime inspector will show you the methods at least: C-c S-i

3:58 Chousuke: technomancy: is that a pun of CSI by accident or intentionally? :P

3:58 technomancy: CSI?

3:58 oh, the television show?

3:58 heh

3:58 probably coincidence; I think slime is pretty old

3:59 eevar2: i for inspect, not investigate ;)

3:59 or whatever the csi folks do

4:00 Chousuke: Slime isn't as powerful as the CSI guys' computer systems though.

4:00 I think they zoomed in behind a corner in one episode

4:00 technomancy: yeah, it needs to get ported to visual basic

4:01 so it can be used to create a GUI to track IP addresses

4:01 eevar2: lolpics.se has a few nice csi pictures

4:01 among a lot of nsfw stuff ;)

4:03 rava: There's gotta be a cleaner/more idiomatic way of doing this: http://gist.github.com/408610

4:03 Any thoughts?

4:03 eevar2: http://www.m5board.com/vbulletin/off-topic-forum/151964-csi-lol-pics.html

4:03 sexpbot: "CSI lol pics.. - The Unofficial BMW M5 Messageboard (m5board.com)"

4:04 Chousuke: rava: not using a struct map would be more idiomatic, unless you really need one :)

4:05 rava: also, calling vec on the file list is unnecessary.

4:06 rava: other than that, I think the code

4:06 is perfectly idiomatic

4:06 defn: ^what he said.

4:06 just use a plain vector of maps, no need for the struct-map, unless of course there is ;)

4:06 rava: more like habbit :)

4:07 i'm used to having to declare some kind of data type

4:07 Chousuke: heh

4:08 in Clojure, data types declare themselves ;P

4:08 rava: still getting used to that :)

4:08 hrm, what's the syntax for this: (map #{:fname (.getName %)} (.listFiles (File. *enc-files-dir*)))

4:09 defn: oops

4:09 bartj: , (doc file-map)

4:09 clojurebot: excusez-moi

4:09 defn: you don't want #{}

4:09 you want #()

4:09 rdsr: Also would file-seq on path would be better that (.listFiles ...) ???

4:09 rava: i'm all sorts of hazy on using the % for args

4:09 defn: rdsr: file-seq will recurse subdirectories IIRC

4:09 Chousuke: #{} is set syntax

4:09 rava: erk

4:10 Chousuke: #() is for function shortcuts :)

4:10 rava: lol yes indeed it is../doh

4:10 rdsr: yes

4:20 mmarczyk: you don't need the vec around .fileList

4:21 oh, Chousuke mentioned that already... noticed the moment I hit ret :-/

4:27 rava: Anyone have trouble compiling a clj file in emacs with slime-compile-file?

4:30 defn: not I

4:30 if that's C-k

4:30 I never use the M-x slime-compile-file

4:31 mmarczyk: an alternate version: http://gist.github.com/408622

4:31 defn: rava: im still working on your code

4:32 mmarczyk: i like the destructuring inside the fn inside the fn

4:32 ;)

4:32 mmarczyk: :-)

4:32 defn: i was using a ref in my version

4:32 not as nice as yours :\

4:33 mmarczyk: the file-info-extractors thing is beautiful too

4:33 really nice

4:33 rava: indeed

4:35 mmarczyk: :-)

4:35 defn: mmarczyk: im trying to improve on that, but it's just too good

4:35 damn you, damn you to hell!

4:35 rava: do you see how it all works

4:36 mmarczyk: :-D

4:36 rava: defn: file-info-extractors is fairly straight forward

4:36 mmarczyk: I had a version based on comp, partial, zipmap & juxt, but I thought it was ridiculous

4:37 it's actually shorter, though

4:37 rava: defn: i THINK i've eval'ed the map reduce call, its a bit of black magic for my newbness

4:37 mmarczyk: updated the gist to include it, for weirdness' sake

4:38 defn: rava: do you understand the destructuring

4:39 vegai: mm, split works weirdly

4:39 mmarczyk: plus you could put type hints on % -- #^java.io.File % -- to avoid reflection...

4:39 vegai: ,(vec (.split #"," "aoe, aoecrh,aho,a"))

4:39 clojurebot: ["aoe" " aoecrh" "aho" "a"]

4:39 vegai: oh?

4:39 rava: yar the type hints are a nice touch

4:39 vegai: ,(vec (.split #"|" "aoe| aoecrh|aho|a"))

4:39 clojurebot: ["" "a" "o" "e" "|" " " "a" "o" "e" "c" "r" "h" "|" "a" "h" "o" "|" "a"]

4:39 vegai: aha!

4:40 ,(vec (.split #"\|" "aoe| aoecrh|aho|a"))

4:40 clojurebot: ["aoe" " aoecrh" "aho" "a"]

4:40 vegai: ah, I see :)

4:40 mmarczyk: ohhh, so I have hinted % in the gist :-)

4:40 thought I haven't

4:40 defn: it makes it a bit less concise

4:41 mmarczyk: true

4:41 defn: but it's good auto-documentation :)

4:41 rava: lol, that last one is fairly nuts

4:43 defn: a nice lesson though

4:43 rava: indeed

4:43 defn: the partial zipmap [:foo :bar] is really concise

4:43 rava: the partial zipmap into the rest of the function calls is so very slick

4:44 defn: ;)

4:46 mmarczyk: that's the one thing I *really* miss from Haskell

4:46 all functions taking one argument

4:46 of course as soon as I'm actually writing Haskell

4:46 I hate the fact that it's not a Lisp :-P

4:48 defn: i cant write code in other languages anymore

4:48 i start every single bit of code with (

4:48 especially in ruby:

4:49 mmarczyk: yeah :-)

4:49 defn: (class Foo (def initialize (puts "omg")))

4:49 mmarczyk: I don't recall ever typing an infix expression in a Lisp

4:49 except maybe when mixing up repls with small prompts

4:49 defn: the incanter guys made it possible to do infix

4:50 mmarczyk: but I actually try to write prefix in other languages occasionally

4:50 defn: mmarczyk: how do you do prefix in other languages

4:50 like ruby...how would you do that?

4:50 mmarczyk: oh, you just do it

4:50 then the compiler complains ;-)

4:50 defn: ohhh, heh

4:51 mmarczyk: Haskell is seriously cool in many ways, though

4:51 so I get over the syntax eventually, if I give it some time

4:51 the effect seems regrettably to wear off between sittings ;-)

4:51 defn: i use xmonad -- i will go in and tinker with my config file -- i find some of the syntax awfully ugly, and the monadic stuff is a headache

4:52 mmarczyk: XMonad!

4:52 part of my plan for the summer is to give that a shot

4:52 rava: odd...

4:52 defn: oh man -- do it. you will never look back.

4:52 mmarczyk: heh, I feel like you may be right :-)

4:52 defn: mmarczyk: recipe for success: urxvtd + urxvtc + xmonad

4:52 mmarczyk: but, um, what about a Web browser, say?

4:53 wouldn't it be impractical to have that in the left half of the screen?

4:53 defn: you can resize

4:53 rava: anyone around familiar with compojure?

4:53 defn: M-h makes the left side smaller, M-l does the opposite

4:54 mmarczyk: rava: not really, but I might remember relevant SO questions and the like

4:54 defn: mmarczyk: you can also define layouts for specific windows, so when you start firfox it locks it into the position you prefer

4:54 mmarczyk: you can't even imagine all the stuff you can do with it :)

4:54 rava: xmonad is amazingly cool

4:54 mmarczyk: defn: ohhh, that sounds really good

4:54 rava: check out stumpwm aswell

4:55 defn: mmarczyk: http://devinwalters.com/?page=3

4:55 sexpbot: "'(Devin Walters)"

4:55 rava: like xmonad but written common-lisp

4:55 defn: xmonad will be undoubtedly faster

4:55 rava: (GET "/files" []

4:55 (str (print-json (file-list *enc-files-dir*))))

4:55 mmarczyk: wow -- wow -- wow :-)

4:55 defn: ive used a lot of tiled wms, and xmonad was the only one that kept up with me

4:55 mmarczyk: thanks, for both pointers :-)

4:55 rava: that should be rendered to the :body no?

4:56 it's printing to the log for some reason

4:56 defn: mmarczyk: actually that's sort of useless without something else ill show you...

4:57 mmarczyk: defn: oh? :-)

4:57 rava: actually, lemme bug #compojure on this one

4:57 spariev: ,(doc print-json)

4:57 clojurebot: "clojure.contrib.json.write/print-json;[[x]]; Prints x as JSON. Nil becomes JSON null. Keywords become strings, without the leading colon. Maps become JSON objects, all other collection types become JSON arrays. Java arrays become JSON arrays. Unicode characters in strings are escaped as \\uXXXX. Numbers print as with pr."

4:57 defn: mmarczyk: i have a cheat sheet so you can see what does what at a glance

4:57 just have to find it

4:58 mmarczyk: defn: cool!

4:58 spariev: ,(print-json [1 2 3])

4:58 clojurebot: java.lang.Exception: Unable to resolve symbol: print-json in this context

4:58 defn: brb

4:59 spariev: ,(clojure.contrib.json.write/print-json [1 2 3])

4:59 clojurebot: java.lang.ClassNotFoundException: clojure.contrib.json.write

4:59 mmarczyk: rava: last time I tried Compojure was before 0.4, and then I believe GET expected to get the whole html

4:59 not just the part to go in body

4:59 rava: i just want to return a json string

4:59 mmarczyk: yeah

4:59 no idea why it would print to log instead :-(

5:00 and where does print-json come from?

5:00 rava: clojoure.contrib.json.write

5:00 spariev: hm, it looks like print-json just, well, print it to strout

5:00 mmarczyk: aha!

5:00 :-)

5:01 rava: that doesn't seem to make sense, i mean wouldn't that function make more sense to return a string?

5:01 spariev: rava: try something like (with-out-str (clojure.contrib.json.write/print-json [1 2 3]))

5:02 mmarczyk: or actually

5:03 maybe try write-json

5:03 with a (java.io.StringWriter.) argument

5:04 spariev: btw, I'm using clj-json, wrapper around jackson java lib, it kinda faster by my unscientific measurements

5:04 rava: where are you getting write-json?

5:05 mmarczyk: hm, maybe that's a new thing from 1.2

5:05 json-str then

5:05 much simpler

5:06 and it's in 1.2 also... hm

5:06 vegai: will it be horribly slow to add to a vector one by one in a (dosync...)?

5:07 rava: mmarczyk: print-json is in 1.1 aswell

5:07 Chousuke: vegai: probably.

5:08 mmarczyk: rava: yeah

5:08 json-str should return as string

5:08 rava: there any way to see what threads are running in a repl and kill it?

5:08 mmarczyk: what print-json prints

5:08 so that's what you'd want to put in your route, I guess

5:08 rava: i've a jetty instance running now in my emacs repl and trying to find a way to kill and restart the instance

5:09 mmarczyk: have you got it bound to a Var or sth?

5:10 Chousuke: vegai: or rather, it'll be as fast as adding to a vector one by one, plus the overhead of the STM

5:10 mmarczyk: http://stackoverflow.com/questions/2706044/how-do-i-stop-jetty-server-in-clojure

5:10 sexpbot: "How do I stop jetty server in clojure? - Stack Overflow"

5:11 rava: hmm..

5:11 (GET "/files" []

5:11 ((json-str (file-list *enc-files-dir*)))

5:11 is the route now

5:11 and i'm getting this in log: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn

5:12 spariev: looks like you've got one paren more than needed in ((json-str ...

5:12 mmarczyk: rava: one level of parens too many

5:12 right.

5:12 rava: doh, this is what happens when you're running off of 2 hours of sleep 12 hours ago

5:13 mmarczyk: :-)

5:16 rava: woot

5:16 its silly how long i've been hacking at this ...

5:16 vegai: (for [line (read-lines file)] (println line)) => no output

5:17 what am I doing wrong there

5:17 Chousuke: for is lazy

5:17 use doseq

5:17 vegai: aah

5:18 thank you, again

5:23 bartj: Chousuke: but, the "control" does return after executing "for"? so why is the output of "for" not printed?

5:26 Lajla: ,((set \a \b \c \d) \b)

5:26 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$set

5:26 Lajla: ,((set "abcd") \b)

5:26 clojurebot: \b

5:26 mmarczyk: bartj: presumably it's being run from a script, in which case return values for expressions aren't printed by default

5:27 vegai: ,(.trim " a bc \n ")

5:27 clojurebot: "a bc"

5:27 vegai: ,(map .trim [" a bc \n "])

5:27 clojurebot: java.lang.Exception: Unable to resolve symbol: .trim in this context

5:27 bartj: mmarczyk: ok, is there any way to print them then?

5:27 mmarczyk: or possibly it's a non-final expression in a function

5:28 I mean, a "do"

5:28 possibly implicit

5:28 bartj: sure, wrap them in print :-)

5:28 if you really want to see the Java-ish string representation, then (print (.toString ...))

5:28 ,(.toString (lazy-seq nil))

5:28 clojurebot: "clojure.lang.LazySeq@0"

5:29 vegai: ah, I need to wrap .trim inside a clojure trim

5:29 what's the reason for this again?

5:30 mmarczyk: .foo-style symbols are treated specially only in the operator position

5:31 Chousuke: mmarczyk: you can use str instead of .toString

5:32 mmarczyk: Chousuke: ah, I thought it would force the seq

5:32 not so, apparently

5:32 Chousuke: it's just a wrapper for toString/StringBuilder :)

5:33 mmarczyk: yup, good catch, thanks :-)

5:40 rava: thanks for the help. rest easy everyone

5:50 LauJensen: Hi all

5:50 esj: Good Morning Mr Jensen

5:50 unfo-: (hi)

6:02 angerman: When using the decomp-eigenvalue function from incanter, I get two lists one with the vectors and one with the values.

6:02 How would I get the vector that corresponds to the absolute maximum of the values?

6:03 basically some index-return on the max function

6:03 e.g. vectors = ( v1 v2 v3 v4 ) values = ( 1 2 4 3 )

6:04 ahh. I've an idea, I compute the maximum, interleave them and filter for the one with the maximum value. and then run take 1 on them

6:17 * hoeck just noticed max-key in core

6:17 hoeck: ,(apply max-key second (map vector [:v1 :v2 :v3 :v4] [1 3 4 2]))

6:17 clojurebot: [:v3 4]

6:18 hoeck: but I don't like the packing together the pairs in those solutions

6:19 angerman: well,

6:20 vegai: is there a nice way to update a map so that either a new value is inserted

6:20 or a new value is computed based on the old value if it exists

6:20 Chousuke: vegai: update-in

6:20 (update-in {:a 1} [:a] inc). though you need to handle the nil case separately

6:22 you can define a function called fnil like so: (defn fnil [f val] (fn [x] (if-not (nil? x) (f x) val))) and then do (update-in m [:key] (fnil inc 0))

6:22 vegai: ok...

6:23 and how to coerce a string into a number?

6:23 Chousuke: what kind of a number? :)

6:23 angerman: hoeck: yep, that seems to work, though it takes the last (if multiple ones with the same key) ...

6:23 still kinda ugly :D

6:23 Chousuke: You can use the java static methods: Integer/parseInt etc.

6:23 vegai: Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number

6:24 to make this go away :)

6:24 yeah, that might work

6:25 Chousuke: I still wonder why fnil is not in core. it's very useful.

6:38 LauJensen: silly name though Chousuke, "fnil" :)

6:47 mmarczyk: http://groups.google.com/group/clojure/msg/f251cfd9baab440a

6:47 :-)

6:47 hi Lau

6:50 I've been looking at "Approaching Productivity" again (apparently you're really onto sth with that post ;-)) and noticed that you're not using -> / ->> in your elisp! :-)

6:50 http://gist.github.com/408702

6:51 there. I also have -> & ->> written as r5rs macros somewhere

6:52 I *can't imagine* how I lived without these two.

6:56 defn: wait, what's fnil?

6:57 mmarczyk: see above

6:57 or click the link ;-)

7:00 vegai: .split is weird for working differently based on the type of the first argument

7:00 ,(vec (.split #"," "1,2"))

7:00 clojurebot: ["1" "2"]

7:00 vegai: ,(vec (.split "1,2" ","))

7:00 clojurebot: ["1" "2"]

7:00 vegai: java limitation?

7:01 or what...

7:04 mmarczyk: (.split foo ...) means "call method split on object foo with args ..."

7:04 java.util.regex.Pattern has a difference implementation to that of java.lang.String

7:04 different.

7:07 LauJensen: mmarczyk: hey, sorry for the late reply, my highlighter didn't pick up 'Lau' for some reason

7:07 odd

7:08 ah cool

7:08 mmarczyk: np :-)

7:16 LauJensen: In java terms, what is for(; ;) ?

7:18 hoeck: like while true { }

7:18 an infinite loop

7:18 LauJensen: k

7:18 thx

7:19 Sure is nice to see Clojure atoms based on sun.misc.Unsafe, titled "The Unsafe service"

8:03 defn: mmarczyk: approaching productivity?

8:04 mmarczyk: ah nevermind, you were referring to LauJensen's post

8:04 LauJensen: Chousuke: ping

8:09 Chousuke: LauJensen: pong

8:09 LauJensen: Chousuke: Im thinking of picking up Magit again and was wondering if you would share your top-10 hotkeys, workflow tricks etc ?

8:11 Chousuke: LauJensen: my use of magit is really simple. I mostly just use s/u for stage/unstage and tab to expand files to chunk view so I can stage individual chunks. and then I just commit and sometimes push/change branches

8:12 oh, and k is useful for deleting trash files in the status view as well

8:12 I haven't even tried to do anything more complicated with magit like rebases

8:12 I'm still more comfortable using the git command line UI for those

8:12 * tcrayford loves his rebases

8:13 LauJensen: tcrayford: in magit?

8:13 tcrayford: nah, command line

8:13 -i is essential

8:13 LauJensen: Chousuke: Ok cool, commit is C-c C-c ? and push / pull is ?

8:13 tcrayford: LauJensen: C-h m describes the current mode, then just search for magi

8:13 *magit

8:14 Chousuke: actually "c" commits in the status view

8:14 bozhidar: P is push

8:14 F is pull

8:14 LauJensen: tcrayford: the reason Im asking Chousuke is to avoid the docs and learn first hand from a user

8:14 Chousuke: C-c C-c is just when you're finished typing the message

8:14 LauJensen: Ah ok, Egg copied that bit

8:15 Thanks a lot Chousuke and bozhidar , I'll give it a whirl :)

8:15 Chousuke: if you use menu mode in emacs you can get pretty far by just looking through the magit menus

8:15 * tcrayford is a heretic and uses gitx

8:16 bozhidar: no menus for me :-)

8:16 Chousuke: LauJensen: it's also useful to bind a key to 'magit-status

8:17 LauJensen: I have meta-f12

8:17 LauJensen: F2 is all fired up and ready to go :)

8:17 Chousuke: also I apparently have set magit-save-some-buffers to nil

8:18 LauJensen: Chousuke: Isnt it desirable to have all buffers save once you pull up the status view ?

8:18 Chousuke: well, that depends

8:18 I switch over to the status view so often that it just annoys me

8:20 bozhidar: I have advised switch-to-buffer to save my buffers at switch anyways

8:20 I'm too paranoid about losing changes

8:20 bartj: what is the difference between "->" and "->>"

8:21 LauJensen: bartj: thread as second argument, or last argument

8:21 bartj: ,(doc ->>)

8:21 clojurebot: "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."

8:21 LauJensen: (-> 5 (+ 2)) = (+ 5 2), (->> 5 (+ 2)) = (+ 2 5)

8:21 tcrayford: ,(-> 1 (/ 2))

8:21 clojurebot: 1/2

8:21 tcrayford: ,(->> 1 (/ 2))

8:21 clojurebot: 2

8:23 tcrayford: haha

8:23 `gut status`

8:24 bartj: , (-> 5 (+ 2))

8:24 clojurebot: 7

8:24 LauJensen: ,(print (str \$ "(-> 5 (+ 2))"))

8:24 clojurebot: $(-> 5 (+ 2))

8:24 sexpbot: result: 7

8:25 bartj: , (->> 5 (+ 2))

8:25 clojurebot: 7

8:25 bartj: , (--> 5 (* 2) (* 3))

8:25 clojurebot: java.lang.Exception: Unable to resolve symbol: --> in this context

8:25 bozhidar: for plus the order doesn't really matter

8:26 bartj: , (->> 5 (* 2) (* 3))

8:26 clojurebot: 30

8:26 LauJensen: bozhidar: I know, just thought it would be fun to let clojurebot start off sexpbot

8:26 bartj: , (-> 5 (* 2) (* 3))

8:26 clojurebot: 30

8:27 bartj: , (-> 5 (- 2) (- 3))

8:27 clojurebot: 0

8:27 bartj: , (->> 5 (- 2) (- 3))

8:27 clojurebot: 6

8:27 bozhidar: LauJensen: I noticed your intent, I was saying this because of bartj experiments

8:27 LauJensen: ah

8:27 bartj: there's also tryclojure.org I think

8:27 bozhidar: and SLIME of course ;-)

8:28 a SLIME REPL I meant

8:30 bartj: , (-> 5 (- 2))

8:30 clojurebot: 3

8:31 bartj: , (->> 5 (- 2))

8:31 clojurebot: -3

8:31 bozhidar: bartj: don't flood the channel with your experiments...

8:31 * defn implements http://en.wikipedia.org/wiki/Malbolge in clojure

8:32 LauJensen: defn: wow, cool way to waste your life :)

8:32 defn: LauJensen: :) Just started on it -- I had never heard of Malbolge. I have a feeling this will take me a long..long time. Very interesting though...

8:32 bozhidar: defn: you should proceed with BrainFuck :-)

8:33 defn: bozhidar: Malbolge is way...way harder.

8:33 (IMO)

8:33 bozhidar: defn: you're probably right, I just remember brainfuck was created for a similar purpose

8:34 defn: Malbolge was so difficult to understand when it arrived that it took two years for the first Malbolge program to appear. The program was not even written by a human being: it was generated by a beam search algorithm designed by Andrew Cooke and implemented in Lisp.

8:34 ^lol^

8:34 bozhidar: hahaha

8:34 LauJensen: defn: There's a 99 bottles of beer on the wall program written in Malbolge

8:34 bartj: thanks guys for explaining "->" and "->>"

8:35 defn: LauJensen: no way! Is it in that 99bottles github repo?

8:35 LauJensen: http://99-bottles-of-beer.net/language-malbolge-995.html

8:35 sexpbot: "99 Bottles of Beer | Language Malbolge"

8:35 defn: Oh...my...God...

8:35 LauJensen: but it looks like a Perl version, just with changed names

8:35 bartj: is there any use-case (experiment) you can think of for "->>"

8:35 defn: LauJensen: yeah that looks awfully perl-esque

8:36 tcrayford: bartj: if you're nesting lots of filter/map/reduce calls, ->> is useful

8:36 LauJensen: ,(->> (range 10) (filter odd?) (map inc))

8:36 clojurebot: (2 4 6 8 10)

8:36 defn: I wonder if that crypto puzzle outside of the NSA could be solved with malbolge...

8:36 Krypto, is it?

8:37 LauJensen: Malbolge, much like Perl, does not solve problems it creates them

8:37 tcrayford: I find that that above form easier to read than the nested version

8:37 defn: LauJensen: *chuckle*

8:37 tcrayford: really? I rather like the nested version to be honest...

8:37 tcrayford: defn: I prefer using ->> a lot of the time

8:38 defn: tcrayford: I write everything nested, and then i use clojure-refactoring where it makes sense ;)

8:38 tcrayford: defn: you're actually using clojure-refactoring on stuff? cool.

8:38 bartj: can some one tell me why I cannot do this: "->>"

8:39 I get a "Unable to resolve symbol" on my system

8:39 tcrayford: you just entered ->> at the repl?

8:39 bartj: do I need to check the version of my clojure installation?

8:39 I mean on my system

8:39 tcrayford: bartj: use *clojure-version*

8:39 bartj: :major 1

8:39 tcrayford: and minor?

8:40 defn: tcrayford: yeah i include it on all my little projects -- it's cool to use it on code i wrote all nested that contains java interop

8:40 it's like...oh yeah.../that's/ what I meant

8:40 tcrayford: defn: are you unit testing that? I know refactoring-mode blows up occasionally

8:41 defn: tcrayford: it does occasionally explode and delete the preceding sexp or some craziness, but that's what C-_ is for :)

8:41 bartj: :minor 0

8:41 {:interim true, :major 1, :minor 0, :incremental 0, :qualifier ""}

8:41 defn: ->> isn't in 1.0 is it?

8:41 tcrayford: defn: if you find stuff when it does eplode (and you're ok posting the code somewhere), then message me on github with what broke

8:42 nope

8:42 defn: that's a 1.1.0 isn't it?

8:42 tcrayford: pretty sure

8:42 defn: yeah

8:42 bartj: so I need to upgrade that's all, right?

8:42 tcrayford: defn: I'm more than welcome for bug reports, apart from those that involve the newline problem

8:43 defn: tcrayford: yeah i'll definitely do that, i should have been doing that all along, but i assumed you were aware, and i had been using your major mode which you stated you were trying to boil down to a minor mode so I figured it was just known beta limitations

8:44 tcrayford: defn: the other thing is that I'm considering moving refactoring-mode so that it changes files on disk instead of doing stuff with emacs. You got any thoughts on that?

8:45 defn: well, like I said, being able to just step back and undo in case something naughty happens is nice, and it's neat to see how something will look threaded and then just step back out of it

8:45 i think for certain operations disk probably makes more sense, but for others maybe not, you know?

8:45 tcrayford: defn: aye. The problem with doing stuff on disk is that I'd need to rework how undo works

8:46 bartj: tcrayford: I just need to upgrade right?

8:46 defn: bartj: yes

8:46 to 1.1.0

8:46 bartj: cool, thanks

8:46 tcrayford: defn: I'm considering doing it for all the refactorings, to get rid of the newline problem

8:46 defn: tcrayford: im assuming that's where, wherever a \n exists, it explodes?

8:46 tcrayford: defn: yeah

8:47 it doesn't explode hugely, it just prints the \n as an actual newline in emacs

8:47 defn: that's sort of a surprise that you cant get around that

8:48 what's the issue in making that work correctly?

8:48 (if you dont mind me asking)

8:48 tcrayford: how I move data between emacs and clojure

8:48 defn: ahhh, do you remove the \n's and treat it like a one-liner sexp?

8:48 tcrayford: go look at the tests

8:48 defn: looking now...

8:50 tcrayford: the real downside of disk stuff is that I'd have to work out some system of stubbing out the filesystem AND namespaces so that I could test it. I'd hate to not have tests for this kinda stuff :/

8:50 defn: yeah tests here are crucial

8:52 tcrayford: and the whole having undo be a seperate function thing :/

8:52 defn: yeah, makes the problem harder... refactoring libraries are /hard/

8:52 you're a braver man than me

8:52 tcrayford: heh, I've been putting off doing the rename refactoring for *ages* because of this

8:53 defn: hehe, yeah i knew someone who was working on a refactoring library for ruby, and he got rename done, but...that's it

8:53 lol

8:53 tcrayford: renames are damn near impossible in ruby anyway

8:54 defn: ive often wondered if turning ruby into s-exps would make refactoring "easier"

8:54 tcrayford: people have done it, but its still pretty much impossible in certain situations

8:54 defn: yeah

8:55 tcrayford: like, given three classes, A B & C, where A & B both have method "foo", and class C calls "foo" somewhere. If you want to rename foo from inside C, how do you know to rename A or B

8:56 defn: gotta follow those singletons to hell and back

8:57 but the context there could change everything, sure

8:57 tcrayford: yep

8:57 * defn bangs his head on his desk

8:57 * defn hires rhickey to refactor for him full time

9:00 tcrayford: defn: atm I'm going to work on having rename-fn refactor to disk, and see how that goes

9:00 defn: tcrayford: so without knowing how all the pieces fit together, could a "perfect" anti-pprint library of some sort be useful?

9:01 in order to get it into a more malleable form prior to transform?

9:01 tcrayford: maybe

9:02 I think clojure.pprint works well enough for me right now

9:02 defn: i just look at what little ive done with the pprint lib for reformating long one-line sexps

9:02 and i wonder about doing the opposite

9:02 tcrayford: what I *really* need is a clojure-reader that tags every sexp with metadata of offset from the start of the sexp (in the string)

9:03 defn: yell at hiredman and Chousuke :)

9:03 tcrayford: mm?

9:03 defn: ive just been told they're the reader gurus

9:03 tcrayford: I think its a lot of work, so meh for now

9:04 defn: perhaps they'd have a suggestion to some successful end

9:04 tcrayford: perhaps

9:04 chouser showed me how to use the compiler to get all bound vars out of a sexp the other day, is pretty cool

9:05 defn: tcrayford: yeah, either way, i have to say: great work. these are the sorts of projects (refactoring) that can make a tremendous difference in a language.

9:05 tcrayford: whoa. that is cool.

9:05 that's mad scientist talk, even.

9:05 :)

9:05 tcrayford: defn: the problem is that you have to use eval, and that makes it pretty messy

9:05 bartj: one newbie question: why is it called "s-expression", I always thought clojure statements were just "expressions"

9:06 defn: bartj: bartj http://en.wikipedia.org/wiki/S-expression

9:06 sexpbot: "S-expression - Wikipedia, the free encyclopedia"

9:06 Chousuke: I think technically clojure expressions are a superset of s-exprs

9:06 tcrayford: seeing as they use things other than lists

9:07 chouser: tcrayford: wait, what requires using 'eval'?

9:07 tcrayford: chouser: that compiler analysis thing used eval

9:07 ,(->> (clojure.lang.Compiler/analyze clojure.lang.Compiler$C/EVAL

9:07 '(let [a 3 b 4] a)) .fexpr .methods first .locals keys (map #(.sym

9:07 %)))

9:07 clojurebot: EOF while reading

9:07 tcrayford: fail

9:08 chouser: that's not using eval

9:08 tcrayford: so when I run it, why do I get a warning about replacing vars in whatever namespace I run it in?

9:08 chouser: ah. yes, well...

9:08 tcrayford: if its analysing a `def` form

9:08 defn: btw, maybe this is a ridiculous question considering how long ago it was, but are there any videos of McCarthy's lecture when he presented lisp?

9:09 like of the actual black and white presentation?

9:09 chouser: The compiler analysis phase does define vars, though it doesn't bind any values to them.

9:09 tcrayford: chouser: right, which ended up being problematic a lot of the time

9:09 chouser: I can believe that. hmph.

9:10 you can bind *ns* to something throw-away...

9:10 meh. I wonder if anything cleaner can be done for c-in-c.

9:10 tcrayford: I hope so

9:11 refactoring-mode does something similar (but I do the analysis myself, using recursion), which would be much better done via talking to the compiler

9:11 chouser: I believe it's done so that the definition of the var can refer to the var being defined.

9:12 but ... actually, I wonder if that's even necessary anymore.

9:13 tcrayford: I'm looking forward to c-in-c for this kinda stuff, should make it a bit easier to understand

9:13 chouser: yes

9:13 I think the next step, or at least the one I'd like to see, is a tool to convert a CompilerExpr tree to a tree of defrecord objects

9:14 tcrayford: are there actual plans for c-in-c yet, or is thinking about that on hold until 1.2 is released?

9:14 chouser: specifically, a tree of records that rhickey approves as being the official target for cinc when it is implemented.

9:15 once such a converter exists (and its output documented), work could proceed independently on both a analyzer producing that format using clojure instead of java code, and also various tools using that tree

9:16 defn: tcrayford: i know there's been talk about c-in-c for the last few months -- specifically i remember rich or someone close to the action saying "soon"

9:16 chouser: tools that could include emitters for other host platforms, lint-like tools, other code analysis tools, etc.

9:16 tcrayford: yep. I'm interested in writing a lint tool as well

9:18 chouser: the only reason I'm not working on a converter is because I'm supposed^W working on a book.

9:18 tcrayford: the joy of clojure has been a pretty good read so far though

9:18 chouser: great, glad you're enjoying it.

9:21 defn: chouser: ditto to tcrayford's comment -- lots of the right kind of depth

9:21 * defn kisses your buttocks

9:21 tcrayford: chouser: also I'm finding on lisp to be *really* good, even if it is in common lisp

9:21 chouser: yes, "on lisp" is solid.

9:22 tcrayford: though bits of it keep on flying over my head, I think I'm on my third go through now

9:22 chouser: before reading that, I wasn't sure why lisp was so venerated. After, I knew: I must have macros.

9:23 defn: before PG became Mr. 2.0

9:23 tcrayford: is there a way to create a var on the fly?

9:24 defn: like...gensym you mean?

9:24 or lower level?

9:25 tcrayford: no, something like (var 'foo), that actually returns a var object that I've just made

9:25 defn: oh, no idea..

9:25 tcrayford: oh, you can do it with var

9:25 bartj: chouser: I wrote a glowing review of your book here: http://rubylearning.org/class/mod/forum/discuss.php?d=3839

9:25 sexpbot: "A Ruby Learning Hub: Login to the site"

9:25 tcrayford: ,(var foo)

9:25 clojurebot: java.lang.Exception: Unable to resolve var: foo in this context

9:25 chouser: tcrayford: with-local-vars

9:26 writing that section this week.

9:26 bartj: chouser: Thank you a million times. I just love your book a million times (compared to Programming Clojure)

9:26 chouser: bartj: wow! thanks!

9:27 lpetit: bartj: Programming clojure starts to show its age, but for what I've read of it (a quarter, maybe), it's very well written. (I have not yet read chouser's one, though ;-) )

9:28 tcrayford: http://gist.github.com/408827 for some reason defining that var on the fly always ends up with it on a line of 19

9:28 bartj: lpetit: If I had money, I would pay you to go read it right now. Seriously.

9:29 chouser: first chapter is free. :-)

9:29 bartj: chouser: have you written any other books? :)

9:29 chouser: ha! no.

9:29 bartj: chouser: and your co-author fogus?

9:30 chouser: sorry, laughing was probably rude. This is hard work.

9:30 no, this is Fogus's first as well

9:31 * tcrayford has been debating writing something like "on clojure"

9:31 bartj: chouser: I profusely apologize...I was just being greedy and cheeky to read all your books...Sorry again...

9:31 chouser: oh, please don't apologize.

9:32 bartj: chouser: like i said, i just wanted to read your other books...I was so impressed by your "Joy of Clojure" book. That is all.

9:32 bozhidar: chouser: when is the book expected - I don't see it for preorder on amazon

9:33 tcrayford: bozhidar: see manning.com

9:33 (which, funnily enough uses yahoo store)

9:34 bozhidar: fall 2010 - not very specific :-)

9:34 defn: it's on amazon?

9:34 i thought it was only available via manning?

9:34 chouser: bartj: it was a perfectly reasonable question.

9:34 bozhidar: defn: it's not

9:34 chouser: bartj: so, do I need an enrollment key to read that link you posted?

9:35 bartj: chouser: is it ok to post it here?

9:36 Anyway, the enrollment key is: BPCE101

9:36 chouser: I was just curious to see what you said, but it doesn't seem to let me.

9:36 tcrayford: chouser: I can gist it if you want

9:36 defn: chouser: actually, i dont know if you have any interest -- but there are quite a few "students" in rubylearning who post quite regularly. it's kind of a mixed bag, but im sure some of the folks would appreciate a cameo from the famous chouser :)

9:36 tcrayford: when I get rubylearning's terrible website working

9:37 bartj: tcrayford: can you gist the full page?

9:39 chouser: well, I'm giving up for now. Can't seem to get anything beyond "This course is not enrollable at the moment"

9:39 tcrayford: chouser: yeah, the course has started an all

9:39 bartj: shouldn't there be more exercises than week 1?

9:39 defn: chouser: it's a really poor site

9:40 bartj: tcrayford: I am afraid, I don't understand

9:40 tcrayford: on the rubylearning course?

9:41 defn: I am afraid also

9:41 tcrayford: I only see exercises for week 1 (which I completed ages ago), and I was under the impression that there were more weeks than that

9:41 defn: tcrayford: yeah i thought so too :\

9:41 tcrayford: chouser: http://gist.github.com/408841

9:41 defn: Michael Fogus will be online on our forum from 25-27 May 2010 to answer questions related to Clojure and his forth-coming book "The Joy of Clojure".

9:41 ah, cool

9:42 bartj: tcrayford: yes there are

9:42 tcrayford: bartj: really? how do I get to them??

9:42 oh, got it

9:42 bartj: er, you need to be enrolled in the course

9:42 tcrayford: I am

9:42 I'm debating dropping out though, the site is *so* bad

9:43 chouser: nice, thanks.

9:43 bartj: er, sorry guys may be it is just my taste but, I liked the site!

9:44 tcrayford: I'm not so worried about the looks, just the fact that navigating around it is really annoying, and working out what's going on on the course is annoying

9:45 bartj: tcrayford: you go here http://rubylearning.org/class/course/view.php?id=53 - which gives you a nice overview

9:45 sexpbot: "A Ruby Learning Hub: Login to the site"

9:45 tcrayford: bartj: see, when I clicked the link to the course I only ever got to week 1's stuff

9:46 bartj: beats me. i see four weeks listed here

9:46 tcrayford: yeah, that link you gave me has 4 weeks, but when I clicked on the link to the clojure course from the homepage I only ever got to week 1

9:47 Chousuke: Someone needs to invent a device to control the sun's heat. I'm melting here ;/

9:47 tcrayford: I think I'll learn more from working through "on lisp" anyway

9:48 Chousuke: and it's "only" 26 degrees celsius

9:48 bartj: tcrayford: can you post the link here please?

9:48 tcrayford: bartj: it seems to be fixed now, maybe I was doing something wrong before

9:49 defn: tcrayford: it's polite to stay on the list and help people out from time to time -- there are some pretty 'green' folks on there who have a real desire to learn clojure -- the more we can do to encourage them the better :)

9:50 im preaching a bit, and it's not really directed at you, more of a PSA than anything

9:50 although i think this community has had the right feeling from day one

9:51 tcrayford: I'm pretty lazy with sticking to stuff like that course atm, I prefer learning from myself/friends/colleagues/this channel

9:51 defn: tcrayford: yeah same here, but again, not everyone has been on IRC for 10 years, and some even find it scary or intimidating

9:52 gotta keep that human connection alive! :)

9:52 tcrayford: defn: I've only really been on irc for a couple of months

9:52 defn: really? i've been on IRC since I was...gosh...13

9:52 esj: defn: truedat, as an 'eager green' I'm most grateful for the skilled in this channel

9:52 defn: esj: it's difficult i think to learn the irc cultural dynamic

9:52 tcrayford: defn: I've only been into programming a couple of years, and the first year and a half were spent in hermit mode

9:53 defn: some folks pour their heart out on irc and get discouraged when everyone doesnt fall over to explain every detail -- i remember asking questions in #c and #c++ and basically getting laughed at

9:53 tcrayford: not to mention #emacs and #git :/

9:54 defn: the first "good" experience I had on irc was in #ruby-lang -- i'd actually say (surprisingly) that the culture on IRC has really matured over the last few years in particular

9:54 i think people finally got hip to the fact that helping other people learn about their favorite things was as beneficial to them as it was to the people they are helping

9:54 s/are/were

9:55 esj: yup, until you've explained it, you don't understand it

9:55 underdev: yeah, fr33n0de rulzrz!

9:55 defn: but then again, i used to be on EFnet -- freenode is a whole 'nother animal of irc

9:55 underdev: ;)

9:55 * defn loads up his botnet

9:56 esj: careful, you'll make CB and SB jealous

9:57 bartj: how do I know which function belongs to which library?

9:58 for example on my REPL, it says "Unable to resolve var" when I use the "re-split" function

9:58 tcrayford: (find-doc "re-split")

9:58 ,(find-doc "re-split")

9:58 clojurebot: nil

9:58 bartj: er, nil?

9:59 tcrayford: try that at a repl

9:59 bartj: yes did that

9:59 tcrayford: I get a printout of re-split

9:59 bartj: have currently loaded both clojure.jar and clojure-contrib.jar on the classpath

10:01 tcrayford: (vals (apply merge (map ns-publics (all-ns)))) gets you a list of all the vars currently loaded (I think), and you can go through it using filter

10:01 ,(filter #(.contains % "re-split") (map #(.toString %) (vals (apply merge (map ns-publics (all-ns))))))

10:01 clojurebot: ()

10:03 bartj: tcrayford: get an empty list

10:04 defn: ,(ns-public 'clojure.core)

10:04 clojurebot: java.lang.Exception: Unable to resolve symbol: ns-public in this context

10:04 defn: ,(ns-publics 'clojure.core)

10:04 did i break clojurebot? :X

10:04 tcrayford: defn: clojurebot will timeout that, (I think)

10:04 ,(+ 1 1)

10:05 defn: uh oh...

10:05 tcrayford: haha

10:05 * defn hides

10:05 defn: ,*clojure-version*

10:05 tcrayford: that's funny, because ns-publics on clojure.core doesn't take any time whatsoever here

10:05 defn: yeah i've done it in here before i think

10:06 hiredman: I think clojurebot choked...

10:06 arkahn: $(ns-public 'clojure.core)

10:06 sexpbot: clojure.core

10:07 tcrayford: $(ns-publics 'clojure.core)

10:07 defn: $(ns-publics 'clojure.core)

10:07 sexpbot: clojure.core

10:07 clojure.core

10:07 defn: whaaaa?

10:07 bartj: defn: was my question the culprit?

10:07 arkahn: $(filter #(.contains % "re-split") (map #(.toString %) (vals (apply merge (map ns-publics (all-ns)))))) ;credits tcrayford

10:07 sexpbot: DENIED!

10:07 spariev: defn, the bot crusher :)

10:08 defn: lol -- i want that for my official title

10:08 ,(+ 1 2)

10:08 man he is really dead...surprising

10:08 clojurebot is battle-tested, mother approved

10:09 bartj: off home, while clojurebot someone administers CPR

10:10 defn: bartj: wanna wait one second so i can answer your question before you go?

10:10 tcrayford: defn: put an issue on hiredman's github repo for clojurebot

10:10 bartj: defn: definitely!

10:10 * defn loads up his repl

10:12 clojurebot: {sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, val #'clojure.core/val, chunked-seq? #'clojure.core/chunked-seq?, find-protocol-impl #'clojure.core/find-protocol-impl, vector-of #'clojure.core/vector-of, object-array #'clojure.core/object-array, *compile-path* #'clojure.core/*compile-path*, max-key #'clojure.core/max-key, lis

10:12 3

10:12 defn: haha!

10:12 clojurebot: {:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"}

10:12 tcrayford: he lives!

10:12 defn: clojurebot: welcome back!

10:13 clojurebot: 2

10:13 Excuse me?

10:13 * arkahn puts away his goblin jumper cables

10:14 bartj: defn: ?

10:14 defn: ,(ns-publics 'clojure.core)

10:14 sorry all, just testing again to make sure it wasnt just lag on clojurebot's side

10:15 tcrayford: ,(+ 1 1)

10:15 yeah, seems to be dead

10:15 I'm surprised clojurebot doesn't fire up a thread for every request

10:15 defn: yeah... anyway, bartj -- tcrayford's advice is good

10:16 (map ns-publics (all-ns)) should give you all the functions in all the namespaces

10:16 tcrayford: defn, don't forget to apply merge to that

10:16 defn: oh right

10:17 bartj: (apply merge (map ns-publics (all-ns)))

10:17 run that at your REPL

10:17 bartj: defn: yes

10:17 defn: bartj: or if you just want to see all of the functions, without their namespaces you could do:

10:18 clojurebot: {sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, val #'clojure.core/val, chunked-seq? #'clojure.core/chunked-seq?, find-protocol-impl #'clojure.core/find-protocol-impl, vector-of #'clojure.core/vector-of, object-array #'clojure.core/object-array, *compile-path* #'clojure.core/*compile-path*, max-key #'clojure.core/max-key, lis

10:18 2

10:18 bartj: defn: I can't find "re-split" function listed when I do that

10:18 AWizzArd: A clojure fn similar to the (get ..) map, but which returns the key/value pair, and not only the value?

10:18 defn: (map str (map first (apply merge (map ns-publics (all-ns)))))

10:19 tcrayford: AWizzArd: I don't know of any, but you can write one pretty easily

10:19 defn: (sort (map str (map first (apply merge (map ns-publics (all-ns))))))

10:19 bartj: are you still on 1.0?

10:19 bartj: no 1.2

10:19 AWizzArd: tcrayford: without iterating over the collection?

10:20 bartj: {:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"}

10:20 tcrayford: AWizzArd: yeah

10:20 AWizzArd: tcrayford: how?

10:20 defn: bartj: weird.

10:20 tcrayford: (defn a-clojure-fn [k mp] (conj [k] (k mp)))

10:20 defn: bartj: how are you running your REPL?

10:20 bartj: defn: java -cp "clojure/clojure.jar:clojure-contrib/target/clojure-contrib-1.2.0-SNAPSHOT.jar" clojure.main $1

10:20 tcrayford: (a-clojure-fn :foo {:foo 1}) ;; ouputs [:foo 1]

10:21 AWizzArd: tcrayford: that does return the k which I provided, which will be = but not identical.

10:21 I want something that is identical to the key, not just =

10:21 tcrayford: ,(identical? :foo :foo)

10:21 clojurebot: true

10:22 tcrayford: keywords are interned (so it works for keywords anyway)

10:23 bartj: defn: I am leaving now

10:23 AWizzArd: tcrayford: what if my keys are strings or instances of defrecords?

10:23 bartj: bye and thank you all very much guys! you guys are awesome. seriously.

10:23 AWizzArd: (identical? (MyRecord. 1 2 3) (MyRecord. 1 2 3)) ==> false

10:23 tcrayford: strings are fine though

10:23 AWizzArd: or when my keys are java.util.Date instances?

10:24 defn: i have no idea why he doesnt have split-with

10:24 tcrayford: yeah it doesn't work all the time. I don't think there's anything that I know about in clojure that does that

10:24 hoeck: AWizzArd: what about find?

10:24 AWizzArd: hoeck: ah yes, that was the fn I was looking for.

10:24 I keep forgetting it.

10:24 * tcrayford learns something new

10:25 defn: wait wait, what do you mean find?

10:25 tcrayford: ,(find {:foo 1} :foo)

10:25 clojurebot: [:foo 1]

10:25 defn: ahhhhh i see

10:26 hoeck: ,(meta (first (find {(with-meta 'a {:meta :t}) :a} 'a)))

10:26 clojurebot: {:meta :t}

10:26 hoeck: find returns the maps MapEntry, so it preservers key metadata

10:26 *preserves

10:28 AWizzArd: for me it is important that I get the key which sits in the map, and with find I can do that

10:28 ,(let [d1 (java.util.Date.), d2 (java.util.Date.), m {d1 10}] [(= d1 d2) (identical? d1 d2)])

10:28 clojurebot: [true false]

10:29 AWizzArd: I can not just say [d2 (get m d2)], because I need it to be d1

10:29 (find m d2) ==> [d1 (get m d1)]

10:30 hoeck: do you know if find is O(1)?

10:30 defn: ,(+ 1 2)

10:30 clojurebot: 3

10:30 hoeck: its the same O as get

10:32 defn: would someone else try the ns-publics thing and see if it behaves the same?

10:32 AWizzArd: hoeck: ok fine, that makes sense

10:32 tcrayford: ,(ns-publics 'clojure.core)

10:32 ,(+ 1 2)

10:32 defn: k just checking. my nick is 'defn' so i just wanted to make sure that had absolutely nothing to do with it

10:33 i dont know why it would but well...it's a keyword so

10:33 tcrayford: defn: have you reported that on clojurebot's repo yet?

10:33 defn: yeah just did

10:33 i just wanted it to be properly tested before i reported intermittent lag as an issue

10:34 * defn somehow always feels guilty about submitting bug reports

10:34 tcrayford: its better for people to know about it than not, even if nowt gets done

10:35 defn: yeah i know that deep in my hacker heart

10:35 but i still hate being the bearer of bad news :)

10:35 tcrayford: so that's why you haven't bug reported much on refactoring :P

10:35 defn: :D

10:36 you're going to be singing a different tune when you wake up to 100 emails from github tomorrow ;)

10:36 tcrayford: I'll be happy with that

10:36 I don't actually use refactoring-mode very much, so I don't see many bugs

10:37 defn: tcrayford: i cant say i use it /all/ the time -- once there is a minor mode id use it all the time

10:37 tcrayford: defn: coming right up

10:40 clojurebot: {sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, val #'clojure.core/val, chunked-seq? #'clojure.core/chunked-seq?, find-protocol-impl #'clojure.core/find-protocol-impl, vector-of #'clojure.core/vector-of, object-array #'clojure.core/object-array, *compile-path* #'clojure.core/*compile-path*, max-key #'clojure.core/max-key, lis

10:40 3

10:40 tcrayford: defn: what key are you binding to refactoring-mode's menu?

10:43 I'm going with "C-c C-r" for the moment

10:43 defn: see github for a minor mode

10:45 Licenser: mmarczyk: neat code for the ident thing!

10:46 tcrayford: Licenser: see the issue on clojurebot regarding ns-publics and clojure.core. Not sure if that's your end or hiredman's though

10:47 Licenser: tcrayford: hiredmans since he does not use clj-sandbox ;)

10:47 tcrayford: ah, k

10:47 we had a 7 minute lag with clojurebot earlier doing that

10:48 Licenser: oha

10:48 can you try that with sexpbot?

10:48 tcrayford: not sure how to invoke sexpbot

10:48 Licenser: $(+ 1 1)

10:48 sexpbot: result: 2

10:48 tcrayford: $(ns-publics 'clojure.core)

10:48 sexpbot: clojure.core

10:48 Licenser: $(+ 1 1)

10:48 sexpbot: result: 2

10:48 Licenser: hmm I see no lag

10:48 tcrayford: that's not even the right result for ns-publics

10:49 Licenser: :P

10:49 tcrayford: ,(ns-publics 'clojure.core)

10:49 (this will take a while)

10:50 Licenser: hmm it should time out usually

10:50 tcrayford: doesn't in this case

10:50 that expression executs instantly at the repl though

10:50 /s/excuts/executes

10:51 Licenser: hmm then it will be likely a clojurebot issue

10:51 tcrayford: yeah, I'll talk to hiredman next time he's aboot

10:51 though sexpbot fails with it as well (as seen earlier)

10:52 Licenser: $mail Raynes Why does sexpbot not return the right result for $(ns-publics 'clojure.core)?

10:52 sexpbot: Message saved.

10:52 tcrayford: that's neat

10:53 $mail hiredman Why does clojurebot take ages (but not time out) when running ,(ns-publics 'clojure.core)?

10:53 sexpbot: Message saved.

10:53 Licenser: ,(loop [i 1] (recur (inc i)))

10:54 $(loop [i 1] (recur (inc i)))

10:54 chouser: oops

10:54 sexpbot: Execution Timed Out!

10:54 tcrayford: chouser: oops?

10:54 Licenser: hmm sexpbot times out

10:54 chouser: $(Thread/sleep 20000)

10:54 sexpbot: DENIED!

10:54 Licenser: then again clojurebot isn't back from the ns stuff

10:54 chouser: *sigh*

10:54 tcrayford: no its not

10:54 :/

10:55 Licenser: chouser: I wrote that sandbox so simple tricks as sleep don#t work :P

10:55 chouser: I was thinking that sleep was a gentler test

10:55 useful for playing with thread-interaction stuff besides

10:57 clojurebot: {sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, val #'clojure.core/val, chunked-seq? #'clojure.core/chunked-seq?, find-protocol-impl #'clojure.core/find-protocol-impl, vector-of #'clojure.core/vector-of, object-array #'clojure.core/object-array, *compile-path* #'clojure.core/*compile-path*, max-key #'clojure.core/max-key, lis

10:57 chouser: but since you can't use agents or futures either, I guess it doesn't matter.

10:57 clojurebot: Execution Timed Out

10:57 tcrayford: that was around 8 minutes again

10:57 :/

10:57 timing out with loop works fine though

10:58 chouser: do you have any tips for reading on lisp? I've been struggling to understand some of the stuff in there

10:58 chouser: tcrayford: hm, none that I can think of. Maybe I should try reading it again.

10:58 tcrayford: did you just read it like a novel?

10:59 chouser: I think I read it on my palm device.

10:59 Licenser: tcrayford: I have the feeling that it is a formating thing

11:00 chouser: which has since died

11:00 presumably that's unrelated

11:00 jweiss: cemerick: i am still trying to figure out what's wrong w my clutch view server. put in some extra debugging to print out stuff - does this mean anything to you: No implementation of method: :read-json-from of protocol: #'clojure.contrib.json/Read-JSON-From found for class: nil

11:00 tcrayford: chouser: maybe it couldn't handle the power of lisp :/

11:01 I have myself a printed copy, which is somewhat better, but its still hard work to actually understand everything

11:01 Licenser: see you later

11:02 chouser: toward the end I might have given up trying to understand every example in detail, just trying to understand the gist. It's been a while, I'm not sure.

11:02 tcrayford: aye, I don't really struggle until he gets to the query compier

11:02 s/compier/compiler

11:03 and then the continuations and prolog stuff goes over my head

11:18 notsonerdysunny: http://clojure.pastebin.com/6ymswkty

11:18 I am a newbie to clojure and java

11:18 I am trying to get slime and clojure working

11:19 I saw the errors and realize that it is not looking for the clojure.jar in the correct directory ..

11:19 can anybody help me to fix this..?

11:19 can I take care of this with some java classpath environment variable?

11:21 Blackfoot: i recommend using lein for setting class path

11:22 for example, http://github.com/jochu/swank-clojure

11:22 but i have not used swank specifically

11:31 arohner: did defn get support for destructuring maps in the & args position, or am I crazy?

11:31 I'm trying to find documentation / github commit for it, and I can't

11:31 aha

11:31 http://github.com/richhickey/clojure/commit/29389970bcd41998359681d9a4a20ee391a1e07c

11:32 notsonerdysunny: Blackfoot: would you be able to help me as to how I could do that..?

11:35 alpheus: notsonerdysunny: as a total newb, I followed the instructions at http://github.com/jochu/swank-clojure last night with no problems

11:38 cemerick: the distinction between send and send-off is a little more subtle than blocking vs. nonblocking. I'm finding that using send-off for just about everything is better for my purposes, so as to "oversubscribe" the cores in my compute nodes, thereby ensuring full utilization.

11:38 alpheus: (doc require) mentions "classpath". Is that the same as the value passed to java in the "-cp" option?

11:38 clojurebot: "([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly. Libs A 'lib' is a named set of resources in classpath whose contents define a library of Cloju

11:39 cemerick: e.g. if your send fn is a mix of 75/25 CPU/IO, you want three of those running on a 2-core box to max things out

11:39 ...or maybe my thinking here is muddled.

11:39 alpheus: in 99% of the cases, yes

11:42 alpheus: Thanks. I'm trying to use a clojure image started with lein and require sample code from a book that doesn't mention swank or lein.

11:55 arkahn: is there a way for a function to 1) create something the first time it's called and 2) have it persist and be available between invocations ?

11:55 specifically, I want to have a file opened and available through function invocations

11:59 Chousuke: arkahn: put a reference to it in an atom or something

11:59 arkahn: Chousuke: ok - I wasn't sure what was idiomatic either, but I'll take that route. Thanks.

12:00 cemerick: a delay would probably be easier -- no explicit checking

12:00 Chousuke: arkahn: it's not particularly idiomatic. more idiomatic would be creating the file, returning it, and then passing it as a parameter later :P

12:00 arkahn: Chousuke: I can do that : )

12:00 cemerick

12:01 : what's a delay?

12:01 cemerick: ,(doc delay)

12:01 clojurebot: "([& body]); Takes a body of expressions and yields a Delay object that will invoke the body only the first time it is forced (with force or deref/@), and will cache the result and return it on all subsequent force calls."

12:01 arkahn: sweet

12:02 cemerick: so, (def some-open-resource (delay (init-resource))), and then just use @some-open-resource in the fn body

12:03 arkahn: cemerick: I'll check that out - thank you

12:08 delay is interesting but I think I'll create a (BufferedReader. (FileReader. f)) ahead of time and pass that around.

12:12 alpheus: I expected that after evaluating (def trigger (delay (println "you got me"))) in the repl, I could evaluate trigger without printing anything (until force or deref was used). What's wrong with my understanding?

12:34 riddochc: Hey, doesn't emacs provide some function like "close-all-open-parens-or-bracets-or-etc" by some different name? Anybody know what that function is?

12:34 tcrayford: just use paredit and you'll be fine

12:35 alpheus: There's slime-repl-closing-return

12:54 bartj: er, are there any libraries to connect to webkit rendering engine using clojure?

12:55 Raynes: I think I've seen some Java stuff for that.

12:56 KirinDave: cgrand did a really good job on his most recent blog post.

12:56 clojurebot: whose job is it to rule the world

13:04 bartj: KirinDave: link?

13:05 jfields: why would you use (some identity coll) instead of (seq coll) when determining if there are any elements of coll?

13:05 (for example, the impl of merge-with)

13:06 KirinDave: bartj: http://clj-me.cgrand.net/2010/05/08/destructuring-records-prototypes-and-named-arguments/

13:06 sexpbot: "Clojure and me » Destructuring, records, protocols and named arguments"

13:09 jfields: anyone care to write a (diff ) function that makes this true: (= {:a [100 250] :c [0 300] :d [220 0]} (diff {:a 100 :b 200 :d 220} {:a 250 :b 200 :c 300}))

13:10 I'm working on something, but haven't found anything I really like yet

13:10 cemerick: bartj: there's a gecko java wrapper

13:10 and swt has webkit integration, I think

13:11 bartj: cemerick: thanks, I check it out

13:12 stuarthalloway: technomancy: you around?

13:13 bartj: cemerick: looks like it is jrex

13:13 cemerick: bartj: there's another one, too...don't remember the name tho

13:16 bartj: cemerick: I was leaning more towards webkit wrappers

13:18 stuarthalloway: "lein test" has a crippling perf bug, and I would love to discuss it with someone before pushing the fix

13:18 I'll just explain it then :-)

13:19 cemerick: bartj: I know that swt has support for using webkit as a backend to its Browser component, but that's as far as my understanding goes.

13:19 there may be other java-webkit wrappers floating around, I have to imagine it's a common inclination

13:20 stuarthalloway: back in late January, the innocuous looking refactoring commit http://github.com/technomancy/leiningen/commit/a9936d22 causes the entire world to be recompiled between every test

13:20 bartj: cemerick: I am not actually looking to use a java component to display a webpage on an app

13:20 cemerick: bartj: what's the use case then?

13:20 stuarthalloway: this makes tests an order of magnitude slower, and doesn't make sense--code won't change while you are running your tests non-interactively

13:21 bartj: cemerick: this is for information extraction purposes - the task being getting the size of each rendered HTML element...

13:21 cemerick: ah, ok

13:22 bartj: cemerick: ... to deduce their importance and see where they "occur" on the web-page

13:22 cemerick: I'd certainly hope that a good wrapper would provide a pipe into the DOM, but I can see that being a tall order

13:23 chouser: I'm using rssowl these days, which appears to be a java app with gecko embedded rather seamlessly.

13:23 does that help? :-)

13:25 Dunno if it uses this or something else: http://jrex.mozdev.org/

13:25 sexpbot: "JRex - The Java Browser Component"

13:27 bartj: chouser: that was probably rude. Finding a wrapper to a rendering engine is hard. :)

13:29 chouser: is rssowl open source?

13:29 I think it is definitely possible to use the webkit rendering engine from java because android uses webkit

13:30 KirinDave: Android also uses jni.

13:37 stuarthalloway: cemerick: I have submitted a patch for last-var-wins that limits its scope to clojure.core, per discussion here. Mostly happy?

13:37 cemerick: heh

13:37 * cemerick is such a PITA ;-)

13:38 cemerick: stuarthalloway: I'm satisficed, yes.

13:38 stuarthalloway: good enough for me

13:39 cemerick: Over time, I really really want to get to the point where ns declarations really are declarative. Not sure what the impl would look like for that, but that instinct remains constant.

13:39 ninjudd: stuarthalloway: what's a guy gotta do to get access to the assembla spaces?

13:47 stuarthalloway: ninjudd: lemme check

13:48 ninjudd: it is done

13:49 ninjudd: stuarthalloway: thanks

13:51 stuarthalloway: are you the same Stuart Halloway who wrote http://www.amazon.com/Component-Development-Java-TM-Platform/dp/0201753065?

13:51 sexpbot: "Amazon.com: Component Development for the Java(TM) Platform (9780201753066): Stuart Dabbs Halloway: Books"

13:56 technomancy: stuarthalloway: it's the :reload-all, isn't it.

13:57 lpetit: http://www.amazon.com/Stuart-Halloway/e/B002BWYVRI/ref=sr_ntt_srch_lnk_1?_encoding=UTF8&qid=1274464448&sr=1-1

13:57 sexpbot: "Amazon.com: Stuart Halloway: Books, Biography, Blog, Audiobooks, Kindle"

13:57 lpetit: yep, or they are both with the same name and the same face :)

13:57 * technomancy wonders where that came from

13:59 technomancy: stuarthalloway: thanks

14:00 jfields: Is there a function that will, given a map and a pred, return a map with all the entires that pass the pred?

14:02 alpheus: doesn't map do that?

14:04 jfields: alpheus: I don't think so.

14:04 Raynes: $(map (fn [[key val]] [val key]) {:key :val :key2 :val2})

14:04 sexpbot: DENIED!

14:04 Raynes: Uh.

14:05 What could possibly be denied in that.

14:05 $(map (fn [[k v]] [v k]) {:key :val :key2 :val2})

14:05 sexpbot: result: clojure.lang.LazySeq@f333e02e

14:05 Raynes: Oh.

14:05 The key and val functions.

14:05 $(into {} (map (fn [[k v]] [v k]) {:key :val :key2 :val2}))

14:05 sexpbot: result: {:val2 :key2, :val :key}

14:05 Raynes: jfields: ^

14:05 jfields: raynes, thanks

14:06 I think I need filter not map, but the idea is the same. thanks.

14:06 ninjudd: lpetit: thanks, two clicks was too far for me to find that page on amazon

14:08 bartj: Raynes: I think clojurebot, sexpbot are not functional

14:09 , (+ 1 2)

14:09 clojurebot: 3

14:09 Raynes: bartj: Huh?

14:09 bartj: , (map (fn [ [key val] ] [val key]) {:key :val :key2 :val2})

14:09 clojurebot: ([:val :key] [:val2 :key2])

14:10 bartj: Raynes: you need to prefix it with a comma

14:10 Raynes: I was using sexpbot, not clojurebot. sexpbot is very functional. The only problem is that key and val aren't whitelisted in clj-sandbox, something I'm remedying as we speak.

14:13 And I think I've fixed that damned LazySeq problem.

14:15 Yep, I did.

14:15 $(map (fn [[k v]] [v k]) {:key :val :key2 :val2})

14:16 $(map (fn [[k v]] [v k]) {:key :val :key2 :val2})

14:16 sexpbot: => ([:val2 :key2] [:val :key])

14:16 Raynes: spacefail

14:16 :)

14:40 ninjudd: technomancy: when you get a minute, i have something i wanted to show you

14:43 technomancy: with regard to leiningen hooks

14:43 Borkdude: Is there a guide somewhere how to upgrade an elpa installed swank-clojure to the next version?

14:45 brb

14:46 my swank-clojure-project doesn't work with a new lein project I just made

14:47 Emacs just keeps polling and polling

14:47 lancepantz: Borkdude: swank-clojure is actually deprecated

14:47 AWizzArd: Anyone here who is pretty familiar with the (current) Java implementation of sorted maps and sets?

14:47 lancepantz: just use lein swank, then slime-connect

14:48 rsenior: technomancy: is there any xref setups needed for the slime-who-calls function to work with the latest swank?

14:48 Borkdude: should I manually add the swank dependency to my project.clj still?

14:49 if I want to do lein swank

14:49 Just did a lein upgrade fyi

14:50 I mean, is there a reason why lein new doesn't add it automatically now?

14:52 lancepantz: I hope you mean swank-clojure-project

14:55 hmm, ok, I added it to my dev-dependencies. when I do slime-connect, I get: version differ (slime, swank), do you want to continue?

14:56 what is that about?

15:02 lancepantz: Borkdude: i get the same after upgrading in elpa, my guess it's because we're not using the master of lein-swank

15:04 rsenior: Borkdude and lancepantz I get that as well after the 1.2.1 upgrade

15:05 Borkdude: in elpa, if I want to upgrade something, like clojure-mode, can I just D the old one and I the new one?

15:07 rsenior: not sure if it's right or wrong, but I installed the new version, then later went in and removed the old

15:08 lancepantz: i have to mark it d, then execute, then package-list-packages again and install, but i use aquamacs which may be making it wonky

15:11 technomancy: lancepantz: there's a bug in package.el that makes it a little awkward; it's fixed in my fork of package.el, but the upstream maintainer is a slacker

15:12 lancepantz: i see

15:13 rsenior: technomancy: is there any additional setup needed to use slime-who-calls? beyond the regular slime/swank setup?

15:13 Borkdude: ah, also upgraded some other things now

15:13 technomancy: rsenior: shouldn't be

15:13 rsenior: I am getting a wrong-type-argument error from slime and am wondering if I'm doing something wrong

15:14 let me past the backtrace into gist real quick

15:14 Borkdude: I upgraded slime also

15:14 but it still complains about the versions

15:17 rsenior: unfortunately there's some crazy characters below the 5th line that gist doesn't like, so I removed them http://gist.github.com/409296

15:18 Borkdude: how can I see which slime version I'm actually using?

15:27 lancepantz: do you guys run clojure-mode in your slime repl?

15:27 when i enable it, enter is a line break instead of return

15:32 nachtalp: hmm, could anybody give me a clue why this doesn't succeed in extracting values from a map given a vector of keys? http://www.pastie.org/971576

15:36 rsenior: nachtalp: your code works for me

15:38 Borkdude: nachtalp: also works here

15:41 nachtalp: rsenior, Borkdude: thanks, i just found out that it works for me in a fresh repl as well... strange, i thought i had my problem isolated...

15:47 Borkdude: still no clue, what version differ means when I do slime-connect, it mentions a version nr that is different from my slime, if I did the upgrade correct, that is

15:52 patrkris: rhickey: you there?

15:52 rhickey: yes

15:53 patrkris: rhickey: can I disturb you with a few questions about clojure's stm? :)

15:53 rhickey: maybe

15:53 :)

15:54 patrkris: rhickey: thanks! just wanted to make sure I understand exactly why clojure's stm is obstruction-free. I have a theory and just want you to say yes or no to whether that (in part) makes it not-obstruciton-free.

15:54 rhickey: it's not obstruction free

15:54 Fossi: that was an easy answer

15:55 patrkris: rhickey: yes, I know. But I just wanted to make sure that I understand what makes it not obstruction-free.

15:55 rhickey: One reason is that writing setting a ref during a transaction takes a lock on the ref, yes?

15:56 rhickey: all the locking and blocking are obstructions

15:56 patrkris: rhickey: well maybe more generally that Clojure's STM employs locks, which may cause other transactions to block and retry (bail).

15:57 ok yes

15:58 rhickey: well, thanks then :) I was just confused by the definition of obstruction-freedom and why clojure is not obstruction-free. I know I shouldn't be, but I'm born with a small brain.

16:02 Borkdude: does Clojure have a function that composes the or of two functions that take the same kind of args? like (or-comp f1 f2) => (fn [args] (or (f1 args) (f2 args)))?

16:02 AWizzArd: rhickey: Hi! I was looking for someone who is familiar with the implementations of sorted sets and maps, and just saw that you are here. Do you see an “easy way” to implement a mechanism to construct a sorted set/map much faster, by bypassing the sorting mechanism, when we can insert in already the correct order?

16:04 rhickey: AWizzArd: the sorted sets/maps are red-black trees. any literature on building them from sorted might apply

16:07 AWizzArd: okay

16:26 remleduff: Borkdude: My attempt is (defn or-comp [args & fns] (let [f (apply juxt fns)] (some true? (f args)))) ;)

16:29 Borkdude: remleduff, is juxt lazy?

16:30 I mean, is the result it returns a lazy seq, so it won't actually evaluate all the fns?

16:30 remleduff: No, I don't think so

16:33 OK, take 2 :). (defn or-comp [args & fns] (let [results (for [fn fns] (fn args))] (some true? results)))

16:35 OK, take 2 :). (defn or-comp [args & fns] (let [results (for [fn fns] (fn args))] (some (complement nil?) results)))

16:35 I wish there was a truthy? function

16:39 Borkdude: remleduff: how am I supposed to provde the args, in a vector?

16:39 AWizzArd: why not (some #(% arg1 arg2) [fn1 fn2 fn3 fn4]) ?

16:39 instead of or-comp

16:39 Borkdude: brilliant

16:40 remleduff: Because I was stuck in the "answering his question" mental space ;)

16:41 Borkdude: AWizzArd: but can I make a version of or-comp, without specifying the args?

16:42 (defn or-comp [fns] (apply some #(% ...) fns))

16:42 remleduff: If you're ok with putting multiple args in a vector or something, do that then do (apply fn args)

16:43 Borkdude: I can do (comp f1 f2) without saying what the args of f1 and f2 are

16:43 I should also be able to do this with or-comp

16:44 bmason: I think I'm not understanding something about importing java classes...

16:44 I searched jarvana for the class I want to use, I found the correct package and got that set up as a lein dependency

16:45 AWizzArd: you can #(apply % args) or if you have not args you can use %&

16:45 bmason: it's pulling the jar down into libs, but I'm still not able to (import 'classname) from clojure...

16:46 AWizzArd: bmason: do you do (import 'ClassName) or (import 'the.package.name.ClassName) ?

16:46 bmason: (import 'javax.mail.internet.MimeMultipart)

16:46 AWizzArd: What happens after you typed this?

16:46 Borkdude: AWizzArd: how would you write comp-or then?

16:46 remleduff: Aha: (defn or-comp [& fns] (fn [& args] (some #(apply % args) fns)))

16:47 bmason: class not found

16:47 AWizzArd: bmason: then this class is indeed not on your CP. Have a look at (System/getProperty "java.class.path")

16:47 Borkdude: I would not write it, but what remleduff presented looks fine.

16:48 Borkdude: AWizzArd: then I would still have to specify the args

16:48 AWizzArd: not at the moment when you call or-comp

16:49 what remleduff showed you is something that produces a fn

16:49 bmason: AWizzArd: indeed, there is no mention of javax at all in my classpath

16:49 AWizzArd: (def your-or-fn (or-comp + - * /))

16:49 And later you could (your-or-fn 10 20 30)

16:49 bmason: AWizzArd: my project.clj has [javax/javaee-api "6.0"] under dependencies and it's successfully copying this from a repo to my libs folder...

16:50 AWizzArd: bmason: the expert for Leiningen is technomancy.

16:50 Borkdude: AWizzArd: maybe I missed something but remleduff 's or-comp takes args as an argument

16:50 bmason: AWizzArd: k :)

16:50 clojurebot: haskell is Yo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you don't compute.

16:51 remleduff: Borkdude: The anonymous function that is returned by or-comp takes args, you don't need them when just calling or-comp

16:51 bmason: clojurebot is funny guy today

16:51 technomancy: bmason: is there a javax/mail/internet/MimeMultipart.class inside one of the jars in the lib directory?

16:51 AWizzArd: As I see it remleduffs or-comp takes fns

16:51 not args

16:51 Borkdude: remleduff: which version are we talking about, can you type it again?

16:51 remleduff: (defn or-comp [& fns] (fn [& args] (some #(apply % args) fns)))

16:52 Borkdude: ah ok I think I indeed missed that one... sorry!

16:52 bmason: technomancy: will check

16:52 Borkdude: that version does indeed look fine, tnx remleduff and AWizzArd :)

16:53 bmason: technomancy: yes, that path exists inside the jar "java-api-6.0.jar" which is in my lib directory

16:55 technomancy: ok, I may not have properly reloaded the environment... now I get "Absent Code attribute in method that is not native or abstract in class file javax/mail/internet/MimeMultipart" when I do (import 'javax.mail.internet.MimeMultipart)

16:56 which I think means I'm missing a dependency...

16:56 AWizzArd: After the import, when you just type MimeMultipart in the repl it should return javax.mail.internet.MimeMultipart if the import worked.

16:57 bmason: yeah, the import is throwing an exception though... have to fix that first

16:58 technomancy: incidentally, is there a way to restart swank/slime with 1 command? right now adding a dependency is a multiple step process for me

16:59 AWizzArd: maybe javax.mail needs this support class? I don't remember it, on my system I can import that Multipart class

17:00 bmason: AWizzArd: http://dominikdorn.com/2010/05/maven-junit-classformaterror-absent-code-attribute/

17:00 sexpbot: "Maven + JUnit + ClassFormatError: Absent Code attribute in method that is not native or abstract in class file | dominikdorn.com"

17:00 drewr: urg

17:00 danlarkin: ugh is right

17:01 no one likes those stupid link titles

17:01 AWizzArd: just /ignore sexpbot then ;)

17:02 bmason: ok... now adding javax/mail as a dep, I still get the absent code attribute error

17:02 how do I figure out what it needs?

17:03 remleduff: javax/mail or javax.mail/mail ?

17:04 bmason: [javax.mail/mail "1.4.1"]

17:05 it seems like voodoo magic to find the dependency with an error message like that

17:06 remleduff: Does java -verbose help at all?

17:07 bmason: hmm... how would I use that in context of a slime repl?

17:08 remleduff: I think you can do JAVA_OPTS=-verbose before you do lein swank

17:08 It may not be any help at all though

17:10 bmason: remleduff: you mean like this? http://www.javalobby.org/java/forums/t76635.html

17:10 sexpbot: "Overwrite java parameters with environment variables or other mechanism???"

17:11 bmason: technomancy: does swank use the JAVA_OPTS variable when it starts the clojure repl?

17:12 that's great if it does... that would help me attach a JSwat session to it :)

17:12 technomancy: it does

17:12 bmason: SWEET

17:13 noted :)

17:13 technomancy: you can also set :java-opts in project.clj if you want them to apply to everyone using your project

17:13 but it forces the JVM to fork, so you pay a perf price

17:14 bmason: oh, that's good to know

17:20 ok, so now I'm trying (import 'javax.mail.Multipart) and I get the absent code attribute error here as well

17:21 weird thing is, I thought that message had to do with a superclass not being imported... javax.mail.Multipart derives directly from java.lang.Object

17:29 remleduff: Did you restart swank after you added javax.mail to your project?

17:29 bmason: ^^

17:30 bmason: I'm sure I... lemme double check :)

17:31 remleduff: yeah, that's not the issue

17:32 I'm reading up more about what the error actually means

17:32 remleduff: Possibly, the problem is that javax.mail needs to be loaded _before_ javaee-api

17:33 But lein I think just looks at the order the jar files are in your lib directory when adding them to the classpath

17:34 So try renaming mail-1.4.1.jar to something like 00mail-1.4.1.jar to see if it helps

17:35 bmason: ok, I think the issue may be the jar I got

17:35 apparently there are some jars floating around in MVN repos that only have the API stubbed out, with no implementation: http://weblogs.java.net/blog/ludo/archive/2007/01/java_ee_5_apis.html

17:35 sexpbot: "Java EE 5 APIs now in a Maven repository... | Java.net"

17:35 remleduff: That's not confusing

17:35 bmason: oh no, not at all

17:36 and it's its not like I've wasted several days trying to figure it out either

17:36 nor am I bitter... moving on :)

17:36 remleduff: haha

17:37 bmason: I guess I need to find out what the correct jars are then

17:37 http://jarvana.com/jarvana/search?search_type=class&java_class=javax.mail.internet.MimeMultipart

17:37 sexpbot: "javax.mail.internet.MimeMultipart - Class Search - Jarvana"

17:37 bmason: pretty big list to go through, and I'm not familiar with java conventions

17:38 danlarkin: I hate you sexpbot!!!!!

17:39 bmason: what was the point of those titles?

17:39 just to give people context on links?

17:39 AWizzArd: bmason: you should ask Raynes (:

17:39 bmason: :D

17:40 remleduff: bmason: The way I read it, those classes are provided by whatever application server your service runs in

17:40 The jars you have are just stubs to allow it to compile, you can't actually use it outside of something like glassFish or BEA Weblogic

17:41 bmason: remleduff: that makes sense I suppose... but I need something to do development with

17:42 so the question is where do I find a complete implementation

17:43 anyone know what "plugin" means in the context of maven repos?

17:43 all the jetty stuff has plugin icons next to it... maybe that means it's a full implementation

17:51 remleduff: Actually, I think javax.mail is a complete implementation. It's the javaee-api that is stubs

17:51 But you probably actually have to run a web server and deploy to it to do testing

17:51 bmason: sweet

17:51 yeah I got it

17:52 remleduff: What did you do, remove javaee-api entirely?

17:52 bmason: javax.mail has what I need, but the javaee-api stubs were overriding them

17:52 yeah, I just removed javaee-api

17:53 remleduff: This is why "enterprise Java" has always seemed like such a strange goal to strive for to me ;)

17:53 bmason: :-D

17:54 yeah... I plan to get more into Java

17:54 easy way to get a day job, and it will have fringe benefits for my clojure programming

17:55 cus yeah... things are a little rough around the edges

18:11 defn: ,(ns-publics 'clojure.core)

18:11 ,(+ 1 2)

18:11 lancepantz: rejected.

18:11 defn: nah, i submitted an issue on this earlier today but hiredman just closed it with no comment

18:11 * defn shrugs

18:11 defn: his bot, i guess

18:12 lancepantz: ,(println "hi")

18:12 defn: it'll come back in about 5min or so

18:12 lancepantz: ns-publics crashes it?

18:12 atleast it doesn't barf a bunch of exceptions to the channel :)

18:12 defn: nah, not a crash, just very slow to return for some odd reason

18:12 lancepantz: hmm

18:15 defn: any second now...

18:19 clojurebot: {sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, val #'clojure.core/val, chunked-seq? #'clojure.core/chunked-seq?, find-protocol-impl #'clojure.core/find-protocol-impl, vector-of #'clojure.core/vector-of, object-array #'clojure.core/object-array, *compile-path* #'clojure.core/*compile-path*, max-key #'clojure.core/max-key, lis

18:19 hi

18:19 3

18:27 scottj: What's required to make a runnable jar with lein? I mean, do you create a -main function, lein jar, and then java -cp foo.jar what-class-goes-here?

18:28 AWizzArd: scottj: read about jar files, specifically the manifest file

18:28 when you mention the right main class there you can simply do java -jar foo.jar

18:28 or doubleclick the .jar

18:31 technomancy: scottj: set the ns containing the -main function as :main in project.clj, then do lein uberjar

18:31 defn: scottj: also note that you want to use the standalone.jar

18:31 since it includes clojure

18:32 Raynes: bmason: Indeed, to give context on those links. sexpbot has pretty sophisticated url scraping, in order to make it suitable for channels like this one. It doesn't follow github or paste links and such.

18:34 danlarkin: He's pretty fond of you. You've broken his heart.

18:34 bmason: lol

18:34 sexpbot: danlarkin: </3 :(

18:34 stribb: hi there

18:35 I'm still very much learning my way around clojure.core and wondered if you were willing to critique this line? I want it to be idiomatic (and ideally shorter)

18:35 http://pastebin.org/262500

18:37 that is, (apply str (cons \newline (flatten (interpose \+(repeat 3 (repeat (* width 3) \-)))))

18:38 Raynes: $(apply str (cons \newline (flatten (interpose \+(repeat 3 (repeat (* width 3) \-)))))

18:38 sexpbot: EOF while reading

18:38 Raynes: $(apply str (cons \newline (flatten (interpose \+(repeat 3 (repeat (* width 3) \-))))))

18:38 sexpbot: DENIED!

18:38 stribb: oops, maybe add another right paren

18:39 Raynes: Probably width.

18:39 $(apply str (cons \newline (flatten (interpose \+(repeat 3 (repeat (* 5 3) \-))))))

18:39 sexpbot: => "\n---------------+---------------+---------------"

18:39 Raynes: Yep.

18:40 stribb: to my eyes it's so full of lispisms that it hides the meaning. apply, flatten, cons are obscuring the thing I'm trying to show

18:41 I'm translating http://norvig.com/sudoku.html and here's the relevant line in Python

18:41 sexpbot: "Solving Every Sudoku Puzzle"

18:41 stribb: line = '\n' + '+'.join(['-'*(width*3)]*3)

18:41 danlarkin: sexpbot: your html parsing is so impressive

18:42 joshua-choi: Question: Is there a function for forcing a lazy sequence to fully evaluate? (I need to do this because resolve uses a re-bind-ed var.)

18:42 moshisushi: it's not possible to do pattern matchin (out-of-the-box, that is) in clojure, right?

18:42 Raynes: danlarkin: When I said sophisticated, I was referring to the blacklisting. :p

18:43 joshua-choi: moshisushi: Clojure has support for Java's regular expressions. The literal syntax is #"...".

18:43 Raynes: I need to get around to writing in something that checks the title and URL for similarities, in case of redundant titles.

18:43 remleduff: joshua-choi: doall ?

18:44 joshua-choi: remleduff: Eh. I need the whole evaluated sequence, not to do some side effect.

18:44 moshisushi: joshua-choi: hum.. i mean pattern matching as in Haskell / ML

18:44 pjstadig: ~meap

18:44 clojurebot: Manning missed the opportunity to call it Manning Early Access Trial

18:44 joshua-choi: moshisushi: Ah. Don't know as much about that. Clojure does have destructuring in let and let-like forms, though.

18:46 remleduff: I am super frustrated, because I found that the source of a bug I've been searching for the past four hours is because 1. map is lazy and 2. resolve uses *ns*. If you have (map resolve vars) in one namespace and happen to evaluate the sequence in another, you will get a lot of strange NullPointerExceptions. :(

18:46 remleduff: doall is intended to do that, it returns the fully realized sequence

18:46 Raynes: $learn meap http://www.manning.com/fogus/

18:46 sexpbot: My memory is more powerful than M-x butterfly. I wont forget it.

18:47 joshua-choi: remleduff: Oh, does it? Excellent. I confused it with doseq.

18:47 I'm still seething about that bug though

18:47 remleduff: Yeah, a lot of people have been caught by map and for being lazy

18:47 Worth it in the end though

18:48 Borkdude: maybe it should be called smth with "force"

18:48 it's the first thing I would search for

18:48 force-all

18:49 joshua-choi: remleduff: No, I don't have a problem at all with lazy map; I love it. My problem is much more with binding-context-sensitive resolve. Functions that depend on variables are a huge source of accidental complexity in Clojure. :(

18:49 Oh well, I'm just glad I figured it out. :)

18:49 (And when I say "functions that depend on variables", I mean mutable variables to be bound.)

18:50 remleduff: Yeah, I think binding is my current uncertainty with clojure

18:51 Your other option if you had wanted to keep laziness is to do (let [*ns* *ns*] (map... etc))

18:52 joshua-choi: Yeah. I'm thinking that I probably want to not use resolve at all if I can help it

18:52 remleduff: Borkdude: force is already with delay (which I've not used yet)

18:54 duncanm: hmm, i'm running jvisualvm on a batch job that i wrote in clojure

18:54 the loaded class count just keeps going up and up

18:54 is that a good thing? bad thing?

18:54 remleduff: Do you use "eval" a lot?

18:55 If the class count goes up and not down, you can run out of PermGen

18:55 clojurebot: AOT genclass is http://paste.lisp.org/display/70665 and http://clojure-log.n01se.net/date/2008-11-18.html#14:19

18:55 stribb: bah, I hate my broadband

18:55 duncanm: remleduff: i don't use any eval

18:55 Borkdude: remleduff: that's true, but there is some similarity between lazy seq and delay/force maybe?

18:56 I only just read about it

18:56 remleduff: gotta run, later all, happy weekend :)

18:56 duncanm: hmm

18:56 Borkdude: ok bye remleduff

19:01 danlarkin: $((fn this [] (try :foo (finally (this)))))

19:01 sexpbot: Execution Timed Out!

19:02 pjstadig: $meap

19:02 sexpbot: Command not found. No entiendo lo que estás diciendo.

19:02 pjstadig: $recall meap

19:02 sexpbot: Command not found. No entiendo lo que estás diciendo.

19:02 danlarkin: ((fn this [] (try :foo (finally (this)))))

19:02 ((fn this [] (try :foo (finally (this)))))

19:03 $((fn this [] (try :foo (finally (this)))))

19:03 $((fn this [] (try :foo (finally (this)))))

19:03 $((fn this [] (try :foo (finally (this)))))

19:03 $((fn this [] (try :foo (finally (this)))))

19:03 sexpbot: Execution Timed Out!

19:03 Execution Timed Out!

19:03 Execution Timed Out!

19:03 Execution Timed Out!

19:04 KirinDave: ...

19:05 poor sexpbot

19:05 Raynes: He's spammed it in PM, and got it stuck in a loop.

19:05 danlarkin: poor us to have to suffer its link titling!

19:05 Raynes: Eh?

19:05 stribb: ok, cheerio chaps

19:06 Raynes: More people like it or don't mind it than people dislike it.

19:07 pjstadig: i think the link titling is a bit spamish

19:07 Raynes: How so?

19:07 bmason: Raynes: or they just don't want to hurt sexpbot's feelings

19:07 Raynes: Not nearly enough links are posted in here, and the titles aren't nearly long enough to be "spamish".

19:07 pjstadig: if i want to see a title, i will click on the link

19:08 usually there is enough context when someone posts a link to know what it is about

19:08 Borkdude: as long as it's not doing ads, I'm find with the titles... and it saves me a click if the title doesn't sound interesting to me

19:08 Raynes: If people want it off, I'll happily turn it off, but several people have told me it's useful in here, and that's why it's on.

19:08 AWizzArd: you can just /ignore the bot

19:08 Raynes: If rhickey wants it off, I'll turn it off. I'm not unfair.

19:08 bmason: :-)

19:08 pjstadig: people want it off

19:08 Raynes: It just doesn't seem to bother anyone. :\

19:08 Until now anyway.

19:09 pjstadig: I mean more than two.

19:09 Or Rich. Rich is more than two.

19:09 pjstadig: how many?

19:09 Raynes: In a poll, the person with the most votes wins.

19:09 pjstadig: we'll get a petition

19:09 bmason: lol

19:09 Raynes: Go for it.

19:09 scgilardi: polling is not idiomatic in clojure

19:10 Borkdude: Raynes: why don't you make $upvote title, when it's positive, the titles appear ;)

19:10 pjstadig: first you have to tell me how many we need to get

19:10 Borkdude: and of course $downvote title

19:10 bmason: maybe it will be a lazy poll

19:10 Raynes: pjstadig: 15-20. Even chouser said he doesn't mind it/hasn't formed an opinion.

19:10 You aren't actually going to start a petition, are you?

19:11 duncanm: i know how to write Scheme macros, but i don't know them in Clojure

19:11 i'm tyring to write a macro so that (write some-form-here) expands into (.add writer some-form-here)

19:11 bmason: (defmacro name form)

19:11 ,(doc defmacro)

19:11 clojurebot: "([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]); Like defn, but the resulting function name is declared as a macro and will be used as a macro by the compiler when it is called."

19:11 duncanm: i tried macroexpanding to test, how do i make sure i get the binding of 'writer' correctly?

19:12 i want it to bind to the local binding of 'writer', not some global binding

19:12 zakwilson: The docs for defmacro are not very helpful for someone not familiar with CL-style macros.

19:12 bmason: is writer a stream?

19:12 pjstadig: i'm not sure we need two bots in here

19:12 maybe we should have a bot cage fight

19:12 Raynes: I'll also point out that clojurebot has some rather random comments sometimes. At least sexpbot's are useful to /some/ people. ;)

19:13 duncanm: bmason: it's an XMLEventWriter

19:13 Raynes: sexpbot has been here for like 2 months. :\

19:13 pjstadig: so you're saying that clojurebot's comments are not useful to anyone?

19:13 Borkdude: duncanm: (defmacro dude [w f] `(.add ~w ~@ f)) ?

19:14 sorry, no space between ~@ and f

19:14 Raynes: pjstadig: I'm talking about the comments that aren't invoked purposely. clojurebot says stuff when people say certain things. If we're going to have this conversation, come to #clojure-casual so we stop disrupting conversation here. :(

19:14 bmason: yeah, Borkdude's suggestion would work if you want to provide the writer as an argument

19:14 duncanm: Borkdude: i don't want to explicitly pass the 'w'

19:15 bmason: i have (let [writer ..., write #(.add writer %)] ...) in my code right now

19:15 and i think that #(...) is generating a lot of unnecessary code, cuz this is being called inside a loop

19:15 bmason: so you're saying a var bound in the surrounding context isn't available?

19:15 danlarkin: no dudes come to #clojure-awesome

19:15 it's way better

19:16 AWizzArd: duncanm: btw, you can add a type hint there

19:16 duncanm: AWizzArd: but that same Fn will still get generated every time, right?

19:16 bmason: oh, well "let" doesn't do a binding... that may be your problem

19:16 AWizzArd: yes

19:17 Raynes: danlarkin: Thanks for clojure-json by the way. sexpbot uses it all over the place. <3

19:17 Borkdude: wasn't &env invented for this problem?

19:19 bmason: danlarkin: might be easier to see what you're doing with a full example

19:20 hiredman: ~foo

19:20 clojurebot: foo is is Short, Self Contained, Correct (Compilable), Example http://sscce.org/

19:24 remleduff: $eval *ns*

19:24 sexpbot: DENIED!

19:24 Raynes: I hate that "Hey, you can't change your nick until you identify" but you can't identify until you change your nick.

19:26 remleduff: joshua-choi: I think I lied earlier about (let [*ns* *ns*]...) actually doing anything you'd want

19:27 * Raynes is off to see Iron Man 2.

19:27 * Raynes huggles danlarkin and runs off to take a shower.

19:28 remleduff: That's fine if you're using *ns* locally, but wouldn't have any effect when calling resolve

19:49 kencausey: I don't suppose anyone has any idea if it is possible to run a clojure/compojure app under GoDaddy basic web hosting? The mention Java in some places, JSP in others, I'm not much of a Java guru and am not clear on whether I would be able to run a clojure app in the environment. Anyone have any experience here?

19:54 lancepantz: kencausey: http://help.godaddy.com/article/67

19:54 sexpbot: "Can I deploy my application using a war file? - Search the Go Daddy Help Center"

19:55 lancepantz: looks like you better have it how you want it at 1am, messed up

19:58 kencausey: thanks, am I safe in assuming they have new enough versions for it to work? they tend to lag a bit

20:00 lancepantz: yeah, build a war file that complies with the servlet spec and it shouldn't be a problem

20:01 i have a basic example with compojure 0.4 on github, http://github.com/lancepantz/lein-war-example

20:01 kencausey: ok, thanks

20:25 _brian2_: noob question> Hi , I'm trying to grok the relationship between handlers and routes in compojure, ( http://clojure.pastebin.com/rijB4Fag ) according to the author the new compojure defers handlers to Ring, but uses routes, which do more or less the same thing, (returning a response map), however as far as I can tell, you cant call a handler function in a route

20:41 joshua-choi: remleduff: Yeah, I figured as much. I would really like someone close to Hickey to write how binding's large disadvantages don't outweigh whatever advantages it does give. But now I think I'll watch out for this error better.

20:58 remleduff: _brian2_: Which are you calling a handler and which are you calling a route?

20:59 _brian2_: on the pastebin, app is the handler, and defroutes are routes, as I undersand it

21:02 remleduff: handlers take a request map, and return a response map. defroutes, returns a handler. The route macros return various things and has a multimethod that can format it into a response map, but they don't use straight ring maps

21:03 You could wrap! your routes with app though in your example

21:04 But you'd only get hello world after that ;0

21:04 There's a #compojure channel as well

21:04 _brian2_: oh, cool!

21:09 remleduff : at first, (I probably need to read more about the request map), but I just want to send user input into a database retrieval function

21:10 Its just 10 categories of finite responses I was going to use routes, but thats probably not the best way

21:10 ?

21:10 remleduff: Ring works by having a list of handlers, they each get a shot at the request map and return a response map if they want to handle it

21:10 defroutes abstracts that, the (GET) macro returns a handler

21:13 _brian2_: ok, but like (GET "/" [] app) ; where 'app' is handler compojure doesn't seem to like this

21:14 remleduff: GET creates handlers

21:14 It doesn't call them

21:14 _brian2_: ok

21:16 so I can call a an ordinary function (GET "/" [] funct[state1] ) ?

21:17 that returns some renedring?

21:17 rendering

21:17 remleduff: Yep

21:18 _brian2_: oh, ok. Thanks!

21:19 remleduff : thank you

22:11 lancepantz: alexyk: jiraph is now using lein and on clojars

22:16 remleduff: Do you know of a good tutorial about graph databases, including when you'd want to use one?

22:18 alexyk: lancepantz: awesome! you guys won

22:19 t believe which other functional language supports tokyo cabinet and google protocol buffers too

22:19 :)

22:20 lancepantz: remleduff: ignoring the implementation, http://neo4j.org/doc/ has some good resources

22:20 sexpbot: "neo4j open source nosql graph database » Documentation"

22:20 alexyk: lancepantz: I was thinking of using the interoperable format to speed up huge walks, and looked for a compiled language with both bindings

22:20 alas ocaml has neither

22:20 lancepantz: remleduff: this one is informative http://dist.neo4j.org/neo-technology-introduction.pdf

22:21 alexyk: but some language git them :)

22:21 got them

22:21 lancepantz: remleduff: note that jiraph has different pros and cons than neo4j, namely that it does not support transactions and is roughly 10x faster than the benchmarks published

22:22 alexyk: jiraph rocks

22:22 remleduff: Thanks :)

22:22 lancepantz: alexyk: c++ :)

22:22 alexyk: lancepantz: well, that's like an assembly... FP!

22:23 some formidable and glorious language!

22:23 to which we all aspire to

22:23 lancepantz: hahaha

22:23 alexyk: when we're not going drinking

22:23 ok it's Haskell

22:23 and it just got an LLVM back end which makes it numerically beat C

22:24 so I'll need to teach Haskell to read map and set extensions and then it'll eat jiraphs for breakfast

22:24 first I need to learn it though :)

22:24 I like interop

22:25 lancepantz: alexyk: it has tc and protobuf support?

22:25 alexyk: lancepantz: yep!

22:25 http://hackage.haskell.org/package/tokyocabinet-haskell

22:25 http://hackage.haskell.org/package/protocol-buffers

22:26 the protobufs understand extensions, but I guess I need to teach it what map and set are

22:27 lancepantz: so I guess geni will run on HAppS stack soon :)

22:27 and be hosted at patch-tag.com :)

22:28 lancepantz: hahaha

22:28 haskell just looks like gobldey gook to me

22:34 * alexyk did it again -- Haskell is mentioned, rhickey leaves :(

22:34 alexyk: but, liebke joined! :)

23:04 riddochc: Opinions requested: which of the editors with Clojure support *least* requires the use of a keyboard?

23:07 I tried emacs again yesterday for the first time in a few years, and it just isn't very accessible for someone who's mostly limited to using pointer-based interfaces.

23:11 Oh, well. Trying netbeans+enclojure now...

23:17 bmason: if I have a java object with methods getCount and getPart(n) is there an idiomatic way to convert the parts to a sequence?

23:19 e.g. in java it would be for (i = 0; i < obj.getCount(); i++) {obj.getPart(i);}

23:19 I'd prefer not to have to iterate a variable, but it looks like that's the interface I'm given...

23:20 riddochc: bmason: I'd probably make loop/recur returning a lazy-seq, given the lack of any other iterator over your collection.

23:21 bmason: k

23:28 riddochc: Alternatively... hm. you could (map #(.getPart %) (range ...))

23:29 Or something similar, mapping over the seq of numbers up to .getCount.

23:55 bmason: riddochc: I like that

Logging service provided by n01se.net