#clojure log - Apr 23 2010

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

0:04 livingston: slyphon: you get your code working?

0:22 mmarczyk: livingston: that's a really cool project you were describing earlier

0:22 can't wait to see it :-)

0:23 livingston: thanks

0:24 well it's a lot of open problems in AI combined, so there won't be a "done" for a long time, but the research will go on for a long while

0:25 mmarczyk: I'm inclined to consider this a good side of the endeavour :-)

0:25 livingston: (we have postdoc slots open if you know of anyone looking)

0:26 mmarczyk: where at?

0:26 livingston: UC Denver - CCP (center for computational pharmacology)

0:27 Anyone here ever worked with Jena? (or RDF anything for that matter)

1:34 isn't equals: "content equals" and ==: "pointer equals" (or identity or whatever you want to call it)

1:35 disregard that, wrong channel

2:29 zkim: Does anybody have an opinion on whether it's better to return an empty list, or nil?

2:29 i.e. {:results nil} vs {:results ()}

2:29 carkh: hum let it return what it would normally return

2:30 zkim: carkh: well if it was up to you, what would you do?

2:30 carkh: looks like that's a choice i never have to do

2:31 my guess is that you're doing something wrong if you're asking that question

2:31 what's the context ?

2:32 zkim: ProcessBuilder stuff, basically I'm running a process and collecting the stdout and stderrs into a map:

2:32 for example: la -aul

2:33 carkh: anyways when you're processing the result, being a list or nil doesn't change a thing

2:33 zkim: would return {:out ("drwxr-xr-x+ 108 zkim staff 3672 Apr 23 00:32 .") :err ("")}

2:33 so I'm thinking of turning that empty err result into either an empty list, or nil

2:33 carkh: allright, and how are you getting that list ? (out)

2:33 zkim: reading it from the Process output stream

2:34 carkh: and it might return several lines ?

2:34 zkim: yeah, which I would turn into a list of strings

2:34 carkh: what function are you using to turn it into a list ?

2:34 zkim: String.split

2:35 (seq (.split (:out res) "\n"))

2:35 carkh: ,(seq (.split "" "\n"))

2:35 clojurebot: ("")

2:36 zkim: so that gives '("") on an empty string

2:37 carkh: ,(clojure.contrib.string/partition #"\n" "")

2:37 clojurebot: java.lang.ClassNotFoundException: clojure.contrib.string

2:38 carkh: ,(require 'clojure.contrib.string)

2:38 clojurebot: java.io.FileNotFoundException: Could not locate clojure/contrib/string__init.class or clojure/contrib/string.clj on classpath:

2:38 carkh: ,(require 'clojure.contrib.str-utils)

2:38 clojurebot: nil

2:38 carkh: ah looks like clojurebot is not on latest +P

2:38 zkim: hehe yeah

2:39 guess I'm not either, getting classnotfound on c.c.string

2:39 carkh: me neither, and now the doc is not available =/

2:40 ah got it, anyways same result

2:40 maybe we want to filter empty strings

2:40 zkim: so that would give an empty seq, correct?

2:41 ,(filter (fn [] false) ["hello" "world"])

2:41 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--11080$fn

2:41 carkh: (filter #(not (.isEmpty %)) (seq (.split "" "\n")))

2:41 ,(filter #(not (.isEmpty %)) (seq (.split "" "\n")))

2:41 clojurebot: ()

2:42 zkim: cool

2:42 carkh: looks like en empty list is the natural way !

2:42 zkim: guess I'll go with empty list

2:42 thanks for the help carkh

2:42 carkh: anyways when you want to process it, you'll "seq" it

2:42 do i have errors ? (seq errors)

2:42 zkim: yeah, that makes sense

2:43 Nobody seems to be talking about nil handling in the community, but I'm pretty new to clojure, so maybe it's just a non issue

2:44 carkh: hum but it might be a bad idea to make a list out of your error output to begin with

2:44 zkim: feels more clojureish, instead of a block of text with newlines

2:44 carkh: if you have some error output, you're interested in the full output as a block, not in individual lines

2:45 mmarczyk: actually there is a pretty significant difference between () and nil

2:45 in that the former is true in Boolean contexts

2:46 carkh: yes there is, that's why you always want to seq what could be a list

2:46 mmarczyk: also, ({:foo :bar} :quux) returns nil

2:46 zkim: hmm

2:47 I guess I could see the use case for checking for :err output by doing a (if (:err res) (do-stuff))

2:47 mmarczyk: occasionally it might be useful to do, say, (if-let [val (my-map key)] ...)

2:48 you can't do that when nil is a possible value, you'd have to use find instead

2:48 carkh: zkim: how about having a function that does that check ? it's good practice

2:48 mmarczyk: (or a default return value, if you can guarantee that it in turn will not be present in the map)

2:48 zkim: carkh: yeah, good point

2:48 mmarczyk: in this case, though, when you're holding sequences of errors (or whatever)

2:49 carkh: (defn result-has-errors? [result] (boolean (seq (:err res))))

2:49 mmarczyk: and those sequences are strict anyway, since they were evaluated before being stuffed into the map

2:49 zkim: mmarczyk: wait, i think you just lost me, so the if-let would only work if the check was against an empty list?

2:49 mmarczyk: (finishing the last sentence) I'd use nil

2:50 (answering that last question) yes

2:50 (if-let [v nil] ...) always takes the false branch

2:50 regardless of whether the nil came from not finding a value in a map or finding a nil value

2:50 carkh: ,(get {:foo :bar} :quux :not-found)

2:50 clojurebot: :not-found

2:50 zkim: ah

2:51 mmarczyk: carkh: as I said, that's ok if you know for sure that :not-found is not a possible value :-)

2:51 carkh: well you should know what's in your maps =P

2:51 mmarczyk: true

2:52 I'd add to that that you should know why you're putting nils in your maps, if and when you do

2:52 carkh: if :not-found can be in it, just put something else

2:52 mmarczyk: like nil :-)

2:52 carkh: i think it's bad practice to use nil as a value

2:53 zkim: so a good rule of thumb is empty seq's the default, and nil's the exception?

2:53 carkh: i mean, i never have to put a nil in a map

2:54 zkim: carkh: yeah, and I guess the thing that's bugging me is that I'm worried that an aversion to nil's a bad hold-over habit from java

2:54 actually, it's mainly a lack of info, nobody's talking about it and I'm not experienced enough with clojure to drawn my own conclusions

2:55 carkh: i think your problem comes from making a list out of something that shouldn't be one

2:55 and i actually would put a nil there

2:55 either you have an error or it is empty

2:56 zkim: empty as in nil

2:56 carkh: see that's an implementation detail you shouldn't have to worry about outside your return value building function

2:56 do it one way or the other

2:57 mmarczyk: well, for this particular case you could just do something like

2:57 carkh: but close to that building function, have an has-error? predicate

2:57 mmarczyk: (zipmap [:in :out :err] (map line-seq [process-in process-out process-err]))

2:57 zkim: ,(doc zipmap)

2:57 clojurebot: "([keys vals]); Returns a map with the keys mapped to the corresponding vals."

2:57 mmarczyk: that would give you empty seqs for values in the map and you'd call seq when dealing with them

2:58 or you could (remove empty? (map line-seq ...))

2:58 and I think there's a blank? function in clojure.contrib.string (used to be called c.c.str-utils)

2:59 zkim: yeah, so for now I think I'm going to go with the empty seq, since that seems to be what line-seq would return, and make a has-error? function to deal with checking for errors

2:59 thank you both for your help

3:00 mmarczyk: (if-let [errs (seq (:err your-map))] (had-errors ...) (no-errors ...)) is a possibility too

3:00 zkim: ,(doc if-let)

3:00 clojurebot: "([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yields else"

3:00 mmarczyk: since seq will force enough of your sequence to determine whether it is empty or not

3:00 returning nil if it is

3:01 note binding-form can use destructuring safely

3:01 zkim: man, I think if-let's above my pay grade right now

3:02 mmarczyk: you'll get used to it upon using it for the first time :-)

3:02 zkim: hehe

3:34 cYmen: I have a question about leiningen..sort of

3:34 I want this http://clojars.org/overtone/vimclojure

3:34 sexpbot: "vimclojure | Clojars"

3:34 cYmen: but I don't get what it has to do with leiningen I thought that was a build tool

3:35 mikem: if you add that to your dev-dependencies, it will be placed into your lib/ directory. then you don't have to add its location elsewhere on your system to the nailgun classpath

3:36 cYmen: ^ that's for you :)

3:37 cYmen: aha...so basically I'm changing the project to suite the editor...that seems wrong

3:37 but I don't want to bitch about things I don't half understand so sorry

3:37 Can you instead tell me how to use it? :)

3:37 mikem: it's a development dependency, but you're right, if someone else who uses emacs runs `lein deps` they'll also pull down vimclojure

3:38 cYmen: I'll refer you to this blog post: http://www.deepbluelambda.org/programming/clojure/programming-clojure-with-vim

3:38 sexpbot: " Programming Clojure with Vim : Deep Blue Lambda"

3:41 cYmen: mikem: Thanks!

3:49 zmila: sexpbot

3:52 Licenser_: morning

3:57 LauJensen: Morning all

4:07 Licenser_: morning

4:13 * esj raises his coffee mug in greeting to all

4:14 LauJensen: mmmm coffee

4:17 Licenser_: mmm tea!

4:25 LauJensen: Are there any websites that ship some really excellent tea internationally?

4:28 uberjar: http://www.adagio.com/black/yunnan_gold.html

4:28 sexpbot: "Yunnan Gold Tea"

4:33 LauJensen: Thanks - I'll give it a shot

5:03 hircus: uberjar: ooh, they have several smoky teas, not only Lapsang Souchong! thanks for the link (a bit dubious about their claim that Lapsang is the same as Russian Caravan though).

5:12 Licenser_: LauJensen: hmm hmm

5:13 LauJensen: I buy my tea at https://www.tee-direkt.com/

5:13 sexpbot: "Document Moved"

5:14 Licenser_: but I'm not sure if they ship internationally

5:15 LauJensen: I could probably find the same on a danish site then, since we're so close. I dont

5:16 know anything about tea, except almost everything I've tasted I disliked, except Silver Pearl Jasmin and something called 'London' which I drank while I was in London and extremely thirsty, so I might have been tricked by my senses :)

5:23 Licenser_: LauJensen: I right now drink Dragon Pearl, it's a very nice green tea with jasmin

5:37 zmila: ... changed topic to clojure tea or tea clojure

5:44 Licenser_: Clojure, the Language, the Tea, the live.

5:46 Borkdude: I prefer coffee, but when it comes to tea I like Minty Morocco, no I idea if something like it is available abroad: http://www.pickwick.nl/MintyMorocco.aspx

5:46 sexpbot: " Pickwick NL | Assortiment | Variatie | Minty Morocco"

5:46 LauJensen: Borkdude: I'm 99% a coffee guy, but I have a hunch that tea might be healtier and caffeine does yield addiction

5:47 hircus: LauJensen: teaism.com is quite good too -- they run some really interesting fusion tea rooms in Washington DC. Only place so far I've seen that sells French verbena

5:48 Borkdude: LauJensen, I agree, I'm also aware of the addiction... time for my third cup of home brewn espresso now ;-)

5:48 hircus: scratch that. does not ship overseas

5:48 LauJensen: Traveling to the US might be a bit extreme for a cup of tea, but if its that good I'm open to it :)

5:48 Chousuke: tea has caffeine too though.

5:48 LauJensen: Chousuke: Not all teas, and not in a comparable measure as far as I understood

5:49 Chousuke: http://coffeetea.about.com/library/blcaffeine.htm is what I found via quick googling

5:49 sexpbot: "Caffeine Content of Coffee, Tea, Chocolate"

5:50 LauJensen: white tea is a keeper :)

5:50 Chousuke: I usually drink black tea or coffee... all without any sugar or milk :P

5:50 Borkdude: I try to avoid coffee after 7 PM

5:50 LauJensen: Cow milk is poison anyway, far beyond caffeine :)

5:51 Borkdude: then I drink tea instead

5:52 LauJensen, you are from Denmark right?

5:52 LauJensen: yea

5:52 Chousuke: when I was a teenager I used to put three teaspoons of sugar in a cup of coffee. :P Now the mere thought of drinking such stuff causes a gag reflex

5:53 Borkdude: There is a group from Denmark having kind of a hit here in the Netherlands, Alphabeat, it just came by on the radio hehe

5:54 LauJensen: Ah ok - I dont follow contempory music, or music in general :)

5:54 (or soccer)

5:54 * esj recently succumbed to the aeroccino. Mercy can it make good foam.

5:55 esj: i figure, more foam in cup implies less coffee

5:57 hircus: LauJensen: don't follow soccer much either, and thankfully I've always lived in a city with a lousy local team :)

5:57 * bsteuber is just reading Richs new datatype docs and has two questions so far 1) why are methods in proxy not "true methods" of the resulting type? 2) are there things that can be done using gen-class but not proxy?

5:57 LauJensen: 2) gen-class can add methods, proxy cannot

5:57 Borkdude: esj, we call café latte koffie verkeerd (coffee wrong, literally) here

5:58 LauJensen: and modify constructors

5:58 bsteuber: LauJensen: ah, ok

5:58 LauJensen: ~source proxy

5:58 Chousuke: bsteuber: proxy methods just dispatch to clojure functions

5:58 esj: verkeerd is die verkeerde woord

5:58 Chousuke: bsteuber: so that they can be dynamically updated

5:58 esj: ;P

5:58 LauJensen: and I think re 1) that proxy returns fns, not a literal method - though I dont want to be asked about the difference :)

5:59 Borkdude: ~source slurp

5:59 Chousuke: all proxies of a single class are instances of the same proxy class.

6:00 Borkdude: unable to find...

6:00 Chousuke: they just have a different function map

6:00 bsteuber: Chousuke: but gen-class methods can ba altered as well, can't they?

6:01 *be

6:01 Chousuke: bsteuber: I think so yes. they dispatch to clojure functions too

6:02 bsteuber: ah, guess I just confused topics - was reading 'bout proxy's differences with reify, not gen-class :)

6:02 Chousuke: so I guess I should say that the methods themselves don't change, they just call a clojure function that *can* change

6:03 bsteuber: mhmm, that makes sense to me - thx to both of you :)

6:04 LauJensen: Chousuke: Thats right, also how the dynamic capabilities were achieved

6:04 esj: is there simpler way to wrap a value as a function than (fn [x] value). I often do this in (update-in my-map [my-key] (fn[x] new-value).

6:04 i tried #(new-value) but it complains about arity

6:06 Chousuke: (constantly x)

6:07 Borkdude: esj, you can leave out the x in [x]

6:07 esj: superb, thanks gents.

6:07 Chousuke: no, update-in requires a function of one argument

6:07 Borkdude: really, ok..

6:07 Chousuke: but there's also assoc-in :)

6:08 Borkdude: constantly is a nice thing

6:08 esj: doh

6:11 LauJensen: (btw, Ubuntu 10.04 beta is nice)

6:15 bsteuber: how would I mutate fields in deftype? not that I hope I'll ever want to :)

6:26 nevermind - should just read the docs :(

6:29 cemerick: wow, those new keyword args are sooooo nice.

6:31 Borkdude: cemerick, what are those?

6:31 cemerick: ,*clojure-version*

6:31 clojurebot: {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"}

6:32 cemerick: Borkdude: clojurebot's not using 1.2, but if you are, you can specify keyword args using: (fn [a b c & {:keys [d e f]}] [a b c d e f])

6:33 bsteuber: what's wrong here? (hope 3 lines are ok to paste directly..)

6:33 (deftype Bar [#^{:unsynchronized-mutable true} a b c])

6:33 (def bar (Bar. 1 2 3))

6:33 (set! (. bar a) 42)

6:33 => No matching field found: a for class user.Bar

6:33 cemerick: and you can call that with (foo 1 2 3 :d 4 :e 5 :f 6)

6:33 Borkdude: ^^

6:34 Borkdude: ah like in common lisp?

6:34 cemerick: similar, yes

6:35 bsteuber: oh, overlooked it is only supposed to work in method bodies :)

6:35 Borkdude: that's useful

6:35 gtg

6:44 vu3rdd: LauJensen: did you try the Ubuntu 10.04 beta?

6:50 AWizzArd: ~max people

6:50 clojurebot: max people is 274

6:51 zmila: (filter #(not (lurking? %)) (max-people))

6:52 AWizzArd: or --> (remove lurking? (max-people))

6:54 bsteuber: could a deftype expert correct this? http://gist.github.com/376431

6:58 cemerick: bsteuber: just use (set! a 42)

6:58 killer error msg there though :-|

6:59 bsteuber: cemerick: ah, thx

7:01 in general, unreadable error messages are clojure's weak spot IMO

7:01 hope CinC will help there, too

7:05 Licenser_: hmm is there a lost of core functions?

7:19 cemerick: bsteuber: of course, the deftype impl is fundamentally hosty, and I'd think not in scope for the CinC effort. But yes, I hope, too. :-)

7:19 defn: "OTOH, it makes no sense for a datatype that defines a collection like vector to have a default implementation of map, thus deftype is suitable for defining such programming constructs."

7:20 that line is a bit unclear in the deftype/record documentation

7:21 bsteuber: defn: I interprete this as "you will want to roll your own map implementation, so we don't give you a default one"

7:21 defn: ah okay thanks

7:21 Licenser_: hi defn

7:21 defn: Licenser_: heya buddy

7:21 im actually just about to get some sleep

7:21 will talk to you later

7:21 :)

7:21 Licenser_: tehn rest well

7:21 defn: gnight

7:26 bosie: anyone in here who does NOT use vi/emacs for clojure development?

7:26 cemerick: netbeans + enclojure here

7:26 bosie: ok

7:27 tried IDEA and the clojure plugin?

7:27 cemerick: No, not yet.

7:28 We use the netbeans RCP platform for one project, so that keeps us close to netbeans. I do plan on checking out the eclipse and intellij plugins at some point though.

7:28 nurv: There is a plugin for eclipse too: http://code.google.com/p/counterclockwise/

7:28 sexpbot: " counterclockwise - Project Hosting on Google Code"

7:28 bosie: the intellij plugin is kind of stale

7:28 cemerick: Yeah, counterclockwise looks pretty slick these days.

7:29 bosie: high activity on counterclockwise

7:30 cemerick: bosie: you mean the pace of development?

7:30 bosie: yes

7:30 maybe not pace but at least activity ;)

7:30 cemerick: I used eclipse for years. It'd be funny if I ended up migrating back there.

7:32 bosie: anything you dislike about enclojure

7:32 nurv: Well, for Java code Eclipse is ok.

7:37 bosie: nurv: meaning it isn't for clojure?

7:39 cemerick: bosie: The code outline isn't so great, especially compared to the functionality I'm seeing in CC's screenshots.

7:39 The documentation popups with code completion are unreliable.

7:40 And I could live with more code highlighting options.

7:40 bosie: same problem i have with intellij

7:40 cemerick: But in general, it's a solid plugin.

7:40 The fact that it has a separate embeddable repl server library is a huge win.

7:42 nurv: bosie: i didn't try clojure development on it i'll probably do at some point.

7:42 Although i really liked the Cusp plugin for Common lisp.

7:43 bosie: hmm

7:43 cemerick: heh, cusp was pretty slick

7:43 bosie: as long as i don't have to learn emacs ;)

7:43 cemerick: bosie: what are you using these days?

7:44 bosie: intellij idea

7:44 nurv: I use vim mostly, but there is nothing similar to slime

7:44 bosie: mainly because i use it for java development as well

7:44 nurv: so i fallback to eclipse + cups for CL.

7:44 *cusp

7:45 cemerick: bosie: yeah, it seems that eclipse and netbeans are both better off than intellij w.r.t. clojure support, at least from what I hear.

7:47 bosie: cemerick: and the gap seems to widen because the development of the clojure plugin for idea is sporadic

7:47 kzar: What's a good way to turn a list of strings into one string separated by spaces? (apply str string-list) works except it doesn't add the spaces

7:48 cemerick: ,(apply str (interpose " " ["foo" "bar" "baz"]))

7:48 clojurebot: "foo bar baz"

7:49 cemerick: there's also a join fn in contrib...

7:49 ,clojure.contrib.str-utils2/join

7:49 clojurebot: #<str_utils2$join__7835 clojure.contrib.str_utils2$join__7835@120da23>

7:49 cemerick: ,(clojure.contrib.str-utils2/join " " ["foo" "bar" "baz"])

7:49 clojurebot: "foo bar baz"

7:50 cemerick: str-utils2 has moved to c.c.string in 1.2 contrib though, FYI

7:50 bosie: cemerick: wouldnt apply/interpose iterate twice over the same list?

7:50 cemerick: kzar: ^^

7:50 bosie: No. Interpose is lazy.

7:51 bosie: ah right

7:51 kzar: sweet thanks everyone

7:53 cemerick: bosie: I don't know that intellij could ever keep up with the other IDEs -- the closed-source heritage means there'll always be a smaller community around it.

7:54 bosie: cemerick: yea

7:55 cemerick: I'd love to pay for a super-polished clojure environment. I've got $500 for whoever can make it happen.

7:55 bosie: cemerick: gimme the 500 bucks... and come back in two years ;)

7:55 cemerick: heh

7:56 bosie: cemerick: but yea, depending on your view of 'super polished', that might not happen soon (see the ruby communit)

7:58 cemerick: bosie: well, NB's ruby support is pretty amazing, given the nature of the language.

7:58 But yeah, I see your point.

7:58 we'll see if anyone rises to the challenge: http://twitter.com/cemerick/statuses/12697662057 :-)

7:58 bosie: cemerick: amazing isn't the word i would use though

7:59 cemerick: bosie: really? Given the curve-balls that ruby throws?

7:59 Just writing the grammar for ruby would be a scary undertaking.

8:00 bosie: hehe yea but i don't care for the curve-balls

8:01 if i include a library that extends all classes with specific functions i would like to have them show up in the completion table

8:03 i doubt you can write grammar rules for that

8:03 cemerick: Yeah, that requires a running environment for introspection.

8:04 bosie: or an understanding of ruby code

8:04 cemerick: well, building up the understanding necessary to add those fns to the completion table that you added to the string class (or whatever) would require a running environment.

8:05 if monkey-patching were declarative, that might not be the case

8:06 bosie: cemerick: hmmm why do i need a running environment? you can only add methods with a handful of methods

8:11 cemerick: bosie: Yeah, you could probably figure out the common cases. If ruby's anything like python though, you can add or replace methods via references to classes, so a static analysis won't catch everything if you're not doing something simple as string.mymethod = ....

8:12 bosie: cemerick: i gotta go, thanks for the talk

8:17 zmila: cemerick, what are criterion of "super-polished clj env"

8:18 cemerick: rhickey: FYI, real usage of kwargs has convinced me of it entirely. Don't know how I lived without it before. :-)

8:18 rhickey: cemerick: kwargs?

8:18 cemerick: zmila: I suppose I should formalize my wishlist somewhere. :-)

8:18 rhickey: keyword rest args

8:19 rhickey: ah, great!

8:23 borkdude: does anyone here synchronize their .emacs file with git?

8:23 rfg: borkdude: I've committed mine to memory.

8:25 fogus: borkdude: Mine is 1-line. ;-)

8:27 borkdude: fogus, tell me the line ;)

8:28 fogus: (load-library "~/.emacs.d/init.el")

8:29 :p

8:29 _ato: ls: cannot access /home/ato/.emacs: No such file or directory

8:29 borkdude: but to answer your question, yes

8:30 bsteuber: borkdude: me, too

8:30 _ato: my whole home directory is a git checkout

8:30 hircus: _ato: even music files and videos?

8:30 fogus: _ato: I have a similar error ls: cannot access ~/.vimrc: No such file or directory ;)

8:31 bsteuber: my .gitignore is very restricted, though :)

8:31 borkdude: fogus: I was hoping for: (tool-bar-mode -1)

8:31 SynrG: fogus: how did your system get so broken?

8:31 hircus: I have several git repos for ~/bin and several other dirs but not the entire home dir

8:32 _ato: hircus: nah, it's pretty selective, I keep notes, configuration, ~/bin in main home dir git. Some things have seperate repos, like emacs configuration

8:32 fogus: borkdude: I use Aquamacs

8:33 rfg: fogus: What version of Aquamacs do you use?

8:33 _ato: I use a wrapper script "hgit" which sets GIT_DIR so I don't accidentally commit stuff to my home directory git went I meant to commit to a project or something

8:34 fogus: rfg: 1.9

8:35 I'm not married to Emacs for all of my development though. I use it a lot, but for Java, Scala, and Python work I use other things

8:36 chouser: _ato: brilliant. I have all that except for the hgit script.

8:45 _ato: oh and the other bit you need is: git config core.worktree /home/ato

8:46 then you can move the .git somewhere else

8:46 and the regular git command won't find it unless you explicitly set GIT_DIR at the path you moved it to

8:48 LauJensen: vu3rdd: Yea I'm on it now

8:48 (ubuntu 10.4 that is)

8:48 vu3rdd: LauJensen: Ok

8:49 LauJensen: I thought you were on OSX

8:49 LauJensen: No I cant stand the thing

8:49 vu3rdd: :)

8:49 http://www.flickr.com/photos/jonobacon/4543428023/sizes/l/

8:49 sexpbot: "Flickr Photo Download: screenshot"

8:49 borkdude: LauJensen: I just installed Ubuntu 9.10 on this laptop, any good reasons to upgrade to 10.4 right now?

8:50 LauJensen: borkdude: No then you might as well wait until it goes out of Beta, but expect something like a 60 - 70% drop in boot time an finer social networking integration

8:51 borkdude: It looks like my webcam is turned on by default in Ubuntu, are they spying on me?

8:51 LauJensen: I dont know, are you good looking ? :)

8:51 I haven't experienced that behavior, though I have a built in web cam

8:52 borkdude: me2

8:52 vu3rdd: borkdude: what do you mean by turned on?

8:53 borkdude: the led is burning, I think it doesn't do that in windows

8:53 vu3rdd: ok.

8:54 Usually when the driver is loaded, the led turns on. so perhaps that is what you are seeing

8:54 sudo lsmod | grep uvcvideo

8:55 you can rmmod it if you are concerned

8:56 borkdude: vu3rdd: lsmod didn't return a line

8:56 vu3rdd: ok, may be your webcam is not uvc camera

9:12 mmarczyk: LauJensen: www.whittard.co.uk have good leaf teas and ship them everywhere

9:12 sexpbot: "Whittard of Chelsea - Tea , Coffee , China , Teapots , Tea Sets"

9:31 bendlas: I need an informed opinion on servers before learning a specific one:

9:32 I want to write a webservice with comet/long-polling

9:32 which server would you recommend as a technical basis for that?

9:34 w.r.t clojure support, although i don't mind writing some framework of my own

9:35 my first sample was jetty with blocking, which of course, is not very scalable

9:37 AntonyBlakey: bendlas: have you looked at Netty?

9:37 I've used it from Clojure

9:38 bendlas: i'm aware of it's existance, but i don't know how it compares to the alternatives

9:38 is it any good?

9:38 AntonyBlakey: It seemed so to me.

9:38 neotyk: bendlas: please check atmosphere project

9:40 it will run comet on all servers, and if server has native api for it or supports servlet 3.0 you'll get native performance

9:40 and we would appreciate a lot clojure support ;-)

9:40 bendlas: nice, i'll check it out

9:41 patrkris_: rhickey: just out of curiosity, are there any planned changes to the STM?

9:41 bendlas: thanks

9:43 hamza: does the agents and future objects use the same thread pool? or two seperate pools?

9:43 cemerick: neotyk: atmosphere looks interesting, thanks for the pointer

9:44 hamza: same, IIRC

9:44 patrkris_: hamza: depends on whether you use send or send-off, I guess

9:44 chouser: futures use the send-off pool

9:44 patrkris_: yes

9:44 neotyk: cemerick: pleasure is mine, just spreading the word of project I contribute to

9:46 hamza: ohh kk, i was using send pool for some blocking actions and was wondering if futures gets blocked, then i am fine..

9:47 bsteuber: neotyk: for the less gifted ones among us, for what exactly can I use atmosphere?

9:49 is it some sort of high-level web application framework?

9:49 neotyk: bsteuber: comet applications, broadcasting in http, pub-sub, long polling, and ajax push

9:49 this is framework that provides one API to do comet

9:50 and allows you deploy to 'any' servlet container

9:50 'any' as it makes sense to deploy to one that has comet api available

9:52 so if you would write comet app for jetty you would not be able to run on grizzly, tomcat, jboss, you name it, by using atmo you can, plus you get higher lever functionality like broadcasting

9:52 does that make sense?

9:53 bsteuber: neotyk: yes, at least enough to be motivated for further investigation

9:54 neotyk: cool

9:54 bsteuber: but it seems quite annotation-heavy - isn't that a problem with clojure?

9:54 neotyk: you have two ways to work with it: Jersey like and it is annotations, and api like

9:54 borkdude: it turns out my webcam isn't supported in linux yet I guess: http://linuxlaptopwiki.net/wiki/ALi_Corp_M5602

9:54 sexpbot: "ALi Corp M5602 - LinuxLaptopWiki"

9:55 borkdude: not that i want to use it, I just want to turn that damn led off

9:56 neotyk: bsteuber: you know java people like annotations a lot

9:57 but we have it used in akka, that is scala application

9:57 bsteuber: neotyk: ic, nice

9:57 neotyk: I was thinking of integrating it as middlewere for compojure, but I lack Clojure foo

9:59 bsteuber: so atmosphere includes some javascript-generation like JWT, too?

9:59 neotyk: bsteuber: mew release should have JQuery integration, but it is not forced on user

10:01 bsteuber: mew?

10:01 neotyk: s/mew/new/

10:01 rhickey: patrkris_: I have ideas for STM - knobs for retries/timeouts etc per-transaciton, also some ideas around transaction timestamps

10:01 bsteuber: ok

10:03 patrkris_: rhickey: anything you want to share that we can maybe do some prototyping with? we're doing a little benchmarking on the stm and trying to find out the effects of different changes.

10:03 rhickey: patrkris_: no code yet

10:03 patrkris_: rhickey: ideas would be fine - we don't mind coding a little ourselves :)

10:04 rhickey: but if you don't have the time, that's ok - we have some papers we're looking through

10:05 rhickey: patrkris_: what do you want that it doesn't do?

10:05 bsteuber: neotyk: JQuery looks nice

10:06 patrkris_: rhickey: nothing in particular. We're just looking at the STM litterature and seeing if we can find something we could try out on Clojure's STM. Just to see the effects in a few small benchmarks we have written. Nothing fancy.

10:07 rhickey: patrkris_: one obvious area is contention-resolution, which is currently hardwired to oldest-transaction-wins

10:07 patrkris_: rhickey: cool, noted

10:14 rhickey: R. Mark Volkmann's page about Clojure's STM notes that you were inspired by the Robert Ennals article (noted at the section about blockAndBail). Where does he know this from? Did he just ask you, or is it described somewhere?

10:16 rhickey: patrkris_: I just mentioned it at some point

10:25 patrkris_: rhickey: just one more question, and you'll have to excuse me, because I'm a little confused: does Clojure's STM exhibit obstruction freedom or does it not?

10:25 rhickey: not

10:28 npoektop: Hi! I have a question about compojure. From flash i do file["postData"] = "sid=..."; file.upload(urlRequest, "image", true); How to get that postData in compojure?

10:31 AWizzArd: npoektop: the client (be it the browser (html&js) or flash or any other application with network access to your app) must send the data over http. There it can be encoded in the header or body. In Compojure each handler gets a request hashmap. In that you can find all data which the client sent

10:32 npoektop: AWizzArd, ok, i'll try. thank you

10:33 hugod: is there a function to return the namespace of a symbol?

10:40 wooby: i have some functions that take vectors as args

10:40 dnolen: hugod: namespace if it's a namespaced symbol, otherwise you may have to look at the metadata of the var.

10:40 wooby: and i'm dispatching based on whether one of the items is a keyword starting with a question mark

10:40 dnolen: ,^#'defn

10:40 clojurebot: {:macro true, :ns #<Namespace clojure.core>, :name defn, :file "clojure/core.clj", :line 206, :doc "Same as (def name (fn [params* ] exprs*)) or (def\n name (fn ([params* ] exprs*)+)) with any doc-string or attrs added\n to the var metadata", :arglists ([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?])}

10:40 wooby: is this the sort of thing that deftype and all the new stuff are looking to simplify?

10:41 bsteuber: wooby: no, deftype etc. are for performance mostly

10:41 hugod: dnolen: thanks, I forgot about metadata

10:42 wooby: alrighty, thanks bsteuber

10:43 hugod: dnolen: but that only works if you have a var...

10:43 dnolen: hugod: then namespace should work right?

10:44 hugod: on an arbitrary symbol?

10:45 dnolen: hugod: but where is the symbol coming from? sounds like your doing something fancy with macros?

10:45 hugod: oh, it does work

10:45 dnolen: from a string...

10:58 ivenkys: gents - simple question - what is the name of the ^ symbol ? (google-fu not working)

10:59 dnolen: ivenkys: meta

10:59 ivenkys: i.e. the metadata symbol

11:00 Chousuke: note, it's deprecated

11:00 ivenkys: dnolen: thanks

11:00 Chousuke: instead of ^foo you're now supposed to write (meta foo)

11:00 ivenkys: Chousuke: meta symbol is deprecated ?

11:01 dnolen: ivenkys: in 1.2.0 yes

11:01 Chousuke: yeah, it'll eventually be changed to do what #^ does now.

11:01 chouser: yes, it's eventually going to become the set-metadata symbol

11:02 ivenkys: Chousuke: chouser: thanks

11:23 lessthantristan: ok i have some code that looks something like this: http://gist.github.com/376581 (this is the most basic version i could write that still has the problem).

11:24 basically, if the recursive function finds something it doesn't like it'll throw an exception. if the exception is not a ParseException and a :catch-error element is present in the input, it will handle the error otherwise it throws it down to the stack which checks the same thing.

11:24 The problem is that the exception gets wrapped in RuntimeExceptions as it goes down the stack so the = class call stops working after the initial throw. anyone got any ideas on how to fix this?

11:34 raek: I think that when lazy seqs are evaluated, checked exceptions are caught and a runtime exception is thrown

11:35 if the exception is not checked (i.e. inherits from Error or RuntimeException) it will pass through, I think

11:35 lessthantristan: hmm it might be something to try (in my real code i am using custom exceptions)

11:37 chouser: lessthantristan: you probably want to use the root exception rather than the one 'catch' hands you

11:37 in your = I mean

11:38 clojure.stacktrace/root-cause

11:40 lessthantristan: ah ok i'll have a look at that too

11:41 livingston: I'm not sure of the context (I joined in the middle of this conversation), but java Exceptions also have a getCause method that you can chain through

11:41 lessthantristan: btw. i changed my exceptions to extend Error rather than exception and this makes the code run how i want

11:41 livingston: it's good practice in java if you catch and re-throw to set the cause to the caught exception

11:42 extending Java Error? i don't know about in Clojure, but in Java that's bad practice, you should extend the leaf types, like RuntimeException

11:44 lessthantristan: sure. it's probably just as bad in clojure :). i'll have a look at chouser's idea. (btw, for context http://gist.github.com/376581 description in the comments)

11:44 chouser: ,(try (seq (lazy-seq (throw (NoSuchMethodException. "foo")))) (catch Throwable e (printf "Caught %s, root %s\n" (class e) (class (clojure.stacktrace/root-cause e)))))

11:44 clojurebot: chouser: It's greek to me.

11:45 chouser: oh, it doesn't let you do try/catch

11:45 livingston: again this is from Java, but catching Throwable is a really bad idea

11:46 That will catch Errors, and Checked and Unchecked Exceptions, (catching Exception is just as bad, because that traps both checked and unchecked)

11:48 lessthantristan: so i guess if you're making your own exception classes you would extend something like RuntimeException then catch that (if you're interested in just catching all your custom exceptions)?

11:49 livingston: exactly

11:50 livingston_: my stupid office blocks IRC because "only hackers use that" so I have a bad web client...

11:50 lessthantristan: chouser: that code runs in the repl. maybe clojurebot doesn't have clojure.stacktrace required?

11:51 livingston_: I don't know what i missed

11:51 slyphon: livingston_: wow, that's piss poor

11:51 livingston_: actually, nothing :)

11:51 mmarczyk: livingston: isn't your office *supposed* to be a hackers' workplace? :-)

11:51 livingston_: but if you want to make your own exceptions you should extend Exception or RuntimeException

11:51 chouser: lessthantristan: clojurebot refuses to run code that includes 'try'

11:51 lessthantristan: ah ok

11:52 chouser: I had forgotten

11:52 livingston_: mmarczyk: yes, kinda it's hard when there are only a few CS people in a sea of people that know nothing about computers

11:52 lessthantristan: :)

11:53 livingston_: re exceptions, it's also preferred to use the existing ones when they do fit (there are a lot of standard ones)

11:53 mmarczyk: may I suggest that you exploit your superior knowledge to subvert the IT policy to your advantage? ;-)

11:54 livingston_: mmarczyk: it is very draconian here - there are forms to be filed to use skype, because "why wouldn't you use our conference call lines?" (which aren't free by the way)

11:55 mmarczyk: Monday's mission is get 6667 unblocked

11:55 mmarczyk: oh, that's rather extreme :-(

11:55 dakrone: livingston_: tunnel through SSH?

11:56 mmarczyk: here's hoping you accomplish that

11:56 livingston_: dakrone: I can, I would need somewhere that would forward for me though, and I've never gotten around to setting that up

11:57 mmarczyk: ,(= '(1 2 3) [1 2 3])

11:57 clojurebot: true

11:57 mmarczyk: is this really by design?

11:57 chouser: mmarczyk: yes

11:57 replaca: livingston_: I keep a linux machine running at home so I can tunnel from anywhere I am - it's super-convenient

11:57 chouser: ,(= '(1 2 3) (range 1 4))

11:57 clojurebot: true

11:57 mmarczyk: hm, thanks, good to know

11:57 chouser: (map class '(1 2 3) (range 1 4))

11:57 ,(map class '(1 2 3) (range 1 4))

11:57 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$class

11:58 chouser: ,(map class ['(1 2 3) (range 1 4)])

11:58 clojurebot: (clojure.lang.PersistentList clojure.lang.LazySeq)

11:58 mmarczyk: I don't think I mind

11:58 dakrone: livingston_: I understand your situation, I have to tunnel IRC through SSH through SSL to get mine working

11:58 replaca: livingston_: also, I can use it a secure web proxy when I'm on open wireless

11:58 mmarczyk: but I do wonder about the rationale?

11:58 livingston_: replaca: yeah I might resort to that - how do you get a static address?

11:58 tcrayford: is there a function to drop every other element of a seq?

11:58 livingston_: I haven't even set up home internet yet, I just moved

11:59 mmarczyk: (actually, I seem to be experiencing a moment of enlightenment whereby this starts to make sense)

11:59 chouser: mmarczyk: clojure tries to avoid relying on concrete types as much as possible. You see that '(...) and (range ...) return different types?

11:59 mmarczyk: yes

11:59 true

11:59 chouser: mmarczyk: you usually don't care that they're different, even when using =

11:59 mmarczyk: and then I seem to remember clojure.lang.Cons being used by the reader?

12:00 ok, starts to make sense

12:00 thanks

12:00 chouser: mmarczyk: so Clojure partitions collections into three groups for purposes of equality: lists, sets, and maps.

12:00 ,(take-nth 2 (range 10))

12:00 clojurebot: (0 2 4 6 8)

12:00 chouser: tcrayford: ^^^

12:00 tcrayford: yeah, cheers

12:00 was doing something horrible with indexed

12:01 mmarczyk: ,(= {0 0 1 1} [0 1])

12:01 clojurebot: false

12:01 tcrayford: tests still pass, so its good, cheers

12:01 chouser: mmarczyk: we go to lengths to explain this as best we can in Joy of Clojure.

12:01 mmarczyk: yup, I'm reading through it

12:02 great reading so far, by the way

12:02 tcrayford: is work on clojure-in-clojure starting after 1.2?

12:02 chouser: mmarczyk: oh, great. early in chapter 4 then. :-)

12:02 mmarczyk: :-)

12:03 chouser: tcrayford: 1.2 *is* work on clojure-in-clojure, to a certain extent.

12:03 tcrayford: I guess so

12:04 chouser: I want to start poking at pieces of it as soon as this book's out of the way.

12:04 tcrayford: heh

12:04 the book is much better this iteration

12:04 slyphon: ok, can someone explain why ~foo# in a macro doesn't compile?

12:04 tcrayford: compared to the first one

12:04 chouser: tcrayford: ah, good. glad to hear it.

12:04 livingston_: so java has the edu.univ.lab.package ... mostly standard naming convention

12:04 hiredman: slyphon: # gensyms only work inside syntax-quote and ~ is unquote

12:04 mmarczyk: slyphon: because gensyms created with # are only valid within the syntax-quote their created in

12:05 livingston_: is clojure kinda sticking to that? or is it just the wild-west for package names?

12:05 * slyphon considers this

12:05 chouser: livingston_: depends on who you talk to. I'd recommend sticking with Java conventions.

12:05 mmarczyk: livingston: most Clojure libs I use follow the packagename.core, packagename.foo convention for naming namespaces

12:06 * tcrayford needs to rework refactoring-mode to have proper namespaces

12:06 mmarczyk: oh well :-)

12:06 livingston_: chouser: that's what I figured, probably makes java interop a hair better too?

12:06 mmarczyk: slyphon: so, have you figured out why your macro didn't work as originally written?

12:06 chouser: mmarczyk: and if someone else also uses packagename, stride out into the street at high noon and have at it.

12:06 :-)

12:07 slyphon: mmarczyk: yeah, but it turns out our version didn't work as expected outside of that ns

12:07 mmarczyk: chouser: hell yeah, the jerk should have known better ;-)

12:07 livingston_: mmarczyk: yeah but then who gets dibs on rdf or sql or whatever library standard names, etc..

12:07 lessthantristan: hah. with clj.stacktrace, the final exception becomes a java.lang.reflect.InvocationTargetException (e.g. my solution under http://gist.github.com/376581 below line 25). it doesn't matter if i keep using root-cause but i wonder where that's coming from

12:07 mmarczyk: slyphon: how come?

12:08 * slyphon goes to check

12:08 LauJensen: mmarczyk: thanks! :)

12:08 mmarczyk: livingston: first come, first to fortify one's positions ;-)

12:08 LauJensen: sure thing :-)

12:08 * bsteuber just orders Joy of Clojure

12:09 chouser: bsteuber: yay! :-)

12:09 mmarczyk: LauJensen: I find the "Orangajuli" (spelling?) Assam to be particularly good, if they still have that

12:09 livingston_: lessthantristan: just remember if you catch Exception you will get *all* of them even a lot of runtime ones you might not want to trap

12:09 s450r1: tis a very good book, nice sequel to "Programming Clojure"

12:09 * slyphon boggles

12:09 tcrayford: is the only difference between rest and next that next returns nil on empty seqs?

12:10 ,(rest [])

12:10 clojurebot: ()

12:10 slyphon: mmarczyk: ok, that seemed to work

12:10 tcrayford: ,(next [])

12:10 clojurebot: nil

12:10 slyphon: mmarczyk: i thought i ran into trouble with it

12:10 mmarczyk: um, apparently they don't, but http://www.whittard.co.uk/store/catalogue/Tea-P2000/India-TIND/Loose-Harmutty-Gold-Tips-105668.raa is close

12:10 sexpbot: "Tea &gt; India - Whittard Of Chelsea"

12:11 mmarczyk: slyphon: so it works now? happy to hear that :-)

12:11 livingston_: tcrayford: yeah, I was trying to sort that out too, and what's preferred, i've been seeing different descriptions that have confused me

12:11 slyphon: mmarczyk: must have been stale repl state last night...or the beer...

12:11 mmarczyk: :-)

12:13 slyphon: i think i'm still not really sure what the syntax quoting is doing, i mean, in general. it seems like a lot of macros open with a `(), and then do escaping throughout, but there are others like your solution

12:13 tcrayford: technomancy: I think there might be a bug with that xref patch I sent you

12:15 mmarczyk: slyphon: oh bother, I just realised that that macro will fairly often *not* work

12:15 slyphon: oh?

12:15 mmarczyk: because it assumes it's being passed a map literal for props-map

12:15 slyphon: ah! yes!

12:15 that was it

12:15 mmarczyk: so (update-bean *bs* some-var-holding-a-map)

12:15 won't work

12:16 right, let's fix that

12:16 slyphon: why does that happen?

12:16 technomancy: tcrayford: oh, good thing I've been too busy to apply it then. =)

12:16 tcrayford: heh

12:16 technomancy: I think it doesn't work on any project other than swank

12:16 I THINK

12:16 I could kinda use some testing though

12:17 either that or I've been compiling it wrong

12:17 slyphon: so `() is kind of like "make a form that looks like *this*" and ~blah substitutes the value held by blah into the form?

12:17 tcrayford: yes

12:18 * slyphon nods

12:18 slyphon: ok

12:18 mmarczyk: slyphon, first see http://gist.github.com/376105

12:18 for a proposed fix

12:18 slyphon: kk

12:18 tcrayford: technomancy: when I try to compile it, (even after changes), it shows that all namespaces are already compiled

12:18 slyphon: mmarczyk: ahh, yeah

12:18 mmarczyk: technomancy: Leiningen seems to be pulling two version each of ant and ant-launcher

12:18 slyphon: makes sense

12:19 mmarczyk: is this a known issue (or do I need to check my local maven repo or sth)

12:19 ?

12:19 livingston_: if that macro isn't taking constants in, you really should probably just be using a regular function - being a macro isn't buying you anything if there is nothing to pre-compute

12:19 mmarczyk: slyphon: the macro receives its argument "as is"

12:19 livingston: you can't use a regular function here

12:20 slyphon: right right, it's not getting "the value of"

12:20 mmarczyk: because you need to expand into . forms

12:20 livingston_: slyphon: regarding macros in general the syntax quote is nothing special, it's short hand - you can write macros just fine without out. think about this:...

12:20 mmarczyk: which need to include your custom-generated symbols

12:20 the shape of which depends on the map you pass in to the macro

12:21 technomancy: mmarczyk: there's probably a dev-dependency that is declaring unnecessary deps.

12:21 tcrayford: technomancy: tell a lie, I hadn't compiled it properly

12:21 slyphon: livingston_: yeah, i know it's the inverse of the 'form

12:21 livingston_: if you have the code (+ foo bar) that is just a list of three symbols if you want a macro to produce that code it's just: (list + foo bar)

12:21 tcrayford: technomancy: just tested it on all of the clojure projects I use swank on, all of them work

12:21 mmarczyk: technomancy: guess so, I'll investigate

12:21 technomancy: mmarczyk: in fact, I think the swank plugin might do that.

12:21 slyphon: livingston_: *nod*

12:21 technomancy: mmarczyk: could you submit an issue or patch?

12:21 mmarczyk: will do

12:22 technomancy: tcrayford: does your patch need AOT?

12:22 we try to avoid it if possible?

12:22 err--possible.

12:22 tcrayford: I don't think so, was just putting it as a dependancy for other stuff via lein jar

12:22 slyphon: argh

12:22 mmarczyk: incidentally, why would the swank-clojure dev dep ever be possible

12:22 slyphon: mmarczyk: "Can't eval locals"

12:22 livingston_: slyphon: so just start with an example of the code you want to come out and then think about the what you need to cons together to produce that list/tree of symbols.

12:22 tcrayford: I think I'm just being bad with terminology

12:23 mmarczyk: I never remember remember about it and yet it always works :-)

12:23 slyphon: ouch, one more fix then

12:23 just a sec

12:23 slyphon: sure

12:23 hm

12:24 tcrayford: technomancy: currently it seems to be bugging out on some symbols. It works fine with defn, but not with if

12:24 technomancy: tcrayford: defn is a var, but if isn't

12:25 it's a special form

12:25 tcrayford: ah

12:25 technomancy: so that's OK

12:25 tcrayford: that'd explain that one, seeing as I get stuff from vars

12:25 technomancy: yeah, trying to track down every use of a special form would be pretty hardcore, but we can do without it. =)

12:25 tcrayford: heh

12:25 mmarczyk: slyphon: could you test this new version?

12:25 slyphon: sure

12:26 what's &env ?

12:27 tcrayford: technomancy: it probably needs proper error messages. Currently it'll mess up if it can't find any references (you get a char-or-stringp error from emacs)

12:27 mmarczyk: &env is an implicit argument that macro functions receive

12:27 holds a map of locals

12:27 slyphon: ahh

12:28 mmarczyk: actually, I'll modify the code a little bit yet

12:28 slyphon: so (&env props-map) is kind of like (a-hash-map :key) ?

12:28 tcrayford: technomancy: and it only works after each namespace is actually loaded (as far as I can see).

12:28 mmarczyk: done

12:28 slyphon: ahhh

12:28 right on

12:29 mmarczyk: slyphon: exactly, and (get &env props-map) is immune to NPE

12:29 slyphon: so &env is a hash of local symbols-to-values

12:29 :)

12:29 mmarczyk: right, but will be nil if there are none

12:29 * slyphon nods

12:30 mmarczyk: basically this macro makes the assumption that props-map is either a map literal or a symbol naming either a local or a Var

12:30 and locals win over Vars, as they should

12:30 * slyphon nods

12:30 slyphon: wow

12:31 mmarczyk: great, now I'll have an update-bean macro lying around

12:31 for whenever I get the point of beans

12:31 :-)

12:31 slyphon: this was way more involved than i'd originally thought

12:32 mmarczyk: beans are just java's way of adding an unnecessary layer of indirection around objects

12:32 mmarczyk: sounds like fun :-)

12:32 slyphon: it's just the convention of getThatThing() setThatThing()

12:32 to change the internal state of an object

12:33 mmarczyk: right

12:33 hm, actually

12:33 perhaps this could be a function if we used reflection instead of .

12:33 slyphon: to be consistent with their total contempt for elegant syntax

12:33 mmarczyk: well, the 'bean' function uses reflection

12:33 mmarczyk: makes perfect sense ;-)

12:33 slyphon: but i didn't want to go there

12:34 :)

12:35 AWizzArd: http://hughw.blogspot.com/2009/01/clojure-vs-javafx-script-only-5x-slower.html

12:35 sexpbot: "Messages not Models: Clojure vs JavaFX Script: only 5x slower!"

12:36 livingston_: AWizzArd: it says "after normalizing to so-and-so's machine speed" - that benchmark is pretty suspect

12:37 same cpu? same os? same ... ?

12:38 AWizzArd: well, you can try to check tak in java vs tak in clojure on your own machine

12:38 Licenser: hmm hmmm

12:38 chouser: all the code on that page is using boxed math

12:39 slyphon: what's the function that lets you assoc into a nested map?

12:39 mmarczyk: assoc-in

12:39 tcrayford: ,(doc assoc-in)

12:39 clojurebot: "([m [k & ks] v]); Associates a value in a nested associative structure, where ks is a sequence of keys and v is the new value and returns a new nested structure. If any levels do not exist, hash-maps will be created."

12:39 slyphon: mmarczyk: thanks

12:40 i thought so, it wasn't in the cheatsheet though :)

12:43 livingston_: there was a change made to lein so you can put some dependencies not managed by maven in a directory and they would get on the classpath.. is there docs on that anywhere (I'm having trouble finding it)

12:44 mmarczyk: livingston: whatever you put in lib/ will be on the classpath

12:44 you don't need a patch for that

12:44 well, actually any jar you put in lib/

12:44 livingston_: yeah but lein clean will destroy it

12:45 mmarczyk: hm, right

12:45 you could work around that with a script to create some symlinks

12:45 not very clean though

12:47 joshua-choi: ,(doc deftype)

12:47 clojurebot: "([type-tag constructor-name docstring? attr-map?] [type-tag constructor-name docstring? attr-map? constructor] [type-tag constructor-name docstring? attr-map? constructor deconstructor]); Define a data type by a type tag (a namespace-qualified keyword) and a symbol naming the constructor function. Optionally, a constructor and a deconstructor function can be given as well, the defaults being clojure.core/identity and cloj

12:48 AWizzArd: how can I use recur in an implementation of a protocol?

12:49 I have a (defprotocol Takkable (tak [t])). Now I implement (tak [this] ... (recur (Tak. ...)))

12:49 Now I get a: Mismatched argument count to recur, expected: 0 args, got: 1

12:50 joshua-choi: I remember reading somewhere that you don't pass on the first argument.

12:50 AWizzArd: where (deftype Tak [x y z] Takkable (tak [this] ...))

12:51 The first arg is supposed to be an instance of Tak

12:51 not deftype but defrecord

12:51 (defrecord Tak [x y z] Takkable (tak [this] ...))

12:51 And tak wants to recur, with an updated instance of (Tak. ...)

12:51 joshua-choi: Ah yes, check defrecord's docs.

12:52 "Note also that recur calls to the method head should *not* pass the target object, it will be supplied automatically and can not be substituted."

12:52 AWizzArd: Yes.

12:53 So I must recur to the immutable instance with which the function started?

12:53 I can not alter the "this" arg itself then?

12:53 vu3rdd: technomancy: did you get a chance to look at the swank-clojure patch I sent you?

12:53 Chousuke: AWizzArd: you'll need another arity for that

12:54 joshua-choi: Is there a set of naming guidelines for Clojure?

12:54 Specifically, for factory functions and protocol methods

12:55 Chousuke: protocol methods are named just like ordinary funcitons

12:55 functions*

12:55 factory functions are either make-foo or create-foo I guess

12:55 joshua-choi: Yeah, but what do you name them? "make-"? "create-"?

12:55 Yeah.

12:55 clojure.core uses both.

12:55 hiredman: fooify

12:55 joshua-choi: clojure.core also uses "vector", "vec", etc.

12:56 Chousuke: it depends on what you're constructing I suppose.

12:56 AWizzArd: make- is closer to the Lisp family's history.

12:56 joshua-choi: AWizzArd: That's good to know.

12:57 Chousuke: Something called a "State". (make-state ...) (create-state ...) (state ...).

12:58 Also, what about protocol methods? If I make a "getter" method for an "answer", should I name the method (get-answer ...), (answer ...), or something else?

12:58 rsenior: hi all

12:58 joshua-choi: rsenior: Hello hello

12:58 rsenior: is anyone persisting blobs with clojureql?

12:59 arohner: didn't someone make a macro that is defn, but it takes a map, to make it easier for macros calling defn?

12:59 AWizzArd: joshua-choi: do you think you need a getter?

12:59 Chousuke: joshua-choi: is the answer a property of the object, or something that's actually computed?

12:59 joshua-choi: AWizzArd: Versus using a keyword directly on a record?

12:59 AWizzArd: yes

13:00 joshua-choi: Probably yes, because I have different types of records that implement this protocol.

13:00 AWizzArd: http://clojure.org/datatypes

13:00 joshua-choi: For some types of those records, it's not a simple attribute.

13:01 Borkdude: Has anyone got ClojureCLR working?

13:01 Chousuke: then maybe compute-answer or just answer

13:01 get doesn't really convey anything useful

13:01 AWizzArd: On this site rhickey wrote: "It has always been an unfortunate characteristic of using classes for application domain information that it resulted in information being hidden behind class-specific micro-languages, e.g. even the seemingly harmless employeee.getName() is a custom interface to data."

13:01 Licenser: odd compairison

13:02 joshua-choi: AWizzArd: The problem is that some records need to return themselves with this method, while others return an attribute.

13:03 Chousuke: The problem with not using "get-" is that it can (and in my case does) conflict with using "answer" as a binding symbol in let forms.

13:03 Chousuke: what is it an answer to, then?

13:03 joshua-choi: But I'm not saying I have to; I'm asking if I should change it. :)

13:03 technomancy: vu3rdd: sorry, been pretty swamped recently. hopefully I can get back to swank next week.

13:03 joshua-choi: Chousuke: Oh, some parsing thing. Ignore that it's called "answer"; it could be called anything.

13:04 vu3rdd: technomancy: no problem.

13:05 Chousuke: joshua-choi: hmmh. in any case, it doesn't sound like a getter

13:05 joshua-choi: so maybe you can find a real function name for it

13:06 AWizzArd: joshua-choi: is it for the hound? ;)

13:06 Chousuke: apply-parser or apply-rules or whatever your object actually represents

13:06 joshua-choi: AWizzArd: It's for both the Cat and Hound. Actually, it's for the common code between them.

13:06 AWizzArd: k

13:06 Chousuke: would those be methods of the Protocol?

13:07 Chousuke: AWizzArd: I don't see why not

13:07 joshua-choi: AWizzArd: I'm actually almost done...after I rewrite find, substitute, and substitute-1, I'm going to freeze the API and enter the beta stage.

13:07 After that, just documentation.

13:07 AWizzArd: Chousuke: good, just wanted to be sure.

13:07 Chousuke: AWizzArd: protocols are just a collection of functions

13:07 AWizzArd: ja

13:07 joshua-choi: very good, I might become one of your beta testers

13:08 joshua-choi: I'll let you know

13:08 AWizzArd: joshua-choi: do you know if the performance to fnparse 1.1 became better?

13:08 joshua-choi: I don't know for sure.

13:08 AWizzArd: We'll see.

13:08 joshua-choi: I've never rigorously tested.

13:08 I'm pretty sure though

13:08 Cat is a packrat parser.

13:08 Hound gets rid of a certain space leak that Parsec's introductory paper talked about.

13:09 AWizzArd: mhmm :)

13:09 joshua-choi: Other than being LL(1) by default, Hound is the same as FnParse 2.x.

13:09 And a ton more error features.

13:09 Actually, the error handing may make Hound sometimes slower than FnParse 2 for short input strings...though I doubt it.

13:09 vegai: ok, I wanna get Leiningen to work for once. Can you guys help a bit?

13:10 joshua-choi: vegai: What problem are you running into?

13:10 etate: vegai: whats the problem?>

13:10 livingston_: vegai: once? or continuously? ;)

13:11 Borkdude: Who also the problem 'The extern alias 'MSC' was not specified in a /reference option' when trying to install ClojureCLR?

13:11 I put MSC at the Aliases property at Microsoft.Scripting.Core

13:13 joshua-choi: Chousuke: I guess I could try to find a better name for get-answer...no, I don't think there is one. I have plenty of other examples.

13:14 (defprotocol AState (get-remainder [state]) (get-position [state]) (make-another-state [state input context]))

13:14 I have two types of AStates, and get-remainder is nontrivial for one of them

13:14 chouser: if it's just doing a value lookup, you could consider implementing ILookupKeyword

13:15 er, ILookup, rather

13:15 joshua-choi: chouser: get-remainder doesn't do a value lookup for one type of AState; it has to generate a sequence using drop and stuff.

13:15 chouser: ok

13:15 joshua-choi: Otherwise, I would have just used :remainder or something.

13:16 Is there a better way to name the method other than "get-remainder"?

13:16 * joshua-choi wishes that there was a up-to-date Clojure naming guideline document

13:17 TakeV: Is the CLI version of Clojure as up to date as the Java version?

13:18 Chousuke: I have never actually looked at it.

13:18 joshua-choi: What's the CLI version?

13:19 slyphon: joshua-choi: winders

13:19 joshua-choi: .NET

13:19 joshua-choi: Ah

13:19 Borkdude: why isn't that called the CLR version?

13:19 * joshua-choi wishes for an Objective-C-hosted Clojure

13:19 TakeV: Er, yeah, sorry, misremembered the name.

13:20 Was thinking about doing an XNA game, and Clojure is awesome.

13:20 Borkdude: TakeV: I'm just trying to get ClojureCLR to install in Visual Studio

13:20 but I get a little stuck

13:20 TakeV: Difficult?

13:20 Borkdude: now it can't find the namespace System.Dynamic

13:21 TakeV: did you get it to work?

13:22 TakeV: Borkdude: I haven't tried, most of my work is with the JVM.

13:22 Borkdude: it must be something stupid, I'll search some more

13:22 joshua-choi: Is the ClojureCLR under active development?

13:23 wooby: joshua-choi, there's nu for objective-c lisp

13:23 it's cool

13:24 Borkdude: I have no idea, but I tell everyone doing CLR to take a look at it ;-)

13:24 joshua-choi: wooby: I'll check that out, thanks.

13:24 wooby: np

13:24 TakeV: wooby: Does it work for the iPhone?

13:25 livingston_: I though Rich abandoned it? because he was sick of supporting two architectures, but maybe someone picked it up?

13:25 wooby: TakeV, last i checked

13:25 TakeV: Excellent. :)

13:25 wooby: i know there have been the recent shenanigans in that realm

13:25 so i'm not sure anymore

13:25 vegai: joshua-choi, etate, livingston_: thanks. I'll try it one more time by myself first :)

13:26 the last time I tried to build my own simple hello world on it, I got exceptions towards java.lang.String for some reason

13:26 clojurebot: what time is it?

13:27 livingston_: vegai: one "problem/feature" with lein is that it will leave jars behind in lib so if you have old clojure jars in there, and call lein deps it will leave them and you will get your jvm confused

13:27 vegai: leain clean will flush that directory though

13:29 joshua-choi: Why does clojurebot say weird things sometimes?

13:30 vegai: livingston_: ah, now I might see my first mistake

13:30 in project.clj, I gave :main as a string

13:35 replaca: Borkdude: you need a version of .Net that supports the DLR extensions), I think this means .Net 4.0, but I'm not sure

13:36 Licenser: joshua-choi: because he's nuts

13:37 vegai: ok...

13:38 replaca: livingston_afk: Rich did stop trying to support both the JVM and CLR early in the process of developing Clojure, the current CLR project is about a year old and led by someone else with Rich's encouragement. I don't know current activity/status. I think it may be waiting on CinC at this point

13:38 vegai: so my project.clj is (defproject hello "0.0.0" :description "hello" :dependencies [[org.clojure/clojure "1.1.0"]] :main hello)

13:38 and src/hello.clj is (ns hello) (defn -main [& args] (println args))

13:38 joshua-choi: Licenser: Who created it?

13:38 vegai: lein deps work fine

13:38 lein jar works fine

13:39 Borkdude: replaca, on the page I read smth about VS2008

13:39 +SP1

13:39 vegai: is it wrong to try to run the resulting jar simply by saying java -jar hello.jar?

13:39 Borkdude: I guess that is .NET 3.5

13:39 vegai: because then I get Exception in thread "main" java.lang.NoClassDefFoundError: hello

13:40 chouser: joshua-choi: hiredman wrote clojurebot. he has a bunch of responses to specific keywords, but uses a fuzzy matcher to look them up. he sometimes chimes in with an answer to something not addressed specifically to him.

13:40 clojurebot: time

13:40 clojurebot: what time \is it? is TIME TO GIT BUSY!

13:41 joshua-choi: clojurebot: time

13:41 clojurebot: multimethods is what separates the boy from the man.

13:41 Licenser: what time is it?

13:41 hiredman: ,(java.util.Date.)

13:41 clojurebot: #<Date Fri Apr 23 10:44:44 PDT 2010>

13:42 Raynes: $time

13:42 sexpbot: Raynes: The time is now 2010-04-23T17:48:32Z

13:42 chouser: heh. mul-time-thods

13:42 joshua-choi: There's another bot?

13:42 sexpbot: time

13:44 Raynes: Why do people always try that?

13:44 :\

13:44 $ <-- This is the prepend. The only prepend. Every single command uses this prepend. :p

13:44 sexpbot: Command not found. No entiendo lo que estás diciendo.

13:44 chouser: Raynes: because that's how you address people on IRC.

13:44 joshua-choi: Raynes: I have no idea that sexpbot existed until two minutes ago. :)

13:45 technomancy: vegai: single-segment namespaces are unsupported

13:45 Raynes: chouser: Indeed, but it usually happens after they've seen somebody else use the prepend, which is weird.

13:45 ._.

13:45 joshua-choi: What does sexpbot do?

13:45 technomancy: vegai: see the skeleton created by "lein new hello" for a better example

13:45 ~single segment namespaces

13:45 clojurebot: namespaces 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

13:45 Raynes: joshua-choi: He spies on clojurebot. Keeps him in line.

13:45 $dumpcmds

13:45 sexpbot: http://gist.github.com/376874

13:45 joshua-choi: $addfortune

13:45 sexpbot: An invisible fortune cookie?

13:45 Raynes: He does all sorts of stuff. He's also in #clojure-casual and #(code) if anyone wants to play with him.

13:46 technomancy: clojurebot: single-segment namespaces (foo instead of foo.core) are unsupported. they may work in a few circumstances, but you shouldn't rely on them.

13:46 clojurebot: Foo is not Baz.

13:46 * technomancy eyes clojurebot suspiciously

13:46 technomancy: clojurebot: single-segment namespaces are unsupported. (foo instead of foo.core) they may work in a few circumstances, but you shouldn't rely on them.

13:46 clojurebot: namespaces 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

13:46 chouser: technomancy: "is" not "are" :-/

13:46 technomancy: clojurebot: single-segment namespaces is unsupported. (foo instead of foo.core) they may work in a few circumstances, but you shouldn't rely on them.

13:46 clojurebot: Ok.

13:46 technomancy: I thought he was clever like that

13:46 oh well

13:47 Raynes: chouser: You shouldn't have used that one.

13:47 :p

13:47 chouser: eh?

13:48 vegai: technomancy: ah, thanks.

13:48 joshua-choi: $what

13:48 sexpbot: It's AWWWW RIGHT!

13:48 Raynes: chouser: title* isn't mean to be used. $title is a verbose version of the normal title scraper.

13:49 And the $part and $say commands are admin-only. :>

13:49 chouser: I don't know what that means, I'm just trying out the list of commands you posted for us. :-)

13:50 Raynes: More dangerous and annoying commands like say, part, and join are limited to "admins", of sorts.

13:50 A little privilege system.

13:51 I need to update my verbose command list with explanations as to what they actually do.

13:51 I've been focusing on making him useful rather than making him useful to other people. :p

13:51 * rhickey was suprised to see the body duplicated in doseq and for

13:52 chouser: rhickey: blame me

13:52 rhickey: did they always?

13:52 chouser: That may be as of chunked support

13:52 rhickey: or just after chunks?

13:52 chouser: is there a better way? I wasn't sure an extra closure would be preferred.

13:53 rhickey: dunno

13:53 Borkdude: rhickey: there was some discussion here about ClojureCLR - is it still under active development?

13:53 rhickey: Borkdude: afaik, yes

13:55 joshua-choi: On the datatypes page, it says, "You should always program to protocols or interfaces." Does this mean that using keywords on datatypes should be minimized in favor of using protocol methods?

13:55 remleduff: Hi all, this is a fun one. I'm using a JNA library call javaCV, whenever an object of type "IplImage" gets printed by the repl, my whole repl crashes with an error that looks something like "Can't cast java.lang.Object to com.sun.jna.Structure". Obviously a bug in the library, but is there some way I can ask the repl to not print the value of the object, to not even look at the object. It's tedious remembering not to call any f

13:55 Borkdude: rhickey: tnx

13:56 remleduff: I've tried something like (defmethod print-method cxcore$IplImage [x writer] (.write writer "Can't print Images")), but it prints that message and then crashes anyway

13:57 rhickey: joshua-choi: using keywords on datatypes is perfectly fine for: unencapsulated information, and trusted implementation code

13:58 joshua-choi: rhickey: Thanks.

13:59 chouser: rhickey: is there any action you'd like me to take on doseq or for? propose an alternate solution? back out chunked seq support?

13:59 rhickey: chouser: no, just mentioning it, don't want to change them just before new release :)

13:59 chouser: ok

14:07 bsteuber: anyone else using paredit on a slime repl? on my emacs, it behaves quite weird there (not in files) with [ oder {

14:08 joshua-choi: rhickey: Quick followup question: should I inform the user whether attributes of a datatype are "unencapsulated" in the datatype's docstring?

14:08 fogus: Did someone say "just before the new release"? ;-)

14:08 rhickey: joshua-choi: if you are using defrecord, I don't see a need personally

14:09 joshua-choi: Okay.

14:09 chouser: fogus: heh

14:16 rhickey: is 'show' ugly by it's very existence, or is there something I could do to make it prettier?

14:39 AWizzArd: Hi stuarthalloway

14:44 technomancy: stuarthalloway: thanks for all your work moving forward with the release. glad to have another committer to help.

14:50 jweiss: bsteuber: i use paredit on the repl

14:50 yeah, it doesn't work quite right for me either with [ and {

14:50 especially barf/slurp

14:52 bsteuber: jweiss: ah, good to know I'm not the only one

14:53 so I'll file a report then - or maybe a request, as maybe repl-use is not one of the promised features

14:53 jweiss: bsteuber: i am not sure what can be done about it, i would think if anyone knows the solution they're likely to be here in this channel

14:53 bsteuber: i don't think it behaves quite right for me in editing clojure files either

14:53 bsteuber: maybe the user> prompt confused it

14:54 jweiss: the newest version does behave nice in files for me

14:54 jweiss: bsteuber: where did you get the latest, from elpa?

14:55 bsteuber: jweiss: http://mumble.net/~campbell/emacs/paredit-beta.el

14:55 this is version 22, I think elpa has 21

14:56 jweiss: bsteuber: ah i have version 20

14:57 bsteuber: ic

14:58 remleduff: How hard is it to get whoever maintains ELPA to update a package? Is anything you get through ELPA doomed to obsolescence?

14:58 jweiss: bsteuber: i tried to install again thru elpa, still got ver 20

14:58 bsteuber: ok, then I was wrong regarding 21

14:58 jweiss: i'm kind of an emacs newbie, i have no idea

14:59 i know ver 22 says beta so it's probably ver 21 that should be in elpa

14:59 interestingly, ver 20 is 3 years old

15:00 even the 'beta' is almost a year old

15:01 technomancy: remleduff: in this case it's blocked on the paredit maintainer

15:01 stuarthalloway: hi technomancy, AWizzard. Sorry silent earlier, was on too many meetings at once

15:03 AWizzArd: rhickey: when I have a (defrecord Foo [x y z]) then I can have (defn foo [{:keys [x y z]}] [z y x]). But when I have a (defprotocol Foobar (foo [f])) and want to (defrecord Foo [x y z] Foobar (foo [{:keys [x y z]}] [z y x])) then ==> clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.Symbol

15:03 stuarthalloway: no problem ^^

15:04 rhickey: AWizzArd: no destructuring in methods yet

15:04 AWizzArd: ok

15:08 Anyone has an idea if this can be done with defrecord? http://pastie.org/932033

15:09 Or does this require a deftype for which the fields will be mutated, and then just (recur) is called?

15:11 rhickey: AWizzArd: you must leave out 'this' on recur in methods, i.e. you can't recur to a different object

15:13 mmarczyk: stuarthalloway: re: issue #270 on Assembla, I don't think def + fn works correctly, see http://pastie.org/932041

15:14 AWizzArd: rhickey: so could this better be done with deftype + mutable fields? Because then we could just (recur) and reuse the existing object.

15:14 rhickey: AWizzArd: what are you trying to accomplish that the first version doesn't?

15:15 chouser: primitives

15:15 AWizzArd: I thought this could get faster when method calls can happen directly, vs. an ordinary function

15:15 http://hughw.blogspot.com/2009/01/clojure-vs-javafx-script-only-5x-slower.html

15:16 chouser: AWizzArd: but your defrecord version creates and retruns a new object each time, while your first one returns only an integer

15:17 AWizzArd: eventually both versions will return z, which is an int

15:17 chouser: AWizzArd: you might try definterface to declare a method that takes ints, then implement that in a defrecord or deftype.

15:18 wooby: has anyone written a repl applet, or otherwise know if it's possible/done?

15:18 AWizzArd: chouser: could definterfaced methods use recur and still provide the first arg?

15:19 chouser: wooby: unsigned applets can't use a custom classloader needed to load dynamically-generated bytecode, so they can't do 'eval'

15:20 wooby: ah

15:20 chouser: wooby: but you should be able to make a signed applet repl

15:20 kylesmith: I think I may be experiencing an infinite loop with swank-clojure. The problem seems to be occurring in/around the following lines: (("LockingTransaction.java" 263) ("LockingTransaction.java" 231) ("swank.clj" 29) ("swank.clj" 26))

15:20 wooby: chouser, already started :)

15:20 chouser: wooby: there's bits of swing-repl code around you could use

15:20 kylesmith: Is this a known problem, or should I keep investigating?

15:21 wooby: chouser, thanks i'll scrounge

15:22 rhickey: AWizzArd: http://pastie.org/932058

15:24 why pastie? no thread?

15:26 AWizzArd: note that removing the unchecked- doesn't hurt perf, please don't use unchecked unless you need truncation

15:26 AWizzArd: rhickey: oh great, this runs 3x faster. Now with the type declarations this is very much on par with JavaFX.

15:26 good, thanks for this hint

15:27 remleduff: Can you guys copy that to gist by any chance? pastie is blocked for me, "disease vector"

15:28 jwr7: I've been reading chouser's "Using binding to mock out even “direct linked” functions in Clojure" (http://blog.n01se.net/?p=134) and I started wondering — he says in Clojure 1.1 most clojure.core Vars are "linked directly" into code, which I assume means avoiding Var lookups,

15:28 * AWizzArd will not use pastie anymore then

15:28 rhickey: remleduff: http://gist.github.com/377040

15:28 jwr7: can I do the same thing for some of my functions?

15:28 I have code which makes lots of function calls to functions that will not change and spends lots of time looking up Vars

15:28 (checked with YourKit profiler)

15:29 AWizzArd: remleduff: this version of rhickey allows faster functions calls. As tak() is mostly a benchmark for funcall speed this had a nice impact.

15:29 Interesting to see that Clojure provides tools for doing optimizations if one really needs it.

15:31 remleduff: Nice, I really like the way deftype and defrecord code "looks", now if only it was ^int instead of #^int everywhere ;)

15:31 chouser: jwr7: first, it's worth nothing that apparently profilers prevent Var from doing some of the performance tricks it does in real life. So it may *look* worse than it really is.

15:31 AWizzArd: remleduff: maybe soon Emacs users will have a visible/invisible switch for type hints (and possibly other stuff, such as hiding meta data, etc)

15:32 jwr7: chouser: even sampling profilers?

15:32 (I use YourKit in sampling mode, which I assume does not redefine functions)

15:33 chouser: jwr7: as for doig direct linking yourself, there's no supported way to do that yet

15:33 but if you namespace starts with "clojure" and you don't have :dynamic true in your var's metadata, you'll get direct linking. Abuse at your own risk. :-)

15:33 livingston: my research is taking me in a direction where I need to interface with very large back-end triple-stores for RDF and OWL etc. (like AllegroGraph)...

15:33 jwr7: chouser: ok. I've been using macros for some of the most critical stuff for now, but that seems like a hack, and I can't use them with map and the like.

15:34 chouser: speaking of hacks :-)

15:34 chouser: thanks, I'll try that out.

15:34 chouser: jwr7: you can also use local functions (via let or letfn) to get faster function lookups, at the cost of unfavorable code reorganization

15:34 livingston: the most direct way to talk to RDF back-ends through java/clojure seems to be Jena, but that's a holy mess. any one have any experience or have done anything with it?

15:35 jwr7: chouser: I thought of that and actually used it in some places.

15:35 chouser: livingston: http://github.com/richhickey/rdfm

15:36 arohner: I'm thinking of putting this in contrib. Does anyone see value in it? http://gist.github.com/377054

15:36 chouser: livingston: I don't know that that's actually "maintained", but it might be interesting.

15:37 hiredman: http://github.com/hiredman/clojure/blob/readerII/src/clj/clojure/reader.clj re: letfn

15:38 arohner: that is useful

15:38 maybe in macro-utils

15:39 arohner: hiredman: thanks. The process for contrib is the same as core? write a patch, file an assembla ticket?

15:39 livingston: chouser: thanks - that has some utilities that are definitely of use

15:40 jwr7: I wish I had a (binding) that wouldn't be thread-local — that would propagate to other threads started by, say, pmap.

15:40 livingston: although as far as I can tell that library is mostly for serializing and deserializing clojure data to/from an rdf store

15:40 but I can build on it to get more general reasoning...

15:40 hiredman: arohner: I believe so, I think might want to bounce it off the mailing list before filing a ticket

15:42 livingston: since rdf uri's are namespace + resource this seems like they should just be mapped to clojure packages + symbols

15:43 hiredman: namespaces

15:44 livingston: I meant clojure namespaces - thank you

15:46 one threat of such an approach is after running through a lot of data there will be a ton of symbols hanging out in the symbol table that are no longer needed - generating memory issues

15:47 (when I did this in common lisp, I didn't actually have a real problem from that, but I'm looking at dealing with orders of magnitude more data now)

15:49 jwr7: livingston: I hit a similar problem when doing genetic programming in CL: generated random constants were interned symbols and caused performance problems. Not even because of memory consumption, but because of namespace lookup times.

15:49 hiredman: interned java strings in utf-16

15:50 livingston: jwr7: I never had a problem with that but I was using ACL and they make a very good compiler. you could also keep the symbols out of the symbol table too.

15:51 AWizzArd: hiredman: if i would like to display U+1D11E - how would I do this then?

15:52 or some chinese chars, such as U+024B62

15:52 jwr7: livingston: I was using SBCL. Amusingly enough, mostly because ACL's compiler had a bug that my code triggered (and that was too difficult to report properly to Franz).

15:53 livingston: hiredman: the thing is when working with this kind of stuff, it's *really* nice to be able to drop into the representation language while you are coding and just cons up some expressions using lisp and rdf (or whatever) so if it's all symbols it's nice and clean, instead of these string everywhere, like you get when manipulating things like sql (yuck).

15:53 jwr7: that's a shame. they are very responsive about stuff like that, generally

15:55 hiredman: AWizzArd: I dunno, google up some java unicode docs

15:55 jwr7: livingston: oh, they WERE responsive. Franz has the best support I've ever dealt with. It's just that if they can't reproduce a problem, it might sometimes be too much work for you to narrow it down and produce an example.

15:56 livingston: jwr7: ah, that's a shame

15:57 Chousuke: jwr7: I think you can simulate the non-thread-local binding by using alter-var-root

15:57 hiredman: AWizzArd: you might checkout the javadoc on Character since it goes into more detail

15:57 Chousuke: :(

15:57 jwr7: don't alter vars

15:57 arohner: how do you combine ~@ and foo#?

15:58 Chousuke: don't. use an explicit gensym

15:59 remleduff: Can someone help me understand how lazy-seq works? I'm feeling kind of silly but it's stumping me

15:59 arohner: Chousuke: how do I use that in a let?

16:00 Chousuke: (defmacro ... (let [foo (gensym)] `(let [~foo (somestuff)] ...)))

16:00 mmarczyk: arohner: what would you want to use it for, anyway?

16:00 ~@ splices in a seq and foo# is a symbol, not a seq

16:00 clojurebot: 'Sea, mhuise.

16:00 Licenser: meep

16:01 Chousuke: ~@

16:01 mmarczyk: sorry to disturb you, clojurebot

16:01 clojurebot: @ , {a b c]

16:01 Chousuke: uh

16:01 ~@

16:01 clojurebot: @ is splicing unquote

16:01 Chousuke: ~@

16:01 clojurebot: @ , {a b c]

16:01 Chousuke: looks like someone else got some garbage there too :)

16:03 jwr7: Chousuke, hiredman: just to explain — I don't want to alter vars, but I do have legitimate uses for (binding). And I just fell into a trap, because I thought I can switch any map to pmap and have it work, which is not the case.

16:03 arohner: Chousuke: thanks

16:04 hiredman: ,(doc bound-fn)

16:04 clojurebot: It's greek to me.

16:04 hiredman: bah

16:04 mmarczyk: jwr7: see bound-fn

16:04 and bound-fn*

16:05 actually the latter may be more useful when you've already go a regular function

16:05 and you want to transform it into one which captures bindings

16:05 hiredman: right, since clojurebot is being run from a lein repl it has been bitten by the using the wrong version of clojure bug

16:05 jwr7: mmarczyk: ahh, cool, thanks!

16:05 hiredman: since map is lazy you can have trouble with it and binding even without going multithreaded

16:05 best not to use binding

16:07 mmarczyk: ,(binding [inc dec] (map inc (range 3)))

16:07 clojurebot: (-1 0 1)

16:08 remleduff: ,*print-limit*

16:08 clojurebot: java.lang.Exception: Unable to resolve symbol: *print-limit* in this context

16:08 mmarczyk: ,(binding [inc dec] (map #(inc %) (range 3)))

16:08 clojurebot: (1 2 3)

16:08 mmarczyk: I mean

16:08 chouser: ~stuartsierra has come to the conclusion that dynamic scope is a bug.

16:08 remleduff: ,*print-lenth*

16:08 clojurebot: java.lang.Exception: Unable to resolve symbol: *print-lenth* in this context

16:08 Roger.

16:09 remleduff: ,*print-length*

16:09 clojurebot: nil

16:09 hiredman: haha

16:09 remleduff: Man, I cannot type

16:09 mmarczyk: there is certainly some merit to that opinion :-)

16:09 hiredman: clojurebot: stuartsierra |has come| to the conclusion that dynamic scope is a bug.

16:09 clojurebot: You don't have to tell me twice.

16:10 hiredman: clojurebot: stuartsierra?

16:10 clojurebot: stuartsierra is awesome

16:10 hiredman: clojurebot: stuartsierra?

16:10 clojurebot: stuartsierra is retiring

16:10 hiredman: clojurebot: stuartsierra?

16:10 clojurebot: stuartsierra is retiring

16:10 hiredman: bah

16:10 chouser: clojurebot: dynamic scope

16:10 clojurebot: stuartsierra has come to the conclusion that dynamic scope is a bug.

16:10 StartsWithK: in art of the interpreter there is a sentance that says dynamic scope is a bug :)

16:11 hiredman: makes sense to me

16:12 livingston: in the right contexts it's hugely valuable, if you need to go through layers of some other api to get to something low that needs tweaked, binding makes sense to me

16:12 hiredman: I think the main use should be the ability to simmulate multiple returns, not resource management

16:13 (with-database ...) sort of stuff is horrible

16:14 livingston: hiredman: why? the alternative is to have parameters to pass all over the place

16:14 jwr7: Oh, there is another use case. Say you walk a webapp tree and need to keep track of which uri-tokens are consumed and which remain (the URI path gets split into 'tokens'). Dynamic variables do half of the work for you.

16:14 hiredman: livingston: parameter passing? in functional programming? horrible!

16:14 livingston: actually usually I would have the parameters anyway with defaults, and then things like (with-foo would over-ride the defaults

16:16 it is when the parameter is some kind of state holding mess like these things are usually used for, then all kinds of state and parameters start leaking all over in your code

16:16 hiredman: leaking?

16:17 livingston: the best examples are when you have your app, talking to some library that has something else you plugged into it under the hood. now you want to change that thing under the hood, you either need to rewrite the whole library to allow that (assuming it's even your library to rewrite) or you can reach down into the thing under the hood and tweak it

16:18 mmarczyk: jwr7: or you could put an atom in a local and use a zipper to walk the tree with a function which accepts an atom arg

16:18 hiredman: livingston: I don't see how the one follows the other

16:19 remleduff: ,(binding [*print-length* 3] [1 2 3 4 5 6 7 8])

16:19 clojurebot: [1 2 3 4 5 6 7 8]

16:19 StartsWithK: i don't know, i find it a mess to type (with-open [x bla] (with-out-str [y x] (fn-with-implicit-out-str)))

16:19 mmarczyk: ,(binding [*print-length* 3] (print-str [1 2 3 4 5 6 7 8]))

16:19 clojurebot: "[1 2 3 ...]"

16:19 StartsWithK: when i could just pass out-str as first argument or in options map

16:19 jwr7: jwr7: amusingly enough, I actually use this technique with a zipped tree :-) I didn't think of your solution, I thought of passing more things around when walking the zipper. But I didn't want to manage popping things when moving up the tree myself — and a dynamic variable fit right in.

16:20 hiredman: if you have an api, and the api has an init state function that returns a state cookie the only things that should be directly manipulating that state cookie are the other functions in that api

16:20 remleduff: mmarczyk: Thanks

16:21 hiredman: so a change to the state cookie may require a refactor of parts of the api, but users of the api would not be effected, since the state cookie is "opaque" to them

16:21 mmarczyk: jwr7: I'd rather use an atom for that :-)

16:21 in fact, I can imagine walking subtrees of a single tree in separate threads

16:22 hiredman: have I mentioned monads yet?

16:22 mmarczyk: in which case maybe a ref

16:22 would do best

16:22 livingston: sometimes you can't refactor because your not calling it, for example

16:22 or not controlling the thing that is doing the calling

16:22 hiredman: livingston: that sounds like a tangled mess

16:22 mmarczyk: hiredman: no, but this conversation does make one think about them

16:23 it's a fact of life, though, that monadic style is very different from the usual present-day Clojure style

16:24 jwr7: FWIW, my zipper tree walking smells of monads, but I couldn't understand them well enough to actually use the ones in clojure-contrib.

16:26 sattvik: rhickey: /who

16:26 mmarczyk: hi sattvik :-)

16:26 livingston: hiredman: frequently it can be used to overcome something done bad, but there are many legitimate uses, look at specials / defspecial in common lisp

16:27 hiredman: livingston: I'd rather not look at common lisp

16:27 sattvik: mmarczyk: Hello.

16:28 rhickey: Does it make sense for a Vec to be comparable against a non-IPersistentVector, such as a Sequential?

16:28 Luyt: ,(doc *print-length*)

16:28 clojurebot: "; *print-length* controls how many items of each collection the printer will print. If it is bound to logical false, there is no limit. Otherwise, it must be bound to an integer indicating the maximum number of items of each collection to print. If a collection contains more items, the printer will print items up to the limit followed by '...' to represent the remaining items. The root binding is nil indicating no limit."

16:29 rhickey: sattvik: yes

16:30 sattvik: collection equality is divided into sequentials, sets, and maps

16:32 sattvik: rhickey: OK, thank you. I will implement it that way. Although it will be somewhat different than vectors, then.

16:32 ,(compare [1 2] (range 1 2))

16:32 clojurebot: java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IPersistentVector

16:33 rhickey: sattvik: sorry, not comparable, just equality

16:33 Vec should mimic vectors

16:34 sattvik: rhickey: Ah, OK. No problem. So, Vec should only be comparable against other IPersistentVectors, correct?

16:35 rhickey: sattvik: yes

16:35 * rhickey reflects over his first Clojure-generated Annotations...

16:36 sattvik: rhickey: Thank you.

16:36 hiredman: rhickey: ooo

16:37 mmarczyk: rhickey: wow :-)

16:37 Borkdude: Hmm, I have installed VS2008 SP1 now for sure, upgraded to .NET Framework 4.0 but still I keep getting this err msg

16:38 The Namespace Dynamic does not exist in the namespace System

16:38 sattvik: So annotations are coming to Clojure? I did some simple-class level annotations on an Clojure/EJB library, but I never tried field or method annotations.

16:38 Borkdude: and I do have references to the dlls described on the ClojureCLR page

16:39 technomancy: every time I hear about annotations, it's for use with netty; what other kinds of things are they useful for?

16:40 StartsWithK: jpa, jax-rs..

16:40 sattvik: technomancy: Most of the Java EE stuff uses annotations these days to replace XML.

16:40 StartsWithK: for jpa you would also need inner classes

16:40 livingston: technomancy: in a language without real macros you can get some macro-like things out of them

16:40 Borkdude: I have come across annotations in JUnit and GWT

16:40 this week

16:40 technomancy: so for various three-letter acronyms then?

16:40 =)

16:40 rhickey: livingston: more like metadata than macros

16:41 mattrepl: Guice is another

16:41 Borkdude: so maybe for ClojureGWT ;-)

16:43 hiredman: you can put metadataish stuff on other stuff, and a processor can read the metadata and do codegen stuff

16:43 livingston: rhickey: mostly yes, but I've seen some crazy things done with them in java, for example: in a system called UIMA you build plug-in modules for text processing, when UIMA calls your module you can query it for a bunch of parameters, and there is a lot of boilerplate for that...

16:44 rhickey: livingston: that has to do with their interpretation by frameworks, the language facility is just metadata-like

16:44 livingston: .. so the thing I saw was something like @parameter String Foo or something, and it would manage all the boiler plate for requesting the foo paramater and getting it typed if it was there etc.

16:45 Borkdude: Hmm, this week someone gave me a JDO demo, it used a lot of annotations, it looked useful to me

16:45 livingston: personally I think that seems like a bit of an abomination, and they seem to make most sense as metadata

16:47 cemerick: rhickey: the protocol docs are wrong in showing parens around overloaded method signatures.

16:47 in assembla, that is

16:48 rhickey: the assembla docs are over

16:48 Borkdude: but the same thing could be done with metadata in clojure probably

16:49 sattvik: I am guessing that if Clojure did support annotations, that might help some of the EE crowd adopt it. It would make it easier to plug into an existing system.

16:49 cemerick: rhickey: sorry, didn't notice the header

16:49 hiredman: Borkdude: it all ready sort of is, like with type hints, etc

16:49 the main things annotation support is nice for are interop

16:50 Borkdude: Can someone help me build ClojureCLR and get this annoying msg out of the way?

16:50 rhickey: (deftype #^{Deprecated true Retention RetentionPolicy/RUNTIME} Bar [])

16:50 ^^ works on my machine

16:50 Borkdude: The type or namespace name 'Dynamic' does not exist in the namespace 'System'

16:50 livingston: I stand corrected, that code apparently mines the annotations to do the work that I thought just placing the annotation was doing (i thought they could behave like templates), but that's not the case at all

16:50 remleduff: rhickey: If you consider the annotation processing framework part of "annotations" it ends up being somewhat similar to a macro facility for java in some of the ways it's used, no?

16:51 rhickey: remleduff: I personally would never equate the two

16:52 remleduff: I've got a few places where there is no concrete class definition, just an interface with some methods marked up with annotations, at compile time a class is generated based on that markup

16:52 cemerick: rhickey: is destructuring going to eventually be allowed in deftype/defrecord method arg vectors?

16:53 rhickey: cemerick: maybe

16:53 it's on an ever lengthening list

16:53 stuarthalloway: rhickey: java.util.Map for defrecord is DONE, with no Java changes :-)

16:54 https://www.assembla.com/spaces/clojure/tickets/313-add-java-util-map-support-to-defrecord

16:54 turns out there is enough clojure-in-clojure in defrecord to do it all as one-liners

17:01 technomancy: anyone who's contributed to swank-clojure but may not be on the mailing list should weigh in on this relicensing thread: http://groups.google.com/group/swank-clojure/browse_thread/thread/3ae8f2c2ad46bbc5

17:03 remleduff: stuarthalloway: Since you're using java interop calls (.count) in your ijavamap, should the IPersistentMap switch to doing it the same way? It seems odd to me that the implementations would be different, but I'm probably not understanding something.

17:04 stuarthalloway: remleduff: I am counting on this, while it looks like IPM is counting on other things

17:12 kzar: When I try and use the lower-case function in str-utils it says the function isn't public. What am I doing wrong?

17:19 remleduff: ,(clojure.contrib.str-utils2/lower-case "ABC")

17:19 clojurebot: "abc"

17:20 remleduff: Is there a function somewhere in swank-clojure that will given a class-name, give you a list of possible imports for that class (found by searching your classpath)?

17:20 kzar: Oh I got it working, I just did (.toLowerCase "Whatever") instead

17:31 rhickey: annotation syntax: http://gist.github.com/377213

17:31 make sense?

17:34 mefesto: rhickey: i like it :)

17:35 im guessing exactly the same at the method definition level?

17:35 sattvik: rhickey: So it's just like the standard meta map, just with Class keys?

17:35 rhickey: How about nested annotations?

17:36 rhickey: sattvik: theoretically supported, do you know of one in standard Java 6?

17:36 mefesto: i think jpa has nested annotations (named query?)

17:36 remleduff: How do you mix annotations and type hints?

17:37 sattvik: rhickey: I know of some for EJBs... It will take a moment to look them up. I am not sure aboute Java SE.

17:37 rhickey: will look like {BlahAnnotation {:anested (NestedAnnotation {:its property})}}

17:38 remleduff: just put both in the metadata

17:38 remleduff: {:tag String AnnotationType blah}

17:38 carkh: \o/ annotations !

17:39 remleduff: Are you respecting default property values too?

17:39 rhickey: remleduff: yup

17:40 remleduff: Neat ;)

17:40 mefesto: looks like there are some nested annotations in the javax.xml.ws package. (ex. WebServiceRefs)

17:40 carkh: too bad i approached the jvm from clojure so i don't know anything about these.... are there annotations for methods as well ?

17:41 remleduff: carkh: There are annotations on nearly everything: on types, methods, parameters

17:42 carkh: looks like i'll spend the evebning reading about all that

17:42 remleduff: rhickey: Will the clojure or java compiler spit out a message now if you use a type's method marked Deprecated?

17:42 rhickey: remleduff: no

17:44 arohner: Chousuke: I can't get your gensym trick from earlier to work: http://gist.github.com/377226

17:47 rhickey: remleduff: thanks - nested looks like this: http://gist.github.com/377213

17:47 sorry, sattvik - nested ^^

17:48 Chousuke: arohner: um, only lists can be spliced

17:49 arohner: Chousuke: what do I have there?

17:49 Borkdude: rhickey: what version of the DLR was used with the latest clojure-clr sources?

17:49 Chousuke: arohner: a symbol

17:49 remleduff: What is (WebServiceRef {:name "fred"}), a function invocation?

17:49 Chousuke: arohner: ~@foo makes no sense unless foo is a list or a vector

17:49 rhickey: Borkdude: you'll have to ask the ClojureCLR folks

17:50 remleduff: a nested annotation

17:50 Borkdude: rhickey: where are they hanging out usually

17:50 ?

17:50 arohner: Chousuke: isn't foo a symbol that resolves to a list?

17:51 rhickey: Borkdude: you could ask on ggroup

17:51 Chousuke: arohner: no.

17:51 Borkdude: k

17:51 remleduff: Just looks a little inconsistent to me, why isn't it #^{(Deprecated true) (Retention RetentionPolicy/RUNTIME)} if they're going to use lists when nested?

17:52 Chousuke: arohner: what you're doing there is generating a symbol first, binding it to the name foo, then generating code that binds the *generated* symbol to a list

17:53 sattvik: rhickey: Looks good. Although a map-like syntax may be slightly more natural for people coming from Java.

17:53 arohner: Chousuke: ok. So then how would I splice the generated symbol?

17:53 Chousuke: arohner: but the list is not available to you when you're actually generating the code to make the list. (think about it) ... so you can't splice it in

17:53 arohner: ah

17:54 remleduff: rhickey: I don't think it makes a big difference though, I haven't seen nested annotations enough to worry about so consider that retracted. I like it a lot :)

17:54 sattvik: rhickey: An example of nested annotations in Java: @Resources ({@Resource(name="jdbc/AdventureDB" type=javax.sql.DataSource),

17:55 Chousuke: arohner: what you can do is generate code that does something to the list; but you can't actually put the list in the generated code because that would be circular :P

17:55 sattvik: Though, in the end, exactly how it looks is rather trivial.

17:56 arohner: Chousuke: ok, thanks. I'll need to re-think this

17:56 Chousuke: arohner: though your example isn't probably the clearest about this because the list is basically a constant

17:56 arohner: one sec, I'll paste what I actually want

17:57 Chousuke: arohner: if you can think of a macro as function of its parameters, producing clojure code, that will help

17:57 what ` is doing is nothing more than building a list, with some templating support

17:57 arohner: http://gist.github.com/377232

17:58 licoresse: flip flop

17:58 Chousuke: you could do it entirely without using ` or ~ or ~@

17:59 arohner: why do you want to evaluate the args like that?

17:59 hmm

17:59 arohner: Chousuke: in case the input is a function call

17:59 Chousuke: what input? the 'args'? hm.

18:00 remleduff: Is there any way to make this work? (map #(import %) [java.util.zip.ZipFile])

18:00 Chousuke: what you want is probably not possible without eval

18:00 at least not the way you're trying to do it

18:01 arohner: but the important mistake here is that you're trying to splice things that are part of the *generated code* into the generated code itself.

18:01 no, wait. you're trying to splice *results* of evaluating the generated code into the generated code.

18:03 arohner: Chousuke: seems like I need another eval step

18:03 Chousuke: is this a case for eval?

18:04 Chousuke: now you can do something like (defmacro foo [args] (let [a (if (fn-form? args) (eval args) args)] `(defn ~@args ...)))

18:04 honestly, probably not.

18:04 it will fail if you try to pass anything but a literal fn form

18:04 hmhm

18:05 what kind of code are you aspiring to write using this macro?

18:05 also, should be ~@a in the example

18:06 arohner: (defmacro defn-map

18:06 "generates a defn expression, but arguments are a map, to make it

18:06 easier on macro writers. Valid keys: name, doc-string, attr-map,

18:06 params, body. If params is nil, then body is a multi-arity

18:06 expression, ([params] body)+ "

18:06 this seems to work well with eval

18:06 Chousuke: should be no need for eval for that

18:07 unless you want to accept non-literal maps as well

18:07 which would be rather evil

18:08 arohner: well I also have

18:08 (defmacro decompose-defn-args

18:08 "interprets args the way defn would, returns a map that can be consumed by defn-map"

18:08 so yes, I want to support non-literal maps

18:08 Chousuke: hmmh :/

18:11 I really don't think that's a very good idea.

18:12 you might just as well make it a function that constructs and evals a defn form then

18:12 no need for macros

18:14 arohner: Chousuke: why don't you think it's a good idea?

18:16 Chousuke: arohner: I guess I just don't see what that is useful for

18:16 arohner: Chousuke: it makes it significantly easier to write macros that call defn, and want to support all the extra features of defn

18:17 Chousuke: arohner: I can see explicitly naming each defn parameter being useful, but why must it work for non-literal maps?

18:17 arohner: so I can do things like

18:18 (let [arg-map (update-in (destructure-args input-args) [:attr-map] merge ...)] (defn-map)

18:18 I want to update-in whatever the user passed in

18:20 Chousuke: hmh

18:21 I still don't see it. you can write a parser for defn args -> map and map -> defn-args and that would be very useful for macro writers, but there would be no need for eval or any "runtime" maps as far as I can tell

18:22 fyuryu: Borkdude: I managed to get ClojureCLR to compile under VS 2008 a month or two ago. Haven't looked at it since.

18:22 cemerick: holy crap, annotations?!?

18:22 * cemerick furiously scans the logs

18:23 fyuryu: Borkdude: I couldn't get it to compile under VS 2010, though. Don't remember what the error was

18:24 Chousuke: arohner: I mean, if you write a (defn mydefn [argvec] ...) you can update the argvec in any way you want

18:24 arohner: it's still just a vector

18:25 arohner: Chousuke: yes, but defn has to support doc-string? attr-map?

18:25 I don't know which position is the attr-map unless I destructure first

18:25 or write a macro as long as defn

18:25 Chousuke: destructure?

18:26 well you can distill all the weird logic in defn into your defn-args -> map function

18:27 and when you are done manipulating the map, do the reverse and then just `(defn ~@(map-to-defn themap))

18:27 that way, there's no need for eval

18:28 your map-to-defn just needs to produce a sequence that, when spliced in, result in a valid defn form.

18:29 results*

18:29 MadWombat: Hello

18:29 arohner: ,(doc defn)

18:29 Chousuke: inspect the args, and figure out whether there is a doc string, and whether there is a metadata map

18:29 clojurebot: "([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]); Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata"

18:30 MadWombat: I have a rather silly question. One of my files has been growing large, so I split it and used (:use [com.wombat.web util datastore]) to import the functions back into the main namespace. But now I get an error that the defun I defined in util is not available. Any obvious thing to check?

18:30 Chousuke: arohner: right?

18:31 mmarczyk: arohner: you could just lift the code from defn

18:31 Chousuke: arohner: you need a parser of defn-args -> map and vice versa

18:31 mmarczyk: leave the bindings vector in the huge let form intact

18:31 Chousuke: arohner: but that's a one-time thing

18:31 arohner: I already have the parser

18:31 that was easy :-)

18:31 mmarczyk: but instead of producing a def form, return a map of stuff extracted from "defn-like args"

18:31 make that a function

18:32 use in any macro which needs to provide similar functionality

18:32 arohner: Chousuke: mmarczyk : I think I understand. thanks

18:32 Chousuke: thanks for your help. I have to run

18:33 mmarczyk: MadWombat: see if util depends on sth in datastore or the other way around

18:33 Chousuke: right, so now you have a function that you can use in any macro... (defmacro foo [& args] (let [parsed (parse args)] `(defn ~(:name parsed) ...)))

18:34 mmarczyk: MadWombat: actually the other way around would be more likely given your description

18:42 MadWombat: mmarczyk: hmm... no, separately util and datastore compile fine

18:45 livingston: what's the function to change the root value of a def (I know this is dangerous - I'm debugging in the repl)

18:45 mmarczyk: MadWombat: does the error arise somewhere where use use or require the com.wombat.web namespace?

18:45 ^ where you use or require

18:46 livingston: you mean a Var? use the .bindRoot method

18:46 or alter-var-root

18:46 which is like alter / swap! / send

18:46 livingston: yeah, I guess so, whatever def produces which is a var, right? so yeah alter-var-root sounds good

18:47 mmarczyk: if you're just going to type it at the repl, you can of course just use def again

18:48 livingston: good point

18:51 MadWombat: mmarczyk: I think I made a mistake in the question, to make things clear, I have 3 namespaces all starting with com.wombat.web, main, util and datastore. When I use the util from main and try to call a function it is not recognized

18:52 mmarczyk: figured it out, I had all functions defined with (defn-, so once they moved away from the original namespace they went inaccessible. Thought it was something silly. Thanks for the help, funny, how you answer most of my clojure questions everywhere I post them :)

18:54 mmarczyk: do I? happy to help :-)

18:55 good this one is sorted out

18:55 slyphon: mmarczyk: oh, i found another bug

18:55 (this is hard)

18:55 mmarczyk: slyphon: I was kind of thinking there might be one

18:55 slyphon: :)

18:55 mmarczyk: let's see if you've got the same one

18:55 :-)

18:56 slyphon: well, &env isn't defined in some contexts

18:56 like, when initially compiling

18:56 mmarczyk: um

18:56 slyphon: i think

18:56 lemme try

18:56 mmarczyk: do you have a not-working example?

18:56 slyphon: make sure

18:56 heh

18:56 one sec

18:57 mmarczyk: incidentally, I realised that an unmention part of the contract for the last version

18:57 is that if a map literal is passed in, then all the keys must be literal keywords or symbols

18:58 slyphon: hrm

18:58 mmarczyk: if symbols, they'll be treated just like keywords, meaning their names will be used

18:58 slyphon: oh, heh

18:58 well

18:58 mmarczyk: is this a problem?

18:58 slyphon: i'm kind of willing to risk that

18:58 ;)

18:58 nah, shouldn't be

18:58 Caused by: java.lang.RuntimeException: java.lang.Exception: Unable to resolve symbol: &env in this context (utils.clj:254)

18:58 mmarczyk: good :-)

18:58 hm, interesting

18:58 could you paste the code which causes this somewhere?

18:58 slyphon: sure

18:59 one sec

19:02 Borkdude: fyuryu: ah

19:02 I'm still wrestling with it, but can't get it to work

19:02 I'm almost giving up...

19:03 Visual Studio is so annoying: it gives hints to add a using System.Dynamic; when I remove it, and when it has added it, says: I don't know where it is

19:05 livingston: so if I have java code that gives me an Iterator, what's the easiest way to get it to be a seq in clojure? iterator-seq ??

19:05 carkh: ,(doc iterator-seq)

19:05 clojurebot: "([iter]); Returns a seq on a java.util.Iterator. Note that most collections providing iterators implement Iterable and thus support seq directly."

19:06 mmarczyk: do I understand correctly that java.util.Iterator doesn't implement Iterable?

19:06 livingston: collections implement iterable

19:06 mmarczyk: so an ArrayList is Iterable, whereas an Iterator isn't?

19:07 I find this somewhat contrary to my initial naive expectations :-)

19:10 rhickey: fuller annotation syntax example: http://gist.github.com/377213

19:10 livingston: mmarczyk: yes

19:11 Borkdude: hmm, I did (read-line) on the repl

19:12 how do I end the input to it??

19:12 mmarczyk: Borkdude: would that be the SLIME repl?

19:12 Borkdude: yes

19:12 mmarczyk: then read & Co. won't work :-(

19:12 with current swank-clojure

19:13 Borkdude: it is reading

19:13 supposedl

19:13 but I don't know how to say: this is it

19:13 chessguy: is 'eval' pretty expensive to call in clojure?

19:14 slyphon: mmarczyk: http://github.com/slyphon/sly-utils

19:14 probably doesn't warrant a proper repository, but i mean, wth

19:14 lein repl, (require '[com.slyphon.utils [update-bean :as ub]]) will cause the barfage

19:14 mmarczyk: if you have an account, i'll add you as a contributor

19:16 mmarczyk: I do, michalmarczyk

19:16 slyphon: mmarczyk: are you polish, perchance?

19:17 mmarczyk: yes

19:17 slyphon: ok, you're a "contributor"

19:17 mmarczyk: right

19:17 slyphon: my best friend from high school is polish, that's why i asked

19:17 mmarczyk: :-)

19:18 livingston: slyphon: the vowel to consonant ratio didn't tip you off

19:18 mmarczyk: livingston: hm? should it?

19:19 slyphon: right, but do you have an actual breaking example?

19:19 slyphon: livingston: hah

19:19 livingston: mmarczyk: well that and the "czyk"

19:19 slyphon: oh

19:19 mmarczyk: it won't even load that

19:20 mmarczyk: slyphon: oh, ok; let me see then

19:20 slyphon: http://github.com/slyphon/sly-utils/blob/master/src/com/slyphon/utils/update_bean.clj

19:20 clojurebot: () invokes the form inside, but there is an implied str call. The semantics are different inside the interpolated string, necessarily so.

19:20 slyphon: clojurebot: huh?

19:20 clojurebot: excusez-moi

19:20 slyphon: :D

19:21 mmarczyk: rhickey: so any metadata entry with a class for a key would be made accessible to Java code in the form of an annotation?

19:21 wherever possible, right?

19:21 livingston: guess you're right :-)

19:21 rhickey: mmarczyk: the class has to derive from Annotation

19:21 i.e. be an annotation

19:21 mmarczyk: rhickey: oh, ok

19:22 slyphon: mmarczyk: hey, you gonna be around for a bit?

19:23 mmarczyk: food just got here

19:23 mmarczyk: so a separate annotations collection in the metadata under a :annotations key wouldn't make much sense, because an Annotation derivee isn't likely to be used for any other purpose, so no need to wrap them

19:23 slyphon: probably

19:23 slyphon: :)

19:24 cool, i'll bbiab

19:25 Chousuke: clojurebot: forget ()

19:25 clojurebot: forget latest is 1382

19:25 Chousuke: duh. :P

19:27 scottj: I've started writing a smalltalk style method finder where you give it an example of how you'd use the method (inputs and result) and it tells you what clojure functions or Java methods in the system fit the bill. Before I get too far though I wanted to check, has anyone written this already?

19:28 Chousuke: possibly for java, but probably not for clojure

19:29 chessguy: a hoogle for clojure?

19:30 dnolen: scottj: no, that sounds pretty cool.

19:31 mmarczyk: scottj: not that I know of, and I can tell you I'd definitely want to use it :-)

19:34 slyphon: I pushed a fix

19:34 chessguy: is 'eval' pretty expensive to call in clojure? e.g., i know it's discouraged in javascript. i'm just not sure if lisp is similar

19:35 scottj: chessguy: never seen hoogle, from its docs about type signatures, does it not support giving true as result and "goof" and "oo" and getting back .contains ? that's more specific than str -> str

19:35 mmarczyk: slyphon: the problem was in that you're using Clojure 1.1 and &env was added more recently

19:36 joshua-choi: Question: how should I refer to a protocol in another namespace? Both org.me/AProtocol and org.me.Protocol are defined, but one is a map and one is a class (or interface?).

19:36 mmarczyk: scottj: so would you actually go ahead and call each candidate method / fn to see if the result matches?

19:36 scottj: dnolen: I want to take the smalltalk method finder to the next level and have it come up with common combinations of functions/methods (tell you to use filter w/ a certain predicate)

19:37 mmarczyk: chessguy: not that expensive in those places where it's actually appropriate to use it

19:37 scottj: mmarczyk: that's what I'm doing right now. I made a list of functions that are dangerous to do that with :)

19:38 chessguy: mmarczyk, an appropriately vague answer for a vague question :)

19:38 mmarczyk: chessguy: see http://stackoverflow.com/questions/2571401/why-exactly-is-eval-evil

19:38 livingston: how do I quote a static function in a java class so that I can apply it? this works (Triple/create a b c) but (apply Triple/create (list a b c)) doesn't

19:40 rhickey: joshua-choi: use org.me/AProtocol to refer to the protocol object

19:40 _rata_: hi

19:40 rhickey: joshua-choi: the interface is just for Java

19:40 _rata_: is there a quick starting guide for people that comes from other Lisp?

19:40 sattvik: livingston: Create an anonymous function #(. obj fn args)

19:41 ,(map #(. %1 charAt 0) ["hi" "there"])

19:41 clojurebot: (\h \t)

19:41 sattvik: Eh, that's not a static function, but should work more or less the same.

19:41 scottj: _rata_: I think wikibook clojure programming used to have a table that detailed some diffs, and rhickey gave a clojure for lisp preso that's on clojure.blip.tv

19:42 I saw a big table that compared a lot of things in emacslisp, common lisp, scheme, and clojure. It was really big, did anyone bookmark that?

19:42 livingston: that's ugly/unfortunate, but ok

19:42 scottj: http://hyperpolyglot.wikidot.com/lisp

19:43 scottj: livingston: thanks

19:43 dnolen: _rata_: I assume you already looked over http://clojure.org/lisps

19:43 livingston: I happend to have it open - i don't think it's totally great, but it'll give you a few quick pointers

19:43 sattvik: ,(map #(. Integer parseInt %1) ["1" "2"])

19:43 clojurebot: (1 2)

19:43 _rata_: thank you all :)

19:43 uberjar: http://www.lisperati.com/clojure-spels/casting.html

19:44 _rata_: I have a lot to read now :)

19:44 uberjar: thats clojure's poigant guide

19:45 mmarczyk: scottj: you could still do some initial filtering based on argument & result types

19:46 scottj: mmarczyk: for java methods yeah, for clojure functions though, other than obvious arity things?

19:47 mmarczyk: you could check if there's any type hints

19:47 rhickey: initial annotation support is up!

19:47 bulk of the work is 50 lines of Clojure - http://github.com/richhickey/clojure/commit/fa899d22dceb531d9f5af833ac6af0d956e6bdc7

19:47 mmarczyk: cool :-)

19:47 rhickey: is it possible to get at the type hints on a function's arguments?

19:48 joshua-choi: rhickey: Thanks. However, you cannot refer to a type by org.me/Type. Is this by design?

19:49 scottj: other than looking at the source :)

19:49 mmarczyk: oh, ok

19:49 I found out myself

19:49 slyphon: mmarczyk: hey, did you have a chance to take a look?

19:49 mmarczyk: (defn #^String foo [#^String s] (count s))

19:50 (meta (first (first (:arglists (meta #'foo)))))

19:50 slyphon: yes, I committed a fix

19:50 slyphon: w00t!

19:50 ty

19:50 rhickey: joshua-choi: I don't understand. In order to use the protocol you need to refer to the protocol object, not the type

19:50 scottj: mmarczyk: cool

19:50 mmarczyk: scottj: of course not that many things are hinted... but still

19:50 slyphon: mmarczyk: hah! nice

19:51 thanks

19:51 mmarczyk: slyphon: btw, I also thought about how this is fundamentally broken :-)

19:51 joshua-choi: rhickey: Yes, sorry; never mind.

19:51 slyphon: hahah

19:51 mmarczyk: oh yeah?

19:51 mmarczyk: cool, no?

19:51 yeah

19:51 rhickey: joshua-choi: in any case ,no, foo.bar/baz is always a ns member or static member

19:51 mmarczyk: but just to make sure

19:52 joshua-choi: rhickey: And datatypes are no longer members of namespaces, right?

19:52 mmarczyk: what would be a simple bean I could work with...?

19:52 I mean is there something in java standard libs I could test this with?

19:52 rhickey: joshua-choi: datatypes are named types, and no longer create factory fns in a ns, right

19:53 slyphon: mmarczyk: hang on, i'll check in that class i was using

19:53 joshua-choi: rhickey: Okay. It's a tad annoying, since I must now import constructors with import instead of require, but I can just create factory functions, so it's okay.

19:53 mmarczyk: slyphon: ok, I'll run a little experiment of my own in the meantime

19:53 slyphon: kk

19:54 rhickey: full example of annotations http://gist.github.com/377213

19:55 joshua-choi: right, a factory fn in your control lets you process args, have defaults etc

19:56 mmarczyk: slyphon: right, so this will break in the following way

19:56 say you want to have a Var named params holding some params to use with update-bean

19:57 joshua-choi: rhickey: In any case, though, we should probably indicate in our datatypes' docstrings the intended way to create the datatype: by constructor or a factor method, right?

19:57 mmarczyk: then you compile a function which uses update-bean and give it the symbol params as the second argument

19:57 scottj: 50 lines? what happened to one line for new features? you're slipping. Didn't someone say if you can write an annotation in one line you should be able to implement annotations in one line? </sarcasm>

19:57 slyphon: symbol capture

19:57 mmarczyk: this will work just fine, BUT

19:57 slyphon: ?

19:57 mmarczyk: if you then go and redefine params to something else

19:57 your function will never notice

19:57 clojurebot: http://jackcoughonsoftware.blogspot.com/2009/05/teaching-functional-programming-to-kids.html

19:57 slyphon: oy

19:57 mmarczyk: and the update-bean bit will use the previous value of params

19:58 slyphon: hmm

19:58 so this probably needs to use gensyms?

19:58 mmarczyk: obviously, since it's determined at macro expansion time

19:58 um, no, that won't do

19:58 actually, at this point, I'm inclined to say that this is a perfect use case for eval

19:59 slyphon: hah

19:59 rhickey: http://github.com/slyphon/sly-utils/blob/master/src/com/slyphon/utils/update_bean.clj

19:59 rhickey: if you have a moment

19:59 mmarczyk: though it'll still need to be a macro

19:59 slyphon: rhickey: this has presented a bit of a poser

19:59 * slyphon nods

19:59 mmarczyk: since there might be locals involved

20:00 hm, actually the fundamental question to ask ourselves is

20:00 slyphon: rhickey: the use case is to update a bean, generating the method names based off of keys of a hash passed in

20:00 mmarczyk: whether this is a problem :-)

20:00 slyphon: hah

20:00 mmarczyk: or maybe reflection is fine after all

20:00 with a nice bit of reflection-fu, this can be a proper function

20:00 slyphon: so it's going to change the value of a local variable behind the function's back?

20:01 mmarczyk: hm? not sure I understand

20:01 slyphon: hah

20:01 well, i don't quite understand what would break

20:01 mmarczyk: well

20:01 rhickey: slyphon: you've looked at bean, in core_proxy.clj?

20:01 mmarczyk: notice how, when given a symbol as the second arg, update-bean calls eval

20:01 slyphon: rhickey: yes, it scared me

20:01 i thought bean was read-only

20:02 mmarczyk: rhickey: doesn't bean return a read-only object?

20:02 rhickey: yes, it's read only, but a very similar job

20:02 * slyphon nods

20:02 * mmarczyk ponders the output of (source bean)

20:02 slyphon: rhickey: i don't quite know how to phrase this, but what is it about '.' that makes this so challenging?

20:04 mmarczyk: rhickey: could bean be rewritten using reify, IPersistentMap and support assoc as a property-setting operation?

20:04 to be used like transients, i.e. in a highly localised fashion

20:07 slyphon: continuing about eval in update-bean, it only gets called once -- when the macro is expanded

20:07 then that hypothetical update-bean-using function gets compiled with the result of the expansion becoming a part of its code

20:07 slyphon: ohhhhh

20:07 mmarczyk: that is, with the map hard-wired inside it

20:07 MadWombat: was defservice replaced by something else in compojure 0.4.0?

20:07 mmarczyk: by value

20:08 slyphon: mmarczyk: that's bad

20:08 mmarczyk: do you have a CL or Scheme background?

20:08 mmarczyk: MadWombat: likely moved off to some other project, see http://formpluslogic.blogspot.com/2010/04/migrating-from-compojure-032-to-040-and_01.html

20:08 slyphon: Scheme

20:08 slyphon: ahh

20:09 mmarczyk: MadWombat: it doesn't mention defservice in particular, but perhaps the dependencies list will give you a hint

20:10 slyphon: i've been thinking about looking into scheme, i tried CL a few years ago, but it was really ....overwhelming

20:12 mmarczyk: I like reading Lisp books :-)

20:13 slyphon: mmarczyk: is there a scheme book in particular you'd recommend?

20:13 mmarczyk: well, I taught myself to programme with SICP

20:13 slyphon: hah

20:13 mmarczyk: and I honestly believe it's the very best technical book I ever read

20:14 MadWombat: mmarczyk: I guess it is up to jetty to provide a way to run compojure as a war

20:15 mmarczyk: MadWombat: couldn't say with any certainty

20:15 I don't know much about Java Web deployment schemes

20:15 (I suppose I'd like to change that)

20:16 joshua-choi: Question. A method called clojure.lang.RT.set is raising a "java.lang.IllegalArgumentException: Duplicate key: true", and I don't know why.

20:16 mmarczyk: but I'd probably look inside ring-servlet

20:16 joshua-choi: But I do know it has something to do with the preconditions in a function.

20:16 mmarczyk: slyphon: then there's EOPL and PAIP

20:16 slyphon: mmarczyk: i have an example of programmatically setting up a servlet container w/ jetty

20:16 mmarczyk: PAIP is more a "reading list" item now, but the bits I've read so far are fantastic

20:17 slyphon: ahh

20:17 ok, these are the clasics

20:17 mmarczyk: so they are :-)

20:17 I rather think the status is well deserved :-)

20:17 slyphon: hah

20:17 well, i'll have a go then

20:18 mmarczyk: :-)

20:18 slyphon: i read ANSI Common Lisp and that free one online

20:19 mmarczyk: slyphon: I'd like to get some initial picture of what the Java Web stack looks like

20:19 for starters

20:19 right now I seem to be bumping into new acronymes all the time :-)

20:19 slyphon: mmarczyk: ah, well, you take what you think about "web serving" and you hit it with a hammer, then you take all those little shards and you make them into Classes and Frameworks seemingly at random

20:20 mmarczyk: Practical Common Lisp, I guess?

20:20 slyphon: mmarczyk: that's the one

20:20 nurv: mmarczyk: Maybe you'll enjoy "Lisp in small pieces"

20:20 slyphon: i find clojure is much easier to digest

20:20 and *WAY* more fun than scala

20:20 mmarczyk: nurv: I think I would, I've skimmed it a couple of times and even the short bits I read were quite enlightening

20:21 nurv: mmarczyk: Very technical sometimes but it's worth it.

20:21 mmarczyk: slyphon: totally with you on that :-)

20:21 slyphon: :)

20:21 nurv: Some discussions on different object systems and environments are pretty "aha!" moments.

20:23 mmarczyk: nurv: well, that's definitely on my list

20:23 and pretty high up :-)

20:25 nurv: EOPL has a new edition, but i didn't read it.

20:25 At least the source code works on PLT Scheme and new implementations.

20:25 slyphon: woah

20:25 mmarczyk: slyphon: my hopes of getting a clear picture of said Classes and Frameworks and how they fit together are already wrapped up in lots of duct tape after having fallen apart on a number of occasions

20:25 slyphon: :)

20:26 i went from zero to deploying a couple of core pieces of the infrastructure of motionbox.com with jruby and jetty

20:26 it takes a lot of reading and futzing, until you know what's safe to ignore

20:26 mmarczyk: nurv: eopl3 is a bit different from 2

20:26 slyphon: b/c a lot of that javaee stuff is just over-complicated

20:26 mmarczyk: the most striking difference, to me

20:27 is that it's not self-contained

20:27 in that you have to get the define-datatype stuff

20:27 as well as a lexer/parser

20:27 somewhere

20:27 and they don't help you with that at all :-)

20:27 nurv: Uhm, i remember downloading the sources and running some chapters without requiring anything else.

20:27 Mind you i've probably only tested the first ones.

20:28 mmarczyk: hm, really?

20:28 well maybe I've got it mixed up with something else then, it's been a while back

20:29 scottj: sounds like you have the right thing: http://www.cs.indiana.edu/eopl/MLblurb.html

20:29 nurv: The only problem with EOPL is that the interpreters are quite inefficient for the sake of clarity.

20:29 clojurebot: Clarity of mind means clarity of passion, too; this is why a great and clear mind loves ardently and sees distinctly what it loves. -- Pascal

20:29 nurv: Heh.

20:30 But i suposse that's what LiSP and other books are for.

20:30 mmarczyk: slyphon: (-> over-complicated (#(apply @(ns-resolve 'clojure-core 'inc) %)))

20:30 slyphon: hah

20:30 nurv: Anyway, good night, going bed.

20:30 mmarczyk: nurv: there's a possible EOPL -> LiSP progression :-)

20:31 see you!

20:31 nurv: mmarczyk: yes

20:31 That's mostly what i did.

20:31 SICP -> EOPL -> LiSP.

20:31 mmarczyk: nurv: well, I'm a bit past the middle of that road :-)

20:31 nurv: can't wait to join you at the end :-)

21:09 remleduff: Is loading ~/.clojure/user.clj a clojure.main thing or does every repl implementation have to source that itself (if it does)?

21:13 hiredman: remleduff: I believe it's clojure.main

21:27 slyphon: uh, multimethods can have multiple arities, right?

21:28 carkh: (defmulti belh (fn [target & args] (:type target)))

21:28 slyphon: ok, thought so

21:29 carkh: (defmethod belh :type1 [a-type-1 arg1 arg2] ...)

21:29 mmarczyk: slyphon: I pushed a new branch

21:29 slyphon: mmarczyk: hah!

21:29 mmarczyk: with a proposed eval-based fix

21:29 slyphon: awesome

21:29 * slyphon goes to take a look

21:29 hiredman: they can have multiple arities, but your dispatch function needs to be able to handle every arity

21:30 mmarczyk: the previous version is still in there, commented out

21:30 slyphon: how about your methods?

21:30 mmarczyk: ok :)

21:30 hiredman: doesn't matter

21:30 slyphon: ok, cool

21:30 mmarczyk: the methods need to handle every arity which makes sense for the given dispatch value

21:31 slyphon: that's what i thought, just wanted to make sure that was what the reality actually was

21:33 mmarczyk: slyphon: oh bother, I think I'm getting a bit tired here

21:33 forgot to commit before pushing

21:33 slyphon: hah

21:33 i have quite a few commit messages at work "doh! helps to add the file"

21:34 (and i'm not the only one)

21:34 mmarczyk: :-)

21:34 done now

21:34 slyphon: k

21:36 mmarczyk: and if you have it return doto# instead of (eval doto#), you'll get a more digestible view of what would happen with eval than with macroexpand

21:38 slyphon: uh

21:38 what's #_ ?

21:38 comment?

21:39 remleduff: Yeah, completely hides the following form, as opposed to (comment) which returns nil

21:40 hiredman: in both case the stuff commented out needs to be readable

21:40 slyphon: interesting

21:41 remleduff: I've been using swank-clojure-project and am trying to switch to lein swank, but I don't seem to have any M-x slime-connect available (I do have slime-repl) installed. Any ideas?

21:41 slyphon: that's kind of odd

21:42 mmarczyk: wait, you're nesting `() ?

21:42 that's why the gensyms work in the inner form?

21:43 mmarczyk: remleduff: can you check if M-x slime-connect becomes available after you launch a repl with swank-clojure-project?

21:43 slyphon: the autogensyms work at the same nesting level, I believe

21:43 slyphon: hrm, you're using k# on line 34

21:43 remleduff: mmarczyk: Yeah, a bunch of slime functions become available after swank-clojure-project

21:44 slyphon: remleduff: (require 'slime) ?

21:45 remleduff: slyphon: Yep, thanks

21:45 mmarczyk: slyphon: just checked and so it is

21:46 http://pastie.org/932493

21:46 note how the k# occurs within an unquoted form

21:47 it's still syntax-quoted, but just one level, while the . is at level 2

21:47 slyphon: wow

21:48 ok, i need to go "back to the woodshed" and study some of this stuff

21:48 hiredman: you don't need macros to use `

21:48 ,`x#

21:48 clojurebot: x__11270__auto__

21:48 * slyphon bursts into tears

21:48 mmarczyk: it could be useful to test it :-)

21:48 slyphon: ah, ok

21:48 :)

21:49 hiredman: ,(let [x '(1 2 3)] `(~@x))

21:49 clojurebot: (1 2 3)

21:49 slyphon: the macro only affects when the parameters are evaluated?

21:50 that's the "macroness"?

21:50 hiredman: right

21:50 mmarczyk: or you could say

21:51 a macro function operates on the form to be compiled

21:51 hiredman: ,(:macro (meta #'defn))

21:51 clojurebot: true

21:51 hiredman: ,(:macro (meta #'+))

21:51 clojurebot: nil

21:51 hiredman: that is the difference

21:51 mmarczyk: as opposed to runtime parameter values operated upon by regular functions

21:51 * slyphon nods

21:52 mmarczyk: so, a macro is a perfectly regular function, but it gets called when the code is compiled

21:52 slyphon: when i first started learning unix, someone told me "Everything is a file". It took me about 5 years until i *really* understood the implications of that

21:52 i have a feeling this is something similar :)

21:52 mmarczyk: :-)

21:53 slyphon: mmarczyk: that makes sense

21:53 and i kind of grok that, i think i just haven't had enough practice thinking about the code in that way

21:54 the "code is data, data is code" thing that drives people mad

21:54 mmarczyk: have you ever used Scheme?

21:55 slyphon: no, but i feel that i should

21:55 mmarczyk: syntax-rules macros are cool :-)

21:55 slyphon: hah

21:55 mmarczyk: http://www.xs4all.nl/~hipster/lib/scheme/gauche/define-syntax-primer.txt

21:56 there's nothing whatsoever strange about CL-style macros when you compare it with that :-)

21:56 on the surface, that is, semantically I kinda feel the reverse is true

21:57 slyphon: "I have noticed that it is easy to

21:57 find both trivial examples and extraordinarily complex examples, but

21:57 there seem to be no intermediate ones."

21:58 sorry, i thought that'd be one line

21:58 hiredman: mmarczyk: you could port syntax-rules to clojure

21:58 slyphon: but that's very astute

21:59 mmarczyk: hiredman: actually I was thinking of doing that

21:59 slyphon: mmarczyk: these differ from regular macros in what way?

22:00 mmarczyk: slyphon: scroll down and have a look at some of the examples :-)

22:00 * slyphon does that

22:00 mmarczyk: there's a completely different syntax

22:00 that's the superficial part

22:00 then they are hygienic

22:00 meaning that they prevent variable capture and the like

22:01 * slyphon nods

22:01 gregh: somewhere I saw a port of syntax-rules to CL

22:01 hiredman: clojure does make it a pain to capture symbols

22:02 gregh: it'd still probably need significant work to port it again to clojure

22:02 mmarczyk: consider (defmacro aif ([pred then] (aif pred then else)) ([pred then else] (list 'let ['it pred] (list 'if then else))))

22:02 slyphon: there's an example of how to do it in the Programming Clojure book

22:02 (symbol capture, that is)

22:02 hiredman: ~'foo

22:02 clojurebot: Huh?

22:02 hiredman: I mean, it's not that much of a pain

22:02 ,`~'foo

22:02 clojurebot: foo

22:02 mmarczyk: gregh: I might google around for it then

22:03 I was thinking of stealing ideas from PLT sources

22:03 slyphon: are there multiple schemes?

22:03 hiredman: yes

22:03 slyphon: like the plethora of CL implementations?

22:03 mmarczyk: slyphon: loads

22:03 hiredman: scheme is legion

22:03 slyphon: uh

22:03 hiredman: hah!

22:03 which one would you guys recommend?

22:03 for someone just learning

22:03 hiredman: *shrug* I prefer clojure

22:04 * slyphon laughs

22:04 mmarczyk: slyphon: more than one per Schemer

22:04 :-)

22:04 slyphon: hah

22:04 * slyphon sees "which one is in apt"

22:04 hiredman: I think someone was writing a scheme interpreter in clojure

22:04 gregh: mmarczyk: http://www.ccs.neu.edu/home/dorai/mbe/mbe-lsp.html

22:04 sexpbot: "Scheme Macros for Common Lisp"

22:04 mmarczyk: MIT Scheme makes it easy to go along with SICP and the classical mechanics book

22:04 Structure and Interpretation of Classical Mechanics

22:04 hiredman: ~google clojure scheme

22:04 clojurebot: First, out of 22400 results is:

22:04 Clojure Programming/Tutorials and Tips - Wikibooks, collection of ...

22:04 http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips

22:04 hiredman: bah

22:05 ~google scheme in clojure

22:05 clojurebot: First, out of 23200 results is:

22:05 Clojure Programming/Tutorials and Tips - Wikibooks, collection of ...

22:05 mmarczyk: gregh: thanks a bunch!

22:05 clojurebot: http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips

22:05 mmarczyk: I'll be taking a close look at that

22:05 hiredman: ttp://clojure.wikidot.com/scheme-interpreter-in-clojure is the real url

22:05 with an h

22:06 slyphon: hah "Scheme 9 From Empty Space"

22:06 mmarczyk: slyphon: there's a so-called "language level" -- a customised version of Scheme -- for EOPL in PLT Scheme

22:06 um, ouch

22:06 I mean Racket

22:06 slyphon: still not as good as the "run plan 9 as a regular program" project "Plan 9 from Userspace"

22:07 mmarczyk: I use Petite Chez Scheme for Project Euler

22:07 PLT for other stuff

22:09 hiredman: seems like a port of syntax-rule to clojure should take advantage of clojure's destructuring

22:11 (defsyntax-rule {(foo [first & rest]) (conj (vec rest) first)})

22:11 right needs a name

22:12 (defsyntax-rule first->last {(foo [first & rest]) (conj (vec rest) first)})

22:13 (first->last (list 1 2 3)) => (let [[first_12 & rest_85] (list 1 2 3)] (conj (vec rest_85) first_12))

22:13 mmarczyk: apparently there's no licence on that code

22:13 slyphon: it's free!

22:15 mmarczyk: ah, LGPL actually

22:16 slyphon: oof

22:16 Can't embed object in code, maybe print-dup not defined: atomikos MessageProducer proxy for HornetQRAMessageProducer->org.hornetq.core.client.impl.ClientProducerImpl@75896415

22:16 weird

22:18 hiredman: oooo

22:18 you doing stuff with hornetq?

22:18 slyphon: yup

22:18 *way* more stable than AMQ

22:19 * hiredman was using hortnetq to get irc from #clojure as growls

22:19 slyphon: hah

22:19 hiredman: clojurebot was sticking messages on the queue and my laptop was picking them up over openvpn

22:19 slyphon: nice

22:19 hiredman: very enterprise

22:20 slyphon: yeah, just gotta slap a web front-end on it and you can start charging for support

22:23 _rata_: what do I have to do to make swank-clojure works?

22:24 I've followed the instructions here http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Emacs

22:24 sexpbot: "Getting Started with Emacs | Clojure | Assembla"

22:24 _rata_: but it doesn't work yet

22:24 it says: (progn (load "/usr/share/emacs/site-lisp/slime/swank-loader.lisp" :verbose t) (funcall ...

22:24 in the first line of the REPL

22:24 and then: java.lang.Exception: Unable to resolve symbol: progn in this context (NO_SOURCE_FILE:1)

22:25 hiredman: haha

22:25 slyphon: http://technomancy.us/126

22:25 sexpbot: "in which are found tricks of the trade concerning clojure authorship - Technomancy"

22:25 slyphon: i found that guide to be quite useful

22:25 hiredman: _rata_: what exactly are you doing

22:26 that exception says you are trying to evaluate elisp as clojure

22:26 _rata_: first I did install package.el

22:26 hiredman: woa

22:26 _rata_: then I do M-x package-list-packages and install clojure-mode, slime, slime-repl and swank-clojure

22:26 hiredman: wait

22:27 you did (progn (load "/usr/share/emacs/site-lis... at a clojure repl?

22:27 _rata_: no

22:27 that was what emacs did

22:27 when I put M-x slime

22:28 hiredman: _rata_: pretty sure you don't want to install slime and slime-repl

22:28 _rata_: why?

22:28 clojurebot: why not?

22:28 hiredman: swank-clojure or clojure-mode pull in the clojure parts of slime

22:29 _rata_: ahh ok

22:29 hiredman: the slime stuff listed in epl is most likely the common lisp slime stuff

22:29 _rata_: and how do I remove them?

22:29 hiredman: darned if I know

22:29 mmarczyk: actually I thought that elpa users are expected to install slime separately

22:30 but I wouldn't really know, I'm using my own checkout

22:30 _rata_: do I need paredit?

22:30 hiredman: yes

22:30 _rata_: ok

22:30 hiredman: last I heard clojure slime and upstream slime did not play well together

22:31 mmarczyk: _rata_: maybe not strictly need it, but you should definitely want it :-)

22:31 hiredman: in some ways

22:31 but elpa is behind upstream

22:31 hiredman: if you aren't already an emacs user I recommend you get the starter kit

22:31 * slyphon hugs paredit

22:31 mmarczyk: possibly partly for this reason

22:32 * slyphon wishes every language had something like paredit

22:32 mmarczyk: as a side note, SLIME HEAD works perfectly fine for me

22:32 I trust people who say that slime-autodoc doesn't work

22:32 _rata_: and do I need to set the inferior-lisp-program in .emacs?

22:32 mmarczyk: and not load it, that's all

22:33 * mmarczyk wholeheartedly agrees with slyphon re: paredit

22:33 _ato: you shouldn't normally need anything slime/swank related in .emacs when using swank-clojure

22:34 mmarczyk: oh? where does elpa put its autoloads etc. then?

22:35 hiredman: ~google emacs starter kit

22:35 clojurebot: First, out of 2680 results is:

22:35 technomancy&#39;s emacs-starter-kit at master - GitHub

22:35 http://github.com/technomancy/emacs-starter-kit

22:36 hiredman: it's good stuff

22:36 the only real problem is the starter kit is setup to make parens a faint gray

22:37 _rata_: I unistalled everything removing .emacs.d/elpa

22:37 hiredman: _rata_: get the starter-kit, it will make your life easier

22:37 _ato: mmarczyk: if I remember correctly elpa just activates everything that's installed (ie everything that's in ~/.emacs/elpa)

22:37 _rata_: but when I install swank-clojure again, it also installed slime and slime-repl :(

22:37 hiredman: I believe it comes with clojure-mode at least, and maybe swank-clojure as well

22:37 _ato: err ~/.emacs.d/elpa I mean

22:38 mmarczyk: _ato: I see, thanks

22:39 if that means pulling everything in at startup time... oh dear

22:39 _ato: mmarczyk: activate == install autoloads, not fully load everything

22:40 mmarczyk: oh ok

22:44 _rata_: mmmm... I don't get it

22:44 I removed my .emacs file and removed .emacs.d/elpa

22:45 installed the starter-kit

22:45 and now I have my emacs as it was the first day I installed it

22:45 I don't even have the M-x package-list-packages

22:46 thing

22:46 hiredman: _rata_: are you sure you installed starter-kit correctly?

22:47 _rata_: cd ~/.emacs.d && git clone http://github.com/technomancy/emacs-starter-kit.git

22:47 _ato: ah

22:47 hiredman: :|

22:47 _ato: you've got in a subdirectory then

22:47 _rata_: yes... that says the README

22:48 _ato: do: mv ~/.emacs.d/emacs-starter-kit ~ && rmdir ~/.emacs.d && mv ~/emacs-starter-kit ~/.emacs.d

22:48 _rata_: "Move the directory containing this file to ~/.emacs.d"

22:48 ok

22:48 hiredman: right, not ~/.emacs.d/

22:50 _rata_: well, it's working now :)

22:50 there were a lot of errors/warnings while compiling though

22:50 hiredman: now you just need autocomplete and rainbow parens

22:51 thats normal, don't worry about it

22:51 _rata_: ok

22:51 hiredman: what's autocomplete and rainbow parens?

22:52 that sounds interesting

22:52 hiredman: http://www.emacswiki.org/emacs/AutoComplete

22:52 sexpbot: "EmacsWiki: Auto Complete"

22:53 _rata_: (now, I did M-x package-list-packages, selected clojure-mode and swank-clojure from the list, and again slime and slime-repl got installed)

22:53 hiredman: *shrug*

22:53 M-x slime

22:53 _ato: it's normal for slime and slime-repl to be installed

22:53 as dependencies

22:54 I have them at least anyway

22:54 _rata_: is autocomplete better than company?

22:54 hiredman: http://dishevelled.net/elisp/rainbow-parens.el

22:54 company?

22:55 * hiredman googles

22:55 hiredman: I have nod idea

22:55 _rata_: ok

22:55 slyphon: i use autocomplete

22:55 it's a'ight

22:56 * slyphon has been thinking about turning it off and using hippie-expand

22:56 hiredman: the company mode wiki page has some discussion of company vs. ac as does the ac wikipage

22:57 _rata_: what does rainbow-parens do?

22:58 well, slime seems to be working now... how do I say to swank-clojure how to execute clojure? (it says clojure is not installed, but it is)

22:58 _ato: rainbow-parens is designed to burn out your eyes ;-)

22:59 slyphon: haha

22:59 hiredman: http://tinypic.com/view.php?pic=2urqmgl&s=6

23:00 sexpbot: "emacs rainbow-parens Pictures, emacs rainbow-parens Images, emacs rainbow-parens Photos, emacs rainbow-parens Videos - Image - TinyPic - Free Image Hosting, Photo Sharing &amp; Video Hosting"

23:00 hiredman: it changes the color of parens based on nesting level

23:00 very handy

23:01 slyphon: wow, mit-scheme takes a *long* time to compile

23:07 mmarczyk: I prefer highlight-parentheses

23:07 but guess it does the same ultimately

23:08 slyphon: well, one is on-demand

23:11 jeez

23:11 * slyphon 's lap is on fire

23:11 slyphon: that's not meant to be a come-on

23:12 _rata_: hahahahahaha

23:13 mmarczyk: slyphon: no precompiled package for your OS?

23:13 slyphon: well

23:13 i'm using macports

23:13 * slyphon 's cpu hits 83C

23:16 mmarczyk: http://www.gnu.org/software/mit-scheme/

23:16 sexpbot: "MIT/GNU Scheme - GNU Project - Free Software Foundation (FSF)"

23:16 mmarczyk: they've got MacOS X binaries

23:16 danlarkin: that really is annoying

23:17 slyphon: mmarczyk: well, i'll use that if ti goes from a first-degree to second-degree burn

23:18 mmarczyk: :-)

23:32 _rata_: mmmm.. there are some annoying things with the emacs starter kit... how do I get rid of that green line over the current line?

23:33 hiredman: that is most likely hl-line-mode

23:34 _rata_: hiredman: thanks :)

23:34 slyphon: oh, i always thought that was part of cedet

23:34 oh, that's above each method decl

23:40 wow

23:40 that took almost an hour

23:43 _rata_: how do I inform swank-clojure where do I have clojure installed?

23:44 mmarczyk: hm, rainbow-paren has very clean sources apparently

23:45 _rata_: I couldn't make rainbow-parens work :(

23:45 mmarczyk: did it complain about not being able to find paredit or sth?

23:46 Raynes: Ew @ hl-line-mode

23:46 mmarczyk: if so, highlight-parentheses is self-contained, so you could use that instead

23:46 so as to avoid the hassle of fixing things and yet have highlighted parens...

23:46 remleduff: If I quit emacs and choose to "kill the active connection and then exit", I can't M-x slime-connect after restarting emacs. Is that my fault for quitting the wrong way?

23:46 mmarczyk: but r-p's code is in fact so clean that I might be able to write a cool advice for it

23:46 slyphon: remleduff: that's odd

23:47 remleduff: It says "connection refused"

23:47 slyphon: oh, you have to restart the clojure process

23:49 Raynes: It looks like one of my dependencies is turning *warn-on-reflection* on, and I'm getting reflection warnings everywhere. Is there a way to force it to stay off?

23:49 remleduff: Yeah, I was thinking the whole point of lein swank was that it would survive emacs restarts

23:50 slyphon: nah, it's more that you can specify the command-line args more easily (i found)

23:50 customize them per-project

23:54 _rata_: mmarczyk: it doesn't say anything

23:54 but the parens are the same as before when I do (require 'rainbow-parens)

23:56 hiredman: (rainbox-parens-mode 1)

23:57 rainbow

23:57 (rainbow-paren-mode t) is what is in my hiredman.el

23:58 _rata_: :) thanks again

23:58 slyphon: o/` Just a box of rain, or a ribbon for your hair... o/`

Logging service provided by n01se.net