#clojure log - Nov 29 2008

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

0:22 ryrunfrnf: is there an autiomatic documentation function for clojure?

0:22 or should i wirte one?

0:32 arohner: ryrunfrnf: what do you mean by automatic documentation?

0:33 the days off are throwing off my schedule

0:33 I keep anticipating breakfast "tomorrow"

0:34 sorry, wrong window

0:42 sdfsf: l

1:12 how do i have a string withint a string?

1:12 hiredman: uh

1:12 speak sense

1:20 sdfsf: "hhello "you fool" there"

1:22 danlei: (println "hhello \"you fool\" there")

1:22 sdfsf: ah nice

1:26 peter_12: join #django

1:41 ryrunfrnf: (re-seq #"(defn [a-zA-Z0-9-]*[\[][a-zA-Z0-9][\]]" "defn")

1:42 anyone good with res?

1:42 i want to match (defn f [a b c]

2:04 hiredman: clojurebot: brain dump is http://clj.thelastcitadel.com/clojurebot

2:04 clojurebot: You don't have to tell me twice.

3:13 hiredman: clojurebot: where are you?

3:13 clojurebot: http://gist.github.com/27733

11:22 emacsen: Clojure study in DC next week

11:23 rhickey: emacsen: cool - how many people do you expect?

11:23 emacsen: rhickey, I have no idea. I suggested it but I somehow got dropped from the list and found out from friends on other lists that it was happening

11:24 somewhere between 4 and 10 maybe?

11:24 no idea really

11:29 it's a spinoff group from FringeDC but I think we'll attract other people from the Java and Ruby community maybe

12:38 mtrimpe: Does anyone know if there's a way to persist the history for refs?

12:39 (where history is all the references the ref has had, so kind of like versioning in a sense)

12:41 arohner: mtrimpe: there's no built in support for that yet

12:42 mtrimpe: arohner: Has there been put some thought into preparing clojure for that? (i.e. are there any obvious roadblocks)

12:42 arohner: I'm not aware of any

12:43 mtrimpe: OK, cool. Is there any persistence available already for objects to start with?

12:43 arohner: I think all it's missing is a 'hook' function. It sounds useful, because I'm not aware of a way to see which value of the ref 'won', in a non-racing way

12:45 mtrimpe: Okay good to know ... and just for a reality check ...

12:46 I'm planning on building a system in Red5 and using clojure as the functional backend to store a versioned history of the important application state and adding a cells like implementation on top of it that builds up the UI, so that you can basically get 'replayable apps' or apps where the interaction is fully versioned.If that's feasible I'd love to put some work into building it ...

12:47 Would that be do-able in Clojure?

12:48 arohner: I don't know what red5 is, but the rest of it sounds doable

12:50 mtrimpe: Cool! That means I'll have some serious clojure exploring to do in the next couple of months. Red5 is an open-source Java based Flash server b.t.w. .. basically meaning I'll be doing it for Flash.

13:30 duck1123_: If I have a list of numbers, what's the best way to get the list of numbers that are missing?

13:30 ie. (1 2 4 5 6 8 9) returns (3 7)

13:31 I tried using difference, but I'm getting errors and don't know what I'm doing wrong.

13:31 lvijay: is your list of numbers always sorted?

13:31 duck1123_: yes

13:31 lvijay: do you know what the lowest and highest bounds are?

13:31 duck1123_: and distinct, no nulls

13:32 lvijay: for example (1 2 4 5) could return (3 6 7 8 9 10)

13:32 kotarak: (reduce disj (into #{} (range 1 10)) [1 2 4 5 6 8 9]) (not tested)

13:32 duck1123_: if there's an easy way to get the last element of a list

13:32 can easily be made a vector

13:34 rhickey_: (clojure.set/difference (set (range 1 11)) (set [1 2 4 5]))

13:35 lvijay: (first (reverse vector))

13:35 kotarak: (first (rseq vector))

13:36 lvijay: right

13:36 reverse is not lazy

13:36 kotarak: thanks

13:36 duck1123_: I'm already consuming the whole seq

13:36 to sort it

13:37 lvijay: you don't need to do it twice

13:37 rseq is constant time

13:37 if you don't want to use rseq

13:37 duck1123_: This is just code to manipulate my data structure into a new format, this won't have to be run again

13:37 lvijay: you can access the last index of the vector

13:38 kotarak: There's also last.

13:38 And for a vector peek.

13:38 lvijay: but last is linear time isn't it?

13:38 kotarak: Yes. peek is not.

13:39 lvijay: ok

13:39 Chouser: last is constant time on vectors, in case that wasn't clear.

13:40 lvijay: the documentation needs to make that more clear then

13:40 (peek coll) For a list or queue, same as first, for a vector, same as, but much more efficient than, last. If the collection is empty, returns nil.

13:40 Chouser: oh! hm, let me double-check my statement then.

13:41 no, I'm completely wrong.

13:42 last is linear time regardless of collection type -- it works strictly on seqs

13:46 that's good to know. thanks! :-)

14:07 Lau_of_DK: Chouser: enjoyed the holidays? :)

14:14 Chouser: Lau_of_DK: still enjoying them, yes!

14:18 * Chouser goes to work off some pie by moving leaves.

14:19 Lau_of_DK: always with the leaves... :)

14:37 rhickey_: big enhancements to gen-class in SVN 1129: http://clojure.org/compilation

14:38 AWizzArd: rhickey_: will that cause changes for your examples in http://clojure.org/compilation ?

14:38 rhickey_: AWizzArd: the examples have been changed there

14:43 AWizzArd: I am just trying to understand how exactly gen-class works. Can you say in one or two sentences what the big enhancements are?

14:45 rhickey_: The big enhancement is that gen-clas can now be called stand-alone, thus one or more named classes can be generated from a single file. These classes can all be implemented in a single namespace if desired. You can now control the mapping to the implementing namespace, whether or not it gets loaded, and the prefix for functions implementing methods

14:45 the small change is that no named class will be created for a ns unless you put at least and empty (:gen-class) directive in ns

14:45 AWizzArd: wow :-)

14:48 Lau_of_DK: Good work rhickey_ :)

14:49 * rhickey_ is staring at Chouser's gen-interface right now, looking to do a similar treatment

14:50 AWizzArd: this is mostly important if someone wants to provide a lib for use in Java?

14:50 Lau_of_DK: rhickey_: consider streaming your desktop and doing a virtual session out of it? :)

14:51 AWizzArd: Lau_of_DK: probably yes, if we pay him a 100mbit upstream connection *g*

14:51 Lau_of_DK: AWizzArd: All Americans have 5x100Mbit lines forged with pure gold

14:51 AWizzArd: duh!

14:51 Lau_of_DK: ...for every pc

14:51 danlarkin: clojurebot: where are you?

14:51 clojurebot: http://gist.github.com/27733

15:02 Chouser: gen-interface got only 4 votes from the 44 responses

15:03 I would never presume, though, to suggest anything about how rhickey_ should be spending his time. :-)

15:03 * Chouser moves more leaves.

15:03 kotarak: Really?

15:04 I'm sure I voted for it.

15:04 It's a nice complement for gen-class.

15:04 considering Java interop

15:05 AWizzArd: This interop with Java is in my opinion the most complex and ugly part about Clojure. I understand that there is no way around it to have something like that, to profit from the rich set of libs in Java.

15:05 rhickey_: Chouser: unfortunately, people will use gen-class rather than gen-interface + proxy, which is the right thing more often than not

15:05 AWizzArd: I just wished that they all were implemented in Clojure, then this level of complexity would simply go away

15:06 rhickey_: what is often the right thing? a) gen-class or b) gen-interface + proxy?

15:06 rhickey_: AWizzArd: b)

15:06 people generally use named concrete classes too often

15:08 AWizzArd: I don't know Java well enough to understand why this is not so good. Is gen-class more complex in usage?

15:09 lisppaste8: A.Nonymous pasted "user defined exceptions" at http://paste.lisp.org/display/71233

15:09 AWizzArd: I thought Interfaces are just not-yet implemented classes, to allow a cleaner substitution for multiple inheritance

15:11 rhickey_: AWizzArd: an interface is just that, an interaction agreement, it specifies no implementation details, and is thus the right thing for both basing actual implementations and defining connections between components

15:15 AWizzArd: rhickey_: in http://clojure.org/compilation you say: ":init functions (-ctor in this case) are unusual, in that ...". But -ctor is now called -init since you updated that page.

15:16 * hoeck likes gen-interface (and voted for it!)

15:16 rhickey_: AWizzArd: fixed - thanks

15:17 AWizzArd: in the java docs about java.util.Iterator I see that this interface also has a remove method. Why don't you have to implement that as well?

15:19 rhickey_: AWizzArd: remove is an optional operation, if you don't support it you need to throw an UnsupportedOperationException, which is what gen-class will generate for an undefined interface method

15:22 AWizzArd: okay, so this means: whenever I see an interface in the javadoc that lists UnsupportedOperation in its "Throws"-list, I can then decide to not implement it. But all other methods that don't list this exception must be implemented. Yes?

15:23 rhickey_: AWizzArd: the JavaDoc says: optional operation

15:24 Tehnically, you only need to implement the methods you know will be called, but then you aren't a proper implementation, under the hood, all the methods are implemented

15:26 AWizzArd: oh okay, so Clojure provides "empty" implementations?

15:26 gnuvince_: rhickey_: does the dash prefix come from the meaning that it's an instance method?

15:26 AWizzArd: or maybe the dash has to do with privacy?

15:26 gnuvince_: AWizzArd: in ObjC, - is used to denote an instance method and + a class method. I think this convention is also present in UML

15:27 kotarak: AWizzArd: defn- is private -foo is method. They are orthogonal.

15:27 rhickey_: gnuvince_: the dash is an arbitrary mechanical way to avoid clashes with Clojure names, else every gen-class involves a name-conflict-resolution session

15:27 AWizzArd: k

15:27 rhickey_: The prefixes are now user-defineable, dash is just the default

15:28 gnuvince_: ok

15:28 rhickey_: so if you generated a bunch of classes in a single file you could give them all unique prefixes

15:28 All subject to macro-fu

15:34 AWizzArd: @Java people: the :constructors argument of gen-class takes a map in which we map the parameter types of our generated class to the ones of the super class. Is this done because in Java a constructor always must call its superclass constructor?

15:35 stuarthalloway: AWizzard: yes

15:36 AWizzArd: so if someone does not do this in Java manually, will javac then a) complain or b) call the constructor under the hood? If b), with what args would that happen then?

15:37 ( b) in Clojure is manually taken care of, because we must provide this. )

15:37 stuarthalloway: AWizzArd: Java does (b) if it can figure out, e.g. a default constructor, or (a) if it can't

15:38 AWizzArd: oki, thx

15:39 stuarthalloway: AWizzArd: "javap -c" is a great way to spelunk around and see what the Java compiler does behind the scenes

15:39 ...or any other to-bytecode compiler, for that matter

15:40 AWizzArd: I see

15:40 stuarthalloway: please look into your /query windows

15:57 would it make more sense to match the position of constructor and superclass constructor in :constructors in gen-class and in the vector that -init returns?

15:58 Right now it is :constructors {[subclass] [superclass]} and (defn -init [x] [[superclass constructor] [state of this class]])

16:00 rhickey_: AWizzArd: people are used to constructing their superclass before setting up their own state

16:00 the constructors map isn't really related

16:00 AWizzArd: I see

16:32 moreqwertythanu: im the qwertiest!

16:34 Lau_of_DK: hehe

16:47 AWizzArd: rhickey_: again about your http://clojure.org/compilation example at the bottom. You said :state state and later in -hasNext and -next you use it via (.state this). Why is this .state method needed? Wouldn't it be easier to simply have state available in all the methods?

16:49 rhickey_: AWizzArd: state is a field of the object, it is available, via .state

16:49 AWizzArd: so in reality this is the only field of the class that clojure generates. And into that we can put for example a clojure hashmap inside which we have the real fields that we want to use.

16:50 (in your example :s and :index)

16:51 But why has it to be this way? Is there any use for "state" itself after having mentioned it in gen-class? Or will it in all cases be only called in combination with this, as in (.state this)?

16:52 rhickey_: AWizzArd: he functions that implement the methods really have no connection to the objects, they are real fns, not methods

16:53 AWizzArd: Hmm, so is it not possible to simply make "state" available in all the methods magically? @state vs @(.state this)

16:54 rhickey_: no, it's an indirection that allows for a lot of flexibility. For instance, you could have a single fn handle methods for multiple classes, a multimethod as a method handler etc.

16:55 AWizzArd: okay, sounds plausible

16:56 Lau_of_DK: Is there being put any serious work into an sql wrapper for Clojure?

16:57 AWizzArd: Lau_of_DK: is the one from contrib not good enough?

16:57 Lau_of_DK: AWizzArd: it seems half-baked, at least last I looked at it

16:58 AWizzArd: Do you have an example of what is missing there? I haven't looked at it in great detail.

16:58 Lau_of_DK: Then take a look, you'll see

16:59 OrOr let me get back to you on that one, I'll check it out myself, was just poking for alternatives

16:59 AWizzArd: Maybe you remember a specific example? Transactions and prepared statements seem to be in there.

17:24 for (let [{a "ja" b "nein"} {:x 4 "ja" 8}] (println a b)) I expeted that 8 nil will be printed.

17:25 This is the case. But for (let [{a "ja" b "nein" :or {"nein" "doch"}} {:x 4 "ja" 8}] (println a b)) I expected to see 8 doch. But I still got 8 nil. Why is that?

17:26 Chouser: try :or {b "doch"}

17:27 AWizzArd: Okay, I see

17:28 rhickey_: SVN 1130 adds gen-interface to AOT

17:28 AWizzArd: so fast!

17:29 How many hours do you sleep per day? ;-)

17:30 rhickey_: sleep?

17:30 Lau_of_DK: haha

17:30 danlarkin: sleep doesn't help cultivate mad scientist hair

17:31 kotarak: http://en.wikipedia.org/wiki/Sleep

17:32 Lau_of_DK: rhickey_: I have a sincere question. Besides the head-knowledge that youve accumulated, the years of experience in various language and denying sleep. How do you cultivate the type of insight that you have into programming? I mean, there a people who have more experience than you in various languages, yet they never produce anything that comes close to Clojure. How do you hone that quality in you?

17:35 rhickey_: Lau_of_DK: that's very flattering but I'm really just a regular programmer

17:36 kotarak: rhickey_: you are more of an engineer: practical solutions for practical problems. Take what's good and improve it. If that means to leave the lisp weenies behind ("iihhh, what's this [] in the syntax"), then so be it if you get a better result.

17:37 (Just an example. Nothing agains lisp weenies.)

17:37 (Could as well be lock weenies or whatever)

17:37 AWizzArd: I honestly don't understand what some Lispers have against [] and {}

17:38 Lau_of_DK: rhickey_: I wasnt trying to flatter, Im just trying to develop my own abilities. But if you dont see it that way, I cant convince you that youre a genius, but you can report back here once you come to that conlusion, well pick up the topic again :)

17:39 gnuvince_: Lau_of_DK: "just say no"

17:40 Lau_of_DK: gnuvince_: not understood

17:40 gnuvince_: Lau_of_DK: no to extra features of limited use, no to bloat, etc.

17:41 Lau_of_DK: gnuvince_: not related to expanding your mental capacity without the use of drugs

17:41 rhickey_: http://clojure.org/compilation updated with gen-interface usage

17:41 gnuvince_: If there's one thing I learned since I started using Clojure is that a lot of things people have asked for have not gone in, and Rich has usually provided a good, technical reason why instead of just "because I said so!"

17:43 Lau_of_DK: user> (import '(this.doesnt.exist))

17:43 nil


17:43 Why is this failing silently ?

17:46 hiredman: it is not failing

17:46 you are importing nothing from nothing

17:46 failure is impossible

17:47 Lau_of_DK: I want a Does Not Exist error, so that I dont get any surprises later

17:47 hiredman: then import something from nothing

17:47 (import '(foo.bar baz))

17:48 AWizzArd: is also * allowed in the place of baz?

17:48 kotarak: no

17:48 AWizzArd: I think in Java one can use it.. import java.util.*;

17:49 kotarak: yes. But not in Clojure.

17:49 walters: should avoid it in Java too - an IDE will manage your imports for you

17:49 AWizzArd: is there a good way to import all classes from a package?

17:50 hiredman: sometimes clojure seems like a completely different language than java

17:50 :)

17:50 AWizzArd: I am not a java guy and don't know if it makes sense to import everything. I just assume it does, as Java supports this * thingy.

17:51 hiredman: * is just for when you are lazy and sloppy

17:55 Lau_of_DK: clojurebot: * is just for when you are lazy and sloppy

17:55 clojurebot: You don't have to tell me twice.

17:56 kotarak: Clojure is similar: (use 'some.namespace) vs. (use '[some.namespace :only (foo)])

17:58 AWizzArd: is there a way to get a list of all classes of a specific package?

17:59 In that case one would have a semi easy way to import everything from a package

18:01 notallama: why do you need to import everything?

18:01 hiredman: rhickey_: what do you think about putting something like (show ...) in core?

18:01 notallama: is it because you're using everything?

18:02 AWizzArd: notallama: I don't need it and as I said a few moments before, I don't even know if that makes sense when working with java classes. But if it really makes no sense, why does java then support it?

18:03 Lau_of_DK: AWizzArd: (import '(javax.swing *)) would certainly make a few programs more concise, you quickly use almost all the components anyway

18:04 dudleyf: AWizzArd: It's not that it makes no sense, it's just that it's usually better to be explicit about what you're using

18:04 AWizzArd: So it typically is a source of problems when people import *?

18:06 dudleyf: If you're importing from several different packages, it can get confusing as to where a particular class came from

18:06 But it's more of a style thing, I think

18:07 AWizzArd: Is there something like (.listAllClassesInPackage "javax.swing")?

18:08 walters: nope

18:08 would be nice, but basically class loading is lazy

19:30 moreqwertythanu: anyone can recommend specific EWDs?

19:30 (edsger dijsktars notes)

19:35 hoeck: moreqwertythanu: "Elegance is not a dispensable luxury but a factor that decides between success and failure."

19:37 timjr: I'm trying to understand the odd behavior (read-line) gives me at the slime repl... it doesn't end up reading the next line of input that I type

19:38 if I hop over to the *inferior-lisp* buffer and send some input, then eventually one of the lines of input gets picked up by read-line

19:39 I haven't understood that yet. But I noticed that (. *in* read) behaves oddly, slime or no slime... I supposed because the readers buffer up some extra stuff, and *in* is not the same reader as the one the repl uses

20:30 Chouser: rhickey: I'd be interested in hearing, sometime, your rationale for getting rid of the dynamic class generation stuff (gen-and-load-class, gen-and-load-interface)

20:41 heath: Quick question: is (find) supposed to function as a predicate?

20:42 Chouser: it returns nil if the key is not found, so that could be used as false in a boolean context.

20:43 heath: It definitely works, I'm just wondering if it's idiomatic...

20:43 Chouser: can you show how you're using it? If you're just using it as a predicate, you can probably use the map itself instead.

20:45 heath: I have a list of legal characters, and I need to test if an argument is legal by seeing if it's among them

20:46 rhickey: Chouser: the basic problem with dynamic class generation is that classes are static, i.e. they can't be changed and reloaded. Another reason is that most usage of dynamic things in that area, say, add-classpath, are due to laziness, and yield a system that is unnecessarily dynamic as regards static things, with much ensuing classloader grief

20:46 proxy is still there, and is ideal in that it doesn't promise any specific classname

20:47 Chouser: rhickey: I like proxy a lot. it is different from gen-class both in its lack of given classname as well as its inability to add methods.

20:47 rhickey: dynamically loaded classes must be loaded from a custom classloader, which creates all kinds of difficulties in certain hosting environments

20:48 heath: Chouser: I can see you're in the middle of a heavy discussion, so no worries about my question :) I'll just profile it

20:48 Chouser: heath: (:a {:a 1 :b 2})

20:48 rhickey: so people dynamically load classes and complain they can't see them from classloaders not related, especially the system loader

20:49 abrooks: rhickey: Perhaps this can be done with proxy but the only way I know to use JNA is gen-and-load-class and gen-and-load-interface.

20:49 heath: Chouser: Thanks!

20:49 rhickey: I also think that adding methods not present in an interface is bad design

20:49 generally

20:49 people should program to interfaces

20:50 I like how gen-interface has worked out and hope people use it + proxy a lot

20:50 abrooks: are you saying there's no way to use the new gen-class for JNA?

20:51 abrooks: rhickey: This is quite possibly my horribly shallow Java knowledge showing but I wasn't able (at the time) to get gen-class working for this: http://groups.google.com/group/clojure/browse_thread/thread/77e626c5440bf1a0

20:52 holmak: I have a question regarding agents when you folks have a minute: http://paste2.org/p/108746

20:52 (await ...) is throwing a "Exception in thread "main" java.lang.Exception: Can't await in agent action (incr-agent.clj:0)"

20:53 My (poor) understanding of agents is that you await after sending to block until all the sends are applied?

20:56 abrooks: rhickey: I'll look into this later -- it's been a long time since I touched JNA calling and all the proxy / class loading has changed since then. I'll post to the group if I can't get some workable solution with the mechanisms that are already there.

20:56 rhickey: abrooks: I don't see a reason it wouldn't work, but would require AOT compilation

20:56 abrooks: ... log time apparently being two months ago... ;-)

20:56 ^log^long

21:00 holmak: I understand that (await ...) can't be used within an agent action, but why is it throwing an exception in top-level code, there?

21:00 rhickey: Chouser: so my biggest reservation is the potential for abuse - I can see valid dynamic use cases but can't prevent misguided ones, yet have to support them. The code for gen-and-load-class (in the new model) is sitting there

21:03 Chouser: rhickey: hm, ok.

21:04 rhickey: holmak: don't call your agent *agent* - didn't you get an error about that?

21:04 holmak: I did not -- I didn't know that was bad.

21:04 rhickey: holmak: I got: java.lang.Exception: Name conflict, can't def *agent* because namespace: user refers to:#'clojure.core/*agent

21:05 lvijay: holmak: your code is fine except for the *agent* special variable conflict and old dotimes syntax

21:08 holmak: I may actually be using an incredibly outdated build...

21:10 lvijay: rhickey: is there a way to find out which version of clojure you're currently on from, say, the repl?

21:10 Chouser: lvijay: no

21:10 lvijay: ok

21:11 any plans to add one?

21:12 Chouser: lvijay: it has been discussed on a couple occasions on the google group, with all sort of problems dug up and few clear paths forward.

21:12 perhaps for the official releases beginning with 1.0, but it's hard to say.

21:13 rhickey: svn info

21:13 Chouser: rhickey: that works unless they downloaded an actual release .zip, right?

21:14 rhickey: the releases have dates as names

21:14 lvijay: java and common lisp provide ways to find out the version so my question. what were the problems? a link to the discussion would suffice

21:14 Chouser: is there any indication in the dir unpacked from the .zip?

21:14 lvijay: the zip name has the date

21:15 rhickey: Chouser: no, just that there are that many releases, and the files have dates...

21:15 aren't

21:15 * Chouser nods

21:18 holmak: rhickey: I'm definitely not getting an exception from having "(def *agent* (agent nil))".

21:18 But doing things the right way works, so, thanks for the help.

21:21 Chouser: lvijay: http://groups.google.com/group/clojure/browse_thread/thread/1ae7eae292765d40/f0843d43ba678d7e and http://groups.google.com/group/clojure/browse_thread/thread/9fa07b00c88280fc/9feb32c95acbaef9

21:21 lisppaste8: rhickey pasted "jnatest via AOT/gen-interface" at http://paste.lisp.org/display/71245

21:22 rhickey: abrooks: that works fine ^^

21:22 lvijay: Chouser: thanks.

21:27 rhickey: abrooks: once: (compile 'clojure.examples.jnatest) ;will run when compiled due to top-level commands

21:27 abrooks: from then on: (load "/clojure/examples/jnatest")

21:27 runs like a script

21:28 Chouser: it just seems such a shame to require a compilation pass. I suppose someone could make a jna-clojure lib that requires the dynamic classloader and does the class gen, loading, and passing off to jna.

21:29 rhickey: Chouser: I agree for a one-off, but otherwise people build the gen-and-load-class calls into their app and it grows and then they wonder why they can't see the classes everywhere

21:30 same thing happens with add-classpath, it has valid use at repl, but...

21:31 I like the dynamic capabilities too, I just have to think of appropriate warning labels, but correct usage in these areas requires more Java savvy than a lot of users have at present

21:32 Chouser: ok, I guess I'm finally with you. If the JVM were different such that this kind of dynamic behavior could be fully supported, that would be one thing. But since it is what it is, trying to pretend it can be as dynamic as gen-and-load requires just leads to confusion.

21:32 rhickey: Chouser: it's also so easy to build a single file now that gens a bunch of stuff - wouldn't you just wrap a lib once and treat the wrapper as a lib?

21:34 Chouser: that's why I built in the indirections, so the implementations could still be dynamic, and they are very much so

21:38 Chouser: sure. it's about as good as we can get on the JVM right now. The dynamism of clojure functions, namespaces, and even getting it into some class methods is impressive.

21:40 I guess requiring occasional recompiles and re-runs of your app in order to add new class definitions or JNA/native-lib wrappers is just a cost of the JVM.

21:41 though I suppose you can write up a new file and namespace, and then compile and load it dynamically.

21:50 MarkVolkmann: I want to print all the items in a collection on separate lines. Why doesn't this work? (map println [1 2 3])

21:51 Chouser: it does, except that map is lazy, so you get extra nils mixed in

21:51 try: (doseq [x [1 2 3]] (println x))

21:54 MarkVolkmann: Ah, much better. Thanks!

21:54 Chouser: you're welcom

21:55 e

22:02 MarkVolkmann: If you accidently output an infinite sequence in a REPL, is there a way to stop it without killing the REPL?

22:02 Chouser: not that I know of.

22:03 but you might choose to set *print-length* in the future to avoid such situations.

22:14 MarkVolkmann: Is there an initialization file that the REPL automatically reads or do I need to modify my script that starts the REPL to specify the file path using --init?

22:15 Chouser: there is user.clj but that happens too early for *print-length*

22:16 I start clojure with ~/.clojurerc.clj on the command line before whatever .clj I'm actually loading.

22:16 MarkVolkmann: Okay. I'll modify my script to do that.

22:18 Chouser: that's where I set *print-length* and also defn 'show'

22:20 MarkVolkmann: What is defn show?

22:22 Chouser: MarkVolkmann: http://groups.google.com/group/clojure/msg/96ed91f823305f02

22:24 MarkVolkmann: Thanks! I'll give that a try.

22:37 Seems like I'm tripping over things that should be easy.

22:37 I created this lazy sequence ... (def my-seq (iterate inc 0))

22:37 Why doesn't this produce any output?

22:38 (doseq [x (take 5 my-seq)] println x)

22:38 rhickey: MarkVolkmann: (println x)

22:39 MarkVolkmann: Thanks ... and sorry for the noise ... silly mistake.

23:45 timjr: I used proxy to implement an interface that has a few different methods called "read" in it. I only want to override one of the read methods, but it seems as though the proxy class overrides them all. Is that the case? Is there a way to specify which one to override?

Logging service provided by n01se.net