#clojure log - May 09 2012

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

0:06 mmarczyk: dnolen: ping

0:07 dnolen: mmarczyk: pong

0:09 mmarczyk: dnolen: so what's the benchmarking story?

0:09 dnolen: mmarczyk: which part?

0:09 mmarczyk: dnolen: the deoptimization-triggering part

0:10 dnolen: not sure if I understand what you were referring to, although it seems like maybe that would explain some of the results I was seeing in node (things which made :simple faster making :advanced slower etc.)

0:10 dnolen: mmarczyk: have you looked at this http://jsperf.com/direct-vs-chain/4

0:10 ?

0:11 mmarczyk: dnolen: yes

0:13 dnolen: mmarczyk: just that putting too many non-function properties on the prototype seems to trigger deoptimization

0:13 mmarczyk: dnolen: but only just, haven't properly digested it yet

0:14 dnolen: mmarczyk: I seemed to encounter this - I had briefly added yet another prototype.flag = true, and things seems to slow down strangely.

0:14 mmarczyk: benchmark seems to confirm what I saw.

0:15 mmarczyk: dnolen: I see

0:16 dnolen: so piling cljs$lang$foo props on prototypes is not sustainable; all the more reasons to try and squeeze things into masks?

0:16 *reason

0:18 dnolen: mmarczyk: well it's only a problem in V8 seems like

0:19 mmarczyk: dnolen: an unusual occurrence.

0:19 dnolen: mmarczyk: more a reason to use only masks for inline protocol implementations - perhaps fall back on prototype flag for dynamic cases.

0:21 mmarczyk: dnolen: so, for inline definitions where we know the masks will include the appropriate bit there's no reason to put any extra flags on the prototype

0:21 dnolen: mmarczyk: yes

0:21 mmarczyk: we can use flags for non-inline extension to support interactive development.

0:22 mmarczyk: dnolen: worth investigating if instead of flags prototype-attached masks could be used?

0:22 dnolen: mmarczyk: I don't think so, I think non-inline extend-type should probably always use flags.

0:23 mmarczyk: otherwise you'll get inconsistent instance construction behavior.

0:23 mmarczyk: mask is static information that can only affect new instances.

0:23 mmarczyk: dnolen: well if it gets placed on the prototype then it no longer is, right?

0:24 dnolen: mmarczyk: if it get placed on the prototype then all instances get the new behavior.

0:24 mmarczyk: not true for protocol masks.

0:24 mmarczyk: dnolen: yes, I think we've discussed it previously

0:24 dnolen: so I'm thinking about having the instance-attached masks for top speed of inline impls and a prototype-attached mask (family of masks) as a fallback

0:25 dnolen: mmarczyk: oh sorry, misunderstood what you were saying.

0:25 mmarczyk: prototype-attached mask - good idea.

0:26 mmarczyk: :-)

0:26 dnolen: neotyk: ping

0:26 mmarczyk: dnolen: ok, in that case, I'll put something together today

0:26 dnolen: mmarczyk: cool!

0:26 mmarczyk: you should remove the flags if you do that.

0:27 mmarczyk: dnolen: right

0:38 dnolen: at long last you bootstrapping ClosureScript will use a newer version of GClosure.

0:41 mmarczyk: ! :-)

1:05 emezeske: ibdknox: ping

1:05 ibdknox: emezeske: only got a minute or two, what's up?

1:06 emezeske: ibdknox: any plans for a jayq release in the near future?

1:06 ibdknox: I'd be happy to

1:06 I'll push one later tonight

1:06 emezeske: You the man!

1:14 zakwilson: ibdknox: you write *lots* of libraries. Don't stop.

1:17 muhoo: what was that business where lazy seqs work in the repl but FAIL everywhere else?

1:18 i remember reading about it, but not how to work around it

1:19 hm, dorun maybe

1:19 nope, that's not it. dang

1:20 emezeske: It's not that they fail everywhere else, it's that they're lazy, and don't do work unless a result is actually used

1:20 You can force things with doall I believe

1:21 muhoo: ^

1:21 jlongster: anyone interested in helping me figuring out some issues with my CPS transformer?

1:22 muhoo: doall! thanks

1:25 hmm, not working still

1:25 works great in repl, not elsewhere. i'll have to keep digging

1:28 it's returning empty seqs

1:29 eggsby: hey, is there any 'replace nth' function in the core library?

1:29 given the nth value of some seq, replace with some other value

1:31 (replace-nth (list 1 4 3) 1 2) ;; => (1 2 3)

1:31 xeqi: &(assoc [1 4 3] 1 2)

1:31 lazybot: ⇒ [1 2 3]

1:32 muhoo: hah! fixed.

1:32 xeqi: well, doesn't work on lists

1:32 * muhoo is tired and needs to rest

1:34 muhoo: it is also WAY past time for passing around {:key value} pairs, and time to start using defrecord instead :-/

1:36 emezeske: muhoo: You working on something performance critical?

1:44 eggsby: thank you xeqi

1:50 muhoo: no, just a website.

1:50 and, i found another interesting thing. if i have a bug that causes an ns to not compile, noir often will simply not tell me

1:50 amalloy: jlongster: i'm far from an expert in CPS, but i have a vague understanding of the style and can often be helpful on sort of "general" issues, i suppose. perhaps if you gisted a description of your problem/code, someone could figure out whether they're capable of helping

1:50 muhoo: it will run the OLD version of the code

1:50 if i run "lein2 check", sure enough i see the compile error

1:51 but page refreshes won't actually throw a stacktrace. it'll just happily run whatever version was previous, causing me to scratch my head in confusion

1:51 new habit: run lein2 check OFTEN, or (require 'nsname :reload-all) in the repl

1:51 jlongster: amalloy: great! I gisted it a while ago, and just put up a new version: https://gist.github.com/2642050

1:52 amalloy: I'm writing in a Lisp that compiles to javascript, and didn't know how to handle set! and define without passing around environments

1:52 but I think I figured it out

1:53 I generate non-CPS `define` and `set!` so that the scoping works. not completely valid CPS, but serves my purposes

2:16 ForSpareParts: Would someone mind explaining transients to me? I get how you create them and that they have a parallel set of operations, but I don't understand what's actually *different* about them.

2:26 raek: ForSpareParts: the transient operations may modify some parts of the data structures in-place

2:32 echo-area: Would anyone like to comment this one: http://pastebin.com/rsbDev0d ?

2:34 alexbaranosky: echo-area, what do you need from the paste in particular?

2:34 echo-area: That's my paste. I just want your opinion about this program.

2:34 Suggestions, critics etc

2:35 s/critics/critiques/

2:35 muhoo: hmm, what does this binding form do: (let [{foo :bar} something] ...) ?

2:36 echo-area: muhoo: Taking :bar from something and bind it to foo

2:36 *binding

2:37 muhoo: ah, cool, thanks

2:39 alexbaranosky: echo-area, ok will do

2:40 echo-area, I'm going to be nitty picky

2:41 echo-area: Sure

2:41 alexbaranosky: (defn dropping-transform [fn coll] ;; fn is non-standard here, f is more common

2:41 echo-area: Okay

2:41 alexbaranosky: cus it is less confusing since fn has another meaning

2:42 (when-let [[first & rest] (seq coll)] ;; might not actually need 'seq' here

2:42 try it out, and let me know if that's true

2:42 echo-area: Okay

2:43 alexbaranosky: I think dropping-transform is already in core.clj as `keep`

2:43 just like map, but any nil results won't be in the resulting seq, right?

2:44 read-next-line is hard to read because it is so long, and has that big anonymous fn in it

2:44 echo-area, I'd pull that fn out and name it

2:45 amalloy: dropping-transform is a non-lazy version of keep, for whatever reason

2:45 echo-area: alexbaranosky: (when-let [[first & rest] coll] <-- This works

2:46 amalloy: and he does need to call seq at least once

2:46 either in the when-let, as he is now, or in the initial binding of the loop

2:46 alexbaranosky: amalloy, howdy

2:47 amalloy: echo-area: if you just take out that seq, your function breaks on empty sequences

2:47 echo-area: amalloy: You mean `keep'?

2:48 alexbaranosky: probably better to do the seq in (loop [coll (seq coll)] ...), right?

2:48 so it is only done once?

2:48 echo-area: amalloy: Oh I see what you meant.

2:48 amalloy: also, it doesn't look like you need dropping-transform at all? you could just (let [lines (filter interested-line? (line-seq reader))] ...)

2:48 alexbaranosky: yes, if he wanted to rewrite keep, that would be best

2:48 but since keep already exists, and he actually wants filter instead of keep, i'd just junk the whole thing

2:53 echo-area: `keep' and `filter' are better than my own solution. Thank you guys amalloy and alexbaranosky

2:54 There seems to be always "corner functions" that I don't know about, I think I need to read core.clj

3:01 brainproxy: anybody in chan that devs with nodejs in addition to clojure? want to give something a shot?

3:54 kral: morning

3:56 PeregrinePDX: morning

3:59 robertstuttaford: i have an xml document, and i want to convert it to json, and move a couple nodes around, and rename a couple nodes. clojure.zip, right?

4:49 echo-area: Is it idiomatic to write (= v (int \Q)) in Clojure? Will (int \Q) be compiled to 0x51?

4:51 AWizzArd: echo-area: int is a function call, and will be evaluated during runtime.

4:52 The good thing is: if Oracle changes the integer value of \Q the program will still work correctly.

4:52 robertstuttaford: what's the best way to pretty print json? i see clojure.contrib.json has pprint-json but i get the feeling it's old

4:52 AWizzArd: robertstuttaford: do you really need to pprint the json? Would it be acceptable for you to convert the json to Clojure and pprint that? It looks nearly identical, only that Clojure is a bit better.

4:53 echo-area: AWizzArd: So what's the idiomatic way to express that? Also, I notice there is :inline key in `int''s meta, when will it be used?

4:53 robertstuttaford: specifically writing code that produces json

4:53 for consumption by javascript app

4:53 clj_guest2012: is there a way to telnet to a clojure-swank session? (instead of using it from emacs)

4:53 basically,, I want to be able to send commands to my swank-clojure using vim via the "nc" commands

4:53 so I need to figure out what protocol swank uses

4:53 and send commands that way

4:54 robertstuttaford: thanks AWizzArd. i can get the structure right using clj forms and then convert right at the end.

4:56 AWizzArd: robertstuttaford: some/most json libs will probably produce compressed output, i.e. not human-readable.

4:57 echo-area: to express what? What you did looks pretty good to me.

4:57 echo-area: or you want the 0x51 compiled into your code?

5:01 echo-area: AWizzArd: Maybe I'm wrong, suppose `v' is a byte typed variable, is there any run-time cost besides comparing in Java in expression "v == 'Q'"?

5:02 If not, I want to express in Clojure the same purpose, and have the same effect -- no any other run-time costs besides comparing

5:09 Madsy: If I encapsulate a proxy in a function and call it several times, will it make N new classes, or reuse the "type" from the first invocation?

5:09 I wonder which practice is the best to follow when I need several instances of a thing.

5:09 AWizzArd: echo-area: the run time costs are very small. The value of v needs to be looked up and int needs to be called on the char \Q. Then those can be compared.

5:10 Madsy: it will create new instances.

5:10 Madsy: are you sure that you need proxy? If the original Java API was designed well then reify is what you want.

5:11 Unfortunately trillions of Java APIs are bad.

5:15 Madsy: AWizzArd: Thanks

5:15 echo-area: AWizzArd: So there's no other way to eliminate that cost, except writing like (= v 0x51)?

5:15 Madsy: AWizzArd: Yeah, I only need to specify callbacks and similar in Java Swing

5:16 AWizzArd: echo-area: you can run (int \Q) before compilation. Two possible ways: (= v #=(int \Q)) or: write a macro.

5:17 Madsy: in Swing both approaches are required: proxy and reify.

5:17 Madsy: well, you can always use proxy, as reify is only a subset of proxy. But it is more efficient, and documents your code for other developers by using reify.

5:18 echo-area: AWizzArd: Oh, thanks

5:19 Madsy: AWizzArd: Guess I'll just have to experiment a bit and see what works best.

5:23 echo-area: AWizzArd: And another question: where could I find the list of reader macros? Currently I can only find it in core.clj, but after your hint

5:27 robertstuttaford: newbie question about recursion: https://gist.github.com/2643276

5:33 espeed: I'm trying to run a regexp on a Groovy source file to parse out the individual functions. This is the pattern I'm using: (def pattern #"(?m)^def.*[^}]") however, it's only grabbing the first line, not the multiline func

5:36 Chousuke: my first thought was to not use regexps for parsing :p

5:37 it will probably be a lot easier and more maintainable if you use some parser combinator library. :)

5:44 espeed: are you sure it's not stopping the matches on newlines by default or something?

5:45 espeed: I thought the (?m) flag is supposed to enable multiline

5:51 robertstuttaford: i want to copy all key/value pairs in one map to another. how would i do that?

5:52 or, put another way, i have {:attrs {:one 1 :two 2} :content nil} and i want {:one 1 :two 2 :content nil}

5:57 AWizzArd: echo-area: on the Clojure website most reader macros are listed. Rich explicitly did not list the #= reader macro there, which forces the reader to evaluate an expression during read-time.

5:59 echo-area: AWizzArd: Okay. So I have to read more Clojure implementation to know these..

6:32 Borkdude: technomancy: is lein2 repl :connect supposed to work in windows?

6:35 technomancy: getting this error https://gist.github.com/2643628

6:38 jonaskoelker: why would you want to evaluate an expression at read-time?

6:38 Borkdude: technomancy: even with a normal "lein2 repl" I get it

6:39 jonaskoelker: when you want to pass something in a macro that you want to be evaluated before the macro sees it?

6:40 clgv: Borkdude: the macro can also decide to eval something (if that makes sense)

6:40 jonaskoelker: when does that come up?

6:41 clgv: it sounds strange, since a macro is intended for the opposite purpose: not to evaluate the params ;)

6:41 Borkdude: jonaskoelker: it comes up.. can't think of any good examples right now ;)

6:44 jonaskoelker: so... (println #=(+ 2 2)) would read the same way as (println 4)?

6:44 Borkdude: jonaskoelker: yes

6:44 jonaskoelker: and if I evaluate defmacro at read-time I can use macros while reading too?

6:44 Borkdude: except that println is already a function

6:44 jonaskoelker: ?

6:45 Borkdude: ,(source println)

6:45 clojurebot: Source not found

6:45 Borkdude: &(source println)

6:45 lazybot: java.lang.RuntimeException: Unable to resolve symbol: source in this context

6:45 Borkdude: well anyway, it's a function

6:45 jonaskoelker: the significance of that being? That it's not an example of read-time macros?

6:45 Borkdude: jonaskoelker: a function already evaluates all of its arguments before doing anything else

6:46 or better said: they are evaluated before the function sees them

6:46 jonaskoelker: sure, but you get read-time constant folding :)

6:46 teh speedz

6:47 Borkdude: if you want speed, go program assembly ;)

6:47 jonaskoelker: oh my god, lisp is slow!! XD

6:48 Borkdude: your brain is always slower

6:49 jonaskoelker: hm?

6:49 Borkdude: not your as in personally you, just mankind in general

6:49 jonaskoelker: I agree, but don't see how that enters the picture?

6:50 I just woke up, so hopefully I'm allowed to be slow :D

6:50 Borkdude: jonaskoelker: it doesn't really (development speed vs performance)

6:51 jonaskoelker: ah, 'k

6:56 hello, Rich. Nice work on clojure! One of those little things I love (and have thought of independently): vectors having integer keys. Python has always bugged me with .keys() vs. range() and .items() vs enumerate()

6:58 Borkdude: jonaskoelker: do you want to repeat what you said earlier about lisp now? ;)

6:59 jonaskoelker: sure: "oh my god, lisp is slow!! XD"

6:59 Borkdude was dissing the speed advantage of using read-time evaluation for constant folding :)

8:28 N8Dawg: Hello room, I often end up writing the following in my code: (if (p x) (f x) x) where p is a predicate and f a function to apply

8:28 is there a standard way to express this, e.g. a macro i'm missing?

8:29 gfredericks: N8Dawg: I don't think anything in the standard lib, but flatland/useful has something in the flatland.fn namespace

8:29 specifically fix

8:29 N8Dawg: fix is the name of the function?

8:29 gfredericks: yes

8:30 N8Dawg: thanks! would be nice to have this in core

8:31 clgv: N8Dawg: N8Dawg: 'alter-when or 'modify-when would be a good name. I vote for core inclusion ;)

8:32 N8Dawg: actually I just looked at the fix function in flatland

8:33 its really good, solves what i want and is more generic

8:33 clgv: oops. wanted to address gfredericks as well

8:33 echo-area: I define a proxy to java.io.InputStream, and only define `int read()', but call to `int read(byte[] b, int off, int len)' (which calls the former in InputStream's implementation) results in `Wrong number of args (4) passed to: xgp-test$make-hdfs-input-stream$fn'

8:33 What could be the reason?

8:35 clgv: echo-area: snippet?

8:35 echo-area: Stack backtrace is here:

8:35 http://pastebin.com/AhBvnqFR

8:35 clgv: Code?

8:35 clgv: jep

8:35 err. yes ;)

8:36 echo-area: http://pastebin.com/pquJcHdm <-- This is the code

8:37 FWIW, http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html is where InputStream's doc resides

8:39 (I haven't added type hints yet)

8:43 jweiss: any CCW users here? is there a way to pop up documentation for the symbol at point in the editor (or in the repl?) i can tab complete, but what about symbols in source that i'm trying to read (not write)?

8:44 clgv: echo-area: line 30 seems odd. shouldnt it be (. inbuf read) or (.read inbuf)?

8:44 jweiss: also i note that if a symbol uses an alias namespace like (require 'clojure.zip :as zip) i can't complete names starting with zip/ ?

8:44 clgv: echo-area: you should decide for one of the two notations and stick to it

8:45 echo-area: clgv: Oh yes, that one is wrong. But when the exception gets thrown, that hasn't be reached yet

8:46 clgv: Got that fixed, but the exception is still there :(

8:47 clgv: echo-area: try to narrow down where exactly it comes from - I cant spot it in the snippet

8:47 echo-area: at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)

8:52 robertstuttaford: any one fancy deodorising this bad code smell? https://gist.github.com/2644284

8:54 dnolen: robertstuttaford: just call flatten-attributes-and-remove-tag with the result of if.

8:54

8:54 robertstuttaford: gah. of course

8:56 echo-area: clgv: at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)

8:56 robertstuttaford: i'm really enjoying this. 15 years of imperative programming can go jump!

8:56 echo-area: This line of backtrace corresponds to line 273 of this file: http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/7634c063db13/src/share/classes/java/io/BufferedInputStream.java

8:56 jonaskoelker: yay, a new convert! :)

8:56 tmciver: robertstuttaford: also, I see no reason why you couldn't put the if inside the ->

8:57 echo-area: clgv: It calls `in''s `int read(byte[] buf, int off, int len)' method

8:57 clgv: echo-area: is your read-implementation even called?

8:57 echo-area: Here `in' is my proxied class instance.

8:57 clgv: Yes

8:58 tmciver: robertstuttaford: hmm, nvm. It's more complicated than I thought . . .

8:58 echo-area: clgv: Oh, maybe no

8:58 robertstuttaford: tmciver: the -> puts node in as if's first arg, causing if to have 4 args, one too many

8:59 Chousuke_: robertstuttaford: if (:content node) is never 'false' then it's more idiomatic to just do (if (:content node) ...) rather than comparing explicitly with nil

8:59 echo-area: clgv: As you see from here line 161,170: http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/7634c063db13/src/share/classes/java/io/InputStream.java, `int read(byte[] buf, int off, int len)' should call `int read()'

8:59 robertstuttaford: it can either be nil or a vector. does what you say apply to that?

8:59 Chousuke_: yes

8:59 echo-area: clgv: Which is defined in my proxy form

9:00 Chousuke_: all non-nil things that are not boolean false are considered truthy

9:00 robertstuttaford: wicked :)

9:00 thank you for that

9:00 Chousuke_: so a common idiom is just to use (if-not some-val ...) of (if some-val ...)

9:01 robertstuttaford: oh, right, if-not

9:01 i need to spend some time reading the apis

9:01 echo-area: clgv: But it seems that somehow the three-argument method is not called, instead the invocation is forwarded directly to my no-argument method, hence the exception

9:01 clgv: echo-area: hmm proxy generates empty implementations returning nil for unspecified methods of an interface, right?

9:01 echo-area: clgv: Is that a question? I'm not sure

9:01 Chousuke_: robertstuttaford: also #(convert-nodes %) is equivalent to convert-nodes :)

9:02 echo-area: clgv: I indeed tried to catch up by defining also argumented read method

9:03 jonaskoelker: Chousuke_, robertstuttaford: that is not true for variadic java methods, I think. E.g. (every? Character/isBlank mystr) vs. (every? #(Character/isBlank %) mystr)

9:03 echo-area: clgv: But got IllegalArgument exception saying "No matching method found" at all times

9:03 Chousuke_: jonaskoelker: java methods are not functions

9:03 jonaskoelker: Chousuke_: and that would be a good explanation :)

9:03 robertstuttaford: Chousuke_: of course, thank you!

9:04 clgv: echo-area: ah well, InputStream is an AbstractClass and no interface - so forget the previous question

9:04 echo-area: clgv: And the three-argument variation of read is not unspecified, it is default in InputStream.

9:04 clgv: Okay

9:04 Chousuke_: jonaskoelker: of course, there could be compiler magic that makes that work but it would kind of conflict the "as is" nature of java interop in Clojure :P

9:04 jonaskoelker: realising that I'm probably talking about contexts other than robertstuttaford's, in case of (map #(conv-nodes %) foo bar) this might not be same, right Chousuke_?

9:06 Chousuke_: would it? How so?

9:06 Chousuke_: jonaskoelker: in that case conv-nodes is clearly a function and you don't need the fn shortcut.

9:06 jonaskoelker: Chousuke_: right, but conv-nodes might be variadic, whereas #(... %-and-no-%2) isn't, right?

9:06 clgv: echo-area: a general advice: try to get that code a minimal as possible but still failing for the same reason. the error will be easier to spot

9:07 *as minimimal

9:07 args. nvm

9:07 Chousuke_: jonaskoelker: that doesn't really matter, since it will only get called with as many parameters as you give seqs to map, just like the anonymous function you create

9:07 jonaskoelker: clgv, echo-area: and (barging in uninformedly from left field) if at all possible sprinkle the code with printf

9:07 ,(#(println %) 1 2)

9:07 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox$eval28$fn>

9:08 Chousuke_: though I suppose you would get a different effect if you were to write #(foo %2)

9:08 jonaskoelker: ,(#(println %2) 1 2)

9:08 clojurebot: 2

9:08 jonaskoelker: ,(println ((fn ([x] x) ([x y] y)) 1 2))

9:08 clojurebot: 2

9:08 jonaskoelker: ,(println ((fn ([x] x) ([x y] x)) 1 2))

9:08 clojurebot: 1

9:08 clgv: echo-area: you can also try tracing via clj-debug

9:08 jonaskoelker: seems (subtly) different

9:09 echo-area: clgv: Oh, let me see what clj-debug is

9:10 clgv: echo-area: hmm well maybe not. It has no support for proxies yet.

9:11 echo-area: clgv: Ah, okay

9:11 jonaskoelker: (into @shower 'me)

9:12 echo-area: clgv: Let me try a toy proxy then

9:12 TimMc: jonaskoelker: (swap! me update-in [:location] :shower)

9:14 clgv: (comp shower me) ;)

9:15 dnolen: CLJS analysis now follows dependencies - should now direct dispatch everywhere if you're using :static-fns true or :optimizations :advanced

9:17 echo-area: clgv: http://pastebin.com/PLDUKVH5 <-- This is the one simple failing snippet. Let me look into it.

9:23 clgv: echo-area: If you have time, post it on the mailinglist

9:25 echo-area: clgv: Okay, I'll do some experiments first to see if I (we) miss anything

9:26 clgv: echo-area: it could be an error in io/reader

9:28 echo-area: clgv: No, with that second simple definition I get the exception by manually evaluating (.read f1 (byte-array 3) 0 3) (But there's an error in that one, i.e. the use of (int \a))

9:28 Although evaluating (.read f1) works fine

9:29 clgv: echo-area: My guess is that the InputStream works fine on its own. but not inside the reader

9:30 echo-area: Let me see if I can do it here

9:30 &(let [p (let [count (atom 0)]

9:30 lazybot: java.lang.RuntimeException: EOF while reading, starting at line 1

9:30 echo-area: (proxy [java.io.InputStream] []

9:30 (read []

9:30 (if (< (swap! count inc) 10)

9:30 97

9:30 -1))))]

9:30 (.read p))

9:30 Oh, what a pity

9:30 &(let [p (let [count (atom 0)] (proxy [java.io.InputStream] [] (read [] (if (< (swap! count inc) 10) 97 -1))))] (.read p))

9:30 lazybot: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.DynamicClassLoader

9:30 jonaskoelker: TimMc, clgv: apropos, (conj twin nurse-south-park) ;-)

9:30 oops, n-from-s-p

9:31 echo-area: &(let [p (let [count (atom 0)] (proxy [java.io.InputStream] [] (read [] (if (< (swap! count inc) 10) 97 -1))))] (.read p))

9:31 lazybot: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.DynamicClassLoader

9:31 echo-area: clgv: So I can't do it here

9:32 clgv: ,(let [p (let [count (atom 0)] (proxy [java.io.InputStream] [] (read [] (if (< (swap! count inc) 10) 97 -1))))] (.read p))

9:32 clojurebot: 97

9:32 terom: echo-area: your last example works in my REPL

9:32 echo-area: Cool

9:33 ,(let [p (let [count (atom 0)] (proxy [java.io.InputStream] [] (read [] (if (< (swap! count inc) 10) 97 -1))))] (.read p (byte-array 3) 0 3))

9:33 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: sandbox$eval56$fn>

9:33 echo-area: But this doesn't work

9:33 It is supposed to work, isn't it?

9:34 clgv: hummm, extending abstract class in proxy - should be possible afair

9:37 ,(let [p (let [count (atom 0)] (reify java.io.InputStream (read [this] (if (< (swap! count inc) 10) 97 -1))))] (.read p))

9:37 clojurebot: #<CompilerException java.lang.IllegalArgumentException: only interfaces are supported, had: java.io.InputStream, compiling:(NO_SOURCE_PATH:0)>

9:40 robertstuttaford: i know select () { case, case case } is bad form in clojure, and one should opt for using polymorphism, but how would i do a simple branch like this anyway?

9:40 erk, not select, but switch

9:41 (if cond1 (action) (if con2 (action)) etc?

9:42 dakrone: robertstuttaford: check out (cond ...) and (condp ...)

9:42 clgv: robertstuttaford: 'case or 'cond

9:42 robertstuttaford: poifect, thanks

9:43 duck1123: then there's always multi-methods, which would be another way to do this sort of thing. (but a little different)

9:44 but cond is what you're probably looking for

9:44 robertstuttaford: yeah. i read the multimethod section of The Book two nights back. something i'm going to have to mess around with to fully grok

9:53 echo-area: Hmm, how to sign up a bug report?

9:54 I didn't find it on clojure's dashboard..

9:54 TimMc: Maybe you need to sign the CA.

9:56 echo-area: How?

9:56 clojurebot: with style and grace

9:56 echo-area: How to sign a CA?

9:56 TimMc: It's irritating. :-/

9:57 Print out the Contributer's Agreement, fill it in, mail it to some address in North Carolina, wait.

9:57 echo-area: Oh, sorry for that

9:57 Can I scan it and send an email?

9:57 TimMc: Nope.

9:57 Nor fax, as far as I know.

9:57 echo-area: Oh.

9:57 TimMc: Stupid lawyers.

9:58 Maybe someone who has already signed one can file a Jira ticket for this issue.

9:58 echo-area: Can you?

9:58 TimMc: I don't understand the issue. :-)

9:59 echo-area: Would you like to take some time to understand it :)

9:59 TimMc: Where's a failing example?

9:59 09:31? (now=09:59)

10:01 echo-area: What's that? I'm preparing one, please hold, thanks

10:05 TimMc: echo-area: https://www.refheap.com/paste/2665

10:05 ArityException Wrong number of args (4) passed to: core$eval181$fn clojure.lang.AFn.throwArity (AFn.java:437)

10:05 ^ Is that the issue?

10:06 echo-area: TimMc: Yes, but I made a simpler one here: http://pastebin.com/PE23deX5

10:07 TimMc: https://www.refheap.com/paste/2666 <-- showing failure to override.

10:07 echo-area: Yes

10:07 Do you think this is an issue?

10:10 TimMc: It certainly seems to be a bug.

10:10 This might be related: http://www.mail-archive.com/clojure@googlegroups.com/msg13106.html

10:12 jsabeaudry: Is there a performant way to shell out? (time (clojure.java.shell/sh "ls")) is over 50 msecs on my system...

10:12 Seeing that "time ls" is only 7 msecs

10:12 There has to be a better way

10:13 echo-area: TimMc: Yes, exactly the same issue.

10:19 clgv: jsabeaudry: did you benchmark it with repeated calls?

10:20 (time (dotimes [_ 1000] (clojure.java.shell/sh "ls"))) => "Elapsed time: 2046.530856 msecs" - so 2ms per call on average

10:20 echo-area: TimMc: It's 22:25PM here and I want to go home. Please help me sign up that issue, thank you very much.

10:21 TimMc: Yeah, I can do that.

10:21 echo-area: Bye. Good night.

10:21 clgv: echo-area: an easy fix to your problem is writing that particular class in java ;)

10:21 TimMc: clgv: You must have more Pentiums than I do. I get 8ms. :-P

10:22 echo-area: clgv: Yes, which I will do next. Bye :)

10:22 TimMc: Or gen-class.

10:23 jsabeaudry: clgv, yeah, ok, I get 11 msecs average with that kind of benchmark, but when a request hits my server and it does 5 of them I still have 350msecs spent (70 msecs if I remove the shell calls)

10:23 TimMc: (22:25PM, that's *super* late)

10:24 clgv: jsabeaudry: well if you have more of them it will improve

10:24 TimMc: The more you spend, the more you save!

10:25 jsabeaudry: Seems a bit pricy, yes.

10:26 clgv: jsabeaudry: can you combine those shell calls to one?

10:26 jsabeaudry: clgv, that's a good idea, I guess I can write a shell script that will combine them and call that shell script

10:42 goodieboy: anyone using slingshot? https://github.com/scgilardi/slingshot

10:43 * algernon is experimenting with it (but so far, only did some very trivial stuff).

10:43 TimMc: goodieboy: Trivially here as well.

10:45 jweiss: goodieboy: i use it

10:47 Null-A_: goodieboy: i used it

10:47 goodieboy: good to know thanks

10:48 Null-A_: it worked beautifully

10:48 pallet uses it too

10:48 goodieboy: any problems? It solves a problem perfectly for me, and I don't want to re-invent the wheel

10:48 good!

10:48 Null-A_: never had any

10:49 if you look at the implementation it's tiny

10:49 it's very easy to fix if you run into bugs

10:49 that sort of my attitude about cutting edge clojure libraries

10:49 if i can easily fix it

10:51 goodieboy: Null-A_: yeah, just browsed the source. Couple of lightweght macros there. I'm going to give it a try.

10:58 TimMc: Needs an RTE unwrapper, but that's all.

11:03 pbuckley: I'm trying to do the equivalent of "find . -name pom.xml" using the fs library in clojure

11:04 and I thought that glob was what I needed, but it doesn't seem to recurse down into folders

11:04 anyone know if it's likely I'm just not globbing right or if I need to put it together with walk?

11:04 S11001001: glob typically doesn't, the ** thing is a nonstandard extension

11:05 pbuckley: S11001001: ok, thanks, I'll try walking the dirs

11:09 robertstuttaford: i have a seq of maps, each with one key. i want to put each map's key + value into a separate map

11:10 and then return that separate map with all the key and values together

11:10 how would i do this? here's a before and after: '({:a 1} {:b 2} {:c 3}) ; i want {:a 1 :b 2 :c 3} from this seq

11:10 ack

11:11 cfa: => (into {} '({:a 1} {:b 2}))

11:11 {:a 1, :b 2}

11:11 robertstuttaford: :o is it really that simple?!

11:12 swearwords

11:12 i've been trying to figure this out for 20 minutes!

11:13 -sigh- baby steps robert, baby steps!

11:14 dakrone: ,(merge {:a 1} {:b 2})

11:14 clojurebot: {:b 2, :a 1}

11:16 robertstuttaford: thanks guys

11:19 timvisher: any way to annotate a function as deprecated?

11:21 Null-A_: timvisher: clojure does this: (defn replicate

11:21 "DEPRECATED: Use 'repeat' instead.

11:21 Returns a lazy seq of n xs."

11:21 {:added "1.0"

11:21 :deprecated "1.3"}

11:21 [n x] (take n (repeat x)))

11:21 timvisher: not sure what the consequences are

11:21 timvisher: so you use the metadata, that'll work for me. :)

11:24 clgv: Null-A_: please use some paste website

11:38 gfredericks: huh. I did not know about that metadata syntax.

11:42 nDuff: Ugh.

11:43 noir including all of ring -> embedded Jetty (and javax.servlet.*) conflicting with the one I'm trying to load my servlet into

11:44 clgv: gfredericks: the defn macro is worth a read for this. ;)

11:45 nDuff: you can use :exclusions in the project.clj to exclude jetty

11:47 bhenry1: what hierarchy is above persistenthashmap and persistentarraymap so that i can move on if i see either one of those?

11:47 or do i just have to use an or?

11:49 Null-A_: bhenry: (map? ..) not sure

11:52 bhenry: hahahahaha thanks Null-A_. duh. i was using instance?

11:52 Null-A_: :)

12:01 yonkeltron: who had mentioned rust a few weeks ago?

12:01 relevant link covering a few differing new native languages: http://www.drdobbs.com/slideshows/232901643

12:02 TimMc: Might have been me.

12:02 yonkeltron: TimMc: word.

12:03 gfredericks: If I want to make an inputstream from a lazy byte seq, I'll have to do it myself with proxy?

12:03 yonkeltron: TimMc: and then this shit showed up: http://blog.lse.epita.fr/articles/12-c---system-oriented-programming.html

12:03 TimMc: kind of interesting

12:04 TimMc: and mildly silly

12:04 nDuff: I notice that re-evaluating a defpage via slime/swank doesn't modify preexisting servlets created with same; is there a way to do this, short of hiding all content generation behind a var?

12:05 yonkeltron: TimMc: you see all that super-funky syntax and special gunk thrown in?

12:06 TimMc: Yes, and I can't help but notice they are building on C...

12:06 ...which is not really the best starting point.

12:06 yonkeltron: TimMc: what, you don't like high-level assembler?

12:06 and other such jokes favored by lispers

12:25 dnolen: mmarczyk: ping

12:31 kzar: I added a dep for [domina "1.0.0-beta4"] in my project but that seems to require org.clojure:clojurescript:jar:0.0-1069 which lein then fails to find. I missing something?

12:41 TimMc: Maybe that's in some alternate repository.

12:41 kzar: There's a post in google groups about the problem but no solution

12:44 TimMc: Oh, I tried "1.0.0-SNAPSHOT" like domina has in it's project.clj and it seemed to fix it

12:44 its*

13:06 ambrosebs: would clojure.core/seq be a function of clojure.lang.Seqable -> clojure.lang.ASeq ?

13:06 do we always get an ASeq back?

13:06 (or nil)

13:07 Chousuke_: I'm not sure if ASeq is right. ISeq probably?

13:07 and seq takes input other than Seqables too

13:07 like java Strings

13:07 nDuff: With noir's defpage, which property of the request object is it actually matching against for routing? I have a defpage with a string that exactly matches (.getPathInfo request) for one of my requests, but it isn't being used.

13:08 ambrosebs: Chousuke: good point, forgot about the String/Iterable etc. input

13:08 twhume: I'm trying to track down clojure-contrib.stream-utils ...

13:09 ambrosebs: Chousuke: with the output, I'm trying to gather as much info as I can

13:09 twhume: anyone know where they live nowadays?

13:09 ambrosebs: ASeq gives a ton more than ISeq

13:10 but is it correct? not sure

13:10 dnolen: ambrosebs: Chousuke: thought that doesn't apply to ClojureScript.

13:10 in ClojureScript Strings & Arrays *are* ISeqable

13:10 Chousuke_: right

13:10 ambrosebs: dnolen: true. And I'm still on the fence as to how to handle that in Clojure. ie. hardcode them as Seqable

13:11 Chousuke_: open prototypes :)

13:11 dnolen: ambrosebs: I think (ISeq | nil) is right - the returned value might be ASeq maybe not.

13:11 ASeq is basically a marker protocol so that we know that we have something that's not empty.

13:12 twhume: (or an alternative way of doing streams - I think I'm going to be generated *massive* sequences and don't want early entries hanging around not being GCed)

13:13 Chousuke_: is there a problem with regular sequences for that? just don't hold on to the head and the elements get gc'd normally

13:13 ambrosebs: dnolen: If seq output is non-nil, is it always an ASeq?

13:14 hyPiRion: Isn't lazy-seqs gc'd? I initially thought they were.

13:15 As long you don't keep the head, of course.

13:15 dnolen: ambrosebs: probably, though I'm not sure if that information can be perservd.

13:15 AWizzArd: How can I access the current line during macro expansion time?

13:15 I would like to enable one of my macros with diagnostic capibilities and report the line number and file where it is used.

13:16 TimMc: &(ancestors (class (seq [1 2 3])))

13:16 lazybot: ⇒ #{clojure.lang.ASeq clojure.lang.IHashEq java.io.Serializable clojure.lang.IMeta java.util.List clojure.lang.IObj java.lang.Object clojure.lang.ISeq clojure.lang.Sequential clojure.lang.IPersistentCollection clojure.lang.Obj clojure.lang.Seqable java.lang.Iterab... https://www.refheap.com/paste/2667

13:17 ambrosebs: dnolen: preserved?

13:18 raek: twhume: you can use clojure sequence functions to do stream-like stuff. (as you said, you have to remember to let go of the head)

13:19 twhume: raek: I'm a n00b. How can I explicitly dereference the head, once it's been bound to a variable?

13:19 (and out of curiosity… what happened to all that streams stuff anyway, any idea?)

13:19 raek: twhume: for I/O there are functions in clojure.core and clojure.java.io (some of them originates from clojure.contrib.duck-streams)

13:20 nDuff: What information about a request is the path given to defpage in noir matched against? request.getPathInfo()? request.getURI()?

13:20 raek: twhume: for I/O you will probably need to use tha java I/O classes too (they are in the java.io namespace)

13:20 twhume: raek: is that the same kind of stream? I scanned and thought that was more IO related than, say, http://clojure.org/streams

13:20 S11001001: AWizzArd: &form or something like that contains the full macro call; grab meta from that, I guess

13:21 raek: twhume: I haven't heard about stream-utils before (besides seeing its name). it is unmaintained.

13:21 AWizzArd: S11001001: I will give it a try.

13:21 S11001001: AWizzArd: I don't remember the name, but it's definitely there; check defmacro's implementation. There is also &env, which contains info about the lexical environment

13:22 AWizzArd: and furthermore keep in mind that your macro might be expanded from another expansion, which likely wouldn't have preserved the meta you're looking for

13:22 raek: twhume: interesting page you have found. that's probably years old since it mentions SVN (git has been used since 2009)

13:22 S11001001: oh, wait, I think things get re-metaed between macro expansions anyway, so that's not an issue

13:23 AWizzArd: I will try and report back in 10-20 mins.

13:23 raek: twhume: what do you mean by dereference?

13:23 twhume: raek: aha… ok, so the streams in clojure.core would be the kinda streams I'm talking about (lazy-seqs that don't keep references to old content)?

13:24 dnolen: ambrosebs: look at which types are ASeq in the ClojureScript source. It probably needs more thought.

13:24 raek: twhume: sequences do not keep references to old content, so you can think of all lazy-seqs as streams

13:24 twhume: … as long as I dereference the head?

13:25 raek: twhume: "dereference"? I don't follow.

13:25 twhume: what you meant by "letting go"?

13:25 hyPiRion: As long you don't have any reference to the head, it will be gc'ed when needed.

13:25 twhume: free it up so the JVM can garbage collect it.

13:25 ok, thanks.

13:26 raek: here's an example of what to not do: (def rdr (io/reader "file.txt")) (def lines (line-seq rdr)) (pr lines) (.close rdr)

13:26 hyPiRion: rather - use defns.

13:26 raek: twhume: "dereference" usually means "to follow a reference"

13:27 if you do that, the sequence of lines will always be bound to a global var. so no sequence cells can be gc'ed

13:27 twhume: ok, thanks.

13:28 raek: here's what to do: (let [rdr (io/reader "file.txt)] (doseq [line (line-seq rdr)] (pr line)) (.close rdr))

13:28 S11001001: or with-open

13:28 raek: S11001001: was just going to mention that... :)

13:29 ambrosebs: dnolen: I've noticed the abstract classes make very handy type aliases https://github.com/frenchy64/typed-clojure/blob/72617384141668de8b145ba13961b405559892e0/src/typed/class.clj

13:29 raek: or even better: (with-open [rdr (io/reader "file.txt)] (doseq [line (line-seq rdr)] (pr line)))

13:30 dnolen: ambrosebs: nice, I'm curious how ClojureScript simplifies this stuff.

13:31 * nDuff pokes at the source, and discovers that compojure permits the :path-info vs :uri routing decision to be made explicitly. Woohoo!

13:42 ambrosebs: dnolen: well now that I'm treating the Java Interfaces as (basically) Protocols, I don't think there would be much difference in CLJS.

13:43 solussd: what's a good name for a macro that takes (and evaluates once) an expression, a predicate, and an 'else' expression and if the predicate returns true, returns the result of the first expression, otherwise the result of the else expression, e.g. (blah (some-func someval), #(= 4 %), (elseexp)). Or, does this already exist?

13:46 joegallo: isn't that (if predicate expression else-expression)?

13:46 AimHere: solussd> You mean 'if'?

13:46 It might be a special form, not a macro, though

13:46 raek: an abbreviation for (let [x (some-func someval)] (if (#(= 4 %) x) x (elseexp)) ?

13:47 joegallo: or did you mean: (if (predicate expression) expression else-expression)

13:47 solussd: no, the same thing using if would look like this: (let [result (expression)] (if (predicate result) result (else expr)))

13:47 joegallo: ah, but my version has double evaluation of expression unless you let it out like raek said

13:48 solussd: yup

13:48 and, of course, I don't want to evaluate else unless I have to-- which if will do for me

13:48 just need a name for it. :)

13:49 and you're right, no need for a macro, I have if

13:49 well, I guess I need a macro to wrap it

13:50 raek: you still need to macro if you don't want the else expression to be evaluated unconditionally

13:50 solussd: yup ^

13:51 dnolen: ambrosebs: so you just flatten the interface hierarchy?

13:53 ambrosebs: dnolen: yea

13:53 dnolen: solved a few other weird diamond inheritance issues

13:54 dnolen: and just seemed more clojurey

13:54 dnolen: thoughts?

13:54 dnolen: ambrosebs: seems right to me.

13:55 ambrosebs: dnolen: cool

13:55 dnolen: it's basically CLJS's hierarchy now

13:57 dnolen: ambrosebs: I suppose it true that seq in some sense return (nil | ASeq)

13:57 solussd: i'll have the predicate work the other way and call it "subif", "substitute if"

13:57 dnolen: ambrosebs: this has to do with the special treatment of EmptyList

13:58 dpritchett: is there a simpler way to write this? https://gist.github.com/2647344

14:00 ambrosebs: dnolen: in CLJS it would probably be something like (U nil (I ISeq ISequential IHash ISeqable ..))

14:00 I = intersection

14:06 tutysra: have been following @cemerick 's starting clojure webcast, (require 'compojure.route) complains of ring/middleware/head.clj not found on classpath, ring - 1.0.1 and compojure 1.0.3 are used

14:06 rhc: ambrosebs: hey i finally watched your "intro to logic programming" presentation, nice job, all that core.logic stuff is amazing to me

14:07 ambrosebs: rhc: thanks! too scared to watch that video, was terrified ;)

14:08 rhc: did you watch dan and will's video on minikanren?

14:08 rhc: will blow ur mind :)

14:08 rhc: ambrosebs: yeah i started that one, realized i had no idea what was going on, so i went back to watch yours first

14:08 still need to watch theirs

14:09 ambrosebs: rhc: they start where I left off, but accelerate at a rapid pace

14:10 quite an honour to be their warm up act actually!

14:11 LauJensen: Evening gents

14:11 rhc: ambrosebs: did you come to reasoned schemer from prolog? or from some strongly typed langauge background?

14:12 ambrosebs: rhc: from scratching my head at core.logic!

14:12 rhc: I knew a bit of prolog

14:12 rhc: ah, cool, i'm still definitely int he head scratching phase.. never touched prolog

14:13 RickInGA: rhc have you seen the primer on core.logic?

14:13 rhc: RickInGA: just this https://github.com/frenchy64/Logic-Starter/wiki

14:13 you're talking about this? https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer ?

14:13 RickInGA: rhc: https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer

14:13 yeah :)

14:13 rhc: thanks, I'll check it out

14:14 i feel like i understand it on some thin level, but not enough to say "hey, i could use that for something"

14:15 ambrosebs: rhc: the official primer is better thought out than mine

14:15 rhc: but mine's still fun

14:15 rhc: ambrosebs: yeah, i enjoyed yours

14:15 ambrosebs: thanks :)

14:16 rhc: I haven't updated it in ages. Did you follow along with the latest core.logic?

14:16 rhc: ambrosebs: no, i just read it while eating :)

14:19 RickInGA: ambrosebs: I hope you don't think I was criticizing your page... It was the first one I looked at when I was curious about core.logic, and with no background it was over my head. I found the primer to be easier to a newb

14:21 AWizzArd: S11001001: it seems that didn’t work. Neither &form nor &env contain line number info.

14:21 ambrosebs: RickInGA: I'll be the first one to admit I really had no idea what I was doing when I wrote it xD

14:21 S11001001: AWizzArd: what did &form's meta have/

14:21 ?

14:22 AWizzArd: nil

14:22 S11001001: oh, oh well

14:22 try checking your args for meta

14:22 RickInGA: ambrosebs: in your tutorial, and your talk you showed a type checker. I hadn't heard of a type checker before. Is it category theory?

14:23 ambrosebs: RickInGA: I don't know what category theory is :)

14:23 S11001001: (this info does exist in the compiler code; I guess it runs macroexpand all the way before retagging)

14:23 AWizzArd: S11001001: although I tested in the repl: (defmacro foo [x] (prn &form (meta &form)) x) and then (foo 10)

14:23 S11001001: hmm, well repls are weird

14:23 RickInGA: ambrosebs: good, then I don't have to find out either :) What is a type checker used for?

14:23 AWizzArd: So, maybe my meta gets lost somewhere.

14:24 As you supposed earlier.

14:24 S11001001: still could happen, but also might be repl thing

14:24 ambrosebs: RickInGA: given an expression and an expected type, the type checker asserts that the expression is of that type

14:24 but it gets fascinating when you have a type checking *relation*

14:25 usually it's a function

14:25 xeqi: RickInGA: I think type theory comes out of set theory/model theory

14:25 AWizzArd: S11001001: no, it really gets lost. I just confirmed it. I have three macros X, Y and Z which all expand into A. I placed the (prn (meta &form)) as first line in A and it has no meta info.

14:25 S11001001: a type is a set of values

14:26 AWizzArd: Then I placed it in my Z and tried it, and there it works now indeed.

14:26 S11001001: makes sense

14:26 RickInGA: ambrosebs: xeqi: are there reseources I should look at to understand this better? I don't even understand the question that the checker means to answer

14:27 flijten: Anyone who can tell me why accessing doc doesn't work in the following small codesnippet?

14:27 http://pastebin.com/LppDES2w

14:27 I thought use would be enough but I am missing out on something apparently

14:28 AWizzArd: flijten: unfortunately doc was moved out of core into clojure.repl

14:28 flijten: ah

14:28 lol

14:28 that explains so much

14:28 AWizzArd: flijten: try (use 'clojure.repl)

14:28 RickInGA: S11001001: A type is a set of values... I like that. I am reading Learn you a Haskell right now, and just this morning I learned about defining types, and that was how they described it.

14:28 AWizzArd: Or put (:use [clojure.repl :only [doc]]) into your NS.

14:29 S11001001: it's also the first definition of type in the little mler; seems to be pretty standard at this point

14:29 tmciver: flijten: and you don't have to (use 'clojure.core); it's done for you.

14:29 RickInGA: I never heard it before today, and now have heard it twice :)

14:29 flijten: AWizzArd: thank, I though I was crazy for not understanding. I never suspected I was simply using the wrong namespace :)

14:30 ambrosebs: RickInGA: does that clear up the role of a type checker?

14:30 AWizzArd: flijten: in Clojure 1.2 the doc macro was always available, which is useful I think.

14:31 Especially since clojure.repl is included in the clojure.jar anyway, so it does not really dramatically speed things up.

14:31 flijten: tmciver, thanks too. I kinda knew that but I started trying all kinds of stuff to simply get doc to work :)

14:32 So why did they take it out?

14:32 AWizzArd: No idea.

14:32 RickInGA: ambrosebs: no, I still don't know when I would find myself wishing I had one. Are there books that talk about them and what they are for? I suspect that getting me to understand is going to take quite a while.

14:33 ambrosebs: RickInGA: Hmm not sure of a good place to start

14:33 RickInGA: are you familiar with statically typed languages?

14:34 RickInGA: ambrosebs: sure, been doing c# for years

14:34 ambrosebs: and the compiler does type checking...

14:35 ambrosebs: very simple example: Integer i = 1;

14:35 1 is type Integer

14:35 expected type is Integer

14:35 so it "type checks"

14:35 RickInGA: so your type checker is something you can run against your code, to get the benefits of static typing, without the restrictuions when you don't want them?

14:36 ambrosebs: oh, in the tutorial?

14:36 that is a very simple checker

14:36 just a toy

14:36 but that's the idea

14:37 rhc: i think dart (the language) has something like that

14:37 RickInGA: ambrosebs: ok. I just noticed that you mentioned a checker in your talk and the tutorial, and the mini-karen guys said they would show a checker, but you already had, so I figured it must be something I should learn about

14:37 rhc: optionally enabled types, at compile or runtime or something

14:37 ambrosebs: I'm working on Typed Clojure too

14:38 optional static typing

14:38 https://github.com/frenchy64/typed-clojure

14:38 RickInGA: ambrosebs: so if I were to summarize why I might want a type checker, is because I might want a tool I could use to check my code, to make sure I haven't made any errors, like trying to 3 + "a"

14:38 ambrosebs: exactly

14:38 RickInGA: ok, thanks!

14:39 to open another can of worms, you are doing typed clojure, and Michael Fogus is doing contract programming in Clojure. Are the two related?

14:40 ambrosebs: they will be

14:41 Typed Clojure is inspired by Typed Racket, which uses runtime contracts extensively

14:41 but this is not in the scope of typed clojure initially

14:41 conceptually, contracts and static type checking are related

14:41 contracts happen at runtime

14:42 type checking happens at compile time

14:42 RickInGA: in core clojure, are pre and post conditions enforced at runtime or compile time?

14:42 ambrosebs: runtime

14:42 there are a few static type checks in Clojure currently

14:43 forget where tho :)

14:43 Raynes: Oh look, ugly new Github icons.

14:43 ambrosebs: ,(fn [] (+ 1 "a"))

14:43 RickInGA: thanks so much for taking the time to clear this up for me. I will defintely have to look at typed Clojure.

14:43 clojurebot: #<sandbox$eval27$fn__28 sandbox$eval27$fn__28@c3a8c5>

14:43 ambrosebs: RickInGA: cool!

14:43 S11001001: reflection warnings sometimes indicate calls that will fail, though not always

14:43 obviously

14:45 apoc: ,(println ('hi))

14:45 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: Symbol>

14:45 apoc: ,(println 'hi)

14:45 clojurebot: hi

14:45 apoc: hihi;)

14:45 ibdknox: Raynes: wow those are terrible

14:45 wtf is github doing

14:46 Raynes: ibdknox: The 'watch' button looks like a giant eyeball that wants to shoot lasers at me, and the icons beside files and directories now appear to be straight out of Windows 98.

14:47 ibdknox: holy crap

14:47 that's truly awful

14:47 I hadn't even seen those

14:47 Raynes: Moving your cursor over headers in the README and you get images of a weird link icon that looks like a tornado and scares me, when they could have used a literal image of an anchor and everybody would have known what it meant.

14:48 ibdknox: way too much contrast

14:48 this is just poor design :(

14:48 like basic design

14:48 Raynes: We should use repo.or.cz in protest.

14:49 S11001001: gitorious

14:50 ibdknox: huh, gitorious looks reasonable :)

14:51 AWizzArd: Also have a look at BitBucket

14:51 imo currently the best site for repos (git and Mercurial)

14:53 ibdknox: This stuff always makes thing I should've done a product consultancy

14:53 of course, they might not listen

14:53 think*

15:04 flijten: What I don't understand, things like the if expression, do they return the if or else expression result implicitly?

15:05 RickInGA: flijten: yes

15:06 flijten: (if (> (count '()) 0) "no" "yes")

15:06 amalloy: flijten: everything is an expression; nothing is a statement. so every expression implicitly "returns" something

15:06 RickInGA: flijten: when you have a block of code such as (do (expr 1) (expr 2)... (expr n)) the last value, in this case (expr n) is what gets returned

15:06 raek: flijten: the value of an (if <condition> <then> <else>) is either the value of <then> or <else>

15:06 flijten: so thats why yes is returned in above code snippet?

15:06 Raynes: What would you expect to happen?

15:06 RickInGA: flijten yes

15:07 amalloy: in the same way that in java (for example), the expression (1 + 1) "implicitly returns" the result of the addition

15:07 raek: flijten: Clojure is built on expression rather than statements

15:07 flijten: well since the list is empty i half expected "no" to be returned

15:07 raek: (mostly)

15:07 RickInGA: flijten: but the test is whether the count was greater than 0, which for the empty list it is not

15:07 raek: flijten: zero is not greater than zero

15:08 flijten: heh

15:08 polish notation

15:08 it gets me

15:08 I like this a lot, but it is a big paradigm shift, this clojure

15:08 :D

15:08 bkolobara: When I compile a clojureScript file with optimisations set to advanced the result is a js file with 8k lines. Why is the result so big? Shouldn't the optimisation perform dead code elimination?

15:10 dnolen: bkolobara: 8k is not very big.

15:10 ibdknox: bkolobara: it has to include the entire run time

15:10 rather, most of it

15:12 bkolobara: OK, I just thought if i'm not using anything that the compiler will eliminate it.

15:12 dnolen: bkolobara: it doesn't eliminate an incredible amount

15:12 pandeiro: my question would be why are there 8000 linebreaks in minified code

15:13 S11001001: tree shaking is hard

15:13 dnolen: bkolobara: er I mean it does, you file would be huge w/o it.

15:13 bkolobara: like >15000 lines if not more.

15:18 bkolobara: after zipping, your CLJS file will probably comparable to jQuery + your app

15:18 bkolobara: if you don't use any Clojure data structures you can get relatively small sizes. Like 7-8k gripped.

15:20 drewr: dnolen: any thoughts as to how to get around lack of resolve in cljs?

15:20 wanna do dynamic namespace dispatch

15:20 dnolen: drewr: you tell me :)

15:20 drewr: haha

15:21 hiredman: resolve is name munging + eval?

15:22 dnolen: drewr: resolve could probably be a macro, patch welcome.

15:30 pandeiro: ibdknox: did you have time to look at the noir.server/add-middleware issue on the ml? were you aware of that?

15:30 clojurebot: what time is it?

15:45 pjstadig: clojurebot: 3:44PM EST

15:45 clojurebot: certainly ryland

15:45 pjstadig: clojurebot: pardon?

15:45 clojurebot: Pardon?

15:45 pjstadig: clojurebot: i hate your guts...if you had guts

15:45 clojurebot: I don't understand.

15:45 pjstadig: meh

15:46 dnolen: ibdknox: speaking of which, you've probably written more ClojureScript than anyone, I'm curious how big your file sizes are after gzipping?

15:47 dpritchett: is there an idiomatic way to convert { "key1" 1 "key2" 2 } to { :key1 1 :key2 2 }? I tried zipmap: (fn [x] (zipmap (map keyword (keys x)) (vals x)))

15:50 hyPiRion: dpritchett: I don't think so.

15:50 dpritchett: thanks hyPiRion

15:51 My overall goal was to figure out how to extract multiple values from (System/getenv) without repeating any code

15:51 S11001001: dpritchett: keywordize-keys in walk

15:52 careful, it's recursive

15:52 dnolen: dpritchett: you know about select-keys?

15:53 dpritchett: i didn't before, thanks dnolen

15:53 so my actual code is https://gist.github.com/2647344 and i was trying to figure out how to avoid calling getenv twice

15:53 RickInGA: (reduce into {} (map (fn [x] {(keyword (str x)) x} ) [1 2 3] ))

15:57 dnolen: dpritchett: https://gist.github.com/2648355

15:59 flijten: doh, I feel like I am missing something. Since everything is an expression how do you so something like iterating over a list and for each item decide if it smaller/greater than x and put it into new lists accordingly? Especially since everything is immutable. This is so trivial in an object oriented language, it must be trivial in clojure to.

15:59 dpritchett: thanks dnolen!

15:59 i was playing around trying to destructure it but hadnt gotten quite that far

16:00 RickInGA: flijten: you filter

16:00 flijten: I mean I know of doseq and let so probably I could construct something :) But what would be the correct way?

16:00 RickInGA: ,(filter even? (range 10))

16:00 clojurebot: (0 2 4 6 8)

16:00 RickInGA: ,(remove even? (range 10))

16:00 clojurebot: (1 3 5 7 9)

16:00 flijten: RinkInGa, but that means two operations instead of one iteration

16:02 But filtering is the way to go I understand

16:02 I am trying to write a quicksort, hence the question by the way

16:02 RickInGA: flijten: do you have joy of clojure? they do a lazy quicksort there

16:03 flijten: Joy of clojure?

16:03 RickInGA: yeah it is one of the clojure books... considered a little more advanced

16:04 Raynes: $google the joy of Clojure

16:04 lazybot: [The Joy of Clojure | Thinking the Clojure Way] http://joyofclojure.com/

16:04 flijten: Aah I see

16:04 RickInGA: Roseatta code has a quicksort in clojure http://rosettacode.org/wiki/Category:Clojure

16:04 actually has 3 of them

16:04 flijten: hehe, I am trying to write it to understand and learn. I specifically try not to peek until I am finished with a working algorithm

16:04 RickInGA: ok

16:04 flijten: when it is working I can compare and see the gazillion mistakes I made :D

16:04 RickInGA: yep

16:06 ldopa: flijten: take a look at group-by

16:09 ,(group-by #(> 5 %) (shuffle (range 10)))

16:09 clojurebot: {true [3 1 4 0 2], false [9 7 8 5 6]}

16:09 flijten: ooh that's even more brilliant in this case I guess

16:10 ldopa: there's definitely an easier way to write quicksort though ;)

16:12 flijten: most likely! In it for the learning curve though :)

16:13 I imagine the easiest way of quicksorting in clojure is something like (sort '(1 9 12 45 3))

16:13 ,(sort '(1 9 12 45 3))

16:13 clojurebot: (1 3 9 12 45)

16:13 flijten: voila

16:13 :D

16:15 TimMc: &(class (sort [1 2 3]))

16:15 lazybot: ⇒ clojure.lang.ArraySeq

16:15 TimMc: Probably some kind of in-place sort?

16:16 AimHere: Those Rosetta Code quicksorts look like they all do two runs through the collection each time. Seems inefficient

16:16 TimMc: java.util.Arrays#sort

16:18 gfredericks: (map #(-> % range sort type) [1 10 1000 1000000])

16:18 ,(map #(-> % range sort type) [1 10 1000 1000000])

16:18 clojurebot: Execution Timed Out

16:18 gfredericks: &(map #(-> % range sort type) [1 10 1000 1000000])

16:18 lazybot: ⇒ (clojure.lang.ArraySeq clojure.lang.ArraySeq clojure.lang.ArraySeq clojure.lang.ArraySeq)

16:18 gfredericks: (inc lazybot)

16:18 lazybot: ⇒ 4

16:18 gfredericks: clojurebot: wuss

16:18 clojurebot: Huh?

16:20 flijten: :D

16:23 well at least I have a let that gets me greater and smaller than the pivot number: (let [pivot (first items) {less true more false} (group-by #(> pivot %) items)] ...

16:23 S11001001: clojure sort is sometimes in-place, sometimes pure

16:24 solussd: hmm, I want an anaphor, but I want to be able to pass in the name of the anaphor as an argument to my macro. ideas?

16:24 (I want an anaphor for fun- spare me the "I shouldn't do that". :))

16:24 TimMc: &(class (sort []))

16:24 lazybot: ⇒ clojure.lang.PersistentList$EmptyList

16:25 S11001001: if you're explicitly naming the binding it's not anaphoric :)

16:25 TimMc: S11001001: ^ that's the only pure sort it does, as far as I can tell

16:25 S11001001: &(let [x [2 1]] [(sort x) x])

16:25 lazybot: ⇒ [(1 2) [2 1]]

16:25 S11001001: looks pure to me

16:26 TimMc: Oh, I misunderstood you.

16:26 Or vice versa. I meant the internal sort strategy.

16:26 S11001001: ah

16:26 TimMc: cf. merge sort

16:26 S11001001: &(let [x (to-array [2 1])] [(sort x) (seq x)])

16:26 lazybot: ⇒ [(1 2) (1 2)]

16:27 TimMc: Ouch.

16:27 michaelr525: hello

16:27 TimMc: &(let [x (seq (to-array [2 1]))] [(sort x) (seq x)])

16:27 lazybot: ⇒ [(1 2) (2 1)]

16:39 weavejester: ibdknox: I've added a make-route function to Compojure 1.1.0-SNAPSHOT that should remove the need for the eval in Noir

16:47 Raynes: weavejester: You are a gentleman and a scholar.

16:48 weavejester: Raynes: That's probably the first time I've been called that :)

16:48 technomancy: weavejester: is it usually gentleman xor scholar?

16:50 weavejester: technomancy: Something like that :)

16:53 michaelr525: so who has already adopted the new reducers thing?

16:54 i still struggle at the basic stuff, so this is like a new bomb dropped out of the blue :)

16:54 technomancy: if you're struggling with the basics you should probably ignore it =)

16:55 Raynes: Well, ignore it until it isn't actually a bomb.

16:55 I've been using Clojure for 4 years and I still don't understand core.logic.

16:55 * technomancy got away with being able to ignore protocols for over a year

16:56 michaelr525: are you clones? ;)

16:56 Raynes: s/clones/clowns/

16:57 People have asked if technomancy and I had ever been seen together in person before.

16:57 Fortunately we have, or else that would be a reasonable question.

17:00 michaelr525: yeah.. my approach to these things is practical.. maybe if I'll see how this new things can be exploited and give me some advantage such as speed of development

17:03 heh :)

17:03 had to read it 5 times

17:03 better i shall go to sleep

17:20 rhc_: did someone paste a new core.logic link?

17:37 dnolen: nice looks like CLJS release 1211 is going out

17:38 Raynes: dnolen: Is it carrying a sack on a stick with a few changes of clothes in it?

17:38 dnolen: Raynes: something like that :)

17:46 Raynes: ibdknox: I wish someone would throw you another 10k and get on with it already.

17:47 jodaro: Raynes: don't you have 10k lying around?

17:47 Raynes: jodaro: Man, I had to raise $300 just to pay for SSL on Heroku a few days ago.

17:48 jodaro: how'd you raise it?

17:48 or do i want to know

17:48 TimMc: Webcam show.

17:48 Raynes: lynaghk made me do things for him. I'd rather not talk about it.

17:48 aperiodic: "Lascivious Lizards Unleashed"

17:53 jodaro: wow

17:53 only 9k away from the goal

17:53 thats rad, ibdknox

17:53 Raynes: Groovy and far out too.

17:53 jodaro: totally awesome

17:53 i dig it

17:57 gfredericks: if I use proxy to create an InputStream and just implement the 0-arg version of read, is it expected that calls to other-arity versions of read will be diverted to my impl?

17:57 (throwing a 'wrong number of args' exception of course)

17:58 S11001001: gfredericks: I think so, but it is documented there anyway

17:58 gfredericks: oh in the proxy docs?

17:58 * gfredericks goes to read those more closely

17:58 S11001001: no, InputStream

17:58 gfredericks: oh I think I miscommunicated

17:58 yes I know that the InputStream impls will eventually call mine

17:59 S11001001: oh that, yeah it's fine, as long as you remember that proxy calls aren't reentrant

17:59 gfredericks: my issue is I'm getting 'wrong number of args' errors, where 4 args are passed to something which I guess must be my function

17:59 S11001001: oh that

17:59 yeah, it's based on method name

17:59 gfredericks: so do I need to give an impl for all the versions of read? :/

18:00 hiredman: yes

18:00 gfredericks: is there any easier way to turn a byte-seq into an input stream?

18:01 S11001001: how about bytearrayinputstream

18:01 gfredericks: well I want it lazy

18:03 hiredman: https://gist.github.com/2649231

18:04 you could also do something with SequenceInputStream and an enumeration of ByteArrayInputStreams

18:04 https://github.com/hiredman/vespa-crabro/blob/master/src/vespa/streams.clj#L44

18:09 gfredericks: huh. So you use a ref there rather than an atom because then you can read and update as separate operations. I don't think I realized there was a use case for single refs.

18:09 I've done some crazy ugly things in those situations :(

18:10 hiredman: SequenceInputStream is definitely the cleanest way for me to go. Thanks!

18:16 S11001001: gfredericks: for extra fun, handle the chunking when mapping to BAISes

18:18 TimMc: S11001001: This is the proxy problem echo-area was having earlier, I think.

18:19 proxy only supports dispatch on name?

18:19 S11001001: it's a map

18:19 TimMc: ew, right

18:19 S11001001: a mutable per-proxy-object one

18:19 TimMc: I fought with proxy some time ago, and I have purged many of the details...

18:19 S11001001: and when you call proxy-super, it removes the entry from the map (causing the bytecode to actually do a super), calls that method, then adds the entry back

18:20 TimMc: So broken.

18:20 OK, still going to file a bug, but this time for a doc change.

18:21 brainproxy: anyone see me post in this chan a sec ago? I think my client was losing the connection just as I was hitting return

18:22 ivan: no messages from you

18:22 brainproxy: thanks

18:23 so... what I wanted to say ... node-clojurescript is basically useable at this point; if you have nodejs v0.6.x installed you can do `npm install -g clojure-script`

18:23 then `ncljsc --help` to get a list of options

18:24 I'll be working on the README for it this evening, to provide instructions for getting setup (e.g. making sure JAVA_HOME is set, etc.) and basic usage

18:24 I'm hoping some folks who do both nodejs nad clojure/script can help me kick the tires

18:24 :)

18:26 lots to do ... figuring out how to integrate it with lein; rewriting the coffee-script based tooling into cljs, so it's pseudo self-hosting, etc.

18:30 Cr8: huh

18:30 what's this node-java bridge thing

18:30 that's interesting

18:34 brainproxy: Cr8: indeed

18:35 Cr8: heh, i'm trying to play with it, realizing i don't know cljs

18:36 brainproxy: easy thing to do

18:36 touch hello.cljs

18:36 ncljsc -w ./hello.cljs

18:36 keep that terminal open

18:36 Cr8: mm, that helps. I was recompiling it every time.

18:36 brainproxy: then use emacs or whatever to edit hello.cljs

18:36 will recompile on chang

18:36 yeah much faster!

18:37 because the jvm stays runnning

18:37 if you want to create a namespace dependency and have it watched also, try:

18:38 ncljsc -w -W ./foo.cljs ./hello.cljs

18:38 then when you change foo or hello, hello will get recompiled

18:38 also if you (:require cljs.nodejs :as nodejs)

18:39 then nodejs/require is available to you

18:39 so you can pull in deps with either cljs namespaces

18:39 or node's require mechanism

18:39 Cr8: swell :)

18:40 hm

18:40 brainproxy: you can also pass options to the JVM or overwrite the default hash-map that's getting passed to the underlying cljs compiler

18:40 Cr8: -w just seems to silently fail and not tell me if I do something syntactically wrong though

18:41 brainproxy: Cr8: will check into it, I probably need to wrap the main build method on the js side in try/catch

18:42 and return an error object

18:42 instead of exception text message

18:42 anyway, it's definitely in development status, but will be looking to improve it, and rapidly!

18:44 hope soon to implement a nice REPL, so the compiled code can be interactively eval'd in node/v8

18:45 Cr8: can i turn a js object into a map

18:45 somehow

18:46 brainproxy: think so... I'm a cljs noob myself, but got motivated to get in place the tooling I wanted (i.e. nodejs front-end and integration) so I can learn it myself

18:46 technomancy: Cr8: probably (into {} js-obj)

18:46 that's how it works on the JVM anyway

18:46 Cr8: it appears js objs are not ISeqable's

18:46 brainproxy: http://himera.herokuapp.com/synonym.html

18:46 ^ helpful

18:47 not sure it has the answer Cr8 is looking for though

18:47 what I want to figure out is how to get the algo monads stuff working

18:47 not sure if that's possible

18:48 time for some food and exercise... willl be back on later, Cr8 thanks a bunch for poking at it

18:48 Cr8: if you make a js-obj with clojurescript it is

18:48 but ones that exist already aren't

18:49 might just be some odd issue with me trying to access the node.js process object though

18:50 brainproxy: Cr8: process should be available as nodejs/process

18:50 if you (:require [cljs.nodejs :as nodejs])

18:51 I've exposed all the built-in globals

18:51 thorough the externs mechanism

18:51 also made available nodejs/next-tick, as a convenience for getting at process.nextTick

18:52 setTimeout is nodej/timeout and there's clear-timeout; interval and clear-interval

18:52 also nodejs/__dirnam and nodejs/__filename are available

18:53 though if you're inside a namespace, those will be with respect to the most top-level script that kicked-off pulling in namespaced deps

18:55 Cr8: well I get an object

18:55 if I could print out what was in it somehow i'd know if it was the right one

18:56 brainproxy: how about...

18:56 (def util (nodejs/require "util"))

18:57 (.inspect util jsobjthing)

18:57 err

18:57 (println (.inspect util object))

18:57 should be trying this mysel :p

19:01 Cr8: my require util, println suggestion worked for me, got a nice printout of the nodejs/process object

19:01 Cr8: https://gist.github.com/2649563

19:37 Cr8: brainproxy: thanks :)

19:51 brainproxy: Cr8: worked for you too?

19:52 Cr8: yes

19:52 brainproxy: cool

19:52 Cr8: now i have to get back to my less functional day job though, will play with it some more later

19:53 brainproxy: okay :D

19:54 if you run into some nasty bug or something, feel free to submit an issue

19:55 Cr8: sure :)

21:28 muhoo: what's a good strategy for keeping global app settings (in a noir app)? pull it in from the db and stick it in an atom, and sync it with the db when it's written?

21:29 the kind of settings the admin could change, but wants to have persistent, but i don't need to read from the db at every page load

21:33 xeqi: whats wrong with leaving it in the db?

21:47 devn: muhoo: like config?

21:47 muhoo: I just drop a {:key "value", ...} config.clj file in the root of the repo and read-string on it

21:50 gfredericks: devn: he said it needs to be updateable

21:50 I assume his admin doesn't use git and redeploy

21:51 I also assume he's a male

21:55 kovasb: any emacs experts in the house? I'd like to know if something is possible

21:55 brehaut: ~anyone

21:55 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

21:56 kovasb: thanks clojurebot

21:56 brehaut: ~botsnack

21:56 clojurebot: Thanks! Can I have chocolate next time

21:56 kovasb: is it possible to save a repl session, and then open it back up later, and still have the inputs and outputs distinguished

21:57 brehaut: im guessing, but i think if you start the clojure swank session from lein rather than emacs and then just connect to it via emacs, then yes

21:57 kovasb: like, relaunch emacs, open the session, and start typing things in where u left off

21:58 (i don't expect it to save the state of the jvm)

21:58 ok

21:58 brehaut: perhaps i misunderstand something, but it sounds like exactly what you are are expecting

21:59 kovasb: ok

21:59 you mean, because the session is kept open by the other end?

21:59 and emacs just reconnects?

22:00 brehaut: well because the jvm state is what is at the other end of the session.

22:00 tmciver: brehaut: that's a great idea - do you know how to disconnect slime while keeping swank up?

22:00 brehaut: nope

22:01 im about as far as you can get from an emacs expert while using it every day

22:01 kovasb: what if I want to save the repl session, send it to someone else, and have them reevaluate my inputs?

22:01 tmciver: brehaut: yeah, that's me too.

22:01 echo-area: Is this the only way to get an array type: (Class/forName "[Ljava.lang.Class;")

22:01 Is this the simplest form?

22:01 brehaut: kovasb: just write your code in a file, and send it to the repl as you go.

22:01 kovasb: the issue is, i don't want to lose the distinction between input and output

22:01 brehaut: then when you are done, save your file and email it

22:02 kovasb: brehaut: but then you lose the output history

22:02 brehaut: so the other person has no idea if they are getting the expected result

22:02 brehaut: you'll have to find someone more knowledgable

22:03 sounds to me like what you want isnt possible though

22:03 xeqi: tmciver: M-x slime-disconnect ?

22:03 kovasb: yeah, its a bit esoteric, gonna do some googling

22:04 tmciver: xeqi: oh sure, if I want to do it the *easy* way. ;) Thanks. I'll have to try that technique sometime.

22:05 SurlyFrog: Is it true to say that `let` creates a lexical binding and `binding` creates a dynamic one?

22:05 brehaut: yes

22:06 SurlyFrog: brehaut: thanks.

22:06 is it also sort of fair to compare clojure's `def` to common lisp's `defparameter` or `defvar`?

22:07 meaning, to establish a special variable with dynamic scoping rules.

22:08 meiji11: I've linked a jar into my leinengen project from clojars. its namespaces don't seem to be showing up in (all-ns). is there something else I need to do to make them accessible?

22:10 brehaut: SurlyFrog: no idea, i dont know anything about common lisp

22:10 technomancy: meiji11: you'll need to load the code before all-ns sees it using require

22:10 SurlyFrog: breahaut: no worries :-)

22:10 technomancy: SurlyFrog: sort of; the difference is that whether it's dynamic or constant is based on the *dynamic* metadata

22:11 SurlyFrog: technomancy: ohhh…so eliding the ^:dynamic in a `def` makes it a constant..

22:12 technomancy: SurlyFrog: it can still be rebound by future def calls, but that should never happen at runtime

22:12 meiji11: technomancy: I don't know what to use in require. the vector under :dependencies is [org.clojars.sids/htmlcleaner "2.1"], I've tried (require

22:12 SurlyFrog: technomancy: ok, thanks!

22:12 meiji11: '[org.clojars.sids/html :as HtmlCleaner])

22:13 oops.

22:13 technomancy: meiji11: you have to check the documentation

22:13 meiji11: but that is not working.

22:13 ah, ok. not necessarily the same.

22:13 thanks.

22:13 technomancy: right

22:13 no problem

22:35 zawzey: hi, just a question, if an external library is jar-ed and it's lein project.clj specifies dependency on clojure 1.3 and our main project uses clojure 1.4 what version of clojure would the external lib be using?

22:36 Would the third-party library then use clojure 1.3 and our main project use clojure 1.4?

22:36 brehaut: zawzey: i think it depends on how the version ranges are specified. theres a bunch of maven magic there

22:36 zawzey: brehaut: i'm assuming that they use lein project.clj

22:37 brehaut: nevertheless, lein uses maven bits under the hood, and its dependancies version strings are maven version ranges

22:37 zawzey: http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution

22:38 most libs use soft requirements i think

22:38 in which case the highest version will probably be used

22:41 zawzey: brehaut: i see, thanks, i do see that clj-http seems to specifies multiple profiles https://github.com/dakrone/clj-http/blob/master/project.clj

22:41 brehaut: but all the dependancies are soft, so it'll be overriden by any higher dependancies

22:42 dakrone: zawzey: that's just so I can test against different versions of clojure, by default it runs against whatever version is specified in your project's project.clj

22:42 zawzey: zawzey: got it, thanks guys

22:45 technomancy: zawzey: if you're curious, with leiningen 2 you can do `lein deps :tree` to see all the versions of all the dependencies that get pulled in

22:45 uvtc: My understanding is that symbols refer to vars; such that when Clojure sees "x" (the symbol), it goes to the var to which x refers, and then gets the value it finds there. Are locals (for example, the x in `(let [x 3] ...)`) also symbols that refer to vars?

22:46 oh, hi #clojure. :)

22:47 gfredericks: uvtc: nope

22:48 uvtc: gfredericks, Thanks. Though, ... what are they then?

22:48 zawzey: technomancy: thanks! :)

22:48 gfredericks: and also even excluding locals things are a bit more complicated than you described. Mostly having to do with things being namespace-dependent, and the aliases and prefixes and java imports.

22:49 uvtc: they are locals, so they are bound directly to a value

22:49 locals include function arguments

22:49 uvtc: gfredericks, right: function args, in let, and ... I think in `loop` as well. Hm.

22:50 gfredericks: uvtc: and lots of other places

22:50 function args and let and loop I think are the real primitive ones

22:50 most everything else is just a macro that transforms into one of those

22:51 uvtc: gfredericks, Ok, bound directly to a value. Makes sense. Thanks!

22:51 gfredericks: yep

22:51 uvtc: oh also those bindings are immutable; they are lexically scoped and can only be shadowed

22:53 uvtc: gfredericks, Right. IIRC, as of 1.3 the vars you get with `def` are also locally scoped (unless you specify them as dynamic) --- though they can re-bound in a `binding` form`.

22:53 gfredericks, (re-bound for just the current thread)

22:54 gfredericks: the binding form is actually exactly what requires the dynamic declaration

22:54 uvtc: Ohhhh. Right, right. :)

23:02 muhoo: it's more of a caching qquestino relaly.

23:02 or a caching question really

23:04 i could do a functino to get/set config, it'll pull stuff from the db into an atom, if it's nil. at set, reset! the atom, then write the db

23:36 emezeske: I just pushed lein-cljsbuild 0.1.9 to clojars. It's updated to use clojurescript 0.0-1211, which seems to have some nice improvements.

23:37 mefesto: awesome! that was quick :)

23:37 emezeske: yeah, I got lucky and had some time today. :)

Logging service provided by n01se.net