#clojure logs

2008-12-02

00:00mememeHello... Anyone using clojure in "real world"?
00:03hiredmanclojurebot: the real world is <reply> wow #who, is that show even on the air anymore?
00:03clojurebot'Sea, mhuise.
00:05danleiclojurebot reality is an illusion which arises due to a lack of drugs
00:05danleiclojurebot: reality is an illusion which arises due to a lack of drugs
00:05clojurebotAlles klar
00:13jeremy____Here's an easy question: Why does (bigdec 5) result in an exception, but (bigdec 5.0) works?
00:16jeremy____If I run (class 5), I get "java.lang.Integer", so I think I see why (bigdec 5) fails, since (bigdec x) appears to call BigDecimal.valueOf()
00:18jeremy____BigDecimal has a constructor which takes an int. Would it make sense to modify (bigdec x) to handle this case?
01:29mibuanyone using clojure-mode with the latest SVN head?
01:45danleihas someone already ported (or started) cl's format?
01:46danleii'm thinking of doing it, but 1. i want to eschew double efforts, and 2. to be honest, i'm not sure if i would be able to do it properly
01:48lvijaydaniel: do you have any real reason to do it -- besides fun itself, of course. because clojure has format which uses Java's java.text.Format
01:48lvijay(doc format)
01:48clojurebotFormats a string using java.lang.String.format, see java.util.Formatter for format string syntax; arglists ([fmt & args])
01:48danleiwell, i'll just paste my first attempt, it can do basic things like (fmt :p "~a" 'hello) and (format "~{~a~^, ~} [1 2 3 4]) any tips or critique are apprechiated
01:48danleilivijay yes, but i somehow miss format =)
01:49lvijay:-)
01:49lvijaydoes it do the same for (format "~{A~^,~}" (range 10)) ?
01:50danleijust try it, it's maybe a horrible mess, i'm not a professional programmer
01:50danleijust a sec
01:50lisppaste8danlei pasted "format for clojure" at http://paste.lisp.org/display/71379
01:51danleii included a few functions, macros from my tools, it's shorter actually ...
01:51danleiand sorry, it's not commented right now, i'll do that
02:02danleii'm not sure, if the (fmt :p ..., (fmt :s thing is a good idea, maybe it should just return a string everytime
02:05danleiany tips on the code itself?
02:26danlei(fmt :p "~{~a~^, ~}.~%" (range 10 20)) works
02:29danleibut i'm afraid, the ~( directive won't be that easy
02:30danleis/(/[/
02:51Lau_of_DKGood morning all
03:03replacawhois danlei
03:03replacadanlei: still there?
03:24danleiyes, i'm here
03:49replacaoops, I wandered away
03:49replacadanlei: still there :-)
03:50replaca?
03:50replacaI've also been working on a CL-style format
03:51replacalook at http://github.com/tomfaulhaber/cl-format
03:54danleireplaca: ah, interesting. i'll have a look at it, thanks
04:04danleireplaca: nice, looks "cleaner" than my shot at it
04:11danleireplaca: you're trying to make it conform to the spec, right? in my version, i wanted a means for the user to define new directives in his own code via defdir. the directives are case sensitive in my version, so there's a bunch of chars left for own extensions.
04:12danleireplaca: are you working on a pretty-printer too?
04:36ChousukeCL format strings are scary.
04:37danleibut nice to have :)
04:37Lau_of_DKChousuke: I miss -R
04:37Chousukethe format utility is also insanely powerful, yes.
04:38danleii hope i'll get a working ~[ today ...
04:58danlei`hm ... how would one test, if the output goes to a fresh line?
04:59Lau_of_DKhuh?
04:59danlei`well, i want to test, if something i will print is going to be on a fresh line
05:00danlei`(for implementing ~&)
05:01danlei`or is there something like ~& in javas format
05:06Lau_of_DKBeats me
05:11lvijaydaniel`: afaik there isn't
05:13danlei`hm ... ok. i just asked in #java
05:13Lau_of_DKdanlei`: have you looked at something like JCurses ?
05:14danlei`Lau_of_DK: i thought about something like that, too, but i'm not sure if i want the overhead
05:15danlei`thanks anyways
05:16Lau_of_DKNo probs :)=
06:15AWizzArdMoin moin
06:19Chousukehm
06:19Chousukethe clojure website renders weirdly in IE6 :/
07:21AWizzArdMornin' rhickey. I have a question: should one in principle be able to replace a specific .class file that was originally compiled with javac with one (or more) that were compiled from Clojure? When I put the clojure.jar on the -cp of the original application.
07:22lvijaythis seems more like a java question than a clojure question. can you elaborate?
07:23rhickeyAWizzArd: depends on the original class file. If you implement the same interfaces and hive it the same name, it should be the same as any other Java class. That said, you can't do everything in gen-class that you can in Java
07:23AWizzArdI think it's a clojure question.. As far as I understand it, I should be able to plug my clojure code (when compiled) into any existing java project.
07:24AWizzArdrhickey: yes, I mean when I have the original.java source code and want to basically do the very same thing.
07:25AWizzArdDo you have an example of what a java class can do and what isn't an option (yet) in Clojure?
07:25rhickeyAWizzArd: you can't declare fields, access specifiers, exception types, annotations...
07:33lvijayrhickey: what is your opinion of allowing multiple exceptions in a catch phrase? (try ... (catch [RuntimeException Exception] (prn e)))
07:34rhickeylvijay: personally I'm not a big fan of catching exceptions by type, so it's not a priority
07:34lvijayok
07:35lvijayso is your typical advice is to just catch Exception? just curious, any reason why?
07:37rhickeylvijay: many
07:37jeremy____Here's an easy question I posted late last night, but I think everyone was asleep by then: When I run (bigdec 5), I get an exception, but (bigdec 5.0) works fine. If I run (class 5), I get "java.lang.Integer", so I think I see why (bigdec 5) fails, since (bigdec x) appears to call BigDecimal.valueOf(). BigDecimal has a constructor which takes an int. Would it make sense to modify (bigdec x) to handle this case?
07:37rhickey:)
07:38rhickeyit's complicated, and would take a while to explain, but Java's treatment of exceptions in signatures is suspect, and it forces a proliferation of exception types, a certain type of exception being thrown isn't necessarily connected to the cause you expected etc
07:40lvijaythat is certainly true. I've had to run around the same thanks to java's different handling of checked and unchecked exceptions -- catch a checked exception and throw a runtime expception because the method's signature doesn't allow it and so on
07:43rhickeyI think exceptions should just communicate: I couldn't do what you asked. If you want a conversation between the location of the problem and some higher-level logic you can dynamically bind funcitons
07:47rhickeyjeremy____: the reason it doesn't use the ctor is this:
07:47rhickey(BigDecimal. 0.1)
07:47rhickey0.1000000000000000055511151231257827021181583404541015625M
07:47lvijayok. i'm sort of convinced. do you have any example code that establishes such a conversation? i agree with you about the conversational function that exceptions should play but i'm just trying to wrap my head around the same
07:48jeremy____rhickey: ah ok thanks
07:48rhickeyjeremy____: so supporting int would mean a conditional, could do
07:49lvijay*wrap my head around what such an implementation would look like
07:51rhickeyjeremy____: but it's a subcase of the more general 'should ints promote to longs?' question
08:44AWizzArdBtw, in Java there are exceptions I think that we have to catch, otherwise the program won't compile. If that is true, what happens in such cases with Clojure?
08:44lvijayclojure treats all excpetions as optional
09:01rhickeyjeremy___: bigdec/bigint enhanced - prefer valueOf, but doing coercions amd supporting all single-arg ctors, including from String
09:01rhickeysvn 1135
09:06AWizzArdWhat is amd supporting?
09:07AWizzArdoh ok
09:07rhickeya typo
09:07Lau_of_DKs/amd/and
09:07AWizzArdI just read something about amd processors.. so ;-)
09:17jeremy___rhickey: wow thanks!
09:34RSchulzMornin' Folks. I need clarification on (proxy ...)
09:35RSchulzIf I proxy an interface, I'm allowed to supply an incomplete implementation and the omitted methods will be supplied automatically, each with a function that throws USOE?
09:35rsynnottAWizzArd: the mandatory compile-time enforced exception handling in Java is a bit of an oddity
09:35rhickeyRSchulz: yes
09:35rsynnottI don't think I've seen it elsewhere
09:35RSchulzGreat. Laziness is a virtue...
09:36rsynnott*exceptions
09:38RSchulzrhickey: http://clojure.org/java_interop still mentions gen-and-load-class and gen-and-save-class. They're now defunct, right?
09:39rhickeyRSchulz: right
09:39RSchulzOK
09:39rhickeydoc will get revisited in release prep
09:48RSchulzrhickey: Are you aware of ACL2?
09:48rhickeyRSchulz: I know of it, but never used it
09:49RSchulzClojure would seem eminently amenable to what it does: Prove properties of programs. You latest post to the group reminded me of it.
09:49RSchulzThe ACL part of the name is Applicative Common Lisp
09:49RSchulzThe 2 refers to the theorem-proving superstructure added to it.
09:50AWizzArdrsynnott: I see. Well, I heared that it exists, and that many programmers "cheat" by providing empty handlers :-)
09:51rhickeyRSchulz: I really should spend some time with it at some point
09:52RSchulzACL2 is used and actively developed. They gave a paper at a workshop at the FLoC in Seattle in 2006.
09:52RSchulzSince it's CL-oriented, it would be a lot of work to port, but the concepts would surely be applicable.
09:53RSchulzAnd I have a pretty mature first-order theorem prover written in put Java...
09:53RSchulz"in _pure_ Java." (put?)
09:58drewolsonhey all, i've been reading up on AOT compiling and i think i understand it to some extend. my question is this: if i want to release clojure code as a jar that can simply be run using "java -jar foo.jar" can i do it?
09:58drewolsoni'm thinking i'd use AOT compiling and add a default class to the manifest of the jar with a main- fn, correct?
10:00ChousukeI think you'd specify the namespace as the class in the manifest, and if that namespace has a main- then the jar will run that
10:01drewolsonChousuke: ah, gotcha
10:01drewolsonand i need to include the (:gen_class) in the namespace declaration?
10:01Chousukehm
10:01ChousukeI don't know
10:01Chousukeyou could check how clojure does it.
10:02Chousukethe jar has a main function now.
10:03Chousukeah, clojure seems to use gen-class
10:04drewolsonthe docs say that the dash comes first, ie (defn -main ...)
10:04drewolsoni'm assuming this is correct
10:05rhickeydrewolson: you've read: http://clojure.org/compilation ?
10:07drewolsonrhickey: reading it now
10:29drewolsonso i've compiled my code and i can run it just fine with: java -cp /path/to/clojure.jar:classes org.drewolson.foo
10:30drewolsonif i wanted to place this into a jar, should i include clojure.jar within the jar as well? i doesn't seem to be able to find clojure if run something like
10:30drewolsonjava -cp /path/to/clojure.jar -jar foo.jar
10:30drewolsononce the jar is created
10:30rhickeydrewolson: -jar disables -cp
10:30drewolsonah, thanks :) need to learn more java
10:31Chouser_I don't know if it's the "right way", but I've had success unpacking the clojure.jar into my classes dir, and jar'ing up all of it together.
10:31drewolsonChouser: gotcha. let me give that a shot
10:31rhickeyChouser: that works
10:32rhickeyChouser: I was wondering last night if watchers could have made your agent-based solution more declarative
10:32RSchulzrhickey: Are there any licensing implications or concerns on your part with that sort of "re-packaging" of Clojure? I know it's forbidden (and technologically precluded, if I understand correctly) for Sun's Java itself.
10:33ChouserHere's what I've got -- spoiler warning, this is a solution to a Project Euler problem: http://n01se.net/paste/BK1
10:33rhickeyRSchulz: you just have to comply with CPL
10:33waltersRSchulz: and not for OpenJDK for the JVM itself
10:34drewolsonChouser: if i place clojure.jar at the root of my jar file, should it be available in the classpath? or do i need to unpack it
10:34ChouserSo watchers ... yes, that might work, but I'd have to think through the termination case.
10:35RSchulzBut rt.jar is sealed, right? You can't recombine it and get a working JVM, right?
10:35Chouserdrewolson: I'm really not that Java savvy yet, but I think you'd have to add the clojure.jar to your manifest classpath. or something.
10:35drewolsonChouser: ah yep, that's the ticket
10:35RSchulzI believe Chouser is right.
10:35AWizzArdAs long I don't write into the clojure.jar but always use it exclusively for reading (= writing Clojure programs), then I can do anything I want with it, including writing commercial software. And inside that I can deliver the clojure.jar, right?
10:36waltersRSchulz: legally? or technically? i don't see any barriers to either with openjdk; whether extending rt.jar is a good idea, i'm less certain
10:36rhickeyRSchulz: I'm not speaking for Java, just Clojure
10:36RSchulzrhickey: Of course. I was just wondering if there were any comparable issues for Clojure. I didn't figure there were, but it is yours.
10:37Chouserso there's some kind of bug in my algorithm in agent-83 -- it gets the right answer sometimes, but not other times. I'd want to solve that first before trying watchers or pmap.
10:37RSchulzwalters: I believe technically if you unpack rt.jar and rebuild it, it won't work as a source for all the classes it would ordinarily supply.
10:37RSchulzwalters: I was under the impression that it was ensured cryptographically, but I'm not really sure about that.
10:39AWizzArdWas it right what I said about Clojures use in commercial products?
10:42RSchulzAWizzArd: Rich should weigh in, but if push comes to shove, it's the CPL (and a court, I suppose) that rules.
10:43rhickeyAWizzArd: the CPL is specifically intended to allow commercial use
10:45AWizzArdYes.. I am just unsure because I read above something that RSchulz talked about repackaging clojure. So, if I put it into my .jar file that I deliver to clients I would do something with the .jar, although I didn't touch its contents.
10:45RSchulzI was only asking! I didn't mean to imply anything.
10:45AWizzArdyes
10:46AWizzArdNow I am curious as well
10:46danleii'd like to know that, too (including of extracted clojure jar in ones jars)
10:46rhickeyhttp://www.opensource.org/licenses/cpl1.0.php
10:46rsynnottit's a pretty liberal license (CPL)
10:46AWizzArdI understand it so far, that I am allowed to put the clojure.jar everywhere where I want, so, also into my own files.
10:46gnuvincerhickey: what are your thoughts on Clojure's standard library? Do you see something very complete like Python or Factor or something minimal?
10:46AWizzArdinto my own apps
10:46rsynnottmore or less with-attribution BSD with some patent-y paranoia added in :)
10:47danleibut isn't unpacking the jar for inclusion modification?
10:47danleiianal
10:47drewolsoninteresting enough, it seems that adding clojure.jar to the Mainfest Class-Path only works if clojure.jar is in the dir where the jar is sitting, not within the jar itself
10:47rsynnottdanlei: AAUI, CPL allows modification without distribution of source
10:47rhickeyrsynnott: CPL is reciprocal for derivative works, not like BSD
10:48rsynnottah, so it is
10:48rsynnotta little more restrictive, then
10:50Chousuketo me it seems clojure-contrib is becoming a kind of "standard library" for clojure.
10:51rhickeysome of contrib will come with clojure
10:51gnuvincerhickey: you don't see contrib coming with Clojure?
10:51danlarkinI, for one, hope there will be tighter coupling between contrib and clojure proper in the future
10:52Chouserrhickey: I think watchers don't really help. They replace some imperative code in the action with some imperative code to set up the watchers.
10:52rhickeyChouser: but separate the two, no?
10:52Chouseryes
10:52rhickeythat's worth something
10:53ChousukeI like the way that the "core" clojure is reasonably small
10:56gnuvinceChousuke: I like it too, but I'd rather be able to require useful libs without having to download a third party tarball
10:56Chouserhm, splitting out the imperative part may have led me to find my bug...
10:57rhickeyChouser: nice
11:01dabdhi all, some time ago I asked if the video from the semantic web meeting will be available. Any news?
11:02Chouserwill sends from the action wait until watchers are complete?
11:02AWizzArdApropos splitting.. is there some "explode" function in Clojure/contrib that let's me split collections at specific elements? Yes filter.. but: (filter #(not= % " ") "Hello World") ==> a sequence that destructed my string into single chars. For non string colls it works however.
11:03rhickeydabd: I don't think it will - the meeting was organized in a way that makes it difficult to produce a coherent video
11:04AWizzArd(explode " " "Hello moon") ==> ["Hello" "moon"] or (explode 4 [1 2 4 1 2 4 5]) = [1 2 1 2 5]
11:04rhickeyChouser: right now the watchers are synced with state update and run on action thread - I may revisit that
11:04dabdrhickey: ok. thx
11:04ChouserAWizzArd: (.split "Hello World" " ")
11:05AWizzArdyes, for strings this is nice and what I like
11:05ChouserAWizzArd: those two examples seem very different to me (string vs. vector)
11:05ChouserYou're sure you don't want ([1 2] [1 2] [5]) for your second example?
11:05gnuvinceThey'd be similar if your first example was (explode \space "Hello moon")
11:06AWizzArdChouser: what you suggested is what I wanted, right
11:07AWizzArdlike http://www.zvon.org/other/haskell/Outputprelude/splitAt_f.html which also works for strings similar to .split
11:10AWizzArdChouser: btw, when I do (.split "Hello moon") ==> IllegalArgumentException: No matching field found: split for class java.lang.String
11:10AWizzArdnevermind
11:11ChouserI'm not seeing anything like String's .split for seqs.
11:11AWizzArdright
11:11danlarkinisn't there partition-at or something?
11:12AWizzArdnope
11:12danlarkinI seem to remember a question like this from a few weeks ago
11:12AWizzArdand Clojures partition is not exactly like Haskells group
11:12Chouserthere's clojure.contrib.seq-utils/partition-by but it's not quite right here.
11:15replacadanlei: good morning, saw your messages from last night (my time)
11:16replacadanlei: yes, my goal is to make my format it spec conformant
11:16replacaalso fast (relatively speaking)
11:19danleireplaca: very nice, it was very interesting to see how you do it, after trying myself
11:20danleireplaca: do you have an idea about implementing ~&?
11:20RSchulzI was just trying to call the "quote" method in java.util.regex.Patter and couldn't get it to work.
11:20RSchulzEventually it sunk in that it was because "quote" is a special form in Clojure.
11:20RSchulzIs there a way to call such Java methods?
11:20replacadanlei: yeah, create a wrapper stream that keeps track of column position
11:21replacafor efficiency, I'd like to analyze the compiled format to decide if I needed it
11:21danleireplaca: ah, i understand
11:22replacaI'd also like to make mine extensible, but not by case distinction
11:22replacasince I want "original" formats in ported code to "just work"
11:23danleiwell, mine was just a quick hack, compared to yours. looks pretty neat, as far as i can tell
11:23danleii'm glad that someone tackles it
11:23lisppaste8Chouser pasted "cut (for AWizzArd)" at http://paste.lisp.org/display/71413
11:23AWizzArdin (.split string "\\s") the regex is "\\s". I remember there was a discussion going on about "\s" vs "\\s"?
11:23replacayeah, it's complicated to deal with all the cases, but that's part of the fun
11:24danlei=)
11:24replacaI've finally got myself to the point where I'm set up to do all the brackets
11:24danleii'll go on working on my version, but i'm not going to try to make it conformant
11:24ChouserAWizzArd: yes, unfortunately split takes a String, not a Pattern, so you still have to do Java-like extra escaping.
11:24AWizzArdChouser: yeah cool, that looks gread
11:24AWizzArdoki, but no problem for me
11:24AWizzArdalthough in contrib there is also a split function for strings no? Let me see...
11:24danleiare you already working on a pretty printer?
11:25replacadanlei: cool, I'm interested to see what you discover
11:25ChouserAWizzArd: you might choose to use re-split so you can use #""
11:25AWizzArdyes
11:25danleireplaca: for me, it's also kind of an exercise, not being a pro programmer
11:25replacaI'll keep pushing updates to github, so you can see what I'm doing
11:25danleireplaca: i'll definetely will
11:26replacadanlei: for me it's kind of an exercise, being a programmer :-) but also an attempt to make something useful that some people seem interested in
11:27ChouserRSchulz: works for me: (java.util.regex.Pattern/quote "asdf")
11:27danleido you have any tips for my version? (anything looking "awful")
11:27RSchulzChouser: But that's a single symbol, right?
11:27drewolsonhas anyone used rake/buildr for building clojure project (aot compiling, jars, etc) or is everyone using ant?
11:28RSchulzI tried (.quote #"\bfoo\b") and variations as was always rebuffed.
11:28AWizzArdChouser: funny: (re-split ...) seems to be even more efficient than (.split ..)
11:28ChouserRSchulz: quote is a static method of Pattern, not an instance method.
11:28RSchulzD'Oh!
11:29RSchulzBut it is true that java.util.regex.Pattern/quote is a single symbol, completely distinct from "quote".
11:30ChouserRSchulz: I think so. It's a little vague for me, since quote is a special form and therefore doesn't participate in namespace resolution in the "normal" way.
11:31replacadanlei: not particularly, at a quick read it looks pretty reasonable
11:31replacadanlei: I like using the multimethods to get extensibility
11:32ChouserRSchulz: yes, I guess so -- it seems that quote is only recognized as the builtin when it's using a nil namespace
11:32ChouserRSchulz: (eval (list (symbol nil "quote") 5)) ==> 5
11:32danleireplaca: thanks
11:32RSchulzChouser: That appears to be the case.
11:32danleireplaca: i'll let you knew if there is something new
11:32Chouserbut replace 'nil' with anything else and it tries to look up a var
11:33danleireplaca: (and have an eye on your efforts)
11:33achim_phi all
11:33RSchulzChouser: You know your nick shares a lot of leading characters with Chousuke...
11:33replacadanlei: cool. My only note would be that outputing streams 1 char at a time would be slow
11:33achim_pis there a specific reason why a multimethod can't be called "bytes"?
11:33ChouserRSchulz: yes. I would apologize, but I was here first. ;-)
11:33achim_plisppaste8: url
11:33lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
11:33replacabut I don't know how slow
11:34RSchulzWell, that answers that question.
11:34RSchulz(about lisppaste8)
11:34cemericksurprising to me -- is this specified by the IEEE float/double spec or something? (== 1 (- (float 1) Float/MIN_VALUE)) => true
11:34danleireplaca: yes, you're right. actually i also thought about it but then, i'm just trying to make it work, atm
11:34lisppaste8achim_p pasted "bytes" at http://paste.lisp.org/display/71414
11:34AWizzArdMoin achim_p
11:35RSchulzcemerick: It seems reasonable to me. MIN_VALUE has much to low a scale to change 1 when subtracted from it.
11:35RSchulzuser=> Float/MIN_VALUE
11:35RSchulz1.4E-45
11:35replacadanlei: :-)
11:36RSchulzAnd 1 being equal to (float 1) happens because one is perfectly representable even in floating point.
11:36Chouserachim_p: nice one!
11:36cemerickRSchulz: yeah, but this is true as well: (== 1 (- (double 1) Float/MIN_VALUE))
11:37RSchulzSame deal. Doubles dont' have enough mantisaa to distinguish 1 and 1e-45.
11:37RSchulzIt takes more than three bits for each decimal order of magnitude.
11:37Chouserachim_p: it seems you can use (defmethod user/bytes ...)
11:37cemerickmy problem is I haven't the foggiest notion of how numerics are implemented at the ground floor :-)
11:38RSchulzWell, it's mostly in hardware, anyway...
11:42achim_pChouser: thanks, that'll do for now. so you also think it's a bug? i wasn't entirely sure ...
11:44Chouserachim_p: I'm not sure either. Can't #^bytes be used as a type hint for an array of primitive bytes? I wonder if it's an incorrect iteraction with that feature.
11:45rhickeyachim_p: bug, fixing now
11:46achim_prhickey: cool, thanks!
12:06cemerickRSchulz: so (sorry to pick on you, but you seem to have an idea about what's what in this dept.) -- if I wanted to reliably "decrement" a float (such that the result would be the smallest legally-representable increment below a given float argument), would this do the trick?
12:06cemerick(defn decfloat [#^Float f]
12:06cemerick (Float/intBitsToFloat (dec (Float/floatToIntBits f))))
12:07cemerickit seems to work, but I'm definitely in unfamiliar territory
12:08rhickeyachim_p: fixed
12:08rhickeysvn 1137
12:09Hunyou could just increment/decrement the mantissa bits. be aware of overflow.
12:09cemerickactually, I'd need to use (if (pos? f) dec inc) instead of just dec
12:10RSchulzcemerick: I'm surely not an expert and I'd have to think about that. However, I think you should consider carefully what you're trying to do, since the notion of a "smallest increment" of something that is an approximation of a real number is surely not well defined.
12:11RSchulzFor one thing, that value will change with the exponent of the float, it would be sort of like a logarithmic / exponential progression of increments.
12:11Hunas long as you're just manipulating the mantissa, it's pretty close to integer handling
12:11RSchulzYou can treat the mantissa like an integer, sure, but the point is that what a floating-point number represents (a real) is not meaningfully treated in this manner.
12:11Huntrue.
12:12RSchulzcemerick: What is it you're actually trying to accomplish?
12:15cemerickRSchulz: I have a body of code that treats certain values as members of sets based on membership within an interval. i.e. given a "query" of 5, it would return intervals of [0 5], [1 6], etc. I'd like to be able to accept an arbitrary "query" value (say, 5), and increment or decrement it so as to exclude candidate intervals whose edges are equal to the query value. Thus, 5 => 5.0000001 or 4.9999999, and the results exclude [0 5] or [5 10], respectively
12:15achim_prhickey: works perfectly, thanks!
12:16cemerickprecision is entirely unnecessary, which is why I'm generally willing to be sloppy with the math (up to a point)
12:16RSchulzSo you're trying to implement full-blown interval arithmetic?
12:16Huncemerick: this distinction is pretty hard in floats. i wouldn't try it.
12:16RSchulzHave you looked for any existing Java libraries you could use or wrap?
12:16RSchulzInterval math is not trivial, as I understand it.
12:17cemerickRSchulz: No, by no means full-blown anything :-)
12:18cemerickHun: You'll have to excuse my math-oriented ignorance.
12:18RSchulzWell, I don't think you should be playing around with increments like that. Are you familiar with the distinction between open and closed interval endpoints?
12:19RSchulzIt seems to me you only need to distinguish whether to use a < or > test vs. a <= or >= test at the respective endpoint.
12:19RSchulzAnd keep in mind that if you do this right, your code should work with all of Clojure's numeric forms, including rationals.
12:19Huni would represent intervals as small objects, like ((1 . inclusive) . (2 . exclusive))
12:19cemerickRSchulz: Sure. I'm not in a position to implement open and closed intervals at this point, though. FWIW, the data are actually n-dimensional regions, not 1-d intervals, which makes the semantics of the implementation a little trickier.
12:19Hunand implement basic math en it
12:20RSchulzI agree with Hun. Represent your domain minimally, but not less than minimally.
12:20RSchulzIt seems that that n-dimensional case is not fundamentally different, you just have a pair of bounds in each dimension instead of assuming just one (pair of bounds)
12:21Hunthere's a nice chapter in SICP in which they implement a numeric tower... it's not exactly what you need, but i think the reduction step they use is applicable for your problem
12:21cemerickRSchulz: No, not fundamentally different. However, there's an existing codebase that I'm really not in the mood to significantly refactor.
12:21RSchulzHun: is that in the 1st ed? I never "upgraded." And it's been a long time since I've cracked it open.
12:21Huni only have the second edition here, so i only know it from there
12:22RSchulzkotarak: How's the tags generator coming?
12:22Hunit's fully available on the intarwebs for free
12:22kotarakworking on it at the moment.
12:22kotarakNoticed some stupid issues.
12:22RSchulzHun: Ah. I didn't know that. Thanks for the tip.
12:22cemerickHun, RSchulz: Is the bit-oriented decrement operation I pasted a bad idea because of likely precision/correctness issues, or is there a more fundamental problem with it?
12:22kotarakI shouldn't release software at half past midnight. :/
12:23Hunoh
12:23Hunsicp section 2.14
12:23Huninterval arithmetic
12:23Hunsounds exactly like what you need
12:23RSchulzI think it will (outside of boundary conditions at the extreme of the FP range) do what you want. But again, I'm not really an expert. I just play one on IRC.
12:23Huncemerick: the problem is that the mantissa may over/underflow
12:23Hunand then Bad Things happen, unless you add a lot of careful code around
12:24cemerickHun: which is only a problem when the base value is close to Float/MIN or Float/MAX, or the infinities, yes?
12:24RSchulzYup. Same section (2.1.4) in the 1st. ed.
12:24Huni'm currently writing a FPU... i know these things. you don't want to know what can happen
12:24Huncemerick: nope
12:24RSchulzcemerick: What Hun just said ...
12:24Hunit is when the mantissa bits approach all 0 or all 1
12:24RSchulzGack! You're writing a real FPU's microcode?
12:24RSchulzWhy am I pretending to try to help?!
12:24HunRSchulz: i'm writing a real FPU in vhdl
12:25RSchulzOK, then.
12:25Hunonly ieee754.. but when i get that thing working, i think i did well enough :)
12:25Hunerr
12:25Hunieee single precision
12:25rsynnottoh, yep, college project?
12:25RSchulzCan you run it in a simulator? (I know _of_ VHDL, but very little _about_ it.)
12:26rsynnottthink I had to do that in second year
12:26rsynnottRSchulz: yep
12:26Huncemerick: you need to check if those bits (rightmost 23 in single, 53 in double) approach zeros or ones
12:26rsynnottotherwise it would be INCREDIBLY painful
12:26RSchulzI started writing FPU microcode for the Z80 as an HP co-op student (in the dim dark mists of time).
12:26Hunrsynnott: yep. we did a risc cpu for the last 3 weeks (which we implemented from scratch)
12:26Hunand now we add a fpu on top
12:27RSchulzIEEE754 allows de-normalized mantissas, right? (If I'm even saying that right.)
12:27RSchulzGod. What a topic for a Lisp channel...
12:27HunRSchulz: it allows it, but they aren't mandatory
12:27Huni don't implement them in my hardware
12:27RSchulzBut if they arise, they don't cause exceptions, right?
12:27Hunnope
12:27RSchulzHun: Your "hardware" (the quote marks are necessary in this case...)
12:27Hunthey have to be renormalized (extended) before carrying out operations
12:28HunRSchulz: erm... nope. it runs on a fpga
12:28RSchulzAh. But that's done inside the FPU when an operand is de-normalized?
12:28Hunwhich is de-facto hardware
12:28RSchulzAh. Cool. What school are you at, if I may ask?
12:28RSchulzThey've plainly got resources.
12:28HunRSchulz: the fpu can use an extended format (like 40 bits for single and 80 for double) as an intermediate
12:28Hununiversity of applied sciences of augsburg, germany
12:29Hunwe have a few xilinx spartan 3. and when we want to run on the real hardware, the prof wants to supervise
12:29RSchulzWell, it sounds interesting, though I prefer the world of symbolic computing, myself. I did the low-level stuff for long enough.
12:29Huni did high-level common lisp for a year now. hardware is a nice change of perspective
12:30RSchulzYes. Most anything gets tedious eventually. I really hate repeating myself!
12:30RSchulzcemerick: Are you squared away? Do you know how you're going to proceed?
12:31Hunme too. i wonder what i'll end up with in another year :)
12:31RSchulzProbably some kind of artificial mind project...
12:31RSchulzThat does impeccable math.
12:31Huna buddy is implementing a compiler for his own neural network language
12:32Hunand he's thinking of adding a vhdl backend
12:32rsynnottRSchulz: fpgas are very cheap these days
12:32rsynnottor small ones are
12:32RSchulzWhat about the hardware and software to program them?
12:32Hunserial cable
12:32Hunxilinx dev tools which are free for educational use
12:32rsynnottyou can get a spartan 3 for 200 euro on a board
12:32RSchulzWow. That's not bad.
12:33rsynnottand there are smaller things for less
12:33Hunwhen you're producing small series, you can get the chip pretty cheap, too
12:33rsynnottthey tend to have serial/usb interfaces on the chip for programming
12:33Huni remember the 3d-boards from sun blade 100 and 150 being a spartan :)
12:33Huntrue
12:34rsynnottyep, that wouldn't be unusual for small production runs
12:34Huni'm actually thinking of adding a spartan on my avr32 board :)
12:34rsynnottsome weirder pci cards are based on them, too
12:35rsynnottbut no, I had to go into the games industry :P
12:35Hunhehe
12:35RSchulzLots of money and actually lots of leading-edge stuff happens in gaming. As I'm sure you know.
12:36RSchulzHow far are we from fully immersive VR? And how long after that 'til the Matrix??
12:37Hunwhat do you mean, 'til'?
12:37rsynnottRSchulz: I do server-side stuff
12:37rsynnottand more recently persistent browser games
12:37RSchulzMe too.
12:37rsynnott(another decision I kinda regret)
12:37RSchulzAmong lots of other things. And mostly 'cause I don't have any one to whom to delegate that stuff...
12:38ChouserRSchulz: doc-find!? :-P
12:38rsynnottthough the server-side stuff was painful around christmas
12:38rsynnottthat's when they tended to launch call of duty whichever number it is now
12:38RSchulzWell, I couldn't really call it find-doc, could I?
12:38RSchulzI guess dgrep or doc-grep might have been better.
12:39Hunthe board we use is available for 150$... pretty cheap, actually
12:40Hunruns with an internal 25MHz clock. that's pretty fast :)
12:40rsynnottsome of the super-expensive Virtex chips go up to about 400MHz :)
12:40Hunwhee
12:41RSchulzHun: We here in the States aren't in the Matrix yet. We prefer to suffer for real.
12:41rsynnott(some of them also have handy builtin PPCs)
12:41RSchulzAnd those glitches in the Matrix make us uneasy.
12:41Huni don't know if my current core can run at that speed... i think my longest combinatorial path is around 11ns
12:42Hunwhich i think would limit the max clock to about 100MHz
12:42RSchulzHow many gates does it use?
12:42rsynnottHun: pipelining! :)
12:42Huni'd have to check, and the dev computer is not running
12:42RSchulzRoughly?
12:42RSchulzI'm just curious.
12:42Hunrsynnott: is hard, and others have done it at my university
12:43Huni'm the first to build a fpu
12:43rsynnottour fpu project had to be pipelined
12:43HunRSchulz: it says 5% of available gates
12:43RSchulzI split from EE to CS when I found out that semiconductor junctions behaved exponentially. That spared me the whole electrodynamics curriculum.
12:43rsynnotton the other hand, it was just a poor lonely FPU; we didn't build a processor
12:43Hunwe include it in our main risc design
12:44Hunmy current idea needs about 4 state machines inside the fpu. the main cpu only has a single one (but could use one for memory access)
12:45kotarakRSchulz: new changes to cljtags pushed
12:45RSchulzGreat. That's in the Google groups file section?
12:46kotarakEhm. No. On bitbucket.
12:46RSchulzBitbucket? I don't know that one.
12:46RSchulzBut you posted a URL in the group, right?
12:46kotarakhttp://www.bitbucket.org/kotarak/cljtags/
12:46kotarakThere's a download button in the top right.
12:46gnuvincebitbucket is to mercurial what github is to git
12:47RSchulzMercurial is proprietary, right?
12:47kotarakno
12:47RSchulzOh? Open Source?
12:47kotarakyes
12:47kotarakwww.selenic.com/mercurial
12:47RSchulzI know there's support for it in IDEA, but since I'm currently still a Subversion guy, I haven't paid much attention.
12:48kotarakmercurial is worth a try. Especially patch queues rock. :)
12:48gnuvinceRSchulz: like kotarak said, open source. It's coded in Python (and some C for performance)
12:48RSchulzPython! Gack!
12:48gnuvinceIt's very nice, very simple, very fast.
12:48kotarakBetter than spaghetti C with Perl.
12:48gnuvincetaking pot shots at Git, are we? :)
12:49RSchulzNot yet.
12:49kotarak;)
12:49gnuvince(not that I disagree)
12:49RSchulzFor an IRC newbie: How do you get that * kotarak <color=blue>couldn't resist</color> thing to happen?
12:49gnuvinceI don't mind git (though I mind the fanbois), but I have this gut feeling that Mercurial is just better written.
12:50kotarakhonest: I think hg or git don't give each other very much
12:50rsynnottRSchulz: /me bla bla
12:50Hunwith /me couldn't resist
12:50gnuvinceRSchulz: /me foo
12:50RSchulzGot it.
12:50RSchulzDid you ever hear Linus' talk at Google about Git? He sure comes off as arrogant!
12:50jtoycan anyone recomment anything simple for using sql in clojure?
12:50kotarakHi *is* arrogant.
12:50Chousukelinus is arrogant
12:50gnuvinceRSchulz: he is
12:50Chousukebut he always has a reason
12:50RSchulzOK, then. Just checking...
12:50gnuvincewell, people sure are in agreement
12:51rsynnottjtoy: you could always talk to JDBC :)
12:51gnuvinceBut he *did* mention in that talk that the *only* other SCM worth using (in his opinion) was Mercurial.
12:51RSchulzYou know, it's just that it wasn't long ago that I switched from CVS to SVN, and I'm not in the mood to switch again or learn yet another VCS scheme...
12:51jtoyis there something simple I could use kind of like activerecord, but for clojure?
12:51blackdogjtoy, clojure.contrib.sql
12:51kotarakRSchulz: SVN->hg is fairly simple.
12:51Chousukegnuvince: wasn't that monotone?
12:51kotarakYes, there are different concepts, but the handling feels very similar.
12:51gnuvinceChousuke: no, he said monotone sucked ass.
12:52RSchulzblackdog: Is that more than just a JDBC wrapper? Or is it more like a kind of ORM?
12:52gnuvinceChousuke: Mercurial was the only one that got a positive nod from him (though he immediatly followed it by "but, just use git instead")
12:52blackdogit's a simple interface to jdbc
12:52gnuvinceCVS and Subversion really got whipped bad in that presentation
12:52ChousukeI think monotone filled his other requirements but his reason for dumping it was that it was too slow.
12:52jtoyblackdog: ok, so if i never do java programming, does that mean i need to go install jdbc also?
12:52Chousukegnuvince: heh, yeah
12:53blackdogit's all in j2se
12:53RSchulzjtoy: I think you'll need JDBC drivers for the particular RDBMS you'll be accessing. That's always the case.
12:53Chousukekotarak: why is that a bad thing, though?
12:53jtoyhmm
12:53gnuvincekotarak: by hand you mean?
12:53kotarakYes. I expect the VCS to take care of this.
12:53Chousukekotarak: git often does an automatic repack
12:53gnuvinceDitto.
12:54Chousukebut sometimes you want to run it manually too
12:54kotarakChousuke: I prefer developming software instead of figuring out, whether I have to repack something.
12:55Chousukekotarak: then don't figure it out and let git do it for you
12:55gnuvinceFor my personal use, I haven't been disappointed by hg so far.
12:55gnuvincealso, it's 33% faster to type than git!
12:55Chousuke:p
12:55Chousukeis it 33% faster than git, though?
12:55kotarakChousuke: there were bloody wars over at the git guys whether git should do that or not...
12:55Hunespecially on dvorak. there it's about 50%
12:55RSchulzI like typing. It keeps my hands busy.
12:56Chousukekotarak: well, it does waste time when you *don't* want to repack in some cases.
12:56Chousukekotarak: in the end, it's configurable,
12:56RSchulzGiving you excuses for office light-sabre fights? (XKCD, you know)
12:56HunRSchulz: me too, as long as it's normal text. typing code in code (doesn't matter that much which language) is worse
12:56kotarakIn the end I found hg with patch queues and will never look back. :)
12:57RSchulzSo is Subversion pass� alreayd?
12:57gnuvincekotarak: unless git just becomes the de facto standard and it's no longer possible to ignore
12:57ChousukeI have nothing against hg either though.
12:57gnuvinceRSchulz: totally
12:57RSchulzI'm always on last year's trends...
12:57ChousukeI think both tools are excellent.
12:57kotarakgnuvince: sheesh to paint the devil on the wall!
12:58jeremy_____anybody ever use AccuRev?
12:58jeremy_____eek
12:58gnuvincekotarak: just saying...
12:58RSchulzjeremy_____: Is that for cleaning your contact lenses?
12:58kotarakHowever there are already sign: on the list someone wrote "Are there projects for Clojure? I searched at github and only found 5". I would use Google...
12:58jeremy_____lol yes it makes my eyes water when I use it
12:59gnuvincekotarak: hmmm
12:59ChousukeI doubt git will take over
12:59Chousukebut DVCS systems might.
13:00kotarakThat certainly.
13:00ChousukeI'm sure git and mercurial are capable of interacting with each other nicely, so in the end you could just use whichever you prefer.
13:00Chousukeheck, git is even pretty good with SVN :P
13:00kotarakgit-hg and hg pull-git. :)
13:01rsynnottat all
13:01kotarakThat would be nice indeed.
13:02RSchulzDid we drive cemerick away?
13:02RSchulzcemerick: Did you solve your FP programming problem?
13:04RSchulzWhat is the essential concept of a monad? I keep seeing it all over the place (well, at least in the Scala and lately the Clojure worlds).
13:04Chousukekotarak: how do you do local branches in hg btw?
13:05RSchulzAll I can think of when I see the name is "monadic" as in "of arity 1".
13:05Hunas far as i know, it's `do these things in this order. and really do them.' that's the main point i got from reading 10 tutorials without learning haskell
13:05kotarakNot at all. My projects are too small to bother. I use patches with guards if necessary. (Which has the advantage, that a patch may belong to several "branches").
13:06kotarak@Chousuke
13:06RSchulzIt just suppresses or precludes or expunges any laziness?
13:06Chousukekotarak: hm
13:07Chousukekotarak: I like branches.
13:07ChousukeI made some even for clojure for playing with some local changes
13:07kotarakChousuke: I like to experiment. I do that with patches. If I don't like the result I just delete them, otherwise I commit them in one go. No need for branches here.
13:08ChousukeI do that with branches in git :/
13:08kotarakAs I said: patch queues completely bought me out for hg.
13:08Chousukejust branch, work on experimental stuff as normal, and merge to master if the changes end up being useful.
13:09kotarakI think, there is also this commit isn't really commit thing in git, which probably allows similar stuff as with patch queues.
13:09Chousukewell, it is a commit in that it adds the changes to the repository.
13:09kotarakI think commit -a does that. There is some step inbetween.
13:10Chousukethe stuff goes to a "staging" area
13:10Chousukewhile you have uncommitted stuff you can switch between branches and bring the uncommitted stuff with you
13:10kotarakYeah. Someone tried to sell me this as "really cool". But I don't get, what the difference is to mq.
13:11Chousukeif that's not what you want, you can "stash" them away in a temporary commit.
13:11ChousukeI suppose in git, local branches just serve the same purpose as patch queues
13:11kotarakSo it the same as a patch or bzr shelf.
13:13Chousukeyou can do your work in a branch and clean up the commits later into one "commit set" that you could merge nicely into the master tree.
13:13danlarkinand that's also git-stash, which is a FILO stack you can push uncommitted changes to
13:14Chousukeit's pretty cool in git actually, you can make all the commits you want with bad commit messages and a lot of typos or stupid mistakes and whatnot, and as long as you don't do it in a public branch, you can clean up stuff later and everyone will think your code is perfect :P
13:15kotarakThat's something I banged against with hg: it typed non-sense in commit message but was too sleepy to notice. Now it's there and I can't get rid of it.
13:16kotarak(Not the commit itself, only the message...)
13:16danlarkinoh and don't forget about git-commit --amend
13:17danlarkinthat lets you amend the previous commit with no traces (as long as you haven't pushed anywhere yet... if you have it gets confusing for everyone)
13:17cemerickRSchulz, Hun: No, you didn't drive me away. wwmorgan straightened me out :-)
13:18kotarakAs long as I didn't push, I can fix the history with hg also.
13:18Hunah, ok :)
13:18kotarakWith a bit more work, though.
13:20RSchulzcemerick: OK. Good. We did get a little sidetracked there...
13:20RSchulzHas anyone used the Zipper?
13:21kotarakyes
13:21kotarakCool stuff.
13:21Chouserclojure.zip or something else?
13:22RSchulzThe Huet's Functional Zipper thing for doing tree editing.
13:23Chouseryeah, I believe that's what clojure.zip implements, and zip-filter is built on that. Very nice.
13:24RSchulzI have Huet's paper, but I haven't read it yet.
13:24RSchulzA little way down the line, I'd like to implement a tree editor oriented towards FOL formulas and SOL patterns.
13:25RSchulzRight now I do that stuff in Java, and it's mind-numbingly tedious and error-prone.
13:25RSchulzAnd opaque.
13:25RSchulzAnd my end users, who are not Java programmers, can't extend that part of my system.
13:26RSchulzI wonder if there are any Clojure implementations of unification (first-order or otherwise) out there?
13:57Chouserrhickey: if you care, here it is with watchers: http://clojure-euler.wikispaces.com/Problem+083
14:04rhickeyChouser: I expected no sends in calc
14:21rhickeymade re-pattern identity for patterns, now find-doc works with patterns too - svn 1138
14:25technomancyyeah, we need to get clojurebot announcing these kinds of things if only to save rhickey the bother of it. =)
14:26technomancywow, sourceforge creates RSS feeds for everything... except commits. awesome and useless.
14:27technomancyusing the github feeds will be a little less up-to-date, but way easier.
14:29drewolsontechnomancy: is someone mirroring clojure on github?
14:29technomancyclojurebot: git?
14:29clojurebotgit is http://github.com/kevinoneill/clojure/tree/master
14:29technomancydrewolson: ^
14:29drewolsonsweet
14:29technomancyindeed
14:30hiredmantechnomancy: svn info and svn log work on remote repos
14:30drewolsonare patches accepted through github, or only svn style
14:30hiredmansvn log -r $(svn info https://clojure.svn.sourceforge.net/svnroot/clojure |egrep "^Revision"|cut -d \ -f 2) https://clojure.svn.sourceforge.net/svnroot/clojure
14:30hiredman^- gets you the last commit log message
14:30technomancyhiredman: yeah, could shell out for that too. we really want "all commits since we polled last" though.
14:31technomancybut that's not hard to adapt that to
14:31technomancydrewolson: github is read-only unfortunately, patch submission is still old-school through the mailing list.
14:31hiredmanthere are also some svn java stuffs
14:31hiredmanhttp://svnkit.com/
14:31technomancyprobably want to avoid external deps if we can though
14:32hiredman*shrug*
14:32drewolsontechnomancy: cool, just wondering
14:32technomancyoddly enough I've read plenty about parsing XML in clojure but nothing about shelling out yet, which is why I was leaning to the feeds solution
14:32hiredmanwhell
14:32hiredmanwell
14:32hiredmanyou shell out the same way you do in java
14:32hiredmanI forget exactly, but you can do it
14:32technomancyI know more Javanese than Java. =)
14:35technomancyis there nothing simpler than this? (.. Runtime (getRuntime) (exec cmd))
14:36walterstechnomancy: nope
14:36drewolsonmaybe a system wrapper in contrib makes sense
14:36drewolson(system cmd)
14:36hiredmantechnomancy: http://weblogs.asp.net/britchie/archive/2006/09/02/RSS-Subversion-Change-Log-.aspx
14:36technomancydrewolson: that seems like a no-brainer to me
14:37drewolsonagreed
14:37hiredmanugh
14:37drewolsoni think the name system is fairly idiomatic, several languages use it
14:37technomancyit should be one function call to call a shell command and return its output as a string
14:38walterswell, should not encourage literal shell; subprocess invocation, sure
14:39technomancyyeah, not necessarily launching a new bash process or anything
14:39walters(system "touch foo") i.e. going through Unix shell is an API that will easily lead to security holes and tears for users; (system ["touch", "foo"]) is the right way to do it
14:40technomancywhat do you mean by security holes? isn't executing untrusted code of any kind a security hole?
14:40drewolsonwalters: what does the vector buy you? not sure i understand.
14:41waltersthe problem comes when you want to change foo to come from user input
14:42technomancythere's nothing to stop you from evaling user input either... sanitization is the job of the caller
14:42hiredmanclojurebot: jar directory?
14:42clojurebotjar directory is -Djava.ext.dirs=$LIBS
14:58Chouserrhickey: when watchers run, the agent's value has been set -- have sends been sent?
14:59rhickeyChouser: not yet
15:01Chouserbeautiful.
15:02Chouserand sends in watchers will go at (roughly) the same time as the sends held from the action?
15:03rhickeyChouser: yes, the very next thing. In what way does this matter for you? I've been thinking about taking the watcher notifications off of the action thread
15:04drewolsonthe docs on other libraries says that zippers should be available in the zip namespace, but the behavior i see in the repl is that it need to be qualified as clojure.zip. is this correct?
15:05AWizzArddrewolson: did you try to (require ...) or to (use ...) that lib?
15:05Chouserdrewolson: no need to 'require' clojure.zip
15:06drewolsonChouser: right, i'm not requiring it, it works fine. but the doc examples show it as available under the namespace zip, whereas it is actually clojure.zip
15:06Chouserit may have been called just 'zip' in earlier versions of Clojure.
15:07drewolsongotcha
15:11drewolsonit looks like within the clojure-contrib source, several files are almost duplicates. like the following: clojure/contrib/enum.clj and clojure/contrib/enum/enum.clj
15:12drewolsonthe only diff is the namespace line
15:12duck1123that's the support for pre-AOT locations
15:13drewolsonah, i see
15:13duck1123you want clojure/contrib/enum.clj if you're post-AOT
15:13drewolsoncool, i assumed as much
15:29technomancyso it looks like split-with only splits sequences in half. is there anything similar that doesn't stop at the first match?
15:32duck1123technomancy: so you're basically looking for a partition-with?
15:32technomancyduck1123: sounds like it; thanks
15:32duck1123doesn't actually exist
15:33technomancyoh... yeah just realized that
15:33duck1123I'm trying to figure out what you're trying to acomplish
15:33hiredmana lazy-seq of split-with over a seq
15:34zakwilsonI had to write my own when I needed that sort of thing (for parsing CSV).
15:34technomancyactually split-with is fine if I use recursion
15:44Lau_of_DK(doc wait)
15:44clojurebotI don't understand.
15:44Lau_of_DKnoob
15:47drewolsonis /usr/share the standard place to put jars used by several applications?
15:47hiredmanI dunno that there is one
15:48drewolsonok, just wanted to make sure i wasn't missing something
15:48hiredmanubano, debian, or solaris may have their own convetion
15:48hiredmanclojurebot: jar directory
15:48clojurebotjar directory is -Djava.ext.dirs=$LIBS
15:50Lau_of_DKrhickey: before you commit the next svn in about 12 minutes, could you please wrap all those atomic* types in some nice clojure goo. Preferably so that I dont have to think very much about what I choose, but still get maximum performance
15:51rhickeyLau_of_DK: unlikely
15:52Lau_of_DKIts a good suggestion though
15:53rhickeyNo, atoms correspond to the other Clojure reference types, the other atomics don't
15:53rhickeythis isn't just to save you from importing java.util.concurrent.atomic
15:56Lau_of_DKI was just thinking, that in some cases its better to use atomicInt or something like that, than a ref. And I think that, that should be a concern of the compiler, and not me
15:57rhickeyLau_of_DK: couldn't possibly be, they have different semantics, a human will have to choose
15:57Lau_of_DKOk, thats the conclusion I would reach myself, but I hoped you had some more insight :)
16:17aquanautIs the 'clojure beta book' a good intro for someone without FP experience?
16:20AWizzArdIn principle it is not the main goal of the book to teach FP. But as clojure is one of the (if not *the*) easiest FPL it can really make sense to have a look at it. The price is just one evening in the cinema with your gf and some popcorn.
16:20AWizzArdThat's for 2 hours of entertainment.. but the book is something you can have fun with for weeks :-)
16:21aquanautIs it oriented towards java programmers adopting clojure?
16:21AWizzArdAnd if you enjoy Clojure you may even want to get rid of your gf.
16:21aquanautNah, We can't live without women.
16:21AWizzArdWe can't live them, but also not without them.
16:21danlei if shes a good woman, she'll buy him the book ;)
16:21Lau_of_DKAWizzArd: That depends on where you live. In Poland the price of the books equals that of a 90m2 apartment with an old Mercedes incl.
16:22AWizzArdin London or Switzerland one could probably buy a mineral water for that amount of money
16:22aquanautIf anything
16:22AWizzArdSo, try to get the salary that a programmer gets in London, but live in China.
16:23AWizzArdaquanaut: read the table of contents, the preface and the example chapters
16:23rsynnottor one evening at the cinema alone with some more popcorn
16:23rsynnott(it's where they make all their money)
16:24AWizzArdaquanaut: in the TOC you will see that the preface will answer th question for who that book is and what you'll find in it.
16:24aquanautThx
16:25AWizzArdthe TOC don't reflect yet fully what will be in the book. For example we can expect chapter 5, which is about functional programming, to be longer than this one page, as the TOC says :-)
16:27technomancythe book is definitely worth it.
16:28RSchulzaquanaut: I just finished the third beta of the book, and I found it very informative and easy to follow.
16:29RSchulzI've done a lot of Java, some Lisp and no FP to date.
16:29aquanautDoes it covers workflow setups IDEs, etc?
16:30RSchulzThere's no real IDE support. Enclojure (for NetBeans) is not currently usable (compatibility something or other), but will be repaired in a few days.
16:30technomancyaquanaut: I don't think so
16:30RSchulzBut it does cover basic CLI setup, yet.
16:30technomancyRSchulz: slime is an IDE, for any definition of IDE that makes sense
16:31RSchulz..., _yes_.
16:31aquanautit covers slime or point you to slime?
16:31technomancyit doesn't cover slime, I just meant that clojure has some IDE support
16:31RSchulzSure, sure. But I don't live in that world. I don't recall seeing anything about it in the book, though. But I might have just glossed over it.
16:32aquanautOk. Basic CLI should be enough.
16:34technomancywhat do you call a clojure programmer anyway... clojurist? clojurer?
16:34technomancyclojurian?
16:34RSchulz"The Enclojed."
16:34ChouserI like clojurista, but clojurian seems common.
16:34technomancyclojurista sounds like it implies gender
16:34Lau_of_DKHe's a Richarian
16:35technomancyI like clojurer since it sounds like conjurer, but I could go with clojurian
16:35Chouseroh, I suppose. I was thinking like Sandinista
16:35Lau_of_DKSeriously, its called a Clojurist
16:35RSchulzThen you could do clojuristo / clojurista, but it's kind of Latinate-specific. Other places it might not come of with the same gender feel.
16:38hiredmanwhy does it matter?
16:38RSchulz_To whom_ does it matter? (Not me...)
16:38technomancyit doesn't; it's totally frivolous.
16:39rsynnottdo people do this for other languages?
16:39rsynnottC-er?
16:39rsynnott:)
16:39technomancyonly for dynamic languages, as far as I can tell.
16:40hiredmansmalltalker
16:40technomancysmalltalker, schemer, pythonista, rubyist, haskellite.
16:40technomancy(ok, I made that last one up)
16:40RSchulzGroovist?
16:40technomancythat should probably just be Groovy Dude.
16:41hiredmanor a Groove
16:42technomancyjust wait till you start getting into the compound nouns. (pride of lions, gaggle of geese, etc.) =)
16:42RSchulzMurder of crows.
16:43RSchulzWhat happens when someone invents the language called "Nude?"
16:43technomancyonly one way to find out
16:44technomancythere's a Clean language, so one must only imagine the existence of cleaning crews.
16:44rsynnotthow about brainfuck, theN?
16:45technomancyif you actually use it, worrying about what people call you is the least of your worries.
16:45ChousukeRSchulz: hm, Nude is something you could name a DE written in Nu :P
16:45hiredmanclojurebot: clojure is also a very attractive hammer with a nice heft to it
16:45clojurebotc'est bon!
16:45RSchulzA "DE?"
16:45Chousukedesktop environment.
16:45rsynnottand the more you worry about what people call you, the more they are likely to call you something unpleasant :)
16:45technomancyhiredman: oh nice, how old is "is also" in clojurebot?
16:46hiredmanuh, dunno, a week maybe?
16:46RSchulzAh. KDE, etc.
16:46ChousukeNu is a weird language.
16:46Chousukeit's got lispy syntax but it's not really a lisp :/
16:46hiredmannext time I meet a carpenter I am going to call him a hammerista
16:47technomancyclojurebot: clojure?
16:47clojurebotclojure is cheating
16:47hiredman(from well outside of tool range)
16:47technomancyhiredman: shouldn't it tell you there's more?
16:47Chousukemaybe clojure programmers should be clojurors or something
16:48hiredmantechnomancy: also makes a vector, and on look up randomly picks from the vector
16:48hiredmanclojurebot: clojure?
16:48clojurebotclojure > scheme
16:48technomancyhiredman: gotcha.
16:50mibusay, what's the idiomatic way to convert an Iterator to a seq?
16:51cemerickmibu: iterator-seq
16:52rhickey(find-doc "iterator")
16:52mibucemerick: thanks. it didn't appear in the Sequences doc page
16:52rhickeyfind-doc is your friend
16:53cemerickI like clojuremancers, myself
16:53rhickeycemerick: first I've heard that one
16:53miburhickey: yeah, it also doesn't appear in any doc section that I can recall. thanks about that one.
16:54cemerickrhickey: let Gibson be your guide :-P
16:56hiredmanok, even I am rolling my eyes at that one
16:56mibuI read something on the svn log that there is a new ref type--atom--is that a transaction free ref accessor?
17:01rhickeymibu: reference type, not transactional ref, it is like a synchronous agent, independent, shared-visibility state
17:02miburhickey: so, it's like using an agent in the same thread?
17:02Chouserrhickey: regarding agent ordering, I think it only mattered to me when I was touching the same state from both the action and the watcher
17:02Chousernow that I've moved all the state manipulation to the watcher, I don't think I care anymore.
17:02rhickeyChouser: if the watcher had to be a send, would you care?
17:03rhickeymibu: when you say (swap! atom fn) it happens right there
17:04miburhickey: nifty
17:04AWizzArdrhickey: earlier today you mentioned that Clojure does not support annotations yet. So this means that if I hava java code and want to extend it, and this java code expects annotitions here and there, I can't do this right now in Clojure, but must do it in java, right?
17:04mibutechnomancy: what's gibson?
17:04rhickeyAWizzArd: right
17:04technomancymibu: William Gibson, author of Neuromancer
17:04mibuoh
17:04AWizzArdrhickey: and are there plans to add annotations one day to Clojure?
17:05mibuhaven't read it. what's the clojure connection?
17:05hiredmanclojurebot: gibson is <reply>I love their guitars
17:05clojurebotRoger.
17:05Chouserrhickey: not quite sure what that means, but for this code I no longer care when the watcher happens, as long as its agent's value has been updated first.
17:06cemerickmibu: none, except -mancer is a good suffix to apply to anyone who wields the prefix to dramatic effect
17:06technomancymibu: someone just said "clojuremancer" above
17:06cemerickneuromancer, necromancer, clojuremancer
17:06cemerickit's been a long day
17:06mibucemerick: ah ;-)
17:07mibufor a second, I thought there was a new clojuremancer project.
17:07mibuit's a cool name.
17:09Lau_of_DKclojuremancer is really bad if you ask me
17:12mattreplrhickey: should I remove the "start-class" let from the patch? I was going for readability, but now it looks ugly to me.. maybe just rename the loop "c" to "lc" or find-field's "c" to "start-c"
17:12mibuLau_of_DK: to me it sounds like the name of a clojure debugger
17:13Kerris7_clojuremancer sounds cool
17:13Kerris7_do we have a name for clojure programmers yet :V
17:13danlarkinChousuke: I looked at Nu a while ago, it's an impressive body of work... but I wasn't attracted to it
17:14danlarkin-1 for boring sounding names like "rubyist". +1 for names like pythonista and djangonaut
17:15danlarkinChousuke: it's kinda just writing objc with different syntax
17:15Chousukeyeah
17:15mibuKerris7_: Wiki says mancer is from mante�a which is divination. If you want to give clojure programmers a god complex, which most lispers already have, that would be a good choice. I'd go with something more humble.
17:17technomancydjangonaut is awesome
17:18mibubut clojurenaut doesn't cut it.
17:36danlarkinok I can only think of one and I don't think it really implies the right things
17:37danlarkinclojurecrat
17:41Chouserclojurician, clojureer, clojurvator
17:47jeremy_____clojureposer
17:47jeremy_____jk
17:47Chouser:-)
17:48abrookspojure?
17:48kotarakclojurenator
17:48abrooksjurenyman?
17:49Kerris7Clojuron.
17:49abrooksjurke?
17:50Kerris7hahaha Jurkes
17:50abrooksjurenalist?
17:50ChousukeThe Jurg
17:51danlarkinsoup de jure
17:51abrooksdu jour (de jure is a legal term)
17:51abrooks:)
17:51danlarkinoh, sorry, du jure then
17:52abrooksI like the idea of "soup by-law" (de jure) -- reminicent of the Seinfeld Soup Nazi. ;-)
17:52technomancysometimes FP feels like walking around with a stack of dishes that's really tall and just thinking "man, I want to set this down somewhere" but not being able to. =)
17:53abrookstechnomancy: I know *exactly* what you mean. :)
17:53technomancythe funny thing is, the dishes don't fall over.
17:53danlarkinthat is a good simile
18:00technomancyshouldn't this destructure so that it returns :b? (let [[a b] (:a :b)] b)
18:00technomancywhat am I doing wrong?
18:01kotarakQuoting the '(:a :b)?
18:01technomancyoh, duh
18:02Chouseranother update, announced here because I know you're all just dying to read it: http://clojure-euler.wikispaces.com/Problem+083
18:14drewolsongo go euler
18:17jleslieanyone here playing with compojure?
18:18hiredmanjleslie: I have beening using it a little
18:18hiredmanmostly just replacing a few cgi scripts
18:19jlesliedo you know if the 'route' function has been renamed or anything?
18:19hiredmanI do not
18:19jleslieit's referenced in the docs but I seem to be getting Unable to resolve symbol: route in this context
18:19jlesliealright, I'll keep poking around.
18:20RSchulzuser=> (find-doc "route")
18:20RSchulznil
18:20RSchulzSeems like there's nothing of that name, at least in doc strings.
18:21RSchulzWhere do you see in the documentation? Which page?
18:23hiredmanRSchulz: this is in the compojure webframe work
18:23jlesliethis is from compojure's page on github
18:23jleslie(GET "/greet/:name"
18:23jleslie (str "Hello " (route :name)))
18:23RSchulzOh. Sorry. I don't know anything about that.
18:24jleslieno worries.
18:24hiredmanjleslie: I still see references to route all over the source
18:24hiredmanwhere are you using (route ...) ?
18:25jlesliehmm, perhaps i've buggered up the import on my servlet def.
18:25hiredmanI am not sure but I think route is a hash, and not a function, so it most likely would not have a doc string
18:26jlesliedoes this look right: (ns jleslie (:use (compojure html http)))
18:27hiredmanjleslie: how exaclt are you getting an error?
18:27hiredmanyou visit the webpage and get a stack trace?
18:27jleslie(defservlet main-servlet
18:27jleslie (ANY "/youdevice"
18:27jleslie (ht-homepage)
18:27jleslie (ANY "/youdevice/:user"
18:27jleslie (route :user))))
18:28jlesliethat seems to throw the error when I startup compojure.
18:29jlesliejava.lang.Exception: Unable to resolve symbol: route in this context (NO_SOURCE_FILE:0)
18:30hiredmanjleslie: try #(route :user)
18:30hiredmanI am not sure, but route may just be a hash bound in the environment where the function is run
18:33jleslieyeah, I think maybe my problem is something to do with me using that repl as the lisp mode in my emacs
18:34jleslieif I do a restart everything seems ok.
18:35hiredmanor wrap in []
18:36hiredmanit seems to expect either a function name in parens (this seems like bad idea) or a vector
18:40technomancyhiredman: everything in clojurebot right now works on a message/response basis. how would I use sendMsg outside of this cycle?
18:40technomancyfor instance, polling every so often for SVN changes and messaging the channel with them
18:43jlesliehiredman: thanks for the help! I understand now that route will onyl be bound when a request comes in so I can't play with it or evaluate things that refer to it in the repl.
18:44hiredmantechnomancy: just do it in another thread
18:46technomancyhiredman: sure, I'm just not sure how to invoke sendMsg. what should I pass as "this"?
18:48hiredman*bot*?
18:49technomancyah, thanks
19:01technomancyhow do you just sleep a thread for a given amount of time?
19:01technomancyhow do you just wait f
19:01technomancy(wups)
19:04hiredmantechnomancy: (Thread/sleep miliseconds)
19:04technomancythanks
19:08lisppaste8technomancy pasted "svn announcements for clojurebot" at http://paste.lisp.org/display/71460
19:08technomancy(I haven't tested the IRC-specific portions)
19:09technomancyhiredman: let me know what you think.
19:10technomancybonus fact: clojurebot will know "latest svn revision" automatically.
19:10hiredmanoooh
19:10technomancyof course, it means someone could go in and change it to some bogus value
19:10technomancybut it's got limiting so it won't spam the channel with 1139 messages if someone sets it to zero. =)
19:10hiredmanwell, we can set up a special cond clause for it
19:11technomancyif it's even worth worrying about
19:15technomancyhiredman: do you run clojurebot out of a repl?
19:16hiredmantechnomancy: yes
19:17hiredmanclojure.lang.Repl clojurebot.clj
19:17technomancyhardcore
19:18hiredman*shrug*
19:18hiredmanI like to reach in and muck with it while it's running
19:18technomancyyeah, sounds handy
19:19hiredmanI run it in a screen session, and I send code from vim using slime.vim
19:20technomancyhas the bzr => gist bridge setup been working fine for you?
19:23hiredmanuh
19:23hiredmanwell, it works
19:24hiredmanand I don't reall think about it
19:24hiredmanbut it is not ideal
19:30lisppaste8hiredman annotated #71460 with "*bot* is not a hash" at http://paste.lisp.org/display/71460#1
19:30hiredmanhuh
19:31hiredmanI guess I should have actually put comments there instead of just changing the code
19:31technomancyaha
19:31technomancywhat's a pojo?
19:31RSchulzPlain Old Java Object
19:31technomancyah
19:32hiredmanwhich is a misnomer
19:32hiredmansince in clojurebot pojo is a hash :P
19:32RSchulzNot "plain?" Not "old?"
19:32RSchulzPOCO
19:34technomancyseems a more descriptive name could be picked in this case, yeah
19:35RSchulzI wrote a (Java) library akin to JavaScript hashes. I called it StructuredValue (all my names are prosaic.)
19:38technomancyoh, I meant the pojo variable in clojurebot
20:18rosejnrhickey: it looks like eval is broken
20:19rosejnuser=> (eval (list + 1 2 3))
20:19rosejnjava.lang.ExceptionInInitializerError (NO_SOURCE_FILE:0)
20:20rhickeyrosejn: have you got a clean build? I get 6 here
20:22rosejnrebuilding now
20:23rhickeyrosejn: make sure you: ant clean
20:25rosejnok, found the problem
20:25rosejnit works when I build with ant
20:25rosejnbut not with maven
20:25rosejnI was trying to use the jar put in the target directory by maven
20:25rosejnit works with the clojure.jar from ant though
20:49technomancyclojure makes me so happy... the combination of keywords-are-functions and being able to pass around functions as values is just so slick
20:59RSchulzrhickey wrote make sure you: ant clean
21:00RSchulzWhen I read that, I realized I'd just been "svn up; ant" -ing for ages without issue, even as the AOT stuff came along. Was I just lucky?
21:02ChouserRSchulz: maybe. That's what I usually do, but if anything inexplicable happens, "ant clean" is a first step
21:03ChouserI've had to do that maybe a half-dozen times since March.
21:03RSchulzInexplicable? What else is there? Computers _never_ do what I want!
21:04RSchulz... Until I force them, that is.
21:04RSchulz"... The question is, who is to be master? ..."
21:05Chouserexactly. (= (ant clean) (gun :to-the 'head))
21:06RSchulz... Did I say _that_??
21:08Chouserhm, how else do you force it? :-)
21:08rosejnSo is maven supposed to work?
21:08RSchulzWell... If you know the name of a thing, you control it completely. That always seemed very Lisp-ish to me...
21:08rosejnor that is legacy or something?
21:09RSchulzMaven? Is it supposed to _anything_?
21:09rosejnI guess I just figured since there is a pom.xml, it was setup for maven.
21:09rosejnI don't know what's typical in Java land though
21:10RSchulzHuh. There it is (the pom.xml). Well, I don't know maven, just that ... opinions differ as to its virtue...
21:11rosejngot it. I'll go with ant
21:11RSchulzAfter all, ant does work.
21:11ChouserI think maven as worked in the past, but I don't know how many people actually use it.
21:11RSchulzSeriously, you should probably make sure Rich knows that the pom is possibly amiss.
21:12rosejnI think he knows now. He clued me in to doing a clean ant build.
21:17lisppaste8hiredman annotated #71460 with "no str-join function " at http://paste.lisp.org/display/71460#2
21:18Chouser(apply str (interpose "," [1 2 3]))
21:19hiredmanah
21:20hiredmanI wrote is using interleave
21:20hiredmanwhich takes a seq
21:20Chouser(clojure.contrib.str-utils/str-join "," [1 2 3])
21:20hiredmanso I had to use cycle
21:20Chouseryep.
21:20Chousergood use of what you knew about. :-)
21:20hiredmananyway, I don't have clojure.contrib :P
21:29hiredmanare there any zipper xml processing example/tutorials out there?
21:33Chousernot much, I think.
21:33Chouserhttp://netzhansa.blogspot.com/2008/10/trying-clojure.html
21:43Chouserns is hard
21:45lisppaste8Chouser pasted "zip, xml, zip-filter.xml example" at http://paste.lisp.org/display/71471
21:45Chouserhiredman: I had that laying around, if it helps at all.
21:46mgsDoes clojure more or less seamlessly integrate with existing Java code?
21:47Chousermgs: calling into existing Java code is completely seamless. Calling Clojure functions from Java was already pretty easy and recently got much easier.
21:47mgsall of my apps are JVM and I've been learning lisp recently and just found out about clojure. I don't want to go completely ecstatic but ... :)
21:47mgsthat is so cool
21:47Chousermgs: oh, it's okay. go ahead.
21:47Chouser:-)
21:47mgshahaha yayayayayaya!!!!!
21:48mgsi love learning that what i've already done is even more valuable than i thought!!
21:48Chouserwhich lisp have you been learning?
21:48mgsIs there anything special I should know about clojure, I just started on clojure.org, I had been using scheme.
21:48mgsscheme
21:49mgsI started with the little schemer :)
21:49Chouserclojure uses immutable things more than most lisps.
21:49mgsand started SITP
21:49mgser
21:49mgsSICP
21:50Chouserand has more natural support for more data structures than most lisps.
21:51mgsi have played with haskell a tiny bit too
21:52ChouserThe screencasts are the best introduction (if you don't want to pay for the book), if you don't mind the format.
21:52mgswell, this is very exciting! looks like i'll be up all night .. :)
21:52ChouserThen I'd look at the Data Structures and Sequences pages on clojure.org
21:54mgsi'll watch the screencasts now to start. i generally don't love programming screencasts (i feel like reading is much faster) but i'm super anxious to check it out.
21:55mgsChouser: thanks a lot for the info!
21:57hiredmanChouser: thanks
21:59mortis`humbly requesting help, the imported symbols, eg: String, say that theyre' a class (class String) => java.lang.Class
21:59mortis`yet they don't respond to methods on Class, eg: (.getName String) throws a NoSuchFieldError
21:59mortis`is there some way to get to the class that the symbol String represents?
22:01mortis`good evening
22:04Chousermgs: I prefer reading too, but there's just not much intro material yet that's as good as the screencasts
22:05drewolsonmortis`: i guess you could do (class (new String))
22:05Chousermortis`: it's FAQ question number one! ...if we had a FAQ. :-)
22:06Chousermortis`: short answer: (identity String)
22:06drewolsonmortis`: whoops, don't listen to me, answered the wrong question :)
22:11Chousermortis`: http://groups.google.com/group/clojure/msg/8fc6f0e9a5800e4b
22:12Chouserclojurebot: FAQ #1 is http://groups.google.com/group/clojure/msg/8fc6f0e9a5800e4b
22:12clojurebotc'est bon!
22:39mortis`Chouser thanks
22:42mortis`that was exactly what I was after
22:44Chouseryou're welcome
22:59lvijaywhere can i get the list of commands that clojurebot responds to?
22:59lvijayi know (doc X)
23:00lvijayclojurebot: help
23:00clojurebotexcusez-moi
23:00lvijayclojurebot: help
23:00clojurebotexcusez-moi
23:02Chouserclojurebot: where are you?
23:02clojurebothttp://gist.github.com/27733
23:03Chouserlvijay: you can pick through that code, I suppose.
23:03lvijayChouser: thanks
23:06lvijayclojurebot: how much do you know?
23:06clojurebotI know 70 things
23:08lvijay(- 2 3 (+ 3 9))
23:08lvijayclojurebot: (- 2 3 (+ 3 9))
23:08clojurebotTitim gan �ir� ort.
23:08lvijayclojurebot: (- 2 3)
23:08clojurebotExcuse me?
23:08lvijayi'll just download the code and play with it at my repl
23:09Chouserlvijay: can you talk to him in private?
23:09lvijayi will
23:09lvijayChouser: I will
23:10hiredmanhuh
23:10ChouserI meant instead of downloading. but whatever. :-)
23:14Chouser- is being interpreted as a range at line 127. I bet.
23:17lvijayquite possible
23:18lvijay+ and * don't work either
23:18Chouserhmph
23:20lvijayslash works tho
23:24Chouser(+ 1 2)
23:24clojurebot3
23:24Chouser(* 2 2)
23:24clojurebot4
23:25hiredman:(
23:25hiredmanbugs
23:51mattreplit's come up a few times, but has anyone started playing around with pattern/structure matching for dispatching?
23:59hiredmanbugs bugs bugs