#clojure logs

2008-12-15

01:21Fennecello
01:21Fenneci'm looking for a little getting-started/java-interop assistance
02:03zakwilsonFennec: What do you need to know?
02:04FennecI've found+hacked up something to instantiate a few basic Swing components. right now I'm trying to figure out how to override the paint(Graphics g) method of a JPanel.
02:04Fenneclooks like 'proxy' has something to do with it likely
02:05zakwilsonproxy is for subclassing or implementing interfaces.
02:06zakwilsonSo yes, you should be able to do that with proxy.
02:06FennecgraphicFrame (proxy [JPanel] [] (paint [g] (code goes here ...
02:07zakwilsonRight
02:07zakwilsonI think
02:20zakwilsonFennec: Did proxy do what you expected?
02:20FennecI think so (I think)
02:21Fennecah, there's the problem. i was chasing down a ) when the problem was a missing ]. :P
02:23huangjsIs clojure suitable for numerical computing programs? is it possible to use unbox arrays, inlining functions and avoid runtime dispatching?
02:24Fennecokay, now I have an issue. :) http://pastebin.ca/1285744 -- Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: sun.java2d.SunGraphics2D cannot be cast to clojure.lang.IFn.
02:24hiredmanit is possible to use unboxed arrays
02:25zakwilsonI don't know if it's possible to unbox arrays. You can use Java arrays. You can inline functions with definline. You can avoid runtime reflection using type hints as metadata on function args.
02:25hiredman(doc make-array)
02:25clojurebotCreates and returns an array of instances of the specified class of the specified dimension(s). Note that a class object is required. Class objects can be obtained by using their imported or fully-qualified name. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE.; arglists ([type len] [type dim & more-dims])
02:25hiredmandefinline you say, hmmmm
02:26huangjsi see. thanks.
02:26huangjsis there any available benchmark result?
02:26zakwilsonFennec: The formatting of your code goes against generally accepted style rules for Lisp - specifically, the closing parens should be on the same line.
02:27Fennecnoted
02:27Fennecsome time soon I shall get a decent editor that'll fix it for me :)
02:27zakwilsonAnd there's some strange indentation there.
02:27Fennecoh, it's a complete mess, I agree :)
02:28zakwilsonAs a rule, Lispers use Emacs. This is a bit of a problem because it means learning a new editor and language at the same time for a lot of people. I'm not sure what the other options are for Clojure.
02:28Fennec..... normally I'd use some emacs mode but I'm temporarily separated from my normal Linux SSH environment (vacationing, which is also why I get to look into this :)
02:28Fennecthe problem with Emacs is that I use emacs at work.
02:28Fennec.... we have a lot of customizations at work.
02:28Fennec..... I'm used to F4 being magic and taking me to wherever something is defined.
02:29hiredmanclojurebot: emacs?
02:29clojurebotemacs is hard, lets go shopping!
02:29Fennecalso, shift-F5 should take me to the .t file for my current .pl script. :P
02:30Fennecin the meantime, I've got this casting issue. :|
02:31zakwilsonYou should keep a copy of your .emacs file, but you're still probably better off with vanilla emacs for Clojure than just about anything else.
02:32hiredmanFennec: casting?
02:32Fennec Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: sun.java2d.SunGraphics2D cannot be cast to clojure.lang.IFn.
02:32Fennec http://pastebin.ca/1285744
02:33hiredmanare you using the latest svn?
02:33Fennecprobably-not.
02:34FennecI'm using the lastest download-link thingy.
02:34hiredmanhmmm
02:34Fennecas I've not bothered setting up svn on Windoze.
02:34Fennecseptember 16 release? yeah, trifle old :|
02:34zakwilsonYou can download the latest svn version from the project site.
02:34hiredman(BufferedImage/TYPE_BYTE_GRAY) <-- this could be a problem
02:34zakwilsonclojurebot: svn
02:34clojurebotsvn is https://clojure.svn.sourceforge.net/svnroot/clojure/
02:35hiredmanI would remove the parens
02:35Fennecnoted. but in my REPL, user=> (BufferedImage/TYPE_BYTE_GRAY) just says 10
02:36hiredmanok
02:36hiredmanwell
02:36hiredman*shrug*
02:36Lau_of_DKGood morning all
02:36hiredmanpreffered method call syntax is (.method object args)
02:37zakwilsonFennec: in graphicPoke, where you have (doto getGraphics ...) I think you might mean (doto g ...)
02:37Fennechmm!
02:37Chousukethough for static methods, use /
02:38Fenneczakwilson- wait, I have (let [g (. image (getGraphics))] (doto g
02:39cgrandGood morning Lau_of_DK!
02:40Fennecwell, I've tweaked it per some of those suggestions and now I'm getting a boolean cast issue so it might be betterish
02:40ChousukeFennec: Note that if you update to SVN your dotos will break. The syntax now requires a dot for methods
02:41Fenneck
02:41Fenneci saw a list of renamed thingies somewhere
02:41Fenneci'll check that when I upgrade
02:41zakwilsonhttp://pastebin.ca/1285755 <-- this doesn't throw any exceptions and displays a giant button, but doesn't do what I think you want it to do.
02:41zakwilsonNote that it uses the new doto method syntax (with dots).
02:42Chousukeso instead of (doto frame (setLayout ...)) you need to (doto frame (.setLayout ...)) -- this change was done to allow mixing in clojure functions (they never have a . in front of them, because those mark java methods)
02:43Fenneczakwilson- yeah, that don't work for me :)
02:44Fennecwhat I want => giant button; when you push it, a red line shows up Somewhere on the space above it.
02:44zakwilsonDoes it work if you remove the dots from the method names in the dotos?
02:45Fennecno, it keeps complaining it can't cast a java.lang.Boolean to clojure.lang.IFn at line 17
02:45Fenneci'll try that svn upgrade
02:46dhayaHey guys, I have a question regarding keyword equality, http://paste.lisp.org/display/72184 (in the above paste, why is the last hash different from the rest)
02:46hiredmanFennec: too many parens on line 17
02:47Lau_of_DKcgrand: oh my. Does this mean that youre back with us again? :)
02:47hiredman((. g ....
02:47hiredman^- double wrapped
02:47Chousukedhaya: hm
02:48Fennecah :)
02:48Chousukedhaya: keywords do not care about namespaces
02:48dhayaThat seems to be causing problems during multimethod dispatch for me. I wonder changed that broke this behaviour.
02:49Chousukedhaya: so :t/testkey is different from :my.test/testkey no matter what your namespace configuration is.
02:50cgrandLau_of_DK: yup!
02:50zakwilsonFennec: this version works, but the line is grey, not red: http://pastebin.ca/1285759
02:50Fennecdoh
02:50Fenneci'm using a greyscale image mode :P
02:51Fennechaha. anyway. awesome. *busy extracting clojure-svn*
02:51zakwilsonWhat are you using for an editor?
02:52Fennecumm.... :)
02:52Fennecnotepad++ :P
02:52Chousukeemacs!
02:52cgranddhaya: (= ::t/testkey ::my.test/testkey)
02:52hiredmanclojurebot: emacs is also <reply>but I like using notepad++!
02:52clojurebotAlles klar
02:53Fennechiredman- no I don't, not really :P
02:53Chousukecgrand: ... that gives me a nullpointer exception
02:53dhayacrand: Thanks! That was it.
02:54Chousukeare you sure you're not abusing keywords there? :(
02:54Fennecshoot
02:54Fennecwhere the heck did I put ant?
02:55dhayaChousuke: I am following this : http://groups.google.com/group/clojure/msg/7be41dbb95a7cfdd
02:55zakwilsonFennec: http://dept-info.labri.u-bordeaux.fr/~strandh/Teaching/Langages-Enchasses/Common/Strandh-Tutorial/indentation.html
02:56Fennec:P
02:56Fennecnoted
02:56Fennecwill learn that
02:57zakwilsonIt's one of the few things that nearly all Lispers agree on.
02:57zakwilsonAnd it will help you spot problems like the one you just had.
02:57hiredmanvimclojure seems to indent if's differently than what is described there
02:58Fennec awesome.
02:58Fennecaha! there is ant. knew I had a copy somewhere.
02:58zakwilsonDoes it line up the then and else clauses with each other and not with the test?
02:58hiredmanyes
02:58zakwilsonThat's still readable.
02:58hiredmanit puts the clauses under the f in the if
02:59hiredmanvery much so
02:59Fennecawesome! it workses!
03:00Fennecthanks a bundle. I shall now go play with this / learn syntax.
03:00Fennecindentation. stuffs.
03:00zakwilsonSo does emacs. I'm not sure I agree with the article on some of the special forms.
03:00hiredman"It's one of the few things that nearly all Lispers agree on."
03:00hiredmanwell, there goes that
03:01zakwilsonGeneral indentation for functions and special forms is standardized as described in the article.
03:55Fennec(defn sinfun [x] (cons x (cons (. Math (sin x)) nil))) ;; surely there's a smarter way to make a 2-element list?
03:56cgrandFennec: (list a b)
03:56cgrandbut do you really want a list?
03:57Fennecwhat else is there? vector?
03:57cgrandyes
03:59Fennecmy goal is to pass these to Graphics2D.drawLine(startX, startY, endX, endY).
04:07cgrandFennec: does sinfun return a point?
04:07Fennecsomething like that.
04:07Fennecyes.
04:11Fennecholy cow it's 1am.
04:11Fennecnight all.
04:11cgrandI guess you have the choice between destructuring or indexed adressing:
04:11cgrand(let [a (sinfun xa) b (sinfun xb)] (.drawLine g (a 0) (a1) (b 0) (b1))) ; works only with vectors
04:11cgrand(let [[x1 y1] (sinfun xa) [[x2 y2] (sinfun xb)] (.drawLine g x1 y1 x2 y2)) ; works with lists or vectors
04:11cgrandnight
08:46AWizzArdHow again can I see the classpath from within Clojure? It must be something similar to (.getProperty System "java.class.path")
08:47Lau_of_DK(System/getProperty "java.class.path")
08:47AWizzArdgood, that works
08:48AWizzArdBtw, why does the other version don't work?
08:48Lau_of_DKalso try (.replace "good, that works" "Thanks")
08:48AWizzArdthe replace also does not work
08:49Lau_of_DKThe other one works here, but Im on an old rev., so maybe they removed the syntax
08:49AWizzArdI just checked out 1160
08:49AWizzArdCould that be it?
08:49Lau_of_DKYes sir
08:54AWizzArdIs there somewhere the description of the new syntax?
08:54Lau_of_DKDescription: (Namespace/Method arguments)
08:54Lau_of_DK:)
08:54ChousukeAWizzArd: it was recently changed
08:54AWizzArdi see
08:55Chousukeclojurebot: svn rev 1158
08:55clojurebotsvn is https://clojure.svn.sourceforge.net/svnroot/clojure/
08:55Chousukeeh
08:55AWizzArdso, (String/replace "abc" "xyz") should work?
08:55Chousukesvn rev 1158
08:55clojurebotsvn rev 1158; force instance member interpretation of (.method ClassName), e.g. (.getMethods String) works
08:55Lau_of_DKclojurebot: svn rev 1157
08:55clojurebotsvn is https://clojure.svn.sourceforge.net/svnroot/clojure/
08:55Chousukethat was the change that broke (.getProperty System ...)
08:56AWizzArdhmm
08:56Chousukeit was intentional; you're supposed to use / with static methods
08:56AWizzArdokay
08:56Chousuke(.foo Classname) is now interpreted as Classname being an object of type Class
08:56rhickey_(.getProperty System) was always wrong, as (.foo bar) is for instance, not static, methods
08:57AWizzArdgood to know
08:59Chousukerhickey_: what about (. System getProperty "foo")?
08:59rhickey_Chousuke: nothing has changed about that
09:01Chousukeokay
09:01rhickey_latest doc: http://clojure.org/java_interop
09:04Lau_of_DKrhickey_: Im really very interested in the outcome of the work in regards to the problems Cliff Click pointed out, is this something that will be shared within the community at some point?
09:05rhickey_Lau_of_DK: which problems?
09:06Lau_of_DKPrimarily the STMs performance problems, but also the byte-code "holes" that Clojure emits (this being completely secondary)
09:06Lau_of_DK@ rhickey_
09:07rhickey_Lau_of_DK: what STM performance problems? He had good things to say about the STM
09:07RSchulzLau_of_DK: One thing I think we can expect from the Sun JVM is the application on (the already-existing) escape analysis to allocate many local values on the stack, not the heap.
09:07blackdogLau_of_DK, i sent you the link the last time you mentioned this
09:08rsynnottthis? : http://blogs.azulsystems.com/cliff/2008/05/clojure-stms-vs.html
09:08Lau_of_DKSome of it was good, but he mentioned that when you increased the amounts of threads when there was contention for initially yield a little better throughput, and then crater (as he put it)
09:08rhickey_He also wrote his loop benchmark before bitops were inlined - I sent him a subsequent drop and he acknowledged to-the-metal perf from Clojure too on his blog
09:08rsynnotthe doesn't seem to demonstrate that it is actually worse than locking, whne it comes ot it
09:08Lau_of_DKrhickey_: Cool
09:08Lau_of_DKblackdog: I dont remember :(
09:09Lau_of_DKrsynnott: Ok :)
09:09rhickey_Lau_of_DK: the crash and burn test he had ? about whether it was the code or some JVM bug - in non-conclusive analysis it looked like a JVM library reentrant read/write lock leak
09:09rhickey_i.e. not Clojure
09:10Lau_of_DKrhickey_: Ok, but that still makes it pretty interesting. But I think the link to his blog actually answers all my questions, I see he's echoed the entire conversation regarding the STM
09:10rhickey_the TSP Ant Colony Optimization came up and ran fine- full use of 600 cores
09:11Lau_of_DKuuuh
09:11Lau_of_DK:)
09:12rsynnottrhickey_: do you have any plans to add a more extensive (CLOS-like?) object system?
09:13ChousukeI hear it generated an insane amounts of garbage though, but apparently for that system it amounted to almost nothing :P
09:13Chousuke-an
09:14Lau_of_DKIm not completely turned of by OOP, if I can be handled in a concurrent-friendly manner it'd be a welcome addition to Clojure
09:14rhickey_Chousuke: generating garbage is not a problem, the while poiunt was to demonstrate how cheap that has become - this is a test that churns constantly, so, the faster you can handle GC the faster it goes.
09:14rhickey_whole point
09:15Chousukethere's always room for improvement though. :)
09:15Chousukebut is it something you can do on the clojure side, or will you need JVM improvements?
09:16rhickey_Chousuke: I don;t understand your point, if you have a benchmark program that calls new at all, it will generate garbage, there's nothing to improve except not to call new, which would be a different program
09:17rhickey_the point is 600 cores calling new in a tight loop can handle gigs of garbage per second
09:18Lau_of_DKImpressive
09:21Chousukecertainly is
09:23Chousukeit's interesting how java has a reputation of being "slow"
09:23rsynnottdoes it?
09:24Chousukemaybe it's just the desktop apps.
09:24rsynnottI'd guess that's much the same as the Common Lisp reputation for being slow
09:24duck1123I think people have bad memories of applets trying to load
09:24rsynnott(that is a 'reputation' perpetuated by people who have either never used it, or last used it some decades ago)
09:24Lau_of_DKJava is slow in regards to desktop adds and those pesty applets
09:25Chousukethe jvm often takes a while to start and that gets interpreted as "slowness" and then generalised to the entire app
09:25Lau_of_DK.Net is fast though
09:25Chousukeor maybe the most common java desktop apps are just bloted and slow. :P
09:25rsynnottswing was not too fast, certainly
09:36RSchulzChousuke: Something like IDEA proves that very large Swing applications can be very responsive.
09:36RSchulzI'd say the most pervasive remaining performance issue for Java is the very long JVM start-up time.
09:38ChousukeThey seem to be working on that too
09:57RSchulzChousuke: When I implemented my simple-minded interface that allows me to invoke from a Clojure REPL things that used to be run from the command line, the feeling of responsiveness was astounding by comparison to what I was used to.
10:39duck1123Does anyone know how to shut down a swank server? I'm not seeing a function for it.
10:41deklundduck1123: you mean above and beyond slime-quit-lisp ?
10:41duck1123I mean from within clojure, not emacs
10:42drewrduck1123: (System/exit 0)
10:42duck1123My problem is, I'm spawning a slime server within Tomcat, but when I shut down the server, it's not releasing the port
10:48danlarkinoh you want to use non exclusive ports
10:48danlarkinor whatever they're called
10:49duck1123I just want swank to shutdown/release the port when tomcat shuts down
11:22danlarkinduck1123: http://hea-www.harvard.edu/~fine/Tech/addrinuse.html
11:26daswerthHi everybody. Does anyone know if there is a way to get at the xml that the API pages are generated from? Is there a place to download the API or the xml?
11:26duck1123danlarkin: thanks. It looks like that will help. (I need to read it again in full)
11:28Chouserdaswerth: the API pages are generated from var metadata -- I don't know that they go through an XML stage
11:29RSchulzAs I understand it, the Clojure.org Wiki software has its own mark-up format that they generate from the Var metadata.
11:35daswerthOh, I see. What exactly is the "var metadata"
11:36RSchulzEvaluate ^var for some var and you'll see it.
11:36RSchulzThere's lots of interesting stuff put there by the compiler, including doc strings.
11:36Chouserderefernced var: filter
11:36Chouservar itself: (var filter) or #'filter
11:37Chouservar metadata: (meta (var filter) or ^#'filter
11:38RSchulzSorry. I got that wrong. I need to keep the Read documentation page open all the time. I should have checked first.
11:38Chouserand I forgot a paren. Don't beat yourself up. :-)
11:38hiredmanRSchulz: what is this email about?
11:39RSchulzEh?
11:39hiredmanI don't understand what you are asking about the multiple defs in a macro
11:39RSchulzWhich email?
11:39daswerthGreat, thanks for your help. :)
11:39RSchulzI have a macro that yields three (def ...) forms and I was wondering if that was a good idea or not.
11:39hiredmandon't see why not
11:39RSchulzIt synthesizes two of the names from one of the arguments to the macro.
11:40RSchulzI guess I don't, either, but I wanted to check. As I mentioned, the first thing I noticed is that only one Var is returned, that of the last (def ...) form.
11:41RSchulzThat was what I didn't like. In my case, there's potentially a lot of computation including disk and network I/O entailed by the extra defs, and that's probably a bigger issue but also what's making me uneasy about this particular case.
11:47mfredricksonRSchulz: could you do what you want with a destructuring form: e.g. (mydef [sym1 sym2 sym3] ...)
11:47mfredricksonthat way you are not introducing symbols the user didn't specifically name
11:48RSchulzSure, I could let the user choose all the symbols. In fact, that's probably much better than what I did.
11:48mfredricksonas I understand it, automagically making symbols is (anaphoric macros?) is frowned upon in some camps
11:48RSchulzI think also in my particular case, the magnitude of the potential side-effect (on "legacy" Java classes) that are implied by that "all-in-one" macro are it's most troubling charcteristic.
11:49mfredricksonRSchulz: i see. i did not entirely understand the concern
11:49RSchulzWell, there's a camp for every frowny-face out there...
11:49RSchulzProbably I'm just making it up. I'm concerned about style and possible bad practices, but that doesn't mean everything I write will actually _be_ bad...
11:50mfredricksonand what a camp it would be: sad campfire songs, crying yourself to sleep in your bunk, making very morose handy crafts
12:20replacaRSchulz: I just did a similar thing for unit tests with my simple-tests macro: http://github.com/tomfaulhaber/unit_test/tree/master/unit_test.clj
12:20replacaMakes certain kinds of unit test sequences *much* easier to read
12:21RSchulzGithub sure is overtaxed... Anyway, I think you can probably justify a lower standard of cleanliness in test code than in main-line code. Or is that heresy?
12:22replacaWell, that depends. You don't want test code to become a drag on your development
12:22replacaAlso, gross code is gross wherever you find it :-)
12:22replacaRSchulz: What do you mean by overtaxed? Slow?
12:23RSchulzYes. It takes forever for their pages to load.
12:23replacaHmmm, I'm not having that problem. I wonder if that's just cause I'm a few blocks from them :-)
12:24replacaI know they were doing a hardware upgrade last night
12:24hiredmancomes up fast here
12:25duck1123even when github is slow, I can usually load 2-3 pages to sourceforge's 1
12:25hiredmanugh
12:25hiredmansf
12:25replacaAnother argument in favor of multiply defining tests is that it makes them easier to *write* so I'm more inclined to write more cases
12:26replacasf is *sooo* 2002 (insert 13-year-old girl eye roll here) :-)
12:29gnuvinceAny math buffs in here? This is a rather simple question which is not properly explained in my text book. The notation f : x -> y = f(x), does that mean that f is a function from the domain x to the codomain y where the image of the function is f(x) ?
12:32fogusI am building keywords in my macros, but at the moment the way it's done is (keyword (str `~s))... Is there a better way?
13:06Lau_of_DKGood evening gents
13:16durkaChouser: show and source are great, but can I suggest a feature for show
13:16durkanamely some way to show the "interesting" methods, i.e. filter out methods that are just inherited from (say) Object
13:17Chousukemaybe add some optional :filter argument?
13:22durkahmm, (source show) doesn't look too scary
13:22durkamaybe i'll take some blind stabs later
13:22durkanow i really do have to go
13:38Chouserfogus: I can't think of a better way to get from a symbol to a keyword.
13:39fogusChouser: I was afraid of that
13:40fogusIs there any reason why :~s is illegal?
13:46RSchulzfogus: It seems you're thinking that some kind of string concatenation will take place there, but that's not how it works.
13:48RSchulzI'm not entirely sure what happens, but probably the keyword parsing triggered by colon is interrupted by the reader macro character ~ yielding a "degenerate" keyword, which is not allowed:
13:48Chousersymbols and keywords are unrelated types, so I'd expect any "conversion" to have to go through a string.
13:48RSchulzuser=> :
13:48RSchulzjava.lang.Exception: Invalid token: :
13:48fogusRSchulz: '~s that does what I would expect, but :~s does not.
13:48RSchulzBecause ' just wraps whatever reader entity comes next in (quote ...)
13:49RSchulz:, however, initiates the reading of a single reader entity, a keyword.
13:49Chouserfogus: you're sure you don't want to pass in keywords from higher upstream?
13:49fogusRSchulz: Understood
13:49fogusChouser: Pretty sure
13:53fogusI'm working on a stupid little DSL that was poo-pooed on when passing in keywords... but is praised when my macros do the wrapping/unwrapping :)
13:54Chouserheh
13:54Chousergood enough, then.
13:55Chouserhm, that's not good: (namespace (keyword (str 'user/foo))) ==> nil
13:56Chousukeisn't that expected?
13:56Chouserfogus: and you also don't want to leave them as symbols internally?
13:56ChouserChousuke: you wouldn't expect a namespace of "user" and name "foo"?
13:56Chousukekeywords don't care about namespaces AFAIK.
13:56ChouserChousuke: not true
13:56Chouser(namespace ::foo) ==> "user"
13:57Chouser(namespace :one/two) ==> "one"
13:57fogusI could do that... but the problem is that changing the top-level macros are a lot easier than changing the backend
13:58Chouser(keyword "one" "two") ==> :one/two
13:58Chouserfogus: ok, just asking. what you've got seems fine, modulo that namespace issue I just mentioned.
13:58fogusChouser: Thanks for the heads up
13:58Chouserfogus: you can of course put that little snippet in a 'to-keyword' function or something.
13:59Lau_of_DKChouser: Did you check out that little something something I passed along? :)
13:59fogusChouser: done. :)
13:59Chousukehm.
13:59Chousukeinteresting indeed
14:01Chousuke:user/user/foo has namespace user/user (is that valid?) but (keyword "user" (str 'user/foo)) has namespace user... they print the same, but are unequal
14:01RSchulzfogus: Does it actually matter whether the Key Words are actually Clojure keywords?
14:01RSchulzIf you're writing a DSL, then you're using macros, presumably.
14:02RSchulzAnd if you're using macros, you control evaluation.
14:02RSchulzSo the self-evaluating nature of keywords is less critical
14:03RSchulzOf course, their identity as functions (of Maps) may still be important, if you're using that aspect.
14:03ChouserChousuke: It's ok to have / in namespace names, but not (I think) in symbol and keyword names
14:03fogusRSchulz: It does for that reason (identity as functions)
14:03ChouserThere's an open issue about validating symbols and keywords created programmatically (instead of via the reader)
14:03RSchulzfogus: "It?"
14:03Chouserfogus: symbols also are functions of maps
14:04fogusRSchulz: Using keywords is kinda critical to the way that the DSL works.
14:04RSchulzYes. I understand. I'm asking if that aspect of Clojure is essential to your use.
14:04RSchulz...that aspect of Clojure keywords... that is.
14:04fogusRSchulz: yes
14:04RSchulzWell, OK.
14:04Chouser('b '{a 1, b 2, c 3}) ==> 2
14:04RSchulzHmmm... Did I know that already??
14:05RSchulz(Just musing, of course)
14:05fogusI didn't
14:05ChouserRSchulz: maybe -- it comes up as an issue on the group pretty often
14:05fogusWhere were you about a week ago?
14:05fogus;)
14:05RSchulzUh-oh. I hear a proposition...
14:05jawolfeHi, does anyone have tips on debugging? At runtime, I keep getting cryptic error messages like NullPointerException or ClassCastExceptions, where clojure.lang.Compiler.eval is at the top of the stack and the proper source file / line number is nowhere to be found in the stack trace.
14:05Chouseran issue because people mis-quote things: ('+ 1 2) ==> 2
14:06Chousukeheh
14:06RSchulzjawolfe: I wrote a function (pst2) ("printStackTrace 2nd") that does (.printStackTrace (.getCasue e)) to get at the nested exception.
14:06RSchulzI overloaded it with a zero-arity version that just goes straight to *e
14:07jawolfeRSchulz: hmmm, I don't understand but I'd like to try it out ...
14:09RSchulzjawolfe: Check it out:
14:09RSchulz(defn pst2
14:09RSchulz "Print the stack trace of the \"cause\" of the specified exception or *e if none passed"
14:09RSchulz ([] (.printStackTrace (.getCause *e)))
14:09RSchulz ([e] (.printStackTrace (.getCause e)))
14:09RSchulz)
14:10fogusChouser: Thanks for the tips. I'm off to do some refactoring.
14:10Chouserfogus: ok, have fun!
14:10jawolfeRSchulz: thanks, I'm trying now
14:11Chouserjawolfe: you could paste the whole stack trace
14:11RSchulzIs paste.lisp.org still in melt-down mode?
14:12Chouserwhen the bot's not here, that's usually a clear sign
14:12ChouserChoosing 'none' for the channel usually works though
14:12RSchulzIt doesn't seem to allow specifying a channel, and of course if you don't, the bot can't post here (or anywhere)
14:12jawolfeChouser: I don't have a specific bug right now, just the past few have been very hard to hunt down
14:13Chouserah
14:13RSchulzjawolfe: Note, too, that sometimes there's a chain longer than two of exceptions. My function could be generalized to look deeper for those cases, but they seem less common.
14:13ChouserIf it's a runtime bug, I can usually find my .clj in the stack trace *somewhere*.
14:14jawolfeRSchulz: Thanks! I'm still trying to figure out how to use this ... how do you catch exceptions again?
14:14ChouserIf it's a compile-time bug, my .clj is often nowhere in the stack trace, but maybe in the top-level exception itself.
14:14RSchulzThere's a special form try, but you dont' need to do that.
14:14RSchulzWhen you get an exception in the REPL, it binds *e to that exception.
14:14jawolfeChouser: try this
14:14jawolfe(defn stupid [seq] (seq seq))
14:14jawolfeput that in your source file
14:15jawolfecompiles fine
14:15jawolfewhen you run, no mention of the source file in the exception
14:15RSchulzYou can't apply seq to a function. And seq is a function.
14:15jawolfeyes i know :)
14:15jawolfei was rebinding seq by mistake and ran into this (not used to lisp-1)
14:16ChouserBoth when I call (stupid) and (stupid 1), I get a correct file name and line number in the stack trace.
14:17jawolfeRShulz: in this example pst2 prints nil
14:17RSchulzYou have to call it immediately after you get the exception in the REPL or else save an excpetion object to pass to the 1-arg version.
14:18jawolfeRShulz: oh, i probably cancelled the exception first
14:18jawolfeChouser: try (stupid '(1 2 3))
14:18Chouserhttp://paste.lisp.org/display/72201 -- note lines 9, 20, and 21
14:19Chouserthat looks the about the same as the second trace in my paste -- different class name, but same filenames and line numbers.
14:20Chouserjawolfe: are you using emacs/slime/swank?
14:20jawolfehmmm, maybe it's something about how i'm testing then
14:20jawolfeChouser: yes
14:20ChouserI'm not at all sure that particular development stack is doing Clojure and great service.
14:20Chouserjawolfe: are you seeing stack traces like I pasted?
14:21jawolfeChouser: my stack traces are different
14:21Chousersimilar but with no useful file names, or completely different?
14:21jawolfewhen I put the definition and invocation into seqs.clj, i get
14:21RSchulzWhen in doubt, quite and restart your Clojure REPL.
14:21jawolfejava.lang.ClassCastException: clojure.lang.PersistentList (seqs.clj:0)
14:21jawolfe [Thrown class clojure.lang.Compiler$CompilerException]
14:21jawolfeRestarts:
14:21jawolfe 0: [ABORT] Return to SLIME's top level.
14:21jawolfe 1: [CAUSE] Throw cause of this exception
14:21jawolfeBacktrace:
14:21jawolfe 0: clojure.lang.Compiler.eval(Compiler.java:4153)
14:21jawolfe 1: clojure.lang.Compiler.load(Compiler.java:4470)
14:21jawolfe 2: clojure.lang.RT.loadResourceScript(RT.java:327)
14:21jawolfe 3: clojure.lang.RT.loadResourceScript(RT.java:316)
14:21jawolfe 4: clojure.lang.RT.load(RT.java:406)
14:21jawolfe 5: clojure.lang.RT.load(RT.java:376)
14:21jawolfe 6: clojure.core$load__1838$fn__1840.invoke(core.clj:3427)
14:21jawolfe 7: clojure.core$load__1838.doInvoke(core.clj:3426)
14:21jawolfe 8: clojure.lang.RestFn.invoke(RestFn.java:413)
14:21jawolfe 9: clojure.core$load_one__1801.invoke(core.clj:3271)
14:22jawolfe 10: clojure.core$load_lib__1821.doInvoke(core.clj:3308)
14:22jawolfe 11: clojure.lang.RestFn.applyTo(RestFn.java:147)
14:22jawolfe 12: clojure.core$apply__144.doInvoke(core.clj:374)
14:22jawolfe 13: clojure.lang.RestFn.invoke(RestFn.java:443)
14:22jawolfe 14: clojure.core$load_libs__1825.doInvoke(core.clj:3338)
14:22jawolfe 15: clojure.lang.RestFn.applyTo(RestFn.java:142)
14:22jawolfe(sorry for flood)
14:22jawolfethis is consistently what i see, i tried updating to newest svn of clojure and same deal
14:22jawolfeif i do the invocation at the REPL, i don't get any mention of seqs.clj at all
14:22Chouserplease use http://paste.lisp.org/ next time
14:22Lau_of_DKjawolfe: In emacs there's a nice mode, where with you can paste along stacktrace, and emacs will automatically make it an online Lisp paste and send that to the channel isntead
14:23jawolfeOK, sorry about that, will do
14:24Chouserjawolfe: yeah, I have no idea. My only guess is that slime/swank is somehow obscuring the true error
14:24drewrjawolfe: Hit 1 until you get there.
14:24jawolfedrewr: oh, wow
14:24jawolfedrewr: thanks
14:25drewrThat shows the CAUSE. :-)
14:25jawolfedrewr: I never read that line, since with SBCL that says "Abort lisp procesS" or some such
14:25drewrHeh. I didn't either for the longest time.
14:26jawolfewow, that will make my life much easier
14:26jawolfethanks!
14:40kotarakDoes anyone know, what the main differences between CPL and EPL are?
14:41hiredmankotarak: there is an faq, I forget where it is, my take away was "nothing"
14:41hiredmanbut Iguess that cannot be right
14:43drewrDid the semantics change recently with import?
14:43drewrFor some reason I can't do (import '(org.apache.commons.logging Log)).
14:44danlarkintoo many licenses imo
14:44drewrTells me java.lang.ClassNotFoundException: org/apache/commons/logging/Log
14:44drewrThe jar shows up on the command line from ps.
14:44drewr-cp ...:/path/to/commons-loggin-1.1.1.jar:...
14:45drewrlogging
14:45drewrI can't think of what else I'm doing wrong.
14:46drewr$ jar tvf ~/tmp/src/jar/commons-logging-1.1.1.jar | grep logging/Log.class
14:46drewr 479 Thu Nov 22 00:28:06 CST 2007 org/apache/commons/logging/Log.class
14:46Chouserdrewr: I don't think anything about that has changed recently.
14:47drewrOdd.
14:47drewrThis has completely killed my productivity today.
14:50Chouserdrewr: works for me.
14:51drewrtrunk@1160?
14:51Chouseryep
14:51Chouseryou might do "ant clean" and rebuild clojure if you haven't
14:52drewrYeah, that's how I rebuild.
14:52Chouserthe error is coming from the import line?
14:52drewrYeah, that's just an example though. None of my jars works for some reason.
14:52drewrI can (import '(java.io File)) though.
14:52Chouseroh my.
14:55Chouserdrewr: the output of this looks right?
14:55Chouser(dorun (map println (.getURLs (ClassLoader/getSystemClassLoader))))
14:55drewrHm, yep. All the stuff from -cp.
14:59AWizzArd115 people in here, nice. What was the record so far?
15:00AWizzArdhiredman: does your clojurebot keep track of the max number of visitors?
15:00hiredmanno
15:01hiredmanlemme check if pircbot gives me an easy way to track that
15:02hiredmanoooh
15:07hiredmanclojurebot: max people?
15:07clojurebotmax people is 116
15:07AWizzArdnice
15:08hiredmannot done
15:15hiredmannow it's done
15:15hiredmancan't be bothered to figure out how to update the proxy live
15:15AWizzArdgrats
15:17hiredmanhmmm
15:20drewrNo matching method found: sleep for class java.lang.Class
15:20drewrThat's screwed up.
15:20AWizzArddrewr: you updated your clojure.jar?
15:21AWizzArdYou must say: (Thread/sleep ...)
15:21hiredmanthat just bit me
15:21AWizzArdI had the same, it was svn 1158. Rich explained that (.sleep Thread ...) always was wrong. Clojure was just so nice to allow it for a while.
15:22hiredmanI hope I got all the static methods
15:24drewrAWizzArd: Ah, thanks!
15:27hiredmanclojurebot: *
15:27clojurebot* is just for when you are lazy and sloppy
15:27hiredmanclojurebot: * is also <reply>http://en.wikibooks.org/wiki/Java_Programming/StarImports
15:27clojurebotIn Ordnung
15:28kotarakIs there a way to unquote things in a normal quote? (def bar 5) (quote (foo ~bar baz)) => (foo 5 baz)?
15:30danlarkinkotarak: no I think you'll need to use syntax-quote for that
15:30Chouserkotarak: I don't think so. The reader gets mad when it sees ~ outside of a `
15:31kotarakAnd there is no (quasiquote ....) for `, as is (quote ...) for '...
15:33Chouserkotarak: I think that's right.
15:33drewr(use [clojure.contrib.str-utils :as s]) => java.lang.ClassNotFoundException: clojure.contrib.str-utils
15:34kotarakdrewr: you must quote the vector
15:34drewrHm.
15:34drewrWhy does this give me a different error? (use '(clojure.contrib.str-utils :as s))
15:35drewrDon't know how to create ISeq from Keyword.
15:35kotarakBecause you use a list and not a vector
15:35Chouserdrewr: that's trying to use a list of libs, str-utils, :as, and s
15:35drewrThey're both seqs.
15:35drewrhm.
15:35Chouservectors in 'use' and 'require' are for options on a particular lib, lists are for lists of libs
15:36drewrOK.
15:36kotarakdrewr: hmmm.. I think a list is a list and a vector is a vector. You can both ask for seq, which is a view on them. But they on themselves are collections, not seqs.
15:36ChouserI find it pretty hard to use correctly, but I haven't complained much because I haven't come up with anything better
15:37drewrI know.
15:37drewrI normally use (ns) anyway, but I'm trying to figure out this importing mess.
15:37Chouserkotarak: almost. lists are one of the few (the only) collections which is its own seq
15:38kotarakChouser: for lists, yes. But for general collections this is not the case.
15:40Chouserkotarak: right
15:40drewrThere's nothing syntactically wrong with this, right? (import '(org.apache.poi.hssf.usermodel HSSFSheet))
15:41drewrIt produces java.lang.ClassNotFoundException: org/apache/poi/hssf/usermodel/HSSFSheet. That doesn't smell like a syntax problem though.
15:42drewruser> (filter #(re-find #".*poi.*" (str %)) (into [] (.getURLs (ClassLoader/getSystemClassLoader))))
15:42drewr(#<URL file:/Users/aar/tmp/src/jar/poi-3.2-FINAL-20081019.jar>)
15:42Chouser(import '(foo.bar Baz)) ==> java.lang.ClassNotFoundException: foo.bar.Baz
15:42ChouserMy exception has dots instead of slashes
15:43drewrOS X did a Java update on me. What's your java -version?
15:43drewrjava version "1.5.0_16" here.
15:43Chouser1.6.0_0-b11
15:44Chouserthat could explain the different message
15:45drewr(.getProperty System "java.version")
15:46drewr"1.6.0_07"
15:46Chouserheh: No matching method found: getProperty for class java.lang.Class
15:46drewrYeah, sorry.
15:46drewr(System/getProperty "java.version")
15:46Chouser"1.6.0_0"
15:46drewrAnyway, I still get java.lang.ClassNotFoundException: org/apache/poi/hssf/usermodel/HSSFSheet!
15:47Chousercan you slap together a little Java program to use that class and make sure that works?
15:49drewrHow about this:
15:49drewruser=> (org.apache.poi.hssf.usermodel.HSSFWorkbook.)
15:49drewr#<HSSFWorkbook org.apache.poi.hssf.usermodel.HSSFWorkbook@609903f4>
15:49drewruser=> (import '(org.apache.poi.hssf.usermodel HSSFWorkbook))
15:49drewrjava.lang.ClassNotFoundException: org/apache/poi/hssf/usermodel/HSSFWorkbook (NO_SOURCE_FILE:0)
15:49drewrHow is that possible?
15:49Chouserwow
15:54galdorhi!
15:54galdorI'd like to use clojure for a school project
15:54galdorit must run as a java applet
15:55galdorso I think it would be a way to use lisp and stay on the requirements
15:55galdorI didn't see a lot of thing about applet programming in clojure
15:55Chousergaldor: It doesn't quite work yet.
15:55RSchulzWhence the requirement for execution as an applet?
15:56RSchulzJava applets in browsers are just a dead-end, if you ask me.
15:56galdorthe teacher wants a web-based end-user interface
15:56drewrIs there a file limit to -cp?
15:56galdorBUT it's a language processing application
15:56galdorso I need sound input
15:57Chousukegaldor: can't you write the backend separately from the frontend?
15:57galdorit's flash or java
15:57Chousergaldor: I've got a small patch to Clojure which allows appletviewer to load a compiled Clojure app, but I've so far failed to get it to draw anything.
15:57galdorChousuke: if I need java for the applet, what's the problem ?
15:57RSchulzdrewr: None that matters, I don't think.
15:57galdorI read http://groups.google.com.sg/group/clojure/browse_thread/thread/f0c69735c5a9bd03/1e0dced366af9077?lnk=gst&amp;q=webstart&amp;fwc=1
15:58galdorif I can compile a clojure application to java bytecode, it should work, nop ?
15:58Chousukegaldor: applets run in a restricted environment and clojure doesn't quite like that. :/
15:58Chousukethere are things you can't do even with java if you're running as an applet
15:58Chousergaldor: you can sign the applet and that'll wor
15:58Chousergaldor: your user has to click through a permissions step
15:59RSchulzChousuke: What about WebStart / JLP? (It's JLP, right Java Launching Protocol or some such)? There you get to control the degree of sandboxing-style restriction, right?
15:59RSchulzJNLP, maybe?
15:59RSchulzYeah, JNLP: http://java.sun.com/developer/JDCTechTips/2001/tt0530.html
16:00galdorChouser: honestly, I don't care, I do not sell this application, I've to do it to get my diploma, that's it
16:00galdoras long as the teacher can click on a link, see the application running and test it, it's fine for me
16:00RSchulzIf I was under deadline in a class, I wouldn't pin my hopes on Clojure in an applet right now...
16:01galdorit's clojure or bare-java
16:01galdorI know some lisp
16:01RSchulzCan't you make the case to your teacher that the browser is a non-essential element of the exercise?
16:01galdorI don't know java
16:01RSchulzIs this a programming class?
16:02galdorit's a computer science master, and a spoken language processing course
16:02RSchulzWhat languages are you comfortable with? What's the time-frame for completion?
16:02galdorif the user needs to download a jar, perhaps it will be ok
16:02galdorI'm a C programmer
16:02RSchulzEither way, Java would have to be installed on the system.
16:02RSchulzIf you're a C programmer, I'd say Java is closer than Clojure.
16:03galdorbut honestly, 2 months for a voip network with audio processing with C...
16:03Guest38653Can anyone tell me how to do if __name__ == "__main__" in clojure?
16:03galdoryep, but I hate C++ and java, and discovered lisp some months ago
16:03galdorlove it
16:03Guest38653coming from python
16:03RSchulz(= __name__ "__main__")
16:03RSchulzGuest38653: Are you asking about pattern matching?
16:04frodwithit's a python idiom
16:04zakwilsonClojure is not the only option for a Lisp on the JVM. I believe Kawa makes it pretty easy to make applets.
16:04Guest38653In python, that would detect if the current module is the main module
16:04frodwithhere's a package - if it's being run a script, do:
16:04RSchulzI know no Python.
16:04danlarkinGuest38653: you don't need the if __name__ == "__main__" idiom in clojure
16:05Guest38653Sorry, i'm new to irc, I think people are whispering at me? How do I whisper?
16:05seraphzakwilson: kawa is a scheme impl in java, just like sisc. there is also a new lisp impl in java called armedbear
16:06zakwilsonseraph: Yes, I've heard of ABCL. I don't know if it's any good.
16:06seraphdunno if they can run java-applets, but i think all of them create bytecode at runtime and i dont think its allowed in an applet
16:07galdorzakwilson: I don't know, I googled for lisp on jvm, found clojure
16:07galdorseems used a lot recently
16:07galdorlot of resources, doc, people
16:07zakwilsonClojure is growing very fast right now.
16:07zakwilsonKawa, on the other hand has been around a while. I don't think it ever got a huge amount of attention.
16:08zakwilsonhttp://www.gnu.org/software/kawa/Applet-compilation.html
16:08galdorif I have to learn a new thing, I'd like something I could reuse
16:08galdorclojure allow me to do concurrency, etc.
16:08galdoryou link shows a nice example though
16:09zakwilsonI think Clojure is more useful in general. On the other hand, Kawa will make it easy to do what you said you want to do.
16:11mchurchWhat is the best way to make arbitrary Unix/command-line calls in Clojure?
16:12gnuvinceYou mean like system()?
16:12AWizzArdChouser: any news about Applets written in Clojure? Do you know what components are missing to make that work?
16:16danlarkinmchurch: (.exec (Runtime/getRuntime) "ls")
16:17mchurchdanlarkin: Great. Thanks.
16:24Chousergaldor: someone did a signed applet in Clojure ages ago, so it should still be possible.
16:24Chouser(where "ages" == "months")
16:25ChouserI don't know how to go about doing that, but that's a directly you could look.
16:33replacaGuest38653: clojure works a little differently than python here because it's based on the jvm
16:34seraphreplaca: i think Guest48653 already left
16:34hiredmanclojurebot: max people?
16:34clojurebotmax people is 116
16:34replacaAhh, gave up, did he?
16:34replacaoh well/
16:41AWizzArdChouser: do you mean galdor or AWizzArd?
16:41Chouserhe does raise a good point. The closest we've got is (defn -main ...), which may be close enough.
16:42ChouserAWizzArd: I meant galdor. My work with unsigned applets hasn't progressed much.
16:42ChouserI think I've got a (very rough) patch that addresses the dynamic classloader issue, but I can't be sure because something else is failing and I'm not sure what.
16:57danlarkinChouser: you better not move on to another language, we'll suffer too much :'(
17:02Chouserdanlarkin: aw, what a sweet thing to say!
17:02danlarkinwhich should tell you something, since I am certainly not known for being sweet
17:04drewrTo what is Chouser moving??
17:06ChouserI'm much more concerned about what happens in rhickey gets busy doing something else.
17:08abrooksYes, at this point, Clojure seems quite vulnerable to "bus accidents". rhickey has a lot of the long term vision in his head. We should keep him very, very safe. :)
17:08abrooks... safe AND happy. :-D
17:09Chouseryes, and while I don't think I can do much about the former, we can all help with the latter.
17:10Chouser...one of the reasons I'm a big advocate of not whining about revision control choices, license choices, etc.
17:25danlarkinwe could all chip in for a safety bubble
17:26danlarkinhttp://fashionindie.com/wp-content/uploads/2008/03/bubble_boy2.jpg ... even looks like rhickey's hair
17:26drewcdanlarkin: i'd contribute :)
17:42drewrChouser: It was -Xbootclasspath/a:clojure.jar!
17:44hiredmanclojurebot: haskell?
17:44clojurebotNo entiendo
17:44hiredmanclojurebot: haskell is <reply>Yo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you compute.
17:44clojurebotIn Ordnung
18:32Chouserdrewr: all your class-visibility weirdness?
18:32Chouserdrewr: just removed -Xbootpath and it worked?
18:33drewrYep.
18:34drewrIt seems to occur only with the poi jar in the mix. I was tired of investigating.
18:36Chouseryep. well, good to know.
19:29ChouserRT/load uses baseLoader() which currently requires the custom dynamic classloader.
19:30ChouserRT/load needs this apparently just to check timestamps to see if the .clj needs to be recompiled.
19:30ChouserI would if it would be appropriate to allways use the contextClassLoader forthis.
19:30rhickeyChouser: probably
19:34dreishHas anyone else seen ridiculously bad threading performance running Clojure on Mac OS X? Like, pmap taking about ten times longer than map and only 140% CPU on a machine with 8 cores, whereas the same code on an 8-core Linux box runs about twice as fast as pmap?
19:34rhickeyChouser: I think we may need to have some explicit way to declare - No dynamic classloader please
19:34dreish(twice as fast _with_ pmap, I meant)
19:36dreishOn Linux, with both IcedTea 1.7.0 and Sun's 1.5, I managed to squeeze roughly another 40% out of the benchmark discussed at http://groups.google.com/group/clojure/browse_thread/thread/972bab614b27c6f8?hl=en
19:37Chouserwe have USE_CONTEXT_LOADER
19:38Chouserif everything used RT/baseLoader instead of RT/ROOT_CLASSLOADER, then *use-context-classloader* would be sufficient.
19:39Chouser...assuming there was some way to set that value early enough.
19:40rhickeyChouser: yes, moving away from direct references to ROOT_CLASSLOADER is part of this change
19:48drewrIf I need to keep an index looping through a seq, is (loop [x xs i 0] ... (recur (rest xs) (inc i))) the only way?
19:48drewrThat there was a way to do it with doseq, but I'm not getting it.
19:49mfredrickson(doc indexed)
19:49clojurebotIt's greek to me.
19:49mfredrickson(doc index)
19:49clojurebotExcuse me?
19:49drewrEr, "I thought that.."
19:50mfredricksonclojure bot is going senile: http://clojure.org/api#toc590
19:50mfredricksonclojurebot: clojurebot is senile
19:50clojurebotAck. Ack.
19:50mfredricksonthough that may not be what i think it is
19:51mfredricksonthe function might be in clojure-contrib
19:52mfredricksondrewr: i think what you want is (indexed ...) in clojure.contrib.seq-utils
19:53wipewindowsanym americans here? can you drink tapwater in USA? everywhere?
19:53wipewindowsin california?
19:54mfredricksonwipewindows: certainly in CA, but ironically they all drink bottled water
19:54wipewindowswhy?
19:54mfredricksonpretension
19:54mfredrickson(says a former CA resident)
19:55wipewindowsis your showerwater drinkable?
19:55mfredricksoni always drink my showerwater when done. ;-)
19:56slanganwhich definition of pretension? 4?
19:57mfredricksonit was a joke. If my memory serves, the city of San Francisco forbids government agencies from buying bottled water. The state is getting it's act together
19:57mfredricksons/it's/its
19:57mfredricksonarg
19:58slanganis bottled less wsteful?
19:58mfredricksonprecisely
19:59wipewindowsjust thinking of it now watching a movie referencing it, im scandanivan and we are spoiled with it here
20:00Chouserclojure and tapwater are both free and highly recommended in the U.S.
20:01wipewindowsprogrammabale nanotech -> clojure -> pure water -> profit
20:01drewrClojure is way more free than tap water. :-)
20:01Chouserboth have alternatives (java and bottled water, respectively) that amount to roughly the same thing, but require more work for everyone involved.
20:01mfredricksona tap is like a lazy infinite sequence
20:02wipewindowslol
20:02Chouserwhile a bottle is definitely an Object.
20:03dreishOh, wow, java -server makes a ginormous difference on the Mac.
20:04mfredricksonthe help on java -server is great 'to select the "server" VM'
20:04dreishI guess client programs need to run slowly so users don't get scared.
20:06mfredricksonthey should have called it -enterprise
20:06mfredricksonwe all know adding the word enterprise makes things faster, better, stronger
20:12RSchulzsvn 1160
20:12RSchulzsvn rev 1160
20:12clojurebotsvn rev 1160; Moved to Eclipse Public License - see epl-v10.html or http://opensource.org/licenses/eclipse-1.0.php
20:13dreishThat one isn't GPL-compatible either.
20:15rhickeyGPL isn't that one compatible either
20:15mfredricksonGPL isn't GPL compatible. ;-)
20:16dreishWhy not BSD or LGPL?
20:17rhickeydreish: non-reciprocal
20:17RSchulzTake it outside, guys. (;-)
20:17dreishI'm not complaining, promise.
20:19dreishclojure-contrib will move too, right?
20:20mfredricksoni wonder if anyone has ever done a study of license effects. could that be feasibly measured?
20:20rhickeydreish: yes, EPL is not different from CPL in any significant way, the move is just to stay with the latest version of that license tree
20:21mfredrickson(can you tell I'm writing up a lab experiment paper right now?)
20:21hiredmanhah!
20:21dreishFrom what I'm reading it just removes some of the more severe patent-retaliation terms of the CPL.
20:21hiredmanthen I was right
20:22hiredmanI knew there was no difference!
20:22RSchulzIs this supported: (into-array CLASS collection) where CLASS is an instance of java.lang.Class? If not, is the removal of the CLASS argument a recent change?
20:23RSchulzhiredman: You know what would be a cool feature for clojurebot? The ability to "grep" through SVN commit comments.
20:23rhickeyuser=> (into-array Class [])
20:23rhickey#<Class[] [Ljava.lang.Class;@6237e0>
20:23RSchulzI ask because the docs on the Java interop page don't list the form with class first, but I have some (slightly) older code that does.
20:23hiredmanRSchulz: ugh, yeah, but, blarg
20:23RSchulzAbsolutely. Blarg on it all!
20:24rhickey(doc into-array)
20:24clojurebotReturns an array with components set to the values in aseq. The array's component type is type if provided, or the type of the first value in aseq if present, or Object. All values in aseq must be compatible with the component type. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE.; arglists ([aseq] [type aseq])
20:24RSchulz(find-commit "made splorg extra spiffy")
20:24hiredmanI am more interested in getting sandboxed code execution
20:24RSchulzAh. So I put a bug in your brain, eh?
20:24hiredmanyou and a few others
20:25RSchulzrhickey: OK. I must have written that code from the (doc ...) string, but just now was looking at the Java Interop page, which doesn't mention the Class argument.
20:25hiredmanhanging in #java now, getting bot envy for javabot
20:34bradbevAs I'm starting to leverage some of Java's libraries I am finding that my class path is getting huge. Is there some convention that Java/ANT has where I can tell Java packages to install to a particular location & just have that in my classpath? Sorry for the Java rather than Clojure question.
20:35bradbevhmm, actually I'll ask in #java also...
20:35RSchulzQ: Is there something one must do to / with an Agent so the JVM does not hang at shut-down?
20:36rhickeybradbev: -Djava.ext.dirs
20:36rhickeysetthat to some dir and dump jars in it
20:37bradbevawesome, that's exactly what I was wanting
20:37bradbevthanks much!
20:40RSchulzQ...: Aside from calling (await ...) on those agents, of course.
20:41rhickeyRSchulz: (find-doc "agent")
20:41rhickeywill yield:
20:41rhickey(doc shutdown-agents)
20:41clojurebotInitiates a shutdown of the thread pools that back the agent system. Running actions will complete, but no new actions will be accepted; arglists ([])
20:42RSchulzI see...
20:42RSchulzIs there a good way to unburden the use of a function that itself uses Agents under the hood from remembering to call this function?
20:42RSchulz(...the _user_ of a function...)
20:46dreishRSchulz: are you using Script.java?
20:46RSchulzNo. I'm just running in a REPL.
20:46dreishTrying to exit with Ctrl-D?
20:47RSchulzYes.
20:48dreishMaybe main() should call that after the for (;;) loop.
20:48dreishCan't really think of any good reason not to do that.
20:48RSchulzrhickey: What do you think about that suggestion? Should (shutdown-agents) be implicit in exiting the REPL?
20:50dreish(It must be one of my better ideas if it's taking him this long to figure out what's wrong with it.)
20:52hiredmanhttp://gist.github.com/36217 <-- sandbox
20:53RSchulzEpiphany?
20:54RSchulzOh, that's too easy... Scratch that... Too simple. As wel all know, "simple isn't the same as easy."
20:55hiredmanit will need some tuning
20:55hiredmanI am sure
20:55hiredmanthat just sort of blocks IO right now
21:03RSchulzhiredman: Interesting. I just dealt with conveying I/O from a sub-process (OS-level) to *out*. A simple copy loop sent to an agent works well.
21:06RSchulzhiredman: I think I misinterpreted "blocks". I thought you mean "blocks" as in "stalls".
21:06RSchulzYou mean it prevents I/O entirely, yes?
21:10bradbevif I use gen-interface, will it be loaded & ready to go as soon as I evaluate it?
21:10bradbevI'm trying to basically do http://groups.google.com/group/clojure/browse_thread/thread/77e626c5440bf1a0/487327209b633451?lnk=gst&amp;q=gen-interface#487327209b633451 - but I can't load contrib.gen-interface due to a name conflict
21:15Chouserbradbev: clojure.core/gen-interface is for generating interfaces at AOT compile time
21:16hiredmanRSchulz: yes
21:17RSchulzbradbev: Did you look at (proxy ...)?
21:17bradbevok - is there a way to gen the interface that JNA appears to need to fill out? (I'm guessing that JNA constructs a class adhering to your Interface when it does the load)
21:17Chouserbradbev: if you're sure you want the less-supported runtime loading behavior of clojure.contrib.gen-interface, you can alias the function you need, and still useit.
21:18bradbevwell, I'm not _sure_ - but I do want to poke around with JNA from clojure
21:19RSchulzQ Re shutdown-agents: Is there a way to "put individual agents to rest?"
21:20bradbevChouser: sorry to be daft - how do I alias like that? I thought (ns test
21:20bradbev (:require [clojure.contrib.gen-interface :as gi])
21:20bradbev (:import (com.sun.jna Library Native Platform))) would do the trick, but I have a name conflict
21:20Chouserbradbev: for playing around in a repl, it's probably appropriate to use gen-and-load-interface
21:21bradbevyeah, that's what I figured
21:22RSchulzChouser: Does gen-and-load-interface still exist? Thought all the gen stuff was unified under (gen-class ...)?
21:23Chouserbradbev: sorry, working on the alias line. this still doesn't come naturally to me
21:23ChouserRSchulz: yes, it's still in clojure-contrib
21:24bradbevnp Chouser - I'm glad for any help.
21:24RSchulzAh. But is it advisable? Or just a matter of clinging to the past?
21:25bradbevRSchulz: the clojure/core stuff looks to only be useful when compiling a module too. I just want to mess around from slime for right now
21:26bradbev- although using compile file isn't getting be there with gen-interface either :(
21:26RSchulzOK, but as a Vimmer, I have no insight to offer to Emacsians...
21:26Chouseryeah, I'd recommend not using gen-and-load-anything except for "playing"
21:26RSchulzFrankly, I anxiously away the next release of Enclojure.
21:27RSchulz___ANXIOUSLY___
21:28RSchulzYou out there Eric T? Give Us Our ENCLOJURE!!
21:28RSchulz...Sorry... Lost my composure there.
21:29Chouserat least you still have your compojure
21:30RSchulzAnd eventually I'll get my composure back, too! What a deal.
21:31RSchulzNo... Time for supper.
21:31RSchulzGah. "Now... Time for supper."
21:31RSchulzWho invented the keyboard, anyway?
21:32Chouseroh! figgin' bug in gen-interface.
21:33RSchulzAnd by a guy whose name is a near homophone to my own, actually, and from the town of my own birth! ... None of it helps...
21:34RSchulzChristopher Sholes.
21:34bradbevChouser: bug?
21:40Chouserbradbev: update to clojure-contrib rev 308 and then:
21:40Chouser(use '[clojure.contrib.gen-interface :only (gen-and-load-interface) :rename {gen-and-load-interface load-iface}])
21:40bradbevyesh
21:40bradbevok :)
21:41Chouserheh. or just (use 'clojure.contrib.gen-interface)
21:41ChouserI've renamed things so they no longer conflict.
21:41bradbevcool
21:42bradbevthanks man, at least I can use the gen-interface stuff now! will let you know how I get on...
21:43Chousergreat
21:46bradbeverrr. I don't spose gen-interface handles varargs at all? No matter if it doesn't - I just won't wrap printf
21:47Chouserbradbev: i think java varargs are always just an Object[] as the last arg.
21:47bradbevah
21:47bradbevso the Object... syntax just won't work
21:50Chouserright
21:50bradbevyah - JNA works. Thanks a bunch Chouser. Though it did have a cow with the printf decl - ['printf [String Object[]] Void]
21:50Chouseryeah, that won't work either -- I'm not sure how to specify an array
21:51bradbevhmm, so does that mean that clojure-core/gen-interface also can't specify arrays?
21:53Chouserthere's got to be a way
21:53bradbevyeah - well it doesn't bother me too much :)
21:53bradbevthanks again for all the help
21:53Chouserwell, it bother me, now.
22:01Chouseroh, wait, you don't need specify methods that are provided by base classes.
22:01slanganIf I want tocall octave or C++ code from Clojure, how do I do?
22:03Chouserslangan: that's what my conversation with bradbev was just about.
22:10alphazeroHi all.
22:11ChouserWell, there's got to be a better way, but this works: (gen-and-load-interface 'x.Foo8 [] ['m [Integer (class (make-array Object 1))] Void/TYPE])
22:11Chouseralphazero: hi!
22:12alphazerochouser: was that issue with arrays related to the jvm's naming of array classes?
22:15alphazero(.getName (.getClass (.getMethods (.getClass (new Object)))))
22:16durka"[Ljava.lang.reflect.Method;"
22:17alphazerodurka: yep. that leading [ .. is that the problem?
22:17durkasorry, what problem?
22:18durkaclojurebot: are you asleep?
22:18clojurebotPardon?
22:19alphazerodurka: something about not being able to spec arrays bother Chouser earlier.
22:19alphazerobothering
22:20gnuvince_How would you get a bunch of agents to write into a ref?
22:22gnuvince_(and know when all agents are done)
22:23durkaChouser: why does ('+ '1 '2 '3) give an illegal arg exception?
22:23durkai understand the example after that, with the map
22:24gnuvince_durka: you cannot call a symbol
22:25gnuvince_Hmmm
22:25durkawell, => ('+ {'+ "plus" '- "minus"})
22:25durka"plus"
22:25gnuvince_apparently you can.
22:25durkayou can sometimes
22:25gnuvince_Yeah, sorry
22:25gnuvince_I guess they work like keywords then
22:25durka(fn? '+) false, but (ifn? '+) true
22:26hiredmanthe '+ , the symbol + is not a function
22:27hiredmanbut symbols are callable
22:27durkait looks like clojure.lang.Symbol has invoke methods with one and two Objects
22:27durkathe one-arg would be the map usage
22:27hiredmantwo arg is also for map
22:27hiredmanmap and default
22:28durkaah
22:28durkathanks
22:32Chousersorry guys, stepped out. Glad you figured it out. :-)
22:33durkaquestion on idioms
22:33durkasince map is lazy i've been wrapping it in doall at the REPL
22:33durkadoes that make sense
22:33durkai.e. (doall (map prn <seq>))
22:34Chouserat the repl there's no need, as the Print part of REPL will print the whole thing
22:35Chouser...unless you set *print-length*, which you should
22:39Chouser:-(
22:42slangananyone into nanotech here?
22:44gnuvince_going to bed
22:44gnuvince_Later all
22:44Chousergnuvince_: g'night
22:45Chouserslangan: if by nanotech you mean very small programs, I'm all over it.
22:46slanganlol
22:47slanganim thinking I should study materials science and nanotech
22:47slanganperhaps, im into computer games and machine learning but the rest of CS doesnt interes t me that much
22:47slanganand nanotech seems supercool
22:47slanganand useful
23:55durkaChouser: I was playing with clojure.contrib.repl-utils::show
23:56durkai don't know much about reflection, but sometimes the output is "cleaner" (to my eyes) using .getDeclared{Fields,Methods,Constructors} instead of .get{Fields,Methods,Constructors}
23:57durkafor example, with clojure.lang.Symbol you avoid printing the 22 different variations of .invoke()