#clojure logs

2010-09-21

00:01hugodlaurus: yes, m-x org-babel-clojure-bind-session-to-repl
00:02hugodis it no longer in org-mode/contrib/babel/lisp/langs/org-babel-clojure.el ?
00:02tomojthe diff doesn't look pretty https://gist.github.com/f4cc819cbaab8878e888
00:02tomojhugod: it's moved to org-mode/lisp/ob-clojure.el
00:03hugodI didn't change that much
00:03tomojcan you tell me your org-mode version?
00:03tomojI can probably get a better diff that way and then maybe forward port your changes
00:05laurustomoj, I think what I'll end up doing is using http://github.com/markmfredrickson/changeling
00:05hugodlast changelog entry was 2010-05-06
00:05laurusAnd possibly contributing to it and expanding it to suit my needs
00:05tomojhugod: thanks
00:06tomojlaurus: I guess you're not already convinced that org-mode is awesome?
00:06hugodI think it was mainly just sorting out the interactive prompt
00:06laurustomoj, oh, I use org mode all the time, it's the basis for my personal wiki and some other things
00:06laurusBut somehow I don't like the cruftiness of all of the Emacs stuff
00:06laurusIt always takes me a million years to customize anything
00:07laurusSo I'd rather just have a separate Clojure program that converts it all to LaTeX or HTML or whatever
00:09laurusHowever insane that soudns
00:09tomojI guess it wouldn't be too hard either to get changeling to process org-mode files and provide an org-mode output context
00:09laurustomoj, yes!
00:09laurus:)
00:09laurusI love the org mode syntax, it's the best wiki syntax I've ever used
00:09tomoj<clj> is a bit weird in org-mode though
00:10laurusWell, yeah, I'll figure that out later
00:10laurusDoesn't changeling look sweet though?
00:11tomojthe repl session faker looks pretty sweet
00:12laurus:)
00:15laurusThanks for your help tomoj, and hugod
00:15laurusHave a good night!
00:15tomojhugod: looks like these were your changes: https://gist.github.com/60c9ea86b1d2064bbb73
00:17hugodtomoj: don't remember touching regexps - so probably just the last one
00:19tomojhmm, I'll dig around for a common ancestor
01:33scottjDoes congomongo not support storing sets? it appears to convert them (one-way) to vectors
01:55bartjin an if-else statement, Perl offers a way to check the else portion first: using unless
01:56bartjis there a way to do the same in Clojure ?
01:57raek(if-not p f t) == (if p t f)
01:58raek,(if-not true :a b)
01:58clojurebotjava.lang.Exception: Unable to resolve symbol: b in this context
01:58raek,(if-not true :a :b)
01:58clojurebot:b
01:58raeklike that? :-)
01:58bartjraek, thank you very much
03:00LauJensenGood morning all
03:07zmilareciprocally
03:18yayitsweiWhat's the best way to tweak an existing library and use it? For example, I want to add a parameter for OAuth requests in clj-oauth
03:18yayitsweiI usually just add a dependency to the project file and let leiningen take care of it. I can check out the source, but not sure where to put it?
03:20LauJensenyayitswei: if you want to change the library itself, either send a patch or fork it
03:22yayitsweiwhat if I just want to use the changed library in my project. is there anything I have to do with classpaths? (newbie question)
03:51Raynesyayitswei: A very simple thing you can do is simply fork/clone the repository, make your change, and then upload the jar to clojars under your own groupId and depend on it in your project as you normally would.
03:54bobo_yayitswei: if you just want to use it yourself, and are using lein, you can use the "checkouts" thingy
03:59Raynesyayitswei: http://github.com/ninjudd/cake Check out the subproject dependencies section. I think it might be what you're looking for.
04:22yayitsweiraynes: yes, I think that IS what I'm looking for
04:23yayitsweiraynes: thanks!
04:31esjGreetings Denizens of the Parenthised Realms
04:31yayitsweibobo_: can you elaborate?
04:32bobo_yayitswei: in leinigen 1.3+ you can create a folder "checkouts" in your project. and checkout/symlink the project there. then it will use that one instead of the clojars version
04:33bobo_did that make any sense at al?
04:36yayitsweiyayitswei: yep, just reading the docs. perfect that lein has that feature!
04:37bobo_http://gist.github.com/589394
04:37bobo_like that
04:37LauJensenDoes anybody know of a pretty countdown component for swing?
04:38LauJensenbobo_: You should really get into Cake :)
04:38yayitsweibobo_: got it. thank you!
04:38bobo_LauJensen: i know, i have started looking at it. but havent got the grip yet
04:38yayitsweiLauJensen: what do you like better about cake? I was just feeling good that lein had the feature I was looking for, so I didn't have to switch :)
04:38bobo_and i dont think ive ever seen any pretty component for swing =)
04:39bobo_i think lein is easier if you are in linux
04:39LauJensenCake can do the same, even more easily I think
04:39LauJensenbobo_: wrong, cake is easier for any platform
04:39LauJensenwheras lein is just impossible for Windows
04:39bobo_agree on the windows part
04:39LauJensenBut anywho, yayitswei, cake has a persistentvm, and first class task/dependency system and is getting new features nearly every week.
04:40LauJensenyayitswei: and for simple stuff, its a drop in replacement for lein
04:41bobo_stockholm clojure ug has a "getting started" meeting today. i should realy show the windows people cake. wonder if i can get time to look into it before
04:41yayitsweiLauJensen: it's a ruby gem?? interesting
04:41LauJensenyayitswei: yea, thats what makes it so easy to take across platforms
04:41LauJensenPersonally I think thats a brilliant move
04:42bobo_i agree, except it didnt work for me to install the gem in ubuntu
04:42LauJensenFor one build I had an issue which would affect my client, I got in touch with ninjudd and alerted him to the situation, literally within minutes he had pushed a new gem and life went on
04:42bobo_or rather, it wasnt added to the path
04:42LauJensenbobo_: I haven't tried on U, but on Arch it 'just worked'
04:44bobo_i dont think ive ever used gem before either, so dont think it was me. but the script worked anyway
04:44LauJensen'sudo apt-get install ruby && sudo gem install cake' ?
04:47bobo_yeh it worked to install
04:47bobo_but when calling cake, it asks me to install something else
04:47bobo_now i have installed with the script, so cant check what it was
04:49LauJensenAWizzArd: Keyboard just arrived, ordered it from Germany early friday evening O_o ? :)
04:49LauJensenbobo_: oh... never had that. On Windows it needs win32-process, but Ubuntu isnt based off Windows yet is it? :)
04:50bobo_no, just almost
04:50LauJensenIm just kidding, for all the wrong reasons there seems to be a lot of anemosity between #archlinux and #ubuntu
04:51LauJensenI loved Ubuntu the entire time I used it, perhaps with the exception of apt-get
04:53bobo_indeed, but think il try mint next time
04:54bobo_arch is most likely best, but seems to be to much work for me
04:54LauJensenWell. I think the first day is a lot of work, but then once you're all set up I think its actually less work
04:55LauJensenbobo_: I also tried mint - wouldn't do it again
05:00bobo_=(
05:01yayitsweiwell, just got cake to work, so i'm a new convert
05:02LauJensenWelcome to the party :)
05:03LauJensenI really cant believe that there's not a Java Countdown component out there...well, I guess I can since Google says so
05:06AWizzArdLauJensen: Grats!
05:07LauJensenthanks
05:08jjidois there a way to reuse methods added with extend-protocol in a different record?
05:10bartjLauJensen, re: the countdown timer - can you check this out http://software.topcoder.com/catalog/c_component.jsp?comp=27201900
05:11bartjLauJensen, but, I don't think it is Swing based
05:11LauJensenbartj: No, thats for web apps
05:15raekClojurians of Linköping! I announce the first meeting of Linköping Clojure User Group: http://raek.se/lcug
05:18maaclHas the way leiningen handles classpath been changed recently? I am getting weird errors suggesting that the wrong version of the java std lib is being used.
05:19LauJensenmaacl: Will you be there on thursday?
05:19LauJensenmaacl: no, only thing remotely new that I can think of, is that dev-deps go in lib/dev
05:20maaclLauJensen: yep, I will be there
05:20LauJensencool - Any idea how many has signed up ?
05:21maaclLauJensen: nope, but from the doodle it looks like 4?
05:22LauJensenI dont think the Doodle was to gauge interest, just a few of Martins contacts
05:22maaclLauJensen: ok
05:29andyfingerhut
05:56maaclLauJensen: do you use lein-run at all?
05:57LauJensennope
05:58maaclok, I think that might be what is causing the issue - I can import the java class from the lein repl, but if I try to use lein-run it cannot find the class
05:59LauJensenmaacl: What does lein run do ?
06:00fliebelmorning
06:00maaclLauJensen: basically just executes the function - or alias you pass to it
06:01LauJensenmaacl: try 'cake run' then
06:01LauJensenthat runs in the project vm, ie. with your projects classpath
06:02maaclLauJensen: will give that a spin
06:02fliebelI'm trying to get the value of something in a ns by using a string, but I'm not sure how to do it. I'm currently trying to do this, which doesn't work: (var (symbol (str "utterson.plugin/" "hooks")))
06:04fliebelWithout the var it returns the correct symbol, but the var part gives me a strange error.
06:04hoeck,@(resolve (symbol "clojure.core/vec"))
06:04clojurebot#<core$vec clojure.core$vec@8fc42d>
06:05hoeckfliebel: resolve + deref should do that
06:05fliebelhoeck: Thanks :) And if the value itself is a deref as well, doe I just use @@?
06:05hoeckright
06:06tomoj(symbol "ns" "name") also works
06:06fliebeltomoj: Ah, that looks better :)
06:52_na_ka_na_,(char -1)
06:52clojurebotjava.lang.IllegalArgumentException: Value out of range for char: -1
06:53_na_ka_na_(clojure.contrib.read-json "")
06:53_na_ka_na_,(clojure.contrib.read-json "")
06:53clojurebotjava.lang.ClassNotFoundException: clojure.contrib.read-json
06:53_na_ka_na_,(clojure.contrib.json/read-json "")
06:53clojurebotjava.lang.ClassNotFoundException: clojure.contrib.json
06:54_na_ka_na_Hey guys I think there's a bug in clojure.contrib.json at line 116
06:55_na_ka_na_in clojure 1.2
06:55_na_ka_na_it has a (char i) and then checks for (= i -1) ... but (char -1) fails
06:55_na_ka_na_where can I report it ?
06:56LauJensen_na_ka_na_: assembla/support
08:29AWizzArd~seen rhickey
08:29clojurebotrhickey was last seen quiting IRC, 1985 minutes ago
08:29AWizzArd,(/ 1985 60.0)
08:29clojurebot33.083333333333336
08:29AWizzArd~max people
08:29clojurebotmax people is 313
08:29AWizzArdmama mia
08:35bartjAWizzArd, nifty!
08:37bartjtoday, my friend was confused that the REPL was not lazy while evaluation for, etc
08:37bartjbut "for, map, etc." in Clojure code is lazy
08:38bartjI justified the behaviour, that REPL is for experimentation and it is OK if it is not lazy!
08:39bartjplease let me know if there are any better justifications
08:39LauJensen$mail hiredman would be great if the ~seen command formatted it output like > 60 minutes = hours, > 24 hours = days
08:39sexpbotMessage saved.
08:40neotykbartj: it is evaluated in order to print it
08:43bartjneotyk, yes that makes more sense
08:46neotykbartj: REPL is not only for experiments, have you see livecoding with penumbra?
08:47bartjneotyk, I haven't heard either terms
08:48bartjneotyk, and a Google search doesn't help much
08:48neotykhttp://vimeo.com/14709925
08:48bartjexcept maybe that penumbra is related to gaming ?
08:48chouserIt would be possible to adjust the REPL to not force lazy seqs.
08:49chouserwhether that would be useful or not is another question.
08:49fliebelneotyk: I'm very curious to see some livecoding with the audio thing… based on Jack it was, forgot the name.
08:50bartjchouser, I wanted to ask that question, but decided against it :)
08:51neotykfliebel: we could try getting Jeff to do some of his Overtone demo, we would just need a bit better audio system for next ams-clj
08:53fliebelneotyk: Is Jeff the American guy? That would be awesome! It'd be even better if we can collaboratively hack on the same jack server.
08:53bartjneotyk, isn't all the magic in slime ?
08:53neotykbartj: yes it is very handy
08:54bartjneotyk, I think that is what a colleague of mine told me once... that one can change the code at run-time
08:54neotykfliebel: Yes it's Jeff, make sure to post that idea for next meetup :)
08:55fliebelneotyk: I will :)
08:55neotykbartj: for some history I think this guy created livecoding thingy thing: http://vimeo.com/2433947
08:56neotykor at least he was first one I've seen doing this magic
08:57bartjI am afraid I don't understand
08:57bartjdid this guy write slime ?
08:58bartjor he built on top of slime to handle stuff at every keystroke
08:58bartj"Google Instant" for Clojure! :)
08:59neotyklivecoding is "just in time programming"
09:04bartjneotyk, I am in office and haven't watched the complete video
09:04bartjdoes he discuss how one can set it up ?
09:05neotykyou just eval different s-expressions
09:16chouseranyone know how to check if a lazy-seq has been realized?
09:19cemerickchouser: as in, fully realized? Impossible, unless I greatly misunderstand the concepts.
09:19chouserno, just any one step.
09:20cemerickah
09:20cemerickprobably wall-hack the seq field in the lazy seq
09:20chouserhm, yeah, you're right.
09:20cemerickwhich is 's'
09:21chouserI was looking at the ^:once stuff in the compiler
09:21cemerickI'm not familiar with that stuff at all yet.
09:23chouserha, got it.
09:26neotykI was looking for eval
09:26neotykI ended up in Compiler class
09:26neotykand got totally lost there
09:26chouserneotyk: :-)
09:26cemerick"here be dragons"
09:27neotykhow do I learn how eval works ?
09:27chouserman, these things realize themselves at the drop of a hat.
09:27cemerickyeah, they're delicate
09:28cemerickneotyk: in general, or specifically how Clojure does it?
09:28chouserneotyk: In my experience it works well to try to port Clojure to JavaScript.
09:28neotykI understand that you invoke eval on top root element
09:29cemerickchouser: That's just cruel. ;-)
09:29neotykcemerick: interested in both, as I think this a core of any lisp
09:30neotykor do I miss a point here?
09:30chouserneotyk: clojure is not a pure simple little lisp on the inside. It's full of messy bytecode-emitting details. I bet SICP is a great way to get a sence of how lisps in general do eval.
09:30cemerickneotyk: Conceptually, yes. Go read SICP for the real scoop.
09:31cemerickchouser, my irc timing nemesis
09:31neotykSICP it is than, thanks
09:31chouserneotyk: if you want clojure details, there's currently nothing betting than studying the source code.
09:31chouserI plan to write more about it in the future, but have talks on other topics to prepare first.
09:31neotykchouser: that's what I thought, but as I've said I got toally lost in Compiler.java
09:32neotyks/toally/totally/
09:32sexpbot<neotyk> chouser: that's what I thought, but as I've said I got totally lost in Compiler.java
09:32cemerickneotyk: AFAICT, *every* lisp is a mess on the inside, except for examples and research implementations.
09:34neotykcemerick: I still want to understand what is inside, as so far this is most powerful tool I've seen
09:35cemerickThe clojure compiler?
09:35neotykClojure, or actually lisp nature of it
09:36cemerickI'm by no means any sort of expert on the subject, but I'll bet the SBCL compiler is more "powerful" -- Clojure is a hosted language, and so inherits a lot from the runtime in question.
09:38neotykcemerick: is it really that limiting?
09:38cemericklimiting?
09:38neotykinherits from a runtim
09:39cemerickThat's either a limitation or a huge weight of one's back, depending on your perspective.
09:39neotykI though it should be very small core of the language, and than a lot of it written in itself
09:39cemerickClojure's can't touch the hardware like an un-hosted compiler can.
09:40cemerickThat's where things are heading, but that's orthogonal to compiler design.
09:42chouserok, here's how to change the REPL to not force unrealized lazy-seqs: http://gist.github.com/589694
09:45bartjchouser, neato! thank you
09:46chouseryou're welcome. I'd imagine this is not what we'd normally want by default, but might be useful for learning things occasionally.
09:46chouserand of course it depends on undocumented private fields of clojure internal objects and so is likely to break
09:47bartjchouser, I will add these functions and call them before clojure.main is called ?
09:47chousernah, just evaluate them in the REPL
09:47chouserthey'll replace the default functionality
09:48bartjalways ? there must be some way of doing it automatically
09:48chouserI guess you could put them in your user.clj or something if you want them all the time.
09:50chouserhm. I wonder if there's this would be accepted in core with a *print-force-lazy* defaulting to true.
09:50chouser s/there's//
10:04_fogus_neotyk: The documentation is not complete, but this might help you to grasp some of the nuances of eval in a minimal Lisp: http://fogus.me/fun/lithp/
10:05neotyk_fogus_: this is great, thank you!
10:06_fogus_neotyke: If you see any holes then feel free to let me know (there are many)
10:06_fogus_neotyke: ^^^
10:06_fogus_I did it again. :(
10:07neotyksure I will, assuming I'll be able to find holes in it
11:02bartj_fogus_, is that the *evolution* of Lisp ?
11:03defn:F
11:03_fogus_bartj: ?
11:07bartj_fogus_, you are writing your own Lisp using Python ?
11:10_fogus_bartj: Well, not really. Just as I was studying early Lisp impls. It's not intended for industrial use. :-)
11:12LauJensenAll language designers hope to design the perfect language, but after Clojure has come along, what would be the point?
11:13pomyktrue
11:22fliebel_fogus_: What's with Lisp in Python? Just came back...
11:24_fogus_fliebel: I just pointed neotyk to a Python impl of McCarthy Lisp... nothing exciting.
11:24fliebel_fogus_: Oh :)
11:29fbru02somebody was questioning me why the datastructures in clojure where done in Java instead of Clojure, anybody knows this???
11:29mabesfbru02: for bootstrap reasons I think.. now that clojure has deftype and defrecords they could/may be ported over I believe
11:29dnolenfrbu02: because the infrastructure wasn't yet in place to do it Clojure. 1.2 is great progress along that route.
11:30LauJensenfbru02: Clojure uses datastructures to it needs a bootstrap, second it has not been possible performance wise yet
11:30mabes:)
11:31fbru02thanks all : is there a plan of re-working that code in Clojure ?
11:31LauJensenfbru02: yea, the plan is to code fast all night long, using protocols
11:32fbru02LauJensen: all night ? :)
11:32fliebelHuh, what is the meaning of this error? while scanning for the next token found character '\t' that cannot start any token
11:34fliebelOh, that wasn't even a Clojure error...
12:03fliebelOh, this is one of those things you can only find if you know its name: -?> where is that located?
12:03laurusI'm trying to use Changeling (http://github.com/markmfredrickson/changeling) but I think this is a general question. The README.md file says it has a "leinengen plugin" so one can just type "lein changeling README.md.changeling" in a terminal and it will run. Where in the code would the interface between lein and the program itself be?
12:04laurusI ask because I'd like to run the program through cljr and I can't figure out how to do it.
12:10arohnerchouser: I'd like to see your 'unrealized' hack checked in somewhere
12:10arohnerchouser: responding here because it's less work than GG
12:10arohner:-)
12:12laurusOh, hah
12:12scottjcongomongo users, can you store sets in objects? (insert! :foo {:a #{1}}) => {:_id #<ObjectId 4c98d87f4cf1822845300950>, :a #{1}}, (fetch :foo) => ({:a [1], :_id #<ObjectId 4c98d87f4cf1822845300950>})
12:14arohnerscottj: no, just maps and vectors
12:15laurusIs there a way to "run" a package from cljr?
12:29hiredmanlaurus: http://github.com/markmfredrickson/changeling/blob/master/project.clj
12:30laurushiredman, I found that, thanks
12:30laurusI think what I need to do is create a .clj script that runs part of those lines?
12:30laurusWhat I wish I could do is run "cljr changeling <filename>"
12:30laurusBut I don't really know how to do that :P
12:32laurushiredman, what do you think of this solution: create a .clj script in my home directory called something like changeling.clj that does a shebang line
12:32laurusi.e., #!/usr/bin/cljr run
12:40fliebelHow can I get a symbol in a macro without making it a gensym or qualified symbol? It's for the parameters of a fuction.
12:41chouserfliebel: probably should still use gensym unless you're explicitly trying to capture a name and understand the implications of that.
12:41scottjfliebel: is that ~'foo ?
12:42fliebelchouser: I'm making a function that exposes its arguments to the user, so it's of no use if the user has to type var_342_auto to get my variable.
12:42chouser(defmacro foo [x] `(fn [y#] (+ ~x y#))) ; auto gen-sym
12:43fliebelscottj: Yea that's it.
12:43fliebelchouser: I understand how gensym works, But my macro computes a few values, and calls a function with ~@body from the user.
12:44fliebelSo my argument names need to be normal symbols in order for the user to get htem.
12:44chouserUnless this will be used under very limited circumstances, I'd still recommend doing something like having the user specify the symbols they want to use for the args
12:45defnhola everyone
12:45fliebelhey defn :)
12:45chouseror perhaps have the user specify a single name and stuff a map or record in there for them
12:45defnhowdy fliebel
12:45fliebelStill hacking on my macro ;)
12:45defn:)
12:46fliebelchouser: What is wrong with exposing 2 fixed names?
12:46chouserfliebel: so many things.... ;-)
12:46defni like the idea of a map a la chouser
12:46chouserok, not that many.
12:47defnbut /some/ things are wrong :)
12:47fliebelchouser: The only problem I see is a name clash, but It's only used in a quite isolated namespace.
12:47chouserthe main ones: inability to nest, difficulty in avoiding collisions, and more "magical" behavior from the perspective of a someone reading the code.
12:49fliebelokay...
12:49fliebeldiner.. I'll fix it later
12:49chouserbut yes, if you're sure none of those are a problem in your case ~'foo
12:56defnfliebel: keep in mind I have to read this! ;D
13:29cemerickchouser: so, are you ready to write apps in javafx in 10 months? </haha>
13:33chousercemerick: a better GUI lib for Clojure would be fantastic, dont' you think?
13:35cemerickchouser: Of course. Unfortunately, all parties concerned have very poor track records in actually delivering on UI promises. If it comes and it doesn't suck, awesome; until then and otherwise, I am only skeptical, and will assume it's just not going to happen.
13:37chousertsk tsk so jaded.
13:37astoddardIs anyone here using cake with lazytest?
13:38cemerickheh, indeed
13:38astoddardOr more generally worked through issues of *out* binding when using cake?
13:39cemerickFor what I need, I'm putting my chips on a lot of "html5" stuff, wrapped up in swt for desktop deployment.
13:40cemerickchouser: I just need that ClojureScript 1.3.0 impl you're sitting on to make it *really* awesome. ;-)
13:40chousercemerick: I think that's good. Short term pain, but largely future-proof I think.
13:40chouserheh. right.
13:42chouseryeah, I can see that for embedded-browser apps, javascript feels like a particularly arbitrary restriction.
13:43cemerickI don't do a lot of small/widgety/inline stuff anyway, so javascript in general is an arbitrary restriction -- regardless of the mode of deployment.
13:46fliebelWhat is this for a kind of path? utterson-0.1-standalone.jar!/index.md
13:54defnfliebel: never seen that sort of thing
13:54fliebeldefn: It's what I'm getting when trying to load a resource form the classpath from within a jar.
13:57fliebelBut opening such a path fails.
13:57fliebelHow can I load something from the classpath from within a jar?
13:58laurustomoj, are you around?
13:58cemerickfliebel: use the .getResource or .getResourceAsStream methods of the Class class.
13:59fliebelcemerick: That returns this, not matter if the dir is on the cp or not: #<URL jar:file:/Users/pepijndevos/git/utterson/utterson-0.1-standalone.jar!/site.clj>
14:00cemerickfliebel: if those .getResource returns a URL, then you should be able to load it.
14:01fliebelcemerick: An url with a exclamation mark in it?
14:02fliebelcemerick: The whole point is that turning it into a file and reading it fails.
14:03laurusWhy do so many people advocate using SLIME for Clojure in Emacs as opposed to inferior-lisp?
14:04fliebelcemerick: I'm using clojure.lang.DynamicClassLoader instead of Class though.
14:04scottjdocstrings, debugger, inspector, compiler errors
14:05technomancylaurus: also clojure-test-mode
14:05laurusAh, okay
14:05scottjs/docstrings/arglists
14:05cemerickfliebel: either way, if you get a URL out of that .getResource method, the file is there and can be read.
14:05laurusI just got inferior-lisp working with cljr repl without Swank or SLIME, and it seems sufficient for the time being
14:05clojurebotmultimethods is what separates the boy from the man.
14:05laurusI didn't know about those other features :P
14:06cemerickfliebel: the exclaimation point has nothing to do with directories though, that's indicating that the remainder of the path is in the jar that's specified.
14:06fliebelcemerick: But it's not. It's in the resource dir I put on the classpath.
14:06scottjtechnomancy: does C-c t from test buffer jump back to original for you? it onyl works one way for me
14:06technomancyscottj: it's temperamental; I need to take a look at it. works in some projects for me.
14:07cemerickfliebel: you don't have an "utterson-0.1-standalone.jar jar on your classpath?
14:07fliebelcemerick: I'm running that, but site.clj isn't in there.
14:07mrBlisslaurus: look at the slime cheat sheet, you'll find loads of handy things you can do with SLIME http://www.pchristensen.com/slimecommands.pdf
14:07cemerickfliebel: I don't believe you ;-)
14:08laurusmrBliss, ah, sheesh
14:08laurus:P
14:08laurusI think I'll stick with this for the time being, I'm using Incanter so I don't really need most of that stuff, although I can sure see why it would be useful for serious programmers.
14:11fliebelcemerick: Okay, what do I need to prove it to you? I'm successfully creating a java.io.File form the url, and .exists returns false.
14:13fliebelcemerick: http://gist.github.com/590174
14:14scottjtechnomancy: I'm really excited about durendal. jack-in, auto-compile, ns-unmap, reload-all, bury, and autorefer most interest me.
14:15cemerickfliebel: java.io.File does not understand jar: URLs. Use reader or input-stream to get the content from the URL.
14:15technomancyscottj: do you think it's feasible to embed elisp in the swank-clojure side and have it loaded into Emacs that way?
14:16technomancyscottj: I'd be more excited about durendal if it didn't involve distributing elisp without lein
14:16fliebelcemerick: But… site.clj IS NOT in the jar.
14:16fliebelit's in the resources dir, besides the jar, which I put on the cp using -cp resources.
14:18lazy1is there a way to get the equivalent of SERVER_NAME in Compojure?
14:18fliebelcemerick: Although… Cake might have relocated the file there because resources was on my Cake cp, checking that....
14:18cemerickfliebel: I don't know what to tell you. It's certainly classpath-accessible, and it would seem absolutely bizarre that .getResource would return an incorrect URL that would be accounted for when loading the data.
14:19fliebelcemerick: Is it possible that cake put the file in the jar because it was on my cp?
14:19cemerickfliebel: never used cake, couldn't say
14:19scottjtechnomancy: are there options I'm missing other than 1) swank sends code to emacs via emacsclient 2) modified slime pulls elisp from swank on connect 3) third mode hooked into slime pulls code from swank? 3rd sounds feasible but I haven't thought about it
14:19lancepantzfliebel: what's your problem?
14:19lancepantzlooking through the logs
14:20fliebelcemerick: Yea… Cake put everything in the jar.. that explains it :S
14:20technomancyscottj: yeah, 3 sounds best if there is not already a mechanism in slime for it.
14:20lancepantzfliebel: it doesn't put everything in your cp in the jar
14:21technomancyscottj: piggy-backing on slime-connected-hook should actually be pretty easy
14:21scottjtechnomancy: btw is reason for this that part of durendal would be elisp and part clj like clojure-refactoring?
14:21fliebellancepantz: It did for those files anyway. I added them to .cake/config
14:21technomancyscottj: that's a bonus; the main motivation is that distributing elisp is going to be a pain until more people are upgraded to Emacs 24 with package.el
14:22technomancyscottj: and synchronizing versions between elisp and clojure is an absolute nightmare
14:24ninjuddfliebel: looking at the git logs, i changed it to add everything in resources to jars on August 29, probably because someone requested it. i'm happy to change it if that isn't correct
14:25LauJensenninjudd: check your email log with me for reasoning
14:25fliebelninjudd: Then resources should also be on the cp by default I think. Anyway, I will move my files.
14:26ninjuddLauJensen: that's right. it was you who asked for it
14:26lancepantzLauJensen: I was trying to figure out what the best practices for the resources directory was last week, maybe you can shed some light on it
14:26LauJensenninjudd: I didn't :) I asked how to do it manually and you mentioned making it the default, then I said something like 'you wont get any complaints from me' :)
14:26scottjtechnomancy: I wonder about multiple slime connections that each have incompatible swank plugins.
14:26LauJensenlancepantz: Not really, all I can say is that in my experience, every single major project ends up wanting resources/ on the cp
14:27lancepantzso jetty has a resources directory, i expected that to be machine specific properties files, that would be on the cp for all servlets on that box
14:27ninjuddfliebel: you're right though, i should add it to the default cp
14:27lancepantzand that therefore you would not want them in your wars
14:27ninjuddfliebel: if you add your file to PROJECT_DIR/dev/ it will be on the default classpath, but not added to the jar
14:27fliebelninjudd: Thanks :)
14:28lancepantzand machine specific properties would be part of your deploy process
14:28lancepantzbut then that said, i couldn't access stuff in jetty resources from within my war
14:28technomancyscottj: hmm... do people run multiple slime connections in a single Emacs instance? I never do that myself.
14:29lancepantzLauJensen: so then do projects want /resources in build artifacts?
14:30scottjtechnomancy: I doubt most do, I do.
14:30LauJensenlancepantz: not sure, what are the implications?
14:31ninjuddLauJensen: would it have worked for you to just put your files in src instead of resources?
14:31LauJensenninjudd: It would probably have worked, but it would have been counter-intuitive to put resources in src
14:32LauJensenA typical use-case is Enlive templates, they look-up html files on the classpath, and I typically put them in resources/
14:32ninjuddi see resources mainly as an organizational convenience
14:32lancepantzi guess it comes down to if people expect files in their project's /resources to be on the cp when deployed
14:32LauJensenninjudd: which is important
14:32ninjuddsure
14:32LauJensenlancepantz: I certainly do, but I can add it manually to the project.clj though. Is it causing you guys problems now to have it default to do so ?
14:33defnfliebel: technomancy I don't, but to be honest it would be nice
14:33defn(if it were easier)
14:33lancepantzLauJensen: no, neither of us have any idea what the best practice for /resources is though :)
14:33LauJensenok
14:34lancepantzbut you've seen it like that across a few projects?
14:34LauJensenlancepantz: sure, most of them my own though :)
14:34lancepantz:P
14:34LauJensenDoesn't lein also put resources on the cp? I seem to recall
14:34fliebelLauJensen: Lein does, Cake doesn't
14:34lancepantzdo you know what jetty's /resources folder is for?
14:35LauJensenfliebel: Cake does as well
14:35LauJensenlancepantz: No Ive never come across it
14:35fliebelLauJensen: Very sure? I just tried last week.
14:35lancepantzdoes anyone here know what jetty's /resources folder is for? :)
14:35amalloytechnomancy, do you have anything that indicates which of the slime commands work with swank-clojure?
14:35LauJensenfliebel: yea, ninjudd just said so
14:36ninjuddcurrently, cake puts it in the jar, but not on the classpath, which is just wrong
14:36ninjuddhere's what i'm leaning toward: put resources/ on the default cp and in the jar/war (like src/). put dev/ on the default cp, but not in the jar/war
14:37LauJensenSounds good- Though I dont have a lot of experience with war files
14:37LauJensenI prefer love files
14:37LauJensen(that was a joke)
14:38ohpauleezhaha
14:38LauJensengreat, one guy got it :)
14:41lancepantzcemerick: do you have any thoughts on the best practices of machine specific properties files in servlet deployments
14:41amalloycake love, not war?
14:41lancepantzwe need to make a cake love task
14:41lancepantzthat will be lein compatibility mode :P
14:41LauJensenhaha
14:42LauJensenlancepantz: You might want to check with hugod next time he's in here, he does configs for a living
14:42LauJensen~seen hugod
14:42clojurebothugod was last seen quiting IRC, 54 minutes ago
14:42LauJensenhe saw this coming
14:43lancepantzcool, that's convenient :)
14:43lancepantzit's one of those things that i've never felt like i had right, even though i've iterated through a few solutions that work
14:43technomancyLauJensen: yeah, I can't resist a good .war file joke either.
14:44technomancythough I find .ear files to be even more hilarious
14:44technomancyamalloy: just the swank readme
14:45LauJensentechnomancy: you have too much fun :) btw, got my Das Keyboard today, would make the inner IBM M fan in you proud, man it clicks!
14:45technomancyslick
14:45fliebelHuh… when I print the classpath for my uberjar, I get just the jar, no the path I just added with the -cp option.
14:45technomancyfor the record, lein uses test-resources for stuff you want on the cp at dev time but not in the jar.
14:46defnfliebel: still hackin away? :)
14:46fliebeldefn: debugging rather :(
14:46technomancymight be nice to use the same names
14:47fliebel"java -cp testsite -jar utterson-0.1-standalone.jar" prints just "utterson-0.1-standalone.jar"
14:47LauJensenfliebel: -jar negates -cp
14:48LauJensenalso, the JVM might reject that silly name utterson... :)
14:48defnhaha
14:48ninjuddtechnomancy: fine with me. i thought about dev-resources, but that seemed too long
14:48fliebelLauJensen: WHAT! So… how am I going to get a directory outside of the jar on the cp?
14:49LauJensenjava -cp outside.jar:utterson(lol).jar utterson(lol).main
14:49LauJensen:)
14:49fliebelHmmm… sounds plausible btw.. what's so fn about Utterson?
14:50LauJensenMakes me think of a Cow named Utterson
14:50LauJensenMaybe its just me
14:51mrBlissfunny: I'm writing some gui code and for the first time when writing clojure, I *almost* used the set-* prefix for a function name! I just realized I've never written a setter in clojure before.
14:51fliebelYAY!!!! Guys, you're all awesome!
14:51cemericklancepantz: "machine specific" properties files?
14:52lancepantzcemerick: maybe i should say deploy specific properties
14:52defnfliebel: commit! :)
14:52lancepantzbut like i have different db properties for stage and production obviously
14:52cemerickoh, I see
14:52fliebeldefn: not yet! I still need to run the actual thing with what I learnt :)
14:54defnis there anything written for clojure that understands selectors: "foo>bar>baz.bees>foozle#bozzle"
14:54cemericklancepantz: there's about 5000 ways to do that. Servlet properties are a decent approach, if you don't mind filtering your web.xml file when you're building the war.
14:54cemerickThat's baked into maven, but not the simplest of things in other tools.
14:54LauJensendefn: are you kidding me?
14:54defnhow do I get "foo>bar>baz" to be: "foo" ">" "bar" ">" "baz"
14:55defnLauJensen: no
14:55cemerickThat also would require a rebuild for deployment to different environments (e.g. you wouldn't be able to simply migrate the same artifact).
14:55LauJensendefn: Enlive!
14:55fliebeldefn: partition?
14:55defnLauJensen: enlive does selectors too?
14:55defnawesome...
14:55chouser,(vec (.split #"\b" "foo>bar>baz.bees>foozle#bozzle"))
14:55clojurebot["" "foo" ">" "bar" ">" "baz" "." "bees" ">" "foozle" "#" "bozzle"]
14:55defndanke
14:55cemericklancepantz: almost all app containers provide a way to set system properties across all apps, which is a decent approach that allows you to do proper migrations
14:56LauJensendefn (select [:one :> :two :three#id :four.class] html)
14:56defnLauJensen: im trying to generate HTML and CSS at the same time
14:56defnso i give a selector, the content, and styles for CSS, and it generates all of it
14:56LauJensendefn: for generating html, use either templates/snippets from Enlive or hiccup
14:56lancepantzcemerick: do you know how to do that with jetty, for example?
14:56defnim using hiccup right now
14:56defnand gaka for css
14:56LauJensendefn: That sounds like the sweet spot for Enlive, its practically built for tasks like that
14:57defnLauJensen: i was using hiccup, but i will check out enlive!
14:57cemericklancepantz: jetty, as in, standalone, non-embedded?
14:57lancepantzsorry, yes standalone
14:57LauJensendefn: I think I have more than a few tutorials/blogposts on it, and dnolen has a most excellent enlive tutorial on github
14:57LauJensenand there is an 1.2.0 comp version on clojars
14:58defnLauJensen: good to know, thanks
14:58LauJensennp
15:00fliebelIf I (load-file), can I require or use it afterwards?
15:00chouserfliebel: sure
15:01lancepantzcemerick: yes, jetty standalone
15:01LauJensendefn: see dnolen comment 3 lines above
15:02cemericklancepantz: looks like webdefault.xml is a way to get env-entry and context-param entries into an app's web.xml configuration before its actual web.xml file is loaded... http://docs.codehaus.org/display/JETTY/webdefault.xml
15:02lancepantzoh, cool
15:03lancepantzthanks cemerick
15:05lancepantzcemerick: wanted to get your input since your talks at the conj is on deployment, thanks for ferreting that out
15:05cemericklancepantz: sure, hope it helps :-)
15:05LauJensenyea Im bummed to miss that talk
15:06cemerickHere's hoping my app deployment talk doesn't complete degenerate into a build tool discussion. :-)
15:06cemericks/complete/completely
15:06LauJensencemerick: just stay clear of XML poems and you'll be fine
15:06lancepantzi'm looking forward to it as well
15:06cemerickLauJensen: XML will be on-screen. Sorry. ;-)
15:06technomancycemerick: think of the children!
15:07fliebeldefn: It worked!
15:07LauJensenDon't worry, Im 6000 miles away, thats 'xml safety distance'
15:07lancepantzi don't have hudson in the loop in our deploy, mainly because it's only me mucking with the webapp code, but i want to get it there one day
15:07cemericklancepantz: the hudson part is by far the easiest
15:08defnninjudd or lancepantz : is it possible to take a command line arg to a cake script using #!/usr/bin/env cake
15:08defnso i could have a (defn foo [bar] (println bar)) where bar is the input to the script?
15:08jjidoyou could rewrite XML as a joke. <book>...</book> becomes (book .... )
15:09dnolenwhy the java library/maven/lein situation ain't so bad - http://news.ycombinator.com/item?id=1712035
15:09ninjudddefn: sure, they should be is *command-line-args*
15:09lancepantzjjido: that's essentially what contrib.prxml is
15:09ninjuddor the parsed opts are in cake/*opts*
15:09defnninjudd: will those run together for multiple scripts?
15:09LauJensenchouser: what was that #"\b" trick you pulled above?
15:09lancepantzjjido: it uses vectors though, so you have to create macro for every tag :)
15:10ninjudddefn: you mean stdin?
15:10fliebelLauJensen: That'd be a regex matchign a word char.
15:10LauJensen'word char' thats new
15:10defnninjudd: yes
15:10cemerickdnolen: yeah, the same junk was floating around about ruby, gems, and whatever they have for doing environments, too.
15:11cemerickthe JVM is the only ecosystem that is *trying* to get things right for the general case AFAICT.
15:11fliebelLauJensen: Now wait… word boundary, so zero-width matcher for anything [^a-z]
15:11LauJensenaha
15:11LauJensencool
15:12ninjudddefn: *in* should be bound to stdin
15:12technomancycemerick: yeah, I was even a committer on rubygems, and now I try to avoid it as much as possible
15:12ninjudddefn: so you could do (read) for example, it would read the next clojure form from *in*
15:13LauJensentechnomancy: dont knock the gems man, they have an edge on you :)
15:13cemericktechnomancy: I've cumulatively used ruby for *maybe* 10 minutes, but all the warning flags for pain are there: central environment, lack of versioning sanity/hygiene, no concern for build repeatability. *shrug*
15:14LauJensenhehe, you sure got a lot from those 10 minutes huh chas?
15:14cemerickLauJensen: it was the five years of heavy python usage that taught me the patterns.
15:15ninjuddcemerick: i agree. i didn't see it at first, but the classpath is way better than a central gem repository for the entire machine
15:16defnninjudd: lancepantz: did cake.core go away? What do I include in my tasks.clj (src/project/tasks.clj) in order to use deftask?
15:16ninjuddcake.core
15:16cemerickninjudd: which is *really* ironic, insofar as people always chafe about the classpath
15:17cemerickThe JVM's not meant to be used from the command line. Once you get past that, things get a lot easier.
15:17ninjudddefn: you may also want to (:use cake) if you want the various vars like *project*
15:18Thornhello
15:18fliebelcemerick: Huh? How do you use the JVM without the command line?
15:18Thornapparently this doesn't work: (def x 0) (defn make-test-x [] (binding [x 7] (fn [] (set! x (+ 1 x)) (println x)))) (def test-x (make-test-x)) (test-x)
15:18fbru02cemerick: not from the command line?
15:18ninjudddefn: for example: http://github.com/Raynes/cake-autodoc/blob/master/src/cake_autodoc/tasks.clj
15:18technomancyLauJensen: not on debian... gems are such a mess there
15:19defnninjudd: cool
15:19defnninjudd: one more question for you: as far as specifying a resources directory -- how do I do that?
15:19amalloyLauJensen: \b is a little more interesting than fliebel says. it actually matches at every boundary between \w (alphanumeric or _) and \W groups. so eg ab[]+4 has a \b after b and after +
15:19cemerickfliebel: using any tooling that abstracts away stuff like the classpath, the 100's of JVM options, etc. Any IDE and most build systems will do.
15:19ninjuddfliebel: from netbeans, of course
15:19fliebelninjudd: That's Counter Clock Wise, right?
15:20technomancyI think the debian devs are offended by the notion that you would want to distribute software without using apt-get
15:20cemerickfliebel: ccw is the eclipse plugin
15:20fliebeloh...
15:20cemerickenclojure is the netbeans plugin
15:20ninjudddefn: what do you want? a place to put resources that is on the classpath?
15:20defnyeah
15:21LauJensentechnomancy: really? thats surprising, when did they get software released after 1994 on debian ?
15:22technomancyLauJensen: grr... don't get me started. =\
15:22LauJensenamalloy: Ah okay, thanks for elaborating
15:23technomancywasted a couple hours a few weeks ago helping co-workers work around the bustedness
15:23LauJensentechnomancy: I symphatize. I love all Linux distros, except debian :)
15:24scottjdselect for life!
15:25ninjudddefn: just checked in a change to cake/master to add resources to the default classpath. it also goes in the jar/war
15:27defnninjudd: fantastic
15:27defnthank you
15:27defnso no project.clj option required?
15:27ninjudddefn: right
15:27cemerickLauJensen: What's the good distro this year?
15:28LauJensencemerick: It doesn't change year after year, it does depend a little on what you want
15:28defnninjudd: beautiful
15:28cemerickRed hat was good, then it was fedora, then debian, then ubuntu, and now....
15:28defngentoo
15:28defn;)
15:28LauJensencemerick: O_o
15:28cemericklol
15:28cemerickdefn: there's always one! ;-)
15:28defnhaha im kidding -- im not the gentoo guy
15:29chouser<--
15:29defni have friends who are like "OH YOU HAVE A NEW TOASTER? YOU COULD PUT GENTOO ON IT."
15:29cemerickoh, there is one here though, I'm sure of it
15:29LauJensencemerick: Redhat is still good, Fedora is similar, Arch is better, debian was only cool in 1980-1982, Ubuntu is the entry-level distro which helps get people started. Gentoo is for geeks who are unemployed
15:29cemerickchouser: wow, really?
15:29chouserexpatriot, but yeah.
15:29defnive installed Gentoo a few times but always fall back to Ubuntu
15:29defnbetter support all around
15:29defnbut i learned way more on gentoo
15:29cemerickchouser: that doesn't count
15:29chouseroh
15:29chousergood
15:30fliebelAnyone for BSD?
15:30LauJensenfliebel: Never tried, had a taste of the community and decided to move on :)
15:31cemerickfliebel: OS X :-)
15:31fliebelcemerick: That's me :)
15:34eyerisIs there a way to get the clojure version from the repl?
15:35scottj,*clojure-version*
15:35clojurebot{:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"}
15:35LauJensen,(clojure-version)
15:35clojurebot"1.2.0-master-SNAPSHOT"
15:35eyerisd'OH
15:35LauJensen,;-)
15:35clojurebotEOF while reading
15:35eyerisI was using clojure.version :)
15:36fliebelOoh, I wrote some code that has an average color of #999 (wild guess, but it looks dense, square, and has a lot of gensyms#)
15:36eyerisWhen I use compojure's run-jetty func it gives me an exception: No matching method found: setSendDateHeader for class org.mortbay.jetty.Server
15:36eyerisLooking in the .jar for jetty, the method is there.
15:37eyerisJetty must be on the CP because otherwise the exception would be NoSuchClass Server.
15:37dnoleneyeris: make sure you don't have old jetty jars (or other old jars) lying around in your lib directory.
15:37fliebelWhy is Ring using Jetty 6 anyway?
15:37jjidothe magic ext/lib
15:38eyerisdnolen: Woohoo! OMG I can't believe I wasted an hour on that.
15:38dnoleneyeris: it's the kind of mistake you only make once ;)
15:45eyerisI'm trying to move from clojure 1.1.0 to 1.2.0
15:46eyerisIt looks like the new c.contrib.json no longer uses multimethods to let me overload print-json
15:46cemericktechnomancy: it'll be like Truman meeting Stalin at potsdam (or something) when we meet next month :-)
15:47alexykcemerick: are you Stalin then?
15:47alexykdnolen: ping
15:47eyerisIt looks like c.contrib.json is now based on protocols
15:47cemerickalexyk: I don't think the reference is allegorical :-)
15:47eyerishrm
15:47eyerisI guess I have to finally learn about those :)
15:48dnolenalexyk: pong
15:48alexykcemerick: so you *are* Stalin? If it's *not* allegorical? (runs away)
15:49alexykdnolen: what does eval supposed to do in TM bundle? I highlight something and hit eval, get an NPE
15:49dnolenalexky: eval works like SLIME now, just run it after an sexpr
15:49jjidowhat does "derive" do?
15:49dnolenalexky: no need to select anything
15:50alexykdnolen: OK, so the pointer is after the closing paren of a sexp, right?
15:50dnolenalexyk: yes, it doesn't work yet form most "atoms", that is, things that are not sexprs
15:50dnolens/form/for
15:51alexykdnolen: I get this after a (defn ...): http://paste.pocoo.org/show/265463/
15:51hiredmanjjido: have you read the docstring?
15:52jjidoI am lost in the choices for structures and interfaces. I used defrecord and extend-protocol but I don't know how to go further
15:52alexykdnolen: cake is started OK and cake repl works. loading file into repl works from TM too
15:54jjidohiredman: I read it, can't understand it
15:54dnolenalexky: hmm, will have to look into that when I have some spare time. It probably makes sense at some point to start a google group of people who are interested in seeing this bundle move forward.
15:54hiredmanjjido: then don't use it
15:54jjidohiredman: thanks :)
15:54dnolenit's close to being useful, but it needs more attention then I'm able to give it at the moment.
15:56dnolenlancepantz: he was, but I think he may have taken it too far :) I'd rather see a small useful feature set that people can extend how they please. His fork has everything and the kitchen sink.
15:56abrenkfliebel: idempotent?
15:57fliebelabrenk: That one :)
15:58jjidohiredman: so if I have a protocol and a record that extends it. Can I have a canonical implementation for methods in the protocol? Such that records that extend the protocol use that implementation when they don't provide their own?
15:59fliebelSo, is there any way I can get Enlive to prepend a snippet in a idempotent manner? The snippet has a unique ID.
16:00alexykdnolen: the disconcerting thing is that eval worked and now it doesn't
16:00alexyki.e. I wonder how did you do the merge testing :)
16:01alexykdnolen: it shows as Command-Control-X in teh menu
16:01dnolenalexy: try Control-X
16:02alexykthat works, same error though
16:03alexykdnolen: what's eval pprint?
16:05alexykdnolen: wrap sexpr bombs out with "private method"
16:09dnolenalexky: hmm did you pull my latest? it sounds like a bad merge
16:09dnolenalexky: just tested and it's working ok for me.
16:11alexykdnolen: did pull, something fishy's going on since I get the invoke error; but load file works...
16:11alexyksame eval error in franks42 stuff too
16:11dnolenalexyk: have you merge both changes? franks42 and my stuff?
16:11dnolens/merge/merged
16:12alexykdnolen: btw, franks42 has a command-control-E for eval, then you get 1..5 menu, how do you do it in one key push? I tried franks42 separately
16:12alexykI symlink Clojure.tmbundle to either yours or his to compare
16:12alexykthen reload bundles
16:12dnolenalexyk: that just based on how you organize the commands
16:13alexykdnolen: so in that case you always have to pick a number, not good
16:13dnolenalexyk: did you try a fresh checkout of my fork, cake branch?
16:13alexykdnolen: I thought you switched to master branch?
16:13dnolenalexyk: there are some design decisions I don't agree with in franks42 branch, however I think there are some things I might cherrypick out of there, haven't had time to do a longer review
16:14alexykdnolen: I have the cake branch in fact of yours, latest
16:14dnolenalexyk: no cake is the branch, however it's the default branch on GitHub
16:16alexykdnolen: yeah, that's the case. Given the pasted error I get on any attempt to eval, can you suggest how to debug it?
16:16alexykcake ps shows the processes and cake repl works
16:16ninjuddalexyk: what about 'cake eval'?
16:18alexykninjudd: cake eval works
16:18alexykdnolen eval fails :)
16:18alexykfranks42 eval fails too
16:19alexykdnolen: I have a file with: (ns hey) (+ 1 1)
16:20alexykI place the cursor past the last ), and hot Contorl-X, and get the paste above.
16:22alexykninjudd: cake is beyond reproach :)
16:23v-alexhey guys
16:23alexyklike Caesar's wife
16:23dnolenalexky: the problem is that I can't recreate, it works here. I did have issues with franks42 branch, but when I switched back to mine, no issues.
16:23v-alexSince fns implement Runnable, why do we have to wrap an fn around proxy?
16:23chouserv-alex: where?
16:24technomancyBrutus's wife could totally take Caesar's though.
16:24v-alexchouser: in some examples i've seen
16:24dnolenalexyk: just tried (ns hey) (+ 1 1), works for me.
16:24defnet tu, Phil Hagelberg?
16:24dnolenalexyk: cake 0.4.15
16:24chouserv-alex: point me at one and I can try to explain it.
16:25alexyktechnomancy: take how? (take 5 (wife brutus))?
16:25v-alexchouser: this is probably really old, but anyhow http://markmail.org/message/a6bs5gupjaypttjs
16:25Raynes_fogus_: ^ Looks like you need to do a take n interview of Brutus's wife.
16:25alexykdnolen: same cake here. Something is effed-up soemwhere.
16:26chouserv-alex: yeah, that's an old version of Clojure. fns are Runnable now too
16:27chouser,(instance? java.lang.Runnable (fn []))
16:27clojurebottrue
16:27alexykdnolen: which clojure?
16:27dnolenalexky: 1.2.0
16:28v-alexchouser: yeah, i'm probaly doing something wrong trying to call a fn in with SwingUtilities#invokeLater. thx
16:28chousershould work
16:29chouser,(javax.swing.SwingUtilities/invokeLater #(prn :ran))
16:29clojurebotnil
16:29chouserwell, works here anyway.
16:29alexykdnolen: btw it's alexYK, or my colloquy misses your replies :)
16:29alexykdnolen: I had 1.2.0-master-SNAPSHOT
16:30alexyklemme try with 1.2.0
16:31jjidoI read: To define a default implementation of protocol (for other than nil) just use Object
16:32jjidoif I do that, do other implementations of the protocol still need to implement all the methods?
16:32v-alexchouser: hah! had the exact same problem trying to run swing from vim (with vimclojure). that's it, thx =)
16:33chouserv-alex: np
16:33jjidochouser: thanks for the macro the other day, helps a lot. I think it could be used in other contexts
16:34chouserjjido: oh, really? great. It looks pretty scary to me. :-)
16:36jjidochouser: I use it like that: http://gist.github.com/588764
16:39alexykdnolen: now load file doesn't work either. How does your bundle find the cake?
16:40chouserjjido: wow, that's hard for me to think about
16:40chouserjjido: you know about #() ?
16:40jjidoyep
16:41dnolenalexyk: it doesn 't look for cake, #! /usr/bin/env cake at the top of the clojure scripts
16:42chouseryour assoc example could be done with ->> but not the trampoline one I think.
16:42chouseranyway, glad you're finding it useful.
16:42jjidochouser: it lets me take the stuff out of ( )'s when it can be very big
16:43jjidoand not really logically nested
16:44alexykninjudd: how do we find out cake's own version?
16:45ninjuddcake --version
16:45alexykkk
16:45LauJensenalexyk: the cake is a lie
16:45alexykLauJensen: did you get bitten by cake?
16:46LauJensenalexyk: no, its an internet meme
16:46alexykLauJensen: let them eat cake on the internets then
16:46chouserIt's a Portal joke. Portal is a great game.
16:51jjidoto answer my previous question: no it does not work. If I extend a protocol I need to provide implementations for all methods, even if Object extends the protocol as well.
16:53alexykdnolen: when you debug your Support/bin scripts, where do you send debugging output?
16:54chouserjjido: sorry, missed that question. the easiest way to reuse partial protocol implementations is something like (extend AType AProtocol (merge base-AProtocol {:method (fn ...)}))
16:54dnolenalexyk: to the output window, might be a better process, but I haven't found one yet.
16:54chouserjjido: you can also write macros as appropriate.
16:55alexykdnolen: I get an NPE in load-file.clj, I wonder if nothing is sent to cake server for some reason
16:55alexykbut I have cake-0.4.16-SNAPSHOT
16:55jjidochouser: (merge base) looks good
16:55alexykmaybe I need to revert to 0.4.15
16:55alexykI just pulled cake from git
16:56alexyka few hours ago, and did cake install in its git checkout
16:56alexykwell cake upgrade says already up-to-date
16:57alexykninjudd: how can I specify cake's version in project.clj?
16:57alexykif I don't trust the latest cake for any reason?
16:58ninjuddalexyk: there isn't a way to do that. we've talked about adding something like that, but it isn't clear what it would mean
16:58jjidochouser: how do I convert a record into a collection?
16:58alexykninjudd: very simply, if maven repo contains several jars for several cakes
16:58ninjuddi suppose it could blow up if the version is wrong, but that doesn't sound all that useful
16:58jjidofor merge
16:59ninjuddcake is more than just the jar though. it is also the client script
16:59chouserjjido: for use with 'extend' both your base and specific implementations should just be maps of :method-name to (fn ...)
16:59alexykninjudd: I symlink to the script... I wonder if Maven has a way to version the script with the jar... interesting
17:02jjidochouser: so I replace extend-protocol with a simple extend, and I store the map somewhere for the base implementation?
17:03chouserjjido: exactly
17:04alexykdnolen: can you try with the latest cake from git?
17:05dnolenalexyk: not at the moment no, in the middle of some work stuff, but I will check it out tonight.
17:05alexykkk
17:10jjidowhat does extend-protocol expend a method with optional arguments into?
17:13jjidoI tried putting the two fn's (for different arity) inside ( )'s, [ ]'s but no success
17:14chouserah, probably a single fn with mulitple arity+bodies.
17:14chouser(fn ([x] (inc x)) ([x y] (+ x y)))
17:20jjidochouser: that is what I was looking for thanks
17:37jjidoAny objections to passing a function with unknown number of arguments (fn [&_] ...) to a function that always invokes it with one argument?
18:01Thornwhy (#(1)) falis and ((fn [] 1)) works?
18:02mrBlissbecause (1) is different from 1
18:02mrBlissthe first is a function call, and 1 isn't a function
18:03Thornisnit #(...) equivalent to (fn [] ...)?
18:03mrBlissalmost
18:03Thornso I need #1?
18:03mrBlissthat doesn't work
18:03raek#(...body...) is equivalent to (fn [...] (...body...))
18:03Thornso it's a 1-form body?
18:03raek(notice the extra parens)
18:04Thornyeah I noticed them
18:04raekyes, #() is always a call
18:04raek(constantly 1) yields a function when given any arguments returns 1
18:04Thornneat name
18:05ThornI need to define hopefully as an alias to try
18:06raek(if you would want to pass that to swap! or alter, reset! or ref-set is preferred...)
18:06jjidois there a more elegant way of doing ,(eval (flatten '(println [1 2 3])))
18:07Thornok, thank you
18:09raekjjido: to get (println 1 2 3)? if so, 'apply' would be appropriate
18:09jjidoraek: yes
18:09raek(apply pritnln [1 2 3]) => (println 1 2 3)
18:10jjidothanks I didn't realise I already knew it
18:14Thornis it possible to do something like this? (def x 0) (defn make-test-x [] (binding [x 7] (fn [] (set! x (+ 1 x)) (println x)))) ((make-test-x))
18:14ThornI get Can't change/establish root binding of: x with set
18:15mrBlissThorn: alter-var-root changes the root binding of a var, but I'm not sure if you want to do that
18:16technomancyþ: once the fn is called it's outside the binding
18:16ThornI basically tried to create a closure over a mutable variable
18:17technomancyclosures only work with lexical scope, binding creates dynamic scope
18:18technomancyyou probably want to close over a let-bound atom instead
18:41ThornI finally found what atom means in clojure
18:46plathropHello
18:47dakroneninjudd: if it's easier to debug the cake problem using IRC, let me know
18:47ninjudddakrone: hi
18:48dakroneninjudd: yo
18:48ninjuddi just reproduced it by setting an ENV var to an invalid unicode character in 1.9.2
18:48ninjuddi think i have a fix that will mangle the string in 1.9.1, but at least in won't blow up.
18:49ninjudddakrone: just checked it in, you'll have to check out the git repo to test
18:50dakroneninjudd: that fixed it
18:52ninjudddakrone: cool. i should be pushing a new gem with various fixes later this week. just want to give a little for any new bugs to emerge
18:52dakroneninjudd: understandable, I'll play around with the git version in the meantime
18:53ninjuddcool, thanks for the help in tracking that down!
18:53dakroneninjudd: shall I close the issue then?
18:57ninjuddsure
19:07amalloydoes anyone know of a good emacs tutorial? i learned through semi-painful trial and error, but one of my friends won't learn without a little more hand-holding. if it matters, he's a vim user but mostly uses basic features
19:08technomancy~peepcode
19:08clojurebotpeepcode is a commercial screencast series; see the Clojure one at http://peepcode.com/products/functional-programming-with-clojure by technomancy
19:08technomancy^ there's one on Emacs too
19:09seancorfieldi saw rich using aquamacs last night at the bay area clojure meetup... i assume that's a mac version of emacs?
19:09seancorfieldi haven't used emacs in... maybe 20 years...
19:10technomancyit's a fork that's designed to twist Emacs to be more Mac-like at the expense of elisp-level compatibility.
19:11lancepantzi use aquamacs, and regret the decision
19:11lancepantzswitching off of it is on my to do list
19:13plathropYeah aquamacs is kinda sucky. I recommend following the Peepcode and using emacs-starter-kit
19:18amalloyi remember someone mentioning that debugger support in swank/slime was a reason to use emacs. does slime play nice with swank-clojure even for debugging? if so, what do i have to do to get it working?
19:20tomojinstall slime-repl from ELPA
19:22amalloyhrm, ELPA. i don't have a ton of experience with emacs and i've just downloaded a bunch of .el files. so i can run the repl via slime already; does it work better with the ELPA version?
19:23technomancyamalloy: the version from ELPA has been tested to work with clojure, while slime trunk often gets breaking changes committed. plus it's much easier to pull in upgrades and manage dependencies with a real package manager.
19:23seancorfieldi'm using CCW in Eclipse since I also use Eclipse for all my other dev stuff (CFML, Scala, Flex, Groovy...)
19:24amalloytechnomancy: okay, thanks. i'll get started with ELPA
19:24seancorfieldand lein at the command line... but i wish CCW supported lein better and didn't dump libraries in the top-level directory :)
19:45developernotesIs there an easy way to do a directory watcher in clojure?
19:46lazy1http://jnotify.sourceforge.net/ ?
19:48developernoteslazy1: I'll check that out - thanks
19:48lazy1I saw some support to inotify in clojure-jna, not sure how stable/usable it is
19:50Raynestechnomancy: Is it normal for ELPA work perfectly for a long time and then one day you decide to pull up the package list and see this lovely "url-retrieve-internal: Symbol's value as variable is void: url-request-method" message?
19:50RaynesI was curious as to whether or not I should see a physician.
19:51bhenry1developernotes: this isn't stable either, but it might get your started. http://github.com/wilkes/Kibitz
19:51developernoteslazy1: Where can I read about that?
19:51RaynesI think this happened once before, and when I fixed it, I manage to destroy... everything else.
19:51technomancyRaynes: usually problems like that are network hiccups
19:51Raynestechnomancy: For 2 months straight? :o
19:52developernotesbhenry1: Thanks
19:52tomojI had this problem on aquamacs where the package.el autoinstall would hang until I moved the mouse
19:52technomancyRaynes: oh... I guess not. I haven't heard of that before.
19:58lazy1developernotes: Sorry, was away. http://github.com/Chouser/clojure-jna
20:07ssideris_if I create a class instance using proxy, is there any way to implement/override any extra methods on it later
20:29amalloyssideris: i don't think so
20:38amalloyssideris: hey tool at that, i take it back. check out update-proxy: it works even for methods you didn't override to begin with
20:38amalloyer...hey *look* at that
20:49lazy1 /part
21:03laurusWhy does the http://clojure.org home page mention three Clojure books, but not _Practical Clojure_ by VanderHart and Sierra?
21:07laurusIt seems almost like it's omitted on purpose or something.
21:07laurusI mean it mentions two books that aren't even released yet.
21:19laurusAnyway, it's a fabulous book, maybe the best book I've ever read about a programming language. Just wanted to get that out there.
21:35jweissregistered for (first clojure-conj) today! looking forward to that
21:44bhenry1jweiss: me too!
21:49jweissbhenry: cool, are you in NC already or are you coming from elsewhere
21:51scottjanyone looking to split one of those two double rooms? or rent out part of their room for an airmattress? :)
21:51bhenryi'm flying down from maine.
21:51bhenryjweiss: ^
21:53bhenryscottj: did they sell out the reserved part of the hotel? or are you just being thrifty?
21:54scottjbhenry: the latter
21:56jweissbhenry: cool, i guess i am just lucky i happen to live nearby :)
21:57jweissanyone know how many are registered
21:57bhenryjweiss: that is lucky. i felt that way about only having to drive 3 hours for mongo boston yesterday.
21:59jweissthe conference is actually a shorter drive for me than work :)
21:59ninjudd,(into clojure.lang.PersistentQueue/EMPTY [1 2 3])
21:59clojurebot#<PersistentQueue clojure.lang.PersistentQueue@6b58d153>
22:00ninjuddhmm, i though clojurebot used to print something like: 1 > 2 > 3
22:02ninjudd>-1-2-3->
22:03ninjudd,Q
22:03clojurebotjava.lang.Exception: Unable to resolve symbol: Q in this context
22:06braverninjudd: ping
22:06ninjuddbraver: yes
22:07braverI used to have dnolen's TM work fine with cake, and now try to use a previous version, 0.4.15, I have in maven repo. My cake script is a symlink to github checkout. How do I tell it to use the 0.4.15 jar from m2?
22:08braver(the github checkout is already at 0.4.16-SNAPSHOT)
22:09ninjuddbraver: you can remove your symlink and download the standalone script
22:09ninjuddhttp://github.com/ninjudd/cake-standalone/raw/master/cake
22:10braverninjudd: my mac's connection is flaky at the moment, am using iPad for chat now. Is there a way to specify the version for cake at command line, or otherwise hack it?
22:11bravercake install puts the verisoned jars in m2, there should be a way to pick one...
22:12ninjuddyou can just copy bin/cake from the git repo instead of symlinking
22:12ninjuddthat *might* work
22:12braverninjudd: ok, but then how do I pick the version?
22:16phobbsIn slime, Is there any better way to stop a computation that is taking to long than to kill the java process and restart lein swank?
22:18scottjC-c C-c if you started it at repl
22:22scottjotherwise C-c C-x t would be the place but I don't think killing threads works for swnak-clojure
22:27phobbsscottj: thank you!
22:30phobbsfor everyone not on the clojure reddit, here's a really interesting macro for debugging let statements: http://www.learningclojure.com/2010/09/astonishing-macro-of-narayan-singhal.html
23:04jk_can anyone tell me why this doesn't work? (let [b (ByteArrayOutputStream.)] (for [x [103 114]] (.write b x)) (.close b) (.toString b))
23:04jk_but it works if i (def b (Byte...)) first and use the root binding
23:07jk_using the let form, i never get anything my ByteArrayOutputStream
23:07andyfingerhutIf you mean why doesn't it write anything, I believe it is because the 'for' is lazy, and nothing you have forces it to traverse the sequence. Try doseq in place of for
23:07tomojfor?
23:07clojurebotfor is a loop...in Java
23:08jk_andyfingerhut: then why does the exact same code work on a root binding of "b"?
23:08andyfingerhutthat is currently a mystery to me
23:08tomojpresumably you're typing each line in one at a time at the repl when using the root binding?
23:09tomojbut, of course, not when using the let
23:09jk_tomoj: yes
23:09jk_tomoj: hmmm, ok. i'm a lisp noob so pardon the stupid questions :)
23:09tomojwhen you enter (for [x [103 114]] (.write b x)) at the repl, the repl prints the return value
23:09tomojthis forces it
23:10jk_tomoj: got it
23:10tomojthat's why you can write code that uses (range) perfectly well, but if you enter (range) at the repl it'll never return
23:10jk_yep, doseq forces it inside the let binding
23:10andyfingerhutI wonder ... would it be useful if the default REPL behavior was *not* to force lazy expressions?
23:10jk_tomoj: ok, i see. that's a little confusing for beginners the way the repl treats lazy collections
23:11jk_or laziness in general
23:11jk_andyfingerhut: i don't know if it would be better until i get more experience but it trips up noobs like me
23:12tomojwould it be more useful or less confusing if entering "(map + [1 2 3] [4 5 6])" at the repl didn't print "(5 7 9)" ?
23:12tomojseems less useful and more confusing to me
23:12tomojbut yeah, it does lead to confusion if you don't get laziness
23:13jk_tomoj: i get the general concept of laziness but keep forgetting when something is lazy or not. most of the time the repl hides it
23:13dysingeryo: [probably dumb/lazy question] -> what do I use if I want to (proxy) but the thing I am proxying has a factory method / protected constructor ?
23:14andyfingerhutYou know, just the default behavior, until you set the secret variable hidden in the docs called *I-will-try-to-always-remember-that-this-variable-wraps-all-repl-exprs-in-an-implicit-doall* to true :-)
23:14jk_andyfingerhut: lol i'm sure it will become totally second nature in a little more time
23:14tomojandyfingerhut: what about *
23:15tomojer, what about *I-will-not-be-confused-when-(map + [1 2 3] [4 5 6]))-only-gives-"clojure.lang.LazySeq@8806"-at-the-repl*
23:15jk_tomoj: that would actually be a lot more useful
23:15tomojI suppose it would force you to learn a bit
23:16jk_it's an instant reminder that you need to force the evaluation
23:17jk_tomoj: at least then your real code and what you type at the repl would be the same
23:17jk_tomoj: errr... maybe that doesn't make sense since i guess your real code wouldn't be dumping it to the screen like that in most cases :)
23:19jk_bottom line, i'd just rather leave it the way it is and let it sink in. it's waht everyone is used to
23:30ninjudd,(let [klass Object] (new klass))
23:30clojurebotjava.lang.IllegalArgumentException: Unable to resolve classname: klass
23:31ninjuddhow do i dynamically construct an instance of an arbitrary class?
23:32hiredmanwith great style
23:34hiredman,(clojure.lang.Reflector/invokeConstructor Object (into-array []))
23:34clojurebot#<Object java.lang.Object@160a70b>
23:35ninjuddhiredman: thanks! that works
23:35ninjuddis it considered bad form to do that?
23:36dnolen,(let [x "java.lang.Object"] (clojure.lang.Reflector/invokeConstructor (Class/forName x) (into-array [])))
23:36clojurebot#<Object java.lang.Object@e18b1a>
23:36hiredmanninjudd: depends, are you doing something bad?
23:37ninjuddhiredman: never ;-)
23:37hiredman~proxy
23:37clojurebotproxy is <Chouser> proxy teases with its ease of use, then suddenly betrays.
23:37ninjuddthe alternative is using a macro, but that has its own problems
23:38hiredmanit's called reflection
23:38hiredmanit's very useful
23:38hiredmanhttp://download.oracle.com/javase/tutorial/reflect/
23:38ninjuddi've heard of it
23:39jk_reflection is one thing... learning how to use it the clojure way is another :)
23:41jk_what is the "right thing" to do to handle Java exceptions in code that calls java? is this where you might want to use monads? i'm struggling with monads
23:43tomojwe have try/catch
23:43tomojthat doesn't seem right to you?
23:43tomojmaybe it's not..
23:44jk_tomoj: the problem i have with it is that if you don't handle them locally, your functions are no longer composable
23:44jk_it feels weird in functional code to have an exception bubble up through the layers
23:46jk_tomoj: i mean in java you're used to doing that, letting the exceptions interrupt whatever is happening all the way up to the right level of handling. but for functional code, you want the functions to be composable in any order and referentially transparent, right?
23:47jk_tomoj: exceptions seem to upset those rules
23:47tomojI dunno what the right way is
23:48tomojis the error monad 'right'?
23:48jk_i guess that's just a problem of interoperating with java. try to limit the scope of the exception propagation to well defined boundaries
23:49jk_tomoj: i think so. as i said, i'm new to functional programming and struggling with monads and the right way to build/use them
23:49jk_tomoj: they seem to be the right way to contain that sort of indeterminacy though