#clojure logs

2009-01-25

00:00Carkactually you should do your requires in the ns form
00:00Carkso you could have something like this :
00:00hiredmaneee: did you pass -server to java?
00:01eeeum, I don't run things like that. whatever netbeans does
00:01hiredmanjava has two different vms
00:01Cark(ns org.mysite.my-lib (:use [clojure.contrib.math :exclude [mod]])
00:01eeewhich is dead working on this again
00:01hiredman-server and -client
00:02hiredman-server does all the cool jitstuff
00:02hiredman-client does not
00:02eeewell can someone whose setup is working convert my filtrem to use lists and time again
00:03eeeagainst separate from contrib
00:03ayrnieu,(defn eenie-meenie-mynie-moe [list] (nth list (mod 15 (count list)))) (eenie-meenie-mynie-moe '(pizza pork pb-and-j))
00:03clojurebotDENIED
00:03eeemy environment is clearly hosed
00:03Carkeee : why don't you try with the basic repl ?
00:05gnuvince_Chouser: Sorry to bother, did you get a chance to look at my greatest-least package?
00:05hiredmanclojurebot: does not allow defns
00:05clojurebotI don't understand.
00:05ayrnieu,(let [e-m-m-m (fn [list] (nth list (mod 15 (count list))))] (e-m-m-m '(pizza pork pb-and-j)))
00:05clojurebotpizza
00:05hiredmaner
00:06eeei don't think time works right
00:06hiredmantime is very simple
00:06Chouser'mod' is removed from 'math' now
00:06ayrnieuit may not provide wallclock time, eee.
00:06eeelazy things continue to process after the timer comes back
00:07eeeyou could run someting that hangs for an hor
00:07eeehour
00:07hiredmaneee: wrap in doall
00:07eeeand then it prints .123
00:07Carkbenchmarking is hard =)
00:07eeeoh
00:07eeeok
00:07hiredmaneee: that is host laziness works
00:07hiredmanit defers execution
00:07hiredmanhow
00:07eeelaziness dumb
00:07eee:)
00:08eeei can just imagine the fun I'll have trying to get coworkers to use the language
00:08eeethere's aren't fewer gotcha's . .. just different ones
00:09Chousergnuvince_: very briefly. were you going to integrate Jason Wolfe's maximal-elements or whatever that's called?
00:14eeewhat does this mean? #(< % x)
00:14eeepercent
00:14ayrnieu,(let [x 5] (#(< % x) 2))
00:14clojurebottrue
00:14hiredmanis #() is a kind of function literal
00:14ayrnieu,(let [x 5] (#(< % x) 7))
00:14clojurebotfalse
00:14eeebut the percent?
00:15hiredman% is the first argument
00:15hiredman% or %1
00:15hiredman%2 is the second
00:15eeeoh
00:15hiredmanetc
00:15ayrnieu,(let [x 5] ((fn [percent] (< percent x)) 2))
00:15clojurebottrue
00:15eee1st areg of let
00:16eeearg
00:16hiredmanno
00:16hiredmanthe first arg of the function
00:16Chouser#(+ % %2) is the same as (fn [a b] (+ a b))
00:23eeeoh
00:24eeei like that
00:24gnuvince_Chouser: I did, but I changed the name and the code.
00:24gnuvince_Chouser: There are 8 functions now: greatest, greatest-by, all-greatest, all-greatest-by and the same thing for least.
00:25eeedo I automatically have contrib available?
00:25eeei just use enclojure
00:27ChouserDoes greatest-by always return the same thing as (first (all-greatest-by ...)) ?
00:27eeewow!
00:27eeenow I know lazy was messing up the timing
00:27eeemine is faster than filter
00:27eeeso anything that uses two passes with filter is way slower
00:28Chousergnuvince_: If so, and if the all-* functions produces lazy seqs, then you'd could have half as many functions.
00:31gnuvince_I don't see how they could produce a lazy sequence: they need to go until the end of the sequence to find the greatest element
00:32eeeanyone have access to the contrib 'separate' implementation?
00:32Chousergnuvince_: heh. good point.
00:32Chousersorry, I'm apparently not thinking very clearly
00:33gnuvince_Chouser: don't worry about it :)
00:33Chousereee: "access"?
00:34Chousergnuvince_: I'm just trying to think of ways to reduce the number of new functions needed to express the range of related functionality.
00:34hiredmanclojurebot: contrib?
00:34clojurebotcontrib is http://code.google.com/p/clojure-contrib/
00:34eeewhat is the implementation for separate. someone listed it before but it is off my screen
00:34Chousereee: http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/seq_utils.clj#37
00:34ayrnieuhttp://www.catholic.com/audio/2008/MP3/ca081212a.mp3
00:35ayrnieuhuh, that's wrong.
00:35ayrnieuhttp://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/seq_utils.clj
00:35eeethanks
00:36hiredmanugh
00:36hiredmanmy internet is so slow
00:37ayrnieuyow, I really hate this style. (defn name "long comment" [args] ...)
00:37eeewow. it really is way faster
00:37eeei guess the lack of branching and more efficient looping?
00:38Chousergnuvince_: ok, let me try again. even 'greatest' has to consume all its args. is boundary any more efficient than boundary-all?
00:38eeei dunno, it calls filter twice, but calling filter once is slow
00:38hiredmanis doall recursive? does it realize lazy-seqs recursively?
00:39Chouserhiredman: no
00:39hiredmanah
00:39Chouser,(second (doall [(iterate inc 0) [1 2]]))
00:39clojurebot[1 2]
00:40Chouser,(seconde (iterate inc 0)) ; lazy
00:40clojurebotjava.lang.Exception: Unable to resolve symbol: seconde in this context
00:40Chouser,(second (iterate inc 0)) ; lazy
00:40clojurebot1
00:41Chouser(second (doall (iterate inc 0))) ; hangs
00:41hiredman,(second (doall (iterate inc 0)))
00:41clojurebotExecution Timed Out
00:42hiredmansure, "hangs"
00:42ayrnieu,(second (first (doall [(iterate inc 0) [1 2]])))
00:42clojurebot1
00:43Chousergnuvince_: I gotta go. I'm not stopping any other contrib member from putting your code in, but personally I'd like to see if there's any sane way to pack the functionality of those 8 fns into 1 or 2 fns.
00:47gnuvince_Chouser: I'll look into it
01:02gnuvince_You can't
01:02gnuvince_You call it on a Reader or a Stream
01:02hiredman,(doc read)
01:02clojurebot"([] [stream] [stream eof-error? eof-value] [stream eof-error? eof-value recursive?]); Reads the next object from stream, which must be an instance of java.io.PushbackReader or some derivee. stream defaults to the current value of *in* ."
01:03technomancyso I need to instantiate some kind of stream?
01:04hiredmanyou nead a java.io.PushbackReader
01:05technomancyright... but I can't make one by passing a File in
01:06technomancyI guess I need a reader?
01:06technomancyto make a reader?
01:06hiredmanFileReader
01:06Cark(-> file FileReader. PushbackReader.)
01:06Carksomething like that i guess
01:07technomancyyay hoops
01:07technomancythanks though
01:08technomancyis this considered reasonable, or is it just one of those, "yeah, the language is still young, so it's got some rough edges" moments?
01:25technomancyIf I want to look up a docstring for a function given a symbol, (:doc ^#'my-func) works... but what if I want to make it dynamic?
01:26gnuvince_technomancy: (:doc (meta (var my-func)))
01:27technomancygnuvince_: that's what I tried
01:27technomancythis doesn't work: (let [x filter] (:doc (meta (var x))))
01:27technomancymaybe I'm misunderstanding var
01:28technomancydocstrings that point to web sites? hrm.
01:28technomancythat may be taking "Don't Repeat Yourself" a bit too literally. =)
01:28gnuvince_That's because x is not a var
01:29gnuvince_technomancy: special forms can't have meta data, so they can't have doc.
01:29technomancyright, I need to look up the docstring for the function that x is bound to... ah. but the function doesn't have the docstring, the var does?
01:30technomancythat's ... problematic.
01:30technomancyI guess I'll have to write this as a macro then.
01:31gnuvince_Look at how it's done for doc
01:31ayrnieu,(let [x filter] (doc x))
01:31clojurebotjava.lang.Exception: Unable to resolve var: x in this context
01:32ayrnieu,(macroexpand '(doc x))
01:32clojurebot(let* [m__63__auto__ (clojure.core/meta (var x)) al__64__auto__ (:arglists m__63__auto__) docstring__65__auto__ (:doc m__63__auto__)] (.replaceAll (.replaceAll (clojure.core/str al__64__auto__ "; " docstring__65__auto__) "\n" "") (clojure.core/str \\ \s) " "))
01:32durka42,(macroexpand-1 '(doc x))
01:32clojurebot(clojure.core/let [m__63__auto__ (clojure.core/meta (var x)) al__64__auto__ (:arglists m__63__auto__) docstring__65__auto__ (:doc m__63__auto__)] (.replaceAll (.replaceAll (clojure.core/str al__64__auto__ "; " docstring__65__auto__) "\n" "") (clojure.core/str \\ \s) " "))
01:32ayrnieu,(macroexpand-1 '(doc x))
01:32clojurebot(clojure.core/let [m__63__auto__ (clojure.core/meta (var x)) al__64__auto__ (:arglists m__63__auto__) docstring__65__auto__ (:doc m__63__auto__)] (.replaceAll (.replaceAll (clojure.core/str al__64__auto__ "; " docstring__65__auto__) "\n" "") (clojure.core/str \\ \s) " "))
01:32ayrnieuhm.
01:32ayrnieuinteractively, it macroexpands to (clojure.core/print-doc (var x))
01:33durka42,(= doc clojure.core/doc)
01:33clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.core/doc
01:33durka42,(= (var doc) (var clojure.core/doc))
01:33clojurebottrue
01:35technomancycan't map a macro over a list, of course.
01:36technomancyI guess this is where I use Emacs rectangle commands for "code generation"
01:37ayrnieuwhat are you trying to do?
01:38technomancyI've got a list of symbols that refer to functions, and I want to get a list of the corresponding docstrings
01:38durka42hmm, you can do something dumb like (map #(eval `(doc ~%)) '[filter print-doc])
01:39technomancydurka42: was about to do that, actually.
01:39technomancymuch to my shame.
01:39durka42it feels like a goto or something
01:39durka42or using a void*
01:40technomancy(my version was going to use read-string, which is far worse)
01:40durka42that would add an extra step
01:40durka42(+ 2 3)
01:40clojurebot*suffusion of yellow*
01:42Carktechnomency : i have some code to search the metadata of symbols in namespaces
01:42Carkwhat to get it ?
01:42Carkerr i mean: want to get it
01:42ayrnieu"want in on it?"
01:43technomancyCark: sure
01:43Carkclojurebot: paste?
01:43clojurebotpaste is http://paste.lisp.org/new/clojure if it's working
01:43durka42lisppaste8: is it working?
01:44lisppaste8cark pasted "doc search stuff" at http://paste.lisp.org/display/74206
01:44technomancythanks
01:44Carkyou're welcome
01:48technomancyok, I need to set the namespace before this will work
01:49technomancyat runtime it tries to look it up in clojure.core
01:50technomancy(let [*ns* mire.commands] ...) blows up though; what's the right way to do that?
01:50Cark(doc binding)
01:50clojurebotbinding => var-symbol init-expr Creates new bindings for the (already-existing) vars, with the supplied initial values, executes the exprs in an implicit do, then re-establishes the bindings that existed before.; arglists ([bindings & body])
01:50technomancyin-ns?
01:50technomancybinding blows up the same way
01:51Carkwhat are you trying to achieve ?
01:51ayrnieu(defn- all-symbols [] "Don't really get all symbols." (meta (vals (list (ns-publics mire.commands)))))
01:51technomancyayrnieu: that looks perfect
01:52ayrnieuwell, that's wrong because it calls meta on a list.
01:52technomancyright, but I get the idea
01:52Cark,(find-ns 'user)
01:52clojurebot#<Namespace user>
01:52Cark(ns-publics (find-ns 'user))
01:53durka42,(ns-publics 'user)
01:53clojurebot{}
01:54ayrnieu,(ns-publics 'clojure.core)
01:54clojurebot{sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, val #'clojure.core/val, *compile-path* #'clojure.core/*compile-path*, max-key #'clojure.core/max-key, list* #'clojure.core/list*, ns-aliases #'clojure.core/ns-aliases, the-ns #'clojure.core/the-ns, == #'clojure.core/==, longs #'clojure.core/longs, special-form-anchor #'clojure.
01:54technomancyayrnieu: thanks a bunch
01:54technomancyI need to head off though; getting late here
01:54durka42,(keys (ns-publics 'clojure.core)) ; human-readable
01:54clojurebot(sorted-map read-line re-pattern keyword? val *compile-path* max-key list* ns-aliases the-ns == longs special-form-anchor instance? syntax-symbol-anchor format sequential? fn? empty dorun time remove-method gensym not= *3 unchecked-multiply doseq bit-or aset-byte if-not hash-set unchecked-dec some nil? string? second keys for *2 long-array cond bit-set fn sorted? ns-unalias ns-publics dosync all-ns long with-open init-pro
01:55durka42(doc longs)
01:55clojurebotIt's greek to me.
01:55durka42me too, that's why i asked
02:09hiredman http://gist.github.com/51721 <-- I took a stab at (scope ...)
02:16Carkshouldn't you be running the functions backward ?
02:16hiredmanah
02:17hiredmanor I could just change the vectors to lists
02:17Carktrue
02:18hiredmanso fixed
02:19hiredmanclojurebot: horizons?
02:19clojurebotTitim gan �ir� ort.
02:19hiredmanclojurebot: horizons is http://gist.github.com/51721
02:19clojurebotOk.
02:21hiredman~ seen oudeis?
02:21clojurebotoudeis was last seen joining #clojure, 1 minutes ago
02:22hiredmanhuh
02:22hiredmanI could have sworn I saw him part
02:29Cark ~ seen oudeis?
02:29Cark~ seen oudeis?
02:29clojurebotoudeis was last seen joining #clojure, 9 minutes ago
02:46hiredman~ seen mrsolo
02:46clojurebotmrsolo was last seen joining #clojure, 82 minutes ago
02:47hiredmanhmmmm
02:57yoeljacobsenQ: I'm trying to use enclojure and when I try to run the automatically generated project I get the following error: <No main class found>
02:57yoeljacobsenMain class is of course configured..
02:57yoeljacobsenAny idea?
02:58lisppaste8ayrnieu pasted "RFC: apropos.clj" at http://paste.lisp.org/display/74207
03:00hiredmanyoeljacobsen: what is the exact exception?
03:00hiredmanshow us some code
03:01hiredmanlisppaste8: url?
03:01lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
03:01yoeljacobsenNo exception - Netbeans complains for no main class
03:01hiredmanoh, well netbeans I know nothing about
05:00Lau_of_DKThere's a Clojure to-do list on some Backpack(?) site somehwere, anyone got link ?
05:03Lau_of_DKclojurebot: todo?
05:03clojurebottodo is http://richhickey.backpackit.com/pub/1597914
05:03Lau_of_DKbroken link
05:12Lau_of_DKclojurebot: todo is not what you think it is
05:12clojurebotRoger.
05:12Lau_of_DKclojurebot: todo?
05:12clojurebottodo is not what you think it is
05:12Lau_of_DKHmm
06:47drhzThere's a small typo in API decrtiption for (empty? coll). IS ..(seq x) rather than (not (empty? x)), SHOULD BE: ..(seq? x) rather than (not (empty? x))
07:52leafw"things supporting seq and stream" --> why not "Flow"? Or Iterable (although this one exists in java, but it *is*)
07:53Chouserdrhz: nope. (seq x) is right
07:53Lau_of_DKChouser: He quit
07:53Chouseroh. so he did.
07:54YouhouHmm... I think there is a function missing from the zipper API. I need zip/root-loc and it isn't there. I would expect it to behave just like zip/root, but return a location instead of just one node. Am I missing something?
07:55YouhouThe reasoning being -- I've done some "modifications" to my tree, now I want to zip up to the top and pass the root to another function which will walk it again.
07:59ayrnieuwell, the source is here if you want to add this: http://code.google.com/p/clojure/source/browse/trunk/src/clj/clojure/zip.clj
07:59Youhousure -- I just wanted to check, perhaps I'm missing something obvious, or perhaps I'm doing something I'm not supposed to.
08:00ayrnieuI think you haven't missed anything.
08:12acieroidhmm
08:12acieroidIs there some example of how extends java classes ?
08:13acieroidbecause I just found that I have to use gen-class
08:13acieroidbut I don't know how
08:21karmazillaacieroid: "have to use gen-class" - means you have tried with proxy but discarded the approach?
08:22acieroidnot tried proxy
08:22YouhouHmm. Should I write to the group (about zip/root-loc) or submit an issue?
08:22acieroidI didn't find any documentation on this topic, except the api
08:24karmazillaacieroid: gen-class, I think, is for when you need to instantiate objects of the class from Java, or control class creation with main methods.
08:25YouhouIs there something that corresponds to CL's #-(and) idiom? I would like to be able to "comment-out" entire forms, instead of lines...
08:25acieroidok karmazilla
08:25karmazilla,(doc comment)
08:25clojurebot"([& body]); Ignores body, yields nil"
08:25acieroidI'll look at proxy so
08:28YouhouThanks, that's what I was looking for.
08:29FibIs there any way to use a macro with 'apply'? Is the idea of doing so misguided?
08:29YouhouNo, that was not what I was looking for.
08:29YouhouI need a reader macro -- something that will disappear into thin air. (comment) won't let me disable function arguments, for example.
08:31YouhouReading http://clojure.org/reader seems to imply there is nothing of the kind.
08:31karmazillaFib: use a #()
08:32leafwkarmazilla: where is #() documented?
08:32Youhouleafw: http://clojure.org/reader, which I'm reading right now :-)
08:34leafwthanks
08:35leafwas Isuspected, #() is an anonymous function literal ... so that, wrapping a (comment ..), can make it just disappear?
08:36clojurebotsvn rev 1232; made eval use ephemeral classloader in all cases
08:36Fibkarmazilla: what if I have a variable number of args to apply to, though?
08:37karmazillayes, I was wondering about that. You can have %& for var-args in #()'s though
08:37Youhou(comment ...) doesn't do what I need -- I want to disable any form within the code, for example one of function arguments. I just want the reader to skip whatever I marked, something that directly corresponds to CL's #-(and) conditional. I would love to see, for example #!() for this. This
08:40Fibkarmazilla: yeah, but then I'm left with the original problem, since if I have the varargs in the form of a vector, I still need to apply the macro to the varargs
08:40FibI suppose there's always eval...
08:43karmazillamaybe the idea really is misguided :) supposedly, the number of arguments is not known until runtime, but by then all macros are expanded
08:47Fibthat's what I thought :)
08:50ChouserYouhou: I think something like what you want is planned.
08:50ChouserYouhou: for now perhaps you could write your own macro to do it?
08:52YouhouChouser: I don't think I can -- it needs to be a reader macro. My macro will return nil and that nil will remain.
08:53ChouserI'm not saying it'd be as general a solution -- your macro would have to wrap the next level out in order to produce the form you need without the nil in it.
08:55YouhouChouser: then it isn't nearly as convenient :-( -- frankly, it misses the point then, I'd rather reformat the code and use ;; to comment out forms. This really calls for #! or something similar, a built-in reader macro.
08:55YouhouI'm actually surprised no one noticed -- it is such a useful tool when developing code.
08:57Chousuke#! is already a comment though :/
08:57Chousukejust not what you want.
08:58YouhouIt is? That is not documented at http://clojure.org/reader, then.
08:59ChousukeIIRC it was added to make unix-style clojure scripts possible.
09:00YouhouOuch. I see. Well, then #* or anything else, really, but it has to be short and easy to type, as it is used very often. CL actually doesn't make it very easy with #-(and)
09:03Chousukehave you made a post to the group about this yet?
09:29Chouseras I said, this has come up before -- I believe Rich has said it's a feature he plans to include.
09:39YouhouI will post about this -- and about the zipper issue.
12:19BigTomhi
12:20BigTomI am trying to do something like reduce but my reduce function has more than 2 parameters
12:20BigTomone of the parameters is a map for aggregating stuff
12:20BigTomis there an idiom for this?
12:21BigTomI am trying to avoid loops and mutable structures
12:21kotarakBigTom: it depends on what you want to do. Several aggregating parameters, or several lists, which are traversed in parallel?
12:22BigTomseveral parameters
12:22kotarak(reduce (fn [[aggr1 aggr2] list-item] ....) [init-aggr1 init-aggr2] the-list)
12:22kotarakYour fn has to return a vector.
12:23BigTomurgh
12:24BigTomgive me a minute to parse that
12:24kotarakIt uses destructuring in the argument vector.
12:24kotarak((fn [[a b] x] (+ a b x)) [1 2] 3) => 6
12:25BigTomok, thanks
12:26BigTomI am going to go a bit quiet now while I work it through
12:26bergermeisterI have a cool but hard slime problem
12:26bergermeisterAre there any slime experts online?
12:52BigTomkotarak: thanks, getting there now
12:53kotarakBigTom: good to hear :)
12:53kotarakDo you know about destructuring?
13:00BigTomI know the basics
13:00kotarakOk. It's a powerfull tool.
13:00BigTom{:keys [:a :b]} etc
13:00BigTomhaven't used it on vectors so much
13:01BigTommain problem at the moment is when to pick reduce/for/doseq/doall
13:01kotarakdoseq for side-effects w/o return value
13:01kotarakdoall for side-effects w/ return value
13:01WizardofWestmarcreduce is pretty straight forward, when you want to condense a list of values down to one in some form or fashion
13:02WizardofWestmarclike adding all of the ints in a list together
13:02WizardofWestmarcor finding the biggest in the list
13:02kotarakreduce to transform a list into something else
13:02durka42i thought side-effects w/o return is dorun
13:02BigTomI am ok with the basic cases, its aggregating structured data out of list/lists
13:03BigTomI think it is nearly always reduce
13:03kotarakdurka42: dorun over a list containing only nils seems ugly to me. But as always: YMMV.
13:04kotarakI prefer (doseq [line lines] (println line)) over (dorun (map #(println %) lines)).
13:05durka42i agree
13:06BigTomI had to force an evaluation a while back with doall.
13:06BigTomit blew the stack otherwise
13:06BigTomI still haven't worked out why
13:06kotarakdorun/doall might be interesting to get a seq of something depending on a resource. (with-open [stream (open afile)] (doall (map #(do-something-with-line %) (line-seq stream))) or something like that.
13:07BigTomI am trying to get a short version to recreate it
13:20BigTomwhat is the best way to filter specific values out of a map?
13:21durka42there is filter, and remove
13:21durka42for maps dissoc might be useful
13:21duck1123Ok, I think I'm ready to start writing test cases using test-is, does anyone know where a good example of an ant task that runs all test is?
13:22duck1123Or better yet, a way to integrate that with emacs
13:22Chousuke,(hash-map (remove (fn [[k v]] (> v 5)) {:a 6 :b 1 :c 7}))
13:22clojurebotjava.lang.IllegalArgumentException: No value supplied for key: ([:b 1])
13:22Chousukehmm
13:22Chousukenot quite like that I guess :/
13:22BigTomI am using filter but I am struggling to get the value
13:23BigTomYou get a leaf node as the value back from the map don't you?
13:25kotarak,(into {} (filter #(> 0 (second %)) {:a 2 :b 0 :c 7}))
13:25clojurebot{}
13:26Chousukewrong predicate :)
13:26kotarak,(apply hash-map (filter (fn [[k v]] (> v 5)) {:a 6 :b 1 :c 7}))
13:26clojurebot{[:a 6] [:c 7]}
13:26Chousuke,(apply hash-map (apply concat (remove (fn [[k v]] (> v 5)) {:a 6 :b 1 :c 7})))
13:26clojurebot{:b 1}
13:27durka42,(into {} (filter second {:a 1 :b 2 :c nil}))
13:27clojurebot{:b 2, :a 1}
13:29durka42,(into {} (filter #(> (second %) 0) {:a 2 :b 0 7}))
13:29clojurebot5
13:29durka42huh?
13:30durka42,(into {} (filter #(> (second %) 0) {:a 2 :b 0 :c 7}))
13:30clojurebot{:c 7, :a 2}
13:30Chousukethat's: java.lang.ArrayIndexOutOfBoundsException: 5 (NO_SOURCE_FILE:11)
13:30durka42yes, it is
13:30durka42my irc client didn't copy the :c smiley
13:32BigTomwow, almost too much information :-)
13:32BigTomI have it now
13:32durka42breaking news: programmers discover more than one way to do the same thing
13:32BigTomI didn't know about clojurebot
13:32durka42:)
13:32Chousukeinto is nice though.
13:34BigTomYes it is, though I think my problem works better with the list of vectors
13:34BigTom,(+ 1 1)
13:34clojurebot2
13:34BigTomcool :-)
13:34durka42(+ 10 10)
13:34clojurebot*suffusion of yellow*
13:35durka42~seen kotarak
13:35clojurebotkotarak was last seen in #clojure, 8 minutes ago saying: ,(apply hash-map (filter (fn [[k v]] (> v 5)) {:a 6 :b 1 :c 7}))
13:35Chousukefor some reason, clojurebot has a separate maths module that can't count past 7
13:35Chousuke(+ 1 2)
13:35clojurebot3
13:35durka42i thought it was 4
13:35Chousuke,(+ 7)
13:35clojurebot7
13:35durka42(+ 2 2)
13:35clojurebot4
13:35Chousuke(+ 4 4)
13:35clojurebot*suffusion of yellow*
13:35durka42(+ 2 3)
13:35clojurebot*suffusion of yellow*
13:36Chousukehmm? :/
13:36durka42no trouble with negatives though
13:36durka42(* 1234 -27)
13:36ChousukeI wonder why the functionality even is there.
13:36durka42(- 2 1234)
13:36clojurebot-1232
13:38duck1123(+ 2 2) => 5
13:38clojurebot*suffusion of yellow*
13:44durka42clojurebot: (+ 2 2) is 5
13:44clojurebotc'est bon!
13:44durka42clojurebot: (+ 2 2)
13:44clojurebot(+ 2 2) is 5
13:44durka42clojurebot: (+ 2 2) is 5, for large values of 2
13:44clojurebot'Sea, mhuise.
13:45durka42~(+ 2 2)
13:45clojurebot(+ 2 2) is 5, for large values of 2
13:45bergermeisterException in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: clojure.lang.Util.equal(Ljava/lang/Object;Ljava/lang/Object;)Z
13:45bergermeisterCurrent svn has a bug in it.
13:46bergermeisterthat line should real clojure.lang.util.equals
13:48bergermeisternope, it is fixed
13:54duck1123clojurebot: (+ 2 2) is <reply>5 (for large values of 2)
13:54clojurebotOk.
13:54duck1123(+ 2 2)
13:54clojurebot4
13:55duck1123clojurebot: (+ 2 2)
13:55clojurebot5 (for large values of 2)
14:24BigTom(reduce (fn [[n p] c] (+ (* n p) c)) 0 [[2 3] [4 5]])
14:25durka42,(reduce (fn [[n p] c] (+ (* n p) c)) 0 [[2 3] [4 5]])
14:25clojurebotjava.lang.UnsupportedOperationException: nth not supported on this type: Integer
14:26BigTomthanks
14:26kotarakThe 0 is not a vector.
14:26kotarakyou mean probably (fn [c [n p]] ...)
14:27BigTomso I did :-/
14:28BigTomCheers :-)
14:32YouhouOk -- so coming from a CL background, I've been looking for &key. Haven't found it. How do people do without keyword arguments?
14:32YouhouI could probably zip up "& args" into a map and do a destructuring binding -- is there an idiom for that?
14:33kotarak(defn foo [arg1 arg2 & options] (let [{:keys [keyword1 keyword2] :or {keyword1 default1 keyword2 default2}} (apply hash-map options)] ...))
14:33kotarak(foo val1 val2 :keyword2 bar)
14:34clojurebotsvn rev 1233; fixed definline, patch from Chouser
14:34YouhouRight -- but this begs to be turned into a macro -- and I'm puzzled -- am I missing something, or do people think that keyword arguments are not the way to go? Or is such a macro in there somewhere?
14:35kotarakObviously keyword args aren't use often enough to be a pain.
14:38YouhouIntriguing. Perhaps that's because clojure is still young. After a while you do get libraries with functions that take 40 parameters, and then it becomes unwieldy to use positional arguments. (libraries for fetching with http come to mind)
14:38WizardofWestmarcwell as you point out you can cheat by putting a dict as a passed in param
14:39WizardofWestmarcthen you just find which values are valid keys in the set and use that to determine what parts they want to do
14:39YouhouI'm not disputing the language design choice -- I'm just surprised that some sort of popular way of implementing keyword args hasn't emerged yet.
14:39WizardofWestmarcnot as pretty/obvious on skim as the CL way I admit
14:40WizardofWestmarcwell, how many projects of significant size exist on clojure?
14:40BigTomkotarak, durka42 & Chousuke: thanks for the help
14:40WizardofWestmarcbecause until you have some larger things built on it, stuff like that won't become a common problem.
14:40kotarakBigTom: np
14:40danlarkinYouhou: http://paste.lisp.org/display/69347
14:40BigTomI have nailed euler problem 5
14:40BigTomand learned a lot,
14:40BigTomcheers
14:41kotarakBigTom: http://clojure-euler.wikispaces.com SPOILER WARNING!
14:41Youhoudanlarkin: oh, cool -- that's exactly the kind of macro I've been thinking about
14:42BigTomThanks
14:42WizardofWestmarcyeah, lots of spoilers on clojure-euler
14:42WizardofWestmarcbut some SLICK code too
14:42WizardofWestmarcI learned a lot looking at some other people's solutions
14:42Lau_of_DKWizardofWestmarc: You talking about my code cracker? :)
14:42WizardofWestmarclike Chouser's way of calculating triangle
14:43WizardofWestmarcerr triangle numbers
14:43Lau_of_DKoh...
14:43WizardofWestmarcwell, I've only looked at the early ones :P
14:43WizardofWestmarcI don't think I've seen any you posted to the euler wiki yet
14:44WizardofWestmarcI really need to take the time to wrap my head around lazy seqs/etc better
14:44WizardofWestmarcI never realized it could use itself to calculate the value of next w/map
14:45durka42eh?
14:45WizardofWestmarcyou can reference a lazy seq inside it's own definition
14:45durka42how do you do that?
14:45durka42i feel like i've wanted to in the past
14:46BigTomdo they ever use more then one letter for variables?
14:46WizardofWestmarclemme find the fib example, since that one is even crazier
14:46BigTomI think my answers look a lot more verbose
14:47WizardofWestmarcthis is it: (def fibs (lazy-cons 0 (lazy-cons 1 (map + (rest fibs) fibs))))
14:48Lau_of_DKWizardofWestmarc: http://clojure-euler.wikispaces.com/Problem+059 This is the only one I was sorta happy with
14:51WizardofWestmarchm
14:51WizardofWestmarcLau_of_DK: I like the way you build the combinations set list
14:52Lau_of_DKcool
14:53WizardofWestmarcI have to say, euler's proving an even better way to learn clojure then I'd hoped
14:53WizardofWestmarcreally have to dig into the api/clojure-contrib to solve some of them
14:53WizardofWestmarcat least cleanly ;-)
14:53BigTomYeah (though mine are anything but clean so far :-/ )
14:53soothb
14:54soothsorry
14:54Lau_of_DKWizardofWestmarc: We started clojure-euler partly for fun, and partly to do one-up on the other languages who had attempted the same. Then kotarak went and solved 215 and suddenly we werent playing anymore :)
14:54WizardofWestmarchaha
14:54WizardofWestmarcyeah I noticed 215 was posted
14:54kotarakLau_of_DK: yeah, beat me! Harder! Harder!
14:54WizardofWestmarcBigTom: I know what you mean, mine haven't been great beyond the super easy ones
14:54BigTomWell, I shall treat that as a challenge...
14:55WizardofWestmarcbut they're slowly getting better
14:55BigTomThat is my hope too
14:55BigTomI think I'll post me answers so other beginners don't feel intimidated :-)
14:57WizardofWestmarcI've skipped a few problems because I simply don't know a clean enough way to do it to my satisfaction, and I refuse to use the code I see in clojure-euler
14:57WizardofWestmarclike #8
14:57WizardofWestmarcoh, another one I liked was some of the posted answers for 9
14:57WizardofWestmarcit's easy to do that one ugly
14:57WizardofWestmarcbut holy cow the clean way to do it is sexy as hell
14:59BigTom(I peeked for 3 :-/ but it spoiled the fun so I'm going to have to wait to see the others
15:08AWizzArdrhickey: is there something like a call-arguments-limit for Clojures apply?
15:14ChouserAWizzArd: there's no limit on the size of the seq passed to apply. Is that what you're asking?
15:15AWizzArdyes
15:15AWizzArdof course, the limits of the hardware
15:16ChouserAWizzArd: nope, not even that.
15:16AWizzArd;-)
15:16AWizzArdChouser: I wish there were no limits in hardware
15:16AWizzArdbut I think you are talking about lazyness
15:17Chouserwell, I'm not *completely* joking. I believe the seq passed to apply could be too large to fit in memory all at once.
15:17Chouserbut that might not be right. I haven't tested it.
15:18AWizzArdin CL one would for example do (reduce #'+ (loop for i from 1 to 5000 collect i))
15:18Chousukewell, you can pass infinite seqs to apply
15:18Chousukeso why not.
15:19AWizzArdbecause if you put apply at the place of reduce the system *might* complain about it: APPLY: too many arguments given to + (clisp, 32-Bit, Windows)
15:19Chousuke,(apply + (range 5000))
15:19clojurebot12497500
15:19Chousuke,(apply + (range 500000))
15:19clojurebot124999750000
15:20Chousuke,(apply + (range 50000000))
15:20AWizzArdyes
15:20Chousukehmm
15:20clojurebot1249999975000000
15:20Chousukeyay
15:20AWizzArdand the timing does not differ from reduce
15:20Chousukewell, + uses reduce internally
15:22AWizzArd,(with-out-str (time (apply + (range 5000000))))
15:22clojurebot"\"Elapsed time: 338.841 msecs\"\n"
15:22AWizzArd,(with-out-str (time (reduce + (range 5000000))))
15:22clojurebot"\"Elapsed time: 329.607 msecs\"\n"
15:22AWizzArdsame
15:33Chousukeyou don't need the with-out-str
15:34AWizzArd(time nil)
15:34AWizzArd,(time nil)
15:34clojurebot"Elapsed time: 0.09 msecs"
15:34clojurebotsvn rev 1234; Made Atream.Iter an IFn, so can act as generator
15:35AWizzArdWhat does that mean?
15:35AWizzArdwas is an Atream.Iter?
15:35AWizzArdwhat is an..
15:36rhickeyAWizzArd: streams stuff
15:38Lau_of_DKrhickey: All the underlying theory of this streams vs seqs vs nil punning vs speed, where can I go read up on it ?
15:38rhickeyLau_of_DK: there's no single place
15:39Lau_of_DKoh - you wanna do a short webinar then, Ive got Yugma open :)
15:39Chouserthere are still decisions to be made, aren't there? A bit early to document very heavily
15:40rhickeyChouser: right, and the issues are subtle, but it has been discussed here and on the group
15:40Lau_of_DKChouser: I just meant the theory governing these decisions, nothing to do with docs
15:40ChouserLau_of_DK: If you just want to use it when it's done, I'd wait patiently until it's intergrated into trunk. Then people can work up docs, examples, etc.
15:41Lau_of_DKChouser: I still dont want docs / examples, I just want to understand the power of streams in comparison to what were doing now, and why this is contrary to nil-punning, that type of stuff
15:41Chouserif you want in on it earlier than that, I think it's reasonable to expect to have to exert a bit more effort. Search the group, the IRC logs, read http://clojure.org/streams
15:41Lau_of_DKI got that streams will give us something like continuations, but thats it
15:42Chouserhm, I don't think that's right.
15:45Chousukestreams are like unix pipes aren't they. you can only read the data once, and then do whatever you want with it, and pass it forward (or not)
15:47Lau_of_DKIs this in anyway connection with LFE?
15:47ChousukeI don't think so
15:47ChousukeLFE was an alternative model for doing the stream stuff, but I think rhickey scrapped it.
15:49Chousukewhich is good, I think, since I was completely unable to understand how they worked :P
15:53hiredmanno
15:54hiredmanLFE is for safe resoure usage
15:56hiredman~seen rhickey
15:56clojurebotrhickey was last seen in #clojure, 16 minutes ago saying: Chouser: right, and the issues are subtle, but it has been discussed here and on the group
15:58AWizzArdSo, LFE won't make it into Clojure?
16:03ChouserI believe that's correct.
16:06ChouserBDFL said "LFE offered resource management and safety,
16:06ChouserI think scope + safe streams is easier, and definitely faster"
16:07AWizzArdAnd that Atream.Iter stuff is about this issue?
16:09ChouserThat's part of "safe streams", yes.
16:15ChousukeIt's supposed to be AStream though :)
16:17StartsWithKChouser: what do BDFL and LFE acronyms stand for?
16:18ChouserLFE is Left Fold Enumerator
16:18ChouserBDFL is Benevolent Dictator For Life, a.k.a. Rich.
16:18StartsWithK:)
16:19StartsWithKwhat are my options for parser construction under java?
16:20StartsWithKare there any parser combinators like spirit/yard?
16:20Chousukethere's fnparse on github
16:22hiredmanhttp://github.com/hiredman/clojurebot/blob/fe80fe2b641b3b8aba6c5ee4064a61f0737c2b37/hiredman/horizon.clj <-- speaking of scope
16:24durka42The Universe has ended unexpectedly: RuntimeException: Naked Singularity. We apologize for any inconvenience. (A)bort, (R)etry, (I)gnore, Report to (G)od
16:30stuarthallowayChouser: I have added :dir and :env options to shell-out in SVN r413. Also unit tests for the helper functions (but not for sh itself).
16:31Lau_of_DKstuarthalloway: Shell-out was your way of getting the current dir?
16:31stuarthallowayChouser: I am going to let my laptop out of my sight for several hours, but if you find anything that irritates you send me an email or castigate me on the mailing list and I will fix it later tonight. :-)
16:31stuarthallowayLau_of_DK: shell-out is in contrib, and provides a simple "sh" function
16:32Lau_of_DKk
16:32stuarthallowayLau_of_DK: I have added the ability to bind a dir for multiple operations, so I can get some rake-like goodness going in lancet.
16:33Lau_of_DKok :)
16:36Chousukebtw, isn't the new stream-utils.clj in contrib misnamed?
16:36Chousukeshould be stream_utils.clj
17:21cconstantineNewbie to clojure here... I have two vectors ([1 2 3] [1 2 3]) and I want to add them together to get a vector like [2 4 6]. How would I go about doing that?
17:22Chousuke,(map + [1 2 3] [1 2 3])
17:22clojurebot(2 4 6)
17:22Chousukeor ,(into [] (map + [1 2 3] [1 2 3]))
17:22ChousukeIf you really want a vector
17:22cconstantineI knew it was something stupid simple like that, thanks :)
17:24Chousukegenerally though, forcing things into concrete data structures is not as clojurey as just using seqs
17:25Chouser,(vec (map + [1 2 3] [1 2 3]))
17:25clojurebot[2 4 6]
17:25Chousukeright, that too :p
17:26Chouser;-)
17:30AWizzArdrhickey: would it be difficult to put & rest parameters into a vector instead of a list?
17:30ChousukeAWizzArd: yes, as rest can be infinite.
17:30Chousukeit's a seq, not a list.
17:31AWizzArdok
17:31AWizzArdfor macros it would be nice though, as it could reduce time for debugging
17:32Chousukewell you can always do (let [rest (vec rest)] ...)
17:32AWizzArdin several cases where a macro has a & rest parameter and one wants to go through that sequence the typical pattern is '~rest
17:32AWizzArdbut thousands of Clojurists will do ~rest at first, without quoting it
17:32Chousuke'~rest? why? :/
17:33AWizzArd(map identity 'rest) ==> (map identity (1 2 3)) ==> Can't call 1
17:33AWizzArduhm, wrong
17:33AWizzArd`(map identity ~rest) ==> (map identity (1 2 3)) ==> Can't call 1
17:33ChousukeI'd use ~@(map identity rest)
17:33AWizzArdbut `(map identity '~rest) ==> (map identity '(1 2 3)) ==> (1 2 3)
17:33Chousukeor maybe just ~(map identity rest)
17:34AWizzArdyou don't always want to do this
17:34Chousukewell, true.
17:34AWizzArdit's not really a big issue
17:34AWizzArdI just did not think about this infinity thing
17:35Chousukeyeah, your code would get quite bloated if you expanded an infinite list :/
17:35AWizzArdotherwise, if it would have been no problem to put the & rest into a vector one could have thought about it. Would probably not break code
17:36AWizzArdChousuke: well, if your box has infinite memory this may not be a problem anymore
17:36Chousukeor if you could have lazy code.
17:37Chousukesomething that appears in the source file only when it's really read
17:37AWizzArdnice
18:11danlarkinis there a way to get all "handlers" for a multimethod?
18:12Chouser(methods print-method)
18:12Chouserit's new!
18:12danlarkinperfect!
18:16red_fish_,(apply (fn [& rest] (println (first rest))) (repeat "hello world!"))
18:16clojurebothello world!
18:18Chousuke:)
18:24hiredmanclojurebot does not deal with newlines well
18:31durka42i noticed that when i tried to sendMsg-who with \n's in it it was displayed as one message
18:33hiredmanyeah there is some stuff to strip newlines
18:34durka42i didn't know if that is just an irc custom
18:34durka42is it better to send as multiple messages?
18:35hiredmanI dunno
18:49Chouserthe irc wire protocol is newline-separated, I believe.
19:15dreishThere's not much need for ' in clojure, is there?
19:15cooldude127quote?
19:15dreishyes
19:15cooldude127why because of literal vector syntax?
19:15dreishThat and keywords, I think.
19:16danlarkindreish: it's still useful sugar
19:16dreishOh, certainly. I can't imagine a Lisp without it.
19:16dreishI just realized after finishing a 600-line lib that I hadn't used it once.
19:16hiredmanheh
19:17cooldude127lol
19:37danlarkin,(var (val (first (methods print-method))))
19:37clojurebotjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol
19:38danlarkin:( how do I accomplish that
19:39hiredman,(methods print-method)
19:39clojurebot{nil #<core$fn__5228 clojure.core$fn__5228@13bedc4>, clojure.lang.IPersistentMap #<core$fn__5322 clojure.core$fn__5322@1ec4535>, java.lang.Number #<core$fn__5246 clojure.core$fn__5246@4b62a7>, java.lang.Class #<core$fn__5370 clojure.core$fn__5370@88e83d>, java.lang.String #<core$fn__5305 clojure.core$fn__5305@1900f17>, java.util.regex.Pattern #<core$fn__5379 clojure.core$fn__5379@26807f>, clojure.lang.Symbol #<core$fn__52
19:39hiredmanuh
19:40hiredmanyou can't
19:40hiredmanit is all function objects
19:40hiredmanwhat are you trying to do?
19:40danlarkinI want to get metadata for one of the methods
19:41danlarkinfor my own function, not print-method, that's just for example
19:41hiredmanmatedata is attached to the multimethod var
19:42hiredmanthe defmethod stuff have no vars and no metadata
19:42hiredmanunlessyou do something weird and attach metadata to the function object (dunno if that is possible)
19:42danlarkinOh. damn.
19:42danlarkinHmmmmm
19:43danlarkinit would really be nice if the individual methods were allowed metadata
19:43hiredman*shrug**
19:55ChouserI think it'd be nice to be able to put metadata on Fn objects, but that's apparently a bit tricky to accomplish.
20:00danlarkinmetadata on defmethods would be perfect
20:00Chouserdanlarkin: what specific metadata are you looking for?
20:04danlarkinwell I'd like each function attaching itself to the multimethod to define a :help key for printing to the command line
20:05AWizzArdWhat is Clojures equivalent to CLs subseq? (subseq '(10 20 30 40 50 60 70) 3 6) ==> (40 50 60)
20:05Chouserhm... you could write an alternative to defmethod that instead of adding a fn to the table, adds a Var instead.
20:06hiredman,(doc subseq)
20:06clojurebot"([sc test key] [sc start-test start-key end-test end-key]); sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true"
20:06ChouserVars, when called, deref and call their value, so it ought to work transparently, but you'd have a place to hang some extra meta-data.
20:06AWizzArdyes, I've already seen that hiredman. That is not the equivalent.
20:06hiredmanI see
20:07ChouserAWizzArd: (take 3 (drop 6 myseq))
20:07AWizzArdI need something like subvec, but for lists
20:07hiredmanI just knew there was something called subseq, and wanted to see what the difference is
20:07Chouseroh, (take 3 (drop 3 myseq)) I guess
20:08danlarkinChouser: here's the body of defmethod: `(. ~multifn addMethod ~dispatch-val (fn ~@fn-tail)))
20:08Chouserdanlarkin: yes
20:08AWizzArdChouser: oki, that would do it, thx
20:33danlarkinlisppaste8: url
20:33lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
20:33lisppaste8danlarkin pasted "defmethod using vars" at http://paste.lisp.org/display/74247
20:34danlarkinChouser: there's my attempt
20:34danlarkinkinda works
20:34Chouserheh
20:34Chouser"kinda"?
20:34danlarkinwell it doesn't get the metadata I assign
20:34danlarkinbut it does have :ns and :file and :line etc
20:34Chouserah
20:38Chouserit might be easiest to accept another arg for the meta-map
20:38Chouserlike defn does
20:38Chouserotherwise, if you want to use #^{} before the multifn, you might be able to extract the metadata from that symbol and apply it to the var
20:39danlarkinyeah I'm looking at the definition of defn now
20:56Chousergreatest-by and greatest already differ only by a predicate, but I guess always providing 'identity' as a first arg for the common case of would be a bit annoying.
21:00Chouserhaving the defaults act like all-* and using 'first' when you only want one would be sligtly less memory efficient if there are lots of equally-maximal values. Would that be acceptible, or is the goal of reducing the number of global vars not sufficent?
21:03gnuvince_Chouser: I guess it depends; if it stays in its own module, I don't see the problem.
21:04gnuvince_Also, I'd would prefer if I only had to write (greatest x y) instead of (first (greatest identity x y))
21:04Chouserheh. yeah.
21:06gnuvince_I looked at it last night, and the only way to reduce the number of functions is to make the interface more awkward (IMO)
21:06ChouserHas Jason Wolfe responded to your code at all?
21:06gnuvince_no
21:07ChouserI agree the number of functions is not a problem if it stays in its own lib
21:08Chouserhaving a whole lib for these seems a little extravagant. I guess it's not a big problem yet.
21:08gnuvince_It doesn't really fit into any other existing library
21:12aperotteChouser: I noticed your discussion on google groups about accessing this in gen-class and setting things post-construction. Has there been any more talk about how to get around those constructor issues?
21:39danlarkinHm... (my-defmethod manager-dispatch :default #^{:foo 'bar} [& args] (println args)) is very weird, the my-defmethod macro doesn't get passed the metadata map... it's like I didn't type it
21:42Chouserpassed using #^{} or just {} ?
21:43danlarkin#^{}
21:43cooldude127danlarkin: that probably won't work
21:43cooldude127it will try to attach that map to the thing after it
21:44cooldude127use a plain map
21:44danlarkinbut it works with defn :(
21:44Chouserit gets attached to the following symbol
21:44cooldude127exactly
21:45Chousertry (prn (meta muti-name)) in there somewhere
21:46danlarkinHm. yep, gets attached to the thing after it
21:47danlarkinso I guess (my-defmethod #^{:foo 'bar} manager-dispatch :default [& args] (println args)) should be the syntax?
21:52gnuvince_Any of you guys actually works with Clojure?
22:02hiredmanhuh?
22:02Chouseryou mean get paid for writing Clojure code?
22:06hiredmanI often find myself writing clojure while I am work...
22:07LordOfTheNoobsAt work and for work tend to be somewhat different things of course. :)
22:07hiredmanindeed
22:09gnuvince_Chouser: yeah
22:25arohnerI had a totally random idea, that sounded kind of cool
22:25cooldude127do tell
22:26gnuvince_indeed
22:26arohnerlet's say I have a function named foo, that I want to do some argument checking, and the arguments are such that it can be done at compile time
22:26arohnerI could make a macro that shadows foo, does the argument checking and then calls the fn-foo, right?
22:27arohneri.e. (defn foo ... )
22:27hiredmanno
22:27hiredmanmacros and functions share a common namespace
22:27arohnerhiredman: why not?
22:28hiredmancalling foo inside a macro called foo would just be a recursive macro
22:28hiredmanin clojure macros are functions with special metadata
22:29arohnercould I rename the old function during the macro call?
22:29hiredmanno
22:29hiredmanbecause creating the macro clobbers the function
22:31arohnermaybe it would require an extra step, but this still seems possible
22:31hiredman:P
22:31arohnerbecause wrapping fns is easy and well known
22:31arohner(defn foo ... )
22:32arohner(compile-check foo (assert-args ...))
22:32arohnerwhere compile check is a macro that takes the name of an existing defn
22:32hiredman*shrug*
22:32arohnerit would move foo to a new name, and then create a new macro named foo
22:32hiredmanthe thing is
22:33orange80acan anybody recommend a good Clojure tutorial for an experience java programmer who knows nothing about lisp-related languates?
22:34hiredmanfunction application happens at a different stage then macro expansion
22:34arohnerafter, right?
22:35hiredmanso really you want another function
22:35hiredmana macro would do the swapping sure
22:35hiredmanbut the assert stuff you would need another function
22:35arohnerI was looking to use a macro to get 'compile time checking', in the case where the arguments can be validated at compile time
22:36hiredmannot gonna happen
22:36arohneroh, ok, I see the problem
22:36arohnereven if the macro expanded to everything I want, that code still won't get run until my function is called at run time
22:38ayrnieuHedgehog had a special form that would generate an error if it survived macroexpansion.
22:38LordOfTheNoobsclojurebot: what is tutorial?
22:38clojurebotTitim gan �ir� ort.
22:39ayrnieuorange, you could try running a scheme tutorial by clojure. You'll need to do a bit of translation.
23:37technomancydang; scala and clojure are neck-and-neck on github
23:37technomancytheir book isn't even in beta yet though; weak sauce!
23:43gnuvince_technomancy: they got a few books out
23:43gnuvince_http://www.amazon.com/s/ref=nb_ss_gw?url=search-alias%3Daps&amp;field-keywords=scala&amp;x=0&amp;y=0
23:44technomancyoh; I thought the prags' one was the first
23:44technomancygnuvince_: that's only two books. one of them is out of stock, and one of them is pre-order.
23:45technomancyclojure wins again!
23:46technomancyheh... "Programming Scala" and "Programming in Scala"... these guys should communicate with each other