#clojure logs

2008-11-13

00:30drewclarrytheliquid: progv
00:30drewclarrytheliquid: ph .. wait .. no
00:36drewcand .. actually .. progv is nothing of the sort@
00:36drewcs/@/!
00:59arohnerhow do I convert a clojure string to java.lang.CharSequence[]?
00:59arohnerI tried (seq "my string")
01:00hiredmanmaybe into-array
01:00hiredmanhmmm
01:00hiredmanor not
01:01hiredmaninto-array will make a char array out of a seq of chars
01:01arohneryeah
01:02hiredmanuh
01:02hiredmanCharSequence is an interface
01:02hiredmanwhich String implements
01:03hiredmanso you should just be able to pass a clojure string in
01:03hiredmanbecause clojure strings are java strings
01:03arohnerI get "java.lang.ClassCastException: java.lang.String"
01:04arohnerthe signature on the function is 'java.lang.CharSequence...'
01:04arohnerwhich I think means array, but (into-array "my string") should have returned an array of strings of length 1
01:05hiredman(into-array (cast java.lang.CharSequence "my string"))
01:06arohnerjava.lang.ClassCastException: [Ljava.lang.Character;
01:07arohnerI wish I understood exactly what the ellipsis means in javadocs
01:07hiredmanwell, I am stumped
01:07arohnerit seems to mean array, but I haven't seen that explicitly
01:07hiredmanuh
01:07hiredman[] means array
01:08arohner'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. '
01:09hiredmantry the cast without the into-array
01:10arohnersame.
01:13arohnergot it
01:13arohner(into-array) takes a sequence
01:14hiredmanah
01:14arohnera string by itself is already a seq of chars, so (into-array "my string") returns char[]
01:14arohnerto get an array of strings, (into-array ["my string"])
01:14arohnerand I think I already ran into this problem and figured it out once
01:15arohnermaybe that's a sign I shouldn't be programming late.
01:15arohnerwell, thanks for the help.
02:41Lau_of_DKGood morning all
02:44danlarkinyou and your gmt+1
02:50Chousukeheh
02:50Chousukemorning
03:02_Jordan_(functional programming noob question): Can anyone help me convert my current recursive solution to one that is able to use loop/recur?
03:03danlarkin_Jordan_: most likely you can just change the call to (my-function ...) to (recur ...)
03:03danlarkinif it's a tail-call
03:04_Jordan_I tried, but apparently it's not tail-call, because it barfed... I still suck at knowing what I'm doing
03:05_Jordan_but I would be delighted if you could show me how to make it tail-call :)
03:05yangsx1_Jordan_: then paste your code on http://paste.lisp.org etc
03:07_Jordan_http://paste.lisp.org/display/70288
03:09jdz_Jordan_: look at the various Lisp implementations of factorial; there are both straight recursive and tail-recursive versions.
03:12yangsx1_Jordan_: you need an accumulator to hold the result and return it when the stop condition is satisfied
03:14hiredmanyou could also turn it into a lazy-seq
03:14hiredmanjust to throw that out there
03:18_Jordan_Got it! Thank you everyone!
04:04Lau_of_DKIs anyone here in possession of some type of comparison between Jetty and Apache. Im interesting in how scalable Jetty is
04:31tWipLau_of_DK: do you mean apache httpd? or apache tomcat or something else
04:32Lau_of_DKhttpd
04:34tWipthat's a bit of apples vs oranges comparison as they don't have the same features
04:35Lau_of_DKIts 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
04:35Lau_of_DKI'd hate to begin on a project, only to have to abandon it in the first day of deployment
04:35Lau_of_DK@ tWip
04:36tWipwell if you are coding in Clojure I don't think you can avoid having a servlet engine
04:37Lau_of_DKBut thats the not really the issue :)
04:38tWipOnly way to be sure is to do load benchmarking
04:39tWipbut I would wager that the plain HTTP serving is not going to be the bottleneck in non trivial applications
04:39tWipand you can always use apache/yaws/something else for the static content
04:42Lau_of_DKYou mean actually run 2 servers, 1 for servlets 1 for static ?
04:43amageei'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)
04:43amageeam i doing something really silly?
04:43jdzwhat about (. (new Timer) (schedule))?
04:43tWipLau_of_DK: well I usually deploy by running apache on 80, then servlet engine in the non-privileged 8080 port
04:44tWipLau_of_DK: apache does rewrite proxying to the servlet engine
04:44jdzamagee: or even (.schedule (new Timer))
04:44Lau_of_DKtWip, thats sounds like the way to go. Have you got a get-me-started guide somewhere?
04:44amageejdz: both of those give the same error
04:44Lau_of_DKamagee, make an agent and (Thread/sleep x) it for your intervals?
04:45tWipLau_of_DK: no, not really... just the accumulated knowledge over the years which I haven't documented anywhere
04:45jdzamagee: i don't see any method in Timer class that has no arguments
04:45jdzamagee: i mean, the schedule metod
04:46tWipbut I think the apache+mod_rewrite is a common for frontend for many app servers and tutorials should be available on the net
04:46amageejdz: oh, i can get that error if the method name is right but the argument list is wrong?
04:47jdzamagee: 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)
04:47jdzamagee: hence, no matching member
04:48amageeah yeah that makes sense
04:48Lau_of_DKamagee: (def a (agent 0)) (defn work [] (println "Running") (Thread/sleep 1000) (send-off a work)
04:48Lau_of_DKmissing a few )) maybe :)
04:49amageeah cool
04:49amageethanks to both of you :)
04:50amageeLau_of_DK: is that code supposed to loop indefinitely?
04:50Lau_of_DKit'll run forever :)
04:51Lau_of_DK(def keep-running (ref true)) (defn work [] (when @keep-running (do work))
04:51amageehmm when i run it from repl it just prints "Running" once then stops
04:51Lau_of_DKthen (dosync (ref-set keep-running false)) to abort
04:51Lau_of_DKThats probably because println doesnt flush by itself, so (println ..) (flush) might do the trick
04:51jdzLau_of_DK: i'd consider your proposed solution ugly
04:52Lau_of_DKjdz, oh, how would you go about it ?
04:53jdzLau_of_DK: i think there is nothing wrong using Timer.schedule. And what's more, your solution will drift off the correct intervals.
04:53jdz*off of
04:53jdzthat might not be important, though
04:54amageeTimer.schedule knows to keep to the correct intervals?
04:54jdzamagee: what else does the 'period' parameter mean/
04:54jdz?
04:55amageeoh i just didn't know how clever it was
04:55jdzamagee: what kind of documentation are you reading?
04:55amageei thought it'd be implemented like how Lau_of_DK did it
04:55jdzi just went to java.sun.com and read there
04:56jdzamagee: look at scheduleAtFixedRate method
04:56Lau_of_DKWell, amagee you can use my example for a reference on agents, but like jdz said, Timer/schedule might be more what you want
04:56jdzamagee: it's all stated right there, in the documentation.
04:56amageeah cool yes that's very nice :)
04:57amageei didn't know that
04:57amageeso i will use that
04:57jdzamagee: i did not, too, until you mentioned that class. but i bothered to read the documentation.
04:57jdzamagee: and i suggest you do the same
04:57amageehowever i still haven't got your agent example working yet
04:57amagee(defn work[] (println "Running") (flush) (Thread/sleep 1000) (send-off a work))
04:58amagee(work)
04:58amageejust prints "Running" once then goes back to prompt
04:58amagee(i'm just doing this out of interest now)
05:09Lau_of_DK(def a (agent 0))
05:09Lau_of_DK(defn work
05:09Lau_of_DK[]
05:09Lau_of_DK(println "agent running")
05:09Lau_of_DK(Thread/sleep 1000))
05:09jdzhow about using lisppaste?
05:09Lau_of_DKin repl
05:09Lau_of_DK(send-off a work)
05:11amageenow i get no output
05:12Lau_of_DKjust as test, not application for the real world, can you try this
05:12Lau_of_DK(import '(javax.swing JOptionPane))
05:13dnmIs anyone else trying to use JUnit with Clojure, or am I it?
05:14Lau_of_DKand then instead of println use (JOptionpane/showMessageDialog "Test")
05:14Lau_of_DKmy showMessageDialog doesnt follow documentation, so try showInputDialog "test"
05:15Lau_of_DKI retract that, use (JOptionPane/showMessageDialog nil "Test")
05:16amagee(defn work [] (JOptionPane/showMessageDialog nil "Test") (Thread/sleep 1000))
05:17amageeand then, (send-off a work) .. ?
05:17Lau_of_DKafter (def a (agent 0))
05:17Lau_of_DKyea
05:17amageedoes nothing
05:19Lau_of_DKhehe
05:20Lau_of_DKI might have forgot a little something
05:21Lau_of_DKEach loop should end with (send-off *agent* self) where self in this case is 'work'
05:21Lau_of_DKBut mine isnt running either, and Im not sure why
05:22amageehmm ok :)
05:22amageewell, still no luck with my other avenue either :(
05:22amageetrying (. (new Timer) scheduleAtFixedRate (proxy [TimerTask] [] (run [] (print "hello"))) 0 1000)
05:22amageeNo matching method found: scheduleAtFixedRate for class java.util.Timer
05:22amageebut this time the arguments are right (i hope)
05:23Lau_of_DKhehe
05:23Lau_of_DKI think I got it
05:24roblallydnm - I've been looking at JUnit and Clojure a little.
05:24Lau_of_DKuser> (def a (agent 0))
05:24Lau_of_DK#=(var user/a)
05:24Lau_of_DKuser> (def b (ref 0))
05:24Lau_of_DK#=(var user/b)
05:24Lau_of_DKuser> (defn work [a] (dosync (commute b inc)) (Thread/sleep 100) (send-off *agent* work))
05:24Lau_of_DK#=(var user/work)
05:24Lau_of_DKuser> (send-off a work)
05:24Lau_of_DK#<clojure.lang.Agent@8edb84>
05:24Lau_of_DKuser> @b
05:24Lau_of_DK33
05:24Lau_of_DKwork must of course take a paramter, which is the agent being dispatched
05:25amageeok
05:26amageecool
05:27amageedo you have any ideas about my Timer problem?
05:27Lau_of_DKI havent looked into it at all, but catch up with me tonight and I'll have time to dive into it if you want
05:27amageemm well it is tonight over here :)
05:27Lau_of_DKoh :)
05:28Lau_of_DKIm thinking approx 8 hours from now, mayb 9� :)(
05:28hoeckamagee: try (long 0) and (long 1000)
05:28Lau_of_DKCan you post a link to the relevant Javadoc ?
05:28amageehoeck: bingo, that did it :)
05:29Lau_of_DKhoeck, a man of a few well chosen words
05:29amageehehe
05:29amageethanks :)
05:29hoecknp :)
08:11mehrheitshould integer? return false for Shorts and Bytes?
08:13rhickeymehrheit: probably not
08:17rhickeymehrheit: fixed (svn 1096)
08:21mehrheitwell that's fast.
08:33leafwso AOT compiler support is in. Thanks Rick.
08:36rhickeyleafw: you're welcome. just have to wait for contrib and other tools (slime/swank) to sync up
08:38leafwthe webpage still has no docs on AOT specifically (empty search result)
08:43cemerickleafw: there's a lot in the language that isn't documented on the site
08:44cemerickI secretly think rhickey is betting that Stuart will take care of all of the documentation for him ;-)
08:44rhickey:)
08:45Chousukethat's not very secret thinking.
08:46gnuvincehahaha
08:47gnuvinceCan you just imagine poor Stuart
08:47gnuvince"Damnit, stop changing the language so fast!"
08:47cemerickChouser: damn, did I type that out loud?!? :-P
08:47rhickeygenerally 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
08:47cemerick"Shoot, there's another chapter I'll have to rewrite"
08:48cemerickA 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.
08:49rhickeyexcept 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
08:50gnuvincecemerick: I can imagine. Adrian and Jacob released a book on Django for Apress during the 0.96-0.97pre days
08:50gnuvinceSo many things changed, I'm hoping they're onto a re-edit.
08:50duck1123can you imagine how mad Stuart would be had this happened after the book went to print
08:50gnuvinceYeah
08:51gnuvinceThat would've been worse
08:51gnuvinceA book that people can't just copy code from?
08:51gnuvinceOuch
08:51duck1123pdfs are easy to fix, paper not so much
08:51cemerickrhickey: short of eliminating genclass, is there anything else coming down before "1.0"?
08:52leafwgnuvince: we should starting writing books like software (under version control), instead of software like books .... read a blog once about it--was neat idea
08:52rhickeycemerick: as far as breaking changes, no. They were: new regex format, uniform vector binding lists, move files for AOT, genclass into AOT
08:53gnuvinceleafw: I don't disagree, but a lot of people enjoy reading paper.
08:57leafwsomeone has to invent the paper book that is updatable.
09:00leafwI have an iLiad, and it's pretty neat -- can write on top of PDFs. But it's a bit too slow to operate.
09:33CraigI 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.
09:33drewrCraig: Back up a few revs.
09:34CraigIs this a known problem in HEAD?
09:34rhickeyCraig: the system classpath is never changed by add-classpath
09:34CraigAh.
09:35rhickeyadd-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
09:35CraigWell, 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)
09:35rhickeyput it
09:36Craig(Not arguing that it doesn't work as you say - just trying to figure it out.)
09:36rhickeyIf swank hasn't been updated, then its files are in nested directories and need to be moved
09:36CraigAh, right.
09:38Chouserrhickey: 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.
09:38ChouserI'll let you know when I've got a simple test that reproduces.
09:39rhickeyChouser: ok
09:47CraigOK, 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 ...)
09:50rhickeyCraig: there's no such namespace clojure - now clojure.core
09:51CraigHeh, you *would* send that two seconds after I read that in the SVN log. :)
09:51CraigThanks!
09:51rhickeybut I think you don't need the qualifier at all for ns
09:52CraigYeah, my fix was to remove it - I'm on to the next error now.
09:54CraigSo, 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?
09:55rhickeyThose are two separate questions - directory is inferred from namespace, but the relationship is: my.fancy.lib ==> my/fancy/lib.clj, somewhere in classpath
09:55CraigOr, looking at the source, perhaps just the last element of the namespace implies a file now, rather than a directory.
09:55CraigGot it.
09:55rhickeyyou can still load .cljs not in classpath with load-file, by why?
09:56CraigThanks - I can see now how swank-clojure needs to be fixed. Appreciate the education.
09:56rhickeynp
10:22shooveranyone try AOT on IKVM.NET yet? looks like it's reading the .class files, but no difference in startup time
10:23rhickeyshoover: startup time there could be dominated by translation to IL
10:23rhickeybut with class files you could precompile with ikvmc, no?
10:24shoovermust be. I was hoping that previously it was a combination of ASM bytecode generation + IL translation, and this would be a magic win
10:24shooverI know ikvmc precompiles jars. I'll check on .class files
10:47cemerickrhickey: 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:47cemericks/names/symbols
10:49rhickeycemerick: keyword, when passed as symbol, would do what?
10:49rhickeypassed a symbol
10:50cemerickrhickey: I should have added a "respectfully" in there. Anyway: (keyword :foo) => :foo, (keyword "foo") => :foo, (symbol 'foo) => 'foo, (symbol "foo") => 'foo
10:50cemerickkeyword shouldn't take symbols, symbol shouldn't take keywords
10:50rhickeyor do you just mean (keyword :akeyword) == identity
10:51cemerickyes, exactly
10:51rhickeyok
10:51cemerickwhew, I guess I took the long way 'round the barn there. :-)
10:51rhickeyI've needed that too
10:51cemerickrhickey: 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:56rhickeycemerick: that's up - rev 1097
10:56cemerickrhickey: thanks
10:59rhickeySome 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:00CraigSo what exactly is your day job? Not that it matters: I plan to contribute anyway.
11:00rhickeyCraig: I do consulting and Clojure
11:01rhickeywork for myself
11:01CraigNerdvana. :) I'm halfway there myself.
11:22cemerickrhickey: 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:23drewrSLIME support updated to work with r1097.
11:23drewrhttp://github.com/drewr/swank-clojure/tree/master
11:39triddelldrewr: 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:40triddellbut I now want to update to support the newest revision of clojure
11:40drewrtriddell: That's the author's repository. I made the changes in my own "forked" repo.
11:40drewrYou could add mine as a remote if you wanted to, then pull the changes from there.
11:40drewrOr, you could wait for jochu to merge my or his own changes.
11:41triddelldrewr: ok, thanks... did you require any .emacs changes to get your new version to work?
11:42drewrNo.
11:43triddellok, cool
11:43rhickeycemerick: fns end up calling varied things. without the Exception decl I would have to wrap all checked exceptions
11:44rhickeyI hate checked exceptions
11:45cemerickrhickey: 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:45drewrrhickey: That was one of the things that drove me from Java screaming.
11:45Chousukedrewr: slime seems to work. thanks for the fix.
11:46rhickeycemerick: Clojure fns call Java all the time, e.g. user fns calling java.io etc
11:47drewrChousuke: You're welcome!
11:47rhickeyhave already gotten complaints the few places I am wrapping, because consumers can't catch typed exceptions
11:49cemerickI think I'm only whining because I'm writing in Java this morning. :-)
11:49rhickeyIt is truly painful - number one complaint I have about Java
11:49rhickeya terrible misfeature
11:50drewrIf they wanted to, would it be possible to fix that in the JVM?
11:50Chouserare not all exceptions checked?
11:51rhickeyIt's just a compiler thing, they could turn into warnings tomorrow
11:51cemerickrhickey: 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:51cemerick.invokeQuietly or something ;-)
11:51rhickeyChouser: no, certain branches of the exception hierarchy are not checked
11:52rhickeycemerick: interesting
11:52rhickeyI'm reluctant to add more methods not knowing the impact of vtable size, if any, on perf
11:53cemerickI can't imagine that that's an issue anymore, especially on 1.6+
11:53rhickeycemerick: you could make a static invoker/call method that did that
11:55cemerickYou mean a class with series of .invoke(IFn/Var, arg1, arg2 ..., argN) methods?
11:56rhickeycemerick: right
11:56cemerickyeah, maybe. We'll see what my mood is like the next time I need to write a Java wrapper for some clojure fns.
11:56cemerick:-)
11:56rhickeyFns.call(f,a1,a2)
12:23unfobradbev: when you have time, could you please come on over to #emacs for a vimpulse-related question?
12:23bradbevunfo: sure
12:27shooverrhickey: 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:28shooverstill can't touch the jvm's .7 secs though
12:33kotarakshoover: hi, is the hg mirror still updated?
12:38larrytheliquidany help with test syntax recommendations would be appreciated: http://paste.lisp.org/display/70313
13:08AWizzArdMoin
13:44rhickeyAOT changes spelled out: http://groups.google.com/group/clojure/msg/58e3f8e5dfb876c9
13:48blackdogthanks rhickey awesome stuff
13:48rhickeyyou're welcome
13:51Chouserrhickey: do you expect to fold gen-interface into AOT as well?
13:52rhickeyChouser: could do, although I'd really like to keep any such interface-generating file free of other stuff.
13:53Chouserok, just curious. I still haven't had a need to use gen-interface.
14:04sohailhey, AOT is official
14:04sohailnicely done rhickey
14:04rhickeywell, AOT is officially ready-to-try
14:04shooverkotarak: I lost my web host so the hg mirror is not automatically updated anymore. I will have it sync at least daily soon
14:06gnuvincehttp://www.reddit.com/r/programming/comments/7d6vs/rich_hickey_adds_aot_compilation_to_clojure/
14:15AWizzArdaot makes Clojure now much more attractive for commercial development, great
14:17sohailjust catching up on the list... howcome tests are a contrib
14:17sohailinteresting way to do it
14:17Chouserbecause that way we can write tests while Rich writes AOT
14:18sohailChouser, the other day I was looking for tests to see how something worked and I couldn't find them!
14:20sohailso long as they are written, that's actually a pretty damn good way to do it
14:20Chouserwell, there aren't very many yet. Send Rich your CA and you can help out!
14:21sohailnot a bad idea, I'd feel like less of a leech
14:27AWizzArdIn 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:28gnuvinceAWizzArd: seq applied to an empty sequence returns nil.
14:28drewrrhickey: What's the consequence of namespaces only having one segment now?
14:28drewrIt seems to still work.
14:29AWizzArdgnuvince: exactly... and (and (coll? x) (not (empty? x))) also returns nil if x is an empty collection
14:29rhickeydrewr: don't do that, it will leave you with a class in no package
14:29tomhickeyH4ns & rhickey: clojure.org now has a print stylesheet, let me know if you need any changes
14:29rhickeytomhickey: thanks!
14:29AWizzArdtomhickey: very cool, thanks
14:29tomhickeynp
14:30drewrrhickey: Ah, I see.
14:30rhickeydrewr: that's why I had to move clojure ns down into clojure.core
14:31drewrYeah, I realized that. I was just wondering why some stuff I had still worked without a package.
14:31wwmorganAWizzard; it may be instructive to look up the definition of empty?
14:31rhickeywwmorgan: :)
14:32rhickeyAWizzArd: (seq x) is idiomatic Clojure
14:32AWizzArdokay good, when it is defined this way it makes sense
14:32rhickeyalso just (when x ...) when you know x is a seq
14:33AWizzArdyes, that also feels natural/good for me to do
14:33H4nstomhickey: hammer!
14:34AWizzArdrhickey: 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:37rhickeyAWizzArd: yes, please, when's implicit nil is a fine thing.
14:42AWizzArdCan dissociating elements from a map be done in near constant time?
14:43rhickeyAWizzArd: from a hash map, yes, same as assoc
15:16tomhickeyclojure.org now has code highlighting (via js). please let me know if you see any issues
15:18AWizzArd*click*
15:18AWizzArdyeah, looks very nice
15:19AWizzArdIt's good and important that Clojure has this nice Web 2.0 look.
15:19rhickeytomhickey: looks great - thanks again!
15:24rhickeyI wonder what it would take to get Clojure highlighting on paste.lisp.org?
15:25drewrI'm sure chandler wouldn't be opposed to it.
15:25drewrWhat's doing the parsing?
15:26rhickeymaybe js regex, tomhickey ?
15:27tomhickeyyes, clojure.org is doing it with regex using Dan Webb's codehighlighter script, http://svn.danwebb.net/external/CodeHighlighter/
15:31tomhickeypaste.lisp.org seems to markup the code on the server side
15:35drewrThat's what I was thinking. I tried to download the source, but common-lisp.net is broken right now.
15:36drewrEr, the FTP part of it is.
15:37H4nsdrewr: did you open a ticket for that? can you? please include information on where you found the ftp path that has become inaccessible.
15:38drewrH4ns: I didn't know I could open a ticket.
15:39H4nsdrewr: just send a quick email to rt@common-lisp.net - that will help us tremendously! thanks!
15:43drewrH4ns: Done.
15:44H4nsdrewr: *bow*
15:46drewrIt was nothing, really.
15:49Chousukehm, 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:50Chousukecommenting out half of the expression probably is not intended :)
15:52tomhickeyChousuke: thanks, i'll look into that
15:53Chousukesyntax highlighting really helps in spotting errors like that
15:56tomhickeyChousuke: fixed. thanks for the report
15:56Chousukeyou're welcome
16:21sohailtomhickey related to richhickey?
16:21drewrsohail: Brothers.
16:22sohailnice
16:24gnuvinceWho's the older one?
16:24duck1123I was wondering that myself
16:29tomhickeyrich is the older one
16:30sohailmust be nice to have a brother with the same interests
16:30tomhickeyso i've got like 14 years before i make my own language! ;)
16:31sohailclojure: the 14 year language
16:32AWizzArdI guess Clojure will be one of the last Lisps before computers will understand human language and will do the programming for us
16:32H4ns"right"
16:32Hunthere's always another lisp.
16:32duck1123isn't that what they said about the first lisp?
16:33Huni think you can prove that by induction if you tried really hard
16:33Chousukelisp is funny
16:34Chousukeyou can have thousands of dialects, but at its core, it's still "just" lisp
16:34Hunthe 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:35ChousukeYou could write an XML-based lisp. it just wouldn't be very lispy.
16:35AWizzArdHun: I think Paul Graham gave a nice summary: http://www.paulgraham.com/diff.html
16:36Huni know that one. i just don't know how much i agree with it :)
16:36cemerickChousuke: http://www.agentsheets.com/lisp/XMLisp/
16:36Chousukecemerick: yeah, I should've known it has already been done
16:36sohailChouser, I think jelly is the xml based lisp
16:36sohailit has proper macros I think
16:37Huni 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:38AWizzArdI 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:38AWizzArdand create on-the-fly
16:39Hunwith which semantics? most lambdas i know are lexical
16:39Hunthe ones in emacs work completely different, though i think i'd still call it a lisp
17:02cemerickis there an incantation to override :private and access such a marked var?
17:03kotarak(ns-resolve 'foo.bar 'private-var), although private there for a reason
17:04gnuvince_Wow
17:04gnuvince_Clojure builds in 11 seconds
17:04gnuvince_that's impressive
17:18sohailgnuvince, it is amortized over the runtime of your program ;-)
17:19gnuvince_heh
17:19gnuvince_I compiled GHC from scratch once. That took *way* longer than 11 seconds ;)
17:24sohaillike I said, amortized
17:24sohail:-)
18:04hiredmanis there a clojure http client that does ssl and doasn't use gen-and-load-class?
18:05cemerickthere's lots of java http clients, FWIW
18:05hiredmanyeah, well
18:06cemerickgetting http right is not an easy thing. Is there a clojure impl floating around at all?
18:06hiredmanafter 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:06hiredmanthere is one in the clojure files stuff that I know of
18:08hiredmanbut it uses gen-and-load class for some ssl "stuff"
18:10cemerickwwmorgan: what's the http library you ended up liking?
18:11wwmorganjakarta httpclient
18:11wwmorgandidn't have any problems with SSL IIRC
18:11cemerickyeah, that's what I thought. hiredman, I'd say stick it out with jakarta. (reliable) http clients are weekender projects.
18:12hiredmanI guess I will
18:12cemericks/are/aren't :-P
18:19H4nshiredman: there is a clojure wrapper around some common http client in http://groups.google.com/group/clojure/files
18:19H4nshiredman: (http-client/url-do "http://planet.lisp.org/&quot; "GET" [])
18:20H4nshiredman: it is not particularily pretty, but worked for me right out of the box.
18:24hiredmanH4ns: 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:25H4nshiredman: ah, ok, understood.
18:26H4nshiredman: did you look at xlightweb already? that is what i use, but i did not try https with it
18:27hiredmanI have not
18:27H4nshttp://vaxbusters.org/http-client.clj is what i currently use in my planet lisp poller
18:29hiredmanI 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:32hiredmanI'll take a close look at xlightweb, thanks
18:33hiredmanwow
18:35H4nshiredman: works?
18:44hiredmanH4ns: still kicking the tire, but looks good
18:46H4nsok. good luck!
18:51DrakesonHave you seen this error on emacs+slime+OSX: java.lang.Exception: No such namespace: clojure (NO_SOURCE_FILE:1)
18:52Chousukeyou either need a fixed slime or an older revision of clojure
18:55ChousukeDrakeson: 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:55DrakesonChousuke: thanks. I was suspecting my settings.
18:56drewrChousuke: jochu has merged my changes, so you guys can pull from the official repo.
18:56Chousukeah, excellent.
19:00Drakesongreat, thanks :)
20:03jtoycan you mix and match languages on the jvm like clojure and jruby together?
20:04arohneris there any way to make System.err show up in the slime buffer rather than only in *inferior-lisp*?
20:04arohnerjtoy: I haven't used jruby, but if their calling conventions are as nice as clojure's ( :-) ), it should be easy
20:05jtoybut i mean in general, can you mix jvm languages? like there is also groovy and scala,etc
20:05arohneryou should be able to. it's all just .class files
20:06arohnerthat being said, I haven't tried it
20:08rhickeyjtoy: you should be able to call from language to language through the interfaces they present to Java, as each can call Java
20:08rhickeythere has been some work on a multi-language MOP
20:09jtoyrhickey: 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:10rhickeyjtoy: yes, the pragmatic book looks good so far
20:40gnuvince_Does a multi-method's dispatching function need to have the same arity as the defmethods will have?
20:41rhickeygnuvince: it gets pased all args, but you can just & rest away the ones you don't care about
20:42gnuvince_rhickey: okay
20:42gnuvince_thank you.
20:43rhickeysure
21:12Chousercan whole classes be garbage collected?
21:13rhickeyChouser: that depends, it is something they are working on, but basically they are kept alive by their classloaders
21:13Chouserhm.
21:14Chouser(Class/forName (.getName (class (fn [] 99))))
21:14rhickeythat's one reason why langs use their own tear-off loaders for dynamic class creation
21:14ChouserThat works, but if I store the name in a var and do forName later, it fails.
21:16rhickeyChouser: what are you trying to do?
21:16Chouserheh. good question!
21:16rhickeythe concrete class of an anonymous fn is, well, anonymous
21:17ChouserI'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:18rhickeychances are entire expression above is compiled under a tear-off loader, class can only be found by name under that loader
21:18Chouserit's anonymous but my snippet above does return a class.
21:18Chouserah. ok.
21:18rhickeyas I said, tear-of loaders are used so classes like this can be reclaimed
21:18Chouserok
21:39ChouserI just can't seem to reproduce this error twice in a row.
21:41rhickeyChouser: what happens?
21:47Chouserhm, paste's not working
21:48Chouserhttp://n01se.net/paste/Q2i -- gen-interface compile issue
21:49ChouserI'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:53arohner`does clojure have zip?
22:53Chouserit has a lib called zip, but I doubt that's what you want
22:53rhickeyhttp://www.sauria.com/blog/2008/11/13/olio-a-web-20-benchmark/
22:54arohner`i.e. (zip '(1 2 3) '(4 5 6)) => ((1 4) (2 5) (3 6))
22:54Chouser(map list '(1 2 3) '(4 5 6))
22:56arohner`interesting.
22:56arohner`thanks
23:03bradbevHmm, refs & lazy mapping have interesting effects
23:04Chouseroh?
23:04bradbevHmm, lisppaste is broken
23:04Chouseryeah
23:05arohner`Chouser: another solution to my earlier question: interleave
23:05bradbevbut basically map over a list of refs doing deref, then change the ref value & then look at the lazy seq
23:05arohner`sort of
23:05bradbev(def refs (into [] (map #(ref %) (range 10))))
23:05bradbev(println (map deref refs))
23:05bradbev(def dref (map deref refs))
23:05bradbev(doseq r refs
23:05bradbev (dosync
23:05bradbev (ref-set r (* 2 @r))))
23:05bradbev(println dref)
23:06bradbevthe lazy seq shows the changed refs - but that is a little confusing really
23:07bradbevIt 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:09Chouserah, I see. yep.
23:10bradbevso if you ever map over a seq containing refs, you need to make it a concrete instance, or get burned
23:16Chouserright. Probably better to keep them in a vector.
23:18bradbevyep. But it is a wee bit of a gotcha.
23:19Chouserhave to be careful with any kind of side-effect mixed with lazy seqs
23:21bradbevindeed. lazy only works with immutable data. On the upside, this is the first real gotcha I've found with Clojure
23:22ChouserAnother good one is laze seqs over a resource that goes away.
23:23bradbeveek, that would be very bad.
23:23bradbevI'm not entirely sure that I'm sold on lazy seqs
23:23bradbevor at least map returning a lazy seq
23:24Chouseroh, I'm completely sold. But they are what they are -- you can't pretend they're not lazy.
23:24Chouser...and I think there's a solution in the works for the resource issue.
23:24bradbevI'm still coming to grips with it I think
23:25bradbevbut I'm learning that you can't treat lazy seqs as a transparent abstraction
23:27Chouserwell, you can't treat them as non-lazy
23:27Chouserif someone hands you a seq, you can treat it as a seq without knowing what it really is underneath
23:30bradbevyes. 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:32ChouserI guess I've never done much witha seq of mutables. Does sound a bit squirrley.
23:33bradbevI haven't either really, but in the process of learning about lazy seqs it occurred to me this could happen
23:45jphrhey folks, just starting to learn clojure, wondering if there is an equivalent from CL's atom predicate?
23:47Chouserjphr: not quite. There's coll? which you could negate
23:47jphrthat would probably work