#clojure log - Nov 13 2008

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

0:30 drewc: larrytheliquid: progv

0:30 larrytheliquid: ph .. wait .. no

0:30 * drewc somehow thinks he's in #lisp all the time

0:36 drewc: and .. actually .. progv is nothing of the sort@

0:36 s/@/!

0:59 arohner: how do I convert a clojure string to java.lang.CharSequence[]?

0:59 I tried (seq "my string")

1:00 hiredman: maybe into-array

1:00 hmmm

1:00 or not

1:01 into-array will make a char array out of a seq of chars

1:01 arohner: yeah

1:02 hiredman: uh

1:02 CharSequence is an interface

1:02 which String implements

1:03 so you should just be able to pass a clojure string in

1:03 because clojure strings are java strings

1:03 arohner: I get "java.lang.ClassCastException: java.lang.String"

1:04 the signature on the function is 'java.lang.CharSequence...'

1:04 which I think means array, but (into-array "my string") should have returned an array of strings of length 1

1:05 hiredman: (into-array (cast java.lang.CharSequence "my string"))

1:06 arohner: java.lang.ClassCastException: [Ljava.lang.Character;

1:07 I wish I understood exactly what the ellipsis means in javadocs

1:07 hiredman: well, I am stumped

1:07 arohner: it seems to mean array, but I haven't seen that explicitly

1:07 hiredman: uh

1:07 [] means array

1:08 arohner: 'An argument type followed by an ellipsis (...) in a method's parameter list indicates that the method receives a variable number of arguments of that particular type. '

1:09 hiredman: try the cast without the into-array

1:10 arohner: same.

1:13 got it

1:13 (into-array) takes a sequence

1:14 hiredman: ah

1:14 arohner: a string by itself is already a seq of chars, so (into-array "my string") returns char[]

1:14 to get an array of strings, (into-array ["my string"])

1:14 and I think I already ran into this problem and figured it out once

1:15 maybe that's a sign I shouldn't be programming late.

1:15 well, thanks for the help.

2:41 Lau_of_DK: Good morning all

2:44 danlarkin: you and your gmt+1

2:50 Chousuke: heh

2:50 morning

3:02 _Jordan_: (functional programming noob question): Can anyone help me convert my current recursive solution to one that is able to use loop/recur?

3:03 danlarkin: _Jordan_: most likely you can just change the call to (my-function ...) to (recur ...)

3:03 if it's a tail-call

3:04 _Jordan_: I tried, but apparently it's not tail-call, because it barfed... I still suck at knowing what I'm doing

3:05 but I would be delighted if you could show me how to make it tail-call :)

3:05 yangsx1: _Jordan_: then paste your code on http://paste.lisp.org etc

3:07 _Jordan_: http://paste.lisp.org/display/70288

3:09 jdz: _Jordan_: look at the various Lisp implementations of factorial; there are both straight recursive and tail-recursive versions.

3:12 yangsx1: _Jordan_: you need an accumulator to hold the result and return it when the stop condition is satisfied

3:14 hiredman: you could also turn it into a lazy-seq

3:14 just to throw that out there

3:18 _Jordan_: Got it! Thank you everyone!

4:04 Lau_of_DK: Is anyone here in possession of some type of comparison between Jetty and Apache. Im interesting in how scalable Jetty is

4:31 tWip: Lau_of_DK: do you mean apache httpd? or apache tomcat or something else

4:32 Lau_of_DK: httpd

4:34 tWip: that's a bit of apples vs oranges comparison as they don't have the same features

4:35 Lau_of_DK: Its not a matter of features per say, its basically a matter of wether or not Jetty can host as large systems as Apache without breaking

4:35 I'd hate to begin on a project, only to have to abandon it in the first day of deployment

4:35 @ tWip

4:36 tWip: well if you are coding in Clojure I don't think you can avoid having a servlet engine

4:37 Lau_of_DK: But thats the not really the issue :)

4:38 tWip: Only way to be sure is to do load benchmarking

4:39 but I would wager that the plain HTTP serving is not going to be the bottleneck in non trivial applications

4:39 and you can always use apache/yaws/something else for the static content

4:42 Lau_of_DK: You mean actually run 2 servers, 1 for servlets 1 for static ?

4:43 amagee: i'm trying to use a Timer in clojure, but it can't seem to find the 'schedule' method: if i try (. (new Timer) schedule), I get IllegalArgumentException: No matching field found: schedule (etc)

4:43 am i doing something really silly?

4:43 jdz: what about (. (new Timer) (schedule))?

4:43 tWip: Lau_of_DK: well I usually deploy by running apache on 80, then servlet engine in the non-privileged 8080 port

4:44 Lau_of_DK: apache does rewrite proxying to the servlet engine

4:44 jdz: amagee: or even (.schedule (new Timer))

4:44 Lau_of_DK: tWip, thats sounds like the way to go. Have you got a get-me-started guide somewhere?

4:44 amagee: jdz: both of those give the same error

4:44 Lau_of_DK: amagee, make an agent and (Thread/sleep x) it for your intervals?

4:45 tWip: Lau_of_DK: no, not really... just the accumulated knowledge over the years which I haven't documented anywhere

4:45 jdz: amagee: i don't see any method in Timer class that has no arguments

4:45 amagee: i mean, the schedule metod

4:46 tWip: but I think the apache+mod_rewrite is a common for frontend for many app servers and tutorials should be available on the net

4:46 amagee: jdz: oh, i can get that error if the method name is right but the argument list is wrong?

4:47 jdz: amagee: well, i'm not very used to Java exceptions and when they are thrown, but this one apparently means that it was unable to find a schedule method with given argument list (empty)

4:47 amagee: hence, no matching member

4:48 amagee: ah yeah that makes sense

4:48 Lau_of_DK: amagee: (def a (agent 0)) (defn work [] (println "Running") (Thread/sleep 1000) (send-off a work)

4:48 missing a few )) maybe :)

4:49 amagee: ah cool

4:49 thanks to both of you :)

4:50 Lau_of_DK: is that code supposed to loop indefinitely?

4:50 Lau_of_DK: it'll run forever :)

4:51 (def keep-running (ref true)) (defn work [] (when @keep-running (do work))

4:51 amagee: hmm when i run it from repl it just prints "Running" once then stops

4:51 Lau_of_DK: then (dosync (ref-set keep-running false)) to abort

4:51 Thats probably because println doesnt flush by itself, so (println ..) (flush) might do the trick

4:51 jdz: Lau_of_DK: i'd consider your proposed solution ugly

4:52 Lau_of_DK: jdz, oh, how would you go about it ?

4:53 jdz: Lau_of_DK: i think there is nothing wrong using Timer.schedule. And what's more, your solution will drift off the correct intervals.

4:53 *off of

4:53 that might not be important, though

4:54 amagee: Timer.schedule knows to keep to the correct intervals?

4:54 jdz: amagee: what else does the 'period' parameter mean/

4:54 ?

4:55 amagee: oh i just didn't know how clever it was

4:55 jdz: amagee: what kind of documentation are you reading?

4:55 amagee: i thought it'd be implemented like how Lau_of_DK did it

4:55 jdz: i just went to java.sun.com and read there

4:56 amagee: look at scheduleAtFixedRate method

4:56 Lau_of_DK: Well, amagee you can use my example for a reference on agents, but like jdz said, Timer/schedule might be more what you want

4:56 jdz: amagee: it's all stated right there, in the documentation.

4:56 amagee: ah cool yes that's very nice :)

4:57 i didn't know that

4:57 so i will use that

4:57 jdz: amagee: i did not, too, until you mentioned that class. but i bothered to read the documentation.

4:57 amagee: and i suggest you do the same

4:57 amagee: however i still haven't got your agent example working yet

4:57 (defn work[] (println "Running") (flush) (Thread/sleep 1000) (send-off a work))

4:58 (work)

4:58 just prints "Running" once then goes back to prompt

4:58 (i'm just doing this out of interest now)

5:09 Lau_of_DK: (def a (agent 0))

5:09 (defn work

5:09 []

5:09 (println "agent running")

5:09 (Thread/sleep 1000))

5:09 jdz: how about using lisppaste?

5:09 Lau_of_DK: in repl

5:09 (send-off a work)

5:11 amagee: now i get no output

5:12 Lau_of_DK: just as test, not application for the real world, can you try this

5:12 (import '(javax.swing JOptionPane))

5:13 dnm: Is anyone else trying to use JUnit with Clojure, or am I it?

5:14 Lau_of_DK: and then instead of println use (JOptionpane/showMessageDialog "Test")

5:14 my showMessageDialog doesnt follow documentation, so try showInputDialog "test"

5:15 I retract that, use (JOptionPane/showMessageDialog nil "Test")

5:16 amagee: (defn work [] (JOptionPane/showMessageDialog nil "Test") (Thread/sleep 1000))

5:17 and then, (send-off a work) .. ?

5:17 Lau_of_DK: after (def a (agent 0))

5:17 yea

5:17 amagee: does nothing

5:19 Lau_of_DK: hehe

5:20 I might have forgot a little something

5:21 Each loop should end with (send-off *agent* self) where self in this case is 'work'

5:21 But mine isnt running either, and Im not sure why

5:22 amagee: hmm ok :)

5:22 well, still no luck with my other avenue either :(

5:22 trying (. (new Timer) scheduleAtFixedRate (proxy [TimerTask] [] (run [] (print "hello"))) 0 1000)

5:22 No matching method found: scheduleAtFixedRate for class java.util.Timer

5:22 but this time the arguments are right (i hope)

5:23 Lau_of_DK: hehe

5:23 I think I got it

5:24 roblally: dnm - I've been looking at JUnit and Clojure a little.

5:24 Lau_of_DK: user> (def a (agent 0))

5:24 #=(var user/a)

5:24 user> (def b (ref 0))

5:24 #=(var user/b)

5:24 user> (defn work [a] (dosync (commute b inc)) (Thread/sleep 100) (send-off *agent* work))

5:24 #=(var user/work)

5:24 user> (send-off a work)

5:24 #<clojure.lang.Agent@8edb84>

5:24 user> @b

5:24 33

5:24 work must of course take a paramter, which is the agent being dispatched

5:25 amagee: ok

5:26 cool

5:27 do you have any ideas about my Timer problem?

5:27 Lau_of_DK: I havent looked into it at all, but catch up with me tonight and I'll have time to dive into it if you want

5:27 amagee: mm well it is tonight over here :)

5:27 Lau_of_DK: oh :)

5:28 Im thinking approx 8 hours from now, mayb 9� :)(

5:28 hoeck: amagee: try (long 0) and (long 1000)

5:28 Lau_of_DK: Can you post a link to the relevant Javadoc ?

5:28 amagee: hoeck: bingo, that did it :)

5:29 Lau_of_DK: hoeck, a man of a few well chosen words

5:29 amagee: hehe

5:29 thanks :)

5:29 hoeck: np :)

8:11 mehrheit: should integer? return false for Shorts and Bytes?

8:13 rhickey: mehrheit: probably not

8:17 mehrheit: fixed (svn 1096)

8:21 mehrheit: well that's fast.

8:33 leafw: so AOT compiler support is in. Thanks Rick.

8:36 rhickey: leafw: you're welcome. just have to wait for contrib and other tools (slime/swank) to sync up

8:38 leafw: the webpage still has no docs on AOT specifically (empty search result)

8:43 cemerick: leafw: there's a lot in the language that isn't documented on the site

8:44 I secretly think rhickey is betting that Stuart will take care of all of the documentation for him ;-)

8:44 rhickey: :)

8:45 Chousuke: that's not very secret thinking.

8:46 gnuvince: hahaha

8:47 Can you just imagine poor Stuart

8:47 "Damnit, stop changing the language so fast!"

8:47 cemerick: Chouser: damn, did I type that out loud?!? :-P

8:47 rhickey: generally the site catches up at release time, but I have gotten behind on some of the prose sections, like for a la carte hierarchy and the require/use system

8:47 cemerick: "Shoot, there's another chapter I'll have to rewrite"

8:48 A friend of mine is a coauthor on a recently-released Django book, and they went through absolute fits keeping up with things there in the final days. I think that's just how it is if you're trying to be the early mover in the book biz.

8:49 rhickey: except for very recently, as part of a determined 'bunch some breaking changes together', there's not that much change of existing things, just new things, for instance the site doesn't get a lot of changes but isn't wrong, just doesn't include everything

8:50 gnuvince: cemerick: I can imagine. Adrian and Jacob released a book on Django for Apress during the 0.96-0.97pre days

8:50 So many things changed, I'm hoping they're onto a re-edit.

8:50 duck1123: can you imagine how mad Stuart would be had this happened after the book went to print

8:50 gnuvince: Yeah

8:51 That would've been worse

8:51 A book that people can't just copy code from?

8:51 Ouch

8:51 duck1123: pdfs are easy to fix, paper not so much

8:51 cemerick: rhickey: short of eliminating genclass, is there anything else coming down before "1.0"?

8:52 leafw: gnuvince: we should starting writing books like software (under version control), instead of software like books .... read a blog once about it--was neat idea

8:52 rhickey: cemerick: as far as breaking changes, no. They were: new regex format, uniform vector binding lists, move files for AOT, genclass into AOT

8:53 gnuvince: leafw: I don't disagree, but a lot of people enjoy reading paper.

8:57 leafw: someone has to invent the paper book that is updatable.

8:58 * rhickey wants an 8x10 Kindle

9:00 leafw: I have an iLiad, and it's pretty neat -- can write on top of PDFs. But it's a bit too slow to operate.

9:33 Craig: I just updated to the latest SVN, and slime breaks for me. It appears to be a problem with add-classpath: calling it seems not to affect the classpath. I'm inferring this because (.getProperty System "java.class.path") doesn't change after I call add-classpath.

9:33 drewr: Craig: Back up a few revs.

9:34 Craig: Is this a known problem in HEAD?

9:34 rhickey: Craig: the system classpath is never changed by add-classpath

9:34 Craig: Ah.

9:35 rhickey: add-classpath is really just for repl emergencies, want to try a new lib without restarting etc. Once you know you need a lib, out it in your real classpath

9:35 Craig: Well, the error I get is pretty consistent with classpath not being updated. (require 'swank) fails with a java.io.FileNotFoundException: Could not locate swank.class or swank.clj on classpath: (NO_SOURCE_FILE:0)

9:35 rhickey: put it

9:36 Craig: (Not arguing that it doesn't work as you say - just trying to figure it out.)

9:36 rhickey: If swank hasn't been updated, then its files are in nested directories and need to be moved

9:36 Craig: Ah, right.

9:38 Chouser: rhickey: FYI, gen-interface doesn't work exactly the same compiled as it does dyn-loaded. It appears to have something to do with Class/forName, but I haven't pinned it down exactly yet.

9:38 I'll let you know when I've got a simple test that reproduces.

9:39 rhickey: Chouser: ok

9:47 Craig: OK, the classpath is sorted, but now (require 'swank) is blowing up with "No such namespace: clojure". This is coming from swank.clj, this line: (clojure/ns swank ...)

9:50 rhickey: Craig: there's no such namespace clojure - now clojure.core

9:51 Craig: Heh, you *would* send that two seconds after I read that in the SVN log. :)

9:51 Thanks!

9:51 rhickey: but I think you don't need the qualifier at all for ns

9:52 Craig: Yeah, my fix was to remove it - I'm on to the next error now.

9:54 So, last dumb question (for a few more minutes, at any rate): now all .clj files have to be on classpath to get loaded? Directory is no longer inferred from namespace?

9:55 rhickey: Those are two separate questions - directory is inferred from namespace, but the relationship is: my.fancy.lib ==> my/fancy/lib.clj, somewhere in classpath

9:55 Craig: Or, looking at the source, perhaps just the last element of the namespace implies a file now, rather than a directory.

9:55 Got it.

9:55 rhickey: you can still load .cljs not in classpath with load-file, by why?

9:56 Craig: Thanks - I can see now how swank-clojure needs to be fixed. Appreciate the education.

9:56 rhickey: np

10:22 shoover: anyone try AOT on IKVM.NET yet? looks like it's reading the .class files, but no difference in startup time

10:23 rhickey: shoover: startup time there could be dominated by translation to IL

10:23 but with class files you could precompile with ikvmc, no?

10:24 shoover: must be. I was hoping that previously it was a combination of ASM bytecode generation + IL translation, and this would be a magic win

10:24 I know ikvmc precompiles jars. I'll check on .class files

10:47 cemerick: rhickey: it would be handy if keyword and symbol could take and return keywords and names as well as strings. I've found myself doing a lot of (if (string? foo) (keyword foo) foo) lately.

10:47 s/names/symbols

10:49 rhickey: cemerick: keyword, when passed as symbol, would do what?

10:49 passed a symbol

10:50 cemerick: rhickey: I should have added a "respectfully" in there. Anyway: (keyword :foo) => :foo, (keyword "foo") => :foo, (symbol 'foo) => 'foo, (symbol "foo") => 'foo

10:50 keyword shouldn't take symbols, symbol shouldn't take keywords

10:50 rhickey: or do you just mean (keyword :akeyword) == identity

10:51 cemerick: yes, exactly

10:51 rhickey: ok

10:51 cemerick: whew, I guess I took the long way 'round the barn there. :-)

10:51 rhickey: I've needed that too

10:51 cemerick: rhickey: FYI, I bring it up because I want Java calls into fns to be able to pass strings, but let all of the backend clojure code work in keywords, etc.

10:56 rhickey: cemerick: that's up - rev 1097

10:56 cemerick: rhickey: thanks

10:59 rhickey: Some people have asked how to donate to Clojure, so I've turned donations on in SF: https://sourceforge.net/project/project_donations.php?group_id=137961 - thanks to all for your support!

11:00 Craig: So what exactly is your day job? Not that it matters: I plan to contribute anyway.

11:00 rhickey: Craig: I do consulting and Clojure

11:01 work for myself

11:01 Craig: Nerdvana. :) I'm halfway there myself.

11:22 cemerick: rhickey: I'm calling into clojure fns quite a bit, and needing to wrap a lot of calls to avoid declaring a checked Exception on those caller methods. What's the motivation for adding the checked exception on .invoke() signatures?

11:23 drewr: SLIME support updated to work with r1097.

11:23 http://github.com/drewr/swank-clojure/tree/master

11:39 triddell: drewr: Is there a master repository for swank-clojure? When I wrote the tutorial at http://riddell.us/clojure I pulled from http://github/jochu/swank-clojure.git

11:40 but I now want to update to support the newest revision of clojure

11:40 drewr: triddell: That's the author's repository. I made the changes in my own "forked" repo.

11:40 You could add mine as a remote if you wanted to, then pull the changes from there.

11:40 Or, you could wait for jochu to merge my or his own changes.

11:41 triddell: drewr: ok, thanks... did you require any .emacs changes to get your new version to work?

11:42 drewr: No.

11:43 triddell: ok, cool

11:43 rhickey: cemerick: fns end up calling varied things. without the Exception decl I would have to wrap all checked exceptions

11:44 I hate checked exceptions

11:45 cemerick: rhickey: Sure -- but that only applies if you're implementing IFn in Java, which I assume is an edge case compared to calling into clojure fns from Java.

11:45 drewr: rhickey: That was one of the things that drove me from Java screaming.

11:45 * cemerick might be totally wrong about that

11:45 Chousuke: drewr: slime seems to work. thanks for the fix.

11:46 rhickey: cemerick: Clojure fns call Java all the time, e.g. user fns calling java.io etc

11:47 drewr: Chousuke: You're welcome!

11:47 rhickey: have already gotten complaints the few places I am wrapping, because consumers can't catch typed exceptions

11:49 cemerick: I think I'm only whining because I'm writing in Java this morning. :-)

11:49 rhickey: It is truly painful - number one complaint I have about Java

11:49 a terrible misfeature

11:50 drewr: If they wanted to, would it be possible to fix that in the JVM?

11:50 Chouser: are not all exceptions checked?

11:51 rhickey: It's just a compiler thing, they could turn into warnings tomorrow

11:51 cemerick: rhickey: the pain would be mitigated when calling into clojure if Var had a series of parallel .invoke methods that wrapped any thrown exceptions in an IllegalStateException, or whatever

11:51 .invokeQuietly or something ;-)

11:51 rhickey: Chouser: no, certain branches of the exception hierarchy are not checked

11:52 cemerick: interesting

11:52 I'm reluctant to add more methods not knowing the impact of vtable size, if any, on perf

11:53 cemerick: I can't imagine that that's an issue anymore, especially on 1.6+

11:53 rhickey: cemerick: you could make a static invoker/call method that did that

11:55 cemerick: You mean a class with series of .invoke(IFn/Var, arg1, arg2 ..., argN) methods?

11:56 rhickey: cemerick: right

11:56 cemerick: yeah, maybe. We'll see what my mood is like the next time I need to write a Java wrapper for some clojure fns.

11:56 :-)

11:56 rhickey: Fns.call(f,a1,a2)

12:23 unfo: bradbev: when you have time, could you please come on over to #emacs for a vimpulse-related question?

12:23 bradbev: unfo: sure

12:27 shoover: rhickey: good call on ikvmc class compilation. I had to hack RT.load, but running everything through ikvmc took startup down to 3 seconds from 6 on my machine

12:28 still can't touch the jvm's .7 secs though

12:33 kotarak: shoover: hi, is the hg mirror still updated?

12:38 larrytheliquid: any help with test syntax recommendations would be appreciated: http://paste.lisp.org/display/70313

13:08 AWizzArd: Moin

13:44 rhickey: AOT changes spelled out: http://groups.google.com/group/clojure/msg/58e3f8e5dfb876c9

13:48 blackdog: thanks rhickey awesome stuff

13:48 rhickey: you're welcome

13:51 Chouser: rhickey: do you expect to fold gen-interface into AOT as well?

13:52 rhickey: Chouser: could do, although I'd really like to keep any such interface-generating file free of other stuff.

13:53 Chouser: ok, just curious. I still haven't had a need to use gen-interface.

14:04 sohail: hey, AOT is official

14:04 nicely done rhickey

14:04 rhickey: well, AOT is officially ready-to-try

14:04 shoover: kotarak: I lost my web host so the hg mirror is not automatically updated anymore. I will have it sync at least daily soon

14:06 gnuvince: http://www.reddit.com/r/programming/comments/7d6vs/rich_hickey_adds_aot_compilation_to_clojure/

14:15 AWizzArd: aot makes Clojure now much more attractive for commercial development, great

14:17 sohail: just catching up on the list... howcome tests are a contrib

14:17 interesting way to do it

14:17 Chouser: because that way we can write tests while Rich writes AOT

14:18 sohail: Chouser, the other day I was looking for tests to see how something worked and I couldn't find them!

14:20 so long as they are written, that's actually a pretty damn good way to do it

14:20 Chouser: well, there aren't very many yet. Send Rich your CA and you can help out!

14:21 sohail: not a bad idea, I'd feel like less of a leech

14:27 AWizzArd: In the sources I find several times (when (seq obj) ..), or (if (seq obj) ..). First I thought this was wrong even though it would work, and that really seq? was meant. But could it not make sense to have a function for saying (and (coll? obj) (not (empty? obj))) ?

14:28 gnuvince: AWizzArd: seq applied to an empty sequence returns nil.

14:28 drewr: rhickey: What's the consequence of namespaces only having one segment now?

14:28 It seems to still work.

14:29 AWizzArd: gnuvince: exactly... and (and (coll? x) (not (empty? x))) also returns nil if x is an empty collection

14:29 rhickey: drewr: don't do that, it will leave you with a class in no package

14:29 tomhickey: H4ns & rhickey: clojure.org now has a print stylesheet, let me know if you need any changes

14:29 rhickey: tomhickey: thanks!

14:29 AWizzArd: tomhickey: very cool, thanks

14:29 tomhickey: np

14:30 drewr: rhickey: Ah, I see.

14:30 rhickey: drewr: that's why I had to move clojure ns down into clojure.core

14:31 drewr: Yeah, I realized that. I was just wondering why some stuff I had still worked without a package.

14:31 wwmorgan: AWizzard; it may be instructive to look up the definition of empty?

14:31 rhickey: wwmorgan: :)

14:32 AWizzArd: (seq x) is idiomatic Clojure

14:32 AWizzArd: okay good, when it is defined this way it makes sense

14:32 rhickey: also just (when x ...) when you know x is a seq

14:33 AWizzArd: yes, that also feels natural/good for me to do

14:33 H4ns: tomhickey: hammer!

14:34 AWizzArd: rhickey: what about doing (when x ..) for using the implicit return value nil? I also do that in CL, even though some people prefer (if (null x) nil (else ..))

14:37 rhickey: AWizzArd: yes, please, when's implicit nil is a fine thing.

14:42 AWizzArd: Can dissociating elements from a map be done in near constant time?

14:43 rhickey: AWizzArd: from a hash map, yes, same as assoc

15:16 tomhickey: clojure.org now has code highlighting (via js). please let me know if you see any issues

15:18 AWizzArd: *click*

15:18 yeah, looks very nice

15:19 It's good and important that Clojure has this nice Web 2.0 look.

15:19 rhickey: tomhickey: looks great - thanks again!

15:24 I wonder what it would take to get Clojure highlighting on paste.lisp.org?

15:25 drewr: I'm sure chandler wouldn't be opposed to it.

15:25 What's doing the parsing?

15:26 rhickey: maybe js regex, tomhickey ?

15:27 tomhickey: yes, clojure.org is doing it with regex using Dan Webb's codehighlighter script, http://svn.danwebb.net/external/CodeHighlighter/

15:31 paste.lisp.org seems to markup the code on the server side

15:35 drewr: That's what I was thinking. I tried to download the source, but common-lisp.net is broken right now.

15:36 Er, the FTP part of it is.

15:37 H4ns: drewr: did you open a ticket for that? can you? please include information on where you found the ftp path that has become inaccessible.

15:38 drewr: H4ns: I didn't know I could open a ticket.

15:39 H4ns: drewr: just send a quick email to rt@common-lisp.net - that will help us tremendously! thanks!

15:43 drewr: H4ns: Done.

15:44 H4ns: drewr: *bow*

15:46 drewr: It was nothing, really.

15:49 Chousuke: hm, found an error on the site. on the "other libraries" page there's a piece of code like this: (pvec (par f :filter-index <; :map-index vector))

15:50 commenting out half of the expression probably is not intended :)

15:52 tomhickey: Chousuke: thanks, i'll look into that

15:53 Chousuke: syntax highlighting really helps in spotting errors like that

15:56 tomhickey: Chousuke: fixed. thanks for the report

15:56 Chousuke: you're welcome

16:21 sohail: tomhickey related to richhickey?

16:21 drewr: sohail: Brothers.

16:22 sohail: nice

16:24 gnuvince: Who's the older one?

16:24 duck1123: I was wondering that myself

16:29 tomhickey: rich is the older one

16:30 sohail: must be nice to have a brother with the same interests

16:30 tomhickey: so i've got like 14 years before i make my own language! ;)

16:31 sohail: clojure: the 14 year language

16:32 AWizzArd: I guess Clojure will be one of the last Lisps before computers will understand human language and will do the programming for us

16:32 H4ns: "right"

16:32 Hun: there's always another lisp.

16:32 duck1123: isn't that what they said about the first lisp?

16:33 Hun: i think you can prove that by induction if you tried really hard

16:33 Chousuke: lisp is funny

16:34 you can have thousands of dialects, but at its core, it's still "just" lisp

16:34 Hun: the syntax doesn't resemble the original one a bit... just the data structures. i still think it's hard to define what `makes' a lisp

16:35 Chousuke: You could write an XML-based lisp. it just wouldn't be very lispy.

16:35 AWizzArd: Hun: I think Paul Graham gave a nice summary: http://www.paulgraham.com/diff.html

16:36 Hun: i know that one. i just don't know how much i agree with it :)

16:36 cemerick: Chousuke: http://www.agentsheets.com/lisp/XMLisp/

16:36 Chousuke: cemerick: yeah, I should've known it has already been done

16:36 * Chousuke shudders

16:36 sohail: Chouser, I think jelly is the xml based lisp

16:36 it has proper macros I think

16:37 Hun: i don't think you really need functions to do a lisp. you can bootstrap those with just eval and cons. but you can bootstrap anything with 0 and 1 also... so i'm not sure there ;)

16:38 AWizzArd: I interpreted Graham in this regard more like: he wants to give us something like (lambda ()) or (fn []), as a 1st class datatype that you can pass around

16:38 and create on-the-fly

16:39 Hun: with which semantics? most lambdas i know are lexical

16:39 the ones in emacs work completely different, though i think i'd still call it a lisp

17:02 cemerick: is there an incantation to override :private and access such a marked var?

17:03 kotarak: (ns-resolve 'foo.bar 'private-var), although private there for a reason

17:04 gnuvince_: Wow

17:04 Clojure builds in 11 seconds

17:04 that's impressive

17:18 sohail: gnuvince, it is amortized over the runtime of your program ;-)

17:18 * sohail runs

17:19 gnuvince_: heh

17:19 I compiled GHC from scratch once. That took *way* longer than 11 seconds ;)

17:24 sohail: like I said, amortized

17:24 :-)

18:04 hiredman: is there a clojure http client that does ssl and doasn't use gen-and-load-class?

18:05 cemerick: there's lots of java http clients, FWIW

18:05 hiredman: yeah, well

18:06 cemerick: getting http right is not an easy thing. Is there a clojure impl floating around at all?

18:06 hiredman: after spending some time with the jakarta httpclient and trying to futz with java.net.URLConnection I am ready to try and put my laptop through a brick wall

18:06 there is one in the clojure files stuff that I know of

18:08 but it uses gen-and-load class for some ssl "stuff"

18:10 cemerick: wwmorgan: what's the http library you ended up liking?

18:11 wwmorgan: jakarta httpclient

18:11 didn't have any problems with SSL IIRC

18:11 cemerick: yeah, that's what I thought. hiredman, I'd say stick it out with jakarta. (reliable) http clients are weekender projects.

18:12 hiredman: I guess I will

18:12 cemerick: s/are/aren't :-P

18:19 H4ns: hiredman: there is a clojure wrapper around some common http client in http://groups.google.com/group/clojure/files

18:19 hiredman: (http-client/url-do "http://planet.lisp.org/&quot; "GET" [])

18:20 hiredman: it is not particularily pretty, but worked for me right out of the box.

18:24 hiredman: H4ns: that part did work for me out of the box, but https does not, and however the author got https working he used some gen-and-load-class stuff, which I would rather avoid

18:25 H4ns: hiredman: ah, ok, understood.

18:26 hiredman: did you look at xlightweb already? that is what i use, but i did not try https with it

18:27 hiredman: I have not

18:27 H4ns: http://vaxbusters.org/http-client.clj is what i currently use in my planet lisp poller

18:29 hiredman: I think almost anything would be less painful then trying to figure out how many arrays jakarta nests the two different kinds of header objects

18:32 I'll take a close look at xlightweb, thanks

18:33 wow

18:35 H4ns: hiredman: works?

18:44 hiredman: H4ns: still kicking the tire, but looks good

18:46 H4ns: ok. good luck!

18:51 Drakeson: Have you seen this error on emacs+slime+OSX: java.lang.Exception: No such namespace: clojure (NO_SOURCE_FILE:1)

18:52 Chousuke: you either need a fixed slime or an older revision of clojure

18:55 Drakeson: There were some breaking changes in the newer versions. A fixed clojure-swank is here: http://github.com/drewr/swank-clojure/tree/master (not the "official" clojure-swank; I don't know if it has these changes yet)

18:55 Drakeson: Chousuke: thanks. I was suspecting my settings.

18:56 drewr: Chousuke: jochu has merged my changes, so you guys can pull from the official repo.

18:56 Chousuke: ah, excellent.

19:00 Drakeson: great, thanks :)

20:03 jtoy: can you mix and match languages on the jvm like clojure and jruby together?

20:04 arohner: is there any way to make System.err show up in the slime buffer rather than only in *inferior-lisp*?

20:04 jtoy: I haven't used jruby, but if their calling conventions are as nice as clojure's ( :-) ), it should be easy

20:05 jtoy: but i mean in general, can you mix jvm languages? like there is also groovy and scala,etc

20:05 arohner: you should be able to. it's all just .class files

20:06 that being said, I haven't tried it

20:08 rhickey: jtoy: you should be able to call from language to language through the interfaces they present to Java, as each can call Java

20:08 there has been some work on a multi-language MOP

20:09 jtoy: rhickey: nice, didn't know you hung out here, is it worth to get the pragmattic book? I dont program java at all, but I plan to start playing with clojure

20:10 rhickey: jtoy: yes, the pragmatic book looks good so far

20:40 gnuvince_: Does a multi-method's dispatching function need to have the same arity as the defmethods will have?

20:41 rhickey: gnuvince: it gets pased all args, but you can just & rest away the ones you don't care about

20:42 gnuvince_: rhickey: okay

20:42 thank you.

20:43 rhickey: sure

21:12 Chouser: can whole classes be garbage collected?

21:13 rhickey: Chouser: that depends, it is something they are working on, but basically they are kept alive by their classloaders

21:13 Chouser: hm.

21:14 (Class/forName (.getName (class (fn [] 99))))

21:14 rhickey: that's one reason why langs use their own tear-off loaders for dynamic class creation

21:14 Chouser: That works, but if I store the name in a var and do forName later, it fails.

21:16 rhickey: Chouser: what are you trying to do?

21:16 Chouser: heh. good question!

21:16 rhickey: the concrete class of an anonymous fn is, well, anonymous

21:17 Chouser: I'm trying to track down my gen-interface problem. I'd like to find some way besides gen-interface to dynamically load a class.

21:18 rhickey: chances are entire expression above is compiled under a tear-off loader, class can only be found by name under that loader

21:18 Chouser: it's anonymous but my snippet above does return a class.

21:18 ah. ok.

21:18 rhickey: as I said, tear-of loaders are used so classes like this can be reclaimed

21:18 Chouser: ok

21:39 I just can't seem to reproduce this error twice in a row.

21:41 rhickey: Chouser: what happens?

21:47 Chouser: hm, paste's not working

21:48 http://n01se.net/paste/Q2i -- gen-interface compile issue

21:49 I've gotten this to happen a couple times, but even if I delete all generated .class files, I can't get it to happen the same way twice.

22:53 arohner`: does clojure have zip?

22:53 Chouser: it has a lib called zip, but I doubt that's what you want

22:53 rhickey: http://www.sauria.com/blog/2008/11/13/olio-a-web-20-benchmark/

22:54 arohner`: i.e. (zip '(1 2 3) '(4 5 6)) => ((1 4) (2 5) (3 6))

22:54 Chouser: (map list '(1 2 3) '(4 5 6))

22:56 arohner`: interesting.

22:56 thanks

23:03 bradbev: Hmm, refs & lazy mapping have interesting effects

23:04 Chouser: oh?

23:04 bradbev: Hmm, lisppaste is broken

23:04 Chouser: yeah

23:05 arohner`: Chouser: another solution to my earlier question: interleave

23:05 bradbev: but basically map over a list of refs doing deref, then change the ref value & then look at the lazy seq

23:05 arohner`: sort of

23:05 bradbev: (def refs (into [] (map #(ref %) (range 10))))

23:05 (println (map deref refs))

23:05 (def dref (map deref refs))

23:05 (doseq r refs

23:05 (dosync

23:05 (ref-set r (* 2 @r))))

23:05 (println dref)

23:06 the lazy seq shows the changed refs - but that is a little confusing really

23:07 It makes sense when you consider how lazy map works, but it is not really what you'd expect in general if it weren't lazy

23:09 Chouser: ah, I see. yep.

23:10 bradbev: so if you ever map over a seq containing refs, you need to make it a concrete instance, or get burned

23:16 Chouser: right. Probably better to keep them in a vector.

23:18 bradbev: yep. But it is a wee bit of a gotcha.

23:19 Chouser: have to be careful with any kind of side-effect mixed with lazy seqs

23:21 bradbev: indeed. lazy only works with immutable data. On the upside, this is the first real gotcha I've found with Clojure

23:22 Chouser: Another good one is laze seqs over a resource that goes away.

23:23 bradbev: eek, that would be very bad.

23:23 I'm not entirely sure that I'm sold on lazy seqs

23:23 or at least map returning a lazy seq

23:24 Chouser: oh, I'm completely sold. But they are what they are -- you can't pretend they're not lazy.

23:24 ...and I think there's a solution in the works for the resource issue.

23:24 bradbev: I'm still coming to grips with it I think

23:25 but I'm learning that you can't treat lazy seqs as a transparent abstraction

23:27 Chouser: well, you can't treat them as non-lazy

23:27 if someone hands you a seq, you can treat it as a seq without knowing what it really is underneath

23:30 bradbev: yes. I guess though I need to know which functions return lazy seqs (or which seqs are mutable), and ensure I instance those seqs during the transaction I'm in

23:32 Chouser: I guess I've never done much witha seq of mutables. Does sound a bit squirrley.

23:33 bradbev: I haven't either really, but in the process of learning about lazy seqs it occurred to me this could happen

23:45 jphr: hey folks, just starting to learn clojure, wondering if there is an equivalent from CL's atom predicate?

23:47 Chouser: jphr: not quite. There's coll? which you could negate

23:47 jphr: that would probably work

Logging service provided by n01se.net