#clojure log - Oct 14 2008

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

1:58 Lau_of_DK: Morning gents

2:06 hoeck: good morning Lau

2:09 l_a_m: http://www.pragprog.com/titles/shcloj/programming-clojure <-- interesting ...

2:11 Lau_of_DK: Who is Stuart Halloway?

2:15 blabber: l_a_m: :-)

2:55 Lau_of_DK: hoeck, do you work across the street from you house? :)

2:57 hoeck: Lau_of_DK: haha, no, a couple of more streets are involved when heading to work

3:03 Lau_of_DK: Ok, it was just like Hoeck quit (going to work) (2 minz later) Hoack joined #clojure

3:03 Anyway, welcome back :)

3:08 hoeck: Lau_of_DK: ah, so erc delayed my quit command, it was actually a 20 minute commute, though i would prefer a 2 min ride :)

7:17 Lau_of_DK: rhickey, have you begun work on consolidating all the pages of the documentation found on clojure.com in something thats more usuable. Maybe along the lines of a windows help file or something like that?

7:23 emacsen: Lau_of_DK, A windows help file?

7:24 Not "an info manual" but a Windows help file?

7:24 cads: lau that was terrible

7:31 jdz: what is an info manual? is there a reader for winblows? is there any other OS than winblows? you must be joking.

7:32 Java runs everywher. on every winblows out there! :)

7:32 hoeck: beeing a windows user at work (and only there), helpfiles are not that bad, especially for fast api-call lookup, way better than big online helpsites like msdn

7:34 cads: I think a nice interactive html file would be... nice

7:35 emacsen: jdz It's the native GNU help format

7:35 jdz infotex produces them, and html

7:35 and why am I talking to no one?

7:36 cemerick: info files are pretty useless for anyone who's not a serious unix/emacs user

7:36 Guest85485: html is a good lowest common denominator imho.

7:37 cemerick: the current set of docs are pretty healthy, IMO. Some greasemonkey applied to the API page would be nice; I keep meaning to throw something together there.

7:39 hoeck: I'm pretty satisfied with doc and find-doc, docstring documentation is way better than with opensource cl's

7:39 emacsen: cemerick, so? ;)

7:39 cads: how simple is it to use clojure code from within java?

7:40 hoeck: I think, rhickey has done a very good job by documenting _every_ single boot.clj function plus all the ones in proxy and set

7:41 cemerick: cads: it's pretty straightforward; IIRC, use Var.find to get a handle to the var that holds whatever function you want to invoke (or value you want to access), and then .invoke or .get it as appropriate.

7:41 cads: I have been playing with a java hosted ruby interpreter, and inside the jruby, java actually feels a lot friendlier... and now I have the crazy idea of making use of clojure facilities from inside ruby

7:42 cemerick: cads: yeah, that's sorta crazy, but certainly doable :-)

9:07 rhickey: AOT compilation would definitely prefer one-file-per-namespace

9:07 thoughts?

9:12 tWip: why is that? would AOT turn each namespace to its own class?

9:17 rhickey: tWip: yes

9:19 tWip: but the compiler could find all definitions made in a namespace, even from multiple files?

9:20 or is that for clarity, to have one file for namespace

9:20 cemerick: rhickey: in principle, that's fine by me. Couple of things: (a) that impacts how genclass currently works quite a bit; would genclass' impl change significantly, or would AOT supercede genclass, or...? (b) I think having a way to specify how a namespace is composed would make the file/namespace relationship trivial to control (or, in the AOT case, unify)

9:25 abrooks: rhickey: Am I understanding correctly that the one-file-per-ns is on the AOT creation side and not a restriction on Clojure source files or is it a restiction of one namespace per Clojure source file, too?

9:26 rhickey: abrooks: on the Clojure source side - on the gen side there are hundreds of class files

9:27 anyone with 1068 can look in the gen directory

9:27 abrooks: Ah, right. Each fn is a function.

9:28 rhickey: Would the namespace restriction be enforced all the time or only at AOT compile?

9:28 rhickey: multiple files might be possible, but there would have to be stricter "include" semantics vs random load-files

9:28 abrooks: I'd like very much for there to be one set of rules for both AOT and not

9:28 abrooks: Good.

9:29 tWip: would an AOT compiled clojure code when used runtime from the REPL behave "normally"?

9:29 abrooks: How about the Repl? Is that considered a single file? It seems that switching namspaces there is important.

9:29 tWip: other than not being able to add definitions to it

9:29 cemerick: Given how solid lib/use etc is in the latest builds, arbitrary file loading is definitely the ugly stepsister.

9:29 rhickey: tWip: try 1068 - all code goes via the disk and normal classloader except proxy/genclass

9:30 tWip: ok, I'll check that out

9:30 rhickey: AOT does not mean non-dynamic - it would just be that pre-compiled code could be loaded vs source - after that all dynamic capabilities apply

9:31 it's not a closed module system, nor a static one-time-def system

9:33 abrooks: to as great an extent as possible, compiling a file will yield a bunch of classfiles, one of which would be the Module class for the namespace. It would have a static load() method that when run should cause the same set of actions to occur as would loading the original file, except fn defs would also be loaded from classfiles rather than compiled on load

9:33 Module class will also have a main() method that will call the main fn in the ns if there is one

9:35 cemerick: still need to work through the genclass story, it should only become easier

9:36 cemerick: rhickey: Sure. I'd suspect that genclass would roughly become obsolete, at least for a large portion of its common use-cases.

9:37 rhickey: cemerick: If I make it possible to cause more fns to become static methods, yeah, although genclass will still be needed to create instantiable object classes

9:38 AOT-ing genclass and proxy are interesting, as then only apps that truly do dynamic runtime code gen (few) will need the compiler/classloader at runtime

9:39 Opens possibility of ASM and Compiler-free delivery, substantially smaller runtime footprint, for phones say

9:46 cemerick: rhickey: are you still looking at generating source, or are you going straight to bytecode? (Sorry, I'm in no shape to follow head at the moment...)

9:46 rhickey: straight to bytecode

9:53 cemerick: rhickey: Sounds delightful; hopefully I'll be able to dig in after I get my head above water again. Are you hoping to have AOT done before you label a build as "1.0"?

9:54 rhickey: cemerick: yes

9:55 here's my idea for release numbers - first release of first year: 0.0, second 0.1 - I've missed all of these

9:56 first release of second year, 1.0, second 1.1 etc, third year, 2.0 etc

9:56 so the first release after this Thursday will be 1.0

9:57 I will try to stabilize AOT and all prior features for that release

9:58 cemerick: I'll try to make sure we test the snot out of the AOT for you. :-)

9:58 The release numbering strikes me as a little odd -- such a scheme would make it likely that major features would be introduced in "minor" releases.

9:59 (unless you intentionally hold back features until late fall each year)

9:59 rhickey: personally I think major/minor numbering is usually meaningless, mostly based on vendors wanting you to pay again

10:00 at least these numbers mean something objective nth release in year m

10:00 Guest85485: what about release numbering based on promised compatibility?

10:01 rhickey: Guest85485: again, rarely so clear

10:03 karmazilla: I don't follow why that ain't clear... code written for 1.1 is promised to work in 1.2?

10:03 but not so for 1.x and 2.x

10:03 rhickey: a release could contain a relatively small but breaking change and nothing else, doesn't justify major rev really

10:03 cemerick: rhickey: There's built-in expectations about "major" releases, though; even aside from the concerns of a commercial vendor, the "technology press" (into which I'll lump in proggit et al.) always gets more jazzed by X.0 releases than X.Y releases. That will only matter more and more as Clojure usage grows, ecosystems coalesce, etc.

10:04 rhickey: cemerick: so they'll get jazzed once a year! :)

10:05 cemerick: rhickey: LOL I needed that :-)

10:05 leafw: worked well for ubuntu

10:05 tWip: do people really expect to change versions of important infastructure parts without retesting everything?

10:05 rhickey: Being a Lisp, there aren't the same kinds of semantics/syntax breaking changes there are in other languages when they need to add features. If I add a macro to boot.clj, it's no big deal

10:06 tWip: I've had micro version updates break things badly in open source libs.

10:07 rhickey: most changes in Clojure are simple enhancements, if you don't use them, you don't care, breaking changes will get rarer

10:08 and just as easy to doc between 1.1 and 1.2 as between 1.1 and a forced-because-breaking 2.0

10:09 Clojure is substantially less monolithic than most software/libs

10:10 cemerick: we've only hit one breaking change in our time using Clojure -- the move to integrate lib into the core -- so I doubt that's much of a concern in the days ahead

10:11 cads: morning rhickey

10:11 rhickey: cemerick: that's a story that needs to be told more - people see the enhancements and presume instability...

10:11 cads: hi

10:13 cemerick: I really don't know what to do vis a vis evangelism. In a private setting, it's not a problem, but a good portion of our customers would absolutely lose their minds if they knew what was running under the hood.

10:13 rhickey: cemerick: fair enough

10:13 danlarkin: cemerick: ha!

10:14 cemerick: rhickey: no, actually, it sorta sucks :-/

10:15 Presumably, once we get to a certain degree of critical mass on a couple of key measures, we can start testifying, but there's a lot of unknown risk before that day comes.

10:15 rhickey: cemerick: eventually it won't, I certainly appreciate everyone who's investing their own effort in learning and using Clojure in these early days

10:18 blabber: Rich in his video on datastructure talks about 'manipulating' data structures, but how is that possible when they're immutable?

10:22 rhickey: blabber: unfortunately there isn't a good word for 'efficiently making new changed versions', so I say "change" and make quotation mark signs with my fingers

10:22 suggestions welcome

10:24 cemerick: one other 1.0 issue is getting in any known, pending, community-welcome breaking changes like Chouser's regex mods and the unification of binding syntax (deoseq et al taking vectors of bindings)

10:24 blabber: rhickey: you say 'manipulate' as well, which has made me pause the video :-) so you mean making new changed versions right

10:25 rhickey: blabber: yes, that's about all you can do other than read from them

10:25 blabber: rhickey: thanks

10:28 cemerick: rhickey: sounds good

10:29 we coincidentally had some discussions around prolog here last week, although it looks like we'll be rolling our own logic framework, due to some unique requirements

10:31 rhickey: interesting

10:31 cads: is there any source hosting place for people to put their clojure projects and share with the community?

10:32 Chouser: cads: nothing clojure specific, other than clojure-contrib, but I see a lot of people using github

10:33 cemerick: cads: people have pushed clojure files up into the google group. Other than that, there's some stuff in the clojure-contrib area of sourceforge, and others have been creating projects in github.

10:33 * cemerick should look at the irc log before hitting 'return' :-P

10:36 blabber: all: are there clojure performance stats anywhere online?

10:36 cads: hah, zcode; a Z-Code interactive fiction interpreter written in clojure

11:01 scgilardi: re: one-file-per-namespace, I think it's a significant convenience to allow a namespace's definition to span multiple clojure source files. Making the mechanism to allow that something other than "load (a random file)" sounds good to me.

11:07 danlarkin: git-gc is annihilating my computer right now

11:07 scgilardi: re: binding-form unificaiton, I like it. I wonder if every place we use bindings has a clear meaning when multiple things are bound. Would doseq run all the sequences in parallel and some new dofor run through sequence N for each member of sequence N-1?

11:07 karmazilla: danlarkin: been a while since you ran it last?

11:09 danlarkin: karmazilla: I wait until it prompts me :-D

11:09 karmazilla: it does prompting?

11:10 danlarkin: yeah "new in 1.6"

11:10 karmazilla: ah, don't think I've upgraded yet

11:11 rhickey: scgilardi: multi-binding doseq would behave like imperative for

11:12 Chouser: what about scgilardi's tidy little patch for destructuring in binding -- I don't think you've commented on that yet.

11:14 rhickey: Chouser: I'm still on the fence about destructuring in binding - people are confused enough about dynamic vars, but it is essentially different in not introducing new names into scope

11:15 Chouser: hm! ok.

11:19 scgilardi: rhickey: that essential difference is present whether or not binding does destructuring. I see destructuring as more related to providing values for the names rather than introducing them.

11:20 rhickey: scgilardi: but it does both in the other places it is used

11:39 abrooks: rhickey: FWIW, I was confused when I discovered that binding didn't destructure. I don't think destructuring adds confusion to var binding. I also think that the utility quickly outstrips any possible detriment. How many times is one confused by vars vs. how many times can you keep using a useful mechanism like destructuring. Catering to the newbie vs. empowering the established user is Microsoft's error. Someone's only a ...

11:39 ... neophyte for a short time.

11:40 rhickey: Egads. That looks like a rant but it's not. I'm feeling a bit overly verbose today, apparently.

11:44 rhickey: let-bindings is only a macro away...

11:51 anyway, I hear you (all) and will revisit my misgivings :)

11:54 Chouser: anyone read Cringley? He's talking about Clojure, and doesn't even know it.

11:54 http://www.pbs.org/cringely/pulpit/2008/pulpit_20081013_005498.html

11:54 scgilardi: rhickey: sounds good, thanks! I've been looking through classfiles in gen. Pretty cool to see them all layed out there. :)

11:55 leafw: Chouser: STM, but that is not unique to Clojure

11:55 Chouser: leafw: true

11:56 djpowell: Just wondering, will AOT clojure be able to run under a security manager? just thinking applets and stuff.

11:58 Chouser: djpowell: I wouls assume so. Rich said something about the regular classloader.

12:06 djpowell: cool - I've found doing GUI stuff in clojure to be quite fun, thanks to being able to redef functions without restarting the app. I've been writing a rubbish platform game to experiment with things.

12:10 asbjxrn: Howdy

12:11 Got a question about jars and manifests. I'm trying to package my app as described in the "Packaging APP" thread in the group.

12:12 But I need to include a library. I changed the class path in the manifest to "jar/clojure.jar lib" and put my lib in there. But clojure fails to find the lib.

12:14 Anyone around that know what I might have missed?

12:14 Chouser: I know nothing. But multiple items in a classpath are usually separated by : aren't they?

12:15 asbjxrn: Not in the manifest file I think, because they are urls... http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html

12:15 Chouser: ah, ok. see, I know nothing. :-)

12:15 sorry

12:15 asbjxrn: Hmm. that is maybe a old page to look at, but I would think that hasn't changed.

12:16 Well. My first attempt was with :

12:25 found the problem, the dir name needs to end with / so classpath is "jar/clojure.jar lib/"

12:50 cads: what is a good java framework that I might use with clojure to implement a light distributed application that could, for example, take advantage of the computers on my home network to compute some embarrassingly parallel function?

12:52 so something that would use minimal interprocess communication, but kind of wrap the details of setting up communications protocols, sockets, routing, and all those other unhappy details

12:54 danlarkin: hadoop?

12:55 cemerick: hadoop, shoal, and terracotta all hit different sweet spots

12:55 cads: hadoop seems pretty sweet

12:57 .. now I want to compute a few terabytes of pi digits

12:58 cemerick: cads: Ah, yeah, hadoop is ideally suited for stuff like that.

12:58 abrooks: cads: Using BBP?

12:59 cads: most likely :)

13:01 abrooks: Are there any other arbitrary digit extration formula for Pi? BBP is the only one I'm aware of (and likewise the only one I know that distributes Pi computation).

13:02 Well.. I should say distributes Pi linearly. All the others still have summation that spills across a range of digits.

13:09 cads: I think there have been a few improvements to the spigot algorithms (and that's what you'd use if you wanted to do naive parallelism)

13:09 but there are others that are more efficient

13:10 abrooks: I just came across Bellard's formula (a BBP variant) which I had apparently come across before.

13:11 cads: stuff like bpp gets really intensive for higher digits, so one would have to paralellize the computation for each digit too, eventually

13:13 lisppaste8: drewr pasted "REPL don't start" at http://paste.lisp.org/display/68508

13:13 drewr: Is that expected with the work that rhickey is doing right now?

13:14 rhickey: drewr: put ./gen in your classpath

13:14 drewr: rhickey: Thanks!

13:23 cads: abrooks: most other pi calculating efforts have been done in c. Do you think computing power has come far enough that you'd win by using java for a distributed project like pi simply because of platform independence?

13:26 the record breaking project that calculated the quadrillionth digit of pi (it was a 0) was a windows app written in c

13:30 Lau_of_DK: Evening gents

13:31 danlarkin: Lau_of_DK: afternoon

13:31 Lau_of_DK: rhickey, did you have any thoughts on my request for some improved consolidated documentation from earlier today?

13:32 abrooks: cads: No... but I'm not intending to do any Pi calculations in Clojure either. :)

13:49 sidewinder128: clojure is a lisp 1 so is similar to scheme?

13:50 Lau_of_DK: its a lisp-1. You can see some of the difference on the wiki, if I remember correctly

13:51 http://en.wikibooks.org/wiki/Clojure_Programming#Clojure_for_Scheme_Programmers

13:53 sidewinder128: thanks

14:06 blabber: wanted to know, are clojure datastructures built over java primitives?

14:07 Chouser: clojure data structures are primarily built of classes and arrays

14:07 and bitfields

14:10 kotarak: Chouser, hi, sorry had to leave on Sunday, did find out what the problem was with gen-interface/proxy/import?

14:22 Chouser: kotarak: yep

14:23 gen-interface doesn't make any constructors, so you can't use proxy.

14:23 but you can use gen-class to create something that implements a gen-interface'd Interface, and it seems to work fine.

14:25 Lau_of_DK: Is ther a better way to trace the steps of a function than inserting printlns? (I realise this is a dumb question if the answer is yes :) )

14:26 Chouser: I spend a lot of time these days doing that in a JavaScript debugger. But that's probably not a good general solution. ;-)

14:26 Lau_of_DK: Doesn't feel very efficient to say the least :)

14:26 oh way... debug macro.. (with-debug), outputs all vars.. that'll be neat

14:27 Chouser: I'm under the impression that some of the simpler Java debuggers work fine on clojure code, though I've not tried that.

14:27 jswat perhaps?

14:28 Lau_of_DK: no clue - I first touched on Java simultaniously with Clojure

14:29 kotarak: Chouser, thanks. gen-class is a bit more work than proxy, but if it works...

14:37 Chouser: yeah, it's more work, but I think you need it if you want to create a new constructor.

14:38 * hoeck wonders that he can use gen-interface and instantiate a proper proxy

14:40 kotarak: Chouser, I'm actually surprised, that an Interface needs a constructor...

14:41 Chouser: I'm running up against the edge of my Java knowledge here, but I think the problem is that proxy needs a constructor since it's creating and instance, and gen-interface creates and Interface with no constructor.

14:43 kotarak: Doesn't proxy implicitly inherit from Object? (My naive view: everything inherits from Object)

14:44 cemerick: kotarak: yes, everything is an Object

14:44 tWip: well there are primitives

14:45 cemerick: I don't know what's under the covers really, but autoboxing makes that distinction pretty fuzzy in practice

14:45 tWip: yes, nowadays that's true

14:45 cemerick: In particular, everything that goes and out of Clojure is boxed.

14:46 kotarak: yes, there are primitives, but proxy creates an instance of an anonymous class

14:50 cemerick: Lau_of_DK: I've debugged clojure code with the netbeans debugger with some limited success. The stack frames and line numbers can get mashed up some, but it works.

14:50 Lau_of_DK: you recommend giving it a go ?

14:50 cemerick: I would, sure. Might not work, but there's little reason to not try.

14:50 Better debugging is ostensibly available in more recent builds of enclojure, but I'm still using one from August-ish.

14:51 Lau_of_DK: k

14:51 I'll look into it. Although the thought of a (with debug macro isn't half bad

14:57 drewr: When did :refer-clojure show up?

14:58 Is that a new part of ns?

14:58 Chouser: Sep 6th

14:59 which was about a week after ns showed up.

15:00 drewr: Do you see anything syntactically wrong with the first line of http://github.com/jochu/swank-clojure/tree/master/swank/util/concurrent/mbox/mbox.clj?

15:00 "java.lang.Exception: Unable to resolve symbol: refer-clojure in this context"

15:01 Chouser: works for me (SVN 1067)

15:01 drewr: That's what I'm on.

15:02 Chouser: you don't need "clojure/ns" though -- just use "ns", it has special resolution rules now, so it always means clojure/ns

15:02 drewr: k

15:05 Chouser: but refer-clojure should be defined

15:05 (doc refer-clojure)

15:07 drewr: Hm, it works after killing my *inferior-lisp* buffer.

15:10 Chouser: if only emacs were written in clojure instead of some ancient brain-dead lisp.

15:10 drewr: I'm going to write Clomacs tonight.

15:10 Chouser: drewr: I'll start using it tomorrow.

15:11 ...assuming it has vi keybindings.

15:11 drewr: Heh.

15:36 isido: This is probably stupid question, but when I have a list of booleans, how do I do and-operation to them?

15:37 This doesn't work (and '(true true false))

15:37 since it has only one argument

15:38 wwmorgan: isido: would every? work for you?

15:38 isido: Maybe, I'll look into that

15:40 (every? '(true true false)) returns "Wrong number of arguments", hmm

15:41 wwmorgan: well '(true true false) evaluates to a list of symbols, not booleans

15:41 Chouser: this is complicated by the fact that "and" is a macro

15:41 wwmorgan: you probably want (every? identity (list true true false))

15:41 Chouser: there you go.

15:42 isido: Yep, that's it. Thanks a lot.

15:48 Lau_of_DK: This might just be something very easy to pick up, but would some of you mind helping me find this bug? http://paste.lisp.org/display/68515

15:48 (also, hints on refactoring are most recommended/encouraged)

15:54 hoeck: Lau_of_DK: looks more like your test-frac function is broken, but you didn't include its definition in your paste

15:57 Lau_of_DK: sorry, but why do you say that ?

15:58 (I've added the test-frac)

16:00 hoeck, ?

16:01 wwmorgan: Lau: doc strings for your functions are a great way to tell others (and remind yourself!) what each function is supposed to do

16:02 Lau_of_DK: wwmorgan, note taken

16:03 hoeck: Lau_of_DK: that was just a guess

16:03 Lau_of_DK: k, I think you guessed it wrong this time hoeck

16:03 hoeck: Lau_of_DK: sorry

16:04 Lau_of_DK: is test-frac is supposed to test the fraction function?

16:04 Lau_of_DK: dont worry about it :)

16:05 Basically test-frac til run a loop from 'min' to 'top', calcucate all the decimal expansions of the fractions in that area, like (test-frac 1 3) will just call (fraction 1.0 1.0) (fraction 1.0 2.0) (fraction 1.0 3.0), and then tell you which one has the longest recurring cycle

16:05 So if there's a problem - and there is, it gives bad results for alot of numbers of 80 - then it lies in (fraction), which does the actual decimal expansion

16:08 wwmorgan: Lau: (fraction 1.0 100.0) returns "0.1" -- is this right?

16:09 Lau_of_DK: no, should be 0.01

16:12 blabber: I get the following error when trying to ru slime with clojure

16:12 *run

16:12 Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/Repl

16:12 any clues?

16:12 Lau_of_DK: did you just update?

16:12 blabber: no the clojure I have is old by a week

16:13 it runs on the shell command line though

16:13 Lau_of_DK: Then it probably because you're not giving the full path to Java, or an incorrect path?

16:15 blabber: (setq swank-clojure-jar-path "/home/joel/repository/clojure_exec/clojure.jar")

16:15 that is a valid path

16:16 This is the error displayed in the inferior lisp buffer:

16:16 Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/Repl

16:16 Caused by: java.lang.ClassNotFoundException: clojure.lang.Repl

16:17 hmmm

16:18 Lau_of_DK: I think you need to review the emacs instructions on the wiki

16:19 blabber: I think I need to sleep

16:19 thanks anyway

16:20 Lau_of_DK: Is anybody looking at my lisppaste, or have we dropped it ? :)

16:21 H4ns: lisppaste8: url

16:21 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

16:21 H4ns: Lau_of_DK: what's wrong with it?

16:22 wwmorgan: Lau: there's a lot going on in fraction. Splitting it up a bit will improve readability and possibly expose the bug

16:22 Lau_of_DK: It produces wrong results for higher numbers

16:22 H4ns: Lau_of_DK: never mind me. i overlooked the "my"

16:23 Lau_of_DK: hehe

16:24 wwmorgan, have you any suggestions for refactoring?

16:30 wwmorgan: Lau_of_DK: Just little stuff, since I don't understand the algorithm you're using. Like you don't need the (= true ...) in front of the some, and I'd indent the consequent S-exps in the cond

16:31 Lau_of_DK: I have followed clojure-mode's indenting, but I can see how yours would produce more readability

16:31 drewr: How can I make the last argument to a function optional without having to parse the resulting arrayseq?

16:31 Chouser: (fn [a b & [c]] ...)

16:32 drewr: Chouser: Oh yes.

16:33 Chouser: although then it's legal to call that with 4 or more args as well.

16:33 of course you can also (fn thisfn ([a b] (thisfn a b nil)) ([a b c] ...))

16:34 drewr: The latter is probably more idiomatic.

16:34 Chouser: hm, maybe.

16:39 drewr: If the type of c varies, would it be best to promote all the args to a map?

16:41 Chouser: I wouldn't think so. You mean the fn will behave differently depending on the type of object passed in for c?

16:41 drewr: Yes.

16:41 Then I could just use generic functions.

16:41 Er, multimethods.

16:42 Chouser: you could use multimethods anyway, and dispatch on the 3rd arg if you really wanted to.

16:43 drewr: I don't always want to supply a third arg.

16:47 lisppaste8: Chouser pasted "dispatch on class of 3rd" at http://paste.lisp.org/display/68518

16:48 drewr: Ah, nice.

16:53 danlarkin: is the JVM a reference-counting GC?

16:55 walters: danlarkin: no true GC is reference counting

16:55 Chouser: danlarkin: I think it's more complicated than that.

16:56 danlarkin: walters: what do you mean?

16:56 walters: danlarkin: http://en.wikipedia.org/wiki/Garbage_Collection

16:58 danlarkin: so why is it not true GC?

16:59 walters: i would call it "memory management", but not garbage collection

17:00 danlarkin: "Garbage collection is often portrayed as the opposite of manual memory management, which requires the programmer to specify which objects to deallocate and return to the memory system. However, many systems use a combination of the two approaches, and there are other techniques being studied (such as region inference) to solve the same fundamental problem."

17:00 I see where you're coming from

17:01 Chouser: I wouldn't mess with the word "true" here. Using reference-counting exclusively has some known deficiencies that most moden JVMs avoid.

17:01 walters: i don't think any JVM uses reference counting, if it did it would be broken

17:02 danlarkin: perhaps it doesn't work within the confines of the JVM for whatever reason, but reference counting is a legitimate way to do GC

17:05 provided you do cycle detection etc

17:07 dudleyf: danlarkin: The JVM has several garbage collectors

17:07 http://www.ibm.com/developerworks/java/library/j-jtp11253/

17:14 danlarkin: dudleyf: I see, thank you

21:10 nicknull: how come clojure supports multimethods but no real OO?

21:11 Chouser: What features of "real OO" is it missing?

21:12 nicknull: you know the answer, dont play rethorics

21:14 aspect: I'm glad somebody knows what is "real OO"

21:15 Chouser: I'm afraid I made a bad impression. I didn't mean to.

21:15 aspect: looked like a troll to me

21:16 Chouser: well, I think every feature of OO is avaible, if not in the "normal" way.

21:18 But I was afraid I was forgetting one, so I didn't want to sound overconfident. :-)

22:44 pjb3: Does anyone know if you can use proxy to extend a java class and override a method with a clojure function. and call the superclass from within the function?

22:44 Does that make any sense?

22:46 Chouser: yes

22:47 (doc proxy-super)

22:48 pjb3: Chouser: ah, proxy-super, thanks, I'll try that

22:57 Chouser: I'm completely failing to read any data from this socket.

23:09 ah. exceptions hiding inside an agent.

23:36 jcrites: how might one translate "fluent style" java code into Clojure?

23:36 fluent style being a().b().c().d().e(), esp. as used with factories

23:36 arohner: jcrites: (doc ->) ?

Logging service provided by n01se.net