# #clojure log - Mar 30 2010

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

0:09 brian__: Hi, how can I tell the data type returned by a function?

0:10 Raynes: ,(type (+ 3 3))

0:10 clojurebot: java.lang.Integer

0:10 brian__: ok

0:11 tnx

0:12 nteon: that JD decompiler gives me wrong answers.

0:13 just for everyones information

0:14 wooby: arohner, got it! thanks in no small part to your insight http://gist.github.com/348741

0:14 i know this actual function works

0:15 arohner: wooby: great

0:15 nteon: but I can't see how it could work if that is _actually_ representative of the generated bitcode

0:16 according to JS decompiler, we find the (right) answers, then set the variable to null, then reference the variable

0:17 i have to bicycle home, but if anyone could look anad let me know in half an hour if I'm taking crazy pills, that would be aweome

0:44 "and i basically hate hieroglyphs, so i wont write APL."

0:47 nteon: hi folks

0:48 defn: nteon: hello

0:53 nteon: defn: any chance I could persuade you or someone else to look at what I posted 3/4 of an hour ago in the scrollback? I apologize if anyone already responded; I had to go offline and don't have something like irssi setup

0:55 joshua-choi: defn: But APL is so *pretty*. And it got its own Unicode block!

0:56 defn: joshua-choi: haha i was just laughing at the lyrics

0:56 that's another excellent one

0:57 joshua-choi: Wow, I didn't see that link.

0:57 defn: haha these are great man

0:57 joshua-choi: That's so...well, I'm smiling broadly :)

0:57 wooby: wow

0:57 gold

0:57 defn: pure gold

0:58 joshua-choi: I guess it was just a matter of time before a musical programmer did something. :)

0:58 defn: haha these are all different submissions

0:58 joshua-choi: Ah. Well, it was a matter time before someone aggregated musical programmers. :)

0:58 defn: joshua-choi: :)

0:59 fanatico: yeah, thanks for linking to that.

0:59 defn: fanatico: no problem -- here's a page with a bunch more: http://www.catonmat.net/blog/musical-geek-friday-crypto/

1:11 So he wrote it all in Lisp.

1:11 hahah -- ah man -- geek love

1:11 ndimiduk: is there an equivalent macro to doto which will conditionally apply the methods/functions against its first parameter?

1:12 or rather, i'd like to use a doto block, but call methods on a java object instance only (when ...) specific conditions are met for each method.

1:14 something like (doto* (Foo.) (when (pred-a?) (.bar)) (when (pred-b?) (.baz)))

1:15 or should i just use a let block? :)

1:16 leifw: ndimiduk: I'd suggest composing a multimethod and doto somehow

1:16 but I know very little about either, so maybe that is silly

1:16 I mean, depending on what kind of predicates you're looking at

1:17 suppose you did have doto* like above, how are you intending to use it?

1:17 ndimiduk: to conditionally call methods on an anonymous instance of a java object :)

1:18 leifw: yes, but on what sorts of conditions?

1:18 noidi: ndimiduk, maybe something like (doto foo (#(when cond (action %)))) ?

1:18 leifw: I guess I don't know anything builtin that will help; you should rpobably just roll your own

1:19 noidi: oops, that cond is a bit misleading, I meant it as a variable there :)

1:19 (doto foo (#(when (.bar %) (action %))))

1:19 ndimiduk: basically, i have a thin clojure wrapper over a java library. This particular fn instantiates an api object, calls setters based on the existence of fn params, and returns the object

1:20 more or less, i'm constructing api objects based on clojure maps.

1:21 these objects tend to have default constructors and property setters. so, make the instance and then call the right setter if a key exists in the map

1:21 leifw: so you want to call something like (doto* instance (:field1 val1) (:field2 val2))

1:21 ndimiduk: or, i guess more correctly, if a key value in the map is not nil

1:22 leifw: rather, (doto* instance {:field1 val1, :field2 val2})

1:22 tbh I'd just roll it myself

1:23 ndimiduk: ah, why not. just a sec.

1:24 noidi: (doseq [[k v] argmap] (condp k = :foo (.setFoo obj v), :bar (.setBar obj v)))

1:24 leifw: for example: (defn setAll [inst setMap] (map (fn [[k v]] (when (contains? inst k) (. inst ((setter k) v)))) setMap))

1:25 noidi: leifw, can you stuff methods into maps?

1:26 leifw: sure

1:27 hmm

1:27 ,(doc memfn)

1:27 clojurebot: "([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn."

1:27 leifw: there it is

1:27 noidi: thanks

1:28 it's better to use doseq instead of map there, because map is lazy

1:29 leifw: noidi: yup

1:29 I frequently run into that issue and get confused for 10 minutes

1:29 :/

1:29 ndimiduk: I want to make this method simpler: http://github.com/ndimiduk/clobo/blob/master/src/clobo.clj#L40

1:29 noidi: yeah, I learned the difference the hard way :)

1:30 after lots of painful debugging

1:30 ndimiduk: please forgive me. this is my first clojure code in the wild - be kind by being cruel ;)

1:30 leifw: did I miss something, or does that infinitely loop on (facet-spec [])?

1:32 seems pretty straightforward to me

1:32 ndimiduk: good question, i shall swank it up...

1:32 leifw: you could use naming conventions to write something that maps :key-words to java setKeyWords() and getKeyWords(), and make it a bit shorter

1:32 but that seems like it would get nasty, and wouldn't actually be that useful

1:33 maybe there's a way to do it with Bean properties, but I don't know anything about those, and I kind of hate the thought of javabeans anyway

1:34 ndimiduk: this api has a handful of objects which are created in this way. i'm only wrapping a small portion of the api right now.

1:34 so a simple fn/macro/mechanism for repeating this "pattern" in a simple way would be nice.

1:36 noidi: ndimiduk, maybe this could work? https://gist.github.com/cfe69717a9086961989d

1:37 ndimiduk: noidi: yes, that could work.

1:38 Raynes: noidi: I'm pretty sure memfn is generally frowned upon. #(.method % args) is the better alternative. An actual fn.

1:38 leifw: you'll want (get setters k) there

1:39 noidi: ok

1:39 ndimiduk: does memfn also curry over the arguments as your gist suggests?

1:39 noidi: leifw, why?

1:40 ndimiduk, there's no currying, memfn only takes argument names

1:40 leifw: because setters is a map, not a function

1:41 noidi: leifw, maps are functions of their keys

1:41 ,({:foo 1} :foo)

1:41 clojurebot: 1

1:41 leifw: ok never mind

1:41 Raynes: Maps are functions.

1:41 leifw: for some reason that didn't work for me today

1:41 Raynes: Oh, too late.

1:41 leifw: but I'm probably remembering that wrong

1:41 noidi: ndimiduk, but like Raynes said, you should use a lambda there

1:42 leifw: here's something else you could use for setter: http://gist.github.com/348800

1:43 ndimiduk: obfuscation for the sake of simplicity? is this perl? :)

1:43 Raynes: leifw: The time when get is most useful is when 'nil' is a valid return value for a key in your map, and you want to differentiate between a bad nil and a good nil. With get, you can make it return whatever you like if the key is not in the map instead of nil if need be.

1:43 ndimiduk: yeah, there's enough setters in this api that i'd like something along those lines.

1:44 leifw: right

1:44 ndimiduk: as long as your naming is consistent, something like that should be okay

1:45 oh wait

1:45 ok edited

1:45 haha, way better

1:45 I guess I could kill the cons too, but meh

1:48 the more difficult part will be the reflection to get the java method from the string name of it

1:48 about which I don't know much

1:48 Raynes: ~def printf

1:52 ndimiduk: thanks!

1:54 leifw: ndimiduk: looks like you'll want Object.getClass(), Class.getMethod() (you'll need the parameter types :/) or Class.getMethods() (which you can search), and Method.invoke()

1:54 Method.getName() will be helpful if you go with Class.getMethods

1:54 good luck

1:58 _ato: nteon: the decompiler is probably reordering the instructions

1:58 probably clojure is nulling the variables in between pushing them onto the stack and returning

1:58 you can't represent that in java code

1:59 nteon: _ato: doesn't that make the JD debugger useless?

1:59 _ato: dunno, never used it

2:00 the nulling is to prevent holding onto the head

2:00 as soon as a variable is no longer referenced its nulled out

2:00 so it can be garbage collected

2:00 nteon: my problem is that I have some nested macros, which expand incorrectly (Somehow), but when I use macroexpand on them in slime, the result I get works fine

2:01 I'm building a fn, but calling it gives me a null-ptr exception, unless I macroexpand it myself and then call that

2:02 _ato: strange...

2:02 there should be no difference between you macroexpanding and the compiler doing it, its the same code

2:02 leifw: ndimiduk: actually I'm kinda drunk and distractable, so I wrote you something anyway: http://gist.github.com/348811

2:03 ndimiduk: may or may not work, I haven't tested it

2:03 nteon: _ato: possibly different environment, includes and such. thats what im looking at now (I'm expanding it in a test file I'm using as a scratch buffer)

2:03 leifw: and method-for-class won't work for polymorphic functions, but if you just have getters and setters, that shouldn't matter

2:16 ndimiduk: ok this actually works: http://gist.github.com/348817. Try (getter (. java.math.BigInteger/ONE (getClass)) :lowest-set-bit)

2:17 ndimiduk: leifw: hawt

2:18 leifw: I always try to rewrite (. obj (method)) as (.method obj); dunno why

2:20 LauJensen: Morning

2:21 tomoj: leifw: that's the recommended style, I think

2:21 (.method obj) I mean

2:22 leifw: didn't work for me

2:22 defn: ,(:foo {:foo 1})

2:22 clojurebot: 1

2:22 defn: also works fwiw

2:22 leifw: maaaaaan you guys and your idioms

2:23 Raynes: LauJensen: Have you written anything cool in J?

2:23 LauJensen: Raynes: I'm strictly a 1-liner kind of a J guy, so nothing more than that

2:24 defn: what do you guys think of Lua?

2:24 Raynes: I think it's an embeddable scripting language and therefore of no interest to me.

2:24 leifw: good for configuring window managers, probably not much else?

2:25 nteon: so my problem is this: http://paste.lisp.org/display/97059 when I pass a string containing clojure code to load-string, http://paste.lisp.org/display/97059 , the java.lang.Math/exp ends up being null?

2:25 albino: possibly narrow minded too

2:25 leifw: it's okay, it just doesn't have anything excellent that no other language has (apart from a small footprint and I don't care enough about that)

2:26 defn: it's kind of neat you only get the essentials

2:26 if you want break or continue you need to add that by hand

2:26 leifw: you're thinking of scheme ;)

2:26 Chousuke: lua is excellent for what it's for

2:26 which is being embedded in applications

2:26 defn: Chousuke: in your opinion what is it for

2:27 *nod*

2:27 i have a project id like to learn a little lua for, an application i use at work has an embedded interpreter

2:27 Raynes: No opinion about it. It's pretty much for that.

2:27 defn: just curious what your thoughts were

2:27 leifw: you can probably learn it in under an hour

2:27 defn: yeah it looks easy

2:27 tables

2:28 leifw: especially if you've done python or ruby

2:28 defn: ruby [x]

2:28 * nteon <3 python

2:31 tomoj: what?

2:31 clojurebot: What is meta

2:32 tomoj: you people like other languages too?

2:32 defn: heh

2:32 leifw: ...I did until last friday :)

2:36 nteon: python has some wonderful functions, namely map, reduce and filter

2:36 tomoj: beh

2:36 python is like clojure with it's legs broken

2:37 nteon: hahaha

2:37 tomoj: well, no, I'm sure it's great for lots of people

2:37 I just kept trying to use it like I'd use clojure

2:37 and it wouldn't cooperate

2:37 nteon: tomoj: its really nice when writing little scripts to not have to wait a couple seconds for the JVM to get its act together.

2:37 defn: i do most of my prototyping in ruby

2:38 and then re-write it in clojure

2:38 tomoj: nteon: yeah

2:38 albino: nteon: big AGREE on that one

2:38 tomoj: I think there's a way to get around that

2:38 defn: yeah but if you distribute your script

2:38 ...

2:39 albino: defn: define distribute?

2:39 _ato: there's nailgun, but it's always fiddly to setup and doesn't work in all situations. python/perl/ruby scripts just work

2:39 tomoj: yeah I think I see what you mean

2:39 defn: give out to other people who won't have the settings necessary to make your script run right away

2:39 albino: distributing CPython can't be that much harder than distributing the JVM

2:40 tomoj: distributing python is usually much easier, no?

2:40 leifw: baaaaaaaash

2:40 albino: tomoj: depends on the OS

2:40 defn: leifw: heh yeah

2:40 leifw: -_o

2:40 kind of a wide-eyed wink I guess

2:41 defn: search a file in clojure, or use grep?

2:42 _ato: grep

2:42 defn: :)

2:42 * leifw has a plane to catch tomorrow; good night

2:43 defn: night leifw

2:43 nteon: tomoj: what I was thinking was to have a long running daemon w/ an initialized JVM & clojure libs, to which you pass a filename and arguments, and have it fork(2) and exec(3). similar in concept to emacs and emacsclient

2:43 should get around most of the startup time, except for the first time

2:43 defn: nteon: and that's awesome, but when you distribute your code to others, it doesnt change the startup time

2:44 unless they do those steps too, which seems like an extra mess to get your script to download a comic book from the internet or something to startup quicker

2:44 _ato: nteon: http://martiansoftware.com/nailgun/

2:44 nteon: defn: not immediately, your right. If I can get it right over the next few weeks, I'll package it up for others

2:44 defn: nteon: that'd be nice

2:45 id like a sort of "throw this clj in this directory and it will be on your path and work like a regular uitlity"

2:45 utility

2:45 sort of a pre-packaged instant clojure utils environment

2:46 _ato: that's cool i guess i wasnt aware that's what nailgun did

2:48 nteon: defn: cool, didn't know about that. what I want to do is a little different; I want each 'client' to run in its own process, with its own instance of the JVM and copy-on-write memory

2:48 _ato: you can't fork the JVM though can you?

2:49 I guess you could try calling fork() via JNI or something and see what happens

2:49 actually

2:49 Raynes: _ato: You can stick a fork in your monitor with a graphical representation of a JVM process running.

2:49 _ato: no it won't work cause the garbage collector thread will be murdered

2:49 as fork only preserves the current thread

2:50 nteon: _ato: haven't looked into it too much yet :) I am planning to try it from the C side of things, looking at how the 'java' binary intializes thigns

2:50 defn: i read that as "java binary initializes thighs"

2:50 albino: you can't use ProcessBuilder to spawn another jvm process?

2:50 _ato: well you can, but then you don't have the benefit of reduced startup time

2:51 of course one option would be to have a pool of pre-initialized JVMs

2:51 but then as soon as you use up your pool its back to being slow again

2:51 nteon: _ato: I know its been done for Python, so I am naiively assuming it will be possible for Java

2:52 _ato: yeah, python has a native fork call though

2:52 its also not garbage collected and doesn't use threads by default

2:52 (well it is garbage collected, but its optional... its ref counted)

2:53 would be awesome if you can get it to work though

2:53 nteon: _ato: yup, well, I will keep you apprised :) I unfortunately can't look more into it until this weekend.

2:54 albino: you could use JNA to make the fork() call

2:54 why the jvm doesn't have this by default is sort of amazing to me

2:55 nteon: albino: thanks, I will keep that in mind.

2:55 heh yea

2:55 albino: I think it has to do with that "run everywhere" mentality

2:55 but it just seems broken to me on platforms where these syscalls have been around forever

2:55 nteon: albino: i think its only recently with clojure and some other languages that its actually useful for scripting-type things, where startup time maters

2:56 albino: nteon: well I was trying some of this in Java a few years ago

2:56 albino: nteon: but I'm weird, I actually expect programming languages to include reflection as part of them being useful

2:56 _ato: s/on/own/

2:56 nteon: heh

2:57 albino: everytime I run 'mvn clean' I feel like jvm startup time matters :)

2:58 nteon: albino: ugh, good point

2:58 albino: although, its hard to say if thats jvm time or mvn time :)

2:58 its not exactly a speed deamon

2:58 demon ...

2:58 albino: this one project I use it on, all it does is 'rm -rf' the 'target' directory

3:00 albino: I had heard that

3:00 _ato: also clojure doesn't start fast, due I guess to the compiler. a hello world java class loads considerably faster than a hello world clojure

3:01 % time java foo

3:01 java foo 0.04s user 0.01s system 49% cpu 0.100 total

3:01 that's just a hello world

3:02 % time java -cp ~/.swank-clojure/clojure-1.1.0-master-20091202.150145-1.jar clojure.main -e '(System/exit 0)'

3:02 java -cp ~/.swank-clojure/clojure-1.1.0-master-20091202.150145-1.jar -e 0.65s user 0.04s system 115% cpu 0.601 total

3:04 albino: my favorite java limitation is chdir(). IMO this is a process's basic right.

3:04 nteon: albino: no way. the static, arbitrary memory limits are my favorite. its like im back on class MacOS

3:05 I particularly love when maven crashes because I forget to set some environmental variable giving it more than the java default memory

3:06 albino: nteon: but most of the memory limits are configurable, where as chdir() is just not there

3:06 nteon: albino: okay :) I can agree that is quite bad as well.

3:30 LauJensen: Its quite impressive that everybody misunderstood my prefix/infix joke in my last blogpost - Humor in writing is a dangerous thing :)

3:30 vIkSiT: hi all

3:31 the programming clojure book has a line - (use '[clojure.contrib.str-utils .. )

3:31 I can't find the str-utils package in the clojure-contrib.jar though

3:31 is it deprecated since the book came out ?

3:32 LauJensen: vIkSiT: Its probably renamed to "string"

3:33 disregard 'probably', it is

3:34 vIkSiT: aha

3:34 let me check it out, thanks

3:36 LauJensen: np

3:37 vIkSiT: LauJensen, hmm weird

3:37 doesn't look like its working

3:38 I get a : repeat already refers to: #'clojure.core/repeat in namespace: user \n [Thrown class java.lang.IllegalStateException]

3:38 LauJensen: When evaluating what?

3:38 vIkSiT: on a simple (use 'clojure.contrib.string)

3:39 LauJensen: Weird, string seems to exclude that

3:40 vIkSiT: LauJensen, not sure what you mean. excluse the core/repeat?

3:40 LauJensen: vIkSiT: If you get the 1.1 snapshot, then all the str-utils code should work as it does in the book

3:40 vIkSiT: excuse*

3:41 LauJensen, sigh. I changed everything to 1.2.0 yesterday :)

3:41 LauJensen: vIkSiT: And that should also work, just as string instead of str-utils. But I'm not able to test that atm so I cant help you much with it

3:41 Raynes: LauJensen: Write a blog post about J.

3:42 LauJensen: Raynes: I already have 2 blogposts that are heavily J oriented

3:42 vIkSiT: sure. let me try that, although just replacing str-utils with string doesn't seem to help. apparently, re-split isn't public anymore

3:42 Raynes: Oh. Well, write a Go vs * comparison.

3:42 Entertain me, man.

3:43 LauJensen: Go? I mentally hibernate whenever I see Go code

3:44 Raynes: Go to your happy place.

3:44 :>

3:44 LauJensen: You mean the REPL ? :)

3:44 vIkSiT: turns out re-split has become split. hrm

3:44 Raynes: Hehe.

3:44 LauJensen: Okay, Reia. Learn Reia, and then blog about it vs *. Final offer.

3:44 LauJensen: REJECTED

3:45 Raynes: x_x

3:46 dcnstrct: is there a method in clojure to get a random element of a vector ? something like the methods first or second except it chooses a random element.

3:46 LauJensen: ,(nth (range 100) (rand-int 100))

3:47 dcnstrct: hrmm

3:47 _ato: <clojurebot> 57

3:47 LauJensen: hehe

3:47 thanks Alex

3:48 _ato: :-p

3:48 _mst: that's not the number I got...

3:48 LauJensen: haha

3:48 dcnstrct: (defn pick [s] (nth s (rand-int (count s))))

3:48 _mst: best out of three :P

3:48 dcnstrct: something like that maybe ?

3:48 _ato: _mst: might be a bug... I'm running an old version of clojure... :-P

3:48 LauJensen: exactly like that

3:49 dcnstrct: thnx ;)

3:49 I vote for adding that to the language proper

3:50 _mst: clojure.contrib.seq-utils has rand-elt that does that

3:50 Raynes: When clojurebot doesn't work, I usually have a bot up in #clojure-casual. $eval or$(whatever). Of course, it's much more limited than clojurebot at this point due to clj-sandbox being in it's infancy.

3:52 LauJensen: Clever.

3:52 LauJensen: Raynes: I'll only be impressed if you implement it in lua

3:52 and compile it with Go

3:52 Raynes: :o

3:52 LauJensen: That was awful off-topic, sure it shouldn't have been in #clojure-casual? ;)

3:53 LauJensen: Raynes: #clojure has always contained the casual talks in the absense of language discussions, so..no

3:54 albino: we're off-hours here anyway, I don't see rhickey or chouser or stuart

3:54 Raynes: Heh.

3:55 LauJensen: albino: Agreed - Its only when Raynes gets drunk and start telling camp-fire stories that we have to move into #casual

3:55 Although I'll admit, that happens frequently

3:55 Raynes: I don't get drunk. :>

3:56 LauJensen: Glad to hear it

4:00 Raynes: I'm totally straight edge. If I drank, I wouldn't be nearly as annoying as I am now, because I wouldn't be able to find my IRC window among my virtual desktops.

4:00 albino: he had to quit to give us that little nugget

4:00 though I like random.choice() from python better

4:01 _ato: pick doesn't imply its random though

4:03 And rand-elt below it.

4:06 _mst: I always think you have to be sober to get drunk...

4:08 kencausey: Should I expect to be able to use leiningen in cygwin? It chokes on trying to find clojure.main even though I have CLASSPATH working to the point that 'java clojure.main' gets me a repl.

4:09 LauJensen: kencausey: I heard of people using it under Windows

4:10 kencausey: I suspect it's a path issue, I'm using a window version of Java so I have to use a mix of unix and Windows style paths

4:10 Raynes: LauJensen: I herd u liek mudkipz. ; This is the extent of my off-topic chatter tonight. Sadly, I'm not immune to sleep deprivation, and I have to get up early. Farewell, my friend. <3

4:11 LauJensen: Raynes: Bye bye dear friend - Sleep tight :)

4:11 _ato: kencausey: have you tried: java -jar leiningen-1.1.0-standalone.jar

4:11 kencausey: where did leiningen install itself?

4:12 tomoj: ~/.m2

4:12 _ato: $HOME/.m2/repository/leiningen/leiningen/1.1.0/ 4:12 which on windows I guess is documents and settings/your_username 4:13 kencausey: actually, no, under cygwin it's in my cygwin home directory 4:15 nteon: okay, how can I tell if a static method on a java class is resolvable? 4:22 kencausey: _ato: Well, it works fine if I change into the same directory with it, but I can't sem to find a CLASSPATH or -cp that will make it work elsewhere, *sigh* 4:22 . is in my CLASSPATH 4:23 actually I know very little about java, I come more from a Lisp background 4:23 I used java only a little in the 90s 4:24 I'm not sure how CLASSPATH and -jar interact 4:24 For clojure I added the full path including the .jar file into CLASSPATH 4:24 nteon: kencausey: I've been told specifying -jar makes java ignore the -cp option 4:24 kencausey: ah, OK, well, that won't help ;) 4:25 nteon: kencausey: yes, I've been doing that. adding the jar to the classpath, and then just specifying the class you want 4:25 _ato: kencausey: java -cp leiningen-1.1.0-standalone.jar leiningen.core 4:25 kencausey: OK 4:25 nteon: java -cp libs/\*:my-jar.jar net.nteon.Example 4:26 yea 4:26 _ato: for the path.. you might need to use double backslashes, like c:\\foo\\bar\\baz 4:26 one to escape it in the shell 4:26 kencausey: of course 4:26 as I said, I've got clojure working ;) 4:26 _ato: ah right 4:26 nteon: _ato: if kencausey is using cygwin, I think he can use the nicer unix path separator 4:26 _ato: right, but java is not part of cygwin 4:27 kencausey: no I can't, because this Java thinks all the world is Windows 4:27 _ato: then again, I don't know much about java on windows 4:27 nteon: sigh 4:27 I wish I liked java 4:28 _ato: the JVM is really awesome, if only it weren't also severely crippled too ;-) 4:28 nteon: heh 4:37 LauJensen: _ato: crippl0red? 4:37 kencausey: _ato: I'm really puzzled, I've added C:\\cygwin\\home\\ken\\.m2\\yadayada to CLASSPATH much as I did for clojure, ant, etc. and I've done it both for bash and for windows environment variables, but unless I'm in the same directory with the jar I can't get it to work, whether in cygwin or command.com, in both cases it chokes with "java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V 4:37 (core.clj:1)" and after the backtrace "Could not find the main class: leiningen.core." 4:38 _ato: hmm 4:38 Chousuke: looks like conflicting versions 4:38 _ato: that restfn error usually means using an incompatible version of clojure 4:38 you're only putting lein's jar on the classpath right, nothing else? 4:38 (lein's jar contains clojure) 4:38 kencausey: aha 4:38 no 4:39 trying that now 4:39 I'm using clojure from git 4:40 java -cp$(cygpath -w ~/.m2/repository/leiningen/leiningen/1.1.0/leiningen-1.1.0-standalone.jar) leiningen.core

4:40 that does work

4:41 so, move the original lein shell script and write my own simple version?

4:42 _ato: yep

4:42 most of the lein shell script is performance hacks and the little niceties like self-install and upgrade

4:50 kencausey: _ato: OK, a simple one liner seems like it is going to work, only time will tell. I've moved the original but kept it handy for the fancy stuff

4:51 night

5:27 aiba: Is there a way to apply a java method, like (apply Integer/parseInt '("123"))? clojure doesn't seem to like that.

5:28 noidi: you have to wrap it in a function

5:28 ,(apply #(Integer/parseInt %) '("123"))

5:28 hmm, no bot

5:28 LauJensen: ,(map #(Integer. %) ["123" "345"])

5:29 aiba: thanks!

5:32 LauJensen: hiredman_: Where's your bot?

5:36 Guess they went out to dinner

5:40 talios: even bots need sleep and good

5:40 s/g/f/

5:59 * talios hits publish on a podcast episode and lets his breath out, one down - 3 to go till we're back to current again

6:00 Borkdude: Is there a clj-sandbox running somewhere behind a website, where I can just paste a quick clojure expression instead of here?

6:01 (where everybody can see my foolish attempts ;-))

6:02 cemerick: talios: they're appreciated :-)

6:03 talios: Borkdude: http://ideone.com - has clojure support. paste code, and it runs ( i believe )

6:03 cemerick: have you listened to any at all?

6:04 cemerick: talios: talking about Illegal Argument, right?

6:04 talios: yep

6:04 cemerick: Sure. Not sure when I subscribed, but it's been some months now.

6:05 talios: I think it's been some months since we published the last episode :) seems that way at least

6:05 cemerick: yeah. My own podcast attempt has gone fallow at this point. Not sure when I'd get back to that.

6:06 talios: we might just have to skype you in for some clojure lovechat :)

6:06 mikem: Borkdude: you can also start a query with clojurebot

6:06 talios: problem with that is all the international timezones

6:06 cemerick: talios: IA is good stuff though; far more entertaining and informational than the posse.

6:07 hah, that'd be fun

6:07 talios: mikem: clojurebot's gone out to lunch tho

6:07 cemerick: I often have calls in Asia, so it wouldn't be so hard :-)

6:07 mikem: talios: oic :) i should pay more attention

6:07 talios: its 11pm here now, whats the time where you are?

6:07 Borkdude: mikem, tnx, but I don't want to disturb you guys with my attempts ;)

6:08 cemerick: 6AM

6:08 Borkdude: talios: great website!

6:08 talios: 6am! freak :)

6:08 mikem: it's just past 6pm here

6:08 talios: Borkdude: ideone is wonderful. I'm surprised no one ever thought of marrying a code snippet/paste with a compiler

6:08 cemerick: yeah, I know :-) I've been doing the 5AM thing for about a year now.

6:09 talios: cemerick: that could he harsh tho - we generally record from 8pm-11pm on Thursdays, so unless you feel like getting up at 3am :)

6:09 Tho we did do a late (11pm our time ) skyper with Reiner and Rule once

6:09 which was fun

6:10 cemerick: talios: hey, whatever it takes to gain fame and international renown! ;-)

6:10 talios: outing yourself as a maven lover isn't enough? :)

6:11 Richard -reallllly- doesn't like maven, or sonatype.

6:11 cemerick: the 5AM thing falls apart when I need to talk to Asia, anyway.

6:12 eh, I was outed a long time ago, but felt like I had to make a little noise for various reasons

6:12 I feared maven like the plague for years, after a bad encounter circa 2005?

6:13 talios: that would have been maven1 timeframe wouldn't it?

6:13 maven1 was a nasty hack built ontop of ant

6:14 talios: good premise, just bad execution. Really loving Maven 3 tho so far

6:15 Borkdude: hur, I just saw your ideone tweet show up in my clojure search timeline ;-)

6:16 Borkdude: ah :)

6:17 I see from your bio you're doing podcasts, on what exactly?

6:18 talios: Borkdude: http://www.illegalargument.com/ <- java and jvm development, mixture of mobile foo, groovy, grails, clojure, scala

6:19 We also talk about pain with maven often it seens :)

6:19 Which, since we keep using maven - must mean we're sadists or something

6:21 Borkdude: ok great

6:23 I'll have a listen later, when I'm home

6:24 cemerick: talios: yeah, that was maven1. That's called a bad first impression. :-)

6:27 talios: When I first started at my current gig we had an inhouse buildtool written in groovy that wrapped ant called "sod". Sadly we spent more time in those first few months of the project adding required features to the build tool than the product itself :(

6:27 cemerick: ouch

6:28 talios: also left a bad taste in my mouth about groovy, altho it was really more the build tool, and ant integration than anything

6:29 cemerick: Not that I've given it much of a chance, but groovy rubs me the wrong way as well.

6:30 I suppose it might have been a big deal when it first appeared for those stuck in Java, but if I have my timeline right, I was in python ~2.3 at that point embedding java libs via jpype

6:32 talios: heh.

6:33 pre-java I was doing Delphi, and did some small patches/contribs to the Python For Delphi project, we had embedded python code inside paradox database records, executed from a delphi app :)

6:33 I wonder what a functional python might look like

6:36 cemerick: I did tinker with lython for a bit, but that project's long since disappeared last I checked.

6:36 but "functional python" is quite the oxymoron :-)

6:38 talios: well ok, clean syntax with the wacky space indent block syntax. get rid of objects, and its wacky (self, xxx) param which always irked me

6:39 cemerick: of course, clojure has adopted the [this & args] approach in places, too :-P

6:42 talios: I love the new named args too. I like the proprosed syntax someone posted to the list about using (defn foo {:name val :name val}) as well, where you just have a {} instead of the normal []

6:44 It's a pity I'm not using clojure beyond toy applications and experiments. Would be nice to use it at work.

6:47 wb

6:47 I love the new named args too. I like the proprosed syntax someone posted to the list about using (defn foo {:name val :name val}) as well, where you just have a {} instead of the normal []

6:47 It's a pity I'm not using clojure beyond toy applications and experiments. Would be nice to use it at work.

6:47 * talios repeats himself

6:50 * talios assumes cemerick isn't really here tho

6:52 * talios wonders if cemerick's really here this time?

6:52 cemerick: yeah, sorry about that. Should've killed the irc client before fiddling with the wifi :-(

6:52 talios: heh

6:53 I love the new named args too. I like the proprosed syntax someone posted to the list about using (defn foo {:name val :name val}) as well, where you just have a {} instead of the normal []

6:53 It's a pity I'm not using clojure beyond toy applications and experiments. Would be nice to use it at work.

6:53 is what I'd said :)

6:53 cemerick: ah :-)

6:53 I didn't see that (I can't keep up with the list these days). It's funny how destructuring has allowed Rich to back into kwargs, which he totally rejected in the beginning.

6:54 talios: he was? heh

6:55 well, coffee finnished and its 6 mins to midnight. time for bed I think.

6:55 SynrG: heh

6:55 cemerick: yeah. Before destructuring was around, people were asking for kwargs, but w/o destructuring, that would have required clojure fn invocation to have a mismatch with java method invocation

6:55 i.e. big perf hit

6:55 talios: right.

6:57 http://hg.genunix.org/onnv-gate.hg/rev/03c4bd206296 <- a monumental commit :(

6:59 gstratton: I'm seeing some really strange performance characteristics with a function I'm trying to optimise; I'm not sure whether the it's the JVM or Clojure being weird

7:00 talios: Right - its now Wednesday morning, night all.

7:00 cemerick: talios: see you this afternoon ;-)

7:01 talios: heh

7:01 gstratton: I have a function which searches a byte array for a subarray. If I start Clojure, create a 10 million byte array and test it, I get consistently around 110ms

7:01 If I then redefine the function, it takes around 200ms

7:04 cemerick: gstratton: Microbenchmarks are nearly useless. You're probably just bumping up against a new fn def that hasn't been JITed yet.

7:08 gstratton: cemerick: All I am doing is re-running the defn. I can run the function as many times as a like before I redefine it and get consistently around 110ms (except the second run, which is always around 85ms!), but after the redefinition I can run it as many times as I like and consistently get around 210ms.

7:08 I'm trying to optimise the function, so this is quite frustrating!

7:10 * triyo just went through "programming f#" book. Never have I seen that much Syntactic sugar in one programming language. Clojure, and lisp for that matter, is an absolute dream in this area.

7:11 cemerick: gstratton: I can sympathize, but redefining a fn carries a lot of consequences -- relevant here is that the resulting fn will not be JITed for some time. The conditions under which code is JITed vary significantly.

7:12 gstratton: are you starting java with -server?

7:12 gstratton: cemerick: no

7:13 cemerick: gstratton: that'd be the first thing to do. The "server" vm is far more aggressive about optimization.

7:16 gstratton: cemerick: With -server, I get around 145ms before I redefine and around 230ms after

7:17 cemerick: gstratton: OK. I'd again warn against microbenchmarking. Aside from that, if you paste the code, that might help.

7:25 LauJensen: gstratton: Did you catch my post from last night? I go through quite a bit of optimization - despite cemericks warning

7:26 gstratton: cemerick: The code is at http://paste.lisp.org/display/97065 With my test array the first function is never called, so I'm just optimising the second

7:26 LauJensen: Yes, it was your post that got me looking at this again

7:27 I have just added some extra type stuff courtesy of your post. Now it's 90ms before redefinition and 215ms afterwards!

7:27 LauJensen: gstratton: type hinting is different from primitives - I suggest you adopt cgrands deep-aget and deep-aset instead

7:30 carkh: hello all

7:30 yay ... this nickserv thing is annoying =/

7:31 Borkdude: Dudes, I have a little idea for Twitter, to teach newcomers to Clojure a little thing each day

7:31 http://twitter.com/ceotd ;; Clojure Example of the Day

7:31 if you want to provide me with some ideas please send them to me

7:31 carkh: anyways, i'm (finally) giving a test run to defprotocol and reify, and it looks like there is an issue with rest parameters on protocols

7:32 is this to be expected ?

7:32 LauJensen: Borkdude: Only complaint is people should be doing (map count args) and not (map #(.length %) args)

7:32 And then there's the whole char-limit thing. Twitter is designed to be superficial, so teaching wouldn't come natural ?

7:34 Borkdude: well it's not really teaching, but more like getting people familiar with clojure a little

7:34 gstratton: LauJensen: To be honest I'm not too worried about 10% performance, but I am worried about the fact that something which I thought should have no effect changes the runtime by a factor of 2.5

7:35 cemerick: gstratton: why do you think that redefining a function should have no effect?

7:36 If everything were simply interpreted, then I'd agree with you.

7:36 LauJensen: gstratton: I meant it would cut it down to 10%, ie save you 90% of the runtime

7:38 cemerick: gstratton: to be clear, there are JVM options that will force optimization of all methods, and/or tweak the optimizer so that it does its work more eagerly. I'm just saying, don't ignore the man behind the curtain that makes stuff go fast. :-)

7:39 carkh: here is a very simple example for my protocol/reify problem : http://gist.github.com/349024

7:39 gstratton: LauJensen: Oh, sorry! If that works then it'll be faster than the Java version :)

7:41 Borkdude: LauJensen, why is count better? It's considered more idiomatic? I'm new to Clojure as well, so great to have some feedback

7:41 LauJensen: Borkdude: Yes, idiomatic clojure functions are more idiomatic than java methods in my oppinion - You're demonstrating interop where a Clojure fn does the same, its redundant

7:42 Borkdude: Ah, so tomorrow's tweet could be: ;; More idiomatic version of yesterday's example: (map count ["foo" "bar"])

7:42 tnx :)

7:42 LauJensen: np

7:44 duncan_bayne: Hi all, I'm trying to build clojure-contrib according to instructions at http://riddell.us/ClojureOnUbuntu.html but I'm seeing a test failure: Testing clojure.contrib.test-jmx

7:44 Uncaught exception, not in assertion.

7:44 expected: nil

7:44 actual: java.lang.RuntimeException: javax.management.RuntimeMBeanException: java.lang.NullPointerException

7:45 cemerick: ugh, the jmx tests are acting up again, it looks like

7:46 duncan_bayne: yup, it's failing on build.clojure.org, too :-(

7:46 duncan_bayne: looks like d1e831b8a8a3d8e08b0f3aa9650b3d43954cb707 is the last commit that succeeded

7:47 LauJensen: Wow, its been down for 7 days now

7:48 cemerick: I think its more likely that this is the culprit 6cfd3b286680fd59021382fdc516be6be82a8834

7:48 carkh: i had this when building it yesterday : FAIL in (test-as-url) (run-test7773307746706794632.clj:40)

7:49 duncan_bayne: cemerick: Thanks, thought it might have been something I was doing. Is there any way of getting the last-known-good version of clojure-contrib from Git? I'm keen to give Clojure a whirl ...

7:50 carkh: get it from build.clojure.org maybe ?

7:50 cemerick: duncan_bayne: yeah, just back up a few commits. Refer to http://github.com/richhickey/clojure-contrib/commits/master or use your favorite git tools. I'd go back to 0a1bfc9 to start, get before the most recent jmx stuff.

7:51 duncan_bayne: or better, what carkh said :-)

7:52 _ato: duncan_bayne: in case you're not familiar with git: git checkout 0a1bfc9b4a1d5e20365d1905806eaf61e13c6db1

7:52 duncan_bayne: Sweet, thanks :-)

7:59 carkh: still noone to have a look at my rest parameter problem on protocols/reify ? http://gist.github.com/349024

8:00 duncan_bayne: _ato: building with 'mvn package' from that checkout worked nicely. Thanks for the git tip; I still think like a Subversion user :-)

8:06 Chousuke: carkh: does reify even support rest arguments? :/

8:07 carkh: looks like it doesn't ... maybe it's planed for the future ?

8:07 carkh: i tried doing it the java way, since there's an interface behind the scene

8:08 but that doesn't work either ='(

8:08 bsteuber: so in java interfaces support ... arguments?

8:08 carkh: there can be a last array argument

8:09 Chousuke: bsteuber: the ... thing is just a shorthand for an array argument AFAIK

8:09 bsteuber: chousuke: so Java does the real work on the caller side?

8:10 Chousuke: I don't know what it does :P

8:10 probably transforms a call to a variadic method to something that constructs an array and then passes that to the method

8:10 bsteuber: i see

8:13 Borkdude: "Quick, let me switch to #clojure to make it look like I'm working" - Huh? "At least it looks more like work than Twitter"...

8:17 noidi: Borkdude, especially if you use this theme for irssi http://irssi.org/themefiles/c0ders.png

8:18 Borkdude: noidi, hehe

8:33 zmila: kill-my-eyes theme

8:58 powr-toc: I hear the latest swank-clojure has breakpoint support! Does it still work with techomancy's SLIME master branch?

9:03 dnolen: powr-toc: yeah it works with technomancy's SLIME in ELPA. but from what I understand, things are close to working again with SLIME master as well.

9:13 powr-toc: dnolen: cool... I've just tried setting a (swank.core/break) in some code, and it throws a stack trace :-\ any ideas what I'm doing wrong?

9:14 dnolen: it's supposed to do that. then you can press enter on frame 0 and the locals

9:14 you can also press 'c' to continue to the next breakpoint, previous might work as well, haven't gotten too deep into it.

9:15 and the locals -> and see the locals

9:15 powr-toc: ahh yeah... just realised that!

9:17 hmm... I get [No Locals] when I think there should be some

9:22 dnolen: powr-toc: you only see locals on the first frame

9:23 powr-toc: dnolen: Yeah, but it doesn't seem to display any either

9:24 dnolen: powr-toc: are you using clojure 1.2.0-master-SNAPSHOT ?

9:29 powr-toc: dnolen: ahh that'll be it

9:29 I'm using 1.1.0

9:30 time for an update me thinks...

9:30 dnolen: powr-toc: yeah, the break stuff uses the new env things in 1.2.0. with lein it's easy to use 1.2.0 for a specific project without messing your setup.

9:31 just add clojure and clojure-contrib 1.2.0-master-SNAPSHOT as deps then run lein swank.

9:32 powr-toc: yeah, was just about to do that

9:32 but thanks for letting me know it wont kill anything else! :-)

9:32 I'm really quite liking lein... not perfect, but pretty good...

9:34 though after the recent maven discussions on the clojure list I'm curious to see what polyglot maven's like

9:39 cemerick: powr-toc: people have been pinging me looking for a demo of polyglot; I may do that sometime soon

9:42 Ankou: hi, is there a function to logically combine 2 functions? something like (and (f1 x) (f2 x)) => (fand f1 f2 x)?

9:43 Borkdude: what is the standard java terminology for anonymous classes, just that, or 'anonymous inner class'?

9:43 LauJensen: cemerick: Has anyone fixed this 7-day breakage yet ?

9:44 cemerick: LauJensen: doesn't look like it

9:44 LauJensen: cemerick: Did you work out which commit blew it ?

9:45 cemerick: LauJensen: I think you had it right, although it's odd that a later commit is shown as successful.

9:45 LauJensen: you'd have to bother chouser or stuartsierra about it, I'm just a civilian. :-)

9:46 LauJensen: stuartsierra: Ping

9:46 chouser: Pong

9:46 cemerick: or perhaps laity is better ;-)

9:46 noidi: Ankou, comp

9:46 esj: cemerick: laity is funny

9:47 cemerick: esj: I try, sometimes too hard. :-)

9:47 noidi: Ankou, sorry, misunderstood you at first

9:47 stuartsierra: LauJensen: pong

9:47 LauJensen: stuartsierra: Contrib has been broken for 7 days now - Are you the guy who's about to fix it ?

9:47 chouser: ~stuartsierra?

9:48 LauJensen: I have a hunch that Halloways commit broke it

9:48 stuartsierra: I'll take a look.

9:48 LauJensen: 6cfd3b286680fd59021382fdc516be6be82a8834

9:48 chouser: bah, no clojurebot

9:48 LauJensen: Thats my best bet

9:48 chouser: stuartsierra: let me know if you need to tag-team

9:49 stuartsierra: It's the c.c.jmx lib still.

9:50 It's been failing tests for a while.

9:50 What changed is that I updated the Maven plugin; so now the failing tests actually stop the build.

9:51 hugod: dnolen: I couldn't repro your issue with the exception-location branch, though I added a fix for navigating to top level namespaces

9:51 dnolen: if you could message me the details, I'll investigate further

9:51 dnolen: hugod: yeah I saw that you committed something. but it did not fix it for me. do you think this is because of SLIME ELPA?

9:51 stuartsierra: I can't reproduce the error shown here http://build.clojure.org/job/clojure-contrib/44/console

9:52 hugod: dnolen: I suspect it's not related to the branch - did you try on the release version?

9:52 stuartsierra: Same error persists here http://build.clojure.org/job/clojure-contrib/46/console

9:53 dnolen: hugod: no should I? the one clojars you mean right?

10:06 LauJensen: stuartsierra: will you drop a comment here once its fixed?

10:07 stuartsierra: sure

10:07 LauJensen: Great, thanks

10:07 stuartsierra: I emailed Halloway about it to see if he has any ideas.

10:09 cemerick: It seems just a bit odd that jmx stuff is in contrib at all, but that's probably just me.

10:09 LauJensen: If jmx has been failing tests for some time now, how about moving it out of the testing to get a working build, and then fixing it behind the scenes

10:10 stuartsierra: ok

10:18 OK, contrib is alive again http://build.clojure.org/job/clojure-contrib/47/

10:26 LauJensen: Great, thanks stuartsierra

10:26 stuartsierra: you're welcome

10:26 npoektop: hi! what is clojure-contrib-slim.jar for?

10:30 esj: female, French, clojurians.

10:30 LauJensen: npoektop: I think its just the classes and no source

10:31 pdk: contrib-slim is just to take less space when you want to bundle it with an applet

10:32 npoektop: ok, thank you

11:27 drewr: npoektop: actually, clojure-slim is the uncompiled clojure source and the compiled java classes

11:28 smaller jar, hence slim

11:37 cemerick: The fact that AOT compilation compiles all transitive namespace dependencies of the namespaces to be compiled is becoming an actual problem. Some libs include support for optional libraries that I'd rather not have around at all, but need to be available for AOT to succeed.

11:40 chouser: cemerick: where would it be best to control that property? a literal flag in ns :require?

11:40 default to AOTing only the libs named specifically in (compile ...)?

11:41 cemerick: I'm not sure. I think it's probably wise to keep control of AOT in compile, rather than pushing it down into ns declarations. Those are generally not under your control if you're having problems.

11:42 It's totally reasonable to have the current behaviour be the default. I think. :-)

11:42 chouser: so maybe compile should take an option list of libs *not* to compile?

11:42 cemerick: No, nevermind, you really should have to specify all the namespaces you want to have compiled.

11:43 or, a pattern, anyway. #"com\.mycompany\..*", etc

11:43 chouser: hm. (compile foo.bar :filter #"clojure\.contrib\..*") ?

11:44 cemerick: chouser: a blacklist would be irritating when dependencies change, along with namespace names.

11:44 chouser: right. filter is a whitelist

11:44 oh

11:44 so my example was bad

11:45 (compile foo.bar.baz :filter #"^foo\.bar\.")

11:45 regex seems a poor fit.

11:45 cemerick: Right, that's better.

11:46 clojure-maven-plugin just happens to use them for namespace exclusion/lists, so that's what came to mind first.

11:46 chouser: (compile foo.bar.baz :only [foo.bar.* clojure.contrib.*])

11:46 meh

11:46 cemerick: I think it's totally reasonable for compile to just take a list of namespaces, and leave the mechanics of building that list to people's build tools.

11:47 With some provision to get back to compile-the-world-starting-here sort of behaviour.

11:47 chouser: (compile-only foo.bar1 foo.bar2)

11:47 cemerick: Sure, that would do.

11:48 chouser: of course that probably demands all sorts of tools support the new fn. maven plugin, lein, IDEs...

11:49 cemerick: well, some significant change will affect them one way or the other. The current behaviour really is a little nuts, at least anywhere where you're not just shipping an uberjar

11:50 (which is pretty impolite these days, anyway)

11:50 (in many scenarios)

11:50 * cemerick is trying to not get into trouble at the moment ;-)

11:53 chouser: it should be possible to write 'compile-all' without patching clojure

11:53 er, compile-only

11:56 cemerick: chouser: How? Doesn't it trigger of reload of each lib's dependencies?

11:56 Hrm, no, it doesn't.

11:57 chouser: hm, direct linking (is that what it's called) may prevent a patchless solution.

11:58 I was thinking of binding load-file (or whatever is needed) to get a chance to change *compile-files*

12:00 cemerick: That may work as an implementation strategy, but I don't think that eliminates the need for API changes. Build tools all run through clojure.lang.Compile.

12:01 chouser: I'm just talking about providing a compile-only fn -- tooling is above my paygrade.

12:01 I suppose clojure.lang.Compile could have a method that calls compile-only

12:01 * cemerick scoffs

12:02 chouser: but I need to tweak clojure.core/load and I bet direct linking will make me patch it instead of binding it. :-/

12:02 cemerick: well, it only has one method (main). It could certainly grow an option or two.

12:13 npoektop: hi! i'm trying to setup emacs with slime for clojure. Can't do (require 'swank-clojure-autoload) -- there is no such file.

12:15 chouser: cemerick: so one detail is that 'require'd libs still need to be loaded, they just wouldn't be compiled unless in the list.

12:15 npoektop: the only file i can find is swank-clojure.el

12:16 cemerick: chouser: Sure, that's unavoidable I presume.

12:16 chouser: cemerick: and that means if its required by something earlier in the list, but appears later in the list, it still needs to be compiled that first time.

12:17 hugod: dnolen: the problem is that the clojure compiler exception is saying line 0 - not much I can do at the swank level...

12:17 chouser: so it'd be nice to avoid re-compiling it that second time. though I guess that could be an optimization later.

12:17 dnolen: hugod: I suspected that.

12:17 cemerick: chouser: I can't imagine that being a problem. The only thing that matters is what's in *compile-path* when compile returns.

12:18 dnolen: hugod: is there a Clojure bug report for that?

12:18 hugod: dnolen: no idea

12:20 drewr: npoektop: how did you go about installing swank-clojure?

12:20 you'll need the entire source distribution somewhere

12:20 lpetit: chouser: (defn compile-only [lib ns-filter-pred]) ?

12:20 dnolen: hugod: well then other than that the exception branch seems to work :)

12:22 npoektop: drewr, i did git clone ..., moved it to ~/.elisp, wrote (require 'swank-clojure-autoload), and it did not work

12:22 hugod: dnolen: thanks! I'll try and merge it later

12:22 cemerick: lpetit: the question is, when would ns-filter-pred ever allow anything other than the explicit set of namespaces one might have in a given project?

12:23 dnolen: npoektop: save yourself a lot of time use setup your Clojure Emacs environment via ELPA

12:23 drewr: npoektop: I think swank-clojure-autoload was removed a while back

12:24 npoektop: dnolen, what if i want to use slime with other lisps?

12:24 dnolen: npoektop: http://tromey.com/elpa/install.html, the only thing you need to actually install from ELPA is swank-clojure it will grab and configure everything else you need.

12:25 npoektop: yeah, a manual approach will probably be more frutiful, tho I've been able to tweak my ELPA setup to handle other lisps.

12:25 drewr: npoektop: you'll need to frob slime-lisp-implementations in that case

12:25 lpetit: cemerick: maybe you're right. But why close the door to the unknown when a general solution is not that bad ? Or maybe a (compile-only* ) witht the predicate, and a (compile-only) with the sugar for the common case ?

12:26 the sugar could even be a macro to avoid having to quote the symbols

12:27 cemerick: lpetit: huh, I figured explicitly naming the libs to be compiled *was* the general solution (since whatever is invoking compile can build that list however it wants)

12:28 lpetit: cemerick: why not, but the list can be quite long. a predicate fn is maybe not what people may want in general, but is certainly more generic

12:29 but I'm just musing here, I'll let you do the right choice. Must leave to house. cu

12:29 cemerick: lpetit: heh, not up to me, talk to chouser :-)

12:40 chouser: yeah, I like a predicate for the unsugared version

12:42 cgrand: (compile-only* 'my.lib '#{other.lib.i.want.to.compile})

12:42 chouser: right

12:43 I mean, good point. :-)

12:50 npoektop: people, share you .emacs for slime+clojure, please

12:50 chouser: npoektop: I don't use emacs or slime. sorry.

12:51 lithpr: npoektop: have you considered the emacs starter kit

12:52 npoektop: no, i have my own emacs setup, and i want to setup slime+clojure manually

12:54 lithpr: yeah, i looked at my cusomizations, and it looks like the ESK took care of that for me :)P

12:55 drewr: npoektop: http://gist.github.com/349294

12:55 use at your own risk :-)

12:56 I'm not currently using any other lisp implementation, but you can edit slime-lisp-implementations as you need

12:57 npoektop: drewr, thank you!

13:01 drewr: done

13:02 stuartsierra: Halloway and I fixed the JMX bug in contrib, builds ok now.

13:03 npoektop: drewr, thank you again!

13:06 LauJensen: stuartsierra: great job

13:07 stuartsierra: Thank halloway, he fixed it. I just nagged. :)

13:08 LauJensen: I was happy about the bit that there was a quick temp fix, and no lack of follow-up to get the real issue fixed

13:08 However - I think it would be in place to set up some kind of alert system so that a build isn't lying in pieces for 7 days

13:21 cemerick: Not sure about that. No one really complained about it for 7 days. :-)

13:22 LauJensen: In my oppinion thats the weakest possible argument for accepting such a failure

13:22 drewr: ,(conj '(1 2 3) 4)

13:22 clojurebot: (4 1 2 3)

13:22 drewr: ,(conj [1 2 3] 4)

13:22 clojurebot: [1 2 3 4]

13:22 drewr: I've never noticed that before

13:22 cemerick: LauJensen: well OK. But Hudson *is* the alert system, fundamentally.

13:23 yup, conj is polymorphic

13:23 LauJensen: ,(reduce conj '() [1 2 3 4 5])

13:23 clojurebot: (5 4 3 2 1)

13:23 LauJensen: drewr: noticed that? :)

13:23 chouser: it's hard to make people not ignore stuff they want to ignore. At least not without other social consequences.

13:23 drewr: why does one want conj to behave like cons for lists?

13:23 LauJensen: chouser: I didn't get the impression that this was caused by anyone with bad intentions?

13:24 cemerick: drewr: conj is a polymorphic cons.

13:24 chouser: LauJensen: I was referring to people ignoring the build failure alert in hudson.

13:25 LauJensen: chouser: Yea, am I'm just asking the question, did they know it was there?

13:25 drewr: I get that it's polymorphic; I'm confused as to why you want to build lists the other direction as you do with vectors

13:25 chouser: you can subscibed to an RSS feed of failures, so it's easy to know. but if people are ignoring that, well, what are you going to do?

13:25 drewr: that the only direction you can build lists efficiently.

13:25 cemerick: drewr: because that's the only way one can add to a list efficiently.

13:25 * chouser high-fives cemerick

13:25 LauJensen: drewr: No other way to build lists efficiently

13:25 cemerick: chouser: oh, here we go again! :-P

13:26 damn, almost down to the word, even

13:26 LauJensen: chouser: Cant we just assign the main responsibility to you, and then you'll handle it?

13:26 drewr: I'm sensing here it has something to do with efficiency

13:26 ;-)

13:26 chouser: LauJensen: no thanks

13:26 cemerick: conj adds an item to a collection, in whatever way makes sense for that collection.

13:26 drewr: I get it, so you don't have to traverse the entire list to append to the tail

13:26 cemerick: ,(conj {} [:a 5])

13:26 clojurebot: {:a 5}

13:26 LauJensen: chouser: I would ask cemerick but he's busy sorting out his XML

13:28 cemerick: LauJensen: Not really, it sorta just works, and is busy deploying apps to three different app servers at the moment. ;-)

13:28 * cemerick is trying to match snark-for-snark, but he knows he'll always lose at that game

13:28 LauJensen: hehe

13:28 :)

13:28 cemerick: I'll watch your screencast and see if you dont end up making a good case for it

13:28 * joshua-choi thinks that lists and cons-cells are already basically the same, so we should go all the way and make (list? (cons a b)) true

13:29 joshua-choi: We being Hickey, the dictator, of course

13:29 Beket: Hey people! I'd like a cool starting project to learn clojure. Something non-trivial + interesting. Any suggestions ? :D

13:29 drewr: joshua-choi: that's where I was headed; I assumed PersistentList was very different from Cons

13:30 chouser: PersistentList is only different in that it promises the rest part is also a PersistentList, and also it knows its own length

13:31 joshua-choi: Yeah, I guess countability is a big difference. (Though that PersistentList promises that its rest is another list is moot if Cons become also lists.)

13:31 cemerick: are people still using lists?

13:31 I mean, explicitly?

13:31 joshua-choi: Hmm, yeah, countability throws a wrench in that idea, then...

13:31 I do.

13:31 lithpr: Beket: i'm reluctant to respond. Do you really want suggestions?

13:32 cemerick: joshua-choi: why?

13:32 chouser: well, you're asking for a polymorphic 'cons'. Which ... doesn't sound particularly bad I guess.

13:32 joshua-choi: cemerick: In a Clojure-in-Clojure parser. :P

13:32 drewr: cemerick: I apparently haven't yet after 2.5 yrs :-)

13:32 LauJensen: Beket: Go check out my blog, there should be something worth trying out: http://www.bestinclass.dk

13:32 Beket: lithpr, please don't respond, if that makes you feel bad :)

13:32 cemerick: joshua-choi: oh, OK, nevermind. Have fun :-D

13:32 lithpr: k

13:32 Beket: Thanks for the pointer LauJensen

13:32 cemerick: drewr: that's where I was going... :-)

13:32 joshua-choi: cemerick: Also, we use them all the time in macros. Though list* secretly returns a Cons.

13:32 drewr: I just haven't read as much of the source as I should have by now

13:32 * joshua-choi thinks that list* should totally be renamed

13:33 joshua-choi: ,(list? (list* 5 2 [1 2]))

13:33 clojurebot: false

13:33 cgrand: on lists vs seqs: in my experience treating lists as seqs hurts performance (pop/peek/conj vs next|rest/first/cons)

13:33 joshua-choi: Its docs are misleading too

13:34 cemerick: cgrand: I always produce vectors, and consume seqs, unless otherwise required. That eliminates any issues AFAICT.

13:34 * joshua-choi apologizes for using "totally" in a stylistically poor fashion

13:34 cemerick: This is all app-level talk, of course.

13:36 joshua-choi: In certain cases with monads, I get right-grouping, so I use lists and cons's instead of vectors.

13:46 norton: hello

13:47 chouser: norton: hi

13:47 norton: I was wondering if anyone could help me understand an error I am seeing when trying to use conjure-contrib.sql

13:48 (ns database-manager (require [clojure.contrib.sql :as sql]))

13:48 (require 'database-manager)

13:48 chouser: that should be ":require" instead of "require", but that's probably not causing your error.

13:49 sorry, "(ns database-manager (:require" Your second one is correct.

13:50 rhickey: so, any more input on the names for deftype variants?

13:50 norton: so the first one (ns ... ) is written in a file: database_manager.clj

13:50 chouser: rhickey: When you're not here, we just talk about our favorite build tools. So no.

13:50 norton: the second one is entered into a repl fired up using "lein repl"

13:51 rhickey: chouser: I see

13:51 I thought you talked about editors :)

13:51 chouser: norton: that's not an error I've seen much. do you have matching clean builds of clojure and contrib?

13:52 norton: This is whatever is in clojars

13:52 rhickey: I was wondering if the distinction I made between program constructs and domain data constructs holds

13:52 norton: btw, I have some unit tests on the database_manager ns that execute fine

13:53 its just when I try and require it into the repl I get the problem

13:53 so I would think its a classpath issue, execpt it doesn't seem to be

13:53 * drewr combs irc logs

13:53 chouser: drewr: http://clojure-log.n01se.net/date/2010-03-25.html (just looked it up myself)

13:54 drewr: thanks

13:56 Licenser: (map greet (who #clojure))

13:56 chouser: rhickey: yeah, I think the conceptual distinction is sound. "program construct" doesn't automatically suggest to me what I think you mean though.

13:57 rhickey: deftype + deftmap ?

13:58 chouser: where deftype is raw and deftmap is mappy. meh.

13:59 rhickey: ideally the names would suggest the distinction, those don't

13:59 drewr: deftypem

13:59 rhickey: deftype + defrecord/defentity

14:00 chouser: their behavior around non-closure methods, fields, and performance will be similar, right? having somewhat related names might be useful.

14:00 rhickey: chouser: yes, very similar and could be variant of same base, but then they get longer

14:00 chouser: defrawtype + defmaptype

14:00 rhickey: deftype defmaptype

14:01 drewr: eww

14:01 chouser: defrawtype deftype

14:01 "raw" isn't quite right

14:02 drewr: I think I still like deftype/deftypem -- implies the latter is an extension of the former, and doesn't tie too much logic into the name (which usually backfires)

14:02 LauJensen: what does 'defmaptype' cover exactly ?

14:02 drewr: plus, I like brevity

14:02 chouser: LauJensen: like (deftype ... clojure.lang.IPersistentMap) is now

14:02 rhickey: LauJensen: deftype w/full map implementation

14:03 drewr: of course, I'm the guy that actually likes car/cdr

14:03 rhickey: data + datamap

14:03 LauJensen: ah, so their uses are totally different?

14:03 chouser: drewr: and yet doesn't know which end lists grow on. ;-)

14:04 drewr: haha

14:04 rhickey: datatype datamap

14:05 LauJensen: rhickey: would deftype and defmap be totally wrong? :)

14:05 chouser: I actually like data. deftype already needs a different word in prose, "datatype". So we'd just need something similar for 'data'

14:05 LauJensen: yea datatype and datamap aren't bad

14:06 arohner: I like datamap

14:06 rhickey: chouser: I'm not sure which name means which in your sentence

14:06 chouser: I like having something to indicate type in both, because that's what's being defined: a named type. not an instace, an example, a map, or anything else.

14:06 drewr: chouser++

14:06 rhickey: datatype maptype

14:07 chouser: yes!

14:07 joshua-choi: Are these ideas for Clojure 1.2?

14:07 Licenser: chouser++ ?is that chouser with objects?

14:07 chouser: Licenser: perhaps. and my mutable state is indeed uncoordinated.

14:08 joshua-choi: yes

14:08 rhickey: so, what about not having def prefix?

14:09 chouser: rhickey: that would feel weird, at least at first.

14:09 LauJensen: rhickey: I'd prefer prefixing both of those suggestions with def

14:10 drewr: if map is going to be in the name, then I like deftype/defmap

14:10 the "def" prefixing "map" implies that it's some kind of blessed map

14:11 LauJensen: To me it just seems natural to keep all of this conventional, defmaptye, defn, defmacro, etc

14:12 drewr: LauJensen: why is defmaptype conventional?

14:12 rhickey: def* for me is fundamentally about some shortcut for (def blah ...), that is not the case for these

14:13 LauJensen: rhickey: I know thats the case, but I don't think most users perceive it like that. I could be wrong though

14:13 rhickey: I'd also change current definterface to interface

14:14 interface X, datatype X, maptype X

14:14 chouser: hm

14:14 dnolen: rhickey: ++

14:14 i mean, inc

14:14 drewr: I don't like it, but you have a larger picture in your head than I do

14:15 dnolen: a different convention because they are all "lower level constructs" in my mind, not the thing you should normally be reaching for.

14:16 drewr: I have a need for typed maps quite frequently

14:16 chouser: I guess all existing def* are about Vars, aren't they.

14:16 rhickey: protocol X

14:17 chouser: yes

14:17 and though datatype/maptype do create vars, not their primary purpose

14:17 interface not at all

14:18 chouser: for me what's uncomforatable is that they look like some kind of side-effect-free conversion function or something.

14:18 rhickey: (datatype Foo [a b c] ...)

14:18 chouser: like (maptype Foo [a b]) is coercing the vector and returning something...

14:19 drewr: yes

14:19 fogus: chouser: What if the first letter was capitalized?

14:19 rhickey: fogus: Datatype and Maptype?

14:20 chouser: those look like class names to me, not verbs

14:20 fogus: rhickey: right Interface X also

14:20 drewr: it does imply construction of some kind, but you feel like you need to def it to a var

14:20 rhickey: chouser: agreed

14:21 chouser: is there a new prefix we can use for these? we're not defining vars, but we're certainly definining something.

14:21 rhickey: def* does have the "this probably belongs at toplevel" feel

14:21 dnolen: chouser: I always thought ns looked kinda weird as well. is datatype, maptype, et. al. so different?

14:21 fogus: chouser: Moreso than the lowercase version?

14:21 drewr: rhickey: yes

14:21 fogus: I suppose caps hold too much baggage

14:22 rhickey: fogus: if we are going to adopt uppercase at all, I'd like it to be for type names

14:22 fogus: got it

14:22 rhickey: chouser: new and shorter prefix welcome :)

14:23 chouser: so if we're not "def"ining, and certainly not "declare"ing, what are we doing? installing, instilling, embedding...

14:23 fogus: newtype newinterface ... again new has too much baggage

14:24 dnolen: chouser: ns creates a namespace object and returns a nil. we don't do def-ns

14:24 chouser: specifying. specmaptype

14:24 rhickey: dnolen: because it would be defns

14:24 chouser: dnolen: perhaps not. I'm sure we'd get used to it.

14:24 dnolen: rhickey: heh, yeah, not good.

14:25 drewr: I'm stuck on deftypem or defm

14:25 rhickey: drewr: those seem awkward

14:25 LauJensen: chouser: its a shame we need a prefix, mapspec, typespec, sounds nice

14:26 not sure if that idiom applies here though

14:26 rhickey: drewr: people normally shouldn't be using the * versions of things

14:26 drewr: ok

14:27 though as a user, I'm really only interested in creating typed maps

14:27 astoddard: What about a sigil prefix or suffix, such as +datatype or >datatype?

14:27 LauJensen: ouch

14:27 rhickey: astoddard: duck!

14:27 ndimiduk: forgive my ignorance, but isn't this was namespaces are for?

14:27 drewr: seems like if I'm creating a type with only hash/= I'm in java-land

14:28 fogus: then we could add twigils! :p

14:28 rhickey: drewr: unless you are writing collection or reference types...

14:28 LauJensen: rhickey: Do they need to be associates in any way? Or would deftype and datamap work ?

14:28 chouser: delinitiate. delmaptype :-)

14:28 rhickey: delete

14:28 chouser: right

14:28 fogus: Has anyone proposed any literal representations?

14:29 rhickey: LauJensen: without a connection we will need duplicate docs, where one is clearly like the other plus a bit

14:29 chouser: fogus: for instances of these things? That's a whole other rabbit-trail.

14:29 LauJensen: True

14:29 fogus: chouser: right... was curious if anyone has taken that trail yet.

14:29 rhickey: fogus: printing is easy, reading requires the supporting defs be loaded first

14:30 drewr: "delinitiate" that took a moment to parse

14:30 LauJensen: I'm ducking out, but deftype and defdatamap would be my best bet

14:30 chouser: drewr: gah, sorry for the typo. "delineate"

14:30 drewr: ah! that's how I read it :-)

14:30 chouser: but useless because we all know "del" means "delete"

14:30 fix

14:31 fogus: freshtype freshmap freshinterface yuck

14:31 chouser: resolve, appoint, establish, dictate

14:31 rhickey: defdatatype and defdatamap start to become sentence-in-a-word

14:31 chouser: rhickey: is that good or bad?

14:32 given we don't have the def- convention

14:32 def-datatype and def-datamap are better

14:32 chouser: oh, I see. yes.

14:32 joshua-choi: There is clojure.template/def-template, I recall.

14:33 chouser: I guess if you're sure we won't want 'datatype' or 'protocol' for some non-top-level thing later, it's just a matter of getting used to it.

14:33 rhickey: def-maptype

14:34 drewr: I'd just assume have defmaptype

14:34 joshua-choi: fogus: ! It was def-template when I last saw it

14:34 rhickey: switching to def- will just leave people wondering when to use which

14:34 joshua-choi: Ah!

14:34 I was confused with do-template

14:36 fogus: My favorite for the defmaptype thing is still deftemplate, but I seem to be the only person

14:36 joshua-choi: What *is* defmaptype? This seems to be a very new development

14:37 rhickey: fogus: in support of defmaptype?

14:37 drewr: fogus: that makes me think of something metasyntactic, not a datastructure

14:37 dnolen: joshua-choi: creating a datatype that acts like a map is a big pain. so rhickey making it easier for us by providing some that's easy for us to extend that already has that functionality.

14:38 joshua-choi: dnolen: As a shortcut for (deftype Type [...] clojure.lang.IPersistentMap ...)?

14:38 drewr: joshua-choi: yes, but also to have a more generic deftype behind it I think

14:39 fogus: dnolen: Not using the IPersistentMap magic is the hard part correct?

14:39 rhickey: In place of defmaptype

14:39 joshua-choi: drewr: Could you elaborate on "more generic deftype"?

14:40 rhickey: fogus: I'm confused

14:41 rhickey: ignoring the deftemplate in contrib?

14:41 fogus: rhickey: Are contrib names off-limits?

14:41 hugod: defmapped

14:41 dnolen: joshua-choi: I think clojure.lang.IPersistentMap is a lot for anyone to implement (I should read the irc backlogs more closely) just to get map-like behavior.

14:41 rhickey: I'm just trying to understand your proposal, given that you just linked to contrib deftemplate

14:42 astoddard: What about spec-datatype or add-datamap? To avoid def def- confusion.

14:42 drewr: joshua-choi: I described it backwards; you were essentially correct in your estimation

14:43 joshua-choi: rhickey: No, I wasn't proposing anything. If you're talking to me. :P I was confused. I was referring to clojure.core/doall, doseq, etc. vs. clojure.template/do-template, which has a hyphen.

14:43 rhickey: joshua-choi: sorry, no, fogus

14:43 fogus: rhickey: I see. The link was meant for joshua-choi but reminded me that my proposal last week of using the name deftemplate in place of defmaptype was met with silence. I'm not trying to link the contrib macro with defmaptypes

14:43 clojurebot: contrib is http://github.com/richhickey/clojure-contrib/tree/master

14:44 rhickey: fogus: ok. I don't see the map variant as a template

14:45 joshua-choi: Why did clojurebot talk again? What prompted it?

14:45 * joshua-choi is freaked out by clojurebot sometimes

14:45 rhickey: interface-type, data-type, map-type

14:45 fogus: rhickey: The etymology of deftemplate goes back to my knowledge of the "similar" CLIPS construct.

14:46 drewr: as an app-level user, I'd rather definterface/deftype/defmap

14:46 I know you want some separation from those, but I think it would be confusing

14:47 chouser: interface-spec, data-spec, map-spec

14:47 rhickey: fogus: ah

14:47 chouser: that conflates or overloads the "specifying" with the "specification"

14:47 rhickey: template has taken on a lot of baggage since then

14:48 fogus: rhickey: yes. That is very true

14:48 * rhickey still wishes Drools accepted Maps as facts

14:49 dnolen: spec seems weird to me, but that's just my experience, make me think of testing frameworks.

14:50 * fogus wonders if it's the terms that have baggage... or us

14:50 rhickey: in any case, template begs the question, template for a what?

14:50 defmaptemplate

14:51 fogus: That was my thought

14:54 astoddard: Are the "def" (or whatever is better) versions of the names going to be macros like defn is for def fn?

14:55 * joshua-choi is hoping for docstrings in the def special form and a def- macro

15:16 powr-toc: Hey... just started using labrepl, under netbeans on Windows and it looks like clojure-1.2.0-SNAPSHOT is not downloaded in the dependencies... any idea why?

15:16 I can't see it in build.clojure.org/releases

15:17 kotarak: powr-toc: it's in build.clojure.org/snapshots

15:34 powr-toc: kotarak: we're doing a clojure workshop just now... one of the guys on windows is having some problems... For some reason his labrepl doesn't seem to have any css applied to its pages etc...

15:34 also he doesn't see any code snippets

15:35 rhickey_: powr-toc: that would be due to no css - how is he running it?

15:35 defn: my labrepl works fine

15:35 rhickey_: powr-toc: e.g. in what environment?

15:35 defn: *(im not on netbeans + windows, though)

15:37 rhickey_: if he's on Netbeans he needs the latest enclojure plugin: http://github.com/downloads/EricThorsen/enclojure/enclojure-plugin-2010-23-mar.nbm

15:37 that fixes an issue where the project repl did not get the project dir as the working directory, causing exactly what you describe

15:39 TakeV: Huh, enclojure updated?

15:40 powr-toc: hey rich

15:41 rhickey_: powr-toc: yes?

15:42 Also we had some problems under both windows and ubuntu with enclojure/netbeans... nbgit seemed to struggle cloning the github repo

15:42 it failed with an auth error

15:42 so we had to git clone it ourselves

15:45 cemerick: powr-toc: in my experience, nbgit is rubbish, unfortunately.

15:45 cemerick: I hear that NetBeans will have git support baked in sometime soonish, but who knows

15:46 cmd line + gitx is a pretty killer combo in the meantime

15:48 rhickey_: do you have any pointers to materials discussing approaches to "porting" (reimagining?) mutable data structures to a persistent form?

15:49 rhickey_: cemerick: heh, no

15:49 cemerick: I figured. :-)

15:50 rhickey_: there is some generic technique described in "Making data structures persistent" Tarjan et al

15:50 cemerick: So much literature out there, describing good stuff, all semi-taboo now that I know what it's like to not deal with mutability.

15:50 defn: hmmm i found something that's not working in labrepl -- just something small -- on 'its_all_data.clj' the (code (quote println)) is actually displayed as 'println in the rendered page -- where i assume it should be (quote println). i'm looking at labrepl/util.clj but my macro foo is not strong enough to know how to fix this one. if anyone has a minute and wants to take a look thatd be cool: http://github.com/relevance/labrepl/blob/master/src/labrepl/util.clj#

15:51 (did all of that come through or did it get cut off?)

15:51 that's the (code (quote println))

15:51 rhickey_: cemerick: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.133.4630

15:51 cemerick: but I rejected that technique

15:55 * defn gets out stuart's book and re-reads the macros section

16:00 chouser: after the reader's done, there's no way to differentiate between (quote foo) and 'foo

16:03 defn: chouser: interesting

16:03 chouser: that's true generally of reader macros, actually

16:04 chouser: ,'#()

16:04 clojurebot: (fn* [] ())

16:04 chouser: ,'(fn* [] ())

16:04 clojurebot: (fn* [] ())

16:04 arohner: is there a version of nth that counts from the end of the list, or do I have to do (nth (- (count list) x) list)?

16:05 drewr: hugod: I'm finding that as I encounter breakpoints, my swank thread count goes up but never down

16:05 defn: chouser: so in this instance the best way to deal with it would just be to not run it through any (code (...)) whatsoever and just print it out in HTML?

16:06 hugod: drewr: nested breakpoints? how are you counting threads?

16:06 chouser: defn: I don't know enough about what laprepl is doing there to answer that

16:09 drewr: hugod: I mean the execution threads that swank fires off

16:09 chouser: rhickey: ha! no, I hadn't.

16:09 defn: perhaps

16:10 defn: perhaps 'code' should optionaly take a string instead of a form?

16:10 drewr: hugod: it should tell you in your modeline

16:11 defn: chouser: like a multimethod maybe?

16:11 lancepantz: if i read a java properties file within a jetty webapp, will it reopen the file for every connection?

16:12 drewr: hugod: that may have been because I was killing sldb windows out of frustration though

16:12 no, it was from sldb-inspect-in-frame

16:12 which doesn't seem to work

16:14 hugod: how recent of a slime version do I need?

16:14 mine's probably a couple months old

16:14 hugod: drewr: you see locals?

16:14 anything from elpa to head

16:14 drewr: ah, hadn't hit return yet

16:14 I was doing eval-in-frame

16:15 and typing the binding name

16:15 hugod: just typing the local symbol should work

16:19 maxhodak: is it possible to do (partial (new myclass)) ?

16:20 hiredman: nope

16:20 hugod: drewr: woops, eval-in-frame doesn't seem to work -thanks

16:20 chouser: no, but you can do #(new myclass %)

16:20 hugod: drewr: the locals should be available at the repl, and through inspection of the first stack frame

16:20 maxhodak: chouser: i want to do something like (new ~myclass anotherclass)

16:21 but anotherclass isn't in scope inside the quote, and ~anotherclass give me "print-dup not defined"

16:21 chouser: maxhodak: this is in a macro?

16:21 maxhodak: chouser: yes

16:21 * rhickey searches for coin to flip over the deftype naming

16:22 maxhodak: er no

16:22 chouser: rhickey: I'm not sure they make 9-sided coins.

16:22 hiredman: 1d9

16:22 clojurebot: 7

16:22 maxhodak: chouser: its not in a macro; i'm using *gasp* eval

16:22 technomancy: hugod: did you post a writeup of swank break yet?

16:22 hiredman: :D

16:22 esj: rhickey, you could use the 'Universe Splitter' app on the iPhone and go with all of them !

16:23 hugod: technomancy: not yet... - it might solve some questions

16:23 rhickey: I'm not loving datatype for the base version, as map types are for plain data IMO

16:24 drewr: hugod: I think I've got the hang of it, though if something goes awry, the errant sldb never dies and swank keeps accruing threads

16:24 I can try to track that down

16:24 chouser: the base version is techincally more general, so: deftype and defmaptype ?

16:24 plus or minus "def"

16:24 rhickey: chouser: yes, those are the current, unloved, leaders

16:25 drewr: s/defmaptype/defmap/ and you have a winner

16:25 hugod: drewr: exceptions are nested - you should have restart to go back to the previous level - I'm not sure "thread" is the correct terminology here...

16:25 Chousuke: that kind of implies defining a map instance :/

16:26 drewr: Chousuke: how so? defmap isn't anything like hash-map or sorted-map

16:27 hugod: ok, yes, it works if I remember to hit 1 instead of 0, but I would think a QUIT should completely kill the sldb session

16:27 chouser: drewr: you're not defining a map, but a thing that describes a whole class of maps.

16:28 optionally replace the word "class" there with: category, kind, type... :-)

16:28 rhickey: deftype and deftype-map

16:29 chouser: defstruct has a few naming problems IMO. :-)

16:29 hiredman: (deflineage ...)

16:29 hugod: drewr: you should have the option to do either (QUIT to the top level, ABORT to the previous level)

16:30 drewr: hugod: I do, but QUIT leaves a lingering execution thread

16:31 chouser: in that case, I vote for deftype/deftypem

16:32 chouser: (deftype Foo [a b] :as this :automap true)

16:32 ew, scratch that

16:32 or rather have 'true' be the default

16:33 hugod: drewr: then that's a bug - could you tell me how to reproduce it

16:33 dnolen: I vote datatype, maptype, protocol, interface. a clear, uncommon, succinct set of names, doesn't add more def stuff (a conceptual break), easy on the eyes.

16:34 drewr: hugod: invoke a break, : foo RET q, then you should see in your modeline your slime execution count incremented

16:35 chouser: map maptype mapcat -- which is a pure function that returns a seq and which defines a new namespace-global type name?

16:36 dnolen: considering I don't even know mapcat very well, I wouldn't get confused about maptype, what could that possibly mean?

16:36 as fn operation I mean.

16:36 hugod: drewr: that gives me sldb buffer with a sldb[2] indicating a nested exception - pressing 0 closes the buffer and takes me back to the repl

16:37 chouser: maybe it takes a dataype name and seq of regular maps, and returns a seq of instaces of the dataype. :-)

16:37 drewr: hugod: I think you'll only see what I'm talking about if you are working from a source file

16:37 the modeline for the repl doesn't have it

16:40 dnolen: chouser: not likely :) I generally expect Clojure to be fairly obvious. maptype sounds special, especially since there's only one other name with the word type in it. datatype.

16:41 chouser: ,(type 5)

16:41 clojurebot: java.lang.Integer

16:41 dnolen: and that makes conceptual sense.

16:41 ,(maptype [1 "foo" :bar}])

16:41 clojurebot: Unmatched delimiter: }

16:42 dnolen: I don't think that'll be a very common thing to try :)

16:43 ,(map type [1 "foo" :bar])

16:43 clojurebot: (java.lang.Integer java.lang.String clojure.lang.Keyword)

16:44 chouser: my point in comparing map maptype and mapcat though is mostly about how their names all look like regular pure functions.

16:44 dnolen: But Clojure has 11 special forms, there really no way to distinguish between special forms and pure functions.

16:44 chouser: as I said before, if we're sure we're never going to want regular pure functions named protocol or interface or maptype, I'm sure we would all get used to those defining namespace-global names.

16:45 dnolen: for example I keep trying to use "and" as a pure function.

16:45 cemerick: rhickey: it's hard to not cringe @ the Driscoll et al. in a world that has Okasaki & Huet

16:45 hugod: drewr: can't miss that arrow :-)

16:45 drewr: what arrow???

16:46 skitch ftw :-)

16:46 dnolen: chouser: couldn't we just use protocol/protocol* in that case?

16:47 chouser: dnolen: which one means what though? * carries very little meaning, except the general implication you might want to avoid calling it.

16:47 s/general/vague/

16:49 hugod: drewr: its leaking sldb buffers, the number of threads is stable

16:52 drewr: hugod: if I type (Thread/sleep 5000) and hit C-x C-e twice, that number increments by two

16:53 are those not threads of execution?

16:53 dnolen: chouser: I supposed mostly concerned with the addition for 4 new def(things). I'm more afraid of some new to Clojure wondering whether they should deftype, defmaptype, defstruct, defprotocol, definterface. when really they should just be using maps. But perhaps this really isn't a valid concern.

16:53 kylesmith: So I'm still trying to get emacs working with clojure. I removed all the system-wide paths to slime (in favor of technomancy's github version), but now emacs is complaining about slime-fancy. Any ideas?

16:54 chouser: dnolen: I'm not sure that choosing different names does anything to reduce that concern. :-)

16:54 drewr: dnolen: they'll need to learn what each thing does anyway; I like using def because it communicates something declarative and top-level

16:54 although I just realized that ns isn't defns

16:54 so maybe I shouldn't care

16:57 hugod: drewr: I don't think so - slime-list-threads doesn't show any changes

17:01 drewr: hugod: ah, ok, that number is overloaded then, because: http://img.skitch.com/20100330-nf3h4hrxc1nhm8wjm731p364ws.jpg

17:04 kylesmith: Can somebody tell me again why swank-clojure-autoload was deprecated? All I wanted to do was update my emacs setup to get a bugfix, and now everything's changed so much that I can't get it to work.

17:06 dnolen: kylesmith: technomancy's slime unfortunately removes support for other lisps, you need to add those files back from that commit of slime.

17:06 hugod: drewr: the number is (length (slime-rex-continuations slime-default-connection))

17:07 dnolen: kylesmith: for what it's worth this problem should soon be over. hugod's work make's swank-clojure work with SLIME master again.

17:08 hugod: drewr: so continuations aren't being handled properly

17:08 drewr: hugod: interesting, thanks for tracking that down

17:08 technomancy: kylesmith: the old installation method was very complicated and error-prone; the new one is automated and causes way fewer problems.

17:08 kylesmith: Ok. When is that expected to be finished?

17:09 hugod: kylesmith: current 1.2-SNAPSHOT should work with slime head

17:09 unless you are using slime-autodoc

17:10 hugod: in which case you will need the changes in the autodoc branch

17:10 kylesmith: clojars or technomancy's repo on github

17:11 TakeV: Is there a standard guide for getting SLIME and swank-clojure working with Emacs 23? Because I can't get it working. >_>

17:11 kylesmith: So use technomancy's repo of swank-clojure with cvs version of slime?

17:12 lithpr: TakeV, i strongly recommend using the "Emacs Starter Kit" if you are new to emacs.

17:13 technomancy: TakeV: the swank-clojure readme is pretty comprehensive

17:13 TakeV: lithpr: Alright, thanks.

17:13 lithpr: It comes with elpa and a bunch of packages that are very useful. You can get clojure-mode, clojure-test-mode, swank-clojure, etc

17:13 from elpa

17:13 hugod: kylesmith: I'm using 2010-03-10 - let me know if you have issues

17:17 kylesmith: Well, I can get to inferior-lisp, but I have to add this to my .emacs (add-to-list 'slime-lisp-implementations (clojure ,(swank-clojure-cmd)))

17:17 TakeV: lithpr: That's what I was doing before, but it didn't work.

17:18 lithpr: oic

17:18 kylesmith: otherwise, I just get "no such file or directory, lisp"

17:19 lithpr: TakeV: still take a look at his .emacs on that page. some good stuff there :)

17:19 TakeV: Sure.

17:22 lithpr: TakeV: one last tip that wasn't immediately obvious to me. To customize your setup in ESK, you can make a [username].el in your .emacs.d dir

17:22 Crowb4r: Anyone here made a rather large gui app in clojure?

17:22 kylesmith: hugod: This might be a dumb question, but when you said 1.2-SNAPSHOT, was that referring to clojure, or slime/swank-clojure, etc?

17:23 lithpr: cemerick has

17:23 cemerick: I've what?

17:23 hugod: kylesmith: swank-clojure

17:23 Crowb4r: made a gui app in clojure

17:23 cemerick: Crowb4r: oh, sure

17:23 Used the NetBeans Platform, FWIW.

17:25 kylesmith: hugod: Ok, I'm on that version, but I'm still getting a file not found exception for swank/swank.clj

17:25 which path is swank.clj supposed to be on?

17:26 Crowb4r: cemerick: Iwas about to ask about netbeans. So that answers that question. I'm just trying to see how some small app development in clojure goes and getting it to a exe with launch4j

17:27 tomoj: kylesmith: you shouldn't have to worry about swank.clj...

17:28 hugod: kylesmith: you might find that swank-clojure-project is a useful way to start the repl

17:28 tomoj: oh, maybe you should if you're doing something weird I didn't read about above :)

17:28 TakeV: Hmm, the instructions for the emacs-starter-kit don't seem to be working.

17:29 Clone the git repo into ~/.emacs.d, right?

17:29 rhickey: cemerick: yes, but even Okasaki is challenged in sticking with purely functional implementation - Clojure's persistent data structures don't, and that's a key to making them fast

17:30 cemerick: Crowb4r: NB has its own launcher, FWIW. It's not the best I've used, but is perfectly servicable.

17:32 kylesmith: swank-clojure-project gives me "wrong argument type: Stringp, nil"

17:32 Crowb4r: cemerick: Ahh thanks

17:33 cemerick: I was thinking of writing a simple car maintaince application and stuffing it as an exe on windows.

17:33 cemerick: Crowb4r: all in one file, you mean?

17:34 Crowb4r: cemerick: No I meant convert the jar to a .exe

17:34 after I write it

17:34 I should have been specific with stuff it

17:34 cemerick: Crowb4r: right, well, that's not the easiest thing to do with an NBRCP app. The installation is a dir, with a pile of jars (modules), and a launcher.

17:35 A proper installer can put a single icon in the start menu linked to the launcher, for the same user experience.

17:35 There are tools (like jsmooth, and others I've forgotten about) that will take a pile of jars, a main entry point, and emit an .exe

17:36 rhickey: yeah...I was about to go hunting for the clojure widget that supports mutable fields :-P

17:36 Crowb4r: cemerick: launch4j seems to be pretty active.

17:36 cemerick: I've not used that before, but sure.

17:37 Crowb4r: It's all an experiment. I will record the results and make a post about them if I finish it.

17:38 hugod: kylesmith: something might have changed since the version I'm using. have a look at the emacs backtrace.

17:39 kylesmith: I honestly don't understand what I'm doing wrong here. I have 1.2-SNAPSHOT of swank-clojure and slime master. I haven't customized anything.

17:39 Crowb4r: I really like the language a lot and just want to see what it can be used to develop. So thanks for the help cemerick.

17:42 hugod: kylesmith: you have a need for slime cvs head? the elpa version and instructions are much simpler...

17:43 kylesmith: I tried the elpa version, and it complained some gibberish about slime-fancy

17:43 here's where I'm at now http://paste.lisp.org/display/97104

17:46 "swank-clojure.el:47:1:Error: Cannot open load file: slime-fancy"

17:46 hugod: drewr: should be fixed now - thanks for the debugging

17:47 kylesmith: That's what happens when I follow the elpa directions exactly.

17:49 quidnunc: Is there a non-raw SQL library in clojure? Something like an ORM?

17:50 hugod: kylesmith: the protocol version identifies that as slime head, not elpa - I suggest you remove slime head, restart emacs, and try the elpa route again

17:50 kotarak: quidnunc: clojureql, but it's in heavy flux right now

17:50 lithpr: inc hugod

17:51 quidnunc: kotarak: Thank you

17:51 kotarak: quidnunc: beware: *heavy* flux

17:52 quidnunc: kotarak: Noted, thanks.

17:52 kylesmith: hugod: that pastebin was from slime-head. The last two things I posted were from my attempt at elpa. I wanted to show that I've tried installing it both ways.

17:53 I just noticed the version of slime in my elpa is 20091016. How do I get 2010-03-10?

17:53 tomoj: looks like that's not in elpa yet

17:54 kylesmith: Ack, how convenient

17:54 lithpr: i would mention that i've had nothing but success using 20091016. Other people have gone through hell trying to get other versions to work.

17:54 fwiw

17:55 tomoj: I've been using 20091016 as well, but dunno what I'm missing

17:55 lithpr: tomoj: (=)

17:56 technomancy: kylesmith: you've got some old config somewhere that's assuming you're using slime trunk. you need to remove it to use elpa slime.

17:57 kylesmith: I thought I did that already, but let me double check.

17:57 lithpr: kylesmith: if technomancy suggests something re: emacs, definitely do it :)

17:57 technomancy: could be apt-get slime

18:00 kylesmith: Well, that's the thing. slime is actually installed via apt-get (and my sysadmin says it has to stay for various reasons). So, I did C-h v load-path and removed all references to slime in my .emacs, before elpa loads. Are there paths other than load-path that my system-wide slime could still be under?

18:04 I can confirm that after installing slime through elpa, C-h v load-path contains only references to the elpa version of slime.

18:07 technomancy: are you calling clojure-slime-config? that's deprecated.

18:07 kylesmith: nope

18:08 shales: How should I remove an item from the middle of a vector? so far I'm doing this:

18:08 technomancy: that's the only place from elpa that slime-fancy is mentioned, so it must be coming from outside an elpa package

18:08 shales: ,(let [v [0 1 2 3] i 2] (apply conj (subvec v 0 i) (nthnext v (inc i))))

18:08 clojurebot: [0 1 3]

18:10 shales: Is there no better way?

18:10 kylesmith: Ok, I'll keep digging.

18:14 Associat0r: anyone here using clojure on .NET?

18:15 dakrone: shales: (concat (take 2 [0 1 2 3]) (drop 3 [0 1 2 3])) but that's not really pretty either

18:32 defn: (app :get [["hi [name #"fred|ethel|lucy"]] ["hello " name "!"] ["hi" _] "I don't talk to strangers."])

18:32 i find that pretty confusing -- am i alone?

18:33 don't answer that -- i just find the syntactic sugar used in that example to be complicate things more than just using the regular syntax

18:34 s/be//

18:39 dnolen: defn: personally I like it and find it easy to read, but printed in IRC you lose the proper formatting.

18:40 fanatico: and if you're not familiar with pattern matching, it may be a little foreign.

18:40 but I thought it was a very cool example.

18:42 defn: yeah i think i was just maybe initially a little shocked by it

18:43 but i already used it :)

18:44 (def my-app (app [#".*" &] {:get "every route!"}))

18:44 that's pretty cool

19:00 Licenser: heya defn how is walton going?

19:03 defn: Licenser: I haven't played with it much -- I've been working on a little geoip thingamajig that I haven't put up yet

19:04 SynrG: /win 5

19:04 defn: Licenser: Well I'm sort of tangentially working on it

19:04 SynrG: ups

19:05 defn: Licenser: I'm building a little enlive + moustache front end for walton -- then im going to let it run overnight on (ns-publics) and have a little website with examples setup

19:05 defn: Licenser: Finally I'd like to use solr or something and make a little clojure example search thing

19:07 Licenser: defn: you could use an irc bot to feed the data dynamically to walton, instead of one shot parsing the data

19:11 underdev: defn, that would be great

19:44 SynrG: Licenser: yah. i habitually use /win instead of alt keys because they can be typed offline on the bus and will be buffered (even though i'm not presently on the bus)

19:53 raek: is all expressions in clojure compiled? (I know fns are...)

19:53 i.e., if I eval (+ 1 2 3), will it be compiled first?

19:54 Licenser: raek: I think (with a big note on think) not

19:55 arohner: raek, Licenser: no, it is

19:55 clojure doesn't have an interpreter

19:56 underdev: raek: I think (witha big note on think) yes. I seem to remember that clojure...

19:56 arohner: it compiles every expression to classes, then runs those

19:56 underdev: rt, no interpreter

19:56 arohner: doesn't that make the answer yes?

19:56 arohner: underdev: yes, everything is compiled

19:57 raek: ah, I suspected so...

19:57 otherwise, there had to be a interpreter too

19:57 underdev: oic, "no, it is"

19:58 "no, its not not compiled, it is compiled"

19:58 arohner: sorry, that could have been more clear

19:58 erikcw1: I'm trying to figure out how to debug a function in Emacs/Swank that keeps throwing a NullPointerException. I've looked though the stacktrace, and non of it seems very helpful. How can I figure out where this exception is being thrown?

19:58 underdev: i was confused, you were not confusing

19:58 arohner: erikcw1: I normally look for the last line in the stacktrace that comes from my code

19:59 actually, it's a little more complicated than that

19:59 1) find the root exception, this is the lowest section that says "caused by" in the stack trace

20:00 once you're there, find the last line that comes from your code. this is the highest line in the root exception that has your_file_name.clj next to it

20:00 look at that line

20:00 that probably wasn't clear either.

20:01 erikcw1: does that make sense?

20:01 oh right, you're in slime. keep hitting 0 to get the cause of the exception until you can't anymore

20:01 then look at the highest line in the stack trace that contains your code

20:03 raek: arohner: isn't 0 abort?

20:04 arohner: raek: I don't remember off the top of my head. whichever says 'cause'

20:05 alexyk: how do you unzip a sequence of pairs [x y] into two seqs, firsts and seconds, in one fell swoop?

20:08 arohner: alexyk: does it have to be in one pass?

20:08 [(map first s) (map second s)] is pretty straight forward

20:09 alexyk: arohner: yeah, I kinda hoped for an stdlib unzip or some such

20:09 the idea of two passes vaguely annoys me

20:10 arohner: alexyk: I don't think there's a std one yet. you can build it using reduce

20:11 alexyk: arohner: yep...

20:14 drocko: Hello

20:16 erikcw1: arohner: I don't see "cause/caused" by anywhere http://pastebin.com/B1CDw3Zk

20:16 drocko: I need a little bit of guidance. I have several items that I am representing as structs in a list. I store this list as a ref as it's pretty much the only mutable part of what i'm doing. Adding items from the list is pretty easy. What is the best way to modify structs in the list?

20:16 also which sort of list should I use? I am unsure

20:17 raek: drocko: have you used assoc-in and update-in?

20:17 drocko: raek: I have not. I shall look these up.

20:17 raek: any tips on what sort of thing I should make this list into?

20:18 raek: ,(assoc-in [{:foo "xyz"} {:foo "ijk"}] [1 :foo] "abc")

20:18 clojurebot: [{:foo "xyz"} {:foo "abc"}]

20:18 raek: drocko: that depends on what you need to do with it

20:19 arohner: erikcw1: ah, you're using eval region. if this is a multiline expression, try putting it in a function, load the function with C-c C-l (load file), and then run the function

20:19 erikcw1: I basically only use C-c C-l, and the repl

20:19 raek: vectors have fast random access with indices

20:19 arohner: sorry, got to run

20:20 drocko: right. i guess it sort of depends on how i want to build and manage this piece of data

20:20 ah the terminology is kind of loaded

20:21 like if i say list, hash, collection, or set they all mean different things!

20:22 raek: I think you have given me the clues i needed. Thanks!

20:23 raek: drocko: some sources of info: http://clojure.org/data_structures and http://clojure.blip.tv/file/707974/

20:24 drocko: cool thanks!

20:24 raek: need to sleep now... (02:24) bye!

22:05 lithpr: how do you negate a regexp in clojure?

22:07 wooby: lithpr, same as you would in java, which is i think with ?!

22:07 * wooby has never used it though

22:08 lithpr: okay, didn't check with java docs... thrown off that the whole thing has to be in quotes...

22:09 joshua-choi: There was actually a little discussion back in the day, before Clojure 1.0, about those regex quotes...

22:09 lithpr: i guess i could just use a function to negate... for now...

22:10 * lithpr is not willing to take on a whole new regex syntax just yet

22:15 lithpr: and by willing, i mean "capable"

22:21 chouser: lithpr: new compared to what?

22:22 lithpr: tcl, perl, ruby...

22:23 its always worth the effort... just not tonight...

22:24 joshua-choi: lithpr: Java regex syntax is very similar to Perl's. I can't remember any differences, but there is a section in Pattern's Java docs.

22:25 lithpr: since you can't negate outside of the quotes, it's different

22:25 again, all my bad, nm, i'll do the legwork :)

22:28 its not like wrapping a not around a function is difficult

22:52 Crowb4r: Anyone play with Conjure a all?

22:53 Raynes: I don't use anything that has 'jure' at the end except Clojure.

22:56 cemerick: Crowb4r: this is the web framework?

22:56 huh, it's grown some

23:12 Blackfoot: has anyone gone through Lau Jensen's tutorial on hadoop?

23:23 ztellman: does reify have a 'this' reference?

23:24 nm, just re-read the docstring

23:24 carkh: (reify :as this AProt ....

23:55 mcburton: hey all, i'm new to clojure and have an idiomatic question: I'm looking to generate a sequence of vectors w/ random int pairs ([1 3][1 4]...) and I'm having difficulty making a lazy sequence.

23:55 i tried something like this: (def random-ints (repeatedly #(vector((rand-int 100)(rand-int 100))))) and then used (take 4 random-ints)

23:56 hiredman: def like that will hang on to the head

23:56 mcburton: but there is something wrong with my anonymous function that I can't figure out

23:57 hiredman: right, I can wrap the taake

23:57 hiredman: you have too many parens

23:57 mcburton: but but right now i can't even get it to run

23:57 hiredman: "wrap the take"?

23:58 mcburton: ah

23:59 (defn wrapper [n func] (take n (repeatedly func)))

23:59 should solve head problem yes?

23:59 where func is (vector (rand-int 10) (rand-int 10))

23:59 hiredman: sure

23:59 that will not work

Logging service provided by n01se.net