#clojure logs

2008-12-14

00:18gnuvince_Don't you hate it when you get a NO_SOURCE_FILE:0 error?
00:18mmcgranaare you not using repl-ln?
00:18gnuvince_no
00:19mmcgrananot not using it or not using it? lol
00:19gnuvince_Not using it.
00:20mmcgranawell just remember that the regular repl doesn't feed line numbers to the compiler. hence an error in code entered in the repl has that message. repl-ln is very nice you should try it
00:23gnuvince_k
00:23mmcgrana1:3 user=> (max) java.lang.IllegalArgumentException: Wrong number of args passed to: core$max (repl-1:3)
00:24mmcgranajust so you can see what the repl line numbering looks like
00:25gnuvince_Does that tell where the error occured in the file that was required?
00:27mmcgranaif there error was in another file it should show up as such in the regular repl anyways. you might have an error in the declaration getting those resorces. happens to me alot with (ns and all the (:use and (:import stuff etc.
00:27gnuvince_bleh
00:27gnuvince_=> (fetch-comic (first *comics*))
00:27gnuvince_java.lang.NullPointerException (repl-1:7)
00:28mmcgranatry (first *comics*)
00:28gnuvince_1:8 net.gnuvince.comics=> (first *comics*)
00:28gnuvince_{:prefix "", :regex #"http://abstrusegoose.com/strips/.+?\.(?:jpg|gif|png)", :url "http://abstrusegoose.com/", :name "Abstruse Goose"}
00:29mmcgranahmm, and line 7 is the line you invoked the call from, so not helpful?
00:29gnuvince_The error is somewhere in fetch-comic
00:29gnuvince_I'd really love to know *which* line
00:31mmcgranaoic. well im not positive but i think that with clojure it only puts line numbers for the entire fn in the bytecodes. now often you have nested fns with e.g. #(foo %) and (fn [] (foo)) but otherwise i dont think there is anything we can do
00:31mmcgranaexcept look at fetch-comic and think about it deeply
00:31mmcgrana):
00:33gnuvince_Which is code I don't really care to look at, cause it's a bunch of Java stuff :-/
00:33gnuvince_(proxy and stuff like that)
00:34mmcgranahttp?
00:34gnuvince_yeah
00:34mmcgranai've actually been working on an http lib
00:34gnuvince_It's more HTML parsing actually.
00:34mmcgranaoic. need hpricot port (:
00:34gnuvince_something like that
00:35mmcgranaits still on my list. i'll have a month off over january to pound out some serious clojure code
00:37gnuvince_I dislike Java's handling of namespaces
00:37gnuvince_with all that org.bar.whatever business
00:38zakwilsonIsn't that just a convention?
00:38gnuvince_zakwilson: don't you need to declare your namespace name exactly as the directory structure?
00:39gnuvince_like net/gnuvince/comics.clj needs to be (ns 'net.gnuvince.comics)?
00:39zakwilsonI think you do. I didn't understand exactly what you didn't like.
00:39mmcgranaright, the convention part is the choice of net.gnuvince.comics
00:40gnuvince_That's a part of Clojure I really don't understand well
00:41zakwilsonI can see the benefit - it means the locations of things will be very predictable.
00:43gnuvince_I guess I'll need to dish out the cash to get an early beta of Stu's book.
00:54Chousernew chart: http://clojure.googlegroups.com/web/chart.png
00:54Chouserdiamonds are non-clojure classes
00:54Chouserinterfaces, actually.
00:56mmcgranaChouser: very nice, thanks
00:56Chouseryou're welcome!
00:56ChouserI'll put the code up somewhere tomorrow. But for now, bed...
06:27Lau_of_DKGood afternoon gents
06:27bOR_and to you.
09:09RSchulzclojurebot: svn?
09:09clojurebotsvn is https://clojure.svn.sourceforge.net/svnroot/clojure/
09:09RSchulzclojurebot: latest?
09:09clojurebotlatest is 1159
09:09RSchulzclojurebot: contrib?
09:09clojurebotcontrib is http://sourceforge.net/projects/clojure-contrib/
09:09RSchulzclojurebot: contrib latest?
09:09clojurebotcontrib is http://sourceforge.net/projects/clojure-contrib/
09:35ChouserRSchulz: http://clojure.googlegroups.com/web/chart.png
09:36RSchulzNew one?
09:36Chouseryep.
09:36RSchulzWhat are diamonds?
09:36Chousernon-clojure classes
09:36Chouserit it better or too crowded now?
09:37RSchulzI strongly prefer being able to fit it on one page, so no, not too crowded. You should post the code somewhere, too.
09:37RSchulzCan DOT produce SVG output?
09:37Chouseryeah, working on that.
09:38Chouseryep
09:38Chouserthat .png is actually dot->svg->inkscape->png
09:38RSchulzIs there something about that route that's preferable to getting PNG directly from dot?
09:39RSchulzAnyway, I like it.
09:39RSchulzI still think it deserves the caption: "What a tangled web we weave..."
09:39Chouseryes, I think the text layout looks better
09:40RSchulzDiagmonds are interfaces?
09:40RSchulzYou're a Linux user?
09:40Chouserdiamonds are standard Java interfaces. everything in an oval is in clojure.lang
09:41Chouseryep
09:41RSchulzThe Obj / IObj stuff is a recent addition? I don't remember seeing that before.
09:42RSchulzThis is one of the few times I wish I had a color printer.
09:42RSchulzI like the inclusion of the built-in predicates for those types that have them.
09:43RSchulzHow long have you been doing FP?
10:34duck1123Chouser: is it possible to get the SVG version of that chart?
10:52RSchulzChouser: +1 for duck1123's request; Also...
10:53RSchulzDid you have to manually alter the DOT's layout in Inkskape?
12:17replacaQ: Can the reader read hex constants a la #x1FC in common lisp?
12:26kotarakreplaca: I think so.
12:26kotarakJust x1fc should be fine.
12:27replacaahh, let me try
12:27kotarakNo.
12:27rhickeyuser=> 0x1cf
12:27rhickey463
12:27kotarakYou need a zero
12:27kotarakAh. right Rich was faster
12:27replacayup, otherwise it's a symbol
12:28replacathanks rich, sorry to bother with uch a mindane Q, but I wasn't seeing it in the doc
12:28replaca*uch => such
12:29replacaargh typos! still on the first cup of coffee :-)
13:02RSchulzQ: Can (declare ...)-ed names be (defn- ...)-ed? That is, will (declare ...) work for private defns?
13:08ChousukeRSchulz: I think private defs differ from regular ones only by having the :private metadata key set to true, so I don't see why that wouldn't work
13:09RSchulzOK. I figured it should, but wanted to check.
13:09RSchulzMany years of C and a few of C++ have made me wary of learning a language through empirical observation...
13:46RSchulzIs there a way to get struct keys from a struct basis? (keys (create-struct ...)) fails with "IllegalArgumentException: Don't know how to create ISeq from: Def"
13:56RSchulzclojurebot: 1159
13:56clojurebotGabh mo leithsc�al?
13:57RSchulzclojurebot: svn 1159
13:57clojurebotsvn is https://clojure.svn.sourceforge.net/svnroot/clojure/
13:57RSchulzclojurebot: 1159?
13:57clojurebotGabh mo leithsc�al?
13:57mehrheitsvn rev 1159
13:57clojurebotsvn 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
13:59RSchulzmehrheit: Thank you!
14:38ChouserRSchulz: (.get (first (.getDeclaredFields (class x))) x)
14:38ChouserBut of course that's not really supported.
14:38RSchulzWhat is it?
14:39RSchulzOh, the struct question.
14:39Chouseryeah
14:39RSchulzDo you think it's something that should be supported? I'm trying not to have to replicate the set of struct keys in the code.
14:39RSchulzTo avoid the possibility of them being out-of-sync.
14:40Chouserdepends on why you need them, I suppose.
14:40RSchulzIt's something I always like to do. It's sort of like a kind of normalization for source code.
14:40danm_Chouser: print-dup doesn't seem to work with PersistentStructMap, is that intended?
14:41rhickeydanm_: struct maps aren't serializable yet
14:41danm_rhickey: yeah, figured as much looking through the code
14:41danm_thanks
14:42ChouserRSchulz: I agree you don't want to repeat yourself
14:43rhickeyclojurebot: faq #1
14:43clojurebotExcuse me?
14:43rhickeyclojurebot: FAQ #1
14:43clojurebotFAQ #1 is http://groups.google.com/group/clojure/msg/8fc6f0e9a5800e4b
14:44ChouserRSchulz: though you could (def sk [:a :b :c]) (def s (apply create-struct sk))
14:44RSchulzYes, I thought of that.
14:44RSchulzIt's still cleaner to create the struct basis and have that be the locus of all information about that struct.
14:44ChouserRSchulz: the question is why your program wants to treat the included keys differently from the others.
14:45RSchulzIt's the reverse, I want to have separate processing for the onese that are _not_ in the struct basis.
14:46ChouserRSchulz: ok, but what and why?
14:46Chousermy point is that it's a bit of an implementation detail, at least right now.
14:46RSchulzDoes it really matter? I'd have explain a lot of what I'm doing.
14:47RSchulzIt's certainly not an implementation detail to know what keys comprise a struct basis, is it?
14:47RSchulzIn a dynamic language?
14:47rhickeymoving to EPL - prefer: http://opensource.org/licenses/eclipse-1.0.php or http://www.eclipse.org/org/documents/epl-v10.html as the license URL, i.e. does opensource.org add any value?
14:49rsynnottrhickey: probably doesn't make much difference
14:49rsynnottwhat license is it at the moment?
14:49rhickeyCPL
14:49rsynnottah
14:50rsynnottwhy're you changing?
14:50rhickeyEPL is successor to CPL, acceptable to Google Code and others
14:51rsynnottah, right
15:01ChouserRSchulz: I didn't make any changes to the graph in inkscape, though perhaps adding a legend would good.
15:04clojurebotsvn rev 1160; Moved to Eclipse Public License - see epl-v10.html or http://opensource.org/licenses/eclipse-1.0.php
15:06rhickeyChouser: getting ready to move to google code - have created clojure and clojure-contrib projects there
15:06rhickeyChouser: Do you have a Google Code account?
15:07rhickeyAlso any other contib members here?
15:09Chouserrhickey: yep, username chouser
15:09rhickeychouser@gmail.com?
15:09Chouseryes.
15:20RSchulzrhickey: Does this mean you're vacating the SourceForge project?
15:21rhickeyRSchulz: there are several steps involved - still looking into what it takes to move the code, which is all that is left as SF
15:21rhickeyat SF
15:21RSchulzThere are advantages to hosting at Google Code?
15:22rhickeyRSchulz: hopefully more usable issue tracking and wiki
15:22RSchulzAh. It's true SF's bug tracking and forum interfaces are pretty bad.
15:24rhickeyright, google group replaces forums, I pay for wikispaces rather than deal with SF's subframing of it, and SF's issue tracking is awful
15:26RSchulzDoes this entail switching to Git?
15:27RSchulzUh... Not mercurial, either, right? In other words, sticking with Subversion?
16:27gpanyoen could link me to monads in clojure?
16:29Chouserdid you search on the google group? they come up there from time to time.
16:29gpon my way
16:30jcritesI didn't know Clojure had a monad representation .... gp send me a link if you find something :)
16:30gprhickey: could there be made some sort of optimization or auto-parallellism with macros+monads in clojure?
16:30rhickeyhttp://groups.google.com/group/clojure/browse_thread/thread/9581bf66eb01ca56/8b8f03bcd5854164?lnk=gst&q=monads#8b8f03bcd5854164
16:34Lau_of_DKEvening gentlement
16:34Lau_of_DK-t
16:34Lau_of_DK:)
16:35danm_hello
16:56gp((comp map filter) #(* % %) #(< % 5) [1 2 3 4 5 6 7 8 9])
16:57gpwrong number of args, ok but how do i write it then?
16:58Lau_of_DK(doc comp)
16:58clojurebotTakes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc.; arglists ([& fs])
16:58Lau_of_DKI havent used that function before, bt it says that its return is a function
16:59Lau_of_DKSo wouldnt it be (map (comp #(* % %) #(< % 5)) [1 2 3 4]) ?
17:02kotarak(map #(* % %) (filter #(< % 5) [1 2 3 4]))
17:04kotarak((comp #(* % %) #(< % 5)) 2) => (< 2 5) is true => (* true true) => ?
17:10Chousukegp: ((comp (partial map #(* % %)) (partial filter #(< % 5))) [1 2 3 4 5 6 7 8]) works but you'll really want just (map #(* % %) (filter #(< % 5) [1 2 3 4 5 6 7]))
17:13Chousukeor at least give the component functions names before composing :)
17:30alphazerohi all, have a question regarding http://paste.lisp.org/display/72155
17:31alphazerotest.Foo.doX() simply does a stack trace. first version seems to be basically to the metal, but the variant that calls a method on the instance later is using reflection. Why is that?
17:48wipewindowsi successfully send the message but the
17:48wipewindowscan someone explain to me how do use agents there?
17:48wipewindowshttp://hpaste.org/13078
17:48wipewindowsi successfully send the message but it doesnt seem to get updated.
18:03Chouseralphazero: since locals are immutable, Clojure can apparently infer that your first 'a' will always be a test.Foo
18:03Chouseralphazero: but that may not be a valid assumption for (def a ...)
18:04Chouseryou should be able to type hint, to avoid the reflection though: (def #^test.Foo a (new test.Foo))
18:08wipewindowswould it be possible to write a macro that tags types to a function?
18:09wipewindowsusing :inline will that inline it as java code or what des that mean?
18:23Chousersure, you can emit metadata-related code from macros
18:24Chouserthe :inline stuff essentially allows you to create a function that in some cases can expand into inline clojure like a macro does
18:25Chouserinline in clojure means inline in the generate java bytecode, which I suppose can allow HotSpot to do better optimization.
18:43alphazeroChouser: thanks. let me try that and see.
18:45alphazeroChouser: that did it. Thanks.
18:51RSchulzQ: If I have a Java Iterator, how can I iterate over the values it yields?
18:52RSchulzuser=> (doseq [erec (.iterateErrors psl-all-proc)] (println erec))
18:52RSchulzjava.lang.IllegalArgumentException: Don't know how to create ISeq from: Itr
18:52danm_RSchulz: iterate?
18:53RSchulzSee above...
18:53danm_mmm, sorry
18:53RSchulzIterator<ErrorRecord> iterateErrors()
18:53RSchulz Iterate over recorded ErrorRecords.
18:53blackdogtry putting a seq round it?
18:53RSchulzI did that. Exact same diagnostic from Clojure.
18:55danm_yeah, the sequence functions call seq for you afaik
18:56RSchulzAlso...
18:56RSchulzuser=> (.iterateErrors psl-all-proc)
18:56RSchulz#<Itr java.util.AbstractList$Itr@195dd5b>
18:58danm_I guess only collections are seq-able
18:58RSchulzOK. Flipping it around, what _can_ we do with Java Iterator instances?
18:59danm_well, anything you can do in java ;)
18:59hiredmanthere is a function that makes seqs out of iterators
18:59hiredman(doc iterator-seq)
18:59clojurebotReturns a seq on a java.util.Iterator. Note that most collections providing iterators implement Iterable and thus support seq directly.; arglists ([iter])
18:59danm_cool
18:59RSchulzYeah. I just found that.
19:00RSchulzSo anything Iterable is directly useable as a seq but not a naked Iterator?
19:00RSchulzI once asked on the Advanced-Java list why Iterators weren't themselves Iterable.
19:00hiredmanthats how it reads to me
19:00RSchulzBut it's moot, of course. They are what they are. I wrote my own IterableIterator class to wrap aribtrary iterators and make them Iterable.
19:01hiredmanheh
19:01RSchulzThis particular class's iterator-generating function must have pre-dated the inception of that class.
19:01hiredmancute
19:02RSchulzGod, I love writing my own software. Got a problem with your API? Enhance it!
19:02ChousukeI guess an iterator itself is not iterable... but still, it sounds a bit weird
19:03RSchulzChousuke: It definitely is not.
19:04RSchulzAnd just like that, problem solved!
19:04Chousukelooks like the iterator interface only specifies the "iterator" function... could be confusing to have iterators return themselves I suppose :/
19:07rhickey(doc iterator-seq)
19:07clojurebotReturns a seq on a java.util.Iterator. Note that most collections providing iterators implement Iterable and thus support seq directly.; arglists ([iter])
19:10slanganoctave has a c++ api, does that mean i have to write c++ -> java -> clojure?
19:15RSchulzYou don't _have to_ do anything, of course.
19:15rhickeyhttps://jna.dev.java.net/
19:16rhickeyPeople have done JNA directly from Clojure
19:27aperottehello all, I've posted about this before, but I've been trying for a little while and I for some reason really can't get the new gen-class to work well, was wondering if someone could help me out
19:27aperotteMore specifically I don't really understand how exposes works
19:29aperotteI am exposing an ancestral protected member, but after compiling, I can only call the public getter from the instance (not from the class) and also it returns nil instead of the thing I was expecting it to get
19:33rhickeyaperotte: can you paste something?
19:34RSchulzIs it possible to call void (-returning) methods of Java classes?
19:34aperotterhickey: sure, give me a second
19:37phfis it possible to extract source location information from java side?
19:38rhickeyphf: you can call any Clojure fn from Java
19:39rhickeyget vars with RT.var("ns","name");
19:39rhickeycall them with invoke()
19:41whiddenchanges in 1160 just the move to eclipse public license?
19:42rhickeywhidden: yes
19:44whiddenrhickey: Thanks, saw all the updates and was now sure what was happening :)
19:46phfrhickey: sorry, i wasn't at all clear. i meant, is it possible to get the source file location for a java class at run time
19:46phffor jumping to source in slime
19:46phfapparently not (or only using heuristics anyway)
19:47rhickeyphf: ah, that's a debugger thing I think
19:48phfoh, yeah, that's a good idea
19:50RSchulzWhat determines argument compatibility in calling Java methods? I've got a call that appears to be valid, but is eliciting this:
19:50RSchulzjava.lang.IllegalArgumentException: No matching method found: printMessage for class rrs.util.ErrorRecord
19:50RSchulzThe method in question "returns" void.
19:51rhickeyRSchulz: the return value is irrelevant for matching - is the method overloaded?
19:51RSchulzYes. Two different kinds of output sinks.
19:51RSchulzPrintStream and PrintWriter. I'm calling it with *out* (the default one)
19:52RSchulzIt's also overrided for different arities.
19:52rhickeyuser=> (supers (class *out*))
19:52rhickey#{java.io.Writer java.io.Closeable java.lang.Object java.lang.Appendable java.io.Flushable}
19:52rhickey*out* is neither of those
19:53RSchulzGagh. Why not?
19:53RSchulzWhy isn't it System.out?
19:53rhickeyuser=> (class *out*)
19:53rhickeyjava.io.OutputStreamWriter
19:55RSchulzBut why is it not simpley equal to java.lang.System/out?
19:57RSchulz???
19:58RSchulzrhickey: I'd really like to know why *out* is distinct both in value and type from System.out?
19:59aperotterhickey: paste.lisp.org worked without the channel. Here's my paste, http://paste.lisp.org/display/72170
20:00rhickeyRSchulz: printing is defined in terms of Writers, which are more useful and avalable than PrintStreams - note how few subclasses of PrintStream there are
20:01RSchulzMore useful is pretty subjective. I'm fine with it being a PrintWriter, but a mere Writer? Could you make it a PrintWriter?
20:17rhickeyRSchulz: why don't you bring it up on the group? - I know there were some issues with charsets
20:17RSchulzOK. I'll send out a short message on the issue.
20:18RSchulzHuh. I just noticed this:
20:18RSchulzuser=> *err*
20:18RSchulz#<PrintWriter java.io.PrintWriter@6397eb>
20:24aperotterhickey: I need to reboot, I'll brb
20:31aperotterhickey: you have any thoughts on what I might be doing wrong?
20:48wipewindowsrhickey: was that for me before? could I somehow call a C++ API from Clojure you mean?
20:50Chouserwipewindows: http://groups.google.com/group/clojure/browse_thread/thread/77e626c5440bf1a0
20:59aperotterhickey: I have to run, but thanks for offering to help
21:00RSchulzaperotte: I had the same problem with paste.lisp.org yesterday. If I selected #clojure as the channel, my paste just disappeared. Only when I did not select a channel (as Rich suggested) was I able to get the paste recorded.
21:01aperotteRSchulz: I'm not sure what's going on with it, it doesn't seem to be affecting all of the channels
21:02RSchulzI only tried #clojure, though I did that a couple of times. But it was also the case that the whole site appeared to be having serious problems at the time I was trying to use it. One time I got a 502 error.
21:04rhickeyaperotte: :exposes doesn't handle static fields as static getters/setters, probably should
21:06aperotterhickey: oh ok, thanks! I'm still unsure what was going wrong with the first thing I tried to expose there. Do I need to specify in the methods the return type of the public getter?
21:08aperotterhickey: sadly, I really have to go, thanks again
21:08rhickeyaperotte: no - it will match the type of the field
21:09aperotterhickey: ok, I'll try again
21:22phfstarting a jvm with a remote debugger and then recursively connecting from the inside allows for all sorts of introspection capabilities
21:22phffor example, to answer my original question
21:22phf(.sourcePath (.location (.concreteMethodByName (first (.classesByName vm (.getName (class [1 2 3])))) "count" "()I")))
21:23phfreturns "clojure/lang/LazilyPersistentVector.java"
21:23rhickeyphf: fun
21:28durkaRSchulz: is it not sufficient to do (def *pout* (PrintWriter. *out*)) ?
21:29RSchulzFlushing?
21:30durkahmm?
21:30RSchulzWhat is Clojure trying to tell me with this diagnostic:
21:30RSchulzCan't embed object in code, maybe print-dup not defined: clojure.lang.LispReader$Unquote@5d391d
21:32RSchulzdurka: If you wrap one I/O object around another, you get into trouble when multiple sources do not always flush after writing. And flushing excessively can be a detriment to good I/O performance.
21:32rhickeyRSchulz: you've got an unquote outside of a syntax-quote?
21:32durkai see
21:32durkathat's a pain
21:34RSchulzrhickey: I don't think so, but I'll look more closely.
21:35RSchulzAh. That's it. Yet Another Copy-and-Paste Error.
23:08yangsxhi, if my clojure-contrib.jar was updated after slime/swank, how can I force swank to reload it?