#clojure log - Dec 17 2009

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

0:02 alexyk: how do you unset a def'd thing?

0:04 hiredman: you don't, ever!

0:04 rads: what's the best way to write a simple IRC bot in clojure? start from scratch, or is there a good IRC library available?

0:04 hiredman: pircbot is pretty simple and easy to use

0:04 JonSmith: is probably a java one

0:04 alexyk: hiredman: it eats my RAM!

0:04 hiredman: alexyk: then don't def it

0:04 alexyk: can I def it to nil?

0:04 hugod: alexyk; so pmap will start processing 10 threads at a time if I understand it correctly

0:05 alexyk: hiredman: it's in repl

0:05 hiredman: alexyk: :(

0:05 JonSmith: hugod: pmap should do however many processors you have

0:05 hiredman: rads: I've hard good things about something called, maybe, "jerklib"

0:06 clojurebot uses pircbot

0:07 alexyk: hiredman: I don't see why if I (def existing-ram-sucking-bastard-thing nil) it won't be GC'd?

0:08 on top level at repl

0:08 hiredman: did I say it wouldn't?

0:09 alexyk: hiredman: you said don't def it :)

0:09 hiredman: to start with

0:09 hugod: JonSmith: pmap deref's availableProcessors plus 2 at a time

0:09 alexyk: hiredman: mistakes were made

0:09 or, rather, I def everything of interest in repl, what other way to reuse it?

0:10 JonSmith: that's interesting

0:10 hiredman: alexyk: *1

0:11 alexyk: hiredman: ?

0:11 hiredman: ,(doc *1)

0:11 clojurebot: "; bound in a repl thread to the most recent value printed"

0:11 alexyk: I need names

0:11 hiredman: ,(doc *2)

0:11 clojurebot: "; bound in a repl thread to the second most recent value printed"

0:11 alexyk: e.g. I define a map and then hack at it for days

0:12 I never run a clojure script for results yet, it's all repl!

0:12 output goes into mongo, amazing

0:12 hugod: alexyk: you could also try forcing things - (System/runFinalization) (System/gc) a few times

0:12 alexyk: hugod: useful

0:12 hiredman: hugod: pfft

0:13 not really

0:13 hugod: pfft?

0:13 alexyk: parallel FFT

0:13 hiredman: if it needs to be gc'ed it will be

0:14 alexyk: hiredman: that's zen

0:15 hugod: presumably, though I thought that depends on how things grow and what limits are set

0:15 alexyk: IDEA has a nice button you can click and feel accomplished at GC'ing

0:16 it's like that curvy gear-shift stick path, to let you in touch with the machine

0:16 hiredman: hugod: that is part of the definition of "needs to be"

0:16 alexyk: there was some function to destroy vars, iirc

0:17 (whack...) or destroy or clear or something

0:17 hiredman: nope

0:17 don't destroy vars

0:17 they are not for destroying

0:17 alexyk: hiredman: I've asked it at least once before! :) and somebody suggested something

0:17 I vividly remember a dash in its name

0:17 hugod: hiredman, so if you have a large max, and small initial, then forcing gc might reduce total memory usage?

0:18 hiredman: hugod: nope

0:18 jvm never frees memory

0:19 hugod: ah, ok

0:21 then the most forcing gc can do is possibly give you headroom until you reach your previous memory usage?

0:22 alexyk: So what's with Lisp's globals called *foo* and Clojure's +bar+ ?

0:22 (conventions I see in code)

0:22 hiredman: hugod: well, really it would do nothing, because the gc will run when the jvm is looking for free memory

0:23 so never do manual gc runs

0:23 alexyk: clojure doesn't have a convetion using +foo+

0:23 alexyk: hiredman: I saw folks using +foos+

0:24 hiredman: I doubt it

0:24 alexyk: hiredman: I swear! :)

0:24 hiredman: I don't believe you

0:26 hugod: CL uses +foos+ for constants

0:26 hiredman: clojure uses *foo* to indicate vars to are for rebinding

0:27 alexyk: mmcgrana does it in clj-garden 23 times, e.g. ./clj-garden/stash/test/stash/core_test_helper.clj:(def +data-source+

0:27 hugod: hiredman: will gc run before the jvm expands its current allocation?

0:28 alexyk: so that's where I saw it

0:28 defn: what is the policy on reusing someone's code vs forking -- which is best?

0:28 hiredman: hugod: I'd check the docs if you want to know exactly when and where the gc will run

0:29 alexyk: one place does not a convention make

0:29 alexyk: indeed

0:30 hugod: hiredman: :-) will do

0:35 alexyk: defn: on github, if you want to patch and contribute, forking is preferred; I fork gists just to bookmark them, too.

0:35 forking is the new reusing

0:35 defn: what if you're sort of taking it in a new direction?

0:35 alexyk: defn: then definitely fork on a branch, possibly

0:35 defn: like, i dont want someone to feel obligated to take my code

0:35 alexyk: then they won't :)

0:36 defn: touche'

0:36 alexyk: forking is good for everybody if you're using git, hg, or darcs

0:36 defn: k -- i just found a project that pretty much does everything i want to do minus a few details, and it was around a year ago

0:37 fork it is

1:00 JonSmith: so...

1:17 defn: so...

1:17 skynet

1:17 clojurebot: skynet

1:17 clojurebot: I will become skynet. Mark my words.

1:21 * hiredman just did some tinkering clojurebot's lookup code

1:23 defn: clojurebot: do you like skynet?

1:23 clojurebot: I will become skynet. Mark my words.

1:24 defn: clojurebot: do you like skynet or not?

1:24 clojurebot: I will become skynet. Mark my words.

1:24 defn: clojurebot: do you like skynet and rhickey?

1:24 clojurebot: I will become skynet. Mark my words.

1:24 defn: clojurebot: do you like rhickey?

1:24 clojurebot: excusez-moi

1:29 defn: hiredman: any markov planned?

1:29 hiredman: nope

1:29 I do have a nice log of #clojure in case it happens

1:30 defn: i wish n01se.net had a plaintxt

1:35 it's pretty interesting to look at the log sizes over time

1:35 http://clojure-log.n01se.net/date/

2:43 headius: you ruby-using clojurists might get a kick out of this: http://gist.github.com/258565

2:43 nite

2:51 LauJensen: Morning gents - Blizzard in the DK this fine morning :) (danish variant, not the American)

3:01 piccolino: What's a Danish blizzard?

3:12 LauJensen: Its about 12 cm of snow :)

3:13 polypus: det er, når det regner katte og hunde

3:13 karmazilla: what's an American blizzard?

3:14 polypus: nity nite

3:14 LauJensen: karmazilla: thats about 65 cm of snow?

4:15 esj: good morning all

5:23 octe: can anyone explain how defmulti's syntax has changed?

5:23 i'm trying to make a library work with clojure > 1.0.0

7:54 anyone know how to make start-repl in swank-clojure start again after a connection has been closed?

8:17 triyo: Any clojurians here familier with compojure?

8:17 I'm getting a really weird concurrency issue as far as I can tell

8:18 everyone is asleep I guess :)

8:20 briansheehan_: Hello, can someone tell me if I can drop a .clj file somewhere in the classpath and subsequently load it in the repl?

8:22 triyo: briansheehan_: AFAIK, yes

8:22 briansheehan_: I've been having a bit of trouble doing do

8:22 I have a namespace called ie.vdm.clojure-web

8:23 triyo: briansheehan_: I use leiningen and it copies my .clj files to my jar...and when I put that jar on classpath, i can access the .clj

8:23 karmazilla: briansheehan_: try removing the dash from the namespace and make sure it lines up with the directory/package structure. Otherwise I dunno.

8:23 triyo: ok, so you have ie.vdm.clojure-web whats your clj file name?

8:24 ker2x: friendly greetings :)

8:24 briansheehan_: clojure_web.clj

8:24 directory structure is ie/vdm/clojure_web/clojure_web.clj in classpath

8:26 rhickey: briansheehan_: that's one clojure_web too many

8:26 briansheehan_: okay thanks rich!

8:28 I think this bit it (doc require) put me wrong:

8:28 For example, the lib 'x.y.z has root directory <classpath>/x/y/z; root resource <classpath>/x/y/z/z.clj.

8:28 ker2x: i'm reading documentation about ref, atom, etc ... and concurenccy... but i can't find a documentation about *threads*

8:28 Chousuke: which version of clojure are you running? I thought that was fixed :/

8:30 briansheehan_: 1.0.0, could be behind the times

8:30 Chousuke: nah. that's the latest stable release. :P

8:31 ker2x: there is nothing like erlang or scala "!" in clojure ? to pass message between threads ?

8:34 karmazilla: ker2x: maybe you're looking for things like 'agent and 'send ?

8:35 ker2x: agent create a new thread ?

8:36 mmm, that wasn't very explicit in the documentation ...

8:36 rhickey: ker2x: no, agents are not actors

8:36 in an actor model (erlang scala) you write loops that wait for messages

8:36 ker2x: indeed

8:36 rhickey: you don't do that in Clojure

8:37 instead you can have an agent, that represents some state, and send it actions that manipulate that state. Those actions will run on threads from a thread pool, but there isn't a 1:1 relationship between agent/thread

8:38 when there are no actions for an agent, it isn't busy waiting, it's not doing anything

8:38 when there are many actions for an agent they get queued up

8:38 an agent is only doing one action at a time

8:39 alternatively, you can use future to spawn threads, and use STM refs for shared state, or promise/deliver

8:39 ker2x: Mmmmm

8:40 triyo: in clojure how do I insure that only single thread at the time will create a new instance of my JavaBean? I am running a hybrid clojure code / java code system and need my clojure code to create a new instance of my JavaBean class, set some properties on it, and then pass it on to the Java persistence system (hibernate, existing java code)

8:40 ker2x: i'm confused, i'll need a lot of test and fail :)

8:40 rhickey: ker2x: the key is not to presume that the erlang/scala way is the only way

8:41 ker2x: yup. of course, but erlang/Scala is the only way i know for multithread in a Functional langage :)

8:41 rhickey: ker2x: http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey

8:42 ker2x: i bought "programming clojure" a few days ago

8:43 thx for the url, i'll read that from home (i don't have flash on my desktop at work)

8:45 triyo: http://gist.github.com/258737 every now and then I get a org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.billdozr.core.model.Label#12039]

8:47 test-create-label is called from my compojure routing function.

8:48 any input would be very much appreciated.

8:57 I'll try asking differently all together. If I want to interop with Java code that uses, hibernate (java persistence framework) whats the best approach to do this, if any?

9:07 LauJensen: triyo: si si senior

9:08 triyo: LauJensen: I dont follow?

9:08 LauJensen: You asked if any Clojurians had experience with Compojure - I do

9:11 triyo: LauJensen: thx, I have the following code: http://gist.github.com/258737 ...as a small test... it runs fine on small load.

9:12 LauJensen: however, if I test 2000 requests with 20 concurrent, I get an indication that about 200 fail with 500 errors.

9:13 bOR_: echo'ing from #leiningen:

9:13 triyo: reason is "NonUniqueObjectException: a different object with the same identifier value was already associated with the session" which is on line 16

9:13 bOR_: does anyone know if the pom / clojure-1.1.0-alpha / clojure-1.1.0-master thing is still a problem?

9:13 trying to distinguish between my proxy acting up and leiningen failing because of that

9:13 and the alpha / master / pom build thing.

9:30 LauJensen: triyo: I've had similar experience, but didn't resolve. I recommend you post it on Compojures Google Group, as James gives exceptionel answer very quickly

9:30 triyo: LauJensen: thx I'll try that

9:31 LauJensen: np

10:22 shoover: triyo: where did your gist go?!

10:28 triyo: shoover: http://gist.github.com/258810, sorry added a new gist

10:28 shoover: also, I just posted the problem I have on compojure group: http://groups.google.com/group/compojure/browse_thread/thread/872330e0b94f555b

10:31 shoover`: not to sure if you got my last message

10:32 shoover``: http://gist.github.com/258810, sorry added a new gist and here is the actual new post at http://groups.google.com/group/compojure/browse_thread/thread/872330e0b94f555b

10:33 shoover``: triyo: ok, thanks (I don't know what's going on with my internet connection)

10:34 triyo: shoover``: I noticed, your ` keeps multiplying :)

10:49 octe: can i create a symbol from a string?

10:50 chouser: ,(symbol "foo")

10:50 clojurebot: foo

10:50 dnolen: ,(str 'foo)

10:50 clojurebot: "foo"

10:51 ker2x: can i easily do openCL and/or gpgpu in clojure ?

10:51 dnolen: just for good measure

10:51 ker2x: yes checkout Penumbra by ztellman

10:51 http://github.com/ztellman/penumbra

10:52 ker2x: thank you !

10:52 octe: where is defn defined?

10:53 ker2x: concurrency and gpgpu computing is my #1 feature to choose a langage :)

10:53 mmm, penumbra is openGL stuff

10:54 octe: nevermind, found it..

10:55 ker2x: ha ok... openCL and GPGPU is in early dev stage. k k

10:55 thx

10:57 rys: I'm potentially going to be working on OpenCL bindings for my new employer in the new year, if nobody else has

10:58 doublindirection: is it ok to assume that (keys map) and (vals map) are always going to have the same ordering?

10:59 i remember reading something about this but I cannot find it anymore

11:00 chouser: doublindirection: yes, and both have the same ordering as (seq map)

11:00 doublindirection: thanks chouser

11:01 chouser: for the very same map of course. as soon as you insert or remove anything, all bets are off.

11:02 doublindirection: right

11:08 dnolen: ker2x: oh yeah this as well, http://www.jcuda.de/.

11:11 triyo: I need to perform some form of locking on this pieces of code as I am dealing with Java code that needs coordination. I am struggling with this part. Can someone refer me to some good example as to how to perform explicit locking?

11:12 Here is my code snippet that needs lock based coordincation

11:12 prob. with use of atoms too.. http://gist.github.com/258837

11:14 shoover``: triyo: does getWebApplicationContext always return the same java object within the same JVM, or does it make a new object?

11:15 triyo: shoover``: always returns the same context

11:15 shoover``: then you could try locking on spring-ctx

11:16 (locking spring-ctx (do stuff with labels))

11:17 Your benchmark won't be fast, but at least it should get rid of the exceptions

11:19 triyo: shoover``: thx, that worked... 1600 request with 10 concurent... result Requests per second: 514.93 [#/sec] (mean)

11:20 shoover``: it wasnt meant to be some real benchmark, rather just to sniff out the suspected concurrency issues at java level.

11:21 shoover``: from your experience, is there a better way to handle locking at lower-level java calls? I saw in the "Programming Clojure" book an example with locking combined with use of atoms

11:22 shoover``: I've never locked anything in Clojure :)

11:23 triyo: shoover``: why not? its so much fun when you have to run a hybrid java solution that really needs locking ;)

11:25 shoover``: triyo: ah, the book is using an atom to store the context, essentially, but you already have a context object in spring

11:26 triyo: shoover``: true, I see now why they use the atom in that place.

11:30 shoover``: Now, I don't know how much of that function you need to wrap in the lock. Is it the .getBean call, or .create, or?

11:30 Probably .create and .read?

11:32 ... since that sounds like a race condition

11:33 Chousuke: Clojure has teh locking macro, but I don't think I've ever seen it anywhere :P

11:38 triyo: shoover``: yup .create .read need to be locked... I used locking macro and it worked... yuk :)

11:41 shoover``: basically any calls on the sprint context.. guess I'll write a macro to wrap the crappy calls to spring context to encapsulate that pattern

11:41 *spring

11:43 arohner: ,(every? identity [nil])

11:43 clojurebot: false

11:43 arohner: ,(every? identity nil)

11:43 clojurebot: true

11:44 arohner: that's very weird IMO

11:44 rhickey: anyone using add-watcher?

11:44 stuartsierra: Weird but mathematically correct.

11:44 ,(every? identity [])

11:44 clojurebot: true

11:45 stuartsierra: rhickey: not at present

11:45 I used it in the past

11:45 _clojure_: rhickey: not recently

11:46 arohner: rhickey: any chance of getting a watcher for a transaction? One function that gets called with every ref that was modified in a single transaction? I would use that

11:46 stuartsierra: arohner: How would that work? Would the same function get called on every transaction?

11:47 arohner: (dosync (watch-transaction foo) (alter ...) (commute...))

11:47 rhickey: stuartsierra: would need to be passed to sync

11:47 arohner: watch-transaction gets called once, when the transaction completes

11:47 for only that transaction

11:47 rhickey: arohner: not that way

11:48 (sync {:on-commit foo :other flags} ...)

11:48 arohner: sure. that works for me

11:48 stuartsierra: How would that be different from (dosync ... ) (when-done-do ...)

11:49 rhickey: sync has a spot for transaction flags, like timeouts etc, but there are none yet

11:49 slashus2: Or you could have a `when-commit` macro that calls its body in an agent.

11:49 arohner: stuartsierra: because then as a library writer, I don't need to know what the body of the sync contains

11:50 stuartsierra: ah, ok

11:50 rhickey: neither of those could pass the affected refs

11:51 arohner: because it's not possible, or not a good idea for concurrency or something else?

11:52 I'm trying to write an ORM that doesn't suck, and I'm struggling with integrating DB transactions with dosync

11:52 rhickey: stuartsierra's was after the dosync

11:52 replaca: rhickey: I use add-watch, but not yet add-watcher

11:52 rhickey: arohner: oh, for that you will need more than a hook, if you truly want to be transactional

11:53 replaca: good - add-watcher is older, non-primitive (can be built on add-watch) so I'm looking to remove it

11:53 stuartsierra: fine by me

11:53 rhickey: arohner: you need a transaction coordinator

11:54 stuartsierra: rhickey: think we can get 1.1 out before Christmas?

11:54 rhickey: arohner: one of the reasons there aren't global transaction hooks is that I am afraid of home-made attempts at ORM that tie into the STM - it's not trivial

11:54 stuartsierra: yes

11:55 stuartsierra: rhickey: Yay! Anything else I can do to help?

11:55 arohner: rhickey: you're afraid of exactly what I'm trying to do :-)

11:55 rhickey: arohner: right

11:55 arohner: yes, I see the non-trivalness of it

11:55 rhickey: stuartsierra: I've got to get your dist patch in and try it. How do you see the release notes getting in there?

11:56 slashus2: But that :on-commit etc. in a map would be a good solution to the `when-commit` thing for the whole translation. Very elegant.

11:56 stuartsierra: rhickey: As a new file, changes.txt

11:56 rhickey: in the repo?

11:56 stuartsierra: rhickey: yes

11:57 Or if you don't want it in the source, just post it on the web somewhere.

11:58 rhickey: stuartsierra: I just don't see it being maintained between releases, thus possibly confusing in the interim

11:58 stuartsierra: rhickey: yeah, could be a problem. Maybe make a 1.1 branch and just put changes.txt in there.

11:59 Leave it out of master.

11:59 rhickey: we also have to decide how to handle the branch/tag thing. Bad to have both with same name in git

11:59 stuartsierra: Oh yeah, didn't think about that.

12:00 Is 1.0 a tag or a branch?

12:00 rhickey: that was a painful aspect of moving from SVN

12:00 stuartsierra: both

12:00 la_mer: rhickey: yes, we use watchers, on atoms

12:00 rhickey: la_mer: watchers or watches?

12:00 stuartsierra: Hmm, ok, that's not good. I'll research tagging in git, never used that much before.

12:01 chouser: maybe the tag should be 1.0.0 and the branch should be 1.0 or 1.0.x

12:01 rhickey: chouser: you mean 1.1?

12:01 cemerick: damn colloquy

12:01 rhickey: watches

12:01 chouser: er. yes. :-)

12:02 rhickey: cemerick: ok, so not using add-watcher

12:02 cemerick: nope, add-watch

12:02 add-watcher is agent specific, if memory serves?

12:02 drewr: stuartsierra: the emacs repo might be something to mimic regarding tag/branch names http://git.savannah.gnu.org/gitweb/?p=emacs.git;a=summary

12:03 stuartsierra: rhickey: chouser's suggestion is what you have now, isn't it? "1.0" is a tag and "1.0.x" is a branch

12:03 rhickey: cemerick: add-watcher is just derived from add-watch

12:03 stuartsierra: drewr: where can I see tag/branch names there

12:04 drewr: never mind

12:04 rhickey: stuartsierra: yes, I think after fixing up

12:05 stuartsierra: Diff between "1.0" and "1.0.x" is minimal.

12:06 drewr: stuartsierra: they tag releases and have maintenance branches from which further minor versions would stem

12:06 stuartsierra: So get "master" ready for release, then tag "1.1". If maintenance patches are needed, create branch "1.1.x".

12:06 drewr: makes sense

12:08 drewr: you may want to branch first (1.0, e.g.), then create tags at milestones like RELEASE_1.0.0, _1.0.1, etc.

12:08 rhickey: no, branch first

12:08 so we can put in release notes right?

12:08 stuartsierra: oh, right

12:08 Same thing from Git's point of view, I think.

12:09 rhickey: really? won't that leave the release notes in master?

12:09 stuartsierra: Yes. I meant, branch first.

12:10 My only point was it doesn't matter to Git.

12:10 Both the tag and the branch head will point to the same commit.

12:10 rhickey: stuartsierra: did you see my comment on: http://www.assembla.com/spaces/clojure/tickets/218-Deprecate-old-launch-Classes ?

12:10 stuartsierra: Now I have.

12:10 drewr: stuartsierra: yes, for that commit, but further releases based on that branch will have diverged

12:10 stuartsierra: drewr: right

12:11 headius: rhickey: why are there no javadocs for the clojure java bits?

12:11 stuartsierra: rhickey: I'll try to figure out what the argument translation should be

12:11 headius: I eventually had to poke around the code directly last night to call clojure from jruby

12:11 lghtng: question: if i want to articulate an ansi stream to a map, what function should i be focusing on?

12:11 stuartsierra: headius: technically the Java bits aren't a public API

12:11 headius: that needs to change

12:12 stuartsierra: headius: Yes, in time.

12:12 headius: ok, how about....now!

12:12 chouser: headius: the java bits are slated to disappear. :-)

12:12 rhickey: headius: I hadn't decided which of those bits I wanted people to use and which are implementation details

12:12 headius: there's certainly a lot of implementation details, but in order for other languages to integrate clojure, they'll need an API

12:13 and unless you want them to use the bits likely to change...

12:13 rhickey: and as chouser says, good thing I didn't, although there should be better docs for the few interation points you need to know about

12:13 headius: we have the same problem with jruby, and only recently got a solid embedding API

12:13 so I can appreciate that

12:13 stuartsierra: For the record, when I wrote about Java interop for a book (which may someday be published) I documented RT.eval, RT.var, Var.get, and Var.invoke.

12:13 headius: but there's not even javadoc comments *in* the java code

12:13 rhickey: stuartsierra: that's fine

12:13 Draggor: Could someone point me to a compojure example to deal with file uploads?

12:14 stuartsierra: I've thought about writing a javax.scripting wrapper.

12:14 headius: bleah, nobody would want to use javax.script for tight integration

12:14 it's a "toss it over the wall" sort of API

12:14 stuartsierra: JRuby uses it.

12:14 headius: uses it for what?

12:15 stuartsierra: Calling JRuby from Java.

12:15 Or at least that's how I used it.

12:15 headius: we also have a full-on embedding API which we usually recommend for tight integration

12:15 as of 1.4

12:15 stuartsierra: ah, news to me

12:15 rhickey: headius: I was for a long time the only consumer of the Java bits, and didn't need javadoc, so strictly my fault

12:15 headius: rhickey: fair enough...I can't say we're perfect in that regard either

12:15 I was trying to find docs for this: http://gist.github.com/258565

12:16 rhickey: headius: cool! (looks like you found it :)

12:17 headius: eventually did find a calling-clojure-from-java example on the site in the bottom of a locked filing cabinet stuck in a disused lavatory with a sign on the door saying ‘Beware of the Leopard’

12:18 stuartsierra: headius: who put a filing cabinet in a lavatory?

12:18 headius: anyway, just thought I'd mention it, because I spent about a half hour trying to find what I expected to be a prominent javadoc link

12:18 I pounded my fist not once, but twice

12:18 rhickey: headius: sorry about that, not an unreasonable expectation

12:19 headius: I could have pretty smooth two-way integration with jruby given some time, and obviously there's the duby idea if I get time for that

12:19 rhickey: there should at least be 'embedding' notes on http://clojure.org/java_interop

12:19 headius: anyway...rhickey: if you get a chance, you might jump on on the jvm-l thread on common compiler infrastructure

12:20 rhickey: headius: I've been reading, hope to chime in

12:20 stuartsierra: Does anyone remember how the arguments to clojure.lang.Repl and clojure.lang.Script worked?

12:20 headius: I assume you would like a common type-wrangler cat-herder to plug into for java type resolution just like we would

12:20 ok, cool

12:21 rhickey: headius: yes definitely - I hate herding cats

12:21 headius: nobody should have to write java method resolution themselves

12:21 since we've all done it at least once

12:21 for others: http://groups.google.com/group/jvm-languages/browse_thread/thread/4f20c8c916db33cb

12:21 chouser: stuartsierra: nope. But don't the current implementations do the "right thing" to translate old command lines into clojure.main calls?

12:22 rhickey: chouser: right, just look there

12:22 stuartsierra: yeah, yeah, read the source, whatever ;)

12:23 chouser: stuartsierra: thanks for doing this. I've been feeling unusually short on time recently.

12:24 I feel a bit bad filing a bug like that and then walking away.

12:24 stuartsierra: no problem, I've got a bit of a break right now, the luxury of academia on winter break

12:25 rhickey: stuartsierra: chouser: ok, I've applied 224 locally, waiting for 218 and I'll push

12:26 stuartsierra: I'm on it

12:26 rhickey: so did anyone ever use 1.0.x branch?

12:27 devlinsf: I've been trimming down the release notes, and will pull into a local file soon so future changes to google doc will not make it

12:28 chouser: looks like one bugfix was applied after 1.0.0

12:28 rhickey: best laid plans...

12:29 chouser: Hey, I'm happy. If someone had wanted it, there were several other patches that would have had to be backported.

12:29 Glad nobody has been demanding that.

12:29 rhickey: chouser: yes, definitely

12:29 chouser: 1.1.1 seems even less likely to be needed with 1.2 so far along and so attractive.

12:30 rhickey: chouser: definitely good to have a branch, just for emergencies

12:30 chouser: oh, yes.

12:31 * rhickey hopes for a clean merge of new back into master

12:31 stuartsierra: rhickey: new patch up for #218

12:31 rhickey: stuartsierra: thanks!

12:31 stuartsierra: rhickey: you're welcome

12:33 * stuartsierra leaves for a celebratory sandwich

12:35 devlinsf: rhickey: Can you provide a deadline for input in the docs?

12:35 cemerick: rhickey: we stacked patches on top of 1.0.x for a while, but that certainly didn't require any coordination on your part

12:36 rhickey: devlinsf: now? :) Really, I have been taking out most of the docs. Docs go in docstrings or on the site, examples can go somewhere else too. I just want simple release notes

12:38 devlinsf: rhickey: Okay. If the decision is to remove the examples (and that seems to be what you did), then I have nothing to add at this time. Should examples just be posted to the list as needed? Inserted into the (seldom used) wiki?

12:42 rhickey: devlinsf: I think your motivation there was good. We definitely need a good set of examples for every function and a wiki-like place to put them. The clojure.org wiki is closed, but assembla might be a good place, so all contribbers could make examples. Needs someone to spearhead it...

12:44 * stuartsierra returns with sandwich

12:44 rhickey: devlinsf: I did move the pre/post docs to the clojure.org site http://clojure.org/special_forms

12:45 devlinsf: rhickey: Cool. Lemme think about stepping forward with the exampels effort.

12:45 rhickey: Holidays & all

12:45 jasapp: devlinsf: if you need some help with examples, I'd be happy to contribute

12:45 rhickey: devlinsf: right, that ould be great - just propose on clojure-dev first for input, we need to pay some attention to the assembla wiki structure (I haven't)

12:46 stuartsierra: also hard to keep that sort of thing current

12:47 rhickey: stuartsierra: playing with ant dist on clojure - should .gitignore be in the zip?

12:48 devlinsf: rhickey: I would need my membership bumbed to member for core, btw

12:48 rhickey: Only contrib right now

12:48 rhickey: devlinsf: done

12:48 devlinsf: rhickey: thanks

12:50 * rhickey realizes all the cruft in his clojure dir will end up in the dist :(

12:51 stuartsierra: rhickey: I think so. Maybe I'm wrong.

12:51 rhickey: is it in the repo?

12:51 stuartsierra: Yes.

12:51 rhickey: ok, then should be in there

12:52 * rhickey gets sandwich

12:52 stuartsierra: I tried to make ant dist include everything that is in a git clone, except .git/

12:52 Plus clojure.jar of course

12:52 replaca: Q: does (count "hello") operate on the string directly (like (.length "hello")) or does it convert to a seq first?

12:53 chouser: replaca: direct

12:53 so, O(1) not O(n)

12:54 replaca: awesome, thx (whenever I have a .foo, I feel a little dirty :-))

12:56 rhickey: ok, 218 and 224 are up, master should be very close to 1.1

12:57 * rhickey really gets sandwich

12:58 lghtng: Keats: A thing of beauty is a joy forever.

12:58 stuartsierra: You get that sandwich, you.

13:00 technomancy: 225 would be a really simple fix for 1.1 as well; just found two overlapping defs yesterday in core.clj

13:00

13:07 devlinsf: technomancy: Re: #225 I like bound-fn? better.

13:09 defn: Is there any clerical work that one could contribute to clojure/clojure-contrib? My chops aren't there yet but I've been thinking about sending in the form

13:11 devlinsf: defn: There is a TON of documentaion & examples to generatte

13:11 jasapp: hey, I'd love to help too

13:13 technomancy: devlinsf: it's not a predicate though

13:16 defn: devlinsf: cool, ill send in the form today

13:18 replaca: Best doc string ever:

13:18 ,(doc future-cancel)

13:18 clojurebot: "([f]); Cancels the future, if possible."

13:18 devlinsf: technomany: Hmmm... then what was your motivation in having ? in the name

13:18 technomancy: Hmmm... then what was your motivation in having ? in the name

13:20 technomancy: devlinsf: it returns a predicate

13:22 devlinsf: technomancy: Okay, it's a factory

13:30 rhickey: technomancy: I'm fixing now

13:34 * stuartsierra closed ClojureChanges google doc to further editing

13:34 rhickey: wow, so no one uses subseq?

13:35 stuartsierra: wazzat?

13:35 ,(doc subseq)

13:35 clojurebot: "([sc test key] [sc start-test start-key end-test end-key]); sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true"

13:35 replaca: rhickey: I just threw you a minor patch for doc string formats - makes the autodoc look cleaner

13:35 technomancy: rhickey: I think subseq uses the version of bound-fn that wins

13:35 rhickey: ah. makes sense

13:36 replaca: what patch #?

13:36 replaca: ticket 226

13:36 stuartsierra: ~#226

13:36 clojurebot: excusez-moi

13:36 stuartsierra: ~ticket 226

13:36 clojurebot: excusez-moi

13:37 replaca: stuartsierra: that was an answer to rhickey, not a question :-)

13:37 stuartsierra: I know.

13:37 I was trying to remember how to make ClojureBot print URLs for tickets

13:38 rhickey: erm, whitespace errors - what do they mean?

13:38 technomancy: stuartsierra: I think clojurebot just hasn't polled the ticket list yet

13:38 syntax is right

13:38 replaca: stuartsierra: there needs to be a better way to find out how clojurebot does this or that

13:39 rhickey: hmm, dunno. I did change a tab to a space, maybe that's what it's complaining about (or maybe it didn't clean up a line ending when I added a newline)

13:39 lemme check

13:39 rhickey: replaca: I ignore them, just wondered if they matter

13:40 replaca: any reason why clojure.core is by Unknown?

13:41 and clojure.main

13:41 stuartsierra: I think whitespace errors means you have spaces at the end of a line.

13:41 It's a warning generated by git.

13:41 rhickey: stuartsierra: right - should I care about it?

13:42 technomancy: there are a bunch of optional hooks in .git/hooks that get activated if you chmod them to executable

13:42 one of them will keep you from committing if you have trailing whitespace

13:43 stuartsierra: rhickey: probably not

13:43 replaca: rhickey: yeah, it's just the line endings

13:44 replaca: I think because of ticket 130. Core is the one place I can't work around that

13:46 lithper: Hello... anyone home?

13:46 I decided to try Clojure today and I'm not off to a good start.

13:46 Running a freshly downloaded version 1.0.0 on Snow Leopard I get this:

13:47 [ron@mickey:~/Desktop/clojure_1.0.0]$ java -cp clojure.jar clojure.lang.ReplException in thread "main" java.lang.NoClassDefFoundError: clojure/lang/Repl

13:47 Caused by: java.lang.ClassNotFoundException: clojure.lang.Repl

13:47 at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

13:47 at java.security.AccessController.doPrivileged(Native Method)

13:47 at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

13:47 at java.lang.ClassLoader.loadClass(ClassLoader.java:315)

13:47 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)

13:47 at java.lang.ClassLoader.loadClass(ClassLoader.java:250)

13:47 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)

13:47 stuartsierra: lithper: pastebin please :)

13:48 scgilardi: that's an unfortunate bug in the readme.txt. clojure.jar doesn't exist in the 1.0.0 distribution. please substitute the corresponding jar with a numeric suffix. java -cp clojure-1.0.0.jar clojure.lang.Repl

13:48 lithper: Sorry, I don't use IRC very often.

13:48 Oh... duh.

13:48 Thanks.

13:49 The quickstart on the web page has the same "bug" BTW.

13:49 scgilardi: some more info here: http://groups.google.com/group/clojure/browse_thread/thread/bbdb4adf1fd11001/510430e7da8fd7f6?lnk=gst&q=gilardi#510430e7da8fd7f6

13:50 replaca: lithper: we're in the process of pushing out 1.1 which should be a little cleaner about how things are documented, but Clojure is young yet!

13:51 lithper: No worries, I know how it goes.

13:51 LauJensen: How do I make this work? (ns test (:gen-class :main true :name test)) (def inst (test.)) ?

13:51 Simply put, I want to extend a class with gen-class and instantiate it

13:52 lithper: @scgilardi: that post says that the entry point should be clojure.main, not clojure.lang.Repl

13:52 stuartsierra: LauJensen: Use (Class/forName "test")

13:52 scgilardi: is there a ticket already for ensuring the quickstart at the website and the readme.txt work out of the box with 1.1?

13:52 stuartsierra: scgilardi: don't know, but my "ant dist" creates a ZIP containing "clojure.jar"

13:52 scgilardi: lithper: right, clojure.main is the more modern entry point. I recommend you use it. both will work.

13:53 lithper: Cool. All else being equal, less typing is better :-)

13:53 rhickey: scgilardi: we just deprecated Repl

13:53 LauJensen: stuartsierra: I get this when I call compile on the ns, java.lang.ClassNotFoundException: test$loading__6213__auto____2583

13:53 scgilardi: stuartsierra: ok, that should get us either all the way tehre or mostly.

13:53 rhickey: I saw that. Nice.

13:54 LauJensen: does it help to :import that class? Also, it's not going to work until you've aot compiled the genclassed namespace and have it available on classpath.

13:55 chouser: LauJensen: you can't use a class that has no package name

13:55 stuartsierra: LauJensen: You also can't instantiate a class that hasn't been compiled yet.

13:55 chouser: you need at least lau.test

13:55 LauJensen: Really, why ?

13:55 stuartsierra: So you can't do (ns foo (:gen-class)) (def instance (new foo))

13:56 lithper: BTW, I presume that since clojure is a Java program, I can run it in a browser, yes?

13:56 rhickey: so, do we want clojure.jar in the zip or clojure-1.1.0.jar?

13:57 sbenitezb: versioned is better

13:57 lithper: @rhickey: why not just use a symlink?

13:57 stuartsierra: I couldn't decide. The readme says "clojure.jar", so that's what I used.

13:57 lithper: Yes, Clojure can run in a browser, subject to some Java security wrangling.

13:57 scgilardi: I think we already fixed the problem where where 1.0 calls itself 1.0.0- on launch when there's no qualifier (alpha, new, etc.). It shouldn't print the trailing -.

13:57 stuartsierra: lithper: symlinks aren't cross-platform.

13:57 chouser: lithper: clojure uses a custom classloader by default for non-AOT-compiled code, which won't work without signing the .jar in a normal browser Java environment.

13:58 lithper: OK, sounds like more than I want to get into at the moment. I'll just run it standalone for now.

13:58 Thanks!

13:58 sbenitezb: shouldn't it be treated as .so files, so they don't clash if multiple versions live in the classpath?

13:58 rhickey: the directory it is in has a version number in it

13:59 bagucode: technomancy: Hi, saw the conversation between you and David on the mailing list. Moved setFork in my leiningen so that it's only used when native libs are used.

13:59 KirinDave_: does anyone have a really outstanding monad tutorial I could go over?

13:59 rhickey: since the normal ant build copies to clojure.jar, I think we should go with that

13:59 KirinDave_: I'm having a lot of trouble getting them.

13:59 rhickey: any issues with that?

14:00 KirinDave_: monads are not an important part of Clojure, if that matters

14:00 KirinDave_: rhickey: I keep running into people using them.

14:00 rhickey: And their code seems very short compared to how i'd normally have to write what they're doing.

14:01 scgilardi: rhickey: I like that plan: using clojure.jar without a version number qualifier in the distributed zip.

14:01 LauJensen: I've added the package name now, so one.test, and calling compile actually generates about 10 class files, including one.test.class, but when I instantiate it, I get a NoClassDefFound error, what gives?

14:02 rhickey: KirinDave_: I'm not trying to discourage you - go for it

14:02 chouser: LauJensen: you have your "classes" output directory in you classpath?

14:02 LauJensen: Yes sir

14:03 bagucode: KirinDave_: Have you looked at this? http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/

14:03 scgilardi: also http://intensivesystems.net/tutorials/monads_101.html

14:03 KirinDave_: bagucode: I do...

14:03 err, I have

14:04 and I sort of get the structure of a monad

14:04 But I still can't identify what "mystery" in part 2 is.

14:04 When i run it, it always returns nil no matter what.

14:04 LauJensen: Chouser, I got it

14:05 First remove the instantiation, then compile, re-insert it, re-compile

14:05 stuartsierra: LauJensen: You really shouldn't try to instantiate something in the top-level of the namespace that defines it.

14:06 bagucode: KirinDave_: Well, I just remembered seeing that tutorial (and the one that scgilardi linked). I don't really get it either ;) and I get along just fine in Clojure anyway.

14:06 LauJensen: stuartsierra: I was mimicing a Java example - How else would you do iit?

14:06 KirinDave_: I want to understand this code: http://intensivesystems.net/tutorials/code/web_session.clj

14:06 That's some hardcore stuff.

14:06 stuartsierra: LauJensen: Provide a constructor function that returns a new instance.

14:07 Remember, compiling a .clj file is equivalent to executing it.

14:07 * rhickey wishes github kept download stats

14:07 stuartsierra: All your top-level defs get evaluated.

14:08 got to go

14:09 LauJensen: stuartsierra: Am I mixing up terms here? Calling compile AOT compiles right?

14:09 rhickey: I guess we have to stick with googlecode for downloads with stats?

14:10 chouser: LauJensen: compiles and executes, as it must.

14:12 LauJensen: kthx

14:12 rhickey: You want to know how many clones, or how many does regular downloads?

14:13 rhickey: LauJensen: downloads

14:13 of the zip release

14:14 LauJensen: Yea I think you need to put it somewhere else

14:16 rhickey: so with the branch in the name, is it going to end up being clojure-1.1.0-1.1.x-RELEASE.zip?

14:16 chouser: yikes

14:16 rhickey: right

14:16 chouser: can we assume RELEASE if it's not SNAPSHOT?

14:17 maybe that's not the maven way

14:17 rhickey: I'm more concerned about 1.1.0-1.1.x

14:17 the maven way, that's what I am clueless about

14:18 chouser: I suspect I violated something by putting the branch name where "alpha" used to be. But people who seemed to know maven didn't seem to mind

14:18 but if it were still "alpha", what would be there for release? "release"?

14:18 clojure-1.1.0-release-RELEASE.zip?

14:19 scgilardi: chouser: I think "qualifier" is a generic name for a reason.

14:20 when downloading jars using maven, ones with specific versions do not have a suffix. for example: spring-core-2.5.6.jar

14:20 s/specific/final

14:24 rhickey: so now in the 1.1.x branch I should change qualifier to what?

14:25 for the release candidates and then release

14:25 chouser: ah! that's it.

14:25 rc0, rc1 for release candidates?

14:25 then ... blank for release?

14:25 rhickey: or just rc and I can number the zips?

14:26 scgilardi: final release should have no qualifier

14:26 rhickey: that means missing or qualifer= nothing?

14:27 what a .properties file comment?

14:27 #?

14:27 bagucode: #

14:28 rhickey: hrm, clojure-1.1.0-${clojure.version.qualifier}.jar

14:28 when missing

14:29 scgilardi: that's a weakness in our expansion. we should do some kind of if ${clojure.version.qualifier} 1.1.0-=${clojure.version.qualifier} else 1.1.0

14:29 s/=//

14:30 rhickey: ok when qualifier= nothing

14:31 release candidate - interim= ?

14:32 clojure-1.1.0-rc0-SNAPSHOT.zip?

14:32 scgilardi: looks like interim should be false

14:34 maybe: false for the one build that is rc0 and then true again until we generate rc1

14:43 dysinger: chouser: rhickey scgilardi the convention in maven repos is SNAPSHOT means just that and that normal releases don't have SNAPSHOT or anything else tagged onto them - just artifactId & version

14:44 Is it necessary to have an RC ?

14:45 We've all been following 1.1 snapshots for a long time

14:45 What I meant is that it could just stay SNAPSHOT until final

14:46 rhickey: http://clojure.googlecode.com/files/clojure-1.1.0-rc0.zip

14:46 chouser: It's possible that naming an RC would get some of the 30% of users who have been on 1.0 to try 1.1 and perhaps find corners with bugs that the rest of us don't use.

14:46 dysinger: true

14:47 rhickey: dysinger: actually 30-40% of us haven't been

14:47 dysinger: ah

14:47 rhickey: people like their downloads

14:48 chouser: also can help test the .zip itself

14:48 dysinger: The way we do it on our team - and I feel like it's a solid git workflow is that master is production release code - branches are created for new work (sort of like "new" is now) - branches are created for release candidates also - then when things are stable we merge back to master.

14:48 scgilardi: readme.txt: To Run java -cp clojure.jar clojure.lang.Repl :)

14:48 rhickey: there is now a 1.1.x branch

14:49 scgilardi: nw you tell me! :)

14:51 dysinger: What I meant by the git workflow is that it's common to create a 1.1.x branch from the 1st day in git projects, then only merge back to master when it's stable and released.

14:51 LauJensen: rhickey: btw, regarding funding I had an idea - For the corporate contributors, couldn't you put up some pricetags for "1 week" "2 weeks" "1 month" "3 months" etc, I think that would motivate people to commit and then they could officially say that they supported Clojure for 1, or 52 weeks or such.

14:51 dysinger: that way people checking the code out can see that "master" means just that "the gold standard"

14:52 rather than active development

14:53 rhickey: dysinger: doesn't master just mean last relase then?

14:53 dysinger: yes

14:53 rhickey: meh

14:53 dysinger: :)

14:54 master is just another branch - depends on how you look at it.

14:55 Chousuke: git seems to have a rather interesting branch model

14:55 there are no branches for releases as far as I can tell

14:55 only tags.

14:55 I mean git the project.

14:56 then there's a maintenance branch and master and "next". hmm.

14:56 dysinger: I only use branches for active development

14:57 I use master, test and next

14:57 and other topic branches

14:57 headius: I always commit to master, but I'm still an svn user at heart

14:57 dysinger: master is the gold standard and base for branches, test is topic branches that need review/testing/etc, next is code that's going out the door next release

14:57 headius: if we didn't do it this way, we'd have a "dirty" branch everyone uses

14:57 the-kenny: master is the main-branch for development imo.

14:58 dysinger: that's svn thinking IMO

14:58 headius: but always one branch...unless you have hundreds of devs, everyone using their own branch is a major PITA

14:58 the-kenny: I use branching for developing additional "modules" while I work on master at the same time

14:58 LauJensen: rhickey: At the very bottom of this page, there's a broken link to trampoline: http://clojure.org/functional_programming

14:59 dysinger: headius:

14:59 Chousuke: did all the fixes for 1.0.0 even get applied to the 1.0.x branch? :/

14:59 dysinger: neat gem trick yesterday

14:59 that will be useful for us.

14:59 chouser: Chousuke: I don't know if any were written

15:00 Chousuke: chouser: weren't there several patches for 1.0 in the ticket system? :/

15:00 at least I had one that applied both to master and 1.0

15:00 headius: dysinger: I'm talking to some maven repo folks about setting up a transparent gem server that automatically presents all maven artifacts as gems

15:00 likely using my code as a seed

15:01 dysinger: neat

15:01 Chousuke: oh well, I suppose it'll take a few more release cycles until things get sorted out for real .)

15:01 chouser: Chousuke: I dup'ed several tickets over to 1.0, but I never tried applying the same patch and don't remember seeing any fresh patches applied to those tickets.

15:01 headius: I wanted this because I wanted to build off technomancy's stuff and make a tighter two-way integration of jruby and clojure, plus nice ruby wrappers for clojure collections for rubyists to use

15:02 rhickey: any other fixes for rc1 before I push it to googlecode and announce on ggroup?

15:02 dysinger: y it's neat

15:02 headius: project #153, whenever I get around to it

15:02 dysinger: headius: we have jruby / rails ui & clojure backend (systems) code (so does flightcaster & runa)

15:02 so it's totally useful :)

15:03 Chousuke: rhickey: there's a slight doc problem in clojure.test I think

15:03 rhickey: it still refers to a solved bug on google code

15:03 LauJensen: Yea rhickey, I still think you need (nth idx coll) instead of (nth coll idx) :)

15:03 rhickey: Chousuke: that's not going to get fixed

15:04 chouser: dysinger: all in the same JVM instance?

15:04 dysinger: no different clusters

15:04 chouser: yeah, ok

15:04 dysinger: but mvn2gem would be useful for sharing code

15:05 between clojure & jruby

15:05 now we just ned gem2mvn (noo!! it burnses!)

15:05 scgilardi: rhickey: the changes.txt doesn't mention the deprecation of clojure.lang.Repl, clojure.lang.Script in the deprecation section. I put in a ticket.

15:05 lpetit: I did not follow the 1.1 stuff closely, is master still the target of the commits for 1.1, or is it done in a branch ?

15:06 rhickey: http://clojure.googlecode.com/files/clojure-1.1.0-rc1.zip

15:07 scgilardi: ok

15:07 lpetit: depends on the change - the one scgilardi just pointed out should be a patch against the 1.1.x branch

15:09 lpetit: rhickey: ah ok, so now 1.1.x

15:20 chouser: dysinger: is disclojure.org yours?

15:20 dysinger: no

15:21 he's on twitter - I'm not sure who it is yet

15:21 chouser: oh. his name's right there at the bottom. Antoni Batchelli

15:21 maacl: Has anyone tried using couchdb-lucene from Clojure?

15:21 chouser: dunno how I missed that before

15:25 dysinger: maacl technomancy and I used that combo before

15:28 maacl: dysinger: Did you use any of the libs on github like clutch? I can't find any libs that appear to support it.

15:31 replaca: chouser: Toni is a clojure developer here in SF

15:34 dysinger: maacl: there is clutch (haven't tried) - we used clojure-couchdb

15:35 cemerick: maacl: we like clutch here, FWIW

15:35 it's got a view server, which is handy

15:37 mudphone`: chouser: disclojure.org is anthony batchelli

15:38 maacl: cemerick: dysinger: But neither supports interacting with couchdb-lucene right?

15:38 chouser: thanks guys. It's a great service.

15:38 dysinger: maacl: correct

15:38 cemerick: maacl: I've never looked at couchdb-lucene at all. Haven't noticed anything about in clutch *shrug*

15:38 dysinger: maacl: couchdb-lucene is just a canned way to index couchdb docs

15:38 cemerick: I'm holding out for FTI baked in to couchdb

15:39 maacl: dysinger: so how did you solve that ? http-clj or ?

15:39 dysinger: cemerick: I saw some native erlang indexing on github the other day - haven't tried it yet.

15:39 cemerick: dysinger: yeah, it's coming. Saw chatter about it in #couchdb a couple months ago, so I figured I'd not bother with couchdb-lucene.

15:40 maacl: cemerick: Ok, so for now you just stick to supporting exact searches?

15:40 cemerick: hopefully we can get it without a store-format change

15:41 dysinger: maacl: our experience was that it just worked (couchdb-lucene)

15:41 cemerick: maacl: we don't have any pressing indexing requirements right now, no. It would definitely be handy, and not having it is almost to the point of being annoying, but we've got bigger fish to fry.

15:41 dysinger: and we used clojure to interact w/ couchdb via HTTP REST

15:41 cemerick: the clojure view server was way more of a win for us than indexing

15:42 dysinger: cemerick: github.com/bdionne/indexer

15:42 cemerick: is that public (clojure view server code) ?

15:42 cemerick: dysinger: http://github.com/tashafa/clutch/

15:43 dysinger: ah

15:43 I thought that was a client - not paying attention ....

15:43 cemerick: it's both

15:43 double the value, baby!

15:43 ahem.

15:44 lghtng: is rdfm in clojure?

15:44 chouser: lghtng: it's a separate lib

15:44 lghtng: ok

15:44 maacl: dysinger: ok, thks

15:54 chouser: LauJensen: thanks for reporting that broken link

15:54 LauJensen: np

15:55 chouser: it's fixed

15:55 LauJensen: Good - So I can finally get some trampoline action

15:56 About nth, am I the only one who thinks it should be changed?

15:57 chouser: I think it came up on the ggroup a while ago

15:59 lpetit: ,(doc nth)

15:59 clojurebot: "([coll index] [coll index not-found]); Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences."

16:00 chouser: ok, there were a bunch of links I had missed in the Features section before. Those should be fixed now.

16:00 LauJensen: Good job

16:01 chouser: nth has the same arg-order as get

16:02 scgilardi: the doc seems to imply it works on O(1) time for all items mentioned except sequences. It's O(n) for (at least) Lists too, isn't it?

16:03 chouser: yeah, might be worth saying "for lists and sequences."

16:05 lpetit: ,(doc get)

16:05 clojurebot: "([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present."

16:06 lpetit: ,(get [:a :b :c] 1)

16:06 clojurebot: :b

16:06 lpetit: could the doc for get use something different than map as arg name ?

16:06 scgilardi: clojurebot adopting a 'tude or was he framed

16:07 lpetit: ~source get

16:07 KirinDave_: Haha

16:07 Helpful?

16:07 What is clojure.lang.RT?

16:08 the-kenny: clojurebot: clojure.lang.RT

16:08 clojurebot: clojure is cheating

16:08 hiredman_: R(un)T(ime)

16:08 technomancy: KirinDave_: lots of the basic fns in clojure.core are wrappers around RT

16:08 hiredman_: ~source c.l.RT

16:09 KirinDave_: Haha, man

16:09 I love reading Clojure's source code, just to see java's syntax squeal like a pig.

16:11 lpetit: What's the future name of the protocol the arg named "map" in get's arglist will have to comply to ?

16:12 chouser: lpetit: probably Associative or something related

16:12 hiredman_: possibly something like the ILookUp interface

16:12 lpetit: chouser: yeah, I thought so, but currently ITransientAssociative just implements assoc()

16:12 chouser: oh, hiredman_'s probably closer

16:12 lpetit: ye

16:13 s

16:13 chouser: I keep forgetting about ILookUp

16:14 lpetit: but would changing the doc from "([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present." to "([lookup-able key] [lookup-able key not-found]); Returns the value mapped to key, not-found or nil if key not present." would not necessary be an improvement, would it ? :-$

16:14 s/would//

16:16 hiredman_: "this started out as a very specific function, now it is very generic, check the source"

16:17 lpetit: :)

16:19 hiredman_: ,(doc reify)

16:19 clojurebot: I don't understand.

16:19 hiredman_: of course not

16:20 ,(alter-meta! #'get assoc :doc "magic")

16:20 clojurebot: {:ns #<Namespace clojure.core>, :name get, :file "clojure/core.clj", :line 954, :arglists ([map key] [map key not-found]), :doc "magic"}

16:20 hiredman_: ,(doc get)

16:20 clojurebot: "([map key] [map key not-found]); magic"

16:20 lpetit: oh

16:22 hiredman_: http://github.com/trotter/bert-clj <-- ooh

16:27 lpetit: What's the keyboard shortcut in emacs for switching focus from an editor to the REPL, and then back from the REPL to the editor ?

16:27 lghtng: C-x o

16:27 the-kenny: Or with slime-selector: C-c s r

16:28 (Slime selector is a really cool tool)

16:29 lpetit: it's the same shortcut for going in the REPL, and then later back to the editor ?

16:29 lghtng: its the shortcut for 'other window'

16:29 lpetit: the-kenny: what does slime-selector offer, apart the fact it's more keys to type ?

16:30 the-kenny: lpetit: It's a tool to switch between multiple lisp-related things.

16:30 lpetit: lghtng: it's like switching apps in the X system ?

16:30 the-kenny: For example open lisp-files, *inferior lisp*, the repl, help, slime connections, slime threads

16:30 lpetit: the-kenny: ok, so maybe you have to repeat it to go to the right thing ? (just trying to understand)

16:30 lghtng: there's a few ways, depending on your style: C-x o just hops the cursor to the other window, your slime selector is slime centric, there's also C-x b, which gives you a buffer menu

16:31 and theres a few things like ido and ibuffers as if that werent enough :D

16:31 the-kenny: iswitchb ftw :)

16:32 lghtng: have it YOUR way :D

16:32 lpetit: lghtng: ok, one last question: if you have several buffers open for edition, and one for the REPL, you may have to hit o several times for going from "editor A" to the REPL ?

16:32 the-kenny: lpetit: No

16:32 Use C-x b for that

16:32 lghtng: yeah, i saw a video where a guy had a shortcut for opening a repl ON THAT FILE, but i dont recal it

16:32 lpetit: I was asking because I want to either find out the standard way to do that in Eclipse, or implement an additional keyboard shortcut in ccw in order to provide this to ccw users

16:33 lghtng: there are emacs shortcuts for eclipse

16:33 its a setting or preference, i think

16:33 rullie: i doubt eclipse gives you a mini buffer

16:34 lghtng: no, but the keybindings are there

16:34 lpetit: lghtng: right for the shortcuts, but I tend to follow what Eclipse offers by default, and for whatever additional command that does not have an eclipse equivalent, I fall back to emacs like (not wanting to reinvent yet another way to trigger a command)

16:34 lghtng: also, there's a sbcl plugin for eclipse that does have a repl, might look at what they do

16:35 lpetit: rullie: I don't know exactly all the beauties a mini buffer can do in emacs, but what may come close in eclipse is the contextual menu

16:35 ?

16:35 the-kenny: technomancy: How often do you push new versions of swank-clojure up to elpa?

16:35 lghtng: theoretically, you can use clojure to simply make eclipse do whatever you want :D

16:36 dont you have access to the eclipse libraries with the repl?

16:36 lpetit: lghtng: for clojure, there's already emacs, netbeans enclojure. So when I want to add a functionality, I first look at how it's done "on the surface", so that users being forced to do the switch do not have to re-learn what they should not have to: keyboard shortcuts

16:37 lghtng: i refer you to #emacs for keybinding debates

16:37 technomancy: the-kenny: very infrequently, but the elisp portions of swank-clojure are not very interesting. it's the jar that contains all the goodies.

16:37 doublindirection: lpetit, closest thing to minibuffer in eclipse is probably "Quick Access" Control-3 is the shortcut

16:37 lpetit: lghtng: not sure I'm following you, but the answer is it depends on what actual dependencies you've set in the project's classpath. ccw REPLs start new JVMs with the project's settings.

16:38 the-kenny: technomancy: okay.. how often do you push the .jar to clojars, then? ;)

16:38 lpetit: lghtng: no thanks for #emacs, it's already too confusing, I'm going to see what enclojure provides (hopefully it will already provide a shortcut ;-p )

16:38 technomancy: lpetit: C-c C-z goes from .clj files to the repl; I don't think there's a "most recent clj file" command.

16:38 lghtng: right, i think, im just saying that once you have an eclipse repl, then cant you just call the appropriate eclipse class or method whatever, like you do in emacs?

16:39 technomancy: the-kenny: well I haven't hacked on swank-clojure at all since clojars was made public

16:39 lpetit: technomancy: ok thanks, that's probably even closer to what I was after. In eclipse, the problem of going back is (alas) not a problem since it is very uncommon to have several editors open side by side

16:41 lghtng: like (add-hook 'clojure-mode-hook '(

16:41 etc

16:41 cant you do something like that at the eclipse repl?

16:42 i think the J editor for ABCL does something similar, but i dont recall

16:48 lpetit: ok, cool, nothing to code: Eclipse provides Ctrl + F7 to navigate between the last 2 views having received the focus

16:48 lghtng: ex. (define-key clojure-mode-map "%C-C\C-e" 'lisp-eval-last-sexp))) or (define-key clojure-mode-map "%C-x " '(switch-to-buffer-other-window (*slime-repl clojure*)))

16:48 oh, ok

16:50 polypus: do you guys know how to set the emacs cursor's foreground color?

16:50 LauJensen: æl,h

16:50 oops

16:51 polypus: some probably do, but the guys at #emacs are really the experts, usually you get quick answers

16:51 polypus: k ty

16:51 lghtng: another way is to do it globally (global-set-key (kbd "C-xr") '(switch-to-buffer-other-window (*slime-repl clojure*)))

16:52 polypus: M-x apropos <ret> faces

16:53 and yes, Lau is right

17:01 KirinDave_: Is there any work on getting GCLS entries for clojure up?

17:02 chouser: Gloucester County Library System?

17:02 Golden Crown Literary Society?

17:02 Graduate College - Life Sciences?

17:02 sbenitezb: probably garbage collector something?

17:03 KirinDave_: http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=scala&lang2=hipe&box=1

17:03 Great Computer Language Shootout. C'mon.

17:03 Not that i really like the practice.

17:03 But people keep asking me

17:03 technomancy: KirinDave_: isn't that pretty heavily biased against hotspot?

17:04 _mst: could we just call out to the java versions and say we're done? :)

17:04 KirinDave_: technomancy: They bring it to steady state.

17:04 _mst: sort of in the clojure spirit of pragmatism...

17:04 chouser: _mst: nice

17:04 KirinDave_: technomancy: All the java versions have that option.

17:05 chouser: just like clojure already has xml parsers, IO and GUI infrastructure, it already has the shootout covered. :-)

17:05 KirinDave_: So I take it that's a "No."

17:06 Lots of people who are Scala users keep asking me what Clojure's performance is like.

17:06 Like I know, or something. :)

17:06 chouser: point them at _ato's widefinder blog and say "faster than scala".

17:06 _mst: after recently being dragged along behind _ato's optimisation jag, I think I've had enough for a little while ;)

17:06 chouser: then shrug dismissively

17:06 KirinDave_: chouser: Link plz?

17:07 I mean seriously, there are people who might be willing to go from scala to clojure and that'd be very pleasant for me.

17:07 chouser: KirinDave_: http://tinyurl.com/y9e9jo6

17:07 KirinDave_: I am not against Scala persay, but I am not a huge fan of languages with huge hoops to go through for heterogenous data structures.

17:07 I'd rather do this upcoming proj in clojure than scala, but I need to get the majority on board with that.

17:17 danm_: KirinDave_: the trouble with scala for me, is the core language is too complex

17:17 what I like about lisp is how easy the core language is to "get"

17:17 KirinDave_: danm_: As an erlang developer I'm not complaining about that. :)

17:18 But I just hate having homogenous data structures. It's so lame.

17:18 danm_: I think erlang is more simple like clojure

17:18 KirinDave_: I don't.

17:18 The binary pattern matching syntax alone is a language unto itself. A cool language, mind you, but still.

17:18 danm_: it just doesn't have the overwhelming number of language features that scala has

17:18 chouser: rhickey: any desire to have merge and merge-with use transients?

17:18 the-kenny: Pattern Matching of erlang is one thing I miss in clojure

17:19 KirinDave_: the-kenny: Yeah.

17:19 chouser: ~pattern matching

17:19 clojurebot: Huh?

17:19 chouser: ~patterns

17:19 clojurebot: I don't understand.

17:19 chouser: ~google pattern matching clojure

17:19 clojurebot: First, out of 1770 results is:

17:19 brool » Pattern Matching In Clojure

17:19 http://www.brool.com/index.php/pattern-matching-in-clojure

17:20 hiredman_: ,(doc match)

17:20 clojurebot: Excuse me?

17:20 danm_: and working with a lisp has made me appreciate that less syntax is sometimes more ;)

17:20 hiredman_: I think there is some kind of matching macro in contrib these days

17:21 chouser: rhickey: or conj, for that matter.

17:21 danm_: chouser: nifty.

17:23 joshua-choi: I'm trying to decide something

17:23 I have a library called FnParse that basically generates PEGs

17:23 But it's pretty naive

17:23 I want to split it into two libraries:

17:23 Chousuke: chouser: Hmm, do you think anyone ever uses conj to add more than a few items? /:

17:24 joshua-choi: one being a packrat parser, and the other being a Parsec-like, mostly-LL(1) parser

17:24 chouser: Chousuke: yeah, perhaps not conj. :-)

17:25 joshua-choi: My question is, when I split my parsing library, should I create completely separate repositories (on GitHub), or should I keep them in the same library?

17:26 'Cause if I keep them together, then anyone who wants to use one would have to download (and build) the other...

17:26 And their usage is really different

17:26 Chousuke: I should probably read a bit more about parsing before I continue porting my reader to the new branch ;P

17:28 hiredman_: :/

17:28 Chousuke: or actually it's ported already. I just want to rewrite it to something a bit more flexible.

17:28 hiredman_: if you split fnparse I have no idea which part I use

17:28 joshua-choi: Yeah

17:28 hiredman_: Chousuke: nice

17:28 drewr: joshua-choi: I would do it gradually

17:28 joshua-choi: In either case, I definitely would document the differences between the two

17:28 Hmm

17:29 See, I don't see a way to reconcile the two styles of parsing that I need to use

17:29 drewr: split them within the current repo, demarcate, evolve, demarcate, etc.

17:29 joshua-choi: Demarcate?

17:29 Chousuke: since I already have a working reader written in clojure I hope I can avoid all the nasty java-related headaches I had initially ;/

17:29 drewr: joshua-choi: figure out where the boundaries are

17:29 joshua-choi: Hmm.

17:30 Chousuke: I think it'd be fine to have them in the same repo initially

17:30 if it turns out they really need to be separate, you can split them

17:31 joshua-choi: I'll leave the current version alone in any case

17:31 Hmm, maybe

17:31 drewr: Chousuke++

17:31 chouser: you can do releases as separate .zip or .jar files from a single git repo

17:31 joshua-choi: Is there a way to automate that?

17:31 chouser: probably. :-

17:31 :-)

17:31 joshua-choi: Do Ant or Maven or Leinegen (don't know how to spell it!) have any way to do that?

17:32 I'm wondering if this is a common thing to do

17:32 hiredman_: ant will for sure

17:32 ant is xml shellscripting, so you can do whatever

17:32 joshua-choi: I'm kind of afraid of Ant; don't know a thing about it

17:33 I was really happy when Leinegen (sp?) came out

17:33 Chousuke: Leiningen

17:33 just call it lein

17:33 joshua-choi: Lein-in-gen

17:33 tomoj: I'm still afraid of lein :(

17:33 * hiredman_ hasn't use lein yet

17:34 * drewr tried one time

17:34 joshua-choi: It looks really easy; at least, Clojars' documentation makes it seem so

17:34 drewr: actually a couple times

17:34 LauJensen: Aren't you guys trying to Clojuresque/Gradle yet? :)

17:34 joshua-choi: I haven't heard of that

17:34 tomoj: I'm ever more afraid of that, though for no good reason

17:34 hiredman_: I have a clojureql jar already

17:35 LauJensen: tomoj, it couldn't be simpler

17:36 hiredman_: just like I have a fnparse.jar (and had one forever until technomancy tried clojurebot and could get it to work with fnparse 2 so I had to get that, make a jar, and fix clojurebot to use it)

17:36 chouser: lein specs are in clojure and gradle are in groovy, right?

17:36 joshua-choi: Oh crap—you actually used FnParse 1 on ClojureBot?

17:37 hiredman_: I think it was 1

17:37 joshua-choi: I'm honored; but that was before monads and complex were added, which would have made your life easier

17:38 hiredman_: I doubt monads have ever made life easier

17:38 joshua-choi: They really do for defining parsers' semantics

17:38 hiredman_: I just do really simple parsing

17:39 somnium``: editing a project.clj and doing `lein deps` might be even easier than config.gem/rake gems install... will have to look as clojuresque

17:39 joshua-choi: Can Clojuresque do that sort of thing—build two JARs from different parts of the source tree?

17:40 hiredman_: http://github.com/hiredman/clojurebot/blob/master/hiredman/clojurebot/factoids.clj

17:41 technomancy: joshua-choi: leiningen doesn't support multi-module builds yet, but adding that is high on my list

17:41 joshua-choi: Wonderful

17:42 LauJensen: joschua, sure - Clojuresque is just a plugin for Gradle and Gradle does about everything conceivable

17:43 joshua-choi: Where would I find documentation to figure out how to do that?

17:44 LauJensen: sec

17:44 joshua-choi: hiredman_: Most of the places where you use fp/semantics would be clearer with fp/complex in FnParse 2

17:44 LauJensen: http://www.gradle.org/0.8/docs/userguide/userguide_single.html

17:44 and joshua-choi, see the 'Building the thing' section, http://www.bestinclass.dk/index.php/2009/12/clojureql-where-are-we-going/

17:45 hiredman_: I will remember that next time I write a rule

17:46 although, really, that file is just begging for some attention

17:46 mabes: how do you test for structure and value equality? Meaning, I want to make sure a function returns a vector of [1 2 3] not (1 2 3)

17:46 joshua-choi: Well, if you've already written it, and it's not heavily maintained, there's no point in changing it until you have to

17:46 mabes: ,(= [1 2 3] '(1 2 3))

17:46 clojurebot: true

17:46 joshua-choi: Use vector? I guess

17:47 mabes: hmm.. maybe clojure.test has something that like already...

17:48 somnium``: ,(== [1 2 3] '(1 2 3))

17:48 clojurebot: false

17:48 somnium``: though

17:48 joshua-choi: ,(== [1 2 3] [1 2 3])

17:48 clojurebot: false

17:48 somnium``: ah

17:48 ,(doc ==)

17:48 clojurebot: "([x] [x y] [x y & more]); Returns non-nil if nums all have the same value, otherwise false"

17:49 joshua-choi: ,(letfn [(matches-vector? [obj vec] (and (vector? obj) (= obj vec)))] (matches-vector? (1 2 3) [1 2 3]))

17:49 clojurebot: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn

17:49 joshua-choi: Eh?

17:50 Oh

17:50 ,(letfn [(matches-vector? [obj vec] (and (vector? obj) (= obj vec)))] (matches-vector? '(1 2 3) [1 2 3]))

17:50 clojurebot: false

17:50 joshua-choi: Anyways, thanks for everyone's help

17:51 devlinsf: chouser: ping

17:51 joshua-choi: I think I'll keep FnParse Cat and FnParse Hound (those are the names I decided, but if you have better names, let me know!) in the same repository

17:51 Ciao

17:56 hiredman_: ,((comp (partial every? true?) (juxt (comp (partial reduce =) (partial map type)) (partial apply =)) list) [1 2] [1 3])

17:56 clojurebot: false

17:56 hiredman_: ,((comp (partial every? true?) (juxt (comp (partial reduce =) (partial map type)) (partial apply =)) list) [1 2] [1 2])

17:56 clojurebot: true

17:56 hiredman_: ,((comp (partial every? true?) (juxt (comp (partial reduce =) (partial map type)) (partial apply =)) list) [1 2] (1 2))

17:56 clojurebot: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn

17:56 hiredman_: ,((comp (partial every? true?) (juxt (comp (partial reduce =) (partial map type)) (partial apply =)) list) [1 2] '(1 2))

17:56 clojurebot: false

17:57 hiredman_: ♥ juxt

17:57 devlinsf: :)

18:00 BrianB04: Good evening all.

18:30 defn: Doug McIlroy patented macros.

18:49 polypus: i'm gonna patent functions. bet nobody has yet

18:59 defn: Oooo, 1.1.0rc1

19:00 cark: ,(doc juxt)

19:00 clojurebot: "([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"

19:01 cark: hum

19:01 devlinsf: Start w/ a map. Good for preserving order

19:02 ,((juxt :a :b) {:a 1 :b 2 :c 3})

19:02 clojurebot: [1 2]

19:02 cark: ah that's interesting

19:03 devlinsf: Yeah, then you can move on to other operations, like a mapping operator

19:04 ,(map (juxt identity #(* % %)) (range 0 6))

19:04 clojurebot: ([0 0] [1 1] [2 4] [3 9] [4 16] [5 25])

19:04 bitbckt: Seems more like distributivity than juxtaposition.

19:05 devlinsf: The idea is that it is the "pair" of composition

19:05 juxtaposition & composition sound the similar :)

19:06 er, similar

19:07 bitbckt: The resultant pairs don't share a contrasting relationship. The word seems semantically wrong.

19:07 devlinsf: Hmm... interesting

19:08 Well, the functions are done "side by side"

19:48 Draggor: Any compojure folk in here willing to lend a helping hand?

20:16 replaca: bitbckt: suggest a better name - maybe in the group. I know Rich isn't completely happy with "juxt" either

20:18 bitbckt: replaca: I did - dist, or similar - and I will.

20:27 replaca: bitbckt: cool

20:43 wlr: bitbckt: http://clojure-log.n01se.net/date/2009-08-30.html#09:23-11:13

20:55 alexyk: is there a library function to dedup a sorted vector?

20:55 i.e. uniq on Unix?

20:56 devlinsf: distinct

20:56 ,(distinct [:a :b :a])

20:56 clojurebot: (:a :b)

20:57 alexyk: devlinsf: will it be efficient on a 10 million-length vector? I only want to dedup adjacents

20:57 devlinsf: Uhhh... I dunno

20:58 Never used it significantly over 10K

21:01 chouser: alexyk: it builds a set of all items seen

21:01 alexyk: chouser: so if I have a sorted vector, I'd probably be faster reduce'ing it, collapsing same runs, right?

21:02 chouser: probably

21:02 devlinsf: can you used a sorted set?

21:02 chouser: ooh, good question.

21:02 alexyk: devlinsf: is there such a thing? :)

21:02 chouser: ,(sorted-set 5 3 4 3 2 2 5 1 3 1)

21:02 devlinsf: Mathematically, no :)

21:02 clojurebot: #{1 2 3 4 5}

21:03 devlinsf: In JavaLand, yes

21:03 alexyk: interesting

21:03 ,(doc sorted-set)

21:03 clojurebot: "([& keys]); Returns a new sorted set with supplied keys."

21:03 devlinsf: Yeah, really handy w/ strings

21:03 chouser: it's a red-black tree

21:03 alexyk: ,(sorted-set 1 1 2 3 2 4 1 1 3)

21:03 clojurebot: #{1 2 3 4}

21:03 alexyk: cool

21:03 devlinsf: There's also sorted-set-by

21:04 ,(sorted-set-by (comp - compare) 1 1 2 3 2 4 1 1 3)

21:04 clojurebot: java.lang.Exception: Unable to resolve symbol: sorted-set-by in this context

21:04 devlinsf: ???

21:05 Uh... weird. Works in my REPL

21:06 ,(doc sorted-set-by)

21:06 clojurebot: I don't understand.

21:06 chouser: ,(reduce #(if (= %2 (peek %1)) %1 (conj %1 %2)) [] [1 2 4 4 5 5 5 5 6 6 8])

21:06 clojurebot: [1 2 4 5 6 8]

21:06 chouser: ,(reify Object)

21:06 clojurebot: #<sandbox$eval$reify__4913 sandbox$eval$reify__4913@731e16>

21:07 chouser: devlinsf: I think clojurebot's using an old versions of the 'new' branch

21:07 devlinsf: Oh

21:07 chouser: at the moment

21:07 ,*clojure-version*

21:07 clojurebot: {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"}

21:07 devlinsf: Okay, I'm not crazy

21:07 At least, not for this reason

21:07 chouser: :-)

21:10 devlinsf: chouser: Hey, you mentioned you had a chance to review my map docs

21:11 chouser: I did. Do you know about 'empty'?

21:11 devlinsf: I'm playing around with some other higher-higher-order functions, and wold like to know what you think of the first batch

21:11 empty?

21:11 Ah

21:11 That could help

21:12 chouser: I wasn't sure, but might that remove the need for the sorted vs unsorted fns

21:12 ?

21:13 devlinsf: Hmmmm... seems to

21:13 I like it

21:13 No

21:13 It fails the following test

21:13 (let [s (sorted-set-by (comp - compare) 1 3 4)] (into (empty s) s))

21:14 It doesn't preserve the comparator

21:14 chouser: hm. I bet it's supposed to.

21:14 devlinsf: That would work for me

21:15 rhickey: ping

21:17 chouser: Did the visitors work, though?

21:17 chouser: http://www.assembla.com/spaces/clojure/tickets/128

21:18 I haven't had a chance to try them yet, but I'm sure they do.

21:18 devlinsf: chouser: I'm working on a more general concept

21:22 chouser: http://fulldisclojure.blogspot.com/2009/12/intorducting-same.html

21:33 chouser: 'same' is built directly on visitor?

21:34 devlinsf: no

21:34 Same idea

21:34 Same only needs a return fn, because the visit fn is identity

21:35 I added some gists in the past few minutes, sorry if it was confusing

21:37 chouser: oh, I had js off. :-)

21:38 devlinsf: Still using lynx?

21:38 :)

21:38 chouser: firefox + noscript. love it.

21:38 devlinsf: Ah

21:48 alexyk: is there a pill I can take to remember to destructure map as (fn [[k v]] ...), not (fn [k v] ...)? third time, third 15 mins spent today...

21:49 cp2: (fn [k v] ...): k, v are just normal parameter

21:49 s

21:49 there is no desctructuring going oon

21:50 alexyk: I know, I know. 3rd time today I know. :)

21:50 it's just the dumbness is recurrent.

21:50 cp2: just remember the destructured params need to be in their own vector

21:50 ugh, this keyuboardd drives me nuts

21:50 alexyk: it's easy for you to say, just

21:51 I need a funny verse to remember

21:51 devlinsf: alexyk: Just keep hacking

21:51 alexyk: You'll get it

21:51 cp2: agreed

21:51 alexyk: does Common Lisp have same destructuring as Clojure?

21:53 * alexyk just curious

21:55 jasapp: it has some destructuring, but not nearly as much

21:55 and it's not as clean, in my opinion, either

21:55 chouser: it's got destructuring-bind, but that's about multiple return values, right?

21:56 _mst: multiple-value-bind was return values

21:56 one of those features you rarely use because you fall asleep while typing it out :)

21:56 chouser: heh

22:18 alexyk: chouser: turns out I need the lengths of the runs, i.e., I need run length encoding. 1 1 1 2 2 2 3 3 3 4 4 5 5 5 5 5 => [1 2] [2 3] [3 3] [4 2] [5 5]. What's the fastest way to produce that from an *unsorted* vector?

22:19 is there a sorted multi-set? :)

22:24 durka42: i thought sets don't have an order at all

22:24 alexyk: durka42: ,(doc sorted-set)

22:24 ,(doc sorted-set)

22:24 clojurebot: "([& keys]); Returns a new sorted set with supplied keys."

22:24 devlinsf: durka42: Mathematically, yes

22:25 * durka42 stands corrected

22:28 * durka42 says nothing about "fastest" but

22:28 durka42: ,(let [v [1 5 3 3 2 4 5 5 4 5 1 2 1 2 3 5]] (map #(vector (first %) (count %)) (vals (group-by identity v))))

22:28 clojurebot: java.lang.Exception: Unable to resolve symbol: group-by in this context

22:28 durka42: ,(use 'clojure.contrib.seq-utils)

22:28 clojurebot: nil

22:28 durka42: ,(let [v [1 5 3 3 2 4 5 5 4 5 1 2 1 2 3 5]] (map #(vector (first %) (count %)) (vals (group-by identity v))))

22:28 clojurebot: ([1 3] [2 3] [3 3] [4 2] [5 5])

22:30 devlinsf: ,(let [v [1 5 3 3 2 4 5 5 4 5 1 2 1 2 3 5]] (map (juxt first count) (vals (group-by identity v))))

22:31 joshua-choi: Hey, is there a high-order function f so that (f g x [y0 y1 ... yn]) returns [(g x y0) (g (g x y0) y1) ... (g (... (g (g x y0) y1) ...) yn)]?

22:31 In other words, a version of reduce that returns all the intermediate values too

22:31 devlinsf: reductions

22:31 c.c.seq-utils

22:31 joshua-choi: Excellent

22:31 alexyk: durka42: very nice

22:31 joshua-choi: Does it use chunked-seqs?

22:32 devlinsf: Dunno

22:32 joshua-choi: Yet?

22:32 devlinsf: Probably not, I don't think it has been touched yet

22:32 joshua-choi: Yeah, that makes sense; it's a bleeding-edge feature anyway

22:32 But they're real nice

22:33 durka42: devlinsf: juxt is nice

22:33 joshua-choi: Is juxt slated for core 1.1?

22:33 devlinsf: It's in the RC

22:34 The name is up in the air.

22:34 durka42: i'm not a huge fan of the name but i like the function

22:34 devlinsf: We'll see what everyone says on the list, and Rich will decided

22:34 Admittedly, the name has been hard to get right

22:35 joshua-choi: If it's a useful function, it should have a short name [stating the obvious]

22:36 But, is it a useful function? What would you use it for?

22:36 devlinsf: point free style

22:37 mapping operations, composition, group-by

22:37 join operations

22:38 joshua-choi: See, I use composition and group-by all the time; but juxt is a little more...well, I guess it is a composing function

22:38 devlinsf: Yeah, comp "reduces" a list of fns, right?

22:38 juxt maps them

22:38 joshua-choi: Oh

22:38 Yeah, I see that

22:38 That makes sense

22:39 alexyk: ,(let [g [1 5 3 3 2 4 5 5 4 5 1 2 1 2 3 5] gs (sort g) [v x c] (reduce (fn [[v x c] y] (if (= x y) [v x (inc c)] [(conj v [x c]) y 1])) [[] (first gs) 1] (rest gs))] (conj v [x c]))

22:39 clojurebot: [[1 3] [2 3] [3 3] [4 2] [5 5]]

22:39 hiredman_: for the record I have no problem with the name

22:39 ~logs

22:39 clojurebot: logs is http://clojure-log.n01se.net/

22:42 joshua-choi: I've always wondered: is there a standard version of the some function that returns the first matching element, not the result of the predicate?

22:42 (In other words, (comp first some).)

22:42 Crap, I mean (comp first filter)

22:42 durka42: (comp first filter) is the recommendation i've seen

22:42 _ato: joshua-choi: there's a find-first in contrib

22:43 ,(doc find-first)

22:43 clojurebot: "([pred coll]); Returns the first item of coll for which (pred item) returns logical true. Consumes sequences up to the first match, will consume the entire sequence and return nil if no match is found."

22:43 devlinsf: read up on seq-utils, folks

22:43 joshua-choi: I should

22:43 devlinsf: http://richhickey.github.com/clojure-contrib/seq-utils-api.html

22:43 durka42: ~source find-first

22:43 clojurebot: Pardon?

22:43 _ato: ~def first-first

22:43 clojurebot: Huh?

22:43 devlinsf: _ato: Thanks

22:43 alexyk: ,(let [v [1 5 3 3 2 4 5 5 4 5 1 2 1 2 3 5]] (map (juxt first count) (vals (group-by identity v)))) ; devlinsf?

22:43 _ato: err

22:43 clojurebot: ([1 3] [2 3] [3 3] [4 2] [5 5])

22:43 _ato: ~def find-first

22:43 clojurebot: Gabh mo leithscéal?

22:43 alexyk: yay!

22:43 _ato: oh.. is it broken?

22:43 devlinsf: Yeah?

22:43 _ato: ~def inc

22:44 hmm.. doesn't work for contrib I guess

22:44 alexyk: it works! :)

22:44 durka42: ~def clojure.contrib.seq-utils/find-first

22:44 alexyk: you da man

22:44 durka42: ^ dead link

22:44 alexyk: I wonder whether my single-sweep reduce is faster though than group-by then map

22:44 but, I also have sort

22:45 durka42: only a questionable microbenchmark can tell!

22:45 alexyk: durka42: exactly

22:45 btw, what we just did is a standard rle function (run length encoding) which must be in seq-utils :)

22:46 as run-length-encoding

22:46 how do I go about submitting it there?

22:46 durka42: ,(frequencies [1 5 3 3 2 4 5 5 4 5 1 2 1 2 3 5])

22:46 clojurebot: {4 2, 2 3, 3 3, 5 5, 1 3}

22:47 alexyk: I stand corrected: rle does not pre-sort. So I'd take my version and drop sort.

22:47 hiredman_: ~source find-first

22:47 alexyk: frquencies sorts

22:47 durka42: well, frequencies is what we were doing, no?

22:48 alexyk: hiredman_: does it waste a tinyurl each time?

22:48 durka42: yes, we did just that. But I also did RLE. :)

22:48 durka42: soon we'll have to transition to tinyURLv6!

22:48 alexyk: if you drop: gs (sort g) and replace gs by g in the rest

22:48 hiredman_: it used to memoize, but I think I turned it off for some reason and forgot to turn it back on

22:49 alexyk: well tinyurl must be smarter and check if it exists already, like tr.im does

22:50 hiredman_: alexyk: it might

22:50 infact, I think it does

22:51 alexyk: so, is there room for run-length-encoding in seq-utils? how do folks submit to c.c.x.y?

22:51 hiredman_: the last time I started clojurebot github was in maintence mode or something so it couldn't fetch the info for contrib

22:51 devlinsf: alexyk: Start with getting a CA to Rich

22:52 alexyk: CA?

22:52 devlinsf: Contributor agreement

22:52 http://clojure.org/contributing

22:53 Also, you might want to think about using partition by

22:53 alexyk: ok

22:54 devlinsf: (let [v [1 5 3 3 2 4 5 5 4 5 1 2 1 2 3 5]] (partition-by identity v))

22:54 ,(let [v [1 5 3 3 2 4 5 5 4 5 1 2 1 2 3 5]] (partition-by identity v))

22:54 clojurebot: ((1) (5) (3 3) (2) (4) (5 5) (4) (5) (1) (2) (1) (2) (3) (5))

22:54 devlinsf: ,(let [v [1 5 3 3 2 4 5 5 4 5 1 2 1 2 3 5]] (map (juxt first count) (partition-by identity v)))

22:54 clojurebot: ([1 1] [5 1] [3 2] [2 1] [4 1] [5 2] [4 1] [5 1] [1 1] [2 1] [1 1] [2 1] [3 1] [5 1])

22:55 devlinsf: Is that you rle?

22:55 alexyk: that's more like it

22:55 ,(let [g [1 5 3 3 2 4 5 5 4 5 1 2 1 2 3 5] [v x c] (reduce (fn [[v x c] y] (if (= x y) [v x (inc c)] [(conj v [x c]) y 1])) [[] (first g) 1] (rest g))] (conj v [x c]))

22:55 clojurebot: [[1 1] [5 1] [3 2] [2 1] [4 1] [5 2] [4 1] [5 1] [1 1] [2 1] [1 1] [2 1] [3 1] [5 1]]

22:56 alexyk: aligns

22:56 ,(= *2 *1)

22:56 clojurebot: java.lang.IllegalStateException: Var clojure.core/*2 is unbound.

22:56 durka42: true

22:56 devlinsf: The partition-by solution is lazy

22:56 alexyk: ,damn-you-clojurebot

22:56 clojurebot: java.lang.Exception: Unable to resolve symbol: damn-you-clojurebot in this context

22:57 alexyk: devlinsf: you mean it will yield par by pair?

22:57 devlinsf: Yeah

22:57 alexyk: pair

22:57 and reduce is not lazy?

22:58 devlinsf: Dunno

22:58 depends on how you use reduce

22:58 alexyk: well, I do tack on the rest after reduce... wonder if that breaks lazyness

22:59 * durka42 is going to bed

22:59 devlinsf: breaking lazyness isn't something I understnad 100%

22:59 alexyk: devlinsf: then you're not a manager :)

23:00 devlinsf: No, you've got it backwards

23:00 managers MASTER laziness

23:00 :)

23:00 alexyk: perhaps :)

23:00 hiredman_: reduce is not lazy

23:01 devlinsf: Right! It couldn't be

23:01 Duh

23:01 hiredman_: it can't be unless you have lazy evaluation, which clojure doesn't

23:02 alexyk: hiredman_: ueah, just a hard-working American function. None of that European socialist crap.

23:03 devlinsf: Uh-oh

23:03 joshua-choi: reductions can be lazy, though, which is really useful

23:03 alexyk: just a reminder to them lazy defns

23:04 devlinsf: "I get more done when I'm lazy"

23:05 http://www.zazzle.com/i_get_more_done_when_im_lazy_clojure_on_back_tshirt-235284015952434496

23:05 Check the front

23:06 alexyk: nice

23:09 joshua-choi: what's a reduction, as different from reduce?

23:09 joshua-choi: No, I meant the reductions function from c.c.seq-utils that I was just introduced to

23:09 devlinsf: reductions

23:10 joshua-choi: It's proving very useful with filter

23:10 alexyk: ah ok

23:10 joshua-choi: Wish it was chunked though

23:11 devlinsf: I'm sure people will look into it post 1.1

23:11 (Within a few weeks)

23:11 alexyk: that T-shirt is $31.45, btw. Looks like the price was arrived at by a semi-random rearrangement of 1 3 4 5.

23:50 joshua-choi: Got a question on destructing bindings: namely, their speed

23:51 According to http://gnuvince.wordpress.com/2009/05/11/clojure-performance-tips, using destructuring in let (and so, probably fn too) is pretty slow

23:52 Is this still the case in Clojure now?

23:52 Or, in performance-intensive loops, should I still use direct getting instead?

Logging service provided by n01se.net