#clojure logs

2012-01-11

00:50alexbaranosky(partition 0 [1 2 3]) :(
01:50echo-areahttp://pastebin.com/J5tbgPFm
01:50echo-areaCould somebody please take a look at it
01:50echo-areaWhy is the `recur' at line 8 not considered a tail call?
01:53echo-areaAnd why is `recur' inside `finally' not considered a tail call?
01:53echo-areaThanks
02:23clj_newbboth len & length are nil -- does clojure have a builtin function for returning the length ofa list?
02:26echo-areaclj_newb: I'm also new to Clojure, don't know if this is good or not: (.size list)
02:27clj_newb.length works
02:27clj_newbhow does .length and .size differ?
02:27echo-areaYes these works, but I don't know if these are really safe to use
02:27gf3clj_newb: count
02:27gf3&(doc count)
02:27lazybot⇒ "([coll]); Returns the number of items in the collection. (count nil) returns 0. Also works on strings, arrays, and Java Collections and Maps"
02:28anntzerhi, it seems that marginalia isn't picking up docstrings of namespaces that are "empty" (i.e. just (ns some.name.space "Some docstring."))
02:28anntzeris that correct?
02:33clj_newbecho-area , gf3 : nice, thanks
02:34clj_newbdumb question: is there anythign like gdb, or the ability to run a repl @ the point of an thrown assertion in clojure? I'm kind of tired of writing detailed assertion messages, and would really like iether gdb, or a repl to examine the frame at which the error has been thrown
02:58clj_newbis there a way to combine a defn w/ a with-meta?
02:58clj_newbi.e. I want to a funciont that I defined to have meta data attached to it
03:03G0SUBclj_newb: use def, fn & with-meta
03:03clj_newbis there a short hand for (def x (with-meta (fn ...) {data})) ?
03:03G0SUBclj_newb: where do you want to put the metadata in? you can have it in the var (x) or the function object.
03:04G0SUBclj_newb: if you want the metatdata to be in the var, use something like this - (def ^{:my-meta 42} x (fn [...
03:06clj_newb(thinking)
03:06clj_newb( I want the meta data attached to the function )
03:06clj_newbthese functions are predicates
03:07clj_newbwhen they throw asertion errors, I want the function to also print out its meta data
03:07G0SUBclj_newb: if you want to put the metadata in the fn object, you'll need with-meta. (with-meta (fn [] …) {:x 1})
03:07clj_newb(info on what the function does)
03:07clj_newbG0SUB: noted; thanks
03:08G0SUBclj_newb: using with-meta you can put metadata in existing fns as well.
03:08clj_newbi can create new objects that is the old fn + meta data
03:08clj_newbnot insert into old fn
03:08clj_newbis that correct?
03:09G0SUBclj_newb: yes, you are right.
03:09G0SUB(def my-first (with-meta first {::x 1 ::y 2}))
03:10G0SUBclj_newb: with-meta will return a new object. it doesn't alter the existing one.
03:18kcin~zip
03:18clojurebotzip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c))
03:20Fossi:o
03:22G0SUB~zipmap
03:22clojurebotGabh mo leithscéal?
03:23G0SUB~(doc zipmap)
03:23clojurebotTitim gan éirí ort.
03:23clj_newbis thre a good book on the design & implementation of clojure? i'm looking for somethign deper than "Programming Clojure"
03:23G0SUBclj_newb: the joy of clojure.
03:29kralhi all
03:45Blktgood morning everyone
03:46AWizzArdHey Blkt.
03:46Blkt:D
03:54Raynes&(doc zipmap)
03:54lazybot⇒ "([keys vals]); Returns a map with the keys mapped to the corresponding vals."
04:34drdoIs there a fastcgi library?
04:38AWizzArddrdo: I guess there is fastcgi support for Java. That could possibly be used for Clojure too.
04:48maio&(+ 1 1)
04:48lazybot⇒ 2
05:24G0SUBbartj
05:49tsdhIf I have an object o and a method name m given as a symbol, how can I invoke that method on o? (. o m) will try to invoke literally a method m. Usual java reflection, then?
05:51raektsdh: yes. there is a useful method for that: clojure.lang.Reflector/invokeInstanceMethod
05:52tsdhraek: Great. Thank you.
05:52raektsdh: if the name is avalable at "compile time" (i.e. when your program starts up and the top levels of the namespaces are evaled) then you can use a macro
05:53tsdhSure, memfn.
05:53raekno, you will have the same problem with memfn
05:53raek(memfn is just an older alternative to #(...)-style anonymous functions)
05:55raektsdh: example: (def method-name "foo") (defmacro call-foo [o & args] `(. ~o ~(symbol method-name) ~@args))
05:56raek(call-foo object 1 2 3) will then expand to (. object foo 1 2 3)
05:56raeknote that macro arguments are not evaluated, but you can still access previously defined values
05:57tsdhI see. Well, I think I don't want to force compile-time availability of classes. invokeInstanceMethod() is not exactly what I want, because I don't want to throw an exception if that method is not defined for the given object.
05:57raekwhat do you want to do instead?
06:00tsdhSimply return nil
06:02raekI guess you could either catch that exception and return nil or use the Java reflection api directly, try to look up the method, and invoke it if it exists
06:03tsdhraek: I'm doing the latter right now.
06:03raekthe first approach will result in way smaller code, but you have more control in the second (e.g. you can choose exactly which method to invoke if it's overloaded)
06:05raekbeware of the security implications, don't let unsanitized user input control which method on which class is invoked, etc, etc :-)
06:05tsdhraek: Well, actually I want only zero-arity method with matching name. I just feared that catching exceptions might be slower than picking myself.
06:06raekwhy slower? I would expect it to be about the same.
06:07raekbut yeah, exceptions for control flow is bad and all that
06:07tsdhThat's what I've read somewhere sometime too, but it might be an urban myth...
06:09raekanyway, I doubt that it will be the performance bottleneck of your app
06:27tsdhraek: Yeah, I'll try both versions and then we'll see.
08:26lnostdal,(remove #{1} [0 1 1 2])
08:26clojurebot(0 2)
08:26lnostdalmh, remove is missing a :count keyarg :P
08:27lnostdale.g., (remove #{1} [0 1 12] :count 1) => [0 1 2]
08:27lnostdalups, meant, (remove #{1} [0 1 1 2] :count 1) => [0 1 2]
08:32G0SUBlnostdal: fair point. but start, end, keyfn etc. would be useful as well, don't you think?
08:43lnostdalG0SUB, yup, i miss them quite a lot at times :)
08:43lnostdali'm doing what feels like a "hack" using with-local-vars and mapcat now
08:43G0SUBlnostdal: lol. I think you'll love the fact that you don't need to look up CLHS every time :-)
08:46G0SUBlnostdal: do you just need the count or do you need the other options as well?
08:46lnostdalCLHS is awesome!
08:47lnostdaland there was no looking up; just F1 in emacs via shortcut key and it was right there
08:47G0SUBlnostdal: no doubt. I loved CLHS as well.
08:47G0SUBlnostdal: C-cC-dd
08:47lnostdal..or it was also there at the bottom of emacs; slime "status bar" there showed all required and keyword args
08:48lnostdal,(let [blah 42] (with-local-vars [blah blah] (var-get blah)))
08:48clojurebot#<Var: --unnamed-->
08:48lnostdalnot sure what's going on there
08:49G0SUB,(let [blah 42] (with-local-vars [blah :nambla] (var-get blah)))
08:49clojurebot:nambla
08:49lnostdalyeah
08:50G0SUBlnostdal: is this not what you expected?
08:50lnostdalthat is, but not the one before
08:50G0SUBlnostdal: why? you were binding blah to itself apparently
08:51G0SUB,(let [blah 42] (with-local-vars [blah 'blah] (var-get blah)))
08:51clojurebotblah
08:52cemerickG0SUB: congrats on having your talk accepted :-)
08:53G0SUBcemerick: thanks! I need to work on the talk now.
08:53cemerickheh
08:53cemerickI don't think anyone ever constructs their talk before submitting it. ;-)
08:53G0SUBcemerick: your talk is going to be great as well, I am sure.
08:53G0SUBcemerick: you don't? :-P
08:54cemerickI do a loose outline, and then make sure to do a dry-run on a smaller crowd ahead of time.
08:54lnostdalok, yeah, so it's not evaled .. kind of surprising, i think
08:54cemerickIt's easier for me this time around; I'm not doing anything super-technical.
08:54G0SUBcemerick: that's the trick. I will do a dry run as well, with my team
08:54cemerickAfter the book, I'm mostly just looking to have fun for a while. ;-)
08:55G0SUBcemerick: the book is like having a child.
08:55cemerickget the fuck *OUT*! ;-)
08:56G0SUBcemerick: haha. but you are in the esteemed company of a certain Grand old man. I hope that helped.
08:56cemerickhah
08:56cemerickIndeed, he has some gems in there.
09:47solussdhow do I capture *out*, but only for the output of one function call, not the output of function calls that produce input to the function call I want to capture *out* of (e.g. using with-out-str)?
09:48di-csuehscan you wrap that call in a bind?
09:48di-csuehsoh...but you want what it calls to still get the usual *out*
09:48solussdexample (let [result (function-with-printlns-i-do-not-want-to-capture)] (with-out-str (function-printing-to-out-that-i-do-want-to-capture result)))
09:50solussdnote that the second function takes 'result' as an argument. since 'let' is just a lexical thing with-out-str catches everything printed form the first function too. :/
09:51di-csuehslet is a special form. I wonder if that is what is biting us.
09:51di-csuehsI would expect result to be the result of calling function-with-printlns-I-do-not-want
09:51di-csuehsbut I am still new to clojure
09:52raeksolussd: you can use 'binding' to give *out* another value, e.g. a StringWriter
09:52raekyou might need to wrap it in a PrintWriter also
09:52solussdwhat I need is 'result' to hold the value returned from the first function, but, referential transparency dictates that the function call and its result should be interchangeable….
09:53kumarshantanuhi
09:53di-csuehsRaek, can we count on result to hold results of the fx call or will it be somehow lazily evaluated later in the with-out-str or binding?
09:53manuttersolussd: what if you wrap the "silent" function in it's own with-out-str binding, and then just discard the str?
09:53solussdraek: you mean to capture the output of the first function?
09:53raek,(let [result ..., sw (StringWriter.), pw (PrintWriter. sw)] (binding [*out* pw] ... result ...))
09:53clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ... in this context, compiling:(NO_SOURCE_PATH:0)>
09:53kumarshantanucan anybody point out what's wrong with this macro….
09:53kumarshantanu(defmacro altering [dvar valu & body] (try (alter-var-root ~dvar (constantly ~valu)) ~@body (finally (alter-var-root ~dvar (constantly ~dvar)))))
09:54raekkumarshantanu: first of all, no syntax-quote (`)
09:54solussdwell the first function isn't silent, per se, I want it to print to stdout. :D
09:54manutterwrap it in a binding to *out* that restores stdout then?
09:54kumarshantanuraek: thanks!
09:55solussdmanutter: that's it!
09:55raekonly the code in the body of 'binding' will have its output redirected and captured
09:55solussdI feel dumb now. :D
09:55raeksolussd: IIRC, you can then call .toString on the StringWriter to get what has been written to it
09:56di-csuehssolussd: nah, sorry.
09:56raeksolussd: you can also check the source code of with-out-str: (source 'with-out-str)
09:58solussdwhat is *out* bound to, by default?
09:58raeksolussd: a PrintWriter that writes to System.out
10:00raekwith the "platform default" encodig
10:03caspercIs there any way to do destructuring and call a function in one go?
10:05caspercsomething like (let [result (function (:val map))] ...do stuff..), but with destructuring
10:05raekcasperc: destructuring of result or map?
10:05caspercraek: i apologize for not thanking you yesterday btw, your tip helped me but I got pulled away before i got the chance to thank you
10:06raekno worries :)
10:06caspercin this case map
10:06raekwell, you can always destructure map where it is bound
10:07caspercnot sure I get your meaning
10:07raek(defn foo [{:keys [val], :as map}] (let [result (function val)] ...))
10:07raekassuming it was (def foo [map] ...) before
10:07caspercyes
10:08casperci guess i was trying to avoid the extra let in order to call the function
10:08raekdestructuring can only be done where you give a name to a value, e.g. in a let or a formal parameter of a function
10:09raekthe point is, you still have to "let" map somwhere, right?
10:09raekyou can do the destructuring there
10:09caspercaye, but I can't call the function :)
10:09raek(unless it's a global var, though)
10:10caspercguess i am just trying to think up something which there is no syntax for
10:10caspercthanks again :)
10:10raekanyway, using (:val map) to pick out the :val value is perfectly fine too
10:11caspercyeah, I was just trying to destructure and validate my input in one go
10:11caspercin fact a macro might do the trick actually
10:18solussdraek: I tried this: https://gist.github.com/1595144 but no luck-- it works when rebinding dynamic versions of 'str', but not with *out*
10:20TimMcsolussd: What happens when you run that?
10:21solussdTimMc everything that is printed is returned in the string
10:23TimMcsolussd: Could laziness be screwing this up?
10:23TimMcWait, it's kind of fucked up to put with-out-str in a -> macro...
10:24solussdI'm trying to 'println' from the function that creates the arg 'directory-records', which is a seq, so it is lazy, but you'd think the inner binding (which is inverted thanks to the threading macro) would bind *out* to the right thing once the seq is realized..
10:24solussdTimMc: :) I tried it without the -> macro too.. same
10:24solussdthe expansion looks fine
10:24TimMcIt's hella confusing with the ->
10:25solussdi agree- with the bindings and let it is.. it wasn't before that though
10:25solussdi'll clean that up
10:26solussdbefore it was simply (-> my-map xml/emit with-out-str)
10:27TimMc&(str "[" (let [out-er *out*] (with-out-str (print "before") (binding [*out* out-er] (print "while")) (print "after"))) "]")
10:27lazybotjava.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!
10:27TimMc,(str "[" (let [out-er *out*] (with-out-str (print "before") (binding [*out* out-er] (print "while")) (print "after"))) "]")
10:27clojurebotwhile
10:27clojurebot"[beforeafter]"
10:27TimMcSo the theory is solid.
10:29solussdthrowing the seq in a do…
10:29solussdhm. same problem. wtf.
10:29TimMcdoall
10:29solussdah
10:30TimMcRight around the map.
10:31TimMcbinding and lazy seqs do not play well together
10:31solussdyay! do all fixed it!
10:31solussdthanks!!
10:32solussd*doall, damnyouosxautocorrect
10:32TimMcxml/emit prints to *out*?
10:32TimMcI see, you're intended to bind *out* around that.
10:34solussdweird… actually, only the first of my printlns from the function that creates directory-records makes it to stdout- the rest end up in the returned string
10:35solussdthat makes no sense
10:36llasramI'm late to the party, but why can't solussd just use `let' to capture the results of the first function (allowing it's *out*put to get printed as usual), then capture the output of the second with `with-out-str'?
10:36solussdllasram: let is a lexical thing- it's really just creates a lexical name for the form its naming
10:37llasramYes... But it also controls evaluation order for side-effects
10:37solussdllasram: maybe ill try that now that i'm forcing evaluation of the seq with 'doall'
10:37llasram,(let [a 1, b (println a), c (println "also"), d 2] d)
10:37clojurebot1
10:38clojurebotalso
10:38clojurebot2
10:38llasramNot the best example, but you get the gist
10:42raeksolussd: do you know what 'binding' is used for?
10:42solussdraek: rebind dynamic vars
10:43solussd:)
10:43raekgood. :) did you manage to get it working?
10:43solussdweird- llasram's advice still only prints the first println to stdout
10:43solussdbinding is a dangerous but awesome tool.
10:44llasramsolussd: Actually, re-reading one of your last messages, let does *not* "just create a lexical name for the form its name". It *evaluates* the form, and creates a lexical name for the result of the evaluation
10:44raekok, so you figured out that you need doall around map
10:45solussdllasram: that's interesting to know-- i always assumed it leaned on referential transparency to not do that and say it's 'ok' it doesn't. :)
10:45solussdbut side-effects, e.g. printing, are a good reason for it to not work like that
10:46raeksolussd: also note that binding gives the var a thread local value temporarily. when the control leaves the 'binding' form, the value of the var is whatever it was before it entered it
10:46solussdraek: yup. knew that.
10:47TimMcsolussd: I don't know anything about to-xml-struct. Does it return a lazy seq itself? That is, the map might not be the only level of lazy.
10:47solussdwell thanks for the help-- off to work- will open this back up then.
11:02tsdhHow do I check if an object in an array?
11:05mdeboardtsdh: http://stackoverflow.com/questions/3249334/test-whether-a-list-contains-a-specific-value-in-clojure ?
11:06tsdhUps, I've meant "if an object *is* an array".
11:06tsdhSomething along (array? (to-array [1 2 3])) => true
11:06TimMc&(.isArray (class (int-array 5)))
11:06lazybot⇒ true
11:07tsdhTimMc: Thanks.
11:07TimMcThere might be something better...
11:07TimMc$findarg map % [(int-array 5) [] 6] [true false false]
11:07lazybot[]
11:07meliponeI want to create a table mapping keys to count and I just want to keep track of the most common, say 1000, keys. What's the best data structure to do that in clojure?
11:08tsdhTimMc: What's that? $findarg
11:08TimMctsdh: It's a lazybot command.
11:09tsdhI guessed so, but what does it do? Or where are the docs?
11:09TimMcIt tries a bunch of core functions for the placeholder (%) and sees which ones make the statement true.
11:09tsdhOh, cool.
11:10TimMc$findfn 2 2 4 ; related command
11:10lazybot[clojure.core/unchecked-multiply clojure.core/+ clojure.core/* clojure.core/unchecked-add clojure.core/+' clojure.core/unchecked-multiply-int clojure.core/*' clojure.core/unchecked-add-int]
11:10manuttermelipone: how many keys are we talking about here?
11:10meliponemanutter: maybe 4000 keys
11:11TimMcmelipone: You want to cache the results of a function?
11:11meliponeTimMc: yes
11:12manuttersomebody was doing an enhanced caching/memoizing lib recently, weren't they?
11:12manutterI want to say it was fogus, but I don't remember
11:14meliponeIn Java I would do that with a treemap to keep track of the highest counts in the map.
11:14jsabeaudryI see that clojure.string.replace allows me to replace characters by other characters but what about replacing a character by nothing (aka removing it)
11:14jkkramermanutter: https://github.com/clojure/core.cache
11:15manutterYeah, that's it
11:16manuttermelipone: what jkkramer said
11:17TimMc,(require 'clojure.string)
11:17clojurebotnil
11:17TimMc,(clojure.string/replace "foo" "o" "")
11:17clojurebot"f"
11:17meliponethanks! I'll look at that
11:18TimMcjsabeaudry: ^
11:18TimMcBut be careful with replace, I think it uses String/replaceALl, which is terrible and should be avoided.
11:18jsabeaudryTimMc: Oh, heh, slow morning, thanks for the wake-up call :D
11:19jsabeaudryTimMc: How so?
11:19jsabeaudryTimMc: What should be used instead?
11:19TimMcI wrote my own.
11:20TimMcLet me check on soemthing...
11:20jsabeaudryTimMc: (str (filter... I guess but what is the problem with java's replaceAll ?
11:20meliponeoff-topic: is there an @ command in IRC?
11:20jsabeaudrymelipone: What is an @ command?
11:22tsdhHow can I get the class object of a primitive type?
11:22franksQ: can i somehow use slurp to read from *in* till EOF? (asked this yesterday, but didn't get ny working suggestions while i was online... )
11:23TimMcjsabeaudry: Never mind, replace is safe.
11:23meliponejsabeaudry: it's a twitter command that let's you put the name of the person you want to talk to
11:23TimMcmelipone: You just did it.
11:24meliponeTimMc: okay. I just wrote your name. Simple, he?
11:24TimMcIf your IRC client doesn't specially mark lines where someone says yourname: then get a new IRC client!
11:25TimMcYour client should also tab-complete usernames at the beginning of a line.
11:26franksTimMc: any IRC-client recommendations for mac
11:27TimMcjsabeaudry: Look at replace's docs. If you give it a j.u.r.Pattern, the string replacement is weird, unless you pass it through j.u.r.Matcher/quoteReplacement to make it a literal.
11:27TimMcfranks: No idea, I'm on GNU/Linux. I use a terminal program called irssi which I'm reasonably happy with.
11:27blakesmithMmm... irssi
11:28blakesmithirssi is in homebrew, so you can install it on a mac if you want.
11:28semperoscolloquy on mac is nice
11:29semperosirssi takes a little bit of dedication to get comfortable with :)
11:29technomancyplus you have to not be allergic to perl
11:30frankssemperos: tried colloquy, but didn't let me search - felt it was half baked
11:31manuttermmm, perl...
11:32franksterminal-based irc-client... the mac has turned me into too much of a softy for that...
11:35jsabeaudryfranks: I beleive I used XChat Aqua before and it was fine.
11:35fridimif you are "allergic" to perl (I think it's suitable for scripting irssi script.. but nvm), there is still weechat that supports other languages
11:36lucianfranks: i liked LimeChat
11:38pandeiroemacs for everything. there, i said it.
11:38franksJust found "Linkinus"... seems to be in active development/support...
11:40llasramUsing ERC here. If you use Emacs, I see little reason to use any other client
11:40pandeiroattaboy llasram
11:41TimMctechnomancy: I haven't had to touch perl in my use of irssi.
11:41meliponellasram: I use emacs.
11:42franks(... waiting for the vi-boys to react and witness this age-old feud to play out again for the gazillions time ;-) )
11:42meliponeTimMc: thanks! it worked!
11:43TimMcfranks: Does vi have an IRC client?
11:43pandeiroTimMc: touche'
11:43pandeiroDoes vi have org-mode?
11:43franksTimMc: wouldn't know as I used to use emacs...
11:44TimMcfranks: There's really not very much sparring in here over emacs and vi.
11:44meliponeboys, don't start the editor wars again ...
11:44TimMcI think vi is the second most common editor used by people in this channel.
11:45llasramYarh, geez. I was just trying to say that ERC is a pretty solid client, and if you already use Emacs, you might as well IRC with Emacs
11:45lucianbut i really liked LimeChat, enough that i'd like to write my own cross-platform version
11:45pandeirollasram: i was just horsing around, vim is great, emacs is great, everyone wins... some just win a little more
11:46TimMcI use Emacs locally, and my IRC client runs under screen on a server. Using ERC would be really annoying.
11:46TimMcunless I had a bouncer, I guess.
11:46pandeiroTimMc: i assume ERC can't connect to your server as a proxy or something?
11:46frankslucian: thanks - I'll take a alook at LimeChat
11:47TimMcpandeiro: No idea. NOt enough motivation to muck round.
11:47TimMc*around
11:47pandeiroTimMc: i've never even looked at the manual for ERC, but that's what i love about it..
11:47pandeirozero features, zero configuration
11:48TimMcSounds Mac-ish.
11:48pandeiroyeah but you don't need to send money to Apple
11:49franksHow do i easily convert a string into a var that i can use in (doc ...)?
11:51franksHow to I get a fully qualified symbol from a symbol? (kind of lost in the string, (fully qualified) symbol, var, namespace...)
11:51cemerick,(resolve (symbol "reduce"))
11:51clojurebot#'clojure.core/reduce
11:52cemerickdoc is a macro that dumps the :doc metadata of a var to stdout; presumably that's not what you want?
11:55franksI want it in a string, and was looking at (with-out-str (doc reduce))
11:55cemerick,(-> "reduce" symbol resolve meta :doc)
11:55clojurebot"f should be a function of 2 arguments. If val is not supplied,\n returns the result of applying f to the first 2 items in coll, then\n applying f to that result and the 3rd item, etc. If coll contains no\n items, f must accept no arguments as well, and reduce returns the\n result of calling f with no arguments. If coll has only 1 item, it\n is returned and f is not called. If val is suppli...
11:55TimMcsniped
11:57TimMcdoc does a little more than that, actually
11:57TimMc&(macroexpand `(doc reduce))
11:57lazybot⇒ (clojure.core/doc clojure.core/reduce)
11:57TimMcgrr
11:57cemerickyeah, well, whatever ;-)
11:58pandeiro&(macroexpand-1 `(doc reduce))
11:58lazybot⇒ (clojure.core/doc clojure.core/reduce)
11:58cemerickhuh, ns documentation is broken via doc
11:58TimMcI'm wondering if lazybot's doc is a function...
11:59TimMc&doc
11:59lazybotjava.lang.RuntimeException: Can't take value of a macro: #'sandbox6832/doc
11:59TimMcnope!
11:59TimMc&(macroexpand-1 `(clojure.repl/doc reduce))
11:59lazybot⇒ ((var clojure.repl/print-doc) (clojure.core/meta (var clojure.core/reduce)))
12:00franksnice bot!
12:01TimMc$botsnack
12:01lazybotTimMc: Thanks! Om nom nom!!
12:01pandeirostrange that it shows doc being in clojure.core, that's not right is it?
12:01llasrampandeiro: That's the just symbol-resolving result of syntax-quote
12:01TimMcllasram: It works correctly in my REPL though.
12:01pandeiroyeah mine too
12:02llasramEr, s,symbol-resolving,namespace-scoping,
12:02TimMcWhatever you call it, lazybot is doing it differently.
12:02TimMc,`(doc reduce)
12:02clojurebot(clojure.repl/doc clojure.core/reduce)
12:03TimMcclojurebot: Slow, but sometimes even correct.
12:03clojurebotNo entiendo
12:03llasramWhich version of Clojure and which REPL? It was moved in 1.3, and clojure.repl isn't included by default, but IIRC `lein' will pull it in under some circumstances
12:04franksstill not clear how you would convert a string into something that doc groks... (doc (resolve (symbol "reduce"))) doesn't work
12:04franks&(doc (resolve (symbol "reduce")))
12:04lazybotjava.lang.SecurityException: You tripped the alarm! resolve is bad!
12:06franksgetting to the :doc property is nice, but doc also give you the arity and such
12:06franks... and i just like to understand how and why this string/symbol/var mapping works...
12:07TimMcfranks: doc is a macro, it expects a symbol literal.
12:08TimMc&(doc (quote reduce))
12:08lazybotjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol
12:09llasramAnd the `print-doc' function form it uses internally is private, so I think you're out-of-luck when it comes to directly applying the clojure.repl code :-/
12:09TimMcYou can get around that. :-)
12:09llasram(I mean, you could reach in and use the function anyway, but etc etc)
12:09llasramYes yes :-p
12:11semperosI find it surprising how often I've found private core functions useful in my apps
12:12TimMc&(-> #'reduce meta (#'clojure.repl/print-doc))
12:12lazybot⇒ ------------------------- clojure.core/reduce ([f coll] [f val coll]) f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll con... https://refheap.com/paste/233
12:15pandeirois there something i can use to iterate over two sequences at the same time?
12:17TimMcpandeiro: (map ... (map vector ...))
12:17pandeiroTimMc: thanks, i think for can do what i want but i've screwed it up somewhere
12:17TimMcOr hell, just (map f s1 s2)
12:18TimMcpandeiro: (for [x s1 y s2] ...) does a cartesian cross
12:18pandeiroTimMc: thanks, that was the issue... i glanced at the docstring but hadn't digested it
12:19pandeiromap is better in this case
12:19pandeiroit's weird using map to produce side effects
12:20TimMc&(doc doseq)
12:20lazybot⇒ "Macro ([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."
12:20pandeiroTimMc: yeah but then I want the op to eval to true if it succeeds
12:21pandeiroso i am gonna use (every? #(not (nil? #)) (map ...))
12:21llasramWhat about `reduce' then?
12:22TimMcpandeiro: (every? identity ...)
12:22pandeiroTimMc: nice llasram: i admit my mind still has issues comprehending reduce well enough to use it
12:22llasramOh, yeah, nm -- early abort
12:22pandeiroit would abort on the first nil?
12:22llasramevery? would, yes
12:23pandeirook good that's what i want
12:23TimMcand the side effects from further iterations would not happen.
12:34franks,(let [s "reduce"] (eval (read-string (str "(doc " (with-out-str (print s)) ")"))))
12:34clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
12:34franksahh - kind mess with the bot's internals...
12:35TimMcfranks: No need to do that. Just use the print-doc method.
12:49franks,(let [w "reduce"] (-> w symbol resolve meta (#'clojure.repl/print-doc)))
12:49clojurebot-------------------------
12:49clojurebotclojure.core/reduce
12:49clojurebot([f coll] [f val coll])
12:49clojurebot f should be a function of 2 arguments. If val is not supplied,
12:49clojurebot returns the result of applying f to the first 2 items in coll, then
12:49clojurebot applying f to that result and the 3rd item, etc. If coll contains no
12:49clojurebot items, f must accept no arguments as well, and reduce returns the
12:49clojurebot result of calling f with no arguments. If coll has on...
12:50franksTimMc: thanks for showing that trick how to invoke a private function.
12:50franks(although why are they called private again ? ;-) )
13:05thoeferguys with compiler-skills here >> PREDICT(X → ; P X) intersection PREDICT(X → eps) = what´s the result set of this?
13:11amalloyis this somehow tangentially related to clojure?
13:12thoeferabsolutely not...
13:13thoeferI always believed that lisper´s love their language more than others... :)
13:15tsdhHow do I get the Class object that int.class would return in Java?
13:18clj_newb(defrecord Animal [name age]) creates a java class "test.Animal" is there a way to attach meta deta to the test.Animal binding? basically I want somethign like (re-def test.Animal (with-meta test.Animal ...))
13:18amalloy&Integer/TYPE
13:18lazybot⇒ int
13:19amalloy&(instance? clojure.lang.IMeta java.lang.Class) ;; clj_newb
13:19lazybot⇒ false
13:19amalloythere is no place to put metadata
13:20clj_newbamalloy: brilliant
13:20TimMcHuh, defrecords don't get IMeta?
13:20clj_newbI want to attach meta deta to the _class_ that the defrecord generates, not instances
13:20amalloyTimMc: their instances do...
13:20TimMcOh!
13:21TimMcclj_newb: If Clojure didn't define the class of the thing you want to attach metadata to, it ain't gonna support metadata.
13:22clj_newbTimMc: every day I get more and more disappointed that clojure is less magical and more clever engineering
13:22duck1123When using clj-http, am I right in thinking that using with-connection-pool with a timeout should cause my request to abort when it takes too long? I have some code that's checking a list of domains, and one domain in particular is just hanging for a long time
13:22RickInGAamalloy I am trying to run the &Integer/Type you wrote, could you put that in an s expression?
13:22clj_newbis inspector.clj used by anyone? it seems like a clever way to do a gui repl / debugger but I can
13:23clj_newbdig up tutorials on it on google
13:23amalloy&(Integer/TYPE) :P
13:23lazybot⇒ int
13:23amalloyprobably the relevant point is that & is just there to wake up lazybot, not as part of the expression
13:23RickInGAwierd, I get Unable to resolve symbol & in this context
13:23RickInGAah, ok :)
13:24RickInGAnice... thanks
13:24solussdwhat's the best way to redirect *out* to a file, if *out* is going to have too much written to it to store in memory in a string?
13:25tsdhamalloy: Ah, yes, that rings a bell. Thanks.
13:26amalloy(binding [*out* (clojure.java.io/writer (java.io.File. filename))] ...)?
13:26amalloyprobably deserves a with-open in there as well
13:28solussdah, that's what I want- same as clojure.io/make-writer?
13:28solussd*clojure.java.io/make-writer
13:32jrgarciaIs there a way to add a docstring to a defrecord? If not, why?
13:35pjstadiganyone want a job doing clojure at sonian?
13:36amalloymake-writer is rather lower-level, isn't it?
13:37solussdah, yes.
13:37amalloyjrgarcia: please refer up about two pages in the scrollback, where it was discussed that classes do not support metadata, and then consider how docstrings are stored on functions
13:43fliebelRaynes: ping
13:43Raynesfliebel: Man, I didn't expect you to actually care enough to ping me. Go away. :p
13:44fliebellaughing out loud :)
13:45Raynesfliebel: So, in general, nothing is wrong with gist. The point of refheap is that we wanted something in Clojure, for Clojure, and we think that we can improve on existing pastebins.
13:46RaynesFor example, we aren't storing pastes as git repositories, opting instead to implement the most important things that gist gains from that ourselves. It really isn't as much as you'd think. Revisions are the bigger thing, and they shouldn't take long either. We can add diffs on top of that later.
13:47RaynesBut we also want to improve things in subtle ways. Paste something big and then click the 'maximize' link at the top right of the paste. That's a neat one that we really like.
13:48RaynesAll of this is still in a fairly early state, but we've got some ideas to implement and try out. Check out the issues we have open on Github. The majority of them are possible/planned features and such.
13:48fliebelRaynes: okay, sounds like fun
13:48RaynesAnd to anybody else listening, the context of this discussion is "What's wrong with Gist [that made you guys write refheap]?"
13:49fliebelRaynes: Do you autodetect languages? I really like tha Gist does that, but hate how it's implemented.
13:49Raynesfliebel: No. The only reason gist can do it is because they have filenames. We don't have anything like that.
13:50RaynesLanguage autodetection without some obvious cue (like a file extension) is pretty hard.
13:50fliebelYou never know for sure what it detected. It says it's based on the filename, but try pasting something without an extensions, it still figures out, most of the time.
13:51RaynesReally? I've never noticed before, I guess.
13:51fliebelMaybe I'm making things up.. let me try.
13:51tmciverRaynes: is refheap online somewhere?
13:51Raynestmciver: The code or the website?
13:52tmciverwebsite
13:52Rayneshttps://refheap.com
13:52amalloygist does autodetect languages, but it's fairly primitive iirc
13:52RaynesBecause it's haarrrdd.
13:53amalloyindeed. i think each language (of those that support autodetection) supplies a string or a regex or something: "if you search the contents of the gist and it contains this string, it's probably java"
13:54carlos_hi
13:54carlos_is there a way to use a default pair to a map?
13:54carlos_I would prefer this than using cond
13:55RaynesYou can supply a default for 'not found' when you query the map: ##({:a 1} :b 2}
13:55RaynesWell.
13:55Raynes&({:a 1} :b 2})
13:55lazybotjava.lang.RuntimeException: Unmatched delimiter: }
13:55RaynesDamn it.
13:55carlos_haha :D
13:56Raynes&({:a 1} :b 2)
13:56lazybot⇒ 2
13:56RaynesSame with get: ##(get {:a 1} :b 2)
13:56lazybot⇒ 2
13:57carlos_Raynes, how would you supply the default value when querying? using if?
13:57carlos_it would be so nice if clojure support a don't care like the "_" inside maps
13:57RaynesIn my above example, it's the last argument. The 2.
13:58carlos_Raynes, yes, but the :b is a match
13:59joly:b doesn't match any key in the map, so 2 is returned
13:59carlos_Raynes, joly, of course. sorry. thanks!
14:00carlos_this is quite cool! I can every condition in a map like some kind of discrete irregular function
14:28clj_newbwith defrecord, is it also possible to declare class members, rather than just instance members?
14:29TimMcI don't think defrecord is meant for such things.
14:30manutterclj_newb: consider using namespaces for stuff like that: i.e. put your defrecord in a namespace by itself
14:30manutterthen you can use namespace vars like class members
14:31manutterwith the caveat that you might end up writing Java in clojure instead of writing clojure. :)
14:32clj_newb(thinking)
14:38clj_newb(resolved)
14:38clj_newbthanks :-)
14:39manutter:)
14:39solussdsomeone needs to write a native i/o library for clojure (I realize java 1.7 has one, but that doesn't help with 99% of installations out there
14:39solussdlet me rephase that :) I'll write one unless someone points me at an existing one.
14:42solussdon a related note, has anyone used JTux?
14:45manutterwhat's JTux?
14:48clj_newbsolussd: you know, clojure is also lacking a smalltalk-like debugger ....
14:48solussd;)
14:50solussdJTux is a "Java to Unix" library-- lets you make system calls, like chmod, from java
14:51manutterah cool
15:46tolstoyIs JTux generally up to date?
15:47jamiltronHoly crap ClojureScript One looks amazing.
15:48RaynesI'm not sure I get it.
15:48RaynesIt's good documentation with a bizarre and cutesy name?
15:50jamiltronThat looks like the idea with a sample app. For me good documentation is one of the most exciting thing about any project.
15:50jamiltronEspecially for me, being that I haven't really groked Clojurescript yet.
15:51solussdI should be able to (from the repl) run (import 'packagename.ClassName) to import a class that I have in a .class file in <lein_proj>/classes, right?
15:51RickInGAyeah, I am looking forward to working through those
15:51dnolenjamiltron: it's pretty cool, they've been working on it hard for a while.
15:54TimMcsolussd: Sure, if it's on the classpath.
15:55solussdclasses/ is on the classpath
15:58TimMctry-it-and-see!
16:02vijaykiran
16:05Raynesdsantiago: ping
16:22_carlos_hi
16:23nicanhi
16:23_carlos_&{1 "hi" 2 "bye"} 1
16:23lazybot⇒ {1 "hi", 2 "bye"}
16:24_carlos_&({1 "hi" 2 "bye"} 1)
16:24lazybot⇒ "hi"
16:24bartj/quit
16:26_carlos_I asked about one hour ago how to have a default value in a map, but I noticed the solution presented only worked if the keys were keywords. in this case they are integers. any idea?
16:26_carlos_&({1 "hi" 2 "bye"} 3)
16:26lazybot⇒ nil
16:26_carlos_I don't have this map to return nil, but to return some default value of my choice
16:27jowag&(get {1 "hi" 2 "bye"} 3 "default value")
16:27lazybot⇒ "default value"
16:27jowag^this
16:29_carlos_oh.. weird.. didn't work early. of course, it is my fault ^^"
16:30_carlos_*earlier
16:33_carlos_jowag: anyways, what is the reason for returning "default value"?
16:34jowag_carlos_: well you wanted to have something else instead of nil, if key is not found
16:34Raynes_carlos_: ##({:a nil} :a)
16:34lazybot⇒ nil
16:35RaynesHow would you know if nil is the actual value of the key, or if the key wasn't found at all?
16:35jowag_carlos_: third argument in get is for specifying what clojure should return if key is not found
16:35RaynesIn those cases, you'd have to be able to return something other than nil in the event of a not found.
16:35jowag,({nil nil} nil)
16:35jowag:)
16:35clojurebotnil
16:36jowag.(get {nil nil} nil :not-found)
16:36jowag,(get {nil nil} nil :not-found)
16:36clojurebotnil
16:36_carlos_&({1 "hi" 2 "bye"} 3 "default value")
16:36lazybot⇒ "default value"
16:36_carlos_so there is an implicit get here?
16:37amalloy_carlos_: not really. it doesn't hurt to think of it that way, though
16:38TimMcI'm sure get just calls the map's get method.
16:40_carlos_amalloy: it doesn't hurt in the I-believe-in-santa-claus way?
16:40amalloyyeah, more or less
16:41jsabeaudryI noticed that compojure will use 1 http packet per object when the body is a sequence. This comes with very high overhead for small objects. Is this a bug or the intended behavior?
16:46nickmbailey,(= Double/NaN Double/NaN)
16:46clojurebotfalse
16:46nickmbaileywhy is that ^
16:47kephale,(Double/isNaN Double/NaN)
16:47clojurebottrue
16:48blakesmith,(.equals Double/NaN Double/NaN)
16:48clojurebottrue
16:48nickmbaileyblakesmith: right which is why i was wondering why the clojure version fails
16:49nickmbaileyhave a unit test that compares a vector that has NaN in it and the asserts are failing for that reason
16:54amalloynickmbailey: it seems a bit off, to me, that java's Double.NaN compares as equal to itself, since the unboxed versions don't compare as == to each other
16:54snamellitIEEE-754 spec dictates that it should return false when they are compared. So clojure is doing the right thing (in as much there can be a right thing with these weird edge cases)
16:57_carlos_&(def p #({1 "hi" 2 "bye"} % "default value"))
16:57lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
16:57_carlos_hun?
16:57_carlos_def is awesome
16:57amronot for a bot
16:58nickmbaileyhttp://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Double.html#equals(java.lang.Object)
16:58nickmbaileythe java impl special cases comparing NaN and NaN
16:58nickmbaileybut at least I know why clojure is returning false
16:59_carlos_anyways, I just want to replace % with something that will make the usage of (p 1 2 3) return "hi""bye""default value"
17:03nickmbaileydon't suppose there is already a version of '=' that handles NaN in contrib or something?
17:04nickmbaileywell nvm, i'll just filter out the NaNs
17:08devnThis is really, really great.
17:18cgrayis this a bad idea: (defmacro ! [e & es] (if (empty? es) `(comp not ~e) `((comp not ~e) ~@es))) ?
17:20brehautcgray: well, to start with, (complement f) = (comp not f)
17:20cgrayahh, good point
17:20cgraycomp not is shorter to type though :)
17:21amalloy(def ! complement)
17:21amalloyDONE
17:21cgrayboom
17:22cgrayamalloy: ,(complement identity true)
17:23cgrayit might be nice to say (! identity true)
17:23cgraythat's the point of the macro
17:23amalloyi know it doesn't do what your macro did, but it shortens the horribly-long name of complement
17:23cgrayi see
17:23amalloyi think that's a terrible idea, personally
17:23amalloyjust write (! (identity true))
17:23brehautcgray: have you looked at not= ?
17:24cgraybrehaut: yeah, I know about not= I see (comp not) in a lot of places
18:17mrevilis it possible to upgrade to leiningen 2.0-snapshot yet?
18:25mrevilnvm, i just realized that there is a 1.x branch which is what i really nead
18:25mrevilneed
18:29geoffegdoes anyone know where i can get the slides for this talk? http://blip.tv/clojure/clojure-concurrency-819147
19:16technomancymrevil: I hope to have a usable preview of leiningen 2.0 by clojurewest
19:56seancorfieldanyone using clojure.data.json 0.1.2? i'm getting a puzzling exception and i don't know if it's the library or my environment
19:57seancorfieldwhen i call read-json - with any argument - i get NoSuchMethodError: clojure.lang.Numbers.isNeg(I)Z
19:57seancorfieldclojure 1.3.0
19:58amalloymismatched clojure versions. something is AOT compiled against clojure 1.2 and you're running it on 1.3
19:59seancorfieldhmm...
20:01seancorfieldi don't believe i have anything AOT compiled
20:01seancorfieldcertainly nothing against clojure 1.2
20:01amalloywell, contrib is AOT-compiled. i'd check your classes/ or similar
20:02seancorfieldi don't have a classes folder
20:04amalloyi dunno where the misbehaving class is, but that error message *screams* 1.2
20:05amalloysince isNeg made the transition along with everything else from int->long, and the method signature is isNeg(int) returning boolean
20:07seancorfieldi agree with your reasoning... i'm just trying to think where an AOT 1.2 class could have come from...
20:07seancorfieldhmm, a lein plugin perhaps?
20:07amalloycould be. i don't understand lein plugins
20:11seancorfieldyup, either immutant or cljsbuild was the culprit
20:12seancorfieldprobably the latter since that was my most recent install
20:13seancorfieldthanx amalloy
20:14amalloywelcome
20:45_carlos_anyone knows how to express % in terms of infinite arguments?
20:45brehaut,(#(prn %&) 1 2 3)
20:46clojurebot(1 2 3)
20:46brehautin hindsight, not your question
20:47_carlos_brehaut: weird, didn't work with this one:
20:47_carlos_(def p #({1 "hi" 2 "bye"} %& "default value"))
20:49brehaut_carlos_: what doesnt work?
20:49brehautit should always return "default value"
20:50brehaut%& is a always going to be a list (or list like thing) and your map only has int (or long) keys
20:50_carlos_brehaut: I want (p 1 2 3) to return "hi""bye""default value"
20:50brehaut_carlos_: then you want a map
20:51brehaut,(#(map {1 "h1" 2 "bye"} %&) 1 2 3)
20:51clojurebot("h1" "bye" nil)
20:57_carlos_,(#(map {1 "h1" 2 "bye"} %& "default value") 1 2 3)
20:57clojurebot("h1" "bye" \f)
20:58_carlos_haha, \f is the third character of "default".. random!
21:05brehaut_carlos_: map with multiple seqs is a zip
21:06brehaut,(map vector [1 2 3] [:a :b :c])
21:06clojurebot([1 :a] [2 :b] [3 :c])
21:06brehautzip-with to be precise
21:07brehaut"default value" is an argument to the function 'map', not the map-literal {1 "hi" 2 "bye"}
21:10alandipertbrehaut, you should update your excellent clj web stack post with cljs:one :-)
21:11brehautalandipert: i want to do an update to all the latest versions of clojure and the libs, and also do one on noir
21:11brehautalandipert: but yes, definately :)
21:11alandipertsweetness
21:11alandiperthad a chance to play with it yet?
21:11brehautclojurescript one ?
21:11alandipertyeah
21:12brehautsadly no
21:12brehautfirst day back in the office today, and a whole lot of holiday period crap to take care of first :(
21:12alandiperti hear you
21:13Raynesbrehaut: If you need any help with the Noir post, let me know.
21:13brehautRaynes: noted :)
21:13Raynesbrehaut: Also, definitely*
21:13brehautRaynes: thanks :P
21:13RaynesAre all New Zealanders illiterate or is it just you?
21:13brehautim just lazy
21:13Raynes:p
21:14brehautalthough, if you were to read our main online news site (stuff.co.nz), you would be forgiven for assuming that it's all of us
21:14alandipertRaynes, belated congrats on refheap
21:14Raynesalandipert: <3
21:18Raynesalandipert: Quick! Paste all of Relevance's secrets!
21:19alandipertthe specific brand of stuart sierra's hair color is highly privileged info, i would never
21:19RaynesPsh.
21:19RaynesProbably splat!
21:20alandipertcurses
21:20alandipertRaynes, doing cljwest?
21:25brehautspeaking of cljs:o ive already learnt some little tricks from reading the uberdoc
21:25brehaut(eg, html-parse to get around enlive's html-snippet discarding doctypes)
21:27alandiperti dig the whole macro/enlive collaboration, turned my no-eval frown upside down
21:28alandipertalthough now with enfocus there are other interesting possibilities
21:28brehautalandipert: do you have some examples i can look at?
21:29brehaut(of the macro/enlive colab)
21:30alandipertsrc/lib/clj/one/templates.clj is enlive, and it's exposed via macro to cljs in src/app/cljs-macros/one/sample/snippets.clj
21:31brehauthuh. thats very clever
21:31espringeIs there a clojure equiv. of boost::multi_index? (It's a super awesome container class that provides 1 or more ways of accessing the data (by internally creating indexes)
21:32espringee.g. you could have could have an inventory collection, and access it (efficiently) either via barcode or via price or via location
21:34dnolenespringe: nothing I know of that does that for you but could easily be done.
21:45alandipertbrehaut, yeah it's wild. high-five brenton when you next see him
21:45dsantiagoWhat does it mean when, for example, Daivd Nolen says on HN: "Note that they've extended (safely because of namespaces) browser natives including Element, Array, String, as well as the custom ClojureScript data types to respond to the color function."
21:45brehautalandipert: if i make it to the states, i have a lot of high-fives to give out
21:45dsantiagoWhat is Clojurescript doing there to extend the primitives safely?
21:47alandipertdsantiago, protocols atop javascript prototypes
21:47dsantiagoI mean, is it actually modifying the prototype of Object or whatever?
21:49dnolendsantiago: namespacing
21:49dsantiagoYes, I know namespacing. How does namespacing help if you're modifying Object?
21:49dnolendsantiago: String.prototype.cljs.core$first = ...
21:50dnolendsantiago: Object.prototype.com.dsantiago$foo = ...
21:50dnolenoops that should be, String.prototype.cljs$core$first, but you get the idea
21:51brehautdnolen: are those namespaces nested objects, or just strings?
21:51dnolenbrehaut: sorry, it's not nested objects, just properties w/ munged names created by the compiler
21:52brehautdnolen: thanks. that makes sense
21:53dsantiagoOK, thanks dnolen.
21:55dnolenbrehaut: dsantiago: it's simple really. Actually I think Dart adopts a similar approach w/ interfaces, but I don't think it supports anything like extend-type
21:55dsantiagoYeah, I see how it works now. I thought you were saying that it was making defensive copies of the prototype for each namespace, or something, and I wasn't sure how that would work.
21:56dnolendsantiago: nope very simple and efficient and optimizable by Google Closure
21:56dsantiagoDoes that break for…in?
21:57brehautdsantiago: no more than anything on a prototype
22:00dsantiagoMy buddy who works on Closure is concerned because Closure itself does still use for..in in certain places, and he finds it worrisome.
22:02dsantiagoFortunately, I don't think there's ever anything that forces you to extend browser primitives this way.
22:02dnolendsantiago: I don't see why for..in is a problem ever
22:02dnolenin anycase sounds like an anti-pattern in ClojureScript
22:03dnolenin JS makes sense for some wretched runtime metaprogramming
22:03dsantiagoIt perhaps requires a footnote.
22:04y3dihas anyone in here installed leiningen in windows before?
22:04dnolendsantiago: why? you never know what you're going to get when iterating properties not even across browsers.
22:08dsantiagoYeah, I don't know if this is something that can cause an actual problem or not.
22:09notostracay3di, yes
22:09notostracalein.bat
22:09JohnnyLwhat s good web framework for clojure and is it mature enough to use on a wxp box?
22:10brehautJohnnyL: thats a complicated question
22:10scottjJohnnyL: noir is the most popular these days
22:10brehautnoir is the library that most represents a framework
22:10brehauts/represents/resembles/
22:10scottjwell conjure might win there :)
22:11brehautssh
22:11seancorfieldor FW/1 (framework one)
22:11seancorfield:)
22:11brehautJohnnyL: do you know about ring yet?
22:12seancorfieldnoir is definitely the best documented and most popular right now tho'
22:12brehautseancorfield: clojurescript:one is giving it a run for its money ;)
22:12JohnnyLbrehaut: i'm a clojure newb. :)
22:12brehaut(for docs at least)
22:13brehautJohnnyL: ring is the foundation of all (well, most) of http / web stuff in clojure. you want to learn about it at some point. it abstracts http to a clojure interface
22:13seancorfieldi plan to look at clojurescript:one "real soon now" but mostly to see how i can leverage the ideas into FW/1 since that already uses Enlive on the server side
22:15JohnnyLbrehaut: thanks.
22:15JohnnyLthanks guys.
22:18seancorfielddumb repl Q: how do i delete / remove a var i no longer want?
22:19brehautseancorfield: ns-unmap i believe
22:20seancorfieldthx
22:21seancorfieldyup, that worked brehaut !
22:23ckirkendallis anyone else getting an exception when they try to run clojureone
22:23ckirkendallsorry clojurescript one
22:25alandipertckirkendall, no - what are you seeing?
22:25ckirkendallClassNotFoundException com.google.common.collect.ImmutableList java.net.URLClassLoader$1.run (URLClassLoader.java:202)
22:25y3diwhen i try to run script/deps it just says the command is not recognized. i might be doing something wrong since im using windows
22:26ckirkendallalandipert: I am running ubuntu
22:26alandiperty3di, no windows dev support - yet
22:27y3diah
22:27f3fAny soul (besides hugod) ever wrote Maven plugins (Mojos) in Clojure ?
22:28alandipertckirkendall, which jdk?
22:28cmwelshhow new is closurescript:one? I just read an article about it this evening
22:28f3fI see hugod did all the heavy-lifting for https://github.com/pallet/zi. I'm just asking if there's anybody else doing Mojos in Clojure
22:28alandipertcmwelsh, released today
22:29ckirkendallJava(TM) SE Runtime Environment (build 1.6.0_22-b04)
22:30alandipertckirkendall, this happens when you script/run?
22:30ckirkendallyep and dumps me into a repl
22:30ckirkendallbut no running server
22:31alandipertckirkendall, hm. have not seen before and can't reproduce (on debian). mind filing a ticket? stack trace and platform details helpful
22:31ckirkendallalandipert: by the way I spent the last few hours reading through the code and I am beyond impressed
22:32ckirkendallwill do
22:32alandipertckirkendall, thanks i'll pass it on. brenton made it, i just use the thing :-)
22:36cmwelshthe site and the documentation page are built using closurescript:one?
22:36cmwelshor is it closurescript one
22:37alandipertcmwelsh, docs built with marginalia
22:37alandipert(with custom theme)
22:45f3f hey, this clojurescript:one smells really good
22:59jyaanHow can I keep up with the clojure-contrib 1.3 version for leiningen? It was 1.3.0-SNAPSHOT, then 1.3.0-alpha4, and now it's broken again. Does anyone have a link?
23:00jyaanWell, perhaps I should say "I don't know" rather than "it's broken"
23:01bbhossIs this the proper place to ask about Clojurescript One? I'm having some trouble getting chrome to connect to the development REPL.
23:03dnolenbbhoss: how are you starting the repl?
23:03bbhossdnolen: script/run then doing (cljs-repl)
23:04bbhossit seems to work in firefox though, it's just chrome with the issue
23:05bbhossNM, seems to be working now, odd
23:05dnolenbbhoss: sometimes you need to refresh the browser
23:05bbhossdnolen: yeah, I did that but I guess I didn't do it enough :)
23:06dnolenbbhoss: cljs repl can be slow to start sometimes, and the connection method is less than stellar
23:06bbhossdnolen: what does it use?
23:07dnolenbbhoss: hopefully someone will add websocket support for modern browsers
23:07bbhossthats what I was wondering
23:07dnolenbbhoss: google cross page channel, since that works in every browser
23:07bbhossinteresting
23:07Raynesalandipert: Doesn't look like it.
23:08bbhosscan I use TextMate to develop things with clojurescript one/cljs or should I just use emacs
23:08dnolenbbhoss: I tried making TextMate work for Clojure, but TextMate is just awful for REPL centric development
23:09bbhossyeah that's what I figured, how do you use it with emacs?
23:09dnolenbbhoss: Emacs, Vim, Eclipse, Clooj all provide nicer experiences IMO
23:09jyaanYou have to install clojure-mode
23:09bbhossI'm familiar with emacs, just more familiar with TM, but it sounds like I should be using emacs
23:09Raynesdnolen: Check out SublimeREPL. Not all that useful, but it's a start.
23:09brehauti second ditching TM
23:09RaynesAlso not textmate, but close enough.
23:09brehaut(for clojure)
23:09jyaanIt's really easy with leiningen
23:09bbhossjyaan: is that in the emacs package manager?
23:10jyaanyes
23:10dnolenbbhoss: (setq inferior-lisp-mode "path/to/repl/script") in .emacs, then M-x run-lisp
23:10jyaanwait, leiningen or clojure-mode
23:10RaynesMarmalade.
23:10dnolenbbhoss: then you can just interact with the browser right from the text editor on the fly.
23:10alandipertdnolen, you think websocket would make repl noticeably faster?
23:10dnolengotta run
23:10RaynesGuys. 50 different things at once is less helpful.
23:10bbhossI have leiningen, not really sure what it does though jyaan
23:10jyaanhaha
23:10jyaanit's for project management, basically
23:11dnolenalandipert: pretty darn sure, my node.js repl screams compared to browser repl
23:11dnolenl8r
23:11alandipertdnolen, don't agree but haven't measured ;-)
23:11alandipertciao
23:11bbhossjyaan: how does lein relate to what I'm trying to do here?
23:12jyaanit has a plugin called "swank-clojure", it handles all the details of starting up slime for you
23:12jyaanwhich is what pretty much everyone uses w/ emacs
23:12bbhossok, I will look at that then
23:13brehautbbhoss: leiningen is the user interface to clojure; it provides (for a beginner any) command line tools (run, repl, build), and dependancy resolution
23:14jyaanbbhoss: are you familiar with emacs already?
23:14bbhossjyaan: a little bit, I know the basics
23:16jyaanwell, first you need to get clojure-mode in your load-path
23:16jonasenhttps://refheap.com/paste/240
23:16jonasen^ has anyone seen a similar error when trying ClojureScript One?
23:17bbhossjyaan: ok, I will do that, I assume I need to play around with my .emacs file to do that, or do I just need to install the package
23:17bbhossor what do you recommend to get started with, I don't really have Emacs setup
23:17jyaanthen if you put :dev-dependencies [[swank-clojure "1.4.0-SNAPSHOT"]] in your project.clj, all you have to do from Emacs is just do M-x clojure-jack in
23:18jyaan1.4.0-snapshot has slime packaged so you don't have to install anything except emacs with clojure-mode and leiningen
23:19jyaanbefore 1.4.0-snapshot you need to add a few more lines of elisp code to your .emacs
23:21jyaanare you on a unix-like system or windows
23:21bbhossos x
23:21jyaanok that makes it easier
23:21bbhoss:)
23:22bbhossI've tried some starter kits before, but I can never get the things to work right and give up
23:22jyaanwhat a lot of ppl do (myself included) is make a lib folder in your ~/.emacs.d folder
23:22jyaanWell on OSX I use Aquamacs
23:22jyaanOn others I use GNUEmacs (actually I like it better)
23:22bbhossjyaan: did that update it to 24 yet?
23:22bbhossaqua
23:23jyaanNot sure
23:23alandipertjonasen, which browser?
23:23brehautemacsforosx.com/
23:23jyaanI think they are still on 23 but i could be wrong
23:23jyaanyea they're based on 23.3
23:23Raynesbbhoss, jyaan: There are builds there for 24.
23:23RaynesGet them.
23:23RaynesThey work fine.
23:24brehaut^ that url has builds of 24 for os x and its 'real' emacs rather than a diversion like aquamacs
23:24bbhossyeah I've used both
23:24bbhossActually I already have 24.0.91.1 installed
23:25jyaanwell anayways, you just need to extract clojure-mode into ~/.emacs.d/lib or something, and put (add-to-list 'load-path "~/.emacs.d/lib/clojure-mode") in your .emacs
23:25bbhossSo I have ELPA, but it doesnt look like clojure-mode is installed
23:25jyaanthen put (require 'clojure-mode)
23:25bbhossok
23:25jyaanthat's really about it
23:25jyaanyea or do the package way
23:25jyaanI don't use package.el myself though
23:26RaynesYou don't need (require 'clojure-mode) after installing it from elpa.
23:26RaynesM-x package-install RET clojure-mode
23:26bbhossRaynes: it doesn't look like it shows up in list-packages
23:26jyaanyea that's why I said "or teh package way"
23:27RaynesYou don't have marmalade set up.
23:27jyaani was talknig about just doing it manually
23:27Raynes(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/&quot;))
23:27Raynesbbhoss: ^ Add that to your .emacs (or init.el or whatever you use).
23:27bbhossRaynes: init.el is run if it exists inside of emacs.d right?
23:28RaynesYes.
23:28jyaanyes, and you should prefer that instead IMO
23:28RaynesPlace your cursor after the last paren and do C-x C-e and it will evaluate it. After that, try again. You don't have to restart emacs.
23:28jyaanyou should structure your elisp files like any other project
23:28RaynesLet's get clojure-mode installed first
23:29bbhossRaynes: do I need to update the package list? It still says not found
23:29RaynesYes.
23:29jonasenalandipert: chrome
23:30bitpimpalandipert: greetings
23:30bitpimpyou know it
23:30alandipertbitpimp, ahoy
23:32alandipertjonasen, hm, that is mysterious. there's always the cargo cult of browser refresh
23:32bbhossok, clojure-mode appears to have installed, now what?
23:33jyaanyou said you have lein right
23:33bbhossyep it's installed
23:33bbhossFYI I am playing with this clojurescript one thing I saw on HN, not sure if you've seen it
23:33bbhossit seems somewhat opinionated
23:33jonasenalandipert: No luck with browser refresh, same error.
23:34jyaanOk so you go to somewhere like ~/Projects and run "lein new PROJECTNAME" in a terminal
23:34alandipertjonasen, mind making a ticket with platform/version details? 'tis a strange one
23:35bbhossjyaan: ok it looks like this project already has it setup with a project.clj etc
23:35jyaanthen just add :dev-dependencies [[swank-clojure "1.4.0-SNAPSHOT"]]
23:35jyaanyes you get a default layout
23:35bbhossjyaan: add that where?
23:35RaynesYou don't need that added to dev-dependencies.
23:35jyaanproject.clj
23:35Raynes'lein plugin install swank-clojure 1.3.3'
23:36jyaanthat way you have to run "lein swank"
23:36jyaaneither is fine
23:36jyaanlatest swank-clojure you can do clojure-jack-in which is apparently preffered
23:36jonasensure. I'm afraid it has something to do with character encodings. I've had problems with that before when using clojurescript
23:36jonasenalandipert: ^
23:37Raynesjyaan: You can do clojure-jack-in with 1.3.3
23:37jyaanOh my mistake then
23:37alandipertjonasen, could be... the server-side of the repl might have funky encoding headers
23:38alandipertjonasen, you see the same behavior in other browsers?
23:38RaynesFirefox to the rescue!
23:40bbhossjyaan: I added that to project.clj, this is what it looks like now: https://gist.github.com/c087b133deefe0bfe7be, but it generates a backtrace when I try to run script/deps which I think is supposed to update your deps
23:41jonasenalandipert: similar error in firefox
23:41bbhossjyaan: backtrace appears to be unrelated
23:42alandipertjonasen, does the app work when you compile with script/build?
23:42jyaanShould probably start with just Clojure to make sure things are set up correctly
23:42bbhossexception: https://gist.github.com/b43615e5887247cd06c5
23:43bbhossok
23:43Raynesjonasen: Oh em gee, you used refheap!
23:43Raynesjonasen: We should totally be friends.
23:44jonasenalandipert: it says [build complete]. No repl. How do I test it?
23:44jyaanI believe that exception means KeywordLookupSite got the wrong constructor call, if that means anything to you -- doesn't to me unfortunately
23:44jonasenRaynes: heh. I created a gist, then changed my mind.
23:45RaynesGood.
23:45jyaanOr rather that there is no constructor matching the parameters it was called with
23:45jyaanAnyways let's just get the basics working and we can go from there
23:45bbhossjyaan: alright I got a basic project setup with lein new, and pulled down swank with lein deps
23:45alandipertjonasen, not sure, it's not building for me ;-)
23:46alandipertjonasen, last it worked you could open the generated index.html
23:46RaynesThe first step to our success is to make people feel guilty when they create a Clojure-related gist.
23:46jyaanok if it worked you should be able to enter 'M-x clojure-jack-in' from Emacs
23:46alandipertjonasen, sleep-time for me though, please do create a ticket
23:46jyaanAnd after some loading it will give a REPL
23:46bbhossjyaan: do I need the project dired or project.clj loaded?
23:46RaynesYou have to actually be editing a file in that project though.
23:47jyaanRight
23:47jyaanYea you have to
23:47RaynesAlso, like I said, you don't have to add swank-clojure to every project. You can do `lein plugin install swank-clojure 1.3.3` and it'll be available for all projects you use, now and forever.
23:48jyaanYea it's worth doing if you know you'll be using the plugin all the time
23:48bbhossalright, I have swank running
23:48jonasenalandipert: I'll create a ticket. (later, work-time form me...)
23:49alandipertjonasen, thanks!
23:49jyaanAlright great
23:49bbhossso it split the buffer into two windows, one repl and one code, I assume I eval the code above or something?
23:49jyaanYea you can also load the entire buffer
23:50jyaanAnd you can use that code in the REPL
23:50bbhossHow do I go about doing that?
23:50jyaanThere should be a slime tab
23:51jyaanyou can do C-h x C-c C-r
23:51bbhosswell it split into two "windows"
23:51jyaanto select all and then evaluate region
23:51jyaanYes but that buffer is linked to the repl
23:52jyaanif you evaluate in the buffer the repl "knows" about it
23:52jyaanso if you put a function definition in the buffer and run C-x C-e at the last paren of it, you'll be able to run it in the slime repl
23:53jyaanor C-h x then C-c C-r to load the whole buffer
23:53jyaanI think there might be anotehr, shorter, one for that
23:55bbhossjyaan: I restarted emacs and it gives me an error in init.el: https://gist.github.com/aaa75b0b36a7dbfa8b9b
23:55bbhossif I go into the file ane C-x C-e it evals fine
23:56jyaanlet's see the init.el
23:56jyaanohh
23:56jyaanwait
23:56bbhoss(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/&quot;)) is all
23:56jyaanyes
23:57jyaanhaha beat me to it
23:57jyaanyou forgot to add that too
23:57jyaanI suppose we didn't mention that you had to save it, though, did we? :P
23:57bbhossNo, I saved what I had, what am I missing?
23:59jyaanyea hm i guess you got an error running the (add-to-list...
23:59jyaanwell i still need to see the file then