#clojure log - Oct 07 2009

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

0:00 rongenre: somnium: i'd use that to reduce all the vectors?

0:01 arbscht: sorry, I'm not familiar with R dataframes. can you describe the structure?

0:01 rongenre: um. Basically a named set of equal-length vectors

0:01 they function a lot like a relational table

0:03 arbscht: can you give an example of what you want to accomplish in clojure?

0:06 rongenre: Say it's account information. User name, password, last login, stuff like that. I want to find everyone who logged in in the last 30 mins.

0:06 somnium: ,(filter (fn [x] (some #(> % 7) x)) '([1 3 5] [2 4 6] [3 5 7] [4 6 8]))

0:06 clojurebot: ([4 6 8])

0:07 somnium: rongenre: some composition of filters and preds should get you where you want

0:08 rongenre: Is there a way.. if I get the indexes of values in one vector to extract the values in all the other vectors? Like nth which takes a vector of indices as an argument

0:09 Or alternately a boolean vector which I can apply to another one of the same side and pull out those which are true. That's kind of like a filter.

0:09 somnium: sure

0:11 ,(map (fn [[x y z]] [x z]) '([1 2 3] [4 5 6] [7 8 9]))

0:11 clojurebot: ([1 3] [4 6] [7 9])

0:12 rongenre: Gotcha. So if I could make [x z] take a vector of booleans I'd be good.

0:12 somnium: I'm sure there's more than one way

0:12 rongenre: That's helpful though, thanks

0:12 arbscht: rongenre: if you described your actual problem, we might be able to give an idiomatic solution :)

0:13 clojurebot: "There is no problem in computer programming which cannot be solved by an added level of indirection." -- Dr Maurice Wilkes

0:13 rongenre: Let me go make it up..

0:17 slashus2: ,(mapcat vals (keys (clojure.set/index #{[1 2 3] [4 5 6]} [0 1])))

0:17 clojurebot: (5 4 2 1)

0:18 slashus2: rongenre: Something like that?

0:19 rongenre: say I have this: (def *db* {:c1 (vector (range 10)) :c2 (map (fn [x] (rand)) (range 10))})

0:20 I want to find the c1 values where c2 < 0.2

0:20 sorry, (vec (range 10))

0:24 slashus2: does that make sense?

0:26 somnium: , (filter (fn [[x y]] (< y 0.2)) [[:a 0.1] [:b 0.2]])

0:26 clojurebot: ([:a 0.1])

0:26 slashus2: ,(filter #(if (< (second %) 0.2) [(first %) (second %)]) (apply zipmap (vals {:c1 (vec (range 10)) :c2 (map (fn [x] (rand)) (vec (range 10)))})))

0:27 clojurebot: ()

0:27 slashus2: or that...

0:27 somnium: (map (fn [[x y]] x) '([:a 0.1]))

0:28 if you split it out into separate transformations and filters

0:28 it should compose in a very understandable way

0:28 slashus2: The zipmap thing works I suppose.

0:29 So as a combination of our solutions..

0:29 ,(filter (fn [[x y]] (< y 0.2)) (apply zipmap (vals {:c1 (vec (range 10)) :c2 (map (fn [x] (rand)) (vec (range 10)))})))

0:29 clojurebot: ([3 0.08506635579071331] [6 0.03744368136130927] [9 0.05586704315213442])

0:30 rongenre: nice. Let me look at that more.

0:34 konr: hmmm, I have two functions defined, (defn foo [] 1) and (defn bar [] (foo)), but if I declare bar before foo, evaluating the file will raise an exception. Is this a way around this?

0:35 somnium: konr: put them in the right order?

0:35 konr: somnium: well, besides that :P

0:39 slashus2: declare?

0:40 (declare foo)

0:41 konr: hmm, this will work! Thanks!

0:42 slashus2: You are welcome.

0:52 Makoryu: ,(doc 'declare)

0:52 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol

0:52 Makoryu: ,(doc declare)

0:53 Pffft

0:53 clojurebot: "([& names]); defs the supplied var names with no bindings, useful for making forward declarations."

1:43 namor: nick namor

1:43 oups

3:05 LauJensen: Morning gents

3:07 Fossi: hi

4:03 snowwhite: how do i use compojure in the existing clojure project?

4:08 ping

4:11 LauJensen: eh?

4:12 snowwhite, could you clarify?

4:14 snowwhite: LauJensen, Thanks, just got the solution

4:21 adityo: hey snowwhite

4:21 snowwhite: pong

4:22 adityo, pong

5:28 LauJensen: Any regex junkies here today?

5:35 voldern: LauJensen: just ask your question

5:38 LauJensen: ,(re-find #"<([A-Z][A-Z0-9]*)\b[^>]*>(.*?)</\1>" "foo bar <title>quux</title> baz 1 2 3")

5:38 clojurebot: nil

5:38 LauJensen: Why am I not trapping quux ?

5:39 jdz: nice, regexps. used for parsing. i'm not reading your next blog entry lau, no way.

5:39 LauJensen: haha

5:44 raek: #"<([A-Za-z][A-Za-z0-9]*)\b[^>]*>(.*?)</\1>"

5:44 ,(re-find #"<([A-Za-z][A-Za-z0-9]*)\b[^>]*>(.*?)</\1>" "foo bar <title>quux</title> baz 1 2 3")

5:44 clojurebot: ["<title>quux</title>" "title" "quux"]

5:45 raek: small letters... :)

5:48 LauJensen: aaah, good catch, thanks

5:48 so we got it worked out and as usual, no thanks to jdz :)

5:49 jdz: i'm not taking part of increasing the number of regexp-wielding monkeys in the world.

5:56 raek: ,(re-find #"<([A-Za-z][A-Za-z0-9]*)\b[^>]*>(.*?)</\1>" "foo bar <p>quux</p><p>foo-foo foo-bar</p> baz 1 2 3")

5:56 clojurebot: ["<p>quux</p>" "p" "quux"]

5:57 raek: ah, (.*?)

6:08 crios_: ,(eval (list '+ 2 8))

6:08 clojurebot: DENIED

6:08 crios_: well, anyway: is there a shorter way to do it?

6:08 Chousuke: (+ 2 8)? :P

6:08 clojurebot: *suffusion of yellow*

6:09 crios_: yes Chousuke :) besides that

6:09 I mean, executing a dinamically created list

6:09 I was guessing ((list '+ 2 8))

6:09 but it does not work

6:09 Chousuke: no, you need eval

6:10 though using eval is often suspicious. what are you doing :)

6:10 +? :P

6:12 crios_: well, sort of studying, following some Scheme example: http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-16.html#%_sec_2.3.2

6:12 there you find: (define (make-sum a1 a2) (list '+ a1 a2))

6:13 Chousuke: ah, well, studying eval is okay I guess.

6:14 helps you understand why you shouldn't use it too often :P

6:15 crios_: yes; just wondering why that Scheme example works without an explicit "eval" function, but maybe there is some different approach to the "executing step"

6:15 Chousuke: hmm

6:15 jdz: ,(let [l '(2 8) f '+] (apply f l))

6:15 clojurebot: 8

6:16 jdz: huh?

6:16 Chousuke: '+ is a function, but it's not + :)

6:16 jdz: oh, right

6:16 Chousuke: ,('+ '{+ 1})

6:16 clojurebot: 1

6:16 jdz: ,(let [l '(2 8) f +] (apply f l))

6:16 clojurebot: 10

6:16 Chousuke: ,('+ '{- 1} 2)

6:16 clojurebot: 2

6:17 jdz: ,'+

6:17 clojurebot: +

6:17 jdz: ,(apply '+ :foo)

6:17 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Keyword

6:17 jdz: ,(apply '+ '(:foo))

6:17 clojurebot: nil

6:18 Chousuke: '+ looks itself up in whatever associative thing you give it

6:18 jdz: hmm, clojurebot should add evaluation numbers so we can refer to them in the chat :)

6:18 Chousuke: or returns its second argument (which is nil by default)

6:20 jdz: i'd probably expect that from keywords, but from ordinary symbols...

6:20 crios_: So, if you were implementing in Clojure the some "derivate" example in http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-16.html#%_sec_2.3.2 (Representing algebraic expressions), would you use "eval" ?

6:20 or some other trick?

6:20 Chousuke: crios_: the (+ a1 a2) list in that code is not evaluated at any point. it's just a data structure used by the derivation function

6:21 crios_: yes, but when actually doing the (deriv '(+ x 3) 'x)

6:21 it is evaluated

6:22 Chousuke: where is deriv defined?

6:22 oh wait, duh

6:23 no, it's not evaluated :)

6:23 if it were, there would be a call to eval

6:24 crios_: it is defined in "The differentiation program with abstract data"

6:24 and used when sum? is true

6:24 sum is true when the operator is +

6:25 it seems to me that in Scheme you (in that example) don't need to call an "eval"

6:25 jdz: crios_: it seems to you wrong

6:26 Chousuke: crios_: it never looks for the function +. all it deals with are symbols

6:26 crios_: jdz: :) I was guessing it, but why?

6:26 jdz: crios_: if there is no need for eval in scheme code, you don't need it in Clojure code

6:27 Chousuke: oh damnation, my emacs is broken

6:27 crios_: Chousuke: so you mean it never really do a real sum?

6:27 ok, I understood :)

6:27 Chousuke: crios_: yeah.

6:27 jdz: crios_: you can define function make-sum like (define (make-sum a1 a2) (list 'this-is-a-plus-symbol a1 a2))

6:28 crios_: and change the sum? function accordingly

6:28 Chousuke: crios_: deriv only transforms the list '(+ x 2) to '(+ 1 0)

6:28 crios_: ok, I see that. Pardon for causing confunsion

6:28 thanks

6:29 Chousuke: you can eval those to get the sum, but that's not relevant to deriv :)

7:44 pixelman: how can i check if a variable exists?

7:45 like (isset? *debug*)

7:48 ,(resolve '*debug*)

7:48 clojurebot: nil

8:07 benns: how do i install swank-clojure manually ?

8:08 eevar2: benns: git clone

8:08 benns: everything i found out so far says to run clojure-install from emacs

8:08 eei mean the configuration bit

8:10 i mean who came up with that crap anyway

8:11 i don't want to download clojure/etc/etc i have them installed

8:11 eevar2: my .emacs looks something like this: http://pastebin.com/m64f9ee22

8:11 benns: ok thanks

8:12 noidi: i followed these instructions to install slime/clojure http://riddell.us/tutorial/slime_swank/slime_swank.html

8:13 just used my own paths instead of dumping everything under /opt

8:14 nothing ubuntu specific in the tutorial, despite the title

8:19 G0SUB: what's the best way to recursively modify the values of a map (they themselves can be maps)? (I am fine with creating a new map)

8:25 chouser: it's good that you're ok with that, because maps are immutable, so you must create a new one.

8:27 benns: how do i start clojure from emacs ?

8:27 i have other lisps in slime-lisp-implementations

8:27 ambient: M-x slime

8:27 benns: slime runs clozure cl

8:27 ambient: ah, then I don't know. i have only clojure installed

8:27 benns: the guy who wrote swank-clojure should be hanged

8:29 chouser: ,(letfn [(double-value [m] (zipmap (keys m) (map #(if (map? %) (double-value %) (* 2 %)) (vals m))))] (double-value {:a 1, :b 2, :c {:d 3, :e 4, :f {:g 5}, :h 6}}))

8:29 clojurebot: {:c {:h 12, :f {:g 10}, :e 8, :d 6}, :b 4, :a 2}

8:29 chouser: G0SUB: ^^^

8:30 eevar2: benns: did you read the docs? -- http://github.com/jochu/swank-clojure mentions something about running clojure alongside cl

8:30 benns: i did that

8:31 basically swank-clojure-config is broken

8:31 he should simply say what configuration options exist and let _me_ set them up

8:31 instead of assuming things that do not exist

8:32 ambient: well you could fix it if you know so much about it for the benefit of the rest of us?

8:34 benns: no dude i won't waste my time with this pile of crap

8:34 if he can't be bothered to release stuff that works, i won't do his job for him

8:35 i have 4 cl implementations working perfectly with slime and swank-clojure fucks everything up because he can't be bothered to document his own stuff

8:45 danlei: benns: what I do is: just compile swank.clojure.jar, use swank.swank/start-server in the clojure repl, and connect via slime-connect. (ymmv)

8:47 benns: this is an option, but clojure-mode depends on swank-clojure being loaded

8:47 so i can't even get the first without the second

8:47 danlei: bens, a sec

8:47 G0SUB: chouser: wow. thanks.

8:48 danlei: benns: I require (in that order) clojure-mode, swank-clojure, and swank-clojure-autoload in my .emacs. that's all I have set-up, and it works

8:49 benns: and I don't like clojure-install either, I compiled swank.clojure.jar via maven

8:49 G0SUB: chouser: so that calls the function recursively. that's stack consuming, right?

8:50 chouser: G0SUB: yes

8:51 G0SUB: chouser: ok. thanks for reminding me about zipmap. that's awesome. many thanks.

8:51 chouser: but it consumes stack relative to the depth of the map nesting, not relative to the size of each map

8:51 np

8:52 G0SUB: right.

8:54 chouser: and it's necessary to keep the partially-complete higher-level maps somewhere while working on lower-level ones. Using the JVM stack is by far the most convenient.

8:56 if you maps can be deeper than the JVM stack allows (and increasing the size of the JVM stack isn't acceptible), you have to build up an accumulator either with tail-recursive calls or 'reduce'. More code, harder to get right, and likely slower.

8:59 benns: danlei: the problem i have here is that he assumes i do not have slime installed and configured

8:59 i tried clojure-installed, not even that works

9:03 danlei: benns: hm. I'm not sure why it won't work. I use jochu's clojure-mode and swank-clojure repos, both are up-to-date. If you want to take a look at my .emacs, it's at http://github.com/danlei/emacs/ if you want to take a look. I can assure you, I never ran clojure-install, just what's in my .emacs and compiled swank-clojure with maven ... hth

9:09 benns: danlei: how do you start clojure instead of clisp though ?

9:09 M-x slime starts ccl here

9:09 M-- M-x slime clojure does not exist

9:09 danlei: benns: as I said, I use swank-connect exclusively

9:10 pixelman: how can I loop a collection and have access to the current index? I want to track progress

9:15 danlei: benns: s/swank-connect/slime-connect/

9:17 jdz: pixelman: how do you loop?

9:18 pixelman: jdz: dorun, but now I am re writing with loop/recur it'll work

9:18 jdz: I was searching for a construct like rubys .each_with_index

9:18 jdz: pixelman: well, if you use map, like (map my-function collection)

9:19 pixelman: jdz: I want to prinnt out 45% done etc.

9:20 jdz: pixelman: then you can instead do (map my-function-that-takes-item-and-index collection (iterate inc 1))

9:20 Chousuke: map is probably not the best choice though

9:20 chouser: clojure.contrib.seq-utils/indexed

9:20 Chousuke: because it's lazy

9:21 jdz: Chousuke: well, i saw pixelman uses dorun at the moment

9:21 pixelman: chouser: indexed will fit the bill!

9:22 just noticed today the documentation for clojure contrib

9:22 http://richhickey.github.com/clojure-contrib/seq-utils-api.html#seq-utils/indexed

9:22 I like that it's possible to click to the source

9:37 benns: ok i managed to make it work

9:37 thanks danlei

9:38 danlei: benns: slime-connect or M-- M-x slime?

9:38 benns: welcome

9:38 benns: M-- M-x slime

9:38 or M-x slime-clojure

9:38 liwp: benns: did you have to fix something in swnak-clojure or was it just a pain to configure it?

9:38 benns: as this is the scheme i'm using with the rest of the lisps

9:38 danlei: I see

9:38 did you have to do something besides what's in my .emacs, if yes, what?

9:39 benns: i will paste the relevant bits

9:39 danlei: thanks

9:42 benns: http://paste.lisp.org/display/88333

9:43 the clojure binary is the one he gives with modified classpath to include swank-clojure

9:43 s/binary/script

9:47 danlei: benns: ok, ty

9:55 jdz: http://paste.lisp.org/display/88333#1

9:57 Chousuke: hm. something has gone wrong with my emacs

9:57 the option key seems to have stopped working

9:58 makes it kinda difficult to write clojure code, as I can't type [ or { :P

9:58 benns: jdz: it would be good if he would put these examples in the docs for swank-clojure

10:07 jfields: how do I take an argument passed to a macro and make it a string? I tried (defmacro foo [x] `(println "~x")) but that printed ~x

10:08 chouser: try 'str'

10:08 jdz: jfields: why do you want a macro?

10:09 oh, nvm. misunderstood the question.

10:09 i think.

10:09 jfields: jdz I'm being lazy for a function that I use all the time and I don't want to type the quotes anymore.

10:09 chouser cool. thanks.

10:21 ngoc: Hi, how to create interdependent namespaces?

10:21 Chousuke: I don't think you can.

10:22 cemerick: ngoc: you'd have to control the load order explicitly, which is generally a sign you're doing something wrong

10:22 e.g. factor out the base functionality into its own ns, and have the two existing ns' refer to it

10:23 ngoc: Functions in namespce a use functions in namespace b and functions in namespace b use functions in namespace a

10:23 chouser: right. stop doing that :-)

10:23 cemerick: then it sounds like there shouldn't be two namespaces

10:24 ~max

10:24 clojurebot: max people is 182

10:24 chouser: ngoc: it could probably be made to work, but it seems likely there's a better way

10:25 cemerick: we have one spot where there's an interdependency -- in that case, namespace a sets up an empty atom which is reset by a dependent namespace when it loads

10:25 not ideal, but it had to happen, and I regret it immensely :-|

10:31 ngoc: I think "resolve" form can be used to evalutate namespace/function dynamically?

10:32 cemerick: yes, that's the fn used to look up vars dynamically

10:32 Chousuke: but do you really want that?

10:32 cemerick: it's definitely intended to be used sparingly

10:33 Chousuke: and I really wish we had some "canonicalize" function for symbols :P

10:33 and keywords

10:33 cemerick: outside of the normal interning?

10:34 ngoc: I "factor out the base functionality into its own ns, and have the two existing ns' refer to it" <-- but the functions in the new one has to call functions in the 2 others, so the problem remains?

10:34 Chousuke: cemerick: I had a need to figure out the full namespace-qualified form of a given. turns out it's not exactly trivial

10:34 a given symbol

10:35 cemerick: ngoc: the objective is to eliminate the ns interdependencies. If that can't be done, why have just one namespace?

10:37 I mean, why *not* have just one namespace?

10:37 Chousuke: cemerick: the way to do it is try resolve first, then if it succeed, extract the namespace and name strings from the var and reassemble them into a symbol, or if it fails, see if the symbol has a namespace part that is an alias for some other namespace, and if so, expand it. unless you're done by now, you either need to add the current namespace to the symbol OR leave it as it

10:37 is...

10:39 cemerick: I remember writing a fn to get a ns-qualified symbol from a var.

10:39 It wasn't pretty.

10:39 Chousuke: I still haven't implemented this fully for my syntax-quote macro because I (obviously) can't use any functions that depend on macros using syntax-quote... :P

10:39 cemerick: Chousuke: by 'alias', do you mean symbol mappings in ns declarations?

10:39 ngoc: cemerick: OK, if in a same namespace, function f1 calls f2, and f2 calls f1, some kind of "forward definition" is used?

10:40 Chousuke: cemerick: the :as stuff, yeah

10:40 ngoc: declare works

10:42 triddell: ok, I'm the one who wrote the tutorials at http://riddell.us for clojure, slime/swank, etc. They are out of date right now but I'm trying to update them this morning. question: what repository is everyone pulling swank-clojure from these days?

10:44 eevar2: triddell: git://github.com/jochu/swank-clojure.git

10:45 clojure-mode is git://github.com/jochu/clojure-mode.git

10:46 Chousuke: I use technomancy's repos for both

10:46 triddell: eevar2: ok, I thought I saw something about technomancy forking it and other using that

10:46 eevar2: ^^ seems some do

10:47 danlarkin: I believe technomancy has been a more active maintainer

10:48 Chousuke: the repos do merge periodically though

10:49 triddell: but is his mostly for the clojure-install method of installation, where he keeps versions in sync

10:50 my install is manual and just takes each repos current HEAD

10:51 which could have mixed results depending on when it's done

10:51 well, I'll just try with jochu today and see if that works

10:53 danlarkin: it seems jochu maven-ized swank-clojure, which I don't really get

10:56 Chousuke: well, most of it is clojure, isn't it? it could be used with apps other than emacs

10:58 danlarkin: Hm I suppose that's true

11:00 Fossi: triddell: a hint on your (excellent, thanks) page that there is now clojure-install would be great

11:10 tmountain: the first two articles on hacker news are both clojure related ... gaining some mindshare !

11:14 cemerick: yeah, things have really picked up lately...of course, right as I had to step away! :-/

11:17 tmountain: I wonder what the numbers look like regarding downloads of Clojure over the past year

11:39 ngoc: Is it true that ;;; is used for namespace comments, ;; for function comments, ; for comments inside functions?

11:42 Chousuke: ngoc: that's the convention

11:43 ngoc: Sometimes I see that ;; is used for comments inside functions. Is this worse than ;?

11:43 ; ?

11:43 stuartsierra: ngoc: emacs will right-align comments starting with ;

11:56 ngoc: How often are you all using gotapi.com? Is there any plan to add Clojure doc to it?

11:56 stuartsierra: don't use it

11:57 ngoc: Is there a better place? (find-doc keyword)? :D

11:57 chouser: never heard of it

11:58 stuartsierra: every web-based javadoc search I've tried is slower than google

11:59 chouser: I like (javadoc x)

11:59 ngoc: Is there an easy way to join elements of an array together?

12:00 chouser: ngoc: into a string?

12:00 mtm: I've been using kiwidoc.com (caveat: written by a friend of mine)

12:00 ngoc: yes, like ["a", "b"] and ", " into "a, b"

12:00 danlei: technomancy: are you there?

12:01 chouser: ngoc: that's a vector not an array, but either way you can use str-utils/str-join, str-utils2/join, or apply str/interpose

12:02 technomancy: danlei: yeah, hi

12:02 ngoc: Is a vector a fix-sized array?

12:03 chouser: ngoc: no

12:03 ngoc: a vector is an indexed persistent collection

12:04 ngoc: http://clojure.org/data_structures#Vectors

12:05 danlei: technomancy: hi, I tried to set up swank-clojure under windows, and it appends "/src" to my swank-clojure-path, which I set to [...]/swank-clojure/target/classes/, which breaks everything for met. (since slime-lisp-implementations tries to call java -cp [...]/swank-clojure/target/classes/src/, which won't work

12:05 ngoc: There are str-utils and str-utils2. Will str-utils be removed in the future?

12:05 danlei: technomancy: I do appreciate that clojure-install makes things easier for newbies, but somehow it's getting in my way pretty much (I remember that I had this working some time ago)

12:06 stuartsierra: ngoc: probably, time unspecified

12:07 chouser: stuartsierra: I don't think I've heard a single person suggest they'd like str-utils to stick around, so that's good.

12:08 stuartsierra: 'k

12:09 chouser: I guess they might come out of the woodwork if 'require'ing it started to print warnings. :-)

12:10 ngoc: Is there a way to create a normal Java array? Or is a vector must be created first, then casted into Java array?

12:10 stuartsierra: ,(doc make-array)

12:10 clojurebot: "([type len] [type dim & more-dims]); Creates and returns an array of instances of the specified class of the specified dimension(s). Note that a class object is required. Class objects can be obtained by using their imported or fully-qualified name. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE."

12:10 chouser: vectors and arrays aren't really related

12:10 arohner: can I get quick opinions on a name I'm thinking of for a clojure library?

12:10 scriptjure

12:10 tmountain: isn't there an issue with namespace collissions and str-utils2?

12:11 stuartsierra: tmountain: it's a feature :)

12:11 danlei: technomancy: worse than that, under cygwin it even prepends "/home/danlei/" to my set-up paths ("c:/cygwin/home/danlei/.../blabla" -> "/home/danlei/c:/cygwin/..."), can't it just leave my paths as I set them?

12:11 chouser: tmountain: yeah, don't 'use' it. (require '[clojure.contrib.str-utils2 :as str2])

12:11 tmountain: stuartsierra: ahh, of course

12:11 as an aside, I'm a big fan of str-utils... use it all the time

12:23 triddell1: FYI: I've updated my clojure and slime/swank tutorials: http://riddell.us/blog/2009/10/07/tutorials-updated.html

12:23 I still see a lot of reference to them and they were very out of date

12:25 chouser: triddell1: updating old docs isn't fun, but I'm sure it'll help a lot of people. thanks for doing it!

12:29 triddell1: chouser: np, this route maybe passe with most people using the clojure-install method but there's no sense in having a broken tutorial out there for those new to clojure

12:31 danlei: triddell1: ah, using s-c-extra-classpaths for swank-clojure :)

12:31 triddell1: that's an option

12:32 triddell1: danlei: yes, that is the part I needed to figure out today!

12:33 danlei: wasn't sure what another would be

12:33 danlei: option that is

12:33 danlei: triddell1: well, basically it's jumping through hoops, I guess

12:34 triddell1: look at slime-swank-implementations, it adds the path itself, but /wrong/ (at least for me)

12:34 triddell1: so basically, this /shouldn't/ be neccessary

12:36 triddell1: oh, slime-lisp-implementations, i meant

12:36 abbe: hi everyone

12:36 how to generate API documentation like the one on clojure-contrib site ? is it downloadable ?

12:37 triddell1: danlei: yes, the path changed for swank.clj and it wasn't in the classpath... this is the only way I could fix that (or atleast the first way I found)

12:37 danlei: triddell1: yes

12:38 abbe: I think its gen-html-docs, is there any script using that ?

12:38 triddell1: danlei: but yes, it shouldn't be necessary

12:38 danlei: triddell1: in my opinion, just setting swank-clojure-path should suffice

12:38 abbe: oh, got it, from gh-pages branch

12:38 danlei: triddell1: but for me, it adds a /src at the end of the path, which gets passed as -cp in slime-lisp-implementations, which breaks it

12:39 danlarkin: so your hack is the rescue :)

12:39 danlarkin: oops

12:39 benns: why does it add stuff in slime-lisp-implementations by itself

12:39 this is what broke it here

12:39 danlei: benns: to be convenient, I'd say

12:39 danlarkin: danlei: my hack?

12:40 benns: wel that's fine if it describes how to do it manually

12:40 but as it is now it doesn't

12:40 triddell1: danlei: good!, ping me later if you find this step unnecessary

12:40 danlei: danlarkin: sorry, name got copletet wrongly

12:41 triddell1: well, it *should* be unneccessary, but atm it is neccessary :)

12:41 triddell1: danlei: right, in the future though :-)

12:41 danlei: triddell1: at least it words

12:41 *works

12:41 triddell1: ok

12:43 technomancy: danlei: sorry, was on the phone

12:43 you're using jochu's fork?

12:43 danlei: technomancy: np, we're talking about jochus anyway, but I

12:43 technomancy: yes

12:44 technomancy: man... I tried to look at that yesterday, but I couldn't get it to work either. =

12:44 =\

12:45 danlei: technomancy: adding it to extra-classpaths, as tridell1 did gets around the problem

12:46 technomancy: shouldn't be necessary in my fork, but if you got it to work that's cool

12:46 danlei: technomancy: C-h v slime-lisp-implementations helps a lot there

12:46 technomancy: the automated install uses my fork now since there was too much confusion about these kinds of things

12:48 danlei: it's really a mess, at least if you don't use clojure-install

12:50 e.g. it wants it's swank-clojure-jar-path set, even If I just want to connect via M-x slime-connect, ohterwise it barfs. that's weird (doesn't even matter what the path is set to)

12:51 technomancy: heh; I don't even have a swank-clojure-jar-path

12:52 danlei: either swank-clojure-jar-path or wank-clojure-binary must be set, if I remembercorrectly

12:52 anyway, at least it works .. somehow

12:53 * danlei gets himself some coffee

12:55 ngoc: Hi, thanks all for all your help these days. I was able to create a very simple chat server as a Clojure exercise: http://github.com/ngocdaothanh/telchat. I'm newbie, comments are very welcome.

13:19 avital: Hello friends. Is [] just a reader macro for (vector)? It seems not: If I eval the following: (ns clojure.core) (defn vector [& rest] "YES") (vector 1 2 3) I get "YES" but if I then eval [1 2 3] I get [1 2 3]. Is there any way to modify []'s behavior? What actually is [] then?

13:24 Chousuke: avital: no, it's not. it's a real vector

13:24 danlei: avital: it's a "reader form" and there is no way to modify it I knew of

13:24 Chousuke: ,(read-string "[]")

13:24 clojurebot: []

13:24 Chousuke: so it's not (vector)

13:25 if it were (vector ...) then you should be able to do (defn foo (vector a b c) ... ) but that of course fails :)

13:26 avital: Right.

13:26 I'll try to explain what we're trying to do.

13:26 We'd like to allow for a purely functional way to do something similar to logging but not exactly that. It is part of work we are doing on a google wave robot.

13:27 Our idea was to have all functions always return results with metadata containing the "log" information

13:27 Then we wrap all functions with something that concatenates all the logs of the arguments and returns a result with that concatenated log as its metadata

13:27 This way we hoped that any function call would end up returning the full log in its metadata

13:27 Chousuke: problem 1: not everything can have metadata ;/

13:27 avital: (Of course there are issues with primities, etc - we are aware of this.)

13:30 As far as I understand, if we make an assumption that all values in our program are not primitives then other than reader forms, this solution would work.

13:30 Even macros would magically work because they eventually call functions and if we redefine vector, map, ... that would work.

13:31 Chousuke: that sounds like way too much magic

13:31 but you can't modify the reader. it's written in java and exposes no hooks to itself

13:32 you'd need your own reader

13:32 danlei: or chosuke's ;)

13:32 Chousuke: if it were complete :P

13:32 avital: Right, I get it that it's impossible but I'd like to understand this in a quasi-theoretical way

13:32 danlei: :)

13:33 Chousuke: avital: so what are you actually not understanding here?

13:34 avital: Is there a purely functional way to do something that is like logging, but is _not_ logging (meaning I can't use print). I want it to be purely functional because it is actually applicative and i need to be able to unit test it etc (so I don't want to use thread-local vars).

13:34 Not in clojure

13:34 This is a general question about functional programming

13:35 I'm sorry if this seems like a strange question the way it's posed but this is truly a specific issue we are having now, we can work around it now but we are going to have difficulties with it.

13:35 We'll end up using thread-local vars but that will make testing more difficult.

13:35 Chousuke: well, for haskell there is the monad that allows you to "write" arbitrary information to an accumulator.

13:35 Makoryu: avital: Sure, there's a monad-based solution some Haskell folks came up with

13:36 Chousuke: with clojure you could do the same, but you'd probably have to pass around the accumulator explicitly

13:36 unless of course, you use the clojure monad library :)

13:36 Makoryu: avital: Are you familiar with the concept of monads?

13:36 avital: Makoryu: Not enough - isn't it just a wrapper for side-effect causing code?

13:37 Chousuke: no

13:37 Makoryu: avital: Nope

13:37 avital: Ok I'll go read a bit.

13:37 Makoryu: avital: The fact that Haskell has an IO monad (which is exactly that) is incidental to the idea of monads in general

13:37 avital: Does this accumulator monad have a name?

13:38 Chousuke: my current high-level definitions of monads is that they provide a way to define how functions in a category are composed

13:38 and probably something else too

13:38 it's like function composition, except you get to define what the composition operation is

13:39 noidi: this might be a stupid idea, but maybe you could put your log information in a map stored in a ref, which uses the "things" as keys?

13:39 Chousuke: and thus you can do all kinds of things like enforce serial execution or whatever

13:40 noidi: so that you could check (@log return-value-of-a-function) for the logging information

13:40 danlei: like monad-comprehensions -> list-comprehensions

13:40 avital: noidi: It should not be shared between threads

13:41 Chousuke: avital: put it in a ref with a nil root binding

13:41 er

13:41 regular def I mean

13:41 noidi: avital, threads can shere refs

13:41 share

13:41 avital: Chousuke: That will work, and will probably be what we'll end up doing but that will make it non-functional and this harder to test.

13:41 noidi: No, I meant I don't want our log data to be shared between threads

13:42 noidi: ah, I missed the "not" :)

13:42 avital: Again, this is not really logging - it is the list of operations to return to the wave server. It is actual applicative code and must be unit tested

13:46 noidi: I haven't really understood monads (yet), but from the little I did understand, they might be what you want

13:46 like Chousuke and Makoryu suggested

13:47 avital: Yes, I am reading about it now and it seems to be exactly what we are looking for.

13:47 So where is this clojure monad library again? ;)

13:47 noidi: http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/

14:00 ambient: it's also in clojure.contrib afaik

14:08 technomancy: stuartsierra: did you catch the second patch for #194?

14:09 first one had the tests not really testing anything

14:13 stuartsierra: clojurebot: #194

14:13 clojurebot: Gabh mo leithscéal?

14:14 stuartsierra: technomancy: got it; will test later

14:14 technomancy: ok, cool

14:15 chouser: ~ticket #194

14:15 clojurebot: {:url http://tinyurl.com/y8nhyty, :summary "clojure.test use-fixtures function composes fixture functions repeatedly", :status :test, :priority :normal, :created-on "2009-10-07T17:54:39+00:00"}

14:42 phpwner: anyone in south florida? a CTO buddy of mine is looking for a hire

14:47 PM me

14:57 ambient: php work for 7 bucks an hour ;)

15:00 mgarriss: can i ask a function what it's arity is?

15:02 pixelman: how can I get read-line to work from emacs?

15:03 I type many newlines but not much happens

15:14 phpwner: ambient: no clojure work for probably $30-40/hr

15:14 kotarak: mgarriss: not programmatically. You get the arglists in the docstring however

15:15 mgarriss: bummer

15:15 kotarak: mgarriss: why do you need to know?

15:15 chouser: mgarriss: also can reflect on the invoke methods of function class

15:16 mgarriss: kotarak: i'm writing something that randomly puts together a function out of fn and data symbols i pass it

15:17 chouser: is that a java call?

15:17 * mgarriss is a n00b

15:18 chouser: yeah, it's a bit of a mess. somebody put together a nice function

15:19 kotarak: mgarriss: and you need to know how much arguments to pass to the fn?

15:20 mgarriss: kotarak: yeah

15:21 the fn that builds the new fn needs to know the arity of the fn's it can choose from

15:21 i think i'm going to just enforce an arity requirement on the passed in fn's

15:22 but that kind of sucks

15:22 kotarak: mgarriss: it depends.

15:23 mgarriss: What's the purpose of the random generation?

15:23 chouser: mgarriss: http://groups.google.com/group/clojure/browse_thread/thread/d9953ada48068d78/1823e56ffba50dbb?q=argument+count+group:clojure#1823e56ffba50dbb

15:24 gah. sorry, that's a horrible url

15:25 mgarriss: i'm rewriting an old aLife sim i wrote in c++, each "cell" in the sim had a byte string that was interpreted as a mini language, new cells might mutate that little program. clojure/lisp allows me to write the little programs in clojure itself. i'm excited about it

15:25 Chousuke: heh

15:25 genetic programming, huh?

15:25 mgarriss: yeah

15:26 i think it cold be very cool in clojure

15:26 *could

15:26 phpwner: need clojure programmers in sofla. pm me

15:27 mgarriss: chouser: awesome, thanks for the link

15:31 nathanmarz: hey all

15:31 are there any continuations-based web application frameworks being developed in clojure?

15:45 mgarriss: that arities fn works well

15:55 kotarak: dnolen, cgrand: did you continue your discussion on template inheritance? My idea (stolen from eg. blogofile) was to have two types of templates, pages and snippets. Pages basically nest and are put into the place of a <content/> tag in the parent page template. Snippets may be used in arbitrary positions with maybe a <snippet name="xxx"/> to invoke the xxx snippet at that position. After each snippet (or page template) is expanded a special

15:55 snippet expands and snippet tags.

15:55 ambient: i have a dream, dream in which clojure runs flawlessly on both .NET and JVM, using portable code

15:55 kotarak: dnolen, cgrand: I'm not sure this really works, but I'll probably give it a try.

15:56 chouser: ambient: and the browser and on the iPhone.

15:56 dnolen: kotarak: not yet, still thinking about it myself. but I was thinking along those lines as well.

15:57 eyeris: I get a compilation error while trying to compile current clojureql from gitorious against clojure 1.0.0. Has clojureql moved away from clojure 1.0.0?

15:57 kotarak: eyeris: good question. I wouldn't think so. Let me check.

16:00 technomancy: nathanmarz: clojure doesn't have continuations

16:01 kotarak: eyeris: nope, works for me with 1.0.

16:01 eyeris: what specific problem do you have?

16:01 eyeris: I will paste the stacktrace. Give me one sex.

16:01 sec*

16:03 http://pastebin.ca/1602299

16:03 Maybe it's expecting me to have Derby installed?

16:03 kotarak: you need the Derby jar.

16:03 Yes. You need it for compilation.

16:03 Or you manually disable the backend in the build.xml.

16:04 eyeris: Where do I put the derby jar?

16:05 kotarak: Into the lib directory.

16:05 If you use Ivy it's fetched for you.

16:10 eyeris: After upgrading my code to the newest clojureql, my (ns (:require...)) fails with this dump: http://pastebin.ca/1602318

16:11 kotarak: eyeris: I had such errors with messed up builds. Try a clean and then a compile. Also check that, there is not a second clojure.jar with a different version.

16:14 emacsen: Anyone here going to the Clojure class in Reston

16:14 kotarak: too far away

16:15 leafw: actually only 30 min from here -- what class is that?

16:15 if we mean Reston, VA

16:15 emacsen: http://pragmaticstudio.com/clojure

16:15 kotarak: yes, class with Rich and the book Stuart

16:15 emacsen: "The book Stuart" hehe

16:16 leafw: xD

16:16 for $1500 I know enough already.

16:16 ambient: the channel 9 clojure talk is really nice

16:17 kotarak: emacsen: well, there are several Stuarts. Eg. Stuart Sierra.

16:18 emacsen: true

16:18 channel 9?

16:19 like NY Channel 9?

16:19 WWOR

16:19 ambient: http://channel9.msdn.com/shows/Going+Deep/Expert-to-Expert-Rich-Hickey-and-Brian-Beckman-Inside-Clojure/

16:19 emacsen: Oh. I was more in favor of something on Channel 9

16:20 maybe a Rich Hickey, Uncle Floyd show

16:20 technomancy: that guy liked to talk about how much he knew about obscure languages. =)

16:20 but yeah, it was pretty good

16:32 eyeris: haha!

16:32 It works!

16:32 Thank kotarak

16:32 kotarak: eyeris: what was the problem?

16:35 man, clojure's compilation model sure is resistant to easy handling.

16:35 chouser: kotarak: in what way?

16:36 kotarak: because you have to specify namespaces.

16:36 chouser: instead of files?

16:36 kotarak: You either have to specify them manually, or you need some discovery mechanism.

16:36 Yes

16:36 I'm currently writing a Gradle plugin.

16:37 Where Java and Groovy just say "Look there is this src dir. Compile the stuff there.", I have to jump through hoops with Clojure.

16:37 Compile could figure out the namespaces itself.

16:38 I could read all files and check the first form for ns or in-ns. But that would be best done with Clojure. Maybe I should use Clojure to write the plugin....

16:39 leafw: kotarak: I agree. Compiling clojure is still a pain.

16:39 LauJensen: ztellman, you here?

16:39 ztellman: LauJensen: yeah

16:39 LauJensen: ztellman, your tetris game throws this: Can't take value of a macro: #'penumbra.opengl/color

16:39 I just got it from Github - am I doing something wrong?

16:39 ztellman: um, I changed around some stuff in opengl.clj

16:39 eyeris: Yeah, it's especially strange that it requires a namespace as an argument because the files are named the same as the namespace.

16:39 kotarak: eyeris: not necessarily

16:40 You can also (load) subfiles.

16:40 ztellman: changed color into a function that targets color-3 and color-4

16:40 kotarak: eyeris: I actually used this in several projects now.

16:40 ztellman: search for color-3 in src/penumbra/opengl.clj

16:40 my guess is that it's not there, for whatever reason

16:41 eyeris: kotarak: What I mean is that the argument to compile, while a namespace, will always match the filename path.

16:41 chouser: kotarak: I think you could (binding [*compile-files* true] (load-file "foo.clj"))

16:41 LauJensen: ztellman, You gotta fix that, you just got linked by disclojure.org :)

16:41 kotarak: chouser: ??? I don't understand.

16:42 ztellman: LauJensen: I think the problem is limited to you

16:42 other people have already gotten it working

16:42 LauJensen: so a git clone will fix it?

16:42 ztellman: that's my belief

16:42 LauJensen: pull even

16:42 chouser: kotarak: look at the source of 'compile' -- you could do what it does, but load a file by name instead of namespace.

16:43 wooby: hi, i've got this simple web server working: http://gist.github.com/203329

16:43 kotarak: chouser: but how about the (load) case? I have to load the master file and ignore the children.

16:43 wooby: however, when a client disconnects abruptly a socketexception is thrown that kills it... and i'm not sure how to fix it

16:44 LauJensen: ztellman, I wasted your time, sorry, git pull solved it

16:44 ztellman: LauJensen, no problem at all

16:44 Guest70798: hi there, i need some help with setting up emacs with clojure

16:44 ztellman: don't hesitate in the future to bother me about this kind of stuff, next time I really might have broken something

16:44 LauJensen: :)

16:44 Guest70798: i installed everything right, slime mode is working

16:45 only my setq swank clojure extra classpaths command

16:45 is not working

16:47 technomancy: Guest70798: if you're working with the latest git version, the variable changed to the less verbose swank-clojure-classpath

16:47 hiredman: wooby: use try/catch to handle the exception

16:47 Guest70798: technomancy

16:47 technomancy: although extra-classpaths should still be aliased to the new variable

16:47 Guest70798: gotta be that

16:47 ah ..

16:47 i'm gonna test

16:48 but has the setq command to be placed in a special place in the .emacs ?

16:48 or just hanging in there ?

16:48 technomancy: Guest70798: as long as it gets executed before you launch slime you're OK

16:48 kotarak: chouser: I'll just go about it and read the first form for every file. If it's in-ns, ignore the file, otherwise compile it. Does that sound reasonable?

16:49 Guest70798: yay

16:49 techno, the aliasing wasn't working apparently

16:49 now i have my full cp

16:49 thank you very much

16:49 technomancy: Guest70798: thanks for letting me know; I'll see if I can fix that.

16:49 Guest70798: great :)

16:50 chouser: kotarak: you're trying to compile every .clj file in a directory tree, with no further direction or configuration?

16:52 kotarak: chouser: I want to hook up as much as possible in the existing gradle infrastructure. There everything is file based with the usual includes/excludes clauses based on filename. And I don't want to specify the namespaces manually all the time.

16:52 wooby: hiredman: cool, got it, thank you

16:53 hiredman: someone should spin out a nice namespace extraction library

16:53 ambient: hmm, what I'm missing? both clojure.jar and clojure-contrib.jar are in classpath: java.io.FileNotFoundException: Could not locate clojure/contrib/def__init.class or clojure/contrib/def.clj on classpath: (opengl.clj:9)

16:54 kotarak: hiredman: there is c.c.find-namespace

16:54 hiredman: ,(doc find-namespace)

16:54 clojurebot: Excuse me?

16:54 hiredman: oh

16:54 right

16:54 kotarak: c.contrib.f-n

16:55 hiredman: well dang

17:02 gosub80: hi

17:02 i was playing with clojure

17:03 and there is something I can't understand

17:03 can anybody explain to me why (remove #(Character/isDigit %) "test123") works while (remove Character/isDigit "test123") raise an exception?

17:04 hiredman: Character/isDigit is not a clojure function

17:04 chouser: unfortunately. :-/

17:04 hiredman: it is a java static method

17:05 gosub80: ok, but then why works inside the anonimous function?

17:05 hiredman: so generally it is not a value, so you cannot really pass it to other functions

17:05 gosub80: uhm

17:05 so it resolves as a function only as the first element of a list?

17:06 hiredman: not really

17:06 but more or less

17:06 rstehwien: hmm, this works for me in slime

17:06 user> (remove #(Character/isDigit %) "test123")

17:06 (\t \e \s \t)

17:06 user>

17:06 hiredman: rstehwien: correct

17:06 gosub80: yes, for me too

17:07 hiredman: Character/isDigit never is a function

17:07 and it never "resolves" as one

17:07 gosub80: so why it behaves as one in #(Character/isDigit %) ?

17:07 rstehwien: ah but I wouldn't be able to pass it around as a "real" clojure function?

17:07 gosub80: is a trick in the reader?

17:08 rstehwien: unless I wrapped it

17:08 hiredman: yes

17:08 ,(. Character (isDigit \1))

17:08 clojurebot: true

17:08 gosub80: ok

17:08 so, another question...

17:09 is there a standard function to turn a sequence of characters into a string?

17:09 kotarak: Java methods were born a second class citizens...

17:09 hiredman: ,(apply str (seq "foo"))

17:09 clojurebot: "foo"

17:09 hiredman: kotarak: I guess you could turn them into values via reflection

17:17 gosub80: I think it would be prettier if map, filter and reduce returned strings when applied to strings, like in Haskell, but this is just an helper function away

17:18 chouser: gosub80: that's interesting. how would map in (map f1 (filter f2 "mystring")) know it's supposed to return a string?

17:19 kanak: hi, can anyone tell me how to add my directory to swank-clojure's classpath?

17:19 technomancy: kanak: (add-to-list 'swank-clojure-classpath "/path/to/foo.jar")

17:20 use swank-clojure-extra-classpaths on older versions of swank-clojure

17:20 kanak: technomancy: how do i know if i'm using an older version?

17:20 technomancy: kanak: if swank-clojure-classpath is defined in Emacs, you're using a newer one

17:20 gosub80: chouser: in Haskell the String type is just syntactic sugar for [Char], a list of Char

17:21 chouser: Haskell has a static type system

17:21 kanak: technomancy: thanks. Is "~/Code" allowed or do i need to expand the "~" part?

17:21 gosub80: I know

17:23 there should be two internal String types, one as a Java String and one as a list of chars, freely and transparently interchangable

17:23 i don't know if something like this is even possible :)

17:25 Chousuke: it's not :p

17:25 because you can't have another string type that is compatible with String

17:26 so you'd lose a lot of interoperability with Java if you started using something that's not String

17:26 chouser: it would also break complexity guarantees of the various collection types.

17:27 (next x) is O(1), but if it returned a String it would have to be O(n)

17:27 hiredman: chouser: well, if you did have two types, it would return the [String] type

17:28 er [Char]

17:28 chouser: or if it returned a string-like thing that wasn't a String, turning it into a String could perhaps be transparent, but it would not be free

17:28 hiredman: CharSequence

17:28 ~ticket search CharSequence

17:28 clojurebot: ("#112: GC Issue 108: All Clojure interfaces should specify CharSequence instead of String when possible" "#98: GC Issue 94: \t (ancestors ClassName) does not include tag ancestors of ClassName's superclasses ")

17:28 chouser: in order to be consistent you'd have to be able to do the same thing with vectors and maps

17:29 hiredman: chouser: really?

17:29 chouser: there's no way to do (-> (next my-vec) (conj my-vec)) and end up with a vector in O(1)

17:30 ...without retaining the earlier part of the vector anyway.

17:31 hiredman: if (map foo "astring") returns a string, shouldn't (map foo [1 2 3]) return a vector?

17:31 hiredman: chouser: it wouldn't return a String it would return a StringSequence or some nonsense

17:32 well

17:32 chouser: that you could call String methods on, right?

17:33 hiredman: chouser: hey, I'm not say this would work and I am not advocating it, I am just saying, the lynch pin is merely compatibility with Java's String, if there was a run around that, this would all just sort of fall together

17:34 Chousuke: hmm

17:35 but for (map foo "string") to return a CharSequence, you'd have to know that foo is Char -> Char :/

17:35 gosub80: what I was thinking was:

17:35 hiredman: Oh

17:35 Chousuke: (instance? CharSequence (seq "foo"))

17:35 ,(instance? CharSequence (seq "foo"))

17:35 clojurebot: false

17:36 Chousuke: hmm

17:36 maybe that should be fixed.

17:37 though... is it useful? :P

17:37 hiredman: that would be kind of cool

17:37 except everyone specifies String everywhere

17:37 Chousuke: how often would you call seq on a string and pass it onto something excepting CharSequence...

17:37 especially since a String is a CharSequence

17:37 hiredman: Never

17:38 and nothing takes CharSequences

17:38 Chousuke: yeah :(

17:38 gosub80: if strings, in the general sense, are sequences they should be naturally operated on with functional operations, like maps and reduces. The fact that they return sequences of chars instead of other strings is just to retain interoperability with Java.

17:39 Chousuke: interop with Java is important :)

17:39 practicality trumps purity in this case

17:41 gosub80: yeah

17:42 chouser: my point is that each collection type has functionality that depends on its internal representation, which it may not be able to provide with the same performance profile after you've done seq'y stuff on it.

17:42 gosub80: but maybe there is a way to retain interop and not lose purity :)

17:45 chouser: I do agree, in the end if you need to convert this hypotethical string representation to Java String, there is a performance hit.

17:51 to have a transparent HypotheticalCharSequence, Java String should not be a Class, but an Interface :)

17:52 technomancy: there's not really a way to get a seq for items that come from a resource that must be closed, is there?

17:52 I guess if you force the user of the seq to fully consume it you could close it once you detect the last item

17:53 but without that contract you'd end up leaking resources

17:56 hiredman: ~ticket #2

17:56 clojurebot: {:url http://tinyurl.com/l6lcfw, :summary "Scopes", :status :new, :priority :normal, :created-on "2009-06-15T12:35:58+00:00"}

17:56 hiredman: :/

17:57 Chousuke: gosub80: I guess making String an interface would prevent many useful optimisations :/

17:58 for example string interning.

18:35 mgarriss: is there any wrappers for basic AWT work? i just need to build an image and be able to grab a mouse click

19:03 technomancy: stuartsierra: do you think it'd be possible to have some kind of use-fixtures invocation that would run once for every new "testing" block?

19:03 we're using the nested style a lot at work now, and fixtures would clean it up a fair bit

19:04 stuartsierra: hmm

19:05 technomancy: you'd have to tweak the testing macro a bit... not sure how that would work

19:05 stuartsierra: Maybe. I'd have to think about it.

19:05 technomancy: do you use that macro?

19:05 stuartsierra: almost never

19:05 I just put it in there to keep the RSpec fanatics quiet. :)

19:05 technomancy: I hate asking for features that the maintainers never use. =)

19:06 it's awesome how simple the implementation is though

19:06 just doesn't play well with fixtures

19:06 it'd be easy if you didn't mind wrapping the body in a new function

19:06 stuartsierra: That was my next question

19:06 technomancy: that would be the only way you could do it, actually

19:07 stuartsierra: Are you calling other test functions inside (testing ...) or just assertions?

19:07 technomancy: definitely more than just calls to "is" if that's what you mean.

19:08 stuartsierra: I mean something like (deftest foo...) (deftest grouped (testing "foo tests" (foo)))

19:08 technomancy: oh, I see. no, I don't do that.

19:08 stuartsierra: ok

19:08 technomancy: but I don't know if it's fair to disallow it just because I don't use it myself

19:08 stuartsierra: So would the fixture be attached to a particular (testing ...) block?

19:09 technomancy: I was thinking of it like one level deeper than :each

19:09 running for every testing block

19:09 stuartsierra: Oh, I see.

19:10 But (testing...) can be nested!

19:10 technomancy: yeah, I'm not sure if that really makes sense

19:10 it's probably not a problem for clojure.test

19:11 stuartsierra: At one point I tried to figure out how to do multi-level hierarchies of tests, with fixtures attaching at any level.

19:11 I gave up because it seemed too complicated.

19:11 technomancy: I can see that.

19:11 stuartsierra: And I couldn't find any other test framework that could do that.

19:12 Even RSpec only does fixtures at the class level.

19:12 technomancy: you could make it so adding fixtures inside a testing block makes it run for all enclosed ones

19:12 but it's probably not worth it.

19:12 stuartsierra: I think it would have to be a new construct...

19:13 (deftest foo (with-each-feature feature-fn (testing ...) (testing ...) (testing...)))

19:15 (with-feature :each|:once feature-fn & exprs) would eval exprs wrapped in the given feature-fn.

19:15 I mean with-fixture

19:16 * stuartsierra eyes droop

19:38 icey: is there a clojure web framework that is particularly well suited for ajax / comet / web *application* style development? (or one that's better suited for that style of development than others)

20:37 replaca_: getting ready to start the bay area clojure group meeting in SF!

20:38 ju|io: next one in MV?

21:07 replaca_: ju|io: I think so. The idea is to alternate

23:53 itistoday: Is Rich's "A deconstruction of object-oriented time" talk available in video from?

23:53 *form?

23:54 hiredman: which talk was that?

23:54 itistoday: http://news.ycombinator.com/item?id=829268

23:55 hiredman: doesn't sound familiar, so maybe no

23:55 the jvmlang talks were supposedly videoed and will be made available

23:56 itistoday: does hickey frequent this channel often? perhaps he knows?

23:57 hiredman: ~seen rhickey

23:57 clojurebot: rhickey was last seen quiting IRC, 6396 minutes ago

23:57 hiredman: ,(int (/ 6396 60))

23:57 clojurebot: 106

23:57 itistoday: ,(int (/106 24))

23:57 clojurebot: Invalid token: /106

23:57 hiredman: so like four or five days ago

23:57 itistoday: ,(int (/ 106 24))

23:57 clojurebot: 4

23:58 itistoday: thanks :-)

23:58 hiredman: ~seen rhickey_

23:58 clojurebot: rhickey_ was last seen joining #clojure, 6442 minutes ago

23:58 itistoday: any reason he has two names?

23:58 or is that some irc thing meaning I'm away or something?

Logging service provided by n01se.net