2008-10-16
| 00:12 | Pupeno | Hello. |
| 00:12 | Pupeno | Can you create a GUI (Swing) component in Clojure? |
| 01:31 | Lau_of_DK | Morning gents |
| 02:20 | Pupeno | Hello Lau_of_DK. |
| 02:21 | Pupeno | Lau_of_DK: a Clojurer in Europe timezone? |
| 02:27 | Lau_of_DK | Yea :) |
| 02:27 | Lau_of_DK | Lisp is not a big-language here by anymeans, but I thought that was a global thing |
| 02:29 | Pupeno | Lau_of_DK: Yes, of course, but since I'm in Europe timezone too and I'm interested in people around here. |
| 02:31 | Pupeno | I'm in Switzerland by the way. |
| 02:31 | Pupeno | BBL |
| 02:32 | tWip | I'm in Finland. |
| 02:32 | tWip | spreading the good word here :) |
| 02:42 | Lau_of_DK | Denmark here |
| 03:21 | karmazilla | just glancing through the front page of dzone, I see four posts that in some way relate to Clojure |
| 03:39 | Lau_of_DK | Impressive |
| 03:49 | Lau_of_DK | karmazilla, I didnt know about DZone, fantastic link, thanks alot |
| 05:43 | Pupeno | Can you create a GUI (Swing) component in Clojure? |
| 05:52 | H4ns | Pupeno: yes. |
| 06:08 | parth_m | Pupeno: http://en.wikibooks.org/wiki/Clojure_Programming#Simple_GUI_:_Temperature_Converter |
| 06:08 | parth_m | Also, the is a miglayout wrapper in clojure-contrib |
| 08:35 | blackdog | i'd like to be able to connect to a repl via ssh, any recommendations for ssh libs, examples? |
| 08:36 | H4ns | blackdog: maybe you can use ssh port forwarding? no libs needed for that. |
| 08:36 | blackdog | mmm, yea that's an option, i wonder if enclojure has something, |
| 08:38 | blackdog | i'd quite like something self contained so i can deploy a jar and run, no other dependencies |
| 08:40 | H4ns | blackdog: 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:41 | cemerick | blackdog: 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:41 | cemerick | I *think* the only thing missing there is a UI to allow one to connect to a specific IP address, rather than local. |
| 08:41 | arbscht | blackdog: establish a tunnel with ssh and you will be able to use enclojure or slime through it |
| 08:43 | blackdog | ok, thanks all for the suggestions |
| 08:44 | Chouser | you'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:46 | tWip | that's what I've done with webjure... just listen to socket and provide repl through that |
| 08:46 | tWip | then ssh in with tunnels set properly |
| 08:47 | blackdog | ok, seems like i just want a tunnel, simplest option |
| 08:59 | pjb3 | I have some clojure code that creates a new class using gen-and-load-class |
| 09:00 | pjb3 | Then from clojure I call some java code then ends up doing Class.forName("myclass") |
| 09:00 | pjb3 | and it throws a ClassNotFoundException |
| 09:00 | tWip | different classloaders? |
| 09:00 | pjb3 | but when I just call (Class/forName "myclass") from clojure, it finds it |
| 09:01 | pjb3 | but isn't Class.forName the system classloader, so it should be the same, right? |
| 09:01 | rhickey | pjb3: different classloaders |
| 09:02 | rhickey | Invoking this method is equivalent to: |
| 09:02 | rhickey | Class.forName(className, true, currentLoader) |
| 09:02 | rhickey | where currentLoader denotes the defining class loader of the current class. |
| 09:03 | pjb3 | hmm...so there's no way to do gen-and-load-class, but then have java code be able to find that class |
| 09:04 | rhickey | gen-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:04 | tWip | I have yet to need any gen -stuff. |
| 09:05 | pjb3 | rhickey: ok, makes sense |
| 09:05 | pjb3 | So if I use gen-and-save-class, that class that gets saved ends up calling functions defined in clojure at runtime |
| 09:05 | rhickey | alternatively, you could have a Clojure fn that makes the instance and get it from Java using RT.var("yourns","yourfn").invoke() |
| 09:05 | pjb3 | so I can redine those methods in clojure, it I need to |
| 09:06 | rhickey | pjb3: yes, still dynamic on the Clojure side - the class is just a contract |
| 09:06 | pjb3 | cool |
| 09:06 | rhickey | there really isn't a good reason to define a class dynamically, since you can't redefine it dynamically, from a signature standpoint |
| 09:08 | rhickey | cemerick: 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:08 | turbo24prg | morning |
| 09:09 | turbo24prg | from http://stuartsierra.com/2008/08/08/clojure-for-the-semantic-web: |
| 09:09 | turbo24prg | "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:09 | turbo24prg | "Screencasts and code from the talk should appear soon -- watch clojure.org or the Clojure Google group for an announcement." |
| 09:09 | turbo24prg | is that code already available? |
| 09:10 | turbo24prg | i'd like to play with jena via clojure |
| 09:10 | cemerick | rhickey: whoo, that seems like a lifetime ago. It's been a busy year. :-) |
| 09:10 | cemerick | isn't it somewhat too late to change course on the ns stuff, especially now that lib's been integrated? |
| 09:11 | rhickey | cemerick: it ends up the interface of lib doesn't change, just where you put things |
| 09:11 | rhickey | com/mycompany/myns.clj |
| 09:12 | rhickey | instead of com/mycompany/myns/myns.clj |
| 09:12 | pjb3 | rhickey: when you said "there really isn't a good reason to define a class dynamically" |
| 09:12 | pjb3 | you mean that I should just use gen-and-save-class |
| 09:12 | cemerick | OK; so, the main advantage of the latter was that a namespace could transparently be composed of multiple files. Would that go away? |
| 09:12 | rhickey | because myns is going to end up being a class, with a static load() and optional main() |
| 09:13 | pjb3 | instead of gen-and-load-class, since I can redefine the functions that gen-and-save-class calls |
| 09:13 | cemerick | (or, main advantage aside from tooling, etc., which is another issue to be reconsidered) |
| 09:14 | rhickey | cemerick: the only advantage of the latter was as regards resources, now all with same Java package share, e.g. one segment up |
| 09:15 | rhickey | I think I've got the tooling sussed out, all fns end up looking like nested classes instead of top-level |
| 09:15 | rhickey | com/mycompany/myns$foo.class etc |
| 09:15 | rhickey | will work with debuggers |
| 09:15 | cemerick | yeah, that's a lot more straightforward, IMO |
| 09:16 | rhickey | cemerick: right, I'm still on the fence about multi-file - it really makes a mess, needs an 'include' notion etc |
| 09:16 | cemerick | there 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:17 | cemerick | personally, 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:17 | rhickey | if there's a need to split them there's probably a logical partitioning, which need not incur a hard ns subdivision: |
| 09:17 | rhickey | com/mycompany/myns.clj com/mycompany/myns-utils.clj |
| 09:19 | cemerick | If I follow you, that's perfectly reasonable in virtually all cases. Requiring a (use 'myns-utils) isn't hard. |
| 09:19 | rhickey | a big advantage, not yet fully cooked, is the replacement of genclass entirely by metadata annotations in your .clj file |
| 09:19 | cemerick | It gets smoothed out even more if clojure eventually grows the notion of friendly access between namespaces. |
| 09:20 | rhickey | since each ns is a class, for loading purposes, can define some fns as maping to methods etc |
| 09:20 | cemerick | rhickey: don't tease me :-) |
| 09:21 | rhickey | cemerick: It's going to happen - there's no reason for separate AOT options, and everyone struggles with the signature/def dichotomy |
| 09:21 | rhickey | of genclass |
| 09:21 | cemerick | Oh, I'm all for it |
| 09:21 | rhickey | so, the sig and initial defs go together, but no limitations on dynamic redef |
| 09:23 | rhickey | also, with the main() gen, makes the delivery story so easy - AOT+jar |
| 09:24 | rhickey | pjb3: yes |
| 09:25 | cemerick | rhickey: 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:25 | cemerick | At that point, I'd be in a position to give something resembling useful feedback. |
| 09:26 | rhickey | cemerick: this decision is the final sticking point, most of the rest is mechanical - compile method is underway |
| 09:27 | cemerick | is it a sticking point still? You sound pretty convinced already. |
| 09:27 | rhickey | there 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:28 | rhickey | cemerick: 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:28 | cemerick | might want to wait until noonish, anyway; Chouser's probably not up yet :-) |
| 09:29 | rhickey | shared-world means strewing side-effecting statements at top level not a good idea, but will eventually beg for eval-when |
| 09:30 | cemerick | yeah, 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:30 | cemerick | it sounds like AOT might leave room for resolving interleaved dependencies down the road.... |
| 09:30 | rhickey | cemerick: maybe, still very complicated |
| 09:31 | rhickey | part of me says, just don;t do it - you'll app will be cleaner if you stick interfaces in a separate, shared project |
| 09:31 | cemerick | definitely, but having a standard AOT process makes the problem tractable, anyway |
| 09:32 | rhickey | AOT is going to propel Clojure forward into many areas, I think |
| 09:32 | rhickey | big feature |
| 09:32 | cemerick | it'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:33 | cemerick | All of the "alternative" jvm languages will need to address it eventually |
| 09:33 | rhickey | cemerick: can you generically describe that situation? |
| 09:36 | rhickey | Today marks Clojure's first year in release! |
| 09:36 | blackdog | congrats! |
| 09:36 | blackdog | very successful year I'd say |
| 09:38 | rhickey | blackdog: yeah, I couldn't possibly have imagined the year it's had |
| 09:38 | Chouser | I'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:39 | blackdog | your upcoming talk on the future of lisp is a good way to finish up, with all the big names there |
| 09:40 | Chouser | rhickey: 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:41 | walters | Chouser: 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:43 | rhickey | walters: not really affecting Clojure's dynamism at all, this is just a Java interop thing, which exists already |
| 09:44 | rhickey | Chouser: yes, the community, the academic and other attention, all the talks etc |
| 09:45 | rhickey | As 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:46 | Chouser | At the next anniversary you'll have a rather more high-profile interview than this. |
| 09:47 | rhickey | The only feature I'd imagined having that's missing is some sort of declarative rules |
| 09:47 | rhickey | I though ti might be combined with predicate dispatch, but am happier with where multimethods ended up - ad hoc hierarchy |
| 09:48 | Chouser | Is the timing of v 1.0 (and related breaking changes) at all coordinated with the book release? |
| 09:48 | cemerick | rhickey: 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:49 | rhickey | Chouser: 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:50 | blackdog | rhickey: 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:51 | rhickey | Chouser: 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:52 | rhickey | blackdog: 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:53 | Chouser | will binding forms all be changed to allow multiple bindings, or is that not necessarily needed yet? |
| 09:54 | rhickey | Chouser: it won't always make sense - e.g. dotimes |
| 09:54 | rhickey | so, othogonal |
| 09:54 | rhickey | doseq being imperative for is the biggest need, IMO |
| 09:55 | blackdog | i 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:55 | rhickey | blackdog: inject into what? |
| 09:55 | rhickey | blackdog: for Clojure? |
| 09:56 | blackdog | well say in a gen class situation, tagging the class as a servlet |
| 09:57 | rhickey | blackdog: that falls under "generate annotations" above, yes |
| 09:57 | blackdog | i 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:57 | blackdog | ah ok |
| 09:58 | blackdog | i thought you meant actually creating the annotation, |
| 09:58 | blackdog | ok, cool |
| 09:58 | rhickey | metadata to the rescue |
| 10:18 | lisppaste8 | wlr pasted "is this -> abuse or a bug?" at http://paste.lisp.org/display/68628 |
| 10:19 | achim_p | hi! |
| 10:20 | turbo24prg | rhickey: do you have any examples for clojure+jena? |
| 10:20 | Chouser | wlr: abuse. -> is a macro that "physically" inserts the result of one expression as the first arg of the next expression. |
| 10:20 | rhickey | wlr: -> is a macro defined in terms of manipulation of the forms it is passed |
| 10:21 | achim_p | rhickey: 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:21 | achim_p | i'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:21 | rhickey | turbo24prg: sorry, saw that before, not on the machine I'm on - I'll try to post them on the group later |
| 10:21 | wlr | rhickey,chouser: thanks |
| 10:22 | turbo24prg | rhickey: cool, thanks! |
| 10:22 | Chouser | -> can be abused to get non-errors like: (-> [a 5] (let a)) |
| 10:22 | rhickey | Chouser: yikes |
| 10:23 | rhickey | achim_p: yes, only load-file is at risk with AOT |
| 10:26 | achim_p | rhickey: that's good to know, thanks! |
| 10:27 | achim_p | looking forward to AOT |
| 11:02 | fyuryu | rhickey: 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:27 | Pupeno | I'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:31 | Chouser | Pupeno: have you seen this? Does it help at all? http://groups.google.com/group/clojure/msg/b093a28d69692479 |
| 11:32 | Pupeno | Chouser: I haven't going there now. |
| 11:34 | Pupeno | is (.setBlah blah) the same as blah.setBlah()? |
| 11:35 | Chouser | yes |
| 11:36 | Pupeno | Ok... so I should make a function (make-my-component) that will basically do (let [c (.JComponent)] (.setTitle c "My component") ...etc... c)? |
| 11:37 | Chouser | "JComponent." but yes |
| 11:37 | Pupeno | Except that JComponent is abstract. |
| 11:37 | Chouser | ah, hm. |
| 11:38 | Chouser | ok, if you actually need to create a new class (and not just compose instances of existing classes) you may need to use proxy |
| 11:38 | Pupeno | So, there's no way to make a Java class/subclass in Clojure? |
| 11:38 | Chouser | (doc proxy) |
| 11:38 | rhickey | Pupeno: proxy can subclass abstract classes |
| 11:38 | Pupeno | Oh! excellent, thanks. |
| 11:39 | Chouser | sure there is. proxy is the easiest, but gen-class is also available. |
| 11:39 | Pupeno | Bah... Enclojure's REPL doesn't work at all. |
| 11:39 | asbjxrn | I 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:40 | asbjxrn | My lib only draws in a JPanel, but could that approach work for more usual swing guis too? |
| 11:41 | Pupeno | asbjxrn: 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:41 | asbjxrn | For callbacks I used a macro eg. (on-mouseclick agent fn) |
| 11:41 | wwmorgan | Pupeno: what behavior are you getting from the enclojure repl? |
| 11:42 | asbjxrn | Pupeno: Exactly. |
| 11:42 | Pupeno | wwmorgan: I type something, I press enter, and it never comes back. |
| 11:43 | wwmorgan | Pupeno: alt + enter |
| 11:43 | Pupeno | wwmorgan: Oh! :) |
| 11:43 | wwmorgan | I think that happens to everybody |
| 11:46 | rhickey | (SwingUtilities/invokeLater any-clojure-fn) |
| 11:47 | asbjxrn | Hey! |
| 11:50 | Pupeno | Is it as easy as (proxy [JComponent] [])? |
| 11:50 | rhickey | Pupeno: yup |
| 11:50 | asbjxrn | Pupeno: Have a look at the ant colony code. |
| 11:51 | Pupeno | Amazing! Thanks. |
| 12:43 | rhickey | fyuryu: fixed - thanks for the report |
| 13:10 | leafw | Fiji is out: http://pacific.mpi-cbg.de -- an imaging application that supports plugins written in Clojure |
| 13:12 | cemerick | leafw: fancy -- is that yours? |
| 13:15 | leafw | partly yes. |
| 13:16 | leafw | I founded it. My hacker friends took it to much higher goals I ever intended. |
| 13:16 | leafw | (I'm Albert in the Contributors list) |
| 13:17 | cemerick | leafw: are you using any UI framework in particular? |
| 13:17 | leafw | there 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:17 | leafw | no: we mix awt and swing. |
| 13:17 | leafw | ImageJ, the core, uses only AWT. |
| 14:09 | leafw | "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:09 | leafw | that sentence needs updating |
| 14:09 | leafw | in the current multicore world, Clojure is the best chance for the JVM to survive into the XXI century. |
| 14:10 | Chouser | Clojure is the best chance for lisp to survive into the XXI century. |
| 14:10 | leafw | I guess we have a synergy here, like symbiosis |
| 14:11 | Chouser | Symbiosis is the best chance for synergy to survive into the XXI century. |
| 14:12 | leafw | that sentence makes nosense Chouser. Never mind. |
| 14:12 | Chouser | I 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:12 | leafw | it's just PR. |
| 14:12 | Chouser | yeah, I'm sure you're right. |
| 14:14 | kotarak | What was it? Same month of release as lisp 50 years ago.... Hmmm.... |
| 14:14 | leafw | someone said that in the mailing list. |
| 14:15 | kotarak | So let's see how Clojure looks like in 50 years... |
| 14:15 | leafw | considering how computers looked like 50 years ago, there's no hope we can even begin to visualize that. |
| 14:16 | kotarak | Maybe we are again in the Stone Age by then... |
| 14:24 | kotarak | "Look my new fifty stone abacus! Running on granite core with marble UI!" |
| 14:24 | abrooks | Chouser: You'd do fine in any medium. |
| 14:24 | abrooks | kotarak: ;-) |
| 14:37 | Lau_of_DK | Evening gents |
| 14:38 | danlarkin | afternoon! |
| 14:46 | Lau_of_DK | Is there anyway to use (println) so that it automatically even-spaces the whitespace, like using the full width of the console? |
| 14:48 | Chouser | you're asking for fully-justified text, like a newspaper column? |
| 14:50 | Lau_of_DK | yes sir |
| 14:51 | Chouser | I don't think clojure provides anything like that -- dunno about Java. |
| 14:51 | Lau_of_DK | Java has a curses library |
| 14:52 | Lau_of_DK | I'd just feel that it would be overkill - I just need to output some statistics :) |
| 14:52 | Chouser | there's (doc format) which could get you fixed-width columns of numbers and such. |
| 14:53 | kotarak | OCaml has pretty-print library, which can do such things IIRC. Maybe one can rip-out the interesting parts. |
| 14:53 | Lau_of_DK | Chouser, (doc format) throws an exception |
| 14:55 | Chouser | maybe your version of clojure doesn't have format. It just makes it easy to use java.util.Formatter |
| 14:55 | Lau_of_DK | are you thinking SBCL now? |
| 14:55 | Lau_of_DK | ah okay, I'll look that up instead, thanks for the tip |
| 14:55 | Chouser | no, what little CL I knew has long since turned to vapor. |
| 14:56 | Lau_of_DK | Might as well, Clojure is the way to go |
| 14:56 | Lau_of_DK | In my oppinion. Its more robust and modern (multi-thread) and also, SBCL and other non-proprietary Lisps have some very frustrating short comings |
| 15:08 | Lau_of_DK | I'm still fighting this bug, if anybody has some input, I'll be happy to hear it: http://pastebin.com/m42056586 |
| 15:18 | Pupeno | I 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:18 | StartsWithK | Lau_of_DK: what exactly is is the bug? |
| 15:18 | Lau_of_DK | That it gives mathematically incorrect results, as shown in second run of test-frac |
| 15:18 | wwmorgan | (fraction 1.0 11.0) => 0.99 |
| 15:20 | Chouser | Pupeno: you can use proxy to override methods |
| 15:20 | Pupeno | Chouser: really? how? |
| 15:21 | Chouser | hm, well ... |
| 15:23 | Chouser | doesn't this work? (proxy [javax.swing.JComponent] [] (paintComponent [g] (prn g))) |
| 15:23 | wwmorgan | Lau: how does your algorithm detect an infinite cycle? |
| 15:23 | Pupeno | Chouser: I don't think so, but let me try. |
| 15:27 | Pupeno | Chouser: Oh! it does! I totally missunderstood the proxy documentation. Thank you. |
| 15:27 | Chouser | Pupeno: ah, great. |
| 15:28 | drewr | Does lazy-cons "look ahead" a few spots? |
| 15:29 | Chouser | drewr: users of it might |
| 15:29 | drewr | I'm trying to figure out if I am. |
| 15:29 | drewr | I think I am but I can't figure out how. |
| 15:30 | Lau_of_DK | wwmorgan, 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:30 | Lau_of_DK | so this is what it looks for |
| 15:32 | rhickey | drewr: lazy-cons doesn't - it creates suspensions of both the first and rest expressions |
| 15:32 | drewr | I must be calling the fn that returns the lazy-cons multiple times. |
| 15:33 | drewr | If I'm concat'ing lazy-conses together, does that cause anything counterintuitive? |
| 15:33 | rhickey | drewr: with lazy-cat? |
| 15:34 | drewr | No, manually. I didn't know about lazy-cat when I wrote this code. |
| 15:34 | drewr | (concat (fn-that-returns-a-lazy-cons) ... ) |
| 15:34 | rhickey | concat will eval each arg |
| 15:34 | rhickey | doesn't run the seqs, but enough to know there is a seq |
| 15:35 | drewr | It looks like I'm getting three calls per fn. |
| 15:35 | rhickey | so will run the fn in which you call lazy-cons |
| 15:35 | drewr | I'm basing this on a prn that I've put in the fn-that-returns... call. |
| 15:36 | Pupeno | Chouser: 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:38 | Chouser | you don't get to customize the constructor with proxy, just override the methods. |
| 15:41 | wwmorgan | Lau_of_DK: modulus is a list of String objects of length 1? |
| 15:42 | Lau_of_DK | No, its a series of digits |
| 15:42 | wwmorgan | "0"-"9"? |
| 15:42 | danlarkin | 1 through n-1 |
| 15:42 | Lau_of_DK | but yea, for ease of use, I mean them string objects, that correct |
| 15:43 | danlarkin | 0 through n-1 actually I guess |
| 15:44 | Pupeno | oh... maybe I should anotate the arguments. |
| 15:44 | lisppaste8 | Chouser pasted "custom JComponent overriding paintComponent" at http://paste.lisp.org/display/68642 |
| 15:46 | Lau_of_DK | wwmorgan, , as far as I can see, this is a problem of the algo inserting too few, or too many zeroes |
| 15:50 | kotarak | Lau_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:50 | Lau_of_DK | youre right |
| 15:52 | kotarak | Lau_of_DK: and after a quick look maybe vectors instead of list. so conj adds to the end. No need for concat... |
| 15:52 | Lau_of_DK | good tip, thx |
| 15:53 | Pupeno | Chouser: thanks. |
| 15:53 | Chouser | Pupeno: sure -- got it working? |
| 15:55 | Pupeno | Chouser: 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:55 | Chouser | hm. Hope you figure it out. |
| 15:55 | Chouser | Feel free to post the whole thing, if you want. |
| 15:56 | Pupeno | It's already gone, but thank you. |
| 15:56 | Chouser | hm, ok. |
| 16:14 | Lau_of_DK | wwmorgan, its working now :P |
| 16:15 | wwmorgan | Lau: very cool. What was it? |
| 16:15 | Lau_of_DK | The function fdigit should not be applied with using (rem a x), only (/ x a) |
| 16:16 | wwmorgan | ah. |
| 16:17 | Lau_of_DK | This is a decimal expansion that works ! :) http://pastebin.com/m379554bf |
| 16:26 | Lau_of_DK | (insert applause) |
| 16:28 | Lau_of_DK | (help refactor) |
| 16:31 | kotarak | Lau_of_DK: my suggestions with set and vector: http://pastebin.com/mf62a20b |
| 16:31 | Lau_of_DK | Thanks, those were some good tips |
| 16:32 | kotarak | Lau_of_DK: yeah, but not tested. ;) |
| 16:32 | Lau_of_DK | it'll come 'round |
| 16:32 | kotarak | Would like to see some comparison in performance on large inputs. |
| 16:32 | Lau_of_DK | yea, so far mine runs from 2 -> 1000 in 50 secs on my old slow CPU |
| 16:32 | Lau_of_DK | I'll do a comparison tomorrow and let you know how it goes |
| 16:33 | kotarak | ok, would be nice |
| 16:33 | Lau_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:33 | kotarak | :) |
| 16:34 | Lau_of_DK | Pretty sweet to be able to work with infinite floats though |
| 16:34 | wwmorgan | Lau_of_DK: (fraction 1.0 2.0) => 0.05 |
| 16:34 | Lau_of_DK | little bug, use (fraction 2.0) instead |
| 16:35 | Lau_of_DK | if you supply both args, it needs to multiply the numerator by 10, which I forgot to put in there |
| 16:37 | Lau_of_DK | I gotta hit the sack, thanks for all your time and inputs guys |
| 16:38 | drewr | Chouser: Thanks for the regex backslash patch! |
| 16:38 | Chouser | drewr: sure! not much code, but my goodness all the talking! |
| 16:39 | drewr | Heh, I'm behind on list mail like a couple months. |
| 16:40 | Chouser | abrooks has suggested a weekly or monthly summary of clojure goings-on. I wonder how much audience that would have. |
| 16:40 | drewr | That's a great idea. |
| 16:41 | Chouser | sounds like work, though. |
| 16:41 | abrooks | Chouser: 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:41 | drewr | I wish I had the time and foresight to pull that off. |
| 16:41 | abrooks | I'd hate to start it up and not follow through. |
| 16:41 | abrooks | I'm intending a summary for October. I have part of September. |
| 16:42 | abrooks | Naturally, this will be called "Over Expojure" |
| 16:42 | drewr | :-) |
| 16:42 | abrooks | I'm aiming for monthly. |
| 16:43 | Chouser | abrooks: sounds great! |
| 16:45 | albino | Like Haskell Weekly, only Clojure Monthly |
| 16:47 | Pupeno | I 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:48 | kotarak | Pupeno: what editor do you use? |
| 16:48 | Chouser | heh. that's a funny reason for it, but it's been mentioned before. |
| 16:49 | kotarak | For me the indentation for proxy methods or functions is just a difference of two spaces.... |
| 16:50 | Pupeno | kotarak: right now, Emacs. |
| 16:50 | kotarak | Pupeno: ok. Can't speak for emacs. |
| 16:50 | Pupeno | kotarak: what do you use? |
| 16:51 | kotarak | vim. What else? ;) |
| 16:51 | cemerick | is there no way to call a superclass' implementation of a method from a genclass impl fn? |
| 16:52 | Chouser | hm, there must be. That used to be a reason to use genclass instead of proxy. |
| 16:52 | achim_p | cemerick: you have to dynamically nil-bind the overriding function |
| 16:53 | achim_p | and then call it |
| 16:53 | achim_p | weird hack |
| 16:53 | cemerick | achim_p: ha-ha! |
| 16:53 | kotarak | proxy has proxy-super... |
| 16:53 | cemerick | yeah, I saw that proxy improved since the last time I looked at it |
| 17:02 | achim_p | cemerick: 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:03 | cemerick | achim_p: thanks -- it's unpleasant enough that I was motivated to find a workaround :-) |
| 17:05 | Pupeno | It seems that printlns from paintComponent, at least when running in Slime, do not reach the screen. |
| 17:10 | danlarkin | this is great, http://api.flickr.com/services/feeds/photos_public.gne?id=68497070@N00&lang=en-us&format=lol |
| 17:10 | wwmorgan | Pupeno: 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:12 | kotarak | is the clojure group the right place to announce things? I'm always spamming the list, but I'm a bit uncomfortable. |
| 17:15 | Chouser | As long as it's clojure-related, I wouldn't expect it to be a problem. |
| 17:19 | cemerick | rhickey: is auto-creating arrays for variadic method calls still on your to-do list? |
| 17:26 | rhickey | cemerick: 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:26 | rhickey | useful in places other than variadics too |
| 17:30 | cemerick | rhickey: adding a type indicator to into-array isn't sufficient? Array literals are expensive, in terms of taking up that #[ dispatch. |
| 17:32 | rhickey | cemerick: 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:06 | Pupeno | lisppaste8: url |
| 18:06 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 18:07 | lisppaste8 | Pupeno pasted "Can this be made less ugly?" at http://paste.lisp.org/display/68654 |
| 18:08 | Pupeno | Can that piece of code be made less ugly? |
| 18:11 | achim_p | Pupeno: how is it ugly? you could replace (. Color WHITE) by Color/WHITE (same for RenderingHints), but apart from that ... |
| 18:12 | Chouser | someone posted a macro to produce proxy calls that defered all the methods to top-level defn's -- but I can't find it. |
| 18:13 | Pupeno | achim_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:14 | Chouser | ah, http://paste.lisp.org/display/68075 |
| 18:14 | achim_p | mmh, just use 2 spaces for indentation, defn style? |
| 18:14 | Chouser | but that's just an example, not an implementation. |
| 18:15 | Chouser | Pupeno: you could certainly replace your paintComponent body with (my-paint component g) and defn that at the top. |
| 18:16 | Pupeno | achim_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:18 | Pupeno | Chouser: 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:21 | Pupeno | Thank you for the tips. |
| 18:28 | rhickey | Clojure's birthday party: http://clojure.org/ |
| 18:31 | danlarkin | looks delicious! |
| 18:31 | drewr | Nice! |
| 18:34 | Pupeno | Still waiting for it to load here :( |
| 18:36 | rhickey | Don't settle for a language that doesn't have cake! |
| 18:36 | achim_p | happy birthday to clojure! congratulations to rhickey and everyone else involved |
| 18:36 | Pupeno | Anyway... happy birthday Clojure! |
| 18:36 | drewr | Bring a piece for me to Nashville. |
| 18:37 | danlarkin | ...the cake is a lie :-o |
| 18:37 | Pupeno | rhickey: 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:38 | Pupeno | drewr: wow! you are an old-timer! |
| 18:38 | drewr | It's amazing it was so usable 10 months ago! |
| 18:39 | rhickey | Pupeno: I worked on it a couple of years before releasing it |
| 18:40 | Pupeno | rhickey: I'm sure Matz did that as well. Not intending to create a flamewar. I'm just really surprised at Clojure. |
| 18:46 | lisppaste8 | achim annotated #68654 with "emacs indentation" at http://paste.lisp.org/display/68654#1 |
| 18:47 | Pupeno | achim_p: *my* Emacs doesn't indent it like that. |
| 18:49 | achim_p | Pupeno: 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:58 | drewr | How do you expand "~/foo" to "$HOME/foo" in java? |
| 18:58 | drewr | I thought File/getCanonicalPath or File/getAbsolutePath would do it, but no. |
| 18:59 | drewr | Those aren't static methods though. |
| 19:02 | Pupeno | drewr: Isn't that very shell specific? |
| 19:02 | drewr | Pupeno: $HOME is just a placeholder there. |
| 19:02 | drewr | I just want the tilde to expand to whatever is appropriate. |
| 19:03 | Pupeno | Is there a shorter way to do (int (/ someRandomInt 2))? to get 3/2=1, 4/2=2, 5/2=2, etc. |
| 19:03 | Pupeno | drewr: 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:04 | drewr | Hm. I suppose Python and elisp parse that manually and insert HOME from the environment. |
| 19:04 | drewr | Seems like Java could do the same. |
| 19:05 | Chouser | what's that partial logo under the cake plate? some kind of Clojure button? |
| 19:08 | Chouser | Pupeno: (quot 3 2) |
| 19:13 | Pupeno | Chouser: thanks. |
| 19:17 | achim_p | some 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:19 | lisppaste8 | achim pasted "find-by-example" at http://paste.lisp.org/display/68658 |
| 19:21 | achim_p | that's the code, maybe someone has an idea how to improve this |
| 19:32 | emacsen | hey 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:33 | emacsen | I'm seeing old disgrunteled Lispers talking optimistically |
| 19:33 | emacsen | I'm seeing Java people taking notice |
| 19:33 | emacsen | it's awesome |
| 20:00 | scgilardi | jochu 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:02 | rhickey | emacsen: thanks, yeah, it's been a great start |
| 20:25 | scottj | Any 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:27 | scottj | I'm supposed to run script/run from the compojure directory, not run run from the script directory, right? |
| 20:30 | jerryk | Is there a current or preferred unit testing framework or discipline for code written in Clojure? |
| 20:31 | fyuryu | jerryk: there is something for that in clojure-contrib |
| 20:31 | jerryk | fyuryu: thx, will look. |
| 20:50 | emacsen | mattrepl, hey... are you in fringedc? |
| 20:51 | mattrepl | emacsen, hey, never attended but am on the list. keep meaning to |
| 20:52 | emacsen | mattrepl Conrad did a cool talk on non-deterministic regex in arc |
| 20:52 | emacsen | I need to bug him about the audio and slides from last talk |
| 20:52 | emacsen | the embeddedml |
| 20:52 | emacsen | not to be off topic- just trying to drum up more people to come to meeting :) |
| 20:53 | mattrepl | yeah, there was one on xmonad awhile back that looked good too. heh, will try to make it |
| 20:53 | emacsen | the xmonad one was decent |
| 20:54 | emacsen | I used Xmonad for like... two weeks |
| 20:54 | emacsen | the xmonad one got huge attendance |
| 20:54 | emacsen | last one, not so much |
| 20:54 | emacsen | (I hosted it and was prepared for double the number who turned out) |
| 20:54 | emacsen | not that I'm complaining. we had I think 10 people at the end |
| 20:55 | emacsen | and I wasn't just dissapointed in fringedc. I was pissed no one from hacdc came either |
| 21:37 | lisppaste8 | q pasted "q" at http://paste.lisp.org/display/68664 |
| 21:38 | lisppaste8 | a pasted "a" at http://paste.lisp.org/display/68665 |
| 21:49 | lisppaste8 | Chouser annotated #68665 with "converted to clojure" at http://paste.lisp.org/display/68665#1 |
| 23:40 | abrooks | Happy Birthday, Clojure! |