#clojure log - Nov 06 2010

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

0:02 tomoj: hmm

0:13 do I remember rightly that there was some maven plugin for generating mac style apps?

0:17 oh, it was the reference to building windows executables that I remembered from cemerick's post

1:09 cemerick: tomoj: There are maven plugins for packaging mac apps as well as building windows installers

1:09 There may well be one for generating windows .exe's for java apps, I've just never used them.

1:11 tomoj: cool

1:13 cemerick: tomoj: http://www.google.com/search?q=maven+jsmooth+plugin *shrug*

1:13 never used it, but seems promising

1:14 ppppaul: coding guis makes me cry

1:41 samx: ok.. finally after hours of pain, netbeans/enclojure debugging seems to be working :-)

1:53 amalloy: samx: what was the key?

1:56 samx: i was importing an existing project of mine, containing java an clojure.. and used the "java/java project with existing sources" project type, which uses netbeans project preferences generated ant build files.. I think something in how they were getting set up didn't work well with debugging.. so, after starting over again, and setting the project up as "java/java free-form project" (which just uses my hand coded ant build file), it just started

1:56 working

1:56 Derander: is there a way to get clojure-mode to color known functions differently?

1:57 like classes vs local vars vs functions

1:57 fuck. maybe that's a terrible idea

1:57 samx: one think i noticed was that the netbeans generated build was copying all the clojure files to the build directory, and for running, it had a path both for the build and the src directories, essentially having two paths containing the clojure files.. that might have been the problem, but not sure

1:57 cemerick: samx: I always found NetBeans' project management stuff somewhat broken, especially their crazy generated ant buildfiles.

1:58 foolishly generating foolish code is foolish, etc.

2:10 amalloy: Derander: so many things are callable as functions that that becomes pretty hard

2:10 Derander: amalloy: yeah, that struck me

2:10 I realized, "wait... almost everything is a function..."

2:11 amalloy: eg: (fn [x y] (x y))...gonna be a tricky one :)

2:11 Derander: highlighting the "word" in each form might be useful

2:11 or boldingi t

2:11 amalloy: you mean the function being called?

2:11 Derander: yes

2:12 amalloy: you don't need emacs to tell you where all the (s are...:P

2:13 Derander: amalloy: that is true

2:13 I'm going to see what it looks like nonetheless

2:13 amalloy: haha k

2:13 Derander: :P

2:14 amalloy: what *might* be useful is to locate anything called as a function, and highlight it throughout the current scope

2:14 ppppaul: color every word differently

2:14 rainbow code

2:14 Derander: amalloy: I'm not sure what that would accomplish

2:14 amalloy: could you explain more?

2:14 ppppaul: anyone know of a tutorial/cheatsheet for programming lisp in emacs?

2:15 amalloy: Derander: suppose you're defining reduce

2:15 Derander: sure

2:16 amalloy: (defn reduce [combiner list] (loop [[x & xs] list] (whatever...(combiner x))))

2:16 being able to have *combiner* highlighted in the function param list might be useful

2:16 Derander: ah, yes

2:16 that would be really handy

2:17 amalloy: maybe. i agree it *sounds* handy, but it seems to me like if it were handy emacs would already have it

2:17 but if you want to get into some elisp it sounds like an interesting project

2:17 Derander: I don't believe that :-)

2:18 amalloy: have ye no faith, brother, in the prophets of lisp who came before us?

2:18 Derander: none

2:19 amalloy: good. we need people to innovate even if the ideas turn out to be rubbish

2:19 Derander: it feels like it'd be a slow operation

2:19 to do that kind of highlighting

2:19 cemerick: Hrm. The prophets of lisp left us elisp and CL…

2:19 * cemerick runs away :-)

2:19 amalloy: Derander: emacs does some pretty intense stuff already

2:20 Derander: I am going to try to get it to show function args as font-lock-variable-name-face

2:20 amalloy: and technomancy has some kind of backtracking syntax highlighter that is (i think) in super-ultra-pre-alpha

2:20 in swank-clojure.el

2:21 or i guess it's a backtracking indent. whatever

2:21 Derander: amalloy: so it indents previous lines of code?

2:21 amalloy: no, i think it goes back to previous lines of code to decide how to indent this one

2:21 but it might have useful ideas for you

2:22 tbh elisp hurts my eyes; i gave up on my tiny improvement after an hour

2:22 hiredman: backtracking indent is great, and not alpha, everyone should turn it on

2:22 Derander: hiredman: how?

2:22 amalloy: hiredman: really? what's it do?

2:22 hiredman: how?

2:22 clojurebot: with style and grace

2:23 hiredman: amalloy: it properly indents protocols and reify etc

2:23 and letfns

2:24 Derander: hiredman: I don't see anything about it in the github page

2:24 hiredman: (setq clojure-mode-use-backtracking-indent t)

2:30 kzar: Is there a way to take a range with a varying step amount? Say the range of 1000 to 10,000 with the step increasing by 2 every 250

2:31 * kzar realises he should just make his own range that takes a function for step

2:40 amalloy: kzar: your super-range sounds like a combination of iterate and take-while

2:43 kzar: &|(take-while #(< % 10000) (map first (iterate (fn [[n step]] [(+ n (inc (quot step 20))) (inc step)]) [1000 1])))|&

2:43 sexpbot: ⟹ (1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1021 1023 1025 1027 1029 1031 1033 1035 1037 1039 1041 1043 1045 1047 1049 1051 1053 1055 1057 1059 1062 1065 1068 1071 1074 1077 1080 1083 1086 1089 1092 1095 1098 1101 1104 1107 1110 1113 1116 1119... http://gist.github.com/665247

2:44 amalloy: (slight modification if you want it changing steps every time N passes a multiple of 20 instead of every 20 elements)

2:49 kzar: amalloy: How come there are two square brackets around [[n step]]?

2:50 amalloy: kzar: destructuring: &|(let [[x y] (range)] y)|&

2:50 sexpbot: ⟹ 1

2:50 kzar: oo gotya

2:50 amalloy: i'm iterating over a [data, step] pair

2:51 kzar: yea that's really clever, thanks for showing me that

2:51 I'm kinda bamboozled but I'm going to play with it for a while and understand it properly heh

2:51 amalloy: it's useful surprisingly often. have you seen the rosettacode fibonacci?

2:51 kzar: amalloy: No I don't think I ahve

2:52 amalloy: i added a walkthrough that i think helps understand this stuff

2:52 kzar: http://rosettacode.org/wiki/Fibonacci_sequence#Clojure

2:52 kzar: wicked thanks

2:53 ppppaul: i support super-range

2:56 kzar: amalloy: Yea I understand it now

2:56 amalloy: cool. now you can create your own hideous monsters just like it :)

2:57 kzar: amalloy: heh yea, trust me I can do worse

3:08 amalloy: Heh I'm using it to make a lazer sound, it's coming out more like a broken fan but it's progress heh

3:09 amalloy: oh that's right, you're doing all the synth stuff

3:09 is it on github yet?

3:09 kzar: amalloy: heh no it's a big mess, I couldn't sleep and I've just been fecking around

3:12 wo that sounded like a teleporter

3:16 amalloy: oh, i see. you want a sound that's gradually changing frequency. cute

3:19 ppppaul: &(take 5(map first (iterate (fn [[a b]] [b (+ a b)]) [0 1])))

3:19 sexpbot: ⟹ (0 1 1 2 3)

3:19 ppppaul: &(take 50(map first (iterate (fn [[a b]] [b (+ a b)]) [0 1])))

3:19 sexpbot: ⟹ (0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 9227465 14930352 24157817 39088169 63245986 102334155 165580141 267914296 433494437 701408733 1134903170 1836311903 2971215073 480752... http://gist.github.com/665256

3:21 amalloy: ppppaul: believe it's fibonacci now? :P

3:21 ppppaul: i'm memorizing it

3:21 too much competition for pi

3:22 that fib function has no recursion at all, right?

3:22 it looks really sexy

3:22 amalloy: ppppaul: it's all recursion, just like everything in clojure

3:22 ppppaul: oh

3:22 amalloy: but it's lazy recursion

3:22 so it doesn't re-compute previous numbers and it doesn't blow the stack

3:22 Derander: ow my brain

3:22 fucking emacs regexp syntax

3:22 ppppaul: lol

3:23 it's weird eh

3:23 amalloy: Derander: if you get it figured out let me know

3:23 ppppaul: ////////////

3:23 i know a little

3:23 Derander: for some reason adding a capture group breaks the regexp

3:23 amalloy: cause i love regexes and i can't get emacs to match anything to save my life

3:23 ppppaul: the regex-builder is so helpful

3:23 Derander: ppppaul: I'm convinced that it lies

3:23 ppppaul: lol

3:23 maybe it has bugs

3:23 Derander: "(defn .* \[\([A-Za-z0-9 ]+\)\]" <-- this should match (defn the-function [arg1 arg2], right?

3:23 ppppaul: maybe there is a way to use perl regex syntax with emacs?

3:24 Derander: and capture arg1 and arg2

3:24 if I take out the \( and \) it works

3:24 but doesn't capture

3:24 ppppaul: use more '\'s

3:24 amalloy: Derander: i think he's actually right :(

3:24 ppppaul: \\[\\(

3:24 Derander: wow.

3:25 that worked.

3:25 wtf?

3:25 ppppaul: secy

3:25 Derander: is there some reason for that?

3:25 amalloy: Derander: of course

3:25 ppppaul: cus it's in lisp

3:25 i dono

3:25 amalloy: lol no

3:25 ppppaul: emacs likes it's slashes

3:25 amalloy: "\(" tells emacs to escape the (

3:25 Derander: right

3:25 amalloy: "\\(" escapes the \, and passes \( to the regex engine

3:26 Derander: oh god

3:26 ppppaul: owe my head

3:26 Derander: sometimes "syntax" is a good idea

3:26 amalloy: Derander: you've never written regexps in java or bash?

3:26 this shit happens all the time

3:26 Derander: amalloy: perl & ruby only :P

3:26 amalloy: lucky man

3:26 Derander: slash delimeters ftw

3:26 amalloy: languages that don't have regexps as first-class literals make it really painful to escape anything

3:27 fortunately clojure's #"regex" syntax passes every character on as a literal to the regex engine

3:28 Derander: "(defn .* \\[\\([A-Za-z0-9]+ ?\\)+\\]" <-- this captures only the /last/ arg.

3:28 * Derander headdesks.

3:28 amalloy: Derander: .* is greedy

3:29 Derander: oh

3:29 right

3:29 fuck

3:29 ppppaul: i love regex

3:29 amalloy: does emacs support .*?

3:29 Derander: ? should make it not greedy, right?

3:29 amalloy: if emacs supports that, yes :P

3:29 Derander: doesn't seem to work

3:29 http://www.gnu.org/software/emacs/manual/html_node/elisp/Regexp-Special.html#Regexp-Special <-- this says it should

3:29 amalloy: a ) is never legal in defn params, right?

3:30 Derander: don't think so

3:30 amalloy: oh but damn, there isn't one after tha params either

3:30 so you can't match on that

3:30 Derander: "(defn .*? \\[\\([A-Za-z0-9]+ ?\\)+\\]" <-- currently still capturing only last arg

3:31 amalloy: hmmmm

3:31 .* shouldn't actually matter now that i think about it

3:31 Derander: I think I'm feeling a solution

3:31 if it wasn't 12:33AM this would be easier

3:32 amalloy: what's the decl you're parsing?

3:32 Derander: (defn the-function [arg1 arg2 arg3 arg 4 arg5] foo bar

3:32 matches to ], captures arg5

3:33 ppppaul: should ask people on #emacs

3:33 amalloy: man, that doesn't make sense

3:33 ppppaul: #regex

3:34 oh, your regex wont match all legal arg strings

3:34 my+arg wont match

3:34 amalloy: oh durr

3:34 Derander: I will tomorrow

3:34 amalloy: brilliant breakthrough?

3:34 amalloy: Derander: you need a paren group that ends after the +, not before it

3:35 which would capture all the args

3:35 you can't capture them individually b/c each capturing group only tracks the last thing it matches

3:35 ppppaul: ooooooh

3:35 so me a solution

3:35 amalloy: so match them all and pull it apart with another re-seq, or (.split string regex)

3:35 ppppaul: i had a similar problem

3:35 Derander: oh, that's trivial then

3:36 amalloy: indeed

3:36 ppppaul: interesting

3:36 amalloy: oh haha i forgot this isn't clojure. "another re-seq or .split". it would be easy in anything but elisp

3:36 Derander: "(defn .*? \\[\\([A-Za-z0-9 ]+\\)+\\]"

3:36 yeah, see I'm trying to figure out a way to wrangle this into font-lock

3:37 so I'm not sure I'm allowed to do more than one regexp

3:37 font-lock's documentation is opaque as fuck

3:37 amalloy: hm. i haven't looked into font-lock

3:37 but if you don't want to color them all differently, then just matching the whole thing should be fine

3:37 Derander: I'm trying to pull out the individual words to color them in the function body itself

3:38 amalloy: ah

3:38 ppppaul: cool

3:38 amalloy: also, don't forget there are more valid symbol characters

3:38 Derander: (defn myfunc [arg] (println arg)) should color both instances of arg

3:38 yes, that's easy to add later though

3:38 amalloy: yeah. just making sure

3:38 Derander: just trying to get *something* working

3:38 but yeah.. I'll ask tomorrow in #emacs

3:39 probably not many font lock experts on in the middle of the knight

3:39 night

3:39 hah

3:39 amalloy: i like to stay on the edges of the knight. the middle is too squishy

3:39 Derander: :-)

3:39 I tried writing my own fontifier thingy

3:39 and I had reasonable success

3:40 the problem is that font-lock overwrites *every* font property you set on every change in the buffer

3:40 if font-lock just had a fucking hook life would be good

3:40 this is a lot easier to solve w/ regular elisp logic

3:40 amalloy: Derander: sorry, my ears must be going bad. did you say "elisp logic"?

3:40 *cue laughtrack*

3:40 Derander: :-)

3:41 if I manage to get this working, I'll write a version of it for let bindings too

3:41 just for fun

3:42 amalloy: Derander: you'll have a hard time with any destructuring in either case

3:42 Derander: ah, true

3:42 well, nothing is perfect

3:42 amalloy: (defn do-stuff [[f & fs]] ...)

3:43 Derander: if the failure mode is "no color" then it's not that bad

3:43 amalloy: heh

3:43 Derander: so long as it doesn't go rampant and fuck everything up I don't mind a few flaws

3:43 amalloy: Derander: you should include both modes just in case

3:44 Derander: just in case somebody wants their colors ruined?

3:44 amalloy: yeah. you never know

3:45 ppppaul: sometimes i know

3:45 amalloy: ppppaul: i wasn't talking about you

3:46 ppppaul: ^_~

3:46 Derander: I am going to go to bed now

3:46 so that I can wake up in time to get a sandwich

3:47 good night gentle(wo)men

3:48 ppppaul: &(map first (iterate (fn [[a b]] [b (+ a b)]) [0 1])))

3:48 sexpbot: java.lang.OutOfMemoryError: Java heap space

3:49 ppppaul: &(doc doc)

3:49 sexpbot: ⟹ "Macro ([name]); Prints documentation for a var or special form given its name"

3:52 Raynes: amalloy: You're still awake?

3:52 amalloy: Raynes: dude it's not 3am here

3:52 Raynes: That's beside the point.

3:52 I still find it odd that I can go to sleep before you and wake up before you. I wonder how much you actually do sleep.

3:52 amalloy: i'm a night owl by preference; i mostly go to bed before midnight because i work in the morning

3:53 you mean wake up after me?

3:53 Raynes: Yeah.

3:53 amalloy: answer: not enough. insomnia has been a problem for me

3:54 Raynes: i'm thinking of starting a sub-branch off of tidy just for all the times you use (apply str (interpose foo bar)) instead of (join foo bar) :)

3:55 Raynes: Please don't. :\

3:55 amalloy: yeah, that would be kinda disgusting

3:56 Raynes: I'm aware of join, I just don't use it because it feels redundant to bring it in every time I need that behavior. I can understand in places where I could use it several times, but once or twice is okay.

3:57 There are likely plenty of legitimate places where I didn't use it because I didn't think I'd need it more than once, but ended up needing it many times.

3:57 amalloy: really? i think join is just so well-known that it's more expressive. and so far every instance i've seen, you defined your own join function and then called that N times

3:58 Raynes: Where?

3:58 clojurebot: where is log

3:58 ppppaul: where?

3:58 clojurebot: where is log

3:58 amalloy: eg sed.clj

3:58 ppppaul: log

3:59 amalloy: and github.clj

3:59 ppppaul: zzz

3:59 Raynes: amalloy: I didn't write sed, and I don't think what I wrote in github.clj was exactly join.

4:01 amalloy: (identical filter-false-str #(join "" %))

4:01 join drops the nils for you

4:02 Raynes: Fair enough. One instance? Forgive my tired soul.

4:02 amalloy: hahaha

4:02 Raynes: I've done wrong, and I shall pay in the next life.

4:02 I'm going to go whip myself with a cat of nine tails now.

4:02 ;)

4:02 amalloy: let me be. sometimes i need to fix things

4:03 Raynes: I'm fixing source.

4:03 As we speak.

4:03 amalloy: neato

4:03 who did write sed? git log is hard

4:03 Raynes: Erik.

4:04 amalloy: that explains why there's a regex in it. i was gonna poke fun at you for having any

4:04 Raynes: Right. I avoid regexy things like the plague. For now, anyway. I have people to write them for me. :>

4:04 amalloy: *chuckle*

4:04 i'm at the "admitting i have a problem" phase

4:05 not yet at the "trying to stop doing them" phase

4:08 oh neat. working through sed is exposing me to functionality i didn't know he had

4:09 -Raynes s/neat/awesome/

4:09 damn

4:09 well, it's in there somewhere

4:10 Raynes: $sed -amalloy s/well/clojure/

4:10 sexpbot: <amalloy> clojure, it's in there somewhere

4:10 amalloy: ah

4:10 Raynes: There is some weird option stuff going on there.

4:10 I never asked, he never told.

4:11 amalloy: god this is going to me so much more legible when i'm done

4:11 with luck it will even still work

4:11 Raynes: What are you doing?

4:12 Mutilating sed? :p

4:12 amalloy: yeh

4:12 Raynes: Cute.

4:12 Take pity on him though. That was some of his first Clojure code.

4:12 amalloy: sure

4:13 i don't judge

4:13 i just enjoy the fixin'

4:13 Raynes: I wish I enjoyed tidying stuff up as much as you.

4:24 amalloy

4:24 $source clojure.contrib.json/pprint-json

4:24 sexpbot: clojure.contrib.json/pprint-json is http://is.gd/gLXiF

4:25 amalloy: Raynes: weren't you going to make it say "Raynes: blah is..."

4:25 Raynes: Yes, but this looks better imo.

4:25 amalloy: well done getting the :line meta for json though

4:25 Raynes: &(meta #'clojure.contrib.json/pprint-json)

4:25 sexpbot: ⟹ {:ns #<Namespace clojure.contrib.json>, :name pprint-json, :file "clojure/contrib/json.clj", :line 338, :arglists ([x]), :doc "Pretty-prints JSON representation of x to *out*"}

4:26 Raynes: Yeah, I was trying to get it off of the actual function earlier. Don't know what I was thinking.

4:26 amalloy: oh hah

4:26 i didn't catch it either

4:29 damn it. i'm trying to make the trailing / optional, but because regexes are confusing it's not working

4:34 ah. the same regex was in three different places and i missed one of them :P

4:53 Raynes: &(= (sort "eleven plus two") (sort "twelve plus one"))

4:53 sexpbot: ⟹ true

4:54 amalloy: haha

4:54 who knew sorting was the same as math

5:03 Raynes: amalloy: I've run out of things to do.

5:03 amalloy: Raynes: got it working, gonna push it to tidy and head to bed

5:03 * Raynes eats his burrito.

5:03 Raynes: Cool stuff. I'm going to eat my burrito and head to bed.

5:03 Night buddy. <3

5:04 amalloy: Raynes: honestly not sure which of us is sabotaging our chances of sleeping more

5:04 Raynes: Me.

9:38 bartj: Is there a better way to do this: http://pastie.org/1277059

9:40 essentially, trying to select keys from a multiple maps; the values of each key is the combination of all the individual values of the maps

9:41 mrBliss: &(into {} (filter (comp #{:a :b} first) (merge-with list {:a 1 :b 2 :c 3} {:a 2 :b 3 :c 4})))

9:42 ,(into {} (filter (comp #{:a :b} first) (merge-with list {:a 1 :b 2 :c 3} {:a 2 :b 3 :c 4})))

9:42 clojurebot: {:a (1 2), :b (2 3)}

9:42 hoeck: ,(select-keys (merge-with list {:a 1 :b 2 :c 3} {:a 2 :b 3 :c 4}) [:a :b])

9:42 clojurebot: {:b (2 3), :a (1 2)}

9:42 sexpbot: ⟹ {:b (2 3), :a (1 2)}

9:44 bartj: hoeck, that is beautiful!

9:44 mrBliss, thanks!

9:44 hoeck: bartj: it's just clojure! :)

9:45 bartj: hoeck, I mean my version is ugly :)

9:46 hoeck: bartj: but the merge-with differs from your solution when a key is only present in one map

9:47 ,(merge-with list {:a 1 :b 2} {:b 3})

9:47 clojurebot: {:a 1, :b (2 3)}

9:47 bartj: hoeck, hmm...

9:47 hoeck: wheras yours returns {:a (1 nil) :b (2 3)} in this case

9:52 bartj: I thought it would always coerce the value to a list...

9:54 hoeck: bartj: no, merge with only uses the given function if a key appears in more than one hashmap

9:56 bartj: http://pastie.org/1277092 <- using reduce, longer than yours and not as clean as the merge-with solution

10:00 bartj: hoeck, hmmm

10:00 hoeck, that doesn't look good for multiple maps?

10:04 is there a clojure function which does "a thing" on all the values of the map and returns a map?

10:05 my current procedure is to use (zipmap (keys m) (map #(do-something) (vals m))) ;where m is a map

10:07 Chousuke: there's fmap in contrib

10:07 you can also do (into {} (map (fn [[k v]] [k (f v)]) somemap))

10:08 AWizzArd: alternatively: reduce

10:09 ,(reduce (fn [m [k v]] (assoc m (+ k 5) (+ v 100))) {} {1 2, 3 4, 5 6})

10:09 clojurebot: {10 106, 8 104, 6 102}

10:09 hoeck: bartj: https://gist.github.com/665449

10:14 fliebel: morning

10:16 AWizzArd: Moin flieb

10:20 mfex: hi fliebel

10:21 SenseScalps: hi all

10:21 fliebel: Hi SenseScalps, found any goos starting space for Clojure the other day?

10:21 mfex: fliebel: I ran you minecraft project and for some reason it prints some of the bytes to the screen while reading the files. does this happen for you as well?

10:22 fliebel: mfex: Yea, I'm afraid this is a showcase of the quality of coding delivered by the avarage Minecraft player. It's comming the the NBT lib.

10:23 mfex: fliebel: glad to see I'm not going crazy :)

10:23 fliebel: mfex: Same with the Python thing, I had to jump through a hoop to be able to close the files I opened.

10:23 mfex: fliebel: but I guess it does hinder performance quite a bit

10:24 fliebel: mfex: It might, but only the file reading part.

10:25 mfex: fliebel: my approach centers around getting the freqs per layer per file and hoping to pmap that

10:26 fliebel: mfex: per layer works well if you do it the array way, but per file for me only generated overheat ov having to consolidate the results of all the files.

10:27 uhm, consolidate is not the right word.. I mean...

10:27 unify?

10:28 mfex: My version runs in 20-30s now.

10:29 mfex: fliebel: the slowest I got was 49s

10:30 fliebel: mfex: And the fastest?

10:30 mfex: fliebel: err that was the fastest :)

10:32 fliebel: mfex: Well, you came all the way from 160 to 50, so that's not bad. But I think it's time to stop this optimizing. We're still talking about tens of seconds, wile Python is doing it in under 5.

10:34 mfex: fliebel: I haven't tried any approach yet that completely follows the python approach, mine still have a byte array per file

10:34 fliebel: mfex: The 20s I got was with some smart-ass stuff to work with arrays all the time. Came form the mailing list: http://groups.google.com/group/clojure/browse_thread/thread/3c759739c265d14d/51b7d6233c7b1b10#51b7d6233c7b1b10

10:35 bartj: Chousuke, AWizzArd, hoeck thank you for your responses; had to go out a bit

10:35 fliebel: mfex: The Python solution is simply no good on the JVM, I ran it in Jython, and it is a massive suck on there.

10:37 mfex: Or at least not on high-level languages implemented on the JVM, I guess they have to much abstraction to efficiently iterate and store such a huge list of items.

10:42 mfex: gtg, speek you later :)

11:02 tomoj: uhh.. why are single-segment namespaces bad, again? I should remember this. :(

11:02 aleph-core->lamina gave us (ns lamina)

11:15 mabes: tomoj: I think they are bad for java interop reasons...

11:15 tomoj: ah

11:16 mabes: tomoj: *I think*. I can't remember the details either.

11:17 tomoj: clojurebot: single segment namespaces?

11:17 clojurebot: single-segment namespaces is unsupported. (foo instead of foo.core) they may work in a few circumstances, but you shouldn't rely on them.

11:17 tomoj: "Do avoid single-segment namespaces though, which would result in classfiles being generated in the default package." http://stackoverflow.com/questions/2223190/

11:20 Bootvis: did something happen to clojure.contrib.repl-utils?

11:21 MayDaniel: Bootvis: clojure.repl

11:21 Bootvis: thanks

11:35 tomoj: grr

11:40 qed: Morning(ish)

11:44 DeusExPikachu: how does one get the git version of clojure 1.3?

11:45 the master branch of github.com/clojure seems to be for 1.2

11:48 nm, was using richhickey github, not he right one

14:14 Raynes: amalloy: Are you awake?

14:18 Vinzent: Is there an emacs function to change ns in the repl to the ns of the current buffer?

14:19 or I should write own one

14:20 hoeck: Vinzent: C-p M-p RET

14:20 C-p M-p defaults to the namespace of the current *.clj buffer

14:23 Vinzent: Great, thank you! And probably you mean C-c M-p

14:25 hoeck: Vinzent: sorry, right

14:43 LauJensen: Man C-c M-p is great, how long have you guys known about this?! :)

14:44 Raynes: Since you were just a gleam in your father's eye. Get off my lawn.

14:44 * Raynes continues hunting for greg burd's email address.

14:48 Vinzent: LauJensen, :) By the way I want to thank you for your blog - I've found a lot of interesting things there!

14:48 LauJensen: Vinzent: You're welcome :)

14:49 Raynes: Greg Burd, a project manager at Oracle, happens to own the tryclojure.com domain, and is willing to transfer it to me.

14:49 I should be happy, but all I can think is "why couldn't he have tryclojure.org? :("

14:50 LauJensen: ?

14:50 Raynes: tryclojure.org would be more consistent. There are no trylanguage.com sites. Only .org sites.

14:51 I'm a sucker for details.

14:51 Not that try-clojure.org is any more consistent with the other sites.

14:51 tryclojure.org was probably available at the time, but Licenser probably didn't think to check because he's German. ;)

14:53 LauJensen: Raynes: German er legendary for their thoroughness and attention to detail, look at how they build cars!

14:53 s/German/Germans/

14:53 sexpbot: <LauJensen> Raynes: Germans er legendary for their thoroughness and attention to detail, look at how they build cars!

14:53 Raynes: But he is a special German.

14:54 LauJensen: Oh.. He's 'Open' then :)

14:54 Opel

14:55 That might mean nothing to you. The well known German cars are Mercedes (High Quality, Luxury), BMW (High Quality), Audi (Pretty, low quality) and VW (Mid-High Quality, boring) and Opel (Ordinary, okay quality)

14:57 Raynes: Meh.

14:57 I drive a '96 F150 XL pickup. :|

14:58 LauJensen: Ford?

14:58 Raynes: LauJensen: Yes.

14:59 LauJensen: k.. Ford is big here too. Im not too fond of them

15:00 Raynes: I wish I had a 4 door pickup.

15:01 Looks like F-Series sales have been slowly decreasing since '04.

15:04 Tough truck though. I backed it into a pole (didn't see it because the pole was shorter than the truck) leaving Walgreens last week. Didn't scratch it.

15:05 The pole didn't suffer much damage either. I wasn't moving very fast, just backing out of a tight parking space.

15:05 LauJensen: Nice. How durable is it? Are you getting repairs on it every now and then?

15:05 Raynes: Cars not hurt, poles not hurt. Any change you just backed over a little old lady or something? Go check under the car

15:06 Raynes: It's got 194k miles on it. Haven't had it for long. Only thing that's been done to it since we got it a few months ago is a new starter and door handle that locked up and broke off.

15:06 But, for something with 194k miles on it...

15:07 It doesn't even look too bad. It had some shoddy body work after somebody wrecked it ages ago, but it isn't terrible.

15:07 Also, little old ladies aren't stout enough to make a truck stop on a dime. :p

15:07 LauJensen: Ok, I should ask you again in a year though, it takes a long time (for me at least) to get comfy with a brand. I've had Peogeot (avoid French cars like the flu), Mercedes and now I'm looking for a BMW, hopefully I can find something nice next week

15:08 amalloy: Raynes: awake now. que pasa?

15:08 Raynes: amalloy: Ohai.

15:09 It's the first stick I've ever driven. Manual transmissions give a little excitement to driving.

15:09 LauJensen: ?

15:09 amalloy: Raynes: they're fun. i learned to drive stick after i bought my car :P

15:09 Raynes: There is always that slight tension that, if you screw up, you could roll backwards into the semi at the stop light.

15:10 LauJensen: Raynes: I get so annoyed with manual shifting - Why should I have to instruct the car on when to shift gears? .. Guess I'll have to get used to it though

15:10 Raynes: Being new to it, I really like it. Ask me again in a year and I'll probably be sick of it.

15:11 LauJensen: Ask me again in a year and I might like it. My uncle is a BMW fanatic, he wouldn't want it any other way

15:12 We should really get this into our calendars, so much to pick up on a year from now

15:12 amalloy: btw LauJensen give my thanks to the germans. i love my passat

15:12 LauJensen: amalloy: You do ? It must be one of the older models, they were quite solid engineering

15:12 amalloy: 2000

15:13 LauJensen: Yea, thats the good model

15:13 amalloy: the new ones are no good?

15:13 LauJensen: amalloy: I've hear the have problems. Like the clutches wearing out etc. They drive smoothly like Mercedes though

15:13 But generally, I think VW is too error prone

15:20 Raynes: I've wanted to drive an Audi since I watched the Transporter series.

15:21 amalloy: clojure has some sort of weighted-random-choice thing built in, doesn't it?

15:22 mrBliss: amalloy: not built-in but: wrand in http://clojure.googlegroups.com/web/ants.clj?gda=AonnajoAAADKqc_OBXvAPFRl94RaAIUvKeh6_1AakPQPpm5YTGkHfO9OU0NQiFWgQuhmPR7veGf97daDQaep90o7AOpSKHW0

15:23 amalloy: mrBliss: ah. i've written one too, but i was hoping to find a "standard" one

15:33 riddochc: Hi, folks. Any incanter users around? I'm trying to figure out how to do a line graph with more than one line on it, and have hit a wall.

15:38 amalloy: aha! incanter has (defn roulette-wheel [freqs]), which is exactly what i wanted

15:43 riddochc: amalloy: Cool, that could be useful for various things...

15:43 amalloy: riddochc: yeah, sorry but i've never used incanter so i can't really help with graphs

15:46 riddochc: amalloy: That's okay, I think I'll just use gnuplot for now. I'll come back to incanter again, when I've got some more time to figure this out. Looks like if I figure it out, I should help a little with the documentation by writing up what I figure out.

15:48 amalloy: riddochc: often the case :)

15:59 Raynes: pircbot. it looks like the branch is still around just for sentimental reasons. do you mind if i kill the branch and replace it with a tag?

16:00 Raynes: amalloy: Not sentimental reasons as much as for historical reasons.

16:00 But yeah, go for it.

16:00 No particular reason for it to be a branch.

16:00 amalloy: hurrah

16:00 Licenser: Raynes, LauJensen: try-clojure.org has a reason, dashes are clojures usual way to name multi word symbols since there is no word tryclojure (unless I am mistaken which of cause isn't the case) but the side says: "try clojure" I found it the best way to go with clojures notation there: try-clojure.

16:01 Raynes: Licenser: I would have aimed for consistency with the other trylanguage sites. It doesn't particularly matter. Just a name. Don't think I'm not grateful for the domain name! :D

16:02 Licenser: Where have you been lately? Working hard, or hardly working?

16:02 I miss my German buddy. <3

16:02 Licenser: I hate consistency we are better so we can have better name :)

16:02 amalloy: haha

16:03 Licenser: first working hard then hardly working in vacation :) which also hits me now, GF wants my attention, see you later people!

16:03 Raynes: Women. Stealing our coders.

16:03 amalloy: Raynes: relax. it doesn't happen often :)

16:03 Raynes: :p

16:04 SergeyD: BTW, Jacob Nielsen advises not to use dashes in domain names.

16:04 For better usability

16:11 riddochc: Argh. Word processors suck.

16:12 kryft: Why use one?

16:13 riddochc: Indeed. If I'd done this in LaTeX, I'd have been done a long time ago. Every once in a while, I think, "Maybe it might be easier..."

16:13 pppaul: word procs are hell

16:19 riddochc: Bother. I'm just going to make this graph with pen, rulers, and colored pencils now. It'll just save me time.

16:19 amalloy: riddochc: save yourself some time and engrave it in stone. you know that'll be next anyway

16:20 riddochc: For a list of the ways in which technology has failed to improve our quality of life, press 8.

16:20 amalloy: :)

16:20 amalloy: Raynes: hurrah, more cleanup completed: pircbot is now a tag, and all branches have active development

16:20 hoeck: riddochc: though latex has lots of warts and inconsistencies, being able to edit and navigate the document in your favourite editor beats all the word processors on this planet

16:21 riddochc: hoeck: Agreed. That counts for a lot.

16:22 hoeck: riddochc: well, and you can use git/hg, diff, grep, find etc etc :)

16:23 riddochc: hoeck: Oh, yeah. I've become a major advocate for git, even just for single documents.

16:24 I haven't looked in a while, but if there's a tortoise-* thing for git on windows, I'd be suggesting it to my non-technical friends, too.

16:25 Ah, there is. Cool. http://code.google.com/p/tortoisegit/

16:40 SergeyD: Could you advise on how to write a macro that makes the following transform?

16:40 (mymacro [par1 par2] some-form-with-par1-par2)

16:40 into

16:40 (let [par1 "par1" par2 "par2"] some-form-with-par1-par2)

16:41 chouser: SergeyD: first write a function that does that

16:42 (defn myfn [par-vector form] ...)

16:43 & ((fn myfn [par-vector form] (interleave par-vector (map str par-vector))) '[par1 par2] 'body)

16:43 sexpbot: ⟹ (par1 "par1" par2 "par2")

16:45 SergeyD: chouser, thanks!

16:46 amalloy: &(vec (mapcat (juxt identity str) '[par1 par2])) ; chouser?

16:46 sexpbot: ⟹ [par1 "par1" par2 "par2"]

16:47 SergeyD: nice :)

16:51 amalloy: SergeyD: you might want to change identity to symbol: it's slightly shorter, and then you could use it as (mymacro ["foo" "bar"]) as well as (mymacro [foo bar]) if you wanted

16:52 SergeyD: ammaloy, thanks, I'll try

17:01 Derander: okay, so I'm writing what amounts to an infinite loop for a daemon in clojure

17:01 is there a way to test this in a repl w/o having to restart slime everytime?

17:04 amalloy: Derander: have the daemon check an atom at every iteration? then swap! it with ::stop when you want it to stop

17:04 Derander: that is a good idea

17:04 thank you sir

17:05 amalloy: Derander: a classic hack, but not very good obviously. do something more clever when you're done developing :P

17:05 Derander: heh

17:06 amalloy: &(class :::test)

17:06 sexpbot: java.lang.Exception: Invalid token: :::test

17:15 amalloy: where's that function (f val pred), which returns val if (pred val) is true, and nil otherwise? it's so handy but i can never remember where to find it

17:21 Derander: amalloy: oh damn, that is handy

17:22 Raynes: chouser: You are so beautiful when you &. <3

17:31 nickik: has anybody used appengine?

17:37 amalloy: argh, i give up. i'll just write (when (pred x) x) :P

17:42 i know it's in clojure.contrib somewhere though, if anyone else feels like looking

17:51 defn: anyone in the room know anything about hudson?

18:05 SergeyD: Great, now I can destructure query (named) parameters in Ring. Anybody interested?

18:07 amalloy: okay, i feel kinda silly here. i have a seq of [x, y] pairs, and i want to turn that into a seq that looks like [[x1 x2 x3] [y1 y2 y3]]. surely there's a better way than ((juxt keys vals) (into {} pairs))...

18:09 SergeyD: amalloy, using get on pairs?

18:10 amalloy: SergeyD: i don't think i understand

18:10 MayDaniel: (apply map vector [[1 2] [3 4] [5 6]]) ?

18:12 ,(apply map vector [[1 2] [3 4] [5 6]])

18:12 clojurebot: ([1 3 5] [2 4 6])

18:12 amalloy: MayDaniel: aha, that's it. i thought map vector seemed right but i couldn't make it fit. thanks

18:24 powr-toc: I once remember seeing a diagram showing 'development flow' in clojure, it showed how the reader reads the text, spits out an AST, which macros operate on, which is then passed on to the evaluator... Does anyone know where I can find this diagram?

18:28 amalloy: Raynes (or anyone): M-x gist-buffer has stopped working for me recently. do we suppose this is another consequence of github's change to https?

18:29 powr-toc: ah its ok, I remember it was from Rich's clojure for java programmers presentation.

18:32 Derander: parsing xml with zippers is hard

18:32 html*

18:33 amalloy: Derander: is it xhtml-compliant?

18:34 Derander: amalloy: it's been run through html-cleaner

18:34 amalloy: the trouble is I don't understand zippers very well :-)

18:35 amalloy: Derander: i didn't either, but somewhere i have an example of parsing a not-quite-trivial xml tree. lemme find it for you

18:35 Derander: yeah. I'm at the stage where I can hack something together to parse trivial examples, but can't write something actually useful

18:36 SergeyD: Derander: may be Enlive can help you

18:36 Derander: I was *just* about to type that

18:37 It just occurred to me that enlive does this stuff

18:38 Raynes: amalloy: It's probable.

18:41 LauJensen: Would somebody do me a favor and take a look at core.clj on http://github.com/LauJensen/clojureql and explain to me why you can eval that file once but not twice due to Clojures warnOnOverride var stuff ?

18:41 (also, ClojureQL now supports aggregates)

18:42 amalloy: Derander: https://gist.github.com/ee00790a79259e69243a was me finding a map of {tag1 {attr1 val1, attr2 val2}} in a file that looked like <foo><databases><db1 config="bar" /></databases></foo>

18:42 Derander: thank you

18:46 morphling: LauJensen: line 56 in predicates.clj sholdn't this be clojure.core/not=?

18:47 LauJensen: morphling: no, != is a fairly common operator

18:48 morphling: I meant you apply = in = and = in != which seams odd

18:48 LauJensen: morphling: ah! thanks for staying sharp :)

18:48 morphling: I suspected a cut&paste error, but I might be wrong

18:49 LauJensen: fixed

18:51 morphling: LauJensen: I ran the test in clojureql.core in postgresql this afternoon, seems to work

18:51 (after removing "autoincrement")

18:51 LauJensen: morphling: Did that test include the joins?

18:53 morphling: yes, but "seems to work" only means there were no exceptions thrown, I didn't actually think about what the results should have been

18:55 LauJensen: hehe. Well the queries are simple, they should work on both backends. The joins worked if you see the :wage column being added in the resultset

18:57 And only the final test should return nil

19:15 morphling: LauJensen: I just checked again with the predicates commit, everything works as expected

19:16 LauJensen: Sweet. Thanks for testing - And while you were busy I fixed the ns reloading issue

19:19 morphling: great, pulling. So far I really like the new clojureql

19:20 samx: What's a simple way of changing nth element in a list ? Something like: (replace-elem-by-index 2 10 [1 2 3 4 5]) => (1 2 10 4 5)

19:21 amalloy: &(assoc [1 2 3 4 5] 2 10)

19:21 sexpbot: ⟹ [1 2 10 4 5]

19:21 samx: thx :-)

19:21 LauJensen: morphling: Glad to hear it - Im quite excited about it myself

19:22 Tomorrow I'll hopefully find time to fix 'rename' and then the major relational algebra primitives should all be there

19:22 Raynes: samx, amalloy: Note that that will only work for vectors and not for sequences.

19:22 amalloy: samx: caveats: that only works for vectors, not lists; it can't grow/shrink the vector, but only replace existing elements

19:22 ninjudd: LauJensen: is there a way to get sql out of a Relation? i'm thinking about writing some tests...

19:23 LauJensen: ninjudd: I think tests are a little pre-mature in the design alpha phase no? Right now the deref call compiles the SQL, but there's no reason that can't go into its own compile function. So if you want it I'll drop it in

19:25 samx: amalloy, raynes.. hmm, ok.. well, considering that i don't have a good feel yet on when the various functions return back a seq instead of a vector, i think i can live with that for now :-)

19:26 amalloy: samx: not many things return vectors, but you can turn any finite seq into a vector: &|(range 4)|& vs &|(vec (range 4))|&

19:27 Raynes: any idea why sexpbot didn't catch that?

19:27 LauJensen: ninjudd:

19:27 clojureql.core> (-> (table db :users [:id]) (project #{:title}) compile)

19:27 "SELECT users.title,users.id FROM users "

19:27

19:27 I'll push it now

19:27 Raynes: sexpbot: kill

19:27 sexpbot: KILL IT WITH FIRE!

19:27 Raynes: amalloy: No clue. He's still alive.

19:27 LauJensen: ninjudd: Its sign off time for me - Its in the master now :)

19:28 Raynes: amalloy: You broke it.

19:28 Wrong number of args passed to execute-text.

19:28 amalloy: bah

19:28 okay

19:29 Raynes: Watching a movie. If you fix it, I'll live the fix as soon as I return (within the next 30 minutes to an hour).

19:29 amalloy: yeah, i'm on it

19:30 Raynes: just missed a call site when adding params

19:32 anyway samx, (vec coll) turns coll into a vector, which is fine so long as it's finite

19:32 rata_: hi all

19:36 samx: amalloy, right.. vectors are reprecented as some type of trees underneath, right?

19:37 just trying to figure how much overhead i'll be adding by the seq-to-vector conversion.. that is, if i should just be using a list for my data in the first place

19:38 lllo: what would be the preferred way to parse HTML(XML) in clojure

19:39 nickik: can i somehow add something to a classpath in leiningen? with en entery in the project.clj or somewhere else?

19:43 lllo: does clojure have a xml namespace or something?

19:44 something I can use?

19:46 nickik: clojure.xml

19:46 it does

19:46 lllo: does it require anything else?

19:47 nickik: (parse <your xml>)

19:47 not

19:47 *no

19:47 lllo: ok cool

19:50 rata_: lllo: there's a lazy-xml too I think

19:50 lllo: hm

19:50 parsing a html page didn't work :(((((

19:50 amalloy_: lllo: html is not, in general, well-formed xml

19:51 nickik: ah html is diffrente if it is not done write

19:51 *right

19:51 lllo: oh

19:51 I thought it was an xml type of thing :(

19:51 damn

19:51 nickik: only xhtml is

19:52 amalloy_: lllo: if you converted it to xhtml first you could use http://richhickey.github.com/clojure-contrib/#zip-filter

19:52 nickik: what is it exactly what you want to do?

19:55 hiredman: you can use tagsoup and clojure.xml together to parse html

19:57 http://markmail.org/message/2e7i72y4cg36wqdx is a little dated

20:00 lllo: I want to download a page from a site

20:00 and parse it for some info

20:00 I guess I'll do it with regexes

20:00 currently I get this message if I try to parse it

20:01 java.net.MalformedUrlException no protocol: <whole html file>

20:01 amalloy_: lllo: that has nothing to do with parsing

20:01 hiredman: read the docs

20:01 lllo: you think?

20:02 amalloy: &(doc clojure.xml/parse)

20:02 sexpbot: ⟹ "([s] [s startparse]); Parses and loads the source s, which can be a File, InputStream or String naming a URI. Returns a tree of the xml/element struct-map, which has the keys :tag, :attrs, and :content. and accessor fns tag, attrs, and content. Other parsers can be supplied by passing startparse, a... http://gist.github.com/665831

20:02 lllo: oh

20:02 so instead of passing it the html I can just give it the URL?

20:02 amalloy: indeed must, not just can :)

20:02 devinus: i'm not trying to start a flame war, but if i chose Clojure to learn for a lisp experience, would I miss out on the full lisp experience by shunning CL?

20:03 amalloy: devinus: you'd certainly miss out on some flame wars, which are arguably a part of the full experience

20:03 lllo: hahahahaha

20:03 devinus: :)

20:04 lllo: oh man I have flamewars all the time

20:04 devinus: i'm sure. I'm just trying to learn something that will give me the "Aha!" enlightenment expeience everyone apparently had in the 80's and 90's with Lisps

20:04 amalloy: i'd say no, but i only spent three weeks with CL before i gave up. very cool conceptually, but too much work to actually write in practice

20:04 lllo: my coworker: "all languages are of the same difficulty and they all work about the same"

20:05 amalloy: lllo: all Blub languages, *maybe*

20:05 lllo: I said: "try Haskell for difficulty". response: "lol wuts haskell"

20:06 that's the day I realized I work with people that have never seen anything but C, Java, Pascal

20:06 and their derivatives

20:06 delphi for instance

20:06 amalloy: whoa what is pascal doing on that list. python and perl are the usual Ps that go there

20:06 lllo: Woah Python is dynamically typed

20:07 nobody at my work knows of anything that new :P

20:08 dnolen: devinus: CL has plenty of cool stuff, so does Scheme. They still have a lot of aha! to offer. Clojure has some unique aha!'s that you won't get programming Scheme or CL.

20:08 devinus: hrm

20:12 dnolen: devinus: what programming languages are you familiar w/ ?

20:12 devinus: dnolen: Erlang, JS, Python, Ruby

20:15 dnolen: devinus: if you're familiar w/ those then you'll probably have a lot of fun w/ Clojure.

20:16 lllo: man

20:16 (clojure.xml/parse "http://en.wikipedia.org/wiki/Bear") returns Server returned HTTP response code: 500 for URL: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd

20:17 damn

20:18 samx: devinus, i really wouldn't worry about missing any ahas.. you can always read books/code/articles of CL/Scheme later; all of them should be fairly accessible after knowing one lisp.. at the moment i'd choose clojure as my first choice, just because it seems to have a decent amount of momentum behind it, while hmm.. CL and Scheme do not

20:21 devinus: does clojure do continuations?

20:21 samx: nope

20:22 devinus: hrm apparently theres a library

20:22 dnolen: devinus: delimited continuations, I ported it from CL

20:22 samx: right.. but not first class continuations, is in scheme

20:41 rata_: why (key nil) throws an NullPointerException?

20:42 amalloy: rata_: because nil isn't a map entry?

20:42 rata_: yes, but shouldn't it say imposible to cast nil to map entry?

20:42 amalloy: no, you can cast nil to anything

20:43 rata_: well, any other exception message that's more descriptive would be ok

20:44 specially as nils can occur almost everywhere

20:45 amalloy: &|(.cast String nil)|& &|(.cast String "blah")|& &|(.cast String 'blah)|&

20:45 sexpbot: (.cast String nil) java.lang.IllegalArgumentException: No matching method found: cast

20:45 (.cast String "blah") java.lang.IllegalArgumentException: No matching method found: cast

20:45 (.cast String 'blah) java.lang.IllegalArgumentException: No matching method found: cast

20:45 amalloy: hey what? that works on my repl

20:48 &(.cast java.lang.String nil)

20:48 sexpbot: java.lang.IllegalArgumentException: No matching method found: cast

20:48 amalloy: wtf. Raynes, why doesn't this work?

20:48 ,(.cast java.lang.String nil)

20:48 clojurebot: nil

20:49 Raynes: I don't know.

20:52 lllo: .cast is a java function?

20:53 amalloy: String.class.cast("blah")

20:53 lllo: try

20:54 ,(cast java.lang.String nil)

20:54 clojurebot: nil

20:54 amalloy: haha well that's a little better than using .cast, but .cast should work too

20:54 http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Class.html#cast%28java.lang.Object%29

20:54 Raynes: &(String. "")

20:54 sexpbot: ⟹ ""

20:54 lllo: then you need to do this

20:54 amalloy: &(cast String "")

20:54 sexpbot: ⟹ ""

20:55 Raynes: &(.replace "x" "x" "y")

20:55 sexpbot: ⟹ "y"

20:55 Raynes: I don't know why that isn't working.

20:55 Maybe a sandbox bug.

20:55 Doesn't look like it.

20:56 lllo: for some reason I can't get String.class

20:57 amalloy: &String

20:57 sexpbot: ⟹ java.lang.String

20:57 lllo: (String/class) doesn't work

20:57 amalloy: lllo: String *is* String.class

20:57 lllo: no

20:57 Raynes: ...

20:57 amalloy: (class String)

20:57 lllo: String is java.lang.String

20:57 amalloy: &(class String)

20:57 sexpbot: ⟹ java.lang.Class

20:57 lllo: ok

20:58 I wanted Class<String>

20:58 amalloy: lllo: clojure doesn't have generics

20:58 &(identical? String (.getClass ""))

20:58 sexpbot: ⟹ true

20:59 lllo: ,(.cast String nil)

20:59 clojurebot: nil

20:59 lllo: ok

20:59 then this is how you need to call .cast

20:59 amalloy: well, but as you pointed out i should just use cast, not .cast

20:59 Raynes: &(.cast String nil)

20:59 sexpbot: java.lang.IllegalArgumentException: No matching method found: cast

20:59 amalloy: no point using interop functionality when there's a wrapper already

21:00 lllo: &(.getClass() "")

21:00 sexpbot: java.lang.IllegalArgumentException: No matching method found: getClass for class clojure.lang.PersistentList$EmptyList

21:00 amalloy: lllo: ()......

21:00 Chousuke: :)

21:00 lllo: &(.getClass "")

21:00 sexpbot: ⟹ java.lang.String

21:00 lllo: see

21:00 Chousuke: ,String

21:00 clojurebot: java.lang.String

21:00 amalloy: lllo: see what?

21:01 lllo: &(.cast (class String) nil)

21:01 sexpbot: java.lang.IllegalArgumentException: No matching method found: cast

21:02 lllo: what the hell

21:02 amalloy: lllo: some kind of bug with the sandbox sexpbot is using

21:02 Raynes and i will look into it when we get a chance

21:02 lllo: ,(.cast (class String) nil)

21:02 clojurebot: nil

21:02 Chousuke: lllo: (class String) returns Class

21:02 lllo: yes I know

21:02 Chousuke: what are you trying to figure out anyway?

21:03 lllo: and .cast is a Class class member

21:03 I don't understand how some can call .cast on java.lang.String, it's not a member method

21:03 IIRC

21:03 amalloy: Chousuke: rata_ was annoyed that (key nil) threw NPE instead of bad cast

21:03 lllo: instead of IIRC why don't you just look at the link i gave, to exactly that member method

21:03 Chousuke: lllo: hm

21:04 rata_: instead of anything more descriptive

21:04 Chousuke: lllo: cast is a method of the Class class

21:04 lllo: and java.lang.String is an instance of Class

21:05 lllo: no, java.lang.String is java.lang.String

21:05 it's class is

21:05 java.lang.Class<String>

21:06 and that has .cast member

21:06 java.lang.String doesn't have .cast member

21:06 Chousuke: erh, the class object instance does

21:06 ,(class java.lang.String)

21:06 clojurebot: java.lang.Class

21:06 Chousuke: see

21:06 lllo: yes

21:06 hiredman: ,(->> String class .getMethods (map #(.getName %)))

21:06 clojurebot: ("forName" "forName" "isAssignableFrom" "isInstance" "getModifiers" "isInterface" "isArray" "isPrimitive" "getSuperclass" "getComponentType" ...)

21:07 hiredman: ,(->> String class .getMethods (map #(.getName %)) (filter (partial = "cast")))

21:07 lllo: still doesn't explain how you can do

21:07 clojurebot: ("cast")

21:07 lllo: ,(.cast String nil)

21:07 clojurebot: nil

21:07 Chousuke: lllo: because String is the class object

21:07 lllo: this shouldn't be possible

21:08 Chousuke: lllo: String is not equivalent to what you get if you type String in java.

21:08 lllo: it's like String.class

21:08 amalloy: lllo: that is exactly equivalent to the following java: (String.class.cast(null))

21:08 lllo: then why do we have function class

21:08 Chousuke: lllo: it gets the class of an instance.

21:08 lllo: and why does String != (class String)

21:08 it's the same thing

21:08 amalloy: &(map (juxt identity class) [String ""])

21:08 sexpbot: ⟹ ([java.lang.String java.lang.Class] ["" java.lang.String])

21:09 Chousuke: lllo: because the class of a class object is not the same as the class of an instance of the class that the class object represents :P

21:09 lllo: String.class == "".getClass == (class String)

21:09 Chousuke: lllo: no

21:09 class String is kind of "String.class.class"

21:09 amalloy: Chousuke: it's actually String.class.getClass()

21:09 Chousuke: ie. the Class object representing Class :P

21:10 lllo: aw geeze, why is clojure complicating this

21:10 Chousuke: lllo: it's not complicated

21:10 amalloy: it's not

21:10 lllo: String

21:10 Chousuke: lllo: what are you still confused about

21:10 lllo: ,String

21:10 clojurebot: java.lang.String

21:10 Chousuke: yes

21:10 a class object

21:10 lllo: yes that's confusing

21:10 Chousuke: how so?

21:10 amalloy: lllo: so don't use it

21:10 Chousuke: what should it be?

21:11 lllo: it says java.lang.String when actually it's Class<java.lang.String>

21:11 if what you say is true

21:11 His_Shadow: ->[\I \space \W \o \r \s \h \i \p \space \H \i \s \space \S \h \a \d \o \w]

21:11 sexpbot: ⟹ [\I \space \W \o \r \s \h \i \p \space \H \i \s \space \S \h \a \d \o \w]

21:11 amalloy: (.toString (class ""))

21:11 lllo: the printout misrepresents what it actually is

21:11 amalloy: &(.toString (class ""))

21:11 sexpbot: java.lang.IllegalArgumentException: No matching method found: toString

21:11 Chousuke: ,(print String)

21:11 clojurebot: java.lang.String

21:11 Chousuke: lllo: it's not clojure's fault :P

21:11 java prints class objects like that.

21:11 amalloy: ,(.toString (class ""))

21:11 clojurebot: "class java.lang.String"

21:12 amalloy: Chousuke: not actually true

21:12 lllo: here it says class

21:12 in clojure it doesn't

21:12 therefore its misleading

21:13 and here's another thing

21:13 Chousuke: Possibly the printout is java.lang.String because that reads in as a class object too

21:13 lllo: when you do type hiting

21:13 you hint that the type you are passing in is a String, yet the "String" resolves to Class class

21:13 Chousuke: so (eval (read-str (print-str String))) returns String

21:14 lllo: type hints are not class objects anyway

21:14 just symbols

21:14 or strings

21:23 lllo: I know

21:23 I'm just saying it's confusing sometimes :)

21:29 amalloy: hm. i'm implementing a quite simple lexer in clojure, and doing kinda a bad job of it. anyone have a reference to someone who did it well?

22:18 hiredman: ~#68

22:18 clojurebot: 68. If we believe in data structures, we must believe in independent (hence simultaneous) processing. For why else would we collect items within a structure? Why do we tolerate languages that give us the one without the other?

22:49 jfkw: Clojure newb, starting off with some java interop (the jackcess library) and I'm trying to build the sample expression inside-out:

22:49 System.out.println(Database.open(new File("my.mdb")).getTable("MyTable").display());

22:49 (jackcess.Database.open (java.io.File. "/path/to/my.mdb"))

22:50 hiredman: which java interop form is that?

22:50 jfkw: The first one is the jackcess sample code at http://jackcess.sourceforge.net/

22:50 hiredman: no it's not

22:51 ah, you mean the java

22:51 I meant "of the clojure code you just pasted, what interop form is that?"

22:51 I had assumed "which java interop form is that?" was clearly not a question about java code

22:54 samx_: how do i do a map over the values of a hashmap (and get a map back) ? (That is: (map #(* % 2) { 1 10 2 20 }) => { 1 20 2 40 }

22:54 Raynes: (.display (.getTable (Database/open (File. "/path/to/my.mdb"))) "MyTable")

22:54 amalloy: samx_: look up fmap in clojure.contrib

22:55 Raynes: samx: (into {} (for [[k v] {1 10 2 20}] [k (f v])) works.

22:55 amalloy: (Raynes's is the way to do it with no libraries)

22:56 Raynes: (map (fn [[k v] m] [k (f v)]) { 1 10 2 20 }) works as well, but if you're going to destructure, you might as well use for.

23:06 samx_: thx.. the 'into' one seemed to work, but can't get the 'map' one to work, and not really getting what you are trying to do in it to even fix it

23:06 amalloy: samx_: you still need into; he means to replace for with map

23:07 samx_: ah, right

23:10 amalloy: Raynes: i don't think i'll use jflex for this thing, but it would be neat to build a cake plugin for it. do you know how to do that, or is that ninjudd's thing?

23:10 Raynes: I wrote the second ever cake plugin.

23:10 I know my stuff.

23:10 amalloy: excellent

23:17 jfkw: If using lein swank, added :dependencies [org.clojars.gilesc/jackcess "1.2.0"], present ./lib/jackcess-1.2.0.jar, in what way is my (import '(com.healthmarketscience.jackcess Database)) incorrect?

23:18 Could not initialize class com.healthmarketscience.jackcess.Database [Thrown class java.lang.NoClassDefFoundError]

23:29 nimred: which which way to install clojure/swank/slime/ for use with emacs ?

23:37 samx_: Is there a function in the standard libraries to calculate powers ? (Math/pow 2 3) is easy enough, just wondering

23:38 hmm... actually, I guess Math/pow will always end up convering values to doubles

23:39 amalloy: &(doc clojure.math/expt)

23:39 sexpbot: java.lang.Exception: Unable to resolve var: clojure.math/expt in this context

23:39 amalloy: &(require 'clojure.math)

23:39 sexpbot: java.io.FileNotFoundException: Could not locate clojure/math__init.class or clojure/math.clj on classpath:

23:39 amalloy: bah

23:40 samx_: it's clojure.math/expt, or i guess maybe clojure.contrib.math/expt

23:40 Raynes: amalloy: Yeah, I can't figure that one out either. Motivation to work on you know what.

23:40 samx_: ok. thx

23:44 Raynes: amalloy: Since when is there a clojure.math namespace, by the way?

23:45 amalloy: Raynes: man, like i said: or maybe clojure.contrib.math

23:45 Raynes: Hehe.

23:45 amalloy: which *apparently* is where it actually is

23:45 nimred: where to find a recent documentation on installing clojure/swank/slime ? Any www link to point to ?

23:46 amalloy: nimred: there's a swank-clojure package in elpa

23:46 wooby: nimred: http://data-sorcery.org/2009/12/20/getting-started/ and scroll down a bit

23:46 nimred: i do not use elpa

23:49 File error: Cannot open load file, slime

23:50 http://clojure.pastebin.com/BHDt3H1Z

23:51 http://clojure.pastebin.com/mvqjB3BB

23:51 oops

23:51 http://clojure.pastebin.com/mvqjB3BB

23:52 should'nt it work ?

23:59 wooby amalloy no way to install without using elpa ?

23:59 amalloy: nimred: there is, but it's been a while since i did it and my instructions won't be very good

Logging service provided by n01se.net