#clojure logs

2010-03-30

00:09brian__Hi, how can I tell the data type returned by a function?
00:10Raynes,(type (+ 3 3))
00:10clojurebotjava.lang.Integer
00:10brian__ok
00:11brian__tnx
00:12nteonthat JD decompiler gives me wrong answers.
00:13nteonjust for everyones information
00:14woobyarohner, got it! thanks in no small part to your insight http://gist.github.com/348741
00:14nteonhttp://fpaste.org/LeHL/
00:14nteoni know this actual function works
00:15arohnerwooby: great
00:15nteonbut I can't see how it could work if that is _actually_ representative of the generated bitcode
00:16nteonaccording to JS decompiler, we find the (right) answers, then set the variable to null, then reference the variable
00:17nteoni have to bicycle home, but if anyone could look anad let me know in half an hour if I'm taking crazy pills, that would be aweome
00:41defnhttp://www.catonmat.net/blog/wp-content/plugins/wp-downloadMonitor/user_uploads/the_eternal_flame-god_wrote_in_lisp.mp3
00:44defn"and i basically hate hieroglyphs, so i wont write APL."
00:47nteonhi folks
00:48defnnteon: hello
00:53nteondefn: any chance I could persuade you or someone else to look at what I posted 3/4 of an hour ago in the scrollback? I apologize if anyone already responded; I had to go offline and don't have something like irssi setup
00:55joshua-choidefn: But APL is so *pretty*. And it got its own Unicode block!
00:56defnjoshua-choi: haha i was just laughing at the lyrics
00:56defnhttp://www.catonmat.net/blog/wp-content/plugins/wp-downloadMonitor/user_uploads/code_monkey.mp3
00:56defnthat's another excellent one
00:57joshua-choiWow, I didn't see that link.
00:57defnhaha these are great man
00:57joshua-choiThat's so...well, I'm smiling broadly :)
00:57woobywow
00:57woobygold
00:57defnpure gold
00:58joshua-choiI guess it was just a matter of time before a musical programmer did something. :)
00:58defnhaha these are all different submissions
00:58defni found these because of the crypt-o song: http://www.catonmat.net/blog/wp-content/plugins/wp-downloadMonitor/user_uploads/crypt-o.mp3
00:58joshua-choiAh. Well, it was a matter time before someone aggregated musical programmers. :)
00:58defnjoshua-choi: :)
00:59fanaticoyeah, thanks for linking to that.
00:59defnfanatico: no problem -- here's a page with a bunch more: http://www.catonmat.net/blog/musical-geek-friday-crypto/
01:00defnhttp://www.catonmat.net/blog/category/musical-geek-friday/
01:00defnthat's a better link
01:11defnYes, God had a deadline.
01:11defnSo he wrote it all in Lisp.
01:11defnhahah -- ah man -- geek love
01:11ndimidukis there an equivalent macro to doto which will conditionally apply the methods/functions against its first parameter?
01:12ndimidukor rather, i'd like to use a doto block, but call methods on a java object instance only (when ...) specific conditions are met for each method.
01:14ndimiduksomething like (doto* (Foo.) (when (pred-a?) (.bar)) (when (pred-b?) (.baz)))
01:15ndimidukor should i just use a let block? :)
01:16leifwndimiduk: I'd suggest composing a multimethod and doto somehow
01:16leifwbut I know very little about either, so maybe that is silly
01:16leifwI mean, depending on what kind of predicates you're looking at
01:17leifwsuppose you did have doto* like above, how are you intending to use it?
01:17ndimidukto conditionally call methods on an anonymous instance of a java object :)
01:18leifwyes, but on what sorts of conditions?
01:18noidindimiduk, maybe something like (doto foo (#(when cond (action %)))) ?
01:18leifwI guess I don't know anything builtin that will help; you should rpobably just roll your own
01:19noidioops, that cond is a bit misleading, I meant it as a variable there :)
01:19noidi(doto foo (#(when (.bar %) (action %))))
01:19ndimidukbasically, i have a thin clojure wrapper over a java library. This particular fn instantiates an api object, calls setters based on the existence of fn params, and returns the object
01:20ndimidukmore or less, i'm constructing api objects based on clojure maps.
01:21ndimidukthese objects tend to have default constructors and property setters. so, make the instance and then call the right setter if a key exists in the map
01:21leifwso you want to call something like (doto* instance (:field1 val1) (:field2 val2))
01:21ndimidukor, i guess more correctly, if a key value in the map is not nil
01:22leifwrather, (doto* instance {:field1 val1, :field2 val2})
01:22leifwtbh I'd just roll it myself
01:23ndimidukah, why not. just a sec.
01:24noidi(doseq [[k v] argmap] (condp k = :foo (.setFoo obj v), :bar (.setBar obj v)))
01:24leifwfor example: (defn setAll [inst setMap] (map (fn [[k v]] (when (contains? inst k) (. inst ((setter k) v)))) setMap))
01:25noidileifw, can you stuff methods into maps?
01:26leifwsure
01:27leifwhttp://clojure.org/java_interop#Java%20Interop-The%20Dot%20special%20form-%28memfn%20method-name%20arg-names%2A%29
01:27leifwhmm
01:27leifw,(doc memfn)
01:27clojurebot"([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn."
01:27leifwthere it is
01:27noidithanks
01:28noidiit's better to use doseq instead of map there, because map is lazy
01:29leifwnoidi: yup
01:29leifwI frequently run into that issue and get confused for 10 minutes
01:29leifw:/
01:29ndimidukI want to make this method simpler: http://github.com/ndimiduk/clobo/blob/master/src/clobo.clj#L40
01:29noidiyeah, I learned the difference the hard way :)
01:30noidiafter lots of painful debugging
01:30ndimidukplease forgive me. this is my first clojure code in the wild - be kind by being cruel ;)
01:30leifwdid I miss something, or does that infinitely loop on (facet-spec [])?
01:32leifwseems pretty straightforward to me
01:32ndimidukgood question, i shall swank it up...
01:32leifwyou could use naming conventions to write something that maps :key-words to java setKeyWords() and getKeyWords(), and make it a bit shorter
01:32leifwbut that seems like it would get nasty, and wouldn't actually be that useful
01:33leifwmaybe there's a way to do it with Bean properties, but I don't know anything about those, and I kind of hate the thought of javabeans anyway
01:34ndimidukthis api has a handful of objects which are created in this way. i'm only wrapping a small portion of the api right now.
01:34ndimidukso a simple fn/macro/mechanism for repeating this "pattern" in a simple way would be nice.
01:36noidindimiduk, maybe this could work? https://gist.github.com/cfe69717a9086961989d
01:37ndimiduknoidi: yes, that could work.
01:38Raynesnoidi: I'm pretty sure memfn is generally frowned upon. #(.method % args) is the better alternative. An actual fn.
01:38leifwyou'll want (get setters k) there
01:39noidiok
01:39ndimidukdoes memfn also curry over the arguments as your gist suggests?
01:39noidileifw, why?
01:40noidindimiduk, there's no currying, memfn only takes argument names
01:40leifwbecause setters is a map, not a function
01:41noidileifw, maps are functions of their keys
01:41noidi,({:foo 1} :foo)
01:41clojurebot1
01:41leifwok never mind
01:41RaynesMaps are functions.
01:41leifwfor some reason that didn't work for me today
01:41RaynesOh, too late.
01:41leifwbut I'm probably remembering that wrong
01:41noidindimiduk, but like Raynes said, you should use a lambda there
01:42leifwhere's something else you could use for setter: http://gist.github.com/348800
01:43ndimidukobfuscation for the sake of simplicity? is this perl? :)
01:43Raynesleifw: The time when get is most useful is when 'nil' is a valid return value for a key in your map, and you want to differentiate between a bad nil and a good nil. With get, you can make it return whatever you like if the key is not in the map instead of nil if need be.
01:43ndimidukyeah, there's enough setters in this api that i'd like something along those lines.
01:44leifwright
01:44leifwndimiduk: as long as your naming is consistent, something like that should be okay
01:45leifwoh wait
01:45leifwok edited
01:45leifwhaha, way better
01:45leifwI guess I could kill the cons too, but meh
01:48leifwthe more difficult part will be the reflection to get the java method from the string name of it
01:48leifwabout which I don't know much
01:48Raynes~def printf
01:52ndimidukthanks!
01:54leifwndimiduk: looks like you'll want Object.getClass(), Class.getMethod() (you'll need the parameter types :/) or Class.getMethods() (which you can search), and Method.invoke()
01:54leifwMethod.getName() will be helpful if you go with Class.getMethods
01:54leifwgood luck
01:58_atonteon: the decompiler is probably reordering the instructions
01:58_atoprobably clojure is nulling the variables in between pushing them onto the stack and returning
01:58_atoyou can't represent that in java code
01:59nteon_ato: doesn't that make the JD debugger useless?
01:59_atodunno, never used it
02:00_atothe nulling is to prevent holding onto the head
02:00_atoas soon as a variable is no longer referenced its nulled out
02:00_atoso it can be garbage collected
02:00nteonmy problem is that I have some nested macros, which expand incorrectly (Somehow), but when I use macroexpand on them in slime, the result I get works fine
02:01nteonI'm building a fn, but calling it gives me a null-ptr exception, unless I macroexpand it myself and then call that
02:02_atostrange...
02:02_atothere should be no difference between you macroexpanding and the compiler doing it, its the same code
02:02leifwndimiduk: actually I'm kinda drunk and distractable, so I wrote you something anyway: http://gist.github.com/348811
02:03leifwndimiduk: may or may not work, I haven't tested it
02:03nteon_ato: possibly different environment, includes and such. thats what im looking at now (I'm expanding it in a test file I'm using as a scratch buffer)
02:03leifwand method-for-class won't work for polymorphic functions, but if you just have getters and setters, that shouldn't matter
02:16leifwndimiduk: ok this actually works: http://gist.github.com/348817. Try (getter (. java.math.BigInteger/ONE (getClass)) :lowest-set-bit)
02:17ndimidukleifw: hawt
02:18leifwI always try to rewrite (. obj (method)) as (.method obj); dunno why
02:20LauJensenMorning
02:21tomojleifw: that's the recommended style, I think
02:21tomoj(.method obj) I mean
02:22leifwdidn't work for me
02:22defn,(:foo {:foo 1})
02:22clojurebot1
02:22defnalso works fwiw
02:22leifwmaaaaaan you guys and your idioms
02:23RaynesLauJensen: Have you written anything cool in J?
02:23LauJensenRaynes: I'm strictly a 1-liner kind of a J guy, so nothing more than that
02:24defnwhat do you guys think of Lua?
02:24RaynesI think it's an embeddable scripting language and therefore of no interest to me.
02:24leifwgood for configuring window managers, probably not much else?
02:25nteonso my problem is this: http://paste.lisp.org/display/97059 when I pass a string containing clojure code to load-string, http://paste.lisp.org/display/97059 , the java.lang.Math/exp ends up being null?
02:25albinopossibly narrow minded too
02:25leifwit's okay, it just doesn't have anything excellent that no other language has (apart from a small footprint and I don't care enough about that)
02:26defnit's kind of neat you only get the essentials
02:26defnif you want break or continue you need to add that by hand
02:26leifwyou're thinking of scheme ;)
02:26Chousukelua is excellent for what it's for
02:26Chousukewhich is being embedded in applications
02:26defnChousuke: in your opinion what is it for
02:27defn*nod*
02:27defni have a project id like to learn a little lua for, an application i use at work has an embedded interpreter
02:27RaynesNo opinion about it. It's pretty much for that.
02:27defnjust curious what your thoughts were
02:27leifwyou can probably learn it in under an hour
02:27defnyeah it looks easy
02:27defntables
02:28leifwespecially if you've done python or ruby
02:28defnruby [x]
02:31tomojwhat?
02:31clojurebotWhat is meta
02:32tomojyou people like other languages too?
02:32defnheh
02:32leifw...I did until last friday :)
02:36nteonpython has some wonderful functions, namely map, reduce and filter
02:36tomojbeh
02:36tomojpython is like clojure with it's legs broken
02:37nteonhahaha
02:37tomojwell, no, I'm sure it's great for lots of people
02:37tomojI just kept trying to use it like I'd use clojure
02:37tomojand it wouldn't cooperate
02:37nteontomoj: its really nice when writing little scripts to not have to wait a couple seconds for the JVM to get its act together.
02:37defni do most of my prototyping in ruby
02:38defnand then re-write it in clojure
02:38tomojnteon: yeah
02:38albinonteon: big AGREE on that one
02:38tomojI think there's a way to get around that
02:38defnyeah but if you distribute your script
02:38defn...
02:39albinodefn: define distribute?
02:39_atothere's nailgun, but it's always fiddly to setup and doesn't work in all situations. python/perl/ruby scripts just work
02:39tomojyeah I think I see what you mean
02:39defngive out to other people who won't have the settings necessary to make your script run right away
02:39albinodistributing CPython can't be that much harder than distributing the JVM
02:40tomojdistributing python is usually much easier, no?
02:40leifwbaaaaaaaash
02:40albinotomoj: depends on the OS
02:40defnleifw: heh yeah
02:40leifw-_o
02:40leifwkind of a wide-eyed wink I guess
02:41defnsearch a file in clojure, or use grep?
02:42_atogrep
02:42defn:)
02:43defnnight leifw
02:43nteontomoj: what I was thinking was to have a long running daemon w/ an initialized JVM & clojure libs, to which you pass a filename and arguments, and have it fork(2) and exec(3). similar in concept to emacs and emacsclient
02:43nteonshould get around most of the startup time, except for the first time
02:43defnnteon: and that's awesome, but when you distribute your code to others, it doesnt change the startup time
02:44defnunless they do those steps too, which seems like an extra mess to get your script to download a comic book from the internet or something to startup quicker
02:44_atonteon: http://martiansoftware.com/nailgun/
02:44nteondefn: not immediately, your right. If I can get it right over the next few weeks, I'll package it up for others
02:44defnnteon: that'd be nice
02:45defnid like a sort of "throw this clj in this directory and it will be on your path and work like a regular uitlity"
02:45defnutility
02:45defnsort of a pre-packaged instant clojure utils environment
02:46defn_ato: that's cool i guess i wasnt aware that's what nailgun did
02:48nteondefn: cool, didn't know about that. what I want to do is a little different; I want each 'client' to run in its own process, with its own instance of the JVM and copy-on-write memory
02:48_atoyou can't fork the JVM though can you?
02:49_atoI guess you could try calling fork() via JNI or something and see what happens
02:49_atoactually
02:49Raynes_ato: You can stick a fork in your monitor with a graphical representation of a JVM process running.
02:49_atono it won't work cause the garbage collector thread will be murdered
02:49_atoas fork only preserves the current thread
02:50nteon_ato: haven't looked into it too much yet :) I am planning to try it from the C side of things, looking at how the 'java' binary intializes thigns
02:50defni read that as "java binary initializes thighs"
02:50albinoyou can't use ProcessBuilder to spawn another jvm process?
02:50_atowell you can, but then you don't have the benefit of reduced startup time
02:51_atoof course one option would be to have a pool of pre-initialized JVMs
02:51_atobut then as soon as you use up your pool its back to being slow again
02:51nteon_ato: I know its been done for Python, so I am naiively assuming it will be possible for Java
02:52_atoyeah, python has a native fork call though
02:52_atoits also not garbage collected and doesn't use threads by default
02:52_ato(well it is garbage collected, but its optional... its ref counted)
02:53_atowould be awesome if you can get it to work though
02:53nteon_ato: yup, well, I will keep you apprised :) I unfortunately can't look more into it until this weekend.
02:54albinoyou could use JNA to make the fork() call
02:54albinowhy the jvm doesn't have this by default is sort of amazing to me
02:55nteonalbino: thanks, I will keep that in mind.
02:55nteonheh yea
02:55albinoI think it has to do with that "run everywhere" mentality
02:55albinobut it just seems broken to me on platforms where these syscalls have been around forever
02:55nteonalbino: i think its only recently with clojure and some other languages that its actually useful for scripting-type things, where startup time maters
02:56albinonteon: well I was trying some of this in Java a few years ago
02:56_atoCriticism of Java has it's on wikipedia page :p
02:56albinonteon: but I'm weird, I actually expect programming languages to include reflection as part of them being useful
02:56_atos/on/own/
02:56nteonheh
02:57albinoeverytime I run 'mvn clean' I feel like jvm startup time matters :)
02:58nteonalbino: ugh, good point
02:58nteonalbino: although, its hard to say if thats jvm time or mvn time :)
02:58nteonits not exactly a speed deamon
02:58nteondemon ...
02:58albinothis one project I use it on, all it does is 'rm -rf' the 'target' directory
02:59_atoa fair whack of java's startup time is actually reading jars and loading classes
03:00albinoI had heard that
03:00_atoalso clojure doesn't start fast, due I guess to the compiler. a hello world java class loads considerably faster than a hello world clojure
03:01_ato% time java foo
03:01_atojava foo 0.04s user 0.01s system 49% cpu 0.100 total
03:01_atothat's just a hello world
03:02_ato% time java -cp ~/.swank-clojure/clojure-1.1.0-master-20091202.150145-1.jar clojure.main -e '(System/exit 0)'
03:02_atojava -cp ~/.swank-clojure/clojure-1.1.0-master-20091202.150145-1.jar -e 0.65s user 0.04s system 115% cpu 0.601 total
03:04albinomy favorite java limitation is chdir(). IMO this is a process's basic right.
03:04nteonalbino: no way. the static, arbitrary memory limits are my favorite. its like im back on class MacOS
03:05nteonI particularly love when maven crashes because I forget to set some environmental variable giving it more than the java default memory
03:06albinonteon: but most of the memory limits are configurable, where as chdir() is just not there
03:06nteonalbino: okay :) I can agree that is quite bad as well.
03:30LauJensenIts quite impressive that everybody misunderstood my prefix/infix joke in my last blogpost - Humor in writing is a dangerous thing :)
03:30vIkSiThi all
03:31vIkSiTthe programming clojure book has a line - (use '[clojure.contrib.str-utils .. )
03:31vIkSiTI can't find the str-utils package in the clojure-contrib.jar though
03:31vIkSiTis it deprecated since the book came out ?
03:32LauJensenvIkSiT: Its probably renamed to "string"
03:33LauJensendisregard 'probably', it is
03:34vIkSiTaha
03:34vIkSiTlet me check it out, thanks
03:36LauJensennp
03:37vIkSiTLauJensen, hmm weird
03:37vIkSiTdoesn't look like its working
03:38vIkSiTI get a : repeat already refers to: #'clojure.core/repeat in namespace: user \n [Thrown class java.lang.IllegalStateException]
03:38LauJensenWhen evaluating what?
03:38vIkSiTon a simple (use 'clojure.contrib.string)
03:39LauJensenWeird, string seems to exclude that
03:40vIkSiTLauJensen, not sure what you mean. excluse the core/repeat?
03:40LauJensenvIkSiT: If you get the 1.1 snapshot, then all the str-utils code should work as it does in the book
03:40vIkSiTexcuse*
03:41vIkSiTLauJensen, sigh. I changed everything to 1.2.0 yesterday :)
03:41LauJensenvIkSiT: And that should also work, just as string instead of str-utils. But I'm not able to test that atm so I cant help you much with it
03:41RaynesLauJensen: Write a blog post about J.
03:42LauJensenRaynes: I already have 2 blogposts that are heavily J oriented
03:42vIkSiTsure. let me try that, although just replacing str-utils with string doesn't seem to help. apparently, re-split isn't public anymore
03:42RaynesOh. Well, write a Go vs * comparison.
03:42RaynesEntertain me, man.
03:43LauJensenGo? I mentally hibernate whenever I see Go code
03:44RaynesGo to your happy place.
03:44Raynes:>
03:44LauJensenYou mean the REPL ? :)
03:44vIkSiTturns out re-split has become split. hrm
03:44RaynesHehe.
03:44RaynesLauJensen: Okay, Reia. Learn Reia, and then blog about it vs *. Final offer.
03:44LauJensenREJECTED
03:45Raynesx_x
03:46dcnstrctis there a method in clojure to get a random element of a vector ? something like the methods first or second except it chooses a random element.
03:46LauJensen,(nth (range 100) (rand-int 100))
03:47dcnstrcthrmm
03:47_ato<clojurebot> 57
03:47LauJensenhehe
03:47LauJensenthanks Alex
03:48_ato:-p
03:48_mstthat's not the number I got...
03:48LauJensenhaha
03:48dcnstrct(defn pick [s] (nth s (rand-int (count s))))
03:48_mstbest out of three :P
03:48dcnstrctsomething like that maybe ?
03:48_ato_mst: might be a bug... I'm running an old version of clojure... :-P
03:48LauJensenexactly like that
03:48_mstah, probably held onto your head :P
03:49dcnstrctthnx ;)
03:49dcnstrctI vote for adding that to the language proper
03:50_mstclojure.contrib.seq-utils has rand-elt that does that
03:50RaynesWhen clojurebot doesn't work, I usually have a bot up in #clojure-casual. $eval or $(whatever). Of course, it's much more limited than clojurebot at this point due to clj-sandbox being in it's infancy.
03:52RaynesLauJensen: Clever.
03:52LauJensenRaynes: I'll only be impressed if you implement it in lua
03:52LauJensenand compile it with Go
03:52Raynes:o
03:52RaynesLauJensen: That was awful off-topic, sure it shouldn't have been in #clojure-casual? ;)
03:53LauJensenRaynes: #clojure has always contained the casual talks in the absense of language discussions, so..no
03:54albinowe're off-hours here anyway, I don't see rhickey or chouser or stuart
03:54RaynesHeh.
03:55LauJensenalbino: Agreed - Its only when Raynes gets drunk and start telling camp-fire stories that we have to move into #casual
03:55LauJensenAlthough I'll admit, that happens frequently
03:55RaynesI don't get drunk. :>
03:56LauJensenGlad to hear it
04:00RaynesI'm totally straight edge. If I drank, I wouldn't be nearly as annoying as I am now, because I wouldn't be able to find my IRC window among my virtual desktops.
04:00albinohe had to quit to give us that little nugget
04:00albinothough I like random.choice() from python better
04:01_atopick doesn't imply its random though
04:02Raynesalbino: http://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/seq.clj#L145
04:03RaynesAnd rand-elt below it.
04:06_mstI always think you have to be sober to get drunk...
04:08kencauseyShould I expect to be able to use leiningen in cygwin? It chokes on trying to find clojure.main even though I have CLASSPATH working to the point that 'java clojure.main' gets me a repl.
04:09LauJensenkencausey: I heard of people using it under Windows
04:10kencauseyI suspect it's a path issue, I'm using a window version of Java so I have to use a mix of unix and Windows style paths
04:10RaynesLauJensen: I herd u liek mudkipz. ; This is the extent of my off-topic chatter tonight. Sadly, I'm not immune to sleep deprivation, and I have to get up early. Farewell, my friend. <3
04:11LauJensenRaynes: Bye bye dear friend - Sleep tight :)
04:11_atokencausey: have you tried: java -jar leiningen-1.1.0-standalone.jar
04:11kencauseywhere did leiningen install itself?
04:12tomoj~/.m2
04:12_ato$HOME/.m2/repository/leiningen/leiningen/1.1.0/
04:12_atowhich on windows I guess is documents and settings/your_username
04:13kencauseyactually, no, under cygwin it's in my cygwin home directory
04:15nteonokay, how can I tell if a static method on a java class is resolvable?
04:22kencausey_ato: Well, it works fine if I change into the same directory with it, but I can't sem to find a CLASSPATH or -cp that will make it work elsewhere, *sigh*
04:22kencausey. is in my CLASSPATH
04:23kencauseyactually I know very little about java, I come more from a Lisp background
04:23kencauseyI used java only a little in the 90s
04:24kencauseyI'm not sure how CLASSPATH and -jar interact
04:24kencauseyFor clojure I added the full path including the .jar file into CLASSPATH
04:24nteonkencausey: I've been told specifying -jar makes java ignore the -cp option
04:24kencauseyah, OK, well, that won't help ;)
04:25nteonkencausey: yes, I've been doing that. adding the jar to the classpath, and then just specifying the class you want
04:25_atokencausey: java -cp leiningen-1.1.0-standalone.jar leiningen.core
04:25kencauseyOK
04:25nteonjava -cp libs/\*:my-jar.jar net.nteon.Example
04:26nteonyea
04:26_atofor the path.. you might need to use double backslashes, like c:\\foo\\bar\\baz
04:26_atoone to escape it in the shell
04:26kencauseyof course
04:26kencauseyas I said, I've got clojure working ;)
04:26_atoah right
04:26nteon_ato: if kencausey is using cygwin, I think he can use the nicer unix path separator
04:26_atoright, but java is not part of cygwin
04:27kencauseyno I can't, because this Java thinks all the world is Windows
04:27_atothen again, I don't know much about java on windows
04:27nteonsigh
04:27nteonI wish I liked java
04:28_atothe JVM is really awesome, if only it weren't also severely crippled too ;-)
04:28nteonheh
04:37LauJensen_ato: crippl0red?
04:37kencausey_ato: I'm really puzzled, I've added C:\\cygwin\\home\\ken\\.m2\\yadayada to CLASSPATH much as I did for clojure, ant, etc. and I've done it both for bash and for windows environment variables, but unless I'm in the same directory with the jar I can't get it to work, whether in cygwin or command.com, in both cases it chokes with "java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V
04:37kencausey(core.clj:1)" and after the backtrace "Could not find the main class: leiningen.core."
04:38_atohmm
04:38Chousukelooks like conflicting versions
04:38_atothat restfn error usually means using an incompatible version of clojure
04:38_atoyou're only putting lein's jar on the classpath right, nothing else?
04:38_ato(lein's jar contains clojure)
04:38kencauseyaha
04:38kencauseyno
04:39kencauseytrying that now
04:39kencauseyI'm using clojure from git
04:40kencauseyjava -cp $(cygpath -w ~/.m2/repository/leiningen/leiningen/1.1.0/leiningen-1.1.0-standalone.jar) leiningen.core
04:40kencauseythat does work
04:41kencauseyso, move the original lein shell script and write my own simple version?
04:42_atoyep
04:42_atomost of the lein shell script is performance hacks and the little niceties like self-install and upgrade
04:50kencausey_ato: OK, a simple one liner seems like it is going to work, only time will tell. I've moved the original but kept it handy for the fancy stuff
04:51kencauseynight
05:27aibaIs there a way to apply a java method, like (apply Integer/parseInt '("123"))? clojure doesn't seem to like that.
05:28noidiyou have to wrap it in a function
05:28noidi,(apply #(Integer/parseInt %) '("123"))
05:28noidihmm, no bot
05:28LauJensen,(map #(Integer. %) ["123" "345"])
05:29aibathanks!
05:32LauJensenhiredman_: Where's your bot?
05:36LauJensenGuess they went out to dinner
05:40talioseven bots need sleep and good
05:40talioss/g/f/
06:00BorkdudeIs there a clj-sandbox running somewhere behind a website, where I can just paste a quick clojure expression instead of here?
06:01Borkdude(where everybody can see my foolish attempts ;-))
06:02cemericktalios: they're appreciated :-)
06:03taliosBorkdude: http://ideone.com - has clojure support. paste code, and it runs ( i believe )
06:03talioscemerick: have you listened to any at all?
06:04cemericktalios: talking about Illegal Argument, right?
06:04taliosyep
06:04cemerickSure. Not sure when I subscribed, but it's been some months now.
06:05taliosI think it's been some months since we published the last episode :) seems that way at least
06:05cemerickyeah. My own podcast attempt has gone fallow at this point. Not sure when I'd get back to that.
06:06talioswe might just have to skype you in for some clojure lovechat :)
06:06mikemBorkdude: you can also start a query with clojurebot
06:06taliosproblem with that is all the international timezones
06:06cemericktalios: IA is good stuff though; far more entertaining and informational than the posse.
06:07cemerickhah, that'd be fun
06:07taliosmikem: clojurebot's gone out to lunch tho
06:07cemerickI often have calls in Asia, so it wouldn't be so hard :-)
06:07mikemtalios: oic :) i should pay more attention
06:07taliosits 11pm here now, whats the time where you are?
06:07Borkdudemikem, tnx, but I don't want to disturb you guys with my attempts ;)
06:08cemerick6AM
06:08Borkdudetalios: great website!
06:08talios6am! freak :)
06:08mikemit's just past 6pm here
06:08taliosBorkdude: ideone is wonderful. I'm surprised no one ever thought of marrying a code snippet/paste with a compiler
06:08cemerickyeah, I know :-) I've been doing the 5AM thing for about a year now.
06:09talioscemerick: that could he harsh tho - we generally record from 8pm-11pm on Thursdays, so unless you feel like getting up at 3am :)
06:09taliosTho we did do a late (11pm our time ) skyper with Reiner and Rule once
06:09talioswhich was fun
06:10cemericktalios: hey, whatever it takes to gain fame and international renown! ;-)
06:10taliosouting yourself as a maven lover isn't enough? :)
06:11taliosRichard -reallllly- doesn't like maven, or sonatype.
06:11cemerickthe 5AM thing falls apart when I need to talk to Asia, anyway.
06:12cemerickeh, I was outed a long time ago, but felt like I had to make a little noise for various reasons
06:12cemerickI feared maven like the plague for years, after a bad encounter circa 2005?
06:13taliosthat would have been maven1 timeframe wouldn't it?
06:13taliosmaven1 was a nasty hack built ontop of ant
06:14Associat0rhttp://www.reddit.com/r/programming/comments/bjxbf/functional_fluid_dynamics_in_clojure/
06:14taliosgood premise, just bad execution. Really loving Maven 3 tho so far
06:15taliosBorkdude: hur, I just saw your ideone tweet show up in my clojure search timeline ;-)
06:16Borkdudeah :)
06:17BorkdudeI see from your bio you're doing podcasts, on what exactly?
06:18taliosBorkdude: http://www.illegalargument.com/ <- java and jvm development, mixture of mobile foo, groovy, grails, clojure, scala
06:19taliosWe also talk about pain with maven often it seens :)
06:19taliosWhich, since we keep using maven - must mean we're sadists or something
06:21Borkdudeok great
06:23BorkdudeI'll have a listen later, when I'm home
06:24cemericktalios: yeah, that was maven1. That's called a bad first impression. :-)
06:27taliosWhen I first started at my current gig we had an inhouse buildtool written in groovy that wrapped ant called "sod". Sadly we spent more time in those first few months of the project adding required features to the build tool than the product itself :(
06:27cemerickouch
06:28taliosalso left a bad taste in my mouth about groovy, altho it was really more the build tool, and ant integration than anything
06:29cemerickNot that I've given it much of a chance, but groovy rubs me the wrong way as well.
06:30cemerickI suppose it might have been a big deal when it first appeared for those stuck in Java, but if I have my timeline right, I was in python ~2.3 at that point embedding java libs via jpype
06:32taliosheh.
06:33taliospre-java I was doing Delphi, and did some small patches/contribs to the Python For Delphi project, we had embedded python code inside paradox database records, executed from a delphi app :)
06:33taliosI wonder what a functional python might look like
06:36cemerickI did tinker with lython for a bit, but that project's long since disappeared last I checked.
06:36cemerickbut "functional python" is quite the oxymoron :-)
06:38talioswell ok, clean syntax with the wacky space indent block syntax. get rid of objects, and its wacky (self, xxx) param which always irked me
06:39cemerickof course, clojure has adopted the [this & args] approach in places, too :-P
06:42taliosI love the new named args too. I like the proprosed syntax someone posted to the list about using (defn foo {:name val :name val}) as well, where you just have a {} instead of the normal []
06:44taliosIt's a pity I'm not using clojure beyond toy applications and experiments. Would be nice to use it at work.
06:47talioswb
06:47taliosI love the new named args too. I like the proprosed syntax someone posted to the list about using (defn foo {:name val :name val}) as well, where you just have a {} instead of the normal []
06:47taliosIt's a pity I'm not using clojure beyond toy applications and experiments. Would be nice to use it at work.
06:52cemerickyeah, sorry about that. Should've killed the irc client before fiddling with the wifi :-(
06:52taliosheh
06:53taliosI love the new named args too. I like the proprosed syntax someone posted to the list about using (defn foo {:name val :name val}) as well, where you just have a {} instead of the normal []
06:53taliosIt's a pity I'm not using clojure beyond toy applications and experiments. Would be nice to use it at work.
06:53taliosis what I'd said :)
06:53cemerickah :-)
06:53cemerickI didn't see that (I can't keep up with the list these days). It's funny how destructuring has allowed Rich to back into kwargs, which he totally rejected in the beginning.
06:54talioshe was? heh
06:55talioswell, coffee finnished and its 6 mins to midnight. time for bed I think.
06:55SynrGheh
06:55cemerickyeah. Before destructuring was around, people were asking for kwargs, but w/o destructuring, that would have required clojure fn invocation to have a mismatch with java method invocation
06:55cemericki.e. big perf hit
06:55taliosright.
06:57talioshttp://hg.genunix.org/onnv-gate.hg/rev/03c4bd206296 <- a monumental commit :(
06:59gstrattonI'm seeing some really strange performance characteristics with a function I'm trying to optimise; I'm not sure whether the it's the JVM or Clojure being weird
07:00taliosRight - its now Wednesday morning, night all.
07:00cemericktalios: see you this afternoon ;-)
07:01taliosheh
07:01gstrattonI have a function which searches a byte array for a subarray. If I start Clojure, create a 10 million byte array and test it, I get consistently around 110ms
07:01gstrattonIf I then redefine the function, it takes around 200ms
07:04cemerickgstratton: Microbenchmarks are nearly useless. You're probably just bumping up against a new fn def that hasn't been JITed yet.
07:08gstrattoncemerick: All I am doing is re-running the defn. I can run the function as many times as a like before I redefine it and get consistently around 110ms (except the second run, which is always around 85ms!), but after the redefinition I can run it as many times as I like and consistently get around 210ms.
07:08gstrattonI'm trying to optimise the function, so this is quite frustrating!
07:11cemerickgstratton: I can sympathize, but redefining a fn carries a lot of consequences -- relevant here is that the resulting fn will not be JITed for some time. The conditions under which code is JITed vary significantly.
07:12cemerickgstratton: are you starting java with -server?
07:12gstrattoncemerick: no
07:13cemerickgstratton: that'd be the first thing to do. The "server" vm is far more aggressive about optimization.
07:16gstrattoncemerick: With -server, I get around 145ms before I redefine and around 230ms after
07:17cemerickgstratton: OK. I'd again warn against microbenchmarking. Aside from that, if you paste the code, that might help.
07:25LauJensengstratton: Did you catch my post from last night? I go through quite a bit of optimization - despite cemericks warning
07:26gstrattoncemerick: The code is at http://paste.lisp.org/display/97065 With my test array the first function is never called, so I'm just optimising the second
07:26gstrattonLauJensen: Yes, it was your post that got me looking at this again
07:27gstrattonI have just added some extra type stuff courtesy of your post. Now it's 90ms before redefinition and 215ms afterwards!
07:27LauJensengstratton: type hinting is different from primitives - I suggest you adopt cgrands deep-aget and deep-aset instead
07:27LauJensenThat should cut your traversal down to about 10%
07:30noidihttp://ptrthomas.wordpress.com/2006/06/06/java-call-stack-from-http-upto-jdbc-as-a-picture/
07:30carkhhello all
07:30carkhyay ... this nickserv thing is annoying =/
07:31BorkdudeDudes, I have a little idea for Twitter, to teach newcomers to Clojure a little thing each day
07:31Borkdudehttp://twitter.com/ceotd ;; Clojure Example of the Day
07:31Borkdudeif you want to provide me with some ideas please send them to me
07:31carkhanyways, i'm (finally) giving a test run to defprotocol and reify, and it looks like there is an issue with rest parameters on protocols
07:32carkhis this to be expected ?
07:32LauJensenBorkdude: Only complaint is people should be doing (map count args) and not (map #(.length %) args)
07:32LauJensenAnd then there's the whole char-limit thing. Twitter is designed to be superficial, so teaching wouldn't come natural ?
07:34Borkdudewell it's not really teaching, but more like getting people familiar with clojure a little
07:34gstrattonLauJensen: To be honest I'm not too worried about 10% performance, but I am worried about the fact that something which I thought should have no effect changes the runtime by a factor of 2.5
07:35cemerickgstratton: why do you think that redefining a function should have no effect?
07:36cemerickIf everything were simply interpreted, then I'd agree with you.
07:36LauJensengstratton: I meant it would cut it down to 10%, ie save you 90% of the runtime
07:38cemerickgstratton: to be clear, there are JVM options that will force optimization of all methods, and/or tweak the optimizer so that it does its work more eagerly. I'm just saying, don't ignore the man behind the curtain that makes stuff go fast. :-)
07:39carkhhere is a very simple example for my protocol/reify problem : http://gist.github.com/349024
07:39gstrattonLauJensen: Oh, sorry! If that works then it'll be faster than the Java version :)
07:41BorkdudeLauJensen, why is count better? It's considered more idiomatic? I'm new to Clojure as well, so great to have some feedback
07:41LauJensenBorkdude: Yes, idiomatic clojure functions are more idiomatic than java methods in my oppinion - You're demonstrating interop where a Clojure fn does the same, its redundant
07:42BorkdudeAh, so tomorrow's tweet could be: ;; More idiomatic version of yesterday's example: (map count ["foo" "bar"])
07:42Borkdudetnx :)
07:42LauJensennp
07:44duncan_bayneHi all, I'm trying to build clojure-contrib according to instructions at http://riddell.us/ClojureOnUbuntu.html but I'm seeing a test failure: Testing clojure.contrib.test-jmx
07:44duncan_bayne
07:44duncan_bayneERROR in (various-beans-are-readable) (run-test5457370694010191789.clj:40)
07:44duncan_bayneUncaught exception, not in assertion.
07:44duncan_bayneexpected: nil
07:44duncan_bayne actual: java.lang.RuntimeException: javax.management.RuntimeMBeanException: java.lang.NullPointerException
07:45duncan_bayne
07:45cemerickugh, the jmx tests are acting up again, it looks like
07:46cemerickduncan_bayne: yup, it's failing on build.clojure.org, too :-(
07:46cemerickduncan_bayne: looks like d1e831b8a8a3d8e08b0f3aa9650b3d43954cb707 is the last commit that succeeded
07:47LauJensenWow, its been down for 7 days now
07:48LauJensencemerick: I think its more likely that this is the culprit 6cfd3b286680fd59021382fdc516be6be82a8834
07:48carkhi had this when building it yesterday : FAIL in (test-as-url) (run-test7773307746706794632.clj:40)
07:49duncan_baynecemerick: Thanks, thought it might have been something I was doing. Is there any way of getting the last-known-good version of clojure-contrib from Git? I'm keen to give Clojure a whirl ...
07:50carkhget it from build.clojure.org maybe ?
07:50cemerickduncan_bayne: yeah, just back up a few commits. Refer to http://github.com/richhickey/clojure-contrib/commits/master or use your favorite git tools. I'd go back to 0a1bfc9 to start, get before the most recent jmx stuff.
07:51cemerickduncan_bayne: or better, what carkh said :-)
07:52_atoduncan_bayne: in case you're not familiar with git: git checkout 0a1bfc9b4a1d5e20365d1905806eaf61e13c6db1
07:52duncan_bayneSweet, thanks :-)
07:59carkhstill noone to have a look at my rest parameter problem on protocols/reify ? http://gist.github.com/349024
08:00duncan_bayne_ato: building with 'mvn package' from that checkout worked nicely. Thanks for the git tip; I still think like a Subversion user :-)
08:06Chousukecarkh: does reify even support rest arguments? :/
08:07carkhlooks like it doesn't ... maybe it's planed for the future ?
08:07Chousukeyou need to ask rhickey about that
08:07carkhi tried doing it the java way, since there's an interface behind the scene
08:08carkhbut that doesn't work either ='(
08:08bsteuberso in java interfaces support ... arguments?
08:08carkhthere can be a last array argument
08:09Chousukebsteuber: the ... thing is just a shorthand for an array argument AFAIK
08:09bsteuberchousuke: so Java does the real work on the caller side?
08:10ChousukeI don't know what it does :P
08:10Chousukeprobably transforms a call to a variadic method to something that constructs an array and then passes that to the method
08:10bsteuberi see
08:13Borkdude"Quick, let me switch to #clojure to make it look like I'm working" - Huh? "At least it looks more like work than Twitter"...
08:17noidiBorkdude, especially if you use this theme for irssi http://irssi.org/themefiles/c0ders.png
08:18Borkdudenoidi, hehe
08:33zmilakill-my-eyes theme
08:58powr-tocI hear the latest swank-clojure has breakpoint support! Does it still work with techomancy's SLIME master branch?
09:03dnolenpowr-toc: yeah it works with technomancy's SLIME in ELPA. but from what I understand, things are close to working again with SLIME master as well.
09:13powr-tocdnolen: cool... I've just tried setting a (swank.core/break) in some code, and it throws a stack trace :-\ any ideas what I'm doing wrong?
09:14dnolenit's supposed to do that. then you can press enter on frame 0 and the locals
09:14dnolenyou can also press 'c' to continue to the next breakpoint, previous might work as well, haven't gotten too deep into it.
09:15dnolenand the locals -> and see the locals
09:15powr-tocahh yeah... just realised that!
09:17powr-tochmm... I get [No Locals] when I think there should be some
09:22dnolenpowr-toc: you only see locals on the first frame
09:23powr-tocdnolen: Yeah, but it doesn't seem to display any either
09:24dnolenpowr-toc: are you using clojure 1.2.0-master-SNAPSHOT ?
09:29powr-tocdnolen: ahh that'll be it
09:29powr-tocI'm using 1.1.0
09:30powr-toctime for an update me thinks...
09:30dnolenpowr-toc: yeah, the break stuff uses the new env things in 1.2.0. with lein it's easy to use 1.2.0 for a specific project without messing your setup.
09:31dnolenjust add clojure and clojure-contrib 1.2.0-master-SNAPSHOT as deps then run lein swank.
09:32powr-tocyeah, was just about to do that
09:32powr-tocbut thanks for letting me know it wont kill anything else! :-)
09:32powr-tocI'm really quite liking lein... not perfect, but pretty good...
09:34powr-tocthough after the recent maven discussions on the clojure list I'm curious to see what polyglot maven's like
09:39cemerickpowr-toc: people have been pinging me looking for a demo of polyglot; I may do that sometime soon
09:42Ankouhi, is there a function to logically combine 2 functions? something like (and (f1 x) (f2 x)) => (fand f1 f2 x)?
09:43Borkdudewhat is the standard java terminology for anonymous classes, just that, or 'anonymous inner class'?
09:43LauJensencemerick: Has anyone fixed this 7-day breakage yet ?
09:44cemerickLauJensen: doesn't look like it
09:44LauJensencemerick: Did you work out which commit blew it ?
09:45cemerickLauJensen: I think you had it right, although it's odd that a later commit is shown as successful.
09:45cemerickLauJensen: you'd have to bother chouser or stuartsierra about it, I'm just a civilian. :-)
09:46LauJensenstuartsierra: Ping
09:46LauJensenchouser: Pong
09:46cemerickor perhaps laity is better ;-)
09:46noidiAnkou, comp
09:46esjcemerick: laity is funny
09:47cemerickesj: I try, sometimes too hard. :-)
09:47noidiAnkou, sorry, misunderstood you at first
09:47stuartsierraLauJensen: pong
09:47LauJensenstuartsierra: Contrib has been broken for 7 days now - Are you the guy who's about to fix it ?
09:47chouser~stuartsierra?
09:48LauJensenI have a hunch that Halloways commit broke it
09:48stuartsierraI'll take a look.
09:48LauJensen 6cfd3b286680fd59021382fdc516be6be82a8834
09:48chouserbah, no clojurebot
09:48LauJensenThats my best bet
09:48chouserstuartsierra: let me know if you need to tag-team
09:49stuartsierraIt's the c.c.jmx lib still.
09:50stuartsierraIt's been failing tests for a while.
09:50stuartsierraWhat changed is that I updated the Maven plugin; so now the failing tests actually stop the build.
09:51hugoddnolen: I couldn't repro your issue with the exception-location branch, though I added a fix for navigating to top level namespaces
09:51hugoddnolen: if you could message me the details, I'll investigate further
09:51dnolenhugod: yeah I saw that you committed something. but it did not fix it for me. do you think this is because of SLIME ELPA?
09:51stuartsierraI can't reproduce the error shown here http://build.clojure.org/job/clojure-contrib/44/console
09:52hugoddnolen: I suspect it's not related to the branch - did you try on the release version?
09:52stuartsierraSame error persists here http://build.clojure.org/job/clojure-contrib/46/console
09:53dnolenhugod: no should I? the one clojars you mean right?
10:06LauJensenstuartsierra: will you drop a comment here once its fixed?
10:07stuartsierrasure
10:07LauJensenGreat, thanks
10:07stuartsierraI emailed Halloway about it to see if he has any ideas.
10:09cemerickIt seems just a bit odd that jmx stuff is in contrib at all, but that's probably just me.
10:09LauJensenIf jmx has been failing tests for some time now, how about moving it out of the testing to get a working build, and then fixing it behind the scenes
10:10stuartsierraok
10:18stuartsierraOK, contrib is alive again http://build.clojure.org/job/clojure-contrib/47/
10:26Licensergreetings
10:26LauJensenGreat, thanks stuartsierra
10:26stuartsierrayou're welcome
10:26npoektophi! what is clojure-contrib-slim.jar for?
10:30esjfemale, French, clojurians.
10:30LauJensennpoektop: I think its just the classes and no source
10:31pdkcontrib-slim is just to take less space when you want to bundle it with an applet
10:32npoektopok, thank you
11:27drewrnpoektop: actually, clojure-slim is the uncompiled clojure source and the compiled java classes
11:28drewrsmaller jar, hence slim
11:37cemerickThe fact that AOT compilation compiles all transitive namespace dependencies of the namespaces to be compiled is becoming an actual problem. Some libs include support for optional libraries that I'd rather not have around at all, but need to be available for AOT to succeed.
11:40chousercemerick: where would it be best to control that property? a literal flag in ns :require?
11:40chouserdefault to AOTing only the libs named specifically in (compile ...)?
11:41cemerickI'm not sure. I think it's probably wise to keep control of AOT in compile, rather than pushing it down into ns declarations. Those are generally not under your control if you're having problems.
11:42cemerickIt's totally reasonable to have the current behaviour be the default. I think. :-)
11:42chouserso maybe compile should take an option list of libs *not* to compile?
11:42cemerickNo, nevermind, you really should have to specify all the namespaces you want to have compiled.
11:43cemerickor, a pattern, anyway. #"com\.mycompany\..*", etc
11:43chouserhm. (compile foo.bar :filter #"clojure\.contrib\..*") ?
11:44cemerickchouser: a blacklist would be irritating when dependencies change, along with namespace names.
11:44chouserright. filter is a whitelist
11:44chouseroh
11:44chouserso my example was bad
11:45chouser(compile foo.bar.baz :filter #"^foo\.bar\.")
11:45chouserregex seems a poor fit.
11:45cemerickRight, that's better.
11:46cemerickclojure-maven-plugin just happens to use them for namespace exclusion/lists, so that's what came to mind first.
11:46chouser(compile foo.bar.baz :only [foo.bar.* clojure.contrib.*])
11:46chousermeh
11:46cemerickI think it's totally reasonable for compile to just take a list of namespaces, and leave the mechanics of building that list to people's build tools.
11:47cemerickWith some provision to get back to compile-the-world-starting-here sort of behaviour.
11:47chouser(compile-only foo.bar1 foo.bar2)
11:47cemerickSure, that would do.
11:48chouserof course that probably demands all sorts of tools support the new fn. maven plugin, lein, IDEs...
11:49cemerickwell, some significant change will affect them one way or the other. The current behaviour really is a little nuts, at least anywhere where you're not just shipping an uberjar
11:50cemerick(which is pretty impolite these days, anyway)
11:50cemerick(in many scenarios)
11:53chouserit should be possible to write 'compile-all' without patching clojure
11:53chouserer, compile-only
11:56cemerickchouser: How? Doesn't it trigger of reload of each lib's dependencies?
11:56cemerickHrm, no, it doesn't.
11:57chouserhm, direct linking (is that what it's called) may prevent a patchless solution.
11:58chouserI was thinking of binding load-file (or whatever is needed) to get a chance to change *compile-files*
12:00cemerick That may work as an implementation strategy, but I don't think that eliminates the need for API changes. Build tools all run through clojure.lang.Compile.
12:01chouserI'm just talking about providing a compile-only fn -- tooling is above my paygrade.
12:01chouserI suppose clojure.lang.Compile could have a method that calls compile-only
12:02chouserbut I need to tweak clojure.core/load and I bet direct linking will make me patch it instead of binding it. :-/
12:02cemerickwell, it only has one method (main). It could certainly grow an option or two.
12:13npoektophi! i'm trying to setup emacs with slime for clojure. Can't do (require 'swank-clojure-autoload) -- there is no such file.
12:15chousercemerick: so one detail is that 'require'd libs still need to be loaded, they just wouldn't be compiled unless in the list.
12:15npoektopthe only file i can find is swank-clojure.el
12:16cemerickchouser: Sure, that's unavoidable I presume.
12:16chousercemerick: and that means if its required by something earlier in the list, but appears later in the list, it still needs to be compiled that first time.
12:17hugoddnolen: the problem is that the clojure compiler exception is saying line 0 - not much I can do at the swank level...
12:17chouserso it'd be nice to avoid re-compiling it that second time. though I guess that could be an optimization later.
12:17dnolenhugod: I suspected that.
12:17cemerickchouser: I can't imagine that being a problem. The only thing that matters is what's in *compile-path* when compile returns.
12:18dnolenhugod: is there a Clojure bug report for that?
12:18hugoddnolen: no idea
12:20drewrnpoektop: how did you go about installing swank-clojure?
12:20drewryou'll need the entire source distribution somewhere
12:20lpetitchouser: (defn compile-only [lib ns-filter-pred]) ?
12:20dnolenhugod: well then other than that the exception branch seems to work :)
12:22npoektopdrewr, i did git clone ..., moved it to ~/.elisp, wrote (require 'swank-clojure-autoload), and it did not work
12:22hugoddnolen: thanks! I'll try and merge it later
12:22cemericklpetit: the question is, when would ns-filter-pred ever allow anything other than the explicit set of namespaces one might have in a given project?
12:23npoektopdrewr, also added path to load-path
12:23dnolennpoektop: save yourself a lot of time use setup your Clojure Emacs environment via ELPA
12:23drewrnpoektop: I think swank-clojure-autoload was removed a while back
12:24npoektopdnolen, what if i want to use slime with other lisps?
12:24dnolennpoektop: http://tromey.com/elpa/install.html, the only thing you need to actually install from ELPA is swank-clojure it will grab and configure everything else you need.
12:25dnolennpoektop: yeah, a manual approach will probably be more frutiful, tho I've been able to tweak my ELPA setup to handle other lisps.
12:25drewrnpoektop: you'll need to frob slime-lisp-implementations in that case
12:25lpetitcemerick: maybe you're right. But why close the door to the unknown when a general solution is not that bad ? Or maybe a (compile-only* ) witht the predicate, and a (compile-only) with the sugar for the common case ?
12:26lpetitthe sugar could even be a macro to avoid having to quote the symbols
12:27cemericklpetit: huh, I figured explicitly naming the libs to be compiled *was* the general solution (since whatever is invoking compile can build that list however it wants)
12:28lpetitcemerick: why not, but the list can be quite long. a predicate fn is maybe not what people may want in general, but is certainly more generic
12:29lpetitbut I'm just musing here, I'll let you do the right choice. Must leave to house. cu
12:29cemericklpetit: heh, not up to me, talk to chouser :-)
12:40chouseryeah, I like a predicate for the unsugared version
12:42cgrand(compile-only* 'my.lib '#{other.lib.i.want.to.compile})
12:42chouserright
12:43chouserI mean, good point. :-)
12:50npoektoppeople, share you .emacs for slime+clojure, please
12:50chousernpoektop: I don't use emacs or slime. sorry.
12:51lithprnpoektop: have you considered the emacs starter kit
12:52npoektopno, i have my own emacs setup, and i want to setup slime+clojure manually
12:54lithpryeah, i looked at my cusomizations, and it looks like the ESK took care of that for me :)P
12:55drewrnpoektop: http://gist.github.com/349294
12:55drewruse at your own risk :-)
12:56drewrI'm not currently using any other lisp implementation, but you can edit slime-lisp-implementations as you need
12:57npoektopdrewr, thank you!
12:59npoektopdrewr, would you upload ~/bin/clojure, please
13:01drewrdone
13:02stuartsierraHalloway and I fixed the JMX bug in contrib, builds ok now.
13:03npoektopdrewr, thank you again!
13:06LauJensenstuartsierra: great job
13:07stuartsierraThank halloway, he fixed it. I just nagged. :)
13:08LauJensenI was happy about the bit that there was a quick temp fix, and no lack of follow-up to get the real issue fixed
13:08LauJensenHowever - I think it would be in place to set up some kind of alert system so that a build isn't lying in pieces for 7 days
13:21cemerickNot sure about that. No one really complained about it for 7 days. :-)
13:22LauJensenIn my oppinion thats the weakest possible argument for accepting such a failure
13:22drewr,(conj '(1 2 3) 4)
13:22clojurebot(4 1 2 3)
13:22drewr,(conj [1 2 3] 4)
13:22clojurebot[1 2 3 4]
13:22drewrI've never noticed that before
13:22cemerickLauJensen: well OK. But Hudson *is* the alert system, fundamentally.
13:23cemerickyup, conj is polymorphic
13:23LauJensen,(reduce conj '() [1 2 3 4 5])
13:23clojurebot(5 4 3 2 1)
13:23LauJensendrewr: noticed that? :)
13:23chouserit's hard to make people not ignore stuff they want to ignore. At least not without other social consequences.
13:23drewrwhy does one want conj to behave like cons for lists?
13:23LauJensenchouser: I didn't get the impression that this was caused by anyone with bad intentions?
13:24cemerickdrewr: conj is a polymorphic cons.
13:24chouserLauJensen: I was referring to people ignoring the build failure alert in hudson.
13:25LauJensenchouser: Yea, am I'm just asking the question, did they know it was there?
13:25drewrI get that it's polymorphic; I'm confused as to why you want to build lists the other direction as you do with vectors
13:25chouseryou can subscibed to an RSS feed of failures, so it's easy to know. but if people are ignoring that, well, what are you going to do?
13:25chouserdrewr: that the only direction you can build lists efficiently.
13:25cemerickdrewr: because that's the only way one can add to a list efficiently.
13:25LauJensendrewr: No other way to build lists efficiently
13:25cemerickchouser: oh, here we go again! :-P
13:26cemerickdamn, almost down to the word, even
13:26LauJensenchouser: Cant we just assign the main responsibility to you, and then you'll handle it?
13:26drewrI'm sensing here it has something to do with efficiency
13:26drewr;-)
13:26chouserLauJensen: no thanks
13:26cemerickconj adds an item to a collection, in whatever way makes sense for that collection.
13:26drewrI get it, so you don't have to traverse the entire list to append to the tail
13:26cemerick,(conj {} [:a 5])
13:26clojurebot{:a 5}
13:26LauJensenchouser: I would ask cemerick but he's busy sorting out his XML
13:28cemerickLauJensen: Not really, it sorta just works, and is busy deploying apps to three different app servers at the moment. ;-)
13:28LauJensenhehe
13:28LauJensen:)
13:28LauJensencemerick: I'll watch your screencast and see if you dont end up making a good case for it
13:29joshua-choiWe being Hickey, the dictator, of course
13:29BeketHey people! I'd like a cool starting project to learn clojure. Something non-trivial + interesting. Any suggestions ? :D
13:29drewrjoshua-choi: that's where I was headed; I assumed PersistentList was very different from Cons
13:30chouserPersistentList is only different in that it promises the rest part is also a PersistentList, and also it knows its own length
13:31joshua-choiYeah, I guess countability is a big difference. (Though that PersistentList promises that its rest is another list is moot if Cons become also lists.)
13:31cemerickare people still using lists?
13:31cemerickI mean, explicitly?
13:31joshua-choiHmm, yeah, countability throws a wrench in that idea, then...
13:31joshua-choiI do.
13:31lithprBeket: i'm reluctant to respond. Do you really want suggestions?
13:32cemerickjoshua-choi: why?
13:32chouserwell, you're asking for a polymorphic 'cons'. Which ... doesn't sound particularly bad I guess.
13:32joshua-choicemerick: In a Clojure-in-Clojure parser. :P
13:32drewrcemerick: I apparently haven't yet after 2.5 yrs :-)
13:32LauJensenBeket: Go check out my blog, there should be something worth trying out: http://www.bestinclass.dk
13:32Beketlithpr, please don't respond, if that makes you feel bad :)
13:32cemerickjoshua-choi: oh, OK, nevermind. Have fun :-D
13:32lithprk
13:32BeketThanks for the pointer LauJensen
13:32cemerickdrewr: that's where I was going... :-)
13:32joshua-choicemerick: Also, we use them all the time in macros. Though list* secretly returns a Cons.
13:32drewrI just haven't read as much of the source as I should have by now
13:33joshua-choi,(list? (list* 5 2 [1 2]))
13:33clojurebotfalse
13:33cgrandon lists vs seqs: in my experience treating lists as seqs hurts performance (pop/peek/conj vs next|rest/first/cons)
13:33joshua-choiIts docs are misleading too
13:34cemerickcgrand: I always produce vectors, and consume seqs, unless otherwise required. That eliminates any issues AFAICT.
13:34cemerickThis is all app-level talk, of course.
13:36joshua-choiIn certain cases with monads, I get right-grouping, so I use lists and cons's instead of vectors.
13:46nortonhello
13:47chousernorton: hi
13:47nortonI was wondering if anyone could help me understand an error I am seeing when trying to use conjure-contrib.sql
13:48norton(ns database-manager (require [clojure.contrib.sql :as sql]))
13:48norton(require 'database-manager)
13:48nortonjava.lang.VerifyError: class clojure.contrib.sql$loading__4946__auto____47 overrides final method meta.()Lclojure/lang/IPersistentMap; (database_manager.clj:1)
13:48chouserthat should be ":require" instead of "require", but that's probably not causing your error.
13:49chousersorry, "(ns database-manager (:require" Your second one is correct.
13:50rhickeyso, any more input on the names for deftype variants?
13:50nortonso the first one (ns ... ) is written in a file: database_manager.clj
13:50chouserrhickey: When you're not here, we just talk about our favorite build tools. So no.
13:50nortonthe second one is entered into a repl fired up using "lein repl"
13:51rhickeychouser: I see
13:51rhickeyI thought you talked about editors :)
13:51chousernorton: that's not an error I've seen much. do you have matching clean builds of clojure and contrib?
13:52nortonThis is whatever is in clojars
13:52rhickeyI was wondering if the distinction I made between program constructs and domain data constructs holds
13:52nortonbtw, I have some unit tests on the database_manager ns that execute fine
13:53nortonits just when I try and require it into the repl I get the problem
13:53nortonso I would think its a classpath issue, execpt it doesn't seem to be
13:53chouserdrewr: http://clojure-log.n01se.net/date/2010-03-25.html (just looked it up myself)
13:54drewrthanks
13:56Licenser(map greet (who #clojure))
13:56chouserrhickey: yeah, I think the conceptual distinction is sound. "program construct" doesn't automatically suggest to me what I think you mean though.
13:57rhickeydeftype + deftmap ?
13:58chouserwhere deftype is raw and deftmap is mappy. meh.
13:59rhickeyideally the names would suggest the distinction, those don't
13:59drewrdeftypem
13:59rhickeydeftype + defrecord/defentity
14:00chousertheir behavior around non-closure methods, fields, and performance will be similar, right? having somewhat related names might be useful.
14:00rhickeychouser: yes, very similar and could be variant of same base, but then they get longer
14:00chouserdefrawtype + defmaptype
14:00rhickeydeftype defmaptype
14:01drewreww
14:01chouserdefrawtype deftype
14:01chouser"raw" isn't quite right
14:02drewrI think I still like deftype/deftypem -- implies the latter is an extension of the former, and doesn't tie too much logic into the name (which usually backfires)
14:02LauJensenwhat does 'defmaptype' cover exactly ?
14:02drewrplus, I like brevity
14:02chouserLauJensen: like (deftype ... clojure.lang.IPersistentMap) is now
14:02rhickeyLauJensen: deftype w/full map implementation
14:03drewrof course, I'm the guy that actually likes car/cdr
14:03rhickeydata + datamap
14:03drewrtoo overloaded
14:03LauJensenah, so their uses are totally different?
14:03chouserdrewr: and yet doesn't know which end lists grow on. ;-)
14:04drewrhaha
14:04rhickeydatatype datamap
14:05LauJensenrhickey: would deftype and defmap be totally wrong? :)
14:05chouserI actually like data. deftype already needs a different word in prose, "datatype". So we'd just need something similar for 'data'
14:05LauJensenyea datatype and datamap aren't bad
14:06arohnerI like datamap
14:06rhickeychouser: I'm not sure which name means which in your sentence
14:06chouserI like having something to indicate type in both, because that's what's being defined: a named type. not an instace, an example, a map, or anything else.
14:06drewrchouser++
14:06rhickeydatatype maptype
14:07chouseryes!
14:07joshua-choiAre these ideas for Clojure 1.2?
14:07Licenserchouser++ ?is that chouser with objects?
14:07chouserLicenser: perhaps. and my mutable state is indeed uncoordinated.
14:08chouserjoshua-choi: yes
14:08rhickeyso, what about not having def prefix?
14:08Licenserchouser: *snickers*
14:09chouserrhickey: that would feel weird, at least at first.
14:09LauJensenrhickey: I'd prefer prefixing both of those suggestions with def
14:10drewrif map is going to be in the name, then I like deftype/defmap
14:10drewrthe "def" prefixing "map" implies that it's some kind of blessed map
14:11LauJensenTo me it just seems natural to keep all of this conventional, defmaptye, defn, defmacro, etc
14:12drewrLauJensen: why is defmaptype conventional?
14:12rhickeydef* for me is fundamentally about some shortcut for (def blah ...), that is not the case for these
14:13LauJensenrhickey: I know thats the case, but I don't think most users perceive it like that. I could be wrong though
14:13rhickeyI'd also change current definterface to interface
14:14rhickeyinterface X, datatype X, maptype X
14:14chouserhm
14:14dnolenrhickey: ++
14:14dnoleni mean, inc
14:14drewrI don't like it, but you have a larger picture in your head than I do
14:15dnolena different convention because they are all "lower level constructs" in my mind, not the thing you should normally be reaching for.
14:16drewrI have a need for typed maps quite frequently
14:16chouserI guess all existing def* are about Vars, aren't they.
14:16rhickeyprotocol X
14:17rhickeychouser: yes
14:17rhickeyand though datatype/maptype do create vars, not their primary purpose
14:17rhickeyprotocol more about vars
14:17rhickeyinterface not at all
14:18chouserfor me what's uncomforatable is that they look like some kind of side-effect-free conversion function or something.
14:18rhickey(datatype Foo [a b c] ...)
14:18chouserlike (maptype Foo [a b]) is coercing the vector and returning something...
14:19drewryes
14:19foguschouser: What if the first letter was capitalized?
14:19rhickeyfogus: Datatype and Maptype?
14:20chouserthose look like class names to me, not verbs
14:20fogusrhickey: right Interface X also
14:20drewrit does imply construction of some kind, but you feel like you need to def it to a var
14:20rhickeychouser: agreed
14:21chouseris there a new prefix we can use for these? we're not defining vars, but we're certainly definining something.
14:21rhickeydef* does have the "this probably belongs at toplevel" feel
14:21dnolenchouser: I always thought ns looked kinda weird as well. is datatype, maptype, et. al. so different?
14:21foguschouser: Moreso than the lowercase version?
14:21drewrrhickey: yes
14:21fogusI suppose caps hold too much baggage
14:22rhickeyfogus: if we are going to adopt uppercase at all, I'd like it to be for type names
14:22fogusgot it
14:22rhickeychouser: new and shorter prefix welcome :)
14:23chouserso if we're not "def"ining, and certainly not "declare"ing, what are we doing? installing, instilling, embedding...
14:23fogusnewtype newinterface ... again new has too much baggage
14:24dnolenchouser: ns creates a namespace object and returns a nil. we don't do def-ns
14:24chouserspecifying. specmaptype
14:24rhickeydnolen: because it would be defns
14:24chouserdnolen: perhaps not. I'm sure we'd get used to it.
14:24dnolenrhickey: heh, yeah, not good.
14:25drewrI'm stuck on deftypem or defm
14:25rhickeydrewr: those seem awkward
14:25LauJensenchouser: its a shame we need a prefix, mapspec, typespec, sounds nice
14:25drewrwhat about deftype*/deftype
14:26drewrnot sure if that idiom applies here though
14:26rhickeydrewr: people normally shouldn't be using the * versions of things
14:26drewrok
14:27drewrthough as a user, I'm really only interested in creating typed maps
14:27astoddardWhat about a sigil prefix or suffix, such as +datatype or >datatype?
14:27LauJensenouch
14:27rhickeyastoddard: duck!
14:27ndimidukforgive my ignorance, but isn't this was namespaces are for?
14:27drewrseems like if I'm creating a type with only hash/= I'm in java-land
14:28fogusthen we could add twigils! :p
14:28rhickeydrewr: unless you are writing collection or reference types...
14:28LauJensenrhickey: Do they need to be associates in any way? Or would deftype and datamap work ?
14:28chouserdelinitiate. delmaptype :-)
14:28rhickeydelete
14:28chouserright
14:28fogusHas anyone proposed any literal representations?
14:29rhickeyLauJensen: without a connection we will need duplicate docs, where one is clearly like the other plus a bit
14:29chouserfogus: for instances of these things? That's a whole other rabbit-trail.
14:29LauJensenTrue
14:29foguschouser: right... was curious if anyone has taken that trail yet.
14:29rhickeyfogus: printing is easy, reading requires the supporting defs be loaded first
14:30drewr"delinitiate" that took a moment to parse
14:30LauJensenI'm ducking out, but deftype and defdatamap would be my best bet
14:30chouserdrewr: gah, sorry for the typo. "delineate"
14:30drewrah! that's how I read it :-)
14:30chouserbut useless because we all know "del" means "delete"
14:30chouserfix
14:31fogusfreshtype freshmap freshinterface yuck
14:31chouserresolve, appoint, establish, dictate
14:31rhickeydefdatatype and defdatamap start to become sentence-in-a-word
14:31chouserrhickey: is that good or bad?
14:31rhickeybad
14:32rhickeygiven we don't have the def- convention
14:32rhickeydef-datatype and def-datamap are better
14:32chouseroh, I see. yes.
14:32joshua-choiThere is clojure.template/def-template, I recall.
14:33chouserI guess if you're sure we won't want 'datatype' or 'protocol' for some non-top-level thing later, it's just a matter of getting used to it.
14:33rhickeydef-maptype
14:33fogusjoshua-choi: deftemplate @ http://github.com/richhickey/clojure-contrib/blob/2ede388a9267d175bfaa7781ee9d57532eb4f20f/src/main/clojure/clojure/contrib/macro_utils.clj#L236
14:34drewrI'd just assume have defmaptype
14:34joshua-choifogus: ! It was def-template when I last saw it
14:34rhickeyswitching to def- will just leave people wondering when to use which
14:34joshua-choiAh!
14:34joshua-choiI was confused with do-template
14:36fogusMy favorite for the defmaptype thing is still deftemplate, but I seem to be the only person
14:36joshua-choiWhat *is* defmaptype? This seems to be a very new development
14:37rhickeyfogus: in support of defmaptype?
14:37drewrfogus: that makes me think of something metasyntactic, not a datastructure
14:37dnolenjoshua-choi: creating a datatype that acts like a map is a big pain. so rhickey making it easier for us by providing some that's easy for us to extend that already has that functionality.
14:38joshua-choidnolen: As a shortcut for (deftype Type [...] clojure.lang.IPersistentMap ...)?
14:38drewrjoshua-choi: yes, but also to have a more generic deftype behind it I think
14:39fogusdnolen: Not using the IPersistentMap magic is the hard part correct?
14:39fogusrhickey: In place of defmaptype
14:39joshua-choidrewr: Could you elaborate on "more generic deftype"?
14:40rhickeyfogus: I'm confused
14:41rhickeyignoring the deftemplate in contrib?
14:41fogusrhickey: Are contrib names off-limits?
14:41hugoddefmapped
14:41dnolenjoshua-choi: I think clojure.lang.IPersistentMap is a lot for anyone to implement (I should read the irc backlogs more closely) just to get map-like behavior.
14:41rhickeyI'm just trying to understand your proposal, given that you just linked to contrib deftemplate
14:42astoddardWhat about spec-datatype or add-datamap? To avoid def def- confusion.
14:42drewrjoshua-choi: I described it backwards; you were essentially correct in your estimation
14:43joshua-choirhickey: No, I wasn't proposing anything. If you're talking to me. :P I was confused. I was referring to clojure.core/doall, doseq, etc. vs. clojure.template/do-template, which has a hyphen.
14:43rhickeyjoshua-choi: sorry, no, fogus
14:43fogusrhickey: I see. The link was meant for joshua-choi but reminded me that my proposal last week of using the name deftemplate in place of defmaptype was met with silence. I'm not trying to link the contrib macro with defmaptypes
14:43clojurebotcontrib is http://github.com/richhickey/clojure-contrib/tree/master
14:44rhickeyfogus: ok. I don't see the map variant as a template
14:45joshua-choiWhy did clojurebot talk again? What prompted it?
14:45rhickeyinterface-type, data-type, map-type
14:45fogusrhickey: The etymology of deftemplate goes back to my knowledge of the "similar" CLIPS construct.
14:46drewras an app-level user, I'd rather definterface/deftype/defmap
14:46drewrI know you want some separation from those, but I think it would be confusing
14:47chouserinterface-spec, data-spec, map-spec
14:47rhickeyfogus: ah
14:47chouserthat conflates or overloads the "specifying" with the "specification"
14:47rhickeytemplate has taken on a lot of baggage since then
14:48fogusrhickey: yes. That is very true
14:49dnolenspec seems weird to me, but that's just my experience, make me think of testing frameworks.
14:50rhickeyin any case, template begs the question, template for a what?
14:50rhickeydefmaptemplate
14:51fogusThat was my thought
14:54astoddardAre the "def" (or whatever is better) versions of the names going to be macros like defn is for def fn?
15:03Licensercooookies!
15:16powr-tocHey... just started using labrepl, under netbeans on Windows and it looks like clojure-1.2.0-SNAPSHOT is not downloaded in the dependencies... any idea why?
15:16powr-tocI can't see it in build.clojure.org/releases
15:17kotarakpowr-toc: it's in build.clojure.org/snapshots
15:34powr-tockotarak: we're doing a clojure workshop just now... one of the guys on windows is having some problems... For some reason his labrepl doesn't seem to have any css applied to its pages etc...
15:34powr-tocalso he doesn't see any code snippets
15:35rhickey_powr-toc: that would be due to no css - how is he running it?
15:35defnmy labrepl works fine
15:35rhickey_powr-toc: e.g. in what environment?
15:35defn*(im not on netbeans + windows, though)
15:37rhickey_if he's on Netbeans he needs the latest enclojure plugin: http://github.com/downloads/EricThorsen/enclojure/enclojure-plugin-2010-23-mar.nbm
15:37rhickey_that fixes an issue where the project repl did not get the project dir as the working directory, causing exactly what you describe
15:39TakeVHuh, enclojure updated?
15:40powr-tochey rich
15:41rhickey_powr-toc: yes?
15:41powr-toche's on windows 7, but it turns out he didn't download the latest version of enclojure, because he had it already
15:42powr-tocAlso we had some problems under both windows and ubuntu with enclojure/netbeans... nbgit seemed to struggle cloning the github repo
15:42powr-tocit failed with an auth error
15:42powr-tocso we had to git clone it ourselves
15:45cemerickpowr-toc: in my experience, nbgit is rubbish, unfortunately.
15:45Licensergood freif
15:45cemerickI hear that NetBeans will have git support baked in sometime soonish, but who knows
15:46cemerickcmd line + gitx is a pretty killer combo in the meantime
15:48cemerickrhickey_: do you have any pointers to materials discussing approaches to "porting" (reimagining?) mutable data structures to a persistent form?
15:49rhickey_cemerick: heh, no
15:49cemerickI figured. :-)
15:50rhickey_there is some generic technique described in "Making data structures persistent" Tarjan et al
15:50cemerickSo much literature out there, describing good stuff, all semi-taboo now that I know what it's like to not deal with mutability.
15:50defnhmmm i found something that's not working in labrepl -- just something small -- on 'its_all_data.clj' the (code (quote println)) is actually displayed as 'println in the rendered page -- where i assume it should be (quote println). i'm looking at labrepl/util.clj but my macro foo is not strong enough to know how to fix this one. if anyone has a minute and wants to take a look thatd be cool: http://github.com/relevance/labrepl/blob/master/src/labrepl/util.clj#
15:51defn(did all of that come through or did it get cut off?)
15:51defnhttp://github.com/relevance/labrepl/blob/master/src/labs/its_all_data.clj#L51
15:51defnthat's the (code (quote println))
15:51rhickey_cemerick: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.133.4630
15:51rhickey_cemerick: but I rejected that technique
16:00chouserafter the reader's done, there's no way to differentiate between (quote foo) and 'foo
16:03defnchouser: interesting
16:03chouserthat's true generally of reader macros, actually
16:04chouser,'#()
16:04clojurebot(fn* [] ())
16:04chouser,'(fn* [] ())
16:04clojurebot(fn* [] ())
16:04arohneris there a version of nth that counts from the end of the list, or do I have to do (nth (- (count list) x) list)?
16:05drewrhugod: I'm finding that as I encounter breakpoints, my swank thread count goes up but never down
16:05defnchouser: so in this instance the best way to deal with it would just be to not run it through any (code (...)) whatsoever and just print it out in HTML?
16:06hugoddrewr: nested breakpoints? how are you counting threads?
16:06chouserdefn: I don't know enough about what laprepl is doing there to answer that
16:06defnhttp://github.com/relevance/labrepl/blob/master/src/labrepl/util.clj#L25 && http://github.com/relevance/labrepl/blob/master/src/labs/its_all_data.clj#L51
16:07rhickeychouser: ever look at: http://functionaljava.googlecode.com/svn/artifacts/2.22/javadoc/index.html ?
16:08rhickeyerm, http://functionaljava.googlecode.com/svn/artifacts/2.22/javadoc/fj/data/fingertrees/package-summary.html
16:09drewrhugod: I mean the execution threads that swank fires off
16:09chouserrhickey: ha! no, I hadn't.
16:09chouserdefn: perhaps
16:10chouserdefn: perhaps 'code' should optionaly take a string instead of a form?
16:10drewrhugod: it should tell you in your modeline
16:11defnchouser: like a multimethod maybe?
16:11lancepantzif i read a java properties file within a jetty webapp, will it reopen the file for every connection?
16:12drewrhugod: that may have been because I was killing sldb windows out of frustration though
16:12drewrno, it was from sldb-inspect-in-frame
16:12drewrwhich doesn't seem to work
16:14drewrhugod: how recent of a slime version do I need?
16:14drewrmine's probably a couple months old
16:14hugoddrewr: you see locals?
16:14hugodanything from elpa to head
16:14drewrah, hadn't hit return yet
16:14drewrI was doing eval-in-frame
16:15drewrand typing the binding name
16:15hugodjust typing the local symbol should work
16:19maxhodakis it possible to do (partial (new myclass)) ?
16:20hiredmannope
16:20hugoddrewr: woops, eval-in-frame doesn't seem to work -thanks
16:20chouserno, but you can do #(new myclass %)
16:20hugoddrewr: the locals should be available at the repl, and through inspection of the first stack frame
16:20maxhodakchouser: i want to do something like `(new ~myclass anotherclass)
16:21maxhodakbut anotherclass isn't in scope inside the quote, and ~anotherclass give me "print-dup not defined"
16:21chousermaxhodak: this is in a macro?
16:21maxhodakchouser: yes
16:22maxhodaker no
16:22chouserrhickey: I'm not sure they make 9-sided coins.
16:22hiredman1d9
16:22clojurebot7
16:22maxhodakchouser: its not in a macro; i'm using *gasp* eval
16:22technomancyhugod: did you post a writeup of swank break yet?
16:22hiredman:D
16:22esjrhickey, you could use the 'Universe Splitter' app on the iPhone and go with all of them !
16:23hugodtechnomancy: not yet... - it might solve some questions
16:23rhickeyI'm not loving datatype for the base version, as map types are for plain data IMO
16:24drewrhugod: I think I've got the hang of it, though if something goes awry, the errant sldb never dies and swank keeps accruing threads
16:24drewrI can try to track that down
16:24chouserthe base version is techincally more general, so: deftype and defmaptype ?
16:24chouserplus or minus "def"
16:24rhickeychouser: yes, those are the current, unloved, leaders
16:25drewrs/defmaptype/defmap/ and you have a winner
16:25hugoddrewr: exceptions are nested - you should have restart to go back to the previous level - I'm not sure "thread" is the correct terminology here...
16:25Chousukethat kind of implies defining a map instance :/
16:26drewrChousuke: how so? defmap isn't anything like hash-map or sorted-map
16:27drewrhugod: ok, yes, it works if I remember to hit 1 instead of 0, but I would think a QUIT should completely kill the sldb session
16:27chouserdrewr: you're not defining a map, but a thing that describes a whole class of maps.
16:28chouseroptionally replace the word "class" there with: category, kind, type... :-)
16:28rhickeydeftype and deftype-map
16:28drewrcouldn't that argument be made about defstruct?
16:29chouserdefstruct has a few naming problems IMO. :-)
16:29hiredman(deflineage ...)
16:29hugoddrewr: you should have the option to do either (QUIT to the top level, ABORT to the previous level)
16:30drewrhugod: I do, but QUIT leaves a lingering execution thread
16:31drewrchouser: in that case, I vote for deftype/deftypem
16:32chouser(deftype Foo [a b] :as this :automap true)
16:32chouserew, scratch that
16:32chouseror rather have 'true' be the default
16:33hugoddrewr: then that's a bug - could you tell me how to reproduce it
16:33dnolenI vote datatype, maptype, protocol, interface. a clear, uncommon, succinct set of names, doesn't add more def stuff (a conceptual break), easy on the eyes.
16:34drewrhugod: invoke a break, : foo RET q, then you should see in your modeline your slime execution count incremented
16:35chousermap maptype mapcat -- which is a pure function that returns a seq and which defines a new namespace-global type name?
16:36dnolenconsidering I don't even know mapcat very well, I wouldn't get confused about maptype, what could that possibly mean?
16:36dnolenas fn operation I mean.
16:36hugoddrewr: that gives me sldb buffer with a sldb[2] indicating a nested exception - pressing 0 closes the buffer and takes me back to the repl
16:37chousermaybe it takes a dataype name and seq of regular maps, and returns a seq of instaces of the dataype. :-)
16:37drewrhugod: I think you'll only see what I'm talking about if you are working from a source file
16:37drewrthe modeline for the repl doesn't have it
16:40dnolenchouser: not likely :) I generally expect Clojure to be fairly obvious. maptype sounds special, especially since there's only one other name with the word type in it. datatype.
16:41chouser,(type 5)
16:41clojurebotjava.lang.Integer
16:41dnolenand that makes conceptual sense.
16:41dnolen,(maptype [1 "foo" :bar}])
16:41clojurebotUnmatched delimiter: }
16:42dnolenI don't think that'll be a very common thing to try :)
16:43dnolen,(map type [1 "foo" :bar])
16:43clojurebot(java.lang.Integer java.lang.String clojure.lang.Keyword)
16:44chousermy point in comparing map maptype and mapcat though is mostly about how their names all look like regular pure functions.
16:44dnolenBut Clojure has 11 special forms, there really no way to distinguish between special forms and pure functions.
16:44chouseras I said before, if we're sure we're never going to want regular pure functions named protocol or interface or maptype, I'm sure we would all get used to those defining namespace-global names.
16:45dnolenfor example I keep trying to use "and" as a pure function.
16:45cemerickrhickey: it's hard to not cringe @ the Driscoll et al. in a world that has Okasaki & Huet
16:45drewrhugod: http://img.skitch.com/20100330-f1fbxt918y1iwcw41jy5685etk.jpg
16:45hugoddrewr: can't miss that arrow :-)
16:45drewrwhat arrow???
16:46drewrskitch ftw :-)
16:46dnolenchouser: couldn't we just use protocol/protocol* in that case?
16:47chouserdnolen: which one means what though? * carries very little meaning, except the general implication you might want to avoid calling it.
16:47chousers/general/vague/
16:49hugoddrewr: its leaking sldb buffers, the number of threads is stable
16:52drewrhugod: if I type (Thread/sleep 5000) and hit C-x C-e twice, that number increments by two
16:53drewrare those not threads of execution?
16:53dnolenchouser: I supposed mostly concerned with the addition for 4 new def(things). I'm more afraid of some new to Clojure wondering whether they should deftype, defmaptype, defstruct, defprotocol, definterface. when really they should just be using maps. But perhaps this really isn't a valid concern.
16:53kylesmithSo I'm still trying to get emacs working with clojure. I removed all the system-wide paths to slime (in favor of technomancy's github version), but now emacs is complaining about slime-fancy. Any ideas?
16:54chouserdnolen: I'm not sure that choosing different names does anything to reduce that concern. :-)
16:54drewrdnolen: they'll need to learn what each thing does anyway; I like using def because it communicates something declarative and top-level
16:54drewralthough I just realized that ns isn't defns
16:54drewrso maybe I shouldn't care
16:57hugoddrewr: I don't think so - slime-list-threads doesn't show any changes
17:01drewrhugod: ah, ok, that number is overloaded then, because: http://img.skitch.com/20100330-nf3h4hrxc1nhm8wjm731p364ws.jpg
17:04kylesmithCan somebody tell me again why swank-clojure-autoload was deprecated? All I wanted to do was update my emacs setup to get a bugfix, and now everything's changed so much that I can't get it to work.
17:06dnolenkylesmith: technomancy's slime unfortunately removes support for other lisps, you need to add those files back from that commit of slime.
17:06hugoddrewr: the number is (length (slime-rex-continuations slime-default-connection))
17:07dnolenkylesmith: for what it's worth this problem should soon be over. hugod's work make's swank-clojure work with SLIME master again.
17:08hugoddrewr: so continuations aren't being handled properly
17:08drewrhugod: interesting, thanks for tracking that down
17:08technomancykylesmith: the old installation method was very complicated and error-prone; the new one is automated and causes way fewer problems.
17:08kylesmithOk. When is that expected to be finished?
17:09hugodkylesmith: current 1.2-SNAPSHOT should work with slime head
17:09hugodunless you are using slime-autodoc
17:09kylesmithgreat! can you give me a link, please?
17:10hugodin which case you will need the changes in the autodoc branch
17:10hugodkylesmith: clojars or technomancy's repo on github
17:11TakeVIs there a standard guide for getting SLIME and swank-clojure working with Emacs 23? Because I can't get it working. >_>
17:11kylesmithSo use technomancy's repo of swank-clojure with cvs version of slime?
17:12lithprTakeV, i strongly recommend using the "Emacs Starter Kit" if you are new to emacs.
17:13technomancyTakeV: the swank-clojure readme is pretty comprehensive
17:13TakeVlithpr: Alright, thanks.
17:13lithprIt comes with elpa and a bunch of packages that are very useful. You can get clojure-mode, clojure-test-mode, swank-clojure, etc
17:13lithprfrom elpa
17:13hugodkylesmith: I'm using 2010-03-10 - let me know if you have issues
17:17lithprTakeV: http://www.bestinclass.dk/index.php/2009/12/clojure-101-getting-clojure-slime-installed/
17:17kylesmithWell, I can get to inferior-lisp, but I have to add this to my .emacs (add-to-list 'slime-lisp-implementations `(clojure ,(swank-clojure-cmd)))
17:17TakeVlithpr: That's what I was doing before, but it didn't work.
17:18lithproic
17:18kylesmithotherwise, I just get "no such file or directory, lisp"
17:19lithprTakeV: still take a look at his .emacs on that page. some good stuff there :)
17:19TakeVSure.
17:22lithprTakeV: one last tip that wasn't immediately obvious to me. To customize your setup in ESK, you can make a [username].el in your .emacs.d dir
17:22Crowb4rAnyone here made a rather large gui app in clojure?
17:22lithprinstead of an .emacs in your home dir
17:22kylesmithhugod: This might be a dumb question, but when you said 1.2-SNAPSHOT, was that referring to clojure, or slime/swank-clojure, etc?
17:23lithprcemerick has
17:23cemerickI've what?
17:23hugodkylesmith: swank-clojure
17:23Crowb4rmade a gui app in clojure
17:23cemerickCrowb4r: oh, sure
17:23cemerickUsed the NetBeans Platform, FWIW.
17:25kylesmithhugod: Ok, I'm on that version, but I'm still getting a file not found exception for swank/swank.clj
17:25kylesmithwhich path is swank.clj supposed to be on?
17:26Crowb4rcemerick: Iwas about to ask about netbeans. So that answers that question. I'm just trying to see how some small app development in clojure goes and getting it to a exe with launch4j
17:27tomojkylesmith: you shouldn't have to worry about swank.clj...
17:28hugodkylesmith: you might find that swank-clojure-project is a useful way to start the repl
17:28tomojoh, maybe you should if you're doing something weird I didn't read about above :)
17:28TakeVHmm, the instructions for the emacs-starter-kit don't seem to be working.
17:29TakeVClone the git repo into ~/.emacs.d, right?
17:29rhickeycemerick: yes, but even Okasaki is challenged in sticking with purely functional implementation - Clojure's persistent data structures don't, and that's a key to making them fast
17:30cemerickCrowb4r: NB has its own launcher, FWIW. It's not the best I've used, but is perfectly servicable.
17:32kylesmithswank-clojure-project gives me "wrong argument type: Stringp, nil"
17:32Crowb4rcemerick: Ahh thanks
17:33Crowb4rcemerick: I was thinking of writing a simple car maintaince application and stuffing it as an exe on windows.
17:33cemerickCrowb4r: all in one file, you mean?
17:34Crowb4rcemerick: No I meant convert the jar to a .exe
17:34Crowb4rafter I write it
17:34Crowb4rI should have been specific with stuff it
17:34cemerickCrowb4r: right, well, that's not the easiest thing to do with an NBRCP app. The installation is a dir, with a pile of jars (modules), and a launcher.
17:35cemerickA proper installer can put a single icon in the start menu linked to the launcher, for the same user experience.
17:35cemerickThere are tools (like jsmooth, and others I've forgotten about) that will take a pile of jars, a main entry point, and emit an .exe
17:36cemerickrhickey: yeah...I was about to go hunting for the clojure widget that supports mutable fields :-P
17:36Crowb4rcemerick: launch4j seems to be pretty active.
17:36cemerickI've not used that before, but sure.
17:37Crowb4rIt's all an experiment. I will record the results and make a post about them if I finish it.
17:38hugodkylesmith: something might have changed since the version I'm using. have a look at the emacs backtrace.
17:39kylesmithI honestly don't understand what I'm doing wrong here. I have 1.2-SNAPSHOT of swank-clojure and slime master. I haven't customized anything.
17:39Crowb4rI really like the language a lot and just want to see what it can be used to develop. So thanks for the help cemerick.
17:42hugodkylesmith: you have a need for slime cvs head? the elpa version and instructions are much simpler...
17:43kylesmithI tried the elpa version, and it complained some gibberish about slime-fancy
17:43kylesmithhere's where I'm at now http://paste.lisp.org/display/97104
17:46kylesmith"swank-clojure.el:47:1:Error: Cannot open load file: slime-fancy"
17:46hugoddrewr: should be fixed now - thanks for the debugging
17:47kylesmithThat's what happens when I follow the elpa directions exactly.
17:49quidnuncIs there a non-raw SQL library in clojure? Something like an ORM?
17:50hugodkylesmith: the protocol version identifies that as slime head, not elpa - I suggest you remove slime head, restart emacs, and try the elpa route again
17:50kotarakquidnunc: clojureql, but it's in heavy flux right now
17:50lithprinc hugod
17:51quidnunckotarak: Thank you
17:51kotarakquidnunc: beware: *heavy* flux
17:52quidnunckotarak: Noted, thanks.
17:52kylesmithhugod: that pastebin was from slime-head. The last two things I posted were from my attempt at elpa. I wanted to show that I've tried installing it both ways.
17:53kylesmithI just noticed the version of slime in my elpa is 20091016. How do I get 2010-03-10?
17:53tomojlooks like that's not in elpa yet
17:54kylesmithAck, how convenient
17:54lithpri would mention that i've had nothing but success using 20091016. Other people have gone through hell trying to get other versions to work.
17:54lithprfwiw
17:55tomojI've been using 20091016 as well, but dunno what I'm missing
17:55lithprtomoj: (=)
17:56technomancykylesmith: you've got some old config somewhere that's assuming you're using slime trunk. you need to remove it to use elpa slime.
17:57kylesmithI thought I did that already, but let me double check.
17:57lithprkylesmith: if technomancy suggests something re: emacs, definitely do it :)
17:57technomancycould be apt-get slime
18:00kylesmithWell, that's the thing. slime is actually installed via apt-get (and my sysadmin says it has to stay for various reasons). So, I did C-h v load-path and removed all references to slime in my .emacs, before elpa loads. Are there paths other than load-path that my system-wide slime could still be under?
18:04kylesmithI can confirm that after installing slime through elpa, C-h v load-path contains only references to the elpa version of slime.
18:07technomancyare you calling clojure-slime-config? that's deprecated.
18:07kylesmithnope
18:08shalesHow should I remove an item from the middle of a vector? so far I'm doing this:
18:08technomancythat's the only place from elpa that slime-fancy is mentioned, so it must be coming from outside an elpa package
18:08shales,(let [v [0 1 2 3] i 2] (apply conj (subvec v 0 i) (nthnext v (inc i))))
18:08clojurebot[0 1 3]
18:10shalesIs there no better way?
18:10kylesmithOk, I'll keep digging.
18:14Associat0ranyone here using clojure on .NET?
18:15dakroneshales: (concat (take 2 [0 1 2 3]) (drop 3 [0 1 2 3])) but that's not really pretty either
18:32defn(app :get [["hi [name #"fred|ethel|lucy"]] ["hello " name "!"] ["hi" _] "I don't talk to strangers."])
18:32defni find that pretty confusing -- am i alone?
18:33defndon't answer that -- i just find the syntactic sugar used in that example to be complicate things more than just using the regular syntax
18:34defns/be//
18:39dnolendefn: personally I like it and find it easy to read, but printed in IRC you lose the proper formatting.
18:40fanaticoand if you're not familiar with pattern matching, it may be a little foreign.
18:40fanaticobut I thought it was a very cool example.
18:42defnyeah i think i was just maybe initially a little shocked by it
18:43defnbut i already used it :)
18:44defn(def my-app (app [#".*" &] {:get "every route!"}))
18:44defnthat's pretty cool
19:00Licenserheya defn how is walton going?
19:03defnLicenser: I haven't played with it much -- I've been working on a little geoip thingamajig that I haven't put up yet
19:04SynrG /win 5
19:04defnLicenser: Well I'm sort of tangentially working on it
19:04SynrGups
19:05defnLicenser: I'm building a little enlive + moustache front end for walton -- then im going to let it run overnight on (ns-publics) and have a little website with examples setup
19:05Licenserdefn: very nice!
19:05LicenserSynrG: irssi?
19:05defnLicenser: Finally I'd like to use solr or something and make a little clojure example search thing
19:07Licenserdefn: you could use an irc bot to feed the data dynamically to walton, instead of one shot parsing the data
19:11underdevdefn, that would be great
19:44SynrGLicenser: yah. i habitually use /win instead of alt keys because they can be typed offline on the bus and will be buffered (even though i'm not presently on the bus)
19:44Licenser^^
19:53raekis all expressions in clojure compiled? (I know fns are...)
19:53raeki.e., if I eval (+ 1 2 3), will it be compiled first?
19:54Licenserraek: I think (with a big note on think) not
19:55arohnerraek, Licenser: no, it is
19:55arohnerclojure doesn't have an interpreter
19:56underdevraek: I think (witha big note on think) yes. I seem to remember that clojure...
19:56arohnerit compiles every expression to classes, then runs those
19:56underdevrt, no interpreter
19:56underdevarohner: doesn't that make the answer yes?
19:56arohnerunderdev: yes, everything is compiled
19:57raekah, I suspected so...
19:57raekotherwise, there had to be a interpreter too
19:57underdevoic, "no, it is"
19:58underdev"no, its not not compiled, it is compiled"
19:58arohnersorry, that could have been more clear
19:58erikcw1I'm trying to figure out how to debug a function in Emacs/Swank that keeps throwing a NullPointerException. I've looked though the stacktrace, and non of it seems very helpful. How can I figure out where this exception is being thrown?
19:58underdevi was confused, you were not confusing
19:58arohnererikcw1: I normally look for the last line in the stacktrace that comes from my code
19:59arohneractually, it's a little more complicated than that
19:59arohner1
19:59arohner1) find the root exception, this is the lowest section that says "caused by" in the stack trace
20:00arohneronce you're there, find the last line that comes from your code. this is the highest line in the root exception that has your_file_name.clj next to it
20:00arohnerlook at that line
20:00arohnerthat probably wasn't clear either.
20:01arohnererikcw1: does that make sense?
20:01arohneroh right, you're in slime. keep hitting 0 to get the cause of the exception until you can't anymore
20:01arohnerthen look at the highest line in the stack trace that contains your code
20:03raekarohner: isn't 0 abort?
20:04arohnerraek: I don't remember off the top of my head. whichever says 'cause'
20:05alexykhow do you unzip a sequence of pairs [x y] into two seqs, firsts and seconds, in one fell swoop?
20:08arohneralexyk: does it have to be in one pass?
20:08arohner[(map first s) (map second s)] is pretty straight forward
20:09alexykarohner: yeah, I kinda hoped for an stdlib unzip or some such
20:09alexykthe idea of two passes vaguely annoys me
20:10arohneralexyk: I don't think there's a std one yet. you can build it using reduce
20:11alexykarohner: yep...
20:14drockoHello
20:16erikcw1arohner: I don't see "cause/caused" by anywhere http://pastebin.com/B1CDw3Zk
20:16drockoI need a little bit of guidance. I have several items that I am representing as structs in a list. I store this list as a ref as it's pretty much the only mutable part of what i'm doing. Adding items from the list is pretty easy. What is the best way to modify structs in the list?
20:16drockoalso which sort of list should I use? I am unsure
20:17raekdrocko: have you used assoc-in and update-in?
20:17drockoraek: I have not. I shall look these up.
20:17drockoraek: any tips on what sort of thing I should make this list into?
20:18raek,(assoc-in [{:foo "xyz"} {:foo "ijk"}] [1 :foo] "abc")
20:18clojurebot[{:foo "xyz"} {:foo "abc"}]
20:18raekdrocko: that depends on what you need to do with it
20:19arohnererikcw1: ah, you're using eval region. if this is a multiline expression, try putting it in a function, load the function with C-c C-l (load file), and then run the function
20:19arohnererikcw1: I basically only use C-c C-l, and the repl
20:19raekvectors have fast random access with indices
20:19arohnersorry, got to run
20:20drockoright. i guess it sort of depends on how i want to build and manage this piece of data
20:20drockoah the terminology is kind of loaded
20:21drockolike if i say list, hash, collection, or set they all mean different things!
20:22drockoraek: I think you have given me the clues i needed. Thanks!
20:23raekdrocko: some sources of info: http://clojure.org/data_structures and http://clojure.blip.tv/file/707974/
20:24drockocool thanks!
20:24raekneed to sleep now... (02:24) bye!
22:05lithprhow do you negate a regexp in clojure?
22:07woobylithpr, same as you would in java, which is i think with ?!
22:08lithprokay, didn't check with java docs... thrown off that the whole thing has to be in quotes...
22:09joshua-choiThere was actually a little discussion back in the day, before Clojure 1.0, about those regex quotes...
22:09lithpri guess i could just use a function to negate... for now...
22:15lithprand by willing, i mean "capable"
22:21chouserlithpr: new compared to what?
22:22lithprtcl, perl, ruby...
22:23lithprits always worth the effort... just not tonight...
22:24joshua-choilithpr: Java regex syntax is very similar to Perl's. I can't remember any differences, but there is a section in Pattern's Java docs.
22:25lithprsince you can't negate outside of the quotes, it's different
22:25lithpragain, all my bad, nm, i'll do the legwork :)
22:28lithprits not like wrapping a not around a function is difficult
22:52Crowb4rAnyone play with Conjure a all?
22:53RaynesI don't use anything that has 'jure' at the end except Clojure.
22:56cemerickCrowb4r: this is the web framework?
22:56cemerickhuh, it's grown some
23:12Blackfoothas anyone gone through Lau Jensen's tutorial on hadoop?
23:23ztellmandoes reify have a 'this' reference?
23:24ztellmannm, just re-read the docstring
23:24carkh(reify :as this AProt ....
23:55mcburtonhey all, i'm new to clojure and have an idiomatic question: I'm looking to generate a sequence of vectors w/ random int pairs ([1 3][1 4]...) and I'm having difficulty making a lazy sequence.
23:55mcburtoni tried something like this: (def random-ints (repeatedly #(vector((rand-int 100)(rand-int 100))))) and then used (take 4 random-ints)
23:56hiredmandef like that will hang on to the head
23:56mcburtonbut there is something wrong with my anonymous function that I can't figure out
23:57mcburtonhiredman: right, I can wrap the taake
23:57hiredmanyou have too many parens
23:57mcburtonbut but right now i can't even get it to run
23:57hiredman"wrap the take"?
23:58mcburtonah
23:59mcburton(defn wrapper [n func] (take n (repeatedly func)))
23:59mcburtonshould solve head problem yes?
23:59mcburtonwhere func is (vector (rand-int 10) (rand-int 10))
23:59hiredmansure
23:59hiredmanthat will not work