#clojure log - Jan 11 2012

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:50 alexbaranosky: (partition 0 [1 2 3]) :(

1:50 echo-area: http://pastebin.com/J5tbgPFm

1:50 Could somebody please take a look at it

1:50 Why is the `recur' at line 8 not considered a tail call?

1:53 And why is `recur' inside `finally' not considered a tail call?

1:53 Thanks

2:23 clj_newb: both len & length are nil -- does clojure have a builtin function for returning the length ofa list?

2:26 echo-area: clj_newb: I'm also new to Clojure, don't know if this is good or not: (.size list)

2:27 clj_newb: .length works

2:27 how does .length and .size differ?

2:27 echo-area: Yes these works, but I don't know if these are really safe to use

2:27 gf3: clj_newb: count

2:27 &(doc count)

2:27 lazybot: ⇒ "([coll]); Returns the number of items in the collection. (count nil) returns 0. Also works on strings, arrays, and Java Collections and Maps"

2:28 anntzer: hi, it seems that marginalia isn't picking up docstrings of namespaces that are "empty" (i.e. just (ns some.name.space "Some docstring."))

2:28 is that correct?

2:33 clj_newb: echo-area , gf3 : nice, thanks

2:34 dumb 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

2:58 is there a way to combine a defn w/ a with-meta?

2:58 i.e. I want to a funciont that I defined to have meta data attached to it

3:03 G0SUB: clj_newb: use def, fn & with-meta

3:03 clj_newb: is there a short hand for (def x (with-meta (fn ...) {data})) ?

3:03 G0SUB: clj_newb: where do you want to put the metadata in? you can have it in the var (x) or the function object.

3:04 clj_newb: if you want the metatdata to be in the var, use something like this - (def ^{:my-meta 42} x (fn [...

3:06 clj_newb: (thinking)

3:06 ( I want the meta data attached to the function )

3:06 these functions are predicates

3:07 when they throw asertion errors, I want the function to also print out its meta data

3:07 G0SUB: clj_newb: if you want to put the metadata in the fn object, you'll need with-meta. (with-meta (fn [] …) {:x 1})

3:07 clj_newb: (info on what the function does)

3:07 G0SUB: noted; thanks

3:08 G0SUB: clj_newb: using with-meta you can put metadata in existing fns as well.

3:08 clj_newb: i can create new objects that is the old fn + meta data

3:08 not insert into old fn

3:08 is that correct?

3:09 G0SUB: clj_newb: yes, you are right.

3:09 (def my-first (with-meta first {::x 1 ::y 2}))

3:10 clj_newb: with-meta will return a new object. it doesn't alter the existing one.

3:18 kcin: ~zip

3:18 clojurebot: zip 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))

3:20 Fossi: :o

3:22 G0SUB: ~zipmap

3:22 clojurebot: Gabh mo leithscéal?

3:23 G0SUB: ~(doc zipmap)

3:23 clojurebot: Titim gan éirí ort.

3:23 clj_newb: is thre a good book on the design & implementation of clojure? i'm looking for somethign deper than "Programming Clojure"

3:23 G0SUB: clj_newb: the joy of clojure.

3:29 kral: hi all

3:45 Blkt: good morning everyone

3:46 AWizzArd: Hey Blkt.

3:46 Blkt: :D

3:54 Raynes: &(doc zipmap)

3:54 lazybot: ⇒ "([keys vals]); Returns a map with the keys mapped to the corresponding vals."

4:34 drdo: Is there a fastcgi library?

4:38 AWizzArd: drdo: I guess there is fastcgi support for Java. That could possibly be used for Clojure too.

4:48 maio: &(+ 1 1)

4:48 lazybot: ⇒ 2

5:24 G0SUB: bartj

5:49 tsdh: If 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?

5:51 raek: tsdh: yes. there is a useful method for that: clojure.lang.Reflector/invokeInstanceMethod

5:52 tsdh: raek: Great. Thank you.

5:52 raek: tsdh: 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

5:53 tsdh: Sure, memfn.

5:53 raek: no, you will have the same problem with memfn

5:53 (memfn is just an older alternative to #(...)-style anonymous functions)

5:55 tsdh: example: (def method-name "foo") (defmacro call-foo [o & args] `(. ~o ~(symbol method-name) ~@args))

5:56 (call-foo object 1 2 3) will then expand to (. object foo 1 2 3)

5:56 note that macro arguments are not evaluated, but you can still access previously defined values

5:57 tsdh: I 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.

5:57 raek: what do you want to do instead?

6:00 tsdh: Simply return nil

6:02 raek: I 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

6:03 tsdh: raek: I'm doing the latter right now.

6:03 raek: the 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)

6:05 beware of the security implications, don't let unsanitized user input control which method on which class is invoked, etc, etc :-)

6:05 tsdh: raek: Well, actually I want only zero-arity method with matching name. I just feared that catching exceptions might be slower than picking myself.

6:06 raek: why slower? I would expect it to be about the same.

6:07 but yeah, exceptions for control flow is bad and all that

6:07 tsdh: That's what I've read somewhere sometime too, but it might be an urban myth...

6:09 raek: anyway, I doubt that it will be the performance bottleneck of your app

6:27 tsdh: raek: Yeah, I'll try both versions and then we'll see.

8:26 lnostdal: ,(remove #{1} [0 1 1 2])

8:26 clojurebot: (0 2)

8:26 lnostdal: mh, remove is missing a :count keyarg :P

8:27 e.g., (remove #{1} [0 1 12] :count 1) => [0 1 2]

8:27 ups, meant, (remove #{1} [0 1 1 2] :count 1) => [0 1 2]

8:32 G0SUB: lnostdal: fair point. but start, end, keyfn etc. would be useful as well, don't you think?

8:43 lnostdal: G0SUB, yup, i miss them quite a lot at times :)

8:43 i'm doing what feels like a "hack" using with-local-vars and mapcat now

8:43 G0SUB: lnostdal: lol. I think you'll love the fact that you don't need to look up CLHS every time :-)

8:46 lnostdal: do you just need the count or do you need the other options as well?

8:46 lnostdal: CLHS is awesome!

8:47 and there was no looking up; just F1 in emacs via shortcut key and it was right there

8:47 G0SUB: lnostdal: no doubt. I loved CLHS as well.

8:47 lnostdal: C-cC-dd

8:47 lnostdal: ..or it was also there at the bottom of emacs; slime "status bar" there showed all required and keyword args

8:48 ,(let [blah 42] (with-local-vars [blah blah] (var-get blah)))

8:48 clojurebot: #<Var: --unnamed-->

8:48 lnostdal: not sure what's going on there

8:49 G0SUB: ,(let [blah 42] (with-local-vars [blah :nambla] (var-get blah)))

8:49 clojurebot: :nambla

8:49 lnostdal: yeah

8:50 G0SUB: lnostdal: is this not what you expected?

8:50 lnostdal: that is, but not the one before

8:50 G0SUB: lnostdal: why? you were binding blah to itself apparently

8:51 ,(let [blah 42] (with-local-vars [blah 'blah] (var-get blah)))

8:51 clojurebot: blah

8:52 cemerick: G0SUB: congrats on having your talk accepted :-)

8:53 G0SUB: cemerick: thanks! I need to work on the talk now.

8:53 cemerick: heh

8:53 I don't think anyone ever constructs their talk before submitting it. ;-)

8:53 G0SUB: cemerick: your talk is going to be great as well, I am sure.

8:53 cemerick: you don't? :-P

8:54 cemerick: I do a loose outline, and then make sure to do a dry-run on a smaller crowd ahead of time.

8:54 lnostdal: ok, yeah, so it's not evaled .. kind of surprising, i think

8:54 cemerick: It's easier for me this time around; I'm not doing anything super-technical.

8:54 G0SUB: cemerick: that's the trick. I will do a dry run as well, with my team

8:54 cemerick: After the book, I'm mostly just looking to have fun for a while. ;-)

8:55 G0SUB: cemerick: the book is like having a child.

8:55 cemerick: get the fuck *OUT*! ;-)

8:56 G0SUB: cemerick: haha. but you are in the esteemed company of a certain Grand old man. I hope that helped.

8:56 cemerick: hah

8:56 Indeed, he has some gems in there.

9:47 solussd: how 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)?

9:48 di-csuehs: can you wrap that call in a bind?

9:48 oh...but you want what it calls to still get the usual *out*

9:48 solussd: example (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)))

9:50 note 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. :/

9:51 di-csuehs: let is a special form. I wonder if that is what is biting us.

9:51 I would expect result to be the result of calling function-with-printlns-I-do-not-want

9:51 but I am still new to clojure

9:52 raek: solussd: you can use 'binding' to give *out* another value, e.g. a StringWriter

9:52 you might need to wrap it in a PrintWriter also

9:52 solussd: what 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….

9:53 kumarshantanu: hi

9:53 di-csuehs: Raek, 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?

9:53 manutter: solussd: what if you wrap the "silent" function in it's own with-out-str binding, and then just discard the str?

9:53 solussd: raek: you mean to capture the output of the first function?

9:53 raek: ,(let [result ..., sw (StringWriter.), pw (PrintWriter. sw)] (binding [*out* pw] ... result ...))

9:53 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ... in this context, compiling:(NO_SOURCE_PATH:0)>

9:53 kumarshantanu: can anybody point out what's wrong with this macro….

9:53 (defmacro altering [dvar valu & body] (try (alter-var-root ~dvar (constantly ~valu)) ~@body (finally (alter-var-root ~dvar (constantly ~dvar)))))

9:54 raek: kumarshantanu: first of all, no syntax-quote (`)

9:54 solussd: well the first function isn't silent, per se, I want it to print to stdout. :D

9:54 manutter: wrap it in a binding to *out* that restores stdout then?

9:54 kumarshantanu: raek: thanks!

9:55 solussd: manutter: that's it!

9:55 raek: only the code in the body of 'binding' will have its output redirected and captured

9:55 solussd: I feel dumb now. :D

9:55 raek: solussd: IIRC, you can then call .toString on the StringWriter to get what has been written to it

9:56 di-csuehs: solussd: nah, sorry.

9:56 raek: solussd: you can also check the source code of with-out-str: (source 'with-out-str)

9:58 solussd: what is *out* bound to, by default?

9:58 raek: solussd: a PrintWriter that writes to System.out

10:00 with the "platform default" encodig

10:03 casperc: Is there any way to do destructuring and call a function in one go?

10:05 something like (let [result (function (:val map))] ...do stuff..), but with destructuring

10:05 raek: casperc: destructuring of result or map?

10:05 casperc: raek: 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:06 raek: no worries :)

10:06 casperc: in this case map

10:06 raek: well, you can always destructure map where it is bound

10:07 casperc: not sure I get your meaning

10:07 raek: (defn foo [{:keys [val], :as map}] (let [result (function val)] ...))

10:07 assuming it was (def foo [map] ...) before

10:07 casperc: yes

10:08 i guess i was trying to avoid the extra let in order to call the function

10:08 raek: destructuring 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:09 the point is, you still have to "let" map somwhere, right?

10:09 you can do the destructuring there

10:09 casperc: aye, but I can't call the function :)

10:09 raek: (unless it's a global var, though)

10:10 casperc: guess i am just trying to think up something which there is no syntax for

10:10 thanks again :)

10:10 raek: anyway, using (:val map) to pick out the :val value is perfectly fine too

10:11 casperc: yeah, I was just trying to destructure and validate my input in one go

10:11 in fact a macro might do the trick actually

10:18 solussd: raek: I tried this: https://gist.github.com/1595144 but no luck-- it works when rebinding dynamic versions of 'str', but not with *out*

10:20 TimMc: solussd: What happens when you run that?

10:21 solussd: TimMc everything that is printed is returned in the string

10:23 TimMc: solussd: Could laziness be screwing this up?

10:23 Wait, it's kind of fucked up to put with-out-str in a -> macro...

10:24 solussd: I'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:24 TimMc: :) I tried it without the -> macro too.. same

10:24 the expansion looks fine

10:24 TimMc: It's hella confusing with the ->

10:25 solussd: i agree- with the bindings and let it is.. it wasn't before that though

10:25 i'll clean that up

10:26 before it was simply (-> my-map xml/emit with-out-str)

10:27 TimMc: &(str "[" (let [out-er *out*] (with-out-str (print "before") (binding [*out* out-er] (print "while")) (print "after"))) "]")

10:27 lazybot: java.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!

10:27 TimMc: ,(str "[" (let [out-er *out*] (with-out-str (print "before") (binding [*out* out-er] (print "while")) (print "after"))) "]")

10:27 clojurebot: while

10:27 "[beforeafter]"

10:27 TimMc: So the theory is solid.

10:29 solussd: throwing the seq in a do…

10:29 hm. same problem. wtf.

10:29 TimMc: doall

10:29 solussd: ah

10:30 TimMc: Right around the map.

10:31 binding and lazy seqs do not play well together

10:31 solussd: yay! do all fixed it!

10:31 thanks!!

10:32 *doall, damnyouosxautocorrect

10:32 TimMc: xml/emit prints to *out*?

10:32 I see, you're intended to bind *out* around that.

10:34 solussd: weird… 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:35 that makes no sense

10:36 llasram: I'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:36 solussd: llasram: let is a lexical thing- it's really just creates a lexical name for the form its naming

10:37 llasram: Yes... But it also controls evaluation order for side-effects

10:37 solussd: llasram: maybe ill try that now that i'm forcing evaluation of the seq with 'doall'

10:37 llasram: ,(let [a 1, b (println a), c (println "also"), d 2] d)

10:37 clojurebot: 1

10:38 also

10:38 2

10:38 llasram: Not the best example, but you get the gist

10:42 raek: solussd: do you know what 'binding' is used for?

10:42 solussd: raek: rebind dynamic vars

10:43 :)

10:43 raek: good. :) did you manage to get it working?

10:43 solussd: weird- llasram's advice still only prints the first println to stdout

10:43 binding is a dangerous but awesome tool.

10:44 * raek reads backlog

10:44 llasram: solussd: 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:44 raek: ok, so you figured out that you need doall around map

10:45 solussd: llasram: 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:45 but side-effects, e.g. printing, are a good reason for it to not work like that

10:46 raek: solussd: 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:46 solussd: raek: yup. knew that.

10:47 TimMc: solussd: 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:47 solussd: well thanks for the help-- off to work- will open this back up then.

11:02 tsdh: How do I check if an object in an array?

11:05 mdeboard: tsdh: http://stackoverflow.com/questions/3249334/test-whether-a-list-contains-a-specific-value-in-clojure ?

11:06 tsdh: Ups, I've meant "if an object *is* an array".

11:06 Something along (array? (to-array [1 2 3])) => true

11:06 TimMc: &(.isArray (class (int-array 5)))

11:06 lazybot: ⇒ true

11:07 tsdh: TimMc: Thanks.

11:07 TimMc: There might be something better...

11:07 $findarg map % [(int-array 5) [] 6] [true false false]

11:07 lazybot: []

11:07 melipone: I 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:08 tsdh: TimMc: What's that? $findarg

11:08 TimMc: tsdh: It's a lazybot command.

11:09 tsdh: I guessed so, but what does it do? Or where are the docs?

11:09 TimMc: It tries a bunch of core functions for the placeholder (%) and sees which ones make the statement true.

11:09 tsdh: Oh, cool.

11:10 TimMc: $findfn 2 2 4 ; related command

11:10 lazybot: [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:10 manutter: melipone: how many keys are we talking about here?

11:10 melipone: manutter: maybe 4000 keys

11:11 TimMc: melipone: You want to cache the results of a function?

11:11 melipone: TimMc: yes

11:12 manutter: somebody was doing an enhanced caching/memoizing lib recently, weren't they?

11:12 I want to say it was fogus, but I don't remember

11:14 melipone: In Java I would do that with a treemap to keep track of the highest counts in the map.

11:14 jsabeaudry: I 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:14 jkkramer: manutter: https://github.com/clojure/core.cache

11:15 manutter: Yeah, that's it

11:16 melipone: what jkkramer said

11:17 TimMc: ,(require 'clojure.string)

11:17 clojurebot: nil

11:17 TimMc: ,(clojure.string/replace "foo" "o" "")

11:17 clojurebot: "f"

11:17 melipone: thanks! I'll look at that

11:18 TimMc: jsabeaudry: ^

11:18 But be careful with replace, I think it uses String/replaceALl, which is terrible and should be avoided.

11:18 jsabeaudry: TimMc: Oh, heh, slow morning, thanks for the wake-up call :D

11:19 TimMc: How so?

11:19 TimMc: What should be used instead?

11:19 TimMc: I wrote my own.

11:20 Let me check on soemthing...

11:20 jsabeaudry: TimMc: (str (filter... I guess but what is the problem with java's replaceAll ?

11:20 melipone: off-topic: is there an @ command in IRC?

11:20 jsabeaudry: melipone: What is an @ command?

11:22 tsdh: How can I get the class object of a primitive type?

11:22 franks: Q: 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:23 TimMc: jsabeaudry: Never mind, replace is safe.

11:23 melipone: jsabeaudry: it's a twitter command that let's you put the name of the person you want to talk to

11:23 TimMc: melipone: You just did it.

11:24 melipone: TimMc: okay. I just wrote your name. Simple, he?

11:24 TimMc: If your IRC client doesn't specially mark lines where someone says yourname: then get a new IRC client!

11:25 Your client should also tab-complete usernames at the beginning of a line.

11:26 franks: TimMc: any IRC-client recommendations for mac

11:27 TimMc: jsabeaudry: 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:27 franks: No idea, I'm on GNU/Linux. I use a terminal program called irssi which I'm reasonably happy with.

11:27 blakesmith: Mmm... irssi

11:28 irssi is in homebrew, so you can install it on a mac if you want.

11:28 semperos: colloquy on mac is nice

11:29 irssi takes a little bit of dedication to get comfortable with :)

11:29 technomancy: plus you have to not be allergic to perl

11:30 franks: semperos: tried colloquy, but didn't let me search - felt it was half baked

11:31 manutter: mmm, perl...

11:32 franks: terminal-based irc-client... the mac has turned me into too much of a softy for that...

11:35 jsabeaudry: franks: I beleive I used XChat Aqua before and it was fine.

11:35 fridim: if 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:36 lucian: franks: i liked LimeChat

11:38 pandeiro: emacs for everything. there, i said it.

11:38 franks: Just found "Linkinus"... seems to be in active development/support...

11:40 llasram: Using ERC here. If you use Emacs, I see little reason to use any other client

11:40 pandeiro: attaboy llasram

11:41 TimMc: technomancy: I haven't had to touch perl in my use of irssi.

11:41 melipone: llasram: I use emacs.

11:42 franks: (... waiting for the vi-boys to react and witness this age-old feud to play out again for the gazillions time ;-) )

11:42 melipone: TimMc: thanks! it worked!

11:43 TimMc: franks: Does vi have an IRC client?

11:43 pandeiro: TimMc: touche'

11:43 Does vi have org-mode?

11:43 franks: TimMc: wouldn't know as I used to use emacs...

11:44 TimMc: franks: There's really not very much sparring in here over emacs and vi.

11:44 melipone: boys, don't start the editor wars again ...

11:44 TimMc: I think vi is the second most common editor used by people in this channel.

11:44 * lucian uses Emacs with Evil mode

11:45 llasram: Yarh, 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:45 lucian: but i really liked LimeChat, enough that i'd like to write my own cross-platform version

11:45 pandeiro: llasram: i was just horsing around, vim is great, emacs is great, everyone wins... some just win a little more

11:46 TimMc: I use Emacs locally, and my IRC client runs under screen on a server. Using ERC would be really annoying.

11:46 unless I had a bouncer, I guess.

11:46 pandeiro: TimMc: i assume ERC can't connect to your server as a proxy or something?

11:46 franks: lucian: thanks - I'll take a alook at LimeChat

11:47 TimMc: pandeiro: No idea. NOt enough motivation to muck round.

11:47 *around

11:47 pandeiro: TimMc: i've never even looked at the manual for ERC, but that's what i love about it..

11:47 zero features, zero configuration

11:48 TimMc: Sounds Mac-ish.

11:48 pandeiro: yeah but you don't need to send money to Apple

11:49 franks: How do i easily convert a string into a var that i can use in (doc ...)?

11:51 How to I get a fully qualified symbol from a symbol? (kind of lost in the string, (fully qualified) symbol, var, namespace...)

11:51 cemerick: ,(resolve (symbol "reduce"))

11:51 clojurebot: #'clojure.core/reduce

11:52 cemerick: doc is a macro that dumps the :doc metadata of a var to stdout; presumably that's not what you want?

11:55 franks: I want it in a string, and was looking at (with-out-str (doc reduce))

11:55 cemerick: ,(-> "reduce" symbol resolve meta :doc)

11:55 clojurebot: "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:55 TimMc: sniped

11:57 doc does a little more than that, actually

11:57 &(macroexpand `(doc reduce))

11:57 lazybot: ⇒ (clojure.core/doc clojure.core/reduce)

11:57 TimMc: grr

11:57 cemerick: yeah, well, whatever ;-)

11:58 pandeiro: &(macroexpand-1 `(doc reduce))

11:58 lazybot: ⇒ (clojure.core/doc clojure.core/reduce)

11:58 cemerick: huh, ns documentation is broken via doc

11:58 TimMc: I'm wondering if lazybot's doc is a function...

11:59 &doc

11:59 lazybot: java.lang.RuntimeException: Can't take value of a macro: #'sandbox6832/doc

11:59 TimMc: nope!

11:59 &(macroexpand-1 `(clojure.repl/doc reduce))

11:59 lazybot: ⇒ ((var clojure.repl/print-doc) (clojure.core/meta (var clojure.core/reduce)))

12:00 franks: nice bot!

12:01 TimMc: $botsnack

12:01 lazybot: TimMc: Thanks! Om nom nom!!

12:01 pandeiro: strange that it shows doc being in clojure.core, that's not right is it?

12:01 llasram: pandeiro: That's the just symbol-resolving result of syntax-quote

12:01 TimMc: llasram: It works correctly in my REPL though.

12:01 pandeiro: yeah mine too

12:02 llasram: Er, s,symbol-resolving,namespace-scoping,

12:02 TimMc: Whatever you call it, lazybot is doing it differently.

12:02 ,`(doc reduce)

12:02 clojurebot: (clojure.repl/doc clojure.core/reduce)

12:03 TimMc: clojurebot: Slow, but sometimes even correct.

12:03 clojurebot: No entiendo

12:03 llasram: Which 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:04 franks: still not clear how you would convert a string into something that doc groks... (doc (resolve (symbol "reduce"))) doesn't work

12:04 &(doc (resolve (symbol "reduce")))

12:04 lazybot: java.lang.SecurityException: You tripped the alarm! resolve is bad!

12:06 franks: getting to the :doc property is nice, but doc also give you the arity and such

12:06 ... and i just like to understand how and why this string/symbol/var mapping works...

12:07 TimMc: franks: doc is a macro, it expects a symbol literal.

12:08 &(doc (quote reduce))

12:08 lazybot: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol

12:09 llasram: And 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:09 TimMc: You can get around that. :-)

12:09 llasram: (I mean, you could reach in and use the function anyway, but etc etc)

12:09 Yes yes :-p

12:11 semperos: I find it surprising how often I've found private core functions useful in my apps

12:12 TimMc: &(-> #'reduce meta (#'clojure.repl/print-doc))

12:12 lazybot: ⇒ ------------------------- 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:15 pandeiro: is there something i can use to iterate over two sequences at the same time?

12:17 TimMc: pandeiro: (map ... (map vector ...))

12:17 pandeiro: TimMc: thanks, i think for can do what i want but i've screwed it up somewhere

12:17 TimMc: Or hell, just (map f s1 s2)

12:18 pandeiro: (for [x s1 y s2] ...) does a cartesian cross

12:18 pandeiro: TimMc: thanks, that was the issue... i glanced at the docstring but hadn't digested it

12:19 map is better in this case

12:19 it's weird using map to produce side effects

12:20 TimMc: &(doc doseq)

12:20 lazybot: ⇒ "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:20 pandeiro: TimMc: yeah but then I want the op to eval to true if it succeeds

12:21 so i am gonna use (every? #(not (nil? #)) (map ...))

12:21 llasram: What about `reduce' then?

12:22 TimMc: pandeiro: (every? identity ...)

12:22 pandeiro: TimMc: nice llasram: i admit my mind still has issues comprehending reduce well enough to use it

12:22 llasram: Oh, yeah, nm -- early abort

12:22 pandeiro: it would abort on the first nil?

12:22 llasram: every? would, yes

12:23 pandeiro: ok good that's what i want

12:23 TimMc: and the side effects from further iterations would not happen.

12:34 franks: ,(let [s "reduce"] (eval (read-string (str "(doc " (with-out-str (print s)) ")"))))

12:34 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

12:34 franks: ahh - kind mess with the bot's internals...

12:35 TimMc: franks: No need to do that. Just use the print-doc method.

12:49 franks: ,(let [w "reduce"] (-> w symbol resolve meta (#'clojure.repl/print-doc)))

12:49 clojurebot: -------------------------

12:49 clojure.core/reduce

12:49 ([f coll] [f val coll])

12:49 f should be a function of 2 arguments. If val is not supplied,

12:49 returns the result of applying f to the first 2 items in coll, then

12:49 applying f to that result and the 3rd item, etc. If coll contains no

12:49 items, f must accept no arguments as well, and reduce returns the

12:49 result of calling f with no arguments. If coll has on...

12:50 franks: TimMc: thanks for showing that trick how to invoke a private function.

12:50 (although why are they called private again ? ;-) )

13:05 thoefer: guys with compiler-skills here >> PREDICT(X → ; P X) intersection PREDICT(X → eps) = what´s the result set of this?

13:11 amalloy: is this somehow tangentially related to clojure?

13:12 thoefer: absolutely not...

13:13 I always believed that lisper´s love their language more than others... :)

13:15 tsdh: How do I get the Class object that int.class would return in Java?

13:18 clj_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:18 amalloy: &Integer/TYPE

13:18 lazybot: ⇒ int

13:19 amalloy: &(instance? clojure.lang.IMeta java.lang.Class) ;; clj_newb

13:19 lazybot: ⇒ false

13:19 amalloy: there is no place to put metadata

13:20 clj_newb: amalloy: brilliant

13:20 TimMc: Huh, defrecords don't get IMeta?

13:20 clj_newb: I want to attach meta deta to the _class_ that the defrecord generates, not instances

13:20 amalloy: TimMc: their instances do...

13:20 TimMc: Oh!

13:21 clj_newb: If Clojure didn't define the class of the thing you want to attach metadata to, it ain't gonna support metadata.

13:22 clj_newb: TimMc: every day I get more and more disappointed that clojure is less magical and more clever engineering

13:22 duck1123: When 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:22 RickInGA: amalloy I am trying to run the &Integer/Type you wrote, could you put that in an s expression?

13:22 clj_newb: is inspector.clj used by anyone? it seems like a clever way to do a gui repl / debugger but I can

13:23 dig up tutorials on it on google

13:23 amalloy: &(Integer/TYPE) :P

13:23 lazybot: ⇒ int

13:23 amalloy: probably the relevant point is that & is just there to wake up lazybot, not as part of the expression

13:23 RickInGA: wierd, I get Unable to resolve symbol & in this context

13:23 ah, ok :)

13:24 nice... thanks

13:24 solussd: what'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:25 tsdh: amalloy: Ah, yes, that rings a bell. Thanks.

13:26 amalloy: (binding [*out* (clojure.java.io/writer (java.io.File. filename))] ...)?

13:26 probably deserves a with-open in there as well

13:28 solussd: ah, that's what I want- same as clojure.io/make-writer?

13:28 *clojure.java.io/make-writer

13:32 jrgarcia: Is there a way to add a docstring to a defrecord? If not, why?

13:35 pjstadig: anyone want a job doing clojure at sonian?

13:36 amalloy: make-writer is rather lower-level, isn't it?

13:37 solussd: ah, yes.

13:37 amalloy: jrgarcia: 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:43 fliebel: Raynes: ping

13:43 Raynes: fliebel: Man, I didn't expect you to actually care enough to ping me. Go away. :p

13:44 fliebel: laughing out loud :)

13:45 Raynes: fliebel: 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:46 For 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:47 But 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:48 All 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:48 fliebel: Raynes: okay, sounds like fun

13:48 Raynes: And to anybody else listening, the context of this discussion is "What's wrong with Gist [that made you guys write refheap]?"

13:49 fliebel: Raynes: Do you autodetect languages? I really like tha Gist does that, but hate how it's implemented.

13:49 Raynes: fliebel: No. The only reason gist can do it is because they have filenames. We don't have anything like that.

13:50 Language autodetection without some obvious cue (like a file extension) is pretty hard.

13:50 fliebel: You 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:51 Raynes: Really? I've never noticed before, I guess.

13:51 fliebel: Maybe I'm making things up.. let me try.

13:51 tmciver: Raynes: is refheap online somewhere?

13:51 Raynes: tmciver: The code or the website?

13:52 tmciver: website

13:52 Raynes: https://refheap.com

13:52 amalloy: gist does autodetect languages, but it's fairly primitive iirc

13:52 Raynes: Because it's haarrrdd.

13:53 amalloy: indeed. 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:54 carlos_: hi

13:54 is there a way to use a default pair to a map?

13:54 I would prefer this than using cond

13:55 Raynes: You can supply a default for 'not found' when you query the map: ##({:a 1} :b 2}

13:55 Well.

13:55 &({:a 1} :b 2})

13:55 lazybot: java.lang.RuntimeException: Unmatched delimiter: }

13:55 Raynes: Damn it.

13:55 carlos_: haha :D

13:55 * Raynes wipes sleep from his eyes.

13:56 Raynes: &({:a 1} :b 2)

13:56 lazybot: ⇒ 2

13:56 Raynes: Same with get: ##(get {:a 1} :b 2)

13:56 lazybot: ⇒ 2

13:57 carlos_: Raynes, how would you supply the default value when querying? using if?

13:57 it would be so nice if clojure support a don't care like the "_" inside maps

13:57 Raynes: In my above example, it's the last argument. The 2.

13:58 carlos_: Raynes, yes, but the :b is a match

13:59 joly: :b doesn't match any key in the map, so 2 is returned

13:59 carlos_: Raynes, joly, of course. sorry. thanks!

14:00 this is quite cool! I can every condition in a map like some kind of discrete irregular function

14:28 clj_newb: with defrecord, is it also possible to declare class members, rather than just instance members?

14:29 TimMc: I don't think defrecord is meant for such things.

14:30 manutter: clj_newb: consider using namespaces for stuff like that: i.e. put your defrecord in a namespace by itself

14:30 then you can use namespace vars like class members

14:31 with the caveat that you might end up writing Java in clojure instead of writing clojure. :)

14:32 clj_newb: (thinking)

14:38 (resolved)

14:38 thanks :-)

14:39 manutter: :)

14:39 solussd: someone 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:39 let me rephase that :) I'll write one unless someone points me at an existing one.

14:42 on a related note, has anyone used JTux?

14:45 manutter: what's JTux?

14:48 clj_newb: solussd: you know, clojure is also lacking a smalltalk-like debugger ....

14:48 solussd: ;)

14:50 JTux is a "Java to Unix" library-- lets you make system calls, like chmod, from java

14:51 manutter: ah cool

15:46 tolstoy: Is JTux generally up to date?

15:47 jamiltron: Holy crap ClojureScript One looks amazing.

15:48 Raynes: I'm not sure I get it.

15:48 It's good documentation with a bizarre and cutesy name?

15:50 jamiltron: That looks like the idea with a sample app. For me good documentation is one of the most exciting thing about any project.

15:50 Especially for me, being that I haven't really groked Clojurescript yet.

15:51 solussd: I 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:51 RickInGA: yeah, I am looking forward to working through those

15:51 dnolen: jamiltron: it's pretty cool, they've been working on it hard for a while.

15:54 TimMc: solussd: Sure, if it's on the classpath.

15:55 solussd: classes/ is on the classpath

15:58 TimMc: try-it-and-see!

16:02 vijaykiran:

16:05 Raynes: dsantiago: ping

16:22 _carlos_: hi

16:23 nican: hi

16:23 _carlos_: &{1 "hi" 2 "bye"} 1

16:23 lazybot: ⇒ {1 "hi", 2 "bye"}

16:24 _carlos_: &({1 "hi" 2 "bye"} 1)

16:24 lazybot: ⇒ "hi"

16:24 bartj: /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 &({1 "hi" 2 "bye"} 3)

16:26 lazybot: ⇒ nil

16:26 _carlos_: I don't have this map to return nil, but to return some default value of my choice

16:27 jowag: &(get {1 "hi" 2 "bye"} 3 "default value")

16:27 lazybot: ⇒ "default value"

16:27 jowag: ^this

16:29 _carlos_: oh.. weird.. didn't work early. of course, it is my fault ^^"

16:30 *earlier

16:33 jowag: anyways, what is the reason for returning "default value"?

16:34 jowag: _carlos_: well you wanted to have something else instead of nil, if key is not found

16:34 Raynes: _carlos_: ##({:a nil} :a)

16:34 lazybot: ⇒ nil

16:35 Raynes: How would you know if nil is the actual value of the key, or if the key wasn't found at all?

16:35 jowag: _carlos_: third argument in get is for specifying what clojure should return if key is not found

16:35 Raynes: In those cases, you'd have to be able to return something other than nil in the event of a not found.

16:35 jowag: ,({nil nil} nil)

16:35 :)

16:35 clojurebot: nil

16:36 jowag: .(get {nil nil} nil :not-found)

16:36 ,(get {nil nil} nil :not-found)

16:36 clojurebot: nil

16:36 _carlos_: &({1 "hi" 2 "bye"} 3 "default value")

16:36 lazybot: ⇒ "default value"

16:36 _carlos_: so there is an implicit get here?

16:37 amalloy: _carlos_: not really. it doesn't hurt to think of it that way, though

16:38 TimMc: I'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:40 amalloy: yeah, more or less

16:41 jsabeaudry: I 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:46 nickmbailey: ,(= Double/NaN Double/NaN)

16:46 clojurebot: false

16:46 nickmbailey: why is that ^

16:47 kephale: ,(Double/isNaN Double/NaN)

16:47 clojurebot: true

16:48 blakesmith: ,(.equals Double/NaN Double/NaN)

16:48 clojurebot: true

16:48 nickmbailey: blakesmith: right which is why i was wondering why the clojure version fails

16:49 have a unit test that compares a vector that has NaN in it and the asserts are failing for that reason

16:54 amalloy: nickmbailey: 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:54 snamellit: IEEE-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:57 lazybot: java.lang.SecurityException: You tripped the alarm! def is bad!

16:57 _carlos_: hun?

16:57 def is awesome

16:57 amro: not for a bot

16:58 nickmbailey: http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Double.html#equals(java.lang.Object)

16:58 the java impl special cases comparing NaN and NaN

16:58 but 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:03 nickmbailey: don't suppose there is already a version of '=' that handles NaN in contrib or something?

17:04 well nvm, i'll just filter out the NaNs

17:07 * devn does a jig for http://clojurescriptone.com/getting-started.html

17:08 devn: This is really, really great.

17:18 cgray: is this a bad idea: (defmacro ! [e & es] (if (empty? es) `(comp not ~e) `((comp not ~e) ~@es))) ?

17:20 brehaut: cgray: well, to start with, (complement f) = (comp not f)

17:20 cgray: ahh, good point

17:20 comp not is shorter to type though :)

17:21 amalloy: (def ! complement)

17:21 DONE

17:21 cgray: boom

17:22 amalloy: ,(complement identity true)

17:23 it might be nice to say (! identity true)

17:23 that's the point of the macro

17:23 amalloy: i know it doesn't do what your macro did, but it shortens the horribly-long name of complement

17:23 cgray: i see

17:23 amalloy: i think that's a terrible idea, personally

17:23 just write (! (identity true))

17:23 brehaut: cgray: have you looked at not= ?

17:24 cgray: brehaut: yeah, I know about not= I see (comp not) in a lot of places

18:17 mrevil: is it possible to upgrade to leiningen 2.0-snapshot yet?

18:25 nvm, i just realized that there is a 1.x branch which is what i really nead

18:25 need

18:29 geoffeg: does anyone know where i can get the slides for this talk? http://blip.tv/clojure/clojure-concurrency-819147

19:16 technomancy: mrevil: I hope to have a usable preview of leiningen 2.0 by clojurewest

19:56 seancorfield: anyone 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:57 when i call read-json - with any argument - i get NoSuchMethodError: clojure.lang.Numbers.isNeg(I)Z

19:57 clojure 1.3.0

19:58 amalloy: mismatched clojure versions. something is AOT compiled against clojure 1.2 and you're running it on 1.3

19:59 seancorfield: hmm...

20:01 i don't believe i have anything AOT compiled

20:01 certainly nothing against clojure 1.2

20:01 amalloy: well, contrib is AOT-compiled. i'd check your classes/ or similar

20:02 seancorfield: i don't have a classes folder

20:04 amalloy: i dunno where the misbehaving class is, but that error message *screams* 1.2

20:05 since isNeg made the transition along with everything else from int->long, and the method signature is isNeg(int) returning boolean

20:07 seancorfield: i agree with your reasoning... i'm just trying to think where an AOT 1.2 class could have come from...

20:07 hmm, a lein plugin perhaps?

20:07 amalloy: could be. i don't understand lein plugins

20:11 seancorfield: yup, either immutant or cljsbuild was the culprit

20:12 probably the latter since that was my most recent install

20:13 thanx amalloy

20:14 amalloy: welcome

20:45 _carlos_: anyone knows how to express % in terms of infinite arguments?

20:45 brehaut: ,(#(prn %&) 1 2 3)

20:46 clojurebot: (1 2 3)

20:46 brehaut: in hindsight, not your question

20:47 _carlos_: brehaut: weird, didn't work with this one:

20:47 (def p #({1 "hi" 2 "bye"} %& "default value"))

20:49 brehaut: _carlos_: what doesnt work?

20:49 it should always return "default value"

20:50 %& 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:50 brehaut: _carlos_: then you want a map

20:51 ,(#(map {1 "h1" 2 "bye"} %&) 1 2 3)

20:51 clojurebot: ("h1" "bye" nil)

20:57 _carlos_: ,(#(map {1 "h1" 2 "bye"} %& "default value") 1 2 3)

20:57 clojurebot: ("h1" "bye" \f)

20:58 _carlos_: haha, \f is the third character of "default".. random!

21:05 brehaut: _carlos_: map with multiple seqs is a zip

21:06 ,(map vector [1 2 3] [:a :b :c])

21:06 clojurebot: ([1 :a] [2 :b] [3 :c])

21:06 brehaut: zip-with to be precise

21:07 "default value" is an argument to the function 'map', not the map-literal {1 "hi" 2 "bye"}

21:10 alandipert: brehaut, you should update your excellent clj web stack post with cljs:one :-)

21:11 brehaut: alandipert: i want to do an update to all the latest versions of clojure and the libs, and also do one on noir

21:11 alandipert: but yes, definately :)

21:11 alandipert: sweetness

21:11 had a chance to play with it yet?

21:11 brehaut: clojurescript one ?

21:11 alandipert: yeah

21:12 brehaut: sadly no

21:12 first day back in the office today, and a whole lot of holiday period crap to take care of first :(

21:12 alandipert: i hear you

21:13 Raynes: brehaut: If you need any help with the Noir post, let me know.

21:13 brehaut: Raynes: noted :)

21:13 Raynes: brehaut: Also, definitely*

21:13 brehaut: Raynes: thanks :P

21:13 Raynes: Are all New Zealanders illiterate or is it just you?

21:13 brehaut: im just lazy

21:13 Raynes: :p

21:14 brehaut: although, 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:14 alandipert: Raynes, belated congrats on refheap

21:14 Raynes: alandipert: <3

21:18 alandipert: Quick! Paste all of Relevance's secrets!

21:19 alandipert: the specific brand of stuart sierra's hair color is highly privileged info, i would never

21:19 Raynes: Psh.

21:19 Probably splat!

21:20 alandipert: curses

21:20 Raynes, doing cljwest?

21:25 brehaut: speaking of cljs:o ive already learnt some little tricks from reading the uberdoc

21:25 (eg, html-parse to get around enlive's html-snippet discarding doctypes)

21:27 alandipert: i dig the whole macro/enlive collaboration, turned my no-eval frown upside down

21:28 although now with enfocus there are other interesting possibilities

21:28 brehaut: alandipert: do you have some examples i can look at?

21:29 (of the macro/enlive colab)

21:30 alandipert: src/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:31 brehaut: huh. thats very clever

21:31 espringe: Is 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:32 e.g. you could have could have an inventory collection, and access it (efficiently) either via barcode or via price or via location

21:34 dnolen: espringe: nothing I know of that does that for you but could easily be done.

21:45 alandipert: brehaut, yeah it's wild. high-five brenton when you next see him

21:45 dsantiago: What 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:45 brehaut: alandipert: if i make it to the states, i have a lot of high-fives to give out

21:45 dsantiago: What is Clojurescript doing there to extend the primitives safely?

21:47 alandipert: dsantiago, protocols atop javascript prototypes

21:47 dsantiago: I mean, is it actually modifying the prototype of Object or whatever?

21:49 dnolen: dsantiago: namespacing

21:49 dsantiago: Yes, I know namespacing. How does namespacing help if you're modifying Object?

21:49 dnolen: dsantiago: String.prototype.cljs.core$first = ...

21:50 dsantiago: Object.prototype.com.dsantiago$foo = ...

21:50 oops that should be, String.prototype.cljs$core$first, but you get the idea

21:51 brehaut: dnolen: are those namespaces nested objects, or just strings?

21:51 dnolen: brehaut: sorry, it's not nested objects, just properties w/ munged names created by the compiler

21:52 brehaut: dnolen: thanks. that makes sense

21:53 dsantiago: OK, thanks dnolen.

21:55 dnolen: brehaut: 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:55 dsantiago: Yeah, 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:56 dnolen: dsantiago: nope very simple and efficient and optimizable by Google Closure

21:56 dsantiago: Does that break for…in?

21:57 brehaut: dsantiago: no more than anything on a prototype

22:00 dsantiago: My buddy who works on Closure is concerned because Closure itself does still use for..in in certain places, and he finds it worrisome.

22:02 Fortunately, I don't think there's ever anything that forces you to extend browser primitives this way.

22:02 dnolen: dsantiago: I don't see why for..in is a problem ever

22:02 in anycase sounds like an anti-pattern in ClojureScript

22:03 in JS makes sense for some wretched runtime metaprogramming

22:03 dsantiago: It perhaps requires a footnote.

22:04 y3di: has anyone in here installed leiningen in windows before?

22:04 dnolen: dsantiago: why? you never know what you're going to get when iterating properties not even across browsers.

22:08 dsantiago: Yeah, I don't know if this is something that can cause an actual problem or not.

22:09 notostraca: y3di, yes

22:09 lein.bat

22:09 JohnnyL: what s good web framework for clojure and is it mature enough to use on a wxp box?

22:10 brehaut: JohnnyL: thats a complicated question

22:10 scottj: JohnnyL: noir is the most popular these days

22:10 brehaut: noir is the library that most represents a framework

22:10 s/represents/resembles/

22:10 scottj: well conjure might win there :)

22:11 brehaut: ssh

22:11 seancorfield: or FW/1 (framework one)

22:11 :)

22:11 brehaut: JohnnyL: do you know about ring yet?

22:12 seancorfield: noir is definitely the best documented and most popular right now tho'

22:12 brehaut: seancorfield: clojurescript:one is giving it a run for its money ;)

22:12 JohnnyL: brehaut: i'm a clojure newb. :)

22:12 brehaut: (for docs at least)

22:13 JohnnyL: 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:13 seancorfield: i 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:15 JohnnyL: brehaut: thanks.

22:15 thanks guys.

22:18 seancorfield: dumb repl Q: how do i delete / remove a var i no longer want?

22:19 brehaut: seancorfield: ns-unmap i believe

22:20 seancorfield: thx

22:21 yup, that worked brehaut !

22:23 ckirkendall: is anyone else getting an exception when they try to run clojureone

22:23 sorry clojurescript one

22:25 alandipert: ckirkendall, no - what are you seeing?

22:25 ckirkendall: ClassNotFoundException com.google.common.collect.ImmutableList java.net.URLClassLoader$1.run (URLClassLoader.java:202)

22:25 y3di: when 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:26 ckirkendall: alandipert: I am running ubuntu

22:26 alandipert: y3di, no windows dev support - yet

22:27 y3di: ah

22:27 f3f: Any soul (besides hugod) ever wrote Maven plugins (Mojos) in Clojure ?

22:28 alandipert: ckirkendall, which jdk?

22:28 cmwelsh: how new is closurescript:one? I just read an article about it this evening

22:28 f3f: I 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:28 alandipert: cmwelsh, released today

22:29 ckirkendall: Java(TM) SE Runtime Environment (build 1.6.0_22-b04)

22:30 alandipert: ckirkendall, this happens when you script/run?

22:30 ckirkendall: yep and dumps me into a repl

22:30 but no running server

22:31 alandipert: ckirkendall, hm. have not seen before and can't reproduce (on debian). mind filing a ticket? stack trace and platform details helpful

22:31 ckirkendall: alandipert: by the way I spent the last few hours reading through the code and I am beyond impressed

22:32 will do

22:32 alandipert: ckirkendall, thanks i'll pass it on. brenton made it, i just use the thing :-)

22:36 cmwelsh: the site and the documentation page are built using closurescript:one?

22:36 or is it closurescript one

22:37 alandipert: cmwelsh, docs built with marginalia

22:37 (with custom theme)

22:45 f3f: hey, this clojurescript:one smells really good

22:59 jyaan: How 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:00 Well, perhaps I should say "I don't know" rather than "it's broken"

23:01 bbhoss: Is this the proper place to ask about Clojurescript One? I'm having some trouble getting chrome to connect to the development REPL.

23:03 dnolen: bbhoss: how are you starting the repl?

23:03 bbhoss: dnolen: script/run then doing (cljs-repl)

23:04 it seems to work in firefox though, it's just chrome with the issue

23:05 NM, seems to be working now, odd

23:05 dnolen: bbhoss: sometimes you need to refresh the browser

23:05 bbhoss: dnolen: yeah, I did that but I guess I didn't do it enough :)

23:06 dnolen: bbhoss: cljs repl can be slow to start sometimes, and the connection method is less than stellar

23:06 bbhoss: dnolen: what does it use?

23:07 dnolen: bbhoss: hopefully someone will add websocket support for modern browsers

23:07 bbhoss: thats what I was wondering

23:07 dnolen: bbhoss: google cross page channel, since that works in every browser

23:07 bbhoss: interesting

23:07 Raynes: alandipert: Doesn't look like it.

23:08 bbhoss: can I use TextMate to develop things with clojurescript one/cljs or should I just use emacs

23:08 dnolen: bbhoss: I tried making TextMate work for Clojure, but TextMate is just awful for REPL centric development

23:09 bbhoss: yeah that's what I figured, how do you use it with emacs?

23:09 dnolen: bbhoss: Emacs, Vim, Eclipse, Clooj all provide nicer experiences IMO

23:09 jyaan: You have to install clojure-mode

23:09 bbhoss: I'm familiar with emacs, just more familiar with TM, but it sounds like I should be using emacs

23:09 Raynes: dnolen: Check out SublimeREPL. Not all that useful, but it's a start.

23:09 brehaut: i second ditching TM

23:09 Raynes: Also not textmate, but close enough.

23:09 brehaut: (for clojure)

23:09 jyaan: It's really easy with leiningen

23:09 bbhoss: jyaan: is that in the emacs package manager?

23:10 jyaan: yes

23:10 dnolen: bbhoss: (setq inferior-lisp-mode "path/to/repl/script") in .emacs, then M-x run-lisp

23:10 jyaan: wait, leiningen or clojure-mode

23:10 Raynes: Marmalade.

23:10 dnolen: bbhoss: then you can just interact with the browser right from the text editor on the fly.

23:10 alandipert: dnolen, you think websocket would make repl noticeably faster?

23:10 dnolen: gotta run

23:10 Raynes: Guys. 50 different things at once is less helpful.

23:10 bbhoss: I have leiningen, not really sure what it does though jyaan

23:10 jyaan: haha

23:10 it's for project management, basically

23:11 dnolen: alandipert: pretty darn sure, my node.js repl screams compared to browser repl

23:11 l8r

23:11 alandipert: dnolen, don't agree but haven't measured ;-)

23:11 ciao

23:11 bbhoss: jyaan: how does lein relate to what I'm trying to do here?

23:12 jyaan: it has a plugin called "swank-clojure", it handles all the details of starting up slime for you

23:12 which is what pretty much everyone uses w/ emacs

23:12 bbhoss: ok, I will look at that then

23:13 brehaut: bbhoss: leiningen is the user interface to clojure; it provides (for a beginner any) command line tools (run, repl, build), and dependancy resolution

23:14 jyaan: bbhoss: are you familiar with emacs already?

23:14 bbhoss: jyaan: a little bit, I know the basics

23:16 jyaan: well, first you need to get clojure-mode in your load-path

23:16 jonasen: https://refheap.com/paste/240

23:16 ^ has anyone seen a similar error when trying ClojureScript One?

23:17 bbhoss: jyaan: 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:17 or what do you recommend to get started with, I don't really have Emacs setup

23:17 jyaan: then 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:18 1.4.0-snapshot has slime packaged so you don't have to install anything except emacs with clojure-mode and leiningen

23:19 before 1.4.0-snapshot you need to add a few more lines of elisp code to your .emacs

23:21 are you on a unix-like system or windows

23:21 bbhoss: os x

23:21 jyaan: ok that makes it easier

23:21 bbhoss: :)

23:22 I've tried some starter kits before, but I can never get the things to work right and give up

23:22 jyaan: what a lot of ppl do (myself included) is make a lib folder in your ~/.emacs.d folder

23:22 Well on OSX I use Aquamacs

23:22 On others I use GNUEmacs (actually I like it better)

23:22 bbhoss: jyaan: did that update it to 24 yet?

23:22 aqua

23:23 jyaan: Not sure

23:23 alandipert: jonasen, which browser?

23:23 brehaut: emacsforosx.com/

23:23 jyaan: I think they are still on 23 but i could be wrong

23:23 yea they're based on 23.3

23:23 Raynes: bbhoss, jyaan: There are builds there for 24.

23:23 Get them.

23:23 They work fine.

23:24 brehaut: ^ that url has builds of 24 for os x and its 'real' emacs rather than a diversion like aquamacs

23:24 bbhoss: yeah I've used both

23:24 Actually I already have 24.0.91.1 installed

23:25 jyaan: well 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:25 bbhoss: So I have ELPA, but it doesnt look like clojure-mode is installed

23:25 jyaan: then put (require 'clojure-mode)

23:25 bbhoss: ok

23:25 jyaan: that's really about it

23:25 yea or do the package way

23:25 I don't use package.el myself though

23:26 Raynes: You don't need (require 'clojure-mode) after installing it from elpa.

23:26 M-x package-install RET clojure-mode

23:26 bbhoss: Raynes: it doesn't look like it shows up in list-packages

23:26 jyaan: yea that's why I said "or teh package way"

23:27 Raynes: You don't have marmalade set up.

23:27 jyaan: i was talknig about just doing it manually

23:27 Raynes: (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/&quot;))

23:27 bbhoss: ^ Add that to your .emacs (or init.el or whatever you use).

23:27 bbhoss: Raynes: init.el is run if it exists inside of emacs.d right?

23:28 Raynes: Yes.

23:28 jyaan: yes, and you should prefer that instead IMO

23:28 Raynes: Place 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:28 jyaan: you should structure your elisp files like any other project

23:28 Raynes: Let's get clojure-mode installed first

23:29 bbhoss: Raynes: do I need to update the package list? It still says not found

23:29 Raynes: Yes.

23:29 jonasen: alandipert: chrome

23:30 bitpimp: alandipert: greetings

23:30 you know it

23:30 alandipert: bitpimp, ahoy

23:32 jonasen, hm, that is mysterious. there's always the cargo cult of browser refresh

23:32 bbhoss: ok, clojure-mode appears to have installed, now what?

23:33 jyaan: you said you have lein right

23:33 bbhoss: yep it's installed

23:33 FYI I am playing with this clojurescript one thing I saw on HN, not sure if you've seen it

23:33 it seems somewhat opinionated

23:33 jonasen: alandipert: No luck with browser refresh, same error.

23:34 jyaan: Ok so you go to somewhere like ~/Projects and run "lein new PROJECTNAME" in a terminal

23:34 alandipert: jonasen, mind making a ticket with platform/version details? 'tis a strange one

23:35 bbhoss: jyaan: ok it looks like this project already has it setup with a project.clj etc

23:35 jyaan: then just add :dev-dependencies [[swank-clojure "1.4.0-SNAPSHOT"]]

23:35 yes you get a default layout

23:35 bbhoss: jyaan: add that where?

23:35 Raynes: You don't need that added to dev-dependencies.

23:35 jyaan: project.clj

23:35 Raynes: 'lein plugin install swank-clojure 1.3.3'

23:36 jyaan: that way you have to run "lein swank"

23:36 either is fine

23:36 latest swank-clojure you can do clojure-jack-in which is apparently preffered

23:36 jonasen: sure. I'm afraid it has something to do with character encodings. I've had problems with that before when using clojurescript

23:36 alandipert: ^

23:37 Raynes: jyaan: You can do clojure-jack-in with 1.3.3

23:37 jyaan: Oh my mistake then

23:37 alandipert: jonasen, could be... the server-side of the repl might have funky encoding headers

23:38 jonasen, you see the same behavior in other browsers?

23:38 Raynes: Firefox to the rescue!

23:40 bbhoss: jyaan: 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:41 jonasen: alandipert: similar error in firefox

23:41 bbhoss: jyaan: backtrace appears to be unrelated

23:42 alandipert: jonasen, does the app work when you compile with script/build?

23:42 jyaan: Should probably start with just Clojure to make sure things are set up correctly

23:42 bbhoss: exception: https://gist.github.com/b43615e5887247cd06c5

23:43 ok

23:43 Raynes: jonasen: Oh em gee, you used refheap!

23:43 jonasen: We should totally be friends.

23:44 jonasen: alandipert: it says [build complete]. No repl. How do I test it?

23:44 jyaan: I believe that exception means KeywordLookupSite got the wrong constructor call, if that means anything to you -- doesn't to me unfortunately

23:44 jonasen: Raynes: heh. I created a gist, then changed my mind.

23:45 Raynes: Good.

23:45 jyaan: Or rather that there is no constructor matching the parameters it was called with

23:45 Anyways let's just get the basics working and we can go from there

23:45 bbhoss: jyaan: alright I got a basic project setup with lein new, and pulled down swank with lein deps

23:45 alandipert: jonasen, not sure, it's not building for me ;-)

23:46 jonasen, last it worked you could open the generated index.html

23:46 Raynes: The first step to our success is to make people feel guilty when they create a Clojure-related gist.

23:46 jyaan: ok if it worked you should be able to enter 'M-x clojure-jack-in' from Emacs

23:46 alandipert: jonasen, sleep-time for me though, please do create a ticket

23:46 jyaan: And after some loading it will give a REPL

23:46 bbhoss: jyaan: do I need the project dired or project.clj loaded?

23:46 Raynes: You have to actually be editing a file in that project though.

23:47 jyaan: Right

23:47 Yea you have to

23:47 Raynes: Also, 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:48 jyaan: Yea it's worth doing if you know you'll be using the plugin all the time

23:48 bbhoss: alright, I have swank running

23:48 jonasen: alandipert: I'll create a ticket. (later, work-time form me...)

23:49 alandipert: jonasen, thanks!

23:49 jyaan: Alright great

23:49 bbhoss: so it split the buffer into two windows, one repl and one code, I assume I eval the code above or something?

23:49 jyaan: Yea you can also load the entire buffer

23:50 And you can use that code in the REPL

23:50 bbhoss: How do I go about doing that?

23:50 jyaan: There should be a slime tab

23:51 you can do C-h x C-c C-r

23:51 bbhoss: well it split into two "windows"

23:51 jyaan: to select all and then evaluate region

23:51 Yes but that buffer is linked to the repl

23:52 if you evaluate in the buffer the repl "knows" about it

23:52 so 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:53 or C-h x then C-c C-r to load the whole buffer

23:53 I think there might be anotehr, shorter, one for that

23:55 bbhoss: jyaan: I restarted emacs and it gives me an error in init.el: https://gist.github.com/aaa75b0b36a7dbfa8b9b

23:55 if I go into the file ane C-x C-e it evals fine

23:56 jyaan: let's see the init.el

23:56 ohh

23:56 wait

23:56 bbhoss: (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/&quot;)) is all

23:56 jyaan: yes

23:57 haha beat me to it

23:57 you forgot to add that too

23:57 I suppose we didn't mention that you had to save it, though, did we? :P

23:57 bbhoss: No, I saved what I had, what am I missing?

23:59 jyaan: yea hm i guess you got an error running the (add-to-list...

23:59 well i still need to see the file then

Logging service provided by n01se.net