2008-11-24
| 00:01 | hiredman | a, uh, �thunk? |
| 00:03 | timothypratley | Ok I have an example of a null pointer user error: |
| 00:03 | timothypratley | (defn new-listener [port] |
| 00:03 | timothypratley | (try (java.net.ServerSocket. port) |
| 00:03 | timothypratley | (println "Listening on " port) |
| 00:03 | timothypratley | (catch Exception e |
| 00:03 | timothypratley | (println "Failed to listen on port " port ": " (.getMessage e))))) |
| 00:03 | timothypratley | (println "Server started") |
| 00:03 | timothypratley | (let [listener (new-listener 8888)] |
| 00:04 | timothypratley | (.accept listener)) |
| 00:04 | timothypratley | new-listener is incorrectly defined |
| 00:04 | timothypratley | so throwing a null pointer exception is the correct action |
| 00:04 | timothypratley | Exception in thread "main" java.lang.NullPointerException (test.clj:0) |
| 00:05 | timothypratley | but there are no clues as to where the error occured. |
| 01:36 | timothypratley | if i had a set, and wanted to call a function on all members for side-effects... what should I use? |
| 01:36 | notallama | doseq? |
| 01:37 | albino | but I just learned about it 10 minutes ago :) |
| 01:38 | timothypratley | great! thanks |
| 01:38 | hiredman | (doc doseq) |
| 01:38 | clojurebot | Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by "for". Does not retain the head of the sequence. Returns nil. |
| 01:40 | albino | hiredman: did you write clojurebot? |
| 01:56 | hiredman | albino: yes |
| 01:56 | hiredman | clojurebot: where are you? |
| 01:56 | clojurebot | http://gist.github.com/27733 |
| 01:57 | hiredman | clojurebot: where are you is <reply>#who: I am at http://gist.github.com/27733 or there abouts |
| 01:57 | clojurebot | Ok. |
| 02:21 | replaca | anyone active? |
| 02:21 | replaca | I have an 'ns' question |
| 02:22 | replaca | I don't see a good source of documentation on the ns macro |
| 02:22 | timothypratley | I'm here, but unlikely to be able to help :) |
| 02:22 | timothypratley | you can but ask... |
| 02:23 | replaca | but in the api doc, they say to prefer ":as" with ns to using refer to make aliases |
| 02:23 | replaca | but I don't see the syntax for add anywhere |
| 02:24 | replaca | *add -> :as |
| 02:24 | replaca | I would guess that it fits into (ns (:use ...)) somehow |
| 02:24 | replaca | ideas? pointers? |
| 02:25 | replaca | timothypratley: are you a noob too? |
| 02:25 | timothypratley | (doc require) |
| 02:25 | clojurebot | Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly. Libs A 'lib' is a named set of resources in classpath whose contents define a library of |
| 02:25 | timothypratley | Recognized options: :as :as takes a symbol as its argument and makes that symbol an alias to the lib's namespace in the current namespace. |
| 02:26 | timothypratley | I think that means (require something :as somethingelse) |
| 02:26 | timothypratley | yup indeed! |
| 02:26 | replaca | yeah, but I thought that require was now mostly deprecated in favor of using ns |
| 02:26 | timothypratley | what exactly are you trying to do...? |
| 02:27 | replaca | or am I misreading things? |
| 02:27 | replaca | So, I'm making a port of the CL format function |
| 02:27 | replaca | but that conflicts with clojure.core |
| 02:27 | replaca | so I call it cl-format |
| 02:28 | replaca | but I'm using test ode from the examples in CLtL and they all call it |
| 02:28 | replaca | format |
| 02:28 | replaca | so I wanted to alias it back so the tests look like the book |
| 02:28 | replaca | (and just to show that it could be done :-)) |
| 02:30 | replaca | ahh, but now I see that :as aliases namespaces and not symbols |
| 02:30 | replaca | maybe I just need def... |
| 02:31 | replaca | hmmm |
| 02:31 | replaca | timothypratley: how long have you been clojuring? |
| 02:34 | timothypratley | groovey :) yes you are beyond my help sorry... you want to 'hide' the clojure core in favour of your own functions I take it |
| 02:35 | timothypratley | about a month, not very heavily and I don't know Lisp or Java that great so I'm a bit of a battler :P |
| 02:47 | replaca | yup, it turns out I was just thinking too hard |
| 02:48 | replaca | after hiding format with (:refer-clojure :exclude [format]) |
| 02:48 | replaca | I was able to do (def format cl-format) and everything works |
| 02:49 | replaca | yeah, that is a little bit of a battle :-) |
| 02:49 | replaca | I'm a newbie, but I come knowing lisp, java and some haskell so |
| 02:49 | replaca | I know most of the concepts |
| 02:53 | Zephtar | Good morning |
| 03:07 | Pupeno | Hello. |
| 06:16 | yonatan | hello channel, anybody know how i can get a list of all currently defined symbols? |
| 06:18 | blackdog_ | http://clj-doc.s3.amazonaws.com/tmp/doc-1116/index.html |
| 06:18 | yonatan | i mean dynamically |
| 06:19 | yonatan | at runtime, get a list of anything that's been def'ed |
| 06:22 | blackdog_ | yonatan, this file is from enclojure it grabs symbols |
| 06:23 | yonatan | cool, thanks. i'll just see how i get this DCC thing to work |
| 06:23 | blackdog_ | actually i;ll paste it hang on |
| 06:24 | blackdog_ | http://paste.lisp.org/display/70949 |
| 06:25 | yonatan | thanks, blackdog_ |
| 06:43 | lau` | Hey heey :) |
| 07:29 | Pupeno-G | Hello. |
| 08:09 | gnuvince | Is there a Clojure or Java library to generate XML? Specifically, RSS. |
| 08:11 | duck1123 | there are tons of java libs |
| 08:12 | gnuvince | duck1123: any one in particular? A very simple one would be ideal |
| 08:12 | duck1123 | There's a really good one, I'm just trying to remember the name. one sec |
| 08:13 | rhickey | gnuvince: there is clojure.xml, which pulls xml into Clojure data structures, and has a simple emit function |
| 08:15 | gnuvince | I'll check it out. |
| 08:18 | duck1123 | gnuvince: are you more interested in rss or atom |
| 08:18 | duck1123 | you might want to check out Apache Abdera |
| 08:21 | gnuvince | duck1123: it's for my mini tutorial |
| 08:21 | duck1123 | then Abdera is way too much for you |
| 08:21 | gnuvince | My need is so trivial that if there's no good lib, I'll just println the tags |
| 08:21 | duck1123 | go with rhickey's suggestion |
| 08:24 | gnuvince | Trying to figure out clojure.xml/emit right now |
| 08:33 | duck1123 | I would hate to have to program much of this clojure.xml format by hand |
| 08:35 | rhickey | gnuvince: try this: |
| 08:35 | rhickey | (require 'clojure.xml) |
| 08:35 | rhickey | (def x (clojure.xml/parse "http://arstechnica.com/journals.rssx")) |
| 08:35 | rhickey | x |
| 08:35 | rhickey | (clojure.xml/emit x) |
| 08:36 | Lau_of_DK | rhickey: wouldnt it be a good idea to include Chousers zip-filter routines in that namespace? |
| 08:37 | duck1123 | Lau_of_DK: zip-filter has other uses though |
| 08:38 | Lau_of_DK | Isnt zip-filter the one where he put (xml-> x :element) and all that in ? |
| 08:38 | duck1123 | actually, I think I'm thinking of something else |
| 08:38 | duck1123 | have a link? |
| 08:39 | Lau_of_DK | Its in contrib |
| 08:39 | rhickey | duck1123: yes, the preferred by-hand format is [tag {:maybe attrs} maybe-child ...], but I haven't switched clojure.xml to produce it |
| 08:39 | duck1123 | ok, clj-doc hasn't indexed that one yet |
| 08:40 | duck1123 | rhickey: will that handle namespaced tags? |
| 08:41 | duck1123 | we have to be careful not to mess up <foo:bar/> |
| 08:42 | rhickey | duck1123: there's an old conversation about ns tags, they can be supported explicitly, i.e. :foo:bar is an ok keyword - the trick is implicit namespace contexts |
| 08:43 | duck1123 | I haven't gotten around to doing any of the xml stuff with my project yet |
| 08:44 | duck1123 | which is surpising considering the previous incarnation was written in xquery |
| 08:50 | Lau_of_DK | rhickey: wouldnt it be a good idea to include Chousers zip-filter |
| 08:50 | Lau_of_DK | routines in that namespace? (Im thinking of xml-> and all that) |
| 08:51 | rhickey | Lau_of_DK: please don't ask the same question twice, if I'm not answering it's because I'm trying to work here |
| 08:52 | Lau_of_DK | rhickey: Please accept my appologies. I thought that it was probably easy to miss messages in the middle of a discussion. Wont happen again. |
| 09:19 | abrooks | Lau_of_DK: The Google Group is a good way to ask a more persistent question. It's less ephemeral, is more obvious when a question hasn't been directly addressed (because of threading) and has a larger audience. I know I personally have a gravity to IRC since it's much more interactive so I have to remind my self to consider what things should be sent to IRC and what should be sent to the group. |
| 09:21 | Lau_of_DK | abrooks: Very good point indeed. I've been too lazy with the group |
| 10:19 | wlr | mattrepl: i notice you've retracted clj-cont. are you willing to say why? |
| 10:21 | mattrepl | because it was awful. I'm also not convinced that conversion to CPS is the way to go. it may be better to build support for higher-level constructs using built-in features (e.g., coroutines via agents) |
| 10:24 | mattrepl | wlr: you're welcome to have the source, although it was my first Clojure project and it was a port of CL code. starting fresh and using idiomatic Clojure is the way to go. |
| 10:30 | wlr | mattrepl: thx. i made a local clone early on but it's still sitting unused. i agree about using idiomatic clojure. i was curious to see if you would gradually transform the original into idiomatic clojure. |
| 10:33 | mattrepl | wlr: that was the plan, but no longer need continuations. it'd be a fun project though, it's one of those things that's easy to hand wave but anyone who hasn't done it before (like myself) will end up learning something |
| 10:39 | wlr | mattrepl: well, i have a pie-in-the-sky hope of trying to do lispy version of Constraint-Based Local Search (van Hentenryck and Michel). They use and swear by continuations for their purposes. |
| 10:58 | blackdog_ | danlarkin, with your json lib, is it possible to add new methods to decode objects like Timestamps from a db? |
| 10:59 | blackdog_ | i don;t think it is right now as you arn't using multimethods |
| 10:59 | danlarkin | blackdog_: I've given thought to that but I couldn't figure out a good way to add in a good way, but I'd like for it to be possible |
| 11:00 | blackdog_ | ok, i guess the encode-helper is a good candidate for a multimethod ? |
| 11:00 | blackdog_ | then one could plug in new helpers as required |
| 11:00 | danlarkin | well there's two issues with that |
| 11:00 | blackdog_ | that's my understnading |
| 11:00 | blackdog_ | ok |
| 11:01 | danlarkin | one is that in my testing I found multimethods to be slightly slower than the cond, which would be OK if it indeed provided extra flexibility, |
| 11:01 | danlarkin | but I'm thinking that the :else could just call a multimethod that dispatches on type? |
| 11:02 | blackdog_ | not sure, sounds reasonable |
| 11:02 | blackdog_ | not a biggie right now just thought i'd mention it |
| 11:02 | danlarkin | that's the other problem... the multimethod dispatch function has to be defined by me |
| 11:03 | danlarkin | that is, the library, not the user of the library |
| 11:03 | blackdog_ | i look at it very much like the print-method i guess, which is on type too |
| 11:04 | blackdog_ | actually i'd like to vote for the json encoder/decoder in core |
| 11:05 | danlarkin | yeah maybe dispatching on type isn't horrible |
| 11:05 | blackdog_ | i think it's a good hook for a lot of peeps |
| 11:07 | danlarkin | I think rich aims for clojure to have a small core |
| 11:07 | blackdog_ | well true, but there is a vote right now as to what may be good to be included in core |
| 11:08 | Chousuke | I think a json encoder would be just fine in contrib |
| 11:08 | Chousuke | contrib is kind of semi-official anyway. |
| 11:08 | rhickey | blackdog_: I think at some point Clojure will ship with contrib, so libs like that will be included in the download and jar |
| 11:09 | blackdog_ | ah cool, that my other thought |
| 11:09 | blackdog_ | batteries included - good plan |
| 11:11 | Chousuke | and I don't know how your json encoder/decoder works, but couldn't you take a dispatch function as a parameter when you create the decoder/encoder object? |
| 11:12 | Chousuke | maybe that's too flexible :/ |
| 11:13 | Chousuke | or rather, instead of a dispatch function you could just take a multimethod parameter :/ |
| 11:15 | danlarkin | I think I might like just dispatching on type better |
| 11:16 | danlarkin | I wanted custom dispatch for a while but after thinking about it for a while and trying a whole bunch of options I think it's too complicated and unnecessary |
| 11:24 | flonk | (take 100 (repeatedly (rand))), shouldnt that work? |
| 11:24 | abrooks | flonk: (take 100 (repeatedly rand)) |
| 11:25 | danlarkin | blackdog_: are you using a Java decoding right now, or don't you have a need for decoding? |
| 11:26 | abrooks | flonk: Repetedly takes an IFn (a function). By wrapping "rand" in ()s you've invoked it and now have a Double. Does that make sense? |
| 11:27 | flonk | (Integer. 5.5) |
| 11:27 | flonk | shoulnt that worj? |
| 11:28 | flonk | abrooks: yes |
| 11:29 | flonk | i want to round down anyway, so not Math/round |
| 11:29 | hiredman | flonk: (int 5.5) |
| 11:29 | abrooks | flonk: No. Integer doesn't have a constructor that takes a Double. It takes an int or a string. You want (int 5.5) |
| 11:29 | abrooks | flonk: See http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Integer.html |
| 11:30 | flonk | is there some automatic unittestin builtin? |
| 11:32 | abrooks | flonk: Since 5.5 is a double, you'd have to call one of its methods (if "int" wasn't available or sufficient) : (.intValue 5.5) |
| 11:34 | flonk | ok |
| 11:35 | flonk | hmm i doing a google-interview quesion/puzzle |
| 11:35 | flonk | given a funcion that returna random number between 1 and 5(int, not loat) |
| 11:35 | flonk | write a function that returns a number between 1 and 7 |
| 11:36 | flonk | at least i got it is a return ing ints |
| 11:36 | flonk | first it seemed rather simple but ov it wasnt, my rand5 * 7 / 5 didnt return any 3 and 6s i think it was |
| 11:38 | flonk | and it doesnt give arnsaom distributiona t all |
| 11:38 | flonk | (0.7142857142857143 0.8333333333333334 1.0 1.25 1.6666666666666667 2.5 5.0) |
| 11:38 | flonk | anyways |
| 11:39 | flonk | any CS-students out there? |
| 11:39 | flonk | that can point a poor little HS-student on his way? |
| 11:39 | flonk | wait |
| 11:39 | flonk | it does |
| 11:40 | flonk | got something |
| 11:50 | Chouser | anybody have a more succint solution for: (filter identity (map #(when-not % %2) [nil nil 1 nil 1 nil] (iterate inc 0))) |
| 11:55 | bradbev | can an un-patched Clojure create standalone "executables" now? Ie, java mypackage.jar -> runs Clojure code. If yes, are there docs/message posts? |
| 11:56 | isido | Probably a stupid question: when I have a list and want to convert it to vector, what is the best way to do it? (into [] lst) or something else? |
| 11:56 | Chousuke | (vec lst) perhaps |
| 11:57 | isido | Chosuke, yes, that's probably better. Thanks! |
| 12:04 | flonk | wait im stuck, anyone good with random number generating? |
| 12:05 | flonk | rand5 -> (random nbr from 1 to 5) |
| 12:05 | flonk | how to write rand7? |
| 12:05 | flonk | (random nbr from 1 to 7) |
| 12:05 | flonk | given only rand5 |
| 12:05 | blackdog_ | (rand-int 7) |
| 12:06 | duck1123 | clojurebot: executable jar? |
| 12:06 | clojurebot | I don't understand. |
| 12:07 | duck1123 | clojurebot: executable jar is http://etherplex.org/archives/50 |
| 12:07 | clojurebot | Ack. Ack. |
| 12:10 | Chousuke | that looks like outdated info |
| 12:10 | duck1123 | hmm, it was just the first relevant google hit |
| 12:12 | duck1123 | what about? http://rpdillon.googlepages.com/creatingexecutablejarswithclojure |
| 12:14 | Chousuke | that's the same thing isn't it. |
| 12:14 | Chousuke | it uses gen-and-save-class which is deprecated |
| 12:14 | duck1123 | well I guess it is. |
| 12:14 | Chousuke | I just can't find the announcement for main methods in the group |
| 12:18 | duck1123 | clojurebot: forget executable jar |
| 12:18 | clojurebot | Excuse me? |
| 12:22 | duck1123 | clojurebot: clojure box? |
| 12:22 | clojurebot | I don't understand. |
| 12:22 | duck1123 | clojurebot: clojure box is http://clojure.bighugh.com/ |
| 12:22 | clojurebot | Ok. |
| 12:25 | Chousuke | right. |
| 12:26 | Chousuke | to get a "standalone" clojure app you just need to defn a "-main" function in your namespace |
| 12:26 | albino | is clojurebox like lispbox or readylisp? |
| 12:26 | duck1123 | that's the idea |
| 12:27 | Chousuke | after that just compile the namespace and you can run java -cp clojure.jar:.classes/ your.namespace |
| 12:27 | Chousuke | and the -main fn will be run |
| 12:27 | cooldude127 | wooooo |
| 12:27 | Chousuke | need a recent clojure though. |
| 12:28 | Chousuke | I still couldn't find the google group message telling more about that but I figured out this much with a bit of experimentation |
| 12:28 | hiredman | I think in the example it is "defn- -main" does -main have to use defn-? |
| 12:28 | Chousuke | hiredman: no idea. |
| 12:29 | Chousuke | probably not. |
| 12:29 | Chousuke | I didn't. |
| 12:29 | Chousuke | and it worked. |
| 12:29 | hiredman | good enough for me |
| 12:29 | cooldude127 | no that just affects whether other clojure code works |
| 12:29 | duck1123 | clojurebot: executable jar is <reply>to get a "standalone" clojure app you just need to defn a "-main" function in your namespace. after that just compile the namespace and you can run java -cp clojure.jar:.classes/ your.namespace and the -main fn will be run |
| 12:29 | clojurebot | Ok. |
| 12:29 | hiredman | clojurebot: executable jar? |
| 12:29 | clojurebot | to get a "standalone" clojure app you just need to defn a "-main" function in your namespace. after that just compile the namespace and you can run java -cp clojure.jar:.classes/ your.namespace and the -main fn will be run |
| 12:30 | duck1123 | that works |
| 12:30 | Chousuke | the -main fn will be run with (apply -main *command-line-args*) too |
| 12:30 | cooldude127 | AWESOME |
| 12:30 | Chousuke | so if you want all command line args in a list, just (defn -main [& args]) |
| 12:31 | Chousuke | whoops, that explanation is missing a slash |
| 12:31 | Chousuke | hm |
| 12:32 | Chousuke | I'll just go an write something in the wiki about this. |
| 12:32 | duck1123 | that'll be easier to point to |
| 12:32 | Chousuke | Who's the person responsible for approving edits to the wiki? |
| 12:32 | duck1123 | is there one? |
| 12:33 | Chousuke | apparently. |
| 12:33 | cooldude127 | clojurebot: executable jar is to get a "standalone" clojure app you just need to defn a "-main" function in your namespace. after that just compile the namespace and you can run java -cp clojure.jar:.classes/ your.namespace and the -main fn will be run |
| 12:33 | clojurebot | Roger. |
| 12:33 | cooldude127 | shit! |
| 12:33 | cooldude127 | i meant to make the edit first |
| 12:33 | cooldude127 | clojurebot: executable jar is to get a "standalone" clojure app you just need to defn a "-main" function in your namespace. after that just compile the namespace and you can run java -cp clojure.jar:./classes/ your.namespace and the -main fn will be run |
| 12:33 | clojurebot | You don't have to tell me twice. |
| 12:34 | cooldude127 | clojurebot: executable jar? |
| 12:34 | clojurebot | executable jar is to get a "standalone" clojure app you just need to defn a "-main" function in your namespace. after that just compile the namespace and you can run java -cp clojure.jar:./classes/ your.namespace and the -main fn will be run |
| 12:34 | cooldude127 | yay |
| 12:34 | duck1123 | clojurebot: botsnack |
| 12:34 | clojurebot | thanks; that was delicious. (nom nom nom) |
| 12:34 | Chousuke | it has 8 edits pending since saturday :/ |
| 12:34 | cooldude127 | botsnack? really? lol |
| 12:36 | shoover | albino: Clojure Box is inspired by the Lispbox from gigamonkeys.com. Something for new users to fire up a REPL and edit code. |
| 12:36 | cooldude127 | yummy |
| 12:36 | cooldude127 | is clojurebox in clojure or is it like lispbox where it packages up emacs and slime? |
| 12:36 | hiredman | (+ 1 5) |
| 12:36 | clojurebot | *suffusion of yellow* |
| 12:37 | duck1123 | cooldude127: the latter |
| 12:37 | shoover | clojurebox is emacs and slime. Didn't mean to get anyone's hopes up :) |
| 12:37 | cooldude127 | i actually would rather it be emacs and slime |
| 12:37 | cooldude127 | emacs is my best friend |
| 12:38 | cooldude127 | so i'm pleased |
| 12:38 | duck1123 | I haven't gotten a chance to try it out since I'm on a linux machine. I will probably try it when I get to school later tonight |
| 12:39 | hiredman | clojurebot: vim is <reply>watxh out, #who, or emacs will get you! |
| 12:39 | clojurebot | Ack. Ack. |
| 12:39 | cooldude127 | clojurebot: vim? |
| 12:39 | clojurebot | watch out, cooldude127, or emacs will get you! |
| 12:39 | cooldude127 | lol |
| 12:39 | cooldude127 | who the hell wrote this thing? |
| 12:40 | hiredman | clojurebot: creator? |
| 12:40 | clojurebot | hiredman: I'll tell you who my creator is if your tell me who your creator is |
| 12:40 | cooldude127 | damnit |
| 12:40 | cooldude127 | clojurebot: author? |
| 12:40 | clojurebot | Huh? |
| 12:40 | cooldude127 | clojurebot: tell me who made you |
| 12:40 | clojurebot | I don't understand. |
| 12:41 | hiredman | I do it |
| 12:41 | hiredman | er |
| 12:41 | hiredman | I did it |
| 12:41 | cooldude127 | lol |
| 12:41 | cooldude127 | it's hilarious |
| 12:41 | duck1123 | it's too bad it doesn't have an AIML interpreter |
| 12:42 | Chousuke | the groups are really hard to search :/ |
| 12:42 | Chousuke | I can't find the post that introducer the main method support. |
| 12:43 | Chousuke | documentation is something I hope will be in gear before 1.0 ;( |
| 12:48 | duck1123 | Chousuke: I couldn't find it either. I searched my mail, and all I saw was the AOT thread, and the thread about using "/" |
| 12:48 | Chousuke | but I really wonder who is the "authorised user" approving changes to the book |
| 12:49 | Chousuke | I don't like how it is at the moment. |
| 12:50 | Chousuke | But the book should really be split into multiple pages |
| 12:53 | hiredman | there was a thread on the ml about wikibooks being bad |
| 12:54 | Chouser | I'm not sure the AOT -main stuff was announced on the group. It may have been just here. |
| 12:55 | Chouser | clojurebot: main? |
| 12:55 | clojurebot | Titim gan ?ir? ort. |
| 12:55 | Chouser | clojurebot: main is http://paste.lisp.org/display/7 |
| 12:55 | clojurebot | You don't have to tell me twice. |
| 12:56 | Chouser | clojurebot: main is http://paste.lisp.org/display/70665 and http://clojure-log.n01se.net/date/2008-11-18.html#14:19 |
| 12:56 | clojurebot | You don't have to tell me twice. |
| 12:56 | Chouser | main? |
| 12:56 | Chouser | clojurebot: main? |
| 12:56 | clojurebot | main is http://paste.lisp.org/display/70665 and http://clojure-log.n01se.net/date/2008-11-18.html#14:19 |
| 12:56 | hiredman | ugh |
| 12:56 | Chouser | oh, that's all the AOT gen-class stuff. |
| 12:56 | hiredman | unicode mangling |
| 12:57 | Chouser | I guess 'main' is in there too. |
| 13:13 | hiredman | http://paste.lisp.org/display/7 |
| 13:14 | hiredman | http://paste.lisp.org/display/7 |
| 13:15 | Chousuke | -main doesn't need gen-class though. |
| 13:26 | Lau_of_DK | Good evening gentlemen |
| 13:31 | danlarkin | oh herro |
| 13:38 | technomancy | is there any function that will partition a sequence by a predicate function instead of just partitioning it into N parts? |
| 13:41 | danlarkin | technomancy: it's yours to write |
| 13:41 | Chousuke | there was something like partition-with in contrib I think |
| 13:41 | hiredman | like split-with? |
| 13:41 | Chousuke | not sure though. |
| 13:42 | hiredman | (doc split-with) |
| 13:42 | clojurebot | Returns a vector of [(take-while pred coll) (drop-while pred coll)] |
| 13:42 | danlarkin | that'd do it |
| 13:42 | technomancy | cool. |
| 13:42 | technomancy | thanks |
| 13:44 | technomancy | hiredman: looks like clojurebot would be more helpful if it showed the parameter list |
| 13:46 | hiredman | yeah |
| 13:46 | hiredman | there are formating issues |
| 13:46 | hiredman | the ircbot java library I am using eats anything with a newline |
| 13:47 | hiredman | :\ |
| 13:47 | Chousuke | if there are any people interested in fixing the wikibook here, please do what you can |
| 13:47 | walters | irritatingly BufferedReader's readLine method does that |
| 13:47 | Chousuke | it's in horrible state right now. |
| 13:48 | Lau_of_DK | Can somebody please bring me up to speed, on what the low-level difference between alter and commute is? I remember Rich mentioning some performance gain by using Commute |
| 13:48 | hiredman | shit |
| 13:48 | hiredman | did not mean to do that |
| 13:50 | danlarkin | all of our ises! :'( |
| 13:50 | Chousuke | Lau_of_DK: commute seems to require that the function is commutative so it can avoid (b)locking more than alter does. |
| 13:51 | kid_meier | Lau_of_DK: If you alter a ref in transaction A, and transaction B then alters the same ref, transaction A will retry |
| 13:51 | kid_meier | If you use commute in both, the STM knows that the function being applied is commutative, and so neither transaction will retry. |
| 13:51 | Lau_of_DK | oh |
| 13:51 | kid_meier | but its up to you to ensure that your function truly is commutative :)... or deal with the consequences :P |
| 13:52 | Lau_of_DK | Ah I got it, thanks |
| 13:52 | Lau_of_DK | I simply misunderstood the word commute - I thought it meant to travel from A to B. But Google informs me that it means independant of order :) |
| 13:53 | kid_meier | haha :) ya, not sure where the "commuter" phrase comes from |
| 13:54 | Lau_of_DK | Did any of you see the post in the Google Group today regarding a chat server terminal ? |
| 13:54 | hiredman | danlarkin: most of them are saved |
| 13:54 | Lau_of_DK | The author uses this function for the listner (forever (new-client (.accept listener))) where is forever defined? |
| 13:55 | danlarkin | hiredman: phew |
| 13:56 | hiredman | hmmm |
| 13:58 | hiredman | clojurebot: how much do you know? |
| 13:58 | clojurebot | I know 0 things |
| 13:58 | kid_meier | (doc forever) |
| 13:58 | clojurebot | excusez-moi |
| 13:59 | kid_meier | hiredman: Is that the exception handler? |
| 13:59 | Lau_of_DK | (doc map) |
| 13:59 | clojurebot | Returns a lazy seq consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments. |
| 13:59 | Lau_of_DK | clojurebot: arg list? |
| 13:59 | clojurebot | Excuse me? |
| 13:59 | Lau_of_DK | Youre excused |
| 14:01 | hiredman | fuck |
| 14:01 | hiredman | remember how I said "most of them are saved"? |
| 14:01 | hiredman | that was a lie |
| 14:02 | Chouser | heh |
| 14:02 | Lau_of_DK | hiredman: your welcome to direct your emotional outbursts to #emotionaloutburst :) |
| 14:02 | hiredman | typo in the load-dicts function |
| 14:02 | hiredman | opened a writer instead of a reader |
| 14:02 | hiredman | *poof* |
| 14:02 | technomancy | ouch. =\ |
| 14:03 | technomancy | all that knowledge... gone forever! |
| 14:03 | danlarkin | ack |
| 14:03 | hiredman | he knew 30 things |
| 14:03 | Chouser | it's all in the irc log, in tidy "<foo> clojurebot: x is y" format |
| 14:03 | hiredman | ! |
| 14:05 | Lau_of_DK | Have you guys experienced, when you do (time (map #(func) large-seq)) that the time returns after 60ms, yet the map runs for x minutes, making the result useless? |
| 14:05 | Chouser | Lau_of_DK: yes. map is lazy. |
| 14:06 | danlarkin | stick it in a dorun |
| 14:06 | hiredman | clojurebot: map is <reply>map is *LAZY* |
| 14:06 | clojurebot | Ok. |
| 14:06 | Lau_of_DK | Oh thats right Mr. Houser, thanks :) |
| 14:07 | technomancy | is compojure the most-used web framework for clojure, or are there other big ones? |
| 14:08 | Chouser | technomancy: there is also webjure |
| 14:09 | technomancy | they get really creative with those names, don't they. =) |
| 14:11 | hiredman | clojurebot: map? |
| 14:11 | clojurebot | map is *LAZY* |
| 14:14 | hiredman | how much do you know? |
| 14:14 | hiredman | uh oh |
| 14:15 | Chouser | clojurebot: how much do you know? |
| 14:15 | clojurebot | I know 19 things |
| 14:15 | hiredman | duh |
| 14:15 | Chouser | :-) |
| 14:15 | hiredman | clojurebot: hiredman is slightly retarded |
| 14:15 | clojurebot | Roger. |
| 14:15 | Chouser | clojurebot: hiredman is an evil genius. |
| 14:15 | clojurebot | Roger. |
| 14:16 | hiredman | so many features, so little time |
| 14:20 | technomancy | do you have "is also" yet? |
| 14:20 | kid_meier | clojurebot: hiredman? |
| 14:20 | clojurebot | hiredman is an evil genius. |
| 14:20 | kid_meier | neat |
| 14:21 | Lau_of_DK | clojurebot: (doseq [i (range 10)] (println i)) |
| 14:21 | clojurebot | Pardon? |
| 14:21 | Lau_of_DK | :( |
| 14:21 | Chouser | (+ 1 2) |
| 14:21 | clojurebot | 3 |
| 14:21 | Chouser | (rem 10 3) |
| 14:22 | Lau_of_DK | thats kinda cool |
| 14:22 | Chouser | (/ 10 3) |
| 14:22 | clojurebot | 10/3 |
| 14:22 | Lau_of_DK | (/ 10 0) |
| 14:22 | Lau_of_DK | :D |
| 14:22 | Chouser | (int 10.5) |
| 14:22 | Lau_of_DK | Killed by DivisionByZero! Muhahaha :) |
| 14:22 | Chouser | (/ 9 8 7 6) |
| 14:22 | clojurebot | 3/112 |
| 14:22 | danlarkin | clojurebot: where are you? |
| 14:22 | clojurebot | http://gist.github.com/27733 |
| 14:23 | Lau_of_DK | Guys I wondered about that ants.clj that Rich made. It uses an 80x80 grid if I remember correctly, and about 50 agents are running simultaneously doing simple operations. And the performance seems absolutely horrible even with 2 cores fully loaded... why? |
| 14:24 | Chouser | can you defined 'horrible'? |
| 14:24 | Lau_of_DK | lagging, 20 fps, cpu drowned... its just slow |
| 14:25 | Lau_of_DK | I expected a nice smooth ant colony marching around |
| 14:28 | Chouser | Lau_of_DK: the animation is pegged at 10 fps |
| 14:28 | triddell | Lau_of_DK: does the performance have to do with the sleep time built into the program? |
| 14:28 | Chousuke | hiredman: did you make a list of functions to allow? :/ |
| 14:28 | Chouser | Lau_of_DK: on my dual-core laptop, the cpu runs at about 30% |
| 14:29 | Chousuke | (defn foo [x] (+ 1 x)) |
| 14:29 | Lau_of_DK | really... |
| 14:29 | Chousuke | (foo 4) |
| 14:29 | Chousuke | hm, no worky :( |
| 14:31 | triddell | Lau_of_DK: on second thought, sleep time wouldn't effect ants since you're not timing the completion of anything |
| 14:34 | Lau_of_DK | triddell: Im not quite sure of all the implications of the sleep. If only the agents dont update less than the animator, it should be the animators intervals that reflects fps |
| 14:35 | hiredman | Chousuke: just + - / * |
| 14:49 | hiredman | clojurebot: one? |
| 14:49 | clojurebot | one is B |
| 14:49 | technomancy | why are docstrings placed before the arg list instead of after? |
| 14:49 | hiredman | clojurebot: one? |
| 14:49 | clojurebot | one is A |
| 14:50 | hiredman | clojurebot: hiredman is also slightly retarded |
| 14:50 | clojurebot | You don't have to tell me twice. |
| 14:51 | hiredman | technomancy: strings are valid literals in function bodies |
| 14:51 | Chouser | technomancy: because functions can have only one docstring, but can have multiple arg lists (each with its own function body) |
| 14:51 | hiredman | (defn a [] "foo") |
| 14:51 | Chouser | oh. that too. |
| 14:52 | hiredman | is that a docstring? a return? |
| 14:52 | technomancy | Chouser: ah; I haven't seen that notation yet. |
| 14:52 | hiredman | clojurebot: do you know? |
| 14:53 | danlarkin | (+ (- (+ 1 5) 3)) |
| 14:53 | danlarkin | (+ (- (+ 1 5) 3) 5) |
| 14:53 | danlarkin | clojurebot: :( |
| 14:54 | hiredman | no next expressions |
| 14:54 | Chousuke | technomancy: (defn foo "docstring" ([x] x) ([x & y] (+ x (apply foo y)))) |
| 14:54 | hiredman | and, uh, I would not do anything that adds up to more than 4 |
| 14:55 | Chousuke | extra paren there ;/ |
| 14:55 | Chousuke | I always miscount them |
| 14:56 | technomancy | Chousuke: wouldn't have that problem if you used an Emacs-based IRC client. =) |
| 14:56 | technomancy | (that last smiley paren matched danlarkin's sad-face) |
| 14:56 | technomancy | Chousuke: thanks. |
| 14:57 | Chousuke | technomancy: yeah I tried erc once but it's no match for irssi. |
| 14:57 | technomancy | I guess if you like perl better than lisp. =) |
| 14:57 | Chousuke | nah |
| 14:57 | Chousuke | I don't write irssi scripts. |
| 14:58 | Chousuke | irssi does most things I need out of the box, and the few things it doesn't, I have already solved by downloading scripts made by others. |
| 14:58 | flonk | is unittesting builtin? |
| 14:58 | cooldude127 | flonk: to clojure? no |
| 14:59 | flonk | like with python? |
| 14:59 | flonk | ok |
| 14:59 | cooldude127 | i suppose you could use junit |
| 14:59 | flonk | ok |
| 14:59 | cooldude127 | it wouldn't be pretty |
| 14:59 | technomancy | it's in contrib or something though, right? |
| 14:59 | cooldude127 | is it? |
| 14:59 | cooldude127 | i have no idea |
| 14:59 | Chousuke | there's some testing stuff in contrib, yes |
| 14:59 | hiredman | there seem to be a lot of testing frameworks popping up on the ml |
| 14:59 | Chouser | yeah, there's much testing work going on in contrib. |
| 14:59 | Chouser | test-is |
| 14:59 | cooldude127 | sweet |
| 14:59 | flonk | anyway i have clojure-box installed now, its great. since it has clojure-contrib can I use databases right away or do I have to install something extra? |
| 15:00 | hiredman | some kind of rspec sort of thing |
| 15:00 | technomancy | that stuff belongs in core though; it makes me sad if people aren't encouraged to write tests by default. =\ |
| 15:00 | Chousuke | flonk: well clojure-contrib has the sql library |
| 15:00 | Chousuke | flonk: you'll still need an actual *database* though. |
| 15:02 | Chousuke | doesn't the core include some testing support too? |
| 15:02 | cooldude127 | i don't think so |
| 15:03 | hiredman | there is (test ...) |
| 15:03 | hiredman | (doc test) |
| 15:03 | clojurebot | test [v] finds fn at key :test in var metadata and calls it, presuming failure will throw exception |
| 15:03 | technomancy | there's no literal syntax for string interpolation, is there? |
| 15:04 | Chousuke | interpolation? |
| 15:04 | technomancy | for instance, ruby allows "two and two is #{2 + 2}" |
| 15:04 | Chousuke | right. well. |
| 15:04 | technomancy | just use format? |
| 15:04 | Chousuke | unless java.util.Formatter allows something like that, no. |
| 15:05 | abrooks | (str "two and two is " (+ 2 2) " don't you know...") |
| 15:06 | technomancy | abrooks: that works; thanks |
| 15:06 | Chousuke | using 'format would be more flexible though. |
| 15:06 | abrooks | technomancy: Subtitute println if you actually want to print it. |
| 15:07 | abrooks | technomancy: Oh, and remove the spaces... |
| 15:07 | abrooks | (println "two and two is" (+ 2 2) "don't you know...") |
| 15:18 | hiredman | clojurebot: how much do you know? |
| 15:18 | clojurebot | I know 19 things |
| 15:19 | cooldude127 | is one of those things how much you know? |
| 15:19 | cooldude127 | lol |
| 15:21 | Chouser | he actually knows lots more than that |
| 15:21 | Chouser | (doc count) |
| 15:21 | clojurebot | Returns the number of items in the collection. (count nil) returns 0. Also works on strings, arrays, and Java Collections and Maps |
| 15:21 | cooldude127 | WOW |
| 15:21 | cooldude127 | awesome |
| 15:21 | cooldude127 | (+ 1 2) |
| 15:21 | clojurebot | 3 |
| 15:22 | cooldude127 | oh that is too much fun |
| 15:22 | hiredman | well, yeah |
| 15:22 | kid_meier | (prn "hello, world") |
| 15:22 | kid_meier | where does *out* go? |
| 15:22 | cooldude127 | kid_meier: apparently /dev/null |
| 15:22 | hiredman | ok, I got the "save what you know so you do not forget it" thread running |
| 15:23 | hiredman | kid_meier: only simple math |
| 15:23 | kid_meier | I suppose thats to prevent spamming? |
| 15:23 | hiredman | (+ 2 3) |
| 15:23 | clojurebot | *suffusion of yellow* |
| 15:23 | hiredman | hmmm |
| 15:23 | cooldude127 | what's suffusion of yellow mean? |
| 15:23 | hiredman | hard to say... |
| 15:29 | hiredman | (doc prn) |
| 15:29 | clojurebot | Same as pr followed by (newline). Observes *flush-on-newline* |
| 15:38 | AWizzArd | Which is the "best" jvm debugger, in which I can set break points and step through my Clojure code, line by line? |
| 15:39 | AWizzArd | I found JSwat so far. |
| 15:58 | Lau_of_DK | AWizzArd: JSwat seems to be it |
| 15:58 | kid_meier | AWizzArd: I have not found anything that really works properly. I have not tested JSwat but clearly I need to get on that |
| 15:59 | kid_meier | Awhile back Rich was working on generating debug info that was similar to regular .java debug info so that vanilla java debuggers can work with clojure code. |
| 16:00 | kid_meier | So... in theory other debuggers should work better than they did, but I haven't tried in awhile so I'm not sure. |
| 16:00 | Lau_of_DK | JSwat works quite OK, supports breakpoints and stepping. Can be quite helpful |
| 16:00 | Lau_of_DK | If youre into more advanced debugging, I have no clue |
| 16:00 | smee | hiredman: I'm playing with your sources of clojurebot, nice work! |
| 16:01 | hiredman | smee: thank you |
| 16:02 | smee | hiredman: did you change the pircbot implementation? I can't call .changeNick as is is declared as final and seems to be not available in the proxy? |
| 16:02 | hiredman | smee: I there maybe bugs around |
| 16:03 | hiredman | I change stuff in the repl and only change it in the code later |
| 16:03 | hiredman | (bad bad bad) |
| 16:03 | smee | :) |
| 16:03 | hiredman | I seem to recall in the file I forgot the bot object in the changeNick call |
| 16:03 | hiredman | (.changeNick *bot* "foo") |
| 16:04 | smee | no, no fix needed. the call doesn't seem to have any effect in my setup :( |
| 16:04 | hiredman | hrm |
| 16:05 | hiredman | are you connected to a server? |
| 16:05 | hiredman | I think changeNick only works once you have connected |
| 16:06 | smee | mmh, I'll just keep experimenting... thanks |
| 16:12 | hiredman | latest clojurebot checked into the gist |
| 16:13 | hiredman | includes changes support for stuff like |
| 16:13 | hiredman | clojurebot: one? |
| 16:13 | clojurebot | No entiendo |
| 16:13 | hiredman | clojurebot: one is A |
| 16:13 | clojurebot | Ack. Ack. |
| 16:13 | hiredman | clojurebot: one is also B |
| 16:13 | clojurebot | Alles klar |
| 16:13 | hiredman | clojurebot: one? |
| 16:13 | clojurebot | one is B |
| 16:13 | hiredman | clojurebot: one? |
| 16:13 | clojurebot | one is B |
| 16:13 | hiredman | uh |
| 16:13 | hiredman | maybe I should not spam the channel with this |
| 16:27 | danlarkin | so no adding docstrings to a defmulti? :'( |
| 16:30 | Chouser | danlarkin: sure |
| 16:31 | Chouser | (defmulti #^{:doc "docs for foo"} foo class) |
| 16:31 | hiredman | hmmm |
| 16:32 | Chouser | clojurebot: defmulti doc is (defmulti #^{:doc "docs for foo"} foo class) |
| 16:32 | clojurebot | In Ordnung |
| 16:33 | danlarkin | but I can't use the pretty syntax for it |
| 16:33 | Chouser | danlarkin: indeed. |
| 16:33 | hiredman | clojurebot: defmulti doc is also ugly |
| 16:33 | clojurebot | Ik begrijp |
| 16:34 | danlarkin | haha |
| 16:34 | Chouser | I imagine there's a decent chance that rhickey would accept a patch that adds nice syntax for defmulti doc |
| 16:35 | tWip | what language is clojurebot speaking? |
| 16:36 | hiredman | that was German then, I think Dutch |
| 16:37 | tWip | wouldn't english be the most accepted language on this channel? |
| 16:37 | hiredman | clojurebot: English is the Official Language of the Universe |
| 16:37 | clojurebot | Ik begrijp |
| 16:38 | cooldude127 | it was speaking english earlier |
| 16:38 | cooldude127 | clojurebot: defmulti doc? |
| 16:38 | clojurebot | defmulti doc is ugly |
| 16:38 | cooldude127 | how do i get to the next part |
| 16:38 | cooldude127 | or previous |
| 16:38 | hiredman | cooldude127: it is random |
| 16:38 | cooldude127 | clojurebot: defmulti doc? |
| 16:38 | clojurebot | defmulti doc is (defmulti #^{:doc "docs for foo"} foo class) |
| 16:38 | cooldude127 | oh |
| 17:00 | larrytheliquid_ | is there a naming convention for functions that shadow their macro counterparts? |
| 17:01 | Chouser | larrytheliquid_: I've not see one. I've used foo-fn for foo a couple times. *shrug* |
| 17:02 | larrytheliquid_ | Chouser: thx |
| 17:16 | danlarkin | blackdog_: I committed a custom-encode multimethod |
| 17:27 | duck1123 | hiredman: have you thought about giving clojurebot the "tell" functionality |
| 17:27 | duck1123 | phenny, in #swig has that and it's quite useful |
| 17:29 | hiredman | yeah, I think it's not so useful |
| 17:42 | blackdog_ | danlarkin, thanks i'll give it a shot |
| 17:43 | Flox | Good evening. |
| 17:46 | Flox | Does anybody have any experience with JEdit plugins/modes for Clojure yet? I have tried to keep up with the channel log for a couple of weeks now (though it's getting harder), but information on this has been scarce. |
| 17:47 | blackdog_ | i have some stuff i worked on but it's in bad shape right now |
| 17:48 | blackdog_ | i have syntax hilighting repl that's throwing exceptions and a ripped of namespace tree from enclojure |
| 17:48 | blackdog_ | if you want to work on it, i'll give you a copy :) |
| 17:48 | blackdog_ | i started using emacs |
| 17:49 | Flox | Yes, I have seen your announcements on the channel and on the group - and have just seen that there are some others mentioned (since Nov 5). |
| 17:49 | blackdog_ | if you're interested to make it better, i'll send you what i have |
| 17:50 | blackdog_ | actually I'll upload what I have right now to google groups |
| 17:50 | blackdog_ | i've been meaning to |
| 17:51 | Flox | Thanks! That's what I just wanted to ask for... |
| 17:51 | hiredman | clojurebot: vim? |
| 17:51 | clojurebot | I don't understand. |
| 17:51 | hiredman | touche |
| 17:52 | Hun | emacs already features that (besides being small) |
| 17:52 | Hun | and... why do you need highlighting for a lisp? |
| 17:52 | Chouser | blackdog_: that's written in Java, riht? |
| 17:52 | blackdog_ | jedit yes |
| 17:52 | Flox | I'd really like to go for a pure Java solution. |
| 17:52 | blackdog_ | it's very good actually |
| 17:53 | blackdog_ | generally |
| 17:53 | blackdog_ | i did quite a lot on it, i just can't countenance 60mb for an editor image |
| 17:55 | blackdog_ | but the good thing it's a heck of a lot simpler than netbeans |
| 17:56 | Flox | I tried chimp/gorilla (since I am more of a vim guy), but the combination is not light weight enough for me - you cannot just put it into a single directory - or even a jar file and be happy... |
| 17:58 | blackdog_ | clj-edit.tar.gz is uploaded, |
| 17:58 | hiredman | clojurebot: anonymous functions is <reply>anonymous functions are functions with no names |
| 17:58 | clojurebot | Alles klar |
| 17:58 | Flox | :-) |
| 18:00 | Hun | i always found it weird to think this way... i mean, named functions are more special cases of anonymous functions than the other way round |
| 18:01 | hiredman | Yes |
| 18:01 | cooldude127 | mhm |
| 18:01 | cooldude127 | we're too keen on naming everything |
| 18:01 | Hun | but the notion of functions as named thingies seems so inbound that one can only talk in this backwards way to explain it |
| 18:02 | hiredman | this haskell guy on the ml, asks if clojure can do anonymous functions, then in his haskell example proceeds to name the function |
| 18:02 | cooldude127 | hiredman: link? |
| 18:02 | hiredman | clojurebot: group? |
| 18:02 | clojurebot | Huh? |
| 18:02 | hiredman | damn it |
| 18:02 | hiredman | didn't I fix you? |
| 18:02 | cooldude127 | lol |
| 18:03 | cooldude127 | is clojurebot written in clojure? |
| 18:03 | hiredman | yes |
| 18:03 | technomancy | cooldude127: of course! |
| 18:03 | cooldude127 | yay |
| 18:03 | hiredman | clojurebot: how much do you know? |
| 18:03 | clojurebot | I know 24 things |
| 18:03 | technomancy | hiredman: why are you always using the <reply> syntax when teaching clojurebot? |
| 18:03 | hiredman | clojurebot: group is http://groups.google.com/group/clojure/ |
| 18:03 | clojurebot | Roger. |
| 18:04 | hiredman | technomancy: <reply> means leave out the is |
| 18:04 | hiredman | clojurebot: group? |
| 18:04 | clojurebot | group is http://groups.google.com/group/clojure/ |
| 18:04 | technomancy | hiredman: right, but you did stuff like map is <reply>map is LAZY. |
| 18:04 | hiredman | and #who gets replaced with the nick of whoever is speaking to the bot |
| 18:04 | hiredman | uh |
| 18:04 | hiredman | my mistake? |
| 18:05 | hiredman | *shrug* |
| 18:05 | technomancy | oh, right; heh. |
| 18:05 | hiredman | cooldude127: http://groups.google.com/group/clojure/browse_thread/thread/3ccb40bcb1a0f797 |
| 18:05 | cooldude127 | hiredman: yeah i found it |
| 18:05 | cooldude127 | i'm gonna reply |
| 18:08 | Chousuke | oh meh, you beat me to it. :p |
| 18:09 | technomancy | I can't be the only one having trouble keeping Chousuke and Chouser apart, can I? |
| 18:09 | Chousuke | no. |
| 18:09 | danlarkin | nope |
| 18:10 | technomancy | I guess I can't complain since I hang out in a channel with a guy called technoweenie... I know how it is. Tab completion causes mistakes... |
| 18:10 | Chousuke | well |
| 18:10 | hiredman | irssi has given both of them the same color nicks |
| 18:10 | hiredman | not helping |
| 18:11 | Chousuke | at least we're not as bad as drewc and drewr-` |
| 18:11 | technomancy | that's pretty bad |
| 18:11 | technomancy | hiredman: see, if you were using Emacs, you could rewrite the nick coloring function in Lisp to pick very distinct colors for similar-looking nicks. =) |
| 18:11 | Chousuka | better? |
| 18:12 | cooldude127 | wow that haskell dude got a barrage of the same damn posts |
| 18:12 | Chousuke | no :( |
| 18:12 | Chousuke | heh |
| 18:12 | drewc | :) |
| 18:13 | hiredman | technomancy: well, the nickcolor thing is a script add on for irssi, so I could rewrite it |
| 18:13 | hiredman | but it is in perl, so, uh, no? |
| 18:13 | technomancy | hiredman: exactly. =) |
| 18:13 | larrytheliquid_ | is there a way to get the "name" of a struct map instance? |
| 18:13 | hiredman | cause elisp is so much better then perl |
| 18:13 | technomancy | though maybe once you get used to Clojure, writing elisp is just as bad |
| 18:13 | technomancy | doh |
| 18:14 | Chouser | larrytheliquid_: no |
| 18:14 | hiredman | larrytheliquid_: sounds like you want a type, and all structmaps are of the structmap type, so you are going to need to use type tags |
| 18:14 | Chouser | larrytheliquid_: that's sort of an 'implementation detail' |
| 18:15 | Chouser | well, either a type tag (which usually implies meta-data) or just another key in your structmap, :type |
| 18:19 | hiredman | lisppaste8: url |
| 18:19 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 18:19 | hiredman | (((partial comp (partial + 1)) (partial + 2) (partial + 3))) <- my poor head |
| 18:22 | Chousuke | heh |
| 18:23 | Chousuke | does that return 6? |
| 18:23 | hiredman | yes |
| 18:23 | Chousuke | pretty evil though. |
| 18:23 | hiredman | I think some was asking about accumulators last night |
| 18:24 | cooldude127 | that's just brutal |
| 18:24 | hiredman | clojurebot: accumulator is (((partial comp (partial + 1)) (partial + 2) (partial + 3))) |
| 18:24 | clojurebot | Ok. |
| 18:24 | hiredman | well you just wrap it in a macro or something |
| 18:24 | hiredman | but yeah |
| 18:24 | hiredman | ouch |
| 18:28 | hiredman | clojurebot: accumulator is (((partial (partial comp (partial + 1)) (partial + 2)) (partial + 3)) |
| 18:28 | clojurebot | You don't have to tell me twice. |
| 18:28 | hiredman | yeah I do |
| 18:58 | technomancy | I'm reading a tutorial that says there's no function in clojure to download the contents of a URL and return a string. is this still true? |
| 18:59 | AWizzArd | technomancy: yes, because that is not needed, as this functionality is already available in the jvm |
| 19:00 | whotheheckami_ | AWizzArd: and that method call would be...? |
| 19:00 | AWizzArd | xlightweb.sourceforge.net |
| 19:01 | technomancy | AWizzArd: he builds such a function in the tutorial by calling Java code, it just seems like an obvious candidate for inclusion in clojure |
| 19:02 | technomancy | and using a third-party library for something as simple as this is a bit silly |
| 19:06 | AWizzArd | technomancy: what is also missing is a counter part for slurp, which reads the contents of a file. |
| 19:07 | AWizzArd | at least I am not aware of such a function |
| 19:08 | Chousuke | spit exists in contrib |
| 19:08 | AWizzArd | I see |
| 19:09 | Chousuke | also, contrib has duck-streams which can be used to download URLs |
| 19:09 | Chousuke | as far as I know, anyway |
| 19:27 | technomancy | cool, thanks |
| 19:30 | technomancy | so contrib is kind of a "proving ground" for libraries that may or may not be needed in core? |
| 19:38 | mtrimpe | Does anyone here have experience with using Clojure for (purely) functional reactive programming where you basically keep a record of all the events coming in and build the UI etc. up from there so that you can replay your interaction with the system? |
| 19:38 | Chousuke | technomancy: not quite. |
| 19:40 | Chousuke | technomancy: some things from contrib can be included in core, but it also has libraries that will never be in core. |
| 19:42 | Chousuke | that doesn't mean those libraries are bad or anything though. They're just not "essential" |
| 19:42 | technomancy | I see. |
| 19:42 | technomancy | does everything in core get loaded every time clojure is invoked? |
| 19:43 | Chousuke | no. core actually has several namespaces. |
| 19:43 | Chousuke | one of them is clojure.core :P |
| 19:44 | Chousuke | (only that is loaded by default) |
| 19:45 | powr-toc | more of a java question this, but presumably proxies are slower than java objects with real native classes/ |
| 19:46 | powr-toc | ? |
| 19:46 | Chousuke | hmmh |
| 19:46 | Chousuke | proxies are real native classes. :p |
| 19:46 | powr-toc | well the proxy is... but... you know what I mean :-) |
| 19:47 | Chousuke | well, there's just a tiny bit of indirection. all the proxy does is forward the invocation to the appropriate clojure fn :) |
| 19:48 | Chousuke | that's my understanding anyway.. |
| 19:49 | rhickey | Chousuke: yes, there is an indirection. In return you get the ability to fix/modify methods of running objects |
| 19:50 | Chousuke | I wonder if the JVM can optimise the indirection away if there are lots of calls to the proxy :/ |
| 19:51 | Chousuke | I don't know what kind of tricks Hotspot is capable of, exactly. Only that it's got lots of them :) |
| 19:52 | technomancy | that 20GB/s story from the JVM summit was pretty amazing |
| 19:56 | powr-toc | technomancy: which story's that? |
| 19:57 | technomancy | powr-toc: from the "clojure for lisp programmers" video |
| 19:57 | technomancy | rich talks about meeting a guy who has a 600-core machine optimized for the JVM |
| 19:58 | technomancy | he started running a sloppy-ish clojure program on it; it generated 20GB of garbage a second, and the GC only took up 7% of the total CPU |
| 19:58 | technomancy | I think that was the point at which I decided to stop worrying about the JVM. =) |
| 19:59 | blackdog_ | if you have a look at the slides off this page has more info http://blogs.azulsystems.com/cliff/2008/09/jvm-language-su.html |
| 19:59 | powr-toc | technomancy: damn... that's amazing!!!! I always knew the JVM was an awesome piece of kit, but that's incredible... |
| 20:00 | powr-toc | not sure what's better... the JVM or that 600-core machine... seriously, what was that?! |
| 20:00 | technomancy | he didn't say much about the box |
| 20:01 | blackdog_ | check out that link to azul systems |
| 20:05 | powr-toc | Looks pretty sweet... does it run on Sun's VM or a custom one? |
| 20:05 | powr-toc | ok, it's the AVM... I wonder how bespoke that is... |
| 23:25 | falconair | hi folks, i'm the one spamming the group with jms/reactive/cells related posts |
| 23:25 | falconair | just thought i'd introduce my self |
| 23:26 | cooldude127 | sup falconair |
| 23:26 | cooldude127 | i don't know shit about that stuff but hi :) |
| 23:26 | falconair | it cool stuff dude |
| 23:27 | cooldude127 | enlighten me |
| 23:27 | cooldude127 | (side note) i'm getting too dependent on tab completion. i just tried to tab complete the word enlighten. how the hell will erc know what i'm trying to say? |
| 23:28 | hiredman | you can get dictionary tab completion stuff for irssi |
| 23:28 | cooldude127 | lol i could probably get it here too |
| 23:29 | cooldude127 | i just haven't figured out how yet |
| 23:29 | falconair | well...perhaps the simplest (but not exact) way is to think in terms of a spreadsheet (Excel)...cell A has 1, cell B has 2 and cell C has an expression (+ A B) ... C will have the sum of A and B ... if A or B changes, C will get updated |
| 23:29 | cooldude127 | falconair: that actually is pretty cool |
| 23:29 | cooldude127 | you have proven yourself to not be a liar |
| 23:29 | cooldude127 | :) |
| 23:29 | notallama | i find myself mashing tab on msn/aim. maybe i'll have to look into actually making it do something. |
| 23:31 | notallama | having tab cycle through possible completions without moving the cursor is what would be good, i think. |
| 23:31 | cooldude127 | yeah |
| 23:32 | falconair | say I have a clojure expression in a string like "(+ 1 2)" ... how do I evaluate this expression? Using the "read" function? Another way to ask is the simplest way to build my own REPL? |
| 23:33 | cooldude127 | falconair: eval is what evaluates expressions i think |
| 23:33 | Chouser | falconair: load-string |
| 23:33 | Chouser | (doc load-string) |
| 23:33 | clojurebot | Sequentially read and evaluate the set of forms contained in the string; arglists ([s]) |
| 23:33 | cooldude127 | (doc eval) |
| 23:33 | clojurebot | Evaluates the form data structure (not text!) and returns the result.; arglists ([form]) |
| 23:33 | falconair | yup, works! |
| 23:34 | cooldude127 | repl basically equates to (print (eval (read "(+ 1 2)"))) |
| 23:34 | cooldude127 | but ya know with prompts and stuff |
| 23:34 | falconair | cooldude127, so how does that differ from load-string? is load-string the primitive or eval? |
| 23:34 | cooldude127 | eval is the primitive |
| 23:35 | hiredman | (doc load-string) |
| 23:35 | clojurebot | Sequentially read and evaluate the set of forms contained in the string; arglists ([s]) |
| 23:35 | hiredman | huh |
| 23:35 | cooldude127 | with one s-expr they seem to be the same |
| 23:35 | Chouser | load-string calls read and eval for you, among other things. |
| 23:35 | cooldude127 | oh |
| 23:35 | cooldude127 | yeah |
| 23:35 | falconair | so read returns a datastructure (not text right?) and eval evaluates that data structure? |
| 23:35 | cooldude127 | (load-string "(+ 1 2)") roughly equals (eval '(+ 1 2)) |
| 23:36 | cooldude127 | aka (eval (read "(+ 1 2)")) |
| 23:37 | Chouser | falconair: yes |
| 23:38 | cooldude127 | that is exactly how it goes |
| 23:38 | falconair | ok, so does it make sense to wire up a JTable where each cell has a clojure expression...blah blah blah...turn it into a spreadsheet? |
| 23:39 | falconair | (i'll fill in the blah if required) |
| 23:39 | hiredman | huh |
| 23:39 | cooldude127 | falconair: that could probably work |
| 23:39 | cooldude127 | basically a spreadsheet where clojure is the language for formulas? |
| 23:40 | falconair | exactly...but better than normal spreadsheets...because you can define your own functions, work on more complex data structures...and not be bound by the grid |
| 23:40 | hiredman | uh |
| 23:40 | cooldude127 | i think that's pretty cool actually |
| 23:40 | falconair | hiredman: don't like the idea? |
| 23:41 | hiredman | I don't know that anyone would use it |
| 23:41 | hiredman | spreadsheet junkies have a lot invested in excel and excel style formulas, vba, etc |
| 23:41 | hiredman | and programers can just use clojure |
| 23:42 | cooldude127 | hiredman has a point |
| 23:43 | hiredman | wait |
| 23:43 | hiredman | vba sucks |
| 23:43 | hiredman | do it! |
| 23:43 | cooldude127 | lol yes VBA does suck |
| 23:43 | falconair | ok, here is my spreadsheet defence :) : the 'spreadsheet' programming model has some extremely interesting things to offer even elitest of language designers--if the goal of a good programming language is productivity: |
| 23:43 | cooldude127 | athough I started programming in VBA |
| 23:44 | cooldude127 | falconair: i think it's cool |
| 23:44 | falconair | I'm going to present my excel point of view any way...since clojure has greatest potential in this area: |
| 23:44 | hiredman | clojurebot: emacs is <reply> uggada buggada |
| 23:44 | clojurebot | In Ordnung |
| 23:46 | falconair | enthusiasts of REPL based languages sing the virtues of exploratory programming...the ability to test small snippets of programs as the programs grows is one of the only ways to stay sane...spreadsheets take that to the next level by allowing |
| 23:46 | falconair | programmers to edit their code AS it is running! |
| 23:47 | falconair | Unlike most languages or programming environments, spreadsheets are not just programs, but also user interfaces |
| 23:47 | hiredman | urm |
| 23:47 | falconair | uh...I had more than two points but I'm forgetting them now |
| 23:47 | notallama | you can't define a function in a spreadsheet? |
| 23:47 | falconair | by the way, for me, spreadsheets don't mean VBA, I mean purely cell based programming |
| 23:48 | falconair | now, the bad parts are that you can't define a function in a spreadsheet :) |
| 23:48 | falconair | also that there is one giant grid (or several giant grids) |
| 23:48 | falconair | with something like clojure...function definition is not a problem (obviously)... |
| 23:49 | notallama | i figured you would be able to. (although that function would be named by its coordinates) i have not used a preadsheet, though. |
| 23:49 | falconair | instead of a giant grid, we can provide a bunch of floating text fields (or whatever layout works better) |
| 23:50 | falconair | Apple's new spread sheet has a concept of 'painting a grid' on the screen...having a bunch of them float next to each other...as opposed to a giant grid |
| 23:51 | falconair | that's my defense of spreadsheets and (partial) motivation behind why clojure is more interesting in this respect that almost any other language (with the exception of small talk languages) |
| 23:51 | falconair | meant to put a :), to clarify that I am not insane |
| 23:52 | notallama | i played a game. mindrover. it let you program robots by dragging wires between different components/functions. same idea? (you're directing the function's i/o basically?) |
| 23:52 | falconair | well, connecting comonents by wires doesn't seem to scale very much...a few connections and you find yourself in a huge mess |
| 23:54 | falconair | i think such programming is most relevant when programmers have to deal with streaming data...i personally deal with stock prices...this would be incredibly useful |
| 23:54 | hiredman | hah |
| 23:54 | hiredman | you are talking about yahoo pipes for clojure |
| 23:55 | falconair | pipes still go back to "boxes and arrows" style of programming that notallama mentioned...but they are very similar... |
| 23:56 | falconair | I think the only difference is that expressions should be definable syntactically rather than just through click and drag |
| 23:57 | hiredman | (doc ->) |
| 23:57 | clojurebot | Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc.; arglists ([x form] [x form & more]) |