#clojure logs

2008-12-13

00:01gpwhy is he callling max in his function though? seems liek a mistake
00:02Chousergood point. I'm sure it's a typo
00:43gpwhy arent tags and metadata between functionname and argslist?
00:46Chouserfunctions can take multiple arglists, but the metadata goes is for all of them and attached to the var.
00:48Chouser(defn #^Integer foo "returns int" ([x] (Integer. x)) ([x y] (+ x y)))
00:53gpuser=> (= '(1 2) [1 2])
00:53gptrue
00:53gpdoes that really make sense?
00:54gpChouser: but that doesnt change the fact that you cpuld put the meata data between f-name and argslist
00:54gpis there a program to run unittests on all functions ina file?
00:55Chouserhm, that is a bit surprising: (= '(1 2) [1 2] (first {1 2}))
00:56Chousergp: I suppose you could, but between which fn-name and which arglist?
00:58Chousergp: (clojure.contrib.test-is/test-ns 'my-ns)
00:59Chousertest-ns runs all tests in a namespace.
01:11gphmm having tests inside a function is pretty ugly though, is there unittesting framework too?
01:12Chousertest-is provides deftest and some helpful functions.
01:13ChouserThere are other frameworks as well, such as "fact": http://groups.google.com/group/clojure/browse_thread/thread/193023afbf87698d
01:21danlarkinI am liking just using deftest
06:55ben1how can I output the current time in clojure?
07:00StartsWithKben1: http://www.rgagnon.com/javadetails/java-0106.html
09:54fandahello all!
09:54fandacould you help me please a little?
09:54fandai am trying to write a function which transforms
09:54fanda(def data '("a" "b" 1 2 "c" 3 "d" "e" "f" 4 5))
09:54fandainto
09:54fanda=> [["a"] ["b" 1 2] ["c" 3] ["d"] ["e"] ["f" 4 5]]
09:54fandait generally groups strings and numbers together
09:55fandai tried loop/recur, but not there yet :-(
09:57fandathis goes well with iteration idioms: http://groups.google.com/group/clojure/browse_thread/thread/fa9859614535f634
09:57fanda:-)
10:06alphazerohi all, need some help with newb questions.
10:08rhickeyfanda: http://paste.lisp.org/display/72092
10:09RSchulzIs there a built-in fn that simply returns true unconditionally?
10:10rhickey(doc constantly)
10:10clojurebotReturns a function that takes any number of arguments and returns x.; arglists ([x])
10:10rhickeyso, (constantly true)
10:10fandarhickey: thanks for the help!
10:11rhickeyfanda: sure
10:11rhickeyno one's done partition-when yet?
10:12alphazeroone is regarding import. Don't understand what is happening in REPL but why does it seem to need full java class name after an import?
10:12RSchulzrhickey: Thanks.
10:12alphazero(import '(import java.util.HashMap))
10:12alphazero(new HashMap) => java.lang.IllegalArgumentException: Unable to resolve classname: HashMap (NO_SOURCE_FILE:9)
10:12rhickey(import '(java,util HashMap)) note space before HashMap
10:13alphazerorhichey: Oh! thanks.
10:13pjb3I'm trying to learn how to use zippers
10:13pjb3given this xml doc: http://paste.lisp.org/display/72095
10:13pjb3I can get the name of each bucket with the XPath query '/ListAllMyBucketsResult/Buckets/Bucket/Name'
10:13pjb3With a zipper, how do you do something like that?
10:14pjb3Seems to have only the direction methods, not ones for looking for children with certain names
10:14alphazeroNext question is given:
10:14alphazero(def jmap (new HashMap))
10:14alphazero(.put jmap :key :value)
10:16alphazerois there any way to specify the 'put' method reflectively?
10:16rhickeypjb3: did you look at Chouser's zip-filter?
10:17pjb3no, is that in clojure-contrib?
10:17rhickeypjb3: zip is pretty much just nav, zip-filter adds search
10:17rhickeyhttp://clojure-contrib.svn.sourceforge.net/viewvc/clojure-contrib/trunk/src/clojure/contrib/zip_filter.clj?revision=239&view=markup
10:18rhickeyand: http://clojure-contrib.svn.sourceforge.net/viewvc/clojure-contrib/trunk/src/clojure/contrib/zip_filter/xml.clj?revision=256&view=markup
10:20ZephtarI saw that there was a discussion of Xronos yesterday, but I was away from my computer at the time.
10:20ZephtarI maintain the project and would be glad to answer any questions.
10:47pjb3Nice, the answer to the aforementioned question of how do I do the Xpath Query:
10:48pjb3 /ListAllMyBucketsResult/Buckets/Bucket/Name
10:48pjb3in clojure, is:
10:48pjb3(xml-> ex :Buckets :Bucket :Name text)
10:49pjb3where ex is the xml-zip
12:05csfIs there a problem in the Slime REPL when getting user input - specifially (read-line)? It never returns
12:56arohnerhas anyone tried running htmlunit from clojure?
12:56arohnerI'm getting some kind of classloader issue
13:22danlarkinthis is amusing, http://jonex.info/dump/yolisp.jpg
13:24arohnergah. Why is it that code can break when switching class loaders?
13:42ChouserShould .clj files in clojure-contrib be more explicit about being part of the Clojure project, such that the CAs are enforcable?
14:14rhickeyChouser: sure
14:14ZephtarI saw that there was a discussion of Xronos yesterday, but I was away from my computer at the time.
14:15ZephtarI maintain the project and would be glad to answer any questions.
14:27drewrWhat do you guys like for doing SOAP?
14:33clojurebotsvn rev 1159; proxy perf tweaks Note breaking change if you are using the proxy interface other than the proxy macro itself - proxy maps are now maps of (preferably interned) strings to fns, not symbols to fns, and if you construct a proxy manually you must establish initial map with init-proxy
14:57RSchulzrhickey_: Possible trouble in SVN 1159:
14:57RSchulzSorry. Here it is:
14:57RSchulzjava.lang.AbstractMethodError: clojure.proxy.java.util.concurrent.atomic.AtomicReference$IRef.__initClojureFnMappings(Lclojure/lang/IPersistentMap;)V (repl_ln.clj:65)
14:57RSchulzHappens upon start-up
14:59drewrHe warned that there might be a breaking change.
14:59RSchulzCaused by: java.lang.AbstractMethodError: clojure.proxy.java.util.concurrent.atomic.AtomicReference$IRef.__initClojureFnMappings(Lclojure/lang/IPersistentMap;)V
14:59RSchulzOK. Just reporting.
15:00rhickey_RSchulz: startup of what?
15:00RSchulzClojure REPL
15:00rhickey_ant clean?
15:00RSchulzNo. Just default build. Hang on...
15:01RSchulzOK. False alarm. Sorry.
15:32Lau_of_DKEvenings gents
15:33danm_hello
15:37Zephtarlau: good evening
15:37Zephtardamn_: hello
15:40danm_what's up?
15:44mfredricksoni seem to have consistent issues with doto
15:44mfredricksonI'm following along with http://clojure.org/jvm_hosted
15:45RSchulzLau_of_DK: You seem confused. It's early afternoon.
15:45Lau_of_DKOh, right... Im besides myself, sorry
15:48mfredricksonbut I always get "java.lang.Exception: Unable to resolve symbol: setSize in this context (NO_SOURCE_FILE:50)
15:48mfredricksonOr whatever the first action in the (doto f ...) call is
15:48RSchulzmfredrickson: Odd. I was just seeing something similar with (new FileWriter ...)
15:49RSchulzI assumed it was my problem, but I haven't figured it out yet.
15:49Lau_of_DKSchulzy, you still use the new keyword?
15:49RSchulzI do have an import for (java.io FileWriter)
15:49RSchulzI was right now.
15:50Lau_of_DKCute
15:50RSchulzSame thing if I do (FileWriter. file-name)
15:50RSchulzThat's the new syntax, right?
15:51Lau_of_DKI wouldnt say 'new' anymore, but yea, its more recent
15:51ZephtarWhat is the official #clojure timezone?
15:52RSchulzEarth Standard Time
15:52mfredricksonRSchulz: For mine I needed (doto pojo (.method args))
15:52ZephtarSo GMT, which means it is evening :D
15:52Lau_of_DKclojurebot: rev 1121
15:52clojurebotTitim gan �ir� ort.
15:52Lau_of_DKclojurebot: svn rev 1121
15:52clojurebotsvn is https://clojure.svn.sourceforge.net/svnroot/clojure/
15:55durkait does work if you change all the setSize to .setSize
15:55mfredricksondurka: yup. just got that
15:56RSchulzHow does Clojure choose the right overload when there are multiple methods of a given name and arity?
15:56mfredricksonto submit a bug report/patch for the code on website, should I diff clojure.markdown?
15:57AWizzArdRSchulz: first multimethod for which the dispatch fired the equal result
15:57RSchulzMultimethod?
15:57RSchulzI'm asking about calling methods of Java classes. Or, in this case, a constructor, if that matters.
15:57AWizzArdwell, you said "multiple methods"
15:57mfredricksonhmm. it's not in there
15:57RSchulzYes. I _didn't_ say multimethod...
15:57AWizzArdbut multiple methods
15:58AWizzArdanyway, the constructors in Java dispatch on type
15:58AWizzArdand arity
15:58RSchulzSo Clojure uses reflection to choose?
15:58AWizzArdin as few cases as possible
15:59RSchulzSo take java.io.File. I have two cases in my code, (string?) and (isa? ... java.io.File), which correspond to two of hte constructors in java.io.FileWriter
16:00RSchulz(I should have said "...take java.io.FileWriter...")
16:01rhickey_mfredrickson: the web site generally documents the release, with the exception of the API page - the body docs will get updated next release, hopefully soon
16:02mfredricksonrhickey_: good stuff. thanks.
16:03AWizzArdChouser: did you have some successful runs with your applet tests yesterday?
16:07RSchulzrhickey_: What are possible causes for "Unable to resolve classname" when I know the class name is valid and imported?
16:08rhickey_RSchulz: you know how? Did you check ns-imports?
16:08RSchulz(ns rrs.io-helpers
16:08RSchulz (:import (java.io
16:08RSchulz File
16:08RSchulz BufferedWriter
16:08RSchulz FileWriter))
16:08RSchulz)
16:08RSchulzjava.lang.IllegalArgumentException: Unable to resolve classname: (new FileWriter file-spec) (io_helpers.clj:21)
16:09RSchulzI tried tagging file-spec with #^String, too, to no avail.
16:10rhickey_What's on line 21?
16:10RSchulzHere's everything non-blank on 21: (-> (new FileWriter #^File file-spec) (new BufferedWriter))
16:11RSchulz(That's the (isa? file-spec File) case)
16:13rhickey_user=> (macroexpand-1 '(-> (new FileWriter #^File file-spec) (new BufferedWriter)))
16:13rhickey_(new (new FileWriter file-spec) BufferedWriter)
16:13AWizzArdthat makes it clear
16:13RSchulzIs the chaing / thread thing wrong? Or just a poor choice?
16:13RSchulzDo you recomment the explicit (new ...) syntax?
16:14rhickey_RSchulz: it works better without new IMO, I use (Classname. ...)
16:14RSchulzOK.
16:14kotarak(-> file-spec FileWriter. BufferedWriter.)
16:14rhickey_right
16:15RSchulzI had it all mangled is what you all are saying. Not a surprise...
16:15RSchulzDo the type tags matter? Do they help? (In a case like this?)
16:16AWizzArdI think they should never help for calling the right constructor, but instead they help to reduce runtime overhead in some cases.
16:19RSchulzNow I have this: ((#^File file-spec FileWriter.) BufferedWriter.) ... and it's producing: java.lang.ClassNotFoundException: FileWriter. (io_helpers.clj:21)
16:19AWizzArdshouldn't the list begin with a dot and a space?
16:20RSchulzIt even does it if I fully qualify java.io.FileWriter!
16:20kotarakShouldn't it be (reverse)d? (BufferedWriter. (FileWriter. file-spec))?
16:20danlarkinclojurebot: todo
16:20clojurebottodo is http://richhickey.backpackit.com/pub/1597914
16:21RSchulzkotarak: I don't think so. I want to wrapp the BufferedWriter around the FileWriter.
16:22kotarak??? So you pass the BufferedWriter into the FileWriter or the other way around? (I would suspect the "other way around")
16:23RSchulzNo. In Java it would be new BufferedWriter(new FileWriter("file-name"));
16:24kotarakSo in Clojure it's (BufferedWriter. (FileWriter. "file-name"))
16:25RSchulzWell, I have a lot of trouble getting things write, but one thing remains constant: java.lang.ClassNotFoundException: FileWriter. (io_helpers.clj:21)
16:25RSchulzAgain, even if I fully qualify the name: java.io.FileWriter.
16:25RSchulzThis has got to be something else really stupid I'm doing (wrong).
16:25AWizzArdAre you allowed to post the first 25 LOC in the lisp paste?
16:26rhickey_RSchulz: this is how to say it manually: (new BufferedWriter (new FileWriter file-spec))
16:26RSchulzMe? Sure. It's my code. And nothing sensitive or proprietary or anything like that. The whol method is exactly 25 lines long. Is that the past site's limit?
16:27rhickey_both news can become Classname. : (BufferedWriter. (FileWriter. file-spec))
16:28RSchulzThat's what I've got, but it still fails. What's the URL for that (one of those) paste site(s)?
16:28rhickey_-> can thread inside out
16:29rhickey_http://paste.lisp.org/new/
16:30AWizzArdRSchulz: the paste limit is much higher, but it makes sense to only show small parts of the code, so one could concentrate on the challenging part.
16:31RSchulzOK. I'm doing it now.
16:31kotarakRSchulz: choose the clojure channel. Then a link is posted by a bot.
16:32RSchulzI tried once, but something went wrong. It never showed up in the list.
16:32rhickey_bot is not logged in, don't choose a channel, just enter the url is gives you here
16:33RSchulzI just get a blank page after I click Submit and it's not in the list.
16:33AWizzArdworks for me
16:33RSchulzIs registration required?
16:33kotarakno
16:33AWizzArdwell, maybe you can paste it here then http://pastebin.com/
16:34danlarkinlisppaste wasn't working for me yesterday
16:34rhickey_paste.lisp works, choose no channel
16:34AWizzArdWell, for me it does work (right now).
16:36RSchulzOy. http://paste.lisp.org/display/72108
16:41RSchulzI got that paste through, but paste.lisp.org seems to be having problems.
16:46RSchulzSo does anybody see why that function causes an error when I (use 'rrs.io-helpers)?
16:47rhickey_RSchulz: I get and error for @ (are you trying to write a macro?):
16:47rhickey_ java.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: clojure.lang.LispReader$UnquoteSplicing@1396ec
16:48AWizzArdRSchulz: what means (file-spec java.io.FileWriter.)? Is file-spec a function?
16:48RSchulzOh. That's left over from a macro attempt, yes. But the error comes on the FileWriter constructor calls.
16:48rhickey_ (isa? file-spec File) should be (instance? File file-spec)
16:48rhickey_No error there for me
16:48RSchulzIt should be clear. It's either a String or a File
16:48RSchulzOK. So it may never take those paths, but I get the error when I (use ...) that file.
16:50RSchulzSo the (new form works) when I fix the macro left-overs. But the commented lines still give the ClassNotFoundException
16:50kotarakRSchulz: (FileWriter. ...) expands to (new FileWriter ...), but only if FileWriter. is the first argument. Otherwise Clojure tries to resolve it as class name. Hence you get a FileWriter. not found error.
16:51rhickey_kotarak: that's in comments now, RSchulz are you talking about the comments not working?
16:51RSchulzYes. The lines that are commented fail. Rich's form works. The macro junk was causing a separate error and that was confusing me further.
16:52RSchulzI've probably been "diagnosing" several problems at once, which is my bad, of course.
16:52kotarakRSchulz: the correct form is (FileWriter. file-spec)
16:52kotarakAnd not (file-spec FileWriter.)
16:52RSchulzOK. I was sure someone suggested the form I had (and I thought I copied and pasted from IRC), but I'm not entirely sure any more.
16:53danm_http://paste.lisp.org/display/72062#1
16:53danm_can anyone tell me if that's how alter is intended to be used?
16:53rhickey_Might be worth rereading: http://clojure.org/java_interop
16:54danm_I feel as though I've improved the function over my earlier paste, but now it won't work (haha)
16:55RSchulzrhickey_: I assume that's to me. I thought I had but ...
16:55rhickey_danm: no - the idea behind alter/commute is that they manipulate the state, you wouldn't use the var in the altering fn
16:55rhickey_danm_: what's in *quote-db* ?
16:55danm_*quote-db* is intended to be a hash of sorted-maps
16:55danm_so, financial quotes from yahoo
16:56danm_where the key in the map is the symbol, and then it's a list of quotes sorted by their date
16:56rhickey_danm_: we don't call maps hashes in Clojure as some of them are trees - so it's a map?
16:56danm_sorry, yeah
16:56AWizzArdOne thing that I really suggest to all the people who never did Lisp before is http://www.cs.umd.edu/~nau/cmsc421/norvig-lisp-style.pdf
16:57AWizzArdit also covers indentation
16:57danm_I assumed hash-map was a has, and sorted-map was a tree
16:57danm_but alas
16:57AWizzArdrhickey_: aren't they both tries under the hood?
16:58rhickey_danm_: so your alter fn should take that map as it's first argument, and should return a new map
16:59danm_ok
16:59rhickey_(alter *quote-db* (fn [qmap] (assoc qmap sym sorted-map-from-dq)))
16:59danm_thanks, that would explain the runtime error
17:00rhickey_AWizzArd: no hash-maps are tries and sorted-maps are red/black trees
17:02RSchulzIs it possible to (binding *out* ...) in a macro expansion?
17:03rhickey_RSchulz: you should put your with-open outside the binding, and don't use *out* in with-open
17:04RSchulzHow do you get a contextual redirection of input or output? I'm working towards a kind of shell-like environment.
17:06rhickey_RSchulz: binding *out* is the right way, (with-open [a-local (open file)] (binding [*out* a-local] ...))
17:06RSchulzAh. OK.
17:06RSchulzThat's for bearing with my ineptitude.
17:07RSchulzDuh. _Thanks_ for ...
17:07rhickey_RSchulz: np
17:26arohnerIf I set a var to contain a class, how do I create a new instance of it?
17:26arohner(def myvar java.util.map)
17:26arohner(new myvar) doesn't work
17:27rhickey_arohner: ick - are you sure you want to do that?
17:28arohnernot really, but I'm not sure how else to do it
17:28AWizzArdarohner: new is a special form, not a function
17:28arohnerI guess I could create a factory function
17:28AWizzArdit treats it's arguments special and does not necessarily evaluate them
17:29rhickey_with only the class you'll have to use reflection:
17:29rhickey_(def myvar java.util.HashMap)
17:29rhickey_(.newInstance myvar)
17:30rhickey_but you could instead store a constructing fn:
17:30rhickey_(def myvar #(java.util.HashMap.))
17:30rhickey_(myvar)
17:30arohnerthanks
17:31rhickey_the latter could be extended to take args, newInstance can't
17:31rhickey_the latter will be much faster
17:32arohnerI'm writing tests for a webapp. Webdriver (a java tool) has several different implementations, firefoxDriver, safariDriver, etc. I was hoping to store the desired implementation in a var so I could re-run the tests with the driver bound to a different implementation
17:32arohnera constructing fn is a good solution though
17:32arohneri can just (binding) that
17:33arohnerthanks
18:16AWizzArdWhat is the easiest way to shuffle a list/vector? (sort-by rand col) does only rarely randomly enough.
18:16RSchulzI finally sorted out my >> macro (it's macro again, as it must be), but the imports seem not to work. Would someone look at http://paste.lisp.org/display/72108#1 an suggest why that might be?
18:18RSchulzAWizzArd: You could interleave the random numbers with the collection and then sort the pairs on the random integer element.
18:18RSchulzAnd project out the original collection elements of each pair.
18:21Chouserclojurebot: shuffle is http://groups.google.com/group/clojure/msg/a2816f1b51d99b79
18:21clojurebotAlles klar
18:22Chouser^^ AWizzArd
18:23AWizzArdthanks Chouser
18:25RSchulzChouser: Did you have any ideas about the DOT problem I was seeing?
18:36danm_Chouser: can you point me at a starting point for spit/slurp with objects the reader doesn't understand?
18:36danm_for instance, I have a j.u.Date in a structmap that I'd like to read/write
18:37danm_I'm not sure where to look in the docs :|
18:39danlarkinarbitrary java objects don't get reader support
18:41danm_danlarkin: ok, thanks
18:41kotarakRSchulz: http://paste.lisp.org/display/72108#2, this works for me.
18:42danlarkinyou'll have to use a serialization format, perhaps clojure-json :)
18:42RSchulzWell, that's good, but do you have any explanation why the imports don't seem to work and why I have to use fully qualified names there?
18:42danm_danlarkin: is that a project you're responsible for? :)
18:42rhickey_danm_: user=> (read-string "#=(java.util.Date. \"Sat Dec 13 18:38:53 EST 2008\")")
18:42rhickey_#<Date Sat Dec 13 18:38:53 EST 2008>
18:43danm_google tells me yes
18:43danlarkind'oh there I got opening my big mouth too quickly
18:43kotarakRSchulz: as you may note, my annotation doesn't use qualified names and it works for me.
18:43danm_rhickey_: neato
18:43rhickey_you can define a print-dup method for any type and print with *print-dup* on to get print/read serialization of anything
18:43RSchulzYes, I see that. But still...
18:44kotarakRSchulz: then I don't the your problem...
18:44kotarakI don't see
18:44rhickey_danm_: http://groups.google.com/group/clojure/msg/e21bf475b45bd2d5
18:46RSchulzAre you saying you can't replicate the "Unable to resolve classname" error in my code if you remove the java.io. qualification on FileWriter and BufferedWriter?
18:47RSchulzBy the way, I see the not about multiple evaluations of file-spec, and I'll fix that, but all my testing has been with simple constants like "file-name" or (new File "file-name").
18:48kotarakRSchulz: works fine for me
18:48kotarakRSchulz: also your version w/o qualified names.
18:48RSchulzSo there's something idiosyncratic about my set-up...
18:48RSchulzI wonder what it could be.
18:48RSchulzI'm using Sun JDK 1.6.0_11 on x86 Linux.
18:49danm_rhickey_: thanks, that's perfect.
18:49kotarak1.5 on Mac
18:50kotarakRSchulz: about the multiple eval: this is just a general remark.
18:50RSchulzSure. And I'm glad you pointed it out.
18:51RSchulzEven my generic Lisp is very (_very_) rusty, let alone Clojure's uniquenesses.
18:51danlarkindanm_: sorry about that :-o
18:51danm_danlarkin: meh, no problem :)
18:54RSchulzWhat's available in the way of a pretty-printer for Clojure forms?
18:56danlarkinChouser has a nice one in the mailing list
18:56rhickey_RSchulz: emacs clojure-mode
18:56rhickey_:)
18:56RSchulzApart from Emacs!
18:56kotarakRSchulz: vimclojure
18:56kotarak;)
18:56RSchulzOh?
18:56RSchulzI didn't know vimclojure had pretty-printing.
18:57RSchulzDoes that require the Ruby thing?
18:57kotarakNot really. You have to add the linebreaks and then just ggGV= for the indeting.
18:57RSchulzBut apart from external dependencies or IDE (-like) tools, is there any Clojure code for pretty-printing Clojure forms?
18:58kotarakNo Ruby. Pure VIm.
18:58kotarakggVG= actually...
18:58RSchulzAh. OK. I'll have to try that.
18:58RSchulzWhat's the V part?
18:58RSchulz(I'm pretty much stuck on the original Vi subset of Vim!)
18:58kotarakvisual mode
18:58RSchulz('Cause I'm so old...)
18:59RSchulzStill, when people need a "pure Clojure" solution to something other than "blob-mode" printing, what do they do?
19:01danlarkinRSchulz: there's a nice pretty printing thread on the group, with (at least) 2 implementations, once of which (Chouser's) I am using successfully
19:02RSchulzOK. I thought I saw something somewhere.
19:02RSchulzI'll search the archives.
19:05hiredmankotarak: as long as you are here, I have a vim theme I like, but it doesn't give any special color to :keywords , any idea how I could fix this?
19:06RSchulzAh. That's nice. That will make comprehending (macroexpand ...) output _much_ easier!
19:08kotarakhiredman: just a sec
19:11kotarakhiredman: make sure it assigns a color to the Operator syntax group
19:13hiredmanhah
19:13hiredmanit assigns "white"
19:13wipewindowsany good clojure benchmarks?
19:13wipewindowshow much faster is clojure than Python?
19:14hiredmanif I add a line like that to my ~/.vimrc will it override the theme?
19:15zakwilsonHow much faster at what calculation? With what optimizations?
19:16hiredmannm
19:16hiredmanI figured it out
19:16hiredmanthanks a bunch
19:16kotarakhiredman: depends on the quality of your color scheme developer
19:16hiredmanoH.
19:18kotarakhiredman: if the colorscheme uses highlight default ...., it will work.
19:18kotarakw/o default it won't
19:19hiredmanhmmm
19:26csfhow is the clojure vim support....i'm no fan of emacs, but it's got slime.
19:29hiredmanclojurebot: contrib?
19:29clojurebotI don't understand.
19:30RSchulzclojurebot: Be more generous!
19:30clojurebotNo entiendo
19:30danlarkinclojurebot: you have no sense of humor
19:30clojurebotGabh mo leithsc�al?
19:30hiredmanclojurebot: clojure.contrib?
19:30clojurebotclojure is the bestest programming language available.
19:31hiredmanuseless
19:31hiredmanclojurebot: contrib is http://sourceforge.net/projects/clojure-contrib/
19:31clojurebot'Sea, mhuise.
19:32RSchulzHow many languages does ClojureBot speak?
19:32hiredmannone, but it can type a few
19:33RSchulzRight... How many (which) languages are represented in its response database?
19:34hiredman4?
19:34hiredmanI think I had to delete the russian one because something somewhere was mangling it
19:34RSchulzSure. Four. What language is "'Sea, mhuise."?
19:35hiredmanirish
19:43RSchulzIs that so?
20:17gphow is clojure for imagemanipulation? anyone tried fjui or fiji ir what its name is? is it fast? does it take advantage of multiple cores?
20:55francois_Hi all!
20:56francois_I have an imperative question :)
20:56francois_Regarding this code (it doesn't work at the moment): http://gist.github.com/35596
20:57francois_This is the main processing loop for receiving forms on stdin (a socket, but who cares :)) and building an RPN calculator
20:57francois_So, anyway, the forms are received, and I can reliably process them
20:57francois_Except, how do I recurse with the new stack sequence?
20:59hiredman(recur (conj stack new-thing))
20:59francois_But, can't I do that only from the end of the loop?
20:59francois_I can't do it on line 8, where I detect that I found a number
21:00francois_I thought of introducing a local that I'd modify, and I would then recurse on that
21:00francois_I'm thinking that I should abstract the processing into a new function, and let the return value of that function be the new stack
21:00francois_I would then detect quit and syntax errors using exceptions
21:00francois_What do you think?
21:01hiredmanI would move everything into the (cond ...) form
21:01francois_Let me try that
21:01hiredmanand if it is a number (recur ...)
21:01hiredmanif not do other sutff
21:03gnuvince_francois_: you from Montreal (or around)?
21:03francois_@hiredman: it works!
21:04francois_Here's the new version: http://gist.github.com/35596
21:04francois_@gnuvince_ I'm from Sherbrooke
21:04francois_I visit Montreal pretty regularly
21:04francois_gnuvince_: And you?
21:04gnuvince_francois_: one hour west of Montreal; small village in Soulanges
21:05francois_Can't say I ever heard of it :)
21:05gnuvince_Highway 20W, exit 9.
21:06francois_I'm 2 hours east of Montreal
21:06gnuvince_Nice to see fellow Quebecers
21:06francois_Yeah
21:07francois_BTW, why do I often see messages like this? Exception in thread "main" java.lang.IllegalArgumentException: No matching method found: println for class java.io.PrintWriter (rpn.clj:0)
21:07francois_I guess this is found at compile time, rather than execution time
21:07francois_That's why the line number would be 0?
21:08gnuvince_francois_: what do you do?
21:09francois_I'm a Ruby on Rails developer by trade
21:09francois_I work with GiraffeSoft, a Montreal-based company
21:09gnuvince_Never heard of them...
21:09francois_We consult, but we plan on building our own applications soon enough
21:09francois_Sell products instead of consulting gigs
21:09francois_I'm the lead developer on http://xlsuite.com/
21:10gnuvince_Cool; I do Django development
21:10francois_Great! A Python developer!
21:10gnuvince_Yeah :)
21:10francois_Do you know about Montreal Python?
21:10gnuvince_No; is that a user group?
21:10francois_Yes
21:11gnuvince_ok
21:11francois_They meet in the same room the Montreal on Rails (now Montreal.rb) group meets in
21:11francois_I'd have to ask when's the next meeting
21:11gnuvince_I did some Ruby and Rails a few years ago.
21:11gnuvince_Even wrote a tutorial for Rails 0.7 and 0.8
21:11francois_Wow!
21:12francois_You started even earlier than I did
21:12gnuvince_http://wiki.rubyonrails.org/rails/pages/TodoListTutorial
21:12gnuvince_That was a long time ago though
21:12francois_I deployed http://weputuplights.com/ (what eventually became XLsuite) on Rails 0.12
21:12francois_Last time I did Python was when I was active in the Subversion dev community
21:13gnuvince_These days, I'm more into Haskell and Clojure.
21:13francois_Just fell in the Clojure soup
21:13gnuvince_(In my free times I mean)
21:13francois_I rather like what I'm seeing
21:13gnuvince_Clojure is awesome.
21:13francois_I made an REPL through a socket in about 45 minutes
21:14francois_I was pretty impressed
21:14gnuvince_All the goodness of Lisp plus the immutability stuff of Haskell without all the restrictions with the gigantic library of Java.
21:14francois_:)
21:14francois_Yes, I like that
21:14francois_I'm also discovering JRuby at the same time, so it looks like the JVM's winning me back
21:15francois_I did a lot of Java coding a couple of years ago, before I met Ruby
21:15gnuvince_I never did any Java
21:15gnuvince_Thankfully :)
21:15francois_Ah!
21:15francois_Syntax is verbose, but the JVM itself is very good
21:16bradbevshould there be any real difference between these functions? (defn spawn [f]
21:16bradbev (. (Thread. f) start))
21:16bradbev(defn spawn [f]
21:16bradbev (send-off (agent nil) (fn[a] f)))
21:16bradbev(lisppaste still broken?)
21:16gnuvince_francois_: that's pretty much the philosophy of Clojure; good platform, bad language
21:18francois_K, gotta run
21:18francois_@hiredman: thanks again for your help
21:19bradbevIf it makes a difference, spawn is being called from an agent that was started with send-off. I expect no difference, but the function using send-off doesn't appear to actually get started properly
21:23hiredmanuh
21:24hiredmanyou may want to (f)
21:24hiredmanif f is a func
21:25bradbevno, it's not a syntax problem. I have an agent that listens on a socket for data, and it gets a lot of data. I want another thread to draw the gui periodically
21:26bradbevI use spawn for the gui-redraw - but the send-off version doesn't actually ever get a chance to run because the socket thread is practically a busy spin loop
21:26hiredmanuh, if you are passing a function to that function it is a syntax problem
21:27hiredmanit wi;; never run
21:27bradbevsorry, you're right
21:27bradbevbut my problem remains - I'd just written that now to illustrate
21:28bradbevwhen socket data stops arriving the send-off version will actually update
21:29bradbevso is there some difference between creating a new thread & using one from a thread pool like send-off does?
21:29hiredmandunno
21:29bradbevme either :(
21:29hiredmanis your socket thread also doing send-offs like that?
21:31bradbevno. There is a server socket that send-offs the socket handler. When the socket handler gets an "init" command it spawns the render loop.
21:33hiredmansend-offs from within a running agent are held until the agent completes
21:33hiredmanmaybe that has something to do with it?
21:39bradbevoh
21:39bradbevthat very well could be the problem
21:39bradbevI did not know that
22:35gnuvince_Anyone knows how to have timeouts in Java for sockets? My comics script tries to access PBF Comics, but the site is down. I'm trying to figure out how to skip over a site after a certain amount of time.
22:37gnuvince_Found it
22:38gnuvince_(System/setProperty "sun.net.client.defaultConnectTimeout", "5000")
22:42dmiles (System/setProperty "sun.net.client.defaultConnectTimeout", "5000") == (.setProperty System "sun.net.client.defaultConnectTimeout", "5000") ?
22:43Chouserno, the latter won't work anymore.
22:44hiredmanclojurebot: latest?
22:44clojurebotlatest is 1159
22:44hiredmanclojurebot: svn rev 1159
22:44clojurebotsvn is https://clojure.svn.sourceforge.net/svnroot/clojure/
22:44Chousersvn rev 1159
22:44hiredmansvn rev 1159
22:44clojurebotsvn rev 1159; proxy perf tweaks Note breaking change if you are using the proxy interface other than the proxy macro itself - proxy maps are now maps of (preferably interned) strings to fns, not symbols to fns, and if you construct a proxy manually you must establish initial map with init-proxy
22:44clojurebotsvn rev 1159; proxy perf tweaks Note breaking change if you are using the proxy interface other than the proxy macro itself - proxy maps are now maps of (preferably interned) strings to fns, not symbols to fns, and if you construct a proxy manually you must establish initial map with init-proxy
22:45hiredmanwhoops
22:45Chouser:-)
22:45dmilesoops ;P .. i am trying to make a lisp dispatch reader macro that can convert Clojure forms to jcall/jstatic/jclass/jfield forms.. someone have one laying around?
22:47dmilesthis is still suposed to work? (.. System (getProperties) (get "os.name"))
22:47Chousernot anymore
22:47Chousersvn rev 1158
22:47clojurebotsvn rev 1158; force instance member interpretation of (.method ClassName), e.g. (.getMethods String) works
22:48Chouserhm, anyway, you need Classname/staticMethod now
22:49dmilesand (Classname/instanceMethod instancevar arg1 arg2) ?
22:49Chouserno, (.instanceMethod instance arg1 arg2)
22:49dmilesoh so its just for statics.. right on.. i like that partial disabiguaty
22:52dmiles(. instance-expr member-symbol) for instance fields?
22:52ChouserI think that still works, but (.member instance) is still preferred.
22:54mmcgranai have some NaN
22:55mmcgranapopping up in some numerical Clojure code I have, but I have no idea from where: are there any ops besides eg (Math/sqrt -2) that would return NaN?
23:03durka0/0?
23:04mmcgranaraises ArithmeticException
23:04mmcgranaat least in repl
23:04durkawith ints yes
23:05durkabut apparently the behavior is different for floats
23:05mmcgranauser=> (/ (float 0) (float 0)) NaN
23:05mmcgranahmmm
23:08mmcgranaas it happens i don't have any calls to / in my program (or (float x) for that matter); i guess i'll keep poking around
23:11asbjxrnAnyone using slime and jswat?
23:12asbjxrnI'd like to get exceptions trapped in jswat, but it looks like slime grabs them first.
23:22rhickeyChouser: (.. System (getProperties) (get "os.name")) still works, only (.instanceMethod classname ...) was changed to force class instance
23:25dmilesrhickey: ah.
23:28dmileshow do i change the search thru packages for System/getProperties Math/PI .. assuming it first search in java.lang.*;
23:33dmilesnot (import '(java.util ) ) ?
23:33hiredmanwhat?
23:34hiredmanyou have to import specific classes
23:34hiredman(import '(java.util someclass))
23:34dmilesdid i have to import java.lang.Math and java.lang.System .. or did those come for free?
23:35hiredmanyou have to import everything other then stuff in java.lang
23:36hiredmanjava.lang.Math and java.lang.System are sperate packages from javalang
23:36dmilesok makes sense
23:48Chouserrhickey: I keep findind more opportunities to use PersistentQueue (legitimitely, I think)
23:49Chouserfinding
23:51gnuvince_Any idea why when I add a Java lib with add-classpath in SLIME and then I C-c C-c a source file, I get a message that the lib I just included isn't found?
23:51hiredmanadd-classpath is lame
23:52gnuvince_What's the alternative?
23:52hiredmanat start up slime adds all jars in ~/.clojure to the cp
23:53gnuvince_There's no temporary way?
23:54hiredmannot that I am aware of
23:54gnuvince_So what does it look like the ~/.clojure?
23:54hiredmanits a directory where you put jars
23:54gnuvince_plain old /home/foo/baz.jar?
23:55gnuvince_oh
23:55gnuvince_it's a directory
23:55gnuvince_fuck