#clojure log - May 02 2010

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

0:02 mmarczyk: some points in the discussion where interesting, though; I'm not always clear on why some switches from data structure A to data structure B that were mentioned (from both sides) would ever make sense, so I guess I might ask some time in the future, when emotions subside :-)

0:05 rhudson: Rich seems to want to make it clear when you're buying into O(n)

0:06 _ato: Personally, when new to the language I would actually have expected 3 functions: (defn contains? [coll x] (some #(= % x) coll)) (defn has-key? [coll k] (not= (get coll k ::fail) ::fail)) (defn has-value? [coll x] (some #(= % x) (vals coll)))

0:06 mmarczyk: has-key? strikes me as a particularly reasonable name :-)

0:06 and if it has one, then of course I can get it

0:07 rhudson: Yeah, has-key? is good

0:07 _ato: where of course contains? doesn't really make sense for use on associative structures

0:08 mmarczyk: I sort of got used to thinking about it as testing whether the domain of the function which is represented by the given structure has a particular item as an element

0:09 so I'm sort of fine with that, but... it strikes me as rather convoluted when I actually try to express the idea (as above)

0:11 _ato: incidentally, I had two questions in relation to clojars: (1) how about putting up a "browse repository" link to clojars.org/repo/; (2) would it be possible to put a link to a "project page" for each jar in the pom and then display that on the jar's page?

0:12 for (2), I know next to nothing about maven, but if it should be possible, I could learn enough to write patches for lein & clojars

0:13 and also, thanks for keeping the site live! that (together with the fact that people actually use it) is the single claim Clojure has to pushing things forward in the infrastructure department :-)

0:14 _ato: (1) good idea, I'll do that now. (2) yes there's a field in the pom format for that, which I'd like to use.

0:15 This is a mockup of what I'd like to do next with the per-jar pages: http://meshy.org/~ato/clojars-wip.html

0:15 sexpbot: "Clojars"

0:15 mmarczyk: oh, great, that's much better :-)

0:16 I take it the pom can have pretty much arbitrary stuff put into it, then?

0:16 or is the info meant to come from elsewhere?

0:17 _ato: I can't have arbitrary stuff. it has fields for homepage url, mailing list and commits. Dunno how yet to get data in for "tutorial", "screencast" links, maybe just a web interface to add links to the pages

0:17 "autodoc" I'm going to generate for all jars :)

0:17 as long as I can get the sandboxing to work

0:18 I'd also like to investigate some sort of better browse, rather than just a big alphabetical list

0:18 some sort of categories or wiki type thing

0:18 not sure I'm going to get around to it soon though

0:20 I'm not hugely satisfied with the way Python and Perl do browse either: http://pypi.python.org/pypi http://www.cpan.org/modules/by-category/

0:20 sexpbot: "Python Package Index : PyPI"

0:20 _ato: but maybe that's the best that can be done without a lot of manual curation work

0:20 mmarczyk: right

0:23 _ato: but yes, if you'd like to submit a patch for leiningen that adds fields for homepage (mailing list and license would be nice too) please do.

0:23 mmarczyk: I would

0:23 I'll look into it in the coming week then

0:23 _ato: the full list of fields pom supports is here: http://maven.apache.org/ref/2.2.0/maven-model/maven.html

0:23 sexpbot: "Maven Model - Maven"

0:23 mmarczyk: great, thanks

1:03 * technomancy liked seq-contains? ...

1:03 technomancy: "it does what it says on the tin."

1:04 and I wish "some" were renamed/aliased to "any?"

1:04 but I really like =?

1:05 =fn might work too (in order to counteract "things are getting a little too perlish" claims), but I like =? better

1:08 _ato: nice; I've been wanting an "other versions" listing for a while now

1:11 joshua-choi: the problem with autodoc is that it depends on an old version of clojure

1:11 lein plugins shouldn't depend on clojure at all; those dependencies are implied

1:11 replaca: ^^

1:12 joshua-choi: you could check out autodoc yourself, do the fix, and do lein install while you wait for it to be fixed upstream

1:12 or it might work to remove the old versions of clojure from lib/ (or lib/dev if you're bleeding-edge lein), but you'd have to do this every time you re-ran lein deps

1:12 * technomancy needs to document more clearly the fact that plugins shouldn't declare deps that leiningen already has

1:15 joshua-choi: technomancy: I see; that's unfortunate. Thanks for the answer.

1:18 mmarczyk: technomancy: which version of =? do you like?

1:18 joshua-choi: For anyone using FnParse, I'm finally done with the antepenultimate stage of FnParse 3. Once I generate Autodoc documentation, beta testing begins.

1:19 mmarczyk: joshua-choi: cool :-)

1:19 joshua-choi: mmarczyk: Thanks. :)

1:20 technomancy: mmarczyk: wasn't aware there was more than one. I like =? meaning "return a predicate for equality to the argument."

1:20 what was the other version?

1:20 mmarczyk: technomancy: not really, I was just thinking of extending it to something like oneof? to check equality to one of a bunch of arguments

1:21 technomancy: I suppose since equal takes varargs that might make sense in parallel

1:21 it's rarely used though

1:21 oh, that's different though; = is allof? rather than oneof?

1:22 but for that you have sets already

1:22 mmarczyk: right on allof?

1:22 sets, sure, but they're equaly good for testing = to one arg

1:22 with less typing

1:23 technomancy: true. I'd have to see it in action

1:23 mmarczyk: unless you've got nils or falses, which is the interesting case where a function might add value over a set -- in addition to sugaring things a bit, of course

1:24 technomancy: there's something to be said for more specific versions just for purposes of clearer intent

1:24 mmarczyk: no argument about that :-)

1:24 I actually like #{x} for checking whether x is contained (:-P) somewhere (values-wise)

1:25 to the point where I'm not sure I wouldn't prefer (#{x} x) to return true / false

1:25 technomancy: I would like that if "some" had a better name. strikes me as an anachronistic CL-ism.

1:25 mmarczyk: I've yet to see an added benefit to (#{x} x) returning x

1:25 as written now, it's not a predicate

1:26 thus no ? makes sense

1:26 technomancy: generally (and this changes now with the new keep function) predicates are OK with any truthy values

1:26 there has historically been no reason predicates should return booleans

1:26 mmarczyk: well that's a Scheme convention

1:27 technomancy: (keep now being an exception to this rule)

1:27 mmarczyk: and I thought it was being followed in the Clojure world

1:27 kencausey: "The Clojure conditional system is based around nil and false, with nil and false representing the values of logical falsity in conditional tests - anything else is logical truth."

1:27 * mmarczyk is not sure whether he likes keep, but definitely dislikes {map,keep}-indexed :-(

1:27 kencausey: http://clojure.org/data_structures

1:27 technomancy: I wasn't fond of map-indexed until I realized it was 5x faster

1:28 then I realized I could deal with it. =)

1:28 mmarczyk: kencausey: sure, but I still think there's a convention at work here

1:28 technomancy: kencausey: that's not true anymore; "keep" will keep false values and only discard nil.

1:28 mmarczyk: seq-contains? was written to be a predicate, I believe

1:28 I mean there was an (if blah true false) form in it

1:29 also, I'm really under the impression I've read about the ? convention applying to Clojure somewhere... need to look it up

1:29 and in Scheme a predicate could contain anything other than #f for true, yet they always coerce truthy values to #t

1:30 technomancy: ? definitely implies predicateness, but IME predicateness really only means truthiness matters

1:30 which is why you can say things like "use this map as a predicate"

1:30 kencausey: technomancy: I'm speaking out of turn really, but one exception does not discard a general rule.

1:30 technomancy: kencausey: yeah, I'm actually arguing for the rule

1:30 I think the exception is confusing.

1:31 mmarczyk: Programming Clojure, page 52: "A predicate is a function that returns either true or false."

1:31 so that's were I remembered it from

1:31 hiredman: *snort*

1:31 mmarczyk: not sure if I have a personal opinion on that, though

1:32 kencausey: well, there are occasions in which you need to distinguish between false and null, not to mention occasions when you just need a truly distinct sentinel.

1:32 I'm too green with clojure to even be sure of what is meant by the keep function.

1:32 technomancy: kencausey: agreed; I just think those don't belong in general functions like keep.

1:33 mmarczyk: if you're calling a predicate, then you certainly won't be doing anything with the return value other than using it as a boolean, so it probably wouldn't be a problem to have nil returned

1:33 technomancy: but I don't really want to argue about it because Rich has been getting a lot of undeserved crap recently =)

1:33 kencausey: yes, I don't understand why there is an exception there

1:33 technomancy: mmarczyk: yeah, that's the way I see it

1:33 mmarczyk: otoh, if you were to store the return value somewhere -- say, build a map whose values where the return values of various predicates -- you might not want huge objects stored

1:34 like what (some #(= % huge-object) sequence) might return

1:34 so since you're not supposed to care about what huge-object if it's just a predicate anyway

1:34 no harm in casting to Boolean inside the predicate

1:34 technomancy: well, technically some only returns the first value

1:34 (did I mention it's terribly-named?)

1:35 hiredman: IBool

1:35 mmarczyk: actually I misrepresented my idea

1:35 technomancy: "some" implies plurality, but only one element is returned

1:35 mmarczyk: (some #{huge-object} sequence) might return something huge

1:35 technomancy: ok, I've got it finally

1:35 hiredman: (extend IBool nil {:bool (constantly false)})

1:35 mmarczyk: so, yeah, either have some?

1:35 or something without ?, but not some

1:36 technomancy: "any?" is a much better name for it

1:36 mmarczyk: (I could have used some "s to make myself clearer :-()

1:36 and none? is a much better name for not-any? :-)

1:38 though as soon as any? -- hypothetically -- got adopted, not-any?'s value as a name would increase

1:39 as for map-indexed, I realise it might be much faster than (map foo (indexed bar)), but I view it as an unfortunate product of the present-day compilation infrastructure to merge ops etc.

1:40 hiredman: "blah blah blah sufficently smart compiler blah blah blah"

1:40 mmarczyk: incidentally, map-indexed is basically just a way to avoid consing

1:41 Licenser_: moin

1:41 mmarczyk: hiredman: I know how it sounds, but this particular feature is available at least in GHC afaik

1:42 of course Haskell is a pure language *and* it's own platform, which might be a necessary combination of properties for this sort of magic

1:42 hiredman: haskell compilers have control off everything down to the metal

1:43 mmarczyk: yeah, that's what I mean by "its own platform"

1:43 hiredman: the clojure compiler is there to generate bytecode and hand it off to the jit

1:43 mmarczyk: fair enough, I have no problem whatsoever with it

1:44 but I pity the poor indexed, currently deemed an inferior primitive

1:44 hiredman: *shrug*

1:44 I recommend just not using it

1:44 mmarczyk: map-indexed doesn't take multiple sequences, for one thing

1:44 hiredman: then don't use that

1:45 mmarczyk: so that's something that might usefully change

1:45 well I'm not really complaining, you know

1:45 extending map-indexed to handle multiple seqs at some point seems like a valid feature request to me

1:47 * hiredman finds mapping operations that need indices distasteful

1:48 mmarczyk: ok :-)

1:49 hiredman: it would be really cool if amazon had some kind of map/reduce search api so I wouldn't have to use their crummy website

1:50 mmarczyk: I notice that I only use indexed once in my code, to solve Euler 50 :-)

1:51 I wonder if I'm in some sort of special debating mood (euphemism?) if I find it possible to consider at length a function I've apparently used one single time outside of the REPL *sigh*

1:54 btw, wall-hack-method is back :-)

1:54 hiredman: hah!

1:54 mmarczyk: lovely :-)

1:55 one naming issue going my preferred way for now

3:04 Licenser_: hmm proxy allows anonymous classes, there was a way to make non anonymous ones right?

3:17 replaca: Licenser_: gen-class

3:18 gerryxiao: hello

3:19 Licenser_: replaca: but gen-class is ugly :P there isn't another way I guess

3:19 * Licenser_ reads into reify but isn't suire if this is his solution :P

3:20 gerryxiao: i have resources/images/file.jpg under project file dir, use what dir/file name as file name when using file.jpg in clojure src?

3:20 i have use images/file.jpg, but not work with lein

3:21 Chousuke: Licenser_: gen-class and deftype/defrecord are the only things that generate non-anonymous classes.

3:21 Licenser_: okay thank you *looks into deftype since he didn't ever got gen-class to work*

3:22 Chousuke: in general though, you should be coding to an interface so that the name of the class doesn't matter.

3:22 gerryxiao: lein package files as images/***.jpg, but java couldn't find it

3:22 Licenser_: Chousuke: my thought being that a lot of this swing data model stuff is based on eachother

3:22 gerryxiao: i have to use "resources/images/file.jpg" as file name?

3:22 Chousuke: gerryxiao: I think "@images/file.jpg" or something

3:23 gerryxiao: Chousuke: not work

3:23 Licenser_: so if I implement List model (for example) I'd not need to 'reimplement' the same code for ComboBoxModel since it extends list model

3:23 of cause I also could make it a macro but that'D get uglyish I nthink

3:23 Chousuke: gerryxiao: then check if the resources directory is added to classpath

3:24 gerryxiao: i'm using lein which should care about classpath for me

3:24 Chousuke: Licenser_: swing is unfortunately designed like that :P gen-class is probably your only option

3:24 gerryxiao: right. check whether it actually does.

3:25 gerryxiao: Chousuke: howto?

3:25 hamza: gerry I had the same problem with lein, when testing images can be accesed using resources/images/some.png but in jar they are images/some.png so i use (ClassLoader/getSystemResource "file") check both places which ever returns the url.

3:25 if file is not found it will return null

3:25 *nil

3:25 Chousuke: gerryxiao: (System/getProperties "java.class.path")

3:29 Licenser_: Chousuke: I know swing is ... odd at times

3:30 I managed to get around some of the things by macro mojo but well

3:32 gerryxiao: i have to check java docs ;)

3:33 Chousuke: you could probably use some reflection hacks to figure out the generated class name at runtime and derive from that :P

3:33 Licenser_: lol that sounds ugly

3:33 Chousuke: yes it is :P

3:34 but it should work, as long as the proxies get evaluated in order

3:34 Licenser_: heh

3:35 well I think the macro mojo is less ugly

4:25 replaca: Q: what's the magic for leaving off the namespace on a symbol in a syntax quote?

4:27 hoeck: ~'foo

4:27 clojurebot: It's greek to me.

4:28 replaca: hoeck: thanks!

4:28 hoeck: yw!

4:29 replaca: don't think that's actually documented anywhere (or if it is, it's well hidden!)

4:32 bsteuber: replaca: it kind of follows from the rules of ` and ' but yeah, some "official macro-writing guide" for this would be nice :)

4:40 replaca: bsteuber: yeah, I get it when I see it, but... :-)

4:42 bsteuber: yeah, it also took me a while to find out :)

4:48 Chousuke: heh

4:49 it's more apparent if you write it as ~(quote foo)

7:51 raek: ,`_

7:51 clojurebot: sandbox/_

7:52 raek: is there any reason why _ becommes fully-qualified?

7:54 kzar: With swing when does paintComponent get run?

7:56 hamza: AFAIK once when the object is created and on consequtive repaint calls.

7:57 Licenser_: raek: because of the

7:57 `

7:57 `,'_

7:57 ,'_

7:57 clojurebot: _

7:57 kzar: hamza: So if paintComponent for my panel is never being called I guess I haven't added it to the frame properly?

7:59 Licenser_: kzar: if you have an example for me on how you use swing I'd be very glad, I'm currently working on clj-swing a clojure wrapper for swingy stuff

8:02 kzar: Licenser_: http://paste.lisp.org/display/98667 although it's not working

8:03 I was trying to get this donut example working http://zetcode.com/tutorials/javagamestutorial/basics/

8:03 sexpbot: "Basics"

8:03 kzar: Licenser_: I can't wait till your wrapper is ready

8:04 Licenser_: kzar: me neither :P

8:04 raek: hrm, how do I turn (1 2 3 4 5 6 7) into ((1 2 3) (4 5 6) (7))?

8:04 Licenser_: raek: partition

8:04 ,(partition 3 '(1 2 3 4 5 6 7))

8:04 clojurebot: ((1 2 3) (4 5 6))

8:04 hamza: ,(partition 3 [1 2 3 4 5 6 7])

8:04 raek: partition either requires padding or drops the last

8:04 clojurebot: ((1 2 3) (4 5 6))

8:04 Licenser_: ,(partition 3 nil '(1 2 3 4 5 6 7))

8:04 clojurebot: java.lang.RuntimeException: java.lang.NullPointerException

8:04 Licenser_: ,(partition 3 3 nil '(1 2 3 4 5 6 7))

8:04 clojurebot: ((1 2 3) (4 5 6) (7))

8:04 Licenser_: that was it

8:04 raek: ah

8:05 thanks!

8:05 hamza: kzar: in your paint method, graphics object does not have getSize method.

8:06 paint-donut is called but it throws an exception

8:06 kzar: How come it didn't throw an exception for me?

8:06 Licenser_: kzar: you're using emacs right?

8:07 hamza: no idea, Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: No matching field found: getSize for class sun.java2d.SunGraphics2D

8:07 Licenser_: look in the inferior-lisp buffer

8:08 kzar: It didn't show up there

8:08 * kzar restarts it all to see

8:09 kzar: No that's weird, no exceptions for me. Also I removed the getSize bit and just passed a with + height over and it still doesn't seem to draw the panel.

8:10 (Yea I'm using semacs)

8:10 s/semacs/emacs/

8:10 sexpbot: (Yea I'm using emacs)

8:13 Licenser_: kzar: you're up trying clj-swing out? if I see how it is used chances are it might get better quicker :P

8:15 hamza: kzar: http://paste.lisp.org/display/98669 working..

8:15 you missed g when calling rotate.

8:32 nurv: Hi.

8:32 Licenser_: so wie siehts aus in windoof :)

8:34 Raynes: $trans de en so wie siehts aus in windoof :)

8:34 sexpbot: Looks like in windoof:)

8:34 Raynes: Did I get the wrong language? :o

8:34 Or does google translate really just suck that bad?

8:35 kzar: $trans jp en nan deska?

8:35 sexpbot: Languages not recognized.

8:35 Raynes: kzar: ja

8:35 kzar: Licenser_: Yea I'd love to try it

8:35 Raynes: I think.

8:35 kzar: $trans ja en nan deska?

8:35 sexpbot: nan deska?

8:36 Chousuke: you probably need to input the actual japanese

8:37 $trans ja en 何ですか

8:37 sexpbot: What

8:38 Licenser_: Raynes: yes

8:38 Raynes: It's 100 degrees if it's 1 in here. :|

8:39 Licenser_: kzar: I'll gladly go over your results and try to make things more clojury from the framework

8:40 kzar: hamza: Ah tanks

8:40 s/a/ha/

8:40 sexpbot: hhamzha: hah thanks

8:40 kzar: oops

8:41 Chousuke: heheh

8:41 kzar: hamza: Are you using Emacs / what environment are you using? I'm curious how you got exceptions thrown but I didn't

8:44 hamza: kzar: i am using emacs with inferior-lisp

8:45 kzar: Hmm wierd

8:54 Licenser_: Does it need Clojure 1.2, I'm using 1.1

8:55 Licenser_: yea it's 1.2 :(

9:09 ,(println ",(+ 1 1)")

9:09 clojurebot: ,(+ 1 1)

9:17 arj: hello. I have a wierd hard to trigger problem in my compojure web project. It seems to be something related to seq and filter. I have tried to write down everything I could about the problem here: http://stackoverflow.com/questions/2748087/stackoverflow-in-compojure-web-project

9:17 sexpbot: "StackOverflow in compojure web project - Stack Overflow"

9:18 arj: I can't seem to figure out why this bug happens, it's very random so it's very hard to reproduce

9:49 raek: thought I might share this: http://gist.github.com/387097

9:49 it's a cond-like macro using if-let and re-find

9:50 each clause is a [regex bindings body] triple

9:51 if the string matches the regex, then vars in bindings are bound to the groups of the match and body is evaluated

10:06 ~exceptions

10:06 clojurebot: http://paste.lisp.org/display/74305

10:14 leifw: hey

10:14 what is a portable (across versions) way to check for regex match?

10:14 I had been using (if (re-seq pattern string) ...)

10:15 but when I went (backward) from 1.2 to 1.0, re-seq started returning () instead of nil for a non-match

10:15 which broke *everything*

10:15 is there a "correct" way to do it?

10:15 re-matches perhaps

10:18 Licenser_: leifw: re-find?

10:18 also (empty? (re-seq ...)) should work too

10:22 leifw: thanks

10:24 re-find is what I was looking for

10:24 dammit I was using that earlier and forgot about it :-/

10:26 * raek <3 if-let + destructuring + re-find + groups in regex

10:28 leifw: raek: yeah, it's like haskelly pattern matching for strings :)

10:29 raek: I also made a cond-like macro based on that pattern: http://gist.github.com/387097

10:29 (I posted it here some minutes ago, sorry for spamming...)

10:29 bosie: anyone ever managed to use java source classes directly in clojure?

10:30 raek: well... yes

10:30 ,(.toUpperCase "foo")

10:30 clojurebot: "FOO"

10:30 bosie: raek: but that's not the source, that is a binary

10:30 raek: ah, I see

10:31 they have to be compiled before clojure can use them

10:31 bosie: crap

10:31 raek: but as long as the .class files are on the classpath, you should be able to use them

10:33 bosie: oh

10:34 raek: do you need to include some java source in your clojure project?

10:34 bosie: yes

10:35 raek: the new deftype and defrecords solve the problem I've had with needing java code so far

10:35 but they're still in the alpha version

10:35 what classes do you need? Exceptions?

10:36 bosie: raek: no, i wrote an xml parser in java, which i need to ... parse the xml files ;)

10:36 Licenser_: proxy often works too

10:36 rewrite it in clojure :P

10:36 bosie: it is already too slow in java ;)

10:37 Licenser_: bosie: it might get faster in clojure

10:37 raek: "There are several plugins for Leiningen in Clojars repository. These plugins implement different functionality — automatic uploading of code into Clojars repository, building of Java source code, etc."

10:37 Chousuke: are java's built in parsers too slow as well? :/

10:37 Licenser_: speed is 10% about language 90% about algorithm

10:37 raek: saw this...

10:37 bosie: Chousuke: very

10:37 rhudson: bosie: Is there some reason you didn't use one of the standard Java XML parsers?

10:37 Licenser_: raek: did a post on the plugins

10:37 http://blog.licenser.net if you are interested

10:37 sexpbot: "lice!"

10:37 raek: ah, nice

10:37 bosie: rhudson: it is quite slow to be honest, esp. since you have to go over it again

10:38 rhudson: ?

10:38 Licenser_: bosie: how big are your files?

10:38 bosie: Licenser_: between 100kb and 3mb

10:38 Licenser_: that shoulodn't be too bad

10:38 bosie: rhudson: you parse it and then you have to tokenize the text etc

10:38 rhudson: i read it into a char array and do it while i read it from the filebuffer

10:39 Licenser_: not if you parse 27million xml files ;

10:39 )

10:39 Licenser_: bosie: parse n of them in paralell :P

10:39 and why would you want to do that?

10:39 bosie: Licenser_: 128 of them in parallel actually

10:39 Licenser_: hmm that might be too much

10:40 if you read 128 in paralell IO will liely bekomm a bottleneck

10:40 bosie: because of the disc?

10:40 yead

10:40 yea

10:40 Licenser_: and unless you're running sparc you likely don't havfe 128 cores :P

10:40 bosie: we will see

10:40 i have 128 cpus

10:40 ;)

10:40 Licenser_: cpu's or cores?

10:41 bosie: cpu

10:41 Licenser_: that still isn't too good

10:41 bosie: hm?

10:41 Licenser_: rather make 128 chunks of files and pass each cpu one chunk

10:41 well small talks don't paralelizes good

10:41 but I've to go

10:41 bosie: Licenser_: yea

10:41 Licenser_: bosie: I'll be back in a bit, I

10:41 'll talk to you later promised

10:42 once I'm out of the office

10:42 bosie: Licenser_: but without testing the theories, i am just guessing... so i need runnable code first

10:42 Licenser_: *nods*

10:42 bendlas: Hi

10:42 Licenser_: well I'll ba back in a bit

10:44 bosie: i compile my java files, put the parser into the classpath, do a little (import '(parser.FileParser))

10:44 (new FileParser) fails, being not able to resolve the classname

10:45 rhudson: (import '(parser FileParser))

10:45 raek: '(parser.FileParser) is the empty prefix list

10:46 (import 'parser.FileParser) also works

10:46 bosie: neither works

10:47 raek: is the source compiled? is the .class files in the classpath?

10:47 bosie: yes and yes

10:47 raek: does import fail?

10:47 bosie: no

10:47 well yes with 'parser.Fileparser it does

10:48 raek: then clojure cannot find it in the classpath

10:48 are you using leiningen?

10:48 bosie: no

10:49 i manually set the classpath with "java -classpath...."

10:49 raek: how do you start the repl?

10:49 rhudson: ../parser is in your classpath?

10:49 raek: the directory above parser needs to be in the classpath

10:49 bosie: rhudson: as an absolute path

10:49 rhudson: (i.e. the directory containing your 'parser' dir)

10:50 bosie: yes, the directory containg 'parser' is in the classpath

10:51 raek: what does the import exception say?

10:51 bosie: i went with rhudson's version and it says: Exception in thread "main" java.lang.NoClassDefFoundError: parser/FileParser (wrong name: FileParser) (main.clj:1)

10:53 rhudson: Does your FileParser.java say "package parser;" ?

10:53 bosie: idea is able to pick it up

10:53 remleduff: Is FileParser actually in the "parser" package?

10:53 bosie: it is

10:55 remleduff: FileParser.java has the "package parser;" line, it's located in "classes/parser/FileParser.class" and "classes" is in your classpath?

10:55 raek: looks like it finds the .class file...

10:56 bosie: remleduff: it is not located in 'classes/parser/', is the word classes that important?

10:56 remleduff: No

10:56 Just the structure needs to match

10:57 bosie: they do

10:57 and since La Clojure is able to pick it up i guess i am doing something wrong with the export

10:58 remleduff: Hmm, FileParser is a public class?

10:58 bosie: remleduff: of courrse

10:59 rhudson: Are you saying in works in IDEA, but not standalone?

10:59 bosie: rhudson: that is what i am saying

11:02 rhudson: Well, the IDEA Run command shows you the command line it's executing -- you could compare that to what you're doing standalone.

11:03 bosie: rhudson: ok, i miscommunicated. it works in the editor of idea but neither standalone nor in the run command

11:03 but thanks guys, i will dig into it once i have more time

11:03 rhudson: good luc

11:20 paraseba: Hi, I know the following wont work, but is there any way I can get the same effect?: (apply new MyClass [arg1 arg2 ...])

11:21 I mean, expand an array of arguments into a constructor call

11:22 replaca: paraseba: (apply #(MyClass. %1 %2 %3) [a1 a2 a3]) if you know the number of args

11:23 paraseba: replaca: that's the problem, I need to call one constructor or the other based on the size of the arguments array

11:25 remleduff: (defn create-foo ([a b] (Foo. a b) ([a b c] (Foo. a b c)); (apply create-foo args)

11:25 peregrine81: paraseba: could you use a macro for that?

11:26 replaca: paraseba: yeah, I think remleduff has the best solution, unfortunately

11:27 paraseba: remleduff: no easier way to achieve that? I don't like writing one of those for each cardinality ...

11:27 replaca: paraseba: you could write a macro that used reflection to generate that function, if it was a common prob

11:27 paraseba: replaca: I see ... I thought there was a reflective mechanism for this already in clojure

11:28 replaca: paraseba: only for clojure funcs AFAIK because it's part of the generation/invoke cycle

11:29 maravillas: paraseba: I had a similar problem recently that I approached as remleduff suggested, at first

11:29 I ended up replacing it with keyword args to call setters

11:29 replaca: replaca: using a general reflective method for interop would make interop very slow

11:29 rhudson: (defmacro construct [cl args] `(new ~cl ~@args))

11:30 replaca: rhudson: which doesn't work when the number of args varies at runtime

11:30 paraseba: replaca: yes of course, it shouldn't be the default mechanism ...

11:30 rhudson: Don't see why not

11:31 paraseba: rhudson: args is an array ... not expanded at macro expansion time

11:31 rhudson: I tested (construct BigInteger [str(1000000000)])

11:32 remleduff: Maybe: (Reflector/invokeConstructor (into-array Object args))

11:32 Sorry: (Reflector/invokeConstructor Foo (into-array Object args))

11:32 paraseba: remleduff: yes ... I think that's the easier way to go ...

11:34 remleduff: Not sure how guaranteed that method is to exist in any future version of clojure...

11:36 paraseba: rhudson: try (construct BigInteger (first [1]))

11:36 rhudson: you're handling the easy case of *actual* compile time array

11:37 rhudson: I see

11:37 reflection it is then

11:37 paraseba: remleduff: why is that? can you explain please?

11:38 remleduff: It's just kind of an implementation class, I can't speak for Rich on if it's a guaranteed class. It's probably fine though

11:40 Also, that does reflection every time, was hoping to find something that did caching of the constructors

11:40 Will probably be pretty slow if you are doing a ton of it

11:41 paraseba: remleduff: thanks, performance won't be a problem

12:28 bsteuber: which swank was it that works with clojure's new meta syntax?

12:36 replaca: bsteuber: the latest on clojars

12:38 bsteuber: replaca: weird, then my error must be sth. else..

12:40 I'm getting "unmatched )" when slime-connecting to a mvn clojure:swank with that version

12:49 is it normal that the jar is named swank-clojure-1.2.0-20100308.145053-9.jar though released 28th Apr, not 8th Mar

12:50 ?

13:00 jgracin: Hi! I'm getting "swank is not a task" when running "lein swank". Using lein 1.1.0. I have :dev-dependencies [[leiningen/lein-swank "1.1.0"]] in project.clj. Any ideas?

13:02 replaca: bsteuber: that's the one I've got and it sems to work ok

13:02 *seems

13:03 bsteuber: replaca: ok thx, have to look somewhere else then

13:04 remleduff: jgracin: You ran lein deps?

13:04 jgracin: remleduff: yes, lib/ contains 20+ jars

13:05 remleduff: including lein-swank.jar

13:05 remleduff: Are you on windows/

13:05 jgracin: remleduff: Solaris

13:06 remleduff: if you do "DEBUG=1 lein swank" what's your classpath?

13:07 jgracin: remleduff: it outputs a line containing only leiningen-1.1.0-standalone.jar

13:08 remleduff: Well that's no good... what does: find lib/ -follow -mindepth 1 -maxdepth 1 -print0 2> /dev/null | tr \\0 \:

13:09 do for you?

13:09 jgracin: remleduff: Found it! Thanks remleduff! The problem is that lein script depends on GNU find, and it doesn't work on Solaris.

13:09 remleduff: Cool

13:09 I think I saw a commit for fixing find on other Unixes go by on github, so it may be fixed in a newer version

13:10 rfg: How can I take a string and make it the first entry in a String[]?

13:11 jgracin: remleduff: great, I'll check out the git repo

13:12 remleduff: ,(into-array ["hello"])

13:12 clojurebot: #<String[] [Ljava.lang.String;@17f2e13>

13:12 rfg: Thank yee, kind sir!

13:15 remleduff: ,(apply into-array String "does" "this" "work?")

13:15 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$into-array

13:16 remleduff: ,(into-array String (apply vec "does" "this" "work?"))

13:16 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$vec

13:16 remleduff: bleh

13:16 ,(into-array String (list "does" "this" "work?"))

13:16 clojurebot: #<String[] [Ljava.lang.String;@1b87d8c>

13:16 rfg: ,(into-array String (apply vector "does" "this" "work?"))

13:16 clojurebot: java.lang.IllegalArgumentException: array element type mismatch

13:18 remleduff: ,(into-array String (apply str "does" "this" :also 1 2 "work?"))

13:18 clojurebot: java.lang.IllegalArgumentException: array element type mismatch

13:18 remleduff: ,(into-array String (map str ["does" "this" :also 1 2 "work?"]))

13:18 clojurebot: #<String[] [Ljava.lang.String;@1a07c8c>

13:18 remleduff: ,(seq (into-array String (map str ["does" "this" :also 1 2 "work?"])))

13:18 clojurebot: ("does" "this" ":also" "1" "2" "work?")

13:19 bmason: ,(apply str ["does" "this" :also 1 2 "work?"])

13:19 clojurebot: "doesthis:also12work?"

13:20 remleduff: Is there an "apply" that applies the variadic args as a single collection to the function?

13:21 So (myapply f 1 2 3 4) -> (f (list 1 2 3 4))

13:21 (defn myapply [f & args] (f args))

13:21 bmason: why not literally write out (f '(1 2 3 4)) ?

13:22 mmarczyk: you mean the function to the collection :-)

13:22 and since you've just defined, sure there is one ;-)

13:22 remleduff: hehe

13:22 mmarczyk: (defined it)

13:24 ,(apply (comp count vector) 1 2 3 [4 5 6])

13:24 clojurebot: 6

13:25 mmarczyk: ,(apply (comp count list) 1 2 3 [4 5 6])

13:25 clojurebot: 6

13:47 rfg: Why isn't this working: (java.nio.IntBuffer/wrap (into-array [1 2 3]))?

13:48 That's an Integer array as opposed to an int array?

13:50 hoeck: rfg: try (into-array Integer/TYPE [1 2 3])

13:53 rfg: Thanks

14:21 iruediger: is it possible to destruct a list without binding each value?

14:21 I know I can do: (let [[x y] [1 2 3]] [x y])

14:22 but is it possible to do without binding to x and y

14:22 ?

14:33 chouser: iruediger: why else would you be destructuring, except to bind x and y?

14:33 iruediger: why else would you be destructuring, except to bind x and y?

14:35 iruediger: chouser, I want to use clojure.contrib.sql/create-table. It takes the table name and specs

14:35 I have a list of specs: ([:id :int :name :varchar])

14:35 but this varies for each table

14:37 I'd like to destruct that list of specs and call create-table, like (create-table :table_name (magic-destructing-fn specs))

14:38 I am not sure if that is possible

14:38 Associat0r: hey Ash

14:39 remleduff: ,(partition 2 [:id :int :name :varchar])

14:39 clojurebot: ((:id :int) (:name :varchar))

14:40 chouser: iruediger: I'm not sure, but I think you may want (apply create-table :table_name specs)

14:41 iruediger: remleduff, chouser: thanks, I'll try both suggestions

14:41 remleduff: I think you want to end up with (create-table :tablename [:id :int] [:name :varchar]) right?

14:41 iruediger: yes

14:42 remleduff: (apply create-table :tablename (map vec (partition 2 [:id :int :name :varchar])), I think

14:42 iruediger: sorry I got the specs collection wrong, it should be: (([:id :int] [:name :varchar])

14:43 ([:id :int] [:name :varchar])

14:43 remleduff: Oh, then just what chouser said, as usual :0

14:44 iruediger: ok thanks anyway remleduff

14:44 LauJensen: Evening guys

14:46 s/guys/crew

14:53 remleduff: Will protocols allow (partition 2 '[a b c d]) to return a vec instead of a list or seq or whatever it is?

14:54 ,(class (partition 2 '[a b c d]))

14:54 clojurebot: clojure.lang.LazySeq

14:54 remleduff: ,(class (first (partition 2 '[a b c d])))

14:54 clojurebot: clojure.lang.LazySeq

14:57 Licenser: remleduff: that'd actually be quite cool :P

15:00 TakeV: Is there a Clojure version of SDL, out of curiosity?

15:02 chouser: remleduff: yes, but I doubt partition will do that. ...mainly because it could today for built-in collections like vector. The decision to return lazy seqs is intentional

15:04 arj: agents are really a brilliant concept

15:04 remleduff: Ah, I understand the outer one being lazy, but seems like each interior one could be the original type

15:07 Associat0r: join ##fsharp

15:07 arj: :>

15:13 fro0g: can I set up a website using clojure (EPL license) + some AGPL licensed project, or am I in violation of the AGPL license?

15:20 Licenser: hm so what to do tonight

15:49 I've a dream

15:51 one happy day when unicorns are freely roaming the wide green oceans of europe, the hippies are happily cuddling their trees, some lonely phenixes roam the sky every now and then picking out one of the weaker parts of the hippy herds clojures compiler errors will actually be helpful.

15:52 technomancy: clojurebot: unmatched ) is an indicator you need to upgrade clojure-test-mode, not a problem with swank itself.

15:52 clojurebot: Roger.

15:53 Licenser: I mean is it that hard for the compiler to spit out a line or at least a file name :(

15:54 I mean I'm willing to deal when it comes to the phenixes if it are just a few of them it's OK with me

15:59 rfg: Over 9000 points for anyone who can tell me how to convert a ByteBuffer to a string (where the bytes are chars).

16:01 Ah!

16:01 Well that didn't work.

16:01 remleduff: ByteBuffer.remaining tells you how many bytes to get, create an array of that size, then ByteBuffer.get(array), then (String. array)

16:02 rfg: Log: 䙲慧浥湴⁩湦漊ⴭⴭⴭⴭⴭⴭⴊ〨㐩›⁥牲潲⁃㔰㔲㨠杬彖敲瑥砠楳潴⁡捣敳獩扬攠楮⁴桩猠灲潦楬攊 :)

16:03 Licenser: hrm

16:04 rfg: That was using (.toString (.asCharBuffer bbuffer)).

16:05 Licenser: So I have this code: http://github.com/Licenser/clj-swing/blob/master/src/clj_swing/document.clj#L53 that is supposed to create a java object, the API http://java.sun.com/javase/6/docs/api/javax/swing/text/AbstractDocument.html tells me that there is a constructor like I call but clojure screams :(

16:06 rfg: mayhaps your encoding is wrong?

16:06 hiredman: ~google java abstract classes

16:06 clojurebot: First, out of 468000 results is:

16:06 Abstract Methods and Classes (The Java™ Tutorials &gt; Learning the ...

16:06 http://java.sun.com/docs/books/tutorial/java/IandI/abstract.html

16:07 Licenser: hiredman: thank you :) I feel stupid now ;)

16:07 rfg: http://download.java.net/media/jogl/jogl-2.x-docs/javax/media/opengl/GL2ES2.html#glGetProgramInfoLog(int,%20int,%20java.nio.IntBuffer,%20java.nio.ByteBuffer)

16:07 sexpbot: "GL2ES2 (JOGL, NativeWindow and NEWT APIs)"

16:09 remleduff: (let [bbuffer (java.nio.ByteBuffer/wrap (.getBytes "hello")), size (.remaining bbuffer), buf (create-array Byte/TYPE size)] (.get bbuffer buf) (String. buf)) ;optionally specify the encoding in String constructor

16:09 Maybe I should have pasted that

16:10 rfg: ^^

16:12 chouser: my agents don't appear to be using up all my CPU resources

16:13 Licenser: chouser: they are secret agents and doN#t want to get noticed

16:13 remleduff: Does anyone happen to know when LISP added defconstant?

16:13 chouser: hmph

16:14 remleduff: Sorry, wrong window, but if anyone knows :)

16:14 rfg: heh

16:18 Cheers remleduff

16:18 remleduff: I want my points :P

16:18 kzar: what's the equivalent of e.getX(); ?

16:18 * rfg grants over 9000 points to remleduff

16:19 * rfg now has a points deficit

16:19 remleduff: kzar: If you mean interop-wise, (.getX e), if you mean what the "clojure way" would be, probably (:x e)

16:20 I have all the points, muahaha

16:21 kzar: remleduff: Hmm that's what I thought but I get a class cast exception

16:21 remleduff: Thanks I'll check the other stuff I changed

16:23 rfg: Yay, my GLSL shader works.

16:29 Licenser: oh darn it :(

16:40 kzar: So I'm working on a little swing app but I had two questions; how come if an action calls println I don't see it at the repl? How come I don't see exceptions caused by code called by actions either?

16:41 technomancy: kzar: IIUC each thread gets its own stdout and stderr

16:43 kzar: ah ok

16:43 Licenser: swing documents areno fun

16:44 kzar: you can look in the *inferiour-lisp* buffer

16:51 chouser: technomancy: really!?

16:51 I was under the impression swank or slime rebinds *out* and *err*

16:51 in order to send them back to the emacs buffer

16:52 Licenser: chouser: not when you open a new thread

16:52 technomancy: hm; I could be wrong about that.

16:52 chouser: but if you print from another thread, that gets the root binding again

16:52 Licenser: nah it is a thread thing

16:53 technomancy: (.start (Thread. #(println "hi")))

16:53 ,(.start (Thread. #(println "hi")))

16:53 clojurebot: nil

16:53 technomancy: yeah, that goes too inf-lisp. never mind.

16:53 must be some weird swing quirk then.

16:53 Licenser: I really really wonder how I can get String index out of range: -1 when I wrap both arguments of subs in (max 0 ...)?

16:55 kotarak: Licenser: maybe the second in a (max 1 ...)?

16:55 ,(subs "Hello" 0 0)

16:55 clojurebot: ""

16:55 kotarak: Nevermind.

16:55 Licenser: yea tried that

16:56 the second is in (max 0 (min len (.length stringythingy)))

16:56 * technomancy wishes -1 in subs would count from the end of the string

16:56 Licenser: I really am not sure if I'll get the swing of this :(

16:57 technomancy: I wonder if a patch for that would be accepted

16:58 Licenser: ,(subs "" 0 0)

16:58 clojurebot: ""

16:59 Licenser: technomancy: I'd rather put that in c.c.string since I'm not sure if it expected behaviour :P

16:59 technomancy: elisp and ruby both do that

16:59 Licenser: well my document is horribly bad, it refuses to render, crashes when editing, I am not good at this :(

16:59 hmm true

17:00 and you still can 'shield' subs from that by min max you just don't get errors

17:02 remleduff: ~subs

17:02 clojurebot: excusez-moi

17:09 technomancy: is anyone using slime trunk?

17:10 Chousuke: are you going to break compatibility? :P

17:10 technomancy: Chousuke: it's already broken in the current release; I'm hoping to restore it in the next.

17:11 Chousuke: I don't update very often, but I'm not using the elpa version either

17:11 technomancy: Chousuke: I'm just wondering if slime is at a good point right now to attempt that or if there have been any major changes recently that may contribute to instability.

17:11 * technomancy grumbles about the irresponsible development cycle that eschews formal releases in favour of "always use the latest"

17:12 rfg: Hmm, these microwave times are non-linear.

17:12 * rfg does some curve fitting.

17:14 rfg: Okay, I need to microwave my lasagne for 8m50s (fitting a quadratic).

17:14 Chousuke: yeah, the slime guys only care about common lisp implementations of the swank backend :(

17:15 anything else basically works by accident.

17:15 Licenser: ,(subs "bla" 1 0)

17:15 clojurebot: java.lang.StringIndexOutOfBoundsException: String index out of range: -1

17:15 Licenser: oh for crying out lod ...

17:20 technomancy: worst error message evar

17:21 Chousuke: leaky abstraction ;P

17:22 technomancy: hugod: pingo

17:22 Licenser: it took me nearly an houre to find why that happens

17:28 hugod: technomancy: hi

17:31 technomancy: hugod: I keep forgetting which of your swank branches still need attention =)

17:31 hugod: it was mostly compile-string and hyperdoc, right?

17:32 hugod: yes, autodoc needs redoing for rpc

17:32 compile-string is the most useful

17:33 but also contains a nasty Compiler/load call

17:38 MadWombat: anyone knows how to pass dont-close to lein swank command?

17:38 lein swank :dont-close true doesn't seem to work

17:44 raek: I ended up making this: http://gist.github.com/348309

17:44 lein didn't pass the options to swank

17:44 thought, this might have been fixed now...

17:50 * technomancy considers moving the lein swank plugin to swank-clojure itself

17:52 technomancy: MadWombat: $ lein swank 4005 localhost :dont-close true # <= works for me

17:53 just has an odd argument order since the port is the thing that you're most likely to change

17:53 any reason why :dont-close shouldn't be the default?

18:09 replaca: ~doc subs

18:09 clojurebot: the doctor is out

18:11 technomancy: replaca: did you see my chat from yesterday about how lein plugins shouldn't declare a dependency on Clojure?

18:18 MadWombat: I just pushed a fix for swank-clojure so :dont-close is no longer required

18:18 should be available on clojars

18:44 MadWombat: Guess I will need to switch back to the github version of swank-clojure

18:46 cause lein swank 4005 localhost :dont-close true gives me wrong number of arguments error

18:48 replaca: technomancy: no, I didn't

18:48 technomancy: I suppose that that's aimed at sutodoc :-)

18:48 *autodoc

18:49 MadWombat: technomancy: wonder if it makes more sense to include lein-swank in leiningen instead

18:55 * replaca is now changing #^ to ^ for the greater good

19:07 nurv: Hi.

19:08 MadWombat: any recent word on 1.2 release date?

19:34 technomancy: replaca: yeah, it's badly-documented

19:34 I'll make sure the next release has more details about authoring plugins

19:36 replaca: technomancy: ok, I'll pull clojure out then

19:37 technomancy: replaca: if you want autodoc to work with lein 1.1.0 then I'd recommend leaving #^ alone

19:37 #^ is going to stay in clojure for a while for backwards compatibility

19:37 it's only ^-as-meta that's deprecated

19:38 replaca: technomancy: oh, I was changing it in pprint

19:38 core is now pretty much free of #^, so I didn't want to be the laggard :-)

19:39 technomancy: oh gotcha; makes sense

19:40 I just recently got a patch that removed #^ because somebody thought it was going away, I was beginning to think it was a common misconception

19:43 replaca: yeah, I guess apps should keep it for awhile. It'll be interesting to see how long 1.1 lives in the wild

19:46 MadWombat: what arguments are passed to erc-text-matched-hook functions?

19:49 technomancy: MadWombat: I can't repro that wrong-number-of-args error in lein swank

19:49 MadWombat: technomancy: hmm

19:50 technomancy: MadWombat: I'm about to take off, but if you continue to have trouble feel free to mail the swank-clojure mailing list with the details to repro

19:50 MadWombat: technomancy: OK

19:50 remleduff: What does that :dont-close parameter to swank do?

19:51 technomancy: remleduff: nothing, anymore

19:51 MadWombat: remleduff: keeps server listening to connections after you disconnect

19:51 technomancy: remleduff: it used to be that after you disconnected from the swank server, it would shut down

19:51 MadWombat: remleduff: well, used to

19:51 remleduff: Oh man, I've been wanting that :)

19:51 technomancy: but that behaviour was nonsense, so I just removed it.

19:52 MadWombat: technomancy: basically I am using emacs pieces from ELPA and lein-swank/clojure-swank from :dev-dependencies [[leiningen/lein-swank "1.1.0"]]

19:52 technomancy: MadWombat: try boosting the lein-swank version to 1.2.0-SNAPSHOT

19:53 I do recall that may have been an issue with the earlier release now that you mention it

19:53 hopefully I can get 1.2.0 stable released soon.

19:54 MadWombat: technomancy: does it require clojure 1.2.0?

19:54 technomancy: MadWombat: it shouldn't

19:55 MadWombat: OK

19:55 technomancy: I will try to make that more explicit in the actual release.

20:03 remleduff: You should call it swank 2010 ;)

20:03 Or Swank 2.0

20:03 Or even better, Swank 7

20:06 MadWombat: technomancy: now it works :)

20:17 eliantor: hi

20:18 is there a way to use macros inside deftype?

20:38 defn: http://gist.github.com/38759

20:38 Could someone take a look at that and offer any ideas on why that's happening? It seems to work fine in the REPL, but then I plug it into my application and get Unreadable Form, see gist^

20:39 arbscht: is that link correct?

20:39 defn: which link?

20:40 arbscht: http://gist.github.com/38759

20:40 defn: http://gist.github.com/387593

20:40 sorry

20:41 i tried replacing the (read (pushback (stringreader with (read-string and still have the same problem

20:47 any ideas?

20:53 I can't find any mentions of unreadable form in the source, hmm

20:56 maybe i need a macro...

20:56 but then why would it work in the REPL but fail in the application

20:56 so confused.

20:59 remleduff: I'm a little suspicious of those single-\ s

20:59 Java might want those to be escaped depending on the context

21:00 hiredman: unreadable form is an exception from the clojure reader

21:01 defn: remleduff: which single \s? the \"foo\"?

21:01 that seems to work fine in my SLIME repl also

21:01 remleduff: No, the resulting "\n"

21:02 defn: oh -- well, that's the output from the format-code function, that's what i want, i dont see how producing a string with \n would confuse the reader, that's pprint's job to add those for me

21:03 hiredman: are you sure the input is the same?

21:03 I kind of doubt it is

21:04 you can grep LispReader for that exception and find out when it throws that exception

21:05 ,(read-string (pr-str (Object.)))

21:05 clojurebot: java.lang.RuntimeException: java.lang.Exception: Unreadable form

21:05 hiredman: etc

21:08 MadWombat: what is the most current couchdb client for clojure?

21:08 defn: hiredman: thanks for the help, looking into it further, but it does appear that my input is the same

21:09 hiredman: how do you know?

21:10 defn: i stepped through it

21:11 hiredman: with what?

21:16 defn: hiredman: i have a structure like: (["(code (input))" "(result of the code run in the sandbox")] [...] [...] ...)"

21:16 i run this function across the first item in the nested vector, and the second item in the nested vector

21:17 actually you know, i think i see what the problem might be

21:17 one second

21:19 ,(read-string "clojure.lang.LazySeq")

21:19 clojurebot: clojure.lang.LazySeq

21:19 defn: ,(pprint (read-string "clojure.lang.LazySeq"))

21:19 clojurebot: java.lang.Exception: Unable to resolve symbol: pprint in this context

21:19 defn: (use 'clojure.contrib.pprint)

21:19 ,(use 'clojure.contrib.pprint)

21:19 clojurebot: nil

21:19 defn: ,(pprint (read-string "clojure.lang.LazySeq"))

21:19 clojurebot: clojure.lang.LazySeq

21:20 defn: ,(with-out-str (pprint (read-string "clojure.lang.LazySeq")))

21:20 clojurebot: "clojure.lang.LazySeq\n"

21:20 * defn shrugs -- that seems fine...

21:21 hiredman: ,(pprint (range 10))

21:21 clojurebot: (0 1 2 3 4 5 6 7 8 9)

21:23 defn: hiredman: are you trying to suggest that when i do a read-string it's actually evaluating?

21:23 ,(pprint (read-string "(range 10)"))

21:23 clojurebot: (range 10)

21:24 defn: ,(pprint (read-string "{:foo \"bar\"}"))

21:24 clojurebot: {:foo "bar"}

21:25 hiredman: I still suggest you look at th reader and figure out where it thorows that exception

21:31 defn: hiredman: could you be a bit more explicit in how to do that, im not sure how to go about that

21:31 hiredman: you mentioned "grep LispReader", where do I do that?

21:33 remleduff: If you just print out the strings in code instead of pprinting them, can you verify that they're what you're actually expecting?

21:33 defn: remleduff: yes, they are what I'm expecting

21:34 remleduff: and again, they actually work in the SLIME repl, but I get Unreadable Form exceptions once it's on swank

21:35 remleduff: I'm not sure what you mean by in swank though, there's a lot of walton code and ring and hiccup calls in the stacktrace. Was thinking there might be some html-escaping getting in your way

21:35 hiredman: in the clojure source there is a LispReader.java

21:35 defn: hiredman: ah-ha, thanks

21:37 Well I find the mention of it, but I'm no java buff -- I see it is UnreadableReader, but beyond that I'm not sure what's goin gon there

21:38 What is object "leftangle"?

21:38 a <?

21:39 hiredman: grep for leftangle

21:46 defn: hiredman: im not 100% sure what im looking at is correct, but...

21:46 List list = readDelimitedList('>', r, true);

21:46 is that what you were thinking?

21:47 or were you thinking across all of clojure, another file other than LispReader perhaps?

22:09 so i must be picking up a < someehere

22:10 i just dont see them :\

22:15 ,(read-string "#<core>")

22:15 clojurebot: java.lang.RuntimeException: java.lang.Exception: Unreadable form

22:15 defn: finally for the bastard...

22:15 thanks hiredman

22:33 GeoffSK: seeking a clue...

22:33 (require '[clojure.contrib.http.agent]) (http-agent) java.lang.Exception: Unable to resolve symbol: http-agent in this context

22:34 What am i missing with the require?

22:40 MadWombat: you are not missing anything, when you do require this way, you have to use fully qualified names

22:41 (require 'clojure.contrib.http.agent)(clojure.contrib.http.agent.http-agent "http://www.google.com")

22:41 if you want to shorten it, you need to use :as keyword

22:41 clojurebot: http://clojure.org/data_structures#toc8

22:41 GeoffSK: thanks, i get:

22:41 java.lang.ClassNotFoundException: clojure.contrib.http.agent.http-agent (NO_SOURCE_FILE:2)

22:42 MadWombat: oops, my mistake, change last . to / like clojure.contrib.http.agent/http-agent

22:42 GeoffSK: yes!

22:42 MadWombat: (require '[clojure.contrib.http.agent :as http]) might help

22:43 then you can use (http/http-agent)

22:43 GeoffSK: obviously a newbie, didn't realise i needed the slash. Thanks.

22:43 MadWombat: no problem, I am relatively new to clojure myself

23:18 defn: How can I find all the strings that contain a char

23:19 slyphon: filter ?

23:19 defn: lol of course

23:34 technomancy: MadWombat: hey, did you get a chance to look at the cygwin fix mentioned in #emacs?

23:44 eliantor: is this a right fold?

23:44 (defn foldr [f acc seq]

23:44 (trampoline

23:44 (fn []

23:44 (if (first seq)

23:44 #(f (first seq) (foldr f acc (rest seq)))

23:44 acc))))

23:44 slyphon: use a pastebin

23:44 eliantor: sorry

23:46 http://pastebin.com/cey23PBD

23:46 here it is

23:47 slyphon: open 2

23:47 lkjdslfdskjfdlkjsfd

23:51 eliantor: did you see the paste?

Logging service provided by n01se.net