#clojure logs

2010-08-10

00:05mebaran151igms, if you haven't check it out MessagePack has awesome rpc over tcp and udp built on netty
00:06mebaran151really easy to use from clojure too
00:06mebaran151with all the new deftype and defprotocol magic
00:11vIkSiThi all
00:11vIkSiTcan you run lein swank on a different IP address than 127.0.0.1?
00:11vIkSiTon the website, I see a "lein swank [PORT=4005] [HOST=localhost]"
00:11vIkSiTbut in practice, i see : Exception in thread "main" java.lang.NumberFormatException: For input string: "PORT=4005" (NO_SOURCE_FILE:1)
00:14lancepantzvIkSiT: you don't specify a key
00:14vIkSiTlancepantz, sorry?
00:14vIkSiTa key?
00:15lancepantzjust lein swank 4006 localhost
00:15vIkSiTaah
00:15mebaran151hey lancepantz, you get a chance to abuse my egregious hack
00:15vIkSiTah ok looks like this works :)
00:16vIkSiTlancepantz, hmm for some reason, i can't connect remotely to a lein swank on say, 192.168.1.111
00:17vIkSiTI'm guessing there's a port vs localport issue.
00:18lancepantzvIkSiT: dunno
00:19lancepantzmebaran151: i have not, i had to restart this morning, can you send me the link again?
00:19mebaran151np
00:20mebaran151http://gist.github.com/516658
00:21Votingwhat are the cooliest things that you folks have done with it?
00:21Votingwhy is it getting more popular?
00:21mebaran151vIkSiT, are you forwarding 4005?
00:21mebaran151sounds like a port forwarding problem
00:24vIkSiTmebaran151, hmm no i'm not actually
00:25vIkSiTi'm trying ot figure out whether using lein swank is possible remotely..
00:25vIkSiTi thought the port was firewalled - and now i can connect to the swank server, but for some reason, i get an error
00:25vIkSiT(a java stacktrace)
00:27mebaran151what's it say
00:28mebaran151I've connected lein swank remotely actually
00:28mebaran151it's pretty sweet deal
00:28Votingis it easy for java to call clojure?
00:30mebaran151what's your java stack say?
00:30mebaran151that sounds like a deployment issue
00:31RaynesvIkSiT: It's definitely possible. I used to run sexpbot over a swank server remotely on Licenser's server (only reason I stopped is because of some weird error that we're too lazy to figure out).
00:32vIkSiTah
00:32vIkSiTmebaran151, raynes - i've gotten most stuff to work now. except, how did you guys handle compilations remotely though?
00:33vIkSiTi don't know what the java issue was. i just restarted swank and it worked fine
00:33mebaran151what do you mean by compilations?
00:33mebaran151C-c C-k will do what you expect
00:33vIkSiTmebaran151, the C-c C-k shortcut
00:33vIkSiThmm no it doesnt
00:33mebaran151how do you mean?
00:33vIkSiTah wait. I'm using tramp to connect to that file
00:33vIkSiTi'm guessing thats whats causing that issue
00:34vIkSiThow do you access the remote files using emacs/slime?
00:34vIkSiT(without using tramp)
00:34vIkSiTI can see that Cc Ck gets stymied by this : error: java.io.FileNotFoundException: /scp:servername:/path/to/file
00:35vIkSiTmebaran151, ^
00:36mebaran151oh it looks like scp isn't work quite right
00:36vIkSiTyes..
00:36vIkSiTnot sure if swank-clojure supports that
00:36mebaran151do you have ssh installed on the server
00:37vIkSiTyeap
00:37mebaran151with scp enabled et al
00:37vIkSiToh yes, i'm able to acess the files and all
00:37vIkSiTits just Cc Ck that fails
00:44mebaran151hmmm, it's been a while since I got it running
00:45mebaran151I might have just been using C-c C-e
00:45mebaran151that's guaranteeed to work
00:45mebaran151you can evaluate the forms you want to redefine
00:47mebaran151apparently you have to tunnel it over ssh
00:47mebaran151and the file has to be edited with tramp
00:48vIkSiTmebaran151, you mean Cx Ce
00:48vIkSiTyes that works
00:48vIkSiTbut a long program - i'll have to go to each expression and Cx Ce!
00:48mebaran151yeah C-x C-e
00:48mebaran151haha
00:48mebaran151you could wrap them all in a giant do
00:49mebaran151I mean that's so hack I regret telling you it
00:49vIkSiThehehehe
00:49vIkSiTok thats EXACTLY what i was tyring
00:49vIkSiTbut this is interesting
00:49mebaran151where is the file you're editing
00:49mebaran151is it remotely located or local
00:49vIkSiT(do (map prn [1 2 3]) (map prn [5 6 7]) (map prn [0 1 0]))
00:50vIkSiTwhy does this only evaluate the last expression?
00:50mebaran151You never used the results of the others
00:50mebaran151laziness caught you
00:50mebaran151doall the others
00:50vIkSiTaah
00:50vIkSiTso how should this be wirtten?
00:50mebaran151(do (doall (map prn [] ....)
00:51vIkSiThmm
00:51mebaran151http://lisp-book.org/contents/ch18.html#id2565666
00:52mebaran151there's also a slime-tramp module
00:53mebaran151http://common-lisp.net/projects/slime/doc/html/Setting-up-pathname-translations.html
00:54vIkSiTaha
00:54vIkSiTinteresting
01:10vIkSiThmm has anyone here actually used slime-tramp?
01:11vIkSiTI'm not even sure how to install it
01:12vIkSiTmebaran151, have you used it btw?
01:35bartjhow does one go about importing all the classes in a java package?
01:35bartj(:import java.util *) doesn't work
01:36bartjneither does (:import java.util.*)
01:36eyerisI'm just getting started with compojure. I've figured out binding forms for routes on GET requests. I can't find any documentation on how to get all POST params though.
01:36eyerisMost of the examples I find online are for 0.3.2
01:37eyerisMeanwhile the compojure.org/routes-in-detail.html doesn't cover POST routes
01:38eyerisbartj: you are looking for (:use)
01:39eyeris(ns my-ns-name (:use java.util))
01:39eyeris,(ns my-ns-name (:use java.util))
01:39clojurebotjava.io.FileNotFoundException: Could not locate java/util__init.class or java/util.clj on classpath:
01:39eyerisOh wait, nvm, it's late.
01:39eyerisI don't think you can do what you are trying to do
01:39lancepantzeyeris: they come in as an InputStream under :body
01:40bartjhmm, why not ?
01:40eyerislancepantz: What do you mean by "under :body"?
01:41bartjit seems very odd that I just can't seem to import all the java classes in a package ?
01:42lancepantzthey are under the :body key in the request map
01:42eyerisbartj: if you're coming from the Java world, then it probably does seem strange.
01:42lancepantzso your route looks like (POST "/blah" {body :body} (do stuff))
01:42bartjok
01:43eyeris(POST "/test-post" {body :body} (slurp body)) ;does not work
01:44eyerisbartj: once you get used to clojure, most of your code will be in clojure, and your desire to import java classes will decline
01:44lancepantz(POST "/blah" {body :body} (println "keys:" (-> body read-lines first keys)))
01:45bartjeyeris, you mean I would be writing my own libraries ? :)
01:47eyerisbartj: or using other people's clojure wrappers for common java libs
01:47bartjeyeris, I am using a lot of apache http libraries
01:47bartjspecifically org.apache.http.*
01:47bartjnot sure if these have clojure wrappers
01:49eyerislancepantz: that doesn't seem to work
01:49eyerisit prints nil
01:49eyerisdespite there being 2 fields in the POST
01:49eyeris(verified via Firebug)
01:50lancepantz(POST "/blah" {body :body :as request} (println "request:" request))
01:50lancepantzverify you have a body key with an inputstream as its value
01:52eyerisThat prints nothing :(
01:54lancepantzafraid i dunno then :/
01:55eyerisIf the map destructuring fails, is the route mismatched?
01:55lancepantzi don't think so, but try this to check (ANY "*" {body :body :as request} ...)
01:56lancepantzeyeris: i have to run, i'd try the mailing list if that doesn't get to the bottom of it
01:56lancepantzgl
01:57eyerisThanks for your help
02:00eyerisI got it. Since the fields are being submitted at application/x-www-form-urlencoded, it looks like they are in :form-params
02:08notsonerdysunnyclojure and openscenegraph .. I am considering using openscenegraph via jni/jna .. it is a scenegraph library in c++ .. do you have any suggestion for an alternative?
02:08mebaran151vIkSiT, I haven't used slime-tramp
02:09bartjI have a bunch of fields with values and I need to spew them out as XML - which Clojure (xml?) library would be the most useful ?
02:24sparievbartj: there is some xml-related stuff in contrib - http://nakkaya.com/2009/10/10/processing-xml-with-clojure/
02:26bartjspariev, thanks!
02:40amalloyi'm getting a compiler error i don't understand but i suspect is related to my faulty knowledge of destructuring:
02:40amalloy(defn legal-moves [{{player :to-play
02:40amalloy trick :trick}
02:40amalloy hands :hands}]
02:40amalloy (legal-plays trick (hands player)))
02:40amalloy<C-c C-C yields the following>
02:40amalloy3
02:40amalloy [Thrown class java.lang.ArrayIndexOutOfBoundsException]
02:41amalloyoh wow, sorry about spamming there - not used to IRC and thought i could insert line breaks
03:15sparievamalloy: try (defn legal-moves [{{player :to-play trick :trick} :player-trick hands :hands}]
03:15spariev (println player trick hands))
03:16amalloyyes, thanks - realized just a minute ago that i hadn't given a keyword to the nested map. works just as you suggest
03:17sparievyep, nested destructuring is tricky
03:17amalloybut also *awesome*
03:17sparievindeed :)
03:18amalloyit got a lot more useful earlier today, when i realized i could use :as within destructuring forms, not just the outer level of function parameters
03:22amalloyby the way, is there a way to use macros to pass strings without having to quote them? ideally i'd like a macro that i can call like (mymacro 7a1) and get back "7a1"
03:28Chousukeamalloy: you can convert the symbols to strings
03:29amalloyright, but 7a1 isn't a symbol
03:29Chousukehm, right.
03:29Chousukethen, no.
03:29amalloyokay. well, a few "s here are there isn't a terrible burden
03:54esjGreeting Parenthesists
04:01old_soundhi, anyone that could help me with some compojure questions?
04:04lpetitHello all
04:05scottj,anyone
04:05clojurebotjava.lang.Exception: Unable to resolve symbol: anyone in this context
04:08old_sound?
04:09old_soundwhere's the description of the protocol for asking questions here? I may have missed that…
04:11esjold_sound: no protocol, its just a bit quiet here in the GMT morning, so nobody may know the answer
04:11old_soundesj: thanks
04:11esjif nobody answers, try again once the US wakes up 
04:11Chousukeold_sound: just ask and be patient
04:11old_soundI'm patient, just that I don't get those java lang things…
04:12Chousukealso I think there's a #compojure channel?
04:12ChousukeI might be wrong though.
04:12old_soundthere's people there :)
04:12spariev__old_sound: what version of compojure are you using ? I can try to answer if you are on 0.3.2
04:12old_soundand yes is for the web framework
04:13old_soundthanks
05:18defngahhh! my clojure setup in emacs is badly broken
05:18tomojwhat did you do?
05:18defnDebugger entered--Lisp error: (file-error "Cannot open load file" "slime-banner")
05:19tomojhmm
05:19tomojon `M-x slime-connect` ?
05:19defnno, when i start my emacs
05:19tomojouch
05:19defni put contrib/ into the elpa/slime-2010... folder
05:19defnwhich has fixed errors like this in the past
05:19defnbut no dice
05:19defnslime/contrib that is
05:19tomojpaste what's in your .emacs.d or init.el that's relevant
05:19defnthis could take awhile lol
05:20tomojheh
05:20tomojwell, are you doing something in there which enables the banner?
05:20tomojI don't have slime-banner either but have no problems
05:20defnyes
05:20tomojso, "give me banner or give me death" is your strategy?
05:20defn!! yes!
05:20tomojhaha
05:21tomojok, well, perhaps try adding contrib/ to your load-path?
05:21defnit should automatically be on the path
05:21defnconsidering it's under elpa/
05:21defnit recursively loads
05:21defnor at least it has in the past
05:21defni took out banner -- another failure
05:23defn:D
05:23defntomoj: (add-to-list 'load-path (expand-file-name "~/src/org-mode/contrib/lisp"))
05:24defnbah nevermind...
05:24tomojadding contrib/ didn't even work?
05:24defnnope
05:24tomojsame error?
05:25defnit's complaining about another thing in my org-mode
05:25defna clojure related thing
05:25tomojah
05:25defninterestingly enough
05:25tomojwhat, clojure org-babel?
05:25defnyeah
05:25defn:)
05:25tomojdude
05:25tomoj*high five*
05:25tomojI just toyed around with clojure org-babel the other day
05:25defni take notes with org-mode and use org-babel to save snippets in a code diary
05:25tomojbut I gave up because it seems to suck
05:25defnit takes a little getting used to
05:26tomojI need it to easily use my `M-x slime-connected` jvm
05:26defnthe problem is this...
05:26defnin my package.el i have swank-clojure 1.1.0
05:26defnit doesn't jive with the latest slime, slime-repl, clojure-mode, clojure-test-mode
05:26defni think
05:26tomojah, yes
05:27tomojthe only solution is to patch the clojure org-babel stuff to work with M-x slime-connect, imo
05:27defnhow the heck do i fix this it's driving me crazy
05:27defnwhat about the previous error
05:27defnthe one about the slime-banner and stuff
05:27tomojI couldn't get the org-babel stuff to work because I refused to install swank-clojure.el
05:27defnbah im going to do it
05:28defnwhy does elpa suck so bad?
05:28defnseriously man - wtf?
05:28tomojno idea, slime-banner.el is at ~/.emacs.d/elpa/slime-2010.../contrib/slime-banner.el and you added ~/.emacs.d/elpa/slime-2010.../contrib to the load-path but you still got "Cannot open load file" on slime-banner?
05:29defnpackages with 2004 release dates? wtf?
05:29tomojmaybe those packages are already perfect :P
05:29defncant open org-babel-init?!
05:29defnwhat!?
05:32defntomoj: im adding it explicitly now
05:32defnive never had to in the past, but we'll see i guess
05:34defntomoj: M-x slime => eval-buffer: Symbol's function definition is void: define-slime-contrib
05:35tomojyou're doing `M-x slime` to try to make sure org-babel can start a jvm?
05:52defnno
05:52defni just run slime sometimes
05:52defnwithout a project
05:55tomojthe horror
05:55defnheh
05:56tomojwhat is it about swank-clojure.el that doesn't work with latest elpa slime/slime-repl?
05:56defnnot sure tbqh
05:56tomojI would think they wouldn't screw eachother up
05:56defnswank-clojure is quite dated
05:56defn1.1.0 is Ye Olde compared to how things are done now
05:57defni think it might be a mixture of the new clojure-mode and swank-clojure
05:57tomojhow does swank-clojure.el make it so that `M-x slime` does a clojure slime, anyway?
05:57defnbut this is probably a question for phil
05:57defni configured it as such tomoj
05:57tomojwith slime-lisp-implementations or whatever?
05:58defnill gist it
05:59tomojmy solution to the same problem with different symptoms: never use `M-x slime`, use `cljr swank` instead, patch clojure org-babel stuff to work with How Things Are Done Now
05:59defnhttp://gist.github.com/517017
05:59defn^^
06:00defntbqh ive never liked using elpa
06:00defnyou get locked in at an old ass version of everything
06:00tomojawesome, repl helper
06:00defn:)
06:00tomojwith technomancy's patched package.el I haven't been locked in
06:01defni have the patched package.el
06:01tomojwell, yeah
06:01defnwhat is so great about it?
06:01tomojlocked in until an update is pushed
06:01defnif that's the case then why is swank-clojure at 1.1.0
06:01defni thought it was at 1.3.0-SNAPSHOT or something
06:01tomojbecause it's deprecated
06:02tomojI think it forked to a new project, too
06:02defnlein-swank was deprecated
06:02defnswank-clojure is around for good
06:02tomojswank-clojure.el remains in the swank-clojure repo only so that people's stuff doesn't break, but won't be worked on anymore
06:02tomojswank-clojure as a clojure dependency is around for good
06:02tomojswank-clojure.el is dead
06:03tomojand so no reason to push elpa updates of the swank-clojure package
06:03defnahhhh
06:03defnhow did i miss all of this happening? heh... things have been working great for ages
06:03tomojmy problem is that org-babel requires swank-clojure and seems to be intertwined with it
06:03defnand then it just all exploded
06:03defntomoj: yeah :(
06:03tomojme too
06:04tomojI'm puzzled by the contrib problem too, though
06:04lpetitsilly question: has the "client side" part of slime/swank been ported to clojure ?
06:05tomojI don't think so
06:05tomojsomeone was asking about that before
06:05lpetitmaybe me :)
06:05tomojand the only answer I saw was that someone else tried to do that and gave up because the swank protocol is undocumented
06:05tomojoh
06:06lpetit'cause then swank / slime could have been used by anybody : netbeans users, eclipse users, probably also vim users, IntelliJ IDEA users ! ! !
06:06lpetittomoj: yes, I said that once
06:07Votingwhat does swank refer to?
06:09lpetitI always mistake one for the other
06:14evanrmurphyIn Emacs, is clojure-mode incompatible with slime-repl-mode?
06:17evanrmurphyEnabling clojure-mode while at the slime repl has been breaking it for me, but it's desirable to have clojure-mode on while writing code. (Perhaps this is why it's great to write your Clojure in a file and compile it from there?)
06:17tomojlpetit: I have just made a log of all the data transferred between swank client and server in a clojure session which used a bunch of features
06:17tomojwill gist
06:18lpetitwill be interesting, thanks !
06:18tomojunfortunately the in/out are not synched up
06:18tomojwonder how I could do that
06:18lpetitoh
06:18lpetitshame
06:19tomojhttps://gist.github.com/be1780178bc11e029999
06:19tomojinflow is stuff the client in emacs sent to the swank server, outflow is the stuff the server sent back, I believe
06:19lpetitdoes swank server just allow to "hook into the running env" for e.g. macro-expansion purposes, or is it also used for implementing the "client part" of the REPL ?
06:19tomojsee line 5 of inflow
06:20defnbbiab
06:21tomojI'd be very interested to know what the hell the hex bits at the front are
06:22lpetityes
06:23lpetitthanks tomoj, I'll send your gist to cemerick, who is currently porting enclojure's server backend to ccw. Maybe of interest to him
06:24tomojoutflow is broken
06:24tomojfixing now
06:25raekevanrmurphy: there shouldn't be any problem using clojure-mode and slime at the same time
06:27raekclojure-mode automatically starts for me when I visit a .clj file
06:28raekevanrmurphy: or did you mean *in* the slime repl?
06:28evanrmurphyraek: Thanks for responding. If I "M-x clojure-mode" at the repl, the "REPL" indicator is replaced by one for clojure-mode and evals stop working. I thought this might mean they were mutually exclusive major modes.
06:28raekah
06:28raekI dont't know I you're supposed to do that
06:28evanrmurphyraek: Yes, exactly. Only while *in* the repl. I can use clojure-mode just fine in files.
06:29tomojlpetit: ok, fixed outflow in the gist
06:29raekI usually write the code in a file and send it for evaluation with C-M-x or C-x C-e
06:29evanrmurphyraek: I'm relatively new to Emacs, this is the first time my major modes have started clashing. (Viper is having to go sometimes! :)
06:30raekevanrmurphy: did you want syntax highlighting in the repl, or why did you want to use clojure-mode there?
06:30evanrmurphyraek: I'm going to do it that way too. Just wanted to make sure I wasn't missing out.
06:30evanrmurphyraek: I might have something mixed up here, but it seemed like clojure-mode was tweaking my paredit-mode w/r/t { } braces.
06:30raekthe repl already is "clojure-enabled"
06:31evanrmurphyI just wanted that functionality.
06:31tomojparedit in the repl?
06:31raekI added this to my .emacs
06:31raekhttp://gist.github.com/443590
06:31raekthere is a fix for paredit { } at the middle
06:31tomojyou're missing M-{ for paredit-wrap-curly
06:32raekoh
06:32tomojI mean, assuming you want paredit-wrap-curly..
06:32evanrmurphytomoj: Do you not use paredit in the repl?
06:33tomojI don't
06:33raekI don't use the meta plus {/[/]/}
06:33tomojthe ideas scares me because I think things will get strange
06:33tomojraek: but they're so awesome! :(
06:33raeksince to type a { on my keyboard layout, I have to hold down AltGr plus 7
06:33raekand Meta + AltGr + 7 doesn't work
06:33tomojouch
06:34evanrmurphyraek: what keyboard layout do you have?
06:34raekI have thought about changing to US layout for coding
06:34raekswedish
06:34tomojin my layout M-{ is qwerty's M-3
06:34raekthe US layout has much better positions for "coding keys"...
06:35evanrmurphyinteresting
06:36raekI already know the US layout from earlier, so I might just switch to it some day
06:37evanrmurphyraek: Could be good, switching layouts is frustrating though.
06:41evanrmurphyparedit is great. Does anyone else wish it didn't completely freak out when parens are unbalanced though?
06:42raekI guess you could wipe out the wrongly closing parens with C-w and enter new )s
06:43raekI think paredit will enter the right closing paren, no matter which one you where typing
06:44evanrmurphyWell, sometimes if I restart a repl, for instance, and then try to enable paredit-mode, it says it detects unbalanced parens and won't start. Has that never happened to you?
06:46raekyes, but then it points out where it is, rigth?
06:46evanrmurphyraek: What does it do to point that out?
06:50evanrmurphyI never noticed it locating the unbalanced parens, will watch for that next time.
06:54raekI think it tells about it in the minibuffer
06:54raekor event place the point
06:54evanrmurphyraek: Thanks for the .emacs gist, that helped me get the paredit { } sorted out.
06:56evanrmurphyah, looks like there is row-column info in the minibuffer, wow
06:58raekM-g g <line-no> ; goto line <line-no>
07:12lpetitevanrmurphy: switch to ccw, I just released a version of paredit.clj which still works with unbalanced parens ( e.g. recognizing "chimera" pairs such as "[foo}", or incomplete "[foo"), still allowing to do structural selection, wrap with, raise over, etc.
07:12lpetit:p
07:12LauJensenGood morning all
07:12lpetit'morning La-ô
07:13evanrmurphylpetit, is that for eclipse?
07:13lpetitevanrmurphy: yep
07:14evanrmurphylpetit: I'll stick with emacs for now, but thanks. :)
07:15lpetitLauJensen: I've finally added the missing bits to clojure.zip in order to be able to do binary search of a child loc, and O(1) creation of the loc of any child of the current loc.
07:15LauJensenCool - Is that going opensource somewhere?
07:16lpetitLauJensen: used it for paredit.clj, and it's terrific ! Now e.g. indenting the 4000's line of a clojure file feels instantaneous (before the move, a "pause" was clearly visible)
07:16LauJensenFantastic
07:16LauJensenHow did you end up doing it ?
07:16lpetitLauJensen: currently there's still a missing part in paredit.clj : the incremental parser. When this one is ok, I'll speak about it on the ml
07:17LauJensenk
07:17tomojI was just wondering about incremental parsing + zippers for clojure the other day
07:18tomojhope that stuff can become portable someday
07:18lpetitLauJensen: more easily than I thought.
07:18lpetitLauJensen: 1. For binary search, I need to examine any given child. This part is easy: I didn't use the xml-zipper anymore, because its provided children function returned a seq. Instead I use my own xml-vzipper which returns a vector.
07:19lpetitLauJensen: 1bis: maybe this was not necessary after all (I've not cleaned things up totally). I mean calling (-> loc clojure.zip/node :content) should suffice if I ensure that the make-node function creates a vector in :content
07:24lpetitLauJensen: 2. I need a new function to be able to jump down at index idx. I just copied over clojure.core/down into a new utility function with an arity of 2 and not 1: (defn vdown [loc idx] ...), and this vdown function takes care of leveraging the vector nature of the children. It can easily be generalized if we could add some 'split function when creating a zipper (fn split [children idx]) => must return [ children-before-idx ch
07:24lpetitLauJensen: easier to implement than to explain, ~ 10 lines of utility code :)
07:24LauJensensounds like good work
07:25lpetitLauJensen: of course the "binary search" part is in the client code : that's the part that searches the index to jup down to, and it's specific to client's usage;
07:27lpetitLauJensen: I learned a lot in the process. Like left nodes in the loc are implemented as a vector, so that when you go to the right you can pop from the tail, and when you go the the left you can push to the tail, while right nodes in the loc are implemented as a list, so that when you go to the right you can add to the front, and when you go to the left you can remove from the front. And when you want to go up, you don't have to r
07:28lpetitLauJensen: but for sure, if we had finger trees, clojure zippers would certainly be even more performant under intensive navigational usage (but that's not a problem I've been aware in my code yet)
07:29LauJensenAmazing that you can optimize that much with so few changes. You can ask Christophe for a copy of the code fron Conj Labs if you want another 20% boost without any changes to your code
07:34lpetitLauJensen: I will. Though I doubt it'll be a 20% boost of a total paredit command.
07:34LauJensenIt wont. Its simply all the core zipper functionality
07:35LauJensenBut since is basically care free to install, you should do it :)
07:35lpetitLauJensen: is it meant as a drop-in replacement of clojure.zip ?
07:36LauJensenYea. I think once Christophe gets the time he'll pretty-it-up and submit it for inclusion in core
07:36LauJensen(though it doesnt need much/any work tbh)
07:38lpetitLauJensen: what's the core "virtue" of this new impl ?
07:38LauJensenThe virtue is the speed. Its just a protocolbased reimplementation of the original code.
07:38lpetitLauJensen: will it still work with lazy datastructures (I think the current implementation does, though I'm not 100 certain)
07:38LauJensenlpetit: yea, all interface remain the same
07:38LauJensens
07:39lpetitLauJensen: does it still enable the creation of new kinds of zippers ? How to do this ? (the last time we talked about it Christophe and I, he was facing a problem for generalizing the approach)
07:39lpetitLauJensen: good !
07:40lpetitLauJensen: ok, I'll see the detail with Christophe, then
07:40LauJensenYea - I think he'd be happy to share the code, if not, entice him with a baguette, I know he's a sucker for those
07:43lpetitLauJensen: :)
09:06lenwhi all - i am missing something in compojure - trying to serve files statically, eg css so have the line (files "/css") but still bet a 404 - anyone can help me ?
09:07spariev__lenw: did you put them into public/ subdir ?
09:07lenwspariev__: public under src ?
09:08spariev__no, on the same level with src/
09:11lenwspariev__: ok moved them there - then in the url must i also use public ?
09:12spariev__no, afaik, public/ is a web root, like in rails
09:13lenwspariev__: ok so css is in public/css and in clojure source i say (files "/css") then http://localhost:8888/css/main.css still gets 404
09:14spariev__also, I have something like (GET "/*" (or (serve-file (params :*)) :next)) in defroutes
09:14spariev__that's all for compojure 0.3.2 btw
09:15raekhrm, I think 0.3.x has a different default static directory
09:15lenwyeah i am on 0.4.1
09:15raekspariev__: can you do a (doc serve-file) ?
09:16raekiirc, the directory was named .static or .public or something
09:17spariev__raek: it says "Attempts to serve up a static file from a directory, which defaults to
09:17spariev__ './public'"
09:18lenwin the compojure source it has this : (let [options (merge {:root "public"} options)]
09:19lenwi tried setting my own root option as well ...
09:19LauJensenlenw: Compojure needs a middle called (wrap-file "root-dir") which automatically serves statics from that dir
09:19LauJensens/middle/middleware/
09:19sexpbotlenw: Compojure needs a middleware called (wrap-file "root-dir") which automatically serves statics from that dir
09:19LauJensenFor Moustache you would do (app (wrap-file "dir") ["login"] render-login) for instance
09:19raekhow is ring related to compojure? which one came first? is one of them an offshoot from the other?
09:20lenwcompojure uses ring
09:20lenwAFAIK
09:20LauJensentrue. Ring is the underlying lib which Compojure is based on
09:20raekthat wrap-file middleware exists in ring, btw
09:20LauJensenraek: yea thats the one Im talking about. Usually when saying 'middleware' we're refering to Rings
09:20LauJensen(since all of Compojures middleware got moved into Ring)
09:20LauJensen(which was why I switched to Moustache)
09:21raekah, now I understand
09:21lenwcool that makes more sense LauJensen
09:21raekthat was that big 0.3 -> 0.4 change, right?
09:21raekso, what is left in compojure then?
09:21raekrouting?
09:22lenwand the html composing support
09:22raekhtml was split off into hiccup, right?
09:22spariev__yep
09:22LauJensenraek: very big. Yea a little routing
09:22LauJensenAnd it was a good thing, so Im not complaining. Compojure is still a very good choice for web-dev
09:22LauJensenBut since Moustache got all of the middle ware functionality for free, I just went with that, because of its simplicity
09:22raekso if one is not interested in compojure's approach to routing, one could just use ring?
09:23LauJensenraek: sure
09:23raek...or moustache :)
09:23lenwand moustache seems simpler from my newbie pov
09:23LauJensenyea, which is also based on ring :)
09:23raekok, so I can use ring middleware in it too?
09:23LauJensenlenw: If you want Moustache, you can check out the source for bestinclass.dk, that entire site is run using enlive and moustache
09:23LauJensenraek: yea
09:23raekneat
09:24LauJensenexactly
09:24LauJensenSo what they did was great, because now we can have more libs, since the functionality is so modular
09:24lenwLauJensen: thanks have the source and it is great
09:25raekwhat I have liked about moustache so far is the ability to do the routing hierarchy level by level
09:25raekthe nestability thingy
09:25raekone handler strips off one portion of the path and invokes another handler
09:26LauJensenyea, christophe is crazy smart when it comes to designing libs
09:26LauJensenIve never used Enlive for a professional project, and not a some point have to lean back and go 'wow'. Its just so well designed
09:28raekI like the quality of a library being "micro"
09:30spariev__lenw: so, did the wrap-file middleware help your case ? btw, sorry for misguided advices :) , I should have asked about version you're using
09:31lenwspariev__ think it will - just restructuring things here - np re advices its great to have ppl to help !!
10:24LauJensenJquery has an odd inconsistency. $(':input').serialize() will serialize all checkboxs that are checked as name=on, but all unchecked checkboxes are left out of the data
10:26AWizzArdLauJensen: urks, yes, this is how checkboxes work per default in html+js
10:26LauJensenoh ok.
10:28jfieldswhat's the easiest way to convert from a java.util.Properties to a clojure map?
10:28AWizzArdjfields: try (into {} your-properties)
10:28jfieldsthanks man
10:32pdk(doc into)
10:32clojurebot"([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."
10:55limux1972why hiccup can not display chinese character correctly?
10:57limux1972I am doing the demo "Developing and Deploying a Simple Clojure Web Application" by mmcgrana
10:58limux1972and add more stuff to do include display some chinese character in the browser
10:59limux1972but it's not work as my expectance
10:59limux1972Those chinese characters are displayed as ????
11:00dnolen_limux1972: how are you starting the JVM?
11:00AWizzArdCan you do a (map int your-string)?
11:01AWizzArdThere you can see the if the string contains the correct data, and only the program can't display those.
11:01limux1972exactly do it as the his blog
11:01limux1972the prn to console is ok
11:02limux1972only browser is wrong
11:02limux1972i start the JVM by lein run script/run.clj
11:02raeklimux1972: this can be caused by a lot of things
11:02limux1972maybe
11:03raekfirst, do the (map int "string containing chinese characters") as AWizzArd suggested
11:03limux1972I am a newbie in Clojure and not very familar with Java
11:03raekthat will determine if it is an issue with source file encoding (witch should always be UTF-8)
11:05pdk(doc cond)
11:05clojurebot"([& clauses]); Takes a set of test/expr pairs. It evaluates each test one at a time. If a test returns logical true, cond evaluates and returns the value of the corresponding expr and doesn't evaluate any of the other tests or exprs. (cond) returns nil."
11:05pdk(doc case)
11:05clojurebot"([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are not evaluated. They must be compile-time literals, and need not be quoted. If the expression is equal to a test-constant, the corresponding result-expr is returned. A single default expression can follow the clauses, and its va
11:06limux1972I replaced the "content" with a wide char string such as my name "刘孟江", It also not work well
11:06raeklimux1972: what happens if you do (map int "刘孟江")?
11:07raek...in your repl
11:07raekthat is, start a repl with "clj" and then type the line above
11:08AWizzArd,(map int "AB C")
11:08clojurebot(65 66 32 67)
11:08raek,(map int "刘孟江")
11:08clojurebot(21016 23391 27743)
11:08limux1972210162339127743
11:08raekif you don't get these three numbers, your source file is in the wrong encoding
11:08raekok, looks right
11:09raekthen that part works.
11:09limux1972next step?
11:09raekadd a encoding meta tag to the generated html, if you don't have one
11:09limux1972i have already add "utf-8"
11:10dnolen_,(java.nio.charset.Charset/defaultCharset)
11:10clojurebot#<UTF_8 UTF-8>
11:10raekinside head: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >/
11:10raekgreat
11:10limux1972I just do it
11:10limux1972as the blog
11:10limux1972no one word changed
11:11raekcan you post the link to the blog?
11:11raekit might be due to operating system default encoding
11:11dnolen_limux1972: what happens when you run the ^ for getting the JVM encoding ?
11:12limux1972http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applications.html
11:12raeklimux1972: what does (.name (java.nio.charset.Charset/defaultCharset)) give for you?
11:12limux1972dnlon_, the prn to console is ok
11:13limux1972sorry typo, donlen_
11:14limux1972GBK
11:16raekah
11:16limux1972donlen_, how to do sa you say
11:16limux1972ah
11:16raeklooks like the tutorial relies on the default encoding being UTF-8
11:17raekmaybe you could add :content-encoding to the response map
11:18raekhttp://github.com/mmcgrana/ring/blob/master/ring-servlet/src/ring/util/servlet.clj#L113
11:18limux1972where to add?
11:18AWizzArdAlso you can check (System/getProperty "file.encoding") and (System/getProperty "sun.jnu.encoding")
11:18raekhere it sets the output encoding to UTF-8
11:19raeklimux1972: what do you get in the browser? can you manually select a different encoding in the browser that gives correct characters? and if so, which?
11:20raek*sigh* do you guys see why the concept of "OS default encoding" is broken?
11:21raeklimux1972: do you have a running server that we can access? so that we can look at the generated html our selves?
11:21limux1972i tried it and no effects
11:22limux1972no
11:23limux1972I can try to have a public domain that you can access torrow. now it's too late
11:23dnolen_limux1972: have you tried changing the default encoding of the JVM?
11:23raekwe only need your ip
11:24raekhttp://whatismyip.com/ + port number
11:24limux1972greatly thanks to raek and all of your guy
11:25raek(java.io.ByteArrayInputStream. (.getBytes "刘孟江" "UTF-8"))
11:25limux1972sorry, I have to run a software to do a dynamic dns resolve or you cannot see me
11:25raektry that as an response
11:25raeklimux1972: if you give us your ip, we don't need any DNS
11:26raekall DNS does is to give a name to an IP
11:27raek(java.io.ByteArrayInputStream. (.getBytes "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'></head><body>刘孟江</body></html>" "UTF-8"))
11:27limux1972I havn't a IP
11:27defnraek: except it's plural
11:28raek17:28 [freenode] -!- limux1972 [~chatzilla@119.190.127.4]
11:28raeklimux1972: you seem to have 119.190.127.4 currently
11:28limux1972can you try it on you machine? raek
11:29raeklimux1972: try to use the line above as your response
11:29raek(defroutes app (GET "/" [] <what i wrote earlier>)
11:30raek)
11:30limux1972ok
11:32limux1972ah
11:32limux1972my name is here
11:32raekalso, does (defroutes app (GET "/" [] "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'></head><body>刘孟江</body></html>")) work?
11:32limux1972exact
11:33raekok, the ByteArrayInputStream version worked?
11:34limux1972yeah
11:35raekhow about my last line?
11:36limux1972刘孟江
11:37limux1972I think the issue is in hiccup
11:37raekthe last one worked?
11:38limux1972all works
11:38raekif so, the issue is most certainly in hiccup
11:38limux1972i think so
11:38raekring: OK, source-file encoding: OK, html charset meta: OK, hiccup NOT OK
11:39limux1972you are right
11:39raekI'm very glad that most of these things handled encoding pretty well
11:40raekI might take a look at hiccup later this evening
11:40limux1972thank you, that's all for today
11:40raekI don't promise anything, but this should be fixed
11:40raeksince it's a pretty big isssue
11:40raekglad to help
11:40raekbbl
11:41limux1972you are hiccup author?
11:41limux1972see you tomorrow
11:42limux1972perhaps i will have more stuff study to you
11:44limux1972heartly thanks for your help to my clojure and english, I am a young chinese!
11:44limux1972bye
12:17ecyrbIs it possible to refer to a record in another namespace without fully qualifying it?
12:18ecyrbsorry - I mean a record-type, defined with defrecord - not an individual record.
12:19ecyrbit seems that for defrecords, there is no __init.class generated, so you can't "use" them
12:22chouserecyrb: use import
12:23ecyrbaw man, I never even thought of that
12:24ecyrbI find the whole use / require / refer / import confusing. I can never remember which one to use.
12:25ecyrbAt least in Java there was only "import".
12:25chouseryeah. it should be improved
12:25chouserthere have been proposals
12:26ecyrbcool. That's good to hear
12:26chouserbut before defrecord, at least import was clearly separate from use/require. Now it's not so clear anymore.
12:26technomancyclojurebot: ns overhaul is http://www.assembla.com/spaces/clojure/tickets/272-load-ns-require-use-overhaul
12:26clojurebotAck. Ack.
12:27chousertechnomancy: I'm reading The Man Who Would Be Thursday and thoroughly enjoying it.
12:28smokecfhi'm amazed at http://ideone.com/ - it even supports clojure
12:28technomancychouser: yeah! it's great. how far are you?
12:29chouser80%
12:29chouser:-)
12:30technomancyah, the part where it starts getting _really_ crazy.
12:30chouserso says my book reader. let's see, they just discovered the entire town was on the side of law not anarchy.
12:30chouserheh. I can somehow believe that.
12:30chouseroh wait, no they're chasing Sunday.
12:31chouserI can't wait to finish so I can start trolling the web for explanations.
12:34mabescould someone take a look at my use of lazy-seqs + futures and tell me how I'm doing it wrong? The lazy-seq is being kept in memory and I'm getting OOM errors.. : http://gist.github.com/513376
12:36mabes(I asked on the ML but got no relies - http://bit.ly/d0V8jV)
13:07thunksexpbot: (+ 1 2)
13:07sexpbotThis command is old. Use -> now. It's a hook, so it can evaluate anything, even stuff that doesn't start with parentheses.
13:08thunk-> (+ 1 2)
13:08sexpbot=> 3
13:08thunk-> 'rudybot:
13:08sexpbotjava.lang.Exception: Invalid token: rudybot:
13:08thunkOh, whoops. wrong room
13:09thunkI thought there was a new bot in #emacs
13:25cgrandraek: do you like Moustache or the "syntax" file?
13:34raekboth, I guess
13:34raekall DSLs should have a syntax reference page
13:35raekand moustache is very neat
13:36raekcgrand: thanks for an awesome lib!
13:37raekI have decided to use it in a rewrite of a web service I have made
13:38raekbtw, is a validator a fn that returns a parsed/normalized value if the input was valid and nil if it was invalid?
13:40defnditto to cgrang
13:40defncgrand*
13:40defnreally great lib
13:43cgrandraek: yes, validator fns return nil/false on failure
13:44cgranddefn, raek: you're welcome
13:46raekKaali (who recently got into clojure) made a validation library, which uses the same interface for validators
13:46raekhttp://github.com/Kaali/pour
14:16duncanmhola
14:17duncanmis there a way to tell lein about my own maven server?
14:19lancepantzduncanm: yes
14:19lancepantz:repositories { "java.net" "http://download.java.net/maven/2&quot;
14:19lancepantz "jboss" "http://repository.jboss.com/maven2/&quot;}
14:19duncanmcool
14:19lancepantzfrom http://github.com/technomancy/leiningen/blob/master/sample.project.clj
14:21raekduncanm: if you want to have a dependency on another project you are working on, you can add a link to that project directory with lein's "checkouts" fieature
14:21clojurebotyour link is dead
14:22joeggCan anybody comment on the mailing list discussion of try/catch/finally? Is this a real bug, or just a needs-better-documentation? That is, is the behavior desired or accidental?
14:27raekI think that is a bug
14:27raekfrom what joegg's example shows
14:28raek( http://groups.google.com/group/clojure/msg/367791544e67aa27 )
14:29raekthe finally-code should obviously not be in the try-part too
14:30raekanyway, Meikel Brandmeyer has forwarded this to the clojure-dev list, so it will get attention
14:31joeggraek: Ooh, thanks for pointing that out. I didn't think to look over there.
14:31raekjoegg: oh, sorry. didn't see it was you... :)
14:31joeggThat's okay. :)
14:31raekman.
14:32raekI should pay more attention...
14:32joeggI kept hitting refresh and hoping for some kind of response, so I came over here to see what's up. :)
14:32raekso the compiler emits duplicated code?
14:32joeggIt's complicated. :)
14:34joeggMy bytecode knowlege is a bit limited; so feel free to correct me if I'm wrong, but: Basically, it looks like it emits the try and finally sections together, and then, separately, the finally section again.
14:35joeggBut, with regard to exceptions, I think the first time through is correct -- if nothing goes wrong, run both the try and the finally.
14:35joeggI think the issue is that the second finally section is being linked to the entirety of the first emitted try/finally exprs.
14:36joeggSo, if something goes wrong in the finally clause, then we re-run the finally clause.
14:36chouseramazingly easy to reproduce
14:37joeggI can post my tests somewhere, if that will help.
14:37chouserI would guess the ones in the ggroup thread are sufficient
14:37joeggI was excited to find special.clj, and then sad to see that it was empty. :)
14:45lancepantzwhat is a shell wrapper?
14:47chouserjoegg: commit 5e9f2b29 is interesting
14:51joeggOh ho! A good point. I'll add a test for that, and see if we can figure out a way through it.
14:53technomancylancepantz: if you install swank-clojure using the latest lein, it writes a cljr-like ~/.lein/bin/swank-clojure shell script that sets up the classpath and lets it get run from the CLI; see the "1.3 features" thread on the lein list
14:54lancepantzoh, cool
14:59duncanmit's always bugged me that in slime-repl-mode, paredits's M-s doesn't work because the keybinding is used by slime
15:00joeggchouser: I'm trying to provoke the problem that that commit says it solved (now that I've pretty much uncommitted it), and I can't.
15:05chouserhmph.
15:07joeggWait, I'm wrong.
15:07joeggMy test wasn't testing what I thought it was.
15:07joeggI need to change something things.
15:07chouser(try (prn 1) (throw (Exception. "one")) (catch Exception e (throw (Exception. "two"))) (finally (prn 2) (prn 3)))
15:07chouser,(try (prn 1) (throw (Exception. "one")) (catch Exception e (throw (Exception. "two"))) (finally (prn 2) (prn 3)))
15:07clojurebotchouser: It's greek to me.
15:08chouserso the goal is to get both that and this to print just 1\n2\n3\n and an exception:
15:08chouser(try (prn 1) (finally (prn 2) (prn 3) (throw (Exception.))))
15:09joeggOkay, I am provoking the behavior that that was supposed to fix. My test was broken.
15:10chouseroh....
15:11chouserJava doesn't allow you to do both cathc and finally on the same "try", does it.
15:12joeggUmmm... in a .java file? Yes, try/catch*/finally?. You must have a least one catch or finally. try/finally, try/catch, try/catch*/finally, etc. All okay.
15:12chouseroh, ok.
15:12clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
15:12joeggAs far as what that turns into in the bytecode, well, I don't really know.
15:12chouserin which case there must be a "right way" to emit this stuff.
15:12joeggYou'd really think! :)
15:21chouserjavac emits the finally code multiple times too
15:21joeggVery interesting.
15:22joeggI wonder if the difference is the exception table.
15:24chouseris there only one exception table per method?
15:25joeggDunno.
15:28chouser"At run time, when an exception is thrown, the Java virtual machine searches the exception handlers of the current method in the order that they appear in the corresponding exception handler table in the class file" ...I *think* that means one table per method
15:29BrianForester"Each method that catches exceptions is associated with an exception table that is delivered in the class file along with the bytecode sequence of the method. The exception table has one entry for each exception that is caught by each try block. Each entry has four pieces of information: the start and end points, the pc offset within the bytecode sequence to jump to, and a constant pool index of the exception class t
15:29BrianForesterhat is being caught." -- http://www.artima.com/underthehood/exceptions.html -- seems to confirm that.
15:29joegg(try (prn :a) (throw (Exception.)) (catch Exception e (prn :b) (throw (Exception.) (finally (prn :c)))))
15:30joegg,(try (prn :a) (throw (Exception.)) (catch Exception e (prn :b) (throw (Exception.) (finally (prn :c)))))
15:30clojurebotjoegg: Pardon?
15:31chouserok, when I do try { A } catch { B } finally { C } in java, AC are emitted together, but the finally handler only covers A
15:31joeggI'm expecting :a, :b, :c from that, and getting :a :b only. Stock clojure 1.1.
15:32chouserjoegg: your finally is at the wrong level
15:32joeggThanks.
15:34pdelgallegoany good tutorial on testing in clojure ?
15:36chouserok, I think I see it
15:37chouserjavac generates an exception table entry for the finally clause for the try block and *each* exception handler
15:37raekI started to work on a java class disassembler, and iirc there was only one exception table per method
15:38chouserClojure compiler generates a single exception table entry for the finally clause, that covers all the try and catch blocks at once (and therefore the finally blocks emitted for each of them)
15:39Ploujwhat's the state of clojure debugging (in Eclipse)?
15:39raek(in case someone wants to look at the byte code in a more "readable" format: http://github.com/raek/impojure )
15:40raekis there any good software for inspecting jvm bytecode?
15:41chouserI was just using javap :-P
15:41chouserpretty painful
15:41raekyeah, but that doesn't show all the details
15:41joeggjavap -v
15:42joeggraek: What do you want to see?
15:43chouserjoegg: what were you doing when you found this bug?
15:44arkhraek: there's a commercial one that Rich Hickey used in making Clojure but I forget the name :(
15:45chouserjoegg: I think this fixes it: http://gist.github.com/517865
15:45arkhis there any way to return from a seque that's blocking on the consumer side? (i.e. when using (.take q))
15:47raek(here is an example output from impojure, if someone was interested: http://gist.github.com/517866 . it is for clojure.core/comp)
15:47joeggchouser: Compiling, will test in a moment.
15:47arkhor, more generally, can an InterruptedException be generated from outside an agent thread (and safely)?
15:47joeggGreat success!
15:48chouserraek: that's pretty cool!
15:48raekthanks
15:48raekthe goal is to make a s-exp based jvm assembly format
15:49raekanyway, that example did not contain any exception handlers...
15:49chouserheh
15:49joegghttp://gist.github.com/517871
15:49raekhey! I came up with it before that lein patch! ;)
15:49raekthe name is not set in stone, btw...
15:49danlarkinraek: I was gonna ask if you deliberately circumvented it :)
15:50chouserjoegg: oh, you caught this while writing actual clojure unit tests?
15:50joeggMy tests, that broke with original behavior, and my patch, but work with chouser's code.
15:50joeggNegatory, I wrote some tests because I saw this on the mailing list.
15:50chouserah. still, very helpful.
15:50joeggAnd wanted to test my "fix"...
15:50joeggUmmm... they're really gross.
15:51joeggIt's pretty much just Laurent's demo, expanded to try a few more edges.
15:51arkhI can't wait until I release my math library called 'intejure' /s
15:54raekhttp://gist.github.com/517879 <-- LazySeq.java (with exception tables(
15:55raekrow 567
15:56raekthe point was, a method can have an exception table that is a set of (catch-type, start-pc, end-pc, handler-pc) tuples
16:01lpetithello
16:03arkhbonjour
16:03lpetitah, one civilized person ;)
16:04lpetithey I'm not japanese, bowing is from ancient times in France :)
16:05lpetitarkh: hmm, maybe you're japanese or chinese ?
16:05defnwould you call clojure aspect-oriented?
16:05arkhlpetit: I am not but it was a good thought :)
16:05lpetitdefn: mm
16:06defnlpetit: was that an "mm" in the affirmative?
16:06lpetitdefn: it was dubitative
16:06raekisn't aspect orientation an extension of object orientation?
16:06raeki'm sure clojure addresses some of the things AOP addresses, but maybe not in the same way
16:06lpetitdefn: aspect oriented because one can redef and encapsulate existing vars ?
16:07chouserjoegg: is it ok if I post the the dev thread, pointing to your tests?
16:07lpetitdefn: and also by using binding ?
16:07defni was thinking about "modularity"
16:07defnseparation from business logic
16:07defni guess it's not "enforced"
16:07defnbut it seems to happen naturally much of the time
16:08lpetitdefn: you're loosing me. "aspect orientation" has a strong meaning these days, and I can't manage to make your definition fit mine :)
16:08defnlpetit: i wasn't aware of that
16:08chouserdefn: Doesn't aspect-oriented suggest you can "hook" before or after any methods you want to?
16:08chouserin which case I don't think clojure qualifies
16:08joeggchouser: That's fine by me.
16:09lpetitchouser, defn: my guess is that defn is not using the popular meaning of aspect oriented. And even if so, I won't say so, 'cause while possible, it's not done in practice
16:09defnI was imagining a single .clj as being sort of the whole of the business logic
16:09joeggI would also be happy to modify them first if you have any criticisms.
16:09defnwherein secondary functions achieve the primary goal
16:10lpetitdefn: that's not what people are calling "aspect oriented". see chouser's definition and mine ^^^
16:10defnto be honest I've never heard anything about AOP until today so I'm taking you both on your word
16:10lpetitdefn: what you're talking is more about separation of concerns, layering out of the application, etc.
16:10defnjust a curiosity, really--
16:10defnlpetit: yeah, that's accurate
16:10neotykHi *
16:11defnhi neotyk
16:11neotykjust wanted to share my happiness of having test running from emacs
16:11neotykno jvm startup
16:11chouserjoegg: they look pretty good to me. you could make them a bit stronger by conjing on a vector or something instead of just counting
16:11defnneotyk: cake?
16:12chouser(swap! a conj :catch) ... (swap! a conj :finally) ... (is (= [:finally] @a)) or whatever.
16:12chouserbut what you've got is good.
16:12neotykdefn: lein swank and slime-connect
16:13neotykdefn: what is cake?
16:14defnneotyk: oh -- it's a build tool that lancepantz has been working on
16:14defnit has a persistent JVM so you can have a JVM up and running all the time that you can run tasks in
16:14defnyou can have project-local and global tasks
16:15neotykproblem I had was [leiningen/lein-swank "1.1.0"] in dev-deps next to [swank-clojure "1.2.1"], while lein-swank is deprecated
16:15anarshas anyone successfully run clojure-clr using mono? either with MS's DLR distribution or the DLR included in the .NET 4 profile of the latest mono
16:15neotyksounds cool, but you have to have "clean" tasks
16:15neotykmight be hard in java
16:16timcharperI noticed that back in december of last year, Rich asked if anyone had written any test cases for lazy-sequence head retention
16:16joeggchouser: endTryCatch doesn't appear to be used for anything anymore, so I think it's safe to delete, too.
16:16timcharperI have isolated an issue where the head a lazy sequence is retained when a lazy sequence is consumed in a different thread from whence it originated
16:16timcharperthe code could easily be made into a test case
16:16timcharper(I believe)
16:16chouserjoegg: yeah, I updated my gist
16:17lpetittimcharper: gist ?
16:17joeggOkay, cool, didn't see that.
16:17timcharperhttp://gist.github.com/510601
16:18timcharpercurrently it output if the lazy sequence head gets GC'd
16:18timcharperthousands of date objects are allocated as a result of the realization of the lazy sequence
16:19timcharperand the garbage collecter is queued to run every 100ms
16:19timcharperin my tests, if the head is going to get freed, it gets freed at least by first 100ms
16:20timcharperotherwise, it is retained until after the entire lazy sequence is processed, and then freed
16:21lpetitsorry, in call
16:21timcharperok :) thank you for engaging
16:22timcharperI will refactor further into a test case
16:22timcharperbut running that snippet of code will demonstrate the issue
16:31technomancyneotyk: yeah, I guess the docs need to be clearer re: lein test being a sanity-check and not a real TDD tool
16:33neotyktechnomancy: it turned out to be very simple
16:33jonnyb`hi, i need to pass a java enumeration value to a function. But it just doesn't work :) and google woun't spit it out. Anyone has a short explanation or a link?
16:33neotykthanks to your "in which are found tricks of the trade concerning clojure authorship"
16:33neotykbut I think I found a bug in clojure-test
16:34defnhave you tested it?
16:34defn*world explodes*
16:34arkhare there any naming conventions in clojure other than the usual that are used to designate "constants" or "magic numbers"?
16:34neotykdefn: like typing google into google
16:34technomancyneotyk: no surprise there; it's kind of cobbled together
16:34defnor recursion :)
16:34technomancyrevisiting it is high on my list for after the next lein release
16:34defn /Did you mean recursion?/
16:35technomancybut please file an issue re: any bugs you find
16:35neotyktechnomancy: if I do clojure-test-run-test fixture is not applied
16:35technomancyarkh: everything's a constant by default
16:35technomancyneotyk: yeah... that is kind of tricky to do with clojure.test
16:35technomancyI may be able to work around it, but clojure.test isn't designed with that in mind
16:36chouserjonnyb`: Java enumerations should act like static fields of the class
16:36perkinscanyone know how much of The Joy of Clojure is written? The website says: "gives you access to the first four chapters now, plus more as we write them", but the Manning site says "Available" beside all 12 chapters. Which is right?
16:36neotykbut it is not that annoying as I can run test on warmed up jvm now :)
16:36technomancyneotyk: please do open an issue though
16:36neotykwill do
16:36chouserperkinsc: oh dear. the web site is out of date. All chapters are written.
16:37arkhtechnomancy: I understand but is there any special designation for 'magic number', e.g. an mtu of 1500?
16:37rhudsonjonnyb`: try something like MyClass$MyEnum/ENUMVAL
16:37raekarkh: clojure does not use the +plus-earmuffs+ convention present in some lisps
16:38arkhraek: ok ... so nothing special? Just (def mtu = 1500) ?
16:38arkher... omg
16:38raekyes
16:38arkhraek: yes, thank you. brain lapse
16:38raekunless it is meant to be dynamically reboundable
16:39raekin that case *earmuffs* are used
16:39raekas in *in*, *out*,
16:39raekand *agent* etc
16:39arkhraek: oh - cool. That helps it stand out.
16:40raekbut those don't count as constants, I suppose... (could be good to know anyway)
16:41arkhraek: sometimes it's the small things. If I knew anyone learning clojure who was local, I could ask them my silly questions and save the meaty ones for IRC and the permanent memory of the Internet ;)
16:43neotyktechnomancy: http://github.com/technomancy/clojure-mode/issues/issue/10
16:43neotykwho runs on GAE with new Compojure?
16:44neotykside note: nice timing for Compjure guys, you would be banned by lein now
16:45neotyks/Compjure/Compojure/
16:45sexpbotside note: nice timing for Compojure guys, you would be banned by lein now
16:46joeggchouser: http://gist.github.com/517871 Updated to use conjing symbols onto a vector.
16:49neotykanyone running on GAE?
16:53evanrmurphy_neotyk: I'm just getting set up there myself, but haven't done it yet.
16:53neotykevanrmurphy_: any hints for starters?
16:53evanrmurphy_neotyk: been following http://compojureongae.posterous.com/, which is good
16:54evanrmurphy_I'm fresh into Clojure but have used similar Lisps and fiddled with GAE a bit
16:54evanrmurphy_neotyk: had you seen that blog before?
16:55neotykevanrmurphy_: yes, have seen it
16:56evanrmurphy_neotyk: Well maybe you're once step ahead of me ;) Did the instructions not work for you?
16:56neotykevanrmurphy_: haven't done single thing from it yet
16:56neotykalso was looking at hackers with attitude
16:57bozhidarI looked at the blog, but it seemed pretty shallow
16:57bozhidarthe lack of documentation is a general problem for compojure...
16:58neotykbozhidar: but you gen-class the servlets right?
16:58evanrmurphy_Do other Clojure web frameworks have more documentation?
16:58lancepantzcompojure isn't really that much guys
16:59lancepantzmost stuff has been moved into ring, which is pretty well documented
16:59bozhidarmaybe it's not, but it could really use some documentation
16:59bozhidarthe project site is hard to describe because there is next to nothing there :-)
17:02evanrmurphy_I have to agree with lancepantz, so far things have been pretty self-explanatory
17:06lpetittimcharper: examined your gist. I think I understood what you did. And I think there's no bug. Or rather, that the bug is in the user code, not in clojure's.
17:06timcharperok
17:07lpetittimcharper: in the "leaky tests", you hold onto the head in the let, while waiting for the future to fully realize.
17:07timcharperlpetit: I hold onto the head with a weak reference in both tests
17:08timcharper(both the leaky tests and the non-leaky tests)
17:08timcharperit is how I detect if the head is retained or freed
17:08lpetittimcharper: not what I'm seeing/understanding. (test-lazy-sequence) returns a lazy seq, whose head is retained in dates.
17:09timcharperso, the head is retained if I have a reference to the lazy seqyence ?
17:09timcharpers/seqyence/sequence/
17:09sexpbotso, the head is retained if I have a reference to the lazy sequence ?
17:09lpetittimcharper: sure
17:09timcharperI hold on to that in all of the cases though
17:10wwmorganI'm using the repl in vimclojure and trying to recall expressions using C-Up, but it's just moving the cursor. Do I have to tell vim not to use the arrow keys, or something like that?
17:10timcharperif I consume the lazy sequence in the same thread that contains the reference to the lazy sequence, the head is not retained
17:11timcharperhowever, if I consume the lazy seqence in a different thread, the head is not retained
17:11lpetitno, in the first case, you hold inside the future, and clojure 1.2's smart compiler takes care of clearing the variable when it sees that after the call to reduce it will not be of use anymore. So the variable is cleared at the right time, right before the whole seq is consumed by reduce. That's how I understan things.
17:11timcharperhow else would you consume a lazy sequence in a streaming manner ?
17:11timcharperah
17:12timcharperand it's not smart enough if you pass the sequence to a future ?
17:12lpetittimcharper: would you have returned the future to another function, and called deref on the future on this other function, I guess the head would not have been held
17:12timcharper(FYI: anything using fill-queue will suffer from this)
17:12lpetittimcharper: that's an interesting question
17:13timcharperin order to use fill-queue, you must pass a lazy-sequence which ultimately is passed to a future that "fills" the LinkedBlockingQueue
17:15lpetittimcharper: can you change your test so that in the "leaky ones", you go out of the (let) without calling deref on future, and rather call deref on the let ?
17:15timcharperso... I'm a little saddened to find that this is classified as a user error, when a similar approach is already embraced by a method in clojure core
17:15lpetittimcharper: would be interesting to know the result of this test before anything else
17:16timcharpersure... one second
17:16timcharperI think if I move the @ sign on lign 45 to the beginning of line 44, that would do it, right ?
17:17lpetittimcharper: yes
17:17timcharperit's still retained... screencast coming...
17:17mabeslpetit: this gist shows the same error (without the leting of the head into a weak ref).. http://gist.github.com/513376
17:18mabeswell, it "shows" the same error by producing an OOM
17:19lpetittimcharper: interesting
17:20lpetitchouser: is it theoretically feasible to have the equivalent of "local clearings" for lexically scoped stuff ?
17:21lpetitchouser: it seems that timcharper demonstrated something like that
17:21lpetittimcharper: mabes's example more straight to the point, IMO
17:22mabestimcharper, lpetit: I added the deref to the let with the future and I still got an OOM
17:22mabesI'll update the gist...
17:23timcharperhttp://screencast.com/t/MWYxZjg4YzI
17:23mabeshttp://gist.github.com/513376
17:23timcharper(excuse my speech, I had 7 stiches put into my chin last night and mouth movement is restricted)
17:25mabesYeah, I don't understand how fill-queue would not be effected by this...
17:26lpetitmabes, timcharper: seems like a clearing problem in the contextual exical binding
17:27emhis there an any/all function? (apply or/and [true false]) doesn't work since it's a macro
17:28mabeslpetit: should we file a ticket for a bug then?
17:28lpetit,(doc every?)
17:28clojurebot"([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."
17:28timcharperlpetit: I will further distill my example. The benefit of not being informed of head retention by an OOM exception is obviously that it's more feasible to put in a unit test
17:28lpetitmabes: no, first report this on the clojure-dev ml
17:28mabestimcharper: agreed, for a unit test your approach is much better
17:28lpetitindeed
17:28emhlpetit: thx
17:29timcharperlpetit: thank you for your time
17:29mabeslpetit: ok.. I posted this on the regular ML and got no response.. Hopefully the dev mailing list will be more attentive.
17:29mabeslpetit: yes, thanks for your help
17:29lpetittimcharper: but the tweak with the garbage collector makes me feel bad. I mean AFAIK calling gc does not guarantee that the real gc will happen soon
17:29lpetitnp
17:29timcharperlpetit: aware of that drawback
17:29timcharpermy research has led me to believe that that is as much as you can do
17:30timcharperwhich is why I allocate so many date objects.... in my experience it has been reliable... but mileage may vary
17:31lpetittimcharper: yes, I can't think about another way of proving this yet
17:36lpetittimcharper, mabes: which version of clojure are you using ?
17:36timcharper1.2
17:36mabeslpetit: various versions of 1.2, including the most recent RC
17:37lpetitmaybe I must help the OOM happen in my machine, maybe cljr added some -Xmx1024M to the java thread ... hmmm ('cause it does not happen "as is")
17:42mabeslpetit: try this project: http://github.com/bmabey/doseq-future
17:44mabeslpetit: you can specify how long you want the function to run for.. which should eventually cause an OOM.. but another way to verify is to compare what the heap looks like (via visualVM)
17:47lpetitmabes: too tired to continue tonight. Will let others on the ml take care of that while I'm sleeping. cu !
17:48mabeslpetit: cool, thanks again
18:00mebaran151what's the best way to cast nil to zero
18:02raekmebaran151: that depends. how are you using the result?
18:02mebaran151trying to max a bunch of values
18:02mebaran151getting null pointer exceptions
18:02raekwhere do you get the value from? a map?
18:03mebaran151I guess I could map #(or % 0) over everything
18:03mebaran151yep, a map
18:03tomojuhh
18:03raekok, then use the three-arg get
18:03mebaran151yeah
18:03tomojjust remove nil? instead of mapping #(or % 0)
18:03mabeswhen you get a value from the map you can pass in a default 0
18:03raek,(get {:foo 1} :bar 0)
18:03clojurebot0
18:03mebaran151I just thought of three arg get
18:03mebaran151hmmm I wonder which will be more efficient
18:03mebaran151these lists might get pretty long
18:04mabes,(:bar {:foo 1} 0)
18:04clojurebot0
18:04mebaran151is it more efficient to max a bunch of possible 0's or to filter 0's
18:04mebaran151*filter nils
18:04mabesdunno, it might depend on how sparse your values are. you could try profiling the common case
18:05mebaran151they probably won't be too sparse
18:05raekboth ways should have the same complexity
18:06raekbut to filter you still have to get the value for that key
18:06raekso then you might as well pass it the default value to use
18:06mabesseems like it would be n vs 2n, since the filter does an extra loop around the data.. so depending on how big n is that might matter..
18:07mabesyeah, I would pass the default value
18:07raekfilter is lazy, so everyting os done in one pass
18:07mabesduh...
18:07raekoh, misread
18:07mabesI was "duh.."ing me :)
18:08mebaran151I think the filter would actually be less efficient because it has to test all the values anyway
18:08mebaran151max automatically excludes 0's anyway
18:12tomojin what way does it exclude 0's?
18:12mebaran151I mean they don't matter
18:12tomojah, right
18:13mebaran151adding a bunch of 0's to max shouldn't change it's behavior
18:13tomojit's a (> x y) instead of a (nil? y) for each 0, I think
18:14tomojplus an extra (nil? y) for every non-0
18:15mebaran151yeah
18:15mebaran151the extra nil? checks are useless
18:15mebaran151also, what's the difference between using the delay macro and simply passing an anonymous function
18:16mebaran151seems like delay and @ are the same as creating an anonymous function no arguments and invoking it if wanted
18:18raek@ is deref
18:18mebaran151yeah I know that
18:18mebaran151but how is delay different than using a closure as a thunk
18:18raekah, not very different
18:19mebaran151does delay do anything funny with threads or something?
18:19raekI think tou can only force a delay once
18:19raekthen the result is cached, or something
18:19mebaran151deref is force right
18:20mebaran151for delays that is
18:20raekyeah, either force or deref can be used
18:21raek,(let [a (atom 0), d (delay (swap! a inc))] [@d @d @d])
18:21clojurebot[1 1 1]
18:23mebaran151that behavior of delay is actually useful here
18:24mebaran151I want to possibly pass the results of a query to two functions, that may never actually need the result at all
18:25mebaran151either one may or may not need it, so the delay macro will automatically let them share the cached result
18:26raeklazy sequences is a similar idea
18:52raekmoustache's 'app' really maximizes the usage of () [] {}
18:53tomojeffectively, you think?
18:53tomojI got lost in it for a while, but I'm not sure whether I just didn't give it enough time to sink in
18:53raekI'm still reading up on it...
18:54raekalmost every clojure data structure or scalar has a mening at every point
18:54raekit's compact
18:55raekbut if that's a good thing, I don't know yet
18:55tomojI found it made it difficult to do things I felt like I wanted to do often
18:55raekI'm just impressed that he managed to make a syntax that semantically compact
18:55tomojbut those things could have been stupid things that I wouldn't want to do often in a real project
18:55tomojyeah
18:55raekwhat kind of things?
18:56tomojpretty dense
18:56tomojlike, for example, returning an explicit response map
18:57raekhrm, I guess so... :)
18:57raek#(fn [request] {...}) maybe
18:58raekbut yeah, no literal syntax for that
18:58tomojeven though the syntax guide seems to suggest it should work
18:59tomojgenerally it was feeling like I had to make too many trivial wrapping fns, yeah
18:59tomojbut again I think I probably just don't grok it yet
18:59raek{a-literal ring-response-map} <-- that?
18:59raekI haven't figured out that one yet, too
19:01tomojI think it's just clobbered by the other meaning for maps
19:02raekjust putting a symbol in the "a-literal" position doesn't work for me
19:03tomojI just assumed it meant the whole map was supposed to be a literal ring response map
19:03tomojlike {:body ... :code ...}
19:04raekoh, right... that worked
19:04wolfjbhow do you concatenate strings? (concat "a" "b") gives back a seq not a string
19:04raekwolfjb: (str "a" "b")
19:04wolfjbraek: thanks!
19:05raekI think I saw a strcat in contrib somewhere
19:05raekit probably did (fn [coll] (apply str coll))
19:07wolfjbit's probably just an experience thing, but the only difficulty I'm having with clojure is finding these kinds of answers. of course, once I ask here the answer is nearly obvious (like why didn't I think of that? kind of obvious)
19:08wolfjbanother question is how do I "overload" a function with different arity? I've been reading defmulti/defmethod, but the syntax for how to have a method with 2 parms and the same named method with 3 is escaping me
19:09Scriptorwolfjb: I think the regular fn can take multiple arity definitions
19:09wolfjbit's probably right there in front of me somewhere, but I just haven't found it
19:09Scriptorlemme find the docs
19:09lancepantzwolfjb: (defn foo ([a b] (do blah)) ([a b c] (do blah)))
19:09Scriptoryep, that
19:10wolfjbnice
19:10wolfjbI missed seeing that
19:10evanrmurphy_wolfjb: are you talking about: (defn foo ([] (foo 1)) ([x] (+ x 1))) ?
19:10raekhttp://faustus.webatu.com/clj-quick-ref.html <-- that one can be handy
19:10wolfjbthanks!
19:12Scriptorhuh, didn't know about this before: http://clojuredocs.org/
19:12raekthat one has a lot of examples too
19:13Scriptorvery well laid out as well, I like how it shows the source for functions
19:14evanrmurphy_Scriptor: Thanks for the clojuredocs link
19:15wolfjbthanks for all the help and tips!
19:24polypus~ping
19:24clojurebotPONG!
19:25polypusi have an ant task java class that i'd like to use from clojure. is the best way to do this with lancet? if so, is this documented anyplace?
19:30polypusbasically what i'm trying to do is use an ant task class, which if i were writing a build.xml file, i'd have to write a taskdef to use, inside a leiningen plugin. i'm an ant noob, so any tips, obvious or not could help
19:31lancepantzpolypus: there is a really cool macro we use inside of http://github.com/ninjudd/cake/blob/master/src/cake/ant.clj
19:32polypuslancepantz: great. thanks i'll have a look
19:32lancepantzyour able to call stuff with (ant SSHExec {:host "foo"})
19:32lancepantzwhere the map basically becomes your setters to the ant tasks
19:32polypusany dependencies other than ant?
19:34lancepantzhttp://github.com/ninjudd/cake/blob/master/src/cake/tasks/compile.clj#L8 is a good example of the usage
19:34lancepantzi don't think so, if you just pull that fn out
19:34lancepantzyou'll have to import the ant task classes that you want to use
19:34lancepantzor fully qualify them with the package i suppose
19:35lancepantzwhich task are you trying to use actually?
19:35polypuslancepantz: com.sun.tools.javafx.ant.JavaFxAntTask
19:36polypusnot sure if having to import it will be a problem though
19:36clojurebotnot a problem, the average bid for it on getacoder is $821.00
19:36lancepantzah, i dont have any examples of that one
19:37lancepantzyou don't *have* to, its just cleaner
19:37polypusproblem is on different systems it sits in different places, and i was hoping to use a leiningen project key to define that place
19:38polypuslancepantz: cool, i'll have to read through your code a bit. thanks for the tip
19:38lancepantznp
19:42polypusactually, that brings up another question. is it possible to add paths to the classpath which lein builds up from within a lein plugin
20:09mikejsis there a friendlier web interface to the clojure core docs than the ones at clojure.github.com?
20:10lancepantzmikejs: use swank?
20:11mikejsI sometimes like having docs outside my immediate dev environment, particularly when I'm just sort of browsing/not 100% sure what I'm looking for
20:12lancepantzyou may be interested in http://clojuredocs.org/
20:12mikejsoh, nice
20:12mikejsI was actually thinking of making a little more featured doc browsing tool as a way of learning more clojure/compojure/ring etc.
20:13mikejsthough that right there might be what I'm looking for
20:13mikejsthanks
20:20tomojmikejs: please make a better one in clojure/compojure/ring :)
20:21Scriptormikejs: cojuredocs with some tutorial sections built in would be pretty neat
20:21mikejswell, I think I'll still tackle it as a learning exercise, but I'm not sure I want to push it publicly and split the community
20:21mikejswould be nice if clojuredocs were open source
20:23tomojdamn the community
20:23tomoj:P
20:26mikejstomoj: well what would you like to see?
20:26tomojit would just make me very happy to see it done beautifully in clojure
20:27mikejsgotcha
20:28tomojI wonder who owns the examples on clojuredocs
20:32mikejsgood question; site doesn't make it clear
20:32gstampexamples are licensed under the creative commons
20:33gstampI know when they first started out they populated with some examples from http://clojure-examples.appspot.com/
20:44tomojoh, where did I agree to make my example CC?
21:00mikejsit would be cool if the examples and source listings on clojuredocs were annotated with embedded docs
21:00mikejslike links/popups with docstrings for functions they call
21:01mikejsI'm picturing loading the example code in a sandbox and introspectively linking everything up
21:02Scriptorhmm, could the syntax highlighter be extended for that?
21:03Scriptorthey apparently already show core functions the code listings use
21:04replacamikejs: if you want to start from the autodoc source, you can feel free. If it doesn't have a license on it, I'll happily put one there
21:05mikejsreplaca: sounds great, I'd appreciate that
21:08mikejsScriptor: looks like their syntax highlighting is done in javascript; I think something more extensive like I'm imagining would require actually loading the code and introspecting
21:14gstamptomoj: when you click add example it's right below the text box.
21:17tomojgstamp: ah :)
21:33replacamikejs: autodoc lives @ github.com/tomfaulhaber/autodoc. It's always in some interesting state of flux, but the html gen has been pretty stable for a while now
21:36mikejsreplaca: thanks
22:58micryptWould it be a decent idea to work through SICP in Clojure? Or should I be looking at Scheme?
22:58lancepantzmicrypt: http://sicpinclojure.com/
22:59lancepantzsome guy also had a github repo full of the examples, which was more complete last i looked
23:01micryptlancepantz: This looks excellent. Thank you.
23:04lancepantz,(let [foo "1.2.3"] (into [] (.split foo ".")))
23:04clojurebot[]
23:04lancepantz,(let [foo "1.2.3"] (into [] (.split foo "2")))
23:04clojurebot["1." ".3"]
23:04lancepantz???
23:04technomancyok, everyone on the latest version of lein can now do: lein install swank-clojure 1.3.0-SNAPSHOT && swank-clojure 4004 # bam! server started.
23:05technomancygranted I am the only person on the latest version of lein right now.
23:06talios'lo technomancy
23:06lancepantzanyone know why that first form doesn't split ^ ?
23:06taliostechnomancy: did swank-clojure ever get into central or still somewhere in clojars?
23:07technomancytalios: I don't know if it made it to central
23:07technomancystuart S talked about it, but I don't remember if he went through the paperwork
23:08taliosmust get back into some clojure hacking. been way too long since I've delved in.
23:09technomancyoh, will they not take it unless it has my domain name as its group-id?
23:09technomancysheesh
23:09technomancyI don't want it to be tied around my neck like an albatross. =\
23:10taliosno - I was just meaning I'd not seen it in the usual place in central.
23:10technomancyoh, I see
23:11taliososs.sonatype.org's nexus setup is a bit more restrictive tho - you need to proove ownership/control of the groupId - which is just more for tracability
23:12taliosaltho "proove" is quite flexible, i.e. I just said "I own the domain, its mine mmmkay?" and was all sweet and away laughing
23:12slyrustechnomancy: it is an ancient lisp programmer and he stoppeth one of three...
23:12lancepantz,(let [foo "1.2.3"] (into [] (.split foo "\\.")))
23:12clojurebot["1" "2" "3"]
23:13technomancythe bureaucracy around the process has always left me disinterested
23:13lancepantzso i guess .split coerces strings into regexes
23:14taliostechnomancy: back when you had to rsync everything it was horrible, but now with nexus and the staging stuff, it took me less than 6 hours from emailing @sonatype to having an account/repo setup and synced to central
23:14igmsI got cljr and it works great, but I find that it takes quite some time to start even simple hello world clojure apps. What is the "right" way to run stuff while developing an app w/o waiting every single time for the whole thing to load
23:14igmsI am not using emacs or slime... rather textmate with clojure bundle
23:14slyrususe emacs and slime
23:15technomancytalios: is it that common to have clojure projects that don't already have clojars as a repo though?
23:15slyrusat least that's what the ancient lisp programmers use
23:15igmscould I somehow avoid emacs? :-)
23:15igmsnot really a fan of it
23:15slyrussure, just wait every single time for the whole thing to load
23:16slyrusas you say
23:16taliostechnomancy: probably not, but it's really annoying having a dependency in central that fails because its deps arn't also in central. Even if its a loose dependency for optional functionality
23:16technomancytextmate doesn't really have good subprocess support from what I understand
23:17technomancytalios: oh, because clojure-maven-plugin depends on swank-clojure?
23:17lancepantzigms: i'd keep an eye on this, it's incomplete right now though http://github.com/swannodette/textmate-clojure/tree/cake
23:18taliostechnomancy: yeh, it's a loose dependency as its a forked process, and only when using clojure:swank so not a major blocker, just being a "nice citazen".
23:19technomancytalios: can you submit it, or does it have to be me?
23:19slyrusigms: you might consider trying emacs/slime/paredit for a day. paredit is essential to the way I write code.
23:19technomancyI can add you as a maintainer if that would help. =)
23:20taliostechnomancy: for a non-auto-syncing thing I think we can still submit a "deploy" jira ticket and it'll happen when an admin gets time, i'll see what needs to be done there.
23:20lancepantzigms: http://github.com/ninjudd/cake will do what you want now, it's still immature though
23:21technomancytalios: 1.2.1 has all the "good stuff" in it; I actually don't even really have any plans for it beyond that.
23:21technomancytalios: that would be great; thanks
23:21igmslancepantz: thanks
23:21technomancyfor a single version it's just a jar and a pom; figure it can't be too tricky.
23:24technomancyso... who's interested in publishing Clojure projects that are easy to launch from the CLI?
23:27Scriptortechnomancy: what do you mean, exactly?
23:29hiredmandoes anyone know of a ring middleware that doe http auth?
23:30technomancyScriptor: well for instance now if you install swank-clojure you get a shell script installed that lets you run a standalone server
23:30technomancykind of like cljr
23:31technomancybut any project can bundle a script; it's not limited to the ones that come with cljr
23:33Scriptortechnomancy: hmm, so would this come with a script to manage everything needed to launch the project?
23:34technomancyScriptor: right
23:37technomancyhiredman: I saw something called sandbar that might fit the bill
23:38technomancytomoj: hey, you were asking about read-project?
23:39hugodtechnomancy: I'll take a look at the scripting for pallet
23:39technomancythe answer is basically yes, the mutability is there because we can't depend on defproject being the last form in project.clj, so we can't use the return value of load-file.
23:40technomancyhugod: yeah, I figured you'd be interested. =)
23:40technomancyhugod: right now it only supports one shell wrapper per project. will probably lift that restriction in the future, but not for 1.3
23:41hugodtechnomancy: is the argument parsing flexible?
23:41technomancybut it's super-easy to use; just include :shell-wrapper true in project.clj and it will look for bin/pallet in resources to use as a wrapper, otherwise it will use the default templated script
23:42technomancyhugod: it does clojure.main -e "(use 'foo.core)(apply -main *command-line-args*)" basically
23:42technomancyoh, with a $@ on the end
23:42cais2002how do I test whether a given form is a regular expression?
23:42technomancyhugod: so you can handle it all in clojure. but if the default templated one doesn't cut it, you can include a script in resources/.
23:42cais2002(re? #"test") ==> true
23:44hugodtechnomancy: does the generated script downloads all the dependencies?
23:48technomancyhugod: no, the script gets written out after lein has downloaded the dependencies already
23:48cais2002,(defn isre? [p] (= java.util.regex.Pattern (type p)))
23:48clojurebotDENIED
23:48cais2002-> (defn isre? [p] (= java.util.regex.Pattern (type p)))
23:48sexpbotjava.lang.SecurityException: Code did not pass sandbox guidelines: ()
23:49technomancyhugod: interesting idea though; it wouldn't be too hard to do if you just templated it at script generation time.
23:51technomancyaw hell; just realized the templated script doesn't include transitive deps yet.
23:51technomancyfacepalm
23:53ataggartcan some kind soul please tell me what steps are necessary for one to get changes made in a local text file into github from whence the file was originally cloned?
23:54slyrusgit push
23:55ataggart~/clojure-contrib/ git push
23:55ataggartEverything up-to-date
23:55clojurebotI don't understand.
23:55Scriptorataggart: did you git add it?
23:55slyrusand commit
23:56Scriptorhttp://git-scm.com/
23:56ataggartI edited a file
23:56ataggartthat's the extent of the operations I have performed
23:56Scriptorlook at the instructions at the bottom
23:56Scriptordon't worry about the patch part
23:56slyrustry making sure you've got the local commit showing up properly in the log before considering pushing
23:56Scriptorinstead of format-patch, you want to do git push
23:57technomancyataggart: so you haven't committed yet?
23:57ataggartI'm not clear on what I'm adding
23:57ataggartI checked out the project from github, edited a file.
23:57Scriptorataggart: have you used git before?
23:57ataggarterm, "cloned" whatever the git jargon is
23:58ataggartused insofar as I try to do something, it pisses me off, and I go do something else for a few months
23:58ataggart:)
23:58technomancyataggart: do you use emacs?
23:58ataggartno I have a mouse
23:58Scriptorataggart: ok, then look at http://git-scm.com/, and do as I said above, instead of format-patch use git push
23:58ataggartgit add (files)
23:58technomancyataggart: I was going to say, if not then I agree; I hate using git outside of Emacs too. =)
23:58ataggartI assume that means I'm supposed to specify which files I changed?
23:58Scriptorright
23:58RaynesI actually use the mouse more than I should in Emacs.
23:59ataggartand I have to do that for every file?
23:59ataggartmanually?
23:59RaynesOnly thing I hate about magit is that I always have to make the first push from a terminal, otherwise magit screws stuff up.
23:59Scriptorataggart: you can also do git add .
23:59ataggartok I did that
23:59ataggartno output