#clojure logs

2009-10-23

00:28Licenser_somnium: I see forward to your driver :P I'm curiose about it
00:29somniumLicenser_: its 90% done, doing the build.xml will likely be the most unpleasant part :)
00:31Licenser_since you mentioned mongodb earlyer I decided to use it for my next (current) project
00:34somniumI'm very impressed with it, schema-less storage plus ad-hoc queries
00:36Licenser_even having some relations, it seems not too bad to query with all data stored in teh documents
00:37Licenser_and the group queries make it nice to even ask the DB about every of the sub elements, with a link to their parents (since at least I usually require then right ahead too)
00:37somniumyes, in some cases you don't even need relations, comments just become an attached array
00:38Licenser_*nods* I find that kind of sweet
00:41somniumthere seems to be some good ruby/python drivers for it too, though I haven't tried them
00:41Licenser_yea if this works out I might think about using it in ruby too
00:42Licenser_hmm creating a static map of 1000x1000 fields takes qite some time so :P
00:42somnium?
00:42Licenser_for(var x=1; x <= 1000; x++) for(var y=1; y <=1000; y++) db.map.save({x: x, y: y, type: 255});
00:42Licenser_that takes some time
00:43somniumyou can do mass inserts you know
00:43somniumthat's 1000 * 1000 function calls vs. 1 :)
00:44Licenser_somnium: too easy :P technically I don't need the entire map from the beginnig it's empty anyway
00:44Licenser_but adding 3 fields and querieing over them is still somewhat fast
00:44Licenser_then again not having the entire map stored is way better
00:45Licenser_like only storing the interesting fields
00:48Licenser_yes not storing them is the better way
00:48Licenser_way better way
00:48Licenser_just have to make a few tricks when inserting/updating
00:49somniumit does require a different approach for validating data
00:49Licenser_and a different idea about storing data too
00:49Licenser_in a SQL table I'd just create 1000x1000 entries - I mean who cares :P
00:50Licenser_but if I want to search over an attribute in this data it kind of is slooow here
00:50somniumLicenser indexes!
00:51Licenser_yes yes, I'm thinking about it but I query over a hashmap not over a value :P
00:52Licenser_just rebuilding my huge db to see if that thing indexes well over that kind of data
00:52somnium? indexes go on keys
00:52Licenser_not sure, I'm finding it out now
00:53Licenser_my data looks like: {x: 300, y:42, type: 4, owner: {'name' : 'Licenser', id: 42}}
00:53Licenser_now I want to find 'all owerns' I do that by: db.map.group({key:{owner:true}, cond:{owner: { $exists : true }}, reduce: function(obj,prev) {prev.data.push(obj)}, initial: {data: []}});
00:53Licenser_which gives me a listof all owners and their map fields
00:53Licenser_just taks 400ms on a 1000x1000 map
00:54somniumah, you're using the shell?
00:54Licenser_yes
00:54Licenser_for testing out how to do things best :P
00:54Licenser_also your lib isn't done yet
00:54somniumnot everything in the shell is available in java yet :(
00:54somniumthough you can eval javascript in a pinch
00:54somniumits still very much in development
00:54somniumlots of features supposed to be in next release
00:55Licenser_oh crist, the index isn't what doing what I want :P
00:56Licenser_it seems you only can have one index which makes it kind of useless for my task
00:56Licenser_I can't index x,y (for fast queries on the position)
00:57Licenser_and the owner
00:57somniumcompound indices are possible
00:57somniumbut only one index used at a time AFAIK
00:57somniumso x, y, x && y I guess
00:57somniumprobably improvements coming in that area, its been coming up on the mailing list
00:57somniumbtw, if you like mongo I recommend the mailing list, its very active
00:58Licenser_sounds good
00:59Licenser_hmm indexing the owner does not help to query about it
01:00Licenser_that is very odd, I have the owner as index and the query still takes 300ms
01:01Licenser_well I'll take care of this later on, it's past 7 am so time to sleep
01:01somniumcheers
01:56piccolinoIs there some way to create a string as conjing repeatedly onto a stringseq?
02:06arsatikip: are you trying to build a string from characters or from shorter strings?
02:07piccolinoFrom characters.
02:08arsatikiAFAIK (which is not much, though) what you attempt is not possible
02:08arsatikithe java string is immutable, after all
02:09arsatikibut you can collect the chars into a seq and then (apply str ...)
02:09piccolinoOh, I didn't have a particular attachment to that particular way of doing it. I'm just needing to parse a string character by character into smaller chunks, and thought that it would be best to do it in term of seqs...
02:15piccolinoOK, I think I get what I basically wanted by conjing to a vector and then calling str on that.
02:15piccolinoThanks.
02:24hoeck1,(apply str (map identity (seq "abc"))
02:24clojurebotEOF while reading
02:24hoeck1,(apply str (map identity (seq "abc")))
02:24clojurebot"abc"
02:24hoeck1@piccolino ^^
02:25hoeck1piccolino: its not overly efficient, I guess, but it takes you at least somewhere before diving into java
02:26piccolinoI don't understand, doesn't this just turn the string into seq, return a seq of each character, and then turn that back into a string?
02:33slashus2hoeck1: Why are you mapping identity to it?
02:33hoeck1piccolino: yes, its just an example of working with seqs of characters
02:33slashus2, (apply str (seq "abc"))
02:33clojurebot"abc"
02:33hoeck1just to show it works
02:34piccolinoOh, I see.
02:35hoeck1piccolino: sorry if I misunderstood your actual question, I thought it was about building strings out of character seqs
02:36piccolinoOh, it was, I was just trying to do it character by character without having to reverse a list on the way.
02:37slashus2,(apply str (reverse "abc"))
02:37clojurebot"cba"
02:47piccolinoI have an even dumber question, which is how do I set the value of a variable during a loop?
02:49jdzpiccolino: your mind is full of destructive thoughts
02:50jdzpiccolino: you are not asking for what you want really. i'm pretty sure setting variables is not what you want.
02:50piccolinoAm I gonna have to whip out a transaction for setting a state boolean during a parsing loop?
02:51jdzpiccolino: why do you have a _state_ boolean in the first place?
02:52hoeck1piccolino: no, you use recur to mutate loop invariants
02:52piccolinoBecause I gotta do different things depending on whether or not I'm in something that's quoted.
02:52piccolinoOh.
02:53piccolinoWell that makes me kind of unhappy.
02:54slashus2piccolino: What exactly is the problem you are trying to solve?
02:54piccolinoParsing a CSV file.
02:54hoeck1piccolino: in java: for(int i=0, i<100, i++) {body}, in clojure: (loop [i 0] (when (< i 100) body (recur (inc i)))
02:55piccolinoYeah, but I've got to build up the vectors of row cells as I go, and that means every recur (of which there are several in the loop) is going to be like 5 or 6 lines each.
02:55hoeck1piccolino: you basically use a loop-recur form
02:55slashus2If you want to get the file-line by line you could use (line-seq on a reader.
02:56hoeck1and then loop throug each line identifying columns and conjing them onto a vec
02:56piccolinoI'm only working with the function that does a single line right now.
02:57slashus2(line-seq (java.io.BufferedReader. (java.io.FileReader. "test")))
02:57slashus2returns a lazy seq of file lines
03:01slashus2piccolino: Does that help?
03:09piccolinoYeah, I got that working. It looks bad to me, repeating all the state variables in every recur even if they shouldn't change. http://clojure.pastebin.com/m610e527c
03:10piccolinoAny style comments?
03:10piccolinoMaybe you can make me feel better about that.
03:12hoeck1piccolino: you can just use a single state var, which uses a keyword describing its state, like :start, :quoting etc
03:12slashus2I would probably split things into defn functions to make it more readable.
03:14piccolinoI don't understand that comment hoeck1... there's only quoting...
03:14slashus2Have you all ever embed a 3rd party applet into a swing program?
03:15hoeck1piccolino: ok, you're right, then using keywords makes no sense and a simple flag is appropriate
03:17arsatikipicc: it seems to me you could cut down the amount of code somewhat by using (let [current-char ... remaining-chars] (cond ..))
03:17arsatikiand perhaps that would allow you to see the bigger picture
03:18piccolinoI don't understand... those have to change each time through the loop..
03:21arsatikiright, there's that one case in the cond
03:21arsatikimissed that
03:34piccolinoWhat's the difference between require and use?
03:48hoeck1piccolino: require just loads the namespace, use puts all defined symbols of the used namespace in your current namespace
03:48piccolinoAh, OK, thanks.
03:54piccolinoI wonder why I can use clojure.contrib.str-utils2, but not clojure.contrib.test-is.
03:55liwpanyone here used fnparse?
03:57liwphow do I define a parser that matches a literal string? Can I just use (lit "foo")?
03:57liwpthe token stream is characters, so I thought maybe I can only use character literals and would have to define some sort of composite parser consisting of each literal char separately...
03:58ChousukeI think that's what you need to do.
03:58Chousukethere's lit-seq though, IIRC
03:59arsatikipiccolino: are you perhaps using a cutting edge clojure, where test-is is moved out of contrib and into clojure
03:59piccolinoI don't know, that's what doesn't make sense. In Github, test-is is still there, it just loads clojure.test. But that doesn't work. I also can't load clojure.test. So yeah, it's strange.
04:02arsatikip: This is a pure educated guess, but sounds like you have "old" clojure and "new" contrib
04:02liwpChousuke: thanks, I'll look into it. I had my first look at fnparse yesterday evening, so I haven't gotten very far yet
04:03piccolinoAh, that is a possibility. I was in here a week or so ago complaining that there is no numbered release of contrib.
04:04piccolinoI think that since I am using Slime right now, it might have pulled its own thing.
05:16G0SUBhmm, fuzzy completion works on the SLIME repl but not on Clojure files. any idea how to fix that?
05:17AWizzArdHow did you get fuzzy completion to work? :)
05:17G0SUBAWizzArd: well, I did nothing. I am using ESK.
05:18G0SUBAWizzArd: in fact, no completion works on a clojure buffer. only on the repl.
05:34liwpG0SUB: try M-tab for completion
05:34liwpor Esc-tab if alt-tab switches windows
05:35liwpit's bound to (slime-complete-symbol) by default in a slime-enabled clojure buffer
05:43G0SUBliwp: well, it doesn't work. I get this in *Messages* funcall: Synchronous Lisp Evaluation aborted
06:12liwpG0SUB: it definitely works for me. Have you updated slime / swank-clojure recently (I haven't)?
06:12liwpG0SUB: hmm, I didn't try fuzzy completion actually. Give me a minute.
06:13G0SUBliwp: fuzzy completion works fine on the repl. not on open files. there is must be some setting...
06:14liwpG0SUB: yeah, you're right. It's doesn't work in clojure buffers for me either. I don't really use it, so I haven't noticed before.
06:15G0SUBliwp: any idea how it can be fixed?
06:27liwpG0SUB: nope
06:28liwpis the completion function the same in both the repl and the buffer, i.e. is M-tab bound to the same functin?
06:28liwpseems to be: slime-complete-symbol
06:28liwpI don't really know how to fix that...
07:02AWizzArdrhickey: about deftype: the idea to have assoc/dissoc converting to clojure maps is good. Maybe this can be made configurable? Maybe deftype could take an arg that says if conversion can happen or if it will produce an error.
07:02AWizzArdAnd maybe one could get a warning when conversion happens, and that behaviour could also be turned off in an arg to deftype. Or would that make things too complicated?
07:04rhickeyAWizzArd: it's not a conversion. But yes, support will have to be configurable in some way else you couldn't use deftype to define PersistentMap (one of the objectives). So, at least, saying you implement Associative/ILookup etc will disable the automatically generated implementation
07:06AWizzArdOh, so you plan to make a deep use of deftype? I first thought that it is just for the enduser.. but interesting perspective!
07:07cgrandrhickey: that means you plan to keep most interfaces? For compatibility? interop? perfs? Or am I reading too much in one sentence?
07:07rhickeyAWizzArd: yes, I want to be able to write Clojure, and Clojure-like things, in Clojure
07:08AWizzArdi like this direction
07:09rhickeycgrand: I'm still working out the interface/protocol breakdown. I imagine many existing things will become both, mostly to reach to classes that can't implement new interfaces, but also working on making sure there is a good dynamic story
07:13rhickeythe trick is to make a smooth spectrum with tradeoffs between dynamics/flexibility and speed, without requiring architectural changes in an app
07:15rhickeybut the actual decisions about keeping particular interfaces will come later with cinc, not changing anything like that right now, just building the constructs we need
07:19djpowellrhickey: is there still a plan to rework IFn to support 4x (long, Object, double) parameters?
07:20rhickeydjpowell: yes, the idea stands there and stares at me, but must wait :)
07:21djpowellrhickey: cool. just wondered whether it was in the queue, or whether it had been scrapped for some reason.
07:22rhickeyfor instance, much more important is to get datatypes in play, then can use them (+ macros) to crank out e.g. persistent vectors of primitives (which would otherwise require painful code duplication in Java)
07:26djpowelldo datatypes + protocols interact with newnew at all? I haven't been following them
07:29djpowellprotocols are a higher level construct that are an alternative to interfaces?
08:19snowwhite07ping
08:21snowwhite07Is there any feedparser in clojure?
08:26snowwhite07cgrand, ?
08:27cgrandsnowwhite07: yes?
08:27snowwhite07cgrand, Is there any feedparser in clojure?
08:28cgrandhaven't heard of one -- you should try java stuff I guess
08:28snowwhite07cgrand, Thanks
08:28jdzsnowwhite07: isn't an XML parser enough?
08:29snowwhite07jdz, how are you suppose to parse feeds using XML parser?
08:29jdzsnowwhite07: are you talking about RSS feeds or paper feeds?
08:30cgrandjdz: it depends if you want to handle all formats and all malformed feeds (especially regarding raw html content) out there in the wild
08:30snowwhite07jdz, RSS feeds
08:41patricius_Are there something equal to enumerations in Clojure? If I have a function that takes an argument, which can be one of two values, would I use a keyword for those value? Contrived example (defn [lamp-state] (if (= lamp-state :on) (turn-on-lamp) (turn-off-lamp)))?
08:42patricius_Would I use keywords as enumeration values?
08:43AWizzArd,((get {:on #(println "Clojure")} :on #(println "lamp is off")))
08:43clojurebotClojure
08:43AWizzArd,((get {:on #(println "Clojure")} :off #(println "lamp is off")))
08:43clojurebotlamp is off
08:45patricius_Ok. Seems keywords are used in such scenarios. Thanks.
08:46snowwhite07jdz, clojure.xml/parse is enough to parse RSS feeds :)
08:46jdzsnowwhite07: according to cgrand only some of them
08:46jdzor, put another way, most of them
08:50snowwhite07jdz, hmm
09:13chousersnowwhite07: you might try using http://commons.apache.org/sandbox/feedparser/
09:14chouserthis kind of event-driven API is annoying but might be worth it if you want to handle faulty feeds.
09:15snowwhite07chouser, True Thanks
09:29G0SUBI am trying to use c.c.http.agent to download a zip file, but the file saved is always corrupt. wget works fine. any ideas?
09:29drewrG0SUB: code?
09:29G0SUBdrewr: just a sec.
09:30chouserG0SUB: are you on Windows?
09:31lisppaste8G0SUB pasted "HTTP Agent" at http://paste.lisp.org/display/89154
09:31G0SUBchouser: no. Ubuntu.
09:32chouseris the file size correct?
09:32G0SUBchouser: file size is wrong. (the server doesn't return the size in the response)
09:33chouserthe one your code saves out is too small?
09:33G0SUBchouser: it's actually larger than expected.
09:35vyThere is a page listing documentations of clojure-contrib packages. What was the URL?
09:35G0SUBvy: http://richhickey.github.com/clojure-contrib/
09:36vyG0SUB: How do I reach to that URL? I've been searching the web for half an hour.
09:37G0SUBchouser: any idea? is it because the server doesn't return the Length in the response?
09:37G0SUBvy: copy/paste the url on your browser?
09:38vyG0SUB: Huh?
09:38G0SUBvy: The URL is -> http://richhickey.github.com/clojure-contrib/
09:39chouserG0SUB: I don't know -- you've alrady ruled out the most common issues I've seen. Next I'd check to make sure it's not a character encoding thing, and then I'd try to hunt down some examples or Java help for the apache lib.
09:40vyG0SUB: I just wanted to say that the URL is not mentioned in the clojure.org and hard to find via googling.
09:41jdzG0SUB: reading/writing binary files as character data? ugh...
09:41G0SUBvy: yeah, unfortunate. may be it should be mentioned on the webpage.
09:41G0SUBjdz: suggest a better way please :)
09:42chouservy: "User contribs" in the top blue box at http://clojure.org/
09:44jdzG0SUB: just don't use Printers and Writers, use the binary equivalents
09:44jdz(output and input Streams)
09:59chouserwe're using google protocol buffer rpc interfaces from C++, Java, and Clojure. We can provide the cleanest usage in Clojure via macro. Next best is C++ (again, macros such as they are). Java has easily the most boilerplate and clumsy interaction.
10:03G0SUBjdz: I am new to Java. can you give me some pointers to reading/writing binary data?
10:04jdzG0SUB: http://java.sun.com/j2se/1.5.0/docs/api/java/io/OutputStream.html
10:04liwpG0SUB: as the main principle writers (and readers) deal with char data and outputsteams (and inputstreams) deal with binary data
10:05G0SUBliwp: anything in c.c that does that already?
10:05liwpdunno, probably something in duck-streams
10:07liwplooks like duck-streams specifically opens BufferedReader and PrintWriters, so it's doing exactly the wrong thing from your point of view
10:07G0SUBeww
10:08G0SUBliwp: I think duck-streams/writer can write to an outputstream
10:09liwpG0SUB: yeah, possibly
10:10liwphave you guys seen the cake on clojure.org - heh
10:11Licenserbah sometimes dynamic IP's from the ISP can be a pain ...
10:15AWizzArdDo we have users of clojure.contrib.sql here?
10:16AWizzArdI would like to know how to specify NULL for a ? placeholder in a prepared statement.
10:16AWizzArdnil doesn't work
10:17AWizzArdExample: (sql/with-connection *db-conn* (sql/with-query-results r ["SELECT ?" nil] (doall r)))
10:19djorkAWizzArd: what's the error
10:20AWizzArd"org.postgresql.util.PSQLException: FEHLER: konnte Datentyp von Parameter $1 nicht ermitteln" which means: couldn't find out the datatype of parameter $1
10:29chouserdoesn't SQL have special syntax for null, like "WHERE foo IS NULL" instead of =
10:31AWizzArdyes
10:31AWizzArdjust stumbled over this.. because "SELECT NULL" works
10:34LicenserAWizzArd: yes
10:35Licenserbut NULL is a constant, rather then a value as chouser said, why would you want to replace it with a ? and not put it directlyß
10:35Licenser?
10:35djorkLicenser: what if you wanted to compare a value in the database to a clojure value that might be nil?
10:37Licenserdjork: good question :P but what would be the expected result when you pass null?
10:38AWizzArdThat would require two queries, if you expect to have nil values in Clojure.
10:39AWizzArdFor non-nils you would compare using WHERE x=? and if you expect you could compare with nils then WHERE x IS NULL.
10:39Licenseror do evil magic things
10:39LicenserI think it would be possible to make =? become IS NULL when something is nil, question is if one wold want that
10:42AWizzArdyes, you can use cl-format which can do this
10:44Licenser(doc cl-format)
10:44clojurebot"clojure.contrib.pprint/cl-format;[[writer format-in & args]]; An implementation of a Common Lisp compatible format function. cl-format formats its arguments to an output stream or string based on the format control string given. It supports sophisticated formatting of structured data. Writer is an instance of java.io.Writer, true to output to *out* or nil to output to a string, format-in is the format control string and
10:45Licenser(+ 1 1)
10:45clojurebot2
10:45Licenserwow clojurebot works w/o the ,
10:45liwpthere's no stopping progress
10:46djork(and now we see if it evaluates every parenthetical mark)
10:46djorkneat
10:46liwppass
10:46rhickey(not)
10:46djork("Only the ones that evaluate)
10:46djorkoops
10:46djork("Only the ones that evaluate")
10:46djorkwhat's going on here :)
10:46liwp(not true)
10:47cgrand(+ "a")
10:47liwpmaybe it was a fluke...
10:47liwp(+ 1 2)
10:47clojurebot3
10:47Licenser('test')
10:47djork(inc 1)
10:47cgrand(str "test")
10:47Licenser(+ 'test' ' case')
10:47djorkapparently it's only for + :)
10:48Licenser(+ "test" " case")
10:48djork+ numbers
10:48Licenseryap
10:48cgrand(* 4 3)
10:48clojurebot*suffusion of yellow*
10:48Licenser(- 3 4)
10:48clojurebot-1
10:48Licenser(* 4 3)
10:48clojurebot*suffusion of yellow*
10:48LicenserSomeone likes douglas addams
10:48Licenser(* 3 3)
10:48clojurebot*suffusion of yellow*
10:49Licenserhrm
10:49Licenser(+ 4 1)
10:49clojurebot*suffusion of yellow*
10:49Licenserah nice :) I love it!
10:49Licenser,(+ 4 1)
10:49clojurebot5
10:52Licenser,(tan 74)
10:52clojurebotjava.lang.Exception: Unable to resolve symbol: tan in this context
10:52Licenser(. tan Math 74)
10:52Licenser,(. tan Math 74)
10:52clojurebotjava.lang.Exception: Unable to resolve symbol: tan in this context
10:52Licenser(.tan Math 74)
10:52liwpLicenser: tan is probably a static method
10:52liwp,(Math/tan 74)
10:52clojurebot-5.737022539278999
10:53Licenserah sneakzy!
10:53liwpbless you
10:53Licenser(- 0 100)
10:53clojurebot-100
10:54Licenserhah I found how to trick the calculator! And again it proves the feather is mighter then the sword, while wracking clojurebot with a sword has a apeal too
10:54Licenser(+ 0 (- 1 100))
10:55hiredmanthe specs on the i ching calculator merely state anything above 4 is represented as a suffusion of yellow
10:56LicenserI know hiredman hence why I tried negative numbers :P
10:56Licenser(red)
10:56Licenser(press red)
10:57Licensernot implementet awww
10:57Licenser(red-button)
10:57ankouhi, how do I overwrite the .toString method of a structmap? I tried to overload print-method and it almost works but I get "\"hi\"" instead of just "hi" and I don't know where these quotation marks come from
11:00hiredmanankou: are you using prn-str?
11:00ankouno
11:00hiredmanlets see the code
11:01ankouokay, are there any good clojure-supporting pastebins?
11:02liwp~paste
11:02clojurebotlisppaste8, url
11:02lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
11:02hiredmanlisppaste8: url
11:02lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
11:03lisppaste8ankou pasted "toString" at http://paste.lisp.org/display/89155
11:04ankouthere it is
11:05hiredmanuh
11:05hiredmansomething there doesn't seem right
11:06hiredmanfirst, don't call .toString
11:06ankouthen print-method is not what I'm looking for
11:06ankoubecause I want to pass the struct as an Object to a java class which calls .toString on it
11:09hiredman(.write writer (:name gm))
11:09ankouis there another way to "overwrite" toString?
11:09ankouah okay great
11:09ankouthanks
12:11mwoelkerrhickey: hi, what are the chances of an externally contributed patch for http://www.assembla.com/spaces/clojure/tickets/64 getting into clojure?
12:24mwoelkerrhickey: AFn already is serializable, so that covers a lot of ground, the only thing that seems to be missing (afaict) is Obj
13:33cgrandmwoelker: I don't know if AFn is really serializable despite being marked as such, the commit that added Serializable is dubious on the intent http://github.com/cgrand/clojure/commit/7cd3b285328e7e7e71b23080303d66640e0f21e8#diff-0 (but I'm not a java serialization expert).
13:37hiredmanhttp://en.wikipedia.org/wiki/Serialization#Java
13:42mwoelkercgrand, yeah serializing arbitrary AFn probably won't work, but the thing I (and the original reporter) are after is serialization for standard clojure datatypes (Vectors, Maps, Seq etc)
13:43mwoelkercgrand, I wondered about that commit as well, another option might be to mark the relevant Classes as serializable further up the hierarchy
13:44cgranddo you have an idea why findbugs complained about missing Serializable?
13:44mwoelkercgrand, what is the policy on unit tests for the java code? these might be neat to have to see if the objects are indeed serializable
13:45mwoelkercgrand, I was just about to remove it to find out...
13:47cgrandI don't think there's one yet -- but the clojure tests exercise the java code as well
14:04mwoelkercgrand, okay I checked out the commit preceding the findbugs one and it gives me "Class clojure.lang.PersistentVector defines non-transient non-serializable instance field root"
14:04mwoelkerroot being final Object[] root;
14:07cgrandmwoelker: thanks for researching that
14:09cgrandmwoelker: btw I agree with you that having a single repo for ccw would be nice
14:11mwoelkercgrand: did you see http://github.com/manuel-woelker/ccw/tree/ccw-project-merge ?
14:12mwoelkercgrand: But I have no clue why FindBugs thinks PersistentVector should be serializable itself...
14:18mwoelkerNo Serializable or Externalizable in the implemented interfaces, no readObject()/writeObject() method as far as I can see
14:19mwoelkerHmm it would probably be cleaner to move the Serializable tags higher up the hierarchy
14:44cemerickrhickey: I'm turning back to the isa? caching again. (http://clojure-log.n01se.net/date/2009-08-31.html#15:13 was our prior conversation) Are you still amenable to a patch using "a persistent map of hashes to weak refs of class+cached-value thingies"?
14:46cemerickThe possible alternative being to memoize isa? entirely, dropping the cache on any hierarchy change. As you said then, it's possible the class unloading issue is a non-issue (or, at least something we don't know the contours of yet).
14:48rhickeycemerick: I'd hold off for now. I'm looking at using some ideas from http://portal.acm.org/citation.cfm?id=1391960 for protocols and they might apply here as well
14:50cemerickrhickey: OK. Until then, I'm just going to bash out isa? with (memoize isa?) :-P
14:51rhickeythere you go
14:51cemerickoh, see, I was trying to irk you a little bit :-)
14:51rhickeyI'm pretty focused on the unification of reify/structs/types right now
14:52hiredmanhttps://www2897.ssldomain.com/higherlogics/www/Wiki.ashx/Interesting+Language+Research <-- pdf of that paper is also here
14:53cemerickrhickey: Godspeed, and all that.
14:54rhickeythanks, I'll write up the most recent decisions shortly
14:55rhickeybasically, structs can implement interfaces and get type tags, fast lookup all around, seamless transition from dynamic to static
14:56rhickeywhat I have been calling deftype becomes defclass, deftype will be a dynamic version, replacing most uses of structs
14:57cgrandrhickey, AWizzArd: I created ticket #205 (preserving hints on inlined and interop forms) and attached a patch.
14:57cgrandcemerick: with this patch, improved -> and ->> are less brittle: http://github.com/cgrand/clojure/commit/a027636d9ef857ee80cb13190731a2801684fe9c
14:57cemerickrhickey: I'm surprised you're wading into those namings. I don't have a problem with them, but defclass in particular has some baggage from some corners.
14:58rhickeycemerick: baggage from CL?
14:58cemerickthat too, but I was thinking of Java classes as well.
14:58cemerickor .NET, or whatever
14:59rhickeycemerick: but that's exactly what this is for, defining Java classes
14:59rhickeyor .Net or whatever
14:59cemerickit's a restricted set of interop though, right?
14:59rhickeycemerick: yes please
15:00hiredmanso deftype will get me to the metal code generation like new new, and also let me name the class?
15:01cemerickI'm just playing the expectations game ahead a few moves. Fine by me if we need to push back on the completionists, but there will be some mismatch here and there.
15:01rhickeyhiredman: defclass will let you name the class, all will do to-the-metal generation (based off reify work)
15:01cemerickIs genclass sticking around for über-interop?
15:01cemerickcgrand: oh, that's nice
15:01rhickeycemerick: for now, I really don't want to get sucked into interop right now. I want decent, high performing polymorphic constructs for Clojure
15:02cemerickThat reminds me, I actually just noticed last night that transients aren't yet up to speed w.r.t. meta.
15:02rhickeycgrand: I'll take it, thanks,, could you please create issue/patch
15:02rhickey?
15:04rhickeyreify - anonymous, created right then, direct method impls, deftype - anonymous, type tag, factory fn, direct method impls, fast field lookup, defclass - named, AOT, direct method impls, accessible ctor, fast field lookup *and* .field access
15:05cemerickrhickey: and 'direct method impls' means no redirection to another fn in an ns?
15:05rhickeycemerick: right, Clojure code in method bodies directly
15:06rhickeytyped fields all around
15:06chouserhow can you do that with named classes?
15:06chouseroh, AOT only for those.
15:07hiredmanto the metal named class generation is what I really missed working my reader
15:07chouserhiredman: why did you need named?
15:08rhickeychouser: yes, the beautiful thing is not with reify + defstruct, you can write completely dynamically (but still get interface impls), then any time you want you can 'bake' by switching deftypes to defclass, without changing any code except factory fn
15:08hiredmanchouser: so I could use my reader to read in clojure code before core was loaded
15:08rhickeysorry, deftype, not defstruct
15:09rhickeyso even though deftypes are anonymous, they use type tags that protocols will look at, and the method bdies are inlne and fast
15:09rhickeyso you can fully redef dynamically
15:09chouser'baking' there would buy you faster jvm-inlinable field access?
15:10hiredmanright now my reader is all in one fn (containg a letfn) and when that namespace is compiled it writes the name of the fns class to a properties file, which RT reads at start up to find out the name of the reader's class so it can load the reader
15:10rhickeywill be limited to :field lookup, which I intend to make very fast, compiled per type vs. current defstruct lookups
15:10rhickeychouser: baking buys you external name, .field access, direct ctor access
15:10rhickeynot much more really
15:11rhickeybut when you need it, it's there
15:12rhickeyOTOH the dynamic story is substantially improved, much faster methods, interfaces for structs(now types), protocols work with type tags, full live redef w/o restart
15:12cgrandrhickey: ticket #206 created
15:12rhickeyprotocols will *not* work with hierarchies on type tags
15:12rhickeycgrand: thanks!
15:13chouserrhickey: so that's a key differentiator between protocols and multimethods
15:13rhickeychouser: yeah, I've basically had it with implementation inheritance, it's a bad idea whose time has gone
15:16hiredmaninterface inheritence + functions?
15:16rhickeyI'v ealso been thinking about explicit implemant clauses in the body, allowing for body clauses to be subject to macroexpansion, thus enabling code-sharing macros:
15:16rhickey(deftype Foo [x y #^int z]
15:16rhickey (implement [Iterable] (iterator [] ... x y ... this ... )))
15:17rhickeythen you could write (implement-Foo-given a b c) macros calls in the body
15:17chouserthat's an interesting idea that presents itself very quickly even with older plans for new new
15:17chouserhenceforth referred to as "old new new"
15:18rhickeyreify will survive. Basically these are all flavors of the same thing, the trick is finding the core
15:18chouserif the facility isn't made available directly in deftype and friends, it's just a matter of time before some macro would be created to allow some kind of modular implementation insertion.
15:23rhickeyhttps://www.assembla.com/spaces/clojure/documents/download/deftypes.pdf
15:24rhickeychouser: I want to try to support that from the start, thus the separate clauses and the promise to macroexpand
15:25rhickeythe above is my scratch diagram, you can see how closure creates a set of fields, as does explicit listing of fields, from there interface method impl is the same, then there's just more default behavior...
15:26rhickeyso I just need to tweak what I've been doing for reify to support at least the 3 latter cases (the first (fn) is already handled, but could be redefined in terms of reify)
15:28rhickeyone things that's become apparent is the fact that auto-implementing interfaces will require they have better-distinguished method names, like meta__clj, valAt__clj etc, else potential for name conflict when merged with interface set
15:30chouserso deftype has a type tag, but this would not be used for protocols. protocols would instead use the actualy host interfaces the deftype implements. the type tag could still be used for multimethod heirarchies
15:31chouserrhickey: do you "think" in omnigraffle, or is it part of collecting your raw notes for eventual docs?
15:33rhickeychouser: I "think" in omnigraffle quite a bit
15:34rhickeychouser: no, type tags would be used by protocols, just no tag inheritance
15:34rhickeyso you can work with protocols, deftype, type tags and completely ignore more static interfaces + classes
15:35rhickeyyet at any time, incrementally: back up a protocol with an interface, implement an interface with a deftype, move a deftype to a defclass, swap .field for :field, without any architectural disturbance
15:38rhickey(deftype ::Foo [a b c]) ... (defprotocol Bar (baz [x])) ... (implement Bar ::Foo (baz [afoo] (:b afoo)), or something
15:38rhickeyno Java at all
15:38rhickeyall dynamic
15:39rhickey(defprotocol Bar :on IBar (baz [x]))
15:39rhickey(deftype ::Foo [a b c] (implement IBar (baz [] b))
15:39rhickeyetc
15:40rhickeysmooth dynamic/performance tradeoff, same architecture
15:42rhickeyoops, stick a (definterface IBar (baz [])) in there
15:42rhickeydefinterface and defclass are AOT
15:43chouserbut not needed until you decide to decorate your defprotocol with :on
15:43rhickeyright
15:43chouserwell, it sounds beautiful to the extent that I understand it so far. :-)
15:44rhickeyI intend to make defprotocol + deftype perf very satisfying, so the other is mostly about interop, or ultimate Java perf parity
15:45rhickeybut as cemerick noted, this is still not a full interop story, it's just for nice interop
15:45rhickeyugly interop is, well, ugly
15:46rhickeyit's quite amazing how much cruft comes in with impl inheritance
15:47chouseryep. and even if interop uses reify internally, there's hardly any value in making its usage look like these native def*s. When you're doing interop with existing Java, you know you're doing interop from the beginning.
15:47rhickeypossible inheritance of some declared interfaces
15:47rhickeyctor bodies
15:47rhickeysuper ctor calls, field inits
15:47rhickeysuper method access, protected
15:48rhickeywell designed Java should use interfaces and thus work well with this
15:49rhickeyand, it provides a recipe for specifying how to interact with your app from Java
15:49rhickeystatic factory methods TBD
15:50rhickeyplus you write your code to protocols and never have a question about being able to make it 'reach' anything
15:50rhickeyprotocols will fastpath the :on interface
15:50chouserI guess that would be the exception then, if you assume it's well designed Java, start using defprotocol, then realize you've got a protected field or something and have to fall back on the (ugly-interop ...) form
15:50cemerickWhat I'd like to see is the ability to write Java in-line in clojure files, and have that compiled out to standalone classes, etc. That would keep all the gnarly interop out of the designs of the clean interop and clojure-only stuff, and be a boon for optimizing hotspots, too. Sort of like how you can write C in python, or ASM in C, etc.
15:50chouseruh oh.
15:51rhickeycemerick: what I've been calling host-in-parens
15:51cemerickah, sure
15:51drewra way to make a perfectly terse clojure fn into 300 lines
15:52riddochcHi, folks. Anyone else having problems with firefox's rendering of the Clojure API page when trying to scroll to anyplace but the top of the page? It's terribly javascript-heavy, for what it is...
15:52rhickeycemerick: but it won't be necessary for hotspots/optimization - the inline Clojure method bodies will produce the same code as Java, leverage primitive fields etc
15:52hircusspeaking of which, where is the defprotocol design doc?
15:52chouserhircus: http://www.assembla.com/wiki/show/clojure/Protocols
15:52chousermore live notes than design doc
15:52hircuschouser: thanks
15:53chouserin fact, it's already out of date. :-)
15:53cemerickrhickey: Definitely, it's going to be an improvement, but surely there will be times when Java still laps clojure. *shrug*
15:53rhickeycemerick: like what?
15:53rhickeywhen
15:54rhickey?
15:55cemerickI've no idea off the top of my head. Perhaps I'm just vastly underestimating you. :-)
15:55AWizzArdcemerick: I think we should look at it and see the differences. I already have code waiting for deftype, where I am currently using a struct. I also wrote a pure Java class and so will be able to see the direct comparison.
15:56cemerickThe notion of generating the same bytecode as Java using clojure somehow seems too good to be true.
15:56rhickeycemerick: it's not me, just a matter of: inline in a method all primitive stuff is the same, type-hinted method calls are the same, hinted array access is the same, recur is goto
15:56rhickeyyou have to opt out of safe math etc, but you can already
15:57rhickeyas cgrand saw with early reify, the perf was the same as the Java
15:58rhickeythe only thing left is boxing across a fn call boundary
15:58cemerickoh, I'm sure it'll be neck-and-neck in many (most?) cases. I'm just assuming that someone will have an algorithm in java that won't be amenable to a comparable clojure impl.
15:59rhickeycemerick: the point of this is to make that not true
15:59hiredmanyou can do a lot with loop/recu
15:59hiredmanr
15:59hiredmanalgorithmicly speaking
15:59AWizzArdin some very strange cases there may be a need for reflection
16:00AWizzArdbut in those cases you would be doing things that won't be possible in Java then
16:00hircuscemerick: Scala does quite well in that regard, I don't see why it's impossible
16:00rhickeycemerick: but to match you will have to have types, primitives, bad math etc
16:00AWizzArdyes
16:01rhickeyAWizzArd: you have an example of something you can't type hint the reflection off of?
16:01cemerickhircus: I wasn't trying to say it was impossible.
16:02cemerickI guess I'm just remembering the painful "clojure is/isn't as fast as java" threads from some months ago.
16:02hircuscemerick: fair enough
16:02AWizzArdrhickey: you could at runtime have a (if ...) returning an object on which you will then call a method
16:03AWizzArd(.method (if (pos? x) "10" (File. "/foo.txt")))
16:03hircusrhickey: sorry if this has been brought up before, but at the cost of mis-alignment with Java interfaces, could we have protocols be "traits" (ala Scala), in that they supply some implementation functions but not all?
16:03AWizzArdonly at runtime it becomes clear which .method we want to call
16:03hircusI think at bytecode level what happens is Scala generates both an interface and a singleton class with the methods
16:04AWizzArdor changing the namespace dynamically.. but as I said, this is very strange stuff and only finds its place in esoteric programs
16:05AWizzArdrhickey: one nice side effect of deftyped objects would be their integration in Drools :)
16:06rhickeyAWizzArd: ah, yes, Drools, but not for deftype as the actual class might change on re-eval, even though they are POJOs
16:07rhickeyhircus: I don't like Scala traits, nor implicits
16:08hircusrhickey: fair enough. because they make the code harder to reason about?
16:08rhickeyhircus: yes, totally
16:08hircusI guess I normally only use implicits to work around Scala's lack of macros (i.e. for creating infix ops)
16:08rhickeyI wouldn't want to work with a system that used traits extensively
16:10cemerickimplicits scared the crap out of me once I used them for a month
16:10hircusI personally find implicits scarier, but traits and mix-ins are.. pretty much common in most OO languages, right?
16:11rhickeyand implicits for the expression problem is just auto-adapter pattern, with all the negatives of adapter
16:11hircusgranted, Python does its multiple inheritance the other way around -- first definition of a method wins
16:11AWizzArdrhickey: Drools will also work perfectly fine with the data structures that Clojure offers today. Those rules just won't run as efficient. And that may change with deftyped objects. I will see this maybe this year.
16:11rhickeyhircus: no, both Java and C# disallow multiple inheritance of implementation
16:12hircusI guess the nice thing about implicits (if any) is precisely that people don't have to reimplement a pattern (and get it wrong). Like how they have the Singleton object
16:12hircusrhickey: ah, I mean all but Java and C#. I see Scala's traits as a reaction to the limitation of an interface-only multiple inheritance, since sometimes it does make sense to share method definitions
16:12rhickeyhircus: it's still a bad pattern
16:13chouserevery namespace is a singleton :-)
16:14KjellskiGood evening (maybe you´re in my timezone=)
16:14rhickeyadapter pattern: requires allocation on wrap, the wrapper isn't-a wrappee, issues with identity, can't reach 2 adaptation targets in a single flow...
16:16hircuschouser: yup, so happily Clojure has that solution too. in fact, if you use Python, a module is a singleton too, really, I don't see why people always try to reimplement the singleton constructor in Python (because they can, I guess)
16:16rhickeyhircus: there's a difference between sharing an implementation and creating a derivation relationship to do so. Also mixins have terribly complicated diamond resolution strategies - always
16:17hircusrhickey: good explanation, thanks.
16:20rhickeyso, one thing about deftype/defclass is that method bodies are *not* closures
16:21chouserbecause their fields are explicit instead
16:21AWizzArdWhich is the more general of those two?
16:21rhickey(let [a 42] (deftype Foo [x] (implement IBar (baz [] a) <-- error, a not seen in baz
16:22rhickeythis one of the compromises
16:22cemerickwell, deftypes are generally going to be top-level anyway, right?
16:22AWizzArdWell, I think this is no problem at all. It's just that some defstructs would be replaced by deftype.
16:22rhickeycemerick: I imagine so
16:22KjellskiIs it possible to have more than one "(recur ..." in a loop body?
16:22rhickeyAWizzArd: defstructs have no methods now anyway
16:23chouserKjellski: yes
16:23AWizzArdright
16:23Kjellskity
16:23chouser(loop [] (if ... (recur ...) (recur ...))) for example.
16:23lpetitKjellski: as long as they are in tail position, of course
16:23AWizzArdI just didn't know that deftype/defclass can have some.
16:23chouserI've decided "tail position" is a misleading term. sounds like there's only one.
16:24Kjellskichouser : You guessed where this is going to lead... frightening... ^^
16:24chousermore of a syntax tree "leaf position"
16:24chouserhm, no that's not right either
16:25hiredmanbut you can only follow one code path through an if at a time
16:25chousercontrol structure leaf position
16:25hiredmanso there is only one tail for any given branch
16:25chouserhiredman: I suppose. so tail position of a function *call*. leaf position of a function definition.
16:26hiredmanhuh?
16:26chouserif you're looking at a function definition there are multiple tail positions. it's only when you're running the fuction that you have to choose a single one.
16:27chousers/are/could be/
16:27hiredman*shrug*
16:27hiredmanI'm just going to call them tail calls
16:28chouserI'm just saying it's a somewhat confusing topic to FP newcomers, and using the word "tail" tends to lead people to believe something that's likely to cause more confusion.
16:29chouserI don't expect to get everyone to call it something different of course.
16:30hiredmandamn
16:31hiredmanchouser made me think about loop/recur which made me think about all the java loops -> loop/recur translation I've been doing, which made me realize there is a bug in my reader
16:32chouserheh. happy to help. :-)
16:35rhickeyanother open question possibly not eveident from the diagram (is anything evident from the diagram? :) - ther may be just one factory fn for deftypes - I'm thinking (Typename vals [extension-keyvals])
16:36rhickeyso you'd always have to supply all fields. You could of course write other factory fns on top of that
16:38cemerickrhickey: what's the line on expando at the moment?
16:39rhickeywhereas currently you have (struct s vals) and (create-struct s inits)
16:39cemerick(wow, that's such a horrible term)
16:39rhickeycemerick: it will be an option, possibly the default, defeated by an impl of Associative
16:40cemerickwonderful
16:40rhickeyI'm not yet sure of how to control the various auto-impls, I can see situations where you might want none of them
16:41rhickeythey are meta, type, lookup (get), expando (assoc)
16:41rhickeyprobably more, like Seqable
16:42rhickeyalso in question, are deftypes j.u.Maps? I'd prefer not
16:42rhickeymaps serve dual purposes in Clojure, as small structs and large collections, only the latter use really maps to j.u.Map
16:43cemerickpresumably, that's an area where one would want a generic extension point (referring to auto-impls there)
16:44chouseras differentiated by whether they keys to the map show up literally in the code
16:44cemerickIMO, I'm happy to copy into a j.u.Map if I need one from a struct
16:44rhickeychouser: ?
16:44rhickeychouser: got it, nevermind
16:45chouserif a maps keys are in your code literally, it's a struct-like map. if... ok.
16:46rhickeycemerick: generic extension is tricky as you'd need to communicate the field details, and some extensions add fields
16:46rhickeycemerick: but I agree, interesting
16:47chouserdoes that suggest something more specific than general macroexpansion in the body of a deftype?
16:48rhickeysome things are self contained - like meta and type, and already there it's complex - type wants to add a static field
16:49rhickeyother things need to process the set of fields, like lookup, and even there, some fields are implementation details
16:49rhickeythe full semantics for extension could get pretty involved
16:50rhickeywheras it's easier with macros - a macro could ask you to supply the names of public fields, and the name of a field it could use etc
16:51rhickeywhereas
16:54cemerickheh, memoizing isa? gets me another 2x speedup on a particular chunk of fns (rather than memoizing bases and supers separately)
16:55rhickeycemerick: just wait till perfect hashing makes that a direct lookup :)
16:56cemerickperfect hashing?
16:56rhickeyyou didn't read the paper from before yet? :)
16:56cemerickha. I'm too busy trying to keep the trains on the tracks at the moment. :-/
16:57rhickeyPerfect Hashing as an Almost Perfect Subtype Test
16:57cemerickcompatible with hierarchies, As We Know Them?
16:58rhickeycemerick: I haven't thought much about their application there, but I don't see why not
16:58cemerickwell, joy :-D
17:05rhickeyactually, for a stable map with keyword keys, where it makes sense, you could define a general (perfect-hash map) -> perfect-hashed-map
17:06cemerickit's funny, I put this in my to-read queue earlier this week: http://research.microsoft.com/en-us/um/people/hoppe/perfecthash.pdf
17:07rhickeyneat!
17:17cemerickyeah. of course, I fall down on the math, but I can generally hack my way to vague understanding :-)
17:25AWizzArdthe map issue ("deftype is j.u.Map or not?") is not so easy to answer.. in principle *all* collection types like lists, pojos, hashmaps, etc. are mappings
17:25rhickeyAWizzArd: but not all POJOs are j.u.Maps
17:25AWizzArdtrue
17:26AWizzArdWhat would a disadvantage of deftypes being j.u.Maps?
17:26rhickeyobviously I agree with the sentiment there, that's why maps play the various roles they do in Clojure, OTOH, they can do that by implementing ILookup and Associative w/o j.u.Map
17:28rhickeydeftypes are more like POJOs in that you'll use them to implement other higher-level things. If you use one to implement a Vector or Set, would you still want it to be a Map?
17:28AWizzArdno
17:28rhickeyor, conversely, who would need/use them that way?
17:28rhickeyi.e. why put in if not needed?
17:29AWizzArdSo, the idea to make them maps just came up, because those are used everywhere in Clojure.
17:30AWizzArdSomeone else coming from outside would not have even thought about making deftypes a map?
17:31rhickeyAWizzArd: specifically java.util.Map, they will support get and assoc, associative destructuring etc, will print like map variants...
17:31rhickeyall I am talking about is the standard Java interface
17:32AWizzArdyes
17:32AWizzArdAnd that sounds very nice of course, especially for those cases that I have in mind: replacements for defstruct.
17:33rhickeyyou are passing structs to Java APIs that take j.u.Maps?
17:33AWizzArdno
17:34AWizzArdI use structs as containers for my objects
17:34AWizzArdthose objects live in one very big container, a ref
17:34AWizzArd(sometimes refs in refs)
17:35AWizzArdand functions that operate on my struct objetcs will use assoc and get
17:35AWizzArdif I now could basically replace defstruct with deftype then the code would still work
17:36rhickeyAWizzArd: yes, that has nothing to do with j.u.Map
17:36AWizzArdoki :)
17:37rhickeyj.u.Map doesn't have functional style assoc
17:39AWizzArdMy main use of deftype (or defclass?) would be to replace defstruct. Not for implementing big things such as a Vector or Set.
17:42AWizzArdenduser use
17:43AWizzArdbut nice surprise that you have plans to make them so generic that you can actually rewrite Clojure types in it
17:43hiredmanwell, thats what is driving this, right?
17:43rhickeyAWizzArd: a big point is to enable writing Clojure's data structures in Clojure
17:44AWizzArdIt's good
17:45rhickeyso no one's complaining that you can derive only from interfaces
17:52uninvertedWhat's the idiomic way to run external programs in clojure? Something like "system 'foo'" in ruby and perl and whatnot.
17:58Chousukeuninverted: contrib has the shell-out thingy.
18:04lpetituninverted: shell-out rocked for me.
18:04uninvertedThanks, I'm downloading contrib now
18:06lpetitrhickey: Maybe not anybody (me, for example) has the understanding of what it will imply to restrict types derivation from interfaces. It's too much for me to currently project all these upcoming use cases.
18:07lpetitrhickey: not doing it now (deriving from e.g. protocols) will prevent or really compromise doing it later ?
18:09ztellmanhas anyone had a problem where some instances of clojure can locate a class, and others can't?
18:10ztellmanI'll be working smoothly, close the process, reopen it, and all of a sudden quicktime.sd.QDGraphics is nowhere to be found
18:10ztellmanthough every other class in that namespace seems available
18:10ztellmanI can't figure out any pattern to it, and it's missing a lot more often than not
18:11hiredmanztellman: you aren't using add-classpath are you?
18:11ztellmanhiredman: no
18:12ztellmanI'm using QTJava, which is native to my OS
18:12ztellmanno classpath changes are necessary
18:32uninvertedHow do you suspend execution for a certain amount of time, like "sleep N" in ruby and perl and whatnot?
18:32chouser(Thread/sleep 1000) ; one second
18:33ztellmanso the problem was that I had to initialize quicktime before I could even import certain classes
18:33uninvertedAh, I tried Thread/sleep, though it was in seconds. Thanks.
18:38leafw,(prn (str "id=\"123\""))
18:38clojurebot"id=\"123\""
18:38leafwwhy the backslashes? I'd appreciate help in avoiding them
18:39leafw(this is a test case of a much larger (prn (str ...))
18:40hiredmanprn prints things in a way that can be reader back in
18:40leafw,(print (str "id=\"123\""))
18:40clojurebotid="123"
18:40leafwI see -- thanks hiredman
18:48leafwand is there any way to insert several of lines of text verbatim, the equivalent of """ ... """ in python?
18:48leafwas a String
18:49hiredmannope
18:50leafwwould be nice to have. Perhaps a modification of (comment ....)
18:51leafwthat returned it content as a STring.
18:51hiredmannope
18:51hiredmanthe input to macros has already passed through the reader
18:58riddochcI don't suppose it's possible that sort or sort-by can avoid consuming a whole sequence that it's meant to work on? ;)
18:59Licenserhmm hmmm likely not
19:00LicenserI guess you could work with tricky heuristics to sort a sequence good enough but then agian that's very ... strange
19:00LicenserI've read about algorithms for heaps that work on a basis that isn't entire correct but 'good enough' to give correct answers, then again I'm not sure if you could apply the same tricks ehre
19:02riddochcYeah, I figured... wishful thinking, in my case.
19:03Licenserwell if you know the items in a list you could kind of cheat, I mean min and max
19:10riddochcWhat I need is kind of like this: (if-nth-most predictate sort-predicate sequence)
19:12riddochcIf I could avoid having to sort the list before iterating over it to find the first element that my first predicate returns true for, it would be less computationally intense, but I don't think I can really make it truly lazy.
19:15riddochcHmm. Actually, a better name might be nth-most-such-that, or nth-most-where
19:24riddochcNo... that's not quite it, either. max-such-that. That's closer to what I mean.
19:27chouserbut you can't know you've found the max until you've gotten to the end.
19:30chouserrhickey: no, no complaints about deriving only from interfaces for native clojure things, especially with a sufficient mix-in-like mechanism (macros or otherwise)
19:36riddochcchouser: you're right, of course. But I wanted magic. Clojure is magical, isn't it? ;)
19:36ztellmanso can someone explain this to me: http://github.com/ztellman/looking-glass/blob/master/capture.clj
19:36ztellmanI have to execute code before I can import certain classes
19:36ztellmanis that a peculiarity of Clojure, Quicktime, or both?
19:37ztellmanit doesn't seem like you have to do anything of the sort in the Java examples I've seen
19:43chouseryeah, that's odd. I would guess a quirk of the Quicktime lib, but that doesn't explain why you haven't seen it documented for Java examples.
19:43ztellmanis the java import lazier than the clojure import?
19:44ztellmanI mean, maybe I'm just misunderstanding the java examples, they were just snippets in much larger pieces of code
19:49chouserhm... actually, that's a good point. I think Java's import does nothing at runtime.
19:49chouserbut Clojure's probably does class init stuff, since you name each class individually.
19:49ztellmanok, that makes sense then
19:50ztellmantotally unexpected issue, though
19:50chouserthings that Java would do when you first mention the class at runtime. perhaps.
19:50ztellmantook me forever to figure out
19:50chouseryeah, I can see why
19:50ztellmansometimes I would get into a state at the REPL where things had been properly initialized, and they were working
19:51ztellmananyways, thanks for helping me wrap my head around this
21:13toupsI am having some problems with swank-clojure-project. In particular, it hangs polling for the new slime
21:13toupsI may not have set up the directory appropriately.
21:14toupsWhere should I put clojure and should it be the jar, or the directory structure or what?
21:14tomojall the jars you need should be in lib/ or target/dependency
21:14tomojincluding clojure.jar and clojure-contrib.jar
21:15toupsOk
21:15toupsSo no source code needs to be there
21:16toupsLet me try it out
21:17toupstomoj: Thanks, that did it.
21:17toupsDo you know of anyone doing numerical modeling in clojure?
21:18toupsI am not doing anything super-heavy, and I am hoping with type declarations in the right places, I will be able to get ok speed.
21:18tomojtoups: nope, don't even know what that is
21:24toupsI am a neuroscientist
21:24toupsSo I want to model some very idealized neurons
21:29liebketoups: I use Incanter for numerical modeling in Clojure (http:incanter.org)
21:33toupsliebke: Incanter is definitely on my radar
21:36liebkecool, sounds like you're working on something fun :)
23:05Drakesonis it possible to run slime + swank on a multiuser machine securely?
23:18tomojhmm
23:20tomojyou'd have to use unix sockets, I guess?
23:21Drakesonbut, does swank-clojure use unix sockets or is it just a numeric port?
23:21tomojwell, I think it just listens on a port
23:22tomojand slime-connect asks for host+port
23:22tomojmaybe slime has some way of connecting to a unix socket instead, I dunno
23:22Drakesontomoj: I see, thanks
23:22tomojmaybe you'd have better luck asking in #emacs