#clojure logs

2009-12-17

00:02alexykhow do you unset a def'd thing?
00:04hiredmanyou don't, ever!
00:04radswhat's the best way to write a simple IRC bot in clojure? start from scratch, or is there a good IRC library available?
00:04hiredmanpircbot is pretty simple and easy to use
00:04JonSmithis probably a java one
00:04alexykhiredman: it eats my RAM!
00:04hiredmanalexyk: then don't def it
00:04alexykcan I def it to nil?
00:04hugodalexyk; so pmap will start processing 10 threads at a time if I understand it correctly
00:05alexykhiredman: it's in repl
00:05hiredmanalexyk: :(
00:05JonSmithhugod: pmap should do however many processors you have
00:05hiredmanrads: I've hard good things about something called, maybe, "jerklib"
00:06hiredmanclojurebot uses pircbot
00:07alexykhiredman: I don't see why if I (def existing-ram-sucking-bastard-thing nil) it won't be GC'd?
00:08alexykon top level at repl
00:08hiredmandid I say it wouldn't?
00:09alexykhiredman: you said don't def it :)
00:09hiredmanto start with
00:09hugodJonSmith: pmap deref's availableProcessors plus 2 at a time
00:09alexykhiredman: mistakes were made
00:09alexykor, rather, I def everything of interest in repl, what other way to reuse it?
00:10JonSmiththat's interesting
00:10hiredmanalexyk: *1
00:11alexykhiredman: ?
00:11hiredman,(doc *1)
00:11clojurebot"; bound in a repl thread to the most recent value printed"
00:11alexykI need names
00:11hiredman,(doc *2)
00:11clojurebot"; bound in a repl thread to the second most recent value printed"
00:11alexyke.g. I define a map and then hack at it for days
00:12alexykI never run a clojure script for results yet, it's all repl!
00:12alexykoutput goes into mongo, amazing
00:12hugodalexyk: you could also try forcing things - (System/runFinalization) (System/gc) a few times
00:12alexykhugod: useful
00:12hiredmanhugod: pfft
00:13hiredmannot really
00:13hugodpfft?
00:13alexykparallel FFT
00:13hiredmanif it needs to be gc'ed it will be
00:14alexykhiredman: that's zen
00:15hugodpresumably, though I thought that depends on how things grow and what limits are set
00:15alexykIDEA has a nice button you can click and feel accomplished at GC'ing
00:16alexykit's like that curvy gear-shift stick path, to let you in touch with the machine
00:16hiredmanhugod: that is part of the definition of "needs to be"
00:16alexykthere was some function to destroy vars, iirc
00:17alexyk(whack...) or destroy or clear or something
00:17hiredmannope
00:17hiredmandon't destroy vars
00:17hiredmanthey are not for destroying
00:17alexykhiredman: I've asked it at least once before! :) and somebody suggested something
00:17alexykI vividly remember a dash in its name
00:17hugodhiredman, so if you have a large max, and small initial, then forcing gc might reduce total memory usage?
00:18hiredmanhugod: nope
00:18hiredmanjvm never frees memory
00:19hugodah, ok
00:21hugodthen the most forcing gc can do is possibly give you headroom until you reach your previous memory usage?
00:22alexykSo what's with Lisp's globals called *foo* and Clojure's +bar+ ?
00:22alexyk(conventions I see in code)
00:22hiredmanhugod: well, really it would do nothing, because the gc will run when the jvm is looking for free memory
00:23hiredmanso never do manual gc runs
00:23hiredmanalexyk: clojure doesn't have a convetion using +foo+
00:23alexykhiredman: I saw folks using +foos+
00:24hiredmanI doubt it
00:24alexykhiredman: I swear! :)
00:24hiredmanI don't believe you
00:26hugodCL uses +foos+ for constants
00:26hiredmanclojure uses *foo* to indicate vars to are for rebinding
00:27alexykmmcgrana does it in clj-garden 23 times, e.g. ./clj-garden/stash/test/stash/core_test_helper.clj:(def +data-source+
00:27hugodhiredman: will gc run before the jvm expands its current allocation?
00:28alexykso that's where I saw it
00:28defnwhat is the policy on reusing someone's code vs forking -- which is best?
00:28hiredmanhugod: I'd check the docs if you want to know exactly when and where the gc will run
00:29hiredmanalexyk: one place does not a convention make
00:29alexykindeed
00:30hugodhiredman: :-) will do
00:35alexykdefn: on github, if you want to patch and contribute, forking is preferred; I fork gists just to bookmark them, too.
00:35alexykforking is the new reusing
00:35defnwhat if you're sort of taking it in a new direction?
00:35alexykdefn: then definitely fork on a branch, possibly
00:35defnlike, i dont want someone to feel obligated to take my code
00:35alexykthen they won't :)
00:36defntouche'
00:36alexykforking is good for everybody if you're using git, hg, or darcs
00:36defnk -- 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
00:37defnfork it is
01:00JonSmithso...
01:17defnso...
01:17defnskynet
01:17defnclojurebot: skynet
01:17clojurebotI will become skynet. Mark my words.
01:23defnclojurebot: do you like skynet?
01:23clojurebotI will become skynet. Mark my words.
01:24defnclojurebot: do you like skynet or not?
01:24clojurebotI will become skynet. Mark my words.
01:24defnclojurebot: do you like skynet and rhickey?
01:24clojurebotI will become skynet. Mark my words.
01:24defnclojurebot: do you like rhickey?
01:24clojurebotexcusez-moi
01:29defnhiredman: any markov planned?
01:29hiredmannope
01:29hiredmanI do have a nice log of #clojure in case it happens
01:30defni wish n01se.net had a plaintxt
01:35defnit's pretty interesting to look at the log sizes over time
01:35defnhttp://clojure-log.n01se.net/date/
02:43headiusyou ruby-using clojurists might get a kick out of this: http://gist.github.com/258565
02:43headiusnite
02:51LauJensenMorning gents - Blizzard in the DK this fine morning :) (danish variant, not the American)
03:01piccolinoWhat's a Danish blizzard?
03:12LauJensenIts about 12 cm of snow :)
03:13polypusdet er, når det regner katte og hunde
03:13karmazillawhat's an American blizzard?
03:14polypusnity nite
03:14LauJensenkarmazilla: thats about 65 cm of snow?
04:15esjgood morning all
05:23octecan anyone explain how defmulti's syntax has changed?
05:23octei'm trying to make a library work with clojure > 1.0.0
07:54octeanyone know how to make start-repl in swank-clojure start again after a connection has been closed?
08:17triyoAny clojurians here familier with compojure?
08:17triyoI'm getting a really weird concurrency issue as far as I can tell
08:18triyoeveryone is asleep I guess :)
08:20briansheehan_Hello, can someone tell me if I can drop a .clj file somewhere in the classpath and subsequently load it in the repl?
08:22triyobriansheehan_: AFAIK, yes
08:22briansheehan_I've been having a bit of trouble doing do
08:22briansheehan_I have a namespace called ie.vdm.clojure-web
08:23triyobriansheehan_: 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
08:23karmazillabriansheehan_: try removing the dash from the namespace and make sure it lines up with the directory/package structure. Otherwise I dunno.
08:23triyook, so you have ie.vdm.clojure-web whats your clj file name?
08:24ker2xfriendly greetings :)
08:24briansheehan_clojure_web.clj
08:24briansheehan_directory structure is ie/vdm/clojure_web/clojure_web.clj in classpath
08:26rhickeybriansheehan_: that's one clojure_web too many
08:26briansheehan_okay thanks rich!
08:28briansheehan_I think this bit it (doc require) put me wrong:
08:28briansheehan_For example, the lib 'x.y.z has root directory <classpath>/x/y/z; root resource <classpath>/x/y/z/z.clj.
08:28ker2xi'm reading documentation about ref, atom, etc ... and concurenccy... but i can't find a documentation about *threads*
08:28Chousukewhich version of clojure are you running? I thought that was fixed :/
08:30briansheehan_1.0.0, could be behind the times
08:30Chousukenah. that's the latest stable release. :P
08:31ker2xthere is nothing like erlang or scala "!" in clojure ? to pass message between threads ?
08:34karmazillaker2x: maybe you're looking for things like 'agent and 'send ?
08:35ker2xagent create a new thread ?
08:36ker2xmmm, that wasn't very explicit in the documentation ...
08:36rhickeyker2x: no, agents are not actors
08:36rhickeyin an actor model (erlang scala) you write loops that wait for messages
08:36ker2xindeed
08:36rhickeyyou don't do that in Clojure
08:37rhickeyinstead 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
08:38rhickeywhen there are no actions for an agent, it isn't busy waiting, it's not doing anything
08:38rhickeywhen there are many actions for an agent they get queued up
08:38rhickeyan agent is only doing one action at a time
08:39rhickeyalternatively, you can use future to spawn threads, and use STM refs for shared state, or promise/deliver
08:39ker2xMmmmm
08:40triyoin 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)
08:40ker2xi'm confused, i'll need a lot of test and fail :)
08:40rhickeyker2x: the key is not to presume that the erlang/scala way is the only way
08:41ker2xyup. of course, but erlang/Scala is the only way i know for multithread in a Functional langage :)
08:41rhickeyker2x: http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey
08:42ker2xi bought "programming clojure" a few days ago
08:43ker2xthx for the url, i'll read that from home (i don't have flash on my desktop at work)
08:45triyohttp://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]
08:47triyotest-create-label is called from my compojure routing function.
08:48triyoany input would be very much appreciated.
08:57triyoI'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?
09:07LauJensentriyo: si si senior
09:08triyoLauJensen: I dont follow?
09:08LauJensenYou asked if any Clojurians had experience with Compojure - I do
09:11triyoLauJensen: thx, I have the following code: http://gist.github.com/258737 ...as a small test... it runs fine on small load.
09:12triyoLauJensen: however, if I test 2000 requests with 20 concurrent, I get an indication that about 200 fail with 500 errors.
09:13bOR_echo'ing from #leiningen:
09:13triyoreason is "NonUniqueObjectException: a different object with the same identifier value was already associated with the session" which is on line 16
09:13bOR_does anyone know if the pom / clojure-1.1.0-alpha / clojure-1.1.0-master thing is still a problem?
09:13bOR_trying to distinguish between my proxy acting up and leiningen failing because of that
09:13bOR_and the alpha / master / pom build thing.
09:30LauJensentriyo: 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
09:30triyoLauJensen: thx I'll try that
09:31LauJensennp
10:22shoovertriyo: where did your gist go?!
10:28triyoshoover: http://gist.github.com/258810, sorry added a new gist
10:28triyoshoover: also, I just posted the problem I have on compojure group: http://groups.google.com/group/compojure/browse_thread/thread/872330e0b94f555b
10:31triyoshoover`: not to sure if you got my last message
10:32triyoshoover``: 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:33shoover``triyo: ok, thanks (I don't know what's going on with my internet connection)
10:34triyoshoover``: I noticed, your ` keeps multiplying :)
10:49octecan i create a symbol from a string?
10:50chouser,(symbol "foo")
10:50clojurebotfoo
10:50dnolen,(str 'foo)
10:50clojurebot"foo"
10:51ker2xcan i easily do openCL and/or gpgpu in clojure ?
10:51dnolenjust for good measure
10:51dnolenker2x: yes checkout Penumbra by ztellman
10:51dnolenhttp://github.com/ztellman/penumbra
10:52ker2xthank you !
10:52octewhere is defn defined?
10:53ker2xconcurrency and gpgpu computing is my #1 feature to choose a langage :)
10:53ker2xmmm, penumbra is openGL stuff
10:54octenevermind, found it..
10:55ker2xha ok... openCL and GPGPU is in early dev stage. k k
10:55ker2xthx
10:57rysI'm potentially going to be working on OpenCL bindings for my new employer in the new year, if nobody else has
10:58doublindirectionis it ok to assume that (keys map) and (vals map) are always going to have the same ordering?
10:59doublindirectioni remember reading something about this but I cannot find it anymore
11:00chouserdoublindirection: yes, and both have the same ordering as (seq map)
11:00doublindirectionthanks chouser
11:01chouserfor the very same map of course. as soon as you insert or remove anything, all bets are off.
11:02doublindirectionright
11:08dnolenker2x: oh yeah this as well, http://www.jcuda.de/.
11:11triyoI 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:12triyoHere is my code snippet that needs lock based coordincation
11:12triyoprob. with use of atoms too.. http://gist.github.com/258837
11:14shoover``triyo: does getWebApplicationContext always return the same java object within the same JVM, or does it make a new object?
11:15triyoshoover``: always returns the same context
11:15shoover``then you could try locking on spring-ctx
11:16shoover``(locking spring-ctx (do stuff with labels))
11:17shoover``Your benchmark won't be fast, but at least it should get rid of the exceptions
11:19triyoshoover``: thx, that worked... 1600 request with 10 concurent... result Requests per second: 514.93 [#/sec] (mean)
11:20triyoshoover``: it wasnt meant to be some real benchmark, rather just to sniff out the suspected concurrency issues at java level.
11:21triyoshoover``: 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:22shoover``I've never locked anything in Clojure :)
11:23triyoshoover``: why not? its so much fun when you have to run a hybrid java solution that really needs locking ;)
11:25shoover``triyo: ah, the book is using an atom to store the context, essentially, but you already have a context object in spring
11:26triyoshoover``: true, I see now why they use the atom in that place.
11:30shoover``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:30shoover``Probably .create and .read?
11:32shoover``... since that sounds like a race condition
11:33ChousukeClojure has teh locking macro, but I don't think I've ever seen it anywhere :P
11:38triyoshoover``: yup .create .read need to be locked... I used locking macro and it worked... yuk :)
11:41triyoshoover``: 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:41triyo*spring
11:43arohner,(every? identity [nil])
11:43clojurebotfalse
11:43arohner,(every? identity nil)
11:43clojurebottrue
11:44arohnerthat's very weird IMO
11:44rhickeyanyone using add-watcher?
11:44stuartsierraWeird but mathematically correct.
11:44stuartsierra,(every? identity [])
11:44clojurebottrue
11:45stuartsierrarhickey: not at present
11:45stuartsierraI used it in the past
11:45_clojure_rhickey: not recently
11:46arohnerrhickey: 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:46stuartsierraarohner: How would that work? Would the same function get called on every transaction?
11:47arohner(dosync (watch-transaction foo) (alter ...) (commute...))
11:47rhickeystuartsierra: would need to be passed to sync
11:47arohnerwatch-transaction gets called once, when the transaction completes
11:47arohnerfor only that transaction
11:47rhickeyarohner: not that way
11:48rhickey(sync {:on-commit foo :other flags} ...)
11:48arohnersure. that works for me
11:48stuartsierraHow would that be different from (dosync ... ) (when-done-do ...)
11:49rhickeysync has a spot for transaction flags, like timeouts etc, but there are none yet
11:49slashus2Or you could have a `when-commit` macro that calls its body in an agent.
11:49arohnerstuartsierra: because then as a library writer, I don't need to know what the body of the sync contains
11:50stuartsierraah, ok
11:50rhickeyneither of those could pass the affected refs
11:51arohnerbecause it's not possible, or not a good idea for concurrency or something else?
11:52arohnerI'm trying to write an ORM that doesn't suck, and I'm struggling with integrating DB transactions with dosync
11:52rhickeystuartsierra's was after the dosync
11:52replacarhickey: I use add-watch, but not yet add-watcher
11:52rhickeyarohner: oh, for that you will need more than a hook, if you truly want to be transactional
11:53rhickeyreplaca: good - add-watcher is older, non-primitive (can be built on add-watch) so I'm looking to remove it
11:53stuartsierrafine by me
11:53rhickeyarohner: you need a transaction coordinator
11:54stuartsierrarhickey: think we can get 1.1 out before Christmas?
11:54rhickeyarohner: 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:54rhickeystuartsierra: yes
11:55stuartsierrarhickey: Yay! Anything else I can do to help?
11:55arohnerrhickey: you're afraid of exactly what I'm trying to do :-)
11:55rhickeyarohner: right
11:55arohneryes, I see the non-trivalness of it
11:55rhickeystuartsierra: I've got to get your dist patch in and try it. How do you see the release notes getting in there?
11:56slashus2But that :on-commit etc. in a map would be a good solution to the `when-commit` thing for the whole translation. Very elegant.
11:56stuartsierrarhickey: As a new file, changes.txt
11:56rhickeyin the repo?
11:56stuartsierrarhickey: yes
11:57stuartsierraOr if you don't want it in the source, just post it on the web somewhere.
11:58rhickeystuartsierra: I just don't see it being maintained between releases, thus possibly confusing in the interim
11:58stuartsierrarhickey: yeah, could be a problem. Maybe make a 1.1 branch and just put changes.txt in there.
11:59stuartsierraLeave it out of master.
11:59rhickeywe also have to decide how to handle the branch/tag thing. Bad to have both with same name in git
11:59stuartsierraOh yeah, didn't think about that.
12:00stuartsierraIs 1.0 a tag or a branch?
12:00rhickeythat was a painful aspect of moving from SVN
12:00rhickeystuartsierra: both
12:00la_merrhickey: yes, we use watchers, on atoms
12:00rhickeyla_mer: watchers or watches?
12:00stuartsierraHmm, ok, that's not good. I'll research tagging in git, never used that much before.
12:01chousermaybe the tag should be 1.0.0 and the branch should be 1.0 or 1.0.x
12:01rhickeychouser: you mean 1.1?
12:01cemerickdamn colloquy
12:01cemerickrhickey: watches
12:01chouserer. yes. :-)
12:02rhickeycemerick: ok, so not using add-watcher
12:02cemericknope, add-watch
12:02cemerickadd-watcher is agent specific, if memory serves?
12:02drewrstuartsierra: the emacs repo might be something to mimic regarding tag/branch names http://git.savannah.gnu.org/gitweb/?p=emacs.git;a=summary
12:03stuartsierrarhickey: chouser's suggestion is what you have now, isn't it? "1.0" is a tag and "1.0.x" is a branch
12:03rhickeycemerick: add-watcher is just derived from add-watch
12:03stuartsierradrewr: where can I see tag/branch names there
12:04stuartsierradrewr: never mind
12:04rhickeystuartsierra: yes, I think after fixing up
12:05stuartsierraDiff between "1.0" and "1.0.x" is minimal.
12:06drewrstuartsierra: they tag releases and have maintenance branches from which further minor versions would stem
12:06stuartsierraSo get "master" ready for release, then tag "1.1". If maintenance patches are needed, create branch "1.1.x".
12:06stuartsierradrewr: makes sense
12:08drewryou may want to branch first (1.0, e.g.), then create tags at milestones like RELEASE_1.0.0, _1.0.1, etc.
12:08rhickeyno, branch first
12:08rhickeyso we can put in release notes right?
12:08stuartsierraoh, right
12:08stuartsierraSame thing from Git's point of view, I think.
12:09rhickeyreally? won't that leave the release notes in master?
12:09stuartsierraYes. I meant, branch first.
12:10stuartsierraMy only point was it doesn't matter to Git.
12:10stuartsierraBoth the tag and the branch head will point to the same commit.
12:10rhickeystuartsierra: did you see my comment on: http://www.assembla.com/spaces/clojure/tickets/218-Deprecate-old-launch-Classes ?
12:10stuartsierraNow I have.
12:10drewrstuartsierra: yes, for that commit, but further releases based on that branch will have diverged
12:10stuartsierradrewr: right
12:11headiusrhickey: why are there no javadocs for the clojure java bits?
12:11stuartsierrarhickey: I'll try to figure out what the argument translation should be
12:11headiusI eventually had to poke around the code directly last night to call clojure from jruby
12:11lghtngquestion: if i want to articulate an ansi stream to a map, what function should i be focusing on?
12:11stuartsierraheadius: technically the Java bits aren't a public API
12:11headiusthat needs to change
12:12stuartsierraheadius: Yes, in time.
12:12headiusok, how about....now!
12:12chouserheadius: the java bits are slated to disappear. :-)
12:12rhickeyheadius: I hadn't decided which of those bits I wanted people to use and which are implementation details
12:12headiusthere's certainly a lot of implementation details, but in order for other languages to integrate clojure, they'll need an API
12:13headiusand unless you want them to use the bits likely to change...
12:13rhickeyand 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:13headiuswe have the same problem with jruby, and only recently got a solid embedding API
12:13headiusso I can appreciate that
12:13stuartsierraFor 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:13headiusbut there's not even javadoc comments *in* the java code
12:13rhickeystuartsierra: that's fine
12:13DraggorCould someone point me to a compojure example to deal with file uploads?
12:14stuartsierraI've thought about writing a javax.scripting wrapper.
12:14headiusbleah, nobody would want to use javax.script for tight integration
12:14headiusit's a "toss it over the wall" sort of API
12:14stuartsierraJRuby uses it.
12:14headiususes it for what?
12:15stuartsierraCalling JRuby from Java.
12:15stuartsierraOr at least that's how I used it.
12:15headiuswe also have a full-on embedding API which we usually recommend for tight integration
12:15headiusas of 1.4
12:15stuartsierraah, news to me
12:15rhickeyheadius: I was for a long time the only consumer of the Java bits, and didn't need javadoc, so strictly my fault
12:15headiusrhickey: fair enough...I can't say we're perfect in that regard either
12:15headiusI was trying to find docs for this: http://gist.github.com/258565
12:16rhickeyheadius: cool! (looks like you found it :)
12:17headiuseventually 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:18stuartsierraheadius: who put a filing cabinet in a lavatory?
12:18headiusanyway, 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:18headiusI pounded my fist not once, but twice
12:18rhickeyheadius: sorry about that, not an unreasonable expectation
12:19headiusI 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:19rhickeythere should at least be 'embedding' notes on http://clojure.org/java_interop
12:19headiusanyway...rhickey: if you get a chance, you might jump on on the jvm-l thread on common compiler infrastructure
12:20rhickeyheadius: I've been reading, hope to chime in
12:20stuartsierraDoes anyone remember how the arguments to clojure.lang.Repl and clojure.lang.Script worked?
12:20headiusI assume you would like a common type-wrangler cat-herder to plug into for java type resolution just like we would
12:20headiusok, cool
12:21rhickeyheadius: yes definitely - I hate herding cats
12:21headiusnobody should have to write java method resolution themselves
12:21headiussince we've all done it at least once
12:21headiusfor others: http://groups.google.com/group/jvm-languages/browse_thread/thread/4f20c8c916db33cb
12:21chouserstuartsierra: nope. But don't the current implementations do the "right thing" to translate old command lines into clojure.main calls?
12:22rhickeychouser: right, just look there
12:22stuartsierrayeah, yeah, read the source, whatever ;)
12:23chouserstuartsierra: thanks for doing this. I've been feeling unusually short on time recently.
12:24chouserI feel a bit bad filing a bug like that and then walking away.
12:24stuartsierrano problem, I've got a bit of a break right now, the luxury of academia on winter break
12:25rhickeystuartsierra: chouser: ok, I've applied 224 locally, waiting for 218 and I'll push
12:26stuartsierraI'm on it
12:26rhickeyso did anyone ever use 1.0.x branch?
12:27rhickeydevlinsf: 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:28chouserlooks like one bugfix was applied after 1.0.0
12:28rhickeybest laid plans...
12:29chouserHey, I'm happy. If someone had wanted it, there were several other patches that would have had to be backported.
12:29chouserGlad nobody has been demanding that.
12:29rhickeychouser: yes, definitely
12:29chouser1.1.1 seems even less likely to be needed with 1.2 so far along and so attractive.
12:30rhickeychouser: definitely good to have a branch, just for emergencies
12:30chouseroh, yes.
12:31stuartsierrarhickey: new patch up for #218
12:31rhickeystuartsierra: thanks!
12:31stuartsierrarhickey: you're welcome
12:35devlinsfrhickey: Can you provide a deadline for input in the docs?
12:35cemerickrhickey: we stacked patches on top of 1.0.x for a while, but that certainly didn't require any coordination on your part
12:36rhickeydevlinsf: 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:38devlinsfrhickey: 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:42rhickeydevlinsf: 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:44rhickeydevlinsf: I did move the pre/post docs to the clojure.org site http://clojure.org/special_forms
12:45devlinsfrhickey: Cool. Lemme think about stepping forward with the exampels effort.
12:45devlinsfrhickey: Holidays & all
12:45jasappdevlinsf: if you need some help with examples, I'd be happy to contribute
12:45rhickeydevlinsf: 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:46stuartsierraalso hard to keep that sort of thing current
12:47rhickeystuartsierra: playing with ant dist on clojure - should .gitignore be in the zip?
12:48devlinsfrhickey: I would need my membership bumbed to member for core, btw
12:48devlinsfrhickey: Only contrib right now
12:48rhickeydevlinsf: done
12:48devlinsfrhickey: thanks
12:51stuartsierrarhickey: I think so. Maybe I'm wrong.
12:51rhickeyis it in the repo?
12:51stuartsierraYes.
12:51rhickeyok, then should be in there
12:52stuartsierraI tried to make ant dist include everything that is in a git clone, except .git/
12:52stuartsierraPlus clojure.jar of course
12:52replacaQ: does (count "hello") operate on the string directly (like (.length "hello")) or does it convert to a seq first?
12:53chouserreplaca: direct
12:53chouserso, O(1) not O(n)
12:54replacaawesome, thx (whenever I have a .foo, I feel a little dirty :-))
12:56rhickeyok, 218 and 224 are up, master should be very close to 1.1
12:58lghtngKeats: A thing of beauty is a joy forever.
12:58stuartsierraYou get that sandwich, you.
13:00technomancy225 would be a really simple fix for 1.1 as well; just found two overlapping defs yesterday in core.clj
13:00technomancy
13:07devlinsftechnomancy: Re: #225 I like bound-fn? better.
13:09defnIs 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:11devlinsfdefn: There is a TON of documentaion & examples to generatte
13:11jasapphey, I'd love to help too
13:13technomancydevlinsf: it's not a predicate though
13:16defndevlinsf: cool, ill send in the form today
13:18replacaBest doc string ever:
13:18replaca,(doc future-cancel)
13:18clojurebot"([f]); Cancels the future, if possible."
13:18devlinsftechnomany: Hmmm... then what was your motivation in having ? in the name
13:18devlinsftechnomancy: Hmmm... then what was your motivation in having ? in the name
13:20technomancydevlinsf: it returns a predicate
13:22devlinsftechnomancy: Okay, it's a factory
13:30rhickeytechnomancy: I'm fixing now
13:34rhickeywow, so no one uses subseq?
13:35stuartsierrawazzat?
13:35stuartsierra,(doc subseq)
13:35clojurebot"([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:35replacarhickey: I just threw you a minor patch for doc string formats - makes the autodoc look cleaner
13:35technomancyrhickey: I think subseq uses the version of bound-fn that wins
13:35rhickeyah. makes sense
13:36rhickeyreplaca: what patch #?
13:36replacaticket 226
13:36stuartsierra~#226
13:36clojurebotexcusez-moi
13:36stuartsierra~ticket 226
13:36clojurebotexcusez-moi
13:37replacastuartsierra: that was an answer to rhickey, not a question :-)
13:37stuartsierraI know.
13:37stuartsierraI was trying to remember how to make ClojureBot print URLs for tickets
13:38rhickeyerm, whitespace errors - what do they mean?
13:38technomancystuartsierra: I think clojurebot just hasn't polled the ticket list yet
13:38technomancysyntax is right
13:38replacastuartsierra: there needs to be a better way to find out how clojurebot does this or that
13:39replacarhickey: 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:39replacalemme check
13:39rhickeyreplaca: I ignore them, just wondered if they matter
13:40rhickeyreplaca: any reason why clojure.core is by Unknown?
13:41rhickeyand clojure.main
13:41stuartsierraI think whitespace errors means you have spaces at the end of a line.
13:41stuartsierraIt's a warning generated by git.
13:41rhickeystuartsierra: right - should I care about it?
13:42technomancythere are a bunch of optional hooks in .git/hooks that get activated if you chmod them to executable
13:42technomancyone of them will keep you from committing if you have trailing whitespace
13:43stuartsierrarhickey: probably not
13:43replacarhickey: yeah, it's just the line endings
13:44replacareplaca: I think because of ticket 130. Core is the one place I can't work around that
13:46lithperHello... anyone home?
13:46lithperI decided to try Clojure today and I'm not off to a good start.
13:46lithperRunning a freshly downloaded version 1.0.0 on Snow Leopard I get this:
13:47lithper[ron@mickey:~/Desktop/clojure_1.0.0]$ java -cp clojure.jar clojure.lang.ReplException in thread "main" java.lang.NoClassDefFoundError: clojure/lang/Repl
13:47lithperCaused by: java.lang.ClassNotFoundException: clojure.lang.Repl
13:47lithper at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
13:47lithper at java.security.AccessController.doPrivileged(Native Method)
13:47lithper at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
13:47lithper at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
13:47lithper at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
13:47lithper at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
13:47lithper at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
13:47stuartsierralithper: pastebin please :)
13:48scgilardithat'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:48lithperSorry, I don't use IRC very often.
13:48lithperOh... duh.
13:48lithperThanks.
13:49lithperThe quickstart on the web page has the same "bug" BTW.
13:49scgilardisome more info here: http://groups.google.com/group/clojure/browse_thread/thread/bbdb4adf1fd11001/510430e7da8fd7f6?lnk=gst&amp;q=gilardi#510430e7da8fd7f6
13:50replacalithper: 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:51lithperNo worries, I know how it goes.
13:51LauJensenHow do I make this work? (ns test (:gen-class :main true :name test)) (def inst (test.)) ?
13:51LauJensenSimply put, I want to extend a class with gen-class and instantiate it
13:52lithper@scgilardi: that post says that the entry point should be clojure.main, not clojure.lang.Repl
13:52stuartsierraLauJensen: Use (Class/forName "test")
13:52scgilardiis there a ticket already for ensuring the quickstart at the website and the readme.txt work out of the box with 1.1?
13:52stuartsierrascgilardi: don't know, but my "ant dist" creates a ZIP containing "clojure.jar"
13:52scgilardilithper: right, clojure.main is the more modern entry point. I recommend you use it. both will work.
13:53lithperCool. All else being equal, less typing is better :-)
13:53rhickeyscgilardi: we just deprecated Repl
13:53LauJensenstuartsierra: I get this when I call compile on the ns, java.lang.ClassNotFoundException: test$loading__6213__auto____2583
13:53scgilardistuartsierra: ok, that should get us either all the way tehre or mostly.
13:53scgilardirhickey: I saw that. Nice.
13:54scgilardiLauJensen: 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:55chouserLauJensen: you can't use a class that has no package name
13:55stuartsierraLauJensen: You also can't instantiate a class that hasn't been compiled yet.
13:55chouseryou need at least lau.test
13:55LauJensenReally, why ?
13:55stuartsierraSo you can't do (ns foo (:gen-class)) (def instance (new foo))
13:56lithperBTW, I presume that since clojure is a Java program, I can run it in a browser, yes?
13:56rhickeyso, do we want clojure.jar in the zip or clojure-1.1.0.jar?
13:57sbenitezbversioned is better
13:57lithper@rhickey: why not just use a symlink?
13:57stuartsierraI couldn't decide. The readme says "clojure.jar", so that's what I used.
13:57stuartsierralithper: Yes, Clojure can run in a browser, subject to some Java security wrangling.
13:57scgilardiI 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:57stuartsierralithper: symlinks aren't cross-platform.
13:57chouserlithper: 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:58lithperOK, sounds like more than I want to get into at the moment. I'll just run it standalone for now.
13:58lithperThanks!
13:58sbenitezbshouldn't it be treated as .so files, so they don't clash if multiple versions live in the classpath?
13:58rhickeythe directory it is in has a version number in it
13:59bagucodetechnomancy: 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:59KirinDave_does anyone have a really outstanding monad tutorial I could go over?
13:59rhickeysince the normal ant build copies to clojure.jar, I think we should go with that
13:59KirinDave_I'm having a lot of trouble getting them.
13:59rhickeyany issues with that?
14:00rhickeyKirinDave_: monads are not an important part of Clojure, if that matters
14:00KirinDave_rhickey: I keep running into people using them.
14:00KirinDave_rhickey: And their code seems very short compared to how i'd normally have to write what they're doing.
14:01scgilardirhickey: I like that plan: using clojure.jar without a version number qualifier in the distributed zip.
14:01LauJensenI'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:02rhickeyKirinDave_: I'm not trying to discourage you - go for it
14:02chouserLauJensen: you have your "classes" output directory in you classpath?
14:02LauJensenYes sir
14:03bagucodeKirinDave_: Have you looked at this? http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/
14:03scgilardialso http://intensivesystems.net/tutorials/monads_101.html
14:03KirinDave_bagucode: I do...
14:03KirinDave_err, I have
14:04KirinDave_and I sort of get the structure of a monad
14:04KirinDave_But I still can't identify what "mystery" in part 2 is.
14:04KirinDave_When i run it, it always returns nil no matter what.
14:04LauJensenChouser, I got it
14:05LauJensenFirst remove the instantiation, then compile, re-insert it, re-compile
14:05stuartsierraLauJensen: You really shouldn't try to instantiate something in the top-level of the namespace that defines it.
14:06bagucodeKirinDave_: 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:06LauJensenstuartsierra: I was mimicing a Java example - How else would you do iit?
14:06KirinDave_I want to understand this code: http://intensivesystems.net/tutorials/code/web_session.clj
14:06KirinDave_That's some hardcore stuff.
14:06stuartsierraLauJensen: Provide a constructor function that returns a new instance.
14:07stuartsierraRemember, compiling a .clj file is equivalent to executing it.
14:07stuartsierraAll your top-level defs get evaluated.
14:08stuartsierragot to go
14:09LauJensenstuartsierra: Am I mixing up terms here? Calling compile AOT compiles right?
14:09rhickeyI guess we have to stick with googlecode for downloads with stats?
14:10chouserLauJensen: compiles and executes, as it must.
14:12LauJensenkthx
14:12LauJensenrhickey: You want to know how many clones, or how many does regular downloads?
14:13rhickeyLauJensen: downloads
14:13rhickeyof the zip release
14:14LauJensenYea I think you need to put it somewhere else
14:16rhickeyso with the branch in the name, is it going to end up being clojure-1.1.0-1.1.x-RELEASE.zip?
14:16chouseryikes
14:16rhickeyright
14:16chousercan we assume RELEASE if it's not SNAPSHOT?
14:17chousermaybe that's not the maven way
14:17rhickeyI'm more concerned about 1.1.0-1.1.x
14:17rhickeythe maven way, that's what I am clueless about
14:18chouserI 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:18chouserbut if it were still "alpha", what would be there for release? "release"?
14:18chouserclojure-1.1.0-release-RELEASE.zip?
14:19scgilardichouser: I think "qualifier" is a generic name for a reason.
14:20scgilardiwhen downloading jars using maven, ones with specific versions do not have a suffix. for example: spring-core-2.5.6.jar
14:20scgilardis/specific/final
14:24rhickeyso now in the 1.1.x branch I should change qualifier to what?
14:25rhickeyfor the release candidates and then release
14:25chouserah! that's it.
14:25chouserrc0, rc1 for release candidates?
14:25chouserthen ... blank for release?
14:25rhickeyor just rc and I can number the zips?
14:26scgilardifinal release should have no qualifier
14:26rhickeythat means missing or qualifer= nothing?
14:27rhickeywhat a .properties file comment?
14:27rhickey#?
14:27bagucode#
14:28rhickeyhrm, clojure-1.1.0-${clojure.version.qualifier}.jar
14:28rhickeywhen missing
14:29scgilardithat'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:29scgilardis/=//
14:30rhickeyok when qualifier= nothing
14:31rhickeyrelease candidate - interim= ?
14:32rhickeyclojure-1.1.0-rc0-SNAPSHOT.zip?
14:32scgilardilooks like interim should be false
14:34scgilardimaybe: false for the one build that is rc0 and then true again until we generate rc1
14:43dysingerchouser: 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:44dysingerIs it necessary to have an RC ?
14:45dysingerWe've all been following 1.1 snapshots for a long time
14:45dysingerWhat I meant is that it could just stay SNAPSHOT until final
14:46rhickeyhttp://clojure.googlecode.com/files/clojure-1.1.0-rc0.zip
14:46chouserIt'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:46dysingertrue
14:47rhickeydysinger: actually 30-40% of us haven't been
14:47dysingerah
14:47rhickeypeople like their downloads
14:48chouseralso can help test the .zip itself
14:48dysingerThe 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:48scgilardireadme.txt: To Run java -cp clojure.jar clojure.lang.Repl :)
14:48rhickeythere is now a 1.1.x branch
14:49rhickeyscgilardi: nw you tell me! :)
14:51dysingerWhat 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:51LauJensenrhickey: 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:51dysingerthat way people checking the code out can see that "master" means just that "the gold standard"
14:52dysingerrather than active development
14:53rhickeydysinger: doesn't master just mean last relase then?
14:53dysingeryes
14:53rhickeymeh
14:53dysinger:)
14:54dysingermaster is just another branch - depends on how you look at it.
14:55Chousukegit seems to have a rather interesting branch model
14:55Chousukethere are no branches for releases as far as I can tell
14:55Chousukeonly tags.
14:55ChousukeI mean git the project.
14:56Chousukethen there's a maintenance branch and master and "next". hmm.
14:56dysingerI only use branches for active development
14:57dysingerI use master, test and next
14:57dysingerand other topic branches
14:57headiusI always commit to master, but I'm still an svn user at heart
14:57dysingermaster 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:57headiusif we didn't do it this way, we'd have a "dirty" branch everyone uses
14:57the-kennymaster is the main-branch for development imo.
14:58dysingerthat's svn thinking IMO
14:58headiusbut always one branch...unless you have hundreds of devs, everyone using their own branch is a major PITA
14:58the-kennyI use branching for developing additional "modules" while I work on master at the same time
14:58LauJensenrhickey: At the very bottom of this page, there's a broken link to trampoline: http://clojure.org/functional_programming
14:59dysingerheadius:
14:59Chousukedid all the fixes for 1.0.0 even get applied to the 1.0.x branch? :/
14:59dysingerneat gem trick yesterday
14:59dysingerthat will be useful for us.
14:59chouserChousuke: I don't know if any were written
15:00Chousukechouser: weren't there several patches for 1.0 in the ticket system? :/
15:00Chousukeat least I had one that applied both to master and 1.0
15:00headiusdysinger: I'm talking to some maven repo folks about setting up a transparent gem server that automatically presents all maven artifacts as gems
15:00headiuslikely using my code as a seed
15:01dysingerneat
15:01Chousukeoh well, I suppose it'll take a few more release cycles until things get sorted out for real .)
15:01chouserChousuke: 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:01headiusI 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:02rhickeyany other fixes for rc1 before I push it to googlecode and announce on ggroup?
15:02dysingery it's neat
15:02headiusproject #153, whenever I get around to it
15:02dysingerheadius: we have jruby / rails ui & clojure backend (systems) code (so does flightcaster & runa)
15:02dysingerso it's totally useful :)
15:03Chousukerhickey: there's a slight doc problem in clojure.test I think
15:03Chousukerhickey: it still refers to a solved bug on google code
15:03LauJensenYea rhickey, I still think you need (nth idx coll) instead of (nth coll idx) :)
15:03rhickeyChousuke: that's not going to get fixed
15:04chouserdysinger: all in the same JVM instance?
15:04dysingerno different clusters
15:04chouseryeah, ok
15:04dysingerbut mvn2gem would be useful for sharing code
15:05dysingerbetween clojure & jruby
15:05dysingernow we just ned gem2mvn (noo!! it burnses!)
15:05scgilardirhickey: 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:05lpetitI 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:06rhickeyhttp://clojure.googlecode.com/files/clojure-1.1.0-rc1.zip
15:07rhickeyscgilardi: ok
15:07rhickeylpetit: depends on the change - the one scgilardi just pointed out should be a patch against the 1.1.x branch
15:09lpetitrhickey: ah ok, so now 1.1.x
15:20chouserdysinger: is disclojure.org yours?
15:20dysingerno
15:21dysingerhe's on twitter - I'm not sure who it is yet
15:21chouseroh. his name's right there at the bottom. Antoni Batchelli
15:21maaclHas anyone tried using couchdb-lucene from Clojure?
15:21chouserdunno how I missed that before
15:25dysingermaacl technomancy and I used that combo before
15:28maacldysinger: Did you use any of the libs on github like clutch? I can't find any libs that appear to support it.
15:31replacachouser: Toni is a clojure developer here in SF
15:34dysingermaacl: there is clutch (haven't tried) - we used clojure-couchdb
15:35cemerickmaacl: we like clutch here, FWIW
15:35cemerickit's got a view server, which is handy
15:37mudphone`chouser: disclojure.org is anthony batchelli
15:38maaclcemerick: dysinger: But neither supports interacting with couchdb-lucene right?
15:38chouserthanks guys. It's a great service.
15:38dysingermaacl: correct
15:38cemerickmaacl: I've never looked at couchdb-lucene at all. Haven't noticed anything about in clutch *shrug*
15:38dysingermaacl: couchdb-lucene is just a canned way to index couchdb docs
15:38cemerickI'm holding out for FTI baked in to couchdb
15:39maacldysinger: so how did you solve that ? http-clj or ?
15:39dysingercemerick: I saw some native erlang indexing on github the other day - haven't tried it yet.
15:39cemerickdysinger: 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:40maaclcemerick: Ok, so for now you just stick to supporting exact searches?
15:40cemerickhopefully we can get it without a store-format change
15:41dysingermaacl: our experience was that it just worked (couchdb-lucene)
15:41cemerickmaacl: 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:41dysingerand we used clojure to interact w/ couchdb via HTTP REST
15:41cemerickthe clojure view server was way more of a win for us than indexing
15:42dysingercemerick: github.com/bdionne/indexer
15:42dysingercemerick: is that public (clojure view server code) ?
15:42cemerickdysinger: http://github.com/tashafa/clutch/
15:43dysingerah
15:43dysingerI thought that was a client - not paying attention ....
15:43cemerickit's both
15:43cemerickdouble the value, baby!
15:43cemerickahem.
15:44lghtngis rdfm in clojure?
15:44chouserlghtng: it's a separate lib
15:44lghtngok
15:44maacldysinger: ok, thks
15:54chouserLauJensen: thanks for reporting that broken link
15:54LauJensennp
15:55chouserit's fixed
15:55LauJensenGood - So I can finally get some trampoline action
15:56LauJensenAbout nth, am I the only one who thinks it should be changed?
15:57chouserI think it came up on the ggroup a while ago
15:59lpetit,(doc nth)
15:59clojurebot"([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:00chouserok, there were a bunch of links I had missed in the Features section before. Those should be fixed now.
16:00LauJensenGood job
16:01chousernth has the same arg-order as get
16:02scgilardithe 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:03chouseryeah, might be worth saying "for lists and sequences."
16:05lpetit,(doc get)
16:05clojurebot"([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present."
16:06lpetit,(get [:a :b :c] 1)
16:06clojurebot:b
16:06lpetitcould the doc for get use something different than map as arg name ?
16:06scgilardiclojurebot adopting a 'tude or was he framed
16:07lpetit~source get
16:07KirinDave_Haha
16:07KirinDave_Helpful?
16:07KirinDave_What is clojure.lang.RT?
16:08the-kennyclojurebot: clojure.lang.RT
16:08clojurebotclojure is cheating
16:08hiredman_R(un)T(ime)
16:08technomancyKirinDave_: lots of the basic fns in clojure.core are wrappers around RT
16:08hiredman_~source c.l.RT
16:09KirinDave_Haha, man
16:09KirinDave_I love reading Clojure's source code, just to see java's syntax squeal like a pig.
16:11lpetitWhat's the future name of the protocol the arg named "map" in get's arglist will have to comply to ?
16:12chouserlpetit: probably Associative or something related
16:12hiredman_possibly something like the ILookUp interface
16:12lpetitchouser: yeah, I thought so, but currently ITransientAssociative just implements assoc()
16:12chouseroh, hiredman_'s probably closer
16:12lpetitye
16:13lpetits
16:13chouserI keep forgetting about ILookUp
16:14lpetitbut 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:14lpetits/would//
16:16hiredman_"this started out as a very specific function, now it is very generic, check the source"
16:17lpetit:)
16:19hiredman_,(doc reify)
16:19clojurebotI don't understand.
16:19hiredman_of course not
16:20hiredman_,(alter-meta! #'get assoc :doc "magic")
16:20clojurebot{:ns #<Namespace clojure.core>, :name get, :file "clojure/core.clj", :line 954, :arglists ([map key] [map key not-found]), :doc "magic"}
16:20hiredman_,(doc get)
16:20clojurebot"([map key] [map key not-found]); magic"
16:20lpetitoh
16:22hiredman_http://github.com/trotter/bert-clj <-- ooh
16:27lpetitWhat'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:27lghtngC-x o
16:27the-kennyOr with slime-selector: C-c s r
16:28the-kenny(Slime selector is a really cool tool)
16:29lpetitit's the same shortcut for going in the REPL, and then later back to the editor ?
16:29lghtngits the shortcut for 'other window'
16:29lpetitthe-kenny: what does slime-selector offer, apart the fact it's more keys to type ?
16:30the-kennylpetit: It's a tool to switch between multiple lisp-related things.
16:30lpetitlghtng: it's like switching apps in the X system ?
16:30the-kennyFor example open lisp-files, *inferior lisp*, the repl, help, slime connections, slime threads
16:30lpetitthe-kenny: ok, so maybe you have to repeat it to go to the right thing ? (just trying to understand)
16:30lghtngthere'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:31lghtngand theres a few things like ido and ibuffers as if that werent enough :D
16:31the-kennyiswitchb ftw :)
16:32lghtnghave it YOUR way :D
16:32lpetitlghtng: 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:32the-kennylpetit: No
16:32the-kennyUse C-x b for that
16:32lghtngyeah, i saw a video where a guy had a shortcut for opening a repl ON THAT FILE, but i dont recal it
16:32lpetitI 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:33lghtngthere are emacs shortcuts for eclipse
16:33lghtngits a setting or preference, i think
16:33rulliei doubt eclipse gives you a mini buffer
16:34lghtngno, but the keybindings are there
16:34lpetitlghtng: 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:34lghtngalso, there's a sbcl plugin for eclipse that does have a repl, might look at what they do
16:35lpetitrullie: 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:35lpetit?
16:35the-kennytechnomancy: How often do you push new versions of swank-clojure up to elpa?
16:35lghtngtheoretically, you can use clojure to simply make eclipse do whatever you want :D
16:36lghtngdont you have access to the eclipse libraries with the repl?
16:36lpetitlghtng: 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:37lghtngi refer you to #emacs for keybinding debates
16:37technomancythe-kenny: very infrequently, but the elisp portions of swank-clojure are not very interesting. it's the jar that contains all the goodies.
16:37doublindirectionlpetit, closest thing to minibuffer in eclipse is probably "Quick Access" Control-3 is the shortcut
16:37lpetitlghtng: 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:38the-kennytechnomancy: okay.. how often do you push the .jar to clojars, then? ;)
16:38lpetitlghtng: 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:38technomancylpetit: C-c C-z goes from .clj files to the repl; I don't think there's a "most recent clj file" command.
16:38lghtngright, 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:39technomancythe-kenny: well I haven't hacked on swank-clojure at all since clojars was made public
16:39lpetittechnomancy: 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:41lghtnglike (add-hook 'clojure-mode-hook '(
16:41lghtngetc
16:41lghtngcant you do something like that at the eclipse repl?
16:42lghtngi think the J editor for ABCL does something similar, but i dont recall
16:48lpetitok, cool, nothing to code: Eclipse provides Ctrl + F7 to navigate between the last 2 views having received the focus
16:48lghtngex. (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:48lghtngoh, ok
16:50polypusdo you guys know how to set the emacs cursor's foreground color?
16:50LauJensenæl,h
16:50LauJensenoops
16:51LauJensenpolypus: some probably do, but the guys at #emacs are really the experts, usually you get quick answers
16:51polypusk ty
16:51lghtnganother way is to do it globally (global-set-key (kbd "C-xr") '(switch-to-buffer-other-window (*slime-repl clojure*)))
16:52lghtngpolypus: M-x apropos <ret> faces
16:53lghtngand yes, Lau is right
17:01KirinDave_Is there any work on getting GCLS entries for clojure up?
17:02chouserGloucester County Library System?
17:02chouserGolden Crown Literary Society?
17:02chouserGraduate College - Life Sciences?
17:02sbenitezbprobably garbage collector something?
17:03KirinDave_http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&amp;lang=scala&amp;lang2=hipe&amp;box=1
17:03KirinDave_Great Computer Language Shootout. C'mon.
17:03KirinDave_Not that i really like the practice.
17:03KirinDave_But people keep asking me
17:03technomancyKirinDave_: isn't that pretty heavily biased against hotspot?
17:04_mstcould we just call out to the java versions and say we're done? :)
17:04KirinDave_technomancy: They bring it to steady state.
17:04_mstsort of in the clojure spirit of pragmatism...
17:04chouser_mst: nice
17:04KirinDave_technomancy: All the java versions have that option.
17:05chouserjust like clojure already has xml parsers, IO and GUI infrastructure, it already has the shootout covered. :-)
17:05KirinDave_So I take it that's a "No."
17:06KirinDave_Lots of people who are Scala users keep asking me what Clojure's performance is like.
17:06KirinDave_Like I know, or something. :)
17:06chouserpoint them at _ato's widefinder blog and say "faster than scala".
17:06_mstafter recently being dragged along behind _ato's optimisation jag, I think I've had enough for a little while ;)
17:06chouserthen shrug dismissively
17:06KirinDave_chouser: Link plz?
17:07KirinDave_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:07chouserKirinDave_: http://tinyurl.com/y9e9jo6
17:07KirinDave_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:07KirinDave_I'd rather do this upcoming proj in clojure than scala, but I need to get the majority on board with that.
17:17danm_KirinDave_: the trouble with scala for me, is the core language is too complex
17:17danm_what I like about lisp is how easy the core language is to "get"
17:17KirinDave_danm_: As an erlang developer I'm not complaining about that. :)
17:18KirinDave_But I just hate having homogenous data structures. It's so lame.
17:18danm_I think erlang is more simple like clojure
17:18KirinDave_I don't.
17:18KirinDave_The binary pattern matching syntax alone is a language unto itself. A cool language, mind you, but still.
17:18danm_it just doesn't have the overwhelming number of language features that scala has
17:18chouserrhickey: any desire to have merge and merge-with use transients?
17:18the-kennyPattern Matching of erlang is one thing I miss in clojure
17:19KirinDave_the-kenny: Yeah.
17:19chouser~pattern matching
17:19clojurebotHuh?
17:19chouser~patterns
17:19clojurebotI don't understand.
17:19chouser~google pattern matching clojure
17:19clojurebotFirst, out of 1770 results is:
17:19clojurebotbrool » Pattern Matching In Clojure
17:19clojurebothttp://www.brool.com/index.php/pattern-matching-in-clojure
17:20hiredman_,(doc match)
17:20clojurebotExcuse me?
17:20danm_and working with a lisp has made me appreciate that less syntax is sometimes more ;)
17:20hiredman_I think there is some kind of matching macro in contrib these days
17:21chouserrhickey: or conj, for that matter.
17:21danm_chouser: nifty.
17:23joshua-choiI'm trying to decide something
17:23joshua-choiI have a library called FnParse that basically generates PEGs
17:23joshua-choiBut it's pretty naive
17:23joshua-choiI want to split it into two libraries:
17:23Chousukechouser: Hmm, do you think anyone ever uses conj to add more than a few items? /:
17:24joshua-choione being a packrat parser, and the other being a Parsec-like, mostly-LL(1) parser
17:24chouserChousuke: yeah, perhaps not conj. :-)
17:25joshua-choiMy 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:26joshua-choi'Cause if I keep them together, then anyone who wants to use one would have to download (and build) the other...
17:26joshua-choiAnd their usage is really different
17:26ChousukeI should probably read a bit more about parsing before I continue porting my reader to the new branch ;P
17:28hiredman_:/
17:28Chousukeor actually it's ported already. I just want to rewrite it to something a bit more flexible.
17:28hiredman_if you split fnparse I have no idea which part I use
17:28joshua-choiYeah
17:28hiredman_Chousuke: nice
17:28drewrjoshua-choi: I would do it gradually
17:28joshua-choiIn either case, I definitely would document the differences between the two
17:28joshua-choiHmm
17:29joshua-choiSee, I don't see a way to reconcile the two styles of parsing that I need to use
17:29drewrsplit them within the current repo, demarcate, evolve, demarcate, etc.
17:29joshua-choiDemarcate?
17:29Chousukesince I already have a working reader written in clojure I hope I can avoid all the nasty java-related headaches I had initially ;/
17:29drewrjoshua-choi: figure out where the boundaries are
17:29joshua-choiHmm.
17:30ChousukeI think it'd be fine to have them in the same repo initially
17:30Chousukeif it turns out they really need to be separate, you can split them
17:31joshua-choiI'll leave the current version alone in any case
17:31joshua-choiHmm, maybe
17:31drewrChousuke++
17:31chouseryou can do releases as separate .zip or .jar files from a single git repo
17:31joshua-choiIs there a way to automate that?
17:31chouserprobably. :-
17:31chouser:-)
17:31joshua-choiDo Ant or Maven or Leinegen (don't know how to spell it!) have any way to do that?
17:32joshua-choiI'm wondering if this is a common thing to do
17:32hiredman_ant will for sure
17:32hiredman_ant is xml shellscripting, so you can do whatever
17:32joshua-choiI'm kind of afraid of Ant; don't know a thing about it
17:33joshua-choiI was really happy when Leinegen (sp?) came out
17:33ChousukeLeiningen
17:33Chousukejust call it lein
17:33joshua-choiLein-in-gen
17:33tomojI'm still afraid of lein :(
17:34joshua-choiIt looks really easy; at least, Clojars' documentation makes it seem so
17:34drewractually a couple times
17:34LauJensenAren't you guys trying to Clojuresque/Gradle yet? :)
17:34joshua-choiI haven't heard of that
17:34tomojI'm ever more afraid of that, though for no good reason
17:34hiredman_I have a clojureql jar already
17:35LauJensentomoj, it couldn't be simpler
17:36hiredman_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:36chouserlein specs are in clojure and gradle are in groovy, right?
17:36joshua-choiOh crap—you actually used FnParse 1 on ClojureBot?
17:37hiredman_I think it was 1
17:37joshua-choiI'm honored; but that was before monads and complex were added, which would have made your life easier
17:38hiredman_I doubt monads have ever made life easier
17:38joshua-choiThey really do for defining parsers' semantics
17:38hiredman_I just do really simple parsing
17:39somnium``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:39joshua-choiCan Clojuresque do that sort of thing—build two JARs from different parts of the source tree?
17:40hiredman_http://github.com/hiredman/clojurebot/blob/master/hiredman/clojurebot/factoids.clj
17:41technomancyjoshua-choi: leiningen doesn't support multi-module builds yet, but adding that is high on my list
17:41joshua-choiWonderful
17:42LauJensenjoschua, sure - Clojuresque is just a plugin for Gradle and Gradle does about everything conceivable
17:43joshua-choiWhere would I find documentation to figure out how to do that?
17:44LauJensensec
17:44joshua-choihiredman_: Most of the places where you use fp/semantics would be clearer with fp/complex in FnParse 2
17:44LauJensenhttp://www.gradle.org/0.8/docs/userguide/userguide_single.html
17:44LauJensenand joshua-choi, see the 'Building the thing' section, http://www.bestinclass.dk/index.php/2009/12/clojureql-where-are-we-going/
17:45hiredman_I will remember that next time I write a rule
17:46hiredman_although, really, that file is just begging for some attention
17:46mabeshow 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:46joshua-choiWell, if you've already written it, and it's not heavily maintained, there's no point in changing it until you have to
17:46mabes,(= [1 2 3] '(1 2 3))
17:46clojurebottrue
17:46joshua-choiUse vector? I guess
17:47mabeshmm.. maybe clojure.test has something that like already...
17:48somnium``,(== [1 2 3] '(1 2 3))
17:48clojurebotfalse
17:48somnium``though
17:48joshua-choi,(== [1 2 3] [1 2 3])
17:48clojurebotfalse
17:48somnium``ah
17:48somnium``,(doc ==)
17:48clojurebot"([x] [x y] [x y & more]); Returns non-nil if nums all have the same value, otherwise false"
17:49joshua-choi,(letfn [(matches-vector? [obj vec] (and (vector? obj) (= obj vec)))] (matches-vector? (1 2 3) [1 2 3]))
17:49clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
17:49joshua-choiEh?
17:50joshua-choiOh
17:50joshua-choi,(letfn [(matches-vector? [obj vec] (and (vector? obj) (= obj vec)))] (matches-vector? '(1 2 3) [1 2 3]))
17:50clojurebotfalse
17:50joshua-choiAnyways, thanks for everyone's help
17:51devlinsfchouser: ping
17:51joshua-choiI 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:51joshua-choiCiao
17:56hiredman_,((comp (partial every? true?) (juxt (comp (partial reduce =) (partial map type)) (partial apply =)) list) [1 2] [1 3])
17:56clojurebotfalse
17:56hiredman_,((comp (partial every? true?) (juxt (comp (partial reduce =) (partial map type)) (partial apply =)) list) [1 2] [1 2])
17:56clojurebottrue
17:56hiredman_,((comp (partial every? true?) (juxt (comp (partial reduce =) (partial map type)) (partial apply =)) list) [1 2] (1 2))
17:56clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
17:56hiredman_,((comp (partial every? true?) (juxt (comp (partial reduce =) (partial map type)) (partial apply =)) list) [1 2] '(1 2))
17:56clojurebotfalse
17:57hiredman_♥ juxt
17:57devlinsf:)
18:00BrianB04Good evening all.
18:30defnDoug McIlroy patented macros.
18:49polypusi'm gonna patent functions. bet nobody has yet
18:59defnOooo, 1.1.0rc1
19:00cark,(doc juxt)
19:00clojurebot"([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:01carkhum
19:01devlinsfStart w/ a map. Good for preserving order
19:02devlinsf,((juxt :a :b) {:a 1 :b 2 :c 3})
19:02clojurebot[1 2]
19:02carkah that's interesting
19:03devlinsfYeah, then you can move on to other operations, like a mapping operator
19:04devlinsf,(map (juxt identity #(* % %)) (range 0 6))
19:04clojurebot([0 0] [1 1] [2 4] [3 9] [4 16] [5 25])
19:04bitbcktSeems more like distributivity than juxtaposition.
19:05devlinsfThe idea is that it is the "pair" of composition
19:05devlinsfjuxtaposition & composition sound the similar :)
19:06devlinsfer, similar
19:07bitbcktThe resultant pairs don't share a contrasting relationship. The word seems semantically wrong.
19:07devlinsfHmm... interesting
19:08devlinsfWell, the functions are done "side by side"
19:48DraggorAny compojure folk in here willing to lend a helping hand?
20:16replacabitbckt: suggest a better name - maybe in the group. I know Rich isn't completely happy with "juxt" either
20:18bitbcktreplaca: I did - dist, or similar - and I will.
20:27replacabitbckt: cool
20:43wlrbitbckt: http://clojure-log.n01se.net/date/2009-08-30.html#09:23-11:13
20:55alexykis there a library function to dedup a sorted vector?
20:55alexyki.e. uniq on Unix?
20:56devlinsfdistinct
20:56devlinsf,(distinct [:a :b :a])
20:56clojurebot(:a :b)
20:57alexykdevlinsf: will it be efficient on a 10 million-length vector? I only want to dedup adjacents
20:57devlinsfUhhh... I dunno
20:58devlinsfNever used it significantly over 10K
21:01chouseralexyk: it builds a set of all items seen
21:01alexykchouser: so if I have a sorted vector, I'd probably be faster reduce'ing it, collapsing same runs, right?
21:02chouserprobably
21:02devlinsfcan you used a sorted set?
21:02chouserooh, good question.
21:02alexykdevlinsf: is there such a thing? :)
21:02chouser,(sorted-set 5 3 4 3 2 2 5 1 3 1)
21:02devlinsfMathematically, no :)
21:02clojurebot#{1 2 3 4 5}
21:03devlinsfIn JavaLand, yes
21:03alexykinteresting
21:03alexyk,(doc sorted-set)
21:03clojurebot"([& keys]); Returns a new sorted set with supplied keys."
21:03devlinsfYeah, really handy w/ strings
21:03chouserit's a red-black tree
21:03alexyk,(sorted-set 1 1 2 3 2 4 1 1 3)
21:03clojurebot#{1 2 3 4}
21:03alexykcool
21:03devlinsfThere's also sorted-set-by
21:04devlinsf,(sorted-set-by (comp - compare) 1 1 2 3 2 4 1 1 3)
21:04clojurebotjava.lang.Exception: Unable to resolve symbol: sorted-set-by in this context
21:04devlinsf???
21:05devlinsfUh... weird. Works in my REPL
21:06devlinsf,(doc sorted-set-by)
21:06clojurebotI don't understand.
21:06chouser,(reduce #(if (= %2 (peek %1)) %1 (conj %1 %2)) [] [1 2 4 4 5 5 5 5 6 6 8])
21:06clojurebot[1 2 4 5 6 8]
21:06chouser,(reify Object)
21:06clojurebot#<sandbox$eval$reify__4913 sandbox$eval$reify__4913@731e16>
21:07chouserdevlinsf: I think clojurebot's using an old versions of the 'new' branch
21:07devlinsfOh
21:07chouserat the moment
21:07chouser,*clojure-version*
21:07clojurebot{:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"}
21:07devlinsfOkay, I'm not crazy
21:07devlinsfAt least, not for this reason
21:07chouser:-)
21:10devlinsfchouser: Hey, you mentioned you had a chance to review my map docs
21:11chouserI did. Do you know about 'empty'?
21:11devlinsfI'm playing around with some other higher-higher-order functions, and wold like to know what you think of the first batch
21:11devlinsfempty?
21:11devlinsfAh
21:11devlinsfThat could help
21:12chouserI wasn't sure, but might that remove the need for the sorted vs unsorted fns
21:12chouser?
21:13devlinsfHmmmm... seems to
21:13devlinsfI like it
21:13devlinsfNo
21:13devlinsfIt fails the following test
21:13devlinsf(let [s (sorted-set-by (comp - compare) 1 3 4)] (into (empty s) s))
21:14devlinsfIt doesn't preserve the comparator
21:14chouserhm. I bet it's supposed to.
21:14devlinsfThat would work for me
21:15devlinsfrhickey: ping
21:17devlinsfchouser: Did the visitors work, though?
21:17chouserhttp://www.assembla.com/spaces/clojure/tickets/128
21:18chouserI haven't had a chance to try them yet, but I'm sure they do.
21:18devlinsfchouser: I'm working on a more general concept
21:22devlinsfchouser: http://fulldisclojure.blogspot.com/2009/12/intorducting-same.html
21:33chouser'same' is built directly on visitor?
21:34devlinsfno
21:34devlinsfSame idea
21:34devlinsfSame only needs a return fn, because the visit fn is identity
21:35devlinsfI added some gists in the past few minutes, sorry if it was confusing
21:37chouseroh, I had js off. :-)
21:38devlinsfStill using lynx?
21:38devlinsf:)
21:38chouserfirefox + noscript. love it.
21:38devlinsfAh
21:48alexykis 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:49cp2(fn [k v] ...): k, v are just normal parameter
21:49cp2s
21:49cp2there is no desctructuring going oon
21:50alexykI know, I know. 3rd time today I know. :)
21:50alexykit's just the dumbness is recurrent.
21:50cp2just remember the destructured params need to be in their own vector
21:50cp2ugh, this keyuboardd drives me nuts
21:50alexykit's easy for you to say, just
21:51alexykI need a funny verse to remember
21:51devlinsfalexyk: Just keep hacking
21:51devlinsfalexyk: You'll get it
21:51cp2agreed
21:51alexykdoes Common Lisp have same destructuring as Clojure?
21:55jasappit has some destructuring, but not nearly as much
21:55jasappand it's not as clean, in my opinion, either
21:55chouserit's got destructuring-bind, but that's about multiple return values, right?
21:56_mstmultiple-value-bind was return values
21:56_mstone of those features you rarely use because you fall asleep while typing it out :)
21:56chouserheh
22:18alexykchouser: 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:19alexykis there a sorted multi-set? :)
22:24durka42i thought sets don't have an order at all
22:24alexykdurka42: ,(doc sorted-set)
22:24alexyk,(doc sorted-set)
22:24clojurebot"([& keys]); Returns a new sorted set with supplied keys."
22:24devlinsfdurka42: Mathematically, yes
22:28durka42,(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:28clojurebotjava.lang.Exception: Unable to resolve symbol: group-by in this context
22:28durka42,(use 'clojure.contrib.seq-utils)
22:28clojurebotnil
22:28durka42,(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:28clojurebot([1 3] [2 3] [3 3] [4 2] [5 5])
22:30devlinsf ,(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:31joshua-choiHey, 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:31joshua-choiIn other words, a version of reduce that returns all the intermediate values too
22:31devlinsfreductions
22:31devlinsfc.c.seq-utils
22:31joshua-choiExcellent
22:31alexykdurka42: very nice
22:31joshua-choiDoes it use chunked-seqs?
22:32devlinsfDunno
22:32joshua-choiYet?
22:32devlinsfProbably not, I don't think it has been touched yet
22:32joshua-choiYeah, that makes sense; it's a bleeding-edge feature anyway
22:32joshua-choiBut they're real nice
22:33durka42devlinsf: juxt is nice
22:33joshua-choiIs juxt slated for core 1.1?
22:33devlinsfIt's in the RC
22:34devlinsfThe name is up in the air.
22:34durka42i'm not a huge fan of the name but i like the function
22:34devlinsfWe'll see what everyone says on the list, and Rich will decided
22:34devlinsfAdmittedly, the name has been hard to get right
22:35joshua-choiIf it's a useful function, it should have a short name [stating the obvious]
22:36joshua-choiBut, is it a useful function? What would you use it for?
22:36devlinsfpoint free style
22:37devlinsfmapping operations, composition, group-by
22:37devlinsfjoin operations
22:38joshua-choiSee, I use composition and group-by all the time; but juxt is a little more...well, I guess it is a composing function
22:38devlinsfYeah, comp "reduces" a list of fns, right?
22:38devlinsfjuxt maps them
22:38joshua-choiOh
22:38joshua-choiYeah, I see that
22:38joshua-choiThat makes sense
22:39alexyk,(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:39clojurebot[[1 3] [2 3] [3 3] [4 2] [5 5]]
22:39hiredman_for the record I have no problem with the name
22:39hiredman_~logs
22:39clojurebotlogs is http://clojure-log.n01se.net/
22:42joshua-choiI'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:42joshua-choi(In other words, (comp first some).)
22:42joshua-choiCrap, I mean (comp first filter)
22:42durka42(comp first filter) is the recommendation i've seen
22:42_atojoshua-choi: there's a find-first in contrib
22:43_ato,(doc find-first)
22:43clojurebot"([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:43devlinsfread up on seq-utils, folks
22:43joshua-choiI should
22:43devlinsfhttp://richhickey.github.com/clojure-contrib/seq-utils-api.html
22:43durka42~source find-first
22:43clojurebotPardon?
22:43_ato~def first-first
22:43clojurebotHuh?
22:43devlinsf_ato: Thanks
22:43alexyk,(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_atoerr
22:43clojurebot([1 3] [2 3] [3 3] [4 2] [5 5])
22:43_ato~def find-first
22:43clojurebotGabh mo leithscéal?
22:43alexykyay!
22:43_atooh.. is it broken?
22:43devlinsfYeah?
22:43_ato~def inc
22:44_atohmm.. doesn't work for contrib I guess
22:44alexykit works! :)
22:44durka42~def clojure.contrib.seq-utils/find-first
22:44alexykyou da man
22:44durka42^ dead link
22:44alexykI wonder whether my single-sweep reduce is faster though than group-by then map
22:44alexykbut, I also have sort
22:45durka42only a questionable microbenchmark can tell!
22:45alexykdurka42: exactly
22:45alexykbtw, what we just did is a standard rle function (run length encoding) which must be in seq-utils :)
22:46alexykas run-length-encoding
22:46alexykhow do I go about submitting it there?
22:46durka42,(frequencies [1 5 3 3 2 4 5 5 4 5 1 2 1 2 3 5])
22:46clojurebot{4 2, 2 3, 3 3, 5 5, 1 3}
22:47alexykI stand corrected: rle does not pre-sort. So I'd take my version and drop sort.
22:47hiredman_~source find-first
22:47alexykfrquencies sorts
22:47durka42well, frequencies is what we were doing, no?
22:48alexykhiredman_: does it waste a tinyurl each time?
22:48alexykdurka42: yes, we did just that. But I also did RLE. :)
22:48durka42soon we'll have to transition to tinyURLv6!
22:48alexykif you drop: gs (sort g) and replace gs by g in the rest
22:48hiredman_it used to memoize, but I think I turned it off for some reason and forgot to turn it back on
22:49alexykwell tinyurl must be smarter and check if it exists already, like tr.im does
22:50hiredman_alexyk: it might
22:50hiredman_infact, I think it does
22:51alexykso, is there room for run-length-encoding in seq-utils? how do folks submit to c.c.x.y?
22:51hiredman_the last time I started clojurebot github was in maintence mode or something so it couldn't fetch the info for contrib
22:51devlinsfalexyk: Start with getting a CA to Rich
22:52alexykCA?
22:52devlinsfContributor agreement
22:52devlinsfhttp://clojure.org/contributing
22:53devlinsfAlso, you might want to think about using partition by
22:53alexykok
22:54devlinsf(let [v [1 5 3 3 2 4 5 5 4 5 1 2 1 2 3 5]] (partition-by identity v))
22:54devlinsf,(let [v [1 5 3 3 2 4 5 5 4 5 1 2 1 2 3 5]] (partition-by identity v))
22:54clojurebot((1) (5) (3 3) (2) (4) (5 5) (4) (5) (1) (2) (1) (2) (3) (5))
22:54devlinsf,(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:54clojurebot([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:55devlinsfIs that you rle?
22:55alexykthat's more like it
22:55alexyk,(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:55clojurebot[[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:56alexykaligns
22:56alexyk,(= *2 *1)
22:56clojurebotjava.lang.IllegalStateException: Var clojure.core/*2 is unbound.
22:56durka42true
22:56devlinsfThe partition-by solution is lazy
22:56alexyk,damn-you-clojurebot
22:56clojurebotjava.lang.Exception: Unable to resolve symbol: damn-you-clojurebot in this context
22:57alexykdevlinsf: you mean it will yield par by pair?
22:57devlinsfYeah
22:57alexykpair
22:57alexykand reduce is not lazy?
22:58devlinsfDunno
22:58devlinsfdepends on how you use reduce
22:58alexykwell, I do tack on the rest after reduce... wonder if that breaks lazyness
22:59devlinsfbreaking lazyness isn't something I understnad 100%
22:59alexykdevlinsf: then you're not a manager :)
23:00devlinsfNo, you've got it backwards
23:00devlinsfmanagers MASTER laziness
23:00devlinsf:)
23:00alexykperhaps :)
23:00hiredman_reduce is not lazy
23:01devlinsfRight! It couldn't be
23:01devlinsfDuh
23:01hiredman_it can't be unless you have lazy evaluation, which clojure doesn't
23:02alexykhiredman_: ueah, just a hard-working American function. None of that European socialist crap.
23:03devlinsfUh-oh
23:03joshua-choireductions can be lazy, though, which is really useful
23:03alexykjust a reminder to them lazy defns
23:04devlinsf"I get more done when I'm lazy"
23:05devlinsfhttp://www.zazzle.com/i_get_more_done_when_im_lazy_clojure_on_back_tshirt-235284015952434496
23:05devlinsfCheck the front
23:06alexyknice
23:09alexykjoshua-choi: what's a reduction, as different from reduce?
23:09joshua-choiNo, I meant the reductions function from c.c.seq-utils that I was just introduced to
23:09devlinsfreductions
23:10joshua-choiIt's proving very useful with filter
23:10alexykah ok
23:10joshua-choiWish it was chunked though
23:11devlinsfI'm sure people will look into it post 1.1
23:11devlinsf(Within a few weeks)
23:11alexykthat T-shirt is $31.45, btw. Looks like the price was arrived at by a semi-random rearrangement of 1 3 4 5.
23:50joshua-choiGot a question on destructing bindings: namely, their speed
23:51joshua-choiAccording to http://gnuvince.wordpress.com/2009/05/11/clojure-performance-tips, using destructuring in let (and so, probably fn too) is pretty slow
23:52joshua-choiIs this still the case in Clojure now?
23:52joshua-choiOr, in performance-intensive loops, should I still use direct getting instead?