#clojure log - Mar 17 2010

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

0:01 brian__: test

0:06 zaphar_ps: anyone had problems with swank-clojure and working directories when compiling?

0:10 brian__: hi, I am trying to run zef's leiningen tutorial, I have the latest lein, and followed directions

0:10 i have java 1.5

0:10 zephyr:~/desktop/test2/helloworld rberger$ lein compile

0:10 [copy] Copying 2 files to /Users/rberger/Desktop/test2/helloworld/lib

0:10 Exception in thread "main" java.lang.NullPointerException (NO_SOURCE_FILE:0)

0:10 at clojure.lang.Compiler.eval(Compiler.java:4658)

0:10 at clojure.core$eval__5236.invoke(core.clj:2017)

0:10 at clojure.main$eval_opt__7411.invoke(main.clj:227)

0:12 zaphar_ps: brian__: can't really help without code

0:12 brian__: ok

0:13 test2/helloworld rberger$ cat project.clj

0:13 (defproject helloworld "0.1"

0:13 :dependencies [[org.clojure/clojure

0:13 "1.1.0-master-SNAPSHOT"]

0:13 [org.clojure/clojure-contrib

0:13 "1.0-SNAPSHOT"]]

0:13 :main helloworld)

0:13 zephyr:~/desktop/test2/helloworld rberger$

0:13 zephyr:~/desktop/test2/helloworld rberger$ ls src

0:13 helloworld.clj

0:13 zephyr:~/desktop/test2/helloworld rberger$ cat src/helloworld.clj

0:13 (ns helloworld

0:13 (:gen-class))

0:13 (defn -main [& args]

0:13 (println "Hello world!"))

0:13 its on mac 10.4 though

0:14 zaphar_ps: brian__: just a tip since it's quiet but pastebin is your friend.

0:14 brian__: ok

0:14 zaphar_ps: I'm pretty cool but some folks on some channels would get upset at a paste bomb like that :-)

0:14 brian__: lol

0:14 i never did this

0:15 zaphar_ps: ever used pastebin before?

0:15 brian__: no

0:15 what do i do?

0:15 zaphar_ps: http://clojure.pastebin.com/

0:15 brian__: ok

0:15 zaphar_ps: go there and paste your code in

0:15 brian__: ok

0:15 zaphar_ps: then return here with the link

0:15 brian__: ok

0:17 zaphar_ps: ohla folks

0:18 crowb4r: Hi

0:19 brian__: http://clojure.pastebin.com/mw0ta2GF

0:23 zaphar_ps> do you see it?

0:23 Boohbah: clojure rocks!

0:23 zaphar_ps: brian__: I'm not seeing any obvious error in your code.

0:24 brian__: i dont either, i copied off the site

0:24 its java 1.5

0:24 bmason: jetty is driving me crazy... is there a way to stop it once it's gone 'rogue' ?

0:24 zaphar_ps: bmason: I don't use it so have no idea

0:25 bmason: zaphar_ps: do you use compojure?

0:26 technomancy: brian__: the real question is what are you doing on rberger's machine, and does he know about it?

0:26 brian__: its a different rberger

0:26 technomancy: brian__: you should probably use clojure 1.1.0 instead of the prerelease snapshot

0:26 * rfg was wondering the same thing.

0:26 technomancy: also: that doesn't look like the latest leiningen

0:27 zaphar_ps: bmason: no

0:27 brian__: ok, i just reloaded it

0:27 zaphar_ps: brian__: the code compiles fine for me :-)

0:27 brian__: hmm

0:28 zaphar_ps: technomancy: hows it goin :-)

0:28 bmason: anyone else had problems with extra jetty processes starting and clogging up one's ports?

0:28 zaphar_ps: bmason: my one and only web clojure project is a static site generator like jekyll

0:28 technomancy: zaphar_ps: not bad

0:29 zaphar_ps: technomancy: You use swank-clojure right?

0:29 technomancy: zaphar_ps: I maintain it... sort of.

0:29 bmason: lol

0:30 zaphar_ps: I'm having an issue I think is probably something I just don't have setup right when compiling files

0:30 specifically files that need to reference local files during the compile

0:31 I think it might be related to the working directory of whatever java process is compiling the file? but I'm not sure and I'm new to elisp so I'm not completely following it all

0:31 technomancy: are you requiring the gen-class nses from the nses that need them?

0:33 zaphar_ps: technomancy: yes but I the clojure code is enlive and it references an html file during the compile and that seems to be what it's failing on

0:33 technomancy: zaphar_ps: aha... is the HTML file in the resources directory?

0:33 zaphar_ps: technomancy: yes

0:34 brian__: this is an aside, but you need gen-class to create java classes? Isn't that generally what its used for, no pun intended?

0:34 technomancy: zaphar_ps: oh... I think earlier versions of swank-clojure-project didn't respect resources

0:34 zaphar_ps: have you tried lein swank?

0:34 zaphar_ps: technomancy: no, details?

0:34 http://code.google.com/p/molehil/source/browse/src/com/marzhillstudios/molehill/template.clj

0:34 thats the code in question

0:35 lein compile works fine

0:35 technomancy: zaphar_ps: lein swank in the shell, then M-x slime-connect in Emacs

0:35 or upgrade to the latest swank-clojure.el

0:35 zaphar_ps: I have the latest from elpa I think I can check to make sure.

0:35 is elpa current?

0:36 technomancy: I think the elpa version might be missing resources

0:36 I should push out a fix

0:36 zaphar_ps: technomancy: okie where can I get latest then?

0:37 technomancy: zaphar_ps: try from my git fork: http://github.com/technomancy/swank-clojure

0:38 zaphar_ps: technomancy: how much has changed?

0:38 technomancy: zaphar_ps: hardly anything on the elisp side

0:38 brian__: technomancy> I thought leiningen loads the latest clojure jars , I don't have clojure in my path

0:39 technomancy: which is why I haven't gotten around to pushing the fix

0:39 brian__: no, you should have clojure in lib

0:39 I just mean there's no reason for you to be using an outdated version like that

0:40 zaphar_ps: technomancy: got install instructions that don't use elpa? :-)

0:40 new to elisp so sorry for the newb questions :-(

0:40 technomancy: np; just do M-x package-install-from-buffer

0:43 brian__: technomancy> i'm not sure i follow you this is in lib-> clojure-1.1.0-master-20091231.150150-10.jar

0:44 bmason: this means leiningen is pulling a snapshot version of clojure

0:45 zaphar_ps: technomancy: then just restart emacs? do I need to install the clojure libs as well?

0:45 technomancy: brian__: right, your project.clj specifies an old version of clojure. you should update it (and contrib) to 1.1.0 instead. then do lein clean && lein deps

0:46 brian__: oh, i c

0:46 technomancy: zaphar_ps: I don't think you need to restart, but if it's acting funky you could try it

0:46 brian__: thx

0:46 zaphar_ps: okie

0:47 bmason: ah I missed the date on the snapshot... yeah that is old :)

0:47 is that from Stuart's book examples?

0:47 zaphar_ps: technomancy: hrmmm still not compiling I'll try lein swank next

0:48 technomancy: zaphar_ps: that's the best way to ensure fidelity between slime and leiningen for sure

0:48 zaphar_ps: hrmmm I don't have the right version of lein apparently :-)

0:48 * zaphar_ps goes to download new lein version

0:49 technomancy: lein swank should work with any version

0:49 zaphar_ps: what problem are you seeing?

0:49 zaphar_ps: it says swank isn't a task

0:49 technomancy: zaphar_ps: oh, you have to add lein-swank as a dev-dependency

0:49 zaphar_ps: ahhh ok

0:50 technomancy: http://github.com/technomancy/leiningen/tree/master/lein-swank/

0:52 brian__: technomancy> I have 1.0 for contrib but not clojure: dependencies [[org.clojure/clojure

0:52 "1.1.0-master-SNAPSHOT"]

0:53 technomancy: brian__: ok, it's very important that your versions match for contrib and clojure

0:53 unless you have a reason not to, you should use 1.1.0 for both

0:53 as I've said

0:53 brian__: ok

0:56 technomancy: brian__: I recommend checking your project's setup using lein test or something before trying compile

0:56 since there are more things that can go wrong with AOT

0:57 zaphar_ps: sweet worked great thanks technomancy!!!

0:57 technomancy: awesum

0:57 zaphar_ps: now I just have to make it all happen straight from emacs :-)

0:58 but that will have to wait for another night

0:58 brian__: technomancy> I ran lein clean, then when I ran lein deps i got this: [null] Unable to resolve artifact: Missing:

0:58 [null] ----------

0:58 [null] 1) org.clojure:clojure-contrib:jar:1.1.0-SNAPSHOT

0:58 technomancy: M-x eshell lein swank RET =)

0:58 brian__: ah yeah, get rid of "-SNAPSHOT"

0:58 brian__: ok

0:58 zaphar_ps: technomancy: ahhh that's too much typing surely I can get it down lower than that :-)

0:58 technomancy: and maybe read the INTRO doc I just uploaded: http://github.com/technomancy/leiningen/blob/master/INTRO.md

0:59 brian__: do i leave "master" in

1:00 technomancy: brian__: just 1.1.0 is all

1:00 brian__: ok

1:00 technomancy: I'm not sure that it's the actual problem, but it's just good to be on the released version

1:03 brian__: still doesnt work

1:04 same error

1:04 technomancy: hrm... I need to go to bed, but you might try generating a new project with "lein new" using the latest stable 1.1.0 release... it looks like you are using an older version of leiningen.

1:04 zaphar_ps: brian__: are you able to launch a clojure repl at all?

1:05 brian__: you mean from lein?

1:05 zaphar_ps: no just a vanilla clojure repl

1:05 brian__: yes, i've done some clojure on this box already

1:06 zaphar_ps: ok then just to rule out leiningen issues can you try to load the file from a clojure repl

1:06 brian__: but i dont have clore in my path

1:06 ok, let me see

1:06 zaphar_ps: if it's a syntax error I'm just missing then that would tell you

1:07 brian__: yea, but it worked for you, right?

1:07 zaphar_ps: yeah :-)

1:07 I forgot I did that test :-)

1:07 brian__: this is osx 10.4

1:08 its old mac

1:08 zaphar_ps: brian__: I'm running mac as well I don't think it's your java version

1:08 brian__: weird, maybe its cursed ;-)

1:08 zaphar_ps: does lein new work like technomancy|away suggested

1:08 brian__: hmm

1:09 hiredman: well, he wrote it

1:09 brian__: no

1:10 i've used leinigen to build other software on this

1:12 zaphar_ps> what version java r u using?

1:12 zaphar_ps: well that's exhausted my ideas and it's time for me to go to bed

1:13 brian__: yea ok

1:13 thanks

1:13 zaphar_ps: brian__: I honestly don't know right now

1:13 whatever comes with mac 10.5

1:13 brian__: java -version

1:13 zaphar_ps: 1.5.0_19

1:14 brian__: ok

1:14 good night

1:14 zaphar_ps: now off to bed

1:24 JonSmith: brian_ have you tried it without the clojure-contrib dependency?

1:57 defn: I need to create a regex using a variable -- I was trying to do this:

1:58 (re-pattern (concat "\(.*" text ".*\)"))

1:58 but it doesn't like the \(

1:59 psykotic: \\(

1:59 defn: thanks psykotic

1:59 hiredman: defn: concat returns a seq

1:59 does re-pattern take seqs?

1:59 psykotic: remember, there is clojure's string literal escaping and there is the regexp's library's

2:00 hiredman: nope, he has to fix that too.

2:01 this reminds me that it might be nice to have a reader macro for "raw" strings

2:01 ala python's r"\(...)"

2:04 maybe that should be the default for regexp literals. most of the time, the usual escape sequences aren't useful anyway, e.g. the default matching mode is line-based, so \n won't ever match

2:05 chouser: what?

2:05 ,(re-find #"\n" "\n")

2:05 that matches \n just fine

2:06 defn: clojurebot, where art thou?

2:19 dnolen: ,(str "é")

2:19 clojurebot: "é"

2:20 dnolen: hmm anybody had trouble with unicode chars period?

2:21 defn: haven't really used them tbqh

2:22 im american! we don't need them extrie alphabet doodads!

2:23 dnolen: erg this is driving me insane

2:26 hiredman: ,(let [x 1 x´ (inc x)] x´)

2:26 clojurebot: 2

2:27 hiredman: dnolen: jline has unicode issues

2:27 I think lein starts the repl with jline

2:27 dnolen: hiredman: k that's unicode problem #1. you think that affects lein swank as well?

2:27 if so, I only have curse words for that.

2:28 hiredman: umm, that I dunno

2:28 I know emacs has its own encoding settings

2:28 dnolen: yeah it's a rats nest trying to figure out what is wrong.

2:28 hiredman: and java defaults to different things depending on the OS

2:28 dnolen: I read through the ML stuff

2:29 hiredman: (System/getProperty "file.encoding")

2:29 dnolen: but my slime (connected to lein swank) if I enter a unicode char just completely hangs

2:29 on the other hand if I send something to the REPL with compile file, just wack characters. However if I compile a region everything works fine!

2:30 grr

2:33 _mst: in emacs do you have a slime-net-coding-system defined? I remember having to set mine to 'utf-8-unix

2:33 although I don't understand why compiling a region would work but not a file...

2:33 dnolen: _mst: yeah I set that. I set JVM file.encoding as well.

2:34 _mst: ah! mine hangs too with lein swank :)

2:35 dnolen: ARGH

2:35 :) well at least it's something to report

2:35 _mst: maybe we could form a support group...

2:36 defn: this is impossible...only one mention of (shit) in #clojure for over two years

2:37 hiredman: clojure

2:37 er

2:37 cgrand: dnolen: hi, how do you call html-content?

2:37 hiredman: ~#clojure

2:37 clojurebot: this is not IRC, this is #clojure. We aspire to better than that.

2:37 dnolen: defn: rhickey doesn't like cursing on channel

2:38 cgrand: after much teeth gnashing I'm no longer convinced it has anything to do with Enlive.

2:38 it's also possible issues with lein

2:41 Raynes: defn: I bet both of those were from me.

2:42 defn: :)

2:42 * hiredman has 136

2:43 Raynes: Didn't gnuvince use to hang around in here?

2:43 Whatever happened to him? :o

2:43 Appears he ran off to Scalaland and got married to curly brackets.

2:43 cgrand: dnolen: well, I found a bug/inconsistency between html-content and content. At the moment you can't call (html-content ["foo" "bar"]) you must (apply html-content ["foo" "bar"])

2:44 dnolen: cgrand: it's like a crazy nexus of bugs here :)

2:45 cgrand: dnolen: good luck then :-)

2:45 dnolen: cgrand: I'm pretty sure it's not really enlive. I can get the unicode characters to render depending how I compile the code. compile file is broken, but if I compile region, I see them properly.

2:45 defn: Thanks to Licenser for making this search so much faster. This is actually turning out to be quite handy. I can include this in my projects and use it as an extra documentation tool to view (in general) nice examples of functions in action

3:53 did I kill chat?

3:53 LauJensen: Morning crew

3:57 Raynes: LauJensen: Morning.

3:57 spariev: morning

4:01 defn: gut morning

4:15 Raynes: (((@modules (keyword (first args))) :load))

4:16 Eh, wrong window.

4:20 spariev: defn: have you figured out your Unicode problem ?

4:21 Raynes: I'm surprised nobody commented on how deeply nested I am. ;)

4:21 LauJensen: inb4ingeniousredneckjoke

4:21 spariev: where is actually a hardcoded value for encoding in http://github.com/technomancy/swank-clojure/blob/master/src/swank/swank.clj

4:22 LauJensen: Raynes: :)

4:23 Chousuke: spariev: I think it's just the default

4:23 _mst: spariev: I hacked at the unicode thingy here: http://github.com/marktriggs/swank-clojure

4:23 to let you override with a system property...

4:23 Chousuke: ,(merge {:foo 'bar} {:foo 'my-bar})

4:23 clojurebot: {:foo my-bar}

4:23 Chousuke: so you just pass :encoding "utf-8" to start-repl and it'll work

4:25 Raynes: I've been writing this (horribly designed) irc bot for two days, and I've already forgotten how to put modules on the autoload list. :o

4:25 Chousuke: Raynes: and I almost did comment on the nesting :P

4:25 but chose not to

4:26 Raynes: Chousuke: You should have done it. Wouldn't have livened things up a bit. :D

4:26 hiredman: if you use -> no one will notice

4:26 Raynes: How could I rewrite that with ->?

4:26 spariev: _mst: yep, I did basically the same, I just wanted to point defn to the unicode problem solution

4:27 Chousuke: ((-> args first keyword @modules :load)) I think

4:27 _mst: yep :)

4:27 Chousuke: hmm

4:27 ,(apply +)

4:27 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$apply

4:27 hiredman: ((@modules (-> args first keyword)) :load)

4:28 @ is (deref …)

4:28 spariev: wonder why unicode is not default

4:28 Chousuke: ah, right. shoot.

4:29 spariev: probably an oversight by jochu :P

4:29 hiredman: but, depending on what modules is, you may be able to get by without derefing

4:29 if modules is a var you don't need to deref

4:29 maybe not refs either, I don't recall

4:30 ,((ref @#'+) 1 2)

4:30 clojurebot: 3

4:30 Raynes: Modules is a ref.

4:30 hiredman: the jvm doesn't default to utf-8

4:30 so you don't need to deref

4:31 defn: i need to add syntax hilighting for the '.' at the end of a java.io.File.

4:31 something to make it stand out

4:32 Chousuke: you could do something fancy like transform it into a superscript "new" or something :P

4:32 just like my emacs transforms (lambda ...) to (λ ...)

4:33 (interestingly enough it's also smart about deleting it so that pressing DEL after it results in "(lambd ...)")

4:38 Raynes: LauJensen: Wouldn't happen to know how to stop Emacs from putting anything you highlight on the clipboard, would you?

4:39 psykotic: the clipboard?

4:39 Raynes: kill-ring or whatever.

4:39 LauJensen: Raynes: I wouldn't know how to get it to start

4:39 Raynes: Does it matter? :\

4:40 psykotic: i don't understand what you mean.

4:40 it doesn't put anything in the killring if you do that

4:40 Raynes: It most certainly does on my machine.

4:40 If I highlight something, it's put on the clipboard (or whatever).

4:40 psykotic: how do you know it's on the "clipboard"?

4:41 what happens exactly, is what i mean

4:41 Raynes: I just highlighted a piece of code in Emacs.

4:41 (str (keys @modules))))

4:41 ^

4:41 hiredman: the clipboard is an X or GTK thing, the killring is an emacs thing, different things

4:42 psykotic: old school X behavior is to make the latest marked text in an application available for pasting elsewhere

4:42 Raynes: Oh. Then I suppose it does that everywher.

4:42 everywhere*

4:42 LauJensen: And i Quote:

4:42 Raynes: Yep.

4:42 LauJensen: Not sure when this appeared in GNU emacs, or if it’s how the developers intended things, buts it’s useful for me (I habitually use emacs from CVS, BTW, so not sure when this tip first applies): The “x-select-enable-clipboard t” method seems to resuscitate the “traditional” (and IMHO deeply strange) emacs interaction with the X11 primary and clipboard selections. EVERYTHING you highlight as a region winds up in both

4:43 So either pull and compile a recent snapshot, or (setq x-select-enable-clipborad nil)

4:46 _mst: Raynes: there's also: (setq mouse-drag-copy-region nil)

5:04 LauJensen: Raynes: Is your uncle going to slow on the dynamo-bicycle powering your laptop, or did something happen to you?

5:04 Raynes: LauJensen: He's going too slow. :(

5:04 spariev: LauJensen: you made my day :)

5:05 LauJensen: I did? Sweet! :)

5:23 defn: weeee

5:24 psykotic: random snippet: inverse of conj, http://gist.github.com/335063

5:24 defn: it better be called jnoc

5:24 psykotic: snoc isn't cons's inverse, so that would be improper :)

5:25 defn: http://github.com/defn/walton/blob/master/src/walton/core.clj

5:25 any comments on this code? any suggestions in general are welcome....

5:32 Licenser_: morning

5:33 Chousuke: defn: the logfile and parsed-logs defs are suspicious

5:34 defn: you should instead just make a parse-logs function that takes a path as an argument

5:34 Raynes: Suspiciously awesome! Amirite?

5:34 defn: Licenser_: ! -- I've been messing with what you gave me yesterday morning

5:34 It runs really quick...

5:34 Licenser_: :) I've seen

5:34 * Licenser_ is glad he could be of use for once ;)

5:34 defn: I'm still a noob, but baby steps have been made. I think I've slowly degraded your performance! :)

5:35 Licenser_: haha

5:35 just be aware, you keep the reader open for all eternity in that code - or my snippet as a tradein for lazyness

5:35 defn: Chousuke: oh yeah...about that... I've been having some issues with getting my REPL to use the right path

5:36 Licenser_: it needs a with-something or other

5:37 Licenser_: defn: with-open

5:37 but then you can't have the line seq's lazy, you've to force them in existance then

5:39 defn: in the extract-code fn, why not move the searcou output inline?

5:40 *search

5:42 defn: who what? *looks*

5:42 oh, i dont know -- i kind of like it in the let, but it could be inline i suppose

5:42 is it more readable to you one way or the other?

5:43 Licenser_: reload that source file

5:44 ive added proper credit :)

5:44 Licenser_: I am new to this myself, but when I stuff thyings in let I always feel so imperative, I might be me

5:46 defn: Really? I never really thought of it that way

5:46 I guess I treat let like "let the sky be blue for 4 seconds"

5:46 Licenser_: well it is kind of a feeling

5:47 I noticed i tend to do stuff like (let [a (+ 1 1) b (+ a 1) c (+ b 2) ...

5:47 I didn't liked it since it reminded me a lot of what I've done in imperative langauges

5:56 defn: i like using first, second, rest in the let

5:57 in general im partial to getting as much compartmentalized up front so i can cut the fat and use a more human readable style

6:05 LauJensen: psykotic: Its good that you make the distinction between first and peek, but any idea why you have to ?

6:06 psykotic: LauJensen: because of conj's container-dependent semantics.

6:06 LauJensen: I mean, any idea why the definition of 'first' doesn't start with (if vector)

6:06 psykotic: but i agree it's weird. it'd be nice if the ICollection interface exposed something a la peek that always refers to the 'next' insertion position, if oyu know what i mean.

6:07 well, first is first in a linear sense

6:07 so it's correct that it behaves this way

6:07 conj adds at the back on vectors. what you really need is a separate function that works for all containers and is compatible with conj.

6:09 does that make sense?

6:10 LauJensen: Yes, but not relating to my question

6:10 psykotic: i thought i answered that. if first had an (if vector) check then it would change the meaning of first.

6:10 LauJensen: Ah wait, yes it does

6:10 I had just mixed up peeks behavior

6:10 Yes Im with you now

6:11 psykotic: actually, my code should actually also check for (queue? ...)

6:11 the fact that this code is so ad hoc and container specific tells you that this really belongs in the ICollection

6:14 i guess you could extend peek and pop to work on all containers

6:29 spariev: ,(isa? "123" String)

6:29 clojurebot: false

6:30 Chousuke: I think it goes the other way around

6:30 esj: ,(string? "abc")

6:30 clojurebot: true

6:30 Chousuke: or hm

6:30 (doc isa?)

6:30 clojurebot: "([child parent] [h child parent]); Returns true if (= child parent), or child is directly or indirectly derived from parent, either via a Java type inheritance relationship or a relationship established via derive. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to the global hierarchy"

6:31 Chousuke: ah, right.

6:31 ,(isa? String Object)

6:31 clojurebot: true

6:31 spariev: so its for classes

6:31 Chousuke: or hierarchies

6:32 ,(derive String ::blah)

6:32 clojurebot: nil

6:32 Chousuke: ,(isa? String ::blah)

6:32 clojurebot: true

6:33 spariev: I see, mistaken Clojure's isa? with Ruby is_a?

6:33 in Ruby "123".is_a? String

6:33 => true

6:34 Chousuke: ruby's is different then

6:34 clojure has instance?

6:35 spariev: ,(instance? String "123")

6:35 clojurebot: true

6:35 spariev: cool, I didn't knew that, thanks Chousuke

6:39 Raynes: ~google test

6:39 clojurebot: First, out of 59600000 results is:

6:39 Test.com Web Based Testing and Certification Software v2.0

6:39 http://www.test.com/

6:40 Raynes: hiredman: I just stoleded your google code. :>

6:44 Chousuke: hm, shouldn't tickets with patches be marked as "Test" on assembla? :/

7:31 Licenser_: ,(greet #clojure.de)

7:31 clojurebot: No dispatch macro for: c

7:32 Licenser_: ,#clojure

7:32 clojurebot: No dispatch macro for: c

7:32 Chousuke: heh :P

7:32 Licenser_: ah sneaky

7:32 clojurebot is silly

7:59 rem7: I'm trying to understand how nested vectors (and I guess lazy seq work) how would you access the first element of the first vector in something like this (def abc [[1 2 3] [4 5 6] [7 8 9]])

8:01 tomoj: (first (first abc)) ?

8:02 esj: or (ffirst abc) ?

8:02 tomoj: oh yeah

8:03 rem7: oh I was using take

8:03 how about the 3rd element (or any other element)

8:03 first and second work....

8:04 tomoj: ,(get-in [[1 2 3] [4 5 6] [7 8 9]] [2 2])

8:04 clojurebot: 9

8:05 tomoj: that's one way

8:05 ,(doc nth)

8:05 clojurebot: "([coll index] [coll index not-found]); Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences."

8:05 tomoj: or that

8:05 but vectors act like maps from indices to values, so

8:06 rem7: ,(nth 1 (second [[1 2 3] [4 5 6] [7 8 9]]))

8:06 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number

8:06 tomoj: get-in is really perfect here

8:07 rem7: yeah, that works

8:07 thanks

8:07 tomoj: also works with maps

8:07 ,(get-in {:foo {:bar 3}} [:foo :bar])

8:07 clojurebot: 3

8:08 rem7: ahh nice

8:28 defn: Anyone have any recommendations on writing tests in clojure?

8:29 I am really interested in getting into TDD, and I'd like a "nice" introduction in clojure

8:30 I am determined to write 3 lines of test to 1 line of production from here on out.

8:30 licoresse: Does it exist a mechanism that can tell me which functions are in use and which are not?

8:30 mattc58: I'm using clojure.test with the deftest and is macros, along with lein test

8:31 defn: mattc58: do you by any chance have a repo with an example project that uses that style?

8:31 licoresse: like a dead function detection...

8:33 mattc58: defn: check out http://github.com/mattc58/animate

8:33 Licenser_: does the lein test thing have a autotest feature?

8:33 mattc58: defn: it's a personal project for a web server I'm doing, but it does indeed have tests that work from lein

8:35 defn: Licenser_: thats my next question

8:35 mattc58: does lein test have autotesting? ;)

8:35 Licenser_: :D

8:35 there was a bdd framework too

8:35 mattc58: defn: what is autotesting?

8:36 like a buildbot or something?

8:36 Licenser_: autotesting runs tests in functions / files that change automatically

8:36 and in the best case informs you about failures / successes

8:38 defn: mattc58: have you ever used ZenTest aka autotest for Ruby:?

8:38 mattc58: ah, no i haven't

8:38 Licenser_: if you ever get them running they are incredible

8:38 mattc58: that does sound interesting

8:38 defn: http://vimeo.com/2680374

8:39 mattc58: probably be a good addition to clojure

8:39 defn: mattc58: touche

8:39 Licenser_: aye

8:39 hmm I wonder if you can write a plugin for leiningen

8:39 when I remember correct java 7 has nio which allows file change hooks

8:40 defn: I'd be interested in doing it -- I messed with some osascript the other day via clojure, we could do growl notifcations, hook into swank somehow maybe?

8:40 tomoj: there's also something external which works now

8:40 defn: Licenser_: you can write plugins for lein pretty easily

8:40 tomoj: in java 6 I mean

8:40 defn: It's not well documented

8:40 spariev: have you guys tried circumspec - http://vimeo.com/9770382 ?

8:40 tomoj: http://jnotify.sourceforge.net/

8:40 defn: spariev: not yet, you?

8:40 spariev: nope :)

8:40 chouser: clojure-jna has some code for watching for file changes on linux via inotify, if that helps. :-)

8:40 tomoj: I've never even heard of circumspec

8:40 Licenser_: tomoj: nice

8:40 Chousuke: circumspec seems to have autotesting

8:41 defn: Chousuke: cool.

8:41 tomoj: how could I never have heard of it? :(

8:42 defn: i was sort of distracted by all of stuart's departures from what ive seen as sort of the standard

8:42 Licenser_: Chousuke: nice!

8:42 defn: (in that particular video)

8:43 tomoj: like hard 'j'? :)

8:43 defn: I really like his book and talks, some of myf avorite actually

8:43 tomoj: hahaha

8:43 psykotic: yeah what's the story with that?

8:43 defn: (inc tomoj)

8:44 it is more clear than saying "

8:44 "closure"

8:44 for sake of argument

8:44 psykotic: not really

8:44 humans are pretty good at using context :)

8:44 defn: im just saying, for sake of argument, it leaves less to the imagination

8:45 it's a style choice

8:45 tomoj: yeah, hadn't really thought about that

8:47 defn: on the other hand...i think we can all agree it's "closure" :)

8:47 psykotic: please.

8:47 tomoj: every time he says "clojure" now I stop listening for a second :(

8:48 * Chousuke doesn't mind at all

8:48 defn: it doesn't really bother me -- it might just be his voice...like he has a cold when he says clojure

8:49 the low quality recording probably makes it worse than it is

8:49 * defn wonders if he's actually spending his morning discussing why stuart halloway says clojure "clo-djure"

8:50 tomoj: hmm

8:50 * defn goes and re-reads some of stuart's book

8:50 tomoj: the (example, example-test) is different

8:50 I think I might like that better

8:51 ehh

8:51 defn: Why are (def x \n(+ 1 1)) indented with a larger space than defns?

8:51 LauJensen: This reminds me of Reddit, you have one of these great technical talks, and the entrailing discussion is "did he say CloJOUre" or "Clo-djure" ?

8:52 defn: LauJensen: yeah it's ridiculous

8:52 I feel terribly guilty about it already

8:52 but I appreciate having my nosed rubbed in it

8:52 that probably came off as sarcsam but I'm being sincere

8:53 tomoj: defn: clojure-mode?

8:53 defn: tomoj: yessir, clojure-mode has a larger indetation of a def than a defn -- it looks weird

8:54 licoresse: how to change?

8:54 LauJensen: defn: Great - I glad you didnt take offense :)

8:55 +am

8:55 tomoj: defn: yeah, the small indentation is a special case for definitions

8:55 defn: tomoj: is that an official lisp style guide thing?

8:55 tomoj: you could probably just add def in there

8:55 in general certain macros will have special indentation conventions, I think, yeah

8:56 but there is no official rule as far as I know

8:56 defn: ahhh i didn't really consider the whole macro thing

8:56 that makes a lot more sense

8:56 you can use that bit to being more discriminative

8:56 tomoj: if you write your own wrapper around defn, you get ugly indentation

8:57 wait, do you?

8:57 defn: what do you mean by wrapper -- like clojure-mode is a wrapper?

8:57 tomoj: deftype seems to get proper indentation even though it's not mentioned in clojure-mode.el

8:58 I meant that if you write your own macro like defoo, clojure-mode wouldn't know to indent it like defn

8:58 but maybe I'm wrong

8:58 defn: it might be there to stop people from doing multiline defs

8:58 tomoj: it actually seems like clojure-mode will indent anything def* like defn

8:58 er, /def.+/

8:58 defn: yeah, the length

8:59 less than 4 chars means different indentation maybe?

8:59 Licenser_: def.+ does not match def

8:59 tomoj: indeed

9:00 it's /def.+/ and /with-.+/ it seems

9:00 Licenser_: make it def.*?

9:00 tomoj: line 429 in 1.6

9:01 e.g. you'll notice that defoo and with-foo get defun style indentation

9:01 with- does too, but not def, strange

9:04 I have no idea really what's going on in line 429

9:22 licoresse: I have a (Dimension. 30 40) and a '[30 40], how can I wrap those values onto Dimension without creating temporaries?

9:23 Licenser_: licoresse: does apply work on dimension?

9:23 licoresse: Licenser_: I don't know

9:23 but would this be a scenario for apply?

9:24 Chousuke: no

9:24 can't apply java things

9:24 Licenser_: but I think even this will create temporaries

9:24 I apply java to my coffe filter!

9:24 licoresse: :-)

9:24 Chousuke: you can't make Dimension without temporaries in this case

9:24 licoresse: ok

9:24 * Licenser_ does not belive in tempraries

9:24 Chousuke: but temporaries are cheap. just two pointers :P

9:24 Licenser_: licoresse: you can use macros

9:25 licoresse: yes, I could use a macro, of course....

9:25 chouser: wouldn't help

9:25 Chousuke: (let [[x y] pair] (Dimension. x y))

9:25 Licenser_: like (Dimension. (first [30 40]) (second [30 40]))

9:25 licoresse: if I use a lot of Dimensions, why would'nt that help?

9:25 Chousuke: licoresse are all your pairs known at compile time?

9:26 licoresse: no

9:26 Chousuke: right. so macros would create temporaries anyway

9:26 licoresse: I'm just interested in the most terse way of writing it

9:26 Licenser_: hmm it would expand :P

9:26 well I'd use let to be frank but I hink it is possible to do it without

9:26 Chousuke: just make a function that works like (make-dimension [1 3])

9:27 licoresse: Chousuke:

9:27 Chousuke: excactly

9:27 ok, thanks...

9:27 Licenser_: licoresse: if you are crazy about performance don't use [] but something like (Defn make-dim [x #^Integer y #^Integer]...

9:27 or the other way round

9:28 Chousuke: well, no.

9:28 Licenser_: hmm can you put type hints into destructing?

9:28 Chousuke: in that case just use (Dimension. x y) directly :P

9:28 licoresse: There is no need for overenginering at my specific case ;-)

9:28 Licenser_: licoresse: there always is need for overenginering ;)

9:31 stuartsierra: Is there a Clojure web REPL anywhere, like "Try Ruby"

9:32 Licenser_: try clojure?

9:33 peregrine81: Hey all I am working on Euler Problem 5 which asks for number evenly divisble by 1-20. I've got two versions, the first one will work, but slow so I took another crack at it. http://gist.github.com/335218

9:33 And I get a java.lang.IllegalArgumentException: Don't know how to create ISeq from: Integer (NO_SOURCE_FILE:0)

9:34 Which doesn't make sense cause iterate returns a seq

9:34 chouser: stuartsierra: http://lotrepls.appspot.com/ is the only one I know of

9:34 dunno if that's like "try ruby" or not

9:34 stuartsierra: peregrine81: you've got "20" instead of "(range 20)"

9:36 arbscht: I suppose you could have a chat with clojurebot over mibbit :-)

9:36 LauJensen: arbscht: mibbit is banned from freenode afaik

9:37 stuartsierra: chouser: thanks

9:42 Licenser_: peregrine81: an simpeler solution is to think about what is required to solve the problem

9:43 dcnstrct: how can I access the static properties of an inner class using clojure's java interop ?

9:43 chouser: OuterName$InnerName/staticThing

9:43 dcnstrct: $ neat

9:43 bling bling

9:43 thnx

9:43 worked!

9:44 peregrine81: Licenser_: What do you mean?

9:45 Licenser_: peregrine81: there isn't much needed aside of simple multiplication

9:45 :)

9:48 peregrine81: Licenser_: Its looking for the smallest number :)

9:49 Licenser_: peregrine81: I know :) but the solution takes 2 minutes a penci, a paper and some multipplicatio

9:50 G0SUB: I want to use clojure.zip to process a nested map. any tips?

9:50 tomoj: what's a "temporary"?

9:51 peregrine81: Licenser_: True but the purpose is to learn clojure :)

9:52 Licenser_: true true, but a good algorithm is a good algorithm even in clojure :d

9:52 peregrine81: stuartsierra: Thanks!

9:53 dumb error.

9:53 zaphar_away: /quit

9:53 \quit

9:54 peregrine81: \quit

9:55 defn: wish circumspec was easier to setup...

9:57 licoresse: It's amazing how few errors I make when writing code in Clojure, compared to when writing plain java...

9:58 G0SUB: hmm, so people here are not interested in zippers :)

9:59 chouser: G0SUB: sounds interesting, just never done it. Not sure how well the api will fit

10:00 G0SUB: chouser, I am looking at a functional solution to massage the keys of an arbit. nested map.

10:01 chouser, can you suggest a good/fast way? I was investigating zippers for that.

10:01 psykotic: if you can do it in a single top-down traversal, you don't need zippers.

10:01 G0SUB: but it seems zippers are better suited for vectors or list like stuff.

10:01 chouser: clojure.zip currently assumes you have an ordered sequence of children

10:02 G0SUB: psykotic, indeed, yes.

10:02 chouser, hmm.

10:02 chouser: I don't see any reason it couldn't be made to work -- it would be interesting, but I don't have any particular advice.

10:02 G0SUB: psykotic, do you have any nice solution of your own?

10:03 chouser, OK. Thanks.

10:03 chouser: G0SUB: you looked at just using update-in?

10:03 bsteuber: you don't mean this, I suppose:

10:03 ,(get-in {:a {:b 42}} [:a :b])

10:03 clojurebot: 42

10:04 G0SUB: bsteuber, no. I want to run a fn on all the keys and then replace them.

10:04 bsteuber: so it's some sort of tree traversal

10:04 tomoj: seems like a faq

10:05 G0SUB: chouser, let me see if that can be used.

10:05 chouser: you want a kind of mapping fn to be run on every key/val of the whole tree?

10:06 G0SUB: hmm, won't work for something like {"a" 1 "b" {"c" 3 "d" {"e" 5 "f" [{"g" 7} 8]}}}

10:06 chouser: or you have more like specific paths into the map tree that you want to massage?

10:06 G0SUB: chouser, I just want to massage the keys, but the vals might be maps which will again have keys.

10:06 chouser, no specific paths. just all of them.

10:06 psykotic: gosub: that sounds like a simple recursive mapping.

10:07 chouser: ok, I suspect zippers would be overkill

10:07 G0SUB: your values may be scalars, maps, or vectors??

10:07 G0SUB: psykotic, it is. now to write it in a non-stack consuming way.

10:07 chouser, yes.

10:07 chouser: G0SUB: I wouldn't worry about the stack if this is a concrete tree

10:08 psykotic: gosub: zippers consume space too, it's just in reified context data form instead of stack.

10:08 G0SUB: chouser, OK. that would relieve me a bit.

10:08 chouser: a solution that consumes only as much stack as the depth of your tree will (a) be safe enough and (b) much prettier.

10:08 psykotic: in fact, a good way of thinking about zippers is that they reify the stack that would exist during a recursive map-style traversal

10:08 G0SUB: psykotic, your IRC client doesn't do tab completion on nicks? the nick is G-Zero-SUB ;)

10:09 chouser: psykotic: they do a bit more than that.

10:10 psykotic: i was simplifying. i've done a ton of zipper work in the past, so know them pretty well.

10:11 but the relationship to delimited continuations ("reified stacks") is formally provable, you just have to elaborate a bit on exactly what you mean by "map-style traversal"

10:11 chouser: ok. I've only used them a little, but mainly when I specifically wanted to do weird navigation from arbitrary points in the tree (up, left, left, down, etc.)

10:11 psykotic: right, if you want to think about it as a recursive traversal, you can think of the user function called on the child node returning an instruction to the calling combinator

10:12 that kind of thing, oleg has some good stuff on it

10:12 anyway, you definitely don't need it for a simple traversal like this guy's.

10:16 chouser: ,((fn z [f c] (cond (map? c) (into {} (for [[k v] c] [(f k) (z f v)])) (vector? c) (vec (map #(z f %) c)) :else c)) #(.toUpperCase %) {"a" 1, "b" {"c" 3, "d" {"e" 5, "f" [{"g" 7} 8]}}})

10:16 clojurebot: {"A" 1, "B" {"C" 3, "D" {"E" 5, "F" [{"G" 7} 8]}}}

10:17 chouser: so much more fun than solving C++ link issues...

10:17 G0SUB: chouser, haha!

10:18 (inc chouser)

10:18 * chouser gets back to it.

10:28 G0SUB: chouser, btw, when is the joy of clojure up for review?

10:37 chouser: G0SUB: I think it's going out this week to the tech review people.

10:38 I'm hoping we'll start seeing updated or additional chapters for the MEAP any day now.

10:39 danlei: cool

10:39 rfg: Ace

10:40 chouser: I'm especially looking forward to the revised chapter 1 -- fogus did some great work pulling that together, and I think it will be much more useful for people to get a sense of whether this is the right book for them.

10:42 Raynes: Is there a way to decode html entities in a string that doesn't involve me adding an apache-commons jar to my dependency list?

10:45 chouser: ,(-> "this&that" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse :content last :content first)

10:45 clojurebot: org.xml.sax.SAXParseException: Content is not allowed in prolog.

10:45 chouser: ,(-> "<x>this&amp;that</x>" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse :content last :content first :content first)

10:45 clojurebot: nil

10:46 chouser: huh. getting different results here.

10:46 ,(-> "<x>this&amp;that</x>" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse :content last :content first)

10:46 clojurebot: nil

10:46 spariev: Raynes: try java.net.URLDecoder/decode

10:46 chouser: ,(-> "<x>this&amp;that</x>" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse :content)

10:46 clojurebot: ["this&that"]

10:46 Raynes: spariev: Doesn't work for this.

10:46 chouser: ,(-> "<x>this&amp;that</x>" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse :content first)

10:46 clojurebot: "this&that"

10:48 Raynes: Cool.

10:48 chouser: there may be a better way to access that functionality

10:51 stuartsierra: Raynes: if you only care about the standard XML entities, it's easy. Supporting all 200-some HTML entities is annoying.

10:51 danlei: hm

10:51 yes

10:51 just recognized that

10:51 chouser: I was surprised that this method seems to handel &nbsp; and &copy;

10:51 danlei: (-> "<p>&uuml;ber</p>" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse :content first) won't work

10:51 Raynes: I just caved and pulled in commons.lang

10:52 It's not like it's a huge dependency.

10:52 fogus: That's how it starts... :p

10:52 Raynes: fogus: ;)

10:59 maacl_: I think there is a problem round-tripping xml from xml/parse to xml/emit - please look at http://paste.lisp.org/display/96511 at tell me if I am missing somthing. The result is not escaped correctly, i.e. the attribute values contain ' instead of apos;

11:00 chouser: maacl_: clojure.emit is buggy :-(

11:00 er

11:00 clojure.xml/emit

11:00 maacl_: chouser: ah, ok

11:01 chouser: is there a recomended solution if I need to read - mutate - write xml?

11:01 chouser: maacl_: you might try clojure.contrib.lazy-xml/emit instead

11:02 it can use the kind of parsed tree produced by clojure.xml/parse or lazy-xml/parse, either one.

11:02 Raynes: ~def time

11:02 maacl_: chouser: thanks, I will give that a try

11:02 remleduff: If I'm in some arbitrary namespace (namespace1), and I want to invoke a function that's in another namespace (namespace2), I should be able to do something like (namespace2/function ...), right?

11:03 S11001001: remleduff: aye

11:03 chouser: remleduff: yes, as long as namespace2 has been loaded

11:04 maacl_: chouser: ah, that worked like a charm - thanks

11:05 chouser: maacl_: great. the one in lazy-xml can do indenting and non-default encodings too

11:07 Chousuke: hm

11:07 I wanted to build zsh from source but it seems to depend on some obscure documentation markup language called yodl and yodl then depends on an obscure build system called icmake ;/

11:08 chouser: i love build systems

11:08 love 'em

11:08 the more the better

11:08 Chousuke: of course, neither of those are installable via macports

11:09 cypher23: Chousuke, have you tried Homebrew? it has a zsh recipe

11:10 Chousuke: hmmh

11:10 I suppose I could try it.

11:11 but damn, I have too many package managers.

11:11 cypher23: I've switched to Homebrew, and booted MacPorts off my system

11:11 Chousuke: OS X's own with appfresh, macports, elpa, stow...

11:11 horror.

11:12 cypher23: someone needs to write a package meta-manager :)

11:13 Chousuke: I also don't want to install any package-managed stuff into /usr/local ;/

11:13 because all the random installers put stuff there

11:13 and I want to at least be able to tell what's managed and what's not

11:13 cypher23: Chousuke, by default, Homebrew installs stuff into /usr/local/Cellar, then symlinks it to /usr/local

11:13 but you can use a different install dir

11:18 Chousuke: hm, github is being slow

11:18 downloading 12kB/s :P

11:18 I'm glad I'm not cloning emacs.

11:18 Licenser_: Chousuke: what are you cloning? Sheep?

11:19 Chousuke: homebrew :P

11:23 hm, it looks like the zsh formula doesn't install from git :(

11:29 Licenser_: write a clojure os!

11:35 SynrG: i remember decades ago reading about the lisp machine

11:35 astoddard: I am using the clojure REPL for same exploratory data analysis. I have put some big data as references in a namespace. How should I clear the namespace to release the memory used by those references?

11:36 chouser: (ns-unmap (find-ns 'your-ns) 'your-var)

11:38 SynrG: oh. my first practical use of the repl to solve a problem. kinda trivial, but: (/ 800 480) (the question was "i have an image that i'd like to use as a desktop image. what aspect ratio does it need to be to fit my eeepc's display?)

11:39 cypher23: SynrG, (float (/ 800 480))

11:40 SynrG: cypher23: i didn't want a float

11:40 cypher23: oh, sorry. thought you were asking a question

11:40 Bozhidar: you need a fraction?

11:42 SynrG: sure. i think it's more natural to express it as 5:3

11:42 than 1.666

11:42 Bozhidar: true

11:42 SynrG: not to mention, more accurate

11:44 astoddard: Is there a quick concise way to "clear" a whole namespace?

11:44 Raynes: IIRC: nope.

11:45 Licenser_: ,(doc remove-ns)

11:45 clojurebot: "([sym]); Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace."

11:45 Bozhidar: hmm, I don't know if there is a fuction to find equivalent fractions

11:46 chouser: = ?

11:46 danlei: (= 1/2 2/4)?

11:46 astoddard: Licenser_: Thank you. I missed it because I tried to (find-doc "ns-")

11:47 etate: LauJensen: nice post on IDEs :)

11:47 Bozhidar: I meant something that could find the minimal equivalent fractions of (/ 800 480)

11:47 Raynes: I didn't think of remove-ns. :o

11:49 texodus: I'm looking for some feedback on the API design of a Netty wrapper library

11:49 Ideally I would like it to be as generally useful and clojure-y as possible before I tag it 1.0 or some such number

11:49 Anyone in here interested in such a library and willing to provide some feedback?

11:50 http://github.com/texodus/saturnine

11:50 I like how handlers are defined right now

11:50 but I'm torn on how to properly wrap server and client instances, how to deal with start and stop functions, threadpools, etc

11:51 so many java objects I want to make invisible in the clojue version

11:51 chouser: I don't think I need anything at that level -- I'd love async features for ring

11:52 texodus: I'd be wary of tieing your api too tightly to defining vars.

11:52 LauJensen: etate: thanks

11:52 Just updated that post with a Netbeans fix - and wow it is an impressive plugin they did: http://www.bestinclass.dk/index.php/2010/03/clojure-ides-the-grand-tour-getting-started/

11:52 chouser: It's usually nearly as terse and much more flexible to do things like (def sum-server (server 1234 ...))

11:53 astoddard: chouser: I am a little confused by ns-unmap, both (ns-unmap (find-ns 'your-ns) 'your-var) and (ns-unmap 'your-ns 'your-var) appear to work. Is this just a convenience, using either a symbol or the namespace itself as the first argument?

11:53 texodus: that makes sense

11:53 chouser: astoddard: oh, sorry -- I didn't try without find-ns

11:54 astoddard: the ns manipulation functions used to only take namespace objects, so you had to find them yourself with find-ns. Most (all?) now will find the ns for you if you pass in a symbol.

11:54 so yes, just a convenience.

11:56 texodus: one (possible) exception is when the thing your defining (server, handler, whatever) needs to know its own name. But even in that case I'd suggest your defserver be a very simple and just expand to (def foo (server foo ...)) so that users can stuff their servers in a map or something instead of vars, if they want.

11:57 texodus: you may find that this also helps you think more clearly about which Java objects belong in your Clojure API.

11:57 texodus: chouser: ah

11:57 chouse: so, if I want to represent the concept of a "server"

11:57 astoddard: chouser: thanks, got it.

11:57 texodus: chouser: and a server has a specification (list of handlers, port to bind, threadpool opts, etc)

11:58 chouser: *and* it has to have an identity once its been bound to a port and is actively listening (or a new state, at least)

11:58 chosuer: and it has single use resource like an executors threadpool

11:59 chouser: I want to cover all that. is it acceptable to have one (new-server ...) funciton that just takes a set of config options and returns a Servre datatype ...

11:59 chouser: then some other functions (start ...) (stop ...) that bash in place that one symbol boudn to teh result of (new-server ...)?

12:00 or should I treat the server isntance as a value?

12:01 chouser: texodus: that is a very good question -- one I've run headlong into a few times now, and I'm not sure I'm overly pleased with any of my solutions.

12:02 texodus: I guess I'd recommend keeping the value-like stuff as seperate as possible -- maybe in its own immutable object? I mean stuff like the set of handlers, config, port numbers, etc.

12:03 well, that's too much detail.

12:04 I guess in short, yes -- providing start and stop functions that bash on a stateful object is I think exactly what you have to do for something like sockets

12:05 texodus: chouser: yeah, I stuck with vars originalyl because I never want there to be 2 clojure vals that reference the same server

12:06 chouser: making them vars limits how much you can ignore that they are inherently very stateful

12:06 chouser: I can see why that would be tempting, but I think it's incorrect

12:07 texodus: chouser: but it's ok to make functions like (start ...) and (stop ...) return nil, but bash in place the "server isntance"?

12:07 chouser: yes -- think of how clojure handles files

12:07 texodus: chouser: ah, good point

12:08 chouser: you can do (def f (java.io.File. "foo")) if you want, but usually you don't. and certainly a (deffile f "foo") would be weird

12:08 either way you'd be responsible for closing it

12:12 texodus: its usualyl rpetty easy to encapsulate the file-processing logic without blocking, something like (with-rdr ...) works great

12:12 (with-server ...) would only ever look like (with-server [repl (new-server ...)] (Thread/sleep ....

12:13 imo, you should be responsible for closing a server explicitly

12:13 chouser: right. the analogy breaks down pretty quickly

12:14 texodus: neat

12:14 I looked at the grizzly, http-core and jetty ring adaptors

12:15 it doesnt loko terribly complicated, Netty has good HTTP support so it should be pretty simple to write an adaptor

12:15 chouser: my only point there was that it's entirely proper to have objects with real resources independent of vars

12:16 texodus: perfect

12:17 would there be any advantage to having a Netty nonblocking ring adapter?

12:17 ring isnt exactly asynchronous

12:17 chouser: it should be. :-)

12:17 texodus: also, cant call sub-http level stuff, like starttls

12:17 which i think is the big win to netty over the others

12:18 chouser: I have an entirely asynchronous app sitting right below a ring server.

12:19 texodus: hrm - maybe it would make more sense to have a ring-like api to an http handler than a straight ring wrapper

12:19 er, adapter

12:20 make an http-handler that gets called with ring-like HTTPRequest maps and whatnot as messages

12:20 chouser: I wish ring itself provided both api styles -- sync and async

12:21 texodus: I actually like how grizzly, netty, mina handle that in java

12:22 the design makes it trivial to choose synch or asynch at runtime, but force you to write in an asynch style, even if you block in your code

12:23 if ring supported both, would it have two apis?

12:24 or just force you to code in asynch style and let you block in one listener if you dont care

12:25 LauJensen: Any way to affect the priority that a future gets?

12:36 astoddard: Can I do something akin to c.c.shell-out but get a line-seq of the stdout?

12:36 If I try "with-open" to wrap the stream going to my line-seq then I get a runtime exception, "stream closed".

12:37 If I don't use with-open I assume I am not closing the stream when I exhaust the line-seq?

12:37 fogus: ,(sort [[3 2 1] [:a] [1 2 3]])

12:37 clojurebot: ([:a] [1 2 3] [3 2 1])

12:37 Licenser_: astoddard: you've to force the line seq to evaluate compleately wit doall

12:37 fogus: ,(sort [[:a :b :c] [3 2 1] [1 2 3]])

12:37 clojurebot: java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.Keyword

12:37 Licenser_: or dorun

12:37 fogus: hrmph

12:37 Licenser_: but the lzyness bites you here

12:46 astoddard: Liceneser_: got it, doall works. So I can't lazily read a stream and then have it close at the end?

12:46 stuartsierra: not safely

12:47 chouser: astoddard: what happens if you happen to not get to the end?

12:49 astoddard: chouser: is that a didactic or a specific question? In my case I should always consume the whole sequence, its just very long and I might want to filter it on the way.

12:49 chouser: didactic

12:49 duck-streams has a function that returns a lazy-seq on a file which closes said file when the seq is fully consumed.

12:50 so it can be done, but it's fragile and not recommend.

12:50 * stuartsierra agrees, and I wrote that function

12:50 chouser: stuartsierra: no worries -- I wrote such functions as well, just didn't get around to putting them in contrib.

12:50 clojurebot: stuartsierra is volunteering

12:51 stuartsierra: clojurebot: hush

12:51 clojurebot: I don't understand.

12:51 * chouser is all about not getting around to...

12:51 stuartsierra: Lately I've been thinking about scoped streams with dynamic vars.

12:52 Licenser_: astoddard: not sure I guess you can wrap it in a new lazy seq

12:52 chouser: sounds somewhat similar to rhickey's "scopes" -- you're thinking of something a bit different?

12:52 stuartsierra: probably similar, not sure how scopes are/were supposed to work

12:53 chouser: they provide sort of generic dynamic scoping hooks

12:53 stuartsierra: yeah

12:53 astoddard: chouser and stuartsierra: I see, thank you. Is the general principle here that laziness and java exceptions don't mix well?

12:54 stuartsierra: astoddard: when open resources are involved

12:54 astoddard: it's more that laziness doesn't mix well with resources that must be explicitly closed

12:56 chouser: iteractions between laziness or closures and any kind of dynamic context introduces complexity that can be hard to manage.

12:56 astoddard: stuartsierra: ok, thank you. Is the infamous function above "read-lines" ?

12:57 stuartsierra: yes

13:05 Licenser_: wouldn't somethjing liuke this work: http://gist.github.com/335459

13:05 (not tested)

13:05 hiredman: line-seq does similar

13:05 chouser: Licenser_: no, because the exception could occur elsewhere, simply causing the consumer of the seq to quit consuming.

13:06 hiredman: but it only works if you consume the whole seq

13:06 chouser: and thus leaving the file open accidentally

13:07 Licenser_: ahhh I see

13:08 it is sad that there does not seem to be a nice solution for this

13:09 chouser: yes. which is why rhickey and stuartsierra are dreaming up solutions.

13:10 but I'm guessing there's something the rhickey doesn't like about his scopes, because they've been implemented at least once if not twice, and still aren't in core.

13:10 s/the/that/

13:15 stuartsierra: How did scopes work when they were there?

13:15 hiredman: they never were "there" beyond a lisppaste

13:15 clojurebot: scope?

13:15 clojurebot: scope is at http://paste.lisp.org/display/73838

13:22 Licenser_: clojurebot: cookies?

13:22 clojurebot: Titim gan éirí ort.

13:22 gko: Hello: with contrib.clojure.command-line, what's the idiom for with-command-line with variable? Looks like I have to build cmdspec by hand...

13:24 chouser: gko: there's a little example at the end of command_line.clj that shows what a cmdspec can look like.

13:24 not exactly overwhelminging complete documentation, sorry.

13:24 Licenser_: hmm are there any centralized efforts to improve documentation?

13:24 gko: chouser: (with-command-line *command-line-args* ...

13:24 [[serve "Starts a repl server on the given port" 8081]...


13:25 chouser: OK, but if 8081 is a symbol, SERVE is bound to that symbol, not the value in it.

13:25 chouser: oh, I see

13:26 gko: chouser: basically, I want to (def *my-default-value* XXXX)

13:26 chouser: I'd just leave it blank, which gives you a nil value if that flag isn't specified.

13:26 gko: chouser: then use: [[serve "help" *my-default-value*] ...]

13:26 chouser: then when you're passing that value into your real function, provide the default there: (or myflag *my-default-value*)

13:27 hm -- perhaps that default should indeed be evaluated.

13:27 gko: chouser: yes, but -help doesn't show the default value...

13:27 chouser: right

13:27 :-/

13:28 gko: I guess I'd have to hack command-line/make-map ...

13:28 chouser: ok, it looks to me like with-command-line could allow those defaults to be evaluated.

13:29 it might be better to do something a bit more like 'locals' -- extract just the defaults from the cmdspec and provide that at runtime as another arg to make-map and print-help

13:30 so with-command-line would expand to something like (let [defaults {:port *my-default-value*}, {:strs ...} (make-map defaults ...)] ...)

13:31 I would welcome such a patch.

13:33 gko: I'll try...

13:33 chouser: thanks!

13:35 gko: maybe it could with-command-line* so that the non-evaluating still exists...

13:35 chouser: I'm having trouble thinking of when non-evaluating would be useful.

13:36 gko: bind a symbol ?

13:36 or keyword

13:36 chouser: it's not like you can pass in symbols or lists from the shell command-line. Your values pretty much have to be converted from strings anyway, so why not your defaults as well?

13:37 I'm not even sure numeric defaults like in that example make much sense.

13:37 gko: well, I think the problem is repetition...

13:38 that is, the hard-coded value is stored here and maybe in a Var...

13:39 chouser: gko: right. evalution of defaults makes sense to me. maybe after evaluation the default should be converted to a string so it matches the type you'd get if the user entered it on the command-line

13:40 oh, before you work on a patch make sure you've got your CA signed.

13:41 gko: URL?

13:41 clojurebot: something

13:41 chouser: http://clojure.org/patches

13:42 gko: OK

13:43 rfg: I just pulled the latest clojure, swank-clojure, slime, clojure-mode etc. and now the slime repl seems to just hang. Any ideas?

13:44 gko: What's CA ? Certificate Authorization ?

13:44 technomancy: rfg: slime from trunk is known to be problematic with clojure, have you tried the swank-clojure readme?

13:45 chouser: Contributor's Agreement: http://clojure.org/contributing

13:47 gko: of course you can patch the file for your own usage, but if you want to get it into contrib, we need a CA from you so I can commit it into the official repo.

13:47 rfg: technomancy: heh, wait I hadn't actually pulled swank-clojure. Let me try again. :)

13:47 gko: OK, I'll check about this later.

14:04 crowb4r: Hey, clojure every submit to google sumemr of code?

14:04 summer*

14:09 slyphon: anyone know if there's a "sane" way to update a database after an STM transaction commits?

14:09 kind of like this: http://groups.google.com/group/clojure/browse_thread/thread/aa22a709501a64ac/b578f0915b55c4be?lnk=gst&q=dosync+and+database+transactions#b578f0915b55c4be

14:09 but not requiring an STM/XA necessarily

14:13 technomancy: http://gist.github.com/335533 <= is this a known issue?

14:13 rest args getting ignored on recur

14:18 polypus: ~ping

14:18 clojurebot: PONG!

14:28 polypus: anybody know what the story is with c.c.string. it is documented but is not in the latest 1.2 build

14:29 stuartsierra: polypus: what?

14:29 polypus: what what :)

14:29 stuartsierra: c.c.string should be in current contrib 1.2.0-SNAPSHOT

14:29 polypus: let me just go double check again

14:32 crowb4r: What ides does everyone use for clojure?

14:32 Just curious

14:32 chouser: vim + rlwrap

14:32 seangrove: Use for clojure?

14:32 emacs

14:32 polypus: stuart. was looking into it late last night, tired. seems to be there now. must have a path problem someplace. sorry

14:33 stuartsierra: np

14:33 crowb4r: I use emacs as well. I'm giving inteliJ community edition with the clojrue plug-in a shot.

14:34 seangrove: crowb4r: Are you a long time emacs user?

14:35 polypus: stuart: btw, in the comment at the top of c.c.string on github it says that it is meant to replace c.c.string. did you mena c.c.str-utils?

14:35 *mean

14:38 crowb4r: seangrove: actually no. I only started using it when I started using clojure.

14:39 seangrove: crowb4r: Ah, got it

14:39 Let me know how you like intellij

14:47 crowb4r: seangrove: will do. the code completion is nice in any IDE, but lets see how good it is.

14:49 stuartsierra: polypus: yes

14:49 polypus: ss: k, ty

14:51 tomoj: I've been amazed lately by the code completion in emacs

14:51 it's started doing things I didn't think it could do

14:51 I believe it completed a java method name in a (.method style call

14:51 how it could possibly have known, I can hardly imagine

14:52 I hadn't even typed the symbol for the object var yet..

14:52 polypus: tomoj: which emacs lib are you using? i haven't really looked into completion yet

14:52 tomoj: polypus: just standard clojure-mode and swank-clojure from elpa

14:53 I am going to investigate

14:53 polypus: C-/ ?

14:53 tomoj: I have TAB bound to slime-indent-and-complete-symbol

14:53 polypus: huh, thx, i'll have a look at that

15:04 duncanm: technomancy: ping?

15:04 technomancy: if i 'embed' swank-clojure in my java app, i'm getting this error "Can't def -main because namespace: .... refers to:#'swank.swank/-main

15:06 dum de dum

15:09 zaphar_ps: duncanm: how are you embedding?

15:09 and is it clojure?

15:09 or vanilla java?

15:10 * zaphar_ps is guessing that using (require '[swank.swank :as swank]) would fix duncanm's problem

15:12 duncanm: zaphar_ps: i have that already

15:12 well

15:12 i have (:use [swank.swank :as swank])

15:20 technomancy: duncanm: use is very different from require

15:20 use doesn't make sense with :as

15:21 try (:use [swank.swank :only [vars you are using]])

15:21 duncanm: that's what i did

15:21 it works now

15:21 technomancy: cools

15:21 duncanm: but only if i build it from Ant, i think Enclojure for Netbeans is a bit confused

15:21 zaphar_ps: :-)

15:32 duncanm: hmm, is it the case that the JVM in osx 10.5 is not as good as the one on Windows?

15:35 stuartsierra: yes

15:35 duncanm: stuartsierra: if i upgrade to 10.6, would it be better?

15:35 stuartsierra: dunno.

15:35 OSX JVMs lag 1-2 revisions behind Windows & Linux

15:36 duncanm: but linux jvms are decent?

15:36 stuartsierra: yes

15:36 duncanm: i've been developing on windows, and it's definitely pretty good

15:36 stuartsierra: i've noticed that swing seems to work best on Windows

15:36 stuartsierra: duncanm: also check your JVM version, many versions of OSX come packaged with Java 1.5, not 1.6

15:37 duncanm: yeah, i did that, i'm running 1.6 already

15:37 polypus: ~ping

15:37 clojurebot: PONG!

15:38 tomoj: the JVM shipped with OSX is partially made by apple, right?

15:38 stuartsierra: I don't understand the relationships, but "Apple" appears in the vendor string.

15:45 mabes: Apple doesn't want java GUIs to look un-appley so they release there own modified version.. that is why the releases lag

15:46 thats my understanding at least.. it might differ in other ways too

15:46 Chousuke: Cyberduck is a good example of a native OS X Java app

15:46 * hiredman didn't know cyberduck was java

15:46 Chousuke: I couldn't even tell it was java before I glanced at the source and saw java files

15:47 hiredman: exactly :)

15:50 * crowb4r also did not know cyberduck was in JAVA.

15:50 hiredman: ~ticker JAVA

15:50 clojurebot: java.io.IOException: Server returned HTTP response code: 400 for URL: http://www.google.com/finance/info?q=JAVA

15:50 hiredman: ~ticker ORCL

15:50 clojurebot: ORCL; +0.29

15:52 crowb4r: hiredman: when you did the modules for clojurebot how did you set-up the keywords that trigger the function in that module?

15:52 hiredman: it's a function

15:52 you define a predicate that gets to examine messages

15:53 crowb4r: ok

16:04 arohner: hrm. IMO, the indentation on clojure-mode for letfn is broken

16:04 and the instructions for how to fix lisp-mode indentation all say "CL and Scheme are indented properly. Don't touch it"

16:07 The-Kenny: arohner: I think it's also broken for cond

16:07 arohner: hmm, (setq lisp-indent-offset 2) makes me happier

16:09 The-Kenny: hm.. cond looks correct now. But something wasn't very beautiful

16:10 http://gist.github.com/335665

16:10 That was is

16:10 s/is/it/

16:14 arohner: The-Kenny: that still has too much indentation for me

16:14 The-Kenny: your example looks correct here

16:15 The-Kenny: arohner: Huh, strange

16:15 Wait, I'll gist the whole macro

16:15 arohner: I'm running clojure-mode HEAD (as of 5 minutes ago), with (setq lisp-indent-offset 2)

16:15 LauJensen: M-x gist-region

16:15 arohner: technomancy's clojure-mode, that is

16:16 The-Kenny: http://gist.github.com/335674 is another function there the indenting is broken

16:16 (this version is indented by-hand)

16:17 arohner: hm ok.. haven't updated clojure-mode in a while

16:17 I think I have to get back to this later, or tomorrow... I have some non-clojure work to do :(

17:01 Licenser: (doall (map greet (/who)))

17:01 Chousuke: Licenser: illegal token

17:02 Licenser: it is a special reader macro for my irc clojure reader

17:25 {newbie}_: Hi I created a double[] with double-array and defined a

17:26 the problem is Arrays/toString says it is using reflection

17:26 I tried to make a new def with a type hint

17:26 like this

17:26 (def #^doubles b a)

17:26 but when I try tu use toString on b

17:26 I get the error

17:26 : Unable to resolve classname: clojure.core$doubles__6157@4cedf389 (NO_SOURCE_FILE:14)

17:28 hiredman: pastebin it

17:31 {newbie}_: http://paste.pocoo.org/show/190941/

17:41 noone?

17:54 Licenser: {newbie}_: Sorry that really isn't my expertise

17:55 so I don't even have Arrays

17:56 {newbie}_: ups I forgot the (import 'java.util.Arrays)

17:56 in the paste

17:57 Licenser: for me it works

17:57 {newbie}_: Licenser: the problem is after you set (set! *warn-on-reflection* true)

17:58 Licenser: ah sneaky

17:58 ((fn [#^doubles d] (Arrays/toString d)) a)

17:58 that works

17:59 {newbie}_: yeah

17:59 I was wondering why the type hint in the def doesn't work

17:59 Licenser: good question

18:00 also why there is an exception

18:00 (let [#^doubles d a] (Arrays/toString d)) works too

18:01 also the exception is very odd: swank.util.io.proxy$java.io.StringWriter$0 cannot be cast to java.io.PrintWriter

18:02 I think that I think that it might be a swank thingy

18:02 {newbie}_: that execption is from swank

18:02 technomancy: should be fixed in the latest swank

18:04 Licenser: hmm in repl I see that it gives the same error as yours

18:06 (def #^"[D" d a)

18:06 that is your solution

18:06 weeh!

18:07 {newbie}_: but

18:07 Licenser: {newbie}_: The cause was that #^ requires java notation and java calles an array of doubles [D

18:07 {newbie}_: thats horrid

18:08 Licenser: it's not horrid it's worst, it's JAVA

18:08 {newbie}_: but Licenser why is #^[D only required in def?

18:08 Licenser: yap

18:09 chouser: you're sure #^doubles doesn't work? What version of Clojure?

18:09 {newbie}_: 1.1

18:10 Licenser: hmm and you can't type a function it seems

18:11 chouser: ,(use '[clojure.contrib.repl-utils :only [expression-info]])

18:11 clojurebot: java.lang.ExceptionInInitializerError

18:11 {newbie}_: ,(import 'java.util.Arrays)

18:11 clojurebot: java.util.Arrays

18:11 {newbie}_: , (def #^doubles a (array-doubles 2))

18:11 clojurebot: DENIED

18:11 {newbie}_: ,(def #^doubles a (array-doubles 2))

18:11 clojurebot: DENIED

18:12 {newbie}_: doesn't work in my 1.2 snap

18:12 chouser: oh, it's something about 'def'

18:12 Licenser: what is odd is that i can't (def #^"[D" ds (fn [n] (doubles n)))

18:12 I wonder really why it is not possible

18:13 chouser: you can use #^doubles to hint a defn, or your *use* of a def, but not the def itself

18:13 'def' is one of the few special forms we use directly

18:14 Licenser: chouser: I tried def since defn didn't worked

18:14 {newbie}_: chouser: what is the *use*

18:14 ?

18:14 chouser: just emphasising that word

18:14 {newbie}_: o

18:14 Licenser: user=> (defn #^"[D" ds [n] (doubles n)) ;=> #'user/ds

18:14 user=> (ds 2) ;=> java.lang.ClassCastException: java.lang.Integer cannot be cast to [D (NO_SOURCE_FILE:0)

18:15 or am I doing it wrong

18:15 it seems not possible to type the reslt of a functio

18:16 chouser: (defn foo []) (expression-info '#^doubles (foo)) ;=> {:class [D, :primitive? false}

18:17 (defn #^Integer foo []) (expression-info '(foo)) ;=> {:class java.lang.Integer, :primitive? false}

18:17 Licenser: chouser: the type hint seems to be seen as the value of the first argument not for the function

18:18 polypus: i have a bunch of functions which i'd like to have the side effect of writing to a character stream of some sort. do i need to dig into javaland or is there something in clojure i should be looking at.

18:18 Licenser: polypus: you can rebind *out* or something like that

18:19 also the duck-streams are very niceish for that

18:19 chouser: Licenser: you see I hinted that foo would return an Integer?

18:19 polypus: Licenser: thx, don't want to rebind out, but i'll look through duckstreams. ty

18:20 Licenser: try something like (defn #^Integer foo [a]) (foo 2) it will fail

18:20 {newbie}_: Licenser: you hints function will work

18:20 (ds (double-array 2))

18:20 it just explodes because you are passing an integer

18:20 Licenser: odd odd it didn not work with the doubles

18:20 I am confused

18:20 {newbie}_: Licenser:

18:20 you passed an integer

18:21 then it calls (doubles on that integer

18:21 then it throws the expcetion

18:21 ,(doubles 2)

18:21 clojurebot: java.lang.ClassCastException: java.lang.Integer cannot be cast to [D

18:22 Licenser: ah darn I'm a idiot

18:24 so I wonder why when a is defed to something with a fixed type why a itself isn't type hinted

18:24 polypus: so is duck-streams now called c.c.io?

18:25 chouser: yes

18:25 polypus: is there someplace where all these name changes are documented?

18:27 Licenser: there is on documentation in clojure :

18:33 you know people I start to feel more compfortable with clojure day to day :) it is a really great experience when you can see how you go from only asking silly questions to actually be able to contribute back to the community

18:34 polypus: (doc format)

18:34 clojurebot: "([fmt & args]); Formats a string using java.lang.String.format, see java.util.Formatter for format string syntax"

18:34 polypus: oops wrong buffer, sorry

18:34 Licenser: ^^

18:42 slyphon: technomancy: hey, is there a way to get swank-clojure-project to add extra system properties to the jvm startup commandline?

18:48 technomancy: actually, i guess the problem is that i have a custom *.jks file and i need to set the system property so the SSL layer will use that instead of the default trust store

18:50 Licenser: slyphon: I think there is a property for the JVM parameters

18:50 slyphon: oh?

18:50 * slyphon looks

18:51 slyphon: i was wondering if there was one in the project.clj

18:51 Licenser: I don't remember wich but I remember I could set it

18:51 n

18:51 slyphon: hmm

18:51 Licenser: no no it was emacs glboal

18:51 slyphon: ah

18:51 Licenser: can't put anythin in the project one, after all it needs to load the project.clj with the JVM ;)

18:51 slyphon: yeah, totally

18:51 there's swank-clojure-classpath

18:52 i guess i'll just look through the cod

18:52 e

18:54 tomoj: slyphon: I think you can just set swank-clojure-extra-vm-args

18:55 as for leiningen, I don't know, but I believe that works for swank-clojure-project

18:55 slyphon: oh, ah, yes

18:55 i think you're right

18:55 there's also this: http://wiki.github.com/technomancy/leiningen/emacs-integration

18:55 which i guess could do something similar, but no need

18:59 duncanm: what's the right way to load clojure.contrib.string now?

18:59 (use 'clojure.contrib.string :as s) doesn't work

18:59 slyphon: (use '[clojure.contrib [string :as s]])) ?

18:59 (untested)

19:01 duncanm: nope

19:01 slyphon: hrm

19:01 oh

19:01 require?

19:02 duncanm: ahh

19:02 what's the difference between USE and REQUIRE?

19:03 Chousuke: require imports the names fully qualified

19:03 use just imports the names.

19:03 use require :P

19:06 dnolen: duncanm, easy rule of thumb: (:use [lib :only [a b c]) or (:require [lib :as alias])

19:06 technomancy: s/import/refer/ to be pedantic

19:06 since import already has a specific meaning

19:07 dnolen: don't bother with any other combination, (:use lib) is only for playing around. you're just begging for refer conflicts down the line if you use plain :use

19:07 tomoj: refer has a specific meaning too, doesn't it? :(

19:10 is use just require+refer ?

19:10 slyphon: hrm

19:11 technomancy: tomoj: yeah

19:18 clojurebot: use vs require is (:use [lib :only [a b c]) or (:require [lib :as alias]) -- (:use lib) is only for playing around

19:18 clojurebot: Ik begrijp

19:18 technomancy: (rather a faq)

19:19 crowb4r: what is that string clojurebot jsut spitout?

19:19 slyphon: technomancy: lein swank?

19:19 howto?

19:20 do i need the bleeding edge?

19:20 technomancy: $ lein swank # <= like that?

19:20 oh, it's a plugin

19:20 slyphon: ah

19:20 technomancy: belongs in :dev-dependencies

19:20 slyphon: ah, ok

19:20 * slyphon re-runs lein deps

19:20 slyphon: wow, that adds quite a bit to the 'ol lib there

19:21 technomancy: awesome, ty

19:21 technomancy: sure

19:31 polypus: with lein repl, loading c.c.string, i get: java.lang.VerifyError: class clojure.contrib.string$loading__4789__auto____3 overrides final method meta.()Lclojure/lang/IPersistentMap; (init_specs.clj:1) is this because lein repl is loading clojure 1.1.0 and not 1.2.0?

19:33 dnolen: polypus: I believe lein only really support 1.2.0. If you want to hack reliably with 1.2.0 lein is not the way to go. Write you're own shell script, import swank and be done with it.

19:33 technomancy: polypus: probably; you should use nailgun or swank instead of the repl if you're mixing clojure versions

19:33 dnolen: er sorry 1.1.0

19:33 technomancy: dnolen: that's only true of "lein repl"; it works fine for the other tasks

19:34 polypus: k, ty

19:34 dnolen: technomancy: that's good to know.

19:41 duncanm: does lein work with java sources as well?

19:41 i've been using netbeans and ant because it sorta lets me have mixed projects

19:41 technomancy: duncanm: yes, but cemerick will mock you mercilessly if you do

19:41 duncanm: heh

19:41 okay

19:41 technomancy: search for lein-javac

19:41 * technomancy hasn't used it

19:52 tomoj: are dev-dependencies added to the jar/uberjar?

20:13 duncanm: hmm, what can i do to convert a LazySeq to a java Iterable?

20:14 ah, iterator-seq

20:14 ahh

20:14 iterator-seq goes the other way, sigh ;-(

20:20 hoeck: duncanm: seqs implement Iterable already

20:20 (.iterator (seq ...))

20:23 slyphon: so, let's say I wanted to persist my data structures in a database, what would be the sanest way of handling the db-transaction/stm-transaction interaction

20:24 wow, that kind of sounded like Jesse Jackson

20:24 lancepantz: lo

20:24 l

20:24 slyphon: :)

20:51 duncanm: is it no good if i have side-effect inside a :let in a for-expression?

20:53 powr-toc: I'm considering trying to host a Clojure workshop for a few guys I know who are don't know Clojure but are intreagued... does anyone have ideas about what to do, and how to structure it?

20:53 I'd like it to be hands on.... i.e. I think step 1 will be to install either Emacs/SLIME or Netbeans

20:53 with enclojure

21:03 technomancy: powr-toc: that will take longer than you think it will

21:03 just as a warning

21:03 powr-toc: I would recommend setting up a screen session on a shared user that everyone can SSH into

21:03 that worked really well for the seajure meeting

21:03 no projector required. =)

21:03 slyphon: rhickey: do you have any suggestions wrt. database transaction / stm transaction interactions?

21:03 * slyphon asks the oracle

21:04 slyphon: i saw a thread a while back about integrating STM with JTA, but it looked as though that were a patch that got abandoned

21:04 that was*

21:04 psykotic: the obvious answer is 2pc but that's tricky to get right

21:05 powr-toc: technomancy: that's not a bad idea, but I'd like people to take away a working clojure environment

21:05 slyphon: i didn't think there were the hooks necessary in STM to do it

21:05 clojurebot: the STM is not a lock

21:05 slyphon: clojurebot: excuse you

21:05 clojurebot: I don't understand.

21:05 * slyphon sighs

21:05 replaca: technomancy: what was the reason that lein includes dev-dependencies in the uberjar?

21:06 technomancy: replaca: nobody's bothered to fix it yet. =)

21:06 powr-toc: technomancy: but it might be a good idea, to get people to do that anyway as a way of focussing everyone on the same task

21:06 dnolen: slyphon: because of stm transactions retries, rhickey added the ability to send-off an agent at the end of a successfully completed transaction, is that what you're asking about?

21:06 replaca: technomancy: ok

21:06 slyphon: dnolen: so would that be the suggested strategy?

21:07 dnolen: well people brought up the issue and he added that feature in response. there's thread on the ML about it.

21:07 slyphon: well, suggested is probably the wrong word

21:07 oh, i didn't know that feature was a response to that

21:07 i saw something about JTA transactions specifically, posted about 2 years ago

21:07 technomancy: powr-toc: it would be good to have everyone on a working environment, but you'll guaranteed have one guy with a really old emacs (or something) and it will take 5x as long on his machine, so it's a shame to have everyone else slowed down because of it

21:08 powr-toc: ideally: one guy doing the main preso, someone else can help with environment setup for the problematic cases

21:08 you could use agents!

21:09 replaca: uberjar should just tie into a list that comes from the lancet/maven tasks rather than listing lib/, but I'm not sure how involved of a change that is

21:09 slyphon: just be aware that ACI + agents for writing is not ACID by any means

21:09 it's ACI + some persistence, but that's all

21:09 slyphon: right

21:10 i'm willing to accept some lossage if the process is killed

21:10 technomancy: that should work then

21:10 slyphon: it's a task-queueing system that will basically load its state from the database, and perform planning around the values in memory, persisting to the db after a state change

21:10 replaca: technomancy: makes sense

21:11 slyphon: if some change doesn't make it to the DB because of power loss or something, it's not the end of the world

21:11 crowb4r: technomancy: Thanks for the post on Rudel. My friend and I are using it to work on some things.

21:11 technomancy: a'ight; bye folks

21:11 slyphon: technomancy: lata

21:11 technomancy: crowb4r: sweet

21:13 powr-toc: technomancy: hmmm... true... do you have any ideas on cute little code snippets or problems that would be good for beginners study?

21:23 mebaran151: in Windows Emacs, how do I get auto-indentation?

21:24 duncanm: C-M-\

21:24 it's the same in all of emacs

21:24 or M-x indent-region

21:24 mebaran151: I mean auto-indentation, on enter

21:24 * slyphon needs to figure out hippie-expand

21:24 slyphon: mebaran151: you need to rebind RET

21:25 duncanm: if you use paredit, or even lisp-mode/clojure-mode, it should do that for it already

21:25 slyphon: newline-and-indent

21:26 mebaran151: I have paredit mode running

21:26 rpenguin: how do demo repls avoid getting stuck and burning cycles from things like (recur)

21:27 mebaran151: but it still doesn't auto-indent newlines

21:30 slyphon: mebaran151: (define-key global-map (kbd "RET") 'newline-and-indent)

21:30 in your .emacs

21:31 mebaran151: slyphon: but I only want this behavior in clojure-mode or paredit-mode

21:32 slyphon: mebaran151: well, i guess you should research http://emacswiki.org or go ask in #emacs

21:42 mebaran151: alright slyphon, I'll check it out

21:42 slyphon: i'm pretty sure emacswiki has something on this

22:44 gah

22:44 java sucks

22:44 no, not java

22:44 SOAP

22:45 TheBusby: haha, so so true

22:45 slyphon: i can't believe someone thought SOAP was a good idea

22:45 TheBusby: it solves a certain set of problems, but introduces a fair number as well

22:46 slyphon: yes, the classic, "I have a problem, oh i know, i'll use $technology, now I have two problems"

22:46 TheBusby: I prefer xmlrpc for simplicity, if I really want to pay the XML performance demon

22:46 I'm hopeful google protocol buffers will become more popular though

22:47 not quite the same thing, but "good enough" for many of the areas where I see soap used

22:47 slyphon: couple of big boys are into them

22:47 i know twitter is messin' with them internally

22:47 (take that for what it is)

22:47 argh

22:47 TheBusby: doesn't twitter "mess" with just about everything?

22:48 * slyphon tries to deal with a String[][]

22:48 TheBusby: seems like that's the case at least

22:48 slyphon: eh, i got a buddy that works there, there's a bunch of really smart mfkrs there

22:48 they're trying to deal with a hockey-stick growth curve

22:49 TheBusby: quite possibly, but they get known for trying just about every new piece of tech that comes out

22:49 slyphon: heh

22:49 i think they got that rep because they were using rails

22:49 TheBusby: there traffic is nothing to be sneezed at, but it's nothing that any of the big boys aren't playing with

22:50 slyphon: true

22:50 TheBusby: I'm thinking post rails, then scala, then every message queuing system on the market, a hord of distributed db systems...

22:51 slyphon: yeah, they're trying to scale *fast*

22:51 TheBusby: it really seems like everytime I hear about something new, I shortly hear "twitters playing with that"

22:51 slyphon: and a lot of MQ systems are fucking garbage

22:51 esp. for the type of use-case they're dealing with

22:51 oh, and integrating it with ruby :P

22:51 stomp is a joke

22:51 TheBusby: yeah, but something at that volume they should fall back on C

22:51 slyphon: ehhhhhh

22:52 they had to transition most of the real heavy lifting ot the JVM

22:52 TheBusby: you pay your pound of flesh for coding in it, but it'll give you the best performance available

22:52 slyphon: hard to find good C app devs though

22:52 TheBusby: really?

22:52 slyphon: well

22:52 i dunno

22:53 TheBusby: it's certainly not the "hot new thing"

22:53 slyphon: in my circles

22:53 i ran into a recruiter for Bloomberg and he told me the financial sector is desparate for C++ guys

22:54 TheBusby: you have to be careful though because certain industries stick with certain technologies "just because"

22:54 google's care backend is C++ isn't it?

22:55 er, *core*

22:55 slyphon: yeah

22:55 well, they have the money and need for that kind of shit

22:55 you can't just rely on moore's law

22:55 at that scale

22:55 TheBusby: neither can twitter...

22:56 slyphon: i mean, shit, that project that facebook is using

22:56 turns PHP into C++

22:56 that's just evil

22:56 TheBusby: it's "performant"

22:56 slyphon: sure

22:56 TheBusby: same issue with Ruby, when you need the performance you drop down to C.

22:57 do fancy stuff in Ruby, but keep the core "performant" bits in C

22:57 Clojure is great because with the multithreading you'll get the performance of C in many cases (not IO though :'( )

22:58 while staying in clojure the entire time

22:58 slyphon: i don't think multithreading has to do with "the performance of C"

22:58 you're talking about two different cases there

22:58 TheBusby: that's true

22:59 apples to oranges

22:59 but with clojure you can quickly put together a multithreaded app that is equilavent to the single threaded app in C you'd probably have created instead

22:59 er, performance wise at least

23:00 slyphon: if your problem is parallelizable, sure

23:04 TheBusby: the issue I'm consistently running into is JVM IO

23:06 slyphon: hrm

23:08 TheBusby: feel my pain, http://tinyurl.com/yl4fo46

23:08 (JVM IO compared to C)

23:09 slyphon: don't direct buffers basically give you zero-copy performance?

23:10 i mean, sure, NIO is kind of a pain in the nuts...

23:10 TheBusby: didn't know about NIO, googling now

23:11 slyphon: !!

23:11 TheBusby: I used java primarily when Java 1.1 and 1.2 we're popular

23:11 slyphon: ah

23:11 TheBusby: I've missed about a decade of Java development

23:12 slyphon: yeah, NIO is the newish hawtnez

23:12 it's like a select(2) loop based thing

23:12 TheBusby: funny that the article I linked to is missing NIO as well...

23:12 (from Feb 2008 no less)

23:13 slyphon: i'm pretty sure NIO gives you mmap() too

23:13 i don't generally do anything at that level

Logging service provided by n01se.net