#clojure log - Mar 19 2010

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

0:06 zaphar_ps: are there any decent compojure tutorials?

0:56 gahhh

0:56 compojure out of the box won't work on appengine

0:56 * zaphar_ps didn't know this

1:01 psykotic: i wish that s/concat/cat/

1:02 shorter, reminiscent of unix cat, symmetric with mapcat, etc

1:13 bytecoder: zaphar_ps: the change required to make compojure work on app engine is quite simple though.

1:13 zaphar_ps: yeah I don't even have to modify compojure like I thought

1:13 just change my use statements

1:14 lose a little convenience but gain appengine

1:14 bytecoder: zaphar_ps: that's right.

1:14 zaphar_ps: now that I have a working hello world on appengine I should blog my setup with appengine, leiningen, compojure and emacs

1:15 after some sleep

1:15 that took longer than I thought it would getting everything setup.

1:16 bytecoder: i followed this blog to setup a helloworld app in appengine: http://elhumidor.blogspot.com/2009/04/clojure-on-google-appengine.html

1:18 hiredman: you know there is a skeleton lein appengine project on github you can checkout and run with

1:18 (well, I guess you must not know)

1:34 psykotic: hiredman: did you see my promise-based hack for tying knots with letrec? http://gist.github.com/336461

1:36 hiredman: a generalized letfn often seems like it would be nice

1:38 psykotic: yeah. you always want letrec references to be "guarded" behind a lambda, but often the lambda isn't the whole thing, only a part of something bigger (e.g. a list in the case of my lazy-seq example, or another case might be in a recursive monadic expression)

1:43 i came up with this implementation based on the standard way letrec is implemented in terms of let, and the standard implementation of assignable locals in scheme compilers ("assignment conversion", where you explicitly box and unbox when something is the target of a set! call).

1:50 gotta love WIFI receivers with an apparent range of 2 meters

2:55 omakase: yo

2:55 Raynes: yoyo

2:56 omakase: how can i get the current unix timestamp?

2:58 bytecoder: ,(System/currentTimeMillis)

2:58 clojurebot: 1268981981848

2:58 gko: (int (Math/floor (/ (System/currentTimeMillis) 1000)))

2:58 ,(int (Math/floor (/ (System/currentTimeMillis) 1000)))

2:58 clojurebot: 1268981985

2:58 gko: ,(int (Math/floor (/ (System/currentTimeMillis) 1000)))

2:58 clojurebot: 1268981994

2:58 omakase: :)

3:01 gko: ,(int (/ (System/currentTimeMillis) 1000))

3:01 clojurebot: 1268982190

3:12 rfg: ,(int (/ (System/currentTimeMillis) 1000))

3:12 clojurebot: 1268982814

3:12 zmila: ,(int (/ (System/currentTimeMillis) 1000))

3:12 clojurebot: 1268982831

3:38 LauJensen: Morning guys

3:42 gko: How to make a "return" in a function ?

3:43 LauJensen: gko, last evaluated expression is always the return

3:43 (defn return-2 [] (println "no return") (+ 1 1))

3:44 gko: LauJensen: I know, I meant if I want to do an early return...

3:44 LauJensen: concept doesnt change if you want branches

3:45 gko: LauJensen: but I want to prevent identation:

3:45 I'd like something like this:

3:46 (if a return-from-function) (if b return-from-function) (if c return-from-function)

3:46 instead of:

3:46 benatkin: When I try running lein deps with the lein-swank plugin in my project.xml, I get a "1 required artifact is missing" message.

3:46 defn: hi all

3:46 benatkin: Do I need to add a path to my repositories?

3:46 defn: hi

3:46 gko: (if a nil (if b nil (if c ...))) => this will indent fastly

3:47 defn: maybe a silly question: user> (.getRegion database "207.100.100.1") => #<Region com.maxmind.geoip.Region@66d7a9c9>

3:47 How do I get an actual value?

3:47 gko: (show Region)

3:47 LauJensen: (cond (even? 2) do-this (odd? 5) do-that :else do-something-else)

3:47 Would that work gko ?

3:48 defn: gko: I'm not sure I follow

3:48 LauJensen: defn: C-S-i Region

3:49 That will give you a list of all the methods, one of them will likely be called "getValue" or similar

3:49 oops, C-I ofc

3:49 defn: hm that doesnt work

3:50 LauJensen: Can you be a little more specific ? :)

3:50 defn: C-I I mean

3:50 gko: (use 'clojure.contrib.repl-utils)

3:50 defn: weird, still nothing...

3:50 LauJensen: C-I is bound to the inspector by default, so no need to use extra libraries

3:51 defn, by try (.countryName region) (.countryCode region) etc

3:51 s/by/but

3:55 defn: yeah it's official, i have no idea what I'm doing

3:55 (.getCountry (LocationService. "/path/to/geoip.dat") "1.2.3.4")

3:56 .getCountry is supposed to return an IP address

3:56 ohhhh wait wait

3:57 there we go:

3:57 (.getName (.getCountry (LocationService. "/path/to/geoip.dat") "1.2.3.4"))

3:57 * defn very slowly begins to understand how to read java docs better

3:58 gko: LauJensen: actually, it's more to avoid something like: (if (do-a-and-fail) (return) (if (do-b-and-fail) (return) (if (do-c-and-fail) (return) ...))) that is, the do-b-and-fail must be true to execute do-b-and-fail... oh, unless I change it to (if (do-a) (if (do-b) (if (do-c) (return)) (return)) (return))

3:59 defn: so to use .. with my above code...

3:59 gko: LauJensen: but the point is to avoid the additional indentations, which could be avoided if I could return ..

3:59 benatkin: I figured my problem out. I had my brackets wrong.

4:00 LauJensen: gko: Im not following, my example would behave as you suggest - The indentation concern should be put second to learning functional programming, you seem to be thinking in terms of imperative statements

4:01 defn: (-> (LocationService. "") (.getCountry ""))

4:01 gko: LauJensen: yes, it's about socket stuff, so I can continue only if the previous request succeeded...

4:01 defn: LauJensen: why not ..?

4:01 LauJensen: .. puts dots between the args useful for chained calls, you're not doing a chained call

4:02 ~source -?>>

4:02 clojurebot: Huh?

4:02 gko: LauJensen: of course, I could split all this stuff in different functions...

4:02 LauJensen: gko: In contrib, there's a short-circut -?>> which I think you could leverage to good efffect, its like ->> but aborts first time a member returns nil

4:02 Raynes: Oh no.

4:02 Not another symbol.

4:02 gko: LauJensen: OK, I'll check. Thanks.

4:02 Raynes: I'm just getting used to -> and ->>

4:02 LauJensen: np

4:03 Raynes: this is the same, just with the nil check added

4:03 Raynes: As a matter of fact, I just updated my irc bot code with it last night.

4:03 @_@

4:03 ~def -?>>

4:03 clojurebot: Huh?

4:03 Raynes: :o

4:03 Worth a try.

4:04 gko: what's the clj file ?

4:04 Raynes: what's the clj file for -?>> ?

4:04 Raynes: I have no idea.

4:04 Never used it.

4:05 core.clj I think.

4:05 LauJensen: no

4:05 Contrib but I forgot where, so grep for it

4:05 Raynes: Or not.

4:05 :\

4:06 gko: Oh, OK, it's in clojure.core

4:06 ,(doc ->)

4:06 clojurebot: "([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."

4:06 Raynes: No it isn't.

4:06 gko: ,(doc ->>)

4:06 clojurebot: "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."

4:06 defn: oh god this is beautiful

4:07 gko: clojure.contrib.core

4:07 defn: disgusting java dung => beautiful, elegant clojure

4:07 Raynes: S'not in core.

4:07 Just checked.

4:11 LauJensen: gko: you noticed I said -?>> and not ->> right?

4:16 psykotic: good old maybe monad

4:18 LauJensen: msg chanbot +enforce wordban: monad Monad Monads monads

4:18 oops forgot the /

4:18 :)

4:20 defn: okay so now I need to figure out multimethods I think a bit better so I don't need 10,000 defns to implement all of the java geoip stuff

4:21 LauJensen: defn the ClojureQL backend is the finest example around :)

4:21 defn: i will take a peek

4:24 I must say this is awfully fun watching java turn into clojure in front of my eyes

4:25 psykotic: LauJensen: do you have a github link to the file?

4:26 LauJensen: psykotic: There's more than one file on github nowadays, so can you be more specific?

4:26 psykotic: the clojureql backend example with multimethods :)

4:26 LauJensen: ~clojureql

4:26 clojurebot: clojureql is http://gitorious.org/clojureql

4:26 psykotic: ah, wrong site, that explains it :)

4:27 LauJensen: Yea, we liked the simplicity and didn't have the patience to wait for Github to resolve their responsetimes

4:27 clojurebot: forget clojureql

4:27 clojurebot: clojureql is http://gitorious.org/clojureql

4:28 LauJensen: clojurebot: clojureql is http://gitorious.org/clojureql and tracked @ http://clojureql.lighthouseapp.com/

4:28 clojurebot: You don't have to tell me twice.

4:28 LauJensen: ~clojureql

4:28 clojurebot: clojureql is http://gitorious.org/clojureql

4:28 gko: LauJensen: yes. I'll look for it. Thanks.

4:28 LauJensen: ~forget clojureql

4:28 clojurebot: clojureql is http://gitorious.org/clojureql

4:28 defn: omg i need to quit using clojure or I will never use another language again

4:28 i am giddy right now this is so fun

4:34 psykotic: LauJensen: nice, i read the code. i like the 'operator hierarchy' for joins, etc

4:35 it would be nice if you could say (derive [::Join ::LeftJoin ... ::FullJoin] ::Join] to cut down on repetition. good thing we have macros :)

4:35 LauJensen: Turns out that once you get the structure in your head, its quite easy to work with. Its a concern though, that right now the entire structure takes too long up commit mentally, so things are being restructured and moved around before we declare it 1.0

4:37 Raynes: How does Gitorious compare to github? Only thing I've ever heard people say about it is "But, it's Open Source and Github isn't."

4:38 psykotic: github is so superior to everything else out there right now that i find it hard to consider switching

4:38 i'm paying them the monthly fee even if i don't use the extra features, just because of how much i like what they're doing

4:38 Raynes: I'm not considering it. Everything I have is on github.

4:38 LauJensen: Raynes: The main pull was speed and the fact that they aim to be more community centered - Im not sure they achieved that goal though

4:39 Oh - And we had planned on embedding documentation directly in the source container. Github used different mark-ups in different places, Gitorious was uniform

4:39 Raynes: You forgot something.

4:39 "AND IT'S OPEN SOURCE!!1!"

4:39 psykotic: Raynes: that actually IS useful if you want to deploy a gitorious thing internally at a company

4:40 Raynes: Most people don't look at the practicality of such a thing.

4:40 eintr: psykotic: true. github:fi isn't viable if you're < 100 devs or so

4:40 psykotic: one issue with DVCS at large companies is that you need to superimpose some 'discovery/exploration' infrastructure that a centralized VCS provides

4:41 and something like gitorious could fit that bill

4:42 Raynes: Well, on an unrelated note, I has Chedder Jalapeño Crunchy Cheetos. Envy me.

4:42 psykotic: on an unrelated note, i feel like the star of one of those DDT infomercials from the 60s where children are paying in dense DDT fog

4:42 *playing

4:42 Raynes: :o

4:43 LauJensen: How do you pronounce your first name?

4:43 LauJensen: I dont know

4:43 ...how to put it in writing :)

4:43 psykotic: it's Jen as in the Japanese Yen

4:43 Raynes: First name, not last.

4:43 LauJensen: Not my first name

4:44 Raynes: like you would lay Loud, but without the d

4:44 psykotic: it's close but not exactly the same as 'Lao' in 'Laos'

4:44 or loud, yeah

4:44 Raynes: Oh.

4:44 I pronounced it as 'La'.

4:44 psykotic: when i moved to the us, i told people to pronounce my name as in 'pair'

4:44 LauJensen: Which is wrong

4:45 psykotic: because they couldn't even come close to the real pronunciation. so now i just introduce myself as 'pair'.

4:46 i think even in denmark, the pronunciation of 'Lau' will vary a bit depending on whether you're a farmer from western jutland or from copenhagen :)

4:48 LauJensen: Not too much - When I present myself, once in a while some kind secretary will ask "Is the L A V", to which I respond "No, then I would be called Lav (low)".

4:48 But it is more common in China than in Denmark I'll give you that

4:50 psykotic: btw speaking of github, i just found out that their search feature can also search code, a la codesearch.google.com

4:50 i remember someone was writing a log searcher for #clojure to find usage examples of functions. either github's search or codesearch.google.com would also be good for that.

4:50 Raynes: You're just finding that out? ;o

4:50 I'm about to do a codesearch for the word 'penis'. That's right.

4:50 psykotic: yes, i never thought to try it before

4:51 i don't think github does regexp searches like codesearch, though

4:51 Raynes: Whereas most programmers use 'foo' 'bar' and 'baz', I use genitalia. :D

4:52 It keeps things interesting on my side, especially when I have to pastebin code.

4:53 "epenis.py ... class epenis(loadable)"

4:53 Alrighty then.

4:54 SynrG: win 2

4:54 sure

5:03 LauJensen: What I really like about #Clojure, is that it has consistently held to a high standard for conversation. I would be sorry to see that go Raynes.

5:04 Raynes: Well, at 4:00am...

5:04 psykotic: maybe #clojure-bullshit is called for :)

5:04 Raynes: There was nothing to disrupt or discuss in this particular situation, so I think we can let it slide.

5:04 psykotic: I tried that about a year ago. Didn't stick.

5:08 LauJensen: Raynes: You see what Im saying though right?

5:08 Raynes: Absolutely, and I wouldn't purposely disrupt the room for the sole purpose of being an idiot.

5:08 LauJensen: And btw, you should be sleeping now - If you want to be up at this hour you should move to Denmark

5:08 Raynes: I woke up at 1:00am.

5:08 LauJensen: Raynes: You see what Im saying though right?

5:09 Raynes: #haskell has three times as many users as #clojure, and I've never seen the high-standard of discussion really break, despite brief off-topic chatter that usually spills over into #haskell-blah.

5:10 #clojure just doesn't have enough users for it's own active off-topic channel at this point.

5:10 But soon. Oh yes, very soon.

5:12 psykotic: Raynes: i just registered #clojure-casual. we can be a community of two :)

5:13 Raynes: Joy!

5:13 Now we need to get somebody to put it in the channel topic, and we might get somewhere.

5:23 patrkris: psykotic: shouldn't it be #clojure-cajual?

5:23 Raynes: Clever.

5:24 psykotic: i think even by my pun-happy standards, that's a bit much

5:24 Raynes: Agreed.

5:24 patrkris: :)

6:08 LauJensen: wow psykotic: deporting Raynes really did the trick, peace and quiet is restored

6:08 Raynes: ;)

6:09 psykotic: we're having so much fun over there with you, Lau. you killjoy :)

6:09 withOUT you, even :)

6:17 how do i test whether something is an instance of a deftype type? i've tried (instance? mytype (mytype 42)) and that doesn't work--mytype is the constructor function for the type, not the java.lang.Class itself.

6:18 LauJensen: isa?

6:18 psykotic: isa? checks relationship between classes by default, not instances and their class

6:19 i think instance? is what i want, the problem is how i get to the type behind a 'deftype' rather than the constructor function

6:19 ah damn, i looked at the deftype code and they use a gensym for the generated type

6:19 that is.. useless.

6:20 spariev_: have you tried type ?

6:20 ,(doc type)

6:20 clojurebot: "([x]); Returns the :type metadata of x, or its Class if none"

6:20 psykotic: doesn't work

6:21 it gives you the type of the constructor function.

6:21 (a generated class that implements IFn)

6:21 here's what the relevant code looks like:

6:22 ~(emit-deftype* name gname (vec hinted-fields) (vec interfaces) methods)

6:22 the gname is a generated (gensymmed) name

6:22 so the type isn't directly accessible

6:25 * psykotic extends deftype to define a ~name? method

6:27 Raynes: ,(clojure.contrib.duck-streams/slurp* "https://sourceforge.net")

6:27 clojurebot: java.lang.ClassNotFoundException: clojure.contrib.duck-streams

6:27 Raynes: ,(clojure.contrib.io/slurp* "https://sourceforge.net")

6:27 clojurebot: java.lang.ClassNotFoundException: clojure.contrib.io

6:27 Raynes: I thought he could access contrib? :o

6:40 psykotic: btw, for my hack all you need is to add the following in deftype's `(do ...) block:

6:40 (defn ~(symbol (str name "?")) [~'x]

6:40 (instance? ~classname ~'x))

6:41 (deftype foo [bar]), (foo? 42) => false, (foo? (foo 42)) => true

6:43 Chousuke: there's no need to use ~'x, just use a gensym

6:47 psykotic: i hate needless gensyms

6:47 no need to make macro expansions needlessly unreadable

6:49 okay, 'hate' is a bit strong :)

7:16 haptiK: test

7:16 Raynes: ~def test

7:16 :p

7:30 * zmila registered at Clojure101 course

7:33 SynrG: zmila: welcome, classmate :)

7:33 Raynes: What he said.

7:35 * esj *jealous*

8:54 defn: hello all

8:54 What's the best way to chunk a large file of text, say 350MB worth?

8:55 It is a logfile, so by line is best, but what I'm wondering is if anyone has any suggestions for re-writing alex osborne's widefinder2 'chunk-file' in pure clojure, with no Java

8:55 or at least, less Java, more clojure

8:55 see http://meshy.org/code/wf2-faster.clj

8:56 AWizzArd: defn: what is bad about a split by line?

8:56 I developed a split-by-regex, but this is unfortunately closed source.

8:56 defn: AWizzArd: nothing in particular I guess, just trying to learn

8:57 ive never worked with data sets as large as 300MB before, which to some probably seems so minor and simple, but I am trying to learn when it is appropriate to split a file into chunks, how many chunks to split it into, etc.

9:01 * defn suddenly remembers Knuth

9:01 defn: optimization does not come first!

9:04 spariev_: defn: here's how I parsed Rails log files, partitioning by request - http://gist.github.com/337484

9:05 clowbar: AWizzArd: Is that lib in clojure, or JAVA you wrote that is closed source??

9:05 spariev_: nothing fancy, just line-seq & partition-by

9:09 licoresse: I am not getting this to work, component count is always showing 0, what am I doing wrong? http://paste.lisp.org/display/96610

9:11 I suspect I am doing something wrong in the constructor

9:17 defn: spariev_: pretty cool

9:18 how quick is it?

9:20 spariev_: haven't measured, actually, my main bottlenecks with this code was in actual log processing, not io

9:20 s/was/were

9:20 defn: yeah i would imagine

9:20 spariev_: it could be sped up by using pmap, though :)

9:21 defn: id be happy if i could do a 300MB log in...oh...20 seconds?

9:22 powr-toc: Does anyone know how to stop a server with ring?

9:22 licoresse: can I override the constructor in a proxy?

9:22 cannot find examples of this

9:22 powr-toc: I've called run-jetty, but I'd like to restart it

9:39 * licoresse is stuck

9:39 Raynes: technomancy: ping

9:41 spariev_: licoresse: I believe you can override only interface/class method's in proxy, not constructors

9:41 s/method's/methods

9:42 LauJensen: I just got banned - in the sense that I could just log in straight after

9:42 licoresse: spariev_: ok, then the only other option is gen-class

9:43 Raynes: I'm getting this: Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/contrib/def__init.class or clojure/contrib/def.clj on classpath: (core.clj:1), whereas it works in lein repl. :|

9:43 Clojure-contrib /is/ on the classpath. :\

9:43 Apparently, clj-time is asking for it, but can't find it.

9:45 What's weird is that I can do the same thing in lein repl and it works. Makes me wonder if I'm not setting up the classpath right.

9:45 java -cp src:lib/* clojure.main src/sexpbot/core.clj

9:45 I'm not sure if lein repl is doing something special, but it appears so.

9:48 LauJensen: Raynes: You know that you can check the cp at runtime right?

9:48 Raynes: LauJensen: That's exactly what I'm doing.

9:48 And contrib is there.

9:48 licoresse: spariev_: thanks for the input, case solved!!

9:49 spariev_: licoresse: np, glad I helped :)

9:51 Raynes: Looks like something is wrong with my contrib jar. Isn't opening up right in Emacs.

9:51 Looks corrupted.

9:51 I'll delete it.

9:56 LauJensen: If you hand-compile, make sure you link to clojure.jar

9:57 defn: I have a list: ("nil" "nil" "a" "b" "b" "a" "b" "c" "c" "c" "c" "b" nil)

9:58 err the first two nils not in quotes

9:58 but basically I want to count occurrences of a string in a map, where the count is the value and the key is the string

9:58 clojurebot: maps are *AWESOME*

9:59 defn: my question is, what is an efficient way of turning the above list into such a map?

9:59 chouser: so awesome that two completely different things are named "map"

9:59 Chousuke: hm

9:59 I think there's something in contrib to do just that.

9:59 chouser: so awesome that two completely different things are named "map"

10:02 defn: Chousuke: if you know or find it let me know, im hunting ATM

10:06 Chousuke: If we had fnil, (reduce (fn [m val] (update-in m [v] (fnil inc 1))) (remove nil? seq))

10:06 defn: Chousuke: id like to count nils as well

10:06 is it possible to have nil as a key

10:07 chouser: yes

10:07 defn: ,{nil 4}

10:07 clojurebot: {nil 4}

10:07 defn: cool

10:07 zmila: ,(reduce

10:07 clojurebot: EOF while reading

10:07 zmila: (fn [acc-map item] (assoc acc-map item (inc (get acc-map item 0))))

10:07 {}

10:07 '(nil nil "a" "b" "b" "a" "b" "c" "c" "c" "c" "b" nil))

10:07 Chousuke: ah, well, then you need to remove nils

10:07 zmila: (reduce (fn [acc-map item] (assoc acc-map item (inc (get acc-map item 0)))) {} '(nil nil "a" "b" "b" "a" "b" "c" "c" "c" "c" "b" nil))

10:07 ,(reduce (fn [acc-map item] (assoc acc-map item (inc (get acc-map item 0)))) {} '(nil nil "a" "b" "b" "a" "b" "c" "c" "c" "c" "b" nil))

10:07 clojurebot: {"c" 4, "b" 4, "a" 2, nil 3}

10:08 defn: zmila: cool

10:08 fogus: ,(apply merge-with + (for [x '(nil nil "a" "b" "b" "a" "b" "c" "c" "c" "c" "b" nil)] {x 1}))

10:08 clojurebot: {"c" 4, "b" 4, "a" 2, nil 3}

10:08 LauJensen: hasn't that been sugared zmila ?

10:08 ,(reduce (fn [acc-map item] (assoc acc-map item (inc (acc-map item 0)))) {} '(nil nil "a" "b" "b" "a" "b" "c" "c" "c" "c" "b" nil))

10:08 clojurebot: {"c" 4, "b" 4, "a" 2, nil 3}

10:08 LauJensen: yup

10:09 Chousuke: I wonder why fnil hasn't been introduced to core yet :/

10:09 LauJensen: because its redundant

10:09 Chousuke: heh, argue & escape :P

10:09 I don't see how it's redundant though. :/

10:09 fogus: ,(reduce #(assoc %1 %2 (inc (%1 %2 0))) {} '(nil nil "a" "b" "b" "a" "b" "c" "c" "c" "c" "b" nil))

10:09 clojurebot: {"c" 4, "b" 4, "a" 2, nil 3}

10:12 zmila: i need this function for ProjectEuler75 :)

10:13 defn: Java Heap Space

10:13 :(

10:13 maybe atoms are in order

10:14 Raynes: For the public record, the problem was indeed that my clojure-contrib jar was corrupted.

10:17 Chousuke: defn: if you're running out of space, use the reduce approach, but with a transient instead

10:17 defn: oo!

10:20 spariev_: is there something like Java's entrySet() for clojure maps ?

10:20 Chousuke: ,(.entrySet '{a 1})

10:20 clojurebot: #< [[a 1]]>

10:21 rhickey: spariev_: is your objective to get key/value entries or the set lookup capability?

10:21 zmila: spariev_ (seq your-map) - is like iterator, then use param destruction (fn [ [key value] ] ...)

10:21 spariev_: thanks, zmila, just need to get k/v entries to iterate

10:22 Chousuke: the general rule of thumb in clojure is that if you need to iterate over something, call seq on it :P

10:22 zmila: ok, spariev_, but remember to prefer existing seq-functions over iteration :)

10:22 spariev_: hehe, I'll try :)

10:24 defn: rhickey: what do you mean by set lookup capability?

10:28 rhickey: defn: being able to lookup map entries in the resulting set

10:31 defn: ah, i asked this question originally, and the former is what *I'm* looking for. I can't speak for spariev_

10:32 rhickey: (.contains (.entrySet {:a 1 :b 2}) (clojure.lang.MapEntry. :b 2))

10:32 ,(.contains (.entrySet {:a 1 :b 2}) (clojure.lang.MapEntry. :b 2))

10:32 clojurebot: true

10:33 defn: rhickey: ah-ha. thank you much.

10:33 Raynes: ,(apply hash-map [:key "v" :key2 "v2"])

10:33 clojurebot: {:key "v", :key2 "v2"}

10:37 spariev_: defn: btw, have you managed to setup circumspec ?

10:38 defn: spariev_: stuart halloway msg'd me back on github this morning

10:38 he gave some hints

10:38 i will take a whack at it later tonight

10:40 spariev_: it is such a weird feeling to be corresponding with your heroes. i remember receiving a letter back from noam chomsky once upon a time and being amazed he wrote back.

10:41 spariev_: defn: :)

10:41 defn: im still amazed every time i get a reply from someone with a prolific "commit" or "create" schedule.

10:42 stuart h wrote a book, wrote a bunch of fantastic code, and managed to write me back within 24 hours. I can barely manage a single one of those 3 items.

10:42 tec*nomancy is another example. that guys is absolutely prolific, and yet he hops on IRC and talks to me for 15 minute here and there about some silly problem I'm having.

10:43 guy is*

10:50 spariev_: defn: Clojure community is amazingly awesome, and it's a well known fact :)

10:51 defn: spariev_: yeah i have had absolutely 0 bad experiences with the community thus far

10:51 and very receptive, creative, intelligent community

10:52 The-Kenny: That's my experience too

10:53 And I try to be a part of this community :)

11:11 defn: <3

11:11 AWizzArd: clowbar: I wrote this in Clojure.

11:13 I had a file that contained several "rows" of data. But each data set did not sit in one line of the text file. Instead it had other complex markers that told me where one data line ends. And as I wanted to process each data set on its own I wrote a split-by-regex fn that returns a lazy sequence of "lines" or "rows" of data.

11:28 remleduff: technomancy: I've been working on writing lein repl in clojure, and have got it working, with one small issue. I either need to make the bat file not use -Xbootclasspath, or I need to use a custom class loader that doesn't delegate to the parent for classes that start with "clojure."

11:28 If you want to take a look: http://github.com/remleduff/leiningen/blob/master/src/leiningen/repl.clj

11:28 The version I did using a custom classLoader is still at home on my harddrive

11:32 The problem with -Xbootclasspath is that it makes leiningen's version of clojure override the project's version of clojure unless I play more ClassLoader games.

11:38 psykotic: i wish juxt with one argument would treat it as a list of functions to apply. that's a common enough pattern that avoids 'apply' and i don't see when juxt with a single function argument would be very useful.

11:38 chouser: rhickey: I can't supply my own 'meta' implementation for a reify. Is this intentional?

11:38 rhickey: chouser: you are making something mutable?

11:39 chouser: no sir!

11:39 Raynes: ,x

11:39 clojurebot: 1

11:39 rhickey: then what's the use case?

11:39 Raynes: Eh,.

11:39 ,rgerer

11:39 clojurebot: java.lang.Exception: Unable to resolve symbol: rgerer in this context

11:40 Raynes: Thank you.

11:41 chouser: rhickey: One use case is an implementation of IPersistentVector and I just want to be able to attach some metadata.

11:41 I don't even need to "modify" it in this case -- providing the meta when the object is created is sufficient.

11:42 I've been making do with my own IMeta-like protocol, but now I've run into a case where I'd like to be able to provide a real vector (from a literal) and want to specify the same kind of metadata on that.

11:43 rhickey: looking...

11:58 aargh - could someone please fix it so that all test errors aren't reported at: test_clojure.clj:77 ?

12:12 chouser: http://github.com/richhickey/clojure/commit/67864eb0d91867ff03b87d6874be28f1476d27df

12:13 chouser: oh sweet -- so I don't even have to implement meta myself

12:14 rhickey: the implementation was already there, that's why you got the dupe error, but there was no path to set the metadata and IObj wasn't an implicit super

12:14 so now it works like fn metadata

12:15 chouser: excellent, I'll try it out right away

12:15 Raynes: How would one write a function that takes a function that times out after so many seconds? :\

12:16 chouser: Raynes: there's not a universally correct way to stop a running thread in the JVM

12:17 Raynes: there's something that sorta works but may leave locks in a bad state, among other problems.

12:18 unless the function is taking so long doing IO stuff and not just computation

12:18 I think

12:18 Raynes: I'm want something like clojurebot's evaluation timeout.

12:18 I'm doing the same thing.

12:19 chouser: ah. I'd actually recommend doing that kind of thing in a separate process entirely.

12:19 arohner: are there any clojure wrappers for working with S3?

12:19 chouser: send forms over to it -- if you don't hear back soon enough, kill off the whole process and start a new one for next time.

12:19 Raynes: Eh.

12:20 chouser: yeah, hiredman didn't like my suggestion either. :-)

12:20 Raynes: Just seems like too much work.

12:21 dakrone: arohner: check out jclouds

12:22 arohner: dakrone: thanks

12:22 dakrone: you're welcome

12:23 Raynes: chouser: It appears Chousuke wrote some sort of timeout function using FutureTask.

12:23 And it appears that hiredman used that.

12:25 chouser: hm, interesting! .Future/cancel doesn't seem to have the kind of warnings that .Thread/stop does.

12:25 Raynes: I think I'll snatch this function.

12:27 chouser: Raynes: you may just be able to use 'future'

12:27 rhickey: chouser: that's because it uses the interruption mechanism to politely coordinate

12:27 Raynes: I figured that too, but I'm not sure how.

12:28 I guess I'm just not smart enough to piece things together. ;)

12:28 esj: rhickey: +1 on Van Roy and Haridi on your Amazon list. It tremendous.

12:28 chouser: ,(let [f (future (Thread/sleep 10000))] (.cancel f true) (.isCancelled f))true

12:28 clojurebot: true

12:29 chouser: heh

12:29 (let [f (future (Thread/sleep 10000))] (.cancel f true) (.isCancelled f))

12:29 blah

12:29 ,(let [f (future (Thread/sleep 10000))] (.cancel f true) (.isCancelled f))

12:29 clojurebot: true

12:32 rhickey: chouser: but all of those things are independent of the thread itself - try with (future (loop [] (recur))) and watch your CPU

12:33 Thread/sleep may be interruptable

12:33 .cancel will not kill the thread

12:33 chouser: ah, indeed. so not sufficient for some kinds of sandboxing

12:34 rhickey: the interruption system will work for most blocking actions though

12:35 chouser: sounds like the pragmatic studio was a hit

12:42 Raynes: http://gist.github.com/337795

12:43 chouser: Raynes: you saw that busy loops won't be stopped?

12:45 Raynes: No, I didn't -.-

12:47 chouser: that's what rhickey was saying -- most blocking actions will be interrupted (locks, IO, etc.)

12:47 but a flat-out busy computation loop will just keep right on going. (loop [] (recur)) and (last (iterate inc 0)) for example

12:51 hiredman: hmmm

12:52 Raynes: Then, I suppose I'll be stealing that function after all.

12:52 I'd rather not think about this particular task. :>

12:53 chouser: I don't think there's a way around this within a single JVM. Either some operations will not be stoppable, or you may leave locks in a bad state.

12:53 hiredman: ,(loop [] (recur)) ;this will timeout using .cancel on FutureTask

12:53 esj: elephant guns are dangerous

12:53 Raynes: Indeed.

12:53 clojurebot: Execution Timed Out

12:53 chouser: hiredman: it's not still cranking away?

12:54 Raynes: It's (.stop ..)ing the thread.

12:54 hiredman: it sure ain't

12:54 Raynes: http://gist.github.com/337804

12:54 chouser: oh, which is the dangerous one.

12:54 hiredman: oh, right

12:54 it does both

12:54 chouser: heh

12:55 Raynes: I'll go with dangerous. :>

12:56 chouser: that's what my add-break-thread! does too. :-/

13:00 hiredman: you could write a fn that wraps starting up a new jvm and manages it, then making an infinite seq of calls to that function and use seque to keep a few jvms on hot standby

13:02 http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Process.html#destroy() I do like the sound of that

13:03 drewr: is passing a bunch of args to str a no-no that I'm forgetting about?

13:03 I thought StringBuilder was easy on the heap

13:03 hiredman: it should be

13:04 drewr: I must be retaining a head somewhere and it happens to bomb out on an (apply str ...)

13:05 because 99% of the time the stacktrace includes that

13:05 lpetit: off topic: any sh scripting power user here ?

13:07 drewr: lpetit: try us

13:07 hiredman: drewr: str looks like it was written to avoid head holding

13:08 chouser: does anyone here use polyglot maven for real?

13:08 lpetit: the unzip command returns 1 when warnings are emitted. I want to somehow "encapsulate it" with the appropriate code to return 0 if 1 is returned, or else $?

13:09 I've tried several things without success for the last 30 minutes, arrgh

13:09 drewr: hiredman: I agree

13:13 lpetit: drewr: so I tried you :-)

13:16 drewr: lpetit: http://gist.github.com/337856

13:19 lpetit: drewr: I have this code: cmd1 && unzip file && cmd2 . How do I transform it so that it continues with cmd2 even if unzip file returns 1. That's the (better formulated) question

13:20 chouser: only if unzip returns 1, right? other errors should fail?

13:21 lpetit: drewr: I tried a lot of permutations of cmd1 && (unzip file; if [ $? -eq 1 ]; then; return 0; else; return $?;) && cmd2 (with {} () w/o ; etc .

13:21 chouser: yes, 1 should be treated like 0; only special case

13:21 drewr: lpetit: try exit instead of return there

13:21 your () is a subshell, not a function

13:22 chouser: cmd1; if [ "$?" = 1 ]; then cmd2; fi # this seems to work, though the error code doesn't come through

13:22 I can't get exit $? to work

13:22 lpetit: I also tried exit :-( . But since there are a lot of permutations, I think I just can't get everything right at the same time

13:22 drewr: hm

13:24 lpetit: best I came up with: lpetit@lpetit-desktop:~/projets/missManners/tmp$ (unzip -qo project.zip ; if [$? -eq 1] then; exit 0 else; exit $? fi) && echo "hello"

13:24 bash: syntax error near unexpected token `)'

13:24 lpetit@lpetit-desktop:~/projets/missManners/tmp$

13:24 chouser: you need exit $?; note the semicolon. But as I said, I can't get that to work

13:24 a literal number like exit 10; works

13:25 drewr: lpetit: your if statements need to be: if [...]; then ...; fi

13:25 i.e., move the semicolon before the then

13:25 chouser: ah, got it

13:26 (unzip ; v="$?"; if [ "$?" = 1 ]; then echo "keep on swimming"; else exit $v; fi )

13:31 lpetit: chouser: yes, with this it's better indeed: (unzip -qo project.zip; v="$?"; if [ $v = "1" ]; then exit 0; else exit $v; fi )

13:32 chouser, drewr: many thanks !

13:40 rhickey: prag studio was fun

13:48 Constantine Vetoshev presented dgraph at ClojureNYC last night - looks like fun: http://github.com/gcv/dgraph

14:08 chouser: looks very clean

14:12 konr: What difficulties will I face programming with Common Lisp? Do you thing these things can be learned on-the-fly? I was proposed working in a big project on CL, but I'm a little afraid of committing, considering that the payment per hour is 4 times what I charge

14:20 clowbar: Is there a clojure lib that would be similar to a cron?

14:22 hiredman: http://github.com/hiredman/clojurebot/blob/master/src/hiredman/schedule.clj

14:33 zaphar_ps: konr: your afraid to do it because the pay is too high? that seems a little weird.

14:34 getting paid to expand your horizons sounds like a dream come true to me

14:42 KirinDave: konr: If you're new to CL your code is going to be much worse than a CL's regular. CL has an incredibly long learning curve with lots of gradations.

14:43 konr: You're professional caliber if you can read Let Over Lambda and have fewer questions than when you started.

14:43 chouser: heh

14:43 * chouser is not there yet.

14:43 clowbar: Damn it it seems all the good libs have been written. :p

14:44 chouser: isn't that a good thing?

14:44 KirinDave: chouser: I guess you'll have to take solace that you're an expert in clojure. :)

14:44 clowbar: Although as nice as pircbot lib is I wonder if a clojure version would be worth the work.

14:44 chouser: ooh, I am? Cool.

14:44 KirinDave: chouser: The community here seems much less infatuated with things like macros than the CL community.

14:45 chouser: You're not? Your imposter syndrome is taking over.

14:45 Crowb4r: I don't see any clojure bindings and utils for nailgun.

14:45 Crowb4r: So there is that to write.

14:45 hiredman: clowbar: I want a pircbot like lib for xmpp

14:46 chouser: huh! "imposter syndrome" is interesting...

14:46 Crowb4r: hiredman: Hmm, that would be nice. I was thinking an AIM lib would be nice, but thank you AOL for making OSCAR needlessly complex.

14:46 hiredman: it be really nice

14:46 it would be

14:47 bozhidar: KirinDave: CL devs are hardcore lispers and many Clojure users(like me) are with extensive Java background

14:47 hiredman: I don't want to have to deal with smack

14:47 bozhidar: but even I enjoy macros a lot ;-)

14:47 KirinDave: bozhidar: I mean, for example...

14:47 Crowb4r: I'm just trying to get involved with developing clojure and contributing some libs seems liek a good place to start.

14:48 KirinDave: People in Clojure are uncomfortable with adding a type? function as an implicit definition of (deftype ...)

14:48 Crowb4r: Nailgun. Please.

14:48 technomancy: KirinDave: what are you trying to do that's not already easy through standard java interop?

14:48 KirinDave: bozhidar: Whereas in CL it'd be like a dozen things.

14:48 technomancy: genuinely curious

14:49 KirinDave: technomancy: I think it'd be better if there was just a form, sorta like the command line interface, to let you make a nailgun interface for your app

14:49 Crowb4r: KirinDave: That would require me to be better with nailgun.

14:49 KirinDave: technomancy: Just define some commands in a form (nailgun-server commands (cmd-name (fn (args) ...))

14:49 technomancy: oh yeah; I've been using it mostly for straight-up repls so far

14:49 KirinDave: Crowb4r: Probably not.

14:49 technomancy: I guess invoking arbitrary commands could certainly be easier

14:49 KirinDave: technomancy: Well a one-liner invocation for repl spawning would be rad too

14:50 technomancy: KirinDave: ng clojure.main, I think

14:50 Crowb4r: Actually my background is not in JAVA, it's in C/#, Python and a little bit of CL.

14:50 technomancy: throw in an rlwrap for good measure

14:50 KirinDave: technomancy: But it'd be nice to be able to say "start a repl in THIS name space"

14:50 Crowb4r: The nailgun interface is very easy. That's why i suggested it.

14:51 Crowb4r: It's mostly macro-ology and some java interop for a better nailgun binding.

14:51 I've been considering doing it myself since i have so much free time right now

14:51 My house is flooded and so my wife, dogs and I are in a tiny boring hotel room.

14:51 And we can't leave the dogs alone, so we can't go anywhere or do anything. :(

14:52 technomancy: Do you agree there'd be value in some macro building for nailgun?

14:52 I mean, a 1line repl server would be great too.

14:52 Crowb4r: KirinDave: I will look into it. I think that would be good. I'm aiming to get decent enough with clojure to land a job in it.

14:52 technomancy: KirinDave: yeah, I'm wondering if you could integrate with it in a way that wouldn't require AOT

14:52 KirinDave: technomancy: Deftype might let that happen.

14:52 technomancy: I'm not sure whether the new 1.2 features would allow that, but if they did it would be a big win

14:53 as long as it's not called clj-nailgun

14:53 KirinDave: technomancy: But

14:53 technomancy: let's raise the bar for project names, please. =)

14:53 Crowb4r: Trying to move from hobbiest to pro in essence.

14:53 KirinDave: technomancy: Also, running a nailgun server in your long-running app. I've seen where people can do things like dump logs and synch dbs from the command line on long running apps.

14:53 technomancy: The AOT isn't a problem there.

14:54 Crowb4r: technomancy: I will keep that in mind. clj-* seems like it's going to get to be overpopulated with libs soon.

14:54 technomancy: yeah, no-AOT just makes getting started easier.

14:54 Crowb4r: brb

14:54 technomancy: KirinDave: people use swank for that now, but having a client in C is preferrable

14:55 Crowb4r: wow, nailgun libs would be nice

14:56 technomancy: Crowb4r: it's always hard to find a good starting project, but I think that would be a good one.

14:56 sh10151: does anyone have any nice wrappers around XPath and XSLT evaluation for clojure?

14:58 Crowb4r: We are a nailgun wrapper I assume.

14:59 we are talking*

14:59 remleduff: technomancy: Did you see what I had directed to you earlier about lein repl? Should have /msg'ed you

14:59 technomancy: remleduff: I didn't see it; I was disconnected when I switched networks.

15:00 remleduff: I've been working on writing lein repl in clojure, and have got it working, with one small issue. I either need to make the bat file not use -Xbootclasspath, or I need to use a custom class loader that doesn't delegate to the parent for classes that start with "clojure."

15:00 If you want to take a look: http://github.com/remleduff/leiningen/blob/master/src/leiningen/repl.clj The version I did using a custom classLoader is still at home on my harddrive.

15:01 The problem with -Xbootclasspath is that it makes leiningen's version of clojure override the project's version of clojure unless I play ClassLoader games.

15:01 So I was thinking about the best way to approach it, the custom classloader is a little icky, but the alternative is to do more work in the shellscript to avoid using bootclasspath if a parameter is given or some project setting is given or if the shell script notices the clojure versions don't match.

15:02 Sorry for the wall of text

15:02 Crowb4r: meh

15:04 technomancy: remleduff: sorry, missing some context here... are you saying you tried with eval-in-project, and the bootclassloader took precedence there too?

15:05 remleduff: Well, eval-in-project forks a new VM if it sees -Xbootclassloader, right?

15:06 technomancy: no, only on OS X or in cases of native dependencies

15:07 bozhidar: technomancy: is not normal for one to get a lot of compile warnings and a couple of warnings when installing swank-clojure from ELPA

15:07 one time something went so wrong that it crashed my Emacs...

15:07 technomancy: bozhidar: those are normal; they don't affect usage

15:07 just means it didn't get byte-compiled

15:07 uhh... ok, that's not normal. ={

15:07 bozhidar: yes, I know that

15:08 Crowb4r: technomancy: I know this sounds stupid, but with a nailgun lib Is there a format to it you could reccommend. An example of the way a good lib is structured would be nice. I would love to avoid making it look like a hack job. :p

15:08 bozhidar: I just wondered if they were normal

15:08 technomancy: bozhidar: if you can reproduce reliably please open an issue on my package.el project on github

15:09 Crowb4r: you could use leiningen to create a project skeleton for you

15:09 $ lein new dont-use-a-name-based-on-clj

15:10 Crowb4r: technomancy: Ohh that sounds nice. I mean if it looks like a pos thats what opensource communities are for.

15:11 technomancy: I'm annoyed with the amount of clj-* libs around as well. my emacs autocomplete when I type clj is just filled.

15:11 technomancy: Crowb4r: I've been taking names from literary characters; plenty of good material there.

15:12 bozhidar: technomancy: I'll do that, but I doubt I'll reproduce it reliably - I've installed it many time before without any problems(other than the compile warnings/errors)

15:13 technomancy: bozhidar: that does seem to be common with package.el issues unfortunately =\

15:14 bozhidar: technomancy: I hope that when ELPA become part of the official Emacs distribution the situation will improve rapidly

15:14 technomancy: yeah, that should help

15:14 Crowb4r: technomancy: My irc bot program is named after a Wheel of time character. However the nailgun lib will either be named something from a more known and pretentious book or something stupid like hammer,

15:14 zaphar_ps: technomancy: I finally got emacs to launch lein swank in the project and then connect slime all in one function the other day

15:14 bozhidar: technomancy: btw, I've been using many of your projects for a long time, but just recently started to join the irc community - I just wanted to congratulate you for the great work you're doing

15:14 zaphar_ps: made stuff much nicer

15:14 bozhidar: you're a real inspiration

15:15 technomancy: bozhidar: awesome. it just takes time and perseverance; I'm sure you'll be coming up with neat code once you ramp up too. =)

15:16 zaphar_ps: yeah, launching the swank server with lein is nice since it guarantees a consistent environment

15:16 * technomancy heads off to lunch; nom nom nom

15:16 zaphar_ps: as a bonus I got to learn all about emacs processes process-filters and process-buffers

15:19 Crowb4r: I think clojure in general conforms more to my thought process with programming. strong types and defining every var just seemed to be a waste of time for a lot of programs I've wrote. As a bonus to clojure I learned emacs as I used vim and a full blown ide for other languages.

15:21 polypus: i need to pipe output to another process started from clojure. c.c.shell's sh has an :in option but that only accepts a string, whereas i want to rebind *out* to a pipe because my strings are too big. what should i be looking at? do i need to hit javaland?

15:23 bozhidar: Crowb4r: do you enjoy Emacs Lisp as well?

15:24 Emacs Lisp got me into Lisp programming, but Clojure's modern and practical approach for solving problems got me hooked

15:24 :)

15:25 Crowb4r: bozhidar: meh, but I have not used it that much. I just did LISP in textmate and gvim for the most part.

15:25 well Common LISP

15:26 I like CL, but the ONLY IMUTABLE THINGS! was somtimes a problem.

15:29 CL did get me to use closures because C# 2.0 just ignored that whole concept.

15:30 Scriptor: that's it, I'm having a try at installing vimclojure again

15:30 Chousuke: only immutable things? :/

15:31 Crowb4r: Chousuke: I overstated that, I mean more along the lines of pure functions.

15:31 Chousuke: you mean in CL or in Clojure?

15:40 arkrost: Hi! Explain me please why function (defn sample [#^String s] s) don't throw exception when I do this: (sample 1)

15:42 hey. Is anyone here?

15:43 Chousuke: arkrost: type hints are just hints

15:43 arkrost: you're not actually trying to use s as a string so it doesn't fail

15:43 arkrost: the type hint is just telling the compiler you expect s to be a string so that it can avoid reflection if you use String methods

15:45 sh10151: anyone use swank-clojure-project? i'm wondering how to get it to use my log4j.properties

15:53 etate: is lein supposed to be working? I can't seem to build it following instructions :[

15:54 mabes: has anyone seen this error when trying to compile before? java.lang.Exception: namespace 'my_namespace' not found after loading '/my_namespace'

15:54 I have a project which compiles fine on OSx but throws that error on ubuntu

15:54 etate: message is: "your leiningen is missing dependencies... please download a stable version"... I downloaded the stable script and this doesnt work :/

15:54 arohner: mabes: it means your ns declaration doesn't match the filename

15:55 mabes: if you have (ns foo.bar.baz), it expects it to find that file in foo/bar/baz.clj on your classpath

15:55 Chousuke: mabes: I think the namespace should be my-namespace :P

15:56 mabes: Chousuke, arohner: right, for some reason I had to name the file my_namespace even though the ns is named my-namespace... so what you are saying make sense. Maybe it is a osx specific issue.. Let me try switching it..

15:56 Chousuke: mabes: it's not

15:56 arohner: mabes: my-namespace is not valid for a java filename

15:56 Chousuke: right

15:56 arohner: so clojure converts my_namespace to my-namespace

15:56 Chousuke: clojure does some munging

15:57 to support lispy identifiers

15:57 because underscores are icky

15:57 mabes: ok, so there is some expected mismatch

15:57 (and harder to type)

15:57 KirinDave: Underscores are icky?

15:57 Where are they icky?

15:57 technomancy: mabes: OS X vs Ubuntu problems often stem from the fact that the OS X filesystem is case-insensitive by default =(

15:58 Chousuke: technomancy: I've never found that to be a problem yet

15:58 mabes: technomancy: hmm... I don't think I've been using any caps in my ns though..

15:58 Chousuke: technomancy: at least it's case-preserving

15:58 technomancy: Chousuke: sure, but it's really easy to get Works on My Box™ bugs

15:58 Crowb4r: For times sake I'm just going to use the pircbot java lib to handle my stuff... for now.

16:01 technomancy: http://www.codeodor.com/images/works-on-my-machine-starburst.png

16:01 Crowb4r: So, How much of an advantage in terms of preformance does a native clojure lib have over calling the java ones. I know that question is slightly subjective in a lot of ways, but in general?

16:02 chouser: none

16:02 KirinDave: Crowb4r: Generally java will be slightly faster. For uninteresting things, anyways.

16:02 Crowb4r: k

16:03 KirinDave: I wonder when someone is gonna bite down on the proverbial leather strap and update server-socket to use nio.

16:03 Crowb4r: I like having the speed of java and the ability to use a repl. Speed when compared to the other big p languages.

16:03 chouser: I guess I do have a few cases here where I can use macros to do work at compile time that the Java lib does at runtime, so my wrapper can actually be a bit faster.

16:03 sh10151: of course it won't matter much because you'll be waiting on the network or disk I/O 99% of the time anyway

16:04 KirinDave: And this little toy is still the #1 hit for "clojure netty" on google

16:04 http://github.com/ngocdaothanh/telchat-clojure

16:04 Which is cute, but is Doin' It 'Rong

16:05 chouser: Speaking of this subject; do you know if it's possible to put annotations on deftype'd classes?

16:05 Crowb4r: sh10151: Ohhh I know. I get into constant arguments with some C++ fanboys.

16:05 chouser: KirinDave: pretty sure not

16:05 KirinDave: chouser: So either write a java class or use gen-class, eh?

16:05 mabes: So.. I only get the compile but when I have this in my leinigen project.clj: :main my_namespace (which I need since that is where my-main resides)..

16:05 chouser: I don't think gen-class can generate annotations either

16:06 KirinDave: chouser: It can

16:06 mabes: er. I only get the *compile* error...

16:06 Chousuke: mabes: shouldn't that still be my-namespace?

16:06 etate: just testing, can you guys see what i write?

16:06 Chousuke: no :P

16:06 mabes: etate: yes

16:06 etate: okay thanks :D

16:06 KirinDave: chouser: http://www.mail-archive.com/clojure@googlegroups.com/msg17628.html

16:07 mabes: Chousuke: no, it needs to be the java class version

16:07 Chousuke: I have verified that via experimentation

16:08 Crowb4r: sh10151: I got blasted pretty good for making something threaded in clojure (an irc bot to be specific) because the C++ friends of mine thought it was a waste because it would take much longer to write. I did it in less time and my bot does not get hung-up doing somethign thus missing his ping and getting disconnected. :)

16:08 KirinDave: I do wonder why clojure doesn't provide more ways to do annotations tho.

16:09 chouser: KirinDave: that's a example of how they'd *like* annotations to work. I see no evidence that they do.

16:09 KirinDave: chouser: Oh?

16:09 I thought they were saying this is what it does.

16:09 What's with the hate?

16:09 I mean, Netty alone justifies the existence of an annotation interop.

16:09 technomancy: KirinDave: indifference is more likely than hate

16:10 chouser: just an requested but unimplemented feature

16:10 KirinDave: Well you look on the list

16:10 And every time it comes up

16:10 the first question is "WHY do you need this?"

16:10 "YOU are doing it WRONG."

16:11 chouser: can annontations be added via reflection?

16:11 technomancy: ok, maybe I haven't been paying attention. =)

16:12 KirinDave: chouser: If so that'd help a lot. You could deftype and then annotate that.

16:12 ugh

16:13 chouser: deftype is mostly not about host interop. annotations would be entirely about interop.

16:14 KirinDave: chouser: I thought we were to use deftype in place of gen-class if its limitations were not prohibitive?

16:18 Crowb4r: wow....... http://stuffthathappens.com/blog/2007/12/17/java-upgrade-hammer/

16:19 *palm* on face

16:34 KirinDave: Crowb4r: Man there is this world of like java app developers I don't understand.

16:35 Crowb4r: I gotta get a plane with a huge "This just in, cross platform app development sucks. Stop bitching about it." banner and just cruise around silicon valley

16:38 dnolen: KirinDave: haha, so true.

16:39 KirinDave: Java is not going to solve this problem. Neither is ANYTHING ELSE.

16:39 If you can't deal, pack up and go to infrastructure where you can hit a smaller subset of platforms. Be happier. Collect a larger paycheck, too.

16:41 slyphon: in for, :when acts as a filter?

16:41 * slyphon speek english good someday

16:41 chouser: slyphon: yes

16:41 slyphon: ok

16:41 cool, thought so

16:42 * slyphon still finds lazy sequences kind of hard to get used to

16:42 lancepantz: i love when you you work with the jdbc wrapper and you have a lazy sequence of a lazy resultset

16:42 slyphon: well, that seems like a good fit

16:45 lancepantz: suppose i just haven't found a use where i don't have to doall on them

16:45 slyphon: yeah, exactly

16:49 arohner: so I want to use jclouds, but google code is sucking right now, so lein isn't working. I've downloaded the distribution zip that's full of jars. Is there a way to tell maven to import all of that, so lein will pull the deps out correctly?

16:51 a more convenient way than reading poms and manually copying, that is

16:59 lpetit: hi all

16:59 ccw 0.0.50 released

17:00 * lpetit is now opening his umbrella :-)

17:03 lpetit: seems like everybody is at lunch in USA, see you guys

17:03 mabes: arohner: what is the dir stricture of the zip? you may be able to drop it into your ~/.m2/repository

17:03 arohner: mabes: doesn't look convenient, and it looks like the zip doesn't contain poms

17:04 I'm going to see if I can build from source and mvn install

17:04 mabes: yeah, probably next best thing.. unless you know someone with it cached in there ~/.m2 :)

17:04 any ideas on why I can't set the :main with leinigen like this? http://gist.github.com/338153

17:05 arohner: mabes: is that file naming again?

17:05 duncanm: hmm

17:05 weird

17:05 mabes: yeah, well foo.core works but foo_bar.core gives the java.lang.Exception: namespace 'foo_bar.core' not found after loading '/foo_bar/core'

17:05 arohner: is the directory named foo_bar?

17:06 duncanm: in a destructuring let, if i have things that I don't care for, I can bind it to _, right?

17:06 arohner: mabes: java doesn't like files or directories with '-' in them, and clojure munges '_' to '-'

17:07 mabes: arohner: the file name is src/foo_bar/core.clj

17:07 arohner: you can clone the gist for the dir structure

17:11 arohner: mabes: it ran without errors here

17:12 mabes: arohner: really? what OS are you on?

17:13 arohner: osx 10.6

17:13 though this doesn't look like an OS issue

17:13 are you running what you think you're running? do a clean checkout of your gist and run it

17:14 mabes: arohner: yep, did a clean checkout and ran "lein compile" with the same results

17:15 (the error)

17:16 arohner: I get that error on osx 10.5.8 and ubuntu

17:18 screw it, I'll just not use - or _ in my main ns

17:19 technomancy: mabes: there's a simple rule: dashes in the namespaces, underscores on disk.

17:19 so in defproject, :main should be foo-bar.core

17:21 mabes: technomancy: that compiles but when I try to run the jar I get: "Exception in thread "main" java.lang.NoClassDefFoundError: foo-bar/core"

17:21 technomancy: so it looks like :main needs to use the java class naming convention..

17:31 technomancy: chouser: any chance you could look at http://www.assembla.com/spaces/clojure/tickets/246 any time soon?

17:31 I got verbal agreement from Rich in here on that fix, but I don't know if he's seen the actual patch. Since it's a one-liner do you think that's a problem?

17:32 slyphon: ,(contains? (list "a" "b") "a")

17:32 clojurebot: false

17:32 slyphon: wtf?!

17:32 drewr: faq

17:32 * slyphon is confusored

17:32 drewr: ,(contains? {:a 1 :b 2} :a)

17:32 clojurebot: true

17:33 slyphon: yeah, but i'm trying to find out if a list-of-something contains something else

17:33 technomancy: slyphon: it's a misnomer. think of contains? as has-key? instead

17:33 slyphon: ah

17:33 technomancy: trips everyone up though

17:33 slyphon: ok

17:33 ok, well i can make that work

17:33 drewr: ,(#{1} [1 2 3])

17:33 clojurebot: nil

17:33 drewr: er

17:34 ,(#{1 2 3} 1)

17:34 clojurebot: 1

17:34 drewr: ,(#{1 2 3} 4)

17:34 clojurebot: nil

17:34 slyphon: ,(some #{1} [1 2 3])

17:34 clojurebot: 1

17:34 drewr: ah yes

17:34 dakrone: ,(boolean (some #{1} [1 2 3]))

17:34 clojurebot: true

17:38 slyphon: ok, so then

17:38 ,(boolean (some (set "a") (list "a" "b")))

17:38 clojurebot: false

17:38 slyphon: wut?

17:39 technomancy: ,(set "a")

17:39 clojurebot: #{\a}

17:39 technomancy: slyphon: set treats its argument like a collection

17:39 slyphon: oh son of a bitch

17:39 technomancy: heh

17:39 slyphon: that's not the first time that's gotten me

17:40 ,(boolean (some (set ["a"]) (list "a" "b")))

17:40 * technomancy heard that in the voice of Sawyer from Lost.

17:40 clojurebot: true

17:40 slyphon: hahahahha

17:40 so is a vector the same "weight" as a list or a set?

17:40 scottj: Is there a function foo that (foo bar tar) = (some #(= % bar) tar)? (I know I can write one, just wondering if I'm missing a name)

17:41 hiredman: I am pretty sure there is something in contrib somewhere

17:41 slyphon: if i just have a bag-o-items, should i prefer one over the others?

17:42 scottj: hiredman: ahh, thanks. seq-utils/includes?

17:46 mabes: ok, so I've verified that my compile error goes away with Leiningen 1.0.1, but it comes back with Leiningen 1.1.0

17:47 technomancy: mabes: if you could tar up a repro case and post it to the mailing list that would be great

17:47 along with a github issue

17:48 mabes: technomancy: okay.. will be clonable gist be enough though?

17:48 technomancy: mabes: oh sure... I've been out of it; I didn't realize gists could contain multiple files. =)

17:48 cools

17:49 mabes: technomancy: yeah, you can say "git clone git://gist.github.com/338153.git gist-338153" and see my exact project

18:15 KirinDave: http://news.ycombinator.com/item?id=1200389

18:16 Doh

18:16 mispost

18:16 sorry

18:17 arohner: http://gist.github.com/338257

18:17 any ideas what that exception means?

18:24 StartsWithK: arohner, i may be wrong but it looks like api should use local variable (java) that has annotation of some kind and is of type String

18:25 something like void someMethod() { String @annot myVar = "bla"; /* use myVar with api.. */ }

18:28 ok, RT/loadResourceScript can load any clojure script, with any ns in it, but, require will reload the script again if called later, even without :reload-all flag

18:28 are they not connected?

18:33 technomancy: why doesn't bound-fn just take a function?

18:33 StartsWithK: Var require = RT/var("clojure.core", "require"); require.invoke(new Symbol("foo.bar")); is then a right way to load a namespace from java?

18:34 technomancy, isn't then there a risk that var was already resolver inside a function body?

18:35 there is bound-fn* that takes a function

18:36 technomancy: StartsWithK: oh, nice; thanks

18:37 StartsWithK: vars wouldn't be bound in the function body at the time you call bound-fn

18:37 duncanm: is that scala syntax?

18:37 technomancy: well, modulo direct binding, in which case you're stuck either way

18:38 StartsWithK: technomancy, brr

18:38 duncanm, no.. its a weird clojure/java mix :) RT.var not RT/var :)

18:39 yesterday i was trying to write for loop in js, and after four-five tries i managed not to write it as (for ..)

18:40 remleduff: StartsWithK: Why not just (RT/load "foo.bar") ?

18:42 StartsWithK: remleduff, it looks like RT/load and friend don't register with clojure lib functions

18:42 s*

18:42 so, if i do (RT/load "foo.bar") and then (require 'foo.bar) it will load the lib twice

18:44 remleduff: Why do you need to require it after loading it?

18:45 StartsWithK: first time from java so i can reset a var value, and all other times from normal clojure code

18:45 i think i can guard the var with defone, so maybe its not a problem after all

18:46 remleduff: Namespace.findOrCreate(Symbol.create("clojure.core")) or something simliar might be even better, it's how RT does it. Or just Namespace.find

18:47 StartsWithK: yap, defone helped

18:47 there is RT/CLOJUR_NS

18:49 thanks all

18:50 so.. what is the best way to send clojure structures from one clojure to another loaded in different classloaders?

18:50 just prn and read?

18:51 slyphon: chouser: hey is there an example of the clojure.contrib.condition lib somewhere?

18:52 * slyphon follows the link

19:01 tomsw: i'd like to run something in a separate thread, using try & finally to ensure a thread-local resource is cleaned up, and then get the return value or throw any error raised. Do I want an agent?

19:02 StartsWithK: tomsw, yes, then use agent-error to check for exceptions

19:02 ,(doc agent-error)

19:02 clojurebot: Excuse me?

19:02 StartsWithK: ,(doc agent-errors)

19:02 clojurebot: "([a]); Returns a sequence of the exceptions thrown during asynchronous actions of the agent."

19:08 tomsw: but if I want block until the agent's work is finished? If I use await and the function throws an error it looks like I wait for ever

19:08 StartsWithK: ,(doc await)

19:08 clojurebot: "([& agents]); Blocks the current thread (indefinitely!) until all actions dispatched thus far, from this thread or agent, to the agent(s) have occurred."

19:08 StartsWithK: hmm

19:08 that could be a bug :)

19:09 ,(doc agent)

19:09 clojurebot: "([state] [state & options]); Creates and returns an agent with an initial value of state and zero or more options (in any order): :meta metadata-map :validator validate-fn If metadata-map is supplied, it will be come the metadata on the agent. validate-fn must be nil or a side-effect-free fn of one argument, which will be passed the intended new state on any state change. If the new state is unacceptable, the validate-fn

19:10 StartsWithK: in master, there is :error-handler

19:10 you can declare on agent

19:16 tomsw: I think it will be simpler just to use a normal thread and a ref for the result and the error

19:33 kylesmith: Is there a way to limit the number of elements that remove will eliminate from a sequence?

19:36 Chousuke: not with remove. you need a custom function for that

19:36 or a stateful predicate, but that's ugly

19:38 kylesmith: @Chousuke That's what I thought. I'm trying to probabilistically remove elements from an infinite seq, and vanilla remove might never quit.

19:39 hiredman: remove is lazy

19:39 why would it be a problem with an infinite seq?

19:39 Chousuke: yes, but it will remove elements until it finds something not to remove

19:39 so if you're randomly deciding whether something needs to be removed, it might never quit :)

19:40 JonSmith: oh man, but it probably will

19:40 hiredman: but it doesn't do anything until you walk the seq

19:40 Chousuke: hiredman: it's enough to try to consume the first item

19:40 kylesmith: it's in the context of a genetic algorithm

19:40 hiredman: remove or filter both won't stop removing or filtering no matter what predicate you use on an infinite seq

19:41 Chousuke: hiredman: I meant to say remove is strict until it finds something that fails the predicate

19:42 if you have an infinite seq of nils and run remove nil? on it, it will run forever if you try to do anything with it.

19:42 hiredman: no, because you are asking for the next thing,

19:42 that is lazy, not strict

19:42 JonSmith: what if i have an infinite seq of numbers and remove all primes

19:42 it will stop at the first non prime?

19:42 hiredman: it won't stop

19:43 JonSmith: hmm

19:43 Chousuke: you have a different idea of "stop" than I

19:43 it WILL stop

19:43 hiredman: Chousuke: the seq won't end

19:43 Chousuke: it won't compute past the first non-prime until you ask for more

19:43 hiredman: yes, but the computation will stop

19:43 JonSmith: oh ok

19:43 hiredman: Chousuke: no, it's still computing

19:43 just spinning

19:43 Chousuke: hiredman: what.

19:44 I don't understand your point anymore.

19:44 hiredman: Chousuke: in the case of (remove nil? (cycle [nil]))

19:45 JonSmith: i think what chosuke is saying if you do like (take 2 (remove even? (iterate inc 0)))

19:45 Chousuke: right, of course.

19:45 JonSmith: it will stop

19:45 Chousuke: in the nil case it will never stop

19:45 hiredman: several points, a) remove will not stop on an infinite seq, you may stop consuming it, but the lazy-seq generated by remove is still there

19:45 b) uh, there was something

19:46 remove is not strict

19:46 kylesmith: how do I paste code in here again?

19:46 Chousuke: I know remove is not strict, but it computes until it finds the next value

19:46 JonSmith: lisppaste.org (?)

19:46 http://paste.lisp.org/

19:46 Chousuke: and it does stop in the sense that it doesn't compute any more, until you ask for the next item in the infinite seq

19:46 JonSmith: that one

19:47 Chousuke: if remove never stopped you would have a buggy program :)

19:47 hiredman: 16:43 Chousuke : hiredman: I meant to say remove is strict until it finds

19:47 something that fails the predicate

19:48 Chousuke: hiredman: yes, with which I meant to say that it keeps computing until it can give you an item

19:48 JonSmith: ,(take 2 (remove even? (iterate inc 0)))

19:48 clojurebot: (1 3)

19:48 hiredman: Chousuke: yes, but you have to ask for the item, which makes it lazy

19:49 I think the sun is frying my brain

19:49 Chousuke: I think this is a pointless argument :P

19:49 hiredman: gorgeous day in seattle

19:49 Chousuke: apparently just a bad choice of wording on my part

19:50 hiredman: :)

19:50 Chousuke: and I really need some sleep :P

19:53 kylesmith: hmm, paste doesn't seem to be working. Do I need to do anything different now that freenode requires registration?

19:53 JonSmith: hm let me check

19:54 you can also do a normal one and just paste the link

19:55 http://paste.lisp.org/display/96652

19:56 etc.

19:58 kylesmith: http://paste.lisp.org/display/96653 There's my solution, if anyone's interested.

19:59 JonSmith: are you using it on an infinite seq?

20:00 kylesmith: the input is from repeatedly, where I generate new candidate solutions.

20:02 JonSmith: cool

20:07 kylesmith: I also need to put a fixed number of elements into a set lazily. Do I need to make a custom function for this as well?

20:08 JonSmith: lazily?

20:09 kylesmith: If the set function were lazy, I think I could just do (take n (set some-infinite-seq))

20:10 JonSmith: you can't just do (set (take n seq-here))?

20:10 i mean, set returns a datastructure

20:11 qbg: Maybe you want distinct

20:11 kylesmith: no, because I want the *resulting* set to have n members.

20:11 qbg: ,(doc distinct)

20:11 clojurebot: "([coll]); Returns a lazy sequence of the elements of coll with duplicates removed"

20:11 kylesmith: I was replying to JonSmith. Distinct looks like it would work.

20:12 JonSmith: yeah so (set (take n (distinct some-infinite-seq)))

20:13 kylesmith: what I actually want to do is (set (take n (distinct (map some-equal-fn some-infinite-seq)))) but have the resulting set contain members from some-infinite-seq. Is there an easy way to do that?

20:14 JonSmith: i think that you just wrote the way to do that

20:15 oh

20:15 or do you want filter

20:15 ?

20:16 qbg: I think you might need to write a function based on distinct

20:17 JonSmith: what does some-equal-fn do?

20:17 like a predicate?

20:18 qbg: Probably like the key keyword argument to REMOVE-DUPLICATES in Common Lisp

20:18 clojurebot: lisp is the red pill

20:18 kylesmith: Well, it looks like I'll have to make another custom function. thanks for the help, everyone, I have to go.

20:20 JonSmith: oh its distinct based on the eq function

20:26 slyphon: so, does clojure.contrib.sql take care of connection pooling and such?

20:26 or it just relies on the driver for that?

20:30 dhess: Hi, can anyone point me to definitive documentation on how to write a command-line script that'll run when invoked as 'java -cp clojure.jar clojure.main script.clj' ?

20:31 I've found some blog posts and github repos with examples, but I can't get any of them to work.

20:33 sorry, more specifically with the clojure.contrib.command-line library

20:34 I can get a simple (prn *command-line-args*) script to run, I just can't figure out the mojo to write a script with a "main" function that takes & args

20:34 hiredman: dhess: there is no default function that clojure calls

20:35 so you would do something like (apply my-main *command-line-args*) at the end of the script

20:35 dhess: apply ahhh gotcha

20:35 all of the examples I've seen use :gen-class with a -main

20:35 but it looks like those are compiling a jar first

20:36 hiredman: that is for aot compiling

20:36 dhess: hiredman: is this documented anywhere?

20:36 hiredman: clojurebot: compiling

20:36 clojurebot: No entiendo

20:37 hiredman: clojurebot: jerk

20:37 clojurebot: Gabh mo leithscéal?

20:37 hiredman: clojurebot: compile

20:37 clojurebot: the unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation

20:37 dhess: hiredman: sorry, I meant the bit about clojure not calling a default function, needing to (apply ...) etc.

20:38 hiredman: dhess: well there is no documentation that says it calls a default function

20:38 dhess: hiredman: it'd be nice if there were somewhere on clojure.org that said: here is how to write a script

20:38 I see

20:39 hiredman: it's obvious that I should have tried this approach in retrospect, but it wasn't before I found out about it ;) So a FAQ or short wiki page would be a good idea, I think.

20:39 hiredman: the lightweight scripting use of clojure doesn't seem to happen much

20:40 which is too bad

20:40 dhess: interesting that *none* of the informal "how-tos" or answered questions I found said anything about this

20:40 hiredman: (it works great)

20:40 psykotic: hiredman: i like the #! reader macro :)

20:40 dhess: hiredman: the start-up cost is a bit much for short jobs.

20:40 technomancy: hiredman: it would work a lot better if you could have a shebang that was honored

20:40 or rather, if there was one obvious way to do it

20:40 hiredman: dhess: depends

20:40 *shrug*

20:41 StartsWithK: some one posted a easy way to do it as: java -cp clojure.jar:src-dir clojure.main -e "(use 'foo.bar) (main)"

20:41 dhess: I guess on Windows there's some fancy fast startup/cache/preload functionality, but it doesn't appear to exist on other platforms

20:41 psykotic: a simple command line utility that takes a second to get going feels bad in the same way that a UI that locks up for a second after you click a button feels bad.

20:41 whether or not it's more or less productive in some objective sense is another matter.

20:41 hiredman: dhess: depends on what you think is a suitable start up time

20:42 I generally don't mind, but that is mostly for batch processing whatever

20:42 dhess: hiredman: well, at least as good as a shell script would be a good start

20:42 hiredman: so, you know, just fire and forget

20:42 dhess: hiredman: anyway, I'm not complaining, just pointing out one reason why it might not be commonplace to use Clojure for scripting.

20:42 psykotic: has anyone tried nailgun?

20:42 dhess: I was just complaining that there's no "best known method" for it in the Clojure docs ;)

20:43 hiredman: dhess: there are several shell scripts floating around, that may or may not work, and are most likely mutually incompatible

20:43 psykotic: many people have

20:43 vimclojure uses nailgun

20:43 there is a lein nailgun plugin

20:43 psykotic: are there any gotchas?

20:43 hiredman: my netbook fires up a nailgun server at boot

20:44 you are stuck with the classpath the nailgun server was started with

20:44 psykotic: really? i thought you could create a new classloader with another classpath in java?

20:44 dhess: I was quite surprised to see that java doesn't appear to have any way to run in a "server" mode with hot caches

20:44 hiredman: psykotic: you can, but it doesn't work well

20:45 psykotic: btw does nailgun use the underlying os's forking?

20:45 StartsWithK: no

20:45 hiredman: you can write your own classloader to use as a system classloader

20:45 psykotic: how does it isolate things then?

20:45 hiredman: and give your classloader a .add method

20:45 dhess: hiredman: anyway, thanks, your advice re: using apply just brought my blood pressure down to a normal level again.

20:45 hiredman: psykotic: doesn't

20:45 StartsWithK: it dosn't

20:46 hiredman: everything runs on one jvm

20:46 psykotic: also, java's monotonic-growth heap would be annoying with a 'wrapper' like nailgun, since it would generally stay up continually

20:46 StartsWithK: for a 'isolation' see something like classworlds

20:47 * hiredman should get his classloader into a state where other people can use and test it

20:47 * StartsWithK now has a clojure container with new classloader

20:48 StartsWithK: with multiple clojure instances, each in its own urlclassloader

20:48 clojurebot: vimclojure is state-of-the-art

20:48 hiredman: ~botsnack

20:48 clojurebot: thanks; that was delicious. (nom nom nom)

20:48 technomancy: with the -Xbootclasspath you can get boot times to around half a second

20:48 (with caveats)

20:48 hiredman: :(

20:48 yes, caveats

20:51 psykotic: like what?

20:53 i wonder what horrible things would go awry if you just called out to unix fork()

20:54 StartsWithK: psykotic, nothing realy, ant can do that

20:55 also, there is extracted api for forking jvm in apache commons, based on ant's code

21:04 psykotic: StartsWithK: couldn't that be used to avoid some startup cost?

21:05 i assume almost everyone is going to be java.lang.*, etc

21:05 *be loading

21:07 StartsWithK: there are other ways to speed up loading of core jars

21:08 psykotic, http://blog.headius.com/2009/01/my-favorite-hotspot-jvm-flags.html

21:09 psykotic: ah i'll have to play around with that

21:10 StartsWithK: http://pastebin.com/7kcmTqr1 to load just core jars, and do something with them, startup time is ok

21:15 *in*, *out* and *err* are never updated from System after the first bind?

21:15 if i update System version, they will stay the same

21:20 maxhodak: is it possible to do something like (require (symbol (str "foo." classname))) ?

21:21 Raynes: Licenser: Thank you for clj-sandbox. Has been very useful.

21:21 hiredman: why would you be requiring something with a classname?

21:21 maxhodak: hiredman: or, whatever that variable might be. the idea is just generating the require symbol at runtime

21:21 which seems to be giving me compile errors

21:22 s/require symbol/symbol to require

21:22 hiredman: ,(if (:macro (meta #'require)) "no" "yes")

21:22 clojurebot: "yes"

21:23 slyphon: argh

21:23 mysql, FEEL THE HATE

21:24 maxhodak: hiredman: does that mean that the function that makes the require form needs to be a macro as well?

21:25 hiredman: maxhodak: as well?

21:25 slyphon: is it possible to "clear out" the memoized results of a function?

21:26 by re-loading the class, maybe?

21:26 s/class/lib/

21:35 maxhodak: hiredman: so basically, (require (symbol "com.foo.baz.quux")) doesn't work?

21:36 or ok: how would you get it to evaluate the inner statement first?

21:36 oh

21:36 just kidding

21:36 JUST KIDDING

21:36 hiredman:

21:39 dcnstrct: serious question: is it possible to port this style of java code to clojure ? http://pastebin.com/QngijPp7

21:39 look at all that method chaining

21:39 I can't even imagine what it would look like it hurts my head

21:40 slyphon: you'd use the .. macro a lot, i would imagine

21:40 dcnstrct: would I use one bit (.. expression ?

21:40 ahhhh

21:40 hiredman: no

21:40 no ..

21:40 use ->

21:40 slyphon: ah

21:40 too right

21:40 dcnstrct: neat, I will investigate ->

21:41 hiredman: ,(-> "foo" .getBytes String. .toUpperCase .getBytes first char)

21:41 clojurebot: \F

21:42 JonSmith: so, would you really want to write that java code in java?

21:43 it looks totally crazy to me

21:43 dcnstrct: thats the code neatbeans gui builder spits out when I make a simple swing form.. heh

21:43 slyphon: java makes people do strange things

21:43 JonSmith: doto macro might also be helpful

21:44 slyphon: not if you're chaining

21:44 JonSmith: yeah i'll say it makes them do crazy stuff

21:44 slyphon: but yeah, it's useful in other situations

21:44 JonSmith: some of the.adds maybe

21:45 i don't really know what it is doing honestly

21:45 hiredman: the code from most gui builders is not meant to be read or written

21:45 just machine generated

21:45 slyphon: heh

21:45 dcnstrct: or ported to clojure

21:45 lol

21:45 hiredman: it's true

21:45 psykotic: method chaining is one of the nicer smalltalk patterns. although it can get excessive, like anything.

21:45 hiredman: they tell people that all the time in #java

21:45 slyphon: does anyone have 'electric-{' working in paredit mode

21:46 there are like 4 different ways to do it, and i can't seem to find one that works consistently

21:48 wow, i'm just batting 1.000 tonight with the questions

21:48 dcnstrct: I think I will try to compile this form as java and stick it in a .jar then import it from clojure

21:49 hiredman: right, that is essentially the same thing you would do with java

22:22 seangrove: Hey all, having a hard time differentiate between what's java and clojure sometimes

22:22 what is (io!)?

22:23 I can't seem to find the documentation on it

22:23 hiredman: ,(doc io!)

22:23 clojurebot: "([& body]); If an io! block occurs in a transaction, throws an IllegalStateException, else runs body in an implicit do. If the first expression in body is a literal string, will use that as the exception message."

22:23 seangrove: haha

22:23 Aiya... yes, there is (doc ... :P

22:23 My bad

22:35 TalkingHead: what is the clojure way of filtering one collection with another?

22:35 Say I had 2 collections like so

22:35 (def flight '("SUN" "SUN" "MON" "TUES" "WED" "THURS" 13:25 RF200 ))

22:36 (def filter-flight '("SUN" "TUES"))

22:38 Can I find out if the first collection contains elements of the second without looping through?

22:38 technomancy: TalkingHead: (filter (set filter-flight) flight)

22:38 danlei: (for [x '[su su mo tu we th] p '[su mo] :when (= x p)] x)

22:39 TalkingHead: thx guys

Logging service provided by n01se.net