2009-01-20
| 00:04 | apage43 | technomancy: for text-adventury stuffs i usually represent everything as instances of a single object type, that can have a parent, sibling, and child, including players |
| 00:05 | apage43 | so to give an item to a player you just attach it to a different node in the tree |
| 00:06 | hiredman | bonus points because with trees you can use zippers |
| 00:07 | technomancy | apage43: huh; interesting. I'm keeping items and players in a different map on the room. |
| 00:07 | apage43 | this is roughly how inform/infocom games work |
| 00:09 | apage43 | this is the class, from an old text adventure sort of "engine" i threw together in java waay back |
| 00:09 | apage43 | http://pastebin.com/m65d7b8e2 |
| 00:10 | durka42 | hiredman: is there an introduction to zippers somewhere? |
| 00:10 | Cark | these mutual references might not be a best fit for clojure though |
| 00:10 | apage43 | possibly not |
| 00:10 | apage43 | but a similar datastructure perhaps |
| 00:12 | technomancy | I suppose I can see why you'd want a uniform interface for putting something in your inventory as you would putting a person in a room, but... I'm not sure it makes a big difference. |
| 00:12 | technomancy | in the clojure case it's all just altering refs anyway |
| 00:12 | apage43 | yeah |
| 00:12 | apage43 | in java it was really nice to be able to just be |
| 00:13 | apage43 | object.moveTo(player); |
| 00:13 | apage43 | and player.children(); worked to get the player's immediate inventory, and you could list the contents of containers with the same function |
| 00:14 | apage43 | really useful when you don't have nice things like multimethods |
| 00:20 | hiredman | durka42: zip.clj is pretty good :P |
| 00:21 | technomancy | hrm... I wonder how I can perform cleanup when a player disconnects |
| 00:22 | technomancy | probably just need to catch the right exceptions from my main loop |
| 00:22 | technomancy | which means I should read up on Java exceptions |
| 00:24 | technomancy | do you get a SocketException when you try to read from a stream that's connected to a socket which the client closed? |
| 00:25 | apage43 | that or an ioexception.. |
| 00:29 | technomancy | actually it looks like read-line might just return nil |
| 00:29 | hiredman | on zippers? I looked at both and ended up with zip.clj |
| 00:29 | hiredman | mainly because I don't speak haskell |
| 00:30 | durka42 | i don't either |
| 00:30 | durka42 | having tried and given up |
| 00:31 | danlarkin | technomancy: regarding clean up: you can wait until rich's "scope" function lands in core :) |
| 00:31 | technomancy | danlarkin: how long is that going to be? =) |
| 00:32 | danlarkin | TBD |
| 00:32 | danlarkin | :) |
| 00:32 | technomancy | danlarkin: I don't see a thread on it yet |
| 00:33 | danlarkin | technomancy: he brought it up on IRC earlier today (or was it yesterday... *sigh* you know it's bad when the days start to blend together) |
| 00:33 | technomancy | sounds pretty bleeding-edge |
| 00:33 | hiredman | lisppaste8: url? |
| 00:33 | hiredman | hmmm |
| 00:33 | hiredman | clojurebot: paste? |
| 00:33 | clojurebot | paste is http://paste.lisp.org/new/clojure |
| 00:34 | danlarkin | http://paste.lisp.org/display/73838 |
| 00:34 | danlarkin | that's the url, although paste.lisp isn't responding for me |
| 00:35 | durka42 | seems to be dead |
| 00:35 | technomancy | odd; it's usually pretty solid |
| 00:37 | danlarkin | any time a lisp site is having trouble my mind always goes back to that big post the reddit guys wrote up when they moved from whatever amalgam of lisp code they were running to web.py |
| 00:41 | technomancy | is there a "retry" for exception handling? |
| 00:43 | durka42 | no, by the time the exception is caught the stack is unwinding and the context of the original throw is gone |
| 00:43 | durka42 | so you can't go back to the place where the exception was thrown |
| 00:44 | technomancy | you can't even go back to the place of the original "try" invocation? |
| 00:44 | technomancy | I know it's not like CL conditions, but you don't need the stack to pull that off. |
| 00:44 | hiredman | (fn a [] (try do some stuff (catch Ex e (a)))) |
| 00:45 | technomancy | you mean defn? |
| 00:45 | hiredman | dunno if that actually works |
| 00:45 | hiredman | I am pretty sure I meant fn |
| 00:46 | technomancy | oh, you can refer to fns with an internal name? |
| 00:46 | technomancy | without the y-combinator? =) |
| 00:46 | hiredman | yeah |
| 00:46 | hiredman | that is what the "a" after fn is |
| 00:46 | technomancy | handy! |
| 00:46 | hiredman | :) |
| 00:46 | technomancy | only problem is... how will the CS students of the future learn how the y-combinator works then? |
| 00:47 | technomancy | rhickey is making this way too easy |
| 00:47 | hiredman | they will read it off that guy's tattoo |
| 00:49 | technomancy | oh snap! got bit by the map-is-lazy thing again. |
| 00:49 | hiredman | clojurebot: map? |
| 00:49 | clojurebot | map is *LAZY* |
| 00:49 | technomancy | what's the way to force that? do-??? |
| 00:49 | technomancy | doall? |
| 00:49 | hiredman | there are two ways |
| 00:49 | hiredman | doall and dorun |
| 00:49 | hiredman | depending if you want to keep the results |
| 00:50 | technomancy | ah, so dorun doesn't keep head; yeah that's what I want |
| 00:50 | technomancy | it'd be nice if the docstrings of doall and dorun refered to each other |
| 00:51 | technomancy | woot; that did the trick |
| 00:51 | technomancy | hiredman: how many times a day do you think you ask clojurebot about map for the benefit of clueless folk like me? =) |
| 00:52 | technomancy | I think this is the second time you've done it for me alone. |
| 00:54 | technomancy | Cark: your stuff gets dropped when you disconnect now, so the bunny will not disappear. |
| 00:54 | technomancy | now I need to add combat! but not tonight. |
| 00:54 | hiredman | technomancy: I just do it because I like the stars |
| 00:54 | Cark | ah i was a bit concerned with the bunny i must confess =) |
| 00:55 | technomancy | the wildlife conservation league can rest easy |
| 00:55 | Cark | until you add combat i guess |
| 00:56 | technomancy | doh! |
| 01:01 | danlarkin | clojurebot: map? |
| 01:01 | clojurebot | map is *LAZY* |
| 01:01 | danlarkin | yum |
| 01:01 | danlarkin | clojurebot: botsnack |
| 01:01 | clojurebot | thanks; that was delicious. (nom nom nom) |
| 01:03 | technomancy | is there any "pick a random element from this sequence" function? |
| 01:03 | danlarkin | AH GOD parser combinators I don't understand them!! |
| 01:03 | danlarkin | why can't they just be easier :) |
| 01:03 | danlarkin | or why can't joshua choi just come to my apartment and give me a little lesson |
| 01:04 | hiredman | java.util.Collections/shuffle |
| 01:04 | hiredman | takes a List |
| 01:04 | technomancy | but not a seq? |
| 01:04 | hiredman | ,(java.util.Collections/shuffle (java.util.List. [1 2 3 4])) |
| 01:04 | clojurebot | java.lang.IllegalArgumentException: No matching ctor found |
| 01:05 | hiredman | ,(java.util.Collections/shuffle (java.util.List. (seq [1 2 3 4]))) |
| 01:05 | clojurebot | java.lang.IllegalArgumentException: No matching ctor found |
| 01:05 | hiredman | are you kidding me |
| 01:05 | technomancy | (my-vector (rand-int (count my-vector))) is ok too |
| 01:05 | technomancy | but (pick-rand my-vector) would be best |
| 01:05 | technomancy | (while we're being picky) |
| 01:06 | hiredman | I had this written |
| 01:06 | technomancy | even if shuffle worked, you'd still have to call first on it |
| 01:06 | technomancy | which is only one call less than the above |
| 01:07 | hiredman | ,(java.util.Collections/shuffle (java.util.LinkedList. [1 2 3 4])) |
| 01:07 | clojurebot | nil |
| 01:08 | hiredman | oh, and it shuffles the linkedlist, it does not return a new shuffled list |
| 01:08 | hiredman | http://github.com/hiredman/clojurebot/commit/f4a50054eff413f080ab2d1c164374a6a0697c1d |
| 01:08 | technomancy | hrm... I need to head off; battery is low. |
| 01:08 | technomancy | thanks for the help |
| 01:08 | hiredman | 1d6 |
| 01:08 | clojurebot | 3 |
| 01:08 | technomancy | later! |
| 01:09 | Cark | ,(let [l (java.util.ArrayList. (seq [1 2 3 4]))] (java.util.Collections/shuffle l) l) |
| 01:09 | clojurebot | #<ArrayList [2, 1, 4, 3]> |
| 01:09 | hiredman | ^- |
| 01:09 | Cark | would be better to make a clojure function i think |
| 01:10 | hiredman | there are where a few functional shuffles on the google group |
| 01:10 | hiredman | but I think Collections/shuffle out performs them |
| 01:11 | Cark | ah could be |
| 01:11 | Cark | was there a randomized merge-sort in th elot ? |
| 01:12 | Cark | *the lot |
| 01:12 | hiredman | not sure, I did not pay that close attention because at the time I did not need shuffle |
| 02:48 | Lau_of_DK | Morning gents |
| 03:04 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 03:39 | ecret | anyone know when clojure-dev(eclipse plugin) will be released? |
| 04:41 | erohtar | hi - this is another newbie question |
| 04:41 | erohtar | what is the best way to bind vars to a value when sending to an agent? |
| 04:42 | cgrand | you have to capture them before sending and rebind them inside the action fn |
| 04:43 | erohtar | cgrand you mean pass them as a parameter into the action fn? |
| 04:44 | cgrand | just to be sure: by vars, you really mean Vars? |
| 04:44 | cgrand | (and not locals?) |
| 04:44 | erohtar | yes, Vars |
| 04:47 | cgrand | then, yes, pass their current value as a parameter and rebind the var inside the fn or use a closure |
| 04:47 | erohtar | thanks a lot, that helped - 2 hours of aggravation just now |
| 04:48 | erohtar | btw - is there some elegant way of doing this? |
| 04:49 | lisppaste8 | cgrand pasted "vars capture with a closure" at http://paste.lisp.org/display/73911 |
| 04:50 | cgrand | you can turn this sample code into a macro |
| 04:50 | erohtar | cgrand: thank you so much |
| 05:00 | lisppaste8 | cgrand annotated #73911 with "capture-and-send" at http://paste.lisp.org/display/73911#1 |
| 05:01 | lisppaste8 | cgrand annotated #73911 with "example" at http://paste.lisp.org/display/73911#2 |
| 07:06 | jave | hello |
| 07:06 | cgrand | hello |
| 07:06 | Raynes | hello |
| 07:07 | jave | I'm thinking about web development with clojure. has someone made bindings for tapestry or wicket? |
| 07:07 | jave | or cocoon? |
| 07:15 | clows | i don't think so ... but there's a clojure webframework that someone's working on i think |
| 07:15 | clows | or a few actually |
| 07:15 | Raynes | My function is better than your function. |
| 07:19 | clows | though wicket bindings should be rather easy |
| 08:37 | rhickey | Chouser: nice blog entry |
| 08:40 | rhickey | http://blog.n01se.net/?p=37 |
| 09:14 | Chouser | rhickey: thanks |
| 09:15 | Fib | Is On Lisp readable for someone with only a little knowledge of macros and none of Common Lisp? |
| 09:16 | Chouser | Fib: yes |
| 09:16 | Fib | Cool, I'll check it out then :) |
| 09:16 | rhickey | Chouser: we didn't get to discuss scope/when-scope before, I didn't know how to interpret your 'wow', - wow that's cool or wow that's too much? |
| 09:16 | Hun | prepare to have your mind boggled |
| 09:17 | cgrand | chouser: I concur with rhickey: nice post. It's funny you experimented with Rhino too. |
| 09:18 | Chouser | "wow that's cool." I don't yet have a grasp on how/when the LFE stuff will be useful, but I can understand scope, and it looks good. |
| 09:19 | rhickey | Chouser: given scope (and safe streams, more on them soon), I find LFE hard to justify |
| 09:20 | Chouser | ah, ok. |
| 09:20 | Chouser | back in a bit. |
| 09:37 | gnuvince | Chouser: nice post, though some details of your initial impressions of Clojure would've been nice. |
| 09:38 | Lau_of_DK | on n01se? |
| 09:38 | gnuvince | yeah |
| 09:39 | Lau_of_DK | danlarkin: Im eating my words :) |
| 09:39 | danlarkin | Lau_of_DK: :-D |
| 09:40 | gnuvince | Chouser also seems more certain about dynamic and static typing than I am |
| 09:40 | Lau_of_DK | If you check out ClojureQL, you'll see that we decided to move the compilation of statements into the backend, to accomodate some of the subtle, but significant differences in the various dbms |
| 09:43 | Chouser | gnuvince: I don't know that I remember my initial impressions |
| 09:43 | gnuvince | OK |
| 09:47 | drewr | Chouser: "...because of it's clean object..." should be "its" |
| 09:47 | Chouser | I supppose I do remember my reaction to the sequences talk -- *so* excited. |
| 09:47 | Chouser | drewr: indeed, thanks. |
| 09:55 | gnuvince | My big moment was "Holy shmoly, you can call *any* Java class with that thing?!" |
| 09:55 | gnuvince | And like that, Clojure was the most practical Lisp ever built |
| 10:02 | clojurebot | svn rev 1217; don't clear local closed over in catch/finally |
| 10:11 | mco_ | hello everybody, I bought the clojure book and wanted to try the compojure example but it won't work. I've seen several posts about that issue but I'm not sure about the status of the code: should the current distribution work ? |
| 10:18 | Chouser | mco_: I'm afraid I've not done anything with Compojure yet, so I don't know. |
| 10:18 | Chouser | But I haven't heard anyone mention recently that it's broken or anything. |
| 10:19 | Chouser | It's possible that a recent change to Compojure has made the example from the book outdated, I suppose. |
| 10:24 | clows | I think there's a link to the clojure / clojure-contrib version he used in the book (somewhere in the introduction or so) that one should work |
| 10:24 | mco_ | thanks for your answers ! |
| 10:24 | mco_ | but I downloaded a single package in which al the jars are present |
| 10:25 | mco_ | okay maybe I missed a step |
| 10:45 | danlei` | what is the minimum java version to run clojure on? 1.5, right? |
| 10:45 | Chouser | danlei`: I think that's right, yes. |
| 10:45 | danlei` | ok, thanks |
| 10:47 | Chousuke | hm |
| 10:47 | Chousuke | shouldn't server_socket.clj in contrib close the socket if the server fn throws an exception? :/ |
| 11:49 | philscotted | I'm trying to invoke a Clojure function from Java, and have so far been successful passing a StringReader with "my-fun-name" to Compile and casting to IFn. However, is there a better way to do this? I can find the class of the compiled function, but I'm not sure how to obtain an instance of it. Any ideas? |
| 11:50 | philscotted | I have the fields const_0,...,const_5 and applyToHelper in the function's class. |
| 11:53 | cgrand | philscotted: in clojure.lang.RT use the static method var(String, String) |
| 11:53 | Chouser | are you trying to call into a Clojure namespace that has :gen-class and is already compiled? Or just trying to invoke functions in an uncompiled .clj file? |
| 11:54 | philscotted | I've compiled but haven't used gen-class. I need to check the documentation for that. |
| 11:55 | Chouser | well, if you're trying to get transparent calling from Java, you'll have to go the gen-class route. But it's easier to just do as cgrand said, in which case you don't even need to compile the Clojure code. |
| 11:56 | philscotted | Cool. I'll try that. Cheers guys. |
| 11:59 | ppjt | Hi all |
| 11:59 | ppjt | Can anyone help confirm some odd behavior w/ pmap? |
| 11:59 | ppjt | Try (pmap inc (range 1000000)) |
| 12:00 | ppjt | Out of Memory error? |
| 12:11 | Chousuke | indeed :/ |
| 12:21 | ppjt | Thanks, Chousuke. I get same with collections one item, too -- (pmap inc [0]) |
| 12:21 | ppjt | (collections *of* one) |
| 12:31 | technomancy | if I def a var in the global root, is binding the only way to give it a thread-local value? |
| 12:32 | danlarkin | (doc with-local-vars) |
| 12:32 | clojurebot | varbinding=> symbol init-expr Executes the exprs in a context in which the symbols are bound to vars with per-thread bindings to the init-exprs. The symbols refer to the var objects themselves, and must be accessed with var-get and var-set; arglists ([name-vals-vec & body]) |
| 12:34 | technomancy | ok, for some reason I thought using set! would make a new thread-local binding, but that's obviously not the case |
| 12:34 | technomancy | seems intuitive, but I suppose that could cause some tough-to-catch errors? using binding is fine. |
| 12:59 | stuarthalloway | Hi all. Is there a count-if equivalent in Clojure or contrib somewhere? |
| 13:00 | StartsWithK | (count (filter pred coll)) |
| 13:00 | stuarthalloway | right, and trivial to compose (comp count filter) |
| 13:01 | stuarthalloway | just didn't know if was actually composed and named anywhere |
| 13:01 | StartsWithK | i don't think it is |
| 13:04 | ajustinjohnson | I have a LazyCons called data of PersistentStructMaps and want to create a PersistentArrayMap from that LazyCons that contains :key1 :key2 :key1 :key2... extracted from each PersistentStructMap. |
| 13:05 | ajustinjohnson | I can't figure out how to do it though. I can do this... |
| 13:05 | hiredman | why so concerned about the type of the hash? |
| 13:05 | ajustinjohnson | (map (fn [psm] [(:key1 psm) (:key2 psm)]) data) |
| 13:05 | ajustinjohnson | but that isn't quite what I want. |
| 13:06 | hiredman | I'd look at for |
| 13:06 | hiredman | ,(doc for) |
| 13:06 | clojurebot | "([seq-exprs expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by an optional filtering :when/:while expression (:when test or :while test), and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. (take 100 (for [x (range 100000000 |
| 13:06 | ajustinjohnson | hiredman: I'm getting db results using clojure-contrib and trying to convert the results to the correct form the dejcartes expects |
| 13:07 | ajustinjohnson | dejcartes is a wrapper around JFreeChart |
| 13:07 | hiredman | and dejcartes needs those exact java types? |
| 13:08 | ajustinjohnson | Maybe not exact types, but it expects a list of [string, num, string, num, string, num] |
| 13:08 | ajustinjohnson | And I have db results stored in a list of structs |
| 13:08 | hiredman | you could use reduce |
| 13:09 | hiredman | ,(reduce #(conj % (first %2) (second %2)) [] {:a 1 :b 2}) |
| 13:09 | clojurebot | [:a 1 :b 2] |
| 13:10 | ajustinjohnson | beautiful |
| 13:10 | ajustinjohnson | That is what I needed |
| 13:10 | ajustinjohnson | Thank you |
| 13:11 | hiredman | np |
| 13:12 | jli | If I understand correctly, Clojure is composed of a bunch of Java code that implements all the data structures and the Lisp primitives, and then a bunch of Clojure code that implements the rest of Clojure? |
| 13:15 | djkthx | whats the equivalent for MEMBER or FIND in clojure? |
| 13:15 | djkthx | trying to find an element in a list |
| 13:15 | drewr | jli: Essentially, yes. |
| 13:15 | drewr | Some of bootstrapping is still just calls to Java though. |
| 13:17 | technomancy | djkthx: you can use first + filter since it's lazy |
| 13:17 | gnuvince | you could use some probably? |
| 13:17 | gnuvince | ,(some #(= 'a %) '(b a c)) |
| 13:18 | clojurebot | true |
| 13:19 | jli | aww, what a cute bot. |
| 13:22 | cgrand | ,(some #{'a} '(b a c)) |
| 13:22 | clojurebot | a |
| 13:23 | Chouser | ,(apply concat {:a 1 :b 2}) |
| 13:23 | clojurebot | (:a 1 :b 2) |
| 13:23 | gnuvince | cgrand: thanks |
| 13:24 | gnuvince | I always forget the idioms with sets |
| 13:25 | technomancy | sets are underrated |
| 13:25 | cooldude127 | what's the clojure way to convert a string to an int? |
| 13:25 | Chouser | ,(Integer. "123") |
| 13:25 | clojurebot | 123 |
| 13:26 | Chouser | the clojure way is the java way. :-) |
| 13:26 | cooldude127 | alright |
| 13:26 | cooldude127 | i was hoping that wasn't the case |
| 13:26 | Chouser | Why's that? |
| 13:26 | cooldude127 | it feels dirty for some reason |
| 13:26 | cooldude127 | i would have expected (int "123") to do it |
| 13:27 | Chouser | It's okay to call into Java when it does what you want. |
| 13:27 | Chouser | No need to feel dirty. |
| 13:27 | cooldude127 | yeah i suppose |
| 13:27 | technomancy | I don't mind hitting Java when the API is relatively sane like that |
| 13:27 | cooldude127 | lol |
| 13:27 | technomancy | cooldude127: you can't complain till you try to do Date stuff. =) |
| 13:27 | cooldude127 | lol |
| 13:27 | clows | swing *cough* |
| 13:28 | technomancy | ,(str (java.util.Date 2009 01 20)) |
| 13:28 | clojurebot | java.lang.ClassCastException: java.lang.Class cannot be cast to clojure.lang.IFn |
| 13:28 | technomancy | ,(str (java.util.Date. 2009 01 20)) |
| 13:28 | clojurebot | "Sat Feb 20 00:00:00 PST 3909" |
| 13:28 | technomancy | can you believe that? |
| 13:28 | cooldude127 | does that say 3909 ? |
| 13:28 | cooldude127 | WTF? |
| 13:28 | technomancy | yes. |
| 13:28 | drewr | Read the documentation. |
| 13:29 | drewr | Offset from the year 1900. |
| 13:29 | technomancy | drewr: I know how it works; I'm just using it as an example. |
| 13:29 | drewr | Sorry, didn't read above. |
| 13:29 | drewr | Yes, it's retarded. |
| 13:29 | cooldude127 | that violates whatever principle that says do what i expect you to do |
| 13:30 | technomancy | cooldude127: also months are offset from zero, but days are from one. |
| 13:30 | cooldude127 | wtf java? |
| 13:30 | technomancy | in other words: don't use java.util.Date. |
| 13:30 | cooldude127 | lol |
| 13:30 | cooldude127 | is there a clojure date library? |
| 13:30 | danlarkin | wtf, that's exactly like the javascript date functions |
| 13:30 | technomancy | cooldude127: if I end up needing it I may write something up and submit to clojure-contrib, but nobody has done that so far iirc |
| 13:30 | karmazilla | Java 7... :) |
| 13:31 | technomancy | danlarkin: apparently they took "make it look like Java" a bit too far. =\ |
| 13:31 | cooldude127 | lol |
| 13:31 | cooldude127 | technomancy: i might write it just to give me something to do |
| 13:31 | cooldude127 | i have no cool project to work on |
| 13:33 | technomancy | there's an alternate library called Joda Time that's supposed to be very good, but that's another jar you need to depend on; something that important belongs in contrib |
| 13:33 | lisppaste8 | technomancy pasted "my simple date wrapper" at http://paste.lisp.org/display/73931 |
| 13:33 | technomancy | that's what I've used so far |
| 13:34 | cooldude127 | technomancy: what about using a simple map for dates along with a nice set of functions |
| 13:35 | cooldude127 | say {:year 2009 :day 20 :month 1} for today |
| 13:35 | cooldude127 | along with whatever other information |
| 13:35 | cooldude127 | seems like the clojure way |
| 13:35 | Hun | for saving stuff that's ok. for calculating it's bad |
| 13:36 | Hun | date management is hard |
| 13:36 | cooldude127 | Hun: care to explain? my plan was to still rely on java's date stuff, but simply wrap it up and cover up all the awfulness |
| 13:37 | Hun | that's ok. but don't try to do conversion and especially math with it yourself |
| 13:37 | cooldude127 | Hun: yeah that doesn't sound fun. i'll delegate that stuff |
| 13:37 | technomancy | right; leap years (not to mention leap seconds) will drive you mad |
| 13:38 | cooldude127 | technomancy: so i'll still use java dates to calculate, but the user of this library will only see friendly clojure structures and functions |
| 13:38 | cooldude127 | that is my plan |
| 13:38 | technomancy | sounds reasonable |
| 13:39 | drewr | Weird, stuff that shouldn't work actually does.. |
| 13:39 | drewr | (make-date 2009 12 32) |
| 13:39 | drewr | #<Date Fri Jan 01 00:00:00 CST 2010> |
| 13:39 | cooldude127 | lol |
| 13:39 | technomancy | yeah, it wraps around |
| 13:39 | technomancy | not sure what I think about that |
| 13:39 | technomancy | it makes stuff like next-date easy, but it could really drive you crazy. |
| 13:40 | drewr | That was first thought. I thought you had a bug until I tried it. |
| 13:40 | technomancy | heh |
| 13:41 | cooldude127 | omg haven't programmed clojure in awhile |
| 13:42 | danlarkin | cooldude127: want to write a parser for me using joshua choi's fnparse? that's a nice project for you :) |
| 13:42 | cooldude127 | danlarkin: maybe a bit much for me right now :) |
| 13:42 | Chouser | technomancy: that lib is worth it for the docstrings alone |
| 13:42 | cooldude127 | we'll see how this date library goes |
| 13:43 | technomancy | Chouser: thanks. I had fun with it. |
| 13:44 | technomancy | it's my passive-aggressive way of fighting back. |
| 13:46 | Chousuke | any emacs gurus here? how can I bind a key so that it is equivalent to pressing esc? I know of global-set-key but I have no idea what "command" corresponds to esc :/ |
| 13:46 | cooldude127 | Chousuke: (kbd "ESC") should work |
| 13:46 | cooldude127 | so do (global-set-key (kbd "ESC") 'my-fn) |
| 13:47 | technomancy | Chousuke: yeah, ESC isn't a command |
| 13:47 | technomancy | sounds like what you want is another meta key |
| 13:47 | Chousuke | I don't want to bind esc into a command. I want to make another key to behave as if it were esc. |
| 13:47 | cooldude127 | oh |
| 13:47 | technomancy | you might need to do that in X (or whatever platform you're on) |
| 13:48 | Chousuke | hmm :/ |
| 13:48 | technomancy | Chousuke: http://www.emacswiki.org/emacs/MovingTheMetaKey |
| 13:48 | cooldude127 | ok date library: preferred order for year month day arguments? |
| 13:49 | karmazilla | ISO |
| 13:49 | technomancy | cooldude127: year month date is pretty hard to argue with. (order of decreasing significance) |
| 13:49 | cooldude127 | is that the best one? increasing specificity? |
| 13:49 | cooldude127 | k |
| 13:49 | Chousuke | technomancy: Unfortunately that doesn't help as I run OS X |
| 13:49 | cooldude127 | Chousuke: which emacs are you running? |
| 13:49 | Chousuke | Aquamacs |
| 13:50 | cooldude127 | Chousuke: check the docs for aquamacs, i know there is a way |
| 13:50 | technomancy | Chousuke: maybe you can do it in System Preferences? |
| 13:50 | technomancy | are you trying to make caps-lock into meta? |
| 13:50 | Chousuke | nah, I want ctrl-� (next to l in my layout) to be an additional esc |
| 13:50 | cooldude127 | oh shit that might be too much |
| 13:50 | Chousuke | I have caps lock as ctrl |
| 13:51 | cooldude127 | Chousuke: same here |
| 13:51 | technomancy | ok good. =) |
| 13:51 | technomancy | you'll go crazy without that |
| 13:52 | gnuvince | I took advice from somebody who suggested I take a small performance penalty hit by using two hands to perform key chords |
| 13:52 | gnuvince | by using the Ctrl key on the opposite end of the keyboard of the key I want to hit |
| 13:53 | Chousuke | hmm... I thought about moving esc, but instead I guess I could somehow hack viper to change its mode when I hit ctrl-� instead |
| 13:53 | technomancy | so *that*'s what right-control is for. =) |
| 13:53 | technomancy | Chousuke: that's pretty involved; might have better luck in #emacs |
| 13:53 | cooldude127 | yeah they tend to be helpful |
| 13:58 | joma | embedding code into html vs embedding html in code? |
| 13:58 | Chouser | neither! :-) |
| 13:59 | joma | then what do you have? |
| 13:59 | technomancy | joma: I really like the syntax compojure provides |
| 13:59 | cooldude127 | i like a lot about compojure |
| 13:59 | joma | but isnt that embedding html into code? |
| 14:00 | cooldude127 | kind of |
| 14:00 | Chouser | essentially, yes, though it looks a little better than straight html |
| 14:01 | Chouser | joma: here's another option: http://clj-me.blogspot.com/2009/01/enlive-yet-another-html-templating.html |
| 14:01 | Chouser | I haven't used that yet. |
| 14:01 | technomancy | I think my problem with compojure was that the first app I tried to build was too ambitious. |
| 14:01 | technomancy | will have to go back to that after I wrap up my MUD |
| 14:01 | cooldude127 | technomancy: what does MUD stand for? |
| 14:01 | technomancy | multi-user dungeon; basically a multiplayer text adventure. |
| 14:02 | cooldude127 | oh got it |
| 14:02 | cooldude127 | awesome |
| 14:02 | cooldude127 | cuz i think i saw your repo on github |
| 14:02 | technomancy | it's pretty silly, but it's a really simple app that still has some interesting concurrency opportunities. |
| 14:02 | cooldude127 | true true |
| 14:03 | cooldude127 | technomancy: benefit of using a map for dates: no need for functions for year, day, and month |
| 14:03 | technomancy | quite |
| 14:04 | technomancy | is clojure-contrib still on SVN? |
| 14:05 | technomancy | looks like it; hrm. |
| 14:05 | Chouser | no, the latest is on google code |
| 14:05 | Chouser | oh, sorry, yes, SVN |
| 14:05 | technomancy | has that been working out OK? |
| 14:05 | cooldude127 | oh shit, i just realized the date api from java that technomancy and i are using is deprecated since java 1.1 |
| 14:05 | cooldude127 | ew |
| 14:06 | technomancy | I guess SVN makes sense for core, but for contrib it seems like there'd be more benefit to using a DVCS. |
| 14:06 | technomancy | cooldude127: oh yeah... and the one you're supposed to use takes an integer or something useless like that? |
| 14:06 | karmazilla | cooldude127: the replacement is called Calendar, and it is also terrible |
| 14:06 | cooldude127 | technomancy: or you use the damn calendar api |
| 14:06 | Chouser | technomancy: I haven't noticed any problems |
| 14:06 | technomancy | cooldude127: it's like a cherry on top. |
| 14:07 | cooldude127 | i must investigate this bucket of yuck called Calendar |
| 14:07 | Chousuke | hm |
| 14:07 | technomancy | Chouser: well in a situation like that, "problems" generally amount to a lower level of community contributions, which would be hard to notice... |
| 14:07 | Chousuke | I found out viper actually has a configuration variable for this. |
| 14:08 | Chouser | technomancy: ah, I see. yes, Rich was wondering aloud about that. |
| 14:08 | Chousuke | but apparently \C-� is not a valid escape... |
| 14:08 | Chouser | recently |
| 14:08 | technomancy | Chouser: encouraging that he's considering it. |
| 14:09 | technomancy | I know personally I'm much more likely to contribute in small ways if I can just fork and have at it rather than having to maintain a series of personal patches in "my space" and not be able to check in. |
| 14:09 | cooldude127 | this calendar junk is awful, is there a REALLY compelling reason not to use the Date api even tho it's deprecated? |
| 14:09 | technomancy | of course I just end up using git-svn or the github mirror anyway, but it'd be nice if that were officially sanctioned. |
| 14:09 | Chouser | technomancy: that's exactly what I do for my patches against clojure core. |
| 14:10 | technomancy | cool |
| 14:10 | Chouser | technomancy: I don't expect to get commit privs on clojure.core ever |
| 14:11 | technomancy | Chouser: doesn't it make you a tiny bit nervous that rhickey is the only one with the keys? like if he got hit by a bus or something? |
| 14:11 | technomancy | I mean, it's fine for now, but in the long run I wonder about the sustainability. |
| 14:11 | Chouser | technomancy: well, I'm nervous about rhickey getting hit by a bus, but not because of repo commit privs |
| 14:11 | cooldude127 | lol |
| 14:11 | technomancy | good point. =) |
| 14:12 | Chouser | but seriously, if he were to lose interest or the ability to work on clojure, the real loss would be the leadership and direction. |
| 14:12 | technomancy | right, but if that leadership were shared, the odds of survival would improve. |
| 14:13 | technomancy | but the bar for something like that is very, very high. |
| 14:13 | Chouser | it expect it would take less than a week for some sufficiently respected set of clojure community members to band together, put up a new "official" fork, web site, etc. |
| 14:13 | Chouser | s/it expect/I expect/ |
| 14:13 | technomancy | right. I just don't know of any other languages with a single committer. |
| 14:13 | Chouser | I'm not at all worried about that at the moment. |
| 14:13 | technomancy | but I guess it's not a big deal. |
| 14:14 | technomancy | I just don't think it will stay that way forever is all. |
| 14:15 | technomancy | has anyone used the new server-socket lib? I'm wondering if it wouldn't be better if it bound *in* and *out* before handing off control in accept-fn? |
| 14:16 | technomancy | I guess it's technically more flexible to make the caller bind them, but it seems like that's definitely the most common case. |
| 14:17 | gnuvince | In Java, are the size of integer classes the same on all platforms and and operating systems? |
| 14:18 | durka42 | there are 32-bit and 64-bit JVMs |
| 14:18 | durka42 | i don't know if Integer changes... |
| 14:18 | gnuvince | That's what I'd like to know. Can I assume that Byte/SIZE will always return 8, no matter which platform? |
| 14:18 | walters | Integer the class probably will, since pointers underlying it will increase to 64 bi |
| 14:18 | cooldude127 | ok the Calendar api, despite being slightly strange in not using constructors much, is much saner than Date |
| 14:18 | Chouser | The amount of memory the boxed objects consume is different, I believe, but I don't know about the range of values supported. |
| 14:18 | technomancy | man, if Byte changes size, you're screwed. |
| 14:18 | walters | but the *range* of int/Integer is always 32 |
| 14:19 | cemerick | primitives (including int/Integer) are constant, regardless of the jvm: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html |
| 14:19 | durka42 | http://stackoverflow.com/questions/400477/on-a-64-bit-machine-is-the-size-of-an-int-in-java-32-bits-or-64-bits |
| 14:20 | gnuvince | Great |
| 14:20 | gnuvince | Thanks |
| 14:31 | cooldude127 | well damn, time zones are gonna totally unpretty this date library |
| 14:32 | technomancy | I don't think there's a language out there that has pretty timezone handling. |
| 14:32 | technomancy | especially when you start to think about... daylight savings</shudder> |
| 14:32 | cooldude127 | technomancy: i don't think i can hide the timezone objects from java world in any decent way, so i guess it's best to just use them |
| 14:33 | hiredman | ,(bean (Date.)) |
| 14:33 | clojurebot | {:hours 11, :time 1232480118568, :minutes 35, :class java.util.Date, :timezoneOffset 480, :year 109, :day 2, :date 20, :month 0, :seconds 18} |
| 14:34 | technomancy | (doc bean) |
| 14:34 | clojurebot | Takes a Java object and returns a read-only implementation of the map abstraction based upon its JavaBean properties.; arglists ([x]) |
| 14:34 | hiredman | cute, yes? |
| 14:34 | technomancy | huh; nice |
| 14:34 | cooldude127 | NO WAY |
| 14:34 | cooldude127 | except i'm using calendars now, and they are not that pretty |
| 14:36 | cooldude127 | but for the moment, i'm gonna do (bean) on timezone objects |
| 14:38 | cooldude127 | on second thought, no i'm not, i'll just use IDs for timezones, they are readable and can be used to get the actual instance if necessary |
| 14:40 | StartsWithK | cooldude127: Have you tried http://joda-time.sourceforge.net/ |
| 14:41 | StartsWithK | i haven't used it myself but it seen in mentioned couple of times |
| 14:41 | cooldude127 | StartsWithK: i was writing this for the clojure-contrib, so i was trying not to rely on external java libs, unless that isn't a problem |
| 14:41 | technomancy | StartsWithK: this is something that would go in contrib, so it has to be based on stuff that ships with the JVM |
| 14:42 | technomancy | StartsWithK: also: your nick is a lie. |
| 14:42 | cooldude127 | haha |
| 14:42 | StartsWithK | why repeat functionality of existing lib? |
| 14:42 | StartsWithK | :) |
| 14:42 | technomancy | StartsWithK: because people want to be able to work with dates without introducing another dependency |
| 14:42 | cooldude127 | exactly |
| 14:42 | StartsWithK | hmm |
| 14:43 | StartsWithK | clojure contrib in another dependency |
| 14:43 | StartsWithK | also mig layout has external dependency |
| 14:43 | StartsWithK | and it is in contrib |
| 14:43 | technomancy | right, but the assumption is that there's enough other stuff in contrib that folks would already be using it. |
| 14:43 | technomancy | from what I've read automated dependency management is still pretty lousy with clojure; it's maven or nothing. |
| 14:44 | technomancy | and for me, nothing wins; no contest. =) |
| 14:44 | StartsWithK | i use ivy, works without any trouble |
| 14:44 | StartsWithK | for maven and custom ivy repositories |
| 14:44 | technomancy | huh; will have to read up on that |
| 14:45 | StartsWithK | it works even for direct url dependencies |
| 14:45 | StartsWithK | it can be bootstraped inside ant build, so you dont need to include ivy.jar with your app |
| 14:45 | technomancy | oh; heh. you have to write XML? no thanks. |
| 14:45 | hiredman | clojurebot: ties? |
| 14:45 | clojurebot | ties is http://www.bitbucket.org/achimpassen/clojure-ties/wiki/Home |
| 14:46 | technomancy | ties could be promising |
| 14:46 | StartsWithK | like ties ivy can be used from your own app |
| 14:46 | technomancy | hasn't had any activity in a couple months though. |
| 14:46 | StartsWithK | but why tie distribution of your app with your build system |
| 14:58 | joma | anyone have a somewhat complicated webpage programmed in compojure they''d like to show? |
| 14:58 | technomancy | joma: does it count if it doesn't work? =) |
| 14:59 | technomancy | joma: you mean a full web app, or just some HTML generation? |
| 15:00 | joma | html-generation? just to see how to do some nice stuff with different columns |
| 15:00 | joma | and get post |
| 15:00 | technomancy | joma: the lisppaste bot seems to be down: http://paste.lisp.org/display/73936 |
| 15:01 | technomancy | I think the lack of good example code is the biggest problem with compojure at this point. |
| 15:01 | joma | thanks ill have a look later |
| 15:01 | hiredman | joma: there is a series of blog posts http://ericlavigne.wordpress.com/2008/12/28/using-postgresql-with-compojure/ |
| 15:01 | technomancy | luckily the mailing list is pretty responsive |
| 15:01 | hiredman | where, uh, I think the guy builds a blog |
| 15:01 | hiredman | I have not read them all, but they might be what you are looking for |
| 15:02 | technomancy | the time-honored Hello World of web apps. =) |
| 15:08 | Lau_of_DK | What are our tools of choice when it comes to producing graphs from Clojure? |
| 15:08 | Chouser | Dejcartes was just announced |
| 15:08 | hiredman | clojurebot: sicp is also http://web.mit.edu/alexmv/6.001/sicp.pdf |
| 15:08 | clojurebot | You don't have to tell me twice. |
| 15:09 | hiredman | google charts? |
| 15:09 | technomancy | ooh; a PDF |
| 15:09 | StartsWithK | Lau_of_DK: prefuse, visual library? |
| 15:09 | technomancy | probably nicer than reading it with info; heh |
| 15:10 | Lau_of_DK | Looks of good hints, thanks guys |
| 15:11 | Lau_of_DK | Ok, next question, anyone has some experience with this? http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Connection.html#nativeSQL(java.lang.String) |
| 15:16 | technomancy | how long has github known how to highlight clojure source? |
| 15:17 | hiredman | months? |
| 15:26 | danlarkin | it's not github per se, but pygments |
| 15:26 | danlarkin | the highlighting library they use |
| 15:27 | cooldude` | for my date library, is it better to use keyword (:sunday :monday ...) or integers to represent days of the week? |
| 15:28 | hiredman | integers |
| 15:28 | cooldude` | hiredman: if so, starting from 1 or 0? |
| 15:28 | Chouser | my gut feeling is keywords. |
| 15:29 | Chouser | you hardly ever do math with day-of-the-week, though you do it all the time with day-of-the-month |
| 15:29 | cooldude` | i started out with keywords, now i'm wondering if it's right |
| 15:29 | hiredman | 0, of course |
| 15:29 | durka42 | but then, which day do you start with |
| 15:29 | hiredman | monday |
| 15:29 | Chouser | the mere existence of these questions is an indication of the answer, seems to me. |
| 15:29 | Chouser | cooldude`: what made you wonder? |
| 15:30 | cooldude` | the java calendar library starts with sunday and indexes from 1 to 7 |
| 15:30 | cooldude` | Chouser: the fact that i was writing maps to convert between what java uses and keywords |
| 15:30 | cooldude` | thought i'd wait and see if that was the right way to go |
| 15:32 | cooldude` | i think keywords are right, just because when i get a number from that, i don't have a clue what it means off-hand |
| 15:33 | cooldude` | I like that the expression (day-of-week (date)) evaluates to :tuesday |
| 15:33 | gnuvince | If I use a GPL3 lib in an application, must I put my work under the GPL3 as well or can I choose a more liberal license (e.g. MIT) |
| 15:37 | danlarkin | gnuvince: depends on how you distribute |
| 15:37 | danlarkin | gnuvince: it's not about use, it's about distribution |
| 15:39 | gnuvince | danlarkin: not sure yet, but I'll want to open source it. |
| 15:40 | danlarkin | well you can choose a more liberal license, but you can't distribute a GPL library with it, you'll have to require a separate install |
| 15:41 | danlarkin | that is, require the user to install the GPL library themselves |
| 15:42 | gnuvince | ok |
| 15:44 | cooldude` | ok i'm ready for critiques of what i've got so far: http://gist.github.com/49656 |
| 15:54 | durka42 | should figure out how to test for zune-type bugs |
| 15:54 | Lau_of_DK | Is the author of dejcartes in here? |
| 16:00 | Lau_of_DK | Is there an idiomatic way of say (let [smallest-seq (smallest col1 col2)]) where smallest-seq would contains that of col1 and col2 where (count %) was the lowest value ? |
| 16:02 | gnuvince | Lau_of_DK: no, but least, least-by, greatest and greatest-by functions would be very helpful IMO considering that max and min work only with numbers. |
| 16:05 | Lau_of_DK | k, I'll cook something up |
| 16:07 | Lau_of_DK | user> (<< [1 2 3] [1 2 3 4 5]) |
| 16:07 | Lau_of_DK | [1 2 3] |
| 16:07 | Lau_of_DK | That type of thing might come in handy |
| 16:08 | Chouser | I like the idea of least-by and greatest-by |
| 16:08 | Chouser | (least-by count [[1 2 3] [4 5]]) ==> [4 5] |
| 16:08 | Lau_of_DK | You do ? |
| 16:08 | erohtar | hi there - does anyone know of a way to wait for all running agents (without access to the agent objects themselves) ? |
| 16:09 | Chouser | like sort-by, but faster because it can be O(n) |
| 16:09 | Lau_of_DK | I still think << and >> as names are cool, then they could overload on arity to take an fn as optional |
| 16:09 | Chouser | erohtar: 'await' works for agents launched by the current thread. |
| 16:10 | Lau_of_DK | (<< count [1 2 3] [4 5 6 7]) ? |
| 16:10 | gnuvince | I strongly dislike << and >> for this purpose. |
| 16:10 | Lau_of_DK | gnuvince: Why? |
| 16:10 | erohtar | chouser: thanks! is there a way to get at the agents launched by the current thread? |
| 16:10 | gnuvince | First because it's strongly associated in the Java world with bit shifting, but mostly because it doesn't convey what it does. |
| 16:11 | gnuvince | least-by is extremely "communicative" |
| 16:11 | Lau_of_DK | True - I get the bit-shifting bit, thats actually what I intuitively would think it did |
| 16:12 | danlarkin | -1 for << and >> |
| 16:12 | Chouser | erohtar: I think I said that incorrectly, or at least it was wrong in my head. 'await' must be given the agents to wait for, and then it waits for the actions to those agents sent from the current thread. |
| 16:12 | danlarkin | bad names |
| 16:13 | Chouser | erohtar: but no, I don't know of any way to get a list of all agents, expect to build such a list as you create them. |
| 16:13 | erohtar | chouser: ok - i understand. Unfortutely i dont have access to the agents themselves - they are launched from elsewhere in the computation |
| 16:13 | erohtar | chouser: ok, i will build the list of agents then |
| 16:15 | Chouser | Usually what I've done is to have some kind of semaphore that the main thread is blocking on, and when the last agent it done it releases that shared semaphore. |
| 16:15 | Chouser | rhickey seemed to suggest that's not a great way to do thing, but I don't think I understood his preferred solution. |
| 16:20 | technomancy | dang; github mentioned my MUD on twitter, got a bunch of watchers. good thing I got it working this morning. =) |
| 16:21 | gnuvince | hehe |
| 16:23 | shoover | does anyone else wish the throw special form would also accept a string and just wrap it in an exception? |
| 16:23 | technomancy | that would be very nice. |
| 16:23 | danlarkin | technomancy: github guys excited about clojure :) |
| 16:23 | technomancy | danlarkin: yeah; just noticed the compojure blog post. very nice. |
| 16:24 | technomancy | especially considering it's only the 23rd-most-popular language on the site. |
| 16:26 | technomancy | heh; compojure is the most-forked clojure project with a grand total of ... 8 |
| 16:28 | technomancy | so is lancet a project designed for real use, or is it for instructional purposes only? |
| 16:30 | cooldude` | what is lancet? |
| 16:30 | technomancy | it's the main example project from the book |
| 16:30 | cooldude` | oh |
| 16:31 | technomancy | a build system layered on top of ant |
| 16:31 | cooldude` | http://github.com/stuarthalloway/lancet/tree/master |
| 16:31 | cooldude` | found it :) |
| 16:31 | technomancy | clojurebot: lancet |
| 16:31 | clojurebot | Excuse me? |
| 16:32 | technomancy | clojurebot: lancet is a build system that works with ant written as an example for the Programming Clojure book. |
| 16:32 | clojurebot | Ok. |
| 16:32 | stuarthalloway | cooldude: it ain't ready for real world use, but if you want to make it so I will cheer you on |
| 16:32 | cooldude` | looks super cool |
| 16:32 | technomancy | stuarthalloway: but it's designed to be more than just example code then? |
| 16:32 | stuarthalloway | technomancy: I don't think it has any crippling flaws... |
| 16:32 | stuarthalloway | it just isn't done yet |
| 16:33 | stuarthalloway | to be ready for prime time it would need a command line interface |
| 16:33 | cooldude` | i would be willing to work on that |
| 16:33 | stuarthalloway | and some way to get at Ant's sub-task-abstractions like paths |
| 16:33 | cooldude` | this sounds fun |
| 16:33 | technomancy | good to know. I'm in favour of anything that reduces amount of executable XML in the world. |
| 16:33 | cooldude` | lol agreed |
| 16:33 | gnuvince | :) |
| 16:34 | stuarthalloway | weavejester and I discussed it and he thought it had hit the point where purposeful wrappers for specific Ant bits was a better way forward than continuing to be totally general and reflective |
| 16:34 | gnuvince | XML: Reinventing sexps since 1993 |
| 16:34 | stuarthalloway | gnuvince: but bigger! Enterprise sexps! :-) |
| 16:34 | technomancy | I do feel like command-line interfaces are usually the weakest point of clojure projects. |
| 16:34 | gnuvince | woohoo! |
| 16:35 | technomancy | I've given up and just said "launch it through slime" for my own stuff for the time being. |
| 16:40 | danlarkin | I'd like to see someone working with hashdot |
| 16:40 | cooldude` | stuarthalloway: it wouldn't even be a real problem to invoke from the repl except at the moment tasks can't be run more than once |
| 16:40 | stuarthalloway | cooldude: you can reset them |
| 16:40 | cooldude` | ok |
| 16:40 | cooldude` | good to know |
| 16:41 | technomancy | danlarkin: it's on my todo list, but I think for it to really get steam it requires .rpms and .debs and such, which require more C knowledge than I'm comfortable with. |
| 16:43 | danlarkin | technomancy: it's chicken an egg :) no one will make packages unless people want them, and no one will make them unless people want them |
| 16:44 | technomancy | sad but true. |
| 16:45 | technomancy | I sat down with the intention of creating a .deb file at one point, but the hoops you have to jump through are pretty daunting. |
| 16:45 | technomancy | especially for a program that doesn't use autoconf or have a configure script =\ |
| 16:46 | danlarkin | gack |
| 16:46 | danlarkin | well if it's simple enough not to need autotools then just write a 2 line Makefile |
| 16:47 | technomancy | I don't know... all the packaging tutorials have a lot of assumptions; as soon as you step outside them I'm lost. |
| 16:47 | danlarkin | mmhmm |
| 16:47 | danlarkin | I wouldn't fret too much over no packages |
| 16:48 | danlarkin | there are no packages for clojure either |
| 16:48 | technomancy | right; submitting a hashdot profile for clojure would be useful regardless |
| 16:51 | hiredman | xD |
| 16:52 | hiredman | java.util.BitSet |
| 16:55 | technomancy | danlarkin: if hashdot were to launch java with a classpath that referred to clojure-contrib even though clojure-contrib.jar didn't exist, would it cause problems? |
| 16:55 | technomancy | or are non-existent entries ignored? |
| 16:57 | danlarkin | java -cp /does/not/exist.jar:clojure/src/clojure/trunk/clojure.jar clojure.lang.Repl |
| 16:57 | danlarkin | Clojure |
| 16:57 | danlarkin | user=> |
| 16:57 | danlarkin | answer: ignored |
| 16:57 | technomancy | cool |
| 16:57 | danlarkin | didn't know the answer myself :) |
| 16:58 | technomancy | I wonder if hashdot has the # character hardcoded as the comment marker |
| 16:59 | technomancy | that would be a shame |
| 16:59 | danlarkin | well it's supposed to look like a shell script, I think is the idea |
| 17:06 | technomancy | certain CL implementations will actually let you start your file with # and treat it as a comment just to allow for shebang lines |
| 17:06 | technomancy | it's ugly, but it's nice to have the option. |
| 17:07 | Chouser | #! is a comment in clojure |
| 17:07 | technomancy | aha; nice to know! |
| 17:07 | technomancy | will have to teach clojure-mode.el about that. =) thanks for the heads up. |
| 17:07 | Chouser | np |
| 17:13 | technomancy | what's the difference between the jvm's -cp argument and -Xbootclasspath? |
| 17:15 | dudleyf | technomancy: Classes in the bootclasspath don't go through the jvm's bytecode verifier |
| 17:15 | technomancy | so don't use it unless there's a good reason? |
| 17:15 | dudleyf | So it cuts down on startup time |
| 17:16 | technomancy | aha. would it be advantageous to use it for clojure.jar? |
| 17:16 | technomancy | it wouldn't make a difference for pure-clojure jars then |
| 17:16 | Chousuke | clojure.jar is probably not that big |
| 17:16 | dudleyf | technomancy: Maybe, but yeah, I think you can run into some weird classloader problems |
| 17:21 | Chouser | gnuvince_: thanks for subjecting my blog post to the reddit commenters. ;-) |
| 17:23 | technomancy | Chouser: I just had to laugh at the last comment on your "My path to Clojure" post |
| 17:23 | technomancy | "really, the compiler is trying to help you. you ungrateful wretch." |
| 17:23 | Chouser | heh |
| 17:24 | Chouser | well, he's perfectly correct, at least in theory. And I think I would have agreed with him before my Scala adventures. |
| 17:25 | pjb3 | FYI: Clojure talk in Portland, OR JUG 9:30 EST streaming live tonight http://bit.ly/pjuglive |
| 17:27 | danlarkin | pjb3: cool! |
| 17:27 | gnuvince_ | Chouser: happy to :) |
| 17:28 | gnuvince_ | The static typing thing was the only part I disagreed with you, but I thought that it was very interesting nonetheless |
| 17:28 | technomancy | the compiler is great at helping you avoid a certain class of error, the problem is that you never make those kinds of mistakes in the first place. =) |
| 17:28 | gnuvince_ | And if Jonathan "My book on Catalyst sucks" Rockway thinks it's fanoiery, then let him |
| 17:29 | gnuvince_ | technomancy: not really true, but I don't think we want to go into a static vs dynamic flamewar |
| 17:29 | Chouser | I don't mind disagreement at all, and I'm trying very hard not to mind the "user error" and "fanboy" comments. I'll succeed, don't worry. |
| 17:29 | technomancy | gnuvince: perhaps you and I make different kinds of mistakes. =) |
| 17:30 | gnuvince_ | technomancy: perhaps we're familiar with different types of static typing too. |
| 17:30 | gnuvince_ | I would agree that static typing in C or Java is much more an annoyance than an advantage |
| 17:33 | technomancy | yeah, one of these years I'll give haskell or OCaml a shot |
| 17:34 | keithb | Hi, I'm trying to create an object with metadata. Can you tell me what I'm doing wrong?: http://pastie.org/366164 |
| 17:34 | stuarthalloway | technomancy: I have really enjoyed working through Real World Haskell online |
| 17:34 | gnuvince_ | Real World Haskell is a good starter |
| 17:34 | gnuvince_ | And they don't just use the type system to be in your way |
| 17:34 | Chouser | keithb: Strings don't support metadata |
| 17:35 | gnuvince_ | They encode logic about the problem in the type system, thus making sure some invariants are enforced at compile time. |
| 17:35 | Chouser | keithb: Clojure strings are just Java strings, so no special features like metadata |
| 17:36 | keithb | So only an object that I can reasonably believe *not* to map to a plain Java object would support metadata? |
| 17:36 | Chouser | keithb: try this instead, and it should work fine: (def k {:name "Keith"}) |
| 17:37 | Chousuke | you can attach metadata to the var itself too I guess. |
| 17:37 | Chouser | only objects that implement clojure.lang.IMeta support metadata |
| 17:37 | Chouser | ,(instance? clojure.lang.IMeta []) |
| 17:37 | clojurebot | true |
| 17:38 | Chousuke | but that kind of use for metadata seems wrong. |
| 17:38 | Chouser | ,(instance? clojure.lang.IMeta "") |
| 17:38 | clojurebot | false |
| 17:38 | keithb | Yes, that worked. Is :name a special case that always resolves to the significant value (semantic value? or the value used to test equals) of any object, or is it just strings? |
| 17:38 | Chousuke | keith's sex is obviously data about keith, not data about keith's name :) |
| 17:38 | Chouser | keithb: there's nothing special about :name, it's just a keyword like any other |
| 17:39 | Chouser | and probably equality-relevent data too, depending on your political views I suppose. |
| 17:39 | keithb | but why is it that when I have repl evaluate k or k4, it returns "Keith"? Does it always return the first metadata value? |
| 17:40 | Chousuke | it returns the actual value. |
| 17:40 | Chousuke | the metadata is not shown unless you ask for it. |
| 17:40 | Chouser | if you do (def k {:name "Keith"}), then after that typing just k at the repl should print {:name "Keith"} |
| 17:40 | keithb | But when I did: (def k { :name "Keith" }), "Keith" was considered the actual value. ??? |
| 17:41 | Chousuke | keithb: the value of k in that case would be {:name "Keith"} |
| 17:41 | Chousuke | keithb: with no metadata |
| 17:41 | gnuvince_ | user=> (def k (with-meta {:name "Keith"} {:source "REPL"})) |
| 17:41 | gnuvince_ | #'user/k |
| 17:41 | gnuvince_ | user=> k |
| 17:41 | gnuvince_ | {:name "Keith"} |
| 17:41 | gnuvince_ | user=> ^k |
| 17:41 | gnuvince_ | {:source "REPL"} |
| 17:42 | keithb | Yes, I'm sorry you're right. so is k then a map containing a single key/value pair? |
| 17:42 | Chousuke | yes. |
| 17:42 | gnuvince_ | yes |
| 17:43 | gnuvince_ | and the meta data of k is also a map with one key/value pair |
| 17:43 | keithb | Got it. Thanks, all. |
| 17:43 | keithb | This IRC thing is great. I'm sitting in a bookstore cafe in Panama. ;) |
| 17:44 | gnuvince_ | IRC is the best application of the Internet |
| 17:44 | Chouser | gnuvince_: wow. just, wow. :-) |
| 17:46 | gnuvince_ | Email, shemail (some words don't work with that expression...): I'd rather choose a channel with many people interacting live and talking about a specific subject any day of the week and twice on weekends |
| 17:46 | keithb | I think it would be "shmemail". ;) |
| 17:48 | gnuvince_ | keithb: yes, you're right: http://en.wikipedia.org/wiki/Shm-reduplication |
| 17:53 | Azmodan | How can I do modulo in Clojure? |
| 17:53 | danlarkin | Azmodan: rem |
| 17:53 | Azmodan | Thanks |
| 17:57 | Azmodan | I'm trying to eliminate all non-multiples of 3 from a range. I figured I have to use filter. I know my predicate will use rem. I found partial. And I'm kinda stuck. |
| 18:00 | Chouser | ,(interleave (range 1 30 3) (range 2 30 3)) |
| 18:00 | Azmodan | Is "On Lisp" a good book to read to get into Clojure? And what should I keep in mind while reading it? |
| 18:00 | clojurebot | (1 2 4 5 7 8 10 11 13 14 16 17 19 20 22 23 25 26 28 29) |
| 18:01 | clows | ,(filter #(zero? (rem % 3)) (range 1 30)) |
| 18:01 | clojurebot | (3 6 9 12 15 18 21 24 27) |
| 18:03 | Chousuke | Azmodan: you should at least remember that things in clojure are supposed to be immutable. :) |
| 18:04 | Azmodan | Otherwise, are the idioms similar? |
| 18:04 | Chousuke | the macro system also looks almost identical to common lisp's, but the namespace qualifying behaviour of syntax-quote is an important difference. |
| 18:05 | technomancy | danlarkin: does this look like a reasonable setting for hashdot? java.class.path = .:../jars/clojure.jar:../jars/clojure-contrib.jar |
| 18:05 | technomancy | (not that you're a hashdot pro, but I just know next to nothing about the classpath) |
| 18:05 | Chouser | I found "on lisp" to be mostly useful in justifying s-expresions over c-like syntax, and for demonstrating the power of macros. |
| 18:06 | technomancy | Azmodan: On Lisp is mostly about macros... there's a lot more to Clojure than macros. |
| 18:06 | technomancy | though macros have the potential to be very confusing. |
| 18:06 | danlarkin | technomancy: I've never even used hashdot, I just like the idea :) what's the deal with ../jars/ -- is that standard? |
| 18:06 | technomancy | anyway, it doesn't strike me as a good place to start unless you've already read through Programming Clojure and have put together a few sample apps. |
| 18:06 | Azmodan | What do you suggest I read then? |
| 18:06 | technomancy | danlarkin: well, I don't want to hardcode the full path |
| 18:07 | hiredman | project euler is a good starting point |
| 18:07 | technomancy | danlarkin: but even if I do, it breaks: HASHDOT ERROR: [2]: No such file or directory: /home/phil/src/mire/src:/home/phil/src/mire/jars/clojure.jar |
| 18:07 | technomancy | danlarkin: I guess it's probably hashdot making assumptions that the classpath will only be a single entry? |
| 18:07 | Azmodan | I completed my first Project Euler problem with Clojure :) |
| 18:07 | hiredman | to just start writing code |
| 18:08 | Azmodan | That went way faster than with Haskell :) |
| 18:08 | danlei`` | azmodan: a few good free (common-)lisp books: successful lisp, gentle introduction to symbolic computation, practical common lisp |
| 18:09 | danlarkin | technomancy: I hope it doesn't... that would be pretty lame... maybe it checks for .jars or something... |
| 18:09 | technomancy | danlarkin: ok, I'll check in with the author |
| 18:09 | danlarkin | technomancy: .jar ending each path on the classpath I mean, *shrug* |
| 18:09 | hiredman | man, if clojure was a real functional language, the complement of my base64 encode function would decode base64 |
| 18:10 | technomancy | hiredman: maybe you should use a simpler encoding, like perhaps rot13. =) |
| 18:10 | technomancy | danlarkin: I think I've almost got it, as long as he's OK with my change to allow ; as a comment syntax |
| 18:12 | Azmodan | Thanks for the advices. See you soon. |
| 18:25 | technomancy | is . on the classpath by default? |
| 18:27 | technomancy | is there a way to get the path of the file currently being eval'd? |
| 18:37 | Chouser | no |
| 18:37 | Chouser | *file* |
| 18:39 | technomancy | ah; should have guessed that. thanks. |
| 18:40 | technomancy | how about getting a directory from a filename? |
| 18:40 | hiredman | ,(str *file*) |
| 18:40 | clojurebot | "" |
| 18:50 | clojurebot | svn rev 1218; added overloads for Atom.swap fix RT.nth for Lists to use count only for RandomAccess |
| 18:51 | hiredman | clojurebot: botsnack |
| 18:51 | clojurebot | thanks; that was delicious. (nom nom nom) |
| 18:52 | hiredman | just keep it up |
| 19:03 | technomancy | danlarkin: sounds like it'll work fine once hashdot gets variable comment syntax, which is planned for Real Soon Now |
| 19:08 | gnuvince_ | Wow |
| 19:08 | gnuvince_ | Mega retard in the thread about Chouser's blog post |
| 19:08 | gnuvince_ | http://www.reddit.com/r/programming/comments/7r2zu/my_path_to_clojure/c0762zp |
| 19:11 | danlarkin | technomancy: hurrah! |
| 19:13 | technomancy | will be nice to be able to launch things without slime. =) |
| 19:13 | technomancy | and also to have reasonable ps output |
| 19:30 | clojurebot | svn rev 1219; added methods/prefers for multimethod reflection |
| 19:53 | joha1 | I have an application where one agent is setting up an XmlRpc server, while the rest of the program has a GUI. When I select close from the GUI I want to kill the XmlRpc agent, but it is stuck in a server.start() call which will never return. How can I kill this agent/thread? |
| 19:55 | Chouser | the server.start() is waiting on a socket? |
| 19:55 | Chouser | blocking? |
| 19:56 | joha1 | yes |
| 19:57 | joha1 | it is a call to a Java library (redstone XmlRpc) so I don't control this call. I just want to kill the thread |
| 19:58 | Chouser | is there any way to give it a timeout, so that its thread can check the status of the GUI and loop around to wait some more? |
| 19:58 | joha1 | will have to check the API docs |
| 19:59 | joha1 | but the general question is if I can kill agents in Clojure |
| 20:00 | technomancy | only Neo can kill agents. |
| 20:00 | cooldude127 | lol |
| 20:00 | technomancy | sorry |
| 20:00 | cooldude127 | that was perfect |
| 20:01 | joha1 | :) |
| 20:01 | Chouser | joha1: when an agent is running, it's just using a regular java thread. My (admitedly weak) understanding is that Java discourages killing threads. |
| 20:02 | joha1 | sometimes you have no choice - but I will see if I can work around my problem somehow |
| 20:02 | Chouser | http://java.sun.com/j2se/1.5.0/docs/guide/misc/threadPrimitiveDeprecation.html |
| 20:06 | joha1 | it seems that the method I want is thread.interrupt(). Now, how to get the agent to send interrupt to its thread... |
| 20:12 | meredydd | Is there a reason you can't let System.exit() take care of things for you, joha1? |
| 20:13 | joha1 | it kills the repl :( |
| 20:13 | meredydd | (or, equally, is there a reason you're not using Apache XML-RPC, which doesn't have this problem?) |
| 20:15 | joha1 | apache xmlrpc is using reflection to bind xmlrpc tags to callback methods in an object. Demanding an object to declare callback functions doesn't seem to fit with FP. With redstone xmlrpc I can declare my own dispatch function instead |
| 20:16 | joha1 | besides, I don't think it solves the problem. You still have a start method which blocks forever |
| 20:16 | meredydd | The Apache libs don't require reflection; they just provide it as the default handler. |
| 20:16 | meredydd | clojurebot: pastebin |
| 20:16 | clojurebot | I don't understand. |
| 20:16 | meredydd | drat it. Where's the pastebin round here? |
| 20:17 | Chouser | lisppaste8: url |
| 20:17 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 20:17 | Chouser | our bots ignore each other |
| 20:17 | joha1 | ok, you know better than me. Do you have the method names, or an example? |
| 20:17 | lisppaste8 | meredydd pasted "apache xml-rpc wrapper" at http://paste.lisp.org/display/73958 |
| 20:18 | meredydd | That's the code I use to wrap Apache's XML-RPC implementation |
| 20:18 | Chouser | ouch |
| 20:18 | meredydd | Yeah, they really brought the ugly for v3. |
| 20:18 | joha1 | great. ugly indeed, but thanks |
| 20:19 | meredydd | I can just picture it: "We inherited this wildly-popular project from its original developers, and it works just fine. But you know what it really needs? More abstract factories." |
| 20:20 | meredydd | (I wrap it as a servlet, so I can throw it to Jetty, as I'm writing Compojure apps. Using a real webserver is generally more scalable anyway, so I'd recommend keeping it that way, but if you really wanted to you could probably chuck that handler at the default WebServer) |
| 20:21 | meredydd | Remember, by the way, that XML-RPC structs coming in arrive as java Maps, and if you return a Clojure persistent hashmap it won't understand you |
| 20:21 | meredydd | so you'll want some kind of fixup on return |
| 20:22 | joha1 | Yes, I've noticed that problem already |
| 20:25 | lisppaste8 | meredydd annotated #73958 with "jmap" at http://paste.lisp.org/display/73958#1 |
| 20:25 | meredydd | That's the function I use. |
| 20:25 | meredydd | It's not lazy, but in this case there's no point in making it lazy, so I didn't bother. |
| 20:27 | meredydd | (eurrgh. I'm rereading that code, and I was *crap* when I wrote it. Explicit loops rather than (doseq)? Ouch.) |
| 20:29 | joha1 | hi there |
| 20:30 | joha1 | I don't have time to do more now, but I'll keep the code for reference. thanks for the help |
| 20:30 | meredydd | just making sure you'd seen the new annotation; save you rewriting that function too :) |
| 20:30 | meredydd | Very welcome. Should really think about submitting that to clojure-contrib, but I keep getting distracted. |
| 20:31 | joha1 | no need to duplicate the effort. and i think submitting a good xmlrpc solution to contrib is a great idea |
| 21:11 | clojurebot | svn rev 1220; Streams in progress - safe stream model |
| 21:28 | Azmodan | How do I turn ratios into doubles? |
| 21:28 | Chouser | (float 1/2) |
| 21:28 | Chouser | ,(double 2/3) |
| 21:28 | clojurebot | 0.6666666666666666 |
| 21:29 | Chouser | or use a float or double as any of the operands |
| 21:29 | Chouser | ,(/ 2 3.0) |
| 21:29 | clojurebot | 0.6666666666666666 |
| 21:30 | Azmodan | Neat. Does it works as nicely for all type conversion? I was using Integer.parseInt and related for all my conversions. |
| 21:31 | Chouser | I think all Java primitive types have matching coersion functions |
| 21:31 | Chouser | ,(char 33) |
| 21:31 | clojurebot | \! |
| 21:31 | cooldude127 | but doesn't work for strings |
| 21:31 | cooldude127 | ,(int "5") |
| 21:31 | clojurebot | java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character |
| 21:32 | Azmodan | I just found str, it seems very useful. |
| 21:32 | danlarkin | http://www.mogulus.com/pjug is on |
| 21:33 | danlarkin | clojure presentation |
| 21:33 | Cark | there's no image ! |
| 21:34 | danlarkin | I think he's still setting up |
| 21:34 | danlarkin | there was image just earlier |
| 21:35 | Chouser | killed my browser |
| 21:36 | danlarkin | yeah this is a cpu hog like nothing else |
| 21:36 | danlarkin | fans running full speed |
| 21:37 | danlarkin | oh, they're doing intros around the room I guess |
| 21:49 | danlarkin | Hm. well the presentation has started, but the screen is still blank |
| 21:49 | danlarkin | oh spoke too soon! |
| 21:49 | danlarkin | video is on |
| 21:53 | Cark | hum is there any way to prevent the advertising showing up ? |
| 22:01 | danlarkin | I'm just listening |
| 22:01 | danlarkin | not watching |
| 22:01 | danlarkin | but when I was trying to watch they were _extremely_ annoying |
| 22:02 | Cark | yes =/ |
| 22:07 | danlarkin | uh oh, the presenter's in trouble! |
| 22:08 | danlarkin | he doesn't know the answer :) |
| 22:08 | Cark | hum there are locks though |
| 22:20 | jli | for a project, I came up with a general design with distinct "pieces" manipulating data and passing data amongst themselves. I intended to implement this is Erlang, because the model seemed to fit very well. Could it be done just as well in Clojure, though? |
| 22:21 | danlarkin | this presenter is giving out some misinformation... |
| 22:22 | drewr | danlarkin: Do tell... |
| 22:22 | Cark | jli : clojure is not erlang, but you can go pretty darn close to it using agents |
| 22:23 | jli | Cark, okay, thank you - I'll look into that :) |
| 22:24 | jli | I would just love to be able to use a Lisp. And I believe I'll have to use a Java library or two, so Clojure would be great |
| 22:26 | Cark | jli : clojure is great fun and very well integrated in the jvm, interacting with libraries is sometimes even easier using clojure than java, you will love it ! |
| 22:26 | jli | even if I end up using Erlang, I definitely intend on learning Clojure |
| 22:27 | Cark | clojure is still a bit of a moving target though |
| 22:27 | Cark | version 1 not out yet |
| 22:29 | Cark | i guess you can't beat erlang maturity that fast |
| 22:29 | danlei | some moving targets are worth aiming at :) |
| 22:30 | Cark | right, i just don't want to oversell it |
| 22:40 | blbrown | Is there a way to pass flags (like CASE_INSENITIVE) to the regex call if I use (re-pattern s) |
| 22:41 | blbrown | guess I could just create an instance of Pattern |
| 22:42 | Cark | the re- functions are a thin wraper around the java regex stuff |
| 22:42 | Cark | so that's pretty much the same thing |
| 22:45 | drewr | blbrown: You can also do #"(?i)...." as your pattern. |
| 22:46 | drewr | That flags it (at some performance cost, apparently). |
| 22:47 | drewr | ,(re-seq #"(?i)(foo)" "fOo foo fOO f0o") |
| 22:47 | clojurebot | (["fOo" "fOo"] ["foo" "foo"] ["fOO" "fOO"]) |
| 22:47 | drewr | ,(re-find #"(?i)(foo)" "fOo foo fOO f0o") |
| 22:47 | clojurebot | ["fOo" "fOo"] |
| 22:48 | dreish | No need for the second pair of parens. |
| 22:48 | dreish | ,(re-seq #"(?i)foo" "fOo foo fOO f0o") |
| 22:48 | clojurebot | ("fOo" "foo" "fOO") |
| 23:18 | ecret | anyone know when clojure-dev(eclipse plugin) will be released? |