2010-10-23
| 00:01 | amalloy | i think someone's translated a fair amount of the little schemer into clojure |
| 00:02 | amalloy | http://stackoverflow.com/questions/2933051/clojure-for-a-lisp-illiterate looks like a relevant reference for you, too |
| 00:04 | yousef | ah, yes that is one of the first links i found. the first book looks good but requires a bit of java experience from the preview text i saw |
| 00:07 | pdk | right now i dunno if there's really any teaching materials assuming no prior experience with either |
| 00:08 | pdk | if anything actual texts like ansi common lisp probably explain the unique lisp stuff better and you're gonna dip into the java standard library often enough to make knowing some classes there + how they all plug together and communicate important details |
| 00:09 | yousef | pdk: i see. well i will definitely go with amalloy's suggestion with learning scheme first. |
| 00:10 | yousef | anyhow thanks again |
| 01:38 | vibrant | morning |
| 01:39 | yayitswei | vibrant: good morning |
| 01:51 | notsonerdysunny | can somebody clarify the difference between send and send-off ..? I the documents weren't very helpfull.. |
| 01:53 | amalloy | notsonerdysunny: they use different thread pools |
| 01:54 | amalloy | i don't use them much, but i seem to recall send is for operations that are "fast" (it uses a limited thread pool), and send-off is for possibly-blocking operations (it uses a new thread) |
| 01:57 | notsonerdysunny | amalloy: every agent runs on its own thread and send runs the funciton on the same thread as the agent but send-off runs on a new thread ... Do I understand you? |
| 01:58 | amalloy | each agent has at most one thread, but my understanding is that if you have more than one agent they share a limited number of threads between them |
| 02:28 | defn | hola |
| 02:28 | amalloy | morning |
| 02:29 | amalloy | how's the conj? |
| 02:29 | defn | chouser: aloha |
| 02:29 | defn | awesome. |
| 02:29 | defn | i think i may be the last person to go to bed |
| 02:29 | amalloy | the clock is a strong argument in favor of that possibility |
| 02:29 | defn | :D |
| 02:30 | defn | spent like 3 hours talking with chouser and cemerick on editor support and cinc |
| 02:30 | amalloy | cinc? |
| 02:30 | defn | clojure in clojure |
| 02:30 | amalloy | excellent. make it so |
| 02:30 | cemerick | defn: I don't think chouser's actually been in here at all -- that's probably just his client at home keeping the log up to date :-) |
| 02:31 | defn | : |
| 02:31 | amalloy | yeah, he hasn't said a word all day |
| 02:31 | defn | :D |
| 02:31 | defn | alexyk is snoring like crazy |
| 02:31 | amalloy | haha |
| 02:31 | defn | someone shoul talk to him about obstructive sleep apnea |
| 02:31 | defn | should* |
| 02:31 | amalloy | too bad you didn't get me to come. i sleep quiet and travel with earplugs :P |
| 02:32 | defn | cemerick: really great talking to you tonight |
| 02:32 | cemerick | likewise :-) |
| 02:32 | defn | this conference is pure unadulterated "win" |
| 02:32 | amalloy | oh snap, defn was wrong again. cemerick's still up |
| 02:33 | cemerick | I've got a talk tomorrow :-P |
| 02:33 | defn | yeah i was the last to leave the bar |
| 02:33 | defn | but not irc, appareantly |
| 02:33 | defn | apparently* |
| 02:33 | cemerick | No rest for those-that-don't-want-to-bomb |
| 02:33 | amalloy | cemerick: up late, or up early? |
| 02:33 | cemerick | heh, late |
| 02:33 | amalloy | good. i don't need to call a mental hospital for you, then |
| 02:33 | defn | cemerick: you'll do great. im sure of it. |
| 02:33 | cemerick | we shall see |
| 02:34 | cemerick | I really want to do a live demo. I might try to beg a mifi thing off someone. |
| 02:34 | defn | cemerick: if you need wifi have a tethering setp |
| 02:34 | defn | (first clojure-conj), PW: d34db33f01 |
| 02:35 | cemerick | dude, you're gonna get such an overage now... ;-) |
| 02:35 | defn | im grandfathered into "unlimited" |
| 02:36 | defn | ive been putting 10GB a month on it -- my bill is big enough they wont bother me :) |
| 02:37 | defn | amalloy: quick, get a plane ticket and come! |
| 02:38 | amalloy | defn: i'm actually there already, i'm just not telling anyone who i am. if you see a creepy-looking guy watching through a window, that'll be me |
| 02:38 | defn | anyway, i should probably retire for the evening...after i read more of chouser's finger tree source, then some of Zach's penumbra, then some CDT by gjahad |
| 02:39 | defn | ive ot my work cut out for me for like..the next 10 years |
| 02:39 | amalloy | hey defn, can you explain finger trees? i glanced at the source but didn't really get the idea |
| 02:39 | defn | you can add to the front and back of a sequence efficiently |
| 02:40 | defn | make them countable in log n time |
| 02:40 | defn | split them and add to the middle similarly |
| 02:40 | amalloy | weird, log countable? |
| 02:40 | defn | it's a really cool functional datastructure |
| 02:41 | defn | branches hold their count, and then as you walk back to the root they all add up to give the full count |
| 02:41 | defn | if that makes sense... |
| 02:41 | amalloy | defn: almost |
| 02:42 | amalloy | it implies you start a walk from somewhere other than the root, and i don't quite follow that |
| 02:42 | defn | you still walk from the root, there are a few branches from root, i think the rule is <4 |
| 02:43 | defn | left and right are just off the root |
| 02:43 | defn | im too tired to attempt this but they're not very hard to grok |
| 02:43 | amalloy | haha |
| 02:43 | amalloy | okay |
| 02:43 | defn | chouser's talk will explain all soon enough |
| 02:43 | defn | :D |
| 02:44 | defn | amalloy: ill draw you a diagram tomorrow during the conj :) |
| 02:44 | defn | gnight all |
| 02:44 | amalloy | heh. just hold it up against the window for me |
| 02:44 | amalloy | night |
| 02:48 | amalloy | cemerick: your talk is on IDEs, right? maybe CCW? i can't quite keep track of everyone's projects |
| 02:48 | cemerick | amalloy: no; Laurent's talk was on ccw, that's his baby |
| 02:49 | cemerick | I help a little :-) |
| 02:49 | cemerick | http://first.clojure-conj.org/speakers#emerick |
| 02:49 | amalloy | ah! that's a more interesting topic for me |
| 02:51 | amalloy | i'm not super-interested in web apps, but they're much better for showing off |
| 05:20 | _ulises | morning |
| 05:40 | lypanov | does anyone want clojure on llvm or no one cares? |
| 05:40 | esj | i know you do :) |
| 05:40 | lypanov | for: 1, against: 8 rotated |
| 05:54 | jszakmeister | lypanov: that would be interesting |
| 05:54 | Chousuke | Yeah. |
| 05:55 | jszakmeister | Especially if you could integrate C++ libraries and such |
| 05:58 | tufflax | Why can't I do (map Integer/parseInt '("1" "2")) but I can do (Integer/parseInt "2")? Error: Unable to find static field: parseInt in class java.lang.Integer |
| 05:58 | tufflax | ,(map Integer/parseInt '("1" "2")) |
| 05:58 | clojurebot | java.lang.Exception: Unable to find static field: parseInt in class java.lang.Integer |
| 06:02 | mrBliss | (map #(Integer/parseInt %) '("1" "2")) |
| 06:02 | mrBliss | ,(map #(Integer/parseInt %) '("1" "2")) |
| 06:02 | clojurebot | (1 2) |
| 06:02 | tufflax | Ok, but why doesn't it work? :P |
| 06:02 | tufflax | ...the way I did it. |
| 06:02 | mrBliss | because it's a java method |
| 06:03 | tufflax | uhu... |
| 06:03 | mrBliss | a clojure function is a first order function |
| 06:03 | lypanov | jszakmeister: yup. that would be the idea. |
| 06:03 | lypanov | okay 3 votes and a possible vote. |
| 06:03 | lypanov | esj: you? |
| 06:04 | jszakmeister | lypanov: are you thinking of writing something? |
| 06:04 | lypanov | jszakmeister: yeah. lost my job and don't want to get another straight away |
| 06:04 | lypanov | (first time i get to choose that, so taking the option) |
| 06:04 | lypanov | so i have 1 month to spend on it |
| 06:05 | lypanov | doubt i'll even succeed. i have zero experience with clojure other than knowing its great. |
| 06:05 | lypanov | and zero experience with llm. |
| 06:05 | lypanov | (see, i can't even spell it) |
| 06:05 | jszakmeister | lypanov: sorry to hear about the job loss... tough times. glad you can take some time off though |
| 06:05 | jszakmeister | Gotta start somewhere, right? |
| 06:05 | esj | lypanov: i'm not qualified to comment really. It would be interesting, but I think the jvm is going to continue to be just fine. (or maybe i'm just a turkey ignorant of thanksgiving ?) |
| 06:05 | lypanov | i started a ruby rewrite a few years back (in ruby) using my own tinyjit. |
| 06:06 | lypanov | so have enough experience with the theory |
| 06:06 | lypanov | (tinyjit was a threaded interpreter) |
| 06:06 | lypanov | (maybe i should have called it something other than tinyjit) |
| 06:06 | esj | lypanov: impressive |
| 06:07 | jszakmeister | lypanov: neat. I've always wanted to do compiler work, but I don't have the formal base (I'm not a CS major) |
| 06:07 | lypanov | it was incomplete crashy and shit. |
| 06:07 | lypanov | i blew up my brain in the process. |
| 06:07 | jszakmeister | :-) |
| 06:07 | lypanov | but it was fast at adding numbers! |
| 06:07 | esj | lol\ |
| 06:07 | lypanov | jszakmeister: i am but from a crap uni so i don't count it anyway. but yay letters. |
| 06:08 | lypanov | i have more experience from life than i got in all the years at uni. |
| 06:08 | lypanov | anyway, bootstrapping sounds like fun. |
| 06:09 | lypanov | thx guys. this project gets 3 more points. |
| 06:09 | lypanov | the others are all still on zero. |
| 06:09 | lypanov | its competing with: finishing an existing cocoa/clojure binding. |
| 06:09 | lypanov | : rewriting basic vim subset in clojure and a few plugins also |
| 06:09 | lypanov | : <insane project i'll never do> |
| 07:02 | kryft | Regarding some code on page 153 (p 149 in the pdf) of Joy of Clojure: (defn xseq [t] (when t (concat (xseq (:L t)) [(:val t)] (xseq (:R t))))) |
| 07:03 | kryft | Shouldn't you use recur or something here? |
| 07:03 | Chousuke | you can't. |
| 07:04 | Chousuke | recur only works for tail recursion |
| 07:04 | kryft | Oh right, it's not in tail position. |
| 07:04 | Chousuke | I think using lazy-cat might be better there though. |
| 07:06 | kryft | Chousuke: Now that I think about it, I guess this kind of recursion wouldn't generally be a problem anyway, as the depth will only be around log N |
| 07:08 | kryft | Chousuke: Ie. even if you could do some fancy optimization, it would be unnecessary. |
| 07:10 | kryft | Well, that was an unusually useful stupid question. |
| 07:11 | kryft | I should make an effort to flaunt my ignorance in all areas of life. :) |
| 07:16 | sempah | hello, what is the meaning for *var* |
| 07:16 | sempah | I know I read it before, but i dont get it |
| 07:17 | sempah | something like a global var? |
| 07:19 | jarpiain | sempah: it's a naming convention for vars that are intended to be dynamically bound with (binding ...) |
| 07:20 | sempah | ok thanks |
| 07:20 | sempah | saw it any book before, but couldnt remember |
| 07:46 | sempah | will be a var defined with "let" only be executed if it is used in a later context? |
| 07:47 | sempah | if I assign: let ... result (...) the whole function will be executed very fast |
| 07:47 | sempah | if I add a print result at the end it is very slow |
| 07:47 | sempah | is this called lazy? :) |
| 07:54 | Chousuke | the let binding is always executed |
| 07:54 | Chousuke | but it might be bound to a lazy seq |
| 07:54 | _ulises | chouser: even if you do let [ x (map f coll)] ? |
| 07:54 | Chousuke | yes |
| 07:54 | Chousuke | the lazy seq is created |
| 07:54 | _ulises | I mean, the realisation of map won't be until you actually use x, right? |
| 07:54 | _ulises | right, that |
| 07:54 | Chousuke | right. |
| 07:55 | sempah | ohh this isnt good for me ;) |
| 07:55 | Chousuke | they're safe, just be mindful of dynamic binding |
| 07:55 | sempah | wanted to compare some functions |
| 07:55 | Chousuke | add a doall? |
| 07:56 | sempah | wondering the giant difference ^^ |
| 07:56 | Chousuke | to force the seq |
| 07:56 | sempah | doall? -.- |
| 07:56 | _ulises | or dorun |
| 07:56 | Chousuke | it forces the whole seq instantly |
| 07:56 | sempah | ,doc doall |
| 07:56 | clojurebot | java.lang.Exception: Can't take value of a macro: #'clojure.core/doc |
| 07:56 | _ulises | ,(doc dorun) |
| 07:56 | clojurebot | "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil." |
| 07:56 | _ulises | ,(doc doall) |
| 07:56 | clojurebot | "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time." |
| 07:56 | sempah | ahh the missing parantheses :P |
| 07:57 | _ulises | if you're dealing with large data dorun might be better |
| 07:57 | _ulises | as it doesn't keep a ref. to the head, etc. |
| 07:57 | sempah | large is realtive :) |
| 07:57 | _ulises | indeed |
| 07:57 | sempah | but i will try both functions |
| 07:57 | sempah | thx for the advise |
| 08:01 | _ulises | sure, np. |
| 08:02 | _ulises | I'm shocked my comments were actually useful :D |
| 08:06 | _ulises | is there any way I can bypass the fetching of the DTD from w3 when using 'parse' to parse XML? |
| 08:06 | _ulises | alternatively, are there other/better options to clojure.xml? |
| 08:28 | kryft | Chousuke: "Be mindful of dynamic binding" sounds very profound. |
| 09:00 | sempah | what is a proper way to compile a clojure file? (without tools like leinigen) |
| 09:01 | esj | sempah: (compile ...) |
| 09:02 | hiredman | I am prepared to be provoked |
| 09:03 | esj | but just google about for AOT and you'll see all the ins and outs |
| 09:05 | sempah | -.- |
| 09:30 | sempah | ,(println "ä") |
| 09:30 | clojurebot | � |
| 09:31 | sempah | is there a change to work with german umlauts? |
| 09:31 | sempah | chance* |
| 09:32 | Chousuke | that should work just fine |
| 09:32 | mike5160 | hi all. |
| 09:32 | Chousuke | check your encoding. |
| 09:32 | sempah | <sempah> ,(println "ä") |
| 09:32 | sempah | <clojurebot> � |
| 09:32 | Chousuke | ,(println "ä") |
| 09:32 | clojurebot | ä |
| 09:33 | sempah | strange |
| 09:33 | Chousuke | you're using ISO Latin-something I guess |
| 09:33 | Chousuke | It's 2010, use UTF-8 :P |
| 09:34 | sempah | I use the default one |
| 09:34 | sempah | so why isnt it utf8 :) |
| 09:34 | Chousuke | no idea. |
| 09:34 | Chousuke | crappy client? :P |
| 09:34 | mike5160 | i m trying to use the vijual-1.0.0-dd-mm...jar file in the command line repl. I do (use '(vijual)) and then as per github vijual instructions i do a (require 'vijual :reload) but when i try to use any function from the library it just says... Unable to resolve symbol... draw-tree any ideas? |
| 09:35 | mike5160 | do i need to use the (load 'vijual ) function? |
| 09:36 | sempah | hmm eclipse encoding says utf8 |
| 09:36 | Chousuke | hmh |
| 09:42 | kryft | ,(println "ä") |
| 09:42 | clojurebot | � |
| 09:42 | kryft | Oh right, I have recode on. |
| 09:42 | Chousuke | I still have it on, but only for incoming stuff. |
| 09:42 | Chousuke | outwards I send UTF-8 |
| 09:43 | Chousuke | if someone complains, well, screw them :P |
| 10:00 | mike5160 | allright i will try again later. i want to get this vijual library to work. |
| 10:00 | mike5160 | later |
| 10:26 | TheAnimal | where do I put files for my namespaces so it will be reachable in repl with require macro? |
| 10:28 | esj | TheAnimal: if maven: ./src/main/clojure/my/namespace |
| 10:29 | esj | if you file is say my.namespace.cleverstuff |
| 10:29 | esj | and pom.xml is in . |
| 10:29 | TheAnimal | not using maven |
| 10:29 | TheAnimal | I use clojurebox |
| 10:29 | TheAnimal | now I've made a file irc.clj |
| 10:30 | TheAnimal | it has ns spur.irc |
| 10:30 | TheAnimal | how do I reach it from repl |
| 10:30 | TheAnimal | aside from changing my ns to spur.irc |
| 10:31 | esj | probably put the file in ./src |
| 10:31 | esj | sorry, put into ./src/spur |
| 10:32 | esj | then (require 'spur.irc) |
| 10:32 | esj | (never used clojurebox, but guestimating) |
| 10:33 | TheAnimal | the only problem then...is that I don't know that . is |
| 10:33 | TheAnimal | that is, I don't know where's the base folder |
| 10:34 | TheAnimal | I can load and compile files from anywhere on the drive |
| 10:35 | esj | OK, then I have no idea :) |
| 10:35 | esj | . is usually where the project project.clj or pom.xml lives |
| 10:36 | esj | i dunno how clojurebox constructs its classpath |
| 10:50 | tonyl | morning |
| 11:04 | defn | gut morning |
| 11:05 | tonyl | i guess everybody is at the conj |
| 11:10 | TheAnimal | you know what's sucks? unlike in java, the order the functions are defined in a file matters |
| 11:10 | sempah | how can I cast a int to char or rather print a special ascii char? |
| 11:10 | TheAnimal | feels like C all over again |
| 11:10 | sempah | something like 216.toChar |
| 11:11 | sempah | ,(print (char 215)) |
| 11:11 | clojurebot | × |
| 11:26 | TheAnimal | ,(print (char 3)) |
| 11:30 | mrBliss | TheAnimal: you can declare functions before you define them: (declare the-fn) |
| 11:32 | TheAnimal | i know |
| 11:32 | TheAnimal | that's C-like |
| 11:35 | fliebel | Hey, how are things at Clojure Conj? Wish I was there... |
| 11:40 | raek | sempah: casting an int to a char means gettin the char with that code point number. be aware of that bytes and chars aren't the same thing, and there are more than oneschemes of translating between the two (that is what encodings are about) |
| 11:41 | raek | *more than one scheme |
| 11:41 | technomancy | fliebel: pretty sweet actually |
| 11:44 | TheAnimal | is there a version of cond |
| 11:45 | TheAnimal | that would save the result of the predicate into a variable to be used in the expression that follows |
| 11:45 | fliebel | TheAnimal: You mean something like cond-let? (made up the name) |
| 11:46 | TheAnimal | yeah |
| 11:46 | TheAnimal | for instance |
| 11:46 | TheAnimal | I have a funcation fun1 that returs a map or nil |
| 11:46 | TheAnimal | I would like to have |
| 11:46 | TheAnimal | (cond (fun1 x y) (fun2 :pred y z)) |
| 11:47 | TheAnimal | where :pred is the result of (fun1 x y) |
| 11:47 | raek | TheAnimal: condp has a special :>> feature, which does something like that |
| 11:47 | TheAnimal | not exactly |
| 11:47 | TheAnimal | it uses a predicate with arity of 2 |
| 11:50 | fliebel | After seeing the slides from cgrand about the macro stuff, I am doubting about a macro I'm making. The macro takes a string of an expression in another language and returns the Clojure code for that. Is this a good use of macro, or should I go for an fn with eval? |
| 11:52 | raek | sounds like a legitimate use case of macros to me... |
| 11:52 | fliebel | good :) I think so to, but just to be sure.... |
| 11:54 | fliebel | I'm currently just regexing them into shape, but is there a way to ns-quallify the symbols for good style? Like ` would do. but without ` |
| 11:54 | TheAnimal | isn't that kind of macro insanely complex? |
| 11:54 | TheAnimal | you can't regex computer languages |
| 11:54 | ivey | Does the repl have a symbol for "return value from last form evaluated"? |
| 11:54 | fliebel | TheAnimal: Nah, I'm merely converting prefix to infix and CamelCase to dashes. |
| 11:54 | fliebel | ivey: *1 |
| 11:55 | ivey | thanks |
| 11:55 | raek | reminds me of incanter's infix macro... |
| 11:55 | fliebel | TheAnimal: You can, if you don't really parse them, but only convert styles. |
| 12:30 | yayitswei | good morning! |
| 12:34 | sempah | good evening ;) |
| 12:53 | kumarshantanu | can anybody tell me how is binary data represented in Clojure? sequence of Byte? |
| 13:26 | pauldoo | hi |
| 13:26 | Scriptor | hey pauldoo |
| 13:26 | pauldoo | I have a clojure multimethod, where the dispatch function is outputting two values |
| 13:27 | pauldoo | in my defmethods.. can I do partial matching? e.g. (defmethod foobar [_ 6] [a b] ...) |
| 13:27 | pauldoo | to match any cases where the 2nd output of the dispatch function is 6, regardless of the first output |
| 13:31 | pauldoo | I've tried [_ 6] syntax, and also [:default 6], but neither of these work.. is there another way? |
| 13:53 | _na_ka_na_ | hello all, is there a way to create a sorted-set which takes a comparable ? |
| 13:54 | _na_ka_na_ | oh i mean comparator |
| 13:54 | _na_ka_na_ | ,(doc sorted-set-by) |
| 13:54 | clojurebot | "([comparator & keys]); Returns a new sorted set with supplied keys, using the supplied comparator." |
| 13:55 | Upper | , (doc rest) |
| 13:55 | clojurebot | "([coll]); Returns a possibly empty seq of the items after the first. Calls seq on its argument." |
| 14:02 | AnotherLomono1 | toot |
| 14:05 | jewel | is there a built-in data-structure that supports BST operations with order-statistics? |
| 14:12 | amalloy | jewel: order-statistics? |
| 14:26 | KirinDave | So quiet around here with the conj draining everyone. |
| 14:28 | amalloy | KirinDave: just look at twitter and pretend they're all on #clojure |
| 14:28 | kumarshantanu | KirinDave: maybe clojurebot can be hooked up with #clojureconj tweetes to kill the quiet here :-) |
| 14:28 | KirinDave | Ha |
| 14:28 | KirinDave | I am jealous. |
| 14:28 | KirinDave | So very jealous. |
| 14:28 | KirinDave | But I am going to do some more work on clothesline. |
| 14:28 | KirinDave | I am going to public-ize it with some known issues, I want to get it out this weekend while the clojure-web-hype is high. |
| 14:28 | KirinDave | I wish I could have seen cgrand's dsl != macro talk so I know wtf it means |
| 14:29 | kumarshantanu | conj is turning out to be better than expected from the tweets i read |
| 14:55 | LauJensen | KirinDave: He's presented the code from a lab we did in Brussels, you can get a ticket for Conj Labs London if you want to see it again :) |
| 14:56 | LauJensen | s/presented/presenting/ |
| 14:56 | sexpbot | <LauJensen> KirinDave: He's presenting the code from a lab we did in Brussels, you can get a ticket for Conj Labs London if you want to see it again :) |
| 15:15 | KirinDave | LauJensen: Yeah, London. easy. ;) |
| 15:16 | amalloy | LauJensen: you sure it's not presented? they're in a different time zone, which is almost like time travel |
| 15:16 | LauJensen | The talk has already been done AFAIK, if thats what you mean |
| 15:17 | cpoconno | Any folk here have enclojure running on netbeans 6.9.1? |
| 15:17 | cpoconno | Or netbeans period? |
| 15:19 | TheAnimal | I'm having a weird problems invoking methods |
| 15:20 | TheAnimal | for instance I have a fn that returns another fn, in my case identity |
| 15:20 | TheAnimal | then I invoke returned fn like this |
| 15:20 | TheAnimal | ((get-handler-fn) "AA") |
| 15:20 | TheAnimal | get-handler-fn returns identity fn |
| 15:21 | TheAnimal | I get nil |
| 15:21 | TheAnimal | instead of "AA" |
| 15:21 | Derander | How do you folks handle java docs in emacs? |
| 15:22 | TheAnimal | (identity "ff") |
| 15:22 | TheAnimal | "ff" |
| 15:22 | TheAnimal | (:handler-proc (first input-handlers)) |
| 15:22 | TheAnimal | identity |
| 15:22 | TheAnimal | ((:handler-proc (first input-handlers)) "ff") |
| 15:22 | TheAnimal | nil |
| 15:22 | TheAnimal | what the hell is this? |
| 15:23 | TheAnimal | bug in the compiler? |
| 15:24 | hoeck | ,('identity "ff") |
| 15:24 | clojurebot | nil |
| 15:24 | hoeck | TheAnimal: looks like you got a symbol back from input-handlers |
| 15:24 | TheAnimal | why did you quote identity? |
| 15:24 | hoeck | and not the function identity |
| 15:24 | qbg | ,identity |
| 15:24 | hoeck | ,identity |
| 15:24 | clojurebot | #<core$identity clojure.core$identity@18eb7b8> |
| 15:24 | clojurebot | #<core$identity clojure.core$identity@18eb7b8> |
| 15:24 | TheAnimal | wtd |
| 15:24 | TheAnimal | wtf |
| 15:24 | qbg | That is how the function would print |
| 15:24 | TheAnimal | how did that happen |
| 15:24 | TheAnimal | I see |
| 15:25 | TheAnimal | I don't understand the difference |
| 15:25 | amalloy | ,[identity 'identity] |
| 15:25 | clojurebot | [#<core$identity clojure.core$identity@18eb7b8> identity] |
| 15:25 | TheAnimal | I can see that |
| 15:25 | TheAnimal | but I can't see why it returns symbol |
| 15:25 | TheAnimal | (def input-handlers '({:handler-proc identity :listeners #{}})) |
| 15:26 | qbg | You are quoting the entire thing, so nothing is being evaluated in it |
| 15:26 | hiredman | fyi, clojurebot is currently running from the the significantly changed newworld branch of clojurebot |
| 15:26 | TheAnimal | oh |
| 15:26 | qbg | (def input-handlers [{:handler-proc identity :listeners #{}}]) |
| 15:26 | qbg | That would be what you want |
| 15:26 | hiredman | which baring problems will become the master |
| 15:26 | amalloy | TheAnimal: if you want a list whose subelements are evaluated, either use [vectors] or (list stuff) |
| 15:27 | LauJensen | hiredman: anything in particular we need to be mindful of ? |
| 15:27 | TheAnimal | ok works now |
| 15:27 | TheAnimal | thanks |
| 15:27 | TheAnimal | I need to learn how to make my clojure code more readable |
| 15:28 | TheAnimal | it's only 77 lines and already I'm getting lost |
| 15:28 | amalloy | TheAnimal: well, some of that is being familiar with the language. but if you make a gist or a paste i'm sure someone can give you tips |
| 15:28 | TheAnimal | gotta come up with some sort of naming convention |
| 15:29 | TheAnimal | right now functions, variables and datastructures all seems the same |
| 15:32 | romain_p | Hi everyone, some beginner help? |
| 15:33 | romain_p | user=> (split-with consonant "This was nice") |
| 15:33 | qbg | romain_p: Go ahead |
| 15:33 | romain_p | [(\T \h) (\i \s \space \w \a \s \space \n \i \c \e)] |
| 15:34 | romain_p | I'd like to make the second element of the returned sequence into a string, ie get "is was nice" |
| 15:34 | qbg | Only the second? |
| 15:34 | KirinDave | romain_p: Apply str. |
| 15:34 | romain_p | (and then catenate the first one after the second one) |
| 15:34 | KirinDave | ,(apply str '(\a \b \c)) |
| 15:34 | clojurebot | "abc" |
| 15:34 | romain_p | KirinDave: OK, I was missing the apply |
| 15:34 | KirinDave | :) |
| 15:34 | KirinDave | A common question |
| 15:34 | romain_p | thx |
| 15:35 | qbg | ,(apply str (apply concat (reverse (split-with consonant "This was nice")))) |
| 15:35 | clojurebot | java.lang.Exception: Unable to resolve symbol: consonant in this context |
| 15:36 | qbg | ,(apply str (apply concat (reverse [(\T \h) (\i \s \space \w \a \s \space \n \i \c \e)]))) |
| 15:36 | clojurebot | java.lang.ClassCastException: java.lang.Character cannot be cast to clojure.lang.IFn |
| 15:36 | qbg | ,(apply str (apply concat (reverse '[(\T \h) (\i \s \space \w \a \s \space \n \i \c \e)]))) |
| 15:36 | clojurebot | "is was niceTh" |
| 15:37 | romain_p | qbg: thanks |
| 15:38 | _ulises | is there any way to tell parse to not try and download the DTD from w3c? |
| 15:38 | _ulises | .e.g use a locally cached version or simply ignore it |
| 15:39 | _ulises | I'm referring to clojure.xml/parse by the way :) |
| 15:40 | hiredman | yes, you can google it, I did the other week and it's fairly easy to find |
| 15:45 | _ulises | hrm, I did some googling but I could only find a solution where it involved using lots of java |
| 15:45 | _ulises | thanks anyway :) |
| 15:51 | hiredman | upshot of the new clojurebot version, if something causes an exception in it's internal processing the exception will show up on irc, which is kind of neat |
| 15:58 | Upper | , (apply str (reverse "adaven nevada")) |
| 15:58 | clojurebot | "adaven nevada" |
| 16:09 | Derander | Upper: looks like reverse is broken |
| 16:09 | Derander | ... |
| 16:09 | amalloy | ,(vals [1 2]) |
| 16:09 | clojurebot | java.lang.Integer cannot be cast to java.util.Map$Entry |
| 16:09 | Upper | looks like |
| 16:10 | amalloy | hiredman: nice. that caused an "i don't understand before", i think |
| 16:11 | amalloy | s/ before"/" before/ |
| 16:11 | sexpbot | <amalloy> hiredman: nice. that caused an "i don't understand" before, i think |
| 16:25 | TheAnimal4 | sup |
| 16:28 | TheAnimal | l |
| 16:29 | Upper | , (->> (iterate inc 0) (map #(* % %)) (str inc " ") (take 20)) |
| 16:29 | clojurebot | Execution Timed Out |
| 16:31 | Upper | i'd like to show inc value in each iterate |
| 16:31 | amalloy | that's weird. i don't see what should be making that time out |
| 16:32 | amalloy | Upper: take a look at juxt. you can use that to sorta apply two different functions to the same argument |
| 16:32 | amalloy | ,((juxt identity #(* % %)) 6) |
| 16:32 | clojurebot | [6 36] |
| 16:33 | Upper | hmm alright. |
| 16:38 | hiredman | amalloy: making a str out of an infinite seq |
| 16:38 | amalloy | hiredman: oh, of course. thanks |
| 16:39 | KirinDave | I have a defrecord defined in clothesline.protocol.test-helpers, named TestResult |
| 16:40 | KirinDave | But when we try and access it from scala |
| 16:40 | hiredman | clothesline.protocol.test_helpers.TestResult? |
| 16:40 | clojurebot | Titim gan éirí ort. |
| 16:40 | KirinDave | hiredman: scala> import clothesline.protocol.test_helpers.TestResult |
| 16:40 | KirinDave | <console>:5: error: value test_helpers is not a member of package clothesline.protocol |
| 16:40 | KirinDave | import clothesline.protocol.test_helpers.TestResult |
| 16:40 | amalloy | raek: you can see my latest juxt ninjitsu in my patch for sexpbot: http://tinyurl.com/23fgwps |
| 16:42 | raek | nice. |
| 16:43 | amalloy | btw, do you think the use of reduce there is idiomatic? it feels kinda like trickery and i ought to be using a plain (loop) |
| 16:44 | hiredman | KirinDave: check the generated class files |
| 16:45 | KirinDave | I dunno why I never use juxt. :\ |
| 16:47 | amalloy | KirinDave: maybe raek and i will send some juxt missionaries at you |
| 16:47 | KirinDave | Lol. |
| 16:47 | LauJensen | amalloy: wasnt that the code somebody blogged about recently, in relation to a talk in here? |
| 16:47 | LauJensen | seems oddly familiar |
| 16:47 | amalloy | LauJensen: it's possible, but i don't follow any blogs |
| 16:48 | LauJensen | not even.... MINE?! :) |
| 16:48 | amalloy | and that *specific* code i wrote at 1:30 this morning, so it probably hasn't made the blogrolls yet :P |
| 16:50 | KirinDave | amalloy: Given the culture, it seems like any reduce use is gleefully embraced. |
| 17:03 | amalloy | anyone know when/where the presentations will be available? |
| 18:43 | _na_ka_na_ | hello, can someone tell me why the following behave as they do: |
| 18:43 | _na_ka_na_ | ,(= (sorted-set :a) (set [:a])) |
| 18:43 | clojurebot | true |
| 18:44 | _na_ka_na_ | ,(= (sorted-set-by (constantly 1) :a) (set [:a])) |
| 18:44 | clojurebot | false |
| 18:58 | _na_ka_na_ | , (= (set [:a]) (sorted-set-by (constantly 1) :a)) |
| 18:58 | clojurebot | true |
| 18:58 | _na_ka_na_ | even wierder! |
| 19:05 | arbscht | for anyone interested, the seven-day Lisp Game Dev Competition for October 2010 has just begun. you can submit your entry at any time until 31 Oct: http://lispgames.ath.cx/index.php/2010_October_Lisp_Game_Dev_Competition |
| 19:14 | amalloy | _na_ka_na_: a sorted-set uses its comparator to look up items |
| 19:14 | amalloy | since (constantly 1) says every element is greater than every other element, you can't be too surprised that it can't find the items you ask it to look for |
| 19:15 | amalloy | ,(let [s #{:a}, ss (sorted-set-by (constantly 1) :a)] [(some ss s) (some s ss)]) |
| 19:16 | amalloy | clojurebot: ping? |
| 19:16 | amalloy | ->(let [s #{:a}, ss (sorted-set-by (constantly 1) :a)] [(some ss s) (some s ss)]) |
| 19:16 | sexpbot | java.lang.SecurityException: Code did not pass sandbox guidelines: (#'clojure.core/sorted-set-by) |
| 19:20 | clojurebot | [nil :a] |
| 19:20 | clojurebot | PONG! |
| 19:20 | _na_ka_na_ | amalloy: thanks for the explanation, got it! |
| 19:22 | _na_ka_na_ | amalloy: i wrongly assumed = with collections just chks something like (= (set (seq %1)) (set (seq %2))) |
| 19:22 | _na_ka_na_ | is there some function like that? |
| 19:23 | amalloy | _na_ka_na_: that wouldn't really work in general because of lazy seqs. if it worked that way, this would be impossible: |
| 19:23 | amalloy | ,(= (range) [1]) |
| 19:23 | clojurebot | false |
| 19:24 | amalloy | (because (set (range)) would never complete) |
| 19:26 | _na_ka_na_ | amalloy: you would check equality of counts first? |
| 19:27 | amalloy | ,(count (range)) |
| 19:27 | clojurebot | Execution Timed Out |
| 19:27 | _na_ka_na_ | and for lazy seqs you'll do one by one |
| 19:27 | amalloy | how do you know what seqs are lazy? |
| 19:29 | _na_ka_na_ | i think it must have some way of knowing that as following works: |
| 19:29 | _na_ka_na_ | , (= (range) (map inc (range))) |
| 19:29 | clojurebot | false |
| 19:30 | opqdonut | the = just compares element by element |
| 19:30 | opqdonut | and map is lazy |
| 19:30 | amalloy | yep |
| 19:31 | _na_ka_na_ | hmm ya it makes sense |
| 19:31 | amalloy | ,(= (sorted-set-by < 1 2) (sorted-set-by > 1 2)) |
| 19:31 | clojurebot | true |
| 19:33 | _na_ka_na_ | but i think its un-intuitive that (= x y) != (= y x) |
| 19:33 | opqdonut | you've violated the contract of sorted-set-by |
| 19:33 | amalloy | that's only the case because you're abusing sets by giving them a comparator that doesn't satisfy the comparator contract |
| 19:34 | _na_ka_na_ | hmm .. what's the contract of sorted-set-by ? |
| 19:34 | _na_ka_na_ | , (doc sorted-set-by) |
| 19:34 | clojurebot | "([comparator & keys]); Returns a new sorted set with supplied keys, using the supplied comparator." |
| 19:34 | amalloy | http://download.oracle.com/javase/1.4.2/docs/api/java/util/Comparator.html |
| 19:34 | _na_ka_na_ | is there any documentation i can refer to? |
| 19:36 | _na_ka_na_ | thanks! I'll read up to understand, I think we should have some reference to Comparator contract for non Java people |
| 19:37 | amalloy | it couldn't hurt, i agree, but it seems kinda unsurprising that (compare a b) should never have the same sign as (compare b a) |
| 19:47 | amalloy | do we have a convenient function to conj/cons an item to a list unless the item is nil? |
| 19:52 | amalloy | in my current use case it's no problem to filter out the nils later, but that feels silly |
| 20:04 | Derander | amalloy: I'm actually wondering the same thing |
| 20:14 | _na_ka_na_ | is there any way in which I can avoid getting 'has joined |
| 20:14 | _na_ka_na_ | and 'has quit' messages? |
| 20:15 | _na_ka_na_ | I'm using XChat |
| 20:22 | amalloy | _na_ka_na_: http://tinyurl.com/38cofyq :) |
| 20:24 | _na_ka_na_ | amalloy: :) |
| 20:24 | _na_ka_na_ | i tried going through settings then gave up |
| 20:26 | Upper | _na_ka_na_: I though you got sad |
| 20:27 | _na_ka_na_ | Upper: actually I did! how did you figure?! |
| 20:28 | Upper | you're gone |
| 20:29 | _na_ka_na_ | Upper: naa I needed to re-join in order for the command (to disable join/leave msgs) to take effect |
| 20:31 | _na_ka_na_ | I was using webchat.freenode earlier but couldn't figure a way to disable join/leave msgs in that, so I downloaded XChat and couldn't find a way in this either |
| 20:40 | _na_ka_na_ | alright time for bed |
| 21:20 | rdeshpande | hi all |
| 21:21 | rdeshpande | i'm a vim user, but am learning clojure and happy to learn a new tool if it is the best tool for writing clojure. will vimclojure suit me, or should i try an IDE/emacs? |
| 21:21 | rdeshpande | (i've seen a handful of posts about this but most are quite dated, so wanted to get a more up to date opinion) |
| 21:21 | ivey | I've got some XML I'm getting from Google Reader with clj-http.client, but xml/parse is choking: "Invalid byte 2 of 2-byte UTF-8 sequence." |
| 21:23 | ivey | nevermind, I just needed to tell getBytes to use UTF8 |
| 21:24 | ivey | rdeshpande: I haven't used any of the vim tools for clojure, but I can't imagine using it without Emacs. Purely personal opinion. |
| 21:25 | mister_roboto__ | rdeshpande: i'm a vi user for many many years too and never learned emacs. however, i have used clojure for a little while now in eclipse and the counterclockwise plugin there works well |
| 21:26 | mister_roboto__ | rdeshpande: i tried eclipse just becuase i've also used that for java for a long time and it's second nature. didn't want to fight too many battles at the same time (learning clojure and emacs) |
| 21:44 | rdeshpande | ah, makes sense |
| 21:46 | mister_roboto__ | rdeshpande: does vimclojure have some kind of integration wtih a repl? i haven't tried it |
| 21:49 | amalloy | rdeshpande: i'm a longtime eclipse user, but i tried CCW when it was still in its infancy; at the time it wasn't very good, and tbh i'm very happy with emacs (having no prior loyalties to vi/emacs). but CCW is supposed to have improved since then |
| 21:51 | amalloy | that said, i know there are vim users who are happy with vimclojure |
| 21:51 | rdeshpande | mister_roboto__: apparently there is nailgun and lein-nailgun which should give some integration |
| 21:51 | rdeshpande | mister_roboto__: but i have yet to get it to work (still thrashing around as a newbie) :P |
| 21:53 | jackdempsey | i'm using vimclojure. mostly happy, except it seems to be slow, perhaps more so the longer i use it |
| 21:53 | jackdempsey | i noticed lag before when typing ( or ) |
| 22:02 | pjb3 | ,(defn foo [] "foo") |
| 22:02 | clojurebot | DENIED |
| 22:03 | pjb3 | If you did define a function like that |
| 22:03 | pjb3 | you can call it with (foo) |
| 22:03 | pjb3 | but (#'foo) also works |
| 22:03 | pjb3 | why? |
| 22:03 | clojurebot | http://clojure.org/rationale |
| 22:06 | amalloy | ,(class #'inc) |
| 22:06 | clojurebot | clojure.lang.Var |
| 22:06 | amalloy | ,(supers (class inc)) |
| 22:06 | clojurebot | #{clojure.lang.AFunction clojure.lang.IMeta clojure.lang.IObj clojure.lang.IFn java.util.Comparator java.io.Serializable clojure.lang.Fn java.lang.Object java.util.concurrent.Callable clojure.lang.AF... |
| 22:06 | amalloy | pjb3: Vars are callable as functions, and when called they just pass it on to whatever they refer to |
| 22:07 | pjb3 | amalloy: cool, thanks |
| 22:12 | jackdempsey | hey pjb3 how you doin man |
| 22:12 | pjb3 | jackdempsey: awesome, just got back from clojureconj, how about you? Your on the left coast I hear? |
| 22:13 | jackdempsey | pjb3: nice, yeah i wanted to go to that but just moved to SF and couldn't really fly away right then |
| 22:13 | jackdempsey | finally looking into clojure more these days. very interesting, though i'm experiencing a bit of the normal early stage hiccups |
| 22:13 | pjb3 | Sure, talks were really good, so were all the people |
| 22:13 | jackdempsey | more about java and tools than the language itself |
| 22:13 | jackdempsey | nice, yeah met some of the fine folks at relevance recently. did they record any talks? |
| 22:14 | jackdempsey | would love to see them if so |
| 22:14 | pjb3 | Yeah, there are recorded |
| 22:14 | pjb3 | supposedly going to be online |
| 22:14 | jackdempsey | awesome |
| 22:14 | jackdempsey | have you gone through their labrepl exercises at all? |
| 22:14 | pjb3 | no |
| 22:15 | jackdempsey | cool, just trying them out to start with. good stuff so far, but i think something's broken, and i know shit about maven :-D |
| 22:15 | pjb3 | ah, bummer, maven can be a PITA |
| 22:16 | jackdempsey | yeah, it's one of those "trying to get compojure working, so i run lein deps and boom goes the dynamite" fun things. but no worries, i'm sure it'll work out |
| 22:16 | pjb3 | yeah, I'm pumped to do more stuff with clojure after the conference |
| 22:16 | Nafai | I should go through labrepl to get back up to speed with clojure |
| 22:16 | pjb3 | I'll have to time find to do that |
| 22:16 | pjb3 | what about you, thinking of using clojure for something or just playing around? |
| 22:17 | jackdempsey | eh, more interested in learning it given i think Rich is right and want to be prepared for the situation when i really need it |
| 22:17 | jackdempsey | as opposed to cursing around in ruby :-) |
| 22:17 | jackdempsey | plus i like how it stretches my mind |
| 22:17 | jackdempsey | i never did much with lisp or java so it's kinda perfect in that way |
| 22:17 | pjb3 | yeah, I'm going to figure out how to do web dev in clojure for real |
| 22:18 | pjb3 | So eventually I can build stuff in clojure instead of Rails |
| 22:18 | jackdempsey | seems for backend service stuff it's certainly a great choice. hard to tell how great it is on the actual generating html / front side stuff at the moment |
| 22:18 | jackdempsey | all will come in time i'm sure |
| 22:18 | rdeshpande | pjb3: i'm in the same boat! |
| 22:19 | rdeshpande | pjb3: just started with it today though |
| 22:19 | pjb3 | I'm gonna give enlive a spin for templating for now |
| 22:19 | pjb3 | but we need better templating options I think |
| 22:19 | jackdempsey | yeah i'm curious how that will place out in practice. great idea i think |
| 22:19 | rdeshpande | a friend of mine and i are sitting here running through project euler problems in clojure |
| 22:19 | pjb3 | rdeshpande: cool |
| 22:19 | jackdempsey | rdeshpande: are you able to run lein deps in labrepl now and have it work? |
| 22:19 | jackdempsey | it's blowing up for me |
| 22:19 | pjb3 | I was just writing a sort of frameworky/router thing |
| 22:20 | jackdempsey | complaining about org.apache.maven:super-pom:jar:2.0 missing etc |
| 22:20 | jackdempsey | nice |
| 22:20 | pjb3 | then realized it's almost exactly the same as compojure |
| 22:20 | jackdempsey | ah |
| 22:20 | pjb3 | I hadn't even looked at compjure |
| 22:20 | rdeshpande | jackdempsey: just saw your reference to it and setting it up now |
| 22:20 | pjb3 | was using GET and POST for the routes just like compojure, thought that was funny that I independently arrived at the same idea |
| 22:20 | jackdempsey | hehe |
| 22:21 | jackdempsey | great minds think alike? |
| 22:21 | jackdempsey | rdeshpande: cool |
| 22:21 | pjb3 | Mine is awesome though because it's just functions, no macros :) |
| 22:21 | jackdempsey | hehe |
| 22:21 | jackdempsey | it's things like that that i'm still learning to grok |
| 22:21 | pjb3 | that's why I asked about the calling a var trick |
| 22:21 | jackdempsey | ah |
| 22:22 | pjb3 | I need to have that work or resort to a macro |
| 22:22 | pjb3 | and then I did it and it worked |
| 22:22 | jackdempsey | is using macros bad for some reason? |
| 22:22 | pjb3 | and I was like |
| 22:22 | jackdempsey | haha |
| 22:22 | jackdempsey | yeah |
| 22:22 | pjb3 | but it makes sense, vars are callable, like maps and keywords are callable |
| 22:22 | pjb3 | I love that |
| 22:22 | rdeshpande | pjb3: what are your thoughts so far coming from the ruby world? |
| 22:23 | pjb3 | rdeshpande: I think the way state is managed in clojure is a huge win |
| 22:23 | pjb3 | that's my biggest complaint with ruby |
| 22:24 | jackdempsey | pjb3: yea very cool design (callable ) |
| 22:24 | pjb3 | larger apps seem to devolved into a mess of instance_var_set, alias_method_chain nonsense that is hard to follow |
| 22:24 | rdeshpande | method_missing |
| 22:24 | pjb3 | yeah |
| 22:24 | pjb3 | unnecessary meta programming |
| 22:24 | rdeshpande | i hate seeing code that defines methods at runtime using strings with "def foo.#{something}" |
| 22:24 | jackdempsey | yep, state and concurrency features are really forward thinking |
| 22:24 | rdeshpande | very hard to debug |
| 22:24 | pjb3 | I liked that that was a big topic of conversation at "the conj", as it was called |
| 22:24 | pjb3 | was about how to avoid using macros (metaprogramming) |
| 22:25 | pjb3 | when you can use functions instead |
| 22:25 | jackdempsey | pjb3: so if you have a sec, i'd love to hear a summary of that. being fairly new to lisp, i don't really have much history/background knowledge to get why that is important |
| 22:25 | pjb3 | Christophe Grand and Stuart Sierra both gave great talks on that |
| 22:25 | rdeshpande | btw any chance you guys are in the NYC area? |
| 22:25 | jackdempsey | i'm still trying to clarify in my head reader macros vs code macros etc |
| 22:25 | jackdempsey | rdeshpande: just moved to SF |
| 22:25 | amalloy | heh. i've been using clojure since june, and so far i've had the chance to help out three different people with macros on #clojure |
| 22:25 | TeXnomancy | macros are like second-amendment rights. you hope you never have to use them, but when you do you'd be in a world of hurt without them |
| 22:26 | pjb3 | rdeshpande: Baltimore |
| 22:26 | rdeshpande | ah ok, cool |
| 22:26 | amalloy | in each case, the answer was "Use fewer macros" |
| 22:26 | jackdempsey | technomancy: haha nice |
| 22:26 | pjb3 | jackdempsey: first, reader macros are syntax stuff |
| 22:26 | pjb3 | #'foo |
| 22:26 | amalloy | jackdempsey: i moved to SF in june. how long have you been here? |
| 22:26 | pjb3 | ends up being |
| 22:26 | pjb3 | (var foo) |
| 22:26 | jackdempsey | and that's the actual code/data that gets interpreted |
| 22:26 | pjb3 | You don't get to make your own reader macros, only Rich does :) |
| 22:26 | jackdempsey | amalloy: a few days? :-) |
| 22:27 | jackdempsey | yeah, i remember reading that. i think that was smart of him |
| 22:27 | amalloy | haha, well hello then. whereabouts? |
| 22:27 | pjb3 | right, even '(1 2 3) is just (list 1 2 3) |
| 22:27 | amalloy | pjb3: no, it's (quote (1 2 3)) |
| 22:27 | jackdempsey | technomancy: hey sir, mind a lein question? i can't tell if this is labrepl blowing up or what, but running lein deps seems to bork on their project now |
| 22:27 | pjb3 | amalloy: er, right |
| 22:27 | pjb3 | ,(macroexpand ''(1 2 3)) |
| 22:27 | clojurebot | (quote (1 2 3)) |
| 22:28 | pjb3 | whereas macros that you write basically take the raw code/data and re-write them before they get executed |
| 22:28 | jackdempsey | cool, so just things to make it easier to type, whereas code macros are substituted at compile-time? |
| 22:28 | pjb3 | and you get to write those |
| 22:28 | jackdempsey | amalloy: thx! living out in brisbane just south of the city |
| 22:29 | pjb3 | right, they run a compile time, the convert the data before it actually gets evaled |
| 22:29 | technomancy | jackdempsey: sure; let's see a gist? |
| 22:29 | jackdempsey | pjb3: so i guess the dumb question is: why are they any different than just functions? because of the compile time nature and they can be evaled before things are actually run? |
| 22:29 | amalloy | jackdempsey: they don't evaluate their arguments, and they expand at compile time. that's about it |
| 22:30 | jackdempsey | technomancy: http://gist.github.com/643005 i used to be on clojure 1.3 but some updates/upgrades seem to have me back on 1.2 |
| 22:30 | pjb3 | Also, macros are hard to compose with other code because they can't be used as higher order functions |
| 22:30 | jackdempsey | not sure why it's trying to use beta1 tho |
| 22:31 | jackdempsey | so comparing them to ruby's metaprogramming is a decent analogy of sorts? (cept compile-time etc) |
| 22:31 | amalloy | dunno. not a rubyist |
| 22:31 | pjb3 | yes |
| 22:31 | jackdempsey | hehe ya sry was for paul |
| 22:31 | jackdempsey | cool |
| 22:31 | pjb3 | so it has the same drawbacks as ruby metaprogramming |
| 22:31 | jackdempsey | seems 'tricks' that lead to complexity are |
| 22:31 | jackdempsey | yeah exatly |
| 22:31 | pjb3 | it's hard to follow/debug |
| 22:31 | jackdempsey | with a c even |
| 22:31 | jackdempsey | k |
| 22:31 | jackdempsey | but sometimes really nice/useful |
| 22:31 | jackdempsey | so use sparingly. cool. |
| 22:31 | pjb3 | if can be done with regular methods, it's just better |
| 22:31 | pjb3 | right |
| 22:32 | pjb3 | basically, only use a macro if you really have to |
| 22:32 | jackdempsey | yea |
| 22:32 | pjb3 | maybe to have a little syntactic suger |
| 22:32 | jackdempsey | k |
| 22:32 | pjb3 | but when you do, make sure there are underlying functions that people can call directly |
| 22:32 | jackdempsey | as far as philosophies go, would you say clojure's more perl or python (tmtowtdi or basically 1 correct way) |
| 22:33 | pjb3 | so that they can skip the sugar if they want to compose with other functions |
| 22:33 | jackdempsey | yea, makes sense |
| 22:33 | pjb3 | hard to say on the tmtowtdi/1 way thing |
| 22:34 | jackdempsey | reason i ask is that there seems to be a billion ways to do most things......but i'm sure some are better ideas than others......so any guiding principles? |
| 22:34 | pjb3 | maybe it's sort of like ruby in that sense |
| 22:34 | jackdempsey | yea |
| 22:34 | jackdempsey | prefer functions to macros |
| 22:34 | pjb3 | jackdempsey: are there a billion ways to do things? like what? |
| 22:34 | rdeshpande | tmtowtdi is a reason im trying to move away from ruby |
| 22:34 | rdeshpande | i like python's PEPs |
| 22:34 | jackdempsey | well, just going through the labrepl bit, there're so many ways it seems to do some simple functions |
| 22:35 | pjb3 | well, clojure syntactically is more regular that ruby for sure |
| 22:35 | jackdempsey | create a range and filter out nubmers you don't want them add them.......or programmtically come up with numbers in an additive way, and so on |
| 22:35 | pjb3 | you don't have the {} vs. do end |
| 22:35 | pjb3 | use parens or not |
| 22:35 | pjb3 | jackdempsey: that's true, but I think that's just the way functional programming is |
| 22:36 | jackdempsey | pjb3: i keep toying with the idea of taking whitespace idea from python/haml and using it to build something with even less (). they're still not very comfortable to me yet. guessing htat changes with time |
| 22:36 | jackdempsey | pjb3: ah true, good clarification |
| 22:38 | pjb3 | jackdempsey: don't let the parens both you, they just melt away after a while |
| 22:38 | jackdempsey | heh k |
| 22:38 | pjb3 | and the parens are what make macros possible |
| 22:38 | jackdempsey | technomancy: does that gist make any sense? i can't see why it's trying to go after beta1 when 1.2 final seems to be out |
| 22:38 | jackdempsey | i'm making my way through stu halloway's book. have you read the one by sierra? |
| 22:39 | pjb3 | jackdempsey: I'm reading sierra's one now, I think it's much better than stu's so far |
| 22:39 | jackdempsey | cool |
| 22:39 | pjb3 | but don't tell stu I that ;) |
| 22:39 | jackdempsey | hahaha |
| 22:39 | jackdempsey | this has been a good intro but i'm kind of hungering for something deeper |
| 22:39 | jackdempsey | amalloy: anything cool going on around here with clojure? |
| 22:40 | amalloy | um, KirinDave is around here somewhere, but i haven't actually met any clojurians yet |
| 22:40 | technomancy | jackdempsey: hard to say; no reason beta1 makes sense any more |
| 22:40 | amalloy | there's a monthly meetup group called baclojure |
| 22:40 | jackdempsey | gotcha |
| 22:40 | amalloy | planning to go to my first one next month |
| 22:41 | jackdempsey | technomancy: i ultimately just want to run the compojure exercises but when i do (use 'compojure) it bombs. trying to figure out if it's just me doing something stupid or a dep isn't loaded |
| 22:41 | jackdempsey | amalloy: nice, will look that up |
| 22:41 | jackdempsey | wow, 300 people in the group. cool |
| 22:42 | technomancy | jackdempsey: network's crap here or I'd check out labrepl myself |
| 22:43 | jackdempsey | technomancy: haha yeah i'm on a neighbors unsecured wireless till comcrapst can set me up |
| 22:45 | jackdempsey | pjb3: so the sierra book won't be a waste after reading a bit on the net and stu's book? (bit pricey, just don't want to waste the $) |
| 22:46 | amalloy | jackdempsey: Joy of Clojure is a good one. i haven't read the others, but it's supposed to be a good "second book" |
| 22:47 | jackdempsey | cool |
| 22:47 | jackdempsey | thx |
| 22:47 | amalloy | and i liked it as a first book, but with prior experience in java and a little CL |
| 23:28 | zakwilson | I'm doing a bunch of map lookups in a very inner loop. The keys are strings, and the maps are smallish (generally no more than a couple thousand entries). Can this be made faster? |
| 23:29 | dash | hmm. i'm trying to understand the implementation of 'assoc' in PersistentHashMap and there are some branches which don't appear to ever be taken. is there some test coverage i can look at to figure out if i'm just missing stuff? :) |
| 23:31 | dash | (In particular I don't see how HashCollisionNode.assoc's branch where the hashes are unequal can occur) |
| 23:31 | amalloy | zakwilson: make the keys into keywords if possible |
| 23:31 | zakwilson | amalloy: you'd think, but that's actually slower |
| 23:33 | amalloy | zakwilson: how many times do you look up a given key, on average? |
| 23:34 | amalloy | dash: eclipse will detect branches which are impossible. it doesn't understand everything, but it's pretty good |
| 23:34 | zakwilson | amalloy: I haven't actually measured that. If you're hinting at memoization, it's not the answer here. There are 30,000 maps being looked at here. |
| 23:35 | amalloy | no, i'm not. my point is if you look up each key 10 times it's worth converting from string to keyword before you loop; if most keys never get looked up at all, leave them as strings |
| 23:36 | amalloy | (this is a guess. i don't know much about the internals involved here) |
| 23:38 | zakwilson | amalloy: with all the keys as keywords, it's slower. Sometimes most of the keys get looked up, sometimes they don't. Either way, it was slower with all of the keys as keywords. |
| 23:38 | amalloy | huh |
| 23:39 | dash | amalloy: across method calls? :) |
| 23:39 | zakwilson | Somebody provided an explanation once. Keywords are also slow to read. |
| 23:43 | dash | aha |
| 23:43 | dash | i figured out how it gets there. :) |