#clojure log - Oct 20 2011

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

0:01 aperiodic: same error

0:02 the docs for the dot special form state that if the first expr is not a symbol that resolves to a class name then it's presumed to be an instance member, so it tries to call an instance method

0:03 and the result of (OptionBuilder/withLongOpt "foo") seems to be some kind of instance

0:03 which doesn't quite make sense to me

0:04 amalloy: aperiodic: instead of me making wild guesses based on an imaginary OptionBuilder class, why don't you link me to the real javadocs?

0:05 aperiodic: amalloy: http://commons.apache.org/cli/api-release/org/apache/commons/cli/OptionBuilder.html

0:06 amalloy: haha wow ew

0:06 this is horrible

0:06 aperiodic: yeah

0:06 amalloy: no wonder nothing works

0:06 aperiodic: why are they all static?

0:07 part of what's confusing to me is i don't understand what's happening on the java side

0:08 amalloy: on the java side, foo.bar() calls foo's bar instance method - unless one doesn't exist, in which case it calls a static method named bar on the class

0:08 aperiodic: ah

0:08 amalloy: clojure doesn't put up with that shit

0:08 aperiodic: haha

0:08 so that's how the chaining somehow works

0:08 amalloy: you can't thread here because there's no focus object to thread on

0:09 you could macro it away, to expand into (do (Optionbuilder/foo bar) (...))

0:09 but this library is hideous, much though i love a lot of apache commons

0:09 eg, it can't work for multiple threads

0:09 if you can use something else, like tools.cli, try to do so

0:10 aperiodic: unfortunately, i don't think i can

0:11 hadoop requires use of the hadoop generic options parser, which uses the commons cli lib

0:12 amalloy: that's not actually true - you can parse your own options if you want. but i never looked into how

0:12 aperiodic: if you don't mind explaining, why would (do (OptionBuilder/foo bar) ...) work?

0:13 amalloy: all of these static calls are mutating the global state in the OptionBuilder class

0:13 aperiodic: uggghhh

0:13 amalloy: and then you finally call create() to get something out

0:13 aperiodic: ok

0:14 thanks for the help!

0:14 amalloy: this is the worst misunderstanding of the builder pattern ever

0:15 aperiodic: i can't believe that mutating a class object is even allowed... yuck

0:15 brehaut: it seems like the Option class provides basically all the same stuff, just without some trivial string parsers

0:16 aperiodic: brehaut: i didn't see a way to add an option with an arg w/out the optionbuilder crap

0:16 i'd like to be wrong

0:16 brehaut: (Option. …) ?

0:16 amalloy: aperiodic: i think brehaut is right

0:16 brehaut: then doto that a bunch of crap

0:17 amalloy: (doto (Option.) (.setFoo bar)...)

0:17 aperiodic: ah

0:17 Option not Options

0:17 * aperiodic is dumb

0:17 aperiodic: well, that's good

0:18 brehaut: this optionbuilder class seems extremely misguided

0:18 amalloy: brehaut: if the methods were non-static it would make total sense

0:18 patchwork: hey #clojure, I have an app that I want to start many instances (ports) of that each have different db bindings. my db utilities are in their own namespace and should work with any given db binding.

0:18 amalloy: but as is, it's a total mess

0:18 patchwork: do I have to pass the db binding I want to every function that uses a db call, even though these are always the same in a given instance? what is the best way to structure that communication?

0:19 I want something like (start port db)

0:19 brehaut: without details of your specific db library thats not really possible to answer

0:20 patchwork: aha, I am using the clojure sql bindings for postgresql

0:20 I have some utilities that call the core functions from that library

0:20 all calls are of the form:

0:20 (sql/with-connection db


0:21 where db is a map of connection configuration values

0:21 that is the map I want to specify for each port

0:21 and not have to call sql/with-connection every time

0:22 hiredman: with-connection just needs to be in the outtermost call

0:22 brehaut: with-connection sets up a binding i believe, so everything that is evaluated within that (dynamic!) scope wont need an additional with-connection

0:22 hiredman: (uppermost?)

0:23 patchwork: Ah! so then I compose my db calls however I want, and call them all at once inside a sql/with-connection with the right db map

0:23 awesome

0:23 thanks guys, I knew I was missing the approach here

0:25 duck1123: how long is it safe to hold that connection open for? Assuming you will always need it, can you run it for the entire length of the app?

0:25 patchwork: that is a good question

0:27 duck1123: I'm assuming reconnecting isn't a concern with jdbc

0:54 amalloy: duck1123: whether it's true or not that seems like a crazy thing to assume without evidence

0:55 duck1123: well, I do keep a connection open for quite a while, but I'm not really stressing it yet

0:56 I know in Ruby, I occasionally have to deal with MySQL dropping

1:04 spoon16: is there a filter indexed op?

1:05 brehaut: spoon16: theres keep-indexed which is in the ballpark

1:06 (doc keep-indexed)

1:06 clojurebot: "([f coll]); Returns a lazy sequence of the non-nil results of (f index item). Note, this means false return values will be included. f must be free of side-effects."

1:08 spoon16: thanks

1:08 ,(keep-indexed #(if (even? %1) { :index %1 :value %2}) [\a \b \c \d \e \f \g \h])

1:08 clojurebot: ({:index 0, :value \a} {:index 2, :value \c} {:index 4, :value \e} {:index 6, :value \g})

1:09 brehaut: spoon16: if you are using a degenerate if without an else clause, when is idiomatic

1:10 spoon16: thanks for the feedback

1:10 makes sense

1:11 brehaut: ,(macroexpand '(when (even? 1) :foo))

1:11 clojurebot: (if (even? 1) (do :foo))

1:14 duck1123: how much overhead does 'do carry?

1:14 amalloy: duck1123: should be zero runtime overhead, i would imagine

1:15 duck1123: yeah, I can see that being compiled away

1:15 brehaut: do is a special form right?

1:15 amalloy: duck1123: not just compiled away - there's nothing *to* compile away

1:15 duck1123: I've just never heard this "use when if you're not using an else clause"

1:15 ok

1:16 I get it, I've just never heard that before

1:16 amalloy: duck1123: i like that rule because after a while you start to get terribly twitchy every time you see an if without an else - great bug detector

1:16 brehaut: ive never heard it before either, but based on code ive read, it seems like a common idiom

1:17 amalloy: yes definately

1:17 amalloy: i've heard people say they prefer the opposite: use if unless you need the implicit do. i can see it might help them in the same way, but it doesn't seem as useful to me

1:17 especially since needing a do is super-rare, but not needing an else is common

1:17 duck1123: perhaps I'll have to adopt that. I'm looking at one right now

1:17 amalloy: hah, a bug due to (if foo bar)?

1:18 brehaut: yeah i infrequently use the implicit do in a when

1:18 duck1123: I've used when only when I meant if do

1:19 * amalloy elects to start quoting symbols in regular speech, just to avoid ever writing "I've used when only when I meant if do"

1:22 tomoj: hmm.. (do (do (do ... 5000 times ... (do body)))) overflows the stack

1:22 is that just a limit of eval?

1:22 duck1123: so many songs go like that

1:23 amalloy: tomoj: a limit of the lisp reader, i believe

1:23 cemerick: that's more an an idiom, IMO

1:23 I wouldn't be disappointed if `if` were to throw an error if no else clause were provided.

1:24 amalloy: cemerick: requiring an explicit nil? i suppose i could get behind that

1:24 brehaut: id be fine with that

1:24 amalloy: it's too late, though, i suspect

1:24 cemerick: Yeah, that's Clojure 2.0 material

1:24 brehaut: it can be 1.4s breaking change to cause ennui on hacker news

1:25 amalloy: brehaut: ennui, really?

1:25 cemerick: ennui is the steady state on HN, I thought

1:25 * amalloy wonders if he's wrong about what that word means

1:25 amalloy: $dict ennui

1:25 lazybot: amalloy: noun: Listlessness and dissatisfaction resulting from lack of interest; boredom: "The servants relieved their ennui with gambling and gossip about their masters” ( John Barth).

1:26 cemerick: very apt

1:26 brehaut: cemerick: it definately is

1:27 amalloy: i guess i don't hang around on HN enough

1:27 brehaut: amalloy: conversely you hang aroudn on hn the right amount

1:28 cemerick: 15 minutes while eating breakfast or lunch is just about perfect

1:28 brehaut: it seems that these days its 30% whinging 30% calling people you disagree with fanboys

1:55 spoon16: how do I print the source of a function loaded in the repl?

1:58 scottj: spoon16: maybe (use 'clojure.repl) (source function)

2:05 spoon16: does destructuring work in ((fn [[x y] point] point) [1 2])

2:05 ,((fn [[x y] point] point) [1 2])

2:05 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval29$fn>

2:06 cemerick: ,((fn [[x y :as point]] point) [1 2])

2:06 clojurebot: [1 2]

2:07 spoon16: so the syntax is slightly different in defn and let, correct?

2:08 cemerick: nope, exactly the same — argument vectors just don't have the values being destructured pre-defined (by necessity)

2:08 (let [[x y :as point] [1 2]] point)

2:09 ,(let [[x y :as point] [1 2]] point)

2:09 clojurebot: [1 2]

2:09 spoon16: i see

2:09 cemerick: Destructuring is defined by let, and all destructuring forms (including defn) just reuse let internally.

2:09 s/destructuring forms/binding forms

2:09 lazybot: <cemerick> Destructuring is defined by let, and all binding forms (including defn) just reuse let internally.

2:10 cemerick: *local* binding forms, feh

2:10 duck1123: The upshot of that, if you use a let inside a macro, you can get destructuring for free

2:12 that might be true in any case, but it's still fun

2:31 spoon16: how do I adjust the JVM params that clojure or leiningen use?

2:31 amalloy: $google clojure lein jvm options

2:31 lazybot: [clojure - JVM options using Leiningen - Stack Overflow] http://stackoverflow.com/questions/3757223/jvm-options-using-leiningen

2:31 spoon16: it's annoying when you do that ;)

2:31 amalloy: jinx

2:44 hah. SO finally convinced me, out of morbid curiosity, to click on their "chat rooms" link. the mysql room is labeled "a room for MySQL Geniues"

3:15 spoon16: how can I lazily flatten a vector like [ [ 1 2 ] 3 ] so that the resulting sequence is ( 1 2 3)?

3:16 apply concat

3:16 is that better than reduce concat?

3:17 raek: yes

3:17 spoon16: why?

3:17 clojurebot: http://clojure.org/rationale

3:17 Chousuke: there is a flatten function in contrib somewhere

3:18 raek: reduce concat has to make a lot intermediary lazy seqs

3:18 archaic: pretty sure flattens in core

3:18 raek: flatten flattens more than one level

3:19 spoon16: that's ok with me

3:19 raek: (reduce concat [[1] [2] [3] [4]]) becomes (concat (concat (concat [1] [2]) [3]) [4])

3:20 but (apply concat [[1] [2] [3] [4]]) becomes (concat [1] [2] [3] [4])

3:20 the nesting actually comes with a cost

3:20 every level will require one stack frame when forced

3:20 so you can accidentally blow the stack with the formeer

3:20 *former

3:22 amalloy: Chousuke: it's in core, actually, though this saddens me. flatten is never the right answer

3:23 brehaut: raek, concat produces a lazy-seq and reduce is a loop recur; im not sure i understand how that would blow stack

3:23 amalloy: brehaut: it will

3:23 brehaut: im not saying it wont: im saying i dont understand why

3:23 amalloy: $google stackoverflow dbyrne prime sieve

3:23 lazybot: [recursion - Recursive function causing a stack overflow - Stack ...] http://stackoverflow.com/questions/2946764/recursive-function-causing-a-stack-overflow

3:24 spoon16: amalloy

3:24 why not flatten?

3:25 amalloy: brehaut: as i understand it you can run into the same problem in haskell too because of the automatic lazy thunks everything turns into

3:26 spoon16: what if your "base element" is a sequence of some kind? it will accidentally get sucked into flatten's vortex

3:26 raek: brehaut: it can blow the stack when the outermost concat is forced (and not when the (reduce concat ...) expression is evaled)

3:26 spoon16: ok, I figured that… in my case it's not

3:26 but makes sense to avoid it for that reason

3:27 amalloy: flatten isn't always wrong (i've used it a few times), but most of the time when it's used it's because someone hasn't properly planned out their list structure to begin with

3:27 raek: ,(first (reduce concat (repeat 10000 [1])))

3:27 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.StackOverflowError>

3:27 raek: ,(first (apply concat (repeat 10000 [1])))

3:27 clojurebot: 1

3:28 spoon16: what if you want to keep duplicates?

3:28 nvm

3:28 I see (first)

3:30 Blkt: good morning everyone

3:31 amalloy: raek: another good point is that the version with apply can handle an infinite seq

3:31 &(first (apply concat (repeat [1])))

3:31 lazybot: ⇒ 1

3:32 amalloy: &(first (reduce concat (repeat [1])))

3:32 clojurebot: ,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an square perfect")) )] (testar 10 25))

3:32 lazybot: Execution Timed Out!

3:36 amalloy: clojurebot: thanks for the assist

3:36 clojurebot: We live to serve.

3:36 aperiodic: is clojurebot sentient?

3:37 i mean, i knew lisp was well suited for AI, but...

3:38 amalloy: would we allow a sentient bot in here??

3:38 lazybot: amalloy: Definitely not.

3:38 amalloy: these guys never get old

3:39 aperiodic: clojurebot, open the pod bay doors

3:39 clojurebot: I'm sorry, Dave. I'm afraid I can't do that.

3:42 spoon16: is there a way to call a function defined as a nested function from the repl? (defn x [] (defn y [] "hello world"))

3:45 clgv: spoon16: yes, just call (y) after you called (x). the way you do it, the function 'y is defined in the namespace publicly and not just privately within the function 'x

3:45 spoon16: how do you define i privately?

3:45 with let?

3:45 amalloy: just don't do that. nested defns are evil

3:45 yes, let or letfn

3:45 clgv: either let or letfn

3:45 + amalloy, dont do it ^^

3:45 spoon16: do the doc thing :)

3:46 clgv: let and letfn are fine

3:47 spoon16: if you need a function in several places then just define it with defn in the namespace. if it is only used privately, use letfn

3:47 spoon16: yeah

3:47 clgv: thanks, reading the docs now

3:48 you ever use let and letfn in the same function?

3:49 amalloy: excitingly (to me, anyway) you can layer it whichever way you want: (letfn [(helper ...)] (defn main ...)), or (defn main [...] (letfn [(helper ...)]))

3:49 spoon16: that's cool

3:49 clgv: I didnt use letfn yet. I did define some private fns for lazy-seqs within a let

3:50 amalloy: the former creates a constant function once, reducing the amoung of "stuff" inside main and avoiding creating functions over and over (not that that's expensive). the latter lets you take advantage of the args to main inside of helper

3:59 Chousuke: I'm pretty sure the function isn't created "over and over" unless you create a closure.

3:59 amalloy: Chousuke: i think it has to alloc an instance of helper every time main is run

3:59 spoon16: richhickey follows nobody on github

4:00 amalloy: but i could definitely be wrong about this

4:00 going to check

4:00 Chousuke: amalloy: probably, but that sounds rather inconsequential :P

4:01 amalloy: Chousuke: like i said, not that it's expensive

4:01 and it's just as inexpensive if you *do* create a closure

4:06 patchwork: hmm... how do I drop the database with clojure jdbc? postgres doesn't let me drop a database from inside a transaction, so do-commands is out

4:09 is there a way to just execute a sql command directly?

4:14 amalloy: whew. i was running javap and getting crazy results - turns out i'm not crazy, i was running it on stale classfiles

4:23 spoon16: does clojure have a built in method for timing a operation execution (time (+ ))

4:23 or something like that?

4:24 amalloy: *cough* ##(doc time)

4:24 lazybot: ⇒ "Macro ([expr]); Evaluates expr and prints the time it took. Returns the value of expr."

4:24 clgv: hehe

4:26 spoon16: amalloy: I do search for something before I ask… you are often quicker to the right answer than google though… so I'm getting a little lazy

4:27 clgv: spoon16: dont google first. start here: http://clojure.github.com/clojure/branch-1.2.x/index.html or here: http://clojure.github.com/clojure/index.html

4:29 spoon16: or here http://clojuredocs.org/clojure_core since there might be examples attached

4:33 spoon16: I'll try to do better

4:39 clgv: you'll find things a lot faster there especially if you already guessed the name (almost) right ;)

4:41 amalloy: you can also try asking lazybot if you don't know what the name would be but you know how it should behave

4:41 $findfn 2 4 16

4:41 lazybot: []

4:41 amalloy: $findfn 4 2 16

4:41 lazybot: [clojure.core/bit-shift-left]

4:44 clgv: $findfn 2 4 16.0

4:44 lazybot: []

4:45 clgv: $findfn 4 2 16.0

4:45 lazybot: [clojure.core/bit-shift-left]

4:45 clgv: damn there is no powerfn in core^^

4:45 aperiodic: is the only difference between defmacro and defn that defmacro registers the underlying fn as a macro so it's recognized at macro-expansion time?

4:47 tordmor: clgv, why should there it has java.lang.Math

4:47 clgv: so that lazybot finds it ;)

4:47 tordmor: :)

4:54 raek: aperiodic: yes, but the underlying fn also takes two additional parameters

4:54 since 1.2

4:55 aperiodic: raek: what are those params?

4:55 clgv: aperiodic: one is env

4:56 amalloy: clgv: anyway, you don't need power when you have repeat

4:56 &(apply * (repeat 3 4))

4:56 lazybot: ⇒ 64

4:56 clgv: amalloy: thats probably not as fast ;)

4:57 &(time (apply * (repeat 3 4))

4:57 lazybot: ⇒ "Elapsed time: 0.877114 msecs" 64 ; Adjusted to (time (apply * (repeat 3 4)))

4:57 raek: aperiodic: env, which is a map from symbols to a compiler-interal representation of local variables (you are generally only interested in the keys of this map)

4:57 amalloy: raek, aperiodic: &env

4:57 raek: aperiodic: and form, which is the code of the enitire call (makes it possible to retrieve the metadata of the call form)

4:57 lobotomy: &(doc mod)

4:57 clgv: &(time (java.lang.Math/pow 4 3))

4:57 lazybot: ⇒ "Elapsed time: 1.221387 msecs" 64.0

4:57 ⇒ "([num div]); Modulus of num and div. Truncates toward negative infinity."

4:58 clgv: ok unfair ^^

4:58 &(time (apply * (repeat 3 4.0))

4:58 lazybot: ⇒ "Elapsed time: 0.590821 msecs" 64.0 ; Adjusted to (time (apply * (repeat 3 4.0)))

4:58 lobotomy: &(mod -1 4)

4:58 lazybot: ⇒ 3

4:58 amalloy: clgv: Math/pow would be faster for a large power, i suspect

4:58 raek: I think you add those params like this: (defmacro foo [a b c &env &form] ...)

4:58 clgv: amalloy: thats possible

4:58 amalloy: raek: noooo, don't add them, they're implicit

4:58 raek: ah

4:58 amalloy: (defmacro foo [a b] (keys &env))

4:59 clgv: yeah (debug-repl) uses them to provide the "context bindings"

4:59 amalloy: clgv: more importantly Math/pow works for non-natural exponents

4:59 aperiodic: raek: is manipulation of env how gensym is implemented?

5:00 amalloy: aperiodic: no, those two are unrelated

5:00 raek: no, gensym just uses a hidden counter

5:00 amalloy: (whether you're talking about (gensym) or foo# auto-gensys

5:02 aperiodic: i can see the motivation for &form, but what about &env?

5:04 it's just the local bindings at the macro call-site?

5:04 zilti: After a restart of my PC "lein help" finally lists swank as a task, and I can do "lein swank" on the command line which starts a swank server. But I still can't do "clojure-jack-in" in emacs.

5:05 andrewclegg: wait. findfn? does that do a brute-force search of all the functions in core or something?

5:05 raek: it allows you to implement a "break" macro that has access to local variables, I believe

5:05 * andrewclegg is boggling at his irc history

5:06 clgv: aperiodic: env allows access to local bindings, see debug-repl here: https://github.com/GeorgeJahad/debug-repl

5:07 aperiodic: raek: sorry, "break" macro?

5:08 zilti: Phew. I guess Slime is broken. Had to sigkill my emacs the second time now.

5:08 archaic: what os / emacs version you using?

5:08 raek: aperiodic: sorry, a macro that works like a breakpoint in a debugger

5:09 that allows you to inspect the actual values of the locals at that point

5:09 aperiodic: ah, got it

5:09 raek: (defmacro dump-locals [] (let [syms (keys &env)] `(prn ~(zipmap (map keyword syms) syms))))

5:09 fliebel: raek: Is that a want or a have? It's a want for me :)

5:09 fhd: Any idea when a Leiningen version that uses Clojure 1.3?

5:09 ... arrives?

5:10 raek: (let [a 1, b 2] (dump-locals) (+ a b))

5:10 fliebel: fhd: Cake already supports it... Don;t know about lein.

5:10 raek: this will print the map {:a 1, :b 2} when evaled

5:10 archaic: pretty sure cake and lein both do

5:10 fliebel: raek: Sweet!

5:11 raek: fliebel: have you used swank.core/break ?

5:11 Borkdude: raek: very cool

5:11 fliebel: raek: No, I use a plain editor with a repl in y terminal.

5:12 aperiodic: clgv: ooh, that's a handy tool. thanks!

5:12 clgv: aperiodic: yes. I love that thingy^^

5:13 fhd: Well, Leiningen does support using Clojure 1.3 for my apps, but I need Leiningen itself to actually run in 1.3. I'm trying to use the lein-clojurescript plugin, which requires 1.3.

5:14 fliebel: Do any of you know how to get "lisp in small pieces" for a reasonable price? It seems to cost nearly €100 everywhere I look.

5:15 I even tried to *gulp* torrent it, and failed miserably.

5:19 Apage43: fhd: i think lein's not going to update to 1.3 for a while as a -lot- of the existing plugins won't work on 1.3

5:20 fhd: Apage43: Bah, means I have to keep using my own ugly exec-based ClojureScript plugin...

5:21 clgv: fliebel: have you checked used books on amazon?

5:21 Apage43: fhd: there's https://github.com/ibdknox/cljs-watch

5:21 fliebel: clgv: Still 70-80

5:22 fhd: Apage43: Doesn't really help here, we need Leiningen for a simple CI setup in a Maven environment

5:22 talios: clojure-maven-plugin works fine with 1.3 :)

5:23 One benefit of me resisting writing it in clojure, and forking the JVM for compilation.

5:23 fhd: talios: But there's no ClojureScript support yet, right?

5:23 talios: I'm normally on Maven for Clojure projects, but I use Leiningen for this one because that was the only sane way to get a working WAR

5:23 talios: alas no. I've not had the time to even -play- with ClojureScript yet.

5:24 fair enough :) For clojure only projects I still promote lein, its certainly the easiest to use.

5:24 fhd: talios: Yeah, but it can get a bit ugly in a Maven environment, stuff like deploying to a Nexus that requires authentication.

5:24 Apage43: *shrug* cake might work

5:25 zilti: Is there some contrib stuff to do http requests to a server or do I have to do it the java way?

5:25 fhd: Apage43: Don't feel like switching build systems again :) Besides, AFAIK, cake doesn't really integrate with Maven, right?

5:25 sunny_101: Hey guys…I'm having trouble with string contains? function…(contains? 'you 'u) returns false

5:26 talios: fhd: promise to buy me a beer if we ever meet and I'll take a look at ClojureScript support tomorrow night/this weekend ;)

5:26 Apage43: fhd: it generates a pom. I don't know much maven, not sure what else that involves.

5:26 Borkdude: sunny_101: check the docs for contains?, it is something different, it checks if a key is present in a collection

5:26 sunny_101: I tried to switch it around using double quoted strings, but still nothing

5:26 clgv: sunny_101: thats right symbol 'you does not contain symbol 'u

5:26 Borkdude: ,(doc contains?)

5:26 clojurebot: "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."

5:26 aperiodic: fhd: lein can deploy to nexus repos that require auth just fine

5:27 Borkdude: sunny_101: and 'you 'u are not strings but symbols

5:27 clgv: try: ##(contains? "you" \u)

5:27 lazybot: ⇒ false

5:27 sunny_101: Borkdude: Then why does (contains? "you" "u") not work?

5:28 archaic: "u" isn't a key present in the given collection "you"

5:28 raek: sunny_101: contains? only works for maps and sets

5:28 Borkdude: sunny_101: because a string is not a collection and u not a key

5:28 clgv: lol right^^

5:28 raek: ,(contains? {:a 1} :a)

5:28 clojurebot: true

5:28 clgv: (some "you" \u)

5:28 &(some "you" \u)

5:28 lazybot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character

5:28 raek: sunny_101: it's better to think of it as "has-key?"

5:28 Borkdude: maybe contains should be renamed, this question comes by so often..

5:28 clgv: now: ##(some #{\u} "you")

5:28 lazybot: ⇒ \u

5:29 sunny_101: Ah, I see! I was thinking in ruby trying to do "you".contains?('u')

5:29 fhd: aperiodic: Yeah, but it's a bit ugly: https://github.com/technomancy/leiningen/issues/276

5:30 aperiodic: And there is generally a lot of confusion with mirrors. The Maven guru here got really annoyed :)

5:30 archaic: ,(contains? (set "you") \u)

5:30 clojurebot: true

5:30 fhd: aperiodic: For the record, I think that's more a problem of the Maven Ant tasks than of Leiningen, but I'm not entirely sure.

5:32 Borkdude: sunny_101: use the function substring? from clojure.contrib.string

5:32 sunny_101: awesome got it working, thanks guys!

5:33 aperiodic: fhd: fair enough. we only set up a maven repo for our clojure projects, so we're not doing anything at all complicated

5:37 Borkdude: how can you check which namespaces are 'used' right now?

5:37 on a repl

5:37 archaic: can someone tell me how a windows 7 file hierachy works.. im interesting if my code is actually portible or not,, i can't find one reference online to how even their base system is structured :S

5:38 i havent used windows in a realllly long time

5:42 guess not many people do here either ;]

5:43 Borkdude: archaic: I use(d) Windows, but I never had this problem, what are you trying to solve

6:09 I'm reading Clojure in Action and take a look at the stubbing macro, but there's going to be the dynamic binding problem...

6:10 You can't dynamically bind vars that are non-dynamic

6:10 I guess it must be hell to write a book on clojure and keep all your text and code up to date

6:12 ejackson: Yeah, in think CIA was written well prior to 1.34

6:12 1.3

6:13 Borkdude: ejackson: it is still not published, so there's a chance of updates maybe

6:14 ejackson: sisyphus

6:15 Borkdude: can I search within one repository on the github website? I seem to be missing it

6:16 ejackson: i would thing so...

6:17 yeah

6:17 in the front page of the project, search source code

6:20 Borkdude: ejackson: I seem to be blind... where on this page is it? https://github.com/marick/Midje

6:20 ejackson: weird... not where it is on mine...

6:22 none of my open source repos have it, but all my closed ones do.

6:22 brilliant

6:23 Borkdude: (I'm searching the 'provided' macro btw)

6:23 ejackson: Borkdude: I think you can use tags in the advanced search to do this

6:24 https://github.com/search

6:24 yup: https://github.com/search?type=Everything&language=&q=repo%3Amarick%2FMidje+provided&repo=&langOverride=&x=18&y=12&start_value=1

6:27 in emacs mode you could do M-. in the source and it would like you to it, BTW.

6:28 Borkdude: ejackson: I think I'll do that then

6:29 babilen: Borkdude: Hmm, what about just using "git grep" on your local checkout? Or plain grep, or ack-grep (look into this!), or ...

6:32 Borkdude: babilen: I haven't checked it out, I was just wondering how provided was implemented, to compare it with the stubbing macro from Clojure in Action

6:33 babilen: Borkdude: It sounds as if you are missing ^:dynamic

6:33 (for 1.3)

6:33 Borkdude: babilen: but checking it out is probably the easiest way

6:33 kij: If i want to do the same transformation on a list, a number of times? How would i do that ? I currently trying with 'dotimes but it returns nil.

6:33 Borkdude: babilen: yes, so the stubbing macro doesn't work on all of the clojure core funcs

6:33 babilen: Strange that GH offers in-repository search for closed projects, but not open ones .. Maybe they don't want to generate huge indices?

6:34 Borkdude: babilen: so I was wondering how they did it in midje

6:34 babilen: Borkdude: Sure! Happy hunting :)

6:36 Borkdude: checked it out... now I get this error: Unable to resolve symbol: print-doc in this context, compiling:(swank/commands/basic.clj:180)

6:38 ah, lein test works though

6:38 ejackson: Borkdude: I'm guessing here, but in 1.3 you need to use clojure.repl to get the doc functions, while in 1.2 you did not. This could be at issue here.

6:39 Borkdude: ejackson: what does this mean in project.clj: [org.clojure/clojure "[1.2.0],[1.2.1],[1.3.0]"

6:39 ejackson: choose any version? :)

6:39 ejackson: dunno, your guess is agood as mine

6:43 Borkdude: babilen: any help on how to find the definition of provided via a git grip?

6:44 babilen: grep that is

6:44 babilen: there are a lot of results..

6:47 (r

6:47 (sorry)

6:57 fliebel: Borkdude: re lein: it's standar maven version ranges. google it, because I don't know any more tan that

6:58 and I'm typing with one hand, because the other is feeding me.

6:58 * talios looks up at the mention of version ranges. The best thing in maven, the most misunderstood thing in maven, and often - the most frustrating thing - cause most people do it wrong.

7:01 talios: Borkdude: maven version ranges define - as you may infer, a range of versions suitable to satisfy a dependency as part of your build. They use a standard math notation, where [ ] indicate an inclusive boundary, whilst ( ) is exclusive. So [1.2.0] means "1.2.0 - and ONLY 1.2.0", But [1.0.0,1.2.0] means "anything from 1.0.0 up to 1.2.0". And combining the types - [1.0.0,1.2.0) means "anything from 1.0.0, up to - but not including 1.2.0

7:02 I suspect, in your example of [1.2.0],[1.2.1],[1.3.0] that means "exactly one of either of these three, but nothing else". A more - non-linear range.

7:02 Borkdude: talios: I see...

7:04 talios: Using ranges means you can automatically pick up new versions of libraries without having to rebuild/rerelease your own individual artifacts - it does however mean you move into less predictable, reproducable builds as the range can resolve to different things based on what maven repositories you have. ( different users MAY get different results - usually when not using maven central, or clojars ).

7:05 also means you can potentially open yourself up to getting random transitive dependencies in your project, if a newer artifact in a range pulls different things in

7:06 ejackson: from which I conclude, as usual, that Maven is much smarter than me.

7:07 talios: ejackson: more like - it "tries" to be - and sometimes fails, but tries to covers its tracks by not really telling you much :)

7:07 ejackson: yeah, I got into it for a while, but have retreated to lein for now.

7:09 talios: lein has maven hidden under the covers, so some of that pain still lurks, and may be hidden even more :)

7:10 and speaking of hiding - its now gone midnight, so I must hide under the duvet and snore ;)

7:10 ejackson: cheers.

7:13 * talios heads off

7:14 bendlas: Hey!

7:14 Why don't array type hints work on definterfaces

7:14 ?

7:15 I tried with (definterface IName (^"[Ljava.lang.String;" getStrings []))

7:16 ^"[J" for longs doesn't work either

7:16 http://dev.clojure.org/jira/browse/CLJ-737 should have fixed that

7:16 can somebody verify?

7:56 clgv: bendlas: String is no primitive and clojure didnt do anything for non-primitive hints back in 1.2 - I dont know if that changed

8:20 bendlas: clgv: ok, but primitive array hints like ^"[J" don't work either

8:20 also look at the attachment to the issue: http://dev.clojure.org/jira/secure/attachment/10119/definterface-array-fix-with-tests.patch

8:21 where arrays of java.util.Maps are tested

8:40 bpr: Is there a way to query the running lisp for a list of method implementions for a given multimethod?

8:42 gu_: hi, anyone with some experience with compojure?

8:51 lucian: does anyone have a nice setup for solving 4clojure? the website editor sucks

8:55 kij: lucian: There should be an lein plugin I think. Is that what you want ?

8:56 lucian: kij: yeah, that's be useful i think

8:56 kij: https://github.com/broquaint/lein-foreclojure-plugin

8:57 lucian: kij: i'd like the problems as commented unit tests, and a way to submit results. that sort of thing

8:57 kij: awesome, thanks

8:57 kij: Not really tried it, i've just finished the nth problem ;)

8:58 lucian: ah. i gues i'm farther along than that :)

8:58 i'm such a lisp newbie, though. i'm still having trouble

8:58 and for all of them i keep thinking "i could do this in python with a few lines"

9:01 kij: Heh, yea - well i still on the project euler mindset, constantly thinking - i should be able to bruteforce this.

9:01 clgv: lucian: you probably can in clojure as well^^

9:02 lucian: clgv: sure, i just don't know how (yet, anyway)

9:04 kij: that lein plugin appears to be broken, i think because 4clojure changed

9:13 kij: nope, i was wrong

9:15 gu_: hi, anyone with some experience with compojure?

9:15 tdrgabi: gu_: what's your problem?

9:16 duck1123: ~anyone

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

9:17 gu_: i described my problem and setup here: http://stackoverflow.com/questions/7836030/compojure-access-filesystem basically i don't know how to access files on the filesystem in compojure in a way that works both with leiningen and in a war file deployed under tomcat

9:20 duck1123: It's been too long since I've deployed anything to a war

9:21 I think you can use getResourceAsStream to read the files, but I'm sure there's a better way

9:22 gu_: the problem is that the server can't find it

9:25 duck1123: try putting them in resources/public http://stackoverflow.com/questions/7816465/serving-static-files-with-ring-compojure-from-a-war

10:35 pyr: hi

10:35 is there an autodoc version that's supposed to work with clojure 1.3 ?

10:36 i'm trying out org.clojars.weavejester/0.9.0 but it blows up on smth i can't qui comprehend

10:36 wondering if it's missing a key in :autodoc in project.clj or just plain not working

10:37 Gamli: hello there - i have a question about the implementation of pmap. is there someone who knows a little about it and is interested?

10:45 hm - i'll just try to put my question in an understandable way :)

10:45 let's say i have an expression like

10:45 (doall (pmap f arguments))

10:45 and arguments is a list of e.g. int (n_0, ..., n_i) and f has e.g. a complexity of O(2^n).

10:45 Lets further suppose, i have 2 processors (pmap would start 4 threads) and arguments would look like '(1, 1, 1, 999999, 100, 100, 100, 100)

10:45 Is it now true, that this would result in the list hacked into two packages of size 4, where the packages are handled in parallel internally but the packages itself being handled sequentially?

10:45 oh, sorry for the new-lines

10:48 octe: what would be the easiest way to transform '(("a" 1) ("b" 30)) into {:a 1 :b 30} ?

10:50 Gamli: @octe - would that even work? ("a" 1) is a function call which should fail i think

10:51 isnt it more like '('("a" 1) '("b" 30))?

10:51 duck1123: ,(into {} [["a" 1] ["b" 30]])

10:51 clojurebot: {"a" 1, "b" 30}

10:52 octe: a, cool thanks

10:52 Gamli: hm - sorry, but i just want to check, if my IRC-client works. did anyone read my question about pmap?

10:53 TimMc: saw it

10:53 Gamli: or anything i write? ^^

10:53 ah, kk - thank you

10:53 TimMc: lazybot: Do you hear anything??

10:53 lazybot: TimMc: What are you, crazy? Of course not!

10:54 ejackson: nothing but the rain

10:54 duck1123: Gamli: pmap tries to stay just ahead of what is being used, so as elements are realized, it'll process more

10:56 Gamli: @duck1123 yes, but i think if e.g. the last element in a package (i think its called step in the code) is very hard to compute the following elements are not realized until the package is finished

10:57 this yields to 100% processor-load on a 72-core system if the last element in a package is hard to compute

10:57 (so it should be 7200% ^^)

10:59 duck1123: Gamli: https://groups.google.com/d/topic/clojure/AtA-0LKYe9A/discussion

11:01 jcromartie: so lein repl runs with the default JVM memory settings?

11:01 which for me is apparently about 128MB

11:01 no wonder I was always running out of heap space trying to do anything interesting :P

11:24 joly: Looks like Rich's "Simple Made Easy" talk just went up on InfoQ: http://www.infoq.com/presentations/Simple-Made-Easy

11:25 jodaro: nice

11:25 watching

11:37 Gamli: @duck1123 thanks for the link. i think pmap is just not what i was looking for since my main concern is to keep the processor load as high as possible.

11:43 ljos: Is there a way I can access the print-out that time gives?

11:45 duck1123: ljos: with-out-str, or you can use this that I wrote the other day. https://github.com/duck1123/ciste/blob/master/src/ciste/debug.clj#L13

11:46 ljos: duck1123: Thanks!

12:00 cgray: hi, i'm having a weird problem... i'm using slime, and when i evaluate a certain clojure form, i'm getting an emacs backtrace

12:02 the error is "error in process filter: condition-case: Variable binding depth exceeds max-specpdl-size"

12:02 and the form is "(max-key #(play-boggle % full-dictionary) (all-2x2-boards))"

12:03 where all-2x2-boards is a function that produces a long lazy list

12:03 duck1123: cgray: I would make sure your swank-clojure and slime are up to date

12:03 cgray: duck1123: i tried that last week and the whole thing broke :)

12:04 duck1123: I remember having that same problem, but I can't remember what the exact fix was

12:07 I would also make sure that you have only 1 version of swank-clojure on your classpath. (but I don't think that's the issue here)

12:10 cgray: oh heck, it should have been (apply max-key ... )

12:44 micahmartin: https://gist.github.com/1301599

12:44 The above link is a potential Clojure 1.3 bug

12:44 It's been driving me nuts for days figuring this out

12:45 Are there any Clojure pros who can take a look?

12:45 cemerick: ??

12:45 lazybot: micahmartin: Uh, no. Why would you even ask?

12:46 micahmartin: chouser: ??

12:46 lazybot: micahmartin: Definitely not.

12:46 micahmartin: lazybot: ??

12:46 lazybot: micahmartin: Definitely not.

12:47 hiredman: micahmartin: I am going to tell you what th problem is, then put you on ignore for being annoying

12:47 vars are not dynamic by default in 1.3

12:47 micahmartin: hiredman: yeah… I knew that

12:47 hiredman: now I'll ignore you for being arrogant

12:48 cemerick: micahmartin: a REPL interaction and a description of what you're expecting as output would be helpful.

12:48 chouser: use of declare and def inside forms like let and list is at the very least unusual, if not completely unsupported.

12:49 cemerick: Yeah, once I saw (list (def …)), I tuned out.

12:49 chouser: micahmartin: but as cemerick said, I'm going to need more info about what you're trying to do

12:49 cemerick: def/declare in let is fine, IMO; baby needs a closure sometimes

12:49 micahmartin: cemerick: The problem is that in the last line throws an exception complaining that the var "something" is unbound.

12:50 chouser: agreed. But if I take these defs outside of the list, the problem does not raise it's head

12:52 cemerick: gist with exception: https://gist.github.com/1301638

12:53 chouser: micahmartin: what did you expect #'something to be bound to?

12:54 micahmartin: chouser: in this example #'something is bound to an atom

12:55 chouser: and it is… (ns-publics) will show that it is bound

12:55 but the form "@something" fails to see the binding

13:07 cemerick: micahmartin: I simplified your example: https://gist.github.com/1301675

13:08 micahmartin: cemerik: Nice. This is much better.

13:09 cemerick: There's something wonky there, but I won't dig into it more. You might get some takers if you post it to the list.

13:09 micahmartin: cemerick: Do you think this is a bug

13:09 cemerick: No. Unspecified behaviour, perhaps.

13:10 chouser: the problem is that the metadata is not transfered from the symbol to the var until the def (or declare) is run

13:10 though the var is created at compile time

13:10 cemerick: I don't think that's it — it's not that the binding is failing.

13:10 chouser: so -- back to what I said earlier: use of declare inside list is not really supported

13:11 cemerick: sure, but it's worth asking why

13:11 chouser: the binding succeed on the var that has become dynamic

13:11 cemerick: if it's being evaluated, then it *should* have the same effect

13:11 chouser: but q is defined using a non-dynamic var p

13:11 or perhaps: q is compiled using a non-dynamic var p

13:12 cemerick: Yeah, I thought that perhaps q was capturing a different (temporary?) var than was visible to with-bindings, but some dumb debug printlns seem to indicate not.

13:14 i.e. if q returns #'p, you get back the bound var with the atom inside

13:17 ah, and (.isDynamic #'p) is true after the list is evaluated

13:17 anyway…

13:58 sritchie_: hey all -- I think this might be a common one, but I'm seeing this when running a jar on a hadoop cluster: Attempting to call unbound fn

13:59 the error's coming from a macro that defines two functions back-to-back inside of a do form

14:00 here's the macroexpansion: https://gist.github.com/1301811

14:00 I'm AOT compiling, and I'm not sure what else I can do to prevent "Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: #'backtype.lyoto.click-stats/human?__"

14:04 scgilardi: would letfn be a better tool here?

14:11 sritchie_: scgilardi: I'll talk to nathanmarz about it -- he wrote the cascalog guts back at 1.1, and I don't understand this enough to say

14:11 scgilardi: probably a good route, though

14:12 hiredman: that exception happens when you take the value of an unbound var and call it as a function

14:14 sritchie_: hiredman: wouldn't AOT compiling that form bind human?__ before it's ever called by human?

14:16 hiredman: sritchie_: well, you need to check were the exception is being thrown, and trace backwards

14:16 figure out how that bit of code got a reference to human?__

14:24 cgray: is there a clean way to get the key in a map with maximum val? i've been doing (apply max-key #(map-name %) (keys map-name)), but that seems kind of verbose

14:25 Chousuke: well #(map-name %) is equivalent to map-name

14:26 cgray: good point

14:26 amalloy: i prefer (key (apply max-key val) map-name)

14:26 errrr, parens wrong

14:26 (key (apply max-key val map-name))

14:27 Chousuke: using a sorted-map might help too :P

14:27 cgray: Chousuke: true, but iiuc, that's sorted on the keys

14:28 Chousuke: mm, right

14:33 amalloy: though if you're getting the maximum value often, maybe you want a heap instead of a map?

14:33 cgray: is that built in?

14:34 ghiu: can anybody check my problem with compjure i described here? http://stackoverflow.com/questions/7836030/compojure-access-filesystem/7838999#7838999 thanks

14:35 cgray: amalloy: actually, that was a bad question :) i don't think i do... i'm updating more often than finding the max value

14:37 hiredman: ghiu: https://github.com/technomancy/leiningen/blob/1.x/sample.project.clj#L151

14:37 if you make your :resource-path "resources/" then what is described in the comment will work

14:39 hugod: for anyone who is using ritz - I just added basic filtering of which exceptions break into the debugger (with an IGNORE restart, and a selector screen for editing) - feedback encouraged…

14:44 ghiu: hiredman: they get deployed, but not under /resources

14:44 hiredman: correct

14:45 the comment doesn't say "resources"

14:45 "public/some/file.txt"

14:45 ghiu: so i have to put all my files under public...

14:45 hiredman: no

14:46 you have a setup that works in dev, but not in production, the comment gives a setup that works in production but not in dev. if you combine the setting above with the setup from the comment it will work in both

14:47 S11001001: We do what leiningen-war does: it puts your resources under WEB-INF/classes so the classloader can get at them.

14:47 hiredman: S11001001: sshhh

14:47 S11001001: you are not helping

14:48 S11001001: oh good, I was hoping to confuse someone today

14:52 ghiu: i think the working production example works because resources are under src

14:53 hiredman: no no

14:53 did you even try it?

14:53 if you do exactly what the comment says and add :resource-path "resources/" to your project.clj it will work

14:53 ghiu: that's what i did

14:54 hiredman: and?

14:54 ghiu: :main org.github.pistacchio.deviantchecker.core

14:54 :resource-path "resources/")

14:54 in the code i have this

14:54 (def *data-file* "resources/data/data.dat")

14:55 that still works in dev

14:55 hiredman: you are not doing what I said

14:55 "if you do exactly what the comment says"

14:55 the filename in the comment does not contain "resources"

14:55 and it is loaed using io/resource

14:56 ghiu: OH!

14:56 you mean the comment on stack overflow?!

14:56 hiredman: which comment did you think I meant?

14:57 ghiu: i thought you were referring to the comment on the code you linked -_-

15:02 hey, it worked, thank you

15:08 the only problem is that now public files are served in dev but not under tomcat...

15:13 hiredman: any suggestion about it?

15:14 hiredman: ghiu: tomcat may swizzle the classloader or something, if you have everything setup right (double check) then the only thing that would explain it is some kind of classloader futzing

15:16 simard: I've followed instructions on http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Creating_an_Applet but all I get in my browser is a gray rectangle, ie.: the applet doesn't start, and no error is generated..

15:16 could anyone get this example going ?

15:16 ghiu: hiredman: i think (route/resources "/") would just make it work, serving static files out of root/public, right?

15:17 hiredman: dunno

15:17 amalloy: simard: the technical term for that (because it's common enough to deserve one) is the Ugly Grey Box of Death

15:17 Raynes: simard: https://github.com/Raynes/webrepl is a little applet I wrote about 300 years ago. It worked.

15:17 simard: amalloy: akin to the blue screen of death

15:17 Raynes: Might be helpful.

15:18 amalloy: indeed

15:18 simard: Raynes: ok I will have a look, you meant 300+ days probably :)

15:18 Raynes: Seems like years.

15:27 nchurch: hello all

15:27 does anyone know how to suppress side effects in a REPL

15:27 or if there is a way?

15:27 I mean if you have a function that prints something internally

15:27 and you only want to see the result

15:27 can you wrap that function in something?

15:28 cemerick: bind *out* (and/or *err*) to writers that drop the output on the floor

15:28 amalloy: you can't suppress side effects in general. suppressing printing is easy, though you should probably edit the function to not do printing instead

15:28 nchurch: thanks cemerick

15:28 amalloy

15:29 what I'm trying to do is run a bunch of pre-written functions

15:29 some of which have side-effects

15:29 so I can't rewrite them

15:29 amalloy: cemerick: if only such writers were built in, eh? java didn't include a NullWriter

15:29 hiredman: scheme does

15:29 amalloy: in the rare occasions i've wanted to do this, i just use a (StringWriter.) and never call toString on it, but blech

15:29 hiredman: it has a function that returns the equiv of a nullwriter

15:30 cemerick: amalloy: yeah, that's the easy escape route

15:30 nchurch: I wonder how often people come across this problem

15:30 * hiredman has been reading the docs for scheme's ports

15:30 amalloy: hiredman: sure. and you can create such writers in java (or use one from apache commons), but it's a bit disgraceful that java doesn't have one prebuilt

15:30 nchurch: it does seem useful to have some sort of null writer

15:31 cemerick: amalloy: (java.io.FileWriter. "/dev/null") if you want to depend on that working :-)

15:32 amalloy: cemerick: true. kinda funny to have to make a bunch of system calls in order to do nothing, but c'est la vie

15:32 cemerick: hah; the windows equivalent is "NUL"

15:32 (FileWriter. "NUL")

15:33 NUL reminds me of IRQs

15:33 amalloy: i guess it's possible the FileWriter class could check to see if its file is /dev/null and not bother to make system calls in that case

15:34 nchurch: yeah, how would you do it system-independently?

15:34 cemerick: I wonder if anyone's attempted to implement a JVM "environment" — alternative implementations of all the native, side-effecting bits (file descriptors, graphics devices, etc), drop into bootclasspath, wackiness ensues.

15:34 S11001001: well, File.toURL does check the filesystem for the type of the file

15:35 amalloy: nchurch: extend (not implement? ugh) Writer and implement write() to do nothing

15:35 cemerick: maybe maxine does that…

15:35 amalloy: the same way apache commons does it

15:36 nchurch: actually, (java.io.StringWriter.) does seem to work

15:36 what is the problem with it?

15:36 cemerick: you're capturing all of the output in the stringwriter

15:36 clojurebot: Excuse me?

15:36 Raynes: clojurebot: You're not excused.

15:36 clojurebot: Cool story bro.

15:36 babilen: Hi all. I am looking for a good/fast/tolerant way to parse SGML documents like http://paste.debian.net/138339/ - I have the DTD - Any recommendations?

15:36 amalloy: clojurebot: not you, buddy. you're doing fine

15:36 cemerick: amalloy: It's likely extremely efficient; the file descriptor that the underlying FileOutputStream uses in that case surely just drops every .write call on the floor.

15:36 clojurebot: Gabh mo leithscéal?

15:36 nchurch: cemerick:

15:37 so it lasts beyond the binding? the junk accumulates somewhere?

15:37 cemerick: You're just paying the cost of N method calls to get down to the FD

15:37 nchurch: no, the writer falls out of scope when flow exits the binding (assuming you're not holding onto it elsewhere)

15:37 amalloy: i don't have a clear idea of where FDs fit into the picture, so i'll take your word for it

15:37 cemerick: But if your functions write 6GB of content to the StringWriter, you're hosed.

15:38 nchurch: oh

15:38 I doubt it will

15:38 I'm going to post this on the group in a bit

15:38 * amalloy starts his JVMs with -Xmx8g, just in case

15:38 nchurch: for the time being I think it will be fine

15:38 cemerick: amalloy: Every .write call ends up delegating to a native method in FileOutputStream

15:39 * cemerick knows a lot of seemingly-useless JVM trivia :-P

15:39 tolstoy: Is there any http basic auth built in to web-noir? Or even ring?

15:39 brehaut: “Guys, whose ready for some more category theory? woo!”

15:40 cemerick: ~scala

15:40 clojurebot: {((x: Any, y: Any) => (f: Function2[Any, Any, Any]) => f(x, y))(1, 2)((x: Any, y: Any) => x)}

15:40 cemerick: woo!

15:40 brehaut: cleanup in isle three

15:41 cemerick: isle four has nicer beaches

15:41 *sigh*, long day

15:42 brehaut: now i have no idea how to spell the word i mean

15:42 cemerick: aisle

15:43 brehaut: thanks

15:47 babilen: Hi all. I am looking for a good/fast/tolerant way to parse SGML documents like http://paste.debian.net/138339/ - I have the DTD, but no need to verify it. I found nathell's clj-tagsoup, but there might be better solutions.

15:58 nchurch: so about my last question (Cemerick, Amalloy)

15:58 cemerick2: cemerick: test meg, ignore

15:58 nchurch: there's still some REPL weirdness

15:58 here's a gist:

15:58 https://gist.github.com/1302148

15:59 I can fix it by wrapping in a vec

15:59 https://gist.github.com/1302155

15:59 which is fine of course

15:59 but why is it like that?

15:59 why would the REPL instersperse side effects into a printed seq even when *out* has been rebound

15:59 but then drop it when I wrap it in vec?

15:59 (wrapping in seq doesn't work----the junk stays there)

16:00 amalloy: $findfn 1 2 3

16:00 lazybot: [clojure.core/bit-or clojure.core/bit-xor clojure.core/+ clojure.core/unchecked-add]

16:00 amalloy: nchurch: you're aware this already exists, right?

16:00 nchurch: nope, I wasn't

16:00 it was fun to write it anyway

16:00 amalloy: yeah, i agree

16:01 nchurch: I mean

16:01 since I didn't know findfn existed

16:01 how could I find it?

16:01 amalloy: hah

16:02 anyway nchurch, the issue is that filter is lazy and vec forces it

16:02 nchurch: and seq does not

16:02 I see

16:02 amalloy: the binding on *out* is only in place until filter returns a value - if that value is a lazy sequence, none of the prints have happened yet

16:02 cemerick2: nchurch: what amalloy said; wrap the filter in doall and you'll get a forced seq without a vector copy

16:03 nchurch: yup, that works

16:03 it didn't \look like a lazyness problem to me

16:04 but I can see it in retrospect

16:05 amalloy: where is findfn?

16:05 I don't see it in the Clojure docs

16:05 amalloy: nchurch: lazybot

16:06 * pauldoo notices not= for the first time.. that'll save me some precious parens

16:09 nchurch: amalloy: i.e., it's on IRC

16:09 is there a version of it for your own REPL?

16:10 amalloy: nchurch: i think someone ported it from lazybot, but i don't know where. you can grab the source yourself, of course

16:10 $whatis source

16:10 lazybot: source is http://github.com/flatland/lazybot

16:14 nchurch: do you know if there is a way of searching within a particular source repository on Github?

16:14 I don't see the option in advanced search

16:15 Raynes: nchurch: https://github.com/flatland/lazybot/blob/newcontrib/src/lazybot/plugins/clojure.clj

16:15 Relevant pieces are the… well… findfn pieces.

16:16 pauldoo: where do I get clojure.contrib.string these days? (under 1.3..)

16:16 TimMc: clojurebot: Where did contrib go?

16:16 clojurebot: well... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

16:16 Raynes: You don't.

16:16 clojure.string is the evolution of it.

16:17 nchurch: thanks Raynes

16:17 pauldoo: hm - it doesn't contain 'substring?'

16:17 brehaut: subs

16:17 nchurch: I wonder why Github doesn't have search within particular repositories

16:17 or at least not htat I can find

16:17 pauldoo: subs is for pulling out a substring, not testing if something is a substring of another thing

16:18 Raynes: &(.substring "foobarbaz" 3)

16:18 lazybot: ⇒ "barbaz"

16:18 brehaut: ,(subs "foobarbaz 3)

16:18 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading string>

16:18 brehaut: ,(subs "foobarbaz" 3)

16:18 clojurebot: "barbaz"

16:18 TimMc: ,(doc subs)

16:18 clojurebot: "([s start] [s start end]); Returns the substring of s beginning at start inclusive, and ending at end (defaults to length of string), exclusive."

16:19 TimMc: Aw, I was hoping it would accept negative endpoints as well.

16:19 pauldoo: Raynes: that's what I have currently, was trying to eliminate all reflection errors without resorting to adding type hints.. I was expecting clojure to contain a usable 'substring?' already...

16:19 replaca: clojure-swank question: when I connect with "clojure-jack-in", disconnect with "slime-quit-lisp" and then try to reconnect with "clojure-jack-in" again, I get "Connection closed". Is there a way to restart my clojure session without restarting emacs?

16:19 Raynes: Where java isn't broke, don't fix it.

16:19 replaca: (Latest everything: clojure-1.3, clojure-mode 1.4, etc.)

16:20 pauldoo: Raynes: yes I know - I was hoping there'd already be one, and learn a little more clojure contrib in the process.. :/

16:20 brehaut: pauldoo: old contrib is largely dead code. new contrib is still very young

16:22 amalloy: pauldoo: .contains

16:22 &(.contains "test" "es")

16:22 lazybot: ⇒ true

16:22 amalloy: &(.contains "test" "sdfa")

16:22 lazybot: ⇒ false

16:23 pauldoo: amalloy: as I said earlier, I've been trying to eliminate reflection warnings and not resort to type hints.. (ie., find equivalent functions that already exist that I perhaps didn't know of)

16:23 amalloy: I can't get .contains to work without a reflection warning unless I use type hints

16:23 amalloy: well yeah

16:24 i didn't catch that part of your question earlier, but now that i've found it i'll echo Raynes: "Where java isn't broke, don't fix it."

16:24 that's why clojure doesn't have substring?, and why you should just use .contains

16:25 Raynes: "resort to typehints" doesn't make a lot of sense.

16:25 If you don't want reflection warnings...

16:26 pauldoo: I'm mainly doing this as an exercise to find the clojure equivalents where they exist

16:26 in a few cases already I was just calling the java methods because I wasn't aware of the clojure function that already existed

16:27 TimMc: pauldoo: If there is a Clojure function that seems to be redundant with a Java method, you should always check to see if the semantics are precisely the same.

16:27 Sometimes there are surprises.

16:34 technomancy`: amalloy: actually (doc subs)

16:34 but that probably wouldn't have been added if it were proposed today

16:34 since it adds nothing interesting

16:35 (defn subs ([^String s start end] (. s (substring start end)))) ; lulz

16:35 amalloy: technomancy`: i think i agree with you, except that your "actually" suffix implies you're disagreeing

16:35 *prefix

16:36 technomancy`: oh, I misread "substring?" as "substring"?

16:36 pauldoo: I'm creating lots of 3 element vectors in my clojure program, and memory use is large. would using records with 3 fields be better ?

16:37 or are there persistentvector classes hardcoded for each size up to some small N?

16:37 amalloy: pauldoo: it would take up less memory. whether it's better depends on your program

16:38 pauldoo: amalloy: so there aren't hardcoded persistentvector classes for each small N?

16:45 hiredman: pauldoo: no, but that might be interesting optimization

16:46 pauldoo: amalloy: looking at clojure source code, I think it'll be creating a java array of 3 elements, and wrapping it in a PersistentVector. Not too shabby, but still a few objects more than a record would use.

16:47 given that my 3 objects are objects which have been internd (and I expect a huge lot of aliasing), maybe that's significant..

16:48 I might poke at this later, could be significant for this use case… (ie factor 2x)

16:48 amalloy: pauldoo: i don't think that's true. i think it allocates a 32-object array, but it's hard to tell

16:49 pauldoo: amalloy: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazilyPersistentVector.java

16:49 bendlas: FWIW, you could create a 3-tuple deftype, that looks and feels just like a persistent vector (i.e. upgrades to one, if you conj, ... to it)

16:49 pauldoo: amalloy: http://clojuredocs.org/clojure_core/clojure.core/vec

16:50 hiredman: pauldoo: what do you have in your vecotr?

16:50 vector

16:50 you could try a primitive vector

16:50 pauldoo: hiredman: 3 String instances. but I have lots of vectors, and the strings are shared a *lot* across vectors

16:51 hiredman: ,(doc vector-of)

16:51 clojurebot: "([t] [t & elements]); Creates a new vector of a single primitive type t, where t is one of :int :long :float :double :byte :short :char or :boolean. The resulting vector complies with the interface of vectors in general, but stores the values unboxed internally. Optionally takes one or more elements to populate the vector."

16:51 hiredman: ah

16:51 pauldoo: amalloy: I expect vec to call into clojure.lang.LazilyPersistentVector/create

16:52 amalloy: and then toArray to be called

16:52 amalloy: pauldoo: that's only relevant if you're creating a seq and then coercing it into a vector, right?

16:52 rather than a literal like [a b c]

16:53 hiredman: definitly look at using a deftype or defrecord

16:53 pauldoo: amalloy: true, but I think that's the case, I'm doing lots of list comprehension type stuff to get my 3 element vectors. then calling vec to fully evaluate and create a more compact representation

16:53 amalloy: a vector is not really more compact, is it?

16:53 pauldoo: and vec does the full evaluation thing, and makes it as if you typed the vector literal

16:54 amalloy: probably is more compact than (take 3 (map etc etc et))

16:54 amalloy: especially if you don't fully iterate the result, and the closures are big, etc..

16:55 amalloy: could be

16:55 pauldoo: amalloy: I saved a lot of memory by just wrapping with a call to (vec …)

16:55 amalloy: have you tried wrapping doall instead?

16:56 i don't actually know which way that would go, but it's interesting

16:56 pauldoo: amalloy: no, I haven't

16:56 I expect the vec to be the smallest, otherwise it'd be kinda broken

16:57 anyhoo, got to head off

17:21 todun: I'm trying to get into macros in clojure. anyone know of good sources (screen-casts, tutorials) out there? thanks.

17:22 jcromartie: todun: I'd recommend starting by experimenting with backquote at the repl

17:22 brehaut: todun: do you have a thing you think you need a macro for?

17:22 jcromartie: ,(let [x 1 y 2] `(+ ~x ~y))

17:22 todun: jcromartie: ok. thanks.

17:22 clojurebot: (clojure.core/+ 1 2)

17:23 jcromartie: ,(let [xs [1 2 3]] `(+ ~@xs))

17:23 clojurebot: (clojure.core/+ 1 2 3)

17:23 jcromartie: etc.

17:23 todun: brehaut: yes. build a macro that makes clojure behave like a different language.

17:23 jcromartie: get a feel for quoting and unquoting

17:23 :P what kind of language?

17:23 todun: jcromartie: more like the length of code needed. it is called rebol.

17:24 jcromartie: (BTW, that's definitely the point of macros: adding something that you can't do right now)

17:24 ah ha

17:25 raek: todun: a fun exercise can be to write a macro that translates arithmetic expressions from infix form to clojure prefix form

17:25 todun: jcromartie: makes sense.

17:25 jcromartie: todun: in the case of REBOL, what features do you want to bring over?

17:26 brehaut: todun: are you wanting to write a rebol compiler or interpreter?

17:26 todun: raek: sounds fun. any ideas where I can find info on learning macros the quick and dirty way?

17:26 jcromartie: don't start out by thinking in terms of eliminating parens :)

17:26 brehaut: (and i hate my self for that extremely imprecise sentence)

17:26 raek: so that (macroexpand '(infix (a + (b * c)))) becomes (+ a (* b c))

17:26 jcromartie: because honestly REBOL looks almost like lisp already

17:27 raek: todun: macros are implemented with ordinary clojure functions. so if you can turn the list '(a + b) into the list '(+ a b), you're almost done

17:28 todun: jcromartie: raek brehaut ok.

17:28 no need to read anything then

17:28 raek: the defmacro macro and the ` ("syntax-quote") syntax will probably be new for you, though

17:28 jcromartie: REBOL looks like it gets most of its utility from the built-in functions

17:29 there's no reason it couldn't be a Clojure library

17:30 raek: todun: a start can be to read the syntax-quote section of http://clojure.org/reader and then http://clojure.org/macros

17:30 todun: jcromartie: ok. sounds like a fun exercise. hopefully not time consuming

17:30 raek: just remember that syntax-quote is just a shorthand to write the code data structures

17:31 and can be used and played with outside macros

17:32 todun: raek: I've never heard that term before...code data structures...or were you refering to data structures like list, arrays..etc?

17:32 jcromartie: todun: since Lisp code *is* data

17:32 todun: macros are implemented as functions that take code and return code

17:33 amalloy: (and that code is shaped like any other data: it's lists, vectors, maps, and symbols

17:33 jcromartie: ,(macroexpand-1 '(-> 123 str reverse))

17:33 raek: todun: yes. in lisps the code is represented with the data structures you normally use in the language

17:33 clojurebot: (clojure.core/-> (clojure.core/-> 123 str) reverse)

17:33 jcromartie: ,(clojure.core/-> (clojure.core/-> 123 str) reverse)

17:33 clojurebot: (\3 \2 \1)

17:34 todun: jcromartie: I can rephrase you then and say macros are implemented as functions that take data and return data,no?

17:34 jcromartie: yes

17:34 raek: so (+ a b) is a list of three elements: the symbol +, the symbol a and the symbol b

17:34 jcromartie: ,(eval (list '+ 1 2))

17:34 raek: todun: yes! that is exactly the point :)

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

17:35 jcromartie: erp, no eval allowed in clojurebot :)

17:37 raek: todun: assume "foo" is defined as a macro. when the compiler sees (a (foo x y) b), it will call the foo macro with 'x and 'y as arguments. the return value of the macro, say "(if (zero? x) y x)", will be used in place of the (foo x y) call

17:37 todun: raek: uhm ok.

17:37 raek: resulting in (a (if (zero? x) y x) b) being evaluated

17:38 the output of the macro is also scanned for other occurences of macros

17:38 a simple example is cond

17:39 todun: raek: I thought cond is a special form?

17:39 jcromartie: macroexpand-1 is your friend, too... todun

17:39 nope

17:39 ,(meta #'cond)

17:39 clojurebot: {:macro true, :ns #<Namespace clojure.core>, :name cond, :arglists ([& clauses]), :added "1.0", ...}

17:39 raek: (cond c1 e1 c2 e2) will expand to (if c1 e1 (cond c2 c3)) and then (if c1 e1 (if c2 e2 (cond))) and then ((if c1 e1 (if c2 e2 nil))

17:40 jcromartie: ,(macroexpand-1 '(cond x :foo y :bar))

17:40 clojurebot: (if x :foo (clojure.core/cond y :bar))

17:40 jcromartie: note the need for further expansion ;)

17:40 raek: todun: well, macros are like user made special forms.

17:40 todun: raek: jcromartie ok.

17:41 raek: todun: I might have said that 'cond' is a special form, but that's not entierly correct.

17:41 it has special rules of evaluation, though (like a special form)

17:42 todun: raek: ok.

17:43 raek: ...and thanks for the links :-)

17:46 tolstoy: So does (require [clojure.string :as str]) not work at the repl?

17:46 raek: todun: an example of an implementation of cond: https://gist.github.com/1302476

17:47 brehaut: tolstoy: (require '[clojure.string :as str])

17:47 raek: tolstoy: you need to quote the whole thing: (require '[clojure.string :as str])

17:47 tolstoy: Ah, thanks.

17:47 Sheesh. The simplest things. ;)

17:47 raek: this is because require is an ordinary function, so without the quote clojure.string would be treated as a class literal, for instance

17:47 gfredericks: I think if use and require were macros beginners would have a slightly easier time

17:48 raek: indeed

17:48 gfredericks: as it is you practically have to grok the difference between macros and functions before doing your hello world

17:48 tolstoy: After a while you get the hang of what to try and then, based on what worked, start to learn what's really going on.

17:48 raek: todun: as you see, syntax-quote works like a templating language for clojure code

17:49 todun: raek: need to google that...but templating languages?

17:50 raek: sorry, "template language" is probably the correct term :-)

17:51 ~ allows you to "fill in" values in a quoted value

17:51 clojurebot: I don't understand.

17:51 raek: ,(let [a 1] '(inc a))

17:52 todun: ok. thanks. brb.

17:52 clojurebot: (inc a)

17:52 raek: ,(let [a 1] `(inc ~a))

17:52 clojurebot: (clojure.core/inc 1)

17:52 raek: it is especially useful when building complex expressions

17:55 glob157-1: Is there a general framework for crawling feeds and sites that's been written in clojure

17:55 michaelr525: hello

17:55 brehaut: glob157-1: enlive will cover sites for you

17:55 at least at the scrapping level

17:59 glob157-1: frinstance, if i want all the a links on the homepage of my site its as simple as (use 'net.cgrand.enlive-html) (map #(get-in % [:attrs :href]) (select (html-resource (java.net.URL. "http://brehaut.net")) [:a]))

19:14 TimMc: $findfn ""

19:14 lazybot: [clojure.core/with-out-str clojure.core/print-str clojure.core/pr-str clojure.core/str clojure.contrib.string/as-str]

19:52 technomancy`: thinking about doing a blog post on the hidden gems of clojure; anyone got nominations?

19:53 (specifically libraries and tools, although built-in functions could be fine too)

19:53 duck1123: have the threading macros been overdone

19:54 or juxt

19:54 chewbranca: this is less of a tool or library and arguably more of a quality of lisp, but one of my favorite parts of clojure is all the cool language research going on

19:55 llasram: In core, but none of the Clojure books I've read thus far mentioned `seque'

19:56 technomancy`: oh, nice

19:57 my current candidates are clj-stacktrace, lein-multi, and difftest

19:57 probably slingshot too

19:58 * gfredericks googles

19:59 technomancy`: or you could just wait for my blog post

19:59 nah scratch that; it'll probably be a while

20:00 duck1123: some good picks there

20:00 technomancy`: maybe lobos if it turns out to be awesome; I haven't investigated it yet

20:00 duck1123: I'd like to see more attention given to what you can do with lamina

20:01 technomancy`: yeah, that's probably due its own post though

20:01 chewbranca: lobos is nice, I'm keeping an eye on korma as well https://github.com/ibdknox/Korma, but its only a few weeks old

20:01 gfredericks: ten years from now the cool thing will be to name your library with a sentence describing what it does

20:02 chewbranca: what would clojure be called then? ;-)

20:02 technomancy`: joegallo: typo in the robert-bruce readme: "whose determination was inspired by the sight a spider"

20:02 * technomancy` tags that one #drivebybugreports

20:02 duck1123: too many libraries will be renamed to "pure awesome"

20:03 gfredericks: hmmm what _does_ clojure do?

20:03 technomancy`: I like how that one fibonacci node.js server had a faq involving "Q: Is it good? A: Yes."

20:03 left a bit to be desired on the accuracy side, but it made up for that in style.

20:04 gfredericks: duck1123: the ones that do IO would have to be "impure awesome"

20:06 TimMc: clojurebot: nathanmarz is <reply> nathanmarz can beat the CAP theorem by simulating the rest of the network in his head!

20:06 clojurebot: Alles klar

20:10 gfredericks: clojurebot: TimMc?

20:10 clojurebot: Cool story bro.

20:12 technomancy`: need to test partition tolerance? just sever the corpus callosem!

20:12 brehaut: TimMc: relevant to your interests https://twitter.com/#!/devops_borat/status/125974500620763137

20:31 aperiodic: is there a guide to using the bots?

20:32 specifically $findfn?

20:36 amalloy: aperiodic: not really. they both have some kind of help, but not very thorough

20:37 $findfn 'a 'b "ab" ; this is basically it, though. N inputs, one output: what functions return the rightmost thing when passed the rest?

20:37 lazybot: [clojure.core/str clojure.contrib.string/as-str]

20:37 jodaro: whats the most latestestest way to parse xml

20:37 data.xml?

20:37 clojurebot: datatype is see datatypes

20:38 amalloy: jodaro: the cloud!

20:38 jodaro: heh

20:38 pre-cloud though

20:38 amalloy: ask siri?

20:38 jodaro: android

20:38 aperiodic: amalloy: i was wondering about inputs and outputs for that, thanks

20:39 amalloy: is their source available?

20:39 amalloy: $whatis source

20:39 lazybot: source is http://github.com/flatland/lazybot

20:39 amalloy: ~source

20:39 clojurebot: source is http://github.com/hiredman/clojurebot/tree/master

20:42 jodaro: oh

20:47 aperiodic: $findfn [:foo :bar :baz] :bar 1

20:47 lazybot: []

20:48 brehaut: ,(.indexOf [:foo :bar :baz] :bar)

20:48 clojurebot: 1

20:49 amalloy: aperiodic: in the shallow sense you probably want .indexOf

20:49 but in a more general sense you probably don't want to do this after all. indexes are no fun

20:49 aperiodic: oh, right

20:50 i'm aware that it's a code smell, but it's used once in some ancillary code to set up a computation, and it's simple

20:51 unless

20:51 is there any sort of predecessor-of fn?

20:51 brehaut: aperiodic: as a guideline that clojure's datastructures only have functions for operations that have reasonable performance garuntees

20:52 amalloy: brehaut: i don't think that's true. count, nth, last, some...

20:52 S11001001: ,(.indexOf [:a '(:b)] [:b])

20:52 clojurebot: 1

20:58 TimMc: brehaut: Whoa! That's fame right there.

20:59 gfredericks: brehaut: my impression was more that clojure preferred functions with consistent performance guarantees

20:59 aperiodic: i have to remember to try to think of how to do something in java if i can't find a way to do it in core/contrib... it's a reflex that i haven't yet developed, and my not having used java in a while doesn't help

21:00 brehaut: gfredericks: thats a better way to state it

21:01 S11001001: ~(do "well" (keep-indexed (fn [i o] (and (= o :bob) i)) [:alice :bob :parker :bob]))

21:01 clojurebot: ,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an square perfect")) )] (testar 10 25))

21:01 gfredericks: I think that's what I've taken from the conversations about why there's no proper contains? function

21:02 nathanmarz: TimMc: that's pretty random

21:07 amalloy: gfredericks: except nth is fast if possible and slow otherwise

21:11 TimMc: nathanmarz: I was just reading the CAP post today. Good stuff.

21:12 duck1123: link?

21:12 clojurebot: your link is dead

21:13 duck1123: got it http://nathanmarz.com/blog/how-to-beat-the-cap-theorem.html

21:17 nathanmarz: thanks

21:30 Nanakhiel: mun rakastettu Chousuke, ilman sua en voi elää, ei ole elämä

21:43 TimMc: nathanmarz: I sent the link to my coworkers. I liked a lot of the ideas, especially the garbage collection bit.

21:44 gfredericks: amalloy: that is a good counterexample. My adjusted impression is that clojure prefers functions that defy my attempts to summarize them.

21:45 amalloy: gfredericks: in fairness, nth really doesn't fit in with the rest

21:45 especially with the (nth coll idx) instead of (nth idx coll) ordering

21:46 gfredericks: amalloy: count is also biperformant isn't it?

21:46 amalloy: yeah

21:47 gfredericks: surely there's a few more...

21:47 aperiodic: don't most coll fns have the coll as the first arg? how is nth different in that regard?

21:48 gfredericks: aperiodic: map, filter, reduce...

21:49 S11001001: I think into is instructive here

21:50 takes a compound data structure as first arg, and sequence as second

21:50 aperiodic: gfredericks: assoc, conj, get...

21:50 S11001001: conj is more of a data structure function, whereas map is a sequence thingy

21:51 amalloy: S11001001: right, that's the distinction i've heard (i think this was rich's idea but not 100% sure)

21:51 gfredericks: aperiodic: if, do, fn...

21:51 amalloy: if it deals with collections it takes the coll as its first arg; if it only cares about sequences it takes that last

21:51 aperiodic: those don't have anything to do with collections!

21:52 gfredericks: aperiodic: I know, there didn't seem to be any good response so I resorted to nonsense

21:52 amalloy: aperiodic: you wouldn't do too badly if you ignored everything gfredericks says that sounds like nonsense

21:52 aperiodic: haha, duly noted

21:52 gfredericks: there oughta be an irc client feature for it

21:53 aperiodic: i can see how nth is weird given amalloy's characterization

21:55 i remember reading about an irssi plugin that colored responses by some hueristic for usefulness

21:55 brehaut: aperiodic: all mine come out the same color as the background

21:56 aperiodic: brehaut: you might just have zen mode enabled

22:47 simard: I'm running M-x clojure-jack-in , with swank-clojure 1.3.3, an upgraded lein, an emacs 24.0.90, and I'm testing the hello-seesaw application from within emacs. Whenever I close the java frame, I get a "Lisp connection closed unexpectedly: connection broken by remote peer"

22:48 technomancy`: simard: often swing is set to do System/exit when the window gets closed

22:48 simard: oh

22:48 :on-close :exit ... :)

22:49 jcromartie: so somebody on HN says they can't do "spikes" with Clojure the same way as with Python or C

22:49 I wonder what that means

22:49 especially in relation to C

22:49 since when is C a good rapid prototyping language?

22:51 simard: technomancy`: thank you

22:51 technomancy`: no problem

23:14 jodaro: spikes?

23:17 second earthquake of the day here

23:18 simard: What's the preferable way of doing some opengl rendering with clojure ? I would rather avoid any clojure lib wrapping underlying opengl java library functions for now.. I'm thinking of using one of either jogl, lwjgl, j3d, etc.

23:20 jkkramer: simard: penumbra is a wrapper, but you could check out its code to see how it's using the underlying libs

23:20 https://github.com/ztellman/penumbra/

23:24 napping: should /msg lazybot mail retrieve mail?

23:25 simard: jkkramer: hum yes penumbra's docs are out of date I'm afraid

23:25 cloning, lein deps, lein compile fail

23:26 ie.: No namespaces to :aot compile listed in project.clj.

23:26 jkkramer: simard: lein compile

23:26 simard: see https://github.com/ztellman/penumbra/wiki/getting-started

23:26 oh

23:26 simard: well, yes :)

23:26 jkkramer: you did that. reading fail, sorry

23:27 simard: I had this project to work once though, I don't feel like struggling again with it right now, but it uses lwjgl, and so does Minecraft... so I might have a try at that

23:37 amalloy: napping: yes, it should, but he's a little broken right now. try $mail

23:38 napping: Thanks, I just noticed the $ in the README

23:46 simard: technomancy`: may I suggest that you add a comment in "lein help uberjar" to use (:gen-class) in the (ns ...) of the file containing the (-main) function ? (see: http://groups.google.com/group/leiningen/browse_thread/thread/286ad643bee7b2ad )

23:46 I had to do this to have lein uberjar + java -jar ... working

23:47 otherwise, a "Could not find the main class: ... Program will exit." error type ensues

23:47 technomancy`: simard: sure; makes sense

23:47 simard: :)

23:47 good night

23:57 amalloy: technomancy`: just re-noticed my answer at http://stackoverflow.com/questions/5983427/how-to-install-clojure-on-ubuntu-10-04-from-github-repo-with-no-clojure-jar/5984183#5984183 and i realized maybe i'm linking to the wrong branch of your repo. should i point people at master or something else?

23:58 technomancy`: amalloy: better to use the "stable" branch

23:58 master right now is in some degree of turmoil and kind of on hold until the next 1.x release lands

23:59 now if only other people were so conscientious about their old posts =)

Logging service provided by n01se.net