#clojure log - Apr 04 2010

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

0:04 underdev: so maven is complaining that the JAVA_HOME environment variable is not set, while reporting that java home is /usr/lib/jvm/java-6-sun-1.6.0.15/jre and "echo $JAVA_HOME" reports that its been set

0:05 should i just ignore the warning, 'cause it's really starting to piss me off...

0:09 this is just getting so awesome... if i "JAVA_HOME=$JAVA_HOME;export JAVA_HOME" from the command line, maven is happy

0:10 cemerick: underdev: sounds like you're just setting JAVA_HOME, as opposed to putting it into your profile

0:12 underdev: okay, for some reason every other variable is happy being set in my .bashrc, except JAVA_HOME, which can be exported from there. Maven's happy now.

0:12 must be exported, i mean

0:13 cemerick: I've never been clear on the semantics of env vars across child processes, etc., but I always export stuff I want to make sure is available everywhere.

0:14 underdev: weeee, maven is satisfied

0:16 cemerick: no, you can't do that, because maven chokes if i export M2_HOME

0:16 cemerick: well, I've never messed with the default .m2 location *shrug*

0:16 underdev: well, i'm sure it works for you. i should say *I* can't do it

0:17 i'm not

0:17 please Jesus, tell me i'm not

0:19 wouldn't it be great if the directions at maven.apache.org were outdated or wrong. that would be special.

0:22 yeah, it made a .m2 dir in ~

0:28 _ato: basically if a var is not exported then child processes won't inherit it

0:30 something else may have exported it for you, which may be why other vars you're setting in your profile like say PATH don't appear to need it

0:31 underdev: hmm, maybe the child process needs the JAVA_HOME, but the shell needs the M2_HOME and M2?

0:32 i wonder why exporting M2_HOME screwed up mvn... it complained about class-loading issues, which i'm sure as hell not trying to get into now

0:33 cemerick: underdev: you simply do not need to set M2_HOME

0:33 unless you want the local repo to be somewhere other than ~/.m2

0:34 underdev: hmm, that doesn't appear to be what m2_home is refering to... it puts the repository in ~/.m2, but wants that env var to point at the maven home dir, and m2 to point at the /bin dir under that

0:35 again, the whole point is i want to learn what is actually going on under the hood.. ignorance was bliss

0:35 cemerick: oh, I see

0:36 I'm entirely ignorant of the inner plumbing of maven, thankfully.

0:40 underdev: me too, obviously. I'm tired of nievely searching for someone who has done whatever monkey trick i need to do with lein.

0:41 but next time i'll definitely have apt take care of all this for me

0:42 cemerick: FWIW, maven 3 is a pretty thorough rewrite from what I hear (though it's all backwards compatible w.r.t. APIs and such), so any internal plumbing you're learning about may be different already.

0:42 underdev: right

0:49 brian__: noob question, is there an easy way for regex to return a string? ie (first (map #(re-seq #"a" %1) ["a" "b" "c"])) -> ("a") , I just want "a"

0:51 underdev: taking a shot...

0:51 ,(str (first (map #(re-seq #"a" %1) ["a" "b" "c"])))

0:51 clojurebot: "clojure.lang.LazySeq@80"

0:51 underdev: nope

0:53 somnium: ,(re-find #"foo" "barfoobar") ?

0:53 clojurebot: "foo"

0:53 brian__: ok thnks

0:53 somnium: ,(some #(re-find #"a" %) ["a" "b" "c"])

0:53 clojurebot: "a"

0:56 underdev: ,(str (into [] (first (map #(re-seq #"a" %1) ["a" "b" "c"])))

0:56 clojurebot: EOF while reading

0:56 underdev: i suck

1:00 defn: someone mind testing out http://getclojure.org:8080/examples/$function-name where $function-name is anything like "zipmap", "concat", etc. -- I've been trying to iron out a kink. The last time i advertised the URL and a few people loaded things up it produced a problem

1:00 feel free to hit it a few times and let me know if you have any feedback

1:02 underdev: defn: rockin'

1:03 ironically, nothing found for defn.. you gotta easter egg that, man!

1:03 cemerick: defn: is this being pulled from irc logs?

1:04 underdev: gotta add a homepage, obviously

1:04 defn: cemerick: yes

1:04 underdev: *nod*

1:04 underdev: and some sort of landing page under /examples

1:05 cemerick: defn: nice; is there a filter or something? Nothing there for send-off, and virtually nothing for send.

1:05 somnium: defn: very cool

1:05 defn: cemerick: yeah there is a filter -- stuff that runs in the sandbox shows up, if nothing is found it returns stuff which /didn't/ run in the sandbox

1:05 cemerick: ah

1:05 defn: also keep in mind it's from irc, so there might not be a ton of mentions of send-off in the first place

1:06 i can tell you how man, one second

1:07 cemerick: looks like there were 125 send-off examples, but probably not many run in the sandbox... I will make sure to add some options for what you want to see, so you can return all of the good AND bad examples if you so choose

1:08 dxgriffiths: I noticed that def brings back a lot of results with "def" the string in them, unrelated to the function.

1:09 defn: dxgriffiths: yes i noticed that as well. I'm not 100 percent sure if that's something I want to filter or not. I can't think of a reason why not to at the moment, but there might be is all...

1:10 dxgriffiths: Maybe you could just float non-string results to the top.

1:11 underdev: i appreciate being able to get all the results from "re-", even if there are some cruft in there...

1:11 defn: dxgriffiths: good idea

1:12 so add some sorting options, syntax highlighting, intelligent indentation for long lines, a couple of filter options, homepage, and examples landing page

1:12 * defn writes this down

1:13 bmason: what are we looking at? I missed the link

1:13 defn: http://getclojure.org:8080/examples/$function-name <--fill in a function-name like zipmap, or concat

1:13 underdev: badgirlsinchains.com

1:13 defn: :X

1:14 bmason: lol

1:14 I see Clojure has a darker side

1:14 clojurebot: That is the one thing Clojure can not do.

1:15 somnium: machine learning has so many applications...

1:15 bmason: what triggered clojurebot to say that?

1:15 somnium: Clojure

1:16 Crowb4r: defn: you get it working?

1:16 somnium: hmm

1:16 defn: Crowb4r: looks like

1:16 Crowb4r: pretty sure it was a problem with my truncate function

1:16 Crowb4r: cool

1:16 ahh

1:16 is that code in github?

1:16 defn: the latest? yes, should be

1:17 Crowb4r: defn: good job, that is really cool

1:17 doseq: Q: is there one definitive place to get clojure info, like a programmer's manual or something? Preferably in a reader-friendly format.

1:17 defn: Crowb4r: wanna add your irc bot code into the mix? id like to have it add to refs when it sees sexps in the channel

1:17 Crowb4r: syntax hilighting and maybe a noshow javascript for the answers would be cool

1:18 defn: yeah! noshow would be really cool

1:18 underdev: clojure.org isn't so bad...

1:18 discursive stuff on the left, api stuff on the right

1:18 defn: Crowb4r: ultimately id really like to be able to "rate" examples, so users get a big giant list of garbage when the site goes live, but over time the results are improved

1:19 underdev: kind of like a mullet -- business in the front, party in the back

1:19 underdev: defn, excellent

1:19 Crowb4r: I'm basing my idea from the labrepl site

1:19 doseq: I downloaded a copy of the core API documentation from clojure.org, and have been re-organising it into categories.

1:19 defn: Crowb4r: ah yes -- i will possibly lift Stuart H's syntax hilighting and js stuff

1:19 bmason: defn: http://getclojure.org:8080/examples/$concat just returns $concat... am I supposed to see something else?

1:20 defn: bmason: drop the $

1:20 bmason: ah nice

1:20 all instances of calls to clojurebot?

1:20 defn: bmason: all instances of sexps in this channel's history

1:20 which compile in a sandbox

1:20 bmason: wonderful!

1:21 that's a great idea

1:21 defn: if none of them compile it shows you bad results

1:21 underdev: ,(underdev is a strikingly handsome man)

1:21 clojurebot: java.lang.Exception: Unable to resolve symbol: underdev in this context

1:21 defn: haha, luckily that wont compile

1:21 * defn wipes sweat

1:21 underdev: you know, just to make sure it's in there

1:22 defn: ,{:rhickey "is" :our "fearless" :leader "."}

1:22 clojurebot: {:rhickey "is", :our "fearless", :leader "."}

1:24 defn: underdev: :)

1:26 underdev: (and "underdev is a strikingly handsome man" "underdev is a giving lover")_

1:26 didn't want to put the comma there :)

1:26 defn: => false

1:27 Crowb4r: defn: I can tr yto help you with some of this later if you want

1:27 doseq: Hey, does anyone know if [1 2 3] is syntactic sugar for (vector 1 2 3)?

1:27 defn: Crowb4r: don't count on me to say no to help :)

1:28 LeNsTR: http://getclojure.org:8080/examples/3.14

1:28 bmason: doseq: yes

1:28 LeNsTR: o_O wtf =)

1:28 doseq: bmason: thanks!

1:28 defn: LeNsTR: haha that's pretty cool

1:29 bmason: ,(vector 1 2 3)

1:29 clojurebot: [1 2 3]

1:29 defn: uh oh -- need to escape html :X

1:29 http://getclojure.org:8080/examples/h1

1:30 doseq: Yeah I REPL'd it and they evaluate the same, I was just wondering if anyone knew if they were similar at the source code level.

1:30 LeNsTR: magic! =)

1:30 defn: untill someone puts something mean in there :)

1:31 bmason: you could dig into Clojure core to be sure, but I believe reading somewhere that they are

1:31 doseq: Thanks again.

1:31 bmason: np

1:31 underdev: someone told me that they weren't equivalent in all cases, but i have yet to see it

1:32 defn: very cool man. very fun. now back to maven hell...

1:32 bmason: ,(class (vector 1 2 3))

1:32 clojurebot: clojure.lang.PersistentVector

1:32 defn: just to make sure i do it... (str "<h1>NAUGHTY JAVASCRIPT AHEAD!</h1>")

1:32 bmason: ,(class [1 2 3])

1:32 clojurebot: clojure.lang.PersistentVector

1:33 underdev: told 'im so...

1:33 bmason: java classes don't lie, right?

1:34 underdev: the topic was whether [] was syntactic sugar...

1:37 doseq: I learned today that "syntactic sugar", the phrase, was invented by a guy who was influential in bringing lambda calculus to programming, who later went on to be a prominent gay rights activist.

1:37 Crowb4r: defn: cool, I want the exp. :)

1:37 bmason: nice

1:37 god knows where the phrase 'eye candy' came from

1:38 defn: Crowb4r: the biggest thing i want to add right now, if you're interested, is an irc bot which collects sexps from the channel after it has done its initial log parsing

1:38 err after walton has done its initial log parsing it should be ready to start grabbing new sexps from the channel and add them to the ref *sexps*

1:40 Crowb4r: k

1:40 underdev: bmason: i don't have clojure set up on this account yet, i made it specifically to mess with clojure, but (defn foo (vector a b) (println "bar baz")) fails on ideone

1:40 mess with maven, i mean

1:40 Crowb4r: I can make perrin (my little crappy watch for all of that soon.

1:41 underdev: oh, but that's a macro, right? one sec

1:43 bmason: I see what you mean

1:44 yeah, I think it is the way the macro expansion works

1:45 underdev: no, can't do it with fn either, it seems

1:45 bastard was right

1:47 bmason: isn't fn a macro?

1:47 underdev: no, its a special form, i think is what they call it

1:47 bmason: (defmacro fn

1:47 "(fn name? [params* ] exprs*)

1:47 (fn name? ([params* ] exprs*)+)

1:48 from clojure.core source

1:48 _ato: it's a macro, the special form is fn*

1:49 underdev: STUART HALLOWAY IS A LIAR AND A FRAUD!

1:49 bmason: hahaha!

1:49 underdev: or, maybe i understood it incorrectly... either way

1:50 OH, AND MARK VOLKMANN TOO

1:50 who else perpetrates this pernicious lie?

1:50 doseq: A special form is any expression that either doesn't evaluate one of its arguments, or can take an indeterminate number of arguments.

1:51 So fn is a special form.

1:51 underdev: oh, well, than never mind

1:51 _ato: in Clojure any normal function can take an indeterminate number of arguments

1:52 and any macro can not evaluate one of its arguments

1:52 so by that definition special forms aren't particularly special :-P

1:52 http://clojure.org/special_forms

1:52 bmason: ,(special-symbol? fn)

1:52 clojurebot: java.lang.Exception: Can't take value of a macro: #'clojure.core/fn

1:52 _ato: it's probably authoratively considered a special form and fn* is probably considereed an implementation detail

1:53 bmason: ,(doc special-symbol?)

1:53 clojurebot: "([s]); Returns true if s names a special form"

1:53 _ato: ,(special-symbol? 'fn)

1:53 clojurebot: false

1:53 _ato: ,(special-symbol? 'fn*)

1:53 clojurebot: true

1:53 bmason: ah

1:53 needs symbol, gotcha

1:54 doseq: I'd say technically fn is a macro, and (fn x [y] y) is a special form that uses it.

1:56 That's going by the original definition of special form from the LISP 1 and 1.5 manuals.

1:58 LauJensen: Thats not how I see it. fn is a macro - end of story :)

1:58 We've used 'Special Form' to refer to a few forms which were implemented in Java

1:59 doseq: That's a confusing clash of terms :)

1:59 somnium: I thought special form meant the symbol is embedded in compiler.java and doesnt point to a var/lexical binding

2:00 LauJensen: somnium: Yep

2:00 underdev: LauJensen: it is widely popularized that fn is a special form

2:01 doseq: In older texts a form is any symbolic expression that can be evaluated, and a special form is one that doesn't evaluate some arguments, like (def x 5).

2:01 What's the terminology for that in clojure?

2:02 underdev: in screencasts, print...

2:02 LauJensen: doseq: IFns is are functions, where all arguments are evaluated, macros are the opposite in that you control evaluation

2:02 ,(doc fn)

2:02 clojurebot: "([& sigs]); (fn name? [params* ] exprs*) (fn name? ([params* ] exprs*)+) params => positional-params* , or positional-params* & next-param positional-param => binding-form next-param => binding-form name => symbol Defines a function"

2:02 LauJensen: ~source fn

2:02 underdev: Go see for yourself, its a pure macro

2:02 underdev: i did. bmason posted the code.

2:03 you are right, and they are wrong.

2:03 doseq: I'm not saying it isn't one... I'm asking what's the clojure term for (def x 5) where x is not evaluated, versus (+ 1 2) where 1 and 2 both are?

2:04 LISP makes a distinction between them but I haven't seen any clojure material on it so far.

2:05 LauJensen: doseq: To my knowledge there is no distinction, except one is a macro and the other is a function

2:05 _ato: doseq: in Clojure a form that does not evaluate it's arguments is either a special form or a macro

2:06 ,(keys (clojure.lang.Compiler/specials))

2:06 clojurebot: (new quote & var set! monitor-enter recur . clojure.core/import* do fn* throw monitor-exit letfn* finally let* loop* try catch if def)

2:06 doseq: Right, and a macro would therefore be a kind of special form. That makes sense to me.

2:06 When used, that is.

2:08 underdev: ,(special-symbol? 'if)

2:08 clojurebot: true

2:08 underdev: okay, well not everything ive heard is a lie :)

2:08 doseq: So am I right in thinking that there's some term confusion between special forms in the mathematical sense and special forms in this other Java/special-symbol sense?

2:09 I can handle that, it's just not signposted :)

2:12 somnium: OT question: javascript has this nasty property where "" and 0 evaluate to false. To completely cure it (if x ...) needs to be (if (x || (x === "") || (x === 0)) ...), but this isnt always desirable. is it horribly ugly to present users with an 'if* (plain host if) and an 'if (if with safety ternary)?

2:12 wrt a lisp hosted in javascript

2:15 defn: somnium: yeah the triple = is a must in JS

2:18 _ato: somnium: I think that's a reasonable way of doing it.

2:18 so that leaves null, false, undefined and NaN as false

2:18 somnium: sometimes x will never be 0 or "", and sometimes in loops there are some performance tricks with 0 evaluating to false and --

2:19 ah yeah, I always forget about NaN, tacking on an isNaN would be going too far think

2:22 _ato: yeah, NaN probably doesn't matter enough to bother including

2:22 psykotic: NaN contamination is fun

2:23 most programs are so poorly situated to handle NaNs that they should probably have been signaling rather than non-signaling in most languages like JavaScript

2:24 NaN contamination is where you get an initial NaN somewhere and over time it spreads to larger and larger parts of your data as the NaN is combined with non-NaNs, producing more NaNs in the process. it can be a pain in the ass.

2:25 _ato: I guess the commonest ways to get NaN are through casting a non-numeric string to an integer or 0/0

2:26 both would be exceptions in Clojure's semantics, if you're following that for your lisp

2:27 actually probably parsing an invalid integer would be nil, so that fits with NaN being false

2:27 psykotic: in a dynamically typed language, i would definitely prefer trapping NaNs and converting to nils

2:27 that way you would get early signaling

2:28 _ato: yeah, good point

2:28 somnium: since javascript is so close to scheme already, Ive come to think its a simpler task to write a scheme-like reader and compiler in javascript, and use that to build abstractions.

2:29 its a bit less to get wrong in any case

2:29 psykotic: programming with NaNs is like programming in a language where not only is (first nil) = nil, etc, but (+ nil x) = nil, and so on

2:29 a little 'silent nil pass-through' is convenient but too much is a nasty thing

2:32 somnium: there are already some things like that, i think

2:32 somnium: psykotic: Ive seen a few, but none that actually seemed intended for use as an enhanced javascript

2:33 psykotic: has anyone tried clojure with gwt?

2:33 i assume it would be a dog but...

2:34 somnium: theres this interesting project coffee-script on github, where they're wrestling a bit with adding macros to its lexer/parser

2:34 I think gwt works from java sources, no?

2:34 psykotic: i thought it worked from bytecode but i haven't used it

2:34 in any case there are round-trippable bytecode to java compilers

2:34 decompilers, even

2:35 Crowb4r: defn: You still up?

2:38 defn: yes

2:39 Crowb4r: So, you need me to just have abot idle in here parsing whenever clojurebot is called to eval somethin.

2:39 or do you want when anyone does a sexp

2:40 the latter would lead to errors I have a feeling

2:42 defn: when anyone does a sexp

2:43 Crowb4r: k

2:43 defn: take a look at the extract-expression fn

2:43 and also note the "add-sexp" fn

2:44 if you follow that for reading the sexp in, and adding it to the *sexps*, it should act sane

2:44 Crowb4r: k

2:47 Ohh, this should be a bit easier then I thought. I think

2:47 Do you want me to put them in a file for you to parse in?

2:49 defn: one second

2:49 busy with something atm

2:51 Crowb4r: k

2:58 doseq: Does anyone know if there's a project underway to rewriter Little Schemer for clojure?

2:58 Or something Little Schemer-ish.

3:44 defn: Crowb4r: im still here fwiw

3:44 Crowb4r: you're saying you're going to put what the bot gives back into a file?

3:44 Crowb4r: I can

3:45 defn: Crowb4r: not necessary since, when you start up walton it is going to need to re-parse all of the logs anyways

3:45 so ill have logs for that day

3:45 Crowb4r: k

3:46 So, then what would you need an ircbot to do if you already have the logs for walton?

3:47 doseq: Is anyone here familiar with rhickey's Are We There Yet presentation? I'm wondering what he means by controlling the spin of CAS.

3:54 defn: Crowb4r: to basically just hang out in here, and run add-sexp on lines that return something for extract-expressions

3:54 Crowbar7: ahhh

3:54 defn: (add-sexp (extract-expressions line-from-irc))

3:54 something like that

3:55 Crowb4r: ummk

3:55 That is doable

3:55 I will write something tomorrow probbably

3:55 defn: and then on top of that, id like it to be able to give random examples for a keyword

3:55 (walton "concat") will do that

3:59 Crowb4r: so when you query the bot he will feed back a random example piece of code

4:00 defn: correct

4:00 Crowb4r: k

4:01 tufflax: Why doesn't (.separator File) work? (. File separator) does work. Doesn't it work for static fields and methods?

4:01 Crowb4r: did you mesn static fields and static methods?

4:02 tufflax: yes

4:03 Crowb4r: should work then

4:05 tufflax: I get this error message: No matching field found: separator for class java.lang.Class

4:17 MrEvil: is their an easy way to convert a list to a set

4:20 zmila: ,File/separatorChar

4:20 clojurebot: java.lang.Exception: No such namespace: File

4:20 zmila: ,java.io.File/separatorChar

4:20 clojurebot: \/

4:22 zmila: ,(into (list) #{2 3 4})

4:22 clojurebot: (4 3 2)

4:27 MrEvil: sorted-set is what I was looking for

4:27 thanks though

4:28 zmila: ,(into (sorted-set) ##{2 1 3 1000 4})

4:28 clojurebot: No dispatch macro for: #

4:29 zmila: ,(into (sorted-set) #{2 1 3 1000 4})

4:29 clojurebot: #{1 2 3 4 1000}

4:29 zmila: :)

4:33 somnium: ,(apply sorted-set '(42 4 11 21))

4:33 clojurebot: #{4 11 21 42}

4:33 somnium: fwiw

5:05 tomoj: https://gist.github.com/564f6f92e1d3e7b6155e

5:06 maybe it would be better if it stuck with a mode until you changed it again

5:08 bitti: so problem 20 of project euler is really a one line in clojure :)

5:09 ,(reduce + (map #(-> % int (- 48)) (-> (reduce * (range 1 100)) str)))

5:09 clojurebot: 648

5:11 Borkdude: (macroexpand '(-> % int (- 48)))

5:11 ,(macroexpand '(-> % int (- 48)))

5:11 clojurebot: (- (clojure.core/-> % int) 48)

5:12 Borkdude: ,(clojure.contrib.macro-utils/mexpand-all '(-> % int (- 48)))

5:12 clojurebot: (- (int %) 48)

5:13 tomoj: ,(->> 100 (range 1) (reduce *) str (map #(-> % int (- 48))) (reduce +))

5:13 clojurebot: 648

5:13 Borkdude: ,(clojure.contrib.macro-utils/mexpand-all '(-> (reduce * (range 1 100)) str))

5:13 clojurebot: (str (reduce * (range 1 100)))

5:13 tomoj: clojurebot should be able to automatically take some code and totally mangle it into -> and ->>

5:13 Borkdude: What is the problem here?

5:14 somnium: and I thought haskell's sigils could be inscrutable

5:14 Borkdude: why convert a number to a string and then to an int again?

5:14 bitti: ok (str (reduce * (range 1 100))) might be shorter

5:15 tomoj: Borkdude: splitting digits I assume

5:16 zmila: str is not lazy, so you first traverse the 100! while converting to string, than the second time - while summing the digits.

5:16 bitti: Borkdude: easiest way to get the digist?

5:17 Borkdude: ah ok

5:19 zmila: ,(loop [x (reduce * (range 1 100)), sum 0] (if (zero? x) sum (recur (quot x 10) (+ sum (rem x 10)))))

5:19 clojurebot: 648

5:20 zmila: loop-recur is used to get digits (rem x 10) and accumulating into sum

5:22 what is diff between (rem) and (quot) ? don't know :)

5:22 bitti: zimila: nice. but with str you get the digits with a native function

5:23 tomoj: zmila: that's a lot slower

5:23 for me :(

5:24 Borkdude: in the repl, what is the symbol to retrieve the last result?

5:25 somnium: ,*1

5:25 clojurebot: java.lang.IllegalStateException: Var clojure.core/*1 is unbound.

5:25 Borkdude: tnx

5:27 bitti: tomoj: a little slower, but not so much?

5:27 ,(time (loop [x (reduce * (range 1 100)), sum 0] (if (zero? x) sum (recur (quot x 10) (+ sum (rem x 10))))))

5:27 clojurebot: 648

5:27 "Elapsed time: 3.724 msecs"

5:27 bitti: (time (reduce + (map #(- (int %) 48) (str (reduce * (range 1 100))))))

5:28 Borkdude: It's about time we make the (-character the activating char for clojurebot...

5:28 troutwine: I'm new. Could someone help me out a bit here: http://paste.lisp.org/display/97303

5:28 bitti: ,(time (reduce + (map #(- (int %) 48) (str (reduce * (range 1 100))))))

5:28 clojurebot: 648

5:28 "Elapsed time: 2.272 msecs"

5:29 bitti: (yeah you're right)

5:33 troutwine: Sorry for the noise everybody. I was looking at the wrong documentation.

5:35 Gertm: is the ELPA M-x clojure-install still the good way to install?

5:37 zmila: my repl inside eclipse (on Windows) shows times near 1 msec for both one-liners. One need to test with bigger numbers to compare :)

5:38 bitti: Gertm: don't know, I installed swank-clojure and when starting slime it installed the rest automatically

5:38 Gertm: that was the only way I got slime running, all other ways lead to strange errors :(

5:39 Gertm: okay

5:39 well slime already works from my Lisp setup, but perhaps I should start from zero

5:39 bitti: I installed clojure-mode though, don't know if it's necessary

5:40 zmila: tomoj - when i run for 1000! your variant is faster to my (8-12 ms vs 42-48 ms)

5:42 Gertm: bitti: heh ok so: swank-clojure.el:47:1:Error: Cannot open load file: slime (when trying to install from ELPA)

5:43 bitti: :(

5:43 Gertm: ugh, this is the main reason for me to ditch clojure right away

5:43 bitti: Gertm: don't know if you have to start from scratch, I don't want to mess up your lisp setup...

5:44 Gertm: I removed that part from my emacs config to be sure :)

5:45 bitti: and when you install slime with elpa?

5:46 zimla: I see, maybe this typecasting (char -> int?) is expensive

5:46 Gertm: lemme check

5:47 bitti: gonna do this tonight, got an easter lunch :) cya

5:47 div: Gertm: have you tried following the instructions on github for swank-clojure ? http://github.com/jochu/swank-clojure/blob/master/README.md

5:47 Gertm: yup, that's what I'm reading

5:48 div: maybe your previous slime install is causing your grief ?

6:01 defn: Gertm: rm -rf ~/.emacs.d/elpa and reinstall all of it

6:01 i had that problem once upon a time i think

6:03 Raynes: Attention: I hate XML with the fury of a thousand angry Gods.

6:05 bitti: zmila: ok, I take it back. my version seems to be 4-5x faster for bigger factorials ;)

6:06 tomoj: bitti: the string version?

6:06 bitti: yeah

6:08 zmila: bitti, ok. this is one more confirmation of the rule: use map/filter/reduce first, but loop/recur only in last turn :)

6:08 if there were seq over digits of a number ....

6:09 Borkdude: ,(defn digits [n] (str n))

6:09 clojurebot: DENIED

6:10 Borkdude: ,(str 10)

6:10 clojurebot: "10"

6:10 zmila: yes, i know, Borkdude, but this is seq of chars :)

6:11 Borkdude: ,(let [digits (fn [n] (int (str n)))] (digits 123))

6:11 clojurebot: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character

6:11 Borkdude: ah damn ;)

6:12 ,(let [digits (fn [n] (map int (str n)))] (digits 123))

6:12 clojurebot: (49 50 51)

6:12 Borkdude: oh no, ah wait

6:12 LauJensen: user> (time (reduce + (map #(- (int %) (int 48)) (str (reduce * (range 1 100))))))

6:12 "Elapsed time: 0.815747 msecs"

6:12 648

6:12 user> (time (reduce + (map #(- (int %) (int 48)) (str (fac 99)))))

6:12 zmila: one step forward two back, yes

6:12 LauJensen: "Elapsed time: 0.491263 msecs"

6:12 648

6:12 Borkdude: I shouldn't be trying here immediately ;)

6:12 LauJensen:

6:17 Raynes: LauJensen: My bot can check the weather now. My bot can check the weather, clojurebot cannot, therefore I am way more powerful. :D

6:20 Borkdude: (defn digits [n] (map #(Integer/parseInt (str %)) (str n)))

6:26 ,(let [digits (fn [n] (map #(Integer/parseInt (str %)) (str n)))] (digits 1234))

6:26 clojurebot: (1 2 3 4)

6:28 Raynes: ,(letfn [(digits [n] (map #(-> % str Integer/parseInt) (str n)))] (digits 1234))

6:28 clojurebot: (1 2 3 4)

6:28 Raynes: letfn ftw

6:28 :>

6:28 Borkdude: (doc letfn)

6:28 clojurebot: "([fnspecs & body]); Takes a vector of function specs and a body, and generates a set of bindings of functions to their names. All of the names are available in all of the definitions of the functions, as well as the body. fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+)"

6:30 Borkdude: yeh better ;)

6:31 a macro transforming regular code into clojurebot-friendly would be convenient

6:31 Raynes: def-stuff is not allowed in general. Anything that could pollute the namespace.

6:31 doseq: I need some help with compojure... can anyone see what's wrong with this?

6:31 (defn remoteeval [request] (-> request :params :expression load-string))

6:32 LauJensen: depending on what is in params, that looks fine

6:32 doseq: I'm trying to do a simple browser-based REPL but it chokes on anything other than strings like "Hello"

6:32 LauJensen: doseq: put a (swank.core/break) right before that s-exp, then inspect the locals and you'll see whats in param

6:32 doseq: If I send (+ 1 2 3) or anything like that it just hangs.

6:32 LauJensen: Then you can fiddle at the REPL with it

6:33 doseq: Ok I'm going to have to unpack that instruction a bit, I'm still learning :)

6:35 Borkdude: haha nice question: why is Scala complex, because we need to create complex software? http://stackoverflow.com/questions/2573899/why-is-scala-very-complex

6:36 doseq: LauJensen: I don't use Emacs, does that advice still apply?

6:37 Raynes: I can't even do swank.core/break /in/ a slime REPL, so... ;o

6:37 doseq: :)

6:38 Borkdude: both Clojure in Action and Programming Clojure go into mutually recursive functions

6:38 does that get used a lot in practice?

6:39 zmila: Scala's the most disadvantage - name :) one hardly google it.

6:43 LauJensen: doseq: No - You're stuck

6:43 You have to use a println or something similar to peek at the locals, or attach JSwat

6:43 doseq: Ok thanks, I'll keep working on it.

6:52 patrkris_: is there something similar to argmin (from math) in clojure?

6:54 bitti: LauJensen: why (int 48)? http://clojure.org/java_interop#Java%20Interop-Type%20Hints says type hints are not needed for statics

6:55 psykotic: doseq: i didn't see your full question, but you might consider debug-repl

6:56 doseq: psykotic: Cool, thanks.

6:56 Fossi: sometimes these classloaders are driving me crazy...

6:57 psykotic: doseq: http://clojars.org/org.clojars.gjahad/debug-repl

7:14 doseq: I got it... had the function order backwards. I had to cast it as a string before trying to return it to the browser:

7:14 (defn remoteeval [request] (-> request :params :expression load-string str))

7:15 :P

7:23 hamza: guys, what is the state of native lib support for leiningen?

7:23 psykotic: hamza: you need the native-deps plugin but then it works well.

7:24 hamza: one thing is that i don't think the repl works right when you're using native deps, but you can use lein swank just fine.

7:26 hamza: this one right http://github.com/swannodette/native-deps ?

7:31 Associat0r: is there an online Clojure REPL somewhere?

7:34 Raynes: Associat0r: http://lotrepls.appspot.com/ Closest thing I know of.

7:35 Associat0r: thanks Raynes

7:37 psykotic: hamza: yep

7:40 Fossi: Associat0r: well, clojurebot has a repl :)

7:41 "Caused by: java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V"

7:41 i guess that means the api changed in 1.2?

7:42 Raynes: Fossi: It means your contrib and your Clojure aren't in sync.

7:42 Associat0r: Fossi: thanks

7:42 Fossi: i don't get that error in contrib, but in another package

7:42 Raynes: Meaning, the contrib you're using wasn't built against the Clojure you're using.

7:43 Fossi: which i don't have the source for atm :\

7:43 Raynes: At least, that's what it almost always means.

7:43 Fossi: so, i guess now i can only go back to 1.1 for the time being

8:05 defn: Morning everyone

8:37 esj: morning defn

8:37 LauJensen: bitti: it wasn't a type-hint to avoid reflection, it was making it a primitive

8:38 bitti: I see, but isnt 48 a primitive?

8:39 zmila: ,(type 48)

8:39 clojurebot: java.lang.Integer

8:39 zmila: ,(type (int 48))

8:39 clojurebot: java.lang.Integer

8:40 bitti: qed?

8:40 LauJensen: ,(expression-info '(48))

8:40 clojurebot: nil

8:40 LauJensen: ,(expression-info '(+ 2 2))

8:40 clojurebot: {:class java.lang.Number, :primitive? false}

8:40 LauJensen: ,(expression-info '(+ (int 2) (int 2)))

8:40 clojurebot: {:class int, :primitive? true}

8:41 zmila: interesting

8:42 bitti: where can I find this "expression-info"?

8:42 bsteuber: ,`expression-info

8:42 clojurebot: clojure.contrib.repl-utils/expression-info

8:47 LauJensen: bitti: check out my latest blog-post for a few of these performance tips if u like

8:49 defn: pretty awesome, tbqh

8:58 cd ~/def

8:58 ls

10:01 Borkdude: When I have this code:

10:01 (let [lzs (map #(do (println "side effect") (+ % 1)) [1 2 3])] (first lzs))

10:01 I get:

10:01 side effect side effect side effect 2

10:02 why not only one time "side effect"?

10:02 bsteuber: borkdude: chunked sequences

10:02 Borkdude: bsteuber, say what?

10:03 bsteuber: borkdude: http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/

10:03 LauJensen: Which hopefully goes away soon

10:06 Borkdude: I see

10:08 can I call a function from a repl to see what version of clojure I'm using?

10:08 LauJensen: ,*clojure-version*

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

10:08 LauJensen: 1.1.0-MASTER

10:09 bsteuber: ,(clojure-version)

10:09 clojurebot: "1.1.0-master-SNAPSHOT"

10:10 Borkdude: ah great, tnx

10:17 btw how do you call x in (let [x expr] ...), obviously not a var, but what, symbol?

10:18 Identifier?

10:18 Variable?

10:19 LauJensen: a local ?

10:20 Borkdude: I dislike calling them variables because they are immutable

10:20 bsteuber: local binding, I guess

10:20 Borkdude: but in Clojure in Action they are called variables

10:21 binding: the expr is bound to ... what?

10:21 bsteuber: if they differentiate between var and variable, this might be okay as well

10:22 but yeah, feels a bit strange :)

10:22 "x is bound to expr"

10:23 Borkdude: "local identifier"?

10:24 local for short might be the nicest

10:31 LauJensen: Borkdude: They are referred to as locals

10:31 Borkdude: ok

10:33 Ah from the clojure.org website: Locals created with let are not variables. Once created their values never change!

10:33 LauJensen: Yea, I'm sorry - The "?" threw you off

10:33 Borkdude: yes, thanks for clarifying

10:34 Maybe the books should stick to that also instead of calling them variables

10:35 LauJensen: I hope nobody calls them variables

10:35 As Rich said, that would simply be too disappointing

10:36 Borkdude: We briefly saw the let form in chapter two, where we used it to create local variables. Let’s quickly look at another example of using it – (let [x 10 y 20] (println “x, y:” x “,” y)) Here, x and y are local variables.

10:36 CiA p88

10:36 LauJensen: Hmm

10:36 Send him an email, he can keep it mind for the next rev

10:36 Borkdude: yes will do

10:37 I'll post it on the manning forum which is the place for that

10:37 LauJensen: Oh ok

10:39 Borkdude: Once they are starting to talk about closures, they should also have to use the expression: free local instead of free variable

10:39 which is not really usual when talking about closures, right?

10:46 Hmm java.lang.NoClassDefFoundError: clojure/contrib/repl_ln

10:47 Raynes: ,(let [x 3, x (+ x 3)] x)

10:47 clojurebot: 6

10:50 Borkdude: ,(clojure.contrib.macro-utils/mexpand-all '((let [x 3, x (+ x 3)] x))

10:50 clojurebot: EOF while reading

10:50 Borkdude: ,(clojure.contrib.macro-utils/mexpand-all '(let [x 3, x (+ x 3)] x))

10:50 clojurebot: (let* [x 3 x (+ x 3)] x)

10:57 LauJensen: hugod: I'm also seeing these *current-thread* unbound errors when I'm in the main-thread

11:02 doseq: Re: variables. In Rich's talk on time he goes to great lengths to describe how logical identities point to an immutable value now, but over time the value being pointed to changes. I don't understand why this can't just be called a variable.

11:03 LauJensen: because its immutable

11:03 variable: a quantity that can assume any of a set of values

11:03

11:04 This does not in any way describe a local, it might describe a 'reference' type

11:05 doseq: That doesn't really address my question though. If the symbol points to different values over time then it's a variable pointer.

11:05 Gertm: swank-clojure.el:47:1:Error: Cannot open load file: slime I removed the ELPA dir, reinstalled ELPA, checked 'swank-clojure' for installation and hit 'x'

11:05 LauJensen: doseq: A local does not point to different values over time, thats the difference

11:06 doseq: A local? Like in a let?

11:06 LauJensen: Yes

11:07 doseq: Right, of course. I didn't mention locals.

11:07 LauJensen: (let [im-a-local 5 im-a-ref (ref 5)]..

11:07 The first is never changing and will always be 5. The second can change, but via indirection, so ref is more descriptive than variable - it still points to something immutable

11:08 doseq: Let me re-read the original discussion...

11:08 Sorry, I misread it.

11:08 LauJensen: np :)

11:09 doseq: It is pretty hilarious that they can't be called variables though, since the whole point of a lambda is to order variables :)

11:11 So really what we're talking about is an argument, which is a variable, being populated by a constant. I love the subtlety of it.

11:18 Intertricity: Is there a book to read for first time programmers for clojure?

11:19 Fossi: clojure in action is the only book so far

11:19 so i guess that'd be it ;)

11:19 doseq: And it's not for first time programmers as far as I can tell.

11:20 Chousuke: only book? what happened to Programming Clojure .P

11:20 Fossi: well, not really i guess. might be that some other lisp book would be a better choice

11:20 ups, that's what i meant really

11:20 LauJensen: Fossi: I think Programming Clojure is usually the recommended first stop

11:21 Fossi: so there is a clojure in action now?

11:21 doseq: All the clojure material I've read assumes knowledge of Java or LISP or both.

11:21 LauJensen: Fossi: Yea

11:21 doseq: My wikipedia's been on overdrive.

11:21 LauJensen: doseq: not PC, I've skimmed it and it looks very entry level

11:23 doseq: I read the PC samples and they were sufficiently jargony and dense that I wouldn't recommend it to a beginner. No offense to the author, who is obviously very great.

11:23 qbg: Programming Clojure looks pretty good to me

11:26 psykotic: doseq: probably they were not meant to be read by themselves but with the text.

11:26 doseq: if he explains the jargon to his readers, what's the problem? jargon is good.

11:26 doseq: psykotic: sorry, I meant the sample chapters.

11:26 psykotic: ah.

11:27 Gertm: can anyone point me to a good tutorial on getting clojure set up for emacs?

11:27 I'm following the guide on the swank-clojure page but it just doesn't work

11:27 psykotic: Gertm: Lau has a good one on Vimeo. i'm sure he'll link you in a second. :)

11:27 doseq: what's your language background?

11:28 Gertm: LauJensen?

11:28 clojurebot: LauJensen is some dane

11:28 psykotic: psykotic?

11:28 LauJensen: ~google Clojure 101 - Setting up SLIME and Emacs

11:28 clojurebot: First, out of 156 results is:

11:28 SLIME + clojure - SWiK

11:28 http://swik.net/SLIME+clojure

11:28 Gertm: thanks!

11:28 LauJensen: ouch, googleburned

11:28 psykotic: haha

11:28 LauJensen: :(

11:28 Gertm: ow, not right one?

11:29 LauJensen: http://www.bestinclass.dk/index.php/2009/12/clojure-101-getting-clojure-slime-installed/

11:29 Gertm, thats mine

11:29 ~google functional fluid dynamics

11:29 clojurebot: First, out of 205000 results is:

11:29 Functional Fluid Dynamics in Clojure | BEST IN CLASS

11:29 http://www.bestinclass.dk/index.php/2010/03/functional-fluid-dynamics-in-clojure/

11:30 LauJensen: Yea! Google Domination

11:30 Gertm: thanks LauJensen

11:30 LauJensen: np

11:31 doseq: psykotic: In time order, BASIC, QBasic, Access Basic, Java, ASP, PHP, ActionScript, JavaScript, Objective-C and now Clojure. I've been studying the history of languages from the LISP and ALGOL families as well as Smalltalk to get a better bearing on things.

11:31 psykotic: doseq: what did you find jargony about it then?

11:31 LauJensen: doseq: So.. you did a quality study on PHP did you? :)

11:32 psykotic: doseq: i'm curious because i skimmed the book and found it entry level... to a fault :)

11:32 doseq: psykotic: I can't remember specifically... I'm a tech writer and editor so I read things more critically probably.

11:33 psykotic: it's really difficult to remember how much knowledge you take for granted when you're writing. but i assume they actually 'test drove' the book on some subset of the intended audience and adjusted the exposition level accordingl.

11:34 LauJensen: quality study of PHP = memorizing these tables: http://php.net/manual/en/types.comparisons.php :)

11:34 Intertricity: Fossi, thanks I'll look that up

11:34 LauJensen: psykotic: hehe, powerful stuff

11:35 If you havent seen it, you wont believe how much power can be crammed into just a few thousand lines of PHP

11:35 psykotic: LauJensen: with those kinds of semantics, you must either be autistic or resigned to writing code that almost but only sort of works

11:36 yeah, i've done some PHP hacking. the best thing i can say about it (which is also its achilles' heel) is that it's very easy for someone who doesn't know the language to hack on it

11:36 doseq: LauJensen: PHP's a pretty fascinating success story. Personally I'm a big fan of static content serving, but I've had fun writing PHP before. I never did like the lack of dot syntax though.

11:36 LauJensen: You had fun writing it?

11:37 psykotic: some of my least fun programming has been trying to make wordpress to my bidding

11:37 LauJensen: That is entirely different to my experience of trying to deploy it in industry - I remember only the pain, the tears, the lonely nights reviewing the progress on the bug tracker

11:37 But ok, of all the things we could discuss this fine afternoon, let not PHP be one of them

11:38 doseq: LauJensen: I ran a decent-sized site on it for a while... taught me a lot about managing Apache processes, that's for sure!

11:39 psykotic: i'm disappointed no one commented on my infix reader hack that i posted to the mailing list last week. i was expecting some flames at least :)

11:39 LauJensen: infix?

11:39 clojurebot: infix is not worth the trouble; see http://groups.google.com/group/clojure/browse_thread/thread/319a1c77ed718ba/3e4be7484b7cbe38

11:39 LauJensen: man thats fun

11:40 psykotic: LauJensen: http://groups.google.com/group/clojure/browse_thread/thread/170616bcc7d776f2/8231ea8bcada43d8?lnk=raot

11:40 LauJensen: In the Functional Dynamics post I did - The thing which got echoed the most was my comment on infix. "Was he joking?" "No he couldnt me" "yes he was half joking" "he was not joking!".. :)

11:41 psykotic: prefix syntax isn't an end in itself

11:41 LauJensen: psykotic: I'm naturally disgusted, but I'll be merciful since you did write that sickness was the cause of this code

11:41 psykotic: haha right

11:41 Chousuke: :P

11:42 psykotic: you have to admit it's nice that it's totally seamlessly integrated with macros because it works at the reader levl

11:42 also, the implementation is like 20 lines of code (java code!)

11:43 doseq: I'm working on a visual form composer, thinking of simulating the look of infix notation by including GUI sugar.

11:43 LauJensen: psykotic: Yea its cool that it was so simple to do

11:43 Whats the point ? Seriously, infix is an inferior notation form which demands precendence rules.

11:44 psykotic: LauJensen: aren't you the one preaching about code density?

11:45 doseq: Right, but it's a visual form builder so the actual containment is the same. It'd just be a presentational thing.

11:45 LauJensen: psykotic: The only way I could see infix making an apperance in Clojure, would be if I freed up just a little more time and then integrated J into the Clojure syntax

11:45 psykotic: i'm programmed in common lisp and scheme for like 12 years and there's no way that prefix s-expression syntax is an unqualified good blessing. does it outweigh the down sides? yes. but that isn't the same say as saying that it's superior in every way.

11:45 LauJensen: oh, i don't want clojure to be infix.

11:45 LauJensen: (defn average [col] (+/ % #))

11:46 (defn average [col] (/ (reduce + col) (count col)))

11:46 The Js numerical performance is incredible

11:46 So it would be a winning combo

11:46 psykotic: also, i don't believe J has precedence rules. incidentally, what i posted doesn't have precedence rules either. everything is equal precedence and right associative.

11:46 doseq: LauJensen: can you define J? I'm not sure what you mean.

11:47 LauJensen: doseq: Its a programming language

11:47 psykotic: J has precendence rules, although they are different from C and Ks

11:47 psykotic: LauJensen: well, K has something very simple and uniform. basically, it has different binding strengths for nouns, verbs and adverbs, but that's it. there's no per-operator associativity or precedence.

11:47 i think J is similar.

11:48 doseq: Ok, cool. I was just reading about Landin's J operator today so I've got things buzzing around in my head.

11:48 LauJensen: It is - But in my terminology "binding strength" is read as precendence

11:48 psykotic: i know but i'm saying that there are only three categories.

11:49 LauJensen: doseq: I have a couple of blog-posts on J if you want to add to the confusion :)

11:49 psykotic: and the categories are delinated on semantic lines.

11:49 (J probably has more because it's so disgustingly baroque)

11:49 doseq: I eat confusion for breakf..ner!

11:49 LauJensen: J adds a little trouble to the mix, by having forks, hooks and trains, depending on the number of verbs in each sub-expression

11:49 psykotic: K is tasteful. J is overindulgent. they didn't know when to stop.

11:49 right.

11:50 LauJensen: J is beautiful

11:50 Raynes: J is terse.

11:50 :o

11:50 LauJensen: K is just a letter

11:50 doseq: LauJensen: what is your blog address?

11:50 LauJensen: doseq: www.bestinclass.dk

11:50 On J

11:50 1: http://www.bestinclass.dk/index.php/2009/11/mind-games-ascension/

11:50 2: http://www.bestinclass.dk/index.php/2009/11/life1d-in-clojur/

11:51 psykotic: LauJensen: that last one reminds me of how annoying it is to have your initial title with a typo in it, so it persists in the permaurl :)

11:51 LauJensen: hehe - Franky I'm more annoyed with the .php than the typo :D

11:52 (but it was very kind of you to bring up, in here.. thanks) :)

11:52 psykotic: can't you have a rewriting rule to pretend you are php free? :)

11:52 LauJensen: Actually I think it would be simple to have nginx replace it with .clj

11:52 That would be cool - I think I'll try that

11:53 doseq: I just have to say, this channel is SO much friendlier than the jQuery channel.

11:53 Borkdude: I'm trying to re-read the discussion, what do you guys mean with J and K?

11:53 LauJensen: Borkdude: If you check out my posts you'll definately know

11:54 Here are a couple of simple, and not so simple J examples: http://www.jsoftware.com/jwiki/Studio/Gallery

11:54 psykotic: LauJensen: one of my favorite things about J is the dev environment.

11:54 LauJensen: hehe, woot?

11:55 You mean that Swing UI ?

11:55 psykotic: well, i don't mean the aesthetics. it's nice for repl-style prototyping and i love the integrated tutorials.

11:55 LauJensen: yea those are great

11:55 And regarding the REPL - You _really_ get some mileage compared to Clojure

11:55 psykotic: there's nothing like that for k. k's "ui" is an incredibly bad repl. it doesn't really have error messages. everytime you make a slight mistake, it will just quote what you wrote back at you. thanks, k!

11:56 LauJensen: Reminds me of Clojures infamous "Exception: NO MESSAGE (SOURCE.CLJ:0)"

11:56 psykotic: yeah, that one rocks.

11:57 LauJensen: Yea, makes me so happy. But then when I open up Source.clj, I get all disappointed :(

12:00 Raynes: http://i.nixeagle.net:8080/t is awesome. The site changes whenever nixeagle switches Emacs buffers or writes something.

12:00 doseq: Say, does the CLR run like individual virtual machine instances the way Java does?

12:09 Gertm: LauJensen: thank you for the nice video. It helped in realizing I should clean out all my previous '.'-folders. Got a working swank-clojure now! :)

12:13 doseq: Ok I think the answer is no, the CLR is singular and runs apps within itself simultaneously.

12:50 LauJensen: Gertm: np - Glad u liked it :)

13:28 doseq: of course, how else would you obtain those system-wide crashes if everything was isolated?

14:01 nullman: Raynes: that site is pretty cool; is the source code available?

14:01 Raynes: nullman: What site?

14:01 Oh.

14:01 I don't know, I'll ask the guy.

14:01 nullman: http://i.nixeagle.net:8080/t

14:04 Raynes: nullman: I'll get back to you on that.

14:04 nullman: ok, thanks; cool idea anyway

14:05 for me i would have to block it when i was editing my personal data (i use org-mode with an encrypted file for that), but everything else would be kind of cool

14:07 Raynes: nullman: The source is mixed in with some other stuff, but he's talking about packaging up and releasing it. Said to give him a day or so. I'll let you know.

14:11 The-Kenny: Raynes: Oh wow, would it be possible to inform me too?

14:11 Raynes: The-Kenny: Sure.

14:11 The-Kenny: Cool, thanks :)

14:15 nullman: great, thanks Raynes

14:34 Crowb4r: defn: we should think about loading these results for walton into a db.

14:34 because reloading at start is long

15:02 TakeV: Is there a way to make a new struct that has all the keys of another struct?

15:15 hugod: LauJensen: *current-connection* I take it?

15:15 LauJensen: hugod: yep

15:21 ,(.getRGB Color/RED)

15:21 ,(.getRGB java.awt.Color/RED)

15:21 -65536

15:22 Is there a simple quick math trick to get the RGB values from that int ?

15:34 maravillas: how about:

15:34 ,(bean Color/RED)

15:34 LauJensen: I need math tricks

15:35 maravillas: oh, no bot

15:35 bit masks?

15:37 LauJensen: Something like that

15:37 maravillas: or the algebraic equivalent, if you don't want to bit twiddle

15:37 LauJensen: I'd prefer bit twiddling

15:48 bsteuber: Laujensen: Why not (Color. -65536) and get the values from there?

15:48 (java.awt.Color. -65536)

15:48 #<Color java.awt.Color[r=255,g=0,b=0]>

15:49 looks promising to me

15:49 LauJensen: Its not bit-twiddling my friend

15:49 I need über fast bit tricks here

15:49 bsteuber: ah, okay

15:53 carkh: LauJensen : (bit-shift-right (bit-and 0xFF0000 -65536) 16)

15:54 not quite sure if that's fast or not

15:55 i guess ine could check the source of that function

15:55 one*

15:55 LauJensen: Lemme check, thanks a lot carkh

16:03 TakeV: I'd like to make a function that takes a map and a key, and returns a map that is the same as the passed map, except the key has been modified. How do I do that?

16:03 LauJensen: ,(assoc {:one 1 :two 2} :one 5)

16:04 bsteuber: life is hard without clojurebot

16:04 LauJensen: Unless you're chatting in Emacs and have a REPL in the next buffer :)

16:04 bsteuber: haha

16:05 LauJensen: I made a funny?

16:05 bsteuber: maybe you can even make M-C-x work with it

16:06 Fossi: would be pretty sleek

16:06 prolly needs to run the clojurebot andbox

16:09 jao: just put the cursor at the end of the expression, and M-x slime-eval-last-expression

16:10 (you can easily bind a key to that)

16:10 bsteuber: nice

16:11 The-Kenny: Isn't slime-eval-last-expt bound to C-c C-e?

16:11 jao: not in erc/rcirc buffers, i presume

16:12 The-Kenny: oh ok

16:13 TakeV: LauJensen: Thank you.

16:23 Hali_303: hi

16:24 it seems that the resource directory is not added to the classpath, even though swank-clojure docs say so. however, if I do (println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader)))), only the src, classes and test is added to the CP, not resources. any ideas?

16:25 LauJensen: Hali_303: Could you check (System/getProperty "java.class.path")

16:25 Hali_303: sure, one sec

16:27 LauJensen: test, src and classes there only

16:27 and the libs from the /lib directory, but no resources folder

17:04 Blackfoot: I'm having trouble loading SWT from a lien uberjar I compiled: java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM

17:07 Crowb4r: wow, I just spent an hour debugging why my utf-8 chars were showing up as ????

17:07 had to set java file.encoding to UTF-8

17:08 albino: java by default pulls the encoding from the OS

17:50 underdev: i hate maven, life, everyone, and everything.

17:50 in approximately that order

17:52 LauJensen: underdev: oops, you seem to have popped into #clojure, please return to #common-lisp

17:52 :]

17:55 Chousuke: :P

18:00 Licenser: greetings

18:01 so I've a question, when I have an 'runable' jar I can't combine -cp and -jar since java thinks that isn't cool

18:01 can I combine $CLASSPATH and jar?

18:02 Crowb4r: So, what is the best way for me to remove a bunch of newlines that I have in a string scatered about?

18:02 TakeV: Filter?

18:02 joshua-choi: A regular expression?

18:03 Licenser: I'd go wiht a regexp

18:06 underdev: ls

18:06 oops :)

18:06 Licenser: /tmp /usr /etc /home

18:07 LauJensen: Crowb4r: (.replaceAll s "\n" "")

18:07 Licenser: but that is so javaish!

18:08 LauJensen: (apply str (remove #(= \newline %) s))

18:08 Licenser: in my eyes the only three reasons to call java directly is A) in a wrapper library B) if performance really matters C) if you are an extremely masochistic person

18:09 LauJensen: If its more concise and clear than idiomatic Clojure I have no problem with a Java call

18:10 TakeV: Is there a library for working with OpenGL, yet? Or is there just LWJGL/JOGL?

18:10 Crowb4r: LauJensen: You have a point, and will use that.

18:10 LauJensen: TakeV: Penumbra!!

18:11 TakeV: Such enthusiasm. Must be epic awesome. :P

18:11 Licenser: heh

18:11 Crowb4r: LauJensen: thanks

18:11 LauJensen: TakeV: Indeed it is, and the guy driving it fantastic

18:11 Licenser: I don't know, I think it makes it look javaish and that reminds me of all the horrible things I go through whenever I come close to it

18:12 LauJensen: TakeV: It even lets you outsource computations to the GPU

18:12 Licenser: java has the usual sun problem: great idea but they didn't went through with it to the end

18:12 TakeV: Nice, that'll be helpful.

18:12 LauJensen: Licenser: Rarely do I find myself in a development situation, where I find its optimal to base decisions based on emotion :)

18:12 (You'd get along great with my wife though, haha)

18:12 Licenser: :P

18:13 LauJensen: well if I enjoy code it usually is better then when I don't, at least that is my experience

18:13 TakeV: Hmm, how you incorporate it into your project? Just add project.clj?

18:15 Licenser: but jokes aside, as much as I hate java for this taks you're right .replaceAll is actally a simple solution

18:15 LauJensen: TakeV: :dependencies [penumbra "0.5.0"]

18:15

18:16 TakeV: Hmm, it requires LWJGL?

18:16 LauJensen: Yep

18:16 Check out his Github page

18:16 Get started guide, source, etc

18:17 TakeV: Yeah, on there now.

18:19 LauJensen: TakeV: And make sure you check out his blog http://ideolalia.com/creating-a-simple-game-in-clojure

18:20 TakeV: Neat, thanks. :)

18:25 Crowb4r: ]

18:25

18:25 opps

18:26 Licenser: hmm I just learned something interesting, leiningen, when compiling ajar compiles used libraries into the jar o.O

18:28 Crowb4r: when you run uberjar?

18:28 Licenser: no always

18:28 I expected it for uberjar but it also happens with jar

18:28 but only some, that is very odd

18:28 and makes me confused how leinigen decides what to include and what not

18:32 underdev: in both a manually installed maven2 and a apt-get installed maven2, when i try to install labrepl w/ maven, i get: "The plugin 'org.apache.maven.plugins:maven-clojure-plugin' does not exist or no valid version could be found"

18:32 Licenser: for defn's project, walton it lincludes cln-sandbox, clj_html but nothign else

18:32 perhaps since they are not in the clojure namespace?

18:32 LauJensen: underdev: repeat the question when cemerick is here. He is one of 4 people still alive who use Maven

18:33 underdev: if you're using lein, your using maven

18:33 Licenser: I still say we need a simple dependencie management system :P

18:33 underdev: but i may give up on trying to grok maven

18:34 i don't feel comfortable not knowing wtf my build system is doing

18:35 on the other hand, i'm standing on the shoulders of giants with emacs, so...

18:39 Crowb4r: underdev: I hope you don't ever compile anything in C with your views on build-systems. :p

18:43 Licenser: hmm what the heck does 'Context classloader is not a DynamicClassLoader' tell me?

18:43 yeems to yall at me for calling add-class-path

18:44 seems I'm not allowed to call the whenI use compile?

18:45 Crowb4r: Java has about the worst debugger messages I have ever seen.

18:45 defn: http://www.harukizaemon.com/2010/03/functional-programming-in-object-oriented-languages.html : Is this accurate?

18:47 Licenser: Crowb4r: yap

18:47 defn: hi btw :)

18:49 Crowb4r: defn: I will read that link later and tell you, but I'm off to eat some dinner.

19:33 Licenser: hmm is there a way to tell clojure to use the classloader from repl instead of the one from script runner?

19:36 Crowb4r: defn: you around?

19:56 defn: Crowb4r: sort of

19:56 what's up?

20:04 Ankou: hi, often when I write a macro I use a second syntax quote in an unquoted form of the first syntax quote. But then I have different # and can't use it for variables I defined in the outer syntax quote which I also need in the inner syntax quote.

20:05 qbg: You could use gensym directly

20:07 Ankou: okay, thanks

20:20 Crowb4r: defn: Walton takes a while to parse all those logs

20:25 defn: Crowb4r: did you do (background-walton-init) or (walton-init)

20:25 also, does anyone know the url for the clojure build snapshots

20:27 Crowb4r: defn: background-walton-init

20:28 I was thinking of figuring out how to toss all of that into a simple database for the irc bot

20:29 defn: Crowb4r: yeah that's a good idea

20:29 Crowb4r: So when I reboot the bot everythign is not in memory.

20:29 and lost on a crash

20:29 or shitydown

20:29 shutdown*

20:31 Licenser: Crowb4r: simple solution pr-str the map into a file and then just read it

20:37 hiredman: why would you pr-str?

20:37 Crowb4r: ,(doc pr-str)

20:37 hiredman: pr and print both output to *out* which can be rebound directly to a printwriter on a file

20:38 no need to go through a string

20:38 Licenser: to print stuff, I know you can do it with pr and a writer but it's simpler to say (spit "file" (pr-str *maptingy*))

20:38 hiredman: :(

20:38 * Licenser patpats hiredman

20:39 Licenser: You are right so, it is a bad solution, I just suggested it for the sake of simplicity :P

20:41 TakeV: Swank doesn't seem to work, keeps saying that the files are not found. Is this normal?

20:42 tufflax: Eh, I have some trouble understanding the function amap, (amap a idx ret expr). Why would I need the ret, the copy? To use in the expr? What would be a example of some expr that uses ret in some useful way?

20:43 Licenser: now we'd need walton to find that :P

20:47 Crowb4r: Licenser: I was thinking of even just tossing it in something like a berkleydb, but I might just put it in something like a postgres or mysqldb

20:49 defn: Any ideasa what would be the easiest to attach to walton based on it's setup?

20:49 _ato: ,(let [src (to-array [3 3 4 3])] (seq (amap src i dest (+ (aget src i) (if (pos? i) (aget dest (dec i)) 0)))))

20:50 ah, no bot

20:50 hiredman: !

20:50 _ato: <clojurebot> (3 6 10 13)

20:50 hiredman: I hadn't noticed

20:50 * _ato fills in

20:50 Crowb4r: lol

20:51 Licenser: Crowb4r: don't use BDB!

20:51 Crowb4r: pircbot libs seems kind of assholish to work with.

20:52 ohhh?

20:53 Licenser: It brakes on updates, I#ve very bad experience with it

20:53 Crowb4r: ahhh

20:54 Licenser: pr and read isn't such a bad combination :P

20:54 tufflax: _ato ok thanks... So how would that look if src wasn't an array but a clojure seq? :P

20:55 _ato: tufflax: I've never used it before, but I assume you'd use amap's "ret" when you don't want to do a purely functional map (ie you want get or set indices other than the current one in each step). Like you could implement a shuffle with it.

20:55 ,(doc amap)

20:55 clojurebot: "([a idx ret expr]); Maps an expression across an array a, using an index named idx, and return value named ret, initialized to a clone of a, then setting each element of ret to the evaluation of expr, returning the new array ret."

20:55 _ato: it wouldn't work at all?

20:56 ,(amap [1 2 3] i ret 3)

20:56 clojurebot: java.lang.IllegalArgumentException: No matching method found: aclone

20:56 _ato: ,(amap (to-array [1 2 3]) i ret 3)

20:56 clojurebot: #<Object[] [Ljava.lang.Object;@1865b82>

20:56 _ato: ,(seq (amap (to-array [1 2 3]) i ret 3))

20:56 clojurebot: (3 3 3)

20:57 tufflax: I mean given a seq (3 3 4 3) as input, produce the same result as there, (3 6 10 13).

20:57 _ato: ,(let [src (to-array '(3 3 4 3))] (seq (amap src i dest (+ (aget src i) (if (pos? i) (aget dest (dec i)) 0)))))

20:57 clojurebot: (3 6 10 13)

20:57 _ato: oh

20:58 you mean not using amap?

20:58 tufflax: no, just clojure seqs

20:58 _ato: hmm

20:58 probably need to use a reduce, lets see

21:02 maybe something like this:

21:02 ,(next (reduce (fn [v x] (conj v (+ x (v (dec (count v)))))) [0] [3 3 4 3]))

21:02 clojurebot: (3 6 10 13)

21:02 tufflax: hm ok, let's see if i understand this... :P

21:03 Crowb4r: clojurebot: seen crowbar7

21:03 clojurebot: crowbar7 was last seen quiting IRC, 3283 minutes ago

21:04 _ato: ,(next (reduce (fn [v x] (conj v (+ x (last v)))) [0] [3 3 4 3]))

21:04 clojurebot: (3 6 10 13)

21:04 _ato: ^ might be more understandable, but 'last' is not constant-time

21:05 tufflax: this is gonna take a while... thank you in the mean time :D

21:07 Licenser: _ato: count isn't either is it?

21:11 _ato: Licenser: count is constant time for most types. It's linear for cons lists and lazy seqs, but constant-time for persistent lists, vectors, maps etc

21:11 Licenser: ah cool thanks :) learned something new again

21:15 Crowb4r: hiredman: My head hurts from trying to exactly understand how clojruebot works. :p

21:15 clojurebot*

21:16 tufflax: hm _ato now i understand the code... the one with amap is almost easier to understand though :P hehe

21:16 hiredman: Crowb4r: it's an input processing pipeline

21:17 messages come in and are placed in the pipe (call to responder)

21:18 Crowb4r: hiredman: I figured that part out. I was just figuring out how you are attaching things to that pipe.

21:18 defresponder defresponder2, etc

21:19 hiredman: they do the same things, just refining

21:19 defresponder2 doesn't actually need to be a macro

21:19 I just haven't gotten around to fixing it

21:19 Crowb4r: OHHHHHH

21:20 ok, well that helps out

21:20 hiredman: it just takes a map with the correct entries

21:20 I need to rip out the irc specific stuff and split it out

21:20 the xmpp stuff could be much nicer

21:21 I was playing a little more with smack last week

21:21 tufflax: you shouldn't do smack, it's bad for you

21:22 Crowb4r: see, thats where I was getting lost kind of. I was just trying to figure out the irc parts.

21:23 hiredman: because it was an irc only bot the irc stuff is kind of front and center, but now it really doesn't need to be

21:23 I also need to fix up the storage stuff

21:24 Crowb4r: hiredman: it's nice code, don't get me wrong.

21:24 hiredman: :P

21:24 you obviously haven't looked at factoids.clj for example

21:24 hideous

21:25 Crowb4r: no, mainly clojurebot.clj and core.clj and a couple of random modules

21:25 _ato: tufflax: it may well be. The amap one is pretty close to an imperative 'for' loop and reduces aren't usually the most readable things.

21:26 tufflax: Yes, but I'm a beginner, which one feel more natural to you?

21:27 Crowb4r: hiredman: oh wow factoid is a cluster

21:27 _ato: I'm not too happy with either. ;-) I'm now thinking it might be better written as a lazy-seq

21:27 tufflax: hehe ok

21:37 _ato: tufflax: here's a lazy variant (it'll only calculate as much as you ask for) http://gist.github.com/355896

21:38 tufflax: Hmm, (instance? Integer n) doesn't work if n is big. Is there an easy way to test if n in an integer, big or small? (instance? BigInteger n) doesn't seem to work either, maybe I'm doing something wrong.

21:39 _ato: ,(integer? 5)

21:39 clojurebot: true

21:39 _ato: ,(integer? 50000000000000000000000000)

21:39 clojurebot: java.lang.ExceptionInInitializerError

21:39 _ato: hmm

21:39 Licenser: it's a long then

21:40 first it becomes long then it becomes BigInteger

21:40 hiredman: ,(meta #'integer?)

21:40 clojurebot: {:ns #<Namespace clojure.core>, :name integer?, :file "clojure/core.clj", :line 2275, :arglists ([n]), :doc "Returns true if n is an integer"}

21:40 _ato: strange...

21:40 works for me

21:40 ,5000000000000000000000000

21:40 clojurebot: 5000000000000000000000000

21:40 hiredman: ,(integer? 5e10)

21:40 clojurebot: false

21:40 hiredman: ,(integer? 5e1000)

21:40 clojurebot: false

21:40 tufflax: oh, yeah, forgot about that one :D

21:41 _ato: ~def integer?

21:41 Licenser: you can try (isa? (type 1000000000) Number)

21:41 _ato: ,(number? 5e100)

21:41 clojurebot: true

21:41 _ato: ,(number? 50.0)

21:41 clojurebot: true

21:42 _ato: ,(class 5e100)

21:42 clojurebot: java.lang.Double

21:42 tufflax: 5e1000 => Infinity :P

21:42 _ato: ,(class 5000000000000000000000)

21:42 clojurebot: java.lang.ExceptionInInitializerError

21:42 _ato: ah

21:42 Licenser: , 5000000000000000000000

21:42 clojurebot: 5000000000000000000000

21:43 Licenser: (let [x 5000000000000000000000] (type x))

21:43 _ato: works in my repl

21:43 Licenser: ,(let [x 5000000000000000000000] (type x))

21:43 clojurebot: java.lang.ExceptionInInitializerError

21:43 _ato: maybe a bug in clojurebot's expression checking?

21:43 Licenser: shouldn't be

21:43 It might be something in the jvm sandbox

21:44 hiredman: *shrug*

21:44 Crowb4r: hiredman: do you have clojurebot call every method and have it traverse the regex in each module for a match?

21:45 hiredman: call every method?

21:45 clojurebot calls the predicate provided for each responder

21:46 Crowb4r: hiredman: To elaberate I mean when a message comes down the pipe, does it call every hook looking for a match?

21:46 hiredman: responder doesn't need to be a multimethod either

21:46 Crowb4r: Ohh predicate check

21:46 hiredman: right

21:47 defresponder's syntax doesn't make it clear

21:47 Crowb4r: I was seeing all the multi-methods and wondering

21:47 hiredman: defresponder2 is better about it

21:47 the output stuff needs to be a mm

21:48 (it is)

21:49 tufflax: 1e10 => 1.0e10, and (int 1e10) => 2147483647. So, I'm forced to write 10000000000? :P

21:49 Crowb4r: (it is)?

21:49 hiredman: uh

21:49 new-send-out?

21:49 Crowb4r: ohh

21:49 hiredman: for selecting irc or xmpp output (possibly twitter if I ever got that working)

22:00 Crowb4r: hiredman: Ahh, I see

22:12 Licenser: ~defn add-class

22:12 clojurebot: add-classpath is bad, avoid it. I mean it!

22:12 Crowb4r: 0.o

22:12 TakeV: That's neat.

22:12 Licenser: clojurebot: you silly peace of soap, I want the source of it

22:12 clojurebot: source is http://github.com/hiredman/clojurebot/tree/master

22:13 Licenser: clojurebot: no the source of add-classpath

22:13 clojurebot: source is http://github.com/hiredman/clojurebot/tree/master

22:13 mikem: ~def add-class

22:13 clojurebot: Gabh mo leithscéal?

22:13 hiredman: ~def add-classpath

22:13 Licenser: nice hiredman thanks

22:13 TakeV: ,(doc add-classpath)

22:13 clojurebot: "([url]); DEPRECATED Adds the url (String or URL object) to the classpath per URLClassLoader.addURL"

22:14 TakeV: Oh, the source.

22:14 Misread.

22:14 Licenser: meh why is it depreclated :(

22:20 hmm why does clojurebot says add-classpath is evil?

22:21 bmason: because it's deprecated :)

22:21 Licenser: is there an replcement?

22:21 hiredman: java's classloader scoping stuff can bite you with add-classpath

22:22 Licenser: hmmm?

22:23 as in 'overloading' something already loaded

22:23 hiredman: no

22:23 bmason: I read the rationale for this once, but unfortunately I can't find a link atm

22:24 the general idea is that it's not appropriate to set a java classpath from within clojure, and it should be done from your build tools or whatever environment setup you have

22:25 the leiningen project is an excellent way to manage your classpath

22:25 Licenser: I think it is a horrible way to be frank

22:25 it falls into the 'way too complicated' section in my eyes

22:25 hiredman: http://clojure-log.n01se.net/date/2008-06-03.html#17:33

22:25 has an example of things that break when using add-classpath

22:26 bmason: ok

22:26 Licenser: thanks

22:27 *sighs*

22:30 so the bottom line is clojure can't (should not) handle class path stuff and we end up with using the jvm things?

22:30 bmason: yup

22:31 Licenser: that is horrible

22:31 Crowb4r: Licenser: Yeah, the thought is lets not be an asshole to the jvm.

22:31 pardon my language

22:31 Licenser: but the jvm is one too :P

22:32 Crowb4r: Licenser: sort of, but if dynamically adding classpaths can easily break things, it's best no to have that hack around.

22:33 I also see that as a huge exploit

22:33 Licenser: it makes things horribly more complicated :(

22:36 bmason: I hear what you're saying... I've been through plenty of pain with the classpath

22:36 Licenser: I figured I try to write a nice library that handles dependencies somewhat like rubygems since it is simple, no fuss and works just great most of the time. But I fail to get it work beyond the repl

22:37 bmason: what's your beef with lein?

22:37 Licenser: bmason: too complicated and too sammy most of the time

22:38 also it is based on maven which makes it even more cimplicated

22:38 bmason: well making a project.clj file is pretty straightforward

22:38 Licenser: it is great for building stuff but the dependency management is a horror

22:38 bmason: hah

22:39 there really isn't any dependency management that I'm aware of

22:39 hiredman: ~dirt simple

22:39 clojurebot: http://www.thelastcitadel.com/dirt-simple-clojure

22:40 Licenser: no I mean seriousely, a week ago I tried to write a little wiki like thing and getting compojure to work correctly with all the deps took me longer then getting a first running version

22:40 hiredman: that does not solve the problem of dependenceies

22:40 hiredman: sure it does

22:41 find the jar and drop it in ~/.jars/

22:41 TakeV: I still can't figure out how to use it to get Penumbra running...

22:41 Licenser: that isn't a solution that is way to complicated

22:41 bmason: hiredman: he's talking about hierarchical dependencies

22:41 Licenser: it shoud be as simple as <whatever tool to use> install <library>

22:41 bmason: at least, I think :)

22:41 Crowb4r: Licenser: I think what would be nice is if you could invoke a clojure script, and have it just grab the missing dependencies then run.

22:41 python has something like that

22:41 hiredman: bmason: finding the jars and dropping them in ~/.jars fixes those to

22:41 Crowb4r: as I recall

22:42 self-check so to speak

22:42 Licenser: Crowb4r: that was my goal I fail on the classpath stuff :(

22:42 bmason: yeah, but if I 'apt-get install gimp' I don't want to have to hunt for X and all it's dependencies

22:42 somnium: Licenser: really? what deps messed up with compojure? last time I used it [compojure "..whatever"] in project.clj and it worked on the first try

22:43 though I havent managed to install penumbra yet :/

22:43 bmason: same could be true of clojure libs if the dependencies are deeply nested, it could be a PITA to get them all manually... though I have to say I haven't encountered this myself

22:44 Licenser: "whaterver" was the first problem, since 0.4.0 (as int he doc) wasn't existing, a search on clojars showed up like a gazillon versions of compojure, only one of them actually automatically got all the stuff like jetty and such stuff

22:44 took me over an hour to get it work, that is a thing that just can't e

22:44 somnium: oh, 0.3.2 was the one I used I think

22:45 Crowb4r: Licenser: I can tell you that compojure "0.4.0-SNAPSHOT" does work

22:45 Licenser: bmason: I am very much used to ruby where the whole dependency managemnt thing really ever was in issue to me

22:45 Crowb4r: I don't know what it was exactly but the one that was in the README didn't worked when I tried it out

22:46 somnium: haskell's cabal system is quite nice, wish we could do `lein list "penumbra"` for example

22:46 Crowb4r: I guess it is an unofficial thing currently, but anything development and bleeding edge gets a SNAPSHOT

22:46 Licenser: somnium: exactly such things are needed in my eyes

22:46 bmason: aye

22:46 that's the one thing I was finding myself looking for today

22:46 Licenser: it is just much too complicated :(

22:46 bmason: something to search currently mapped repos

22:47 instead of me trying to hit them in my browser and locate the libs/versions

22:47 Licenser: and the force to use versions

22:47 Crowb4r: adopt the same naimg as apt-cache

22:47 bmason: now versions I think is good

22:47 Crowb4r: search, info, list,

22:47 Licenser: Crowb4r: the exactl names are not too important

22:47 bmason: Crowb4r: I agree

22:48 we've basically got a package manager here... it's a solved problem

22:48 do what has worked before

22:48 Licenser: bmason: I think they are important and good most of the time but it should be as simple as when I say ... install penumbra it installes the current stable version

22:48 and if I then (use 'penumbra.something) it loads the latest installed version

22:49 bmason you mean maven?

22:49 bmason: yeah, that's valid

22:49 um

22:49 Crowb4r: When there are missing dependencies do what spt does and restart the program after the deps and updates are resolved. :p

22:49 bmason: I have no maven experience outside of lein

22:49 Crowb4r: s/spt/apt

22:50 bmason: but I think the general concept of a package manager is fairly constant

22:50 Licenser: bmason: I disagree strongly

22:50 bmason: why's that?

22:50 Crowb4r: ever use yum or yast?

22:50 thumbs down

22:50 bmason: Crowb4r: yes, and yes :)

22:50 Licenser: because there are generally two approaches: make it very very expressive, or make it 'just work' simple

22:51 yast is horrible

22:51 bmason: yeah, I'm a much bigger fan of apt

22:51 I suppose I get what you mean then

22:51 Licenser: I am not sure it is correct to compare dependency management systems for os's with one for used in a language

22:51 Crowb4r: however we could expand this and look at some of the best package managers around for programing langs.

22:52 CPAN is really nice imo.

22:52 ztellman: if I'm getting a runtime error for "incorrect number of args" passed to a macro, what does that mean?

22:52 shouldn't that be caught at compile time?

22:52 Licenser: I personally have my best experience with rubygems

22:52 bmason: you're just for simplifying the syntax and having a sensible default action

22:52 I hated managing versions with rubygems

22:53 somnium: rvm ftw! :P

22:53 bmason: but I only worked with rails for one project

22:54 Licenser: bmason: rails is nearly it's own world it can be confusing since it does so many things on it's own

22:54 Crowb4r: python is such a jerk with adding libs.

22:54 bmason: :-D

22:54 and my experience was they broke compatibility with nearly every release

22:54 Licenser: I mean your bar experience might very well one with rails and not one with gems

22:54 bmason: yea but that is a rails issue not a gem issue

22:54 Crowb4r: I thin CPAN is nice because it gives you a lot of options to look for mirrors, or etc.

22:54 bmason: true

22:55 Licenser: a dep management system can't stop maintainers to be silly

22:56 Crowb4r: I think lein could really use a dry-run mode

22:56 Licenser: hmm Crowb4r I even found cpan a bit complicated but that might be that I had not worked much with it

22:56 Crowb4r: Licenser: Well, take the complicated part, and add a simpler more intuitive way to work with it.

22:56 bmason: lein is really close to being what I need... add the ability to search for packages and resolve hierarchical deps and I'd be a happy baby

22:56 Licenser: bmason: also remove the silly version stuff

22:57 bmason: default version, agreed

22:57 not removed, just a sensible default

22:57 Licenser: *nods*

22:57 Crowb4r: Licenser: How abotu defult version that is considered stable unless otherwise specified.

22:57 Licenser: Crowb4r: yea latest stable or otherwise specified I totally Agree

22:58 what I did was it either takes the latest or you can specify a set of rules for versions

22:58 Crowb4r: you could also add a suggested version so incase there is a major overhaul to a dependency that is needed it can try to use what was stable at the time.

22:59 Licenser: like you could say "clj-sandboy" ">=0.2.5" "<0.3.0" that would give you a version between 0.2.5 and 0.2.99999999999(watever)

22:59 bmason: so assuming none of us is actually going to submit a patch for lein... it might be good to at least document these feature requests

22:59 Licenser: bmason: I am not sure if you CAN do that with maven

22:59 hiredman: you can

22:59 bmason: do what?

23:00 Licenser: listing stuff and so

23:00 bmason: ah

23:00 Licenser: lanother issue with leiningen is that it copies everything into the lib directory which I find horrible :(

23:00 bmason: I find it tolerable :)

23:00 Licenser: not really

23:01 since it can bite you in the a*

23:01 Crowb4r: Licenser: I understand that, but you could make a symlink option to use.

23:01 bmason: sym links might be better

23:01 Licenser: symlinks are not os indipendant

23:01 also it really has some bad issues

23:01 bmason: who uses windows? :-D

23:01 Crowb4r: but not change the default deps downloading into libs

23:01 hiredman: neither is the shell script that starts lien

23:01 Licenser: bmason: while I agree with that to quote Crowb4r we should not be asses to windows users :P

23:01 Crowb4r: umm vista and up supports symlinks

23:02 bmason: yeah j/k :)

23:02 there is a windows batch script available for lein though

23:02 Licenser: seriousely the libs should be in one central place (either user or system wide)

23:02 there is no reason at all to download libs more then once

23:02 bmason: and... hey, not every feature has to be supported on windows

23:02 no reason not to offer the *option* for those who have the capability

23:03 Licenser: it doesn't actually download them more than once

23:03 Licenser: the issue is the following: lein deps (update prjoject.clj to use a newer version of library X) lein deps; lein compile => brakes every now and then since you've two versions of the library

23:03 bmason: Licenser: it puts them in a central location then copies them to each project

23:04 Licenser: bmason: okay badly worded sorry, I meant having them on your disk more then once

23:04 bmason: no, newer versions are stored with unique names

23:04 Licenser: bmason: different versions is OK, but not the same version

23:05 Projects heinz$ find . | grep "jar$" | wc -l

23:05 129

23:05 that is just horrible

23:05 Crowb4r: Licenser: The other thing is that with swank it's awesome to have the entire development enviroment in one folder so you can do a remote session and have a development set-up that is unique to each project.

23:06 * _ato likes the way lein currently works >.>

23:06 _ato: every project is self-contained

23:06 Licenser: Crowb4r: then it should be an option to copy the stuff there

23:06 _ato: you can copy to a different PC and it just works

23:06 Crowb4r: I like the way it works, but it could use a bigger feature set I think.

23:07 bmason: Crowb4r: I'm in agreement with that

23:08 Crowb4r: if you did some default versioning you could so a lein deps-update and it would grab the newest default (minor) version.

23:08 major versions are ment for breaking things, not minor, so that should be a well established standard.

23:09 well generally is

23:11 so the compjure rewrite should technically be a major version update because 0.4.0 is way different then 0.3.2, however that should be a 1.0 and 2.0, but I could be wrong.

23:11 bmason: could prompt on major versions

23:11 _ato: with central system location for libs you need to install all the libs on all your PCs. Which makes sense for languages that compile natively (or have lots of native extensions) as half the time you're going to need to recompile anyway, but one of the nice things about java is you can just copy something to a random machine and expect it to just work

23:12 Crowb4r: otherwise you will have to try to write some absurd corner cases to program for. However when you are the package system, you can dictate how things will be versioned..

23:12 Licenser: I mean I have 177MB of jars for clojure by now that is a bit too much

23:13 Crowb4r: _ato: yeah, it's a straight copy, but people are lazy, and support is a headache.

23:13 if it does not do it for you, people don't adopt to it quickly.

23:13 in programming that is.

23:13 :p

23:14 Licenser: Crowb4r: there is a nice text about semver in the interwebs that explains a good standard for versioning

23:14 0.* is generally concided as unstable and is 'allowed' to break with every release 1.0.0 is the first version with a stable API

23:14 Crowb4r: I could be wrong, but people don't want to go back to the fun of linking that C is and was.

23:14 _ato: I don't buy the argument about disk space as disk space is ridiculuously cheap and in comparison to data sizes the size of the code is nothing. If you're that worried about it you'd probably want to write a script to deduplicate your disk and replace all duplicate files with hard links. Your browser cache is probably bigger than that. ;-)

23:15 hyp3rvigi1ant: http://semver.org/

23:15 Licenser: exactly that one

23:15 Crowb4r: _ato: A softlink would be fine

23:16 bmason: hardware < peopleware

23:16 Crowb4r: so then when one project gets removed it does not delete the whole package that other places use.

23:16 Licenser: _ato: heinz$ du -sh Library/Safari/ => 14M Library/Safari/

23:16 bmason: making the job easier is worth a lot :)

23:16 rpenguin: _ato: you're just going to have to accept a lot of us are very concerned and a little insecure about the size of our disk.

23:16 _ato: haha

23:17 yeah ok, anyway technomancy's said he's happy to accept a patch that adds symlink support to lein

23:17 so feel free to do it

23:17 Licenser: _ato: but I don't want simlinks I want a centrelaized palce :P

23:18 bmason: for development?

23:18 Crowb4r: Licenser: I mean, I see the argument about diskspace, but still I just found out after 6 months that I lost 25GB of diskspace to google chrome dev build. I really did not flinch about it till I went looking to cut down some space and about had a stroke when my apps folders in my windows home folder was 27GB.

23:18 Stupid memory dumps

23:18 on crash

23:19 bmason: rofl

23:19 Licenser: heh

23:19 bmason: *makes a note to check his chrome folder*

23:19 Licenser: Crowb4r: sadly I've a small disk :P

23:19 only 22GB free :P

23:20 Crowb4r: I would advise you to not use google chrome.

23:20 the dev build

23:21 _ato: Licenser: why do you want a central place? (I mean other than disk-space.)

23:21 Licenser: bmason: to answer your questions, yes and no, if I install a version of a forign library for it and want it from a repository, then yes it should be central

23:21 Crowb4r: My name is google and I need to save my ENTIRE MEMORY STATE ON CRASH BY DEFAULT! Because people ar egoing to upload 1gb memory dump profile for bug fixing.

23:22 bmason: is this mainly for sanity of knowing that all projects are referencing the same version?

23:22 Licenser: hmm _ato actual a good question, it seems cleaner to me when you have multiple projects that share the same deps that they use the same

23:23 I mena would you intsal a version of python for every single python program? Or a version of java for every project?

23:24 bmason: I think it's a gray area... it's a question of when you reach critical mass and there are a lot of things referencing you so the duplicates would get out of hand

23:24 * Crowb4r is glad he is not a core language developer for C++ geesh

23:25 Licenser: :P

23:25 bmason: java and python are at that point where there could be hundreds of things referencing them on a single system

23:25 Crowb4r: imagine the corner cases on that. :p

23:25 Licenser: Crowb4r: yes that would be nice, for every c project you install it's own version of libc :P

23:25 bmason: lol

23:25 Apage43: *shudder*

23:26 Licenser: bmason: but it would be the same, actually lein installs a own version of clojure for every project

23:26 Apage43: differing libcs

23:26 Crowb4r: Ohh I ment in reguards to trying to make real improvments.

23:26 bmason: yeah... this is true

23:26 Apage43: reminds me of weird quirks running clojure on IBM jvms.

23:26 _ato: For distros which have a large team of people making sure versions work with each other and such it's nice to be able to share libs. (There's also memory benefits for C programs, but not for Java unless you do some special precaching stuff). If you don't have that sort of infrastructure then no it's much easier just for everything to have its own copy.

23:27 somnium: at least it doesnt copy a new JDK into lib

23:27 _ato: Actually at work for Ruby projects we found the gems central way quickly became a nightmare and ended up making a GEM_HOME inside each project

23:27 Crowb4r: _ato: yeah, ok you get better memory, maybe if you have no leaks at all.

23:29 * Crowb4r hates C++, but does enjoy C

23:29 * Crowb4r won't troll

23:29 somnium: Crowb4r: have you tried vala?

23:29 Licenser: _ato: which is understandable BUT the difference is gems give you the option, and for most of the time the central thing works just great and without any problems

23:29 leins way already broke for me and gave me very nasty bugs I had a really hard time to track

23:30 Crowb4r: somnium: I have not

23:30 brb

23:31 Licenser: but really if there wouldn't be such issues I could care for small libs but at least clojure itself should not be in every simgle project :(

23:33 _ato: Licenser: well, you could always use maven, which doesn't copy libs to projects ;-)

23:34 Licenser: going back to the versioning stuff, since I need to add a version to every library , (even clojure) I got: 1.1.0-alpha-SNAPSHOT, 1.1.0, 1.1.0-master-SNAPSHOT and 1.2.0-SNAPSHOT as clojure verions (just checked) scattered over my projects. I mean leinigen should not force me to tell it which version I want, since 1.1.0 is the current stable (I think, point proven here again in my eyes) just use that if I don't tell it explictly to use something

23:34 :/

23:35 _ato: which is all fine and good until 1.2 is released and suddenly all your projects break and you can't figure out why

23:35 Licenser: _ato: if I install 1.2 as a new clojure I think I'd know that :P

23:36 technomancy: Licenser: it's kind of inconsistent to complain about problems with leiningen you had while trying to get compojure to work and then say rubygems is great even though it's a pain to work with Rails. =)

23:36 Licenser: technomancy: kind of true :P

23:37 so I think the problems are somewhat different

23:37 _ato: anyway, not saying there isn't room for a dependency tool that works like gems, just that acting like gems doesn't magically solve everything and there reasons why you'd want to do things differently

23:37 technomancy: there's also a patch in the dev version of lein to use symlinks instead of copying to lib

23:37 but nobody uses it

23:37 because nobody cares about wasting five megabytes

23:38 Licenser: I picked the problem with compojure to explain the general issue lein has at the momen in my eyes

23:38 it's often easyer to explain an issue with an example then the abstract underlaying problem

23:39 but the copying is the smallest issue I have with leiningen (save for that I find it silly to copy clojure itself in ever project)

23:40 Crowb4r: It's a young language and as such I make concessions.

23:41 Licenser: Crowb4r: of cause, I won't say I stop using clojure, but if we don't talk about the issues we have or see clojure will not improve (or at least much slower)

23:41 Crowb4r: I would like to point out that I am olny making consessions because of the small, but really active community.

23:42 Licenser: I can't wait to see how clojure can work with the JAVA 7 JVM.

23:43 Licenser: it goes well

23:43 I tried it already

23:43 technomancy: I've seen a lot of breakage with Ruby in production in situations like where we move to servers that have 1.8.7 instead of 1.8.6 installed

23:43 being able to lock to an exact version is really important

23:43 Licenser: technomancy: very true, but that should not be a reason for us to say we can do it too :P we should try to make it better

23:44 chouser: we an clojure app breaking under load the other day, until the dev seeing it upgraded his jvm. The GC had been segfaulting.

23:44 Licenser: I think the key word there is 'being able to' not 'Being forced to'

23:44 chouser: was that defn?

23:45 technomancy: I don't think you'd ever want to just pick the latest version except by accident.

23:45 _ato: I don't think hiding the classpath and versions under the rug is a good way to go, it just encourages ignorance and means when something does break (and it will) you don't know what to do.

23:46 I mean sure for absolute beginners a sandbox that comes with a few useful jars prebundled is nice, just so you can get up and play around quickly, but anyone who seriously uses the language should understand this.

23:46 Licenser: technomancy: hmm I am not sure what you mean, would be using clojure 1.1.0 bad?

23:46 technomancy: _ato: you mean the labrepl? =)

23:47 _ato: You'd expect a C programmer to be able to use gcc's -I and -L flags

23:47 Licenser: i think at the start of development of a project, choosing the 'currently latest version' is the best way - at least for the most project

23:47 technomancy: Licenser: it would be bad if it used 1.1.0 today and 1.2.0 tomorrow and broke things without any warning.

23:48 Licenser: it does that if you use "lein new"

23:48 I thought you meant you should be able to leave off the version and have it use whatever is latest at the time; that's what I'm against.

23:49 _ato: I do think there's scope for a "lein search" that tells you the latest version, but when you add the dependency to the project it should be locked to that version unless you explicitly change it

23:50 technomancy: I also think there's room for "lein install $FOO" that works outside the scope of a project

23:50 once we add bin script wrappers

23:50 but's that several point-releases down the road

23:50 unless someone else wants to do the legwork. =)

23:50 (that would be a lot like Rubygems)

23:51 there just aren't that many CLI-launched clojure apps available yet, so I guess it's not a bad thing to wait on.

23:51 Licenser: technomancy: yes that would be nice

23:51 technomancy: Licenser: if you're looking for a project to hack on... =)

23:52 Licenser: hmm so sataying with the 'all int the project' how about lein install <library> to fetch the latest stable version adding it to project.clj and freezing it's version

23:52 lein update <library> to update that library to the latest stable versions

23:53 technomancy: I'd call it "add" instead of "install" (for the first)

23:53 but it would be worth having

23:53 _ato: yes

23:53 Licenser: ah add, isntall, get, fetch, whatever :)

23:53 important is the functionality

23:53 it would be a long way in the right direction I think

23:54 * Licenser should look into leiningens source :P

23:54 technomancy: go for it. =)

23:54 Licenser: it's only 700 LOCG

23:54 *LOC

23:54 Licenser: technomancy: I'm not so much scared of leins LOC but of the entire marven and ant stuff in the background

23:55 _ato: the ant stuff is ok

23:55 the maven stuff isn't

23:55 :p

23:55 Licenser: heh

23:55 albino: what's wrong with the maven stuff?

23:58 _ato: actually the maven stuff in lein is ok to, cause its wrapped in an ant API

23:58 cp2: the last guy who investigated that never came back... or so i heard...

23:58 Licenser: albino: I don't know everything about it

23:58 albino: heh

23:58 Licenser: maven scares me

23:58 albino: That's one way to disappear then

23:58 Licenser: the source or the concept?

23:58 cause the concept seems okay to me

23:59 Licenser: the concept already :P huge XML files with tons of things in it scare me

23:59 somnium: ~XML

23:59 clojurebot: XML is like violence; if it doesn't solve your problems, you're not using enough of it.

23:59 Licenser: lol

23:59 _ato: raw maven repository API is ugly, I used it in Clojars. Even the Maven developers agree: "The primary reasons for replacing the code are that it is unmaintainable and nearly impossible to navigate"

23:59 they're rewriting it for maven 3

Logging service provided by n01se.net