#clojure logs

2008-10-16

00:12PupenoHello.
00:12PupenoCan you create a GUI (Swing) component in Clojure?
01:31Lau_of_DKMorning gents
02:20PupenoHello Lau_of_DK.
02:21PupenoLau_of_DK: a Clojurer in Europe timezone?
02:27Lau_of_DKYea :)
02:27Lau_of_DKLisp is not a big-language here by anymeans, but I thought that was a global thing
02:29PupenoLau_of_DK: Yes, of course, but since I'm in Europe timezone too and I'm interested in people around here.
02:31PupenoI'm in Switzerland by the way.
02:31PupenoBBL
02:32tWipI'm in Finland.
02:32tWipspreading the good word here :)
02:42Lau_of_DKDenmark here
03:21karmazillajust glancing through the front page of dzone, I see four posts that in some way relate to Clojure
03:39Lau_of_DKImpressive
03:49Lau_of_DKkarmazilla, I didnt know about DZone, fantastic link, thanks alot
05:43PupenoCan you create a GUI (Swing) component in Clojure?
05:52H4nsPupeno: yes.
06:08parth_mPupeno: http://en.wikibooks.org/wiki/Clojure_Programming#Simple_GUI_:_Temperature_Converter
06:08parth_mAlso, the is a miglayout wrapper in clojure-contrib
08:35blackdogi'd like to be able to connect to a repl via ssh, any recommendations for ssh libs, examples?
08:36H4nsblackdog: maybe you can use ssh port forwarding? no libs needed for that.
08:36blackdogmmm, yea that's an option, i wonder if enclojure has something,
08:38blackdogi'd quite like something self contained so i can deploy a jar and run, no other dependencies
08:40H4nsblackdog: the clojure promise is: leverage the java platform. i don't believe that there is some clojure ssh library, but you may be able to use a java one, like maybe http://www.trilead.com/Products/Trilead_SSH_for_Java/
08:41cemerickblackdog: enclojure has all of the infrastructure to support remote repls -- its repl is actually accessed via sockets (locally in the base case), but there's no reason why it couldn't be used to connect to remote repls
08:41cemerickI *think* the only thing missing there is a UI to allow one to connect to a specific IP address, rather than local.
08:41arbschtblackdog: establish a tunnel with ssh and you will be able to use enclojure or slime through it
08:43blackdogok, thanks all for the suggestions
08:44Chouseryou'd want the clojure bit to be on the server side, right? That implies user and priv control -- probably best to leave that up to sshd and use a tunnel.
08:46tWipthat's what I've done with webjure... just listen to socket and provide repl through that
08:46tWipthen ssh in with tunnels set properly
08:47blackdogok, seems like i just want a tunnel, simplest option
08:59pjb3I have some clojure code that creates a new class using gen-and-load-class
09:00pjb3Then from clojure I call some java code then ends up doing Class.forName("myclass")
09:00pjb3and it throws a ClassNotFoundException
09:00tWipdifferent classloaders?
09:00pjb3but when I just call (Class/forName "myclass") from clojure, it finds it
09:01pjb3but isn't Class.forName the system classloader, so it should be the same, right?
09:01rhickeypjb3: different classloaders
09:02rhickeyInvoking this method is equivalent to:
09:02rhickey Class.forName(className, true, currentLoader)
09:02rhickeywhere currentLoader denotes the defining class loader of the current class.
09:03pjb3hmm...so there's no way to do gen-and-load-class, but then have java code be able to find that class
09:04rhickeygen-and-load-class has decidedly restricted utility, and is only for consumption by Clojure. Java is a static world and needs gen-and-save-class
09:04tWipI have yet to need any gen -stuff.
09:05pjb3rhickey: ok, makes sense
09:05pjb3So if I use gen-and-save-class, that class that gets saved ends up calling functions defined in clojure at runtime
09:05rhickeyalternatively, you could have a Clojure fn that makes the instance and get it from Java using RT.var("yourns","yourfn").invoke()
09:05pjb3so I can redine those methods in clojure, it I need to
09:06rhickeypjb3: yes, still dynamic on the Clojure side - the class is just a contract
09:06pjb3cool
09:06rhickeythere really isn't a good reason to define a class dynamically, since you can't redefine it dynamically, from a signature standpoint
09:08rhickeycemerick: you may win on the ns/file relationship after all - in thinking about AOT and genclass, it seems now like the best mapping of a Clojure ns is to a Java class
09:08turbo24prgmorning
09:09turbo24prgfrom http://stuartsierra.com/2008/08/08/clojure-for-the-semantic-web:
09:09turbo24prg"The first thing Rich did when experimenting with the semantic web was to pull data out of the Jena API and get it into Clojure data structures."
09:09turbo24prg"Screencasts and code from the talk should appear soon -- watch clojure.org or the Clojure Google group for an announcement."
09:09turbo24prgis that code already available?
09:10turbo24prgi'd like to play with jena via clojure
09:10cemerickrhickey: whoo, that seems like a lifetime ago. It's been a busy year. :-)
09:10cemerickisn't it somewhat too late to change course on the ns stuff, especially now that lib's been integrated?
09:11rhickeycemerick: it ends up the interface of lib doesn't change, just where you put things
09:11rhickeycom/mycompany/myns.clj
09:12rhickeyinstead of com/mycompany/myns/myns.clj
09:12pjb3rhickey: when you said "there really isn't a good reason to define a class dynamically"
09:12pjb3you mean that I should just use gen-and-save-class
09:12cemerickOK; so, the main advantage of the latter was that a namespace could transparently be composed of multiple files. Would that go away?
09:12rhickeybecause myns is going to end up being a class, with a static load() and optional main()
09:13pjb3instead of gen-and-load-class, since I can redefine the functions that gen-and-save-class calls
09:13cemerick(or, main advantage aside from tooling, etc., which is another issue to be reconsidered)
09:14rhickeycemerick: the only advantage of the latter was as regards resources, now all with same Java package share, e.g. one segment up
09:15rhickeyI think I've got the tooling sussed out, all fns end up looking like nested classes instead of top-level
09:15rhickeycom/mycompany/myns$foo.class etc
09:15rhickeywill work with debuggers
09:15cemerickyeah, that's a lot more straightforward, IMO
09:16rhickeycemerick: right, I'm still on the fence about multi-file - it really makes a mess, needs an 'include' notion etc
09:16cemerickthere were a couple of people that were very pleased with dirs-as-namespaces though, so you could split a large ns into multiple files
09:17cemerickpersonally, I'd be perfectly happy with a hard rule where one file == one namespace (or, has hard a rule as you can get given load-file)
09:17rhickeyif there's a need to split them there's probably a logical partitioning, which need not incur a hard ns subdivision:
09:17rhickeycom/mycompany/myns.clj com/mycompany/myns-utils.clj
09:19cemerickIf I follow you, that's perfectly reasonable in virtually all cases. Requiring a (use 'myns-utils) isn't hard.
09:19rhickeya big advantage, not yet fully cooked, is the replacement of genclass entirely by metadata annotations in your .clj file
09:19cemerickIt gets smoothed out even more if clojure eventually grows the notion of friendly access between namespaces.
09:20rhickeysince each ns is a class, for loading purposes, can define some fns as maping to methods etc
09:20cemerickrhickey: don't tease me :-)
09:21rhickeycemerick: It's going to happen - there's no reason for separate AOT options, and everyone struggles with the signature/def dichotomy
09:21rhickeyof genclass
09:21cemerickOh, I'm all for it
09:21rhickeyso, the sig and initial defs go together, but no limitations on dynamic redef
09:23rhickeyalso, with the main() gen, makes the delivery story so easy - AOT+jar
09:24rhickeypjb3: yes
09:25cemerickrhickey: what's your timeline look like? We're in the middle of trying to squeeze out a release; once that's done, then we'll bring our clojure up to date.
09:25cemerickAt that point, I'd be in a position to give something resembling useful feedback.
09:26rhickeycemerick: this decision is the final sticking point, most of the rest is mechanical - compile method is underway
09:27cemerickis it a sticking point still? You sound pretty convinced already.
09:27rhickeythere will be some semantics of compilation, i.e. a shared-world model, since the compiler needs to evaluate the things it's compiling in order to make macros-in-same-file work
09:28rhickeycemerick: I think I decided last night and still feel good about it this morning, floating it here for any feedback I haven't thought of
09:28cemerickmight want to wait until noonish, anyway; Chouser's probably not up yet :-)
09:29rhickeyshared-world means strewing side-effecting statements at top level not a good idea, but will eventually beg for eval-when
09:30cemerickyeah, we rolled our own poor-man's eval-when so our build process wouldn't puke on itself in conjunction with some self-referential genclass stuff
09:30cemerickit sounds like AOT might leave room for resolving interleaved dependencies down the road....
09:30rhickeycemerick: maybe, still very complicated
09:31rhickeypart of me says, just don;t do it - you'll app will be cleaner if you stick interfaces in a separate, shared project
09:31cemerickdefinitely, but having a standard AOT process makes the problem tractable, anyway
09:32rhickeyAOT is going to propel Clojure forward into many areas, I think
09:32rhickeybig feature
09:32cemerickit's definitely a problem on the margins, but where it is a problem, it usually can't be resolved through separate projects, and one's left in quite the bind
09:33cemerickAll of the "alternative" jvm languages will need to address it eventually
09:33rhickeycemerick: can you generically describe that situation?
09:36rhickeyToday marks Clojure's first year in release!
09:36blackdogcongrats!
09:36blackdogvery successful year I'd say
09:38rhickeyblackdog: yeah, I couldn't possibly have imagined the year it's had
09:38ChouserI'm up, but this is all over my head. I don't grok classic lisp or Java deployment deeply enough to have anything useful to say.
09:39blackdogyour upcoming talk on the future of lisp is a good way to finish up, with all the big names there
09:40Chouserrhickey: I suppose you're mainly talking about imagining the community as it has become, but had you tried to imagine what feature set you'd have by now?
09:41waltersChouser: the way i think of it is in a dynamic language you can get away with A depends B, B depends A in many cases; the AOT is making Clojure less dynamic in a sense
09:43rhickeywalters: not really affecting Clojure's dynamism at all, this is just a Java interop thing, which exists already
09:44rhickeyChouser: yes, the community, the academic and other attention, all the talks etc
09:45rhickeyAs far as the language, I knew doing a Lisp meant a small, manageable core, and tremendous ease in adding new capabilities, and that has proven out
09:46ChouserAt the next anniversary you'll have a rather more high-profile interview than this.
09:47rhickeyThe only feature I'd imagined having that's missing is some sort of declarative rules
09:47rhickeyI though ti might be combined with predicate dispatch, but am happier with where multimethods ended up - ad hoc hierarchy
09:48ChouserIs the timing of v 1.0 (and related breaking changes) at all coordinated with the book release?
09:48cemerickrhickey: No, I can't generically describe the situation right now; we ran into it some months ago in connection with some clojure tests that introduced the interleaved dependencies. I think we resolved the problem by tweaking the build process for just that one clojure file.
09:49rhickeyChouser: not coordination - you know how it is with books, but whenever it is released, it will cover what is known then. Little I am planning to do would negate anything in the book, as it's been over the year, most changes are just additions
09:50blackdogrhickey: re java integration have you put thought into using annotations? e.g. i noticed the servlet spec v 3.0 yesterday is all about annotations, and i suppose it would be good for clojure to leverage that work
09:51rhickeyChouser: the only lingering breaking changes are, some code file layout issues relating to AOT, and the binding-form standardization, for which someone needs to do due diligence and find all the changing forms
09:52rhickeyblackdog: I think it will be important for Clojure to be able to generate annotations at some point, but they are still a very static Java thing, not that useful for Clojure itself
09:53Chouserwill binding forms all be changed to allow multiple bindings, or is that not necessarily needed yet?
09:54rhickeyChouser: it won't always make sense - e.g. dotimes
09:54rhickeyso, othogonal
09:54rhickeydoseq being imperative for is the biggest need, IMO
09:55blackdogi agree not that useful for clojure itslef, but a lot of people moving over will expect the functionality, to inject predefined stuff, would it be possible?
09:55rhickeyblackdog: inject into what?
09:55rhickeyblackdog: for Clojure?
09:56blackdogwell say in a gen class situation, tagging the class as a servlet
09:57rhickeyblackdog: that falls under "generate annotations" above, yes
09:57blackdogi haven't really looked at the new spec, but i think that's part of what they have - i should go and research a bit
09:57blackdogah ok
09:58blackdogi thought you meant actually creating the annotation,
09:58blackdogok, cool
09:58rhickeymetadata to the rescue
10:18lisppaste8wlr pasted "is this -> abuse or a bug?" at http://paste.lisp.org/display/68628
10:19achim_phi!
10:20turbo24prgrhickey: do you have any examples for clojure+jena?
10:20Chouserwlr: abuse. -> is a macro that "physically" inserts the result of one expression as the first arg of the next expression.
10:20rhickeywlr: -> is a macro defined in terms of manipulation of the forms it is passed
10:21achim_prhickey: with files and namespaces being 1:1, will there still be a way to execute some code before the imports and requires are evaluated? alternatively, will there still be a non-declarative way of doing import and require (outside of ns)?
10:21achim_pi'm currently using some runtime code to pull missing libraries from various sources (maven, svn, etc.) and adding them to the classpath, because i don't think xml config files are a good fit for smaller scripting-like usages of clojure.
10:21rhickeyturbo24prg: sorry, saw that before, not on the machine I'm on - I'll try to post them on the group later
10:21wlrrhickey,chouser: thanks
10:22turbo24prgrhickey: cool, thanks!
10:22Chouser-> can be abused to get non-errors like: (-> [a 5] (let a))
10:22rhickeyChouser: yikes
10:23rhickeyachim_p: yes, only load-file is at risk with AOT
10:26achim_prhickey: that's good to know, thanks!
10:27achim_plooking forward to AOT
11:02fyuryurhickey: apropos non-errors, I lost almost an hour today because (merge nil {:a 1}) returns a seq. I have a patch if you want, but won't be able to send a CA untill tomorrow
11:27PupenoI've already took a look at the temperature converter example, but I still don't know how to break down the UI of a program. In Java I have a component that inherits JComponent and is a brand new widget with its custom drawing. Can I make such a component in Clojure?
11:31ChouserPupeno: have you seen this? Does it help at all? http://groups.google.com/group/clojure/msg/b093a28d69692479
11:32PupenoChouser: I haven't going there now.
11:34Pupenois (.setBlah blah) the same as blah.setBlah()?
11:35Chouseryes
11:36PupenoOk... so I should make a function (make-my-component) that will basically do (let [c (.JComponent)] (.setTitle c "My component") ...etc... c)?
11:37Chouser"JComponent." but yes
11:37PupenoExcept that JComponent is abstract.
11:37Chouserah, hm.
11:38Chouserok, if you actually need to create a new class (and not just compose instances of existing classes) you may need to use proxy
11:38PupenoSo, there's no way to make a Java class/subclass in Clojure?
11:38Chouser(doc proxy)
11:38rhickeyPupeno: proxy can subclass abstract classes
11:38PupenoOh! excellent, thanks.
11:39Chousersure there is. proxy is the easiest, but gen-class is also available.
11:39PupenoBah... Enclojure's REPL doesn't work at all.
11:39asbjxrnI didn't study that GUI thread that closely, but I made this toy gui lib that basically updated the GUI by having an agent update the repaint function.
11:40asbjxrnMy lib only draws in a JPanel, but could that approach work for more usual swing guis too?
11:41Pupenoasbjxrn: I'm still new with Clojure (and agents and all), but I've been teached to be scare of modifying GUIs outside the Swing thread... otherwise the sky will fall.
11:41asbjxrnFor callbacks I used a macro eg. (on-mouseclick agent fn)
11:41wwmorganPupeno: what behavior are you getting from the enclojure repl?
11:42asbjxrnPupeno: Exactly.
11:42Pupenowwmorgan: I type something, I press enter, and it never comes back.
11:43wwmorganPupeno: alt + enter
11:43Pupenowwmorgan: Oh! :)
11:43wwmorganI think that happens to everybody
11:46rhickey(SwingUtilities/invokeLater any-clojure-fn)
11:47asbjxrnHey!
11:50PupenoIs it as easy as (proxy [JComponent] [])?
11:50rhickeyPupeno: yup
11:50asbjxrnPupeno: Have a look at the ant colony code.
11:51PupenoAmazing! Thanks.
12:43rhickeyfyuryu: fixed - thanks for the report
13:10leafwFiji is out: http://pacific.mpi-cbg.de -- an imaging application that supports plugins written in Clojure
13:12cemerickleafw: fancy -- is that yours?
13:15leafwpartly yes.
13:16leafwI founded it. My hacker friends took it to much higher goals I ever intended.
13:16leafw(I'm Albert in the Contributors list)
13:17cemerickleafw: are you using any UI framework in particular?
13:17leafwthere are Clojure examples under plugins/Examples/ : http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=fiji.git;a=tree;f=plugins/Examples;hb=HEAD
13:17leafwno: we mix awt and swing.
13:17leafwImageJ, the core, uses only AWT.
14:09leafw"Jython, lest you do not know of it, is the most compelling weapon the Java platform has for its survival into the 21st century" -- from http://www.jython.org
14:09leafwthat sentence needs updating
14:09leafwin the current multicore world, Clojure is the best chance for the JVM to survive into the XXI century.
14:10ChouserClojure is the best chance for lisp to survive into the XXI century.
14:10leafwI guess we have a synergy here, like symbiosis
14:11ChouserSymbiosis is the best chance for synergy to survive into the XXI century.
14:12leafwthat sentence makes nosense Chouser. Never mind.
14:12ChouserI guess maybe others have a better sense of what computing will be like for the next 100 years, but to me none of those assertions are very compelling.
14:12leafwit's just PR.
14:12Chouseryeah, I'm sure you're right.
14:14kotarakWhat was it? Same month of release as lisp 50 years ago.... Hmmm....
14:14leafwsomeone said that in the mailing list.
14:15kotarakSo let's see how Clojure looks like in 50 years...
14:15leafwconsidering how computers looked like 50 years ago, there's no hope we can even begin to visualize that.
14:16kotarakMaybe we are again in the Stone Age by then...
14:24kotarak"Look my new fifty stone abacus! Running on granite core with marble UI!"
14:24abrooksChouser: You'd do fine in any medium.
14:24abrookskotarak: ;-)
14:37Lau_of_DKEvening gents
14:38danlarkinafternoon!
14:46Lau_of_DKIs there anyway to use (println) so that it automatically even-spaces the whitespace, like using the full width of the console?
14:48Chouseryou're asking for fully-justified text, like a newspaper column?
14:50Lau_of_DKyes sir
14:51ChouserI don't think clojure provides anything like that -- dunno about Java.
14:51Lau_of_DKJava has a curses library
14:52Lau_of_DKI'd just feel that it would be overkill - I just need to output some statistics :)
14:52Chouserthere's (doc format) which could get you fixed-width columns of numbers and such.
14:53kotarakOCaml has pretty-print library, which can do such things IIRC. Maybe one can rip-out the interesting parts.
14:53Lau_of_DKChouser, (doc format) throws an exception
14:55Chousermaybe your version of clojure doesn't have format. It just makes it easy to use java.util.Formatter
14:55Lau_of_DKare you thinking SBCL now?
14:55Lau_of_DKah okay, I'll look that up instead, thanks for the tip
14:55Chouserno, what little CL I knew has long since turned to vapor.
14:56Lau_of_DKMight as well, Clojure is the way to go
14:56Lau_of_DKIn my oppinion. Its more robust and modern (multi-thread) and also, SBCL and other non-proprietary Lisps have some very frustrating short comings
15:08Lau_of_DKI'm still fighting this bug, if anybody has some input, I'll be happy to hear it: http://pastebin.com/m42056586
15:18PupenoI don't see any other way of implementing custom painting that overriding paintComponent, which pretty much forces me to go the gen-class way.
15:18StartsWithKLau_of_DK: what exactly is is the bug?
15:18Lau_of_DKThat it gives mathematically incorrect results, as shown in second run of test-frac
15:18wwmorgan(fraction 1.0 11.0) => 0.99
15:20ChouserPupeno: you can use proxy to override methods
15:20PupenoChouser: really? how?
15:21Chouserhm, well ...
15:23Chouserdoesn't this work? (proxy [javax.swing.JComponent] [] (paintComponent [g] (prn g)))
15:23wwmorganLau: how does your algorithm detect an infinite cycle?
15:23PupenoChouser: I don't think so, but let me try.
15:27PupenoChouser: Oh! it does! I totally missunderstood the proxy documentation. Thank you.
15:27ChouserPupeno: ah, great.
15:28drewrDoes lazy-cons "look ahead" a few spots?
15:29Chouserdrewr: users of it might
15:29drewrI'm trying to figure out if I am.
15:29drewrI think I am but I can't figure out how.
15:30Lau_of_DKwwmorgan, there's mathematical evidence that says that if a result of (modulus x a) gives a result, which has already been given once before, then an infinite cycle is detected
15:30Lau_of_DKso this is what it looks for
15:32rhickeydrewr: lazy-cons doesn't - it creates suspensions of both the first and rest expressions
15:32drewrI must be calling the fn that returns the lazy-cons multiple times.
15:33drewrIf I'm concat'ing lazy-conses together, does that cause anything counterintuitive?
15:33rhickeydrewr: with lazy-cat?
15:34drewrNo, manually. I didn't know about lazy-cat when I wrote this code.
15:34drewr(concat (fn-that-returns-a-lazy-cons) ... )
15:34rhickeyconcat will eval each arg
15:34rhickeydoesn't run the seqs, but enough to know there is a seq
15:35drewrIt looks like I'm getting three calls per fn.
15:35rhickeyso will run the fn in which you call lazy-cons
15:35drewrI'm basing this on a prn that I've put in the fn-that-returns... call.
15:36PupenoChouser: It doesn't seem to work. The documentation says "Expands to code which creates a instance of a proxy class that implements the named class/interface(s) by calling the supplied fns." It seems the fns are kind-of like a constructor, but I'm not sure.
15:38Chouseryou don't get to customize the constructor with proxy, just override the methods.
15:41wwmorganLau_of_DK: modulus is a list of String objects of length 1?
15:42Lau_of_DKNo, its a series of digits
15:42wwmorgan"0"-"9"?
15:42danlarkin1 through n-1
15:42Lau_of_DKbut yea, for ease of use, I mean them string objects, that correct
15:43danlarkin0 through n-1 actually I guess
15:44Pupenooh... maybe I should anotate the arguments.
15:44lisppaste8Chouser pasted "custom JComponent overriding paintComponent" at http://paste.lisp.org/display/68642
15:46Lau_of_DKwwmorgan, , as far as I can see, this is a problem of the algo inserting too few, or too many zeroes
15:50kotarakLau_of_DK: maybe you want to use a set to store the previous results. I think this is more efficient then some + a list
15:50Lau_of_DKyoure right
15:52kotarakLau_of_DK: and after a quick look maybe vectors instead of list. so conj adds to the end. No need for concat...
15:52Lau_of_DKgood tip, thx
15:53PupenoChouser: thanks.
15:53ChouserPupeno: sure -- got it working?
15:55PupenoChouser: yes, but couldn't figure out why mine wasn't working, because it was very similar to yours. I was missing pack and invokelatter, but I've added them to mine and still couldn't make it work. Anway, thank you a lot!
15:55Chouserhm. Hope you figure it out.
15:55ChouserFeel free to post the whole thing, if you want.
15:56PupenoIt's already gone, but thank you.
15:56Chouserhm, ok.
16:14Lau_of_DKwwmorgan, its working now :P
16:15wwmorganLau: very cool. What was it?
16:15Lau_of_DKThe function fdigit should not be applied with using (rem a x), only (/ x a)
16:16wwmorganah.
16:17Lau_of_DKThis is a decimal expansion that works ! :) http://pastebin.com/m379554bf
16:26Lau_of_DK(insert applause)
16:28Lau_of_DK(help refactor)
16:31kotarakLau_of_DK: my suggestions with set and vector: http://pastebin.com/mf62a20b
16:31Lau_of_DKThanks, those were some good tips
16:32kotarakLau_of_DK: yeah, but not tested. ;)
16:32Lau_of_DKit'll come 'round
16:32kotarakWould like to see some comparison in performance on large inputs.
16:32Lau_of_DKyea, so far mine runs from 2 -> 1000 in 50 secs on my old slow CPU
16:32Lau_of_DKI'll do a comparison tomorrow and let you know how it goes
16:33kotarakok, would be nice
16:33Lau_of_DK(note: tomorrow could both mean saturday and sunday depending on circumstances beyond my immediate control, including but not limited to mood-swings and energy loss)
16:33kotarak:)
16:34Lau_of_DKPretty sweet to be able to work with infinite floats though
16:34wwmorganLau_of_DK: (fraction 1.0 2.0) => 0.05
16:34Lau_of_DKlittle bug, use (fraction 2.0) instead
16:35Lau_of_DKif you supply both args, it needs to multiply the numerator by 10, which I forgot to put in there
16:37Lau_of_DKI gotta hit the sack, thanks for all your time and inputs guys
16:38drewrChouser: Thanks for the regex backslash patch!
16:38Chouserdrewr: sure! not much code, but my goodness all the talking!
16:39drewrHeh, I'm behind on list mail like a couple months.
16:40Chouserabrooks has suggested a weekly or monthly summary of clojure goings-on. I wonder how much audience that would have.
16:40drewrThat's a great idea.
16:41Chousersounds like work, though.
16:41abrooksChouser: I've actually been working on that. I'm trying to find the right level of detail so it's (A) useful and (B) regularly completable by me...
16:41drewrI wish I had the time and foresight to pull that off.
16:41abrooksI'd hate to start it up and not follow through.
16:41abrooksI'm intending a summary for October. I have part of September.
16:42abrooksNaturally, this will be called "Over Expojure"
16:42drewr:-)
16:42abrooksI'm aiming for monthly.
16:43Chouserabrooks: sounds great!
16:45albinoLike Haskell Weekly, only Clojure Monthly
16:47PupenoI think it would be nice if proxy would get real functions instead of things that look like functions, so that I could get a sane indentation.
16:48kotarakPupeno: what editor do you use?
16:48Chouserheh. that's a funny reason for it, but it's been mentioned before.
16:49kotarakFor me the indentation for proxy methods or functions is just a difference of two spaces....
16:50Pupenokotarak: right now, Emacs.
16:50kotarakPupeno: ok. Can't speak for emacs.
16:50Pupenokotarak: what do you use?
16:51kotarakvim. What else? ;)
16:51cemerickis there no way to call a superclass' implementation of a method from a genclass impl fn?
16:52Chouserhm, there must be. That used to be a reason to use genclass instead of proxy.
16:52achim_pcemerick: you have to dynamically nil-bind the overriding function
16:53achim_pand then call it
16:53achim_pweird hack
16:53cemerickachim_p: ha-ha!
16:53kotarakproxy has proxy-super...
16:53cemerickyeah, I saw that proxy improved since the last time I looked at it
17:02achim_pcemerick: yes, it's not entirely obvious ... i already had patched gen-class to include a :retain-supers argument (super.anything() would become superAnything() for the generated class) when i learned this trick. IIRC, rhickey suggested it, so it's authoritative ;)
17:03cemerickachim_p: thanks -- it's unpleasant enough that I was motivated to find a workaround :-)
17:05PupenoIt seems that printlns from paintComponent, at least when running in Slime, do not reach the screen.
17:10danlarkinthis is great, http://api.flickr.com/services/feeds/photos_public.gne?id=68497070@N00&lang=en-us&format=lol
17:10wwmorganPupeno: I think I've run into that. I believe it's because *out* is not bound correctly in the AWT thread. I had a text widget that I just sent my output to, but you might try (. System/out println "foo")
17:12kotarakis the clojure group the right place to announce things? I'm always spamming the list, but I'm a bit uncomfortable.
17:15ChouserAs long as it's clojure-related, I wouldn't expect it to be a problem.
17:19cemerickrhickey: is auto-creating arrays for variadic method calls still on your to-do list?
17:26rhickeycemerick: probably not, but literal syntax for native arrays is. Java variadics really need types to disambiguate the Object/Object[] problem. So I'm likely to add #[x y z] == Object[], with some variant for specifying the types
17:26rhickeyuseful in places other than variadics too
17:30cemerickrhickey: adding a type indicator to into-array isn't sufficient? Array literals are expensive, in terms of taking up that #[ dispatch.
17:32rhickeycemerick: It might be, 'array' is also still available for some more succinct syntax. I basically punted on this when doing the recent print/read work, but print/read for arrays is going to come up soon
18:06Pupenolisppaste8: url
18:06lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
18:07lisppaste8Pupeno pasted "Can this be made less ugly?" at http://paste.lisp.org/display/68654
18:08PupenoCan that piece of code be made less ugly?
18:11achim_pPupeno: how is it ugly? you could replace (. Color WHITE) by Color/WHITE (same for RenderingHints), but apart from that ...
18:12Chousersomeone posted a macro to produce proxy calls that defered all the methods to top-level defn's -- but I can't find it.
18:13Pupenoachim_p: well, the method is indented so much, and by the time I finish putting the 500 lines of code I need in the paintComponent method, it'll be much uglier and harder to understand. It'll be very hard to know what's this component is inside the let.
18:14Chouserah, http://paste.lisp.org/display/68075
18:14achim_pmmh, just use 2 spaces for indentation, defn style?
18:14Chouserbut that's just an example, not an implementation.
18:15ChouserPupeno: you could certainly replace your paintComponent body with (my-paint component g) and defn that at the top.
18:16Pupenoachim_p: yes, I could, but I leave indentation to my editor, and when the editor messes up, generally I know I did something wrong. If I indent by hand the editor would mess up in normal cases. Maybe the editor should be fixed. I'm not sure.
18:18PupenoChouser: You mean (paintComponent [g] (my-paint this g))? I could do that, right. I was feeling I was depending on the internal workings of a macro, but hey! just by using this I'm already doing that.
18:21PupenoThank you for the tips.
18:28rhickeyClojure's birthday party: http://clojure.org/
18:31danlarkinlooks delicious!
18:31drewrNice!
18:34PupenoStill waiting for it to load here :(
18:36rhickeyDon't settle for a language that doesn't have cake!
18:36achim_phappy birthday to clojure! congratulations to rhickey and everyone else involved
18:36PupenoAnyway... happy birthday Clojure!
18:36drewrBring a piece for me to Nashville.
18:37danlarkin...the cake is a lie :-o
18:37Pupenorhickey: I really can believe it's been only a year, the language look much much more mature than that. I'd say it's more mature than Ruby, which it's almost a teeneger.
18:38Pupenodrewr: wow! you are an old-timer!
18:38drewrIt's amazing it was so usable 10 months ago!
18:39rhickeyPupeno: I worked on it a couple of years before releasing it
18:40Pupenorhickey: I'm sure Matz did that as well. Not intending to create a flamewar. I'm just really surprised at Clojure.
18:46lisppaste8achim annotated #68654 with "emacs indentation" at http://paste.lisp.org/display/68654#1
18:47Pupenoachim_p: *my* Emacs doesn't indent it like that.
18:49achim_pPupeno: if emacs indents too much, inserting linebreaks after the first symbol of a form helps a bit. not perferct, but better than coding in cinemascope
18:58drewrHow do you expand "~/foo" to "$HOME/foo" in java?
18:58drewrI thought File/getCanonicalPath or File/getAbsolutePath would do it, but no.
18:59drewrThose aren't static methods though.
19:02Pupenodrewr: Isn't that very shell specific?
19:02drewrPupeno: $HOME is just a placeholder there.
19:02drewrI just want the tilde to expand to whatever is appropriate.
19:03PupenoIs there a shorter way to do (int (/ someRandomInt 2))? to get 3/2=1, 4/2=2, 5/2=2, etc.
19:03Pupenodrewr: I thought the tilde was just an alias for $HOME, and the shell must interpret that. Different shells might or might not interpret it in different ways. But, not sure.
19:04drewrHm. I suppose Python and elisp parse that manually and insert HOME from the environment.
19:04drewrSeems like Java could do the same.
19:05Chouserwhat's that partial logo under the cake plate? some kind of Clojure button?
19:08ChouserPupeno: (quot 3 2)
19:13PupenoChouser: thanks.
19:17achim_psome kind of metadata marker convention for fns with side effects would be nice ... i dabbled on a "find-by-example" function which let you do sth like (find-by-example [3 2] 1) and return all functions that yield 1 when called with any permutation of the given args. but the presence of side effects makes such things kind of dangerous
19:19lisppaste8achim pasted "find-by-example" at http://paste.lisp.org/display/68658
19:21achim_pthat's the code, maybe someone has an idea how to improve this
19:32emacsenhey rhickey I read your post today. Just want to say, honestly, that Clojure, even if it doesn't do everything you want, is doing something we all needed- that is jazzing people up about Lisp
19:33emacsenI'm seeing old disgrunteled Lispers talking optimistically
19:33emacsenI'm seeing Java people taking notice
19:33emacsenit's awesome
20:00scgilardijochu has been working on updating swank-clojure for the recent clojure changes. if you're using slime for clojure, it's worth a fresh pull. http://github.com/jochu
20:02rhickeyemacsen: thanks, yeah, it's been a great start
20:25scottjAny compojure users here? I just downloaded it with git and running script/run in cygwin fails saying it can't find clojure/lang/Script. I'm guessing the classpath is not getting set correctly. /bin/sh is bash 3.2.
20:27scottjI'm supposed to run script/run from the compojure directory, not run run from the script directory, right?
20:30jerrykIs there a current or preferred unit testing framework or discipline for code written in Clojure?
20:31fyuryujerryk: there is something for that in clojure-contrib
20:31jerrykfyuryu: thx, will look.
20:50emacsenmattrepl, hey... are you in fringedc?
20:51mattreplemacsen, hey, never attended but am on the list. keep meaning to
20:52emacsenmattrepl Conrad did a cool talk on non-deterministic regex in arc
20:52emacsenI need to bug him about the audio and slides from last talk
20:52emacsenthe embeddedml
20:52emacsennot to be off topic- just trying to drum up more people to come to meeting :)
20:53mattreplyeah, there was one on xmonad awhile back that looked good too. heh, will try to make it
20:53emacsenthe xmonad one was decent
20:54emacsenI used Xmonad for like... two weeks
20:54emacsenthe xmonad one got huge attendance
20:54emacsenlast one, not so much
20:54emacsen(I hosted it and was prepared for double the number who turned out)
20:54emacsennot that I'm complaining. we had I think 10 people at the end
20:55emacsenand I wasn't just dissapointed in fringedc. I was pissed no one from hacdc came either
21:37lisppaste8q pasted "q" at http://paste.lisp.org/display/68664
21:38lisppaste8a pasted "a" at http://paste.lisp.org/display/68665
21:49lisppaste8Chouser annotated #68665 with "converted to clojure" at http://paste.lisp.org/display/68665#1
23:40abrooksHappy Birthday, Clojure!