#clojure log - Mar 18 2012

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

0:01 ideally_world: How would you test *state* with Midje?

0:08 For the time being, just going to create a sub function that calculates the state that the state setting function uses and then test the sub function...

0:12 yoklov: weird, there's no `any?` function?

0:13 but there's a `not-any?`, `every?`, and `not-every?`

0:13 that just seems inconsistent.

0:15 ideally_world: some?

0:18 yoklov: oh

0:18 right.

0:22 archaic: also look at contains?

0:23 pyninja: not to be confused with .contains

0:23 ideally_world: contains? is probably more what you are looking for...

0:24 though some is a bit more generic :)

0:30 amalloy: contains? doesn't sound anything like what he's looking for

0:38 ideally_world: amalloy, you're probably right, just talking out of my ass :(

0:38 not unusual for me...

0:38 * ideally_world is just struggling trying to figure out how to add midje-mode to his emacs config from overtone

0:42 mdeboard: Are multimethods a vehicle to method overloading?

0:44 ibdknox: they're for polymorphism, yeah

0:45 tremolo: yea, it's really more method overriding than overloading

0:45 overloading is where arity comes in

1:03 ideally_world: suspect midje and live-coding are somewhat incompatiable :/

1:06 wmealing: midje is for mocking right ?

1:07 muhoo: well that was a fun weekend. my brain is full now.

1:07 wmealing: live coding (ie artistic ) ?

1:08 that is something ive always been interested in

1:09 cgag: f

1:09 '

1:09 ';

1:09 woops, was just waking my monitor up

1:10 ideally_world: midje is a testing frame work that is a bit more abstract than normal testing

1:10 wmealing: ah

1:10 ideally_world: live coding is more for overtone, which I only dabble with rarely

1:10 but the live-coding configs actually got my emacs environment sane enough for me to start using Clojure

1:11 I really like the feel of midje "test". Basically stating facts on what is expected confirm (or not) that they are true

1:12 "FAILURE: 1 fact was not confirmed. (But 20 were.)" :)

1:43 wmealing: i've yet to do it, i'm pretty new to clojure, just working my way through the coans now

1:43 ideally_world, are you using somehting like supercollider ?

4:41 ideally_world: wmealing, yes, using supercollider on a mac

5:51 Fullmoon: Does Emacs + Slime make a good development environment for clojure code?

5:55 foobar27: Fullmoon: I'm quite happy with it, though I use swank (which uses slime)

5:56 especially the interactive evaluation is quite practical if you've just started with clojure

5:56 do you already work in emacs?

5:58 ideally_world: isn't swank slime's backend?

5:58 that is, it's the server that makes slime possible

5:59 IMHO, Emacs with Slime is the best environment for writing Clojure code

5:59 I realy really really hate using it for Clojure code :)

6:05 foobar27: ideally_world: you seem to be right

6:13 dan_b: is there a "not" missing in your last message, ideally_world?

6:14 if you hate using the best environment, I tremble to thionk of your reaction to any of the lesser ones

6:14 ideally_world: :)

6:14 It speaks volumes for how much I like the language

6:14 dan_b: or are you a Lisp Machine trero grouch?

6:14 s/trero/retro/

6:15 ideally_world: how ever you word it, I've never seen a Lisp Machine

6:15 though I probably grew up pretty close to a few...

6:15 dan_b: (the delightful thing abut clojure is how devoid the community is of "hey let's build a lisp machine" people)

6:15 at least, what I've seen of it so far

6:15 ideally_world: Hey, let's not build a Lisp Machine...

6:15 there's your not :)

6:16 dan_b: hehe

6:17 ideally_world: I'd hate emacs more if technomancy hadn't pointed out the bleedy obvious commands on https://github.com/technomancy/swank-clojure

6:22 AimHere: Lets build a java bytecode machine in hardware, and run clojure on it

6:43 ideally_world: I guess dragging the C programmers half way to Lisp, dragged some of them towards Lisp Machines? :)

6:46 ambrosebs: given a protocol and a class, is there a function that determines if an instance of that class "satisfies" that protocol?

6:47 ideally_world: satisfies?

6:47 ambrosebs: say (satisfies? IParseType []) ;=> true

6:47 * ideally_world is just digging through the docs

6:48 ideally_world: but I'd expect you did that already

6:48 ambrosebs: I want (magic-fn IParseType PersistentVector) ;=> true

6:48 well I can kinda see a way to use some private clojure.core functions to make my own function

6:48 but id rather not ;)

6:49 another pair of eyes is always good

6:49 ideally_world: my eyes are tired and naive

6:49 :)

6:49 ambrosebs: xD

6:49 ideally_world: and not quite what they were at the Conj :)

6:49 although probably a bit less naive than then

6:50 actually spoke to you a couple of times at the Conj

6:50 and back in Australia

6:50 ambrosebs: orly? remind me?

6:50 ideally_world: tall :)

6:50 ambrosebs: LOL pic?

6:50 ideally_world: false :)

6:51 ambrosebs: haha :)

6:51 ideally_world: lol

6:51 ambrosebs: well im deep into Typed Clojure

6:51 ideally_world: American accent from Australia

6:51 said hello on the way back from the Firday not party

7:02 ambrosebs: ok, made my own implementation. just minor modification of clojure.core/find-protocol-impl

8:39 jaley: For some reason, after grabbing slime-ritz from marmalade, package.el won't autoload it. It loads other packages, and if I open slime-ritz.el and load it manually, that works fine. Anyone else have this issue?

8:52 bsteuber: I wonder how I could find out in which lein2 profile I am from a when-in-production macro

8:54 I would probably add a different hook copying over a lein-profile.clj, but maybe there's a simpler way?

9:19 tomoj: any glossers around? finite-block seems to be basically identity. you can encode byte arrays, but buf-seqs just decode back to buf-seqs

9:19 so how do we get a byte array?

9:20 I thought (.array (gloss.io/contiguous buf-seq)) worked, but I realize now this will sometimes return too much

9:20 rfgpfeiffer: hello?/who

9:21 llasram: tomoj: You need to get a byte-array on decode, not encode, right?

9:23 tomoj: right

9:23 ah, I think this works:

9:24 (let [b (byte-array len)] (.get (gloss.io/contiguous buf-seq) b) b)

9:24 rfgpfeiffer: I'd like to write a native clojure compiler for gsoc. Is anybody here familiar with cola/pepsi/potion/fonc?

9:26 llasram: tomoj: Something like that should work, but seems a bit hacky; still hacky, but you should be able to use .remaining on the `contiguous' ByteBuffer to get the real content size

9:26 tomoj: I did a quick look, and I don't see anything in gloss to decode directly to a byte array, but it wouldn't be too hard to implement in terms of gloss's internal protocols

10:27 wink: hello, anyone knows some semi-fleshed out user management for noir web apps? not that it would be hard to reinvent., but still... :P

10:33 bsteuber: wink: I just googled around a bit and found https://github.com/remvee/ring-basic-authentication

10:34 wink: bsteuber: thanks, will take a look at it. I just usually hate trying 5 things when there's a generally accepted well-known default :)

10:35 bsteuber: :)

11:21 yoklov: so, if i have a small piece of necessary application-specific state which needs no concurrency semantics, which reference type should i be using?

11:22 usually I use atom, but should i be using var instead? or ref?

11:22 Vinzent: yoklov, usually atom is ok

11:23 yoklov: yeah, what throws me is the description of var as "thread local state"

11:24 Vinzent: in order to modify var you have to bind it first, like (binding [*foo* 1] ... (set! *foo* 2))

11:25 so if you don't need thread-local bindings, you don't need dynamic vars

11:25 yoklov: right, and that definitely seems like a hassle, but do i need that if i do `(def ^:dynamic *foo*)`

11:25 and

11:26 actually that makes sense, so if i _need_ the state to be thread local, use a var

11:27 Vinzent: exactly. If you want just plain "mutable variable", atom is ok

11:27 although, usually you don't want it :)

11:29 yoklov: of course not, but you sometimes need it

11:31 (e.g. in my silly unlambda interpreter there's a "current-character" at all times, which is a tiny piece of necessary state)

11:31 raek: if your application has essential state, then you need something like it

11:33 yoklov: yeah. i had just been wondering if i was horribly abusing clojures reference types by using atom

11:56 fliebel: morning

11:58 antares_: yoklov: atom is a good place to start.

11:59 yoklov: yeah, i almost never need concurrency semantics in my programs, and had been using atom when i needed some state.

11:59 just felt like checking that that was, in fact, appropriate

12:06 Chousuke_: yoklov: if you write your programs using mostly pure functions, changing it later won't be that difficult anyway

12:06 yoklov: yup

12:07 and a nice thing about clojure is that i always have that option

12:07 as opposed to other functional languages where concurrency support is spotty at best

12:08 (depending on the language, of course)

12:08 Chousuke_: clojure has an edge in that the concurrency tools are orthogonal to the rest of the language.

12:08 I suppose that

12:08 is true of Haskell too

12:10 but in lots of languages you have to worry about how to use the rest of the language in a way that doesn't interfere with concurrency when you decide to add it.

12:11 java interop has that sort of effect in clojure too, though :P

12:14 yoklov: right, i came from programming mostly in racket, and if you want concurrency in that you either have to settle for working fake concurrency, or not-really-working parallelism

12:16 clojure overall is an extremely well-designed language, and the concurrency sematics are certainly no exception (even though i never really finding myself wanting to use them)

12:19 Chousuke: It seems to me that Clojure's good design stems from rhickey's insistence on simplicity as he defines it. As you add features designed like that, it looks like people perceive it as overall good design :P

12:19 mdeboard: go figure :P

12:24 yoklov: yeah, definitely. and comparing to other lisps, it helps a lot to be modern.

12:30 zw: it is a little strange, (require 'clojure.contrib.str-utils) success in lein repl, but failed in slime. but I do not find clojure-contrib.jar in my box, so why lein repl can find it?

12:31 There is only clojure-1.3.0.jar, no clojure-contrib.jar

12:32 Bronsa_: zw: this is because lein repl outside a project runs a repl from within leiningen's process

12:32 raek: zw: in the same project?

12:33 Bronsa_: and leiningen < 2.0 uses clojure 1.2 and clojure-contrib

12:35 raek: zw: also, use clojure.string instead. the old contrib is deprecated and clojure.string has been available since 1.2

12:42 pandeiro: anyone using lynaghk's c2 lib yet? https://github.com/lynaghk/c2

12:43 zw: thanks Bronsa and raek

12:43 Bronsa, you said leiningen has its own clojure?

12:43 Bronsa_: well

12:44 clojure is included in leiningen's standalone jar

12:44 raek: zw: Leiningen and your project run in separate environments

12:44 you control the project environment through the project.clj file

12:45 zw: Oh, where is leiningen's jar? I only find .lein and .m2 directories

12:45 raek: in one of those...

12:45 Bronsa: LEIN_JAR="$LEIN_HOME/self-installs/leiningen-$LEIN_VERSION-standalone.jar"

12:45 zw: Yes, I just want to know the global jars, not per project

12:45 Bronsa: it's in .lein/self-install

12:46 raek: zw: when just tinkering, it's common to have a project for that

12:46 leiningen is not built for developing outside projects

12:47 so if you want to play with, say, clojure 1.3 and some library, do a "lein new tinkering" and declare those libs in the project.clj file

12:48 Bronsa: alias clj="java -cp `for i in $HOME/src/dummy/lib/*.jar; do echo -n $i: ; done` clojure.main"

12:48 i have this on my .zshrc

12:48 raek: if you just started learning clojure, don't try to install libraries globally as you would do in other languages

12:49 zw: why? raek

12:49 raek: when in Clojure-land, do as Clojurians do :-)

12:49 wink: install ALL the libs!

12:49 raek: zw: also, leiningen does not have any concept of globally installed libraries

12:49 so you can't

12:50 zw: I think I can set swank-clojure's classpath, so the libs won't be downloaded while (clojure-jack-in)

12:50 raek: if you just want to get started with clojure, it's probably easiest to do thing the way most other people do them

12:50 Vinzent: zw, libs are downloaded when you do lein deps

12:50 raek: zw: libraries are only dowloaded once (unless you use SNAPSHOT versions)

12:51 Vinzent: zw, M-x clojure-jack-in just starts swank server and connects to it

12:51 zw: yeah, but I just wandering the other way

12:51 Vinzent: why do you need it?

12:51 raek: which other way?

12:51 zw: I just want to know if I can do thing differently

12:51 Vinzent: zw, you can, with cljr

12:51 but it has very specific use-case

12:52 raek: well, you basically have "use leiningen" or "download all jars manually and launch clojure with the java command with the correct classpath setting"

12:52 zw: I don't need it, just a little curiously

12:52 raek: zw: one way to se what's going on in leiningen is to use the "lein classpath" command

12:53 a very basic repl can be started with "java -cp <output from lein classpath> clojure.main"

12:53 zw: are results of `lein classpath` different for different projects?

12:54 raek: zw: yes

12:54 different projects use different libraries

12:54 and different versions of them

12:54 which can be incompatible

12:54 zw: so it just result from dependencies/dev-dependencies?

12:54 raek: yes

12:54 zw: I'm using emacs/slime, I like it

12:55 raek: lein download the deps of your project, and the deps of the deps, and so on

12:55 Vinzent: hm, btw, cljr actually seems outdates. Is there modern analogous of it?

12:55 raek: and provides a way to start a repl, swank server, or whatever, with correct classpath settings

12:55 zw: but I download clojure-contrib failed, long list of maven error, does the newest version is 1.3.0?

12:56 Vinzent: zw, clojure-contrib is gone

12:56 raek: zw: there is no clojure-contrib for clojure 1.3

12:56 http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

12:56 Vinzent: ah, too slow

12:56 raek: zw: some of the namespaces have been merged into clojure, some have been split off into their own projects, and some are simply unmaintained

12:56 zw: oh, but I have some old code in the book "pragramming clojure" to try

12:57 Bronsa: zw: you can still use clojure 1.2 with clojure-contrib 1.2

12:57 raek: zw: then you can set up a project that uses clojure 1.1 or clojure 1.2

12:57 and things will work exactly like in the book

12:57 zw: ok, seems the only solution

12:57 Bronsa: just put [org.clojure/clojure "1.2.1"] [org.clojure/clojure-contrib "1.2"] in :dependencies of a project

12:58 zw: I still wander is it necessary to repeat same jars in different projects?

12:59 raek: in lein2 they aren't copied to the lib/ directory anymore

12:59 they are used directly off the .m2 directory instead

13:00 zw: my lein seems to be 1.7.0

13:00 raek: zw: here is the rationale: https://github.com/technomancy/leiningen/wiki/Repeatability

13:00 zw: lein2 is dev version?

13:00 raek: yes

13:00 it's about to be released

13:00 pretty soon

13:02 zw: ok, I feel leiningen is mysterious, I should do some read

13:03 thank you guys, it's very nice chatting to you

13:04 go to sleep now, bye guys!

13:05 I'll be back :)

13:05 yoklov: leiningen rules

13:05 both the 30's sci-fi novel _and_ the program

13:05 zw: I've heard about the novel

13:06 yoklov: by novel i mean short story, actually

13:06 and yeah

13:06 i read it for class in highschool haha, it's very cool. i really like that lein's name is a reference to it

13:08 zw: Oh, I havn't read it, maybe I should find it

13:08 yoklov: if you have some time to kill it's worth it.

13:08 zw: ok, thanks

13:08 bye

13:17 yoklov: ,(#([3, 4]))

13:17 oh damn

13:17 &(#([3, 4]))

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

13:17 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

13:18 yoklov: &(#(vector 3 4))

13:18 lazybot: ⇒ [3 4]

13:18 yoklov: weird.

13:18 raek: ([3 4]) and [3 4] are not the same thing

13:19 yoklov: yeah, but that's not what's happening, is it?

13:19 raek: therefore #([3 4]) = (fn [] ([3 4])) is not the same thing as (fn [] [3 4])

13:19 yoklov: really?

13:19 TimMc: &((constantly [3 4]))

13:19 lazybot: ⇒ [3 4]

13:19 raek: note the extra parens

13:19 you try to call [3 4] as a functions

13:19 -s

13:20 yoklov: yeah, i guess that makes sense

13:20 TimMc: &(#())

13:20 lazybot: ⇒ ()

13:20 raek: #(...) is a shorthand for the sommon cases when you want an anonymous function that performs a call

13:20 TimMc: &`#([3 4]) ; yoklov

13:20 lazybot: ⇒ (fn* [] ([3 4]))

13:20 raek: *common case

13:20 yoklov: raek: yeah i knew that

13:21 TimMc: that makes more sense now

13:21 I should use ` more often when i'm confused by the reader

13:22 actually, raek, i guess i didn't realize that it was for when it performs a call specifically.

13:22 raek: &'#([3 4])

13:22 lazybot: ⇒ (fn* [] ([3 4]))

13:23 TimMc: Yeah, ' is often clearer to read than `.

13:24 yoklov: yeah, ` ends up with all those clojure.core/lists iirc

13:24 and concats

13:24 wait no that's just if you actually use read

13:25 raek: &`(foo ~bar)

13:25 lazybot: java.lang.RuntimeException: Unable to resolve symbol: bar in this context

13:25 raek: &'`(foo ~bar)

13:25 lazybot: ⇒ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/foo)) (clojure.core/list bar)))

13:25 yoklov: &(with-in-str "`(foo ~bar)" (read))

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

13:25 yoklov: whoops

13:26 raek: &(read-string "`(foo ~bar)")

13:26 lazybot: ⇒ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote sandbox6997/foo)) (clojure.core/list bar)))

13:26 raek: putting double quotes around it and passing it to read-string has the same effect as quoting

13:27 yoklov: that is… weird.

13:28 though, not if you do something like (read-string "#=(+ 3 4)") :p

15:27 beffbernard: I'm trying to change the :source-path in a noir project to "src/clj" but jetty doesn't like that

15:30 Oops, just solved my own prob. I didn't change noir.server/load-views to reflect my changes

15:47 choffstein: Anyone know why `lein clean` might not be removing my lib/ directory?

15:48 I run lein clean && lein deps and I end up getting multiple snapshots of the same lib, compiled on different days

15:48 which isn't such a big deal locally -- I can just manually remove my lib directory -- but sort of sucks on my CI server

15:57 tmciver: choffstein: yeah, doesn't remove jars from lib for me either. The doc says it removes *compiled* class files and jars.

15:57 choffstein: hm, okay. That seems ... strange to me -- but I guess it makes sense if I am actually managing version numbers correctly, right? Which I don't...

15:59 fliebel: dnolen: Any breakthroughs there? I'm crawling towards a working connectedo goal.

16:00 Jetien: Hi! How can you get the line where the Reader throws an exception? I tried using clojure.lang.LineNumberingPushbackReader and catch the clojure.lang LispReader$ReaderException excpetion, but I can't seem to access its member "line"

16:06 dnolen: fliebel: sorry haven't had a chance to get to it yet, a bit busy putting together a CLJS presentation today

16:07 fliebel: dnolen: Ok, where are you presenting?

16:09 dnolen: fliebel: BK.js this Tuesday and NYC.js next week

16:09 anyone tried to use SublimeText with CLJS?

16:14 * fliebel suprised

16:14 fliebel: > (partition odd? (list 1 2 3 4 5 6 7 8 9))

16:14 (1 3 5 7 9)

16:14 (2 4 6 8)

16:14 (scheme, not clojure)

16:31 Frozenlock: I'm trying a compojure example. In it, there's the Float/parseFloat function. However this leaves me with an ugly .0 when I have a full number. By using read-string it seems I can avoid this problem. Is there any drawback to using read-string instead of Float/parseFloat?

16:41 beffbernard: Frozenlock: Depends if you want a Double or not I guess

16:41 ,(class (read-string "0.0"))

16:41 clojurebot: java.lang.Double

16:41 beffbernard: ,(class (read-string "0"))

16:41 clojurebot: java.lang.Long

16:42 Frozenlock: Well that's the beauty of it, it will asign the correct type automatically.

16:42 No need to parse integer or float, just read-string

16:43 beffbernard: Yup

16:43 Frozenlock: yahoo! :D

17:05 nybbles: anyone know if it's possible to load incanter.core without any guy windows opening up?

17:07 arch i meant *gui windows

17:07 stupid autocorrect..

17:10 jkkramer: Frozenlock: keep in mind that read-string reads more than just numbers

17:10 &(read-string "#=(println \"hi\")")

17:10 lazybot: java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.

17:11 cgag: nathanmarz: I was reading the storm tutorial the other day, there's a missing "````" following the ExclaimationBolt extends BaseRichBolt example

17:17 mk: why does are there 20 invoke methods taking 1-20+ arguments?

17:17 -does

17:21 nathanmarz: cgag: thanks, fixed

17:21 mk: this is from java, for example RT.var("foo", "bar").invoke(...)

17:21 pelleb: Hi guys. I have a question about organization of my new oauth library clauth https://github.com/pelle/clauth

17:21 Hali_303: hi! which is the most up to date joda time library? clj-time was not updated in the last 2 years..

17:23 pelleb: I have a Store protocol for storing tokens, users etc. and a memory based implementation. I want to add redis, datomic etc. Should I do this in the same project with dev dependencies for clj-redis etc or as seperate project for each implementation.

17:23 Raynes: Hali_303: https://github.com/seancorfield/clj-time

17:23 Hali_303: Sean's is the canonical repo at this point.

17:26 pelleb: Today is probably going to be a pretty slow day in here due to a lot of people flying home and getting settled back in after the Clojure/west conference. If you don't get sufficient replies tonight, I'd give it another shot tomorrow.

17:26 pelleb: Raynes: Thanks. Good point. I wish I could have been there.

17:27 Raynes: As do I.

17:29 Hali_303: Raynes: thanks!

17:29 Raynes: any way to use lein to use this version of clj-time?

17:30 Raynes: Hali_303: The one on clojars is his.

17:30 Hali_303: Raynes: hm

17:30 Raynes: [clj-time "0.3.7"]

17:30 http://clojars.org/clj-time

17:31 Hali_303: oh i see

17:40 mk: are there any nice interfaces from java to clojure?

17:47 gfredericks: mk: I wrote a clojure macro for generating classes with static functions from clojure

17:48 mk: gfredericks: got a link?

17:48 gfredericks: $google lib-2367

17:48 lazybot: [fredericksgary/lib-2367 · GitHub] https://github.com/fredericksgary/lib-2367

17:48 gfredericks: it's the lib-2367.export ns

17:49 mk: let me know if you have any questions/suggestions

17:50 mk: there's more documentation about options in the macro's docstring

17:51 mk: you could add an example of what the generated code looks like

17:52 gfredericks: mk: it's boring gen-class stuff -- you'd really find that helpful?

17:52 mk: I was thinking of it the other way, with some sort of way to call clojure code from java

17:52 gfredericks: mk: yeah that's what this is for

17:53 you stick the macro at the bottom of your ns, make sure to aot-compile the ns, and then you will have a class with a static method for each public function

17:54 mk: I was thinking that maybe a good way to make clojure easier for people (including myself, since I'm learning) is to pretend that clojure is really a java ... jar, in a sense

17:54 gfredericks: well the clojure language is certainly a jar

17:54 and it's easy enough to make jars from clojure projects with leiningen

17:55 mk: yeah, but to start it up one needs to set up what initially looks like a whole bunch of strange tools

17:55 gfredericks: what tools beyond leiningen?

17:57 mk: if you have a bunch of java code that you'd need to use, and you're used to working from eclipse, you now have to figure out ccw, and so on

17:57 gfredericks: ah

17:57 ideally_world: yeah, there's the language, then there's the tool support :(

17:58 gfredericks: it's not easy to make everything easy

17:58 ideally_world: at least the language is consistent :)

17:58 gfredericks: most of the time

17:58 ideally_world: more often then the tool support seems to be

17:59 mk: whenever I get into a new language, I have the most trouble with just that initial step. I tried scheme, I think... there's this pseudo-emacs editor that it uses, I think?

17:59 ideally_world: trial by fire, if you can't get the tool support working, you're not passionate enough to use the language? :)

17:59 mk: it took me about 5 minutes to quit (unfortunately, maybe)

18:00 yeah, in a sense. Keeps the newbies out too :)

18:00 ideally_world: I sympathise with you mk, I've been having a go at learning for about 6 months and only just getting comfortable with emacs dev

18:00 gfredericks: I find it simpler to avoid things like eclipse

18:01 mk: well... I really mean bad coders, but lisp itself should keep those out, or magically turn them into good coders

18:01 gfredericks: probably as a result of the fact that it takes so much effort to develop plugins

18:01 ideally_world: the hard part with the toolset is that you need to use them consistently and that's sometimes hard to do when you're starting to learn the language

18:01 mk: gfredericks: I hardly use plugins

18:02 gfredericks: mk: I mean like for new languages like clojure

18:02 ideally_world: everyone is different, but I'd strongly recommend having a good long run at using emacs with all the Clojure support

18:02 gfredericks: I've had success with using eclipse when I need to do java and classic CLI tools when doing clojure, and mixing them together

18:02 mk: gfredericks: well, hopefully someone does that for you - like ccw

18:03 gfredericks: mk: yeah, but because it takes more effort for that to get done, the set of things available at the command line is usually a superset of the set of things available in an IDE

18:03 and when you work with things that aren't mainstream like clojure, that difference tends to be more stark

18:04 mk: gfredericks: yes, but what's available isn't always what's easy. An ide makes them available in an easy way. In any case, some people are used to eclipse...

18:04 but the bigger thing, I guess, is that people are used to however they load up java

18:07 if I had a main method with at the very least load("path/file.clj") and startrepl() or something, then it's like I haven't really left the java toolchain at all

18:08 gfredericks: hmm

18:08 that doesn't soudn impossible

18:09 mk: you can call general clojure functions from java in a mildly clunky way using e.g. RT.var("clojure.core/load-file").invoke("path/file.clj")

18:09 I think that's correct, not 100% sure

18:10 bbloom: quick question about idiomatic use of vectors and conj: i frequently run into the situtation where i have a vector, process it in some way, wind up with a seq, and then want to conj onto the right of it

18:10 i have to either (conj (vec whatever) x) ….or…. (concat whatever [x])

18:10 seems clunky

18:10 mk: gfredericks: yeah - Object result = RT.var(path, "foo").invoke(args);

18:10 bbloom: am i missing something?

18:11 gfredericks: bbloom: I think clojure 1.4 has something for that

18:11 bbloom: :-P what's it called?

18:11 gfredericks: mapv

18:11 ,*clojure-version*

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

18:11 gfredericks: ,(doc mapv)

18:11 clojurebot: "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a vector consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."

18:11 gfredericks: yep

18:12 bbloom: ah, that's cool, but not exactly what i need because i'm not always using map

18:12 for example when working with paths in a tree: (interleave path (repeat :children))

18:12 I have to do: (concat (interleave path (repeat :children)) [x])

18:13 mk: I'm having fun looking at RT.var at the moment, I had program set up to automatically reload loaded .clj files whenever a save occurs. That's a bit ugly, though.

18:13 gfredericks: yeah :/ I guess there's not really a good answer to that besides 1.4

18:14 bbloom: does 1.4 help with this in some other way?

18:14 gfredericks: oh right

18:14 forgot map doesn't apply :)

18:14 then no probably not

18:14 wink: hm.. is it possible to convert strings/vars to usable keywords? my problem is: hiccup's "[:input.myclass" syntax, I'd like to do something like (let [x '(str ":input." y)] [x ...

18:15 bbloom: haha ok, thanks

18:15 gfredericks: wink: like ##(keyword "foo")?

18:15 lazybot: ⇒ :foo

18:15 bbloom: `(keyword "asdf")

18:15 ,(keyword "asdf")

18:15 clojurebot: :asdf

18:15 wink: doh. thanks :)

18:16 mk: if there were some way to just treat clojure like... xml or jsp files, then perhaps some number of java programmers could be tricked into using clojure

18:17 just having a repl hooked up to running code might be enough for some people

18:20 gfredericks: mk: I think chas emerick is pretty interested in this topic; I think he may have started a google group or something

18:22 mk: thanks, I'll look that up

18:24 gfredericks: ,(-> cdr a is car other my quote flatten)

18:24 clojurebot: (clojure.core/-> clojure.core/-> clojure.core/-> clojure.core/-> clojure.core/-> ...)

18:24 gfredericks: hmph

18:26 * gfredericks can't remember how he did that the other day

18:26 gfredericks: &(-> cdr a is car other my quote flatten)

18:26 lazybot: ⇒ (my other car is a cdr)

18:26 gfredericks: oh

18:26 &*clojure-version*

18:26 lazybot: ⇒ {:major 1, :minor 3, :incremental 0, :qualifier nil}

18:26 gfredericks: so what changed about -> between 1.3 and 1.4?

18:29 tmciver: gfredericks: I was going to ask you about that the other day; I couldn't figure it out and it wouldn't work in my repl.

18:29 Luyt_: &(-> cdr a is car other my quote flatten) ; amazing

18:29 lazybot: ⇒ (my other car is a cdr)

18:30 tmciver: The threading macro is building up a list of symbols by placing each at the end of the thing that comes next?

18:31 gfredericks: tmciver: yeah

18:31 tmciver: for reference: ##(-> cdr a is car other my quote)

18:31 lazybot: ⇒ (my (other (car (is (a cdr)))))

18:32 gfredericks: tmciver: adding quote to the end of a threading macro is a great way to see what it's doing

18:32 at least in 1.3 it is :)

18:32 tmciver: gfredericks: Can't get it to work in my swank repl.

18:32 gfredericks: tmciver: what clojure version?

18:32 tmciver: gfredericks: 1.3

18:32 gfredericks: weerd

18:33 * gfredericks starts up his own repl

18:33 gfredericks: tmciver: well you can at least use lazybot

18:33 tmciver: gfredericks: it gives me the following: (clojure.core/-> clojure.core/-> clojure.core/-> clojure.core/-> clojure.core/-> cdr a is car other my)

18:35 gfredericks: tmciver: well I can't figure out why quoting the thing doesn't work, but I can help with understanding the -> macro in general if that's your issue

18:38 tmciver: gfredericks: does it work in your own repl?

18:38 gfredericks: nope

18:39 and lazybot won't show me ##(source ->) for some reason

18:39 lazybot: java.lang.RuntimeException: Unable to resolve symbol: source in this context

18:39 gfredericks: $source ->

18:39 lazybot: -> is http://is.gd/8TJH2p

18:39 gfredericks: ooh there we go

18:39 tmciver: gfredericks: I understand the threading macro I guess I was just surprised that it worked with unquoted symbols like that.

18:39 Raynes: Those links need to be updated.

18:39 &(require 'clojure.repl)

18:39 lazybot: ⇒ nil

18:40 Raynes: &(clojure.repl/source ->)

18:40 lazybot: ⇒ Source not found nil

18:40 Raynes: FFFUUU

18:40 gfredericks: tmciver: it's because the symbols end up inside a (quote) form before they ever get evaluated

18:41 since -> is a macro, it does all its macroey things first, by which time everything's inside of (quote) and so never gets evaled

18:41 tmciver: gfredericks: yeah, that makes sense.

18:41 gfredericks: Raynes: yeah that link is to the middle of an unrelated docstring in 1.2 :)

18:42 * gfredericks cancels his lazybot subscription

18:42 gfredericks: amalloy: explain us the mysteries of (->)?

18:43 Raynes: amalloy is sick with the lisplauge.

18:43 gfredericks: that sounds parenthetical

18:44 amalloy: huh?

18:44 gfredericks: amalloy: what is the difference between ##(-> cdr a is car other my quote flatten)

18:44 lazybot: ⇒ (my other car is a cdr)

18:44 gfredericks: and

18:45 ,(-> cdr a is car other my quote flatten)

18:45 clojurebot: (clojure.core/-> clojure.core/-> clojure.core/-> clojure.core/-> clojure.core/-> ...)

18:45 gfredericks: the former seems only reproducible by lazybot

18:45 amalloy: lazybot probably macroexpands it too much

18:46 gfredericks: oh it has to handle it manually?

18:46 amalloy: sorta

18:46 gfredericks: weerd

18:47 ,(-> cdr a is car other my quote macroexpand-all flatten)

18:47 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: macroexpand-all in this context, compiling:(NO_SOURCE_PATH:0)>

18:48 gfredericks: ah well

18:48 amalloy: gfredericks: lazybot has to mostly-macroexpand stuff, so he can find out if you're doing some illegal interop hidden by a macro like memfn

18:48 he carefully doesn't macroexpand stuff inside of (quote ...), but i think (-> x quote) tricks him

18:48 gfredericks: that lazybot sure is vigilent

18:48 $botsnack

18:48 lazybot: gfredericks: Thanks! Om nom nom!!

18:49 Raynes: all ur code r belong to us

18:49 gfredericks: clojurebot: all ur code |r| belong to us

18:49 clojurebot: Alles klar

18:51 mk: '(x) and (list x) don't do the same thing?

18:52 gfredericks: no

18:52 note the difference between ##(list 1 2 (+ 2 3)) and

18:52 lazybot: ⇒ (1 2 5)

18:52 gfredericks: &'(1 2 (+ 2 3))

18:52 lazybot: ⇒ (1 2 (+ 2 3))

18:53 mk: what is ' equivalent to?

18:53 gfredericks: quote

18:53 mk: ah

18:53 gfredericks: &(quote (1 2 (+ 2 3)))

18:53 lazybot: ⇒ (1 2 (+ 2 3))

18:53 mk: thanks

18:53 gfredericks: sure

18:54 mk: '(...) isn't used very often since you can get list-ish literals using vectors without having to quote

19:02 mk: does the clojure java code have to be untyped (object and exception are everywhere) for clojure to function, or does Rich hate types?

19:03 gfredericks: clojure is a dynamically typed language

19:03 so...I think that's the normal way to do it on the jvm

19:04 raek: mk: I think there are version of the clojure data structures with generics in another project

19:04 in case you want to use them in a java app

19:05 https://github.com/krukow/clj-ds

19:05 mk: I see - thanks

19:07 gfredericks: mk: it sounds like you might be looking for a much tighter coupling between java/clojure than is intended/possible; I think anytime you have a radically different language, things will be a little rough at the boundary points. At least from the static side to the dynamic side. Using java from clojure is much cleaner.

19:12 mk: yeah, I understand that. There just seem to be places where it could be a bit easier - like the lack of any javadocs in the code

19:14 gfredericks: you're browsing through the java source files?

19:14 mk: via clojure-src.jar

19:16 gfredericks: I'd say you're definitely not using clojure the way most beginners do; but I guess that just leads back to the eclipse discussion

19:20 mk: it's mosty because I'm toying with using parts of clojure from java (I'm not sure how it'll work out in the end, but it's interesting enough)

19:24 gfredericks: I guess it'd be cool if lib-2367 could generate classes from namespaces in libraries. Well maybe it can...I suppose if you just put (ns clojure.core) (export-ns) it would at least try

19:24 the class might be too big; not sure

20:00 seancorfieldw: foolishly trying to get emacs / swank etc running on windows 8 (what else is there to do on a sunday afternoon)...

20:00 i run lein swank, try to slime-connect, it says connected but i don't get a slime-repl in emacs

20:00 i can eval code and send it to the swank server tho'

20:01 doing the same on my mac produces a slime-repl as expected

20:01 guess i missed a step in setup on win8?

20:05 hmm, slime-repl-set-package is void ... so i'm guessing that's because the repl didn't start?

20:08 seancorfield: nm, lein swank had failed due to an existing process on that port... *sigh*

20:16 rhc: if my clojure-contrib.jar contains clojure/contrib/http/agent.clj, and i run clojure with java -cp clojure.jar:clojure-contrib.jar clojure.main and then run "(:require clojure.contrib.http.agent)" in the REPL, i should be able to use the http ns, right? am I missing something?

20:16 Frozenlock: In the REPL, when I have an object like this one: #<Server Server@2cec33>. How can I "take it back"? I would like to be able to do (.stop #<Server Server@2cec33>).

20:17 gfredericks: Frozenlock: *1 refers to the result of the last expression

20:17 also there is *2 and *3

20:17 Frozenlock: so you can also do (def foo *1) if you need something around longer

20:17 Frozenlock: rhc: I think require is insufficient. Try (use 'your-library-name). But I'm a noob, use it at your own risks :p

20:18 rhc: Frozenlock: ahh, thank you

20:18 Frozenlock: gfredericks: Oh thanks! Just need to count how far away it is now :P

20:18 gfredericks: rhc: (require 'clojure.contrib.http.agent) is what you were trying to do

20:18 rhc: Frozenlock: guess the instructions at the top here: http://richhickey.github.com/clojure-contrib/http.agent-api.html were a bit misleading

20:18 lazybot: Nooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/http.agent-api.html and try to stop linking to rich's repo.

20:18 rhc: lazybot: ahhh thank you :)

20:19 which also has the correct require..

20:19 gfredericks: require/use/import have different syntax depending on whether they are inside of a (ns) declaration or run as proper functions

20:19 rhc: gfredericks: ah, care to elaborate? or should i look at the docs for require/use/import

20:20 gfredericks: rhc: basically when you run them as functions you have to quote the arguments, like (require 'foo)

20:20 but inside a (ns) you don't quote, and you add the colon up front

20:20 so (:require foo)

20:21 rhc: ah, cause of the way evaulation works?

20:21 gfredericks: well they could be more consistent; the (ns) macro could have been written to do things just about any way it wanted

20:21 but the functions have to have their arguments quoted because of evaluation, yes

20:22 so if (ns) let you do (ns foo (require 'bar)) then there would be less confusion

20:22 but it's hard to take things back

20:22 rhc: yep

20:22 makes sense, thanks

20:22 gfredericks: and maybe some reason to keep it the way it is, if only to make people think about the diff between macros and functions

20:23 rhc: thats the trouble when too many people start using your language before you're done ;)

20:23 gfredericks: ha

20:23 needless to say there's been much discussion about it already

20:23 rhc: interesting, doesn't seem terrible, just another little "thing" to remember

20:23 gfredericks: yeah

20:25 Frozenlock: rhc: if you stumble upon an explanation of use/require, could you please send the link this way? :P

20:28 rhc: Frozenlock: http://stackoverflow.com/questions/871997/use-vs-require-in-clojure

20:28 in my words, 'use' imports the names into your current namespace

20:29 similar to python from package import * vs import package

20:29 or in C++ #include <lib.h> vs #include <lib.h> using namespace lib;

20:30 Frozenlock: Ooohhh! Quite an important difference indeed!

20:31 gfredericks: note that you can (require '[foo.bar.baz :as baz]) to give you a shorter prefix

20:35 alright that's it; I'm making a keybinding for paredit-forward-slurp-sexp

20:37 Frozenlock: Not a vanilla Emacs' function.. what does it do? (I can somehow guess, but still...)

20:37 gfredericks: in paredit mode it will move the next form to the end of your current form

20:38 so ((foo bar baz) bang) can become ((foo bar baz bang))

20:39 Frozenlock: Like M-t, but for multiple arguments?

20:39 gfredericks: Frozenlock: are you familiar with paredit?

20:41 Frozenlock: Not really, I use (show-paren-mode) to track my S-expressions. I'll take a look.

20:45 hiredman: ~ping

20:45 clojurebot: PONG!

20:45 hiredman: ,(+ 1 3)

20:45 clojurebot: 4

20:45 hiredman: ,(println :foo)

20:45 clojurebot: :foo

20:46 gfredericks: botercizes

20:47 remember to exercise your bot at least twice a day to keep him in shape

20:48 hiredman: I've been off line for days and I think ibdknox was trying to tell me clojurebot was broken

20:49 gfredericks: he seems to have been behaving himself for the last few hours

20:51 amalloy: gfredericks: isn't it bound to C-) and C-RIGHT already?

20:55 seancorfield: finally bludgeoned windows 8 into submission: emacs / clojure-jack-in works beautifully on it now!

20:55 gfredericks: amalloy: tmux hates C-RIGHT and urxvt hates C-shift

20:55 seancorfield: also did slime-connect from win8 VM to swank server run on host mac which was novel :)

21:04 arohner: why does noir call (name) on session keys? Is there a specific reason why session keys should be strings?

21:09 gtrak: hmm, how do we got on prismatic?

21:09 get*

21:22 arohner: seancorfield: just wait until you're chaining SSH tunnels for slime :-)

21:23 seancorfield: heh...

21:23 right now i'm playing with starting a swank server inside my application for debugging etc

21:25 arohner: seancorfield: yes, I have slime running on all of my apps, all of the time

21:25 highly recommended

21:25 rhc: hmm, is this an appropriate place to talk about lein?

21:26 arohner: rhc: yes. I believe there's also #leiningen, but this is fine too

21:26 rhc: why does it download clojure-ver.jar when i try to build a jar file

21:26 ?

21:31 gfredericks: rhc "try to build a jar file" == `lein jar`?

21:34 rhc: gfredericks: yes

21:34 gfredericks: i was kinda just expecting it to package up the .class/.clj files into a jar with nothing else

21:40 gfredericks: rhc: it doesn't include the clojure jar in the jar it builds, it just uses it to compile against I think. Also probably uses it to run the compiler.

21:41 rhc: check out the jar with `jar tf my-jar-I-just-built.jar`

21:41 rhc: ah, nice

21:41 gfredericks: thanks for your help

21:41 do you dev clojure professionally?

21:41 y3di: ahh i can't wait to see the datomic talk, did anyone see at west?

21:42 gfredericks: rhc: yep

21:42 y3di: yep

21:45 y3di: gfredericks: how was it?

21:47 gfredericks: y3di: the idea of making the database-snapshot an explicit part of a query is cool

21:47 the one thing I didn't expect was how easy it is, once you do that, to be able to do things like make hypothetical changes to the db and then query against that hypothetical db without changing the real one

21:48 arohner: y3di: it was very cool

21:48 Frozenlock: I can haz video?

21:49 arohner: yeah, the state of the DB is a value, so you can use it in queries like, "query the DB from last week", or "take yesterday's DB, and apply this transaction to it, and see if the transaction applies w/o error"

21:49 y3di: did it feel/seem revolutionary/next-gen?

21:50 gfredericks: Frozenlock: probably not, this was just on friday; you could watch rich's intro video on datomic.com though

21:52 Frozenlock: 20 min talk.. nice :D

22:32 TimMc: They need to get the contents of that into text.

22:32 I can't skim video.

22:38 gfredericks: man it's even harder to skim talks at conferences

22:38 you yell at them to jump forward 4 minutes and everybody just stares at you

22:41 icey: I want to mess around with Datomic, but I'm not used to using jars that don't come from Clojars / another Maven repo. Is this approach [ http://www.pgrs.net/2011/10/30/using-local-jars-with-leiningen/ ] appropriate for dealing with local jars, or is there a better / more standard way to go?

22:53 rhc: gfredericks: ok, lein makes so much more sense now :)

22:54 after putting my code into a lein project, simplifies the dependencies tremendously

22:54 though its kinda awkward when you want something in github that hasnt been put into clojars so you have to add it locally..

22:55 gfredericks: rhc: yeah that is a bit awkward

22:57 rhc: but at the very least you can push it up to clojars yourself

22:57 just be sure to change the maven group before you do

23:03 ibdknox: just clone it into a checkouts dir and you're good to go

23:05 gfredericks: yeah I guess that is easier

23:09 rhc: gfredericks: oh really? so there's no "owner" on clojars?

23:09 ibdknox: what do you mean?

23:10 ibdknox: rhc: if you create a checkouts/ in the root of your project

23:10 rhc: then just clone a repo in there a build a jar?

23:10 ibdknox: anything you put there will be added to the classpath. So if you git clone some project into that directory

23:10 you'll have access to it from your project

23:11 no jar-ing or anything needed

23:11 rhc: oh cool

23:11 perfect, i felt installing it was kinda kludgy

23:12 gfredericks: rhc: in clojars I think the only rule is the first person to add a jar to a particular group owns that group

23:12 which is why you should avoid pushing up somebody else's project to the same group that they specify in the project.clj

23:12 cuz they probably want it

23:13 rhc: yeah, thats what i figure

23:13 i was just using irclj for a learning project..

23:14 ibdknox: irclj is on clojars: http://clojars.org/irclj

23:15 rhc: yeah, but for some reason the snapshot there (1.5.0) is not equiv to the git repo

23:20 ibdknox: Raynes: ^

23:20 Raynes: Yeah, I'm in the middle of a rewrite.

23:21 ibdknox: ah :)

23:21 Raynes: The version in the repo might do what he wants, but it isn't complete.

23:21 rhc: oh hey Raynes :)

23:21 Raynes: No ctcp support at the very least.

23:21 rhc: yeah I read your comments on the github

23:21 Raynes: I've been too busy to work on it lately. :<

23:21 rhc: i figured if i ran into some problem maybe i could contribute as well

23:22 but for this crappy bot i don't need ctcp or anything really, so its no biggie, i was just glad to see any irc lib

23:22 Raynes: Sure. The core is there. The rest is probably just adding multimethods for things it doesn't support that you might need.

23:22 rhc: yeah, i saw that its nicely abstracted to add anything missing

23:24 Raynes: rhc: Want me to release an alpha for you to play with?

23:25 rhc: Raynes: nah don't worry about it, i was able to build from github

23:25 or is this alpha different from github?

23:25 Raynes: What's on Github is what I have.

23:26 I'm not that mean. ;)

23:26 amalloy: wouldn't you rather use the last stable release than the github snapshot anyway?

23:26 rhc: ok, that's what I figured :)

23:26 Raynes: amalloy: No.

23:26 amalloy: given that what's on github is probably Raynes's half-baked ideas

23:26 aw, okay&

23:27 rhc: amalloy: i picked the snapshot only because this is just some learning exercise

23:27 Raynes: The old version in its 'complete' state is disgusting enough that the new version trumps it in its incomplete state.

23:27 rhc: its irc, i can't be that serious, right? :P

23:27 Raynes: :p

23:29 rhc: If you need anything, just ping me or shoot me an email.

23:29 * Raynes takes off

23:30 rhc: Raynes: thanks!

Logging service provided by n01se.net