#clojure log - May 20 2012

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

0:07 amalloy: i'm pretty sure a type with 100 instance variables is a disaster

0:10 rife: unless they are stored in a list?

2:07 muhoo: is there anything like ring-mock that does cookies?

2:08 i need to test a bunch of login crap, and it'd be great to do it from in the repl and clojure test rather than having to rely on something external

2:51 var quoting is making me crazy

2:51 (= POST--fubar--baz (:POST--fubar--baz @noir.core/route-funcs)) ==> true

2:52 (var POST--fubar--baz) ==> #'foo.test/POST--fubar--baz

2:52 but!

2:52 (var (:POST--fubar--baz @noir.core/route-funcs)) => ASSPLODE!

2:52 Caused by: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol

2:52 ibdknox: it's not a var

2:53 it's a function

2:54 var is also a macro that only takes symbols :)

2:54 muhoo: ah, that's what it is then

2:54 dammit

2:57 metadata attaches to the var, so if you assign a function to a map, only the function goes in there, not the var, and metadata goes bye-bye

2:58 afaict, anyway

2:58 unless you do {:foo #'thething} i guess

3:13 i got it! about 10 hours of work for this: https://www.refheap.com/paste/2801

3:14 McMartin: What does the ~ mean? I think I recognize the rest of that syntax.

3:14 * McMartin just started looking at Clojure a couple of days ago

3:15 * muhoo may be stupid, but makes up for it with sheer tenacity

3:16 muhoo: McMartin: ~ is a reader macro that means unquote

3:16 McMartin: http://clojure.org/cheatsheet

3:17 McMartin: Aha

3:17 muhoo: most of the punctuation stuff is at the bottom, under "reader macros"

3:17 McMartin: Got it

3:17 My initial get-feet-wet project involved translating an ancient GW-BASIC program into Clojure in a way that minimized use of variables.

3:18 This may not have been the greatest idea, but I *have* managed to write a 23-clause let binding.

3:18 Static single assignment: not just for breakfast anymore

3:18 muhoo: that must have been barrels of fun.

3:18 McMartin: It's been an interesting challenge in several ways, and it's gotten me familiar with the many differences from Scheme (my only previous Lisp)

3:20 (And it's a 'spreadsheet game' so this was basically replacing a big chunk of code that involved computing new values for a bunch of variables, so that's now a function that does that in a let and then shoves the relevant results into a map to return)

3:21 muhoo: nice. i'll bet after a while you'll figure out a way to rewrite it more functionally without the lets.

3:23 McMartin: Well

3:23 These *are* functional

3:23 There's two places where I needed swap!

3:23 Or swap!.

3:23 But those are I/O-based "ratchets" for "do this thing the first time it happens and never again", so I'm OK with hat.

3:23 *that

3:24 The rest were "here are the 8 things that the user has given us, now give us back the 15 or so outputs to feed into the next turn"

3:24 Put that into a loop-recur on "status" with appropriate escapes for victory or failure, success

3:31 amalloy: McMartin: you can use ##(doc delay) for "do this once"

3:31 lazybot: ⇒ "Macro ([& body]); Takes a body of expressions and yields a Delay object that will invoke the body only the first time it is forced (with force or deref/@), and will cache the result and return it on all subsequent force calls. See also - realized?"

3:32 McMartin: That's pretty dirty >_>

3:32 amalloy: that's...more or less what they're for

3:32 McMartin: For one-shot I/O?

3:33 amalloy: well, not exactly, i guess. but for things you want to do at most once

3:51 muhoo: hmm, seems like memoize. though i haven't had reason to use either yet.

3:51 McMartin: Yeah, memoizing the results of a specific println seems like a sleazetastic move to me.

3:52 Hey, success, woo

3:52 This looks like it's working

3:52 However, I did need to use Math/ceil so I don't get to just point it at ClojureScript for the web adaptation.

3:53 muhoo: Math.floor in js?

3:54 js/Math.floor i suppose

3:54 McMartin: Oh, nice

3:54 Yeah, that'd do in the one place it matters.

3:55 Does it also have a ceil to go with floor?

3:55 muhoo: yep

4:02 fliebel: Neither Java or JS Clojure provide rational versions of those, right? Like ##(rationalize (Math/sqrt 12))

4:02 lazybot: ⇒ 4330127018922193/1250000000000000

4:05 fliebel: ... there is an infinite number of natural number, but there are more rational numbers, and even more real numbers.

4:07 Unfair... ##(rationalize (Math/PI)) I had hoped it'd day something like 22/7

4:07 lazybot: ⇒ 3141592653589793/1000000000000000

4:09 amalloy: fliebel: it said something pretty close to 22/7

4:12 fliebel: amalloy: i can make any float into a rational n.dddddd => ndddddd/1000000

4:14 Also, (count natural-numbers) = Double/POSITIVE_INFINITY, (count real-numbers) = Double/POSITIVE_INFINITY so Double/POSITIVE_INFINITY < Double/POSITIVE_INFINITY = true

4:17 amalloy: &(== Double/POSITIVE_INFINITY Double/POSITIVE_INFINITY)

4:17 lazybot: ⇒ true

4:17 amalloy: oh right, it's NaN that acts weird

4:23 fliebel: amalloy: In what way?

4:24 amalloy: comparisons with NaN always return false, iirc. it's not true in clojure (which is technically incorrect IEEE stuff, i think), because clojure implements (>= x y) as (not (< x y))

4:24 &(< NaN NaN)

4:24 lazybot: java.lang.RuntimeException: Unable to resolve symbol: NaN in this context

4:24 amalloy: &(< Double/NaN Double/NaN)

4:24 lazybot: ⇒ false

4:25 amalloy: &(< Double/NaN 5)

4:25 lazybot: ⇒ false

4:25 amalloy: &(> Double/NaN 5)

4:25 lazybot: ⇒ false

4:25 amalloy: &(>= Double/NaN 5)

4:25 lazybot: ⇒ false

4:25 amalloy: okay, maybe i'm wrong about clojure being incorrect. anyway, point is NaN acts weird

4:37 muhoo: batNaN

4:39 &(str (clojure.string/join (repeat 16 Double/NaN)) ", Batman!")

4:39 lazybot: ⇒ "NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN, Batman!"

4:45 michaelr`: BaNaNa

5:31 ghengis: I have a question

5:31 why don't people use this form of the unless macro:

5:31 (defmacro unless [a-test then else]

5:31 (if (not (eval a-test)) `(do ~then) `(do ~else)))

5:32 AimHere: Because that evaluates the test at compile time

5:32 If your test gives different results when running, then your macro will be wrong

5:33 ghengis: aha! i wondered because it works in the repl

5:34 thx much!

6:15 gtuckerkellogg: i'm having some trouble with slime

6:15 when I run inf-lisp (set to "clj") I get a repl just fine

6:16 when I run M-x slime

6:18 raek: gtuckerkellogg: is there any reason you want to start slime this way, or do you just want to get started using the simplest method?

6:18 gtuckerkellogg: no reason at all

6:20 raek: the simplest method I know of is to _only_ install clojure-mode in emacs (i.e. no slime packages), install swank-clojure/lein-swank in leiningen and use M-x clojure-jack-in from emacs

6:20 also, inferior lisp and slime are two separate ways to use a repl in emacs

6:21 gtuckerkellogg: raek, i use clojure-jack-in with leiningen projects all the time, that works great.

6:21 but what I want to do is run clojure from outside of leiningen as wll

6:21 in particular, from within org-mode src blocks

6:22 raek: how are you going to set up the classpath? have you written a custom script?

6:24 gtuckerkellogg: setting up inferior lisp is easy. M-x customize-variable RET inferior-lisp-program RET

6:24 gtuckerkellogg: raek, I can use inf-lisp as well

6:24 what I can't seem to do is connect the org-mode clojure source blocks to the inf-lisp process

6:24 raek: there you can put the path to your clojure launcher script

6:24 gtuckerkellogg: which is why I tried slime

6:25 raek: if you use slime you need to start a swank server in a clojure process

6:26 gtuckerkellogg: so for that i need the swank-clojure package?

6:26 raek: yes

6:26 gtuckerkellogg: (which doesn't seem to be on marmalade)

6:27 raek: gtuckerkellogg: it isn't. it's a clojure library

6:27 you need to make a "clj" script that puts swank-clojure on the classpath and executes a function in it on startup

6:28 https://github.com/technomancy/swank-clojure

6:28 gtuckerkellogg: thanks!

6:28 raek: then you need to tell slime to connect to the port you started the swank server on

6:28 M-x slime-connect

6:29 additionally, you need to set the encoding since slime defaults to ISO 8859-1 and swank-clojure uses the more sane UTF-8

6:30 M-x customize-variable RET slime-net-coding-system RET <enter "utf-8-unix">

6:30 (this step is done automatically by clojure-jack-in)

6:30 if you don't set that option, then slime will crash when you print a non-ascii character in the repl

6:32 gtuckerkellogg: this is the entry point the swank-clojure shell wrapper uses: https://github.com/technomancy/swank-clojure/blob/master/src/swank/swank.clj#L105

6:33 gtuckerkellogg: raek, that's extremely helpful, thank you

6:51 tordmor: Hi! I found this weird behaviour on a 4clojure problem that I don't understand:

6:51 > (apply / '(16 8))

6:51 is 2

6:51 (apply (first '(/ 16 8)) '(16 8))

6:51 is 8

6:52 does anybody know what is going on?

6:53 Bronsa: ,(apply (first '(/ 16 8)) '(16 8))

6:53 clojurebot: 8

6:54 tomoj: ,('/ 16 8)

6:54 clojurebot: 8

6:54 tordmor: also works with other operations

6:54 ahhhhh

6:54 Bronsa: oh.

6:54 tomoj: ,('/ {'/ 2} 8)

6:54 clojurebot: 2

6:54 tordmor: it doesn't recognize it as function

6:54 Bronsa: it does 'get'

6:54 tordmor: because it's still quoted

6:54 Bronsa: (get '/ 16 8)

6:54 ,(get '/ 16 8)

6:54 clojurebot: 8

6:55 tomoj: right, it's just like a keyword

6:56 ,(:foo 16 8)

6:56 clojurebot: 8

6:56 tordmor: ,(apply ~(first '(/ 16 8)) '(16 8))

6:56 clojurebot: #<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote>

6:57 tomoj: ,(doc resolve)

6:57 clojurebot: "([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"

6:58 tomoj: ,(apply (resolve '/) [16 8])

6:58 clojurebot: 2

6:58 tordmor: tomoj, Thank you, that's what I need

6:59 damn! I can't use resolve in 4clojure :(

6:59 I'll use a map to resolve it.

7:00 tomoj: that's better even if resolve were allowed, I think

7:01 tordmor: yes, might be faster for limited operations.

8:07 madsy: Does byte-array convert each element in the collection to a byte, or does it treat each element as multiple bytes?

8:08 I need to convert a collection of floats from the range [0 65535] into signed shorts, represented as byte[]. That seems a bit tricky to do from Clojure.

8:09 I guess I could cast to short, and then split it into two bytes with bit masking

8:11 hyPiRion: So the casting would be like ##(short 65535.0)?

8:11 lazybot: java.lang.IllegalArgumentException: Value out of range for short: 65535.0

8:13 hyPiRion: Well, that doesn't sound "easy".

8:13 madsy: hyPiRion: Well, the "real" data consists of shorts, but the javax.sound.sampled expects it as byte[]

8:14 So you would get one LSB and one MSB

8:14 But, I think I know a way. But it's clumsy.

8:14 hyPiRion: I would make a function which takes in a float and returns a vector, mapcatted the floats with the fn.

8:15 Then finally just spit it into an array with (into-array Byte/TYPE %)

8:16 madsy: Wouldn't into-array just coerse a type into a single byte?

8:16 Because that's what I want to avoid.

8:18 hyPiRion: What do you mean?

8:18 ,(seq (into-array Byte/TYPE (map byte (range 10))))

8:18 clojurebot: (0 1 2 3 4 ...)

8:19 hyPiRion: ,(into-array Byte/TYPE (map byte (range 10)))

8:19 clojurebot: #<byte[] [B@1f67043>

8:19 madsy: ,(seq (into-array Byte/TYPE (map byte (range 255 260))))

8:19 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for byte: 255>

8:20 madsy: I need something like this (defn split-short [x] (let [lsb (bitwise-and x 255) msb (bitwise-and (bit-shift-right x 8) 255)] ... )

8:21 And store both parts

8:21 hyPiRion: Ah, so 255 -> -1 then

8:21 madsy: Sure. There is no unsigned in Java afaik

8:22 The important thing is to store the previous whole range as a group of multiple bytes.

8:22 hyPiRion: It's kind of unexpected that (byte 255) doesn't work though, because it does in Java. =/

8:22 Well, maybe not unexpected, but it makes stuff more complicated.

8:24 ,(ubyte 255)

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

9:03 madsy: hyPiRion: Jeez.. the range for byte is annoying indeed

9:05 hyPiRion: madsy: It is kind of weird though. I thought things like short -> byte coercion would be simple.

9:07 Ah!

9:07 madsy: ##(unchecked-byte 255)

9:07 lazybot: ⇒ -1

9:08 hyPiRion: Should also work for shorts: ##(unchecked-short 65535)

9:08 lazybot: ⇒ -1

9:10 madsy: hyPiRion: Nice! Thank you so much

9:11 hyPiRion: madsy: You're welcome :)

9:14 madsy: hyPiRion: I ended up with: (into-array Byte/TYPE (flatten (map #([(highest-byte %) (lowest-byte %)]) coll))

9:16 hyPiRion: Looks good. (into-array Byte/TYPE (flatten (map (juxt highest-byte lowest-byte) coll)) will do the same thing (take a look at how juxt works).

9:16 You can also change the (flatten (map into (mapcat, I think that is more efficient.

9:16 tomoj: that can't be right

9:16 ,(#([1 %]) 2)

9:17 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentVector>

9:17 tomoj: you need ##((#(vector 1 %) 2)) there

9:17 lazybot: clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentVector

9:17 madsy: Oh, yeah I forgot about juxt

9:18 hyPiRion: ,(seq (into-array Byte/TYPE (mapcat (juxt + -) (map byte (range 10)))))

9:18 clojurebot: (0 0 1 -1 2 ...)

9:18 tomoj: ,byte-array

9:18 clojurebot: #<core$byte_array clojure.core$byte_array@a86868>

9:19 hyPiRion: tomoj: ##(doc byte-array)

9:19 lazybot: ⇒ "([size-or-seq] [size init-val-or-seq]); Creates an array of bytes"

9:21 hyPiRion: So, in fact, you can compress the whole thing down to (byte-array (mapcat (juxt highest-byte lowest-byte) coll)

9:28 xumingmingv_: i met a weird issue about lein

9:29 one of clj file depends on another clj file, let's name it a.clj

9:29 but lein does not schedule a.clj to compile first

9:30 so i got an exception like xxxx class not be found..

9:31 hyPiRion: What version of Lein and Clojure do you use? Do you import the dependency through a :use or a :require?

9:32 xumingmingv_: i use :import

9:32 i defined a java class (:gen-class) in a.clj

9:32 for java interop

9:32 lein 1.7.1

9:33 1.4.0

9:33 raek: xumingmingv_: do you require the namespace too?

9:33 xumingmingv_: raek, no

9:33 raek: import only sets up an alias for the class name. it does not cause anything to be loaded.

9:34 xumingmingv_: so if i need to import a class defined in clj file, i need to :use or :require that clj file first?

9:34 raek: xumingmingv_: yes

9:37 xumingmingv_: rake, thanks a lot, really helped!

9:37 rake, thanks a lot, really helped

9:38 … xchat changed my words…

9:38 raek, thanks!

9:39 one more question, for example a.clj depends on b.clj, but from the output of leon, a.clj is compiled first, then b.clj is compiled, why?

9:41 león -> lein, xchat's auto-correction seems annoying

9:43 raek: xumingmingv_: the compiler begins to compile a, but when it reaches the ns form it will compile b (if it hasn't been compiled already). when b is done it will resume compiling a.

9:44 compiling is just executing the top-level expressions

9:44 and storing the generated bytecode

9:53 ambrosebs: I'm looking for a graph of the Clojure collection hierarchy

9:54 has anyone seen one around?

9:54 Writing in on ye ol' paper

9:54 Bronsa: https://github.com/Chouser/clojure-classes ?

9:55 jonasen: ambrosebs: https://github.com/Chouser/clojure-classes/blob/master/graph-w-legend.png

9:55 ambrosebs: epic!

9:55 thx

9:55 Bronsa: the png is not updated

9:55 use the svg

10:05 ambrosebs: Bronsa: cheers

10:32 lynaghk`: ping: cemerick

10:32 * cemerick isn't really here ;-)

10:32 cemerick: lynaghk`: hi :-)

10:32 lynaghk`: cemerick: hey chas, how's it going?

10:33 cemerick: Pretty good. On vacation.

10:33 lynaghk`: cemerick: oh, boss! Chillin' in #clojure from the beach?

10:33 cemerick: Cambridge at the moment, waiting to hear from Sam and Edmund, actually. :-)

10:33 Beaches were earlier this year.

10:34 lynaghk`: Sam & Edmund, you'll probably need to save your energy to keep up with those two

10:35 cemerick: Per usual.

10:35 lynaghk`: so, what's cooking?

10:35 lynaghk`: cemerick: I'm moving forward a bit on that lawyertron project you saw, and I wanted to ask you if you'd used any solid exception notification stuff on clojure/heroku stack. I'd like to start aggregating things like when certain futures timeout or raise exceptions.

10:35 cemerick: Ah, nope. I'm fundamentally a heroku noob.

10:36 lynaghk`: get emails when stuff blows up, &c. I've used New Relic on a Rails stack, but that's pretty much it in terms of adv. perf/uptime monitoring

10:38 cemerick: ok, thanks. I'll keep digging around.

10:38 cemerick: There's lots of options though, most (all?) unrelated to heroku. Presumably, you could bring your own? I always get antsy about thinking about such things in a vendor-specific way, though.

10:40 lynaghk`: cemerick: yeah. My needs are pretty limited too. Mostly I want something that is easy to setup and understand, and will let me know what stuff is blowing up.

10:41 cemerick: lynaghk`: I used cloudkick for a while ~18 mos ago. They've been bought though, so I don't know where that's headed.

12:06 madsy: Could someone help me with a code snippet? I have an IllegalArgumentException (Illegal Format) I have no idea where comes from

12:07 None of the classes I use is supposed to throw that

12:07 https://gist.github.com/2758323

12:09 gfredericks: madsy: side note; I don't think importing java.lang.Math is necessary

12:09 madsy: Oh, hm. I guess javax.sound.sampled.Clip throws it. Still, I see nothing wrong with the arguments

12:09 gfredericks: Oh, thanks

12:12 gfredericks: but I don't see anything notable at a glance :/

12:13 banseljaj: Hey guys. I have been trying out the "Programming Clojure" book, and I wanted the latest version of clojure from git. I have cloned it and ran "mvn package" but I can't seem to be able to use leiningen with it. any ideas?

12:14 * banseljaj <----- Clojure and FP newbie.

12:17 madsy: banseljaj: If you get the latest version of leiningen, it should fetch Clojure 1.4 for you automatically

12:17 banseljaj: madsy: I have leiningen 1.7. also, isn't 1.5 the latest one for Clojure?

12:18 madsy: banseljaj: Oh, that might be. I haven't checked.

12:18 ForNeVeR: 1.5 is devel version.

12:18 madsy: There is a 2.0 of Leiningen. 1.7 is the old one

12:18 ForNeVeR: Are you sure you want it?

12:18 banseljaj: ForNeVeR: Newbie. So I'll stick with the stable

12:18 rexim: ForNeVeR: O_o

12:19 ForNeVeR: banseljaj: so use 1.4 from lein, and you'll be okay.

12:19 rexim: no u.

12:19 rexim: ForNeVeR: yes me.

12:19 ForNeVeR: //_~

12:19 banseljaj: ForNeVeR: How do I check clojure's version? (version)?

12:20 gfredericks: ,*clojure-version*

12:20 ForNeVeR: banseljaj: `lein repl` and then *clojure-version*

12:20 clojurebot: {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}

12:21 gfredericks: ,(type #queue [])

12:21 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: No reader function for tag queue>

12:21 gfredericks: ,(type #bytes [])

12:21 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: No reader function for tag bytes>

12:22 banseljaj: user=> ,*clojure-verision* ; java.lang.Exception: Unable to resolve symbol: *clojure-verision* in this context (NO_SOURCE_FILE:0)

12:22 ForNeVeR: I get the above error.

12:22 ForNeVeR: banseljaj: remove ,

12:22 , for talking with clojure-bot

12:22 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/for, compiling:(NO_SOURCE_PATH:0)>

12:23 ForNeVeR: ,'(yes sir)

12:23 clojurebot: (yes sir)

12:23 twhume: I have a sequence of predicate functions (suitable for "filter") and want to run them against a candidate sequence and return the first one that fails. What would be the most idiomatic way to do this in Clojure?

12:23 banseljaj: ForNeVeR: Same error when I remove the ","

12:23 ForNeVeR: banseljaj: it cannot be!

12:23 banseljaj: ForNeVeR: Sorry. typo

12:23 Okay. It says I have 1.2.1

12:24 ForNeVeR: Somewhat old version.

12:24 banseljaj: Can multiple versions of clojure reside on the same system?

12:24 raek: banseljaj: yes. leiningen takes care of that.

12:24 madsy: banseljaj: I don't see why not.

12:25 raek: each project specifies its own version

12:25 banseljaj: ,(str "banseljaj" \space "is" "...")

12:25 clojurebot: "banseljaj is..."

12:25 madsy: Just give them different version number names

12:25 banseljaj: In the project.clj?

12:25 raek: yes

12:25 banseljaj: Ah.

12:25 I apologize if I am being too noobish. I tend to learn more by asking rather than reading.

12:25 raek: this is similar to virtualenv in python-land

12:26 banseljaj: or rvm in ruby

12:26 raek: clojure is unconventional, so don't be ashamed

12:27 banseljaj: Yes. I feel like I am learning programming from scratch.

12:27 Is it common to make seperate project directories to work on different projects, and downloading clojure using lein each time?

12:27 gfredericks: ForNeVeR: the comma wouldn't mess him up; it's just whitespace

12:28 ForNeVeR: gfredericks: aw, you right.

12:28 raek: banseljaj: yes. each version of clojure you use is only downloaded once, though

12:28 banseljaj: I mean Should I use "lien new play-around" and use that project for my usual testing and fooling around?

12:28 raek: yeah

12:28 ForNeVeR: Sry, I just came from evil-flooded common lisp land.

12:29 Comma is significant there.

12:29 raek: that might feel a bit odd, but there's not any simpler way currently in lein

12:29 banseljaj: Thanks raek, ForNeVeR, madsy.

12:29 raek: cake had a "global project"

12:29 banseljaj: You guys mind if I stick around here? :)

12:29 gfredericks: ~guards

12:29 clojurebot: SEIZE HIM!

12:29 raek: lein hasn't got any global project yet, because no one has bothered adding that

12:31 banseljaj: then what is the default clojure version that is run when I use lein repl? My current install obviously uses the one that it installed with programming clojure source.

12:32 raek: banseljaj: if you run `lein repl` outside a project, you get whatever clojure version leiningen uses internally

12:32 ForNeVeR: banseljaj: that's okay. You may install another version of clojure with any project.

12:32 And get that version of clojure repl.

12:33 raek: if you run `lein repl` within a project, you get the clojure version specified in the corresponding project.clj

12:33 banseljaj: Okay. So apparently leiningen uses Clojure 1.2 internally.

12:34 raek: lein repl outside a project is mainly there for when you quickly want to try something in a clojure repl

12:34 banseljaj: Oh. Nice.

12:35 I come from a ruby background and it is second nature for me to fire an irb session to test my code.

12:35 raek: banseljaj: yes, lein 1.x uses clojure 1.2. lein 2.x uses 1.3 or 1.4 (not sure)

12:35 banseljaj: ~guards

12:35 clojurebot: SEIZE HIM!

12:35 raek: banseljaj: when developing in clojure you often keep a repl open during the whole session

12:36 and purely functional code is often very easy to test in a repl

12:37 banseljaj: leiningen is a standard tool for clojure development, I gather?

12:38 raek: banseljaj: yes. clojure the language comes as a jvm library.

12:38 from the author of leiningen himself:

12:38 "For work I use Leiningen a lot. A lot of people get confused when working with Clojure because Clojure itself is just a library rather than an application, and they expect to interact directly with it. Leiningen is that application that you interact with directly."

12:39 http://phil.hagelberg.usesthis.com/

12:40 it's a bit sad that clojure.org doesn't mention Leiningen in big bold letter on the front page

12:40 since it is the de-facto tool

12:43 Borkdude: raek: I think clojure 1.4

12:44 raek: and now I'm sure

12:44 raek: ah, probably changed in preview4

12:48 * banseljaj is upgrading to leiningen 2.0

12:49 banseljaj: It's my opinion, as a beginner, that clojure needs a more stream lined approach to install. :( the current approach might turn people off.

12:50 wkmanire: banseljaj: What would you change to make it better?

12:51 banseljaj: Hmm. I am totally willing to actually do this stuff.

12:51 For one, I would see if we can package a JVM + clojure library as a single package with most deps.

12:52 furthermore, as leiningen is already the standard tool, I'll probably include that in the main install package too.

12:52 I think it should be easy to do in *nix distros.

12:52 And the last thing, which would take a lot more time, is that I would fork emacs to make a clojure specific editor.

12:52 wkmanire: I've done the install on both linux and windows. On linux it was a lot easier.

12:53 banseljaj: yeah. on linux it's just sudo yum/apt-get install leiningen

12:53 Iceland_jack: banseljaj: not quite, most people recommend against that

12:54 wkmanire: I think the emacs part is unecessary. You could provide a script that configures an existing emacs installation with clojure-mode and paredit-mode and install swank-slime.

12:55 banseljaj: Well, I wouldn't know about that. I am still learning emacs.

12:56 Overall, Clojure is my first lisp. And I like it. a LOT

12:56 :D

12:57 I sometimes hate ubuntu

12:57 wkmanire: banseljaj: I wouldn't make light of forking emacs. he he

12:57 It isn't a simple project.

12:58 But if you install the major modes that you need and the swank slime package then you've got a perfect editor for hacking clojure.

12:59 banseljaj: I'm new to clojure too by the way.

12:59 banseljaj: wkmanire: woo. Another newbie. :) *shakes hands*

13:00 wkmanire: Well, The question would be how to get all the needed packages. :)

13:00 wkmanire: lein handles most things.

13:00 Practically *all the things*

13:01 As far as setting up emacs modes, that is all pretty simple.

13:02 You just have to download the required .el files, put them in your site-lisp folder, then update your ~/.emacs configuration file to include the .el files in your load path.

13:02 You could probably use package-mode too to install the modes from marmalade.

13:03 banseljaj: wkmanire: Yeah. I'm gonna use emacs starter kit

13:03 wkmanire: Lots of options. In the case of setting up emacs, I would only suggest writing a tutorial. There already are tutorials for most things.

13:03 banseljaj: is maven repo down or some thing? Lein is not downloading the list.

13:08 madsy: Funky.. my problem seems to be OpenJDK's fault :/

13:15 raek: banseljaj: if you decide to make a stream lined installer for "clojure", please make sure you know how clojure development is done in practice first

13:16 if you use leiningen (which most people do), there is no need to install clojure or any libraries.

13:17 since those are handled as project dependencies

13:23 madsy: Sigh.. so javax.sound.sampled is broken in Linux with OpenJDK. Is there something else I can use for sound which actually works?

13:28 banseljaj: <raek> banseljaj: if you decide to make a stream lined installer for "clojure", please make sure you know how clojure development is done in practice first -- I shall keep that in mind. Until I know enough, I will not venture into contributing crucial pieces of software

13:30 wkmanire: he he he

13:30 banseljaj: I say shoot for the sky.

13:30 If it's good, it'll stick

13:30 if it isn't, you'll find out why.

13:30 Borkdude: banseljaj: what would you install? a jdk ?

13:31 banseljaj: Borkdude: I'd probably use a standlone jdk installed just for clojure. I seem to remember one such package using this kind of approach. just can't remember which it was.

13:31 devn: good weekend all

13:32 wkmanire: Hidevn

13:32 banseljaj: ,(str "Hi " 'devn)

13:32 clojurebot: "Hi devn"

13:32 Borkdude: banseljaj: what would be useful maybe is a small linux distro with a jdk + some pre-configured IDEs like Eclipse + counterclockwise/leiningen, Emacs, Netbeans, IntelliJ and a version of leiningen thoroughly tested

13:33 wkmanire: Borkdude: Now that sounds like awesome.

13:33 Borkdude: banseljaj: so people can just load that up in their favorite VM program to get to work real quick

13:33 banseljaj: Borkdude: In my expreience, that would be rather easy to build than my solution. :D

13:34 wkmanire: Completely removes all barriers to entry except for knowing how to either install an OS or load a VM.

13:34 banseljaj: Well, I can't promise anything to the community but I think I should have something capable of running and failing in about two months or so. :D

13:34 Borkdude: VirtualBox is free and runs on linux/OSX/windows

13:34 banseljaj: wkmanire: Well, that can be handled quite easily.

13:35 Borkdude: you would just have to provide an image for that with all good defaults set

13:35 raek: banseljaj: please do contribute! but don't forget to gather feedback from other clojurians...

13:35 banseljaj: Yeah. an iso, cross compiled.

13:35 Borkdude: labrepl already installed, + other nice things

13:35 wkmanire: Borkdude: labrepl?

13:35 banseljaj: raek: No. I'd work in secret on this. and take over the world. :D

13:36 Borkdude: Clubuntuj ? ;)

13:36 banseljaj: wkmanire: it's a clojure lab web app

13:36 wkmanire: Borkdude: That hurt my eyeballs.

13:36 banseljaj: Borkdude: ubuntu is not a good candidate IMO

13:36 devn: Borkdude: it was used in the pragprog training by rich and stu ages ago

13:36 i havent looked at it in awhile, but it was maintained once upon a beard

13:36 Borkdude: cljarch linux

13:37 wkmanire: Plain old debian+clojure. Clebian.

13:37 banseljaj: Well, I'm gonna build a very basic setup and I'll report her.

13:37 wkmanire: Clojure and debian for the plebians.

13:37 banseljaj: Clebian is a nice name. :D

13:37 But we need one with a flair. :D

13:37 One that is not a blatant ripoff. :P

13:38 matessim: my copy of Clojure programming arrived NOW!

13:38 TIEM for world domination

13:38 but first, we read.

13:38 banseljaj: What would be funny is if it's named clebian but it's based on fedora. :D

13:38 devn: I like Clebian

13:38 banseljaj: matessim: CONGRATULATION!

13:38 * banseljaj is a cheapskate and reading a borrowed copy. :D

13:39 Borkdude: wkmanire: cljnux

13:39 devn: aw bummer, clebian wouldn't be spelled right: "plebeian"

13:40 plus it has negative connotations

13:40 so nevermind

13:40 Borkdude: clojuxt

13:40 devn: juxtify

13:40 banseljaj: Lambda?

13:40 Borkdude: or just "clojure linux"

13:41 banseljaj: Borkdude: Boooooring!

13:41 devn: or just "linux with clojure in it"

13:41 if it doesnt have a super sweet name we cant get people who try anything with a sweet name to download it

13:41 raek: what would this distro contain?

13:41 banseljaj: Kappanix

13:41 Kappa = klojure

13:41 wkmanire: :(

13:41 devn: it sort of sounds like kernel panics

13:42 kappanix

13:42 Borkdude: Damn functional linux

13:42 raek: a JVM, leiningen + swank-clojure, emacs + emacs-starter-kit + clojure-mode?

13:42 banseljaj: raek: Latest Clojure, OPen jdk, labrepl, and IDEs already set up for use with Clojure

13:42 wkmanire: DFL has the CLJ and the JVM and the FUN!

13:42 devn: "Cloy"

13:42 raek: banseljaj: what do you mean by latest clojure?

13:42 wkmanire: Borkdude: ^

13:42 devn: Cloy would be a cool distro name

13:43 banseljaj: raek: The latest stable release preinstalled and updatable using lein

13:43 devn: Cloy is nice'

13:43 devn: nono wait

13:43 i got it

13:43 cloister.

13:43 Borkdude: cloy?

13:43 devn: done and done.

13:43 raek: banseljaj: how would you use this installed clojure version?

13:43 devn: cloy means to disgust with an excess of richness or sweetness

13:43 uvtc: banseljaj, on Debian-based systems, it's pretty easy to apt-get install openjdk-6-jdk, then grab lein and start working. Maybe I'm not understanding what problem you're trying to solve.

13:43 banseljaj: java -cp local-version.jar

13:44 devn: cloister is a convent, monastery, college, or cathedral

13:44 jonh: i love this idea of a clojurating system

13:44 progo: lambdax

13:44 banseljaj: uvtc: the problem is to get a unified standard starting system that lets you start with repl immediately

13:44 Borkdude: linuxen… a clojure linux distro to get started without setting your hair on fire

13:44 raek: personally, I'm sceptical to going back to "java -cp clojure.jar" or "clojure scripts"

13:44 now that we have Leiningen

13:44 Borkdude: leinuxen

13:45 or leinux

13:45 devn: leinux

13:45 uvtc: banseljaj, `lein new foo; cd foo; lein repl` is pretty immediate though.

13:45 banseljaj: the good names so far: Leinuxen, lambdax, cloister and kappanix

13:45 devn: im still going with cloy or cloister, because then you get carcassonne fans as a two for one

13:45 raek: well, I can appect this: alias clojure='lein repl'

13:46 Borkdude: I like leinux as a tribute to leiningen… I don't know carcasonne

13:46 banseljaj: uvtc: Not on windows. and that still doesn't set up the different editors/IDE

13:46 uvtc: Just bouncing ideas. :)

13:46 uvtc: banseljaj, Ah.

13:46 banseljaj: <Borkdude> I like leinux as a tribute to leiningen… -- +1

13:47 devn: cloister just wins -- sorry, but im stuck in the mud on that name

13:47 :)

13:47 raek: banseljaj: I think the "java -cp ..." approach is bad for noobs, since becomes significanly complicated when need to done any of:

13:47 banseljaj: devn: Two votes for Leinux. :P

13:47 raek: noobs would just use a shortcut on the desktop.

13:47 wkmanire: What did I miss?

13:47 raek: 1) load code from source files (!)

13:48 wkmanire: May laptop ate all the battery.

13:48 raek: 2) use external libraries

13:48 3) integrate with editors

13:48 jonh: devn: i to think cloister is win

13:48 too

13:49 banseljaj: wkmanire: the good names so far: Leinuxen, lambdax, cloister and kappanix

13:49 raek: that's the idea.

13:49 raek: banseljaj: be sure to include documentation on how to begin "real development"...

13:50 banseljaj: raek: A local mirror of docs and sources would be nice. :)

13:50 raek: we get a lot of people in this channel who are halfway though implementing their own Leiningen because they started with one of the "clojure scripts"

13:51 banseljaj: Also, if there is a good open source book, or one that can be released with the linux, that'd make it frickin complete

13:51 wkmanire: banseljaj: Well, there are some really good books

13:51 raek: banseljaj: a link to the Leiningen readme on the desktop

13:51 essential.

13:52 wkmanire: and the authors are in #clojure all of the time.

13:52 So their books tend to get recommended.

13:52 I'm currently working through Cemerick's new book on my kindle.

13:53 jonh: which book is that?

13:53 Borkdude: I think a VM would be nice to try things out without installing things on your machine (IDEs) and see how it should work if it works (not if it doesn't work on your own machine because of some weird thing)

13:54 devn: jonh: joy of clojure, clojure programming, programming clojure, practical clojure

13:54 i mean honestly without exception the authors of books hang out in here at one time or another

13:54 but id say joy of clojure and clojure programming have the most presence as of late

13:55 Borkdude: the thing I learned so far from CP is that Ruby has a really weird synta

13:55 x

13:56 wkmanire: Borkdude: Yes it do.

13:56 Borkdude: Very oddish. But I'd still take ruby's syntax over C++ any day. :D

13:56 And I'm not even a rubyist. I fell in with the Python camp.

13:57 Borkdude: wkmanire: I like Python's syntax better

13:57 banseljaj: Borkdude: I don't find it weird. but then again, ruby was my first language.♥

13:57 wkmanire: banseljaj: Ahhh, first love.

13:57 Borkdude: wkmanire: one thing in Python though: variables introduced in for loops are global, wtf?

13:58 banseljaj: Borkdude: Python's syntax *is* cleaner. I personally don't work well with indentation. :(

13:58 Borkdude: banseljaj: GW Basic was my first language

13:58 then Turbo Pascal

13:58 no first Turbo Basic

13:59 banseljaj: Borkdude: GW BASIC was the forst one I did, but never did actual programming, i.e problam solving, until ruby.

13:59 Borkdude: I was so happy when I could compile my own executables… :-)

13:59 banseljaj: Borkdude: that feeling is indeed awesome. :D

14:00 As programmers go, I belong to the breed that has a profession that has nothing to do with programming. :D

14:00 jonh: devn: thanks, I just started clojure a few days ago and purchased the joy of clojure; so far so good :P)

14:01 Borkdude: banseljaj: what is your profession?

14:01 banseljaj: I'm 99% doctor.

14:01 (meaning months away from graduation)

14:01 Borkdude: banseljaj: doctor meaning PhD? in what field?

14:02 banseljaj: Doctor meaning MD. Specializing in psychiiatry

14:02 s/Psychiiatry/Psychiatry

14:02 Borkdude: banseljaj: ah ok

14:03 banseljaj: maybe you can do a research on clojure as a therapy or why it is so addictive ;)

14:03 jonh: so you can help us after we go clinically insane

14:03 or that

14:03 banseljaj: I think jonh's idea is better. :P

14:04 Clojure Therapy: A new frontier in recovering Imperative/Object-Oriented Programmers.

14:04 Borkdude: banseljaj: I have a mutability trauma…

14:05 banseljaj: can you help me?

14:05 banseljaj: Borkdude: take a seat and tell me where it touched you.

14:05 wkmanire: 99% doctor? Is that contagious?

14:05 Borkdude: banseljaj: I think we have to go back to my childhood, GW BAsic

14:06 wkmanire: Borkdude: I started with QBasic.

14:06 :D It was awesome.

14:06 banseljaj: wkmanire: Nope. :)

14:06 jonh: can i get a "shut up and take my money!!!" ?

14:06 uvtc: uh oh, Borkdude is regressing. :)

14:06 Borkdude: wkmanire: I also used that, in the later versions of DOS

14:06 wkmanire: Borkdude: I print'd, circle'd, line'd and pset'd the night away.

14:06 many many weekends.

14:06 banseljaj: GW BASIC was the thing that hooked me on computers. :)

14:07 wkmanire: Borkdude: Have you ever seen the QBasic Nerd video on youtube?

14:07 Borkdude: wkmanire: no

14:07 wkmanire: It is practically the anthem of my childhood.

14:07 hold on, I'll link it for you

14:07 Borkdude: (on a sidenote, has anyone tried microcontroller programming as a hobby here?)

14:07 wkmanire: Borkdude: http://www.youtube.com/watch?v=Mal6XbN5cEg

14:09 banseljaj: Borkdude: Nope. I didn't actually have my own computer till 2003.

14:11 Borkdude: wkmanire: you didn't make this video, did you? ;)

14:11 wkmanire: Can I use tags with clojure in emacs?

14:11 Borkdude: No, it wasn't me actually.

14:11 I wish it were.

14:11 Borkdude: Pretty kick ass though right?

14:11 banseljaj: wkmanire: Is that you? :D

14:12 wkmanire: No, I'm much prettier with my bald head and red beard.

14:12 banseljaj: :D

14:12 Borkdude: wkmanire: well, it reminds me of my childhood as well, but it doesn't included mod tracker software and floppy disks

14:12 webben: wkmanire: Good grief. via that video. people still program stuff in qbasic: http://www.qbasicstation.com/

14:12 clojurebot: profiles in clj-http is https://gist.github.com/1846759 an example of the profiles feature in Leiningen 2

14:13 Borkdude: wkmanire: http://www.youtube.com/watch?v=6RpB41Txa9M

14:15 I never had the fun I had in programming as a kid in GW BASIC until I discovered Common Lisp and now Clojure though

14:15 wkmanire: Borkdude: Cool video.

14:16 webben: I still hack a little QB when I'm feeling nostalgiac.

14:16 webben: Usually with a few beers.

14:17 Borkdude: .bat scripts are nostalgia and also still reality (leiningen ;))

14:17 show me your autoexec.bat and I'll show my .emacs/init.el? :

14:17 :P

14:18 banseljaj: I never did .bat scripts.

14:18 Windoze is for video games. :)

14:18 Borkdude: I wonder what would attract kids to programming when growing up with Windows right now

14:19 wkmanire: I want to browse through use's of a particular function in a project.

14:19 Borkdude: clearly in the 80ies it was GW Basic on DOS

14:19 wkmanire: can I set up tags to do that with clojure?

14:19 Borkdude: maybe Apple had something like it too? I didn't know much people with Apples then

14:19 wkmanire: Borkdude: Back in the day you could actually produce a box-on-the-shelf quality video game by yourself as a 16 year old.

14:19 Borkdude: That was pretty attractive.

14:20 Not really feasible anymore.

14:20 Borkdude: wkmanire: maybe the web is now more attractive, javascript?

14:20 wkmanire: what would a child try to make I mean just for fun

14:20 misislavski: What's a good alternative to (format) in ClojureScript?

14:20 wkmanire: "Oh wow! I make some text appear on the screen look at that!" -- 16 year old in the 80`s

14:21 "THis is so lame! How do I do 3d stuff?" -- 16 year old in 2012.

14:21 Bronsa: lol

14:21 Borkdude: wkmanire: I wrote programs on paper when I was 12 and bored with arithmetic, I used to type it over when I arrived home

14:21 wkmanire: Borkdude: Yes, I think Javascript is probably the winner of today. You can make things work on your mobile phone appendage.

14:22 banseljaj: I agree.

14:22 eggsby: Borkdude: were they BASIC programs

14:22 Borkdude: eggsby: yes, including line numbers

14:22 eggsby: :p

14:22 wkmanire: Ahhh.. Beginners All Purpose Symbolic Instruction Language. I still remember the acronym.

14:22 banseljaj: I attracted my little cousins to OOP by setting them up at irb.

14:23 * eggsby is too young for that..

14:23 eggsby: my first language was js then java

14:23 banseljaj: eggsby: You are closer to my age then. :D

14:24 Borkdude: eggsby: banseljaj what age are we talking?

14:25 banseljaj: Dragon Age, Obviously

14:25 wkmanire: Looks like ctags works on lisp.... I hope it works on clojure.

14:25 eggsby: I'm 23, I'd wager you're late 30s early to mid 40s Borkdude ?

14:25 Borkdude: 31

14:25 eggsby: :(

14:25 wkmanire: Nope, it looks for defun

14:25 :(

14:26 eggsby: What do you wager for me? Hmm? hmm?

14:26 Borkdude: eggsby: why :( ?

14:26 * banseljaj is 23

14:26 eggsby: cause my guess was incorrect!

14:26 banseljaj: +this year

14:27 wkmanire: You are like 35 OSLT

14:27 +/- 5

14:27 raek: wkmanire: have you tried using M-. with slime?

14:27 Borkdude: I remember seeing Java for the first time… public static void main(String [] args) wtf?

14:28 eggsby: honestly, I was interested in programming in highschool, so I took a java class.. it really turned me off

14:28 Borkdude: it didn't really invite me to explore any further

14:28 eggsby: 'why is there so much ceremony just to do this simple thing'

14:28 Borkdude: they should have used GW BASIC for web applications… GW BASIC EE

14:29 banseljaj: I read "SAMS teach yourself java in 24 hours'. I got distracted around hour 8, never went back. :(

14:30 eggsby: smalltalk webdev

14:30 Borkdude: banseljaj: did they recommend 24 hours in one go? ;)

14:30 raek: wkmanire: it probably doesn't use etags/ctags under the hood, but provide a similar interface

14:30 eggsby: every url is an object

14:30 wkmanire: eggsby: 26

14:30 ha ha

14:30 raek: Looking, sorry for the delay. Had to discipline my offspring.

14:31 raek: M-. definition not found.

14:31 eggsby: I started young. 12 years old or so.

14:31 raek: wkmanire: which version of swank-clojure / lein-swank do you use?

14:31 eggsby: nice

14:32 I didn't get serious about dev until about 3 years ago

14:32 raek: and did you use clojure-jack-in or another approach?

14:32 wkmanire: raek: Yes, that's what I used.

14:32 pandeiro: wkmanire: are you from MT originally?

14:32 wkmanire: raek: I forgot which version of swank-clojure I have, how do I check that?

14:33 pandeiro: Não. I was born in Texas and grew up in Las Vegas.

14:33 raek: wkmanire: if you use lein 1.x, check your ~/.lein/plugins/ directory

14:33 wkmanire: 1.4.2

14:33 raek: hrm

14:34 pandeiro: wkmanire: ah ok, you don't sound like an ESLer come to think of it

14:34 raek: also, M-. requires the code to be loaded before it can find it. have you required all involved namespaces?

14:34 wkmanire: pandeiro: He he. No. English was my first language. I am fluent in portuguese too.

14:34 pandeiro: I started learning about 4 years ago.

14:34 raek: I would do that from the repl?

14:34 pandeiro: you moved to brasil 4 years ago?

14:35 raek: wkmanire: (require 'my.namespace)

14:35 wkmanire: pandeiro: No, 3 months ago. But I've been visiting every year.

14:35 pandeiro: cool, i moved down here when i was 22, 8 years ago

14:35 raek: after that, M-. should be able to find all functions in that namespace and all namespaces it uses, etc

14:35 C-c C-k in the buffer does the same thing

14:35 (the source file buffer)

14:36 wkmanire: raek: ha ha ha, I know how to load a namespace. I mean if I require everything from the REPL will it do the trick?

14:36 raek: yes

14:36 ah, sorry. I misread what you said... :-)

14:36 wkmanire: pandeiro: Where from?

14:37 raek: wkmanire: M-. works for me with swank-clojure-1.4.2

14:37 eggsby: I just watched that documentary 'wasteland', so beautiful

14:37 you seen it wkmanire ?

14:37 pandeiro: wkmanire: southern california

14:38 wkmanire: pandeiro: Interesting. Why'd you move to Brazil?

14:38 Do you have Brazillian parents?

14:38 raek: No luck so far.

14:38 pandeiro: wkmanire: no, Brazilian wife and now a Brazilian kid :)

14:39 wkmanire: pandeiro: I'm about to marry one myself.

14:39 banseljaj: <Borkdude> banseljaj: did they recommend 24 hours in one go? ;) Nope. But i sure took it that way. :D

14:39 pandeiro: oh good luck with that

14:39 raek: wkmanire: does it work if you put the point inside let in a (let [...] ...) and press M-. ?

14:39 pandeiro: ;(

14:39 that was supposed to be a ;) but freud etc..

14:39 wkmanire: We're still working on the kid. It's hard work. :D

14:39 raek: wkmanire: I just realized a thing. what clojure-mode version do you use?

14:39 pandeiro: yeah for me it was 'um chute um gol'

14:40 wkmanire: ha ha ha ha

14:40 raek: M-: (clojure-mode-version) RET

14:40 wkmanire: 1.11.5

14:40 raek: same as mine...

14:41 wkmanire: raek: I'm obviously doing it wrong.

14:41 :/

14:41 pandeiro: We're working on the I129F visa. One month to go in the wait.

14:41 Borkdude: The nice thing in Python is that you can make smileys to get things from indexed collections, s = 1, X = [1,2,3], X[:-s]

14:41 wkmanire: pandeiro: I'm so tired of all of this visa crap.

14:41 raek: wkmanire: C-h k M-. shows the help for slime-edit-definition for me. what does it show for you?

14:42 wkmanire: raek: Same.

14:42 raek: :/ indeed

14:42 wkmanire: It's just telling me definition not found for whatever I try it on.

14:43 pandeiro: wkmanire: having a kid was the easiest way for me to normalize; i was here 5 years illegally before that

14:43 raek: wkmanire: in the repl or in a source file buffer?

14:43 pandeiro: process was relatively painless actually

14:43 wkmanire: pandeiro: Damn. Hell of a risk, that.

14:43 pandeiro: We're trying to live in the states though, not Brazil.

14:43 raek: IN the source file buffer.

14:44 raek: wkmanire: and M-. on the word "let" fails too?

14:44 wkmanire: raek: No, that works.

14:44 pandeiro: wkmanire: that is definitely more complicated.. was hard for my partner to get a visa

14:45 wkmanire: pandeiro: Mine was turned down on the tourist visa, which is why I'm here now.

14:45 raek: ok, so then it works (partially). it just cannot find your own definitions?

14:45 wkmanire: pandeiro: This fiancé visa aughta work out though.

14:45 raek: Yeah. I'm working on refheap. Raynes asked me to add to the API.

14:46 raek: wkmanire: and you ran C-c C-k in the buffer?

14:46 wkmanire: raek: but I'm having trouble getting refheap.models.api to load in the REPL.

14:46 raek: error: java.lang.AssertionError: Assert failed: (connection? conn), compiling:(paste.clj:22

14:47 raek: wkmanire: ok, this sounds like an issue with the refheap code and not with M-.

14:48 wkmanire: raek: Agreed.

14:49 pandeiro: Recently the US government relaxed quite a bit with Brazilians entering the country. I'm hoping that will help our case too.

14:49 pandeiro: You'd think it'd be enough to fall in love right?

14:49 That was the easiest part. *sigh*

14:49 pandeiro: wkmanire: now that brasil's coming along yeah, dont think either country will require a visa soon

14:49 wkmanire: raek: Thank you for your help.

14:50 pandeiro: The two countries only stand to gain by working together.

14:50 * banseljaj has lein2 perfectly setup now. yay!

14:52 pandeiro: wkmanire: good luck with your process, i'm sure it'll work out. if you're ever in SP drop me a line. email is nick @gmail

14:53 wkmanire: pandeiro: I usually pass through sp entering and leaving the country.

14:53 But I've only left the airport once.

14:53 :D thanks for the invitation though. I'm sure I'll end up in sp for more than a day eventually.

14:55 banseljaj: Hmm. labrepl won't run. I wonder why it throwsa a ClassNotFoundException

15:11 Borkdude: how does keynote compare to powerpoint on mac, is it easier to use etc? any experience?

15:11 I'm asking this because I copy pasted some clojure code to powerpoint which turns out very urgly

15:11 ugly

15:11 and I can't get the highlighting in order

15:12 banseljaj: Borkdude: Interop between them is tough.

15:12 but PP is pretty awesome in its own right

15:13 ghengis: i can usually preserve syntax coloring when cutting and pasting from eclipse -> word/lotus notes, etc

15:13 Borkdude: ghengis: did you try Eclipse -> Powerpoint?

15:14 ghengis: nope

15:14 Borkdude: ghengis: I always have to fix the indenting and coloring

15:14 ghengis: but maybe I'm doing something stupid

15:14 ghengis: i haven't used powerpoint in ages

15:15 Borkdude: I use latex/beamer for other presentations but in this one I want to be able to change the code in a wysiwyg fashion

15:19 ghengis: all I know is that eclipse is one of the few editors that preserves coloring on the clipboard

15:20 banseljaj: Borkdude: There is a Latex editor that also has WYSIWYG

15:20 In othernews, suddenly lein has stopped working

15:23 ghengis: so i asked last night, why this implementation of unless is bad

15:23 (defmacro unless [atest then else] (if (eval atest) then else))

15:24 Bronsa: (defmacro unless [atest then else] `(if ~atest ~then ~else))

15:24 well

15:24 (defmacro unless [atest then else] (list 'if atest then else))

15:24 ghengis: defmacro should produce a list

15:25 raek: ghengis: one reason it is bad is because it does not behave the same as Bronsa's definition

15:25 banseljaj: Umm. Guys, halp. lein and lein2 refuse to run repl.

15:25 ghengis: in the repl, it works, but i understand in compilation, it's different

15:25 Borkdude: banseljaj: what OS are you on?

15:26 banseljaj: Borkdude: Linux. ubuntu 12.04

15:26 Bronsa: well, ghengis's unless does the conditional at compile-time

15:26 raek: ghengis: don't you expect <a> in (if <a> <b> <c>) to be evaluated each time the if is evaluated?

15:26 Borkdude: banseljaj: does it look like this issue? https://github.com/technomancy/leiningen/issues/582

15:26 raek: ghengis: note that (let [x 1] (unless (= x 1) ... ...)) fails, because x is not avaiable there

15:27 all expressions passed to eval are evaluated as if they were on the top level

15:27 Borkdude: banseljaj: in other words, a hanging REPL

15:27 raek: (so you can't use any local variables)

15:27 banseljaj: Borkdude: Nope. It just crashes even before repl starts.

15:27 ghengis: yeah, i see now

15:28 raek: banseljaj: can you post the stackrace (or other error message) you get?

15:28 ghengis: raek: that's a good test

15:28 banseljaj: Just a minute

15:28 raek: ghengis: a macro like that can be useful, but I wouldn't name it "unless". "compile-time-unless" would perhaps be better

15:29 banseljaj: raek, Borkdude:https://gist.github.com/9088572fce73895b60a0 --this shows everyhting I did

15:30 Borkdude: banseljaj: don't call your project clojure

15:30 banseljaj: Oh.

15:30 *facepalm*

15:31 raek: yeah, the project name interacts with the clojure runtime in surprising ways...

15:31 banseljaj: That was my problem?

15:31 wkmanire: raek: Turned out to be a problem with me. Not even a problem with refheap.

15:31 raek: I didn't load a needed dependency.

15:32 raek: banseljaj: when you created a project called "clojure", leiningen created a file called clojure/core.clj. this file shadows all definitions of clojure.core

15:32 banseljaj: Yes. it works now.

15:32 raek: Ahh.

15:33 raek and Borkdude, thanks. :)

15:33 raek: so 1) don't choose a project name that is already taken 2) don't choose a project name that is the same as a function in clojure.core

15:34 2) causes problems if you name your project "test"

15:35 banseljaj: I am now going to set up emacs for y laptop. :)

15:36 wkmanire: banseljaj: There is no try.

15:36 banseljaj: There is only `do

15:36 raek: banseljaj: make sure you follow the official docs (clojure-mode)

15:37 never trust the first result on google on how to setup your clojure dev tools

15:37 banseljaj: raek: I was gonna get the emacs starter kit

15:37 Raynes: raek: Boy, don't you be talkin' bout my code now.

15:38 raek: banseljaj: good choice

15:38 Raynes: It was actually just the mongodb connection hadn't been set up because server.clj hadn't been loaded.

15:38 raek: then the clojure emacs install process is just M-x package-install RET clojure-mode RET

15:41 then install swank-clojure using the steps in its readme and you're all set

15:42 banseljaj: raek: Thanks. :)

15:43 madsy: Do I have to do something special to access static members inside nested class in a class?

15:43 Raynes: raek: I expect a written apology in my P.O. box by Tuesday.

15:43 madsy: (Foo/Bar Baz.Bal.someStaticVariable)

15:43 Baz.Bal isn't found even though I imported Baz

15:53 muhoo: is there a lein-ish tool to search all the clj files in a classpath for a particular string or function?

15:54 i mean, i could write in bash in a few minutes, and might do, but if there were already something inside lein to do it, that'd be neat

16:00 arrrgh, found it. compojure 1.0.4 requires ring-core 1.1.0, but couch-session requires ring-core 1.0.0, so that is what is getting pulled in https://www.refheap.com/paste/2804

16:01 is this a bug in lein, or in maven, or do i have something misconfigured?

16:04 arohner: muhoo: that's kind of the design of maven

16:05 pandeiro: muhoo: i had that the other day but didn't have time to investigate.. gave up on couch-session for now.. i had bumped the version numbers a while ago but it doesn't work with ring 1.1.0

16:05 arohner: changing the order of your deps will change which one wins, I think

16:05 a more clear solution is to use :excludes in your deps

16:05 sorry, :exclusions [foo/bar baz/baz]

16:08 muhoo: pandeiro: hmm, thanks, you may have saved me hours of going around in circles!

16:09 but couch session store is in my critical path, so, if it don't work, i'ma gonna hafta fix it. *sigh*

16:10 it's only like > 100 loc anyway

16:10 < 100

16:10 infix operators confuse me now

16:14 pandeiro: muhoo: i am planning on doing that this week too if time permits, the previous ring/clutch bump only needed a few small changes

16:20 muhoo: pandiero: should we coordinate on that then? do you have a fork of it or are you working on sritchie's?

16:20 michaelr`: if jswat doesn't show any locals and watches what does it mean? I've connected it to a java program

16:23 muhoo: pandeiro: nm, i see you in the commit history

16:23 pandeiro: muhoo: i had a fork but deleted it after sritchie merged my changes back... i will fork again now, try to hit this on wednesday probably? unless you do it for us :)

16:26 muhoo: i'd like to get to it before wednesday. if i fix it for then, i'll send both you and sritchie a pull request

16:26 if not, we can connect then, sure

16:28 pandeiro: muhoo: if it turns out to be something complicated, let me know here and i'll take a look earlier.. i just have a deliverable for this tuesday

16:29 muhoo: sounds good, thanks

16:40 raek: madsy: the java language hides something here. the Bal class name is acutally Baz.Bal

16:40 sorry, is actually Baz$Bal

16:41 so you need to import that class and then write Baz$Bal/someStaticVariable

16:43 (this is mentioned briefly under "The Dot special form" at http://clojure.org/java_interop)

16:49 ghengis: i think this is my problem in a nutshell

16:49 i need a macro like (make-let [a b c] [1 2 3] (+ a b c)) => 6

16:49 where make-let expands to:

16:49 (let [a 1 b 2 c 3] (+ a b c))

16:50 Vinzent: ghengis, why do you need that?

16:51 ghengis: for a larger macro i'm writing

16:51 Vinzent: why can't the larger macro generate [a 1 b 2 c 3] if it can generate [a b c] and [1 2 3]?

16:51 ghengis: i want to accept forms like [a b c] and bind them to values taken from a list

16:51 clojurebot: eg, https://github.com/clojure/tools.logging is the new version of clojure.contrib.logging

16:52 madsy: raek: Thanks

16:52 gfredericks: (defmacro make-let [a b & cs] `(let [~@(mapcat vector a b)] ~@cs))

16:52 raek: ghengis: why not (let [[a b c] [1 2 3]] (+ a b c)) ?

16:52 Vinzent: ghengis, it actually sounds like destructing

16:52 ah, yeah

16:52 ghengis: oh my

16:52 that's brilliant :)

16:52 at least from my perspective :)

16:53 i think that'll work great

16:53 gfredericks: I like raek's idea. not sure who you're reacting to.

16:53 ghengis: raek

16:54 * gfredericks goes off to make macro & cheese

17:01 pandeiro: where does lein-cljsbuild stash the google closure lib and clojurescript?

17:18 emezeske: Anyone know if there's a mirror for the clojure JIRA workflow doc (http://dev.clojure.org/display/design/JIRA+workflow) ?

17:18 Seems down right now

17:18 Nevermind, google cache seems recent

17:50 fmw: I get No matching field found: getRoot for class clojure.lang.Var when running tests from emacs using clojure-swank in Clojure 1.3.0 and 1.4.0. Does anyone have a fix for this? I'm running swank-clojure 1.4.4

17:54 raek: fmw: are you sure you don't have multiple swank versions in ~/.lein/plugins/ or that no deps pull in another version into lib/?

17:55 fmw: raek: let me check.

17:55 raek: I recall having seen this error before, but I think it has been fixed

17:56 fmw: raek: yes, I've seen it before too and I think it has been fixed too - it turns out I have an old version in ~/.lein/plugins so let me check what happens when I remove it!

17:59 raek: ok, I removed the old file, removed my libs/ directory in my project directory and ran lein clean, but still getting the error. I guess some old version must be lurking around still.

18:01 madsy: Is there a better way to iterate over Java arrays than this? https://gist.github.com/2759686

18:01 My input order is pretty weird :)

18:01 raek: fmw: a dependency could pull in an old version. does swank-clojure appear in lib/ after you do a lein deps?

18:01 madsy: I'm probably missing something which was made specifically for this. amap, doseq or something

18:01 amalloy: madsy: just call seq on the array? i can't even find the code your asking about in that swarm of printlns

18:02 *you're. oh god

18:02 raek: (doseq [element array] ...operations...) works for java arrays too

18:02 fmw: raek: yes, it seems there is a 1.4.0 version in lib/ for some reason, instead of 1.4.4

18:02 emezeske: madsy: You should use doseq instead of for/map (which are lazy)

18:03 madsy: Also, (do (println ...) nil) is equivalent to just (println ...)

18:03 madsy: emezeske: Yeah, I was just confused about the order.

18:03 raek: fmw: one thing you can do is to add an :exclusions entry to your project.clj

18:03 madsy: Which probably is caused by the laziness

18:03 Thanks again

18:04 raek: fmw: and instruct the library author to remote swank-clojure from the library project.clj

18:04 plugins and profiles are better suited for stuff like swank

18:04 fmw: raek: I'm guilty of putting it in my project.clj too, I realize that this is not good now ;)

18:05 raek: fmw: well, it used to be the correct way to do it... :-)

18:06 the swank-clojure readme lists the current best practices for using it

18:06 which differs a bit depending on your lein version

18:09 fmw: raek: ah, so putting it in :plugins for project.clj is not a problem?

18:09 because they are not pulled in if you're project is a dependency?

18:11 raek: fmw: I think so. but ideally you should put swank-clojure in your user profile

18:11 since it's not really specific the project, but to your setup

18:13 so in lein2, you'd have {:user {:plugins [[lein-swank "1.4.4"]]}} in your ~/.lein/profiles.clj file

18:13 fmw: raek: yes, I'm trying that now. thanks!

18:13 raek: with lein1, you install the plugin using "lein plugin install ..." and it ends up in the ~/.lein/plugins/ directry

18:14 which seems to be what you had

18:15 I always forget whether the :plugins option was backported to lein 1.x

18:15 fmw: raek: ok, thats what I did now. still getting the error, so restarting emacs just to be sure

18:22 bderooms_: what does the io! macro do exactly? I expected (io! (dosync (println 4) (+ 4 5))) to return an error

18:23 metellus: I think the goal is to keep things with side effects from happening inside a dosync

18:24 amalloy: &(dosync (io!))

18:24 lazybot: java.lang.ClassNotFoundException: clojure.core

18:24 amalloy: damn it, lazybot

18:24 ,(dosync (io!))

18:24 clojurebot: #<IllegalStateException java.lang.IllegalStateException: I/O in transaction>

18:24 bderooms_: ah so you wrap all io in 'io!'

18:24 to make sure it doesn't accidentally happen in a transaction?

18:24 amalloy: ,(doc io!)

18:24 clojurebot: "([& body]); If an io! block occurs in a transaction, throws an IllegalStateException, else runs body in an implicit do. If the first expression in body is a literal string, will use that as the exception message."

18:24 metellus: exactly

18:25 bderooms_: k, I interpreted it as 'evaluate a transaction to check each operation and error if its IO'

18:32 fmw: raek: now swank won't start at all, I'm just going to start with a clean leiningen install

18:33 raek: fmw: just wipe the ~/.lein/plugins/ and the project lib/ directories

18:33 and do a "lein plugin install swank-clojure 1.4.2" if you are on lein 1.x

18:33 and then a lein deps

18:33 fmw: raek: yes, I saw that on the lein-swank github page

18:34 so I'm going to try and upgrade to lein2

18:34 raek: you need to update your project.clj file too

18:34 fmw: anyway, when debugging these kind of things it's very usefule to inspect the output of "lein classpath"

18:35 if you see swank-clojure (or lein-swank) there twice, you also see the full path

18:36 (at least in lein 1.x. in lein 2 you can do "lein deps :tree" instead)

18:52 fmw: raek: I'm on lein2 now, there is no mention of lein-swank in my classpath or lein deps :tree. swank jack-in works again now, but I still get the error

18:54 I'm pretty confident I'm on lein-swank 1.4.4 now, since sudo find / -name lein-swank only return /home/fmw/.m2/repository/lein-swank/lein-swank/ which just contains 1.4.4

18:57 raek: fmw: the same error?

18:57 (getRoot something)

18:58 fmw: raek: yes, No matching field found: getRoot for class clojure.lang.Var

18:58 raek: oh, wait. could this be a clojure-mode issue?

18:59 fmw: what does M-: (clojure-mode-version) print?

18:59 fmw: raek: 1.10.0

19:00 raek: fmw: that could be it. try upgrading

19:01 1.11.5 is the latest

19:05 fmw: raek: on clojure-mode 1.11.5 now, but still the same error

19:09 raek: fmw: is the only one swank on `lein classpath`?

19:10 nmishra: hi

19:10 fmw: raek: oddly enough, there is no mention of swank at all on lein classpath

19:10 nmishra: installed lein2.0.0-preview4

19:10 raek: fmw: what libraries are you using, and with which clojure version?

19:11 nmishra: and my clojure version in project.clj is 1.4

19:11 but lein2 repl gives the version as 1.3.0

19:11 what am I doing wrong ?

19:12 fmw: raek: see https://github.com/fmw/alida/blob/master/project.clj

19:12 raek: nmishra: I have heard that bad-behaving dependencies can pull in an older version

19:13 fmw: also, :dev-dependencies does not exist in lein2

19:13 fmw: raek: yes, just figured out that it wasn't including those packages when I ran lein test

19:13 raek: fmw: and you should put lein-swank in your ~/.lein/profiles.clj

19:13 nmishra: I have a brand new project

19:13 (defproject svm4HN/svm4HN "1.0.0-SNAPSHOT"

19:13 :min-lein-version "2.0.0"

19:13 :dependencies [[org.clojure/clojure "1.4.0"]]

19:13 :description "FIXME: write description")

19:13 thats what it looks like..

19:13 fmw: raek: was just to mention this is an old version, without the :plugins

19:13 raek: fmw: there's a `lein precate` command

19:14 fmw: didn't push the current version yet

19:15 raek: nmishra: when do you get 1.3.0? with lein repl inside the project?

19:15 nmishra: yes

19:15 lein2 repl

19:15 raek: not outside the project?

19:15 nmishra: nope

19:15 outside I get 1.4

19:16 raek: ok, that sounds weird

19:17 fmw: I'm confused. are you using lein2 with profiles and plugins, or are you using lein1 with lein plugin install?

19:17 nmishra: I am using lein2 with profiles and plugins

19:17 raek: nmishra: that one was for fmw...

19:17 nmishra: I still have lein1 installed ..but I upgraded using https://github.com/technomancy/leiningen/wiki/Upgrading

19:18 sorry

19:18 raek: nmishra: and you restarted clojure after you made any changes to the project.clj file?

19:18 it is really weird that such a small project should behave this way

19:19 nmishra: going to try this..remove the project and generate it with lein2

19:19 see if that makes any difference

19:20 raek: if your project.clj looks exactly like what you posted, I can't imagine what's wrong...

19:20 fmw: raek: http://paste.lisp.org/display/129552

19:20 raek: that project.clj should work in both lein1 and lein2 (if you remove the :min-lein-version, that is)

19:20 fmw: that is my new project.clj (shouldn't have linked to the old one, but I thought you just needed to know the packages)

19:21 raek: fmw: ah, a dependency pulled in an old version swank, right?

19:22 you should add swank-clojure to :exclusions too

19:22 fmw: raek: I'm not sure what caused that, but I'll try that

19:22 raek: you said before that swank-clojure 1.4.0 appeared in lib/

19:22 but that was your project?

19:22 fmw: yes

19:23 raek: its not there anymore, though

19:23 raek: a library of yours, or this project.clj file?

19:24 nmishra: I don't know..

19:24 it's a brand new project

19:25 fmw: raek: it wasn't my project that pulled it in, my project said 1.4.4 and it was still running some old version I had installed manually because I was still on lein 1

19:25 raek: I assume 1.4.4 wouldn't have worked in the first place, with lein1, but not sure.

19:27 raek: its not there, anymore, though, so it doesn't matter.

19:29 raek: nmishra: doing "lein2 new foo", changing 1.3.0 to 1.4.0 in foo/project.clj and then "lein2 repl" in foo/ gives me a 1.4.0 repl...

19:29 nmishra: are you using any plugins or anything?

19:29 nmishra: I am not..

19:29 this is a brand new project

19:29 fmw: raek: I don't know where my current swank is coming from, though, I've only got it in a single place and with 1.4.4, but it isn't listed in my lein classpath output

19:30 nmishra: the only thing I haven't done yet..is completely wipe my git source folder and start fresh with lein2

19:30 let me try that

19:30 raek: I wonder what lein command clojure-jack-in uses

19:30 maybe it uses your 1.x lein

19:31 fmw: raek: I removed that

19:31 nmishra: That did it

19:31 don't know why it happened though

19:31 thanks

19:32 raek: and in what file does [lein-swank ...] exist now?

19:32 have you removed the .lein/plugins dir

19:32 ?

19:32 nmishra: QUIT

19:33 raek: nmishra: also, you don't need to install via git. you can download the preview lein scripts

19:33 nmishra: thanks . I will do that

19:33 raek: nmishra: and I think you are looking for /quit :-)

19:33 fmw: raek: yes, I've removed the plugins directory

19:34 raek: fmw: and you upgraded clojure-mode?

19:34 lewang: hello

19:34 fmw: raek: yes

19:35 lewang: is this a good place to ask a newb question or should i go to stackoverflow?

19:35 raek: so M-: (clojure-mode-version) yields 1.11.5 now?

19:35 nmishra: fat fingered

19:35 raek: lewang: here is fine

19:35 nmishra: thanks

19:35 fmw: raek: hmm, there still is ~/.m2/repository/swank-clojure/swank-clojure/1.4.0/ somehow!

19:36 raek: yeah, that's just the maven cache. it shouldn't case any problems

19:36 lewang: cool. What's the idiomatic way to define true-times where "(true-times 4)" yields true 4 times and nil thereafter?

19:37 fmw: raek: ~/.m2/repository/lein-swank/lein-swank/1.4.4/ is the only version of lein swank it has

19:37 raek: lewang: a sequence like (true true true true) or (true true true true nil nil nil ...)?

19:37 fmw: I removed the maven cache earlier, so it shouldn't be tehre

19:37 raek: fmw: ah, so something is pulling it back?

19:37 fmw: try running "lein deps :tree"

19:37 lewang: raek: sorry, no. "(true-times 4)" should return a function.

19:37 fmw: raek: possibly, but let me confirm

19:38 raek: its not in deps :tree, but I'll check it again

19:38 raek: lewang: so it should maintain state?

19:38 lewang: yes, i guess taht's my question. keep in mind i don't understand monads fully yet please. :)

19:39 raek: lewang: in this case it's very simple to write a non-pure (but fully thread-safe) function

19:40 lewang: (defn true-times [n] (let [state (atom 0)] (> (swap! state inc) n)))

19:40 muhoo: i'm writing a macro which is doing a naughty thing: it needs to call functions which are defined in the calling namespace, not in the macro's namespace. how can i call a function in a macro without it being fully qualified?

19:41 raek: lewang: sorry, got the condition backwards... should be (<= (swap! state inc) n)

19:41 muhoo: in other words, (defmacro fubar [] (somefunc-in-calling-ns)) .

19:41 raek: it will return 'true' the first n times and 'false' from then on

19:42 muhoo: it macroexpands out to ns.of.macro/somefunc-in-calling-ns, which doesn't of course exist

19:42 raek: muhoo: yes that is naughty. you have to make sure the name of the function is outside any syntax-quote

19:42 so instead of `(... (f ...) ...) you need to do `(... (~'f ...) ...)

19:43 but there is probably a more elegant solution to your problem...

19:44 fmw: I'm out of advice and I need to go, but try asking in #leiningen, the leiningen mailing list, and/or create an issue at swank-clojure on github

19:44 muhoo: raek: ah ~' that'll do. yes, it's ugly, but if it works, it works.

19:44 fmw: raek: thanks a lot for the effort, though. I really appreciate it and you helped me upgrade to lein2 too!

19:44 raek: np

19:45 lewang: raek: thanks.

19:45 muhoo: raek: fyi, https://www.refheap.com/paste/2812 , so far so #'good, for some value of #'good

19:45 raek: lewang: sorry, the previous code is all wrong. I'm, getting tired. (defn true-times [n] (let [state (atom 0)] (fn [] (> (swap! state inc) n))))

19:46 (defn true-times [n] (let [state (atom 0)] (fn [] (<= (swap! state inc) n))))

19:46 timvisher: hey all

19:46 raek: last correction now?

19:46 lewang: raek: I was just rephrasing the q in case I asked it badly. ;)

19:47 timvisher: how would one go about printing all the docstrings for a namespace? Something like `(find-doc "<namespace-prefix>/.*")` that worked

19:47 gfredericks: timvisher: just the publics okay?

19:48 lewang: raek: thanks. that worked. Would a monad also solve this?

19:48 raek: muhoo: note that eval'ed code cannot use local variables

19:48 gfredericks: ,(->> clojure.walk quote ns-publics vals (map meta) (map doc) (map count))

19:48 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.repl/doc, compiling:(NO_SOURCE_PATH:0)>

19:49 raek: ...from the context where the eval call is at

19:49 gfredericks: ,(->> clojure.walk quote ns-publics vals (map meta) (map :doc) (map count))

19:49 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.Exception: No namespace: clojure.walk found>

19:49 gfredericks: ,(->> clojure.string quote ns-publics vals (map meta) (map :doc) (map count))

19:49 clojurebot: (44 34 138 107 34 ...)

19:49 gfredericks: timvisher: there we go ^

19:50 timvisher: gfredericks: ah-hah

19:50 nice. :)

19:51 raek: muhoo: you should probably eval the url in the macro like this: `(do (defpage [:post ~(str (:view-url fsettings) "add")] ...) ...)

19:51 eval in a macro sounds very suspicious

19:51 muhoo: raek: i tried that, and i'd prefer it. it didn't work, for some reason

19:52 raek: ah, fsettings is not evaluated...

19:52 muhoo: this whole thing is a huge experiment anyway

19:53 raek: (def fsettings { ... }) (defmacro def-form-pages [] `(... ~(str (:view-url fsettings) "add") ... )) on the other hand...

19:54 lewang: monads are not very common in clojure

19:54 they are not included in the core language

19:55 since clojure does not enforce function purity, you can always resort to side-effects when you need to

19:56 my experience with the combination of clojure and monads is basically non-existing, so I can't really answer the question

19:56 timvisher: what does the `#'` reader macro do?

19:56 gfredericks: ,(read-string "#'foo")

19:56 clojurebot: (var foo)

19:57 raek: timvisher: it expands to (var foo), where var is a special form. (var foo) evaluates to the var object itself instead of its value

19:57 this can be done since global variables are reified as objects in clojure

19:58 timvisher: hmm... so if i were trying to turn an instance of that (as in (->> ns-publics vals)) into the symbol itself, how might I do that?

19:58 read?

19:59 raek: it's often used to embed a callback function in a data structure when you want to be able to redefine the var and make sure all callbacks are updated too

20:00 timvisher: use the name in (keys ...ns-publics...)

20:01 gfredericks: timvisher: yeah if you want the symbol get it from the ns-publics map; that'll mean you can't use ->> so slickly anymore :)

20:01 raek: I think there is an undocumented java method too

20:02 gfredericks: something more like (for [[sym var] (ns-publics 'clojure.string)] [sym (-> var meta :doc)])

20:03 raek: timvisher: ah, the name is also in the metadata of the var

20:03 muhoo: raek: ah, that worked, thanks

20:04 McMartin: Is there a way to set up leiningen to build multiple applications out of the same source tree?

20:05 emezeske: McMartin: There's a plugin that might help: https://github.com/kumarshantanu/lein-sub

20:06 McMartin: emezeske: This looks like just what I was looking for, thanks

20:08 * McMartin has discovered Terrible Implications from old GW-BASIC programs as a result of this, which is funnier than it really should be.

20:14 muhoo: McMartin: you could always write an 8088 emulator in clojure to run the gw-basic program directly :-)

20:17 McMartin: This way it's easier to write psychopathic AIs and plug them into the world model.

20:18 muhoo: heh, or clojurescript http://www.bluishcoder.co.nz/js8080/

20:18 McMartin: Heh

20:18 Actually, turning this particular little game into a webapp via ClojureScript was my main goal

20:18 Then I got distracted by the opportunity for rampant AIs.

20:18 It's a city-sim sort of game, but it turns out that until you hit various instant-lose conditions, it's actually more economical to let your population starve and use some of the savings to entice new immigration


20:19 N

20:19 muhoo: i think the donner party used that strategy

20:20 McMartin: They just took the population hit

20:20 I haven't worked out whether it's actually a good idea to deliberately crash your population to the edge of losing the game early on or not.

20:23 muhoo: just put in a feedback loop where the news of starving population causes immigrants to avoid the place like the plague? anyway, sounds like a fun project.

20:24 my god, this macro is not only turning into a disaster, it *must* turn into a disaster in order to work. time to start over with a different approach.

20:24 McMartin: Heh

20:25 Well, there's also the minor issue that citizens are actually a drain on the economy and if it weren't for tourism money the place wouldn't be colonizable at all - the sustainable population is about a quarter of what the instant-loss condition population is.

20:25 So it's a game about delaying the inevitable

20:26 muhoo: life is a game of delaying the invevitable.

20:26 McMartin: This also had that 20-odd element let clause where it static-single-assignments up three pages of BASIC

20:26 https://gist.github.com/2760021

20:26 muhoo: the job of humans is to fight entropy

20:26 McMartin: Yeah, but these particular humans are really bad at it

20:28 timvisher: raek, gfredericks: boo, i was trying to use `(map doc...` over them but map doesn't work with macros. any way to apply doc to each of the symbols in turn?

20:29 gfredericks: (->> clojure.string quote ns-publics vals (map meta) (map (juxt :name :doc)))

20:29 timvisher: ^ that not do it for you?

20:30 timvisher: well, it gets the docstrings but really what I want is the exact behavior of doc

20:30 i should've been more specific in my first specification

20:30 ;)

20:30 like i said, find-doc does what i want except that i can't filter for everything in a namespace

20:31 one of the main reasons i jump out to the source code site or to clojuredocs or something is just to browse the api

20:31 this sort of behavior would keep me at the repl more often, which would be nice

20:31 gfredericks: well doc is side-effects

20:31 so what you want is doseq I think

20:31 which will work fine with the macroness of doc

20:35 timvisher: gfredericks: `(doseq [x (->> clj-time.core quote ns-publics keys (map (partial str "time/")) (map symbol))] (prn x))` works fine but when I s/prn/doc it says it can't find the var, i'm guessing because the macro prevents expansion?

20:39 gfredericks: oh poop right

20:39 sorry I was wrong because I'm stupid

20:40 yeah probably writing a macro is the easiest way to do that

20:41 timvisher: gfredericks: `(doseq [x (->> clj-time.core quote ns-publics vals)] (print-doc x))`

20:41 good 'ol `macroexpand-1` to the rescue! ;)

20:42 i do find the docs utilities to be lacking a bit in ease of use, although i suppose they are fairly simple ;)

21:02 would someone mind mentioning me real quick? i'm trying to test out an erc feature

21:02 wkmanire: timvisher: Mention you?

21:02 timvisher: What do you mean by that timvisher?

21:02 timvisher: lol

21:02 exactly what you did

21:02 and it works!

21:02 :)

21:02 wkmanire: timvisher: Is this what you meant timvisher? timvisher?

21:02 timvisher: What feature are you testing?

21:02 timvisher: now emacs beeps! i can't believe i never noticed the erc match customizations

21:03 wkmanire: timvisher: How do I does that too?

21:03 I want beeps

21:03 found it

21:04 timvisher: `M-x customize-group RET erc match RET` enable erc-beep-on-match in the erc text matched hook

21:04 wkmanire: whew, you're fast ;)

21:05 wkmanire: timvisher: What sound file formats are supported?

21:05 wav?

21:05 timvisher: oh i have no idea, i'm assuming when it says beep it means to run the emacs beep function

21:05 which you can customize elsewhere

21:05 dnolen: non-higher order keyword invoke got >10X faster in CLJS master

21:05 wkmanire: I'm looking here, you can choose all kinds of sound optons.

21:05 Erc Sound

21:06 timvisher: can't remember how

21:06 dnolen: good work

21:07 wkmanire: that looks fancy

21:08 wkmanire: timvisher: The sound stuff?

21:09 timvisher: yep

21:09 erc track looks interesting too

21:10 wkmanire: what's that do?

21:10 timvisher: looks like maybe a supercharged watch of sorts?

21:10 not sure

21:11 erc's functionality is mind-blowing

21:11 replsos: LLVM-clojure

21:11 emezeske: dnolen: Awesome! I just wrote some code that does a lot of that and wants to be faster

21:19 pandeiro: is there any cljs testing lib out there yet?

21:22 dnolen: emezeske: yeah common case should be a lot faster. still pondering higher order case.

21:29 wkmanire: Kick ass!

21:29 My son just put his shorts on!

21:29 emezeske: dnolen: I'm not sure what a higher-order keyword invocation looks like

21:29 hyPiRion: How is the new ns-bindings for require again?

21:29 emezeske: pandeiro: You can get pretty far with phantomjs and assert, in my experience

21:29 hyPiRion: The one which replaces use.

21:29 emezeske: pandeiro: Or just V8 if it's not a web app

21:30 dnolen: emezeske: (map :foo seq-of-maps)

21:31 emezeske: dnolen: Ahhh, I see, so only direct (:foo ...) invocations are optimized?

21:31 pandeiro: emezeske: i will look into phantom, i saw it mentioned in the cljsbuild repo examples... i would love to be able to write the tests in clojure though

21:31 emezeske: pandeiro: PhantomJS is just an environment in which to run the tests

21:32 pandeiro: You still write them in clojurescript

21:32 pandeiro: ah i see, cool

21:32 dnolen: emezeske: yes

21:32 emezeske: dnolen: Does (:foo ...) get turned into a static-fn ?

21:32 dnolen: emezeske: higher-order case needs more thought

21:32 emezeske: no, wrapped in a new Keyword type.

21:32 emezeske: dnolen: Ah, cool

21:33 pandeiro: PhantomJS is just a headless browser, so you can do tests on clojurescript stuff that needs e.g. a DOM to work correctly

21:34 pandeiro: The cljsbuild advanced example does have a few lines of JS to tell PhantomJS to load the clojurescript JS. I've pondered writing that glue code in cljs itself, but there's not much to gain by doing that

21:34 pandeiro: So I guess you could say the hand-written JS just bootstraps the cljs test code

21:36 pandeiro: emezeske: i guess i'm actually more perplexed by how to test a bunch of async functions, regardless of language

21:37 emezeske: pandeiro: Yeah, that can get really tricky

21:38 pandeiro: I've found mocking useful when things get super async. I don't know if there's a good solution for mocking cljs calls, though (midje is clj only)

21:39 replsos: It's more on the "secret weapon" side of Paul Graham's programming language taxonomy

21:56 gfredericks: emezeske: it took me several seconds not to read the end of your last msg as a sexp

21:57 &'(midge is clj only)

21:57 lazybot: ⇒ (midge is clj only)

21:57 McMartin: Hrm. I'm poking around at ClojureScript, but I'm not really seeing any tutorials for interacting with DOMs, JS generally, etc.

21:58 Is that out there or is one expected to more or less go off and learn by example?

22:00 gfredericks: tutorials might be rather light yet; I've used domina and liked it

22:12 ambrosebs: is it a good idea to assume that (= (class (conj anything a)) (class (conj anything a b c d e f g h)))

22:13 yoklov: McMartin: its basically the same as in javascript

22:13 scottj: ,(= (class (conj [] 1)) (class (conj #{} 1)))

22:13 clojurebot: false

22:13 yoklov: scottj: different as

22:13 err

22:13 anythings

22:13 ambrosebs: :) Actually, don't ArrayMaps convert to hashmaps?

22:13 scottj: yoklov: ahh, misunderstood question

22:14 ambrosebs: So it doesn't look like a good assumption

22:14 gfredericks: ,(class {})

22:14 clojurebot: clojure.lang.PersistentArrayMap

22:15 gfredericks: ,(class (apply conj {} (map vector (range 200) (range 200))))

22:15 clojurebot: clojure.lang.PersistentHashMap

22:15 ambrosebs: That's fine. I'm finding a type signature for conj

22:15 I just need to note an ArrayMap can conj to either ArrayMap or HashMap

22:17 for those interested, I'm parameterising IPersistentCollection to hold info about cons, first, rest and empty

22:18 (IPersistentCollection obj-to-cons cons-result empty first rest)

22:18 emezeske: gfredericks: heh ^_^

22:19 ambrosebs: so IPersistentCollection$EmptyList is (All [a] (IPersistentCollection a (Cons a IPersistentCollection$EmptyList) Nothing IPersistentCollection$EmptyList))

22:19 :)

22:19 so I'm going thru each class and typing them as so

22:21 emezeske: McMartin: If you've used js before, you might like jayq

22:35 alex_baranosky: does anyone know what is the preferred way to shell out in Clojure these days?

22:36 TimMc: alex_baranosky: The question is, do you need access to the in/out streams?

22:37 alex_baranosky: I think no for this case… but I'm interested to know the differences

22:38 aha, clojure.java.shell - http://richhickey.github.com/clojure/clojure.java.shell-api.html

22:38 lazybot: Nooooo, that's so out of date! Please see instead http://clojure.github.com/clojure/clojure.java.shell-api.html and try to stop linking to rich's repo.

22:38 alex_baranosky: thanks lazy bot :)

22:39 xeqi: alex_baranosky: https://github.com/Raynes/conch ?

22:52 amalloy: someday i'll add a feature to lazybot that can cause rich's github page to issue an http 301

23:04 muhoo: hmm, nested defns are allowed, it seems. are they considered.... evil?

23:04 i.e. (defn fubart [y] (defn baz [x] (str y " baz " x)))

23:06 gfredericks: in clojure there's not much of a distinction between top level and inside-of-something

23:06 if it's not evil it's at least awful

23:06 ooh try putting a (ns) inside a (defn)

23:07 emezeske: muhoo: I don't know if that's considered "evil", but it is almost certainly never what someone wants to do

23:07 muhoo: E.g. newcomers expect that to create a nested-in-scope function

23:07 muhoo: When in reality fubart is going to redefine baz at the top level every time it's called

23:08 muhoo: it looks like that's the case. damn

23:09 i've exhausted most of the options here, not sure what to do next

23:09 emezeske: muhoo: What's your goal?

23:09 jasonjckn: muhoo: letfn for nested-scope function

23:09 or let with lambdas

23:09 muhoo: i'm trying to write something that will create a bunch of boilerplate pages for CRUD in noir

23:09 defpage is a macro

23:10 it generates a function, then adds that function to the noir state atoms

23:11 emezeske: muhoo: My experience has been that once I go beyond the basic "define a single page" step, that I find it easier to use compojure directly than to use Noir

23:11 muhoo: i thought about that.

23:12 emezeske: I actually wrote a macro I called defcrud that builds a full RESTful API for me using compojure

23:12 muhoo: there's a noir.core/custom-handler* function, but it uses this same defpage parse-args business

23:12 emezeske: really? is it somewhere i could look at it?

23:12 emezeske: I wish... I keep wanting to open source it, but haven't had time

23:12 muhoo: that's very much along the lines of what i'm trying to do, except i need to do it with forms

23:12 emezeske: are you using noir?

23:13 emezeske: muhoo: I used to, but eventually I just dropped it because I was building my own abstractions

23:13 muhoo: Which it kind of sounds like you are doing as well

23:14 muhoo: i might do some hack like writing the whole business as a compojure app, then just wrapping the noir app in it

23:14 the whole thing has turned out to be a harder problem than i thought it'd be.

23:15 emezeske: The nice thing about compojure is that routes are just functions, so your defcrud thing could just return a compojure handler

23:15 No macros necessary

23:15 I dunno, there might be some sweet way to do it with Noir as well

23:15 muhoo: right, then i could add only one handler instead of 5

23:15 i think there is, thanks, that gives me some hope

23:17 ah, noir.core/compojure-route !

23:17 emezeske: That's a promising name!

23:17 muhoo: it's 3 lines, and seems to do exactly what i want.

23:18 will try. that would be sweet.

23:18 emezeske: Good luck sir

23:20 Raynes: muhoo: What is this defpage hack crap?

23:20 ambrosebs: Another question on collection invariants: does (= (-> any-coll empty class) (-> any-coll empty rest class))

23:20 I think this probably holds

23:21 gfredericks: ,(-> [3] empty class)

23:21 clojurebot: clojure.lang.PersistentVector

23:21 gfredericks: ,(-> [3] empty rest class)

23:21 clojurebot: clojure.lang.PersistentList$EmptyList

23:21 ambrosebs: :)

23:22 ok, maybe not, cheers

23:22 gfredericks: maps will do something similar I think

23:23 ,(for [x [3] {3 3} #{3} '(3)] (= (-> x empty class) (-> x empty rest class)))

23:23 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: for requires an even number of forms in binding vector in sandbox:>

23:23 gfredericks: ,(for [x [[3] {3 3} #{3} '(3)]] (= (-> x empty class) (-> x empty rest class)))

23:23 clojurebot: (false false false true)

23:24 ambrosebs: So I need to be more specific with my types. I assumed I could infer the "empty rest case" from the type of "empty" for that type

23:24 but it's not consistent

23:25 gfredericks: rest mucks with things

23:26 ,(rest "foo")

23:26 clojurebot: (\o \o)

23:26 gfredericks: ,(empty "foo")

23:26 clojurebot: nil

23:27 gfredericks: ,(empty 12)

23:27 clojurebot: nil

23:27 banseljaj: Hmm. Guys, do clojurians need DB servers?

23:29 gfredericks: It is a truth universally acknowledged that a single man in possession of a good clojure must be in want of a DB server.

23:29 ambrosebs: gfredericks: wat ... (empty 12)

23:30 sometimes nil punning goes too far :P

23:30 gfredericks: nil punning?

23:31 ambrosebs: slightly wrong context, but http://clojure.org/lazy#Making%20Clojure%20Lazier--The%20victim%20-%20nil%20punning

23:33 banseljaj: And which is the preferred DB server for Clojurians/

23:33 xeqi: banseljaj: like using clojure.java.jdbc, korma, clutch, or something similar?

23:33 banseljaj: xeqi: Ahh. Okay. :)

23:34 I am asking in context of the discussion here a few hours ago about a Linux for Clojure dev. A Plug-in replacement clojure development environment

23:34 One that can be fired from a VM, for instance.

23:35 technomancy: what does replacement mean in this context?

23:35 banseljaj: technomancy: I recognize you. :D

23:35 technomancy: hello

23:35 banseljaj: Hi.

23:35 And sorry, Replacement was the wrong word.

23:37 In its bare default, my distro has leiningen, a JDK and aall the editors configured for lisp/clojure. (emacs, eclipse, vim etc)

23:38 And the associated paraphernalia. an offline browsable doc, some simple text editors, a gui, an IRC client.

23:38 people here were interested in it. in fact, they told me to make it. :)

23:39 technomancy: you could spend all day adding databases and someone would still feel left out

23:39 amalloy: i don't think (empty 12) returning nil has anything to do with nil punning. if (rest 12) returned nil, then maybe, but...

23:40 technomancy: that said, postgres is probably the place to start

23:40 Raynes: And if you add mongodb, everyone will be afraid to touch it.

23:41 ambrosebs: amalloy: true, just the first phrase that came to mind

23:41 Raynes: amalloy is a walking correction service.

23:41 gfredericks: so the word "pun" here refers to the double meaning of nil as empty and falsy?

23:41 amalloy: Raynes: i'm sitting down. duh

23:42 Raynes: You could be standing outside and still see that damned tv of yours.

23:42 amalloy: but i agree, there are a few cases where it seems clojure goes too far in silently accepting "crazy" argument types

23:43 banseljaj: technomancy: The most used and the second most use should suffie on the basic instal

23:43 ambrosebs: gfredericks: that's my interpretation. Nil punning is usually about return values, not argument values tho

23:43 banseljaj: s/instal/install

23:43 amalloy: ,((juxt keyword :foo empty) 10)

23:43 clojurebot: [nil nil nil]

23:43 ambrosebs: gfredericks: I was a bit lazy, but hey, you learnt something ;)

23:44 gfredericks: heck yes I did. It's really weird to read stuff from old-clojure days

23:44 amalloy: gfredericks: like halloway being astonished that sets are functions

23:45 technomancy: banseljaj: for people getting started with Clojure, Couch or Redis would be my second pick.

23:45 ambrosebs: amalloy: and not just boolean ones in Clojure yay!

23:45 Raynes: I was pretty astonished myself.

23:45 technomancy: since they'll be unlikely to be working with huge datasets

23:45 banseljaj: technomancy: thanks.

23:46 amalloy: ambrosebs: i'd rather they returned booleans

23:46 muhoo: Raynes: my CRUD-generating stuff

23:46 gfredericks: amalloy: ambrosebs I was about to say the same thing

23:46 technomancy: amalloy: but... c.c/some

23:46 muhoo: Raynes: i'm going to go with compojure-routes instead

23:46 Raynes: amalloy: Why?

23:46 amalloy: i don't really like some either :P. i'd like it to be more like find-first

23:46 muhoo: but i learned a lot about macros, what they are, and what the aren't, so no big loss

23:47 banseljaj: Hmm. I think gnome is too much for a window manager, lxde might be better

23:47 ambrosebs: amalloy: what's find-first?

23:47 amalloy: ambrosebs: (fn [pred coll] (first (filter pred coll)))

23:47 Raynes: &(first (filter true? [1 2 3 true 4]))

23:47 lazybot: ⇒ true

23:47 technomancy: if it's meant to be used as a VM, just have people SSH in. you'll save tons of disk space =)

23:48 amalloy: Raynes: because you can't *actually* use sets as existence checkers, in case one of the elements is false or nil

23:48 i never want to do something like: "oh, let's *map* this set over a collection" - just use it in filter or whatever, i only care about truthiness of the result, and so as things are now i have to use contains? instead to be correct

23:49 banseljaj: technomancy: :D Well, it is also meant to be used as a stand-alone distro. locally installed. :)

23:49 technomancy: banseljaj: too bad distros aren't composable

23:49 ambrosebs: amalloy: how can u distinguish between a found nil and a not-found in find-first?

23:49 banseljaj: technomancy: that's a clojure joke?

23:50 Raynes: Whoa. The 'u' bomb.

23:50 banseljaj: I'm still a noob in clojure. :)

23:50 amalloy: ambrosebs: the same issue exists for c.c/some

23:50 just shaped slightly differently

23:50 ambrosebs: amalloy: exactly, what's the advantage?

23:50 amalloy: ,(some even? (range))

23:50 clojurebot: true

23:50 amalloy: not very dang helpful. i wanted the first even number

23:51 ambrosebs: amalloy: ah

23:51 Raynes: amalloy: You should write your own language dude.

23:51 amalloy: what would i do with a "language dude"?

23:51 banseljaj: ,(true)

23:51 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn>

23:51 banseljaj: ,(true? true)

23:51 clojurebot: true

23:51 ambrosebs: I'm usually halfway to writing (some #(and (pred %) %) ...)

23:51 amalloy: exactly

23:51 Raynes: You could write a grammar checker.

23:52 banseljaj: amalloy: Ask him to do your work and chill. :D

23:52 technomancy: banseljaj: not specific to clojure, but commonly-used terminology around here

23:52 banseljaj: *nod*

23:52 amalloy: but, ambrosebs, that doesn't work if you want your predicate to return truthy for an input of nil/false

23:52 banseljaj: technomancy: I'm forking your code as soon as I am competent enough. :) I WILL REPLACE YOU! :D

23:53 ambrosebs: amalloy: :) and that's the point I stop using some

23:53 amalloy: right! if it were instead find-first, you could just use it :P

23:54 ambrosebs: find-first + not-found parameter would solve all worries, right?

23:54 amalloy: *nod*

23:54 banseljaj: technomancy: I'm prone to such jokes. Don't mind me. :)

23:55 amalloy: anyway, i have similar experiences with sets. i can *almost* use them the way i want

23:55 technomancy: emezeske: do you know how much of the browser-repl stuff is specific to the fact that browsers can't have server sockets?

Logging service provided by n01se.net