2009-02-16
| 01:07 | technomancy | cooldude127: ping |
| 01:17 | technomancy | cooldude127: more ideas on date handling: http://gist.github.com/65034 |
| 01:17 | technomancy | please comment (and anyone else who's interested); will try to get feedback on the mailing list tomorrow. |
| 01:19 | Chouser | keyword arg to later and earlier accept both singular and plural? |
| 01:22 | Chouser | but the api looks nice. I'd use it. |
| 03:19 | Bracki | Can smaddy point me to a place where all the special character expresiions like #,@,` etc are explained? |
| 03:21 | Bracki | ,# |
| 03:21 | clojurebot | Eval-in-box threw an exception:EOF while reading character |
| 03:21 | Bracki | ,(doc #) |
| 03:21 | clojurebot | Eval-in-box threw an exception:No dispatch macro for: ) |
| 03:24 | xitam | Bracki: http://clojure.org/reader |
| 03:27 | Bracki | Aight, thx. |
| 03:29 | alinpopa | hey |
| 03:29 | alinpopa | 'morning |
| 03:29 | alinpopa | is there a way to display current clojure's version ? |
| 03:29 | alinpopa | java -cp $CLOJURE_JAR:$CLOJURE_CONTRIB_JAR clojure.main |
| 03:29 | alinpopa | this is how I'm using it ... |
| 04:21 | alinp | ,(+ 1 2) |
| 04:21 | clojurebot | 3 |
| 04:23 | eevar2 | (+ 1 2) |
| 04:23 | clojurebot | 3 |
| 04:35 | alinp | ,(doc recur) |
| 04:35 | clojurebot | java.lang.Exception: Unable to resolve var: recur in this context |
| 04:35 | alinp | ,(+ 1 2) |
| 04:35 | clojurebot | 3 |
| 09:22 | cooldude127 | damnit technomancy, why aren't you on here when i am? |
| 09:24 | Chouser | wouldn't it be great if there were some electronic communications mechanism that would hold your messages until the other person was available to read them? |
| 09:24 | cooldude127 | Chouser: he emailed me already, i just desire a more active discussion |
| 09:27 | Chouser | heh, ok. |
| 09:29 | cooldude127 | i'm curious about what other sort of representation he has in mind for dates internally |
| 09:29 | cooldude127 | cuz the way i understand it, if you want to stick with pure clojure, you're using either lists, vectors, or maps (or struct-maps) to represent all your data |
| 09:30 | cooldude127 | you can use objects if you dip into java |
| 09:30 | cooldude127 | like do a gen-class |
| 09:30 | rsynnott | well, clojure has structs |
| 09:30 | rsynnott | which are effectively objects |
| 09:30 | Chouser | he could just use a Date object |
| 09:31 | cooldude127 | Chouser: well, i wanted something more clojure-like. date objects are gross |
| 09:32 | cooldude127 | i'm using maps at the moment, which allows keyword access to year, month, hour, etc. |
| 09:32 | cooldude127 | (:year (today)) => 2009 |
| 09:32 | Chouser | yep |
| 09:32 | Chouser | I wasn't recommending anything, just speculating wildly. |
| 09:33 | cooldude127 | yeah |
| 09:33 | cooldude127 | but he seems to have ideas beyond maps, so i'm kinda wondering what he has in mind |
| 09:34 | cooldude127 | i don't see any reason why maps should not be sufficient, aside from the fact that we can't customize how they print, which i'm hoping will be fixed at some point soon thanks to you, Chouser |
| 09:34 | Chouser | well, I'm not sure how likely that is to make it in |
| 09:35 | Chouser | using a custom print method to make something that used to print as code to instead print as something that's not ... may not be a popular feature. |
| 09:35 | cooldude127 | Chouser: why not? i'm just curious cuz that seems like a really useful patch. not all data looks like vectors and maps |
| 09:37 | cooldude127 | Chouser: most object-oriented languages have a way to make objects print different ways, haskell has the Show type class, we need something :) |
| 09:37 | rsynnott | cooldude127: date objects handle a lot of nasty stuff for you |
| 09:37 | rsynnott | they're horrible because working with dates is horrible |
| 09:37 | Chouser | I'm still speculating here, but it seems to me to be sorta central to lisp that the things you print can be read again. |
| 09:38 | rsynnott | Chouser: well, depends |
| 09:38 | cooldude127 | rsynnott: yes they do, i haven't been writing this totally from scratch, i |
| 09:38 | rsynnott | most things in common lisp aren't, for instance |
| 09:38 | cooldude127 | 've been using the java Calendar api |
| 09:38 | Chouser | maybe if they print like #=(make-date 2009 02 16) or something. hm... |
| 09:38 | gnuvince | Morning guys |
| 09:38 | rsynnott | (arrays, symbols and lists are printed as readable, but pretty much nothing else) |
| 09:39 | Chouser | rsynnott: oh, really? well, then, maybe that patch has a decent chance after all. |
| 09:40 | cooldude127 | Chouser: that would be rather acceptable actually. anything that's less verbose than a damn hash which happens to have a timezone object attached to it |
| 09:40 | cooldude127 | s/hash/map/ |
| 09:40 | cooldude127 | i come from ruby world |
| 09:40 | rsynnott | actually, what cooldude127 is talking about looks very much like what the popular CL local-time library produces |
| 09:41 | rsynnott | (local-time:now) -> "@2009-02-16T11:52:16.692307-05:00" |
| 09:41 | rsynnott | but given that most things in Clojure ARE readable, it might not be appropriate |
| 09:41 | cooldude127 | but is stuff like #=(date 2009 1 1) readable? |
| 09:42 | cooldude127 | will that get read in as calling that function? |
| 09:42 | Chouser | yes |
| 09:42 | cooldude127 | well there we go! |
| 09:42 | durka42 | that sounds dangerous |
| 09:42 | Chouser | ,#=(sorted-map :a 1, :b 2) |
| 09:43 | clojurebot | {:a 1, :b 2} |
| 09:43 | durka42 | from a user-editable data file standpoint |
| 09:43 | Chouser | durka42: it's a strange mode -- the function is called, but the args are not evaluated, just read. |
| 09:43 | gnuvince | What does #= do? |
| 09:43 | durka42 | so those aren't really numbers? |
| 09:43 | durka42 | ,#=(class 1) |
| 09:43 | clojurebot | java.lang.Integer |
| 09:44 | Chouser | no, they're really numbers, but... |
| 09:44 | Chouser | ,#=(sorted-map :a (+ 1 4), :b 2) |
| 09:44 | durka42 | ,#=(class (System/getProperty "java.class.path")) |
| 09:44 | clojurebot | clojure.lang.PersistentList |
| 09:44 | clojurebot | {:a 5, :b 2} |
| 09:44 | Chouser | hm. |
| 09:44 | durka42 | ,#=(prn (System/getProperty "java.class.path")) |
| 09:44 | clojurebot | DENIED |
| 09:44 | cooldude127 | Chouser: you liee |
| 09:45 | Chouser | cooldude127: aparently I do. I clearly have a weak grasp on it. The thing's not documented -- it's used internally by print-dup |
| 09:45 | durka42 | ,#=(str (System/getProperty "java.class.path")) |
| 09:45 | clojurebot | "(System/getProperty \"java.class.path\")" |
| 09:45 | durka42 | but it didn't do that one |
| 09:45 | durka42 | although, it did when i tried to prn it |
| 09:45 | cooldude127 | maybe it evaluates safe stuff |
| 09:45 | cooldude127 | like math |
| 09:45 | cooldude127 | idk |
| 09:46 | Chouser | or maybe my math was eval'ed in a later stage. |
| 09:46 | cooldude127 | actually #=(sorted-map :a a) doesn't work either |
| 09:46 | cooldude127 | a gets evaled |
| 09:46 | durka42 | ,#=(list :a a) |
| 09:46 | clojurebot | java.lang.Exception: Unable to resolve symbol: a in this context |
| 09:46 | cooldude127 | but #=(class a) gives symbol |
| 09:46 | durka42 | ,#=(System/getProperty "java.class.path") |
| 09:46 | clojurebot | Eval-in-box threw an exception:System |
| 09:47 | Chouser | ,#=(str :a b) |
| 09:47 | clojurebot | ":ab" |
| 09:47 | durka42 | only in the current namespace? |
| 09:47 | cooldude127 | durka42: don't worry, that soooo doesn't work |
| 09:47 | Chouser | as I said, strange mode. |
| 09:47 | cooldude127 | i tried #=(System/exit 1) and it threw an exception |
| 09:47 | Chouser | I wasn't lying about that part. |
| 09:47 | Chouser | cooldude127: but only because of clojurebot's sandbox |
| 09:48 | Chouser | cooldude127: it works in a regular repl |
| 09:48 | cooldude127 | Chouser: no it doesn't |
| 09:48 | cooldude127 | not on mine |
| 09:48 | Chouser | ,#=(java.lang.System/exit 1) |
| 09:48 | cooldude127 | class not found System |
| 09:48 | cooldude127 | oh |
| 09:48 | Chouser | ah! |
| 09:48 | Chouser | sorry! |
| 09:48 | cooldude127 | LOL |
| 09:49 | durka42 | whoops |
| 09:49 | Chouser | shoot, I was sure it would catch that. :-( |
| 09:49 | durka42 | hiredman: bat signal! |
| 09:49 | Chouser | well, nobody really promised that 'read' was completely safe. |
| 09:50 | cooldude127 | lol |
| 09:50 | durka42 | perhaps that is a bug |
| 09:51 | jbondeson | Chouser: didn't we have a similar conversion about reading having side effects last week? |
| 09:51 | cooldude127 | Chouser: this is why i want this patch: this is not an acceptable printed date representation: {:type :clojure.contrib.chrono/Date, :year 2009, :month 1, :day 1, :zone "America/New_York"} |
| 09:51 | cooldude127 | but this is acceptable: #=(date 2009 1 1) |
| 09:52 | Chouser | durka42: I don't know if it's a bug or not. I think this sort of thing is meant to work: #=(java.util.HashMap. {:a 1}) |
| 09:52 | durka42 | does clojurebot read things outside the sandbox? |
| 09:52 | durka42 | i'm thinking it has to, if System/exit worked |
| 09:52 | Chouser | oh, I see -- a bug in clojurebot. could be. |
| 09:52 | Chouser | I've never looked at his code. |
| 09:53 | durka42 | his dispatch architecture is pretty nifty |
| 09:53 | cooldude127 | yeah agreed |
| 09:54 | Chouser | jbondeson: i guess reading well-behaved text doesn't have side effects. :-) |
| 09:54 | jbondeson | hahaha |
| 09:54 | durka42 | well, i'm thinking from an application standpoint it's nice to initialize settings by just (read-string (slurp "data-file")) |
| 09:54 | durka42 | but that isn't safe |
| 09:55 | durka42 | maybe this strange mode could incorporate a "safe list" of functions that are OK to call? |
| 09:55 | jbondeson | yeah... that's just not pretty |
| 09:55 | durka42 | or namespaces |
| 09:56 | Chouser | this is odd, though, because I used to have a clojurescript repl that sent strings to my server to be read and compiled to JS |
| 09:57 | Chouser | before I turned it on, I tried several such dangerous-looking #=() forms, and concluded it was safe enough. |
| 09:57 | durka42 | hmm |
| 09:57 | Chouser | I wonder if I just completely failed to test it right. |
| 09:57 | durka42 | or things could have changed |
| 09:57 | Chouser | anyway, at the moment I'm pleased to have turned that off. :-) |
| 09:58 | Chouser | http://clojurescript.n01se.net/repl/ now uses an applet. You can do whatever you'd like to your own machine. |
| 09:58 | durka42 | i wonder if this also punches a hole right through clojurebot's blacklist |
| 09:58 | durka42 | #=(defn works in the repl |
| 09:59 | Chouser | i was wondering that too |
| 09:59 | durka42 | however, i need to go now |
| 09:59 | Chouser | but #=(def x 1) doesn't. how odd. |
| 10:00 | durka42 | well, def is a special form |
| 10:00 | durka42 | defn is a macro |
| 10:00 | Chouser | right |
| 10:01 | durka42 | i shall return |
| 10:01 | djpowell | Re dates, Joda Time, is a Java Date API that makes heavy use of immutable objects and is proposed for incorporation in Java 7. Probably worth a look. |
| 10:01 | hiredman | smooth guys |
| 10:02 | Chouser | hiredman: so sorry. :-( |
| 10:02 | Chouser | I like clojurebot and i mean him no harm. |
| 10:03 | hiredman | :P |
| 10:05 | hiredman | ~def defn |
| 10:06 | jbondeson | ,(assoc {} :bot-hater "Chouser") |
| 10:06 | clojurebot | {:bot-hater "Chouser"} |
| 10:13 | cooldude127 | let's talk programming fonts! consolas vs. inconsolata |
| 10:13 | jbondeson | consolas |
| 10:16 | cooldude127 | i used to use it, i've forgotten how they compare |
| 10:16 | jbondeson | very similar |
| 10:16 | cooldude127 | and now i'm killing myself trying to find a download for consolas for mac |
| 10:18 | cooldude127 | i may need to just install cabextract |
| 10:19 | jbondeson | the only real differences i can see is that inconsolata is a little more rounded.. |
| 10:19 | cooldude127 | idk i'm never satisfied |
| 10:19 | jbondeson | things like 'C' and '{' |
| 10:24 | cooldude127 | and found it |
| 10:43 | cooldude127 | man this room is dull |
| 10:45 | danlarkin | you're dull! |
| 10:45 | cooldude127 | lol |
| 10:46 | pilkarn | to make an mp3player you just use a decoder, doe sthe OS has automatic "streamer" for video too, you just need the right decoder? |
| 10:48 | rsynnott | you killed the poor little bot?! |
| 10:48 | cooldude127 | apparently i was not aware of the change that allowed defmulti to have a docstring without ugly metadata map |
| 10:48 | cooldude127 | nice |
| 10:48 | Chouser | cooldude127: ah, I missed that too. thanks. |
| 10:49 | Chouser | must have come along with per-defmulti hierarchies |
| 10:49 | cooldude127 | Chouser: it was funny how i found it. i was writing a new multimethod, and i saw in the minibuffer that slime was showing doc-string? as one of the args |
| 10:49 | ayrnieu | no, it's older than that. |
| 10:49 | cooldude127 | Chouser: what are these per-defmulti hierarchies you speak of? |
| 10:49 | Chouser | cooldude127: hm, nice. i don't have that. |
| 10:50 | cooldude127 | Chouser: what are you using? |
| 10:50 | Chouser | nothing |
| 10:50 | cooldude127 | Chouser: WHAT? |
| 10:50 | Chouser | (doc defmulti) |
| 10:50 | clojurebot | Creates a new multimethod with the associated dispatch function. The docstring and attribute-map are optional. Options are key-value pairs and may be one of: :default the default dispatch value, defaults to :default :hierarchy the isa? hierarchy to use for dispatching defaults to the global hierarchy; arglists ([name docstring? attr-map? dispatch-fn & options]) |
| 10:51 | cooldude127 | Chouser: is the clojure.org page for hierarchies updated with information about this? |
| 10:51 | cooldude127 | i'm so lazy i could just check myself |
| 10:51 | Chouser | the web pages in general are meant to reflect the latest release, not svn HEAD (experimental branch docs notwithstanding). So my guess is no. |
| 10:52 | cooldude127 | we have releases? |
| 10:53 | cooldude127 | and it does cover make-hierarchy and such |
| 10:53 | Chouser | yeah, that's older. |
| 10:53 | cooldude127 | oh ok. well that's enough |
| 10:53 | Chouser | latest release: http://code.google.com/p/clojure/downloads/list |
| 11:07 | hiredman | ,#=(java.lang.System/exit 1) |
| 11:07 | clojurebot | access denied (java.lang.RuntimePermission exitVM.1) |
| 11:07 | cooldude127 | woo hoo |
| 11:07 | hiredman | Excelard |
| 11:07 | dreish | ,#=(num 1) |
| 11:07 | clojurebot | 1 |
| 11:07 | dreish | Interesting. |
| 11:08 | hiredman | yeah |
| 11:08 | hiredman | I just moved the (read ...) into the sandbox |
| 11:08 | dreish | Makes sense. |
| 11:08 | hiredman | where it should have been from the begining |
| 11:10 | cooldude127 | well good then :) |
| 11:11 | Chouser | You're welcome for the test case. |
| 11:11 | cooldude127 | lol |
| 11:11 | hiredman | :) |
| 11:12 | dreish | Anyone happen to know whether arg destructuring in the lazier branch uses the new rest, or next a.k.a. old rest? |
| 11:13 | dreish | Or better yet, a link where I can browse the branch's source online? |
| 11:13 | danlarkin | dreish: at google code |
| 11:14 | danlarkin | ~source |
| 11:14 | clojurebot | source is http://github.com/hiredman/clojurebot/tree/master |
| 11:14 | danlarkin | erf, |
| 11:14 | danlarkin | ~source rest |
| 11:14 | dreish | Ah, thanks. |
| 11:14 | danlarkin | that's trunk though |
| 11:14 | Chouser | dreish: next -- as in, nil punning is allowed |
| 11:14 | danlarkin | so change the branch in the browser |
| 11:14 | dreish | Oh yeah, it's pretty easy to find. |
| 11:15 | Chouser | ,(let [[a & b] [1]] (class b)) |
| 11:15 | clojurebot | nil |
| 11:15 | dreish | Chouser: That's too bad. One of the things I was hoping for from this was easier porting of Haskell code. |
| 11:15 | Chouser | try that in a lazy branch repl to see it yourself. |
| 11:16 | Chouser | you really need the extra laziness there? |
| 11:16 | dreish | Usually. |
| 11:17 | dreish | It's not that hard to rewrite things to be lazier, but I just think it would be nice if it could be almost a transliteration from Haskell. |
| 11:17 | cooldude127 | dreish: that's what i was hoping the lazy branch would be |
| 11:17 | cooldude127 | EVERYTHING LAZY |
| 11:17 | dreish | I'm not sure it would be nice enough to justify the cost of rewriting everything that uses destructuring, though, since that's harder than just s/rest/next/g. |
| 11:18 | cemerick | is there a canonical post in the group (or some other resource somewhere) that discusses the various printing mechanisms? (print-method, print-dup, etc) My grasp of the interactions in that area isn't up to snuff. |
| 11:28 | Chouser | cemerick: not that I know of. print-dup has hardly been discussed at all. |
| 11:29 | Chouser | you can poke around in core_print.clj to get a sense of how the print-method works. |
| 11:29 | cooldude127 | wait what's print-dup |
| 11:29 | cooldude127 | (doc print-dup) |
| 11:30 | cooldude127 | ~(doc print-dup) |
| 11:30 | clojurebot | No entiendo |
| 11:30 | cooldude127 | ,(doc print-dup) |
| 11:30 | clojurebot | "; " |
| 11:30 | rhickey | dreish: yeah, maybe a destructuring variant [[a &rest b]] ? |
| 11:30 | cooldude127 | well then |
| 11:30 | Chouser | (doc *print-dup*) |
| 11:30 | cemerick | Chouser: yeah, that's what I'm doing. I think I basically have it, but I'm guessing I'm not going to do something the "right way" |
| 11:30 | clojurebot | When set to logical true, objects will be printed in a way that preserves their type when read in later. Defaults to false. |
| 11:30 | cooldude127 | ohhh |
| 11:31 | cooldude127 | oh so like hashmaps will be hashmaps ands sorted-maps will be sorted? |
| 11:31 | Chouser | cooldude127: exactly |
| 11:31 | cooldude127 | got it |
| 11:31 | Chouser | cooldude127: and java.util.HashMaps will be java.util.HashMaps |
| 11:31 | cooldude127 | ok |
| 11:32 | Chouser | cooldude127: and System/exit will kill your bot |
| 11:32 | cooldude127 | lol |
| 11:32 | Chouser | ,(binding [*print-dup* true] (prn (new java.util.HashMap. {:a 1, :b 2}))) |
| 11:32 | clojurebot | java.lang.ClassNotFoundException: java.util.HashMap. |
| 11:33 | Chouser | huh |
| 11:33 | cooldude127 | ,(binding [*print-dup* true] (prn (new |
| 11:33 | cooldude127 | java.util.HashMap {:a 1, :b 2}))) |
| 11:33 | clojurebot | EOF while reading |
| 11:33 | Chouser | ,(binding [*print-dup* true] (prn (sorted-map :a 1, :b 2))) |
| 11:33 | clojurebot | #=(clojure.lang.PersistentTreeMap/create {:a 1, :b 2}) |
| 11:33 | cooldude127 | Chouser: you messed up by using new AND having a . after hashmap |
| 11:33 | Chouser | oh. indeed. |
| 11:33 | cooldude127 | ,(binding [*print-dup* true] (prn (new java.util.HashMap {:a 1, :b 2}))) |
| 11:33 | clojurebot | #=(java.util.HashMap. {:b 2, :a 1}) |
| 11:34 | cooldude127 | nice |
| 11:34 | cooldude127 | the only way to change *print-dup* is to surround in binding, right? |
| 11:35 | Chouser | cooldude127: afaik, yes |
| 11:36 | cooldude127 | yeah nothing else seems to work |
| 11:36 | cemerick | hah! Since my genbean impl inherits from PersistentStructMaps, I get a perfect serialized form for free when I print with *print-dup* bound to true -- now I just need to write a single 'create' fn. :-D |
| 11:38 | cooldude127 | anybody know a way for a computer to determine eigenvalues/vectors without symbolic math? |
| 11:50 | dreish | rhickey: (re &rest) I was wondering about that, but looking at the destructure fn, I couldn't tell whether that would make it infeasibly complex. |
| 11:50 | dreish | It's already very big. |
| 11:51 | Chouser | dreish: that's a fun function, eh? :-) |
| 11:51 | dreish | Yes. |
| 11:52 | dreish | I'm just glad it happens at compile time. |
| 11:52 | Chouser | & is also supported by pre-destructuring fn (and loop?) forms, but I guess that wouldn't necessarily have to change. |
| 11:54 | dreish | Just when I thought I understood something ... |
| 11:57 | stuartsierra | Hi, all. In the lazy branch, I can't write (doall (map f c)), right? |
| 11:57 | stuartsierra | It has to be (doall (seq (map f c)))? |
| 11:57 | silkarn | ayrnieu: you never answered yesterday, what is so bad about Haskell? it inspired Clojure a lot, I find Haskell to be very elegant in so many ways(althouhg the Io Monad is not my dearest friend always) |
| 11:58 | Chouser | stuartsierra: no, I think your first example is fine |
| 11:59 | Chouser | stuartsierra: in what way do you think it might fail? |
| 11:59 | stuartsierra | Chouser: clojure.contrib.walk didn't work right in the lazy branch; that seemed to fix it. |
| 12:00 | stuartsierra | But the problem only shows up when trying to use "are" in clojure.contrib.test-is. |
| 12:01 | Chouser | doall appears to return a LazySeq in the lazy branch |
| 12:01 | ayrnieu | silkarn, #haskell is a more suitable channel for a defense of haskell. |
| 12:01 | Chouser | ...although it still is fully realized first |
| 12:02 | Chouser | stuartsierra: you must be fixing up test-is a bit as well? |
| 12:02 | stuartsierra | Chouser: Not changing anything, just trying to make it work in the lazy branch. |
| 12:03 | stuartsierra | Chouser: just had to replace "rest" and "rrest" with next/nthnext. |
| 12:03 | Chouser | ok |
| 12:05 | Chouser | stuartsierra: you have the assert-if-lazy-seq flag on? |
| 12:05 | stuartsierra | yes |
| 12:07 | stuartsierra | The form with a problem is this: (are (= _1 _2) :a :a :b :c) |
| 12:08 | Chouser | I'm getting Unable to resolve symbol: _1 |
| 12:08 | stuartsierra | That's what I get. |
| 12:09 | stuartsierra | Until I change this one line in clojure.contrib.walk: |
| 12:10 | stuartsierra | From (seq? form) (outer (doall (map inner form))) |
| 12:10 | stuartsierra | To (seq? form) (outer (doall (seq (map inner form)))) |
| 12:12 | Chouser | someone should branch contrib, even without any changes, so we have a place to put fixes as we find them. |
| 12:12 | Chouser | :-D |
| 12:13 | stuartsierra | Just trying to stay anonymous. :) |
| 12:17 | Chouser | I've not used 'walk' before, but calling postwalk-replace directly appears to do the right thing |
| 12:17 | cemerick | Is it the case that print-dup is meant to be a superset of the level of "readability" provided by "regular" print-method impls? I'm not clear on when I *wouldn't* just bind *print-dup* all the time, I suppose. |
| 12:17 | cemerick | sorry, still trying to get some clarity, and the content I've found on the group so far isn't specific enough for me :-) |
| 12:17 | Chouser | cemerick: the output of *print-dup* is a bit ugly for, say, a repl. |
| 12:18 | Chouser | I think that's the main difference. |
| 12:18 | Chouser | or rather, the main reason for there being a difference. |
| 12:18 | cemerick | Chouser: ah, OK -- so print-method impls should be human-readable, and nominally clojure-readable, whereas print-dup impls should provide the highest-fidelity serialization possible? |
| 12:18 | Chouser | that's my understanding, yes. |
| 12:18 | rhickey | cemerick: right |
| 12:19 | stuartsierra | Chouser: yes. There's something very subtle going on in the interaction of walk, template, and test-is. |
| 12:19 | cemerick | OK, got that. |
| 12:19 | Chouser | and right there is the difference between the BDFL and a lowly hanger-on. :-) |
| 12:19 | Chouser | stuartsierra: yes |
| 12:20 | cemerick | rhickey: what's the etymology of print-dup, BTW? |
| 12:21 | Chouser | cemerick: ah, I've got a link for that one if you give me a sec... |
| 12:21 | stuartsierra | FYI: I created /branches/lazy in contrib, in SVN rev. 472. |
| 12:21 | Chouser | stuartsierra: thanks!! |
| 12:22 | stuartsierra | Welcome. I'm not a big SVN user, but I think it's right. |
| 12:23 | Chouser | cemerick: http://clojure-log.n01se.net/date/2008-11-06.html#19:57 |
| 12:25 | stuartsierra | rhickey: what does that imply? |
| 12:25 | cemerick | Chouser: ah-ha. Hey, if I had been following the channel then, we could have lengthened that conversation by at least another 20 minutes! :-P |
| 12:26 | rhickey | stuartsierra: things will be much simpler without 2 seq[uence] types, but the first/rest/next thing stays the same |
| 12:27 | rhickey | bbl - will push code and modified docs - this looks like a winner |
| 12:27 | dreish | To trunk? |
| 12:28 | stuartsierra | Ok, I'll take a look after lunch. :) |
| 12:28 | Chouser | dreish: I would doubt it. |
| 12:29 | dreish | Oh, I see. Got rid of the Sequence class, pushing that to the branch. |
| 12:29 | dreish | I just don't want to miss the big exciting merge. |
| 12:29 | dreish | Especially since merges are such a clusterf*** in SVN. |
| 12:31 | pilkarn | can a tuple not be of length 3? |
| 12:31 | pilkarn | wrong channel |
| 12:32 | cooldude127 | pilkarn: what language was that for? haskell? scala? |
| 12:32 | Chouser | python? |
| 12:33 | Chouser | python as tuples, but getting one of length 3 would be trivial, so probably not. |
| 12:33 | cooldude127 | Chouser: any language i know with tuples has no problem with any length |
| 12:33 | Chouser | haskell might require the number of args in the constructor function name, right? |
| 12:33 | cooldude127 | Chouser: tuples in haskell are just like (1,2,3) |
| 12:33 | Chouser | hm. |
| 12:34 | dreish | What a riddle you have given us, pilkarn. |
| 12:34 | ayrnieu | ,(defn tuple [a b] [:tuple a b]) ;; no, they can only have two arguments. |
| 12:34 | clojurebot | DENIED |
| 12:34 | cooldude127 | lol he may never come back |
| 12:34 | cooldude127 | then we'll never know |
| 12:35 | Chouser | ~google can a tuple not be of length 3? |
| 12:35 | clojurebot | First, out of 289000 results is: |
| 12:35 | clojurebot | Tuples |
| 12:35 | clojurebot | http://greenteapress.com/thinkpython/html/book013.html |
| 12:35 | dreish | Python it is, then. |
| 12:35 | cooldude127 | lol |
| 12:37 | hiredman | http://en.wikipedia.org/wiki/Tuple |
| 12:38 | cooldude127 | tuples should always be able to be whatever length |
| 12:38 | albino | In python a tuple of length 3 is as easy as (1, 2, 3) |
| 12:38 | WizardofWestmarc | yeah |
| 12:38 | WizardofWestmarc | just can't modify it after, have to make a new one :P |
| 12:38 | albino | he must have been doing something much more interesting |
| 12:39 | dreish | Oh? So you think you know better than Google's supercomputers, with their silicon chips and such? |
| 12:40 | albino | oh, if that was directed at me, then the answer is yes |
| 12:42 | gnuvince | ayrnieu: have you caught the blog post I promised? |
| 12:42 | ayrnieu | I did! Thanks. |
| 12:42 | cooldude127 | richard cobbe's thesis about null in java looks like something i've been wondering about lately |
| 12:43 | gnuvince | ayrnieu: cool :) |
| 12:47 | Chouser | cooldude127: link? |
| 12:47 | cooldude127 | http://www.ccs.neu.edu/scheme/pubs/dissertation-cobbe.pdf |
| 12:48 | Chouser | thanks |
| 12:49 | cooldude127 | basically boils down to: why is java's type system so sucky? |
| 12:49 | cooldude127 | at least as far as i have read |
| 12:50 | gnuvince | Couldn't they just copy C#'s nullable types? |
| 12:50 | gnuvince | int x; // Non-nullable type |
| 12:50 | gnuvince | int? x; // Nullable type |
| 12:50 | cooldude127 | cuz at the moment, existing java code would EXPLODE |
| 12:50 | hiredman | Doctor of Philosphy in the field of Computer Science |
| 12:50 | hiredman | cute |
| 12:50 | cooldude127 | lol |
| 12:52 | gnuvince | See, that's why Rich should not feel bad about breaking Clojure *now* with rest/next and do the right thing *before* there's too much code out there that just cannot afford breaking changes |
| 12:52 | albino | how is a Nullable type different from using NPEs? In the Nullable type case you end up using an if instead of a try/catch, right? |
| 12:53 | cooldude127 | albino: nullable types encode the information that this variable can or can't be null in the type system |
| 12:53 | gnuvince | albino: as I understand it (I don't really have any experience with C#), you cannot pass a nullable type to a function that expects a non-nullable type. |
| 12:53 | WizardofWestmarc | yeah I prefer Rich to feel like it's ready for prime time before 1.0 and it takes off to another level or two |
| 12:53 | albino | cooldude127: I figured that, still doesn't answer my question |
| 12:53 | gnuvince | The compiler will scream at you |
| 12:53 | WizardofWestmarc | although following the twitter traffic on clojure is interesting |
| 12:53 | WizardofWestmarc | it's escalating |
| 12:53 | cooldude127 | albino: the compiler can now check that stuff |
| 12:54 | cooldude127 | albino: NPEs are at runtime, but with nullable types the compiler can check if you're doing something wrong |
| 12:54 | gnuvince | WizardofWestmarc: link? |
| 12:54 | WizardofWestmarc | http://search.twitter.com/search?q=clojure |
| 12:54 | WizardofWestmarc | you can see all references to clojure with that |
| 12:55 | WizardofWestmarc | and it updates pretty fast based on tests where I've mentioned clojure and then waited for it to give the refresh message |
| 12:59 | te | i just found a cool clojure-related domain name |
| 12:59 | te | trying to dfecide on the .org or the .com |
| 12:59 | te | maybe .org just for street cred |
| 12:59 | Chouser | injure.com is already taken |
| 12:59 | te | lol |
| 12:59 | ayrnieu | clojurebot: jure words |
| 12:59 | clojurebot | http://gist.github.com/54847 |
| 13:00 | cooldude127 | lol foreclojure |
| 13:00 | WizardofWestmarc | get both |
| 13:00 | WizardofWestmarc | domains are cheap |
| 13:01 | hiredman | but they pile up |
| 13:01 | WizardofWestmarc | I still regret not taking the .net and the .org for my domain because someone else grabbed the .net while I've barely used my .com and now wants the .com, which is just annoying :P |
| 13:01 | hiredman | like buying songs from itunes |
| 13:01 | te | mine isnt on there |
| 13:01 | te | WizardofWestmarc: domains are cheap UNTIL you have to renew 30 of them the same week |
| 13:02 | cooldude127 | haha |
| 13:02 | hiredman | yeah |
| 13:02 | te | wow, 7$ for a .net |
| 13:03 | WizardofWestmarc | heh |
| 13:03 | WizardofWestmarc | they still cost $30+ if you buy through network solutions :P |
| 13:03 | WizardofWestmarc | and I think Yahoo! as well |
| 13:03 | cooldude127 | whyyyy |
| 13:04 | te | because people dont know any better |
| 13:04 | WizardofWestmarc | because NS are *insert lots of swearwords here*? <_< |
| 13:04 | cooldude127 | lol |
| 13:04 | WizardofWestmarc | actually what was ugly, last i heard yahoo charged something like $10 for the first year |
| 13:04 | WizardofWestmarc | but the auto renewals were something like $30 |
| 13:05 | cooldude127 | stupidddd |
| 13:05 | WizardofWestmarc | there's a reason I stick to GD |
| 13:05 | WizardofWestmarc | though right now I have the extra ~$10 for private entry |
| 13:07 | hiredman | I did not do the private thing, and got a few calls from people who wanted to make a website for me |
| 13:09 | WizardofWestmarc | heh really? bleh |
| 13:10 | WizardofWestmarc | I'll probably unprivate it once I launch what I'm going to put on the site |
| 13:10 | WizardofWestmarc | but not before |
| 13:10 | te | hehe I registered getclojure.com/.org |
| 13:10 | te | "I--I just need to get clojure *sob*" |
| 13:11 | WizardofWestmarc | you know, findclojure.com would be an amusing domain name as well, what with the many meanings ;-) |
| 13:11 | WizardofWestmarc | see how many typoing people looking for counciling you can sucker in >_> |
| 13:11 | te | lol id give them code |
| 13:12 | te | (defn your-mood [scale]) |
| 13:13 | te | (Or maybe I'd proceed to tell them how their life is probably great compared to me-- I spent hours of my life learning something most people will never care about." |
| 13:21 | cooldude127 | if i'm saying that a function in clojure returns a sequence, does that mean it returns a vector, list, etc. that can be used with the seq functions, or that it returns one of those that has had seq called on it already |
| 13:24 | WizardofWestmarc | I'd expect it to be the actual seq object, with who knows what underlying it |
| 13:24 | WizardofWestmarc | though technically I think that's same difference |
| 13:25 | cooldude127 | WizardofWestmarc: ok, just wondering what the right way to document stuff is |
| 13:25 | WizardofWestmarc | actually I'm going to test something, one sec |
| 13:26 | WizardofWestmarc | hm |
| 13:27 | WizardofWestmarc | may be off, conjing a seq of a vect works like a list/seq, not a vector |
| 13:27 | hiredman | cooldude127: (class ...) |
| 13:27 | hiredman | ,(class (map identity [:a :b :c])) |
| 13:27 | clojurebot | clojure.lang.LazyCons |
| 13:28 | WizardofWestmarc | although if you class a seq of a vect it returns persistantvector |
| 13:28 | hiredman | ,(class (reduce conj '() [:a :b :c])) |
| 13:28 | clojurebot | clojure.lang.PersistentList |
| 13:28 | WizardofWestmarc | well |
| 13:28 | WizardofWestmarc | APersistantVector$Seq |
| 13:28 | cooldude127 | it's not as important anymore cuz i'm using map, so it's definitely a seq |
| 13:28 | hiredman | ~def seq |
| 13:35 | cooldude127 | how big is the cutoff between array maps and hash maps? |
| 13:35 | Chouser | 32 |
| 13:36 | cooldude127 | oh |
| 13:36 | cooldude127 | makes sense |
| 13:38 | Chouser | that's wrong, |
| 13:38 | cooldude127 | Chouser: close enough, 33 is a hashmap |
| 13:38 | cooldude127 | but so is 31 |
| 13:39 | Chouser | 9? |
| 13:39 | cooldude127 | idk this is fine, it was more a curiousity |
| 13:39 | Chouser | 9 is an array-map, 10 is a hash-map. |
| 13:40 | cooldude127 | ok good to know |
| 13:40 | Lau_of_DK | Good evening gents |
| 13:40 | danlarkin | Hi Lau! |
| 13:41 | danlarkin | got a name for me? |
| 13:41 | Lau_of_DK | c l a b a n g o ! |
| 13:41 | danlarkin | no way man |
| 13:42 | danlarkin | that's worse than copter |
| 13:42 | Lau_of_DK | :( |
| 13:55 | rhickey | Sequence-free lazy is up, new doc at: http://clojure.org/lazy |
| 13:56 | Lau_of_DK | cool |
| 13:59 | clojurebot | svn rev 1283; [lazy] got rid of Sequence, (seq iseq) no longer an identity, ISeqs can be empty, PersistentList.EMPTY and LazySeq.EMPTY are ISeqs, rest returns ISeq |
| 13:59 | rhickey | No changes to code already ported other than to switch back to seq? since sequence? is gone |
| 14:00 | WizardofWestmarc | rhickey: so nil punning is still out in lazy? |
| 14:00 | rhickey | WizardofWestmarc: there is still next and seq |
| 14:01 | WizardofWestmarc | *nods* |
| 14:01 | Chouser | why is (seq iseq) not being identity important? |
| 14:02 | rhickey | Chouser: it's just a change |
| 14:02 | rhickey | hopefully it's not important |
| 14:02 | rhickey | It was an important optimization inside Clojure itself, but I figured out another way |
| 14:03 | Chouser | ok |
| 14:03 | hiredman | the "Don't hang (onto) your head" fills me with non-specific dread |
| 14:03 | rhickey | but the change just covers (seq ()) -> nil, since () is a seq now |
| 14:04 | Chouser | "Sequence fns (map, filter etc) don't (necessarily) return seqs, but Sequences" |
| 14:04 | rhickey | hiredman: there's nothing new about that, just that it's less likely |
| 14:04 | cooldude127 | sometimes i just love loop/recur, it's just so elegant sometimes |
| 14:04 | ayrnieu | cooldude - read The Little Schemer for a deeper appreciation :-) |
| 14:04 | WizardofWestmarc | I like it because it helps me catch when I don't have my TC in the tail position |
| 14:05 | WizardofWestmarc | since I'm so bad at doing that wrong :P |
| 14:05 | rhickey | Chouser: fixed - thanks |
| 14:05 | cooldude127 | i like it because i can be doing a simple tail recursion where it calls to the function it's in, but if i need to have something done before that, i just wrap it in a loop and i don't need an auxillary function |
| 14:10 | stuartsierra | Ported clojure.contrib.duck-streams to lazy branch, SVN rev. 473. |
| 14:10 | rhickey | stuartsierra: lazy 1283? |
| 14:11 | Chouser | rhickey: why the use of the Cons constructor rather than just the cons fn, in the final example at http://clojure.org/lazy |
| 14:11 | stuartsierra | rhickey: yes |
| 14:11 | rhickey | stuartsierra: awesome! |
| 14:12 | stuartsierra | rhickey: That was the easy one. :) |
| 14:12 | rhickey | stuartsierra: good |
| 14:12 | Chouser | template/test-is/walk still misbehaving? |
| 14:13 | stuartsierra | Chouser: working on that next. |
| 14:13 | Chouser | ok |
| 14:15 | Chouser | I think rhickey fixed it. |
| 14:15 | rhickey | Chouser: remnant, fixed in 1284 and doc - thanks |
| 14:16 | Chouser | rhickey: np! |
| 14:16 | rhickey | so, is this (1283+) simpler? |
| 14:17 | stuartsierra | Committed test_is.clj using next/nthnext (rev. 474). Still need to test 'are' & templates. |
| 14:17 | Chouser | Based on just reading the docs, I think nicely simpler, yes. |
| 14:17 | Chouser | stuartsierra: it's fixed already. |
| 14:18 | Chouser | stuartsierra: your "are" example now works fine as of 1283 |
| 14:19 | stuartsierra | Chouser: so it does. Thanks, Rich! |
| 14:19 | clojurebot | svn rev 1284; [lazy] straight cons call in filter |
| 14:20 | gnuvince | rhickey: when do you plan to merge lazy into trunk? |
| 14:21 | Lau_of_DK | Has anyone here had some experience with the JMonkey Engine? |
| 14:21 | rhickey | gnuvince: RSN |
| 14:21 | gnuvince | rhickey: cool |
| 14:22 | gnuvince | I'm going to check my lib, but there are no calls to rest and only one to lazy-cons. |
| 14:22 | gnuvince | I think the conversion is gonna be real easy :) |
| 14:27 | stuartsierra | Committed lazy/.../json/write.clj (rev. 475); only renamed rest to next, all tests pass |
| 14:29 | hiredman | clojurebot: svn? |
| 14:29 | clojurebot | svn is http://clojure.googlecode.com/svn/trunk/ |
| 14:34 | stuartsierra | Fixed re-partition in clojure.contrib.str-utils for lazy; SVN rev. 476 |
| 14:35 | stuartsierra | danlarkin: oh I wish |
| 14:35 | stuartsierra | danlarkin: Really, though, these are trivial changes. |
| 14:35 | jbondeson | only a bot would say that! |
| 14:35 | Chouser | clojurebot could announce contrib commits too, couldn't he? |
| 14:36 | stuartsierra | Chouser: yes, that would be nice. |
| 14:41 | Lau_of_DK | Java question, when I want my Clojure proggy to have a structure like this class calc extends GCalc { public static void myadd(int x, int y) { ... } }, How do I mimic that in Clojure? |
| 14:42 | Chouser | static -- does that mean GCalc does not have a myadd method? |
| 14:42 | hiredman | depends, are you adding a new method or changing the behaviour of an existing method? |
| 14:43 | Lau_of_DK | Chouser: Yea |
| 14:43 | Lau_of_DK | hiredman: Adding |
| 14:43 | hiredman | gen-class |
| 14:44 | Chouser | ~gen-class |
| 14:44 | clojurebot | No, Chouser, you want gen-interface + proxy |
| 14:45 | Lau_of_DK | Come now boys, gen-class was sent into retirement by AOT right? |
| 14:45 | hiredman | nope |
| 14:45 | hiredman | just changed |
| 14:45 | cooldude127 | Lau_of_DK: it lives in (ns) |
| 14:45 | Lau_of_DK | hiredman: Can you give me an example? |
| 14:46 | hiredman | uh |
| 14:46 | jbondeson | you cannot extend objects with proxy, correct? |
| 14:46 | hiredman | the only place I used, I used it very badly |
| 14:46 | hiredman | jbondeson: correct |
| 14:46 | jbondeson | time for SUPERPROXY |
| 14:47 | hiredman | http://gist.github.com/34229 |
| 14:47 | hiredman | macro generates standalone (gen-class ...) forms |
| 14:47 | Lau_of_DK | thanks |
| 14:47 | hiredman | (not in a ns form) |
| 14:48 | thearthur | does clojure contrib have something to write a bunch of ints or sequences of ints to an open file? |
| 14:48 | Chouser | thearthur: as ascii text? |
| 14:48 | Lau_of_DK | (spit ...) |
| 14:48 | Lau_of_DK | or is it spew ? |
| 14:48 | Lau_of_DK | (doc spit) |
| 14:49 | Chouser | ,(println [1 2 3 4]) |
| 14:49 | hiredman | (binding [*out* (FileWriter. "somefile")] (println (range 100))) |
| 14:49 | clojurebot | [1 2 3 4] |
| 14:49 | thearthur | Lau_of_DK, tak! |
| 14:49 | Lau_of_DK | Selv tak min ven :) |
| 14:50 | thearthur | Chouser, as 64 bit ints |
| 14:50 | Chouser | ah. I don't know of any such thing |
| 14:53 | stuartsierra | Committed seq_utils.clj in lazy branch; changed lazy-cons to lazy-seq, but haven't tested everything. |
| 14:54 | gnuvince | rhickey: if one wants to avoid unnecessary eagerness, should we stay clear of destructuring? |
| 14:58 | technomancy | heh; spew/slurp would be almost as awesome as spit/slurp |
| 14:59 | cooldude127 | technomancy: woah you're here |
| 15:00 | gnuvince | technomancy: do you have an idea why slime-interrupt doesn't work in swank-clojure? |
| 15:02 | technomancy | gnuvince: I've not touched the internals of swank-clojure at all, just the setup stuff. |
| 15:03 | technomancy | cooldude127: hey. did you take a look at that date stuff I sent you? |
| 15:03 | cooldude127 | technomancy: yeah, in fact i was wondering what you had in mind for other internal representations |
| 15:03 | gnuvince | technomancy: ok |
| 15:04 | gnuvince | technomancy: does it work for you? |
| 15:04 | technomancy | gnuvince: I haven't tried it at all. I often just end up killing my inf-lisp buffer and restarting; I'm sure there's a better way though |
| 15:05 | technomancy | need to spend some Quality Time with the slime manual |
| 15:05 | Bracki | What ecavtly does lazy-cat do? |
| 15:06 | technomancy | cooldude127: I think I need to learn how gen-interface works. I'm not so sure I like using just a map, but I'm not sure how one constructs a new data type. |
| 15:06 | cooldude127 | Bracki: eventually concatenates two things |
| 15:06 | cooldude127 | technomancy: idk, it feels anti-clojure to me to use anything else |
| 15:06 | gnuvince | technomancy: ok; I find it annoying to do all the (use) and (import) that I had |
| 15:08 | technomancy | cooldude127: well the problem I see is that if you're going to implement stuff like (later-than christmas 1 :month) and keep the internal representation as a map, you're going to need to do tons of useless translation back and forth between the two formats. |
| 15:08 | cooldude127 | :( dates suck |
| 15:09 | Bracki | I'm trying to understand the fibonacci code using lazy-cat but I just don't get it. |
| 15:10 | cooldude127 | Bracki: trust me, it's confusing |
| 15:10 | technomancy | cooldude127: well I really don't know if that's the right way, but I think it at least merits some more investigation |
| 15:10 | cooldude127 | yeah you're right |
| 15:10 | cooldude127 | i'm really not sure |
| 15:10 | technomancy | cooldude127: what do you think of the other functions I specced? |
| 15:10 | cooldude127 | everything looked good to me |
| 15:11 | technomancy | cooldude127: mostly I tried to think of what I like best about date libs from Ruby |
| 15:11 | hiredman | Bracki: are sure it is lazy-cat? not lazy-cons? |
| 15:11 | Bracki | yes |
| 15:11 | technomancy | and translate that into non-OO-speak |
| 15:12 | hiredman | ,(lazy-cat '(1) '(2)) |
| 15:12 | clojurebot | (1 2) |
| 15:12 | hiredman | ^- that is what lazy-cat does |
| 15:12 | cooldude127 | technomancy: the one thing that i wonder about is having parse guess the format. i have no idea how to make that happen, java doesn't support it i don't think |
| 15:12 | lisppaste8 | Bracki pasted "fibs with lazy-cat" at http://paste.lisp.org/display/75585 |
| 15:13 | hiredman | ah |
| 15:13 | hiredman | so lazy-cat is lazy |
| 15:13 | hiredman | so is map |
| 15:13 | hiredman | so that turns into a lazy seq of (0 1 ..promise to compute the rest..) |
| 15:13 | Bracki | So every element is evaluated when it is taken right? |
| 15:14 | hiredman | yes |
| 15:14 | cooldude127 | Bracki: yes, otherwise if they were all evaluated now, that would go infinitely |
| 15:14 | hiredman | so it sort of rolls over on itsself |
| 15:14 | technomancy | cooldude127: well I was thinking of trying each of the known formats in order of likelihood until a sane result was reached |
| 15:14 | cooldude127 | yes |
| 15:14 | technomancy | but I don't know if that would work |
| 15:14 | technomancy | a smarter approach may be necessary |
| 15:14 | Bracki | Alright lets say I do (take 4 fibs). What happens for 3 and then 4? |
| 15:14 | cooldude127 | technomancy: yeah i'm not really sure how to do that. tho ruby is open source, maybe see how it does it |
| 15:15 | hiredman | well, the map happens |
| 15:15 | technomancy | cooldude127: yeah, but that part's in C... ugh! =) |
| 15:15 | cooldude127 | Bracki: your head explodes trying to understand it |
| 15:15 | cooldude127 | technomancy: what about rubinius? |
| 15:15 | cooldude127 | technomancy: do they have that working? wouldn't it be in ruby? |
| 15:15 | technomancy | cooldude127: worth a shot. that's lower-priority than most of the other functions though |
| 15:15 | cooldude127 | yeah |
| 15:15 | hiredman | the map is on fibs which is (0 1 ..promise to compute the rest..) and (rest fibs) which is (1 ..promise to compute the rest..) |
| 15:16 | hiredman | and map is mapping + |
| 15:16 | cooldude127 | Bracki: so you end up with (0 1 (+ 0 1) (+ 1 1) ...) |
| 15:16 | cooldude127 | it's scary how it works |
| 15:17 | hiredman | use the substitution model |
| 15:20 | cooldude127 | i'm doin it! i'm writing a damn symbolic math system in clojure |
| 15:20 | cooldude127 | i've made the namespace |
| 15:20 | cooldude127 | there's no going back |
| 15:20 | jbondeson | cooldude127: DOOOON'T DOOOO ITTT |
| 15:20 | cooldude127 | jbondeson: I MUST |
| 15:20 | jbondeson | there's no going back after this |
| 15:20 | cooldude127 | lol |
| 15:21 | cooldude127 | i have to, it will make everything easier |
| 15:21 | jbondeson | it's like killing a man, once you write a symbolic math library you're never the same |
| 15:21 | cooldude127 | lol |
| 15:21 | cooldude127 | jbondeson: have you done it? |
| 15:21 | jbondeson | no, but i've... seen things... things no man should have to |
| 15:21 | cooldude127 | haha |
| 15:22 | cooldude127 | well in the name of all that is holy, i'm telling infix to go jump off a bridge |
| 15:22 | cooldude127 | so that should eliminate at least a few problems |
| 15:22 | technomancy | "I knew the risks!" |
| 15:22 | technomancy | (http://qwantz.com/archive/001406.html) |
| 15:23 | cooldude127 | lol |
| 15:24 | jbondeson | cooldude127: it's not sybolic math if you throw out the most common notation! |
| 15:24 | cooldude127 | jbondeson: fuck infix! i don't love it. all i want is to have variables in my stuff |
| 15:25 | cooldude127 | i'll do what i want |
| 15:25 | jbondeson | "Reality is what *I* define it to be!" |
| 15:25 | cooldude127 | EXACTLY |
| 15:26 | cooldude127 | if i want to use prefix notation, damnit i will! |
| 15:26 | jbondeson | RPN is for calculators and COMMIES |
| 15:26 | cooldude127 | haha |
| 15:26 | WizardofWestmarc | who says the calculators aren't commies? |
| 15:27 | jbondeson | their both after our precious fluids |
| 15:27 | jbondeson | they're even |
| 15:32 | pilkarn | how do I do if I want to call a Clojure-function from Java? I do compile with gen-class to generate class-files and then I import what? the namespace and refer to it like namespace.function(params); ? |
| 15:37 | Bracki | Does anybody have some pointers to an easy parser written in Clojure? I'm about to write a Markdown parser. |
| 15:38 | Bracki | Or rather as far as I get tonite. |
| 15:38 | danlarkin | Bracki: http://github.com/joshua-choi/fnparse/tree/master |
| 15:38 | pilkarn | how do I make (System/exit 0) not kill the repl? |
| 15:39 | danlarkin | pilkarn: why do you want to do that? |
| 15:39 | gnuvince | pilkarn: don't call it? |
| 15:39 | Bracki | danlarkin: I meant *easy* ;) |
| 15:39 | technomancy | quote it. =) |
| 15:40 | gnuvince | pilkarn: http://java.sun.com/javase/6/docs/api/java/lang/System.html#exit(int) |
| 15:40 | danlarkin | Bracki: it's a steep, but short, learning curve |
| 15:40 | gnuvince | It terminates the JVM |
| 15:41 | danlarkin | Bracki: much more fun than reading a string char-by-char, believe me |
| 15:42 | gnuvince | Or having a regex mess |
| 15:42 | briancarper | Bracki: I was actually starting to write a Markdown parser too. I was going to use ANTLR. Didn't get very far though. |
| 15:42 | Bracki | I prefer the regex mess then. |
| 15:43 | briancarper | The original Markdown.pl was a regex mess, and if you make a proper parser with a proper grammar, it will probably break compatibility. So I've read. |
| 15:44 | technomancy | heh |
| 15:47 | Bracki | Well who needs a Markdown parser anyways... |
| 15:52 | gnuvince | if you go with the regex mess, you can probably just copy markdown.pl and be done with it in less than 4 hours |
| 15:54 | Bracki | That's even harder to read... |
| 15:55 | gnuvince | fnparse then :) |
| 15:55 | Bracki | No way, cause my Clojure is less than basic and I don't understand anything thats happening there... |
| 15:56 | danlarkin | Bracki: it's not too difficult :) |
| 15:56 | Bracki | Considering that the lazy-cat fibs stuff makes my head explode it is. |
| 15:56 | danlarkin | do you know much about formal grammar or automata? |
| 15:57 | Bracki | I did. |
| 15:58 | danlarkin | then it's a breeze, you build rules from the bottom up to match bigger and bigger parts of the markdown spec |
| 15:58 | danlarkin | like you'd start with a whitespace rule |
| 15:58 | Bracki | But I wouldnt know how to handle multiple lines. |
| 15:59 | danlarkin | well if you want to match a newline then use a rule to match \newline |
| 15:59 | danlarkin | if you don't, then just... don't match them |
| 15:59 | danlarkin | see? easy :) |
| 16:00 | jbondeson | heh |
| 16:00 | jbondeson | there's a reason people use parser-generators |
| 16:00 | briancarper | Parsing Markdown requires at least two passes, I think. One to extract the links first. |
| 16:00 | danlarkin | because they're small minded! |
| 16:01 | jbondeson | danlarkin: either that or efficiency minded |
| 16:01 | danlarkin | jbondeson: parser combinators can run in polynomial time |
| 16:02 | danlarkin | if they use memoization correctly |
| 16:02 | danlarkin | fnparse doesn't, but it could |
| 16:06 | Bracki | Hm, so how do I replace stuff in a string? |
| 16:08 | technomancy | (doc re-sub) |
| 16:08 | technomancy | clojurebot: hey! |
| 16:08 | clojurebot | excusez-moi |
| 16:08 | technomancy | clojurebot: (doc re-sub) |
| 16:08 | clojurebot | No entiendo |
| 16:08 | danlarkin | it's in str-utils I believe |
| 16:08 | technomancy | clojurebot: (use 'clojure.contrib.re-sub) |
| 16:08 | clojurebot | clojure is a very attractive hammer with a nice heft to it |
| 16:08 | technomancy | clojurebot: (doc clojure.contrib.re-sub) |
| 16:08 | clojurebot | clojure is cheating |
| 16:08 | hiredman | ,(use 'clojure.contrib.re-sub) |
| 16:08 | clojurebot | java.io.FileNotFoundException: Could not locate clojure/contrib/re_sub__init.class or clojure/contrib/re_sub.clj on classpath: |
| 16:08 | technomancy | bah |
| 16:09 | technomancy | ,(doc clojure.contrib.str-utils) |
| 16:09 | clojurebot | java.lang.Exception: Unable to resolve var: clojure.contrib.str-utils in this context |
| 16:09 | hiredman | ,(use 'clojure.contrib.str-utils) |
| 16:09 | clojurebot | java.io.FileNotFoundException: Could not locate clojure/contrib/str_utils__init.class or clojure/contrib/str_utils.clj on classpath: |
| 16:09 | technomancy | ,(doc clojure.contrib.str-utils/re-sub) |
| 16:09 | clojurebot | java.lang.Exception: Unable to resolve var: clojure.contrib.str-utils/re-sub in this context |
| 16:09 | hiredman | *shrug* |
| 16:09 | jbondeson | clojurebot is anti-contrib |
| 16:09 | technomancy | jbondeson: yeah, when was the last time he contributed a patch anyway? slacker. |
| 16:10 | jbondeson | clojurebot: sharing is caring |
| 16:10 | clojurebot | 'Sea, mhuise. |
| 16:11 | cooldude127 | clojurebot: sharing? |
| 16:11 | clojurebot | sharing is caring |
| 16:11 | cooldude127 | lol |
| 16:12 | jbondeson | he'll be ditching us and teaching preschoolers in no time |
| 16:12 | technomancy | is this an appropriate use of cons? (str-join "\n " (cons "You are carrying:" @*inventory*)) |
| 16:13 | Bracki | re-gsub is it. |
| 16:24 | pilkarn | (fn [[x y] z](y (* x x))) isnt that allowed? |
| 16:24 | pilkarn | , ((fn [[x y] z] (* x y)) [10 20]) |
| 16:24 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--933$fn |
| 16:25 | pilkarn | how do I destructure there |
| 16:25 | pilkarn | , ((fn [[x y]] (* x y)) [10 20]) |
| 16:25 | clojurebot | 200 |
| 16:25 | pilkarn | ah |
| 16:26 | Bracki | zomg the markdown.pl code is really awful. |
| 16:27 | ayrnieu | where is it? |
| 16:27 | hiredman | ~google markdown.pl |
| 16:27 | clojurebot | First, out of 59600 results is: |
| 16:27 | clojurebot | Daring Fireball: Markdown |
| 16:27 | clojurebot | http://daringfireball.net/projects/markdown/ |
| 16:27 | ayrnieu | OK. Is that what you're looking at, Bracki? |
| 16:29 | gnuvince | fnparse isn't looking so bad now, is it? |
| 16:30 | Bracki | Yeah but the whole detabbing unspacing stuff is even worse in a grmammar for my taste |
| 16:30 | Bracki | ayrnieu: yes |
| 16:30 | Bracki | trying to translate the _detab subrotuine |
| 16:30 | Bracki | http://code.google.com/p/python-markdown2/source/browse/trunk/lib/markdown2.py#386 This one is easiert to understand. |
| 16:31 | stuartsierra | Or just use http://sourceforge.net/projects/markdownj/ |
| 16:32 | ayrnieu | oh, I was expecting something written in perl4. This this OK. |
| 16:32 | Bracki | stuartsierra: Yeah, but the point is to learn clojure. |
| 16:32 | ayrnieu | But why are you reading the code anyway? Implement the documentation. |
| 16:33 | stuartsierra | Bracki: ok, go for it! |
| 16:33 | Bracki | ayrnieu: true |
| 16:33 | technomancy | Bracki: I hate to discourage you, but I'm not sure that's a great first project for clojure. |
| 16:34 | skogs | there is also a haskell parsec like library in google groups files |
| 16:34 | technomancy | it doesn't seem to address any of the language's strengths |
| 16:34 | skogs | its based on clojure.contrib.monads code |
| 16:34 | Bracki | technomancy: probably not, but project euler is boring. |
| 16:35 | technomancy | Bracki: I had a lot of fun implementing a game. |
| 16:35 | Bracki | What kinda game? a MUD thingy? |
| 16:36 | technomancy | ~mire |
| 16:36 | clojurebot | Huh? |
| 16:36 | technomancy | Bracki: yeah, exactly: http://github.com/technomancy/mire/tree/master |
| 16:36 | pilkarn | how do you do extends or implments from Clojure? |
| 16:36 | hiredman | ~mire is http://github.com/technomancy/mire/tree/master |
| 16:36 | clojurebot | Alles klar |
| 16:36 | pilkarn | how do I make (System/exit 0) not kill the repl? |
| 16:37 | pilkarn | how do I do if I want to call a Clojure-function from Java? I do compile with gen-class to generate class-files and then I import what? the namespace and refer to it like namespace.function(params); ? |
| 16:37 | Bracki | technomancy: Ah, saw that yesterday while browsing a friends following list on github. |
| 16:39 | stuartsierra | pilkarn: if you declare your method as static in gen-class. |
| 16:40 | Bracki | The thing is, functional programming isn't made for me. I like filter,map and list comprehensions but I have those in Python as well ;( |
| 16:40 | pilkarn | Bracki: it takes time |
| 16:40 | WizardofWestmarc | you don't have the same guarantees of data safety though |
| 16:41 | pilkarn | ayrnieu: can you explain to me why you think all Haskell code is useless? |
| 16:41 | hiredman | Bracki: what about it turns you away? |
| 16:41 | Bracki | The special characters and the lack of coherent docs. |
| 16:42 | hiredman | eh? that doesn't seem to be a functional programming issue |
| 16:42 | Bracki | No, but I makes code even less readable for my taste. |
| 16:43 | hiredman | *shrug* |
| 16:43 | technomancy | Bracki: you get used the special characters pretty quickly |
| 16:44 | technomancy | give it a week or so |
| 16:44 | Bracki | Or rather what turns me away is, I don't have any problems to solve that require functional programming. |
| 16:44 | technomancy | the docs will take longer than a week, of course |
| 16:44 | technomancy | ah! that is a little harder to address. =) |
| 16:45 | Bracki | It has either been solved or turns out to be too hard. |
| 16:45 | WizardofWestmarc | the thing is, learning the functional style can arguably make even your non-functional programming better |
| 16:45 | stuartsierra | Nothing *requires* functional programming, but it can be very concise and elegant. |
| 16:45 | hiredman | I see you have been misinformed, all problems require functional programing |
| 16:45 | WizardofWestmarc | because of the new way it teaches you to think |
| 16:45 | stuartsierra | Yes. :) |
| 16:46 | technomancy | but coming up with a learning project can be tricky; no doubt about that. |
| 16:46 | Bracki | That's alright. I did a fair bit of scheme/guile but it's not how I tick. |
| 16:46 | hiredman | (ha ha guile) |
| 16:47 | cooldude127 | anything involving math is more fun in a functional language |
| 16:47 | cooldude127 | :) |
| 16:52 | pilkarn | does java have an import as statement? it is either import java.io.*; then File or java.io.File ? |
| 16:52 | pilkarn | import java.io.* as I; I.File would be better, as in Python |
| 16:54 | stuartsierra | pilkarn: No, Java doesn't have package aliases. |
| 16:55 | Lau_of_DK | Whats the syntax for gen-class' :expose ? |
| 16:55 | Lau_of_DK | I need to expose com.jme.app.SimpleGame's protected method getRootNode |
| 16:55 | Lau_of_DK | How do I do ? |
| 16:55 | Lau_of_DK | The things that you do ? |
| 16:56 | hiredman | why functional programming matters is <reply>http://www.math.chalmers.se/~rjmh/Papers/whyfp.pdf |
| 16:56 | hiredman | er |
| 16:56 | hiredman | ~why functional programming matters is <reply>http://www.math.chalmers.se/~rjmh/Papers/whyfp.pdf |
| 16:56 | clojurebot | You don't have to tell me twice. |
| 16:57 | jbondeson | i tell yeah, clojurebot just gets more uppity by the day... |
| 16:57 | hiredman | Lau_of_DK: http://clojure.org/api#gen-class has a bit about :expose |
| 16:57 | stuartsierra | Lau_of_DK: I think you want :exposes-methods |
| 16:57 | Bracki | Well, more Euler than. What's sqrt in clojure? |
| 16:57 | hiredman | ,(Math/sqrt 25) |
| 16:57 | clojurebot | 5.0 |
| 16:58 | Lau_of_DK | typical rich, fancy documentation, no examples for dumb folk |
| 16:58 | hiredman | but, uh, Math/sqrt is a normal java static method, so you cannot just pass it a BigDecimal or what not |
| 17:00 | stuartsierra | Lau_of_DK: protected methods are automatically exposed by gen-class. |
| 17:00 | pilkarn | stuartsierra: how? (declaring gen-class method static) |
| 17:00 | hiredman | ah |
| 17:00 | hiredman | :exposes is for fields |
| 17:01 | stuartsierra | yes |
| 17:01 | pilkarn | Lau_of_DK: whatis SimpleGame? |
| 17:01 | Bracki | When should I use a Macro? |
| 17:01 | hiredman | for manipulating code |
| 17:02 | hiredman | (as data) |
| 17:02 | Lau_of_DK | pilkarn: google JMonkeyEngine |
| 17:02 | stuartsierra | pilkarn: (gen-class ..... :methods [#^{:static true} [methodName [param types] return-type]] |
| 17:02 | stuartsierra | I think |
| 17:03 | jbondeson | is clojure.contrib.math borked for anyone else? |
| 17:03 | hiredman | Bracki: for example, to talk about pointless symbols, I have a macro that transforms (a � b) to (comp a b) |
| 17:04 | clojurebot | svn rev 1285; [lazy] updated docs |
| 17:04 | hiredman | normally (a � b) would try and apply the function 'a' to '�' and 'b' |
| 17:05 | hiredman | but the macro gets access to (a � b) as a list of symbols, and deletes the � symbol and cons the comp partial onto the front of the list |
| 17:05 | hiredman | (actually it uses a zipper, so it doesn't really cons onto the front) |
| 17:09 | hiredman | er |
| 17:09 | hiredman | "comp partial" |
| 17:09 | hiredman | hah |
| 17:13 | Bracki | What is between (a and b). Unicode/putty issues. |
| 17:13 | Chouser | apparently an empty rectangle. |
| 17:13 | cooldude127 | a dot |
| 17:15 | hiredman | nah |
| 17:15 | hiredman | it is a interpunct |
| 17:15 | technomancy | it's a middle-dot rather than a period |
| 17:15 | hiredman | http://en.wikipedia.org/wiki/Interpunct |
| 17:19 | Chouser | I once saw an guy get interpunked |
| 17:19 | hiredman | ashton sent him an email? |
| 17:19 | jbondeson | did he get composed? |
| 17:19 | Chouser | hiredman: exactly |
| 17:22 | durka42 | was clojurebot's read-time vulnerability already discussed? |
| 17:22 | Chouser | and solved |
| 17:22 | Chouser | though not the underlying question of whether read should allow such things |
| 17:22 | rhickey | everyone good with lazy branch? |
| 17:23 | jbondeson | bwahaha |
| 17:24 | rhickey | Chouser: I feel good about it, have no idea how best to get it in trunk without major breakage |
| 17:24 | jbondeson | embrace the chaos ;) |
| 17:24 | Chouser | I was planning another blog post -- I have what I think is a nice setup here for running any of the different branches on a whim |
| 17:25 | Chouser | It doesn't currently handle the contrib branch, but I was thinking that could be worked in too. |
| 17:26 | lisppaste8 | Bracki pasted "What's wrong with this primality test?" at http://paste.lisp.org/display/75598 |
| 17:27 | Chouser | but I'm not sure there's any value in that once the future is no longer uncertain. People can choose to upgrade now or later, but the end result is the same. *shrug* |
| 17:27 | WizardofWestmarc | there could be major change branches in the future as well |
| 17:27 | WizardofWestmarc | so the info is still useful even if the current branches get merged into trunk |
| 17:28 | Chouser | oh, I see. sure |
| 17:28 | hiredman | Bracki: I think you need sqrt+1 |
| 17:28 | durka42 | ,(empty? nil) |
| 17:28 | clojurebot | true |
| 17:28 | durka42 | ^ that is Bracki's problem |
| 17:28 | Chouser | but I guess I was thinking the benefit of keeping trunk un-broken (unbreaking?) for now is hardly anything once we know lazy branch is the future. |
| 17:28 | durka42 | ,(empty? (seq nil)) |
| 17:28 | clojurebot | true |
| 17:29 | durka42 | wait, nevermind |
| 17:31 | lisppaste8 | Bracki annotated #75598 with "untitled" at http://paste.lisp.org/display/75598#1 |
| 17:31 | hiredman | yeah |
| 17:31 | hiredman | change the "int" to an inc |
| 17:32 | durka42 | nice one-char fix |
| 17:33 | Bracki | Cool. |
| 17:34 | jbondeson | still technically not correct because (is-prime? 2) => false |
| 17:35 | Bracki | Nitpicker ;) |
| 17:36 | rhickey | SVN wizards - how do I (best) merge this lazy stuff back into trunk? |
| 17:36 | jbondeson | number theory is serious business |
| 17:38 | jbondeson | rhickey: unfortunately i've always done big merges in svn by letting svn have a go and using a really good diff tool to resolve the conflicts. |
| 17:42 | danlarkin | make sure you're using svn 1.5! It has merge tracking built-in |
| 17:42 | Bracki | Hm it's getting late, how do I break or return? |
| 17:42 | hiredman | uh |
| 17:43 | hiredman | you don't |
| 17:43 | jbondeson | danlarkin: that would not be helpful only if he had it before he branched lazy off ;) |
| 17:43 | hiredman | how are you "looping" |
| 17:43 | hiredman | ? |
| 17:43 | Bracki | Well take the prime code and add the explicit check for 2. |
| 17:43 | hiredman | ah |
| 17:43 | hiredman | just wrap it in an if |
| 17:44 | hiredman | (if (= x 2) true (filter ...)) |
| 17:44 | Bracki | Argh, I closed the bracket to early... |
| 17:44 | durka42 | what if x is 1? |
| 17:45 | Bracki | After the true. |
| 17:45 | danlarkin | jbondeson: :-o |
| 17:46 | Bracki | durka42: Since I do an empty? on an empty list then its true. |
| 17:47 | durka42 | but is 1 prime? ;) |
| 17:47 | jbondeson | durka42: no. |
| 17:47 | jbondeson | iirc |
| 17:48 | hiredman | prime is not evenly divisble by any number other then 1 and itsself |
| 17:48 | hiredman | hmm |
| 17:49 | hiredman | I am pretty sure 1 is not prime, but that def sounds different |
| 17:49 | ayrnieu | you could also state it computationally: a number is prime if it is not divisible by any of the primes you've come across. |
| 17:50 | durka42 | that's a seive, isn't it |
| 17:50 | jbondeson | hiredman: it excluded because it screws up factoring |
| 17:50 | hiredman | http://en.wikipedia.org/wiki/Prime_number#Primality_of_one |
| 17:51 | hiredman | Yeah. |
| 17:51 | ayrnieu | yes, you can also ask what it means to factor a number. Reducing a factor from a non-prime gives you a new number -- that is, you're actually reducing the non-prime with the act. |
| 17:51 | rhickey | cat out of bag - Clojure on CLR: http://groups.google.com/group/clojure/browse_frm/thread/54571c9b8f625dba |
| 17:51 | jbondeson | "We don't like it cause it screws up our other pretty theories" |
| 17:54 | jbondeson | it was bound to happen. countdown until the next round of "you need a language spec" |
| 17:54 | clojurebot | svn rev 1286; [lazy] smarter ASeq and LazySeq isEmpty() |
| 17:54 | ayrnieu | jbondeson - glass is technically a liquid. But you can't drink it, you can't pour it into a container, it doesn't take the shape of its container to any extent; you can also do things to it that would make no sense given any other 'liquid'. |
| 17:54 | rhickey | Subversion command-line client, version 1.4.4. |
| 17:55 | jbondeson | rhickey: yeah, you're going to have a bit more manual merging. |
| 17:56 | Bracki | I give up on prime factorization for tonite. |
| 17:59 | Bracki | Don't know how to create ISeq from: BigInteger |
| 18:02 | zargon_ | ad full lazy seqs: I'm a bit worried about the proposed "next" semantics. For Java programmers this would definitely mean "next element" as with Java iterators |
| 18:02 | blbrown | ,paste |
| 18:02 | zargon_ | I would even prefer typing "next-seq" ... |
| 18:02 | clojurebot | java.lang.Exception: Unable to resolve symbol: paste in this context |
| 18:02 | blbrown | ~paste |
| 18:02 | clojurebot | lisppaste8, url |
| 18:02 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 18:03 | ayrnieu | zargon, do you want to forever type 'next-seq' so that people who've spent all of a day with the language will wonder WTH 'next-seq' means instead of wondering, with all the other unfamiliar parts in context, what 'next' means? |
| 18:03 | rhickey | zargon_: iterator next both gets next element and moves iterator, Clojure gives you next iterator |
| 18:04 | lisppaste8 | blbrown pasted "Clojure...Im doing it wrong" at http://paste.lisp.org/display/75603 |
| 18:05 | blbrown | anybody have any code improvements for that. I basically just want to have a count of number times a token occurs |
| 18:05 | hiredman | hmm |
| 18:05 | hiredman | I would use a line-seq |
| 18:05 | hiredman | (doc line-seq) |
| 18:06 | clojurebot | Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader.; arglists ([rdr]) |
| 18:06 | hiredman | and just reduce over the line-seq |
| 18:06 | blbrown | hiredman, what about the 'map' part of it, that is the most important code |
| 18:08 | zargon_ | rhickey: I really really appreciate your opinion, I just read the 63 posts on the mailing and thought "damn" rich is right on the "tail" proposal (not corresponding with first, "head" would be the right peer). But it would convey the right semantics I think ... |
| 18:10 | hiredman | blbrown: nested lets are kind of nasty and often unnesassary |
| 18:10 | rhickey | zargon_: I guess my feeling is a functional iterator like seq is so different from a stateful one like Iterator, there are bigger problems than the meaning of next - it could never be the same as Java's |
| 18:10 | blbrown | sigh |
| 18:11 | zargon_ | rhickey: don't you think "next" is also tainted in colloquial sense? |
| 18:11 | hiredman | (doc zipmap) |
| 18:11 | clojurebot | Returns a map with the keys mapped to the corresponding vals.; arglists ([keys vals]) |
| 18:11 | WizardofWestmarc | what about just using... frequencies I think it is? and then looking for the occurancies of your tokens within the map? |
| 18:11 | Bracki | What yields the last element of a list? |
| 18:11 | zargon_ | "give me the next ONE" |
| 18:12 | blbrown | WizardofWestmarc, is that for me, that is what I need, where is frequencies |
| 18:12 | WizardofWestmarc | in clojure contrib, forget which lib |
| 18:12 | technomancy | some projects still using centralized version control perform merges in an external DVCS and then import them back into SVN... that's always an option if the merging gets hairy |
| 18:12 | hiredman | (map #(.group m %) (range 6)) |
| 18:12 | technomancy | Emacs did this with Arch and CVS before git was around. |
| 18:12 | WizardofWestmarc | someone mentioned it recently but haven't had a chance to dig through the code for it |
| 18:13 | hiredman | (map #(keyword (.group m %)) (range 6)) |
| 18:13 | WizardofWestmarc | and Bracki: only thing I can think of is (nth coll (- (count coll) 1)) |
| 18:13 | Bracki | Or the largest? |
| 18:14 | WizardofWestmarc | largest in a list? |
| 18:14 | Bracki | yes |
| 18:14 | WizardofWestmarc | (reduce max coll) |
| 18:14 | technomancy | anyway, I'm in favour of merging the lazy branch as soon as possible |
| 18:14 | hiredman | WizardofWestmarc: apply |
| 18:14 | hiredman | ,(apply max [ 34 2 291 0 53]) |
| 18:14 | clojurebot | 291 |
| 18:15 | WizardofWestmarc | ah ha |
| 18:15 | WizardofWestmarc | fair enough! |
| 18:15 | rhickey | so I just ran svn merge trunk lazy and got only Us and As, no diff popped up, and it builds! |
| 18:15 | rhickey | I wonder if it did anything? |
| 18:15 | hiredman | hmmmm |
| 18:15 | WizardofWestmarc | look at a file that you know what it should look like |
| 18:16 | WizardofWestmarc | hiredman: btw, at least on that small a list reduce is faster then apply |
| 18:16 | hiredman | interesting |
| 18:17 | WizardofWestmarc | not sure if that holds up across larger collections |
| 18:17 | hiredman | ,(import 'java.util.Collections |
| 18:17 | clojurebot | EOF while reading |
| 18:17 | hiredman | ,(import 'java.util.Collections) |
| 18:17 | clojurebot | nil |
| 18:17 | hiredman | ,(import 'java.util.LinkedList) |
| 18:17 | clojurebot | nil |
| 18:18 | hiredman | ,(let [x (LinkedList. (range 10000)) _ (Collections/shuffle x)] (time apply max x)) |
| 18:18 | clojurebot | java.lang.RuntimeException: java.lang.IllegalArgumentException: Wrong number of args passed to: core$time |
| 18:18 | WizardofWestmarc | also blbrown: lemme find the old post in the google group with a short/fast frequencies function |
| 18:18 | hiredman | ,(let [x (LinkedList. (range 10000)) _ (Collections/shuffle x)] (time (apply max x))) |
| 18:18 | clojurebot | 9999 |
| 18:18 | clojurebot | "Elapsed time: 42.059 msecs" |
| 18:19 | hiredman | ,(let [x (LinkedList. (range 10000)) _ (Collections/shuffle x)] (time (reduce max x))) |
| 18:19 | clojurebot | 9999 |
| 18:19 | clojurebot | "Elapsed time: 7.435 msecs" |
| 18:19 | hiredman | ouch |
| 18:19 | hiredman | ~def max |
| 18:19 | hiredman | heh |
| 18:20 | hiredman | max uses reduce interally anyway |
| 18:21 | WizardofWestmarc | blbrown: http://bit.ly/kJxFl |
| 18:22 | WizardofWestmarc | hiredman: true but that only matters if you feed it individual elements ;-) |
| 18:24 | hiredman | I do find the disparity odd because apply max and reduce max both use reduce |
| 18:24 | blbrown | WizardofWestmarc, gracias |
| 18:25 | WizardofWestmarc | blbrown: np, I needed that function a while back for stuff I'm currently working on so I happened to have it bookmarked in delicious ;-) |
| 18:25 | hiredman | I guess because it is (reduce max (max x y) more) |
| 18:26 | WizardofWestmarc | hiredman: hm, certainly possible. Either way it's a useful bit of info |
| 18:26 | hiredman | Yes. |
| 18:27 | hiredman | if you supply the reduce you leave out the extra calls to max |
| 18:27 | rpg | back |
| 18:30 | blbrown | WizardofWestmarc, what datastructure is returned from that frequency call. |
| 18:31 | hiredman | a map |
| 18:31 | rhickey | hmmm.. that seemed to be backwards (i.e. lazy branch dominated), but when I switch to svn merge lazy trunk, I get only a few added files, no updates |
| 18:32 | WizardofWestmarc | btw best thing I learned from that frequencies function is the merge-with function |
| 18:32 | WizardofWestmarc | rhickey: hm, trying to think what could be wrong, but I almost exclusively use tortoise svn so I don't know the syntax for the command line version. |
| 18:34 | WizardofWestmarc | that and I'm anything but an svn wizard, I just spend a lot of time cleaning up other peoples' mistakes at work >_> |
| 18:35 | danlarkin | this is the cost of using svn |
| 18:36 | rhickey | I wish someone would just feed me the correct command line to try... |
| 18:37 | hiredman | http://www.sepcot.com/blog/2007/04/SVN-Merge-Branch-Trunk |
| 18:38 | hiredman | that might help, step by step instructions |
| 18:39 | WizardofWestmarc | the worst part about pre-1.5, the fact you have to supply the revision # of the break |
| 18:40 | burkelibbey | So at the end of his latest blog post, chouser mentioned his system to easily switch between branches of clojure. I figured I'd share the piece of junk I hacked together to do the same thing: http://gist.github.com/65457 |
| 18:41 | WizardofWestmarc | Heading out, take care all and good luck on the merge rhickey |
| 19:10 | mrSpec | Hi |
| 19:12 | cooldude127 | mrSpec: hey |
| 19:12 | ayrnieu | burkel, I have a clojure.jar symlink in my CLASSPATH , and I have a makefile. 'make lazy'. 'make trunk'. |
| 20:08 | pilkarn | is binary search the fastest way to locate a number in an array? |
| 20:10 | hiredman | pilkarn: http://en.wikipedia.org/wiki/Sorting_algorithm#List_of_sorting_algorithms |
| 20:18 | cooldude127 | pilkarn: is your data already sorted? |
| 20:31 | cooldude127 | ok looks like symbolic math is gonna be way easier with some good pattern matching |
| 20:34 | blbrown_ | how can I set the return value with 'loop' Can I put anything after 'recur'? |
| 20:34 | hiredman | uh |
| 20:34 | Chouser | no, you need an alternate branch. |
| 20:34 | hiredman | no |
| 20:34 | blbrown_ | nevermind |
| 20:34 | blbrown_ | Chouser, yea |
| 20:35 | Chouser | and then you have to merge them. Ask Rich how. ;-) |
| 20:35 | hiredman | recur is (a loop) not a loop |
| 21:11 | matthew` | Does anyone have any thoughts on delivering Clojure applications to the desktop? |
| 21:11 | albino | build jar+bundle with jre == delivered java app? |
| 21:19 | matthew` | I'm really coming to Java through Clojure and don't have much of a feel for how widely used it is out there. |
| 21:20 | matthew` | Are there many Java Swing apps running out there in the business world? |
| 21:20 | hiredman | because the jvm startup time, java is not used a lot in desktop apps |
| 21:20 | matthew` | Ok. |
| 21:21 | matthew` | So it isn't a quality issue with the GUI then. |
| 21:21 | hiredman | mostly for long running tasks |
| 21:21 | cooldude127 | matthew`: well, the gui isn't the greatest, but it works |
| 21:21 | matthew` | Thanks. |
| 21:21 | hiredman | and there are bindings for other gui frameworks |
| 21:22 | matthew` | I've heard of the QT4 bindings. |
| 21:22 | burkelibbey | ...pretty much every other GUI framework, really. |
| 21:22 | blbrown | matthew`, I like SWT |
| 21:22 | hiredman | QT :( |
| 21:22 | cooldude127 | swt isn't too bad |
| 21:23 | burkelibbey | QT would be perfect if it weren't for the sketchy license :( |
| 21:23 | matthew` | ok. |
| 21:24 | blbrown | QT jvm bindings, do they exist? I am going with swt/eclipse ...millions of installs and great widgets. |
| 21:24 | hiredman | perfect is a strong word |
| 21:24 | burkelibbey | Yes, I heard of someone developing QT in Clojure a few months back. I'll try to dig up the link |
| 21:24 | cooldude127 | blbrown: they're called QT jambi i think |
| 21:24 | burkelibbey | http://briancarper.net/2008/10/31/qt4-in-lisp/ |
| 21:25 | hiredman | Lua_of_DK is pretty unrelenting about pushing a) emacs and b) Qt Jambi |
| 21:25 | matthew` | Thanks guys, sorry to start something and then leave. My swimming partners are hassling me. Thanks for the help and the links. |
| 21:25 | blbrown | I guess we have options. SWT, Swing, QT4 |
| 21:26 | hiredman | and "anyone who picks something else is doing so for religious reasons" |
| 21:26 | Chouser | gtk/gnome |
| 21:26 | hiredman | Chouser: have you looked at gnome's java bindings? |
| 21:26 | Chouser | no, just saw they exist |
| 21:26 | hiredman | they, uh, :( |
| 21:27 | hiredman | at least on freebsd |
| 21:29 | hiredman | the documentation doesn't match the current class hierarchy |
| 21:29 | Chouser | for gtk?? |
| 21:29 | hiredman | the documentation on the java gnome website |
| 21:30 | Chouser | ah. |
| 21:30 | hiredman | doesn't match what is actually in the java gnome source tree |
| 21:30 | hiredman | classes have been moved around, etc |
| 21:30 | hiredman | packages renamed |
| 22:10 | shoover | rhickey: still looking for that svn command? |
| 22:26 | shoover | if you're going to merge the lazy branch and be done with it, go to a clean up to date trunk working copy and run svn merge -r 1236:1286 http://clojure.googlecode.com/svn/branches/lazy. That takes all the changes to the lazy branch and applies them to the trunk working copy. There will be some minor conflicts to resolve. |
| 22:29 | shoover | If you want to bring trunk changes into lazy and play with lazy some more, go to a clean, up to date lazy working copy and run svn merge -r 1236:1286 http://clojure.googlecode.com/svn/trunk. |
| 22:30 | eyeris | If I instantiate a HashMap in Java, I have to specify the key and value types and .get() and .put() enforce those types. That doesn't seem to be the case in Clojure. Could someone point me to documentation of the implications of this? |
| 22:30 | hiredman | eyeris: Generics are implemented as type erasure in java |
| 22:31 | Chouser | Before generics, the types of things put in Java collections was not enforced. |
| 22:31 | hiredman | http://java.sun.com/docs/books/tutorial/java/generics/erasure.html |
| 22:32 | hiredman | so as I understand it, generics are just a compiletime check |
| 22:32 | Chouser | and allow you to avoid casting things as you take them out of the collection |
| 22:33 | hiredman | "there is no way to tell at runtime which type parameter is used on an object. For example, when you examine an ArrayList at runtime, there is no general way to tell whether it was an ArrayList<Integer> or an ArrayList<Float>." |
| 22:34 | eyeris | Right, so how does Clojure know what methods are available? |
| 22:34 | eyeris | Or is that a JVM operation, resulting in a runtime error? |
| 22:35 | hiredman | clojure uses reflection, unless you type hint |
| 22:35 | Chouser | Clojure does some type inference at compile time, which you can help along with type hints. |
| 22:35 | eyeris | Okay |
| 22:36 | Chouser | right, if that's not sufficient it will issue an optional warning and do the lookup at runtime. |
| 22:36 | eyeris | Last question: When dealing with generics in Clojure, this means that I can just completely ignore the type parameters and use the generic class as a raw type? |
| 22:40 | Chouser | yes |
| 22:40 | eyeris | Great. Thanks. |
| 22:40 | cooldude127 | eyeris: although it so doesn't matter |
| 22:40 | cooldude127 | eyeris: java has generics mostly to avoid a bunch of casting. clojure doesn't bother with that, so it doesn't really matter |
| 22:41 | cooldude127 | for the record, you can use a generic type in java as a raw type, it behaves as if you just has Object as the generic parameter |
| 22:41 | cooldude127 | that was crappy english on my part |
| 22:41 | eyeris | I see that now. |
| 22:42 | ozy` | generics are necessary for typesafe polymorphic collections |
| 22:42 | ozy` | typesafe polymorphic other stuff as well, but mainly collections |
| 22:42 | cooldude127 | ozy`: in clojure, we could give a damn about type-safety |
| 22:42 | ozy` | cooldude127: exactly |
| 22:42 | cooldude127 | :) |
| 22:49 | cooldude127 | it's sometimes fun to translate CL code to clojure, you really see how certain features clean things up |
| 22:49 | cooldude127 | for example: maps being functions of their keys |
| 22:49 | cooldude127 | AWESOME |
| 22:49 | gnuvince_ | Hell yeah |
| 22:49 | gnuvince_ | and having literal syntax for maps |
| 22:49 | cooldude127 | yes also awesome |
| 22:50 | gnuvince_ | I use them as much as I use them in Python or JavaScript |
| 22:50 | cooldude127 | i forget that's not how CL works |
| 23:12 | cooldude127 | what's the closest thing we have in clojure to this CL function: http://www.lispworks.com/documentation/HyperSpec/Body/f_sublis.htm#sublis |
| 23:13 | cooldude127 | which btw, i had no idea existed until now |
| 23:15 | pilkarn | cooldude127: yes i find clojure to be sooo much cleaner than common lisp. |
| 23:16 | hiredman | cooldude127: I think you'll have to roll your own |
| 23:16 | cooldude127 | BOOO |
| 23:16 | cooldude127 | :( |
| 23:17 | hiredman | ,clojure.zip/seq-zip |
| 23:17 | clojurebot | #<zip$seq_zip__5928 clojure.zip$seq_zip__5928@171120a> |
| 23:17 | hiredman | I think it would be fairly easy with a zippero n a seq |
| 23:17 | durka42 | (let [tree ["one" "two" ["three" "four"]] reps {"one" 1 "three" 3} doit (fn doit [x] (if (coll? x) (map doit x) (get reps x x)))] (map doit tree)) |
| 23:17 | durka42 | ,(let [tree ["one" "two" ["three" "four"]] reps {"one" 1 "three" 3} doit (fn doit [x] (if (coll? x) (map doit x) (get reps x x)))] (map doit tree)) |
| 23:17 | clojurebot | (1 "two" (3 "four")) |
| 23:19 | durka42 | ~zippers |
| 23:19 | clojurebot | excusez-moi |
| 23:19 | durka42 | wasn't there a good link on the haskell behind them? |
| 23:19 | hiredman | ~google haskell functional zippers |
| 23:19 | clojurebot | First, out of 1950 results is: |
| 23:19 | clojurebot | Haskell/Zippers - Wikibooks, collection of open-content textbooks |
| 23:19 | clojurebot | http://en.wikibooks.org/wiki/Haskell/Zippers |
| 23:19 | hiredman | the zip.clj code is pretty clear |
| 23:19 | durka42 | oh man the theseus example |
| 23:20 | durka42 | i remember reading this when i was attempting to learn haskell |
| 23:25 | hiredman | http://paste.lisp.org/display/74521 <-- could be useful |
| 23:33 | hiredman | lisppaste8: url? |
| 23:33 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 23:35 | lisppaste8 | hiredman pasted "sublis sort of, using transform" at http://paste.lisp.org/display/75625 |
| 23:43 | blbrown | hmm, thinking about buying those clojure t-shirts |
| 23:44 | durka42 | clojure t-shirts? |
| 23:44 | blbrown | http://www.zazzle.com/clojure+tshirts |
| 23:44 | durka42 | heh |
| 23:48 | Chouser | blbrown: you should. I've currently got the keys to that account, but since the ideas are mostly not my own I've already said I'll give the proceeds (if any) over to Rich. |
| 23:49 | blbrown | wonder why the black one is so expensive. I wanted to get two |
| 23:49 | Chouser | you can customize them, pick the shirt that you want. |
| 23:50 | Chouser | doesn't mean there's a cheaper one, through. :-/ |
| 23:50 | blbrown | ooo, nice website |
| 23:51 | Chouser | So far we've sold 7, so Zazzle owes Rich almost $20. |
| 23:51 | Chouser | Pretty soon he could by that new Clojure book. |
| 23:51 | Chouser | buy |
| 23:55 | blbrown | Chouser, I just bought 2 |
| 23:55 | Chouser | blbrown: great, thanks! |
| 23:55 | Chouser | which did you get? |
| 23:56 | blbrown | I got the one with 'state you are doing it wrong' |
| 23:56 | Chouser | ooh, I should get one before the lisp conference in Boston. |
| 23:56 | Chouser | something provocative for all the CLers. |
| 23:56 | blbrown | hehe |
| 23:56 | Chouser | lisp is not dead... |
| 23:57 | hiredman | heh |
| 23:58 | durka42 | might be preaching the choir with that one |
| 23:58 | danlarkin | haha oh boy, I watch catching up on the conversation and I thought you said "So far we've sold 7200..." and my jaw dropped |
| 23:58 | Chouser | man, how embarrassing would it be to get beat up at a LISP conference. |
| 23:58 | Chouser | heh |
| 23:58 | hiredman | imagine getting a fat lip |
| 23:58 | hiredman | lipth |
| 23:58 | hiredman | lithp |
| 23:58 | blbrown | this is the only other programming shirt I have: http://www.flickr.com/photos/berlinbrown/21302219/ |
| 23:59 | Chouser | oh, that's orders not shirts. up to 8 now. |
| 23:59 | blbrown | hehe |
| 23:59 | Chouser | nice |