#clojure logs

2008-12-10

05:31Lau_of_DKMorning all
07:01AWizzArdWhen I do (load-file "/path/myfile.clj"), what could then be the reason for getting a EOF exception in the last line of that file?
07:01AWizzArdI think this is not very exceptional that the file ends where.. well.. it ends.
07:02mibuAWizzArd: maybe the file was so interesting and the reader just wanted to protest that it's over. ;-)
07:03AWizzArdyup, right, that was it
07:03mibuAWizzArd: but seriously, who raised the exception, the reader or the load?
07:04AWizzArdWell, there was an unbalanced paren that caused it.
07:04AWizzArdSo probably the reader.
07:05mibuyou solved the problem too quickly. that's not fun :-)
07:45rhickeytry this next time you get an exception: (map bean (.getStackTrace *e))
07:48AWizzArdah oki, thanks
07:48Lau_of_DKWhat is *e ? I dont recall seeing star syntax in Clojure
07:48AWizzArdlast exception
07:48AWizzArdjust a normal variable
07:49AWizzArdand the star syntax still makes sense for global/dynamic vars, created with (def *var*)
07:51AWizzArdis the (.. syntax for doing things like frame.getContentPane().add(yellowLabel, BorderLayout.CENTER); ?
07:58AWizzArd(doto frame (.add (.getContentPane) yellow BorderLayout/CENTER)) ...) looks a bit strange?
07:59mibuI have a theoretical question about special forms: why isn't let simulated with macros and fn? is it just a matter of practicality?
08:00blackdoglooks to me like it is, core.clj line 24
08:01AWizzArdyes, let is implemented as a macro
08:01mibuoh, in the docs it appears as a special form
08:02AWizzArdWell yeah, it uses some magic
08:02AWizzArdit expands into (fn* let ...)
08:02mibuno wait. it's not really a macro. it still uses a special form (let*)
08:03AWizzArdright, and let* is the real special form.. but let itself is a macro
08:03rhickeymibu: from a binding perspective, let can be defined in terms of fn, from a practical perspective, it never is, or, if it is, there is a special case of determining which fns don't need to be realized as proper objects. It is much simpler for them to be different
08:04AWizzArdIn Common Lisp LET is also introduced as a special operator.
08:04AWizzArdSome years ago I had an interesting discussion with Don Geddis about this issue.
08:04miburhickey: so it's only a practical matter, there isn't a theoretical limit, right?
08:04mibuAWizzArd: yeah, I was wondering why it's that way in CL too.
08:05AWizzArdIn principle let and let* don't need to be special forms.
08:05miburhickey: same thing goes with loop? it could have been macro'd with fn and let, no?
08:07rhickeyI personally see let defined via fn as taking it reduction one step too far, since in implementation you reintroduce the distinction, it's the difference between a minimal calculus and a language
08:08AWizzArdyes
08:08rhickeyI think real languages and their use have cost models that matter. In Clojure, when you say fn you get an object, an overhead I wouldn't want to incur for let/loop
08:08rhickeySo I want them to be different and not to care about or rely on an implementation detail to optimize the non-realized cases
08:09rhickeyOthers might prefer a minimal calculus, Scheme being a good example
08:09mibuhey, I wasn't complaining. just curious about theoretical limits. I'm all for practical compromises.
08:10rhickeyScheme maximizes what you can do with lambda
08:10duck1123for most people, it doesn't affect anything if it's a special form, a fn, or a macro. It works, that's all that matters
08:12AWizzArdHow can I do frame.getContentPane().add(yellowLabel, BorderLayout.CENTER); inside a (doto frame ...)?
08:12miburhickey: on the subject of special forms, what's your take about exceptions in clojure, are they interop necessities or a legitimate flow control idiom? (I'm asking because they appear in the docs in the special forms section and not in the java interop section, where other necessary special forms are. )
08:12rhickeyI don't think exceptions should be used for flow control in general
08:14miburhickey: I meant as a legitimate language construct in a functional programming language, not a botched up loop or switch
08:14rhickeymibu: not exceptions, maybe continuations
08:15miburhickey: aren't they the same as far as being side-effects?
08:18rhickeyI'm thinking more about hierarchical exceptions where some intervening code can intercept your non-local transfer by catching its super class
08:19miburhickey: isn't that like interrupt handlers?
08:25AWizzArdI think (. frame (getContentPane) (.add panel BorderLayout/CENTER)) is equivalent to frame.getContentPane().add(panel, BorderLayout/CENTER);
08:26AWizzArdBut how can one do this with (.add ..) in the front, or (.getContentPane ..) instead of (. frame ...)?
08:26AWizzArdAnd how can one do this in a (doto frame ...)?
08:32rhickeyAWizzArd: (.add (.getContentPane frame) panel BorderLayout/CENTER)
08:32AWizzArdhmm yes, I tried this first, but got some strange exception
08:33AWizzArdrhickey: btw, in your example under "Hosted on the JVM" you say (doto frame ...) and all these java functions don't start with a dot, as in (.add ...), but it simply is (add ...)
08:33Lau_of_DK(.. frame (getContentPane) (add BorderLayout/CENTER)) <-- Isnt that it AWizzArd ?
08:34AWizzArdwhen I do begin with (.add ...) it complains: No matching method found: add for class javax.swing.JPanel
08:34AWizzArdLau_of_DK: I will try the .. syntax. But I still don't know if this is supported inside a (doto frame ...)
08:35AWizzArdLau_of_DK: I can do it with one dot: (. frame (getContentPane) (add panel BorderLayout/CENTER)), and this also works.
08:36AWizzArdHere I don't have to use dots for calling getContentPane and add.
08:36Lau_of_DKk
08:36AWizzArdBut the example under http://clojure.org/jvm_hosted maybe came from an earlier version of Clojure. There one did not have to use the dots inside a doto.
08:43Lau_of_DKYes that was a recent change
08:44AWizzArdcurrently the dot syntax is not fully consistent i think
08:44Lau_of_DKAWizzArd: I dont know what you arrived at, but it can be done like this (doto frame getContentPane (.add panel BorderLayout/CENTER)) I think
08:45Lau_of_DKI think its consitent in code, but not in docs
08:46rhickeydoto is about doing a set of actions to the same object, that's not what is happening here
08:46AWizzArdI mean: (. frame (getContentPane) (add panel BorderLayout/CENTER)) vs (.add (.getContentPane frame) ...) in the first version there is a dot, a space and then the object follows. Now function calls don't need to be prefixed by a dot.
08:47rhickey(. frame (getContentPane) (add panel BorderLayout/CENTER)) is not right, you need (..
08:48AWizzArdwell, this currently works for me, without ..
08:48AWizzArdor was this recently changed? I have a clojure.jar from early December
08:49duck1123AWizzArd: it was some time last month I think
08:50duck1123svn rev 1111
08:50clojurebotsvn rev 1111; enhanced doto now supports functions as well as methods !! Note - breaking change - you must now use .method instead of just method: (def frame (doto (new JFrame) (add panel) pack show)) becomes: (def frame (doto (new JFrame) (.add panel) .pack .show))
08:53lisppaste8AWizzArd pasted "dot syntax" at http://paste.lisp.org/display/71905
08:53AWizzArdThat works for me
08:55duck1123what happens if you put a dot in front of add?
08:55duck1123other than that, it looks good to me.
08:56AWizzArdit still works
08:56AWizzArdthat is what I mean with consistency
08:57rhickeyAWizzArd: it doesn't work, it is wrong as I said, you have to use ..
08:58rhickeyif you use . and supply extra args they are ignored
08:58AWizzArdWell, here I see that it works in the sense that the window appears.
08:58rhickeyuser=> (. "foo" (length) (print 42))
08:58rhickey3
08:58AWizzArdAs soon I begin with .. it does not work anymore: No matching method found: add for class javax.swing.JPanel
08:59lisppaste8rhickey annotated #71905 with "dot options" at http://paste.lisp.org/display/71905#1
09:00AWizzArdI will try -> now
09:01AWizzArdNo, strangely it works only when I have what I pasted above.
09:01rhickeyAWizzArd: your code is broken in other ways too,
09:01AWizzArdswing wise you mean?
09:01rhickeyread the Java docs and make sure that's what you are doing - you are trying to add a layout to a panel
09:02rhickeyif you are confused by the syntax, do only one step at a time
09:02AWizzArdI will update my clojure.jar and see if that brings any changes.
09:02rhickeyAWizzArd: you just have bugs
09:03rhickeypanel (new BoxLayout (new JPanel) BoxLayout/X_AXIS) is wrong
09:04rhickeyin that panel is the layout itself
09:05AWizzArdOkay I see. Well, I just started looking into Swing and just play with it.
09:05blackdogAWizzArd, have a look at miglayout to simplify your life
09:05blackdogwell your code anyway :)
09:06AWizzArdIs there a way to do guis under Java with something corresponding to what is html to the webbrowser?
09:06blackdogAWizzArd, will be soon
09:06blackdoghttp://weblogs.java.net/blog/alex2d/archive/2008/12/jwebpane_projec.html
09:06blackdogcan't wait for that
09:07AWizzArdWell, in that case one could simply let the designer do the gui. He knows it 100x better anywa.
09:07AWizzArd+y
09:08AWizzArdblackdog: is that only for FX applications? Or can it be used without WebKit, inside stand-alone Clojure apps?
09:08blackdogit will be standalone i think, general use that is
09:09blackdogit embeds webkit
09:09blackdogcan't use without
09:09AWizzArdblackdog: btw, do you know if it is possible to write JavaFX applications exclusively by using Clojure? Or will one have to write JavaFX Script at some point to make it possible?
09:09blackdogah, well i think someone needs to do a comparable api
09:09blackdogmainly javafx uses the scengraph stuff
09:10blackdogso that is open for anyone to get into
09:10duck1123JavaFX looked cool, but it looks like you need to jump through a few hoops to get it working with linux
09:10blackdogso a similar api in clojure would probably be very easy
09:12AWizzArdduck1123: that doesn't matter too much, because in 1-4 months it will work under Linux. 2010 it will seem as if it never were different.
09:12AWizzArdClojure does not run on mobile phones yet. But noone will care about it anymore in 1-2 years.
09:12AWizzArd(because then it most likely will)
09:12blackdogduck1123, http://silveiraneto.net/2008/12/06/javafx-sdk-10-on-linux/
09:13duck1123right. I'm not saying it will be a major problem. I'm just saying it annoyed me when I went to check it out after it was mentioned the other day
09:13AWizzArdYes, same here *seufz*
09:14duck1123blackdog: ok, that one is easier. The one I saw involved mounting the mac package
09:21AWizzArdrhickey: does http://clojure.org/jvm_hosted need an update? (as there are no dots before the method calls)
09:23rhickeyAWizzArd: the docs correspond to the release
09:24AWizzArdand the api to the svn?
09:38cemerickdoes proxy creation still use reflection in svn head?
09:43rhickeycemerick: no
09:43rhickey(macroexpand '(proxy [Object] []))
09:43duck1123Is it possible to use clojure to gen-class a completely plain class. (without all the dynamic stuff that allows you to change the code without recompiling)
09:44duck1123I know it's like having a swiss army knife and throwing it all out for the little plastic toothpick, but some might have a use for it
09:45rhickeyduck1123: what advantage would that have over Java, once you had to add all the goop to specify types, access specifiers etc? Java with parens
09:45cemerickI can't say I knew what (proxy [Object] []) expanded into before, but that's very good to know.
09:45cemerickI think we might move our codebase to some svn head shortly
09:46duck1123IDK, I'm still fighting Tomcat, and I'm just rying to reduce this down to the most basic level to figure out what's going on
09:46AWizzArdduck1123: but in Jetty you made it work, right?
09:46rhickeycemerick: it called construct-proxy, which was and still is reflective
09:46duck1123oh yeah, It works in Jetty no problem
09:46rhickeyduck1123: clojure classes work fine in tomcat
09:47AWizzArdduck1123: but you also had to do something special to make it work in Jetty?
09:47rhickeywhere is clojure.jar in you tomcat setup
09:47rhickey?
09:47AWizzArdI know at least that Clojure-classes+Jetty+Rife can't be combined easily. Chouser and I tried it for some time, but there were other hurdles.
09:48duck1123It's in webapps/{projectname}/WEB-INF/lib
09:48rhickeyrife is a completely different thing, runtime bytecode modification
09:48rhickeyduck1123: and you've tried a simple hello world servlet?
09:49duck1123That's what I'm using. It just spit's out a basic html hello world page using strings
09:49AWizzArdrhickey: Rifes author said that the bytecode transformation happens transparently. So that should not be the problem.
09:50duck1123http://paste.lisp.org/display/71768#2
09:52duck1123I found a test suite that tests servlets, but I have a feeling that since Jetty works, it's going to say it's fine
09:53Chouser-awayAWizzArd: Rife may yet be a (relatively) simple classloader thing, that's just an area I don't know much about.
09:54AWizzArdsame here
09:55duck1123I'm tempted to do like Webjure does and cheat by writing Java code to define the servlet, but I really don't see any reason why this shouldn't work
09:56rhickeyduck1123: what's your xml like?
09:57lisppaste8duck1123 annotated #71768 with "Web.xml that goes with this" at http://paste.lisp.org/display/71768#3
09:59duck1123I have a java version (Servlet2) that works fine when I change the servlet-class, but as it is I only get 404
10:17AWizzArdWhen I have a Java method foo which takes an array of strings as argument, can I then simply pass in Clojures vectors?
10:18AWizzArd(foo ["a" "b" "c"]) vs. String[] bar = {"a", "b", "c"}; obj.foo(bar);
10:21ChousukeAWizzArd: (.foo obj (to-array vec-of-args)) or something should work.
10:23Chousukeor into-array if you need to specify the type
10:26AWizzArdIs there a gui builder that works nicely together with Clojure code?
10:27AWizzArdSwing is by far too complex, with it's containers inside containers, that all need to be handled specifically, depending on if their layouts come from awt or swing.
10:47rhickeyduck1123: your servlet (with only different names) works fine for me on Tomcat 6.0.18
10:47RSchulzThe Groovy folks have a DSL for building Swing GUIs. There might be some ideas there for a Clojure counterpart.
10:57duck1123hmm... perhaps I need to get the latest version. I'm using Tomcat 5.5 (only one in Debian apt)
10:59rhickeyI took out load-on-startup - it created an error on startup, but didn't prevent from working
10:59rhickeyhow are you trying to invoke the servlet?
11:02duck1123http://localhost:8180/mycyclopedia/
11:02duck1123where 8180 is the port it was running on
11:03jkantzI've been trying out http://www.zentus.com/sqlitejdbc/ from within clojure
11:03jkantzbut I'm running into a problem where putting a statement in a closure closes it
11:03rhickeyduck1123: do you see the app in tomcat manager?
11:03lisppaste8jkantz pasted "sqlite3 inserts" at http://paste.lisp.org/display/71914
11:04cemerickAWizzArd: Our general approach right now is to use netbeans' matisse to design UI's, and have everything but the top level of event handling, etc., be handled by clojure fns we call into from the UI.
11:05duck1123rhickey: yeah, it was showing up there just fine
11:05AWizzArdcemerick: okay, so I will checkout netbeans in a few days
11:05cemerickIMO, building UIs without a visual designer is a disaster waiting to happen. Every UI framework is far too complicated to hand-code.
11:06lisppaste8jkantz annotated #71914 with "2 throws the error" at http://paste.lisp.org/display/71914#1
11:10RSchulzcemerick: I think there's a subset of uses, very stylized dialogs, e.g., that are amenable to a simple description language.
11:12cemerickRSchulz: sure, but if you're talking about generalized UI design, that description language would inevitably degenerate into a direct wrapper around whatever widget lib you happen to use.
11:12AWizzArdcemerick: with html it works out pretty well
11:13cemerickAWizzArd: wow, really? 9.9
11:13AWizzArdIf I could just write an xml file, similar to html or whatever, but adopted to swing, and then just call (.loadUI "/path/gui.xml") and be done, then that might be nicer ;-)
11:14RSchulzcemerick: Sure. I was asking a couple of days ago about a Clojure counterpart for MPW's commander, which was just a DSL for parameter-gathering dialog boxes used to invoke CLIs for the CLI-phobic.
11:14RSchulzI still think that's appropriate (and something I could use).
11:15cemerickIt seems that HTML/XHTML/css/js is a prime example of the inherent complexity of UI programming.
11:16cemerickRSchulz: I'm not familiar with commander, but that sounds like a very narrow scope. A perfectly reasonable place to use a data-driven UI generation approach, but I don't think that's generalizable.
11:17RSchulzGeneralizable? Surely not. But within its bounds, a productivity win, I'd say.
11:17RSchulzcemerick: Do you do a lot of full-blown Java / Swing / etc. GUIs?
11:17RSchulzGUIs aren't my thing.
11:18cemerickRSchulz: It's by no means my main thing. But I've been steeped in that for the past few months.
11:18RSchulzWhat do you think of that JavaFX thing? Good?
11:19RSchulzFor my work, BBIs are the thing, I believe.
11:20cemerickRSchulz: I poked at the "launch" site a little. I've not been impressed with javafx since it was originally "announced" as an afterthought reaction to AIR and silverlight.
11:20RSchulzAIR is the follow-on to Adobe Flex?
11:22cemerickI think they're using another name for it now, but AIR is Flex, transparently deployable as a RIA (i.e. embedded in a browser) or as a thick-client, offline app.
11:23cemerickI'm actually hopeful about the new-style applets available in java6-update10. It includes all of the guts that javafx needs (which are actually decent, technically), as well as a lot of deployment simplifications that have always made applets nigh-useless IMO.
11:25cemerickRSchulz: BBIs?
11:26RSchulzI'm pushing the term (as far as I know, of my coinage): Browser-Based Interface
11:26RSchulzWeb 2.0 stuff. AJAX; what have you.
11:26cemerickah. "RIA" will be a formidable competitor.
11:27RSchulzI'll be happy when all the distinctions are erased and the programming models are easy in every deployment mode.
11:27RSchulzBut I won't be holding my breath.
11:30AWizzArdcemerick: have you tried NetBeans gui builder, together with Enclojure already?
11:31cemerickAWizzArd: Using it now, although enclojure doesn't have anything to do with it, short of providing the clojure programming niceties.
11:31cemerickmatisse generates java, period.
11:32AWizzArdand how to you add event listeners for button clicks? In Clojure?
11:34cemerickAWizzArd: No, the top layer of the UI is all Java...and really, at least in my case, there's very little actual code there. When I need to hook into the real guts of the app (to put together a visualization to be drawn in the UI, for example), then I call into clojure.
11:34cemerickI also have a couple of controller interfaces that call back into API points I've set up in the UI so I can drive certain parts of it from the clojure side.
11:35AWizzArdSo when you add a button, you will write a clojure function foo and call it in the java event handler?
11:36cemerickonly if the action to be performed is complicated enough, or requires interaction with APIs implemented in clojure.
11:36AWizzArdOtherwise you write it in Java?
11:36cemericktrying to be all-clojure top to bottom at the moment is going to require a lot of work that doesn't net one any reward, IMO
11:37cemericksure -- matisse takes care of the vast, vast majority of the real work, so the amount of java that needs to be written for simple event handlers and such is really miniscule
11:37AWizzArdCan Mantisse be modified to output Clojure code?
11:38RSchulzSMOP
11:38cemerickmaybe :-) Some people are fiddling with it to make it emit JRuby, so it's possible in concept, I suppose.
11:38cemerickI don't see what one would gain from that in practical terms, though.
11:39AWizzArdAnd let's say your event handler is complex enough, so that you will want to write a Clojure function which you then want to call in that handler. Does this mean that you have to wrap your Clojure function inside a (gen-class ..) to make it callable from Java?
11:39AWizzArdI thought the practical terms are that you never need to write even one line of Java code.
11:40cemerickAWizzArd: no, it's not that difficult -- you just do RT.var("namespace", "fn-name").invoke(blah) (assuming the clojure is already loaded)
11:40AWizzArdYou make a button and then simply say: (add-on-click-handler my-button (fn [x y mouse-button] ...))
11:41cemericksure, that's certainly doable, but not with the tools the way they're set up now. You'll have to roll your own UI design environment, or UI description language, or modify matisse or some other toolset to get there.
11:41AWizzArdSo, there is still a long way for Enclojure to go :-)
11:41cemerickpurging Java isn't big on my to-do list. I'll live if my time in Java is cut to 10% or something.
11:42cemerickI don't think the enclojure guys have said anything about tackling UI design.
11:42AWizzArdIt's maybe okay for people who actually know Java...
11:42AWizzArdOtherwise going down to 0% should be the goal.
11:43cemerickclojure runs on the jvm, so short of very isolated research purposes, it'll be tough to not touch java sometimes.
11:57ChousukeAWizzArd: you can't avoid java, but a lot of it can be hidden with functions and macros and some proxying :)
11:57AWizzArdWhy do you think that Java can't be avoided?
11:57AWizzArdMaybe for doing some low level (assembler-like) optimizations Java could come in handy.
11:57Chousukebecause that's not what clojure is trying to do.
11:58AWizzArdChousuke: do you have some typical things in mind where one would have to write .java code for a project that could not be written in .clj?
12:00Chousukehm, not really.
12:00AWizzArdIt would mean that there exists methods in Java that can't be called from within Clojure. Or that one wants to work in a Java project that makes use of annotations which can't be generated in Clojure at the moment.
12:01achim_phi all!
12:01AWizzArdI understand that cemerick knows Java and does not feel much pain to write it from time to time. He just wants to do it less often, so for him the Mantisse+Java+Clojure combination works.
12:01AWizzArdI however come from Common Lisp, and I didn't do it to write more Java than I did in the past (0% that is *g*).
12:02Chousukehm
12:02achim_phas it always been the case that you weren't allowed to await an agent from within an agent action?
12:02lisppaste8achim_p pasted "awaiting awaiting awaiting" at http://paste.lisp.org/display/71922
12:02Chousukeit's pretty hard to avoid using java if you use libraries designed to be used from java. clojure has a disadvantage.
12:02cemerickAWizzArd: I think an all-clojure UI framework would be very, very warmly welcomed, including by me. Such a beast just doesn't exist (yet?).
12:03Chouserachim_p: I think it's always been that way, yes.
12:03AWizzArdI just don't know swing very well. If I did I could write a wrapper in Clojure that reads xml or s-expression files and could generate UIs from that. It would not be a declerative language so to speak.
12:03cemerickChousuke: clojure's java interop is what makes it practical, IMO
12:03Chousukecemerick: yeah.
12:04AWizzArdcemerick: yes, I guess in 3-5 years such a thing could exist, if Clojure can attract some 10k programmers.
12:04Chouserachim_p: the problem is that sends from inside an agent are held until the agent is complete. await doesn't make sense.
12:04cemerickAWizzArd: *shrug* Swing is essentially the only option in Java land w.r.t. UIs (short of SWT, which I'll rudely ignore :-) )
12:05cemerickThere may very well be a declarative swing layout library out there already that you could wrap with clojure...?
12:05ChousukeAWizzArd: Did you look at QtJambi? there were some examples some time ago that used a QT GUI builder and resource files and no java (though the API obviously isn't very clojurey either)
12:05ChouserLots of people seem to be playing with Clojure and Qt/Jambi
12:05Chouser...which has a nice graphical GUI editor, if you're into that sort of thing.
12:05AWizzArdcemerick: what about this: you make a gui with Mantisse, put it into a single .class file and load that from Clojure. There you make an instance of it which should show the gui. Then you get all objects that need event handlers and add them in Clojure.
12:06Chousukethat could work.
12:06duck1123rhickey: I installed Tomcat6, deployed my app and it ran without a hitch
12:06achim_pChouser: oh, i didn't realize they were. thanks for the pointer!
12:06walterscemerick: i use GTK+ through bindings I wrote, works great
12:06walters(and Clutter)
12:07AWizzArdChouser: but what does the qt gui builder produce? Will it allow me to click together my gui and then do the rest in Clojure? Such as onClick or onKeyPress handlers, etc?
12:07ChouserAWizzArd: yes
12:07cemerickAWizzArd: certainly doable. There's a lot of manual bookkeeping there, but if avoiding Java is your priority, then it just might work.
12:07Chouserthe qt gui builder produces .xml
12:07AWizzArdAnd why isn't that possible with NetBeans+Mantisse+Swing?
12:07AWizzArdI see
12:07ChousukeAWizzArd: why wouldn
12:07Chousukewouldn't it be?
12:07cemerickthe same degree of bookkeeping would be necessary with Qt, I presume
12:07Chouserin clojure you can load the .xml, and then hook up wantever signal/slots you want.
12:07ChousukeI don
12:07ChousukegaH
12:08AWizzArdSo the qt gui builder basically does what I asked for. It produces something comparable to .html files.
12:08Chouserduck1123: wow, just like that?
12:08cemerickwalters: that's interesting. Can't say I'd want to learn yet another widget toolkit, though. :-)
12:08AWizzArdWhile the Mantisse builder produces .java code.
12:08Chousukecode generation ;(
12:08duck1123Chouser: just like that... Obviously there's something wrong with 5.5 + clojure
12:08RSchulzNot to harp on spelling / typos, but it's "Matisse," right?
12:08walterscemerick: http://live.gnome.org/GObjectIntrospection/ if you're interested
12:09cemerickRSchulz: yes
12:09walterscemerick: (more specifically http://live.gnome.org/JGIR )
12:09cemerickwalters: ah, it's JNA-based?
12:09duck1123Now I just need to figure out how to get a repl working with this so I can hack at some live code
12:09waltersright now yeah
12:10waltersthough i am about on the edge of writing something more lowlevel and efficient
12:10cemerickwalters: I was going to say, JNA uses reflection for fn invocation, which would be troublesome depending on how much you're pushing through the keyhole.
12:10waltersright
12:11waltersthe way it does structs and unions is also really bad (implementation wise)
12:14cemerickAWizzArd: a couple of declarative swing libraries you might be able to wrap: http://www.swixml.org/ http://jacekfurmankiewicz.blogspot.com/2008/06/java-swingbuilder-finally-01-beta.html
12:18cemerickAWizzArd: you could also take a look at JWebPane, which might be just the ticket based on the 2.5 blog posts I've read about it ;-)
12:32RSchulzclojurebot: todo?
12:32clojurebottodo is http://richhickey.backpackit.com/pub/1597914
12:34RSchulzIs there a technical reason why special forms don't have doc strings?
12:37ChouserRSchulz: where would they be stored?
12:38RSchulzI don't know. Where are other doc strings stored?
12:38Chouserin the metadata of the var
12:38Chouserbut special forms don't have vars
12:38RSchulzIt seems plausible that whatever Java constructs embody the run-time definition of special forms could be the locus of a doc string, right?
12:40RSchulzSurely doc could have special-case code for speical forms that looked in some place other than the (non-existent) Var for special form document strings.
12:46rhickeyRSchulz: there are only a handful of special forms - they have long descriptions that really need to be read before using Clojure
12:46RSchulzOK. But something synoptic still seems useful for a (doc) result?
12:54cemerickrhickey: I'm curious: why doesn't RT.toArray produce results for IPersistentCollections? It seems like the class-is-array block can be directly used for IPC's as well.
12:56rhickeycemerick: it used to be that Collection covered all IPCs
12:56rhickeynow all but maps
13:05abrooksIn a flourish of ignorance -- what sorts of things would break if we defined vars for builtins to hold their docstring?
13:05abrooksAla: (def #^{:doc "More fn* than you can imagine"} fn* "fn* is builtin")
13:06rhickeywhat is the purpose of these docstrings? are people forgetting how fn/let/do work?
13:07RSchulzNo offense, but you're pretty deep inside Clojure to understand a beginner's mindset...
13:07abrooksrhickey: If you can tell a new user (doc foo) will tell you about foo, they're going to be surprised when that thing that they saw in the example (and perhaps even read about once before) doesn't have a doc string.
13:08RSchulzWell, to be fair, it refers you to the Web documentation.
13:08rhickeyBut I do remember learning CL, and I never wanted doc strings for defun or let, always looked in documentation, vs quickie arg lookup for other things
13:13abrooksrhickey: You're a long time lisper -- beginners don't remember which forms are special and which are not. The (a) beauty of lisp is that the both appear the same.
13:13zakwilsonWhen I first started with Clojure, the fact that some arguments that would be lists in most lisps are vectors bit me several times.
13:14zakwilsonAnd "Don't know how to create ISeq from Symbol" didn't help.
13:14abrooksrhickey: I recognize special formsm when I see them but I could not rattle off a list off the top of my head.
13:15abrooksRSchulz: Oh, right. It does send you to the web docs.
13:15abrooksRSchulz: Not so useful if you're at a REPL and offline without the web docs, though.
13:16abrooksAlso, that link will be broken when the website changes and someone's still running an older version of Clojure.
13:18RSchulzMy guess is that clojure.org will be the Clojure Web site as long as Clojure is alive.
13:19alphazeroHi all! Does anyone know what is the baseline target jre for clojure? (1.1, 1.3, etc.)?
13:20Chousuke1.5
13:20cemerickrhickey: I asked, because I have a couple of IPC implementations, and I always forget to wrap them in seq in order to use them with sort, etc.
13:20whiddenIs there an equivalent function in clojure of CL's 'find-all-symbols ?
13:22alphazeroChousuke: thanks! then it would be nice if a shutdownHook was added to repl.java.
13:22rhickeycemerick: but you don't want to implement Collection?
13:25cemerickrhickey: They implement Iterable, but that's as far as I want to go. Java-land API users simply don't get the notion of implementing only the read portions of Collection (despite the interface's contract).
13:28Chousukealphazero: the repl is a clojure function. do you need to have the shutdown hook in the java code? maybe you could add it from clojure :/
13:29abrookswhidden: all-ns will show you all namespaces. ns-map (and in varying slices: ns-aliases, ns-imports, ns-interns, ns-publics and ns-refers) will show you what's in a given namespace.
13:30whiddenabrooks: thanks...just what i needed!
13:30alphazerochousuke: hah! am a Java old timer but very (very) new to lisp and clojure. (rhickey: didn't see you here earlier. Great stuff! Thanks for clojure.)
13:32alphazero.. could give you the patch for java if you want. (I didn't like how it just dies after ctl-c so added a goodbye msg to mine, but wasn't sure if rhickey wanted to be backwards compatible with pre 1.3 jvms.)
13:37Chousukealphazero: You want something like this? (.addShutdownHook (Runtime/getRuntime) (Thread. (fn [] (println "Goodbye World!"))))
13:38lisppaste8alphazero pasted "shutdown hook for Repl.java" at http://paste.lisp.org/display/71931
13:39Chousukeoh, I should've used #(println "Goodbye world") ;P
13:40RSchulzChousuke: Since Clojure functions imlement Callable and Runnable, couldn't you skip the (Thread ...) part?
13:40alphazeroChousuke: yep, thanks for the clojure version.
13:40alphazero? what's the diff? I pasted yours and it worked.
13:41RSchulzThe #(...) notation is just more concise, in situations where it's applicable.
13:42alphazeroRSchulz: thanks.
13:43RSchulzPerhaps (doc ...) deserves to be a multimethod? Then 3rd-party add-ons could extend it in interesting ways. And the overhead of multimethod dispatch wouldn't be a problem in that case.
13:46alphazeroChousuke: tried (.addShutdownHook (Runtime/getRuntime) (Thread. (#(println "Goodbye World!")))) and it immediately executes.
13:47alphazero.. and it doesn't actually run on shutdown. can someone explain why please?
13:47Chousukealphazero: you have an extra pair of parentheses
13:48Chousuke#(println "foo") returns a function (#(println foo)) runs a function :)
13:48alphazeroChousuke: Aha! the mysteries of lisp. you are right.
13:48ChousukeRSchulz: .addShutdownHook wants a Thread
13:49RSchulzThat's rude of it.
13:49RSchulzIt should be satisfied with a Runnable...
13:50Chousukealphazero: anyway, #(foo bar) is just a more concise way of saying (fn [] (foo bar)) :)
13:51alphazeroChousuke: thanks. Yep, RSchulz mentioned that earlier.
13:51Chousukeof course if you want a function with more than one expression you'll need to use fn. or #(do (foo) (bar)) :P
13:52alphazeroa more general question: do you guys think clojure is a good platform for scripting bytecode engineering? (Specifically, can it do something like aspects without the pain of asm, etc.?)
13:53Chousukeyou could implement aspect-oriented programming constructs in clojure I suppose.
13:55alphazeroI ask, since multimethods seem to be an excellent way to write crosscut specs and coupled with ad-hoc taxonomies ...
13:55ChousukeI'm not that familiar with aspect oriented programming, so I can't really say anything about that.
13:56duck1123when using gen-class, the -init fn is essentially the constructor right? (with the exception that it must return a vector)
13:56Chousukebut for example, you could redefine defn to work in a way that wraps every defined function in a way that checks (from a global data structure, for instance) if there are any things to run before or after its execution.
13:58alphazeroChousuke: in a nutshell: you define pre- and -post ops for a signature pattern and apply it across class hierarchies. e.g.: you say whenever a method return void with params Foo, Object[] is called, first pass the args throw this -pre method and then after the actual method is done call this -post method. Its a very powerful mechanism.
13:59alphazerothrough
13:59cemerickrhickey: thinking about it a little more, to-array really should accept any IPC, in order for third-party IPC implementations to be peers to standard data structures.
13:59cemerick(IMO, of course ;-) )
14:02Chousukealphazero: I think that should be doable, but would require a fair amount of trickery
14:03alphazeroChousuke: well, I was thinking wrapper functions would do it, but then, not sure how that would help with (existing) java classes. So question is: does the clojure import mechanism allow you to customize its classloader?
14:04Chouserduck1123: I think that's right, though I believe -init gets run before the object is created.
14:04alphazerobecause then you could script that
14:05Chousukealphazero: you'll have to read the code and see how clojure imports stuff. I don't know :/
14:06alphazeroChousuke: will do, thanks. I have to step out for lunch but if anyone has an idea and posts it it is appreciated and I will read the logs. bye for now.
14:10duck1123every time I try to use an init, I get: Duplicate field name&signature in class file
14:12duck1123you know what, this class has a method named init... that's probably causing a problem
14:18duck1123ok, If I'm implementing an overloaded fn, do I have to provide implementations for both of them, or can I specify which one I'm doing?
14:27Lau_of_DKGood evening gents
14:27duck1123hello Lau_of_DK
14:28Lau_of_DKduck1123: Hows your projects coming along?
14:29duck1123actually, I upgraded to Tomcat 6, and like a miracle, it worked
14:30Lau_of_DKWuhuu! :)
14:30Lau_of_DKWhat did?
14:30duck1123gen-classing a servlet and dropping it into tomcat
14:31Lau_of_DKOh, from pure clojure?
14:31duck1123now I'm trying to get a repl put in there so I can modify the code
14:31Lau_of_DKDuck I dont know which country youre in, but Tomcat is very hot in Denmark atm
14:31duck1123yeah. My code was right, it's just something funky with Tomcat 5.5
14:31Lau_of_DKI'll remember that
14:32duck1123I'm in Michigan, USA
14:32Lau_of_DKJBoss server selling like hot bread there? :)
14:33duck1123I really wouldn't know.
14:36Chouserduck1123: there is a (still undocumented, I think) feature that lets you add arg types to your function name.
14:37Chouserduck1123: like (defn -foo-Integer-String ...) for an implementation of foo that takes 2 args of those types.
14:37Chouserduck1123: but I've never tried to use it, so that's about all I know.
14:39duck1123Chouser: thanks. What if it doesn't take any args? -init-Void?
14:40Chousergood guess. dunno. :-)
14:41Chousertry -init-void
14:41Lau_of_DKHey Chouser
14:41ChouserLau_of_DK: hey!
14:42RSchulztomhickey, rhickey: Thanks a million for fixing up the API page. The underline thing is still happening for (ns ...) (only)
14:45acieroidis there a way to download the videos of clojure.blip.tv ?
14:47danlarkin_toward the bottom you can subscribe
14:48Lau_of_DKacieroid: Or change the type of video to .mov, then as I recall you get enough in the adresse line to pass it to wget
14:48Lau_of_DKThats how I usually do it
14:49acieroidand how do I change it to .mov ?
14:49Lau_of_DKHang on let me look
14:50Lau_of_DKIn the top right corner, choose Episode Archive
14:50Lau_of_DKThen select the video you want to download
14:50Lau_of_DKThen when it starts playing, you have a dropdown box right below where you can choose .mov
14:51acieroidyeah ok
14:51acieroidthanks
14:52Lau_of_DKBut looking at it now, I forgot how I modified the adress to become downloadable, but you can probably work it out
14:52Lau_of_DK:)
14:55acieroidhum
14:56acieroidI just found the flv in the firefox's cache
14:57acieroidYeah, great, if I change the .flv to .mov, it works
14:57acieroidthanks
14:58rhickeyacieroid: there's a Download Playing link at the bottom when playing from the episode directly
14:59hiredmanrhickey: what are the odds of (show ...) or something like it showing up in clojure.core?
15:00rhickeyhiredman: good, although it will likely be an enhanced inspect
15:00gnuvincerhickey: Do you have any upcoming speaking engagements?
15:01hiredmanexcellent
15:01rhickeygnuvince: QCon London and ILC Cambridge in March
15:01gnuvinceThank you.
15:07mchurchI have a design question re: Clojure.
15:08mchurchI'm starting to use it, and I like it, but why is it set up so that two primitives can be print/read equal and yet nonequal?
15:08mchurche.g. (symbol "nil") is something that prints as nil but is not actually equal to nil
15:10Chousukethat's because it's not nil, it's a symbol that looks like nil when printed :)
15:10rhickeymchurch: there is print-dup, with more verity along with more verbosity.
15:11mchurchWhat's print-dup?
15:11rhickeynil is special, not read as a symbol as in CL due to its unification with Java null
15:11mchurchClojure's great, but I really dislike the idea of ambiguous read/print syntax.
15:12mchurchAh, this makes sense.
15:12rhickeywell, printing the symbol nil and expecting to get a symbol when read is asking for trouble.
15:12Lau_of_DKmchurch: Does that really make much of a difference in the bigger picture of concurrency and functional programming?
15:12rhickeyprint-dup is a printing mode like print-readably, set with *print-dup*
15:12mchurchYes. This is one of those pathological use cases that is unlikely to occur.
15:13rhickeyprint-readably has rough read/print equivalence, by data structure category, butif you look at CL, they just ended up with unreadble printed representations of so many things
15:14rhickeyprint-dup does track the specific types, so sorted sets come back sorted. print-readably is readable but bot type equivalent, but still useful for repl
15:15rhickeynot type equivalent
15:15mchurchI'm writing some glue code for IPC between SBCL and Clojure, so I'm dealing with the question of how to unify the concepts of Nil/false in the "between language"
15:16rhickeymchurch: nil should be ok for IPC, as it is used similarly by Clojure, just isn't a symbol
15:16rhickeyfalse is a different thing, not in CL
15:17mchurchYeah. The "ambiguity" I was worried about is not an issue for me right now. I just wanted to know why it was done that way, because a lot of things that seem "wrong" turn out to make sense.
15:18Chousukehow does print-dup work? there's no docstring
15:18rhickeyright now print-dup is used only by serialization during AOT compilation, will get doc'ed soon
15:19rhickeybut it is used to serialize all constants, and they are read back with read, so print/read is important to me
15:19mchurchrhickey: Shall I assume you're Rich Hickey, the inventor of Clojure?
15:19rhickeyClojure just has a much richer type space than prior Lisps, so I ended up needing another level of 'readable'
15:20rhickeymchurch: yes
15:20mchurchYour talk at the JVM conference was great; I watched it on video last night.
15:20rhickeythanks, it was quite rushed, but fun
15:20Chousukethe java side certainly complicates things for read/print
15:21Lau_of_DKmchurch: Is that on blib?
15:22mchurchhttp://news.ycombinator.com/item?id=392442
15:22lisppaste8rhickey pasted "print-dup in action" at http://paste.lisp.org/display/71933
15:23Lau_of_DKThanks alot
15:23mchurchThat's cool.
15:24mchurchMind if I ask (while I'm here) about the difference between let vs. bindings?
15:24rhickeythose things read back precisely, but not as nice for the repl
15:25mchurcherr, binding, sorry (I'm a 4-day-old newb to Clojure)
15:25rhickeylet is for lexical locals, binding is for thread-specific dynamic binding of global vars
15:25rhickeymchurch: you know CL?
15:26mchurchCL: 3 months old.
15:26mchurchPlus some exposure to Scheme in college.
15:26rhickeyok, well CL does both kinds of binding in let, Clojure breaks them apart
15:26rhickeybinding ~~ Scheme fluid-let
15:27rhickeylet is the primary construct, binding is pretty special-purpose
15:27mchurchThis makes sense.
15:28mchurchSo binding is used for constructs like (let ((*read-eval* nil)) ... ).
15:28rhickeymchurch: right, dynamic vars
15:28mchurchAlthough that's a bad example, since (I believe) Clojure's reader is side-effect free.
15:29rhickeybinding *out*, *print-dup* etc
15:29rhickeyClojure jobs! - http://groups.google.com/group/clojure/msg/9bcd9c42346206fa
15:30danlarkin_*drools*
15:30abrooksAwesome.
15:32Lau_of_DKrhickey: Can we expect some improvements on the performance characteristics of the STM that Mr. Click touched upon in his presentation? I ask, because he gave the impression that this was something that had been around for 15 years with little or no improvement
15:32Lau_of_DKargh
15:34Lau_of_DKduck1123: start your own business? :)
15:35danlarkin_duck1123: wanna go into business together? I'm not moving to Michigan though...
15:36RSchulzzakwilson: Elaborate, please!
15:36duck1123I did, however, put Clojure on my resume on dice
15:37Lau_of_DKduck1123: You only need 1 good contract to carry yourself for 2� - 3 months :)
15:37zakwilsonWhen I'm not writing software, I'm a lighting designer for a band.
15:37zakwilsonStage lighting controlers use profiles to determine how to control specific types of lights. All of them use different file formats.
15:38zakwilsonThere is no central place to get such profiles, and people like me often end up making half-complete profiles on the fly while setting up for a show because there's no profile for a specific light/controller combination.
15:38cemerickis there something along the lines of doseq that also binds the current index of the item in seq being enumerated? Something more concise than using (interleave seq (iterate inc )), preferably...
15:39mchurchrhickey: Thank you for taking the time to reply to me about Clojure. I'm really glad Clojure exists; it's a cool language.
15:39zakwilsonI'm thinking profit could be made from a profile format that can be converted to most controllers on the fly.
15:40Chousercemerick: clojure.contrib.seq-utils/indexed
15:40zakwilsonEither by charging for access or by running ads on a website.
15:41Chousercemerick: (doseq [[i foo] (indexed foos)] ...)
15:41Lau_of_DKDoes anybody know if we can expect some improvements on the performance
15:41Lau_of_DK characteristics of the STM that Mr. Click touched upon in his
15:41Lau_of_DK presentation? I ask, because he gave the impression that this was
15:41Lau_of_DK something that had been around for 15 years with little or no
15:41Lau_of_DK improvement
15:41Lau_of_DK:)
15:41cemerickChouser: thanks much
15:42blackdogLau_of_DK, i think his impression after doing the clojure tsp that is was going in the right direction
15:42blackdogif you readthe blog entry
15:42zakwilsonI'm also contemplating writing lighting control software, as I think everything currently on the market has obvious flaws. Professional lighting controllers are very expensive, and a sucessful product has a great deal of potential for profit.
15:42Lau_of_DKblackdog: Thats just not very concrete
15:43RSchulzI wonder how easily STM-based systems (such as Clojure) would re-target to hardware TM?
15:44Lau_of_DKMr. Schulz, you certainly do
15:45RSchulzEh? I do what?
15:46Lau_of_DKYou wonder...
15:46RSchulzYes... That's why I asked about it...
15:47Lau_of_DKI know. I was just confirming that fact. I cant be helpful 100% of the time you know
15:47hoeckzakwilson: cool
15:48zakwilsonI'm actually stuck on something related to the first project, if anybody has some advice on reverse-engineering a file format.
15:57AWizzArdRSchulz: do you have your test for find-factors still available? I mean, do you remember for which number it produced a wrong result?
15:57RSchulzI think I can dig it up in my terminal back-scroll (it's set to 5,000 lines, and I have many tabs open, for different purposes).
15:57RSchulzJust a sec...
15:57AWizzArdthanks :-)
15:57AWizzArd5k is not bad *g*
15:58holmakrecur only goes back to fn's and loops, right? Not lets or anything strange?
15:58RSchulzIf not, it'll be in the channel logs. Could someone remind me of the URL of those logs?
15:59AWizzArdholmak: yes
15:59AWizzArdbut also to defn's (which are fn's under the hood)
15:59RSchulzAWizzArd: Here it is: 43587438757
16:00AWizzArdthanks
16:00RSchulzfactor 43587438757
16:00RSchulz43587438757: 21517 2025721
16:00RSchulzThe various "find-factor" functions only gave the first factor.
16:00AWizzArdyes
16:01lisppaste8holmak pasted "recur problem" at http://paste.lisp.org/display/71936
16:02holmakI'm having a strange problem...
16:02holmakI'm getting an error that recur should be getting one arg, not two.
16:03hiredmanuh
16:03hiredmanI don't think recur will work there
16:03hiredmanin a lazy-cons
16:03holmakThat could be it, but I'm not getting a "not in tail position" error
16:03hiredmanwell
16:04hiredmanit is not in the tail position (I think) but that is not the problem
16:04hiredmanit is not being called in the context of that function
16:04holmakAh
16:04hiredmanbecause lazy-cons is, well, lazy
16:05hiredmanyou should be ok calling chop again there
16:05hoeckholmak: lazy-cons is a macro, the recur gets wrapped in a function with one arg
16:06holmakI was wondering where the fn was coming from. Serves me right for trying to feed macros strange things...
16:07hoeckholmak: to me, your chop function looks like clojure.core/partition
16:08holmakI was trying to find a good standard library function to do what I wanted, but couldn't -- I'll take a look at partition.
16:09holmakAha, wonderful. partition is what I wanted.
16:09hoeckyeah, did that too until I discovered partition :)
16:10holmakIt can be hard to find the right standard function for things.
16:10holmakThere's really a lot of things a person might want to do to a sequence.
16:12holmakAnyway, thanks for the help.
16:13hoecktakes some time to learn them, I often take a look at clojure.org sequences docs
16:29lisppaste8holmak pasted "partition by different sizes" at http://paste.lisp.org/display/71941
16:30holmakSo ^^^ was my final solution, since I had to partition according by different sizes.
16:33holmaks/partition according by/partition by/
16:52Lau_of_DKholmak: Looks good :)
16:53holmakThanks :D I don't know if it would be generally useful, but I happened to need it.
16:53Lau_of_DKIn my experience helpers like that always come in handy sooner or later, so I tug them all away in my utility lib :)
16:53Lau_of_DKs/tug/tuck
17:27aperottehi, does anyone know how to print the stack trace?
17:27blackdog(.printStackTrace e) or some such
17:27rhickey*e
17:27aperottethanks!
17:30blackdogwell that's shorter :P you can tell who the master is
17:31aperotteblackdog: I think he meant *e instead of just e ... at least that's what worked for me
17:31rhickeyright
17:31blackdogyep
17:34aperotteAm I right in thinking that the only way to expose protected members is through gen-class and AOT compilation?
17:34rhickeyaperotte: yes
17:34aperotterhickey: ok, thanks
17:48raftingHow can I call Clojure-code from Java?
17:49ChouserWide-open REPL type thing, or calling into a specific interface?
17:49rhickeyrafting: Var someFn = RT.var("some.ns","some-fn"); someFn.invoke(someargs);
17:52raftingand the cloure-code shuld be compild to .class or i can call .clj-files?
17:54rhickeyrafting: either, just put it in the classpath, you can require it by:
17:55rhickeyVar require = RT.var("clojure.core","require"); require.invoke(Symbol.intern("my.ns"));
17:55rhickeyetc
17:59clojurebotsvn rev 1150; releaxed namespace requirement for derives in private hierarchy, patch from J. McConnell
18:01raftinghow do i do repeatedly for a function with arguments?
18:01aperotteI don't know if this is my problem or a bug but here's what happened. I am extending an abstract class with :gen-class. There is one method that must be implemented and it shouldn't take any arguments. However, I get a clojure.lang.AFn.throwArity unless I define the method with [& args] instead of [].
18:02hiredmanrafting: wrap it? #()
18:02hiredmanaperotte: explicit "this" argument
18:02aperotteohhh
18:02blackdografting, apply?
18:03aperottehiredman: thanks
18:03hiredman(doc repeatedly)
18:03clojurebotTakes a function of no args, presumably with side effects, and returns an infinite lazy sequence of calls to it; arglists ([f])
18:04raftinghiredman: yes i wrap it but i dont want to :)
18:04hiredmanrafting: what?
18:05hiredmanthen write a macro to wrap it for you
18:05RSchulzhiredman: Have considered a variant of clojurebot that would allow evaluation of Clojure forms? It would be risky if not restricted (say, no load calls) and would probably have to self-limit the amount of computation and I/O fron any given form evaluated, but it could be great to have for helping an experimenting here.
18:06hiredmanRSchulz: I think chouser suggested I look at java's sandboxing capabilities
18:07hiredman(+ 1 5)
18:07clojurebot*suffusion of yellow*
18:07RSchulzI doubt it would be trivial to do well, but it could be interesting and useful.
18:07RSchulz(shhh!)
18:07RSchulzI see it's selective about what it tries to eval.
18:08hiredmanyes
18:08RSchulzA bot with discretion...
18:08cemerickYou should be able to sandbox clojure without a hitch, especially now that namespaces and fn's clearly correspond to classes now.
18:09hiredmanoh, this looks familar
18:09hiredmanI must have googled "java sandboxing" before
18:09cemerickeven easier would be to lock off particular sections of RT.
18:09RSchulzDo Java's sandboxing mechanism extend to resource consumption limitation?
18:09cemericknot sure about that, maybe
18:09hiredmandoing anything that is really involved in java makes me want to bak things
18:09hiredmanbrake
18:10RSchulzOr, maybe, "break?"
18:10hiredmangah
18:11aperotteIf I'm extending an abstract class with :gen-class, do I have to define the abstract methods in the same file or can I define those in a different context as well?
18:12hiredmanyou can define ththe functions that corrispond to class methods latter
18:12hiredmanas long as they are in the right namespace
18:13aperotteand the right namespace would be the same as the :gen-class ns or whatever namespace I happen to be in?
18:13hiredmanit defaults to the gen-class ns
18:14hiredmanbut you can specify it
18:14aperotteoh ok, that's right
18:14aperottethanks
18:14hiredmanI just worked through this yesterday
18:17aperottehiredman: thanks, those things would've taken me a little while to figure out
18:22hiredmanclojurebot: sandbox is http://calumleslie.blogspot.com/2008/06/simple-jvm-sandboxing.html
18:22clojurebotOk.
18:26hiredmanoooh
18:26hiredmanvery cool
18:28RSchulzWhat an odd coincidence... I just found a transcript of #haskell and it appears they have an evaluater bot called "lambdabot"
18:28RSchulzhttp://tuukka.iki.fi/tmp/haskell-2008-02-24.html
18:29gnuvince_RSchulz: yes
18:29gnuvince_lambdabot is very cool
18:30Chousukehm, that sandboxing stuff is rather verbose :P
18:30RSchulzgnuvince_: You do Haskell?
18:30Chousukebut then again, it's java :p
18:30billcRSchulz: for people who use ERC in emacs, creating a Clojure evaluator is trivial
18:30RSchulzWhat's ERC?
18:30billc(= 42 42) => true
18:31ChousukeRSchulz: elisp irc client
18:31gnuvince_RSchulz: a little, I enjoy it a lot. ERC is an Emacs IRC Client.
18:31RSchulzThanks.
18:31billc(printf "%s" *ns*) => usernil
18:31Chousukeheh
18:31RSchulzI'm feeling pretty overloaded with things to learn lately: Clojure, FP, Emacs. Whew!
18:31billclisppaste8: url
18:31lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
18:33aperottehiredman: do you happen to have an example of :gen-class that uses :exposes?
18:33gnuvince_RSchulz: tell me about it; I'm into Clojure, learning git and I'm doing my calculus classes
18:33hiredmangetting the default applet security policy is not very verbose
18:33hiredmanaperotte: sorry, did not get that far
18:33RSchulzgnuvince_: Sounds like your brain is younger than mine...
18:33lisppaste8billc pasted "ERC Clojure code evaluator" at http://paste.lisp.org/display/71946
18:34RSchulzgnuvince_: (based on the calculus class thing)
18:34hiredman(.setSecurityManager System (SecurityManager.))
18:34hiredmanthen suddenly no file or net io in my repl
18:34hiredmandunno what else is off limits
18:35cemerickhiredman: well, can't get much simpler than that...
18:35hiredmanwell, clojurebot kind of needs network io
18:36hiredmanand some file io too come to think of it
18:36Chousukehiredman: (System/setSecurityManager (SecurityManager.)) ;)
18:36hiredmanwhichever
18:36Chousukeyeah. the / form is much nicer though.
18:37hiredmanI guess
18:37hiredmanI see this in java a lot, that simple thing there does almost exactly what I want, but getting the exactly part is going to be hell
18:40hiredmanif I do have clojurebot eval forms, is there a preference for format?
18:40ChousukeThough for System I guess it's semantically correct to say you're calling the method on it. but I'd rather see Math/pow than (.pow Math 1 2) ... or, hrr, (. Math PI)
18:40hiredmanwould be easiest to prefix with , or something
18:40Chousukeremember to set print-length :P
18:41hiredmanheh
18:42RSchulzhiredman: What do you mean by format?
18:42hiredman,(do stuff)
18:42hiredmanlike, we don't want it to just eval every sexp in the channel, right?
18:42RSchulzYou mean what pattern does the bot trigger on?
18:43Chousukethat's unlikely to conflict with any clojure code
18:43Chousukeso fine with me :)
18:43hiredmanRSchulz: yeah
18:43RSchulzLeading !, perhaps.
18:43hiredmanChousuke: because , is whitespace
18:43raftingwhat do i pass to sort from biggest to lowest?
18:44RSchulzrafting: Supplying your own Comparator would certainly work.
18:44Chousukehm? (sort > [2 3 4 1 5])
18:44hiredmanwrapping in a (reverse ...) might be easier if you are getting smallest to bigggest
18:45Chousukeor just (sort < [2 3 4 1 5]) :p
18:45hiredmanoh
18:45hiredmanI see what you did there
18:46RSchulzHow did you learn that sort would take a predicate? I assumed from the wording of the doc text that it required an actual Comparator.
18:46ChousukeRSchulz: in clojure predicates work as comparators.
18:46Chousukeat least, I think I read that in the SVN log a while ago :)
18:47RSchulzOK... But Comparators have to reutnr < 0, 0 or > 0 to signify the ordering relation that exists between their arguments.
18:47ChousukeI guess a predicate-turned-Comparator will never return a 0 then
18:48RSchulzUnless whatever converts it implicitly checks for = (first?)
18:48Chousukehm, right.
18:50Chousukedid clojurebot have a log lookup function for revisions?
18:50Chousukeanyway, r1088: made AFn's Comparator.compare work with predicates too, true values sorting first
18:51hiredmansvn rev 1088
18:51clojurebotsvn rev 1088; made AFn's Comparator.compare work with predicates too, true values sorting first
18:53gnuvince_RSchulz: I'm 25. Been out of school for 5 years and I've decided that I want to go back and get my bachelor's degree
18:54RSchulzgnuvince_: Yuh-huh. I see your 25 and raise you 25 more. (The AARP's on my ass...)
18:55gnuvince_RSchulz: wow
18:55gnuvince_I'll repeat what I said a few weeks ago: this is a really diverse community
18:55RSchulzIt's a large world.
18:55Chousukeheh
18:56ChousukeI think. last I checked I was 23. :/
18:56ChousukeI sometimes have trouble remembering my age :)
18:57gnuvince_I should just say "I'm 27" for the next 6 years
18:57raftinghow do i sort on the first element in a list of tuples?
18:57hiredmanhah
18:57RSchulzThen for you (and other non-U.S. types): AARP Associate for the Advancement of Retired Persons (though technically they're just AARP now, since no one's retired at 50...)
18:58gnuvince_Speaking of school, I'm gonna go and study for a bit
18:58gnuvince_Catch ya later
18:59Chousukerafting: (sort-by first > [[1 2] [5 1]])
18:59hiredmanwhen I was 16 a girl guessed my age as 35, so I started introducing my self as being 35
19:00ChousukeI get the opposite :/
19:00RSchulzhiredman: You'll get over that some day.
19:00raftinguser=> (sort-by first > [[1 2] [5 1]])
19:00raftingjava.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Number
19:00hiredmanRSchulz: oh, I am over it, it's mostly just a habit now
19:00RSchulzSo you're 35 for ever. Nice.
19:00Chousukerafting: your version of clojure is too old :)
19:01hiredmanactually people believe it less now than they did then
19:01Chousukerafting: in the meantime, (sort-by first (comparator >) ...)
19:02RSchulzrafting: Realisically, you should be working with the latest code from SVN. The "official" releases become out-of-date very quickly.
19:02RSchulzAnd sine everyone here and on the list is living on the bleeding edge, we expect everyone to bleed with us.
19:02RSchulzBut seriously, Rich manages changes well, and it is, as best I can tell, a monotonic curve of improvement.
19:04hiredmanclojurebot: latest?
19:04clojurebotlatest is 1150
19:06Chousukethere have been a lot of changes since the release.
19:06Chousukethe release version is not clojure anymore!
19:07ChousukeI suppose things should calm down after an actual 1.0 release :)
19:09ppierreanyone use textmate and/or ant ?
19:11whiddenwhat's the bot command for the log of the latest svn revision?
19:11ppierreclojurebot: latest?
19:11clojurebotlatest is 1150
19:12hiredmansvn rev 1150
19:12clojurebotsvn rev 1150; releaxed namespace requirement for derives in private hierarchy, patch from J. McConnell
19:12whiddensvn rev head
19:13whiddenwishful thinking on my part
19:13Chousukesvn rev HEAD
19:13Chousukehm, not case-sensitive either then ;(
19:13hiredmanmaybe I should add that
19:14aperottedoes anyone happen to have any examples of :gen-class using :exposes (I'm trying to use a library the has lots of protected members)
19:15whiddenlibrary with lots of protected, which library?
19:16RSchulzI don't know about "lots," but the Java Collections have some.
19:16aperottejava monkey engine (maybe lots was an exaggeration, I need to use 3 for the very basic example)
19:16hiredmancute
19:17Chousukemonkey engine? does it involve typewriters?
19:17aperottehahaha
19:17RSchulzjava.util.AbstractList has both protected fields and methods, if that matters.
19:18RSchulzEven a protected constructor.
19:18ChousukeJava would be more fun if you replaced Abstract with Ideal all over.
19:19ChousukePeople would go "oh, there's an IdealList! I'll use that" and then be disappointed to find it's not actually implemented :(
19:19RSchulzOr, maybe, "Platonic."
19:21hiredmanpublic platonic Friends {}
19:21RSchulzHmmm... Maybe a topic for an XKCD comic.
19:22aperottehahaha
19:33raftingis there get-with-default? liek (get {'x 5 'y 10} var if-not-found)
19:38RSchulz(doc get)
19:38clojurebotReturns the value mapped to key, not-found or nil if key not present.; arglists ([map key] [map key not-found])
19:38RSchulzThe second for takes a third argument, the "if-not-found" value.
19:39RSchulz...the second _form_ takes...
19:44Chousukeare there any vimperator users here btw? I just found it a few days ago and I'm really impressed :P
19:44Chousukefirst non-mouse control scheme for a browser that is actually faster and more effective than using the mouse.
19:47ChousukeMakes me think that I might be weird. I make my Firefox act like vi, and even emacs, but I rarely actually use vim the editor for anything more complex than simple edits
19:47Chousukeat least, that's the case now that I found vimpulse which makes emacs and acceptable vim clone :P
19:48ChouserChousuke: tried it, didn't like it (vimperator)
19:49RSchulzWhat is "vimperator?"
19:49RSchulz(I _am_ a Vim user)
19:50Chousukea firefox extension that brings vi-style modal control to firefox.
19:54ChousukeSo my firefox now looks like this: http://www.modeemi.fi/~oranenj/vimp.png
19:55Chousukehid the tab bar becuase tab rendering is a bit buggy on OS X and I don't really need to see them anyway :P
19:57RSchulzI'm intrigued by the notion of making a browser like a character-mode editor. But I don't see anything out of the ordinary on that screen snapshot.
19:58ChousukeRSchulz: that's exactly what's out of the ordinary with it, compared to most browser screenshots :)
19:59Chousukethe little black bar at the bottom is vimperator's UI :p
19:59RSchulzUh... huh...
19:59Chouserthe vimperator key bindings got in the way of site-specific key bindings for me.
19:59RSchulzI still don't get it.
19:59Chousuke(it's white by default)
19:59ChouserThere were work-arounds, but didn't strike me as worth the effort.
19:59RSchulzI'm looking at http://vimperator.org/trac/wiki/Vimperator now
19:59ChousukeChouser: gmail?
20:00Chouserbingo
20:00Chouserbut also others. chalk.
20:00Chousukeapparently a piece of javascript in the config file can turn off vimperator for specific sites though.
20:00RSchulzSo I could, e.g., ":g/(map.*#(/p" ??
20:01RSchulzI'm still running Firefox 2.0. I'm loathe to give up Pinball.
20:01Chousukehmm.
20:02RSchulzThey should have called it Vimperial!
20:02Chousukewhat I like most is the quickhints stuff
20:02Chouserwhen I tried it, vimperator disabled ff3's "awesome bar", which I've grown to rely on.
20:02Chouserhm, we're way off topic.
20:02Chousukeno, It's vimperator because it's in control :)
20:04Chousukeanyway, I think vimperator is worth investigating at least if you're partial to how vi works. I guess it's not for everyone though.
20:05RSchulzI'm certainly partial towards Vim!
20:06ChousukeI guess I just like how quickhints and quickmarks work.
20:07Chousukeyou can press "f" in vimperator and it'll number every link, and you can then either type a number to open the link, or type text to "narrow down" the selection of numbered links
20:07Chousukeif you want a tab, that's F :)
20:09Chousukequickmarks are just a way to assign a URL (or URLs) to buttons, so if you assign www.clojure.org to c, then typing goc will get you there.
20:09raftingmeh how do i prevent a list from becoming a lazycons? there is a lot of implicit conversion in clojure which im not so fond of.
20:09rhickeyrafting: when does a list become a lazy cons?
20:10raftingthat swhat i dont know :)
20:11rhickeyso what conversions are you talking about that you don't like?
20:12ChousukeI would guess rafting means stuff becoming lazy at the earliest opportunity.
20:12raftingwell my lsit becomes a lazy-cons somewhere and i cant figure out where
20:13rhickeynothing becomes anything else, functions take values and return different values
20:13raftingtake makea alzycons of a list for example
20:14raftinguser=> (class '(1 2 3 4 5 6 7 78))
20:14raftingclojure.lang.PersistentList
20:14raftinguser=> (class (take 5 '(1 2 3 4 5 6 7 78)))
20:14raftingclojure.lang.LazyCons
20:14rhickeytake returns a new thing, how could it return the same list?
20:14raftingsure but you get what i mean
20:15raftingot youre right and im wrong but it is a bit implicit
20:15zakwilsontake always returns a LazyCons.
20:15zakwilsontake takes lazily from the original collection
20:15Chousukerafting: clojure is lazy, so it'll always return you lazy things if it can.
20:15Chousukeyou can force evaluation with doall and dorun
20:16rhickeyMore generally, there's no problem with functions taking one type and returning another
20:16rhickeyis there?
20:16RSchulzIt would be a horribly restrictive language if every function's codomain were equal to its domain...
20:17Chousuke(class (doall (take 5 '(1 2 3 4 5 6 7 78)))) will still be lazycons though, but this time all the values have really been taken :P
20:17rhickeyand you can create a realized result easily from a lazy one, the converse isn't true without incurring the cost of realizing first
20:18zakwilsonYou could (apply list ...) or (apply vec ...) to that and get a non-lazy list or vector.
20:18zakwilson(defn eager-take [n coll] (apply vec (take n coll)))
20:18rhickeyvec doesn't need the apply, neither list*
20:18rhickey(doc vec)
20:18clojurebotCreates a new vector containing the contents of coll.; arglists ([coll])
20:19rhickeyvector does
20:19rhickey but apply vector was so common, added vec
20:19zakwilsonIn any case, if you want eager-take, it's a one-liner.
20:20rhickeyright, and you get to choose the resulting container type, rather than it being hardwired
20:20rhickeyalos remember (into [] (take ...))
20:20rhickeyalso
20:20Chousukecan you put them into java collections?
20:21rhickeyChousuke: no, because the semantics of adding are different - mutation in that case
20:22rhickeybut Java collections all take collections in their ctors, so (ArrayList. [1 2 3 4]) works
20:22zakwilsonIt also wouldn't be hard to write a multifn eager-take that dispatches on the class of the collection and returns the same type.
20:22rhickeyzakwilson: right: (into (empty x) (map f x))
20:23zakwilsonrhickey: that's MUCH easier than what I had in mind.
20:24Chousukeduck typing makes polymorphism easy.
20:25rhickeyChousuke: that's not really duck typing, as there are strong abstractions and interfaces behind it, not just name matching
20:27ChousukeBut did you see this? http://groups.google.com/group/clojure/browse_thread/thread/913077ecdbe1d3a
20:28Chousukemostly the part where ('+ 1 4) => 4
20:29hiredmanyeah
20:29hiredmanweird, no?
20:30rhickeysymbols are functions, when called on something in which they can't find themselves they return nil or the default if supplied
20:30ChousukeI think it should give an error on things like Integer though.
20:31rhickey until you want to write generic lookup code on heterogeneous sets
20:31rhickeythen you'll have to add an awkward type test and branch yourself
20:32RSchulzI take it it was an nth-level concern how things like #' would read to CL programmers...
20:33rhickeyRSchulz: yeah, the symbol/var/fn thing is so different in Clojure, being a Lisp-1 with a non-interning reader
20:33RSchulzA friend of mine, a died-in-the-wool CL guy for a long time, told me today he'd prefer a CL job to a Scheme job and that he prefers a Lisp-2.
20:33RSchulzI can't say I get it but...
20:34RSchulz(dyed-in-the-wool, of course)
20:35zakwilsonI know a lot of people think lisp-2 or lisp-n is the Right Thing. It's always seemed messy to me, but Scheme has never seemed as practical as CL.
20:36rhickeyClojure does find a middle ground, with reified vars, non-interning reader, symbols->resolving->vars, defmacro + some hygiene in `
20:36rhickeyI think it's the best of both
20:37zakwilsonThat's why I'm here.
20:37RSchulzrhickey: Hey, I'm cool with it. But clearly I'm making inroads, since today he bought the PDF of Stuarts book.
20:39RSchulzAnd my friend got a kick out of Bill Clementson's "Common Lisp is the Borg of programming languages" blog: http://bc.tech.coop/blog/040402.html
20:40zakwilsonClojure is already my language-of-choice for anything than needs a GUI. I still go for CL for web stuff because I'm used to using Hunchentoot.
20:42raftingHmm, is it just a thing you have to live with in functional programming to pass the same arguments through several functions or is there some design trick to get around it?
20:43RSchulzWell, you certainly don't need any other search terms to find _that_ via Google...
20:43raftingclojure iis so much better than cl or scheme from what ive tried.
20:43RSchulzrafting: How is that different than other languages?
20:45raftingwhat?
20:46holmakThere's a lot less explicit passing of arguments to functions when there are globals globals, as in normal imperative programming.
20:46Chousukebut you know globals are evil.
20:46Chousukeunless done right like clojure does.
20:46RSchulzholmak, rafting: I'm not sure I think that's really true. My experience in Java is that there's very little reference to global names in any given method.
20:47holmakOh absolutely, but it makes you more aware of the state you are using when you have to pass everything along explicitly.
20:47ChousukeRSchulz: except stuff "global" to the object
20:47RSchulzAnd when I think about it, virtually all such references in my code are really _constants_. Fundamental constants of an implementation.
20:47zakwilsonSo I'm not sure what you're getting at, rafting.
20:48holmakBy globals I also mean an object's state, which you implicitly have in methods...
20:48RSchulzNor I. Passing along arguments doesn't strike me as a problem or even an inconvenience.
20:48RSchulzI'd rather pass something off on someone else (some other function) than have to use it directly.
20:48zakwilsonI've always preferred to pass state around in args rather than store it in globals. If you don't you have a couple options.
20:49zakwilsonOne is to pass around closures.
20:49holmakFor the record, I like the Clojure way. But it is a change to have to pass _everything_ instead of having things sitting in an object's state.
20:49zakwilsonAnother is to use refs/agents/atoms as globals, but I think that should be avoided when practical as it tends to make for messy code.
20:50raftingis there a common class for +-/*?
20:50RSchulzIf you have very commonly occurring collections of values, you can always use a map or a struct.
20:50hiredmanclosures can do a lot
20:50raftingi hate globals
20:50RSchulzrafting: Those functions are not classes, so there's no common class unifying them.
20:51RSchulzClojure is not really object-oriented, and you're best served by not trying to think of it as such.
20:51rhickeyholmak: if you are used to objects, try using maps, so where you would have said anObject.aMethod() you now say (a-function a-map)
20:51zakwilsonGlobal objects with encapsulated state and methods that mutate it are still globals.
20:51ChousukeI was thinking to myself today, that all languages that want "pure OO" or that methods must be part of a class or an object are fundamentally wrong. (Except smalltalk, but that's because in smalltalk a block of code is the object... it's not a function.)
20:52raftinghow do i passa round a closure?
20:52hiredmanrafting: excellent, I was looking for an excuse to paste this again
20:52hiredmanclojurebot: chutes and ladders?
20:52clojurebotExcuse me?
20:52hiredmandamn it
20:52raftingyes oc i could just use a Map and pass it around
20:52RSchulzA "closure" (any function) is not special. Just pass it. By name, if it's def-ed / defn-ed, or as a literal, via (fn ...) or #(....)
20:53holmakI'm getting along fine with using maps and such, but it was a significant change from my usual style.
20:54hiredmanrafting: http://gist.github.com/32417 <-- at the bottom the chute function returns a function which is closed over the ref used as an in que
20:54hiredmanqueue
20:54zakwilsonI think Clojure is a significant change from most people's usual style. It's like a bastard child of Scheme and Haskell.
20:54holmakMy usual language being Python, which has plenty of classes, mutability and even globals.
20:54zakwilson(and I mean that in the nicest way)
20:55hiredmanheh
20:55RSchulzUh... The term "bastard" has generally negative connotations...
20:55hiredmans/bastard/love-child/
20:56RSchulzAmazing what a euphemism can do for a thing.
20:56holmakHaskell's really good if you want to go crazy trying to understand monads. I'm a PhD or two short of being qualified to be a Haskell programmer.
20:56Chousukeborn out of scheme and haskell, raised by java...
20:56RSchulzOh my god! Clojure is The One!
20:56Chousuke(resulting in a burning passion to change Javaland forever)
20:56hiredmanborn of scheme and haskell secreted away to be raised in the kingdom of nouns
20:57gnuvince_"In a world where the number of cores per CPU keeps increasing, the chosen child of Scheme and Haskell seeks to save the world! Raised by his uncle Java The Hutt..."
20:57gnuvince_</Don Lafontaine>
20:57RSchulzSo it could commit regicide on the king of said realm?
20:57raftinghiredman: thats some actor-model stuff?
20:57hiredmandunno
20:57hiredmanI just did it, not sure what it is
20:57zakwilsonI don't know about regicide, but it could be the hier to the throne.
20:58RSchulzWell, it's got S-Exprs, so I guess it's pretty hierarchical.
20:58RSchulzSomething tells me I should go have supper...
21:00ChousukeOr maybe it would be more appropriate to say clojure is born out of scheme and java, and carefully raised by haskell :P
21:02gnuvince_Clojure does what more programs should do: standing on the shoulders of giants
21:03Chousukehm, yes, that would take into account the fact that clojure is made of lisp and works on the JVM, yet brings functional programming to javaland.
21:03rafting(append '(1 2 3) '(4 5 6)), no function for that?
21:03gnuvince_In CS, progress is made by standing on the toes of everyone else
21:03rafting-> '(1 2 3 4 5 6)
21:04gnuvince_rafting: concat
21:05rhickeycemerick: just to swap the order?
21:05cemerickrhickey: yeah, corollary of when-not
21:05RSchulz(into '(1 2 3) '(4 5 6))
21:05rhickeycemerick: when-not has no order
21:06Chouser'concat' is lazy, 'into' is not.
21:06rhickeyif has two branches, if-not just swaps them
21:06RSchulzChouser: You beat me to it.
21:06zakwilsonI didn't know about when-not. I have unless in my util file.
21:06rhickeyinto conjes, so will give different order too
21:07cemerickrhickey: I know that :-) if-not just allows one to keep the exit from a loop or recur'ed fn at the top is all.
21:07RSchulzrafting: One gets the feeling you've not spent much time perusing the resources at http://clojure.org/ ...
21:07ChouserRSchulz: but worth mention 'into' -- I still don't think of it often enough when adding to a non-empty collection.
21:07rhickeycemerick: that's what I'm trying to get at - the style you are trying to achieve
21:08rhickeye.g. exit-at-top
21:09cemericksometimes irc is like trying to have a conversation through a mattress
21:10RSchulzThe colors aren't enought for you??
21:10cemerickis if-not in the stdlib, then? I don't see it anywhere...
21:10cemerickeveryone is so ORANGE in here!!!
21:10cemerick:-P
21:10RSchulzThere's (when-not), but it takes only a single body form.
21:11mmcgranaare there any HTML parsers for Java along the line's of Ruby's Hpricot?
21:11Chousercemerick: I'm not sure, but I rhickey was telling you that exit-at-top is not a desirable style in Clojure.
21:11Chouserwas trying to tell you, that is.
21:11mmcgranaalso when trying clojure.xml/pars I get: java.lang.IllegalArgumentException: No matching method found: parse for class com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
21:11cemerickah, I see. Hrm, I'll buck that trend.
21:12mmcgranarather clojure.xml/parse
21:13cemerickso often, the return value from a terminating loop or fn recur is just returning an accumulator, so I like to have that short bit before whatever the bulk of the form is.
21:13hiredmanmmcgrana: you are passing in something that does not patch the method sig of that java method
21:13Chousermmcgrana: I've had some success with tagsoup and zip-filter
21:13hiredmanI think by default it takes some kind of io stream
21:14mmcgranahiredman: sounds like that could be it, i'll check.
21:15Chousermmcgrana: there's also http://gnuvince.wordpress.com/2008/11/18/fetching-web-comics-with-clojure-part-2/
21:16mmcgranaindeed, giving it an InputStream worked, I was giving it a plain String previously.
21:16raftingcan i in stop a function without doing C-x kill?
21:16Chouserrafting: probably not
21:17raftingIs there any plan on completely bootstrapping clojure? ie its own datatypes etc, meaning all of them, no java.lang.integer etc
21:18hiredmanI doubt it
21:18hiredmanno real point
21:25RSchulzrafting: What would be the up-side of that?
21:25RSchulzNone, I think.
21:25RSchulzJava inter-op, not just the mechanism, but the stock libraries, is a big plus for Clojure.
21:25RSchulzJust today someone asked me how Clojure will get main-stream buy-in. My answer: Complete Java compatibility and interoperability.
21:26mmcgranaChouser: thanks for those pointers
21:27RSchulzIf deep Java intimacy were not an issue, we'd use Haskell or Caml or OCaml or ML or some other language. But it _is_ an issue, so the "turn-your-back-on-the-Java-world" approach is a non-starter.
21:27ChouserRSchulz: Actually I still wouldn't, but anyway...
21:28RSchulzWell, I can't say I would, either, but that's 'cause I don't know any of those languages. Maybe I should have included CL, but that's _far_ from functional.
21:37ChouserI played with OCaml, but macros are not to be trifled with.
21:42zakwilsonScheme has a more functional culture (e.g. set! is discouraged), but Java interop is a big win.
21:42zakwilsonIronicly, it kept me from trying Clojure earlier. I've never liked Java and I had a tendency to dismiss anything associated with it.
21:44Chouserlooks like beta 4 of the book is out
21:46hiredman"The difference between the two interfaces is that the run() method in the PrivilegedExceptionAction interface may throw an arbitrary exception. Note the unfortunate overloading between this method and the run() method of the Thread class and Runnable interface, which return void; a class cannot implement both the Runnable and PrivilegedAction interfaces.
21:46hiredmanlame
21:51RSchulzChouser: beta4 of "Programming Clojure" was out yesterday. Where you been?
21:54RSchulzhiredman: You can probably resolve the conflict with delegation. Unless you really must create a class that is type-compatible with both those interfaces.
21:57ChouserRSchulz: oh.
21:57RSchulzzakwilson: Disliking Java is fine, but ignoring anything even remotely affiliated will blind you to good languages such as Scala and Clojure.
21:58RSchulzChouser: Did you buy the PDF and / or the printed version of Stuart's book? 'Cause if you did, you should have gotten an email notification of the new beta.
21:58RSchulzYesterday.
21:59RSchulzWhen I mentioned it some other denizen here said he was half way through the new chapter ("Macros")
22:00Chouseroh, yeah, now that you mention it, I remember that.
22:00ChouserI just got signed up properly today.
22:01RSchulzProper is good.
22:01RSchulz"Respect must be paid."
22:13hiredmanRSchulz: yeah, I just used a proxy
22:14hiredmanbut still terribly disapointing
22:22hiredmanhah!
22:22hiredmansandboxing is sort of working
22:34zakwilsonRSchulz: you're right. It just took me a while to see that. I don't remember what article or blog post finally got me to try Clojure, but I was impressed when I did.
22:36danlarkinzakwilson: I had the same opinion
22:36danlarkinand the same change of heart
23:06blenketis there a good fft-package in java?
23:17Kerris7blenket: JScience has an experimental section, you could have a look there https://jade.dev.java.net/
23:18blenketis there an automatic documentation tool for clojure? like .clj to html
23:20mmcgranablenkey: i had started something like that a while back. see some sample docs here: http://clj-doc.s3.amazonaws.com/tmp/doc-1116/index.html code itself is here (not ready to use, though): http://github.com/mmcgrana/clj-doc/tree/master i want to come back to this over the next month.
23:20mmcgranaerr blenket sorry
23:21blenketno worries
23:51jvoorhisChouser: thanks for posting your with-bg-queue example to the mailing list :)
23:56Chouserwow, that's going back.
23:56Chouserit's in core now
23:56Chouser(doc seque)
23:56clojurebotCreates a queued seq on another (presumably lazy) seq s. The queued seq will produce a concrete seq in the background, and can get up to n items ahead of the consumer. n-or-q can be an integer n buffer size, or an instance of java.util.concurrent BlockingQueue. Note that reading from a seque can block if the reader gets ahead of the producer.; arglists ([s] [n-or-q s])
23:58jvoorhisoh, perfect