#clojure log - Feb 16 2010

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

0:33 brennanc: slime doesn't seem to be indenting functions with multiple method bodies, is there a setting to fix this?

1:13 qed: hello all

1:17 lpetit: hi, has the cell story finally got a final word on the names of things ?

1:26 replaca: hmm, silly Q: is there a func like (foo [a b c] [d e f] [g h i]) => ([a d g] [b e h] [c f i])?

1:26 trivial enough to hack up with map, but seems really common

1:31 TheBusby: So is there a normal reason why independent clojure calls in a REPL would work, but being wrapped in a function would cause them to fail?

1:31 I have the following code for rendering a java.awt.Image to the screen, http://pastie.org/826749

1:32 which works if I execute each line individually, but when wrapped as a function it throws a null pointer exception

1:43 replaca: TheBusby: where does it throw the null pointer exception?

1:44 TheBusby: in the drawImage call I believe

1:44 replaca: A common reason things work at the repl and not in funcs is laziness (since the repl prints results) but that would appear not to be relevant here

1:45 TheBusby: I thought that maybe since the drawing was happening in another thread that image or jframe were being freed

1:45 so I added the sleep, but that didn't seem to help at all

1:46 replaca: I would put code to check the non-nil-ness of each part before calling the drawImage

1:47 I'd be especially suspicious of getGraphics and image

1:47 TheBusby: did that as well

1:47 seemed fine

1:48 that's what the println's were for

1:48 replaca: yeah, i see that now

1:48 TheBusby: do you get the same behaviour?

1:48 replaca: I didn't try running it. gimme a sec and i will

1:49 TheBusby: thank you

1:51 wonder if it's a swing thing where a re-render causes the problem... The clojure seems too simple to be broken (IMHO)

1:53 replaca: well, it's not even getting into swing, really

1:53 the back trace is right at invoke

1:55 TheBusby: my repl is showing the println's all the way up to drawImage

1:56 replaca: yeah, but if you look at the npe, the trace doesn't go deeper than the invoke on drawimage

1:56 TheBusby: well the println looks like getGraphics is returning a SunGraphics2D object

1:57 replaca: sorry, I should mention that i'm playing with your code and I do see the same thing

1:57 which seems right...

1:59 TheBusby: replaca: thank you, well at least I know it isn't just my system now

1:59 very strange though...

1:59 replaca: oh, isn't it treating that nil as a BufferedImageOp

2:00 which you would expect to npe on you

2:00 TheBusby: the example java code I was using was passing NULL to indicate no value

2:00 and if that was the problem why would it would at REPL but not in a function?

2:01 replaca: yeah, I dunno

2:01 TheBusby: does any casting need to occur?

2:02 I notice in the reference example that the getGraphics() value is being casted, http://www.javalobby.org/articles/ultimate-image/#2

2:03 replaca: I don't *think* that should matter

2:05 hoeck: TheBusby: to debug such exceptions, you should create a proper namespace for your code and then load it from the repl via require or use

2:05 TheBusby: you will then get at least a line number of where the exception occured, instead of no_source_file:1

2:06 TheBusby: hoeck: will try that now

2:16 replaca: TheBusby: the problem is that clojure is picking the worng overload

2:16 *wrong

2:17 TheBusby: ?

2:17 replaca: It's calling public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer)

2:17 TheBusby: gah

2:17 hence the cast in the Java code

2:17 replaca: in java.awt.Graphics

2:17 no, the cast wouldn't matter

2:18 the issue is that it is only picking by arg count

2:18 TheBusby: hmm, so why would it work in the REPL though?

2:18 does 0 = nil in some cases but not others maybe?

2:20 replaca: yeah, I don't know the answer to that

2:20 the results may be indeterminate

2:20 TheBusby: well it's not throwing an exception anymore so that's still a huge improvement

2:21 hoeck: since the NPL was outside my code, the NS didn't add any additional information

2:21 thank you both though! No I need to figure out why it's rendering a blank window though... :)

2:21 er No->Now

2:23 replaca: yup, onto the next problem!

2:23 defn: 你好

2:23 replaca: time for me to go to sleep though. Good night!

2:23 defn: Good night sir.

2:24 TheBusby: night, and thank you again!

3:09 hoeck: TheBusby: my guess is that while the frame pops up you draw into it while the frame is still being resized, if I'm putting the Thread/sleep call before the call to .drawImage, something appears after a few seconds

3:38 TheBusby: hoeck: thanks, I'm still messing with that

3:38 any idea how to set up redraw to recreate the image with proxy?

3:39 hoeck: TheBusby: could you elaborate a bit?

3:41 TheBusby: I imagine an event is trigger when the window is resized

3:41 so I can call drawImage again

3:41 it sounds like if I add the sleep timer, although the image will display okay the first time. If I resize it'll disappear again

3:42 I'd like to have it so that when the window is resized, some code is called to redraw the image

3:42 hoeck: TheBusby: right, because you are drawing on the "bare" java-metal

3:42 TheBusby: can I add a handler to the "bare" java-metal to redraw when a resize occurs?

3:43 hoeck: TheBusby: under normal circumstances, you would use a windowing toolkit doing this, but I guess you just want to play around a little bit

3:43 ulfster: TheBusby: you should be able to add a onResize listener on the frame, which then redraws the image

3:43 TheBusby: honestly I really just need to display an image

3:43 that'll be the end of my awt/swing adventure

3:44 ahh okay

3:44 Rich's celsius example has a handler on button, so I'll try to replicate that then

3:45 ulfster: you may want to look up the semantics, i am not 100% sure that this thing is called the way i said in swing

3:45 but the general way should work

3:46 TheBusby: er, would the general way be with Jframe.addContainerListener?

3:46 ulfster: try this: http://java.sun.com/docs/books/tutorial/uiswing/events/componentlistener.html

3:47 TheBusby: thank you, reviewing the link you kindly provided now

3:56 hmm, tried this without any success

3:57 http://pastie.org/826830

4:00 is there any easier way to display an image that I'm missing?

4:02 hoeck: TheBusby: ContainerListener interface has simply no onResize method

4:03 TheBusby: what you want is: http://java.sun.com/javase/6/docs/api/java/awt/event/ComponentListener.html

4:04 TheBusby: hoeck: thanks again, I apologize for my ignorance here,

4:04 I'm not used to swing/awt or any GUI framework really

4:05 hoeck: TheBusby: no need to apologize here, we all have been there :)

4:06 TheBusby: so I renamed it from "onResize" to "componentResized"

4:07 hoeck: right, and ContainerListener to ComponentListener

4:07 TheBusby: no change though...

4:07 ahh

4:09 So now,

4:09 (.addComponentListener frame

4:09 (proxy [java.awt.event.ComponentListener] []

4:09 (componentResized [evt]

4:09 (. (.. frame getRootPane getGraphics) drawImage image nil nil)

4:09 )))

4:09 dsop: arg

4:09 use pastebin

4:09 TheBusby: sorry, will do that now

4:10 Updated code to use components, http://pastie.org/826840

4:23 hoeck: TheBusby: well, it works, at least the image is painted into the jframe, but the jframe repaints it self immediately after resizing too, so it overwrites your image

4:24 I believe you have to use a java.awt.Canvas, this one also does buffering, so you don't have to manually refresh the screen

4:26 the getGraphics method in awt and swing components is mainly there to write other components or decorators, not to directly draw on it

4:26 TheBusby: Ahh

4:27 hoeck: thank you! I'll head in that direction.

4:29 can you write an image to a canvas though?

4:30 LauJensen: Morning team

4:31 B is for? Check out the top video: http://www.rocketboom.com/category/daily/

4:31 Raynes: Morning teammate.

4:36 esj: Morning !

4:37 Raynes: http://factor-language.blogspot.com/2010/02/factor-092-now-available.html

4:38 hoeck: TheBusby: you have to subclass Canvas and overwrite the paint or update method (via clojures proxy) which recieves a Graphics Object (the same you took from the JFrame with .getGraphics)

4:50 TheBusby: http://gist.github.com/305415

4:59 ordnungswidrig: sorry guys. vpn flapping

5:09 qed: ordnungswidrig: no problem

5:11 defn: anyone awake?

5:11 i need my clojure fix

5:12 Chousuke: :P

5:12 pjackson:

5:12

5:15 defn: Chousuke: tie me off?

5:17 AWizzArd: Is there something in Contrib to support “keyword arguments”, similar to the ones in CL?

5:17 I saw that more and more fns support (foo 1 2 :some-parameter1 arg :another-one arg2)

5:18 Where the order of the keyword+arg don't matter, as long they come after the non-optional ones.

5:21 defn: AWizzArd: i think it may be in c.c.macros

5:21 hoeck: AWizzArd: clojure.contrib.def/defnk ?

5:21 AWizzArd: Will look at those, thanks.

5:22 defn: AWizzArd: http://www.assembla.com/spaces/clojure-contrib/tickets/51

5:22 does that look like what you're after?

5:22 defnk looks like what you need

5:24 but the link above is absolutely what you /want/

5:25 AWizzArd: http://groups.google.com/group/clojure/browse_thread/thread/d6b5fa21073541c1

5:27 i wonder if compojure or ring use defnk or some amalgamation of the stuff in that post

5:28 if it doesnt use either it seems like it might make things simpler

5:28 bbl, cheers

6:20 TheBusby: hoeck: much much *MUCH* thanks

6:21 hoeck: TheBusby: so you finally got it working?

6:32 AWizzArd: Is there a bar other than #(symbol (name %)) which returns for (bar :foos) the symbol “foos”?

6:32 keyword to symbol

6:40 Chousuke: AWizzArd: I don't think so.

6:49 AWizzArd: oki

7:49 Raynes: FleetDB looks nice.

7:57 LauJensen: Anybody know what that RocketBoom is I linked earlier?

8:10 cemerick: this book may find a home with many here: http://www.amazon.com/dp/3540891846

8:43 esj: cemerick: that looks like a challenging read, thanks.

8:44 cemerick: yeah, no doubt. Stuff like that is likely the sort of foundation one needs to build things like Qi

8:44 Which would be particularly interesting in clojure, IMO.

8:46 bremner: ignorant question: does clojure support pattern matching a la Haskell or ML?

8:47 cemerick: it has excellent destructuring -- no value-based pattern matching, though you could probably put something very interesting together with the new case form

8:47 I think all of the existing pattern matching libs predate case, so they do a lot of heavy lifting that isn't necessary anymore.

8:47 bremner: ah. yeah, Oz has a very expressive case, but no "top level" pattern matching

8:48 not that I expect anyone to know Oz :)

8:48 cemerick: ask around some more, though, there may be a lib that I'm not familiar with

9:22 ordnungswidrig: Raynes: I currently evaluate fleetdb and I like it

9:25 esj: ordnungswidrig: have you looked at Mongo ?

9:26 ordnungswidrig: esj: it's next on the list. I like about fleetdb that it's java. so I have a single environment for development. riak looks nice as well.

9:27 esj: cool. I'm checking out Mongo right now and have only nice things to say

9:33 ohpauleez: is there a more idiomatic way to use iterate than: (nth (iterate add2 2) 4)

9:41 chouser: ohpauleez: that looks about right.

9:41 ohpauleez: cool, I figured as much, just wanted to see if people used it any other way

9:42 chouser: thanks

9:42 chouser: I've never actually done that, I don't think, but if I wanted the fourth application of a fn to its own results, that's the best way I can think of.

9:42 ohpauleez: that's indeed what I want

9:45 AWizzArd: How helpful would it be if the compiler were emitting warnings for name clashes? Such as having a parameter p called like a function f, thus effectively having p shadowing f.

9:46 chouser: AWizzArd: it would have a fit with clojure.core

9:47 AWizzArd: Such warnings could be turned off by meta-data for example.

9:47 Today I was debugging 30 minutes until I found the name clash ^^

9:47 ohpauleez: I like this idea

9:48 chouser: what about a separate "lint" tool that would flag such things?

9:48 AWizzArd: chouser: yes, this would be the best.

9:48 I already suggested something like FindBugs for optional static typing.

9:48 chouser: Hm... I've started such a thing. I should keep pushing on it.

9:48 AWizzArd: FindBugs has a very nice infracstructure ready for use.

9:49 It can find unused vars, wrong format strings, etc.

9:49 chouser: but it couldn't be used to find this kind of bug

9:49 I assume, anyway.

9:49 By the time clojure code has been compiled, the names of things are different and unique

9:50 AWizzArd: chouser: maybe there could be a way. For example, the compiled version of the function “keyword” will probably have a unique identifier in compiled code.

9:51 chouser: http://findbugs.sourceforge.net/

9:51 chouser: my plan is to let the clojure compiler do its analysis, but then check the results before emitting bytecode.

9:51 ohpauleez: chouser: I remember you saying you were working on that tool, I'd love to see it make it's way into the community

9:51 rhickey: if editors/IDEs understood let, they could color locals differently from globals

9:51 AWizzArd: rhickey: yes

9:52 chouser: maybe check those results using datalog...

9:52 ohpauleez: I'm still working on the clojure repl based JDB interface, which I haven't gotten too far on

9:52 * chouser needs to learn datalog

9:52 lpetit: rhickey: soon to come :-)

9:52 AWizzArd: chouser: yes, the compiler can do the analysis and optionally include data in the compiled code

9:54 In principle it would be nice if the compile function would take in future versions a full stack of options.

9:58 cemerick: whoa, looks like I'll be able to make it to the next Clojure-NYC meetup :-D

9:58 ohpauleez: cemerick: when is that?

9:58 cemerick: apparently they're pegged at the third thursday each month, starting in march

9:58 ohpauleez: cool, I'd bus up for that

9:58 cemerick: http://www.meetup.com/Clojure-NYC/

10:02 ohpauleez: cemerick: thanks

10:07 hoeck: ohpauleez: how far did you get with JDE?

10:09 ohpauleez: I looked at the jdb source to see how to best interface with JDI, and then sat on the repl trying stuff out and saving a few things that seemed to work on the surface

10:10 It's a weekend project to get a basic version going

10:10 chouser: ohpauleez: can you debug the JVM your REPL is in, or only other JVM processes, or either?

10:11 ohpauleez: either

10:11 JDI lets you connect remotely, or locally

10:11 chouser: excellent.

10:12 ohpauleez: yeah, totally

10:17 hoeck: I'm currently trying to hook jde into swank-clojure for better exception stacktraces

10:19 ohpauleez: hoeck: there's a pretty good developerWorks article about how to pull out more detailed stack traces

10:19 I don't know if you've seen that

10:24 hoeck: no, I'm just using the JDE javadoc

10:24 hardest part is figuring out how slime works

10:30 * rhickey adding :volatile and :unsynchronized-mutable options for deftype fields

10:33 AWizzArd: rhickey: what do those options do?

10:34 chouser: volatile is a Java keyword that means the same thing, I would assume

10:35 And I would guess unsynchronized-mutable is for a regular ol' Java instance field -- with a long enough name to discourage its use. :-)

10:36 ohpauleez: haha

10:36 AWizzArd: So, this mutable thing would not trigger the instantiation of a completely new object, but instead mutate the existing one.

10:37 Chousuke: is volatile then just an instance field, but synchronised?

10:38 chouser: AWizzArd: just a regular field in the object you can change with the set! special operator.

10:44 rhickey: could be :volatile-mutable! and :unsynchronized-mutable!

10:45 :unsynchronized-mutable-I-know-what-Im-doing-and-wont-call-Rich-when-it-goes-awry

10:45 chouser: there, that's better.

10:45 the-kenny: I like the version with !

10:47 rhickey: seriously - :volatile-mutable! and :unsynchronized-mutable! ?

10:48 chouser: I don't really like the ! on a noun. but the words are good

10:48 ohpauleez: I agree with that, I tend to think of ! as a mutable/destructive verb

11:00 rhickey: proposed new text in deftype docs:

11:00 Fields can be qualified

11:00 with the metadata :volatile-mutable true or :unsynchronized-mutable

11:00 true, at which point (set! afield aval) will be supported in method

11:00 bodies. Note well that mutable fields are extremely difficult to use

11:00 correctly, and are present only to facilitate the building of higher

11:00 level constructs, such as Clojure's reference types, in Clojure

11:00 itself. They are for experts only - if the semantics and

11:00 implications of :volatile-mutable or :unsynchronized-mutable are not

11:00 immediately apparent to you, you should not be using them.

11:01 ohpauleez: solid

11:03 LauJensen: Excellent rhickey

11:08 cemerick: rhickey: it's *almost* like they shouldn't be documented at all ;-)

11:09 rhickey: cemerick: but there are those pesky people who read the Clojure source :)

11:09 cemerick: ah, but those brave enough to do so get to use the gems they find!

11:10 rhickey: cemerick: then we'll just be answering about them here over and over

11:10 * the-kenny needs to learn how to use deftype.. Is there something I can read?

11:10 cemerick: yeah, omitting docs was a joke, actually ;-)

11:10 the-kenny: like how/when to use

11:11 cemerick: the-kenny: https://www.assembla.com/wiki/show/clojure/Datatypes

11:12 basically, use deftype when you need to create objects with a set of defined slots

11:12 e.g. in place of defstruct

11:14 the-kenny: cemerick: ah, nice. Maybe it makes sense in my small fun-project :)

11:19 qed: rhickey: i was thinking about fetch/pass this morning. what about 'glean' or 'abscond'?

11:19 rhickey: for fetch i mean...

11:20 rhickey: qed: I like fetch in that it implies go in and bring back

11:21 qed: rhickey: right, just trying to bring the spirit of 'smuggle' into the mix as you were suggesting yesterday

11:24 Chousuke: I quite liked "spy" :P

11:24 qed: yes I liked that as well

11:25 I was also thinking something like liberate might work

11:26 it's unique and brings to mind some animal protester letting a bunch of monkeys out of their 'cells'.

11:27 Chousuke: :P

11:28 qed: Chousuke: oo oo! "fence"?

11:29 _fogus_: qed: You saw how well that worked out in 28 days Later no?

11:29 :p

11:30 qed: _fogus_: haha

11:33 lpetit: rhickey: what about inspect instead of fetch ?

11:35 rhickey: lpetit: the roots are good, but the current usage is more of "examine closely"

11:36 lpetit: rhickey: ah, ok

11:38 qed: lpetit: perhaps 'probe'?

11:52 esj: gather ?

11:53 or, in nod to our friends in London, 'nick' ?

11:53 chouser: gather implies from multiple sources.

11:54 esj: chouser: true dat.

11:54 pick ?

11:54 chouser: I kinda like inspect, though I'm not sure it's any better than fetch. And clojure.inspector already exists.

11:55 lpetit: visit ?

11:55 mm, no

11:57 study ?

11:57 rhickey: wow, interactive development with deftype and protocols is way faster and more fun than classes+interfaces

11:58 lpetit: why not just "look" instead of fetch ?

12:01 qed: lpetit: because you need to go instide

12:01 inside*

12:02 lpetit: Well, somehow we already are "inside" ( within-cell ), no ?

12:03 chouser: rhickey: yes! Never restarted my REPL while hacking out the extra interface impls for gvec

12:17 qed: google fight: inspect cell vs fetch cell -- inspect wins

12:56 sh10151: Hi -- is there any variant of pmap that spawns a user-defined number of threads? I have something I/O bound that I want multiple workers to perform

12:58 chouser: if it's IO bound, why do you want more than one thread?

12:59 sh10151: it's network-bound, I should say

13:00 some hosts are slow and others are fast

13:00 cemerick: seems like a better job for agents

13:02 sh10151: Maybe? I mean, conceptually it's "I want (e.g.) no more than 10 connections open at one time to process these 1000 hosts"

13:03 Chousuke: you can use a plain old threadpool :)

13:03 sh10151: yeah but this code is more Java than Clojure anyway at this point ;)

13:04 Chousuke: It might be useful if you could tell eg. futures or agents to execute in a specific threadpool . :/

13:04 qed: have anyone done any good write ups on using TDD with clojure?

13:04 has*

13:05 Chousuke: qed: write a function, test it, once it works, goto 10 :P

13:05 qed: i only go to 11

13:05 cemerick: sh10151: Chousuke has a good point -- just create a fixed threadpool, .invokeAll with your list of fns that do the IO, and then read off the results.

13:05 larger stuff would require a queue

13:05 or, doing something by hand with agents :-)

13:05 Chousuke: qed: the only one I can find is http://s-expressions.com/2009/07/28/clojure-the-repl-and-test-driven-development/

13:06 sh10151: aaah i always forget clojure functions are runnables

13:06 that makes that option much less ugly

13:06 hiredman: and Callables

13:08 qed: Chousuke: yeah i found that but im not in love with it -- i'd like to get something sexy working where id have a buffer constantly running tests and giving me red/green for every save of a file

13:10 Chousuke: im not sure why i even really want to use tests -- with FP I need them so much less, and after you add the REPL into the mix there's even less reason for good tests for everything

13:10 however, with I/O it'd be nice to double check

13:17 Chousuke: heh

13:18 when I was writing a Clojure reader I didn't even do any IO until the reader was pretty much fully functional :P

13:23 sh10151: the threadpool looks nice enough

13:23 thanks for the help :)

13:39 DeusExPikachu: technomancy, do you have a public read-only development branch of leiningen?

13:40 more development then master

13:41 technomancy: DeusExPikachu: no, master is the development branch

14:08 metaperl: Hi all ... who has the best SLIME - Clojure mode for Emacs right now?

14:09 I think technomancy picked up where jeff chu left off?

14:10 fanatico: metaperl: use the elpa release. http://tromey.com/elpa/

14:10 metaperl: Hmm, I will try

14:10 thanks fanatico

14:10 havent used ELPA in 2-3 years I think :)

14:11 fanatico: technomancy manages the clojure related packages for it.

14:11 np

14:13 metaperl: I see. It installed just fine. Thanks.

14:21 licenser__: Hi :)

14:22 hamza: hey guys, i am trying to get lein test to run but i get a classnotfoundexception for leinningen.test, even on a fresh project created with lein new someProj? This is for Mac OS X.

14:22 btw, every other lein task works except test

14:23 licenser__: Did you do a leon deps first?

14:23 hamza: yes

14:23 i have clojure and contrib in lib/

14:23 licenser__: Okay then I've no idea

14:26 fanatico: hamza: do you have an old version of lein in your path?

14:27 hamza: no, but i removed clojure and contrib from my java extensions folder and seems to fix the problem, multiple clojure in both extension folder and lib/ folder.

14:28 licenser__: Okay a question about the best aproach here: I've a map of 2k items, the map never changes only the items now i've to run a function on every item that modifies the item itself and perhaps anoter obe or two each of those functions only tale like 10ms currently. To optimize this dies it make sense to send all the functions to a agents and let them handle stuff in paralell, I see chances for conflicts as pretty low

14:32 chouser: rhickey: abrooks suggests "glimpse" instead of "fetch"

14:34 rhickey: hmm

14:41 I'm finding these word-names completely in the way

14:42 a big diff between cells and the other ref types is that you always have to go through the cell. With the other refs you grab the value out, perform a series of transformations, and stick it back in, ot passa multi-step value transform in

14:43 or pass a

14:43 cell code will say pass pass pass pass

14:43 obscuring the work

14:44 AWizzArd: a cell must be traversed from the beginning to end always?

14:44 rhickey: AWizzArd: ?

14:44 AWizzArd: What do you mean by "you always have to go through the cell"?

14:45 Raynes: (())

14:46 dakrone: what's the easiest way to get [a b c] [1 2 3] into ([a 1] [b 2] [c 3])? I tried (map #([%1 %2]) [a b c] [1 2 3]) but that doesn't work

14:46 AWizzArd: try (map #(vector %1 %2) ..)

14:46 opqdonut: or (fn [a b] [a b])

14:46 cemerick: dakrone: zipmap + seq if you're lazy :-)

14:47 opqdonut: or even map vector

14:47 _fogus_: ,(map vector '[a b c] '[1 2 3])

14:47 clojurebot: ([a 1] [b 2] [c 3])

14:48 cemerick: I find a lot of people don't grok that map can take any number of collections.

14:48 noidi: that's a real FAQ :)

14:48 dakrone: AWizzArd / opqdonut / cemerick /_fogus_, awesome, that works. Thank you

14:48 _fogus_: ,(map vector '[a b c] '[1 2 3] '[e f g])

14:48 clojurebot: ([a 1 e] [b 2 f] [c 3 g])

14:48 DeusExPikachu: technomancy, what do you think about the idea of having "wrapper" like project.clj files that act like ebuilds in gentoo, that provide the necessary information to build that project. In this way, there would be a project.clj maintainer who potentially may not be the project's maintainer?

14:48 noidi: I've noticed after I asked that myself a few months ago :)

14:48 +that

14:52 technomancy: DeusExPikachu: I don't really know what that means. What are ebuilds?

14:52 ohpauleez: noidi: totally, that question gets asked all the time

14:53 DeusExPikachu: technomancy, ebuilds are like project.clj files, they list the dependencies for building a package in a linux environment, they are general enough to build and install all sorts of packages written in java, python, C/C++ etc...

14:54 portage, kinda like apt system with debian, looks at that file, downloads the sources, and builds deps and finally the package itself

14:56 technomancy: DeusExPikachu: still not seeing the connection

14:56 stuartsierra: Thereby adding one more layer at which things can be broken.

14:57 technomancy: oh, you're talking about leiningen manually building all the deps?

14:58 that sounds really complicated and not helpful.

14:58 arohner: technomancy: it would avoid jar hell of each of your dependencies specifying a different version of clojure

14:58 DeusExPikachu: technomancy, yes, so leiningen normally builds allthe deps, I'm asking that potentially described in the project.clj file, it can offload the work to the package's installation method

14:58 fanatico: maven already handles that.

14:58 technomancy: oh, I see... yes, there's a place for a final-AOT before an uberjar is built

14:59 but definitely not checking out all the sources for each dependency

14:59 DeusExPikachu: all leiningen would have to do is manage downloading sources/jars and installation of the built jar into the local repo

15:03 metaperl: do you fill out a ticket on Assemba for doc fixes? This section http://clojure.org/getting_started#toc4 does not mention the ELPA method of installing the emacs' clojure mode

15:03 technomancy: I'm all about late-binding a project to a specific clojure version

15:03 that's why it needs to be done at uberjar-time

15:03 metaperl: or maybe the website is under source control?

15:04 technomancy: anything earlier is just going to cause headaches down the road with project that depend on it

15:04 metaperl: no, it's a manually-edited wiki unfortunately.

15:05 chouser: do you have write-privs for it? those links are extremely outdated.

15:05 metaperl: oh, and where are the docs on your clojure mode technomancy?

15:05 I dont know how to run it... I can run clojure from the shell jsut fine, but want to step up to emacs

15:05 technomancy: metaperl: clojure-mode doesn't really need docs; there's nothing to it. swank-clojure (for communicating with running clojure subprocesses) is documented in http://github.com/technomancy/swank-clojure.

15:06 metaperl: oh so I need to install something other than what I got via ELPA... yes us emacs-users certainly would benefit from an update of that section :)

15:07 technomancy: metaperl: no, getting swank-clojure from elpa is enough

15:07 it will pull in dependencies automatically

15:12 tomoj: anybody happen to have a distance_of_time_in_words function laying around? :)

15:13 metaperl: technomancy: I should not have gotten this right - """swank-clojure.el:47:1:Error: Cannot open load file: slime""" - http://pastie.org/paste/827697

15:14 technomancy: metaperl: that's an elisp byte-compilation error. it won't interfere with usage; elisp will continue to work in interpreted mode

15:19 metaperl: ok and I need to set my environmental variable CLASSPATH to "." to fix this right - http://pastie.org/pastes/827713

15:19 hyp3rvigi1ant: it seems that the Java Media Framework (JMF) requires a manual download (can't get it leiningen)...how should i go about adding it to my project?

15:20 hiredman: hyp3rvigi1ant: I'm pretty sure jmf must be a maven repo somewhere

15:26 hyp3rvigi1ant: hiredman: this is what happens when i try with [javax.media/jmf "2.1.1e"] as a dependency: http://pastie.org/827726

15:26 metaperl: even after setting the CLASSPATH to "." it does not work - http://pastie.org/pastes/827713

15:27 hamza: technomancy: how does lein pass command line args to the plugin? if my plugin expects a port value "lein myPlugin 90" how do i grap 90 from within a plugin?

15:27 hiredman: hyp3rvigi1ant: you need to find a maven repo that has jmf in it, and add it to you project.clj

15:28 ~google jmf maven

15:28 clojurebot: First, out of 2160 results is:

15:28 Index of /maven/2/javax/media/jmf/

15:28 http://download.java.net/maven/2/javax/media/jmf/

15:28 hiredman: ^- doesn't look very hard

15:30 hyp3rvigi1ant: hiredman: how do i tell leiningen to use that? (i know nothing about maven and this is the first time i've run into something like this)

15:33 metaperl: fanatico: have you had any issues with swank-clojure like this - http://pastie.org/pastes/827713

15:34 dakrone: anyone have a second to take a look at this http://paste.lisp.org/display/95068 and tell me if I'm on the right track as far as coding style / layout goes?

15:34 not sure if function generators are the cleanest way to lay that out

15:35 hiredman: hyp3rvigi1ant: :repositories {"name" "url"}

15:35 or something similar

15:36 hyp3rvigi1ant: hiredman: ah, nice, thanks! i'll check that out

15:36 fanatico: metaperl: no. I did a clean install last night and everything worked perfectly. Is this error triggered by starting slime?

15:36 metaperl: yes, when I type M-x slime

15:38 it downloaded and installed clojure the first time, but then it threw this error... I figured it was CLASSPATH, so I set that and then restarted Cygwin/X/emacs .. but the same error...

15:39 hyp3rvigi1ant: hiredman: excellent! it worked perfectly! thanks again

15:40 metaperl: So Prolog is not quite homoiconic? I suppose DCGs would get in the way of that?

15:42 fanatico: metaperl: could there be an previous version of clojure in your CLASSPATH?

15:42 metaperl: fanatico: CLASSPATH=.

15:43 maybe I should remove the clojure it installed and uninstall slime and swamk-clojure and try again

15:43 but where did it install clojure?

15:45 fanatico: maven.

15:50 metaperl: maven? I dont think I have maven installed unless it comes with java

15:51 oh you nkow, it might be because I'm running emacs22 --- Cygwin says it has emacs23, but it keeps installing 22

15:51 I may have to manually compile and install 23

15:53 fanatico: metaperl: can you start a swank server using lein and connect to it with slime?

15:53 metaperl: lein? I dont know how to do that? I never installed leiningen

15:55 fanatico: there is a plugin for leiningen called lein-swank that'll create the slime server for you. it may give you some idea why your current setup isn't working.

15:55 metaperl: I see - http://github.com/technomancy/leiningen/tree/master/lein-swank/

15:56 fanatico: just list it in :dev-dependencies.

15:56 metaperl: This is not docs for idiots like me - Simply add [leiningen/lein-swank "1.1.0"] to your :dev-dependencies in project.clj

15:56 1) I dont know what project.clj is, or where it should be

15:56 2) should CLASSPATH just be "."

15:57 3) what is exact syntax to add [leiningen/lein-swank "1.1.0"] to your :dev-dependencies

15:57 fanatico: metaperl: sample http://github.com/weavejester/compojure/blob/master/project.clj

16:00 metaperl: ok, this is what I setup - http://pastie.org/pastes/827785

16:00 but I really should install emacs23, he made it clear earlier versions probably would not work

16:04 fanatico: metaperl: that should work. running this setup on windows is going to be a little error-prone. I don't think any of the devs working on swank run it.

16:04 metaperl: hmm, I suppose I should ssh to my linux box...

16:13 LauJensen: Did everyone see this? :) http://www.rocketboom.com/apple-zoom/

16:15 lpetit: it's *your* Steve Ballmer ! ?

16:17 LauJensen: Yes sir - The girl has got it right, B is for Best In Class :)

16:18 danlarkin: LauJensen: sweet!!

16:19 LauJensen: Yea! :D

16:19 hamza: guys, does lein support chaining tasks such as i can't build my exe before uberjar task is run. so is it possible to make my task depend on other tasks?

16:23 metaperl: I think swank is not calling java with a windows classpath under cygwin.... where does ELPA install swank-clojure?

16:24 fanatico: for me, ~/.emacs.d/elpa/swank-clojure-1.1.0

16:25 technomancy: hamza: sure; tasks are just functions. you can call them easily.

16:26 avarus: hi

16:27 lpetit: LauJensen: she's your girlfriend ? ;-)

16:28 LauJensen: lpetit: Definitely not - I'm married to a very wonderful danish woman :)

16:28 hamza: technomancy: thanks..

16:28 lpetit: LauJensen: no pb, you can answer me in private, it'll not end up in the logs lol

16:29 LauJensen: lpetit: Given the morality of men today, thats not even funny

16:29 avarus: sure men...omg

16:29 :>

16:30 hamza: technomancy: also, is it ok for a plugin to expect user to define a new key in defproject?

16:30 lpetit: LauJensen: sorry, I didn't mean to offense you

16:30 technomancy: hamza: sure, that's quite normal as long as it's clear in docs

16:30 LauJensen: np

16:31 Licenser: is there something like values equivalent to keys?

16:32 rhickey: vals

16:32 Licenser: ah too easy rhickey you tricked me with that :P

16:32 hamza: technomancy: kk thx..

16:33 avarus: can I print something in a (catch Exception _)?

16:34 I've seen examples like (catch Exception _ nil)

16:34 LauJensen: try :)

16:34 avarus: guess it's returning "nil" :P

16:35 aye, my problem is I'm doing it with compojure and I get only 0byte-length output when I do a try catch thing

16:35 in case of an error I'd like to print something :)

16:37 I tried a (catch Exception _ (println "bla")) and it didn't print anything :)

16:38 omg

16:38 I'm sooo dumb

16:38 it never hit the catch :P

16:39 because I check for the existing username earlier with an if :

16:39 :>

16:39 ayayayayaaa

16:41 Licenser: rhickey: it might be a dumb question but what is the reason taht clojure throws java.lang.NullPointerException without any stack trace, is it worth to write a bug report for that?

16:42 stuartsierra: The exception is stored in *e

16:42 avarus: LauJensen: sometimes it simply helps to talk about it :P

16:43 hamza: can i create a new namespace without actually switching to it them use it with with-ns?

16:43 Licenser: stuartsierra: yea *e says: #<CompilerException java.lang.NullPointerException (NO_SOURCE_FILE:0)>

16:44 LauJensen: avarus: True - When you are unable to master your thoughts, verbalizing the problem often adds structure

16:44 Licenser: which is the problem I have a really hard time tracking the problem that causes this

16:44 hiredman: Licenser: do you have a small test case that reproduces the exception

16:44 stuartsierra: That usually happens when you're trying to load a file with a bad ns declaration.

16:44 Licenser: sadly not :( it's my biggest clojure project yet

16:45 and since I don't know where it is it's hard to isolate

16:45 it's kind of a hen egg problem

16:45 avarus: a show stopper

16:45 hiredman: Licenser: well, I think if you work it down to a small test case, you might get someone interested in looking at it

16:46 Licenser: hiredman: Yea I guess so :( it's just so hard to find the bug untill it is fixed :P

16:47 time for more println debugging

16:47 hiredman: the compiler is not throw the NPE, something else is during compilation so it is being wrapped in a compiler exception

16:49 Licenser: hmm?

16:49 hiredman: #<CompilerException java.lang.NullPointerException (NO_SOURCE_FILE:0)>

16:49 that is an NPE wrapped in a compilerexception

16:51 it might actually be a reader exception

16:53 avarus: a show stopper

16:53 oops :)

16:54 Licenser: hmm I try to track it down with println

16:57 hiredman: Licenser: easiest would be println's in the Compiler

16:57 Licenser: in the Compiler o.O

16:57 hiredman: Compiler.java

16:58 Licenser: See if I touch the .java files I start clawing out my eyes :(

16:58 stuartsierra: Compiler Exceptions are almost always reader errors at some level.

16:58 hiredman: well, easiest if you are looking for the root cause, if you are looking for what to start to make a test case with, maybe not

16:59 Licenser: hiredman: yea but I'm not good at Java, I had no idea where to start looking

17:00 hiredman: well, paring it down to clojure code that reproduces is not a bad start either

17:01 konr: What's the clojure equivalent to sub("foo", "bar", "I'm going to the foo")?

17:01 stuartsierra: Licenser: The root cause is probably a syntax error.

17:01 hiredman: .replaceAll

17:01 Licenser: stuartsierra: but why does that show at runtime not at compile time?

17:02 stuartsierra: macros?

17:02 clojurebot: Holy Crap.

17:02 stuartsierra: delayed loading?

17:04 eval?

17:04 clojurebot: eval is evil

17:04 Licenser: no eval, I promise

17:05 stuartsierra: It could still be something that isn't fully evaluated until runtime.

17:05 I guess my point is, it's unlikely that there's a NPE bug in the Clojure compiler.

17:06 It's probably caused by trying to read/compile some bad code.

17:06 You just have to find where.

17:06 Licenser: stuartsierra: *nods*

17:09 arohner: what's the best way to determine whether an object implements a protocol?

17:09 stuartsierra: (doc extends?)

17:09 clojurebot: Excuse me?

17:09 stuartsierra: It's there, really.

17:09 ,(doc extends?)

17:09 clojurebot: Pardon?

17:10 stuartsierra: bah

17:10 arohner: stuartsierra: thanks

17:10 stuartsierra: np

17:13 Licenser: got a test case

17:13 I actally think it IS a bug in clojure

17:13 ,(>= nil nil)

17:13 clojurebot: java.lang.NullPointerException

17:13 hiredman: what else would you expect?

17:13 kotarak: arohner: satisfies?, extends? is only for explicit extension via extend

17:13 stuartsierra: That's not a bug.

17:13 Licenser: hiredman: wait wait

17:13 so far so good

17:13 (defn x [] (>= nil nil)); (x) should give a stack trace right?

17:14 arohner: kotarak: ah, I was wondering why I couldn't get it to work

17:14 Licenser: should say I called (x) and then a NPE was caused

17:14 hiredman: Licenser: I bet it's because >= is inlined

17:15 eyeris: Does S.W.F.WebBrowser use the version of IE that is installed on the system at runtime, or does it represent a specific build of IE? My experiments make it seem like the former, but I get different results from IE8 on this computer and an embedded WebBrowser control in my app.

17:15 arohner: kotarak: (ancestors (class foo)) works fine, except that if I'm in the ns Foo returns a map

17:15 outside the NS, my.ns.Foo returns the class

17:15 Licenser: I'm not sure but I think it's a bug or am I mistaken?

17:15 eyeris: Doh, wrong channel :)

17:16 kotarak: arohner: I'm not sure what you mean, but you should probably use type instead of class.

17:16 stuartsierra: Licenser: I'm hesitant to call it a bug.

17:16 Licenser: well there is a stack I call a function, x, if I def a to call x I still don't get a trace

17:17 stuartsierra: The REPL never prints stack traces.

17:17 hiredman: Licenser: the repl doesn't print full traces

17:17 arohner: run (.printStackTrace *e)

17:17 metaperl: I hope this is just a byte compiler error - http://pastie.org/827968

17:18 Licenser: user> (.printStackTrace *e) => nil

17:18 hiredman: there really is none

17:18 hiredman: Licenser: not reproducable

17:18 arohner: kotarak: if I'm in the ns that defines the protocol named Foo, Foo returns a map

17:18 hiredman: I get a stracktrace here

17:18 Licenser: for me it is, odd

17:18 stuartsierra: I get a stacktrace too.

17:18 arohner: kotarak: outside the ns, my.ns.Foo returns the interface Foo

17:18 Licenser: hmm

17:18 hiredman: actaully (use 'clojure.stacktrace) (e) makes it pretty clear where the problem is

17:19 stuartsierra: Licenser: (.printStackTrace *e) will print to *inferior-lisp*, not the SLIME REPL buffer.

17:19 kotarak: arohner: and the problem is? satisfies? should work anyway, no?

17:19 Licenser: ah sneaky

17:20 stuartsierra: That's what (clojure.stacktrace/e) is for.

17:20 hamza: i have src/leiningen/mytask.clj containing a function called mytask but calling lein doesn't show it also lein help mytask complains that it can not find leiningen/mytask.clj on the classpath?

17:20 arohner: kotarak: oh. satisfies? works great. I missed it when reading your earlier comment. thanks

17:21 Licenser: ahhh sneaky sneaky

17:21 so it's actually a SLIEM problem not a clojure one

17:21 stuartsierra: yes

17:21 The fact that you don't see the stack trace is definitely a SLIME problem.

17:21 Licenser: okay learned something new again

17:22 stuartsierra: Sometimes I test things outside of SLIME for just this reason.

17:23 Licenser: hmm someone knows the SLIME hompage so I can report that bug?

17:23 Google oddly enough turns off blank

17:24 stuartsierra: SLIME doesn't care about Clojure.

17:24 It's written for Common Lisp.

17:24 Licenser: ah found it

17:24 hiredman: swank-clojure

17:24 Licenser: yea just found that homepage :)

17:28 technomancy: Licenser: it's a known bug that some things print to *inf-lisp* when they should go to the repl buffer

17:28 thanks for the thought though. =)

17:28 swank IO is insane.

17:28 Licenser: there we go, reported thank you hiredman & co

17:29 hiredman: are you sure you can't find a real compiler bug?

17:29 that would be fun

17:29 Licenser: technomancy: the problem is not that (.printst.. *e) does not show, the problem is that the exeption window shows no trace at all

17:30 I had a deeply nested function that caused NPE'ed cause of (>= nil nil) and it just told me 'no trace'

17:30 stuartsierra: In nearly 3 years of production use, I've found exactly one bug in the Clojure compiler.

17:30 technomancy: oh, I see

17:31 Licenser: there are so many bugs in swank-clojure that I really wish I had the time to rewrite it from scratch. =\

17:31 stuartsierra: And that was a Java interop issue.

17:31 technomancy: it's a mess.

17:31 Licenser: technomancy: I know the feeling

17:31 * technomancy has found 3 bugs in 1 year

17:31 stuartsierra: ok, 2 bugs now that I think about it

17:32 I'm off

17:32 Licenser: hiredman: I'd love to find a compiler bug :P I'm sorry my bug is just a swank problem

17:32 hiredman: :/

17:32 Licenser: so I'm kind of glad I didn't tried to debug Clojure.java :P that'd had not helped much

17:32 technomancy: still not sure I've convinced rich that direct-binding all vars in namespaces that contain the string "clojure" is a bug. =(

17:32 hiredman: *sigh*

17:35 rhickey: technomancy: it's only namespaces that start with clojure, could easily be stars with clojure., but who is starting with clojure?

17:35 technomancy: rhickey: clojure-http-client and clojuresque do

17:35 rhickey: with no prior segment?

17:36 technomancy: yeah

17:36 it's pretty common

17:36 rhickey: just one segment>

17:36 ?

17:36 hiredman: bleh

17:36 Licenser: so now to fix my actual problem

17:36 hiredman: single segment is a bureport waiting to be filed

17:36 bug report

17:36 rhickey: right

17:37 technomancy: oh hang on; it's not single-segment

17:37 it's clojure.http.client

17:37 just no segment prior to "clojure"

17:37 rhickey: well, who gave them the right to clojure?

17:37 like me calling my ns java.something

17:39 anyone putting anything under clojure that is not part of clojure deserves to break

17:39 technomancy: well there's still the issue of wanting to rebind clojure.test vars

17:40 rhickey: technomancy: we've discussed that

17:40 technomancy: yeah, last time we talked I thought I had a workaround, but the fact that it's done so early means there's really no way to get at it

17:40 rhickey: technomancy: I thought you needed a patch to test so it would officially be dynamic in that area

17:41 dakrone: what repository does leiningen try to pull its dependencies from again?

17:41 hiredman: clojars and build.clojure.org, and maybe the official maven 2 repo?

17:42 dakrone: okay, I'm assuming the official maven 2 repo is http://repo1.maven.org/maven2/ right?

17:42 hiredman: dakrone: http://github.com/technomancy/leiningen/blob/master/src/leiningen/pom.clj#L83

17:42 technomancy: rhickey: well ideally I wanted to be able to experiment with rebinding it to make sure it was useful and worked well before submitting the patch, but I can do that if you don't have any plans for fine-grained direct-binding-control in the near future.

17:42 dakrone: is there a way to suggest jars to be included in the official repo? I'd like to have leiningen get the repos automatically for some dependencies for my project.

17:43 jlilly: technomancy: any chance you plan on opening comments / accepting patches for http://riddell.us/tutorial/clojure/clojure.html ? clojure-contrib now uses maven, not ant.

17:43 dakrone: I'm not sure even who maintains the official maven repo, is it apache?

17:43 abrenk: dakrone: http://maven.apache.org/guides/mini/guide-central-repository-upload.html

17:43 rhickey: technomancy: direct binding is still just an experiment

17:43 * jlilly assumes its you.

17:44 technomancy: jlilly: no, it's not my site. I've had trouble with people getting confused about swank from that site too though; I'd like to see it updated.

17:44 dakrone: abrenk: thanks, drat, looks like you have to be the owner of the project in order to submit it

17:44 technomancy: rhickey: understood. I do think it's a good idea as long as there are workarounds.

17:44 hamza: when multiple functions are send to an agent are they handled in parallel or one after the other?

17:45 jlilly: Its a pretty well done guide, aside from being stale.

17:45 hiredman: hamza: actions sent to the same agent are executed serially

17:46 dakrone: you can push stuff to clojars

17:46 hamza: is that the case even if i send them using send-off?

17:46 dakrone: hiredman: can I push java-dependencies for a clojure project, or is clojars for clojure projects only?

17:47 rhickey: http://www.assembla.com/spaces/clojure/tickets/271-determine-direct-binding-policy-and-controls

17:48 technomancy: rhickey: great; thanks

17:49 seems like using ns-level metadata would work

17:49 since redefining a namespace with ns leaves the old metadata intact

17:50 you could vary-meta to turn off direct binding, then force a reload of the namespace

17:50 but that would require a fix for #130; losing ns-level metadata during AOT

17:50 hiredman: dakrone: you can push any jar

17:51 as long as you have a pom for it

17:51 dakrone: alright, I will attempt to make a pom for this, thanks for the info hiredman

17:54 hiredman: dakrone: generally if you are not the primary source of a project you put upload it to clojars under org.clojars.username/projectname

17:54 dakrone: hiredman: okay

17:54 jlilly: technomancy: I messaged the guy on github. If he responds, I'll mention the other swank-clojure thing is out of date as well.

17:55 hiredman: http://clojars.org/org.clojars.hiredman/fnparse

17:59 clojurebot: ticket #270

17:59 clojurebot: {:url http://tinyurl.com/yaeskfd, :summary "defn-created fns inherit old metadata from the Var they are assigned to", :status :new, :priority :normal, :created-on "2010-02-14T03:05:14Z"}

18:00 hiredman: is that actually a bug?

18:00 oh, I see it was dicussed in the group

18:01 I guess I'd better go read that

18:41 hamza: ,(doc add-watcher)

18:41 clojurebot: "([reference send-type watcher-agent action-fn]); Experimental. Adds a watcher to an agent/atom/var/ref reference. The watcher must be an Agent, and the action a function of the agent's state and one additional arg, the reference. Whenever the reference's state changes, any registered watchers will have their actions sent. send-type must be one of :send or :send-off. The actions will be sent after the reference's state is

18:42 hamza: add-watcher doesn't seem to be in docs is it depricated?

18:44 rhickey: hamza: yes

18:45 use add-watch

18:46 hamza: rhickey: thanks..

19:02 arohner: can I use extend to make my deftype implement an interface, or do I have to do that when I define the deftype initially?

19:09 rhickey: arohner: extend is for protocols only. I can't fix interfaces :)

19:10 arohner: rhickey: thanks

19:11 rhickey: I'm trying to make my deftype implement IFn. I find it annoying to have to specify invoke(), invoke(arg1), invoke(arg2), apply(). It would be nice if I could just give deftype a fn and say "go implement IFn, using f for all calls"

19:12 dsop: urgs backlog is huge

19:14 arohner: I can write a macro, but it's sort of ugly

19:35 konr: Whitespace """code""" generation in clojure: http://pastebin.com/f6366f934

20:20 hamza: is there a way to determine if await will block for an agent or not?

20:23 rhickey: .getQueueCount

20:27 hamza: thanks..

20:28 rhickey: cells in progress: http://gist.github.com/306174

20:47 jperras: rhickey_: cells? (pardon the dumb question)

20:48 fanatico: jperras: http://clojure-log.n01se.net/date/2010-01-22.html#09:22a

20:48 jperras: fanatico: grazi

20:50 fanatico: np.

20:55 hamza: is there a technique that will allow jobs send to an agent to run in parallel (multiple agents underneath?) but still can be able to await for them using master agent?

21:04 slyphon: inside of a genclass impl method, how does one access "this"?

21:10 chouser: slyphon: the first arg to each function is the "this"

21:11 hamza: you might consider using promise/deliver or a CountDownLatch

21:12 slyphon: chouser: oh

21:13 hamza: chouser: will checkout promise/deliver, i would rather use a clojure idiom.

21:14 slyphon: chouser: "state" is basically something that gets associated with an instance of your generated class?

21:14 for keeping track of instance-local state?

21:15 dnolen: so are there any example of what a cells operation would look like? having a hard time making a picture of it in my mind :) I understand the transient persistent! pattern well enough.

21:17 chouser: hamza: using java.util.concurrent classes for workflow is absolutely acceptible.

21:18 slyphon: right, it's the one instance field you get

21:18 slyphon: chouser: how do i access it from my -methods?

21:18 just 'state' ?

21:18 chouser: if (.state this)

21:18 slyphon: ahh

21:19 chouser: assuming you named your state "state" and your this "this" of course. ;-)

21:19 slyphon: hah

21:19 :)

21:21 Drakeson: how can I use a value that is local to the user of a library?

21:26 metaperl: This #^x syntax is being used before it is described.... what is going on here - #^{:x x} [x y 3]

21:30 hiredman: #^ is a reader macro for with-meta

21:30 ,(meta #^{:x 1} [1 2 3])

21:30 clojurebot: {:x 1}

21:31 hiredman: ,(meta (with-meta [1 2 3] {:x 1}))

21:31 clojurebot: {:x 1}

21:34 metaperl: I see.

21:34 Now.

21:34 rhickey_: added some usage: http://gist.github.com/306174

21:34 metaperl: Could someone please show me what to type in the REPL to get the mymax function to execute - http://www.screencast.com/users/metaperl/folders/Jing/media/4d3f39e2-6fa8-40c6-b779-49bd00a42597

21:34 it just returned the list

21:38 wilig: Is there a way to retrieve more then one keys value from a hash? (let [a {:one 1 :two 2}] (a :one :two))

21:38 metaperl: I will ask my question on the enclojure google group

21:39 hiredman: metaperl: a list is a single collection of things, and for a single thing, the mymax function just returns whatever you pass it

21:39 metaperl: oh the [x] x pattern match

21:40 is what fired

21:40 hiredman: clojurebot: destructuring

21:40 clojurebot: destructuring is http://clojure.org/special_forms#let

21:40 hiredman: metaperl: it's not a pattern match

21:40 it is simple arity based dispatch

21:40 dnolen: rhickey_: thx, and wow! so what is the difference between cell/locked-cell. locked-cell can be used safely in a multi-threaded situation and cell can't?

21:40 fanatico: ,(let [a {:one 1 :two 2}] (map a [:one :two]))

21:40 clojurebot: (1 2)

21:40 rhickey_: dnolen: right, locked-cells support multiple threads

21:41 hiredman: ,(let [{:keys [a b]} {:a 1 :b 2}] [a b])

21:41 clojurebot: [1 2]

21:44 metaperl: ok it worked as expected when I simply passed the values as arguments. Is there an advantage to writing functions that dont expect a list when they will be operating on multiple values? Why was the mymax function written so that its args were "inlined" as opposed to provided in a list?

21:47 dnolen: rhickey_: so cell might be useful in divide an conquer scenario where you know which threads will operate on which partitions of a java array?

21:47 slyphon: hrm

21:48 so there's a protected method 'setName' in the class i'm inheriting from, do i need to say :exposes-methods {setName superSetName} then do (defn -setName [this n] (.superSetName this n)) ?

21:48 rhickey_: dnolen: not exactly. different threads could feed a single new value. the cell will make sure they don't step on each other

21:49 dakrone: what's leiningen's supported test framework? Just (test ...) on things? I noticed test-is isn't supported yet

21:49 rhickey_: i.e. maybe a bunch of threads are processing input and building a single map

21:49 slyphon: (bean my-inst) actually shows a :name key, so i guess i could just use that

21:49 metaperl: well, never mind about my question. I'm going to sleep. I got a good start tonight

21:50 * metaperl hits the hay

21:51 dnolen: rhickey_: wait so *both* cell/locked-cell are about serializing mutable access?

21:52 rhickey_: dnolen: sorry - I didn't realize you were trying to distinguish cell from cells in general. cell is just to ensure the access to the transient will occur in only one thread

21:52 wilig: hiredman: perfect, thanks.

21:53 rhickey_: cell also manages the transition to/from transient

22:02 dnolen: rhickey: nice, so this is a general way to deal POJOs (arrays, mutable things from Java libs). Put it in a cell, sit back, enjoy Clojure's sane concurrency support.

22:02 this is -> this is also

22:03 rhickey_: dnolen: it is the first of the constructs that can be extended to POJOs that aren't otherwise persistent. There are still advantages to the persistent/transient pairs, as generating intermediate and terminal values is much less expensive

22:50 lancepantz: anyone know anything about http://github.com/joshua-choi/clojure-yaml/

22:50 trying to figure out if i should use that a java lib for yaml

22:51 kinda surprised there's nothing in clojure-contrib

22:54 slyphon: #<CompilerException java.lang.IllegalArgumentException: No matching field found: state for class clojbot.Clojbot (REPL:14)>

22:54 hrm

22:55 i'm trying to call (.state inst) after creating an instance of my gen-class

22:55 * slyphon has a feeling he's Doing it Wrong

22:55 hiredman: did you tell gen-class to make such a field?

22:56 slyphon: :state state

22:56 lemme do a fresh compile

23:04 ah, there we go

23:10 when you recompile, do existing instances see the new methods?

23:11 wait

23:11 * slyphon "just tries it"

23:12 lancepantz: "Could not find clojure.lang.Compile. Make sure you have it in your classpath" <------ means clojure.jar is not in my classpath, correct?

23:12 slyphon: sounds like it

23:14 lancepantz: what if it is though, anything else that could cause that?

23:16 * slyphon is new here himself

23:16 lancepantz: :)

23:16 this is the stuff i hate about java

23:16 slyphon: heh

23:21 * slyphon looks at the generate-class def and is truly impressed

23:39 durka42: ~def generate-class

23:40 holy crap

23:48 Drakeson: Incanter in clojars seems a bit out of date. Is there a more up-to-date repository for incanter?

23:55 slyphon: so, if the class i'm inheriting from has a protected method setFoo, how do I expose that to consumers of my subclass

23:55 i'm trying :exposes-methods but i'm not having much luck

Logging service provided by n01se.net