#clojure log - Dec 07 2011

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

0:02 amalloy: ambrosebs: def creates a new var, as i understand it. so the metadata on the old one is gone

0:02 but i'm not sure i've understood what you're trying to do anyway

0:03 ambrosebs: amalloy: at compile time, I intern a var, and add ::type metadata

0:04 I guess I didn't expect `def` to overwrite the var at *compile time*

0:04 I'm probably wrong

0:04 it would be at runtime no?

0:05 amalloy: welllll, those two kinda get mixed up when you're evaluating a namespace's forms sequentially

0:06 ambrosebs: right

0:06 so it might be a good idea to store type annotations elsewhere

0:08 dnolen: ambrosebs: you're not using that info at runtime anyway right?

0:08 ambrosebs: or add metadata to the var at "runtime"

0:08 dnolen: no, but it seems `def` blurs the line

0:09 (T my-function :- (Fn (Integer -> Integer)))

0:09 that interns a new var #'my-function and adds metadata at compile time

0:10 dnolen: ambrosebs: why not just persist that information in a atom of type information?

0:10 ambrosebs: you know the symbol and the namespace

0:10 ambrosebs: dnolen: yes, I did that initially, raek suggested storing in the var

0:10 dnolen: ambrosebs: I don't see the benefits. you're not going to use that information at runtime.

0:11 ambrosebs: dnolen: ok, I'll switch back

0:11 dnolen: ambrosebs: (T …) should maybe even be a no-op? It something only that analyzer deals w/.

0:12 ambrosebs: dnolen: It's a separate top level form, I assume it needs some sort of global side effect

0:13 it's not metadata

0:13 hmm

0:13 dnolen: ambrosebs: I don't see why. if type-checking doesn't effect compilation and runtime - why do you need a global side effect?

0:14 ambrosebs: seems like you should be able to (type-check "foo.clj")

0:16 ambrosebs: dnolen: where would (type-check "foo.clj") be called from?

0:17 dnolen: ambrosebs: would be nice if you could just do that from the REPL, (typed-clj/check "foo.clj")

0:19 ambrosebs: dnolen: but what about normal compilation of a namespace? I don't see where to hook that kind of command in

0:20 dnolen: ambrosebs: I think rhickey point about not coupling compilation and type-checking are important.

0:20 ambrosebs: dnolen: must have missed that :)

0:21 dnolen: It sounds counter-intuitive. What am I missing? Don't I want transparent type checking when I compile my file?

0:22 dnolen: "you can do type checking independent of compilation, there's not much reason to do it as you go, and doing so will only invite the problems of mandatory typing"

0:22 rhickey quote from the desig ndoc

0:22 design doc

0:22 ambrosebs: ah

0:22 very interesting

0:22 I brushed past that

0:23 ok, some problems fall away with that in mind

0:24 dnolen: ambrosebs: I think rhickey is pushing us to develop good analysis tools / infrastructure. wiring it up to compilation will need a more compelling argument.

0:24 ambrosebs: dnolen: ok, I get it now.

0:25 dnolen: I don't find type-checking compelling in of itself - remove intermediate steps when doing higher order operations on persistent vectors of primitives - hells yeah.

0:25 what I mean, is I don't find hooking up type-checking to the compiler compelling, sorry.

0:26 ambrosebs: dnolen: I don't have any attachment to running at compilation, I just didn't think of anything else

0:26 dnolen: definitely having that as analysis tool w/in easy grasp would be welcomed by many folks.

0:28 ambrosebs: yet another concept that now looks horribly complected xD

0:28 I am enlightened

0:29 could you elaborate on your use case with primitives?

0:30 dnolen: ambrosebs: http://citeseer.ist.psu.edu/viewdoc/summary?doi=

0:30 that was what rhickey mentioned at the conj

0:30 hiredman: http://stackoverflow.com/questions/578063/what-is-haskells-stream-fusion

0:30 ah

0:33 dnolen: core.logic koans in progress … https://github.com/sritchie/core.logic-koans/blob/master/src/koans/basics.clj

0:37 ambrosebs: dnolen: hiredman: woooo that's some heavy stuff

0:38 dnolen: ambrosebs: you got through Maranget, I'm sure you can handle it ;)

0:39 ambrosebs: dnolen: what's the purpose of this? "Here's a vector of stuff, see if you can implicitly covert to primitive array?"

0:41 dnolen: ambrosebs: do you mean the purpose in general?

0:41 ambrosebs: dnolen: yes, I have no idea what this is

0:42 licenser: Raynes: are you working on a twitter api integration for clojure?

0:42 Raynes: No. Why would you assume that?

0:42 dnolen: ambrosebs: operations like map and reduce have a lot of intermedia steps - many of which can be eliminated. we'd rather use reduce but get areduce perf.

0:43 licenser: Raynes: Because you had two test's in twitter and that might mean you are up to something sneaky

0:43 I know you, you are a sneaky one ;)

0:43 Raynes: I started using twittering-mode for Emacs today, and I wrote a hook to get growl notifications for new mentions. I tweeted @ myself so as to trigger the hook. Nothing sneaky going on here.

0:44 licenser: ah I see, but keep in mind, I have an eye on you, don't you sneak up on things again :P

0:45 ambrosebs: dnolen: and where does typing come into this?

0:46 hiredman: I believe you need to be able to prove the optimizations are correct

0:47 not a type system per se

0:47 dnolen: ambrosebs: analysis, I think the paper is pretty clear that they leverage the type information to generate the worker function f'

0:49 ambrosebs: as w/ most interesting papers correctness is not really that interesting. they talk about their framework lacking a rigorous correctness proof.

0:50 ambrosebs: I'm only skimming it, but that papers looks really approachable and leverageable from a Clojure context.

0:54 ambrosebs: dnolen: awesome.

0:54 dnolen: I've learnt a lot about the analyzer, only a few things need to be changed to be generalized

0:55 dnolen: ambrosebs: excellent! Look forward to seeing your notes on the design doc :)

0:55 ambrosebs: namely resolving macro expanders and getting rid of substituions of clojure.core to cljs.core

0:56 dnolen: I think I'll do a brain dump now, and then read the stream fusion paper :)

0:56 dnolen: ambrosebs: cool!

0:58 ambrosebs: dnolen: I really don't have an attachment to type checking either, but it seemed like a cool experiment

1:01 dnolen: ambrosebs: I think the type checking is actually really, really cool, and very useful.

1:01 was really only talking about the completing checking/compilation being uninteresting.

1:01 complecting

1:02 unless you're using it for stream fusion of course ;)

1:04 ambrosebs: dnolen: hehe

1:05 dnolen: I have a vague understanding that people will find it useful, but I still haven't convinced myself totally ;)

1:05 dnolen: type checking that is

1:09 dnolen: ambrosebs: I think there's a good chance it could end up being used a lot. And if not, at least there some blazed trails on how to build custom analysis for Clojure - seem equally big at least to me.

1:11 ambrosebs: dnolen: It's crazy how far I've got in just a few days

1:11 dnolen: the analyzer rocks

1:13 hiredman: ambrosebs: do you have it running on clojure or clojurescript?

1:13 ambrosebs: clojure

1:16 dnolen: actually I think I'll rewrite it to decouple compilation, then add my thoughts. The more I work with the analyzer, the more work I dump onto it :)

1:16 dnolen: ambrosebs: looking forward to it, off to sleep.

1:17 ambrosebs: dnolen: cya

1:18 hiredman: I don't have much interest in clojurescript at the moment. Probably wouldn't be hard to port it

1:18 aside from the compiler, of course

1:28 patchwork: In a lein project, is there an easy way to access the root directory of that project from clojure?

1:29 From inside the app I guess

1:29 it seems like it should be a simple thing to do, but I haven't found anything on it

1:29 tolstoy: I think File(".") does it.

1:29 But that probably depends on where the JVM was started.

1:30 patchwork: I'll try that

1:31 tolstoy: If you're talking lein plugin, I believe it's attached to the project data structure passed to your plugin.

1:31 patchwork: No, just from within the src of that project

1:33 Hmm, here is the clojure I am trying to do:

1:33 (import java.io.File)

1:33 (File. ".")

1:33 tolstoy: I think (File. "") gets you the dir you're in.

1:34 patchwork: It returns a #<File > object

1:34 tolstoy: Yeah.

1:34 You can also use clojure.java.io.

1:35 Try: (.getAbsolutePath (java.io.File. ""))

1:35 patchwork: There it is

1:36 thank you!

1:36 checking out clojure.java.io now

1:36 tolstoy: I always forget to use it. ;)

1:36 (require '[clojure.java.io :as io])

1:37 (.getAbsolutePath (as-file ""))

1:37 Also, (System/getProperty "user.dir"), but that's just the place where the JVM was started. lein repl and lein swank put you in the top of your project.

1:38 patchwork: That is what I'm looking for

1:38 lein root

1:40 michaelr525: hello

1:55 prosa: noob question: is there a way to reload libraries that have already been loaded into the REPL, without restarting it? for example, when bumping a version in leiningen?

2:00 tolstoy: I don't know. Do you mean like you've started with foo-1.0.jar on the class path, then outside the JVM, you replace it with foo-2.0.jar?

2:46 patchwork: okay, if I have a file containing clojure code, how could I get a list of functions defined in it?

2:47 I am thinking of defining a macro that builds a map of function names to functions that I can later reference from other code

2:47 but something like this could already exist

2:59 hiredman: ,(doc ns-publics)

2:59 clojurebot: "([ns]); Returns a map of the public intern mappings for the namespace."

3:02 G0SUB: ,(doc def)

3:02 clojurebot: Cool story bro.

3:02 G0SUB: ,(doc eval)

3:02 clojurebot: "([form]); Evaluates the form data structure (not text!) and returns the result."

4:15 patchwork: f I have a vector [:a 5 :b 11 :c 12] how do I convert that to a map with keys :a :b :c and vals 5 11 and 12?

4:15 *if

4:18 nm: (apply hash-map [:a 5 :b 77])

4:36 Bahman: Hi all!

4:37 Is it possible to define a function like (defn f [x y z] ...) and store the partial application of one variable to that function in a variable like (def v (f x))?

4:38 ejackson: like (def v (partial f x)) ?

4:38 where x is some value

4:38 Bahman: ejackson: Exactly...thanks.

4:43 Is there any naming convention for 'v'?

5:10 ejackson: Bahman: nope,

5:11 although if you're careful with your arrangements you can do things like (defn sell [product client] ...) (def sell-apples (partial sell apples)), to make the partially applied function names flow well in the code

5:12 Bahman: ejackson: Thanks for the hint.

5:19 pyr: hi

5:19 i have a war which needs to be fed a config pointing to a jar which has clojure namespaces

5:20 i'm going to have to play dirty tricks with URLClassLoaders and friends, right ?

5:55 Borkdude: Does anyone know a nice tutorial in TDD in Java? (free)

5:55 on TDD

5:58 michaelr`: Borkdude: why in java?

5:59 Borkdude: michaelr`: because my students know Java (but I will teach them some Clojure, I promise ;))

6:07 erujolc: are you intending to teach your students how to do unit testing, retrospectively, or actually drive stuff out through tdd? seems a lot of confusion, but best is by example

6:24 vivekn: What does the "#( .. )" form signify in clojure? Does it have something to do with side effects?

6:26 pyr: vivekn: it is a reader form which builds anon fns

6:26 #(+ % 2) => (fn [x] (+ x 2))

6:27 vivekn: Thanks. Is there only 1 substitution "%" possible ?

6:28 pyr: nope

6:28 %1 %2 %3 refer to the args

6:28 and %& refers to the rest of the args

6:29 vivekn: oh, thats useful. thanks

6:43 Borkdude: erujolc: I want them to see an example of how TDD can help you design a simple problem. Just wondering if there is a good tutorial on this onlinr which I can use in class. Next I want to create an assignment based on another problem, so they can try it out for themselves

6:43 (sorry, had to leave, now I'm commuting)

6:43 that is: design software to solve a simple problem

6:53 gtg again, if you have smth interesting contact me at michielborkent@gmail.com

7:53 kzar: Any ideas why something like (try stuff (catch Exception e nil)) didn't catch this exception? "PortForwardingL: local port cannot be bound. [Thrown class com.jcraft.jsch.JSchException]"

7:55 erujolc: thrown in a different thrad?

7:57 clgv: kzar: there was a change to exception handling in 1.3 - so are you using 1.3=

7:57 kzar: clgv: Yea

7:59 clgv: kzar: hmm ok I dont know if it applies when you catch 'Exception.

7:59 kzar: but if you aimed to catcha more specific exception than your code might stop working in 1.3 since there are cases when your specific exception gets wrapped into a RuntimeException

8:00 kzar: Maybe erujolc's right about it being thrown in another thread, I'm using clj-ssh which uses jsch for SSH so maybe jsch throws it in another thread?

8:00 clgv: kzar: I noticed that with EOFException

8:00 kzar: But as my code is interupted and the loop doesn't continue I guess not

8:01 clgv: kzar: try catching Throwable there. if that doesn catch anything than it's not thrown in there.

8:03 kzar: clgv: Oh I think that's it

8:04 clgv: kzar: though it's advised not to catch Throwable in production code. you should narrow it down to specific type you expect there.

8:04 kzar: catching throwable worked, yea I was just going to say that

8:05 clgv: It's catching the fact the port is in use and spamming me with security dialogues

8:05 had to just kill java

8:05 clgv: kzar: when debugging I always do (try (suspicious code) (catch Throwable t (debug-repl)) ;)

8:06 kzar: clgv: So with my example exception above how do I catch that one specifically?

8:07 clgv: kzar: look at its inheritance tree and decide which class you take. if you only need that exception, catch only its class

8:41 pyr: alright, so i narrowed my classloader issue to this:

8:41 in a repl i can add a jar to the classpath

8:41 then use find-namespaces-in-jarfile from tools.namespace

8:41 then call require on them

8:41 it works

8:41 inside a ring handler

8:41 when running for instance with lein ring

8:42 an exception is thrown saying i don't have a DynamicClassLoader

8:42 and if i try to set the current classloader to an instance of dynamicclassloader

8:42 it fails

8:42 (initially: i want to require namespaces found in a jar being loaded after the application starts)

8:47 clgv: pyr: so you want to build a plugin architecture?

8:48 pyr: yes

8:48 well not really

8:49 clgv: i have a daemon which can be configured using a clojure dsl and need the configuration to be supplied as namespaces in a jar

8:49 clgv: you probably could do that with the sdk classes for jar files and load-file or load-string - did you give that a shot?

8:50 pyr: that's what i'm trying to achieve

8:50 unless i misunderstand what you mean by sdk classes for jar files

8:50 clgv: there is this builtin: http://docs.oracle.com/javase/6/docs/api/java/util/jar/JarFile.html

8:51 pyr: oh, and load-file can take this as input ?

8:51 because i'm already building and instance of JarFile to use with find-namespaces-in-jarfile

8:53 clgv: you can get the content of the jar via that one -> entries() returns all JarEntries which you can filter and then get an InputStream via JarFile.getInputStream() put that input stream into a suited reader and use one of clojures load* methods that fits

8:53 pyr: 'k

8:54 clgv: I didnt really do that myself yet - so there might be unexpected obstacles but I guess they are not likely

8:55 pyr: the output of entries is not seqable it seems

8:55 enumeration-seq

8:55 got it

9:16 kzar: When an exception is thrown it seems to list two exception classes. For example "java.net.UnknownHostException: dub.kzar.co.uk [Thrown class com.jcraft.jsch.JSchException]", can you catch either? I tried catching com.jcraft.jsch.JSchException to no avail and I don't really want to catch java.net.UnknownHostException because it's too vague for my purposes.

9:29 clgv: kzar: they are probably nested so you could catch java.net.UnknownHostException and check with getCause if it was cause by JSchException

9:29 or vice versa. I am not familiar with the output string format you have ;)

9:32 kzar: clgv: Ah right, I pasted it from Emacs. I tried (catch com.jcraft.jsch.JSchException e ...) but it didn't catch it. I wanted to avoid catching java.net.UnknownHostException so that I don't have to catch an exception for each possible problem with ssh connection. Equally though, as you mentioned, catching throwable seems too promiscuous

9:34 clgv: kzar: there is also an advanced try-catch löib try+ or something that promised easier exceptionhandling. I didnt try it yet

9:36 kzar: clgv: ah right, cheers I'll check it out

9:42 lemoq: hey folks... is there a way to add meta information to pre and postconditions? I have a bunch of functions, each with pre and post conditions, but whenever they fail I do not get in what function exactly that happened (this is the error thrown #<AssertionError java.lang.AssertionError: Assert failed: (== (count %) 1)>)

9:46 clgv: lemoq: does the stacktrace not tell you where it happened?

9:48 lemoq: clgv: nope, it just throws the mentioned error

9:54 boodle: Howdy can someone kindly direct me to how to use a github clone of a leingingen dependency (that I'm hacking on) ?

9:54 clgv: lemoq: I tried with (defn f [x] {:pre [(pos? x)]} (* x x)) - in the stacktrace the first element of AssertionError show playground$f.invoke playground.clj:47

9:56 kzar: clgv: Ah the exception was wrapped in RuntimeException like people talked about on google groups

9:57 clgv: kzar: ah that was my initial assumption.

9:59 kzar: So what's the idiomatic way of handling exceptions like that? Catch RuntimeExeption and then use regexp to search the string representation of the exception for the exception class / message you where looking out for?

10:01 lemoq: clgv: it seems to be a misbehaviour of my editor... in the standard REPL I can at least see the line of code in the source file causing the problem. But thanks anyway for your help :)

10:02 clgv: lemoq: you can define a print-method for AssertionError that shows you more

10:05 lemoq: clgv: I don't get that, how?

10:05 tsally: is there a symbol where equals always evaluates to false?

10:07 clgv: lemoq: via defining (defmethod print-method AssertionError [o w] ...) and building the output string that you wana see in this method

10:08 lemoq: there is an example in JoC book for queues. maybe you can find that one via google

10:09 lemoq: ah here it is: http://my.safaribooksonline.com/book/programming/clojure/9781935182641/composite-data-types/92

10:11 lemoq: clgv: that looks promising, thanks for the hint

10:11 pyr: clgv: ok, so that approach worked

10:11 clgv: but

10:12 clgv: there's a problem when the clj files in the jar require something

10:12 let me be more clear

10:13 i have a daemon that serves models over http

10:13 said models are described through a dsl

10:13 but of some fields are generated through utility functions

10:14 so if my structure if fooapp.model.post, fooapp.model.category and i have a support fooapp.util

10:14 and i load the namespace using the jarfile trick

10:14 it doesn't work, even though i set the currentContextClassLoader to a loader which has the jar in its path

10:15 weird

10:20 clgv: pyr: humm right. it doesnt know where the :reuqire/:use-dependencies are if they are not on classpath

10:20 pyr: maybe you can have a "plugin" directory that is always on your classpath and just extract the jars there as a workaround?

10:21 pyr: I mean, extracting them via thze JarFile access you just used

10:22 pyr: clgv: ok, but again, the plugin dir will can not be part of the configuration / dynamic. oh well.

10:23 clgv: pyr: humm I meant you just have this directory thats on classpath where you can temporarily extract all those jars to?

10:24 pyr: you could also have a look at JSPF codebase how they use classloaders and try to adopt that to your clojure use case

10:34 pyr: on second thought - some time ago I found a snippet of add-to-classpath that worked pretty well with 'use

10:37 pyr: clgv: ah ?

10:37 clgv: pyr: have to search it in my git repo. the problem is I deleted it in a later revision - so just figuring out how to search the git repo

10:41 pyr: got it -> http://pastebin.com/EjXxK2Rh

10:41 pyr: it contains an evil reflection hack, though

10:44 pyr: ah ok

10:44 you force addURL

10:44 which is supposed to be protected

10:44 heh

10:44 dirty trick

10:44 i'll try that

10:45 clgv: yep, it's not my idea. but I dont have the reference url anymore

10:49 licenser: aloa

10:52 pyr: clgv: you made my day

10:52 clgv: :)

11:02 bostonaholic: join #clojure

11:06 kzar: What's the opposite of this? (apply hash-map [:a 1 :b 2]) (Something that turns {:a 1 :b 2} into [:a 1 :b 2].)

11:08 vijaykiran: vec ?

11:09 kzar: ,(apply hash-map [:a 1 :b 2])

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

11:09 kzar: ,(apply vec {:a 1 :b 2})

11:09 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$vec>

11:09 clgv: &(vec (concat {:a 1 :b 2}))

11:09 lazybot: ⇒ [[:a 1] [:b 2]]

11:09 vijaykiran: ,(vec {:a 1 :b 2})

11:09 clojurebot: [[:a 1] [:b 2]]

11:09 dnolen: (mapcat vec {:a 1 :b 2})

11:09 ,(mapcat vec {:a 1 :b 2})

11:09 clgv: &(flatte {:a 1 :b 2})

11:09 clojurebot: (:a 1 :b 2)

11:09 lazybot: java.lang.RuntimeException: Unable to resolve symbol: flatte in this context

11:09 clgv: &(flatten {:a 1 :b 2})

11:09 lazybot: ⇒ ()

11:10 kzar: aha thanks guys

11:10 clgv: &(vec (apply concat {:a 1 :b 2}))

11:10 lazybot: ⇒ [:a 1 :b 2]

11:10 clgv: &(vec (apply concat {:b 2 :a 1}))

11:10 lazybot: ⇒ [:a 1 :b 2]

11:11 vijaykiran: what was the +1 karma syntax again ?

11:16 jweiss: is there a page somewhere with recommended packages for emacs-starter-kit? for instance, is durendal still used? slime-clj?

11:18 gtrak`: &(inc vijaykiran)

11:18 lazybot: java.lang.RuntimeException: Unable to resolve symbol: vijaykiran in this context

11:19 gtrak`: (inc vijaykiran)

11:19 lazybot: ⇒ 1

11:29 jcromartie: OK, so why don't we have this? http://re-factor.blogspot.com/2010/09/visual-repl.html

11:30 kzar: jcromartie: Oo fancy

11:30 jcromartie: or Dr. Scheme

11:30 anyway, should just be a Swing REPL

11:30 the trick is keybindings

11:30 I like my readline

11:30 and I do not look forward to porting that

11:30 JLine sucks

11:49 cemerick: jcromartie: http://cemerick.com/2011/10/26/enabling-richer-interactions-in-the-clojure-repl/

11:50 hhutch: i was just about to paste that

11:53 ejackson: meh, mathematica's repl slays all

11:53 for rich data stuff, at any rate

11:55 check out http://www.wolfram.com/mathematica/new-in-8/combine-knowledge-and-computation/

12:27 cemerick: ejackson: We should have the raw materials to enable that sort of thing in the very, very near future.

12:27 Tool support will be the blocker.

12:27 ejackson: wow !

12:27 cemerick: *raw* materials :-)

12:38 hugod: ritz snapshot supports slime-media, and slime-presentation, so you can return images, and attach context menus to them

12:45 cemerick: hugod: unfortunately, such things will never be available for tools other than emacs

12:47 hugod: cemerick: so it would seem

12:54 jweiss: anyone know why I get "Cannot open load file clojure-mode" when I have a (require 'clojure-mode) in my starter kit $USER.el file?

12:55 for some weird reason clojure-mode isn't on the load-path, even though the elpa package is installed.

13:00 technomancy_: jweiss: if you installed with package.el, you shouldn't require it; you'll have autoloads set up for you

13:02 jweiss: technomancy: i'm trying to use custom-clojure.el, how should i add that to my configuration then? (it calls (require 'clojure-mode)

13:02 or is custom-clojure outdated? it has code highlighting in the repl, which is the main thing i wanted from it

13:03 technomancy: I don't know; I've never heard of it

13:03 jweiss: really? does no one else have code highlighting in the repl then?

13:03 or is there some other thing that does it

13:03 technomancy: you can do that with a hook; I don't remember the exact invocation

13:03 jweiss: https://github.com/mrBliss/dotfiles/blob/master/.emacs.d/custom-clojure.el

13:04 technomancy: any suggestion how to get that to load ^

13:05 technomancy: it's not a general-purpose library; it's just some code from some guy's dotfiles

13:06 it looks like he's just grabbed elisp from a bunch of places; there's stuff copied from durendal and an outdated lein-swank defun.

13:08 jweiss: technomancy: i'm moving to emacs 24, trying to do things the 'clean' way, but don't know where to get the functionality i had before from this file

13:09 definitely don't get syntax highlighting in repl without it, and paredit does not work correctly in the repl either (create a paren pair, delete the open paren, close paren stays there)

13:09 technomancy: I never got paredit working satisfactorily in the repl

13:10 it's hard because the repl contains output, so there's no guarantee that it's structurally sound

13:11 you probably want elein instead for invoking lein tasks if you want to avoid the shell

13:13 jweiss: technomancy: it worked well for me in emacs23

13:13 but then again i had a mishmash of customizations that i am not entirely sure what they did

13:14 cemerick: I think I've finally come 'round to appreciating hiccup et al.

13:22 dnolen: hmm a pretty amazing ClojureScript debugging experience could probably be built with this, http://trac.webkit.org/browser/trunk/Source/WebCore/inspector/Inspector.json

13:22 remote debugging protocol

13:27 Raynes: cemerick: Have you used Story at all?

13:28 cemerick: Raynes: Nope, just looked at the pretty pictures.

13:28 Raynes: I was playing with it yesterday. Couldn't get it to output anything but the actual source file.

13:29 cemerick: Ut-oh. :-P

13:30 Raynes: If I could get the darn thing to work, I'd probably start contributing to it. The project is in dire need of restructuring.

13:30 tmciver: Raynes: what's story?

13:30 Raynes: http://jedahu.github.com/story/

13:32 cemerick: Aha! I got it to work.

13:32 Eureka. Hackin' time.

13:32 tmciver: Raynes: cool, thanks.

13:40 jcrossley3: is there a better way to ensure true/false when x may be nil than (not (not x))?

13:41 TimMc: coercing to boolean?

13:41 $findarg map % [true 5 false nil] [true true false false]

13:41 lazybot: [clojure.core/boolean]

13:41 TimMc: there you go

13:42 jcrossley3: TimMc: cool, thanks!

13:43 TimMc: Raynes: Looks like shit on FF 3.6.

13:44 http://i.imgur.com/6oA6Z.png

13:44 TeXnomancy: youch: http://lift.la/scalas-version-fragility-make-the-enterprise

13:45 Raynes: TimMc: Looks fine in 7.

13:45 TimMc: Make an issue: https://github.com/jedahu/story

13:46 TeXnomancy: That can't be good.

13:47 TeXnomancy: Raynes: tl;dr: AOT creates nightmares.

13:54 cemerick: Not sure fixing FF 3.6 bugs is going to be very high on anyone's list.

13:55 accel: dear the great ones of clojure

13:55 has any wizard conjured up an editor in clojure

13:55 where I can code in unicode and latex expressions?

13:55 cemerick: Pollak has been "honest" about Scala quite a lot lately.

13:56 accel: any decent editor will let you use unicode.

13:56 Any decent editor will also make you think twice about using latex. :-P

13:56 OlegYch|h: you heard him being "unhonest" ?

13:57 accel: i'm confused

13:57 does "unhonest" mean honest?

13:57 since "" negates the word within

13:57 so is "unhonest" like not unhonest ?

13:57 yeah; I have unicode support in vim; but hmm; I guess what I reallyw ant is the abilityt o layout equations in latex

13:57 and then have them evaluate as clojure code

13:58 I think fortress was supposed to do this?

13:58 cemerick: What I was getting at is that criticism is alternatively honesty, bitterness, trolling, etc., depending on the reader.

13:59 accel: IIRC, fortress can emit latex for code, but doesn't consume it.

13:59 it has nothing to do with clojure though.

13:59 OlegYch|h: sorry, you mean he is trolling?

14:00 accel: cemerick: if fotress had an editor that could write typeset math, and evaluate it, I would like to create a clojure binding for it

14:00 which shouldn't be hard sine both are Java based

14:00 cemerick: OlegYch|h: Definitely not what I'm saying.

14:00 I retract all my comments on the matter.

14:00 :-P

14:01 accel: I don't think there is such a thing as a "fortress editor" — it takes in fortress code, and can evaluate it and/or emit latex, images, etc. containing that code.

14:18 TimMc: cemerick: 3.6 is still fairly common, unfortunately

14:18 including my machine :-(

14:18 cemerick: my apologies

14:18 I was stuck there myself for longer than I wanted until the PDF plugin was updated for 4+

15:03 jodaro: sheesh

15:04 jodaro: 1 emacs: infinity

15:10 TimMc: jodaro: http://www.printmojo.com/deviantlogic/Store/Product.php?ProductID=14252

15:11 (Disclosure: That's a friend of mine's store.)

15:12 jodaro: heh

15:16 jcromartie_deskt: sup

15:17 jcromartie_desk: M-x irc is the best thing ever

15:22 I wonder if paredit works in irc mode

15:22 duck1123: jcromartie_desk: I know it does in erc if you turn it on

15:22 smilies will kill you though

15:24 TeXnomancy: just switch to korean smiles: ^_^

15:25 duck1123: I find I try to avoid doing smiles or frowns in here simply because of the unmatched parens

15:28 djhworld:



15:36 Squee-D: djhworld make them look like homer (8-)

15:37 djhworld: Squee-D: sorry have I been posting nonsense again

15:37 Squee-D: no sorry

15:37 i missed. duck1123 was who i should have hit

15:37 you did post three blank lines immediately after him which is what cause me to miss.

15:37 djhworld: haha OK, was just worried then as I'm messing around with emacs and rcirc

15:38 the blank lines would probably explain that!

16:10 jedahu: does clojure(script) have anything analogous to common lisp's read-time conditionals?

16:13 dnolen: jedahu: no, but perhaps one day.

16:16 jedahu: dnolen: I'm stuck with cpp then; ugh.

16:18 dnolen: jedahu: yeah sharing code between CLJ / CLJS needs to be sorted out ...

16:30 gtrak`: dnolen, still waiting for that turn-dial rich hickey promised :-)

16:40 jweiss: anyone emacs folk know if clojure repl (emacs starter kit) should run in slime-repl-mode or just REPL-mode? mine is in REPL-mode. doesn't seem right

16:53 nighty-: pyr, salut :) c'est Christophe

16:59 daniel__1: im trying to work out where to put the css iles in a noir app, so that include-css inds them. can anyone help me out?

17:11 djhworld: daniel__1: create a dir structure called "resources/public/"

17:11 under the root of your project

17:12 technomancy: I'm wondering with all this complaining about binary compatibility in scala if they have looked into using classifiers to specify artifacts targeting different scala versions

17:13 pjstadig: i don't think that is the problem people are highlighting

17:14 the problem is the dependency hell and combinatorial explosion caused by the incompatibilities

17:15 technomancy: if it's an issue of binary compatibility only, then I think as long as each library in the dependency chain was careful to publish versions with the appropriate classifiers it would help.

17:15 if it's an issue of source-level incompatibility, not so much

17:17 pjstadig: sure it would probably help, but who wants to be responsible for compiling a bunch of different copies of their libraries, one for each Scala version

17:17 technomancy: it's easy using lein-multi

17:17 clearly the problem is that they are using sbt; they should all switch to lein. =)

17:18 pjstadig: hehe

17:18 technomancy: hm; actually lein doesn't support setting the classifier when publishing, just when consuming.

17:18 better fix that

17:21 https://github.com/technomancy/leiningen/issues/349

17:31 jasperla: hi

17:37 cemerick: technomancy: people have a rough time with SNAPSHOT, and you want everyone to publish N artifacts with suitable classifiers? ;-)

17:37 devinus: has anybody here worked with both CL and clojure?

17:38 technomancy: cemerick: weeeeeeeellllll... it's something that should be trivial to automate, right?

17:40 cemerick: technomancy: *if* you've got a good release process + good metadata

17:40 technomancy: right; "trivial" is probably not the right word. =)

17:40 pdk: i'd assume a lot of folks here have at least learned cl dvev

17:40 dev

17:40 technomancy: but "possible to automate in such a way that it appears trivial to the user" maybe?

17:40 pdk: it's a much smaller number than you'd think

17:41 around 5% of survey respondents: http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/

17:41 pdk: wow

17:41 technomancy: MAYBE they are all keeping quiet in order not to draw attention to themselves, since that could result in me convincing them to help maintain swank-clojure.

17:41 cemerick: To be fair, that's a choose-one question asking where people came from Clojure.

17:42 zakwilson: I used to use CL a lot and now pretty much only use Clojure.

17:42 cemerick: Maybe more like 20% have *some* prior experience.

17:42 I personally try to forget my brief affair with CL.

17:43 zakwilson: I like some things in CL that are missing from Clojure.

17:43 technomancy: yeah, "having used CL at some point" is more common than "has used CL and Clojure in time periods with non-trivial overlap"

17:43 zakwilson: I've actually used symbol-macrolet in production code.

17:49 It's interesting that while few people came from Common Lisp, many would go to it if they couldn't use Clojure.

17:52 TimMc: Or they'd go to Scheme.

17:53 gtrak`: clojure is lisp gateway drug?

17:54 brehaut: id go to scheme or an ML if clojure vanished today

17:55 devn: i think it is a gateway drug. i went looking for a lisp and found CL. the community was not very friendly, and clojure seemed to present an opportunity for me to get a real job writing it.

17:56 that meant I finally knuckled down and learned some emacs. after copying/pasting I found myself writing elisp. lately i've been playing with racket. so yes, gateway drug.

17:57 devinus: "The read table is currently not accessible to user programs"

17:57 is that still true?

17:57 seancorfield: i'm not sure what i'd go to if clojure disappeared - i'm wedded to the jvm right now

17:57 devn: if clojure disappeared I would attempt undisappear it

17:57 attempt to*

17:58 seancorfield: well, given it's on github and lots of people have forked it, "disappear" is unlikely i suppose :)

17:58 bhenry: devn: if clojure disappeared i would use it as it is now forever.

17:59 seancorfield: but _if_ the community went away, and there was essentially no support out there, then i'd move to something else for the mental peace of my company... i just don't know what that would be...

17:59 devn: yeah, i mean, if clojure did not exist, I think I would probably end up needing to choose a "hobby" language, which is the best part about clojure

17:59 I don't feel like clojure is a hobby language.

17:59 amalloy: gtrak`: "lisp gateway drug"? that's like marijuana being a marijuana gateway drug

17:59 seancorfield: i sort of came to clojure from scala (in a very loose sense) but i don't think i'd want to go back to scala :(

17:59 devinus: zakwilson: what's in CL that you miss from clojure?

18:00 gtrak`: amalloy, we are all hyper-sensitive to this point by now :-)

18:00 devn: amalloy: it's lisp lite or something -- seemed less daunting to me as a newb, but then again i was totally unfamilliar with lisp so I had no real criteria to use when choosing clojure over another lisp

18:00 zakwilson: User-defined reader macros, symbol macros, method combination.

18:01 devinus: zakwilson: CLOS?

18:01 zakwilson: Not really.

18:01 devn: I didn't choose clojure. Clojure chose me.

18:01 We're best friends who happen to also be lovers.

18:01 zakwilson: Well, method combination is from CLOS I guess, but I don't miss classes.

18:01 devinus: isn't it hard to do macros using a Lisp-1 ?

18:01 zakwilson: Not really.

18:02 devinus: not knowing clojure well enough i couldn't say

18:02 devn: First rule of macro club: Don't use macros.

18:03 seancorfield: if lisp ran on the jvm, i'd use that... oh, wait... :)

18:04 jodaro: clojure and i are secret lovers

18:04 and penny lovers

18:04 zakwilson: Clojure macros qualify symbols to their namespace by default, so unintended name capture is unlikely.

18:04 devn: clojure and i ride penny farthings, attend ice cream socials, and Get Things Done together

18:05 technomancy: devinus: it's harder to write composable macros than it is to write composable functions, and lisp-1 users generally care more about composability.

18:05 devinus: zakwilson: do you miss the condition/restart system?

18:05 amalloy: hugod: what's the Right Way to get a clojure debugger (preferably in slime) these days? i'd like to be able to step through some code that's crashing in a way that makes it extremely hard to get a stacktrace

18:06 zakwilson: devinus: Sort of. It's available as a library in Clojure, but I haven't wanted it enough to try it out.

18:08 Mostly, I think it will be annoying to have both that and Java exceptions, so I haven't bothered.

18:37 seancorfield: amalloy: have you tried george's swank-cdt lately?

18:44 amalloy: seancorfield: not lately

18:45 i think when i searched for it just now i found some really-old document about it, implying it doesn't have features i want, like stepping. but i found something newer that says it does

18:46 technomancy: I've done stepping with cdt

18:46 helped me find a bug in the clojure reader

18:47 amalloy: technomancy: and whatever version of lein swank i have is compatible?

18:48 technomancy: amalloy: you need 1.4.0-SNAPSHOT specifically; none of the cdt stuff is on 1.3.x

18:49 amalloy: oh ugh, but i can't use lein swank anyway on this project, because it uses cake stuff that isn't in lein yet

18:49 licenser: but isn't cake dead dead?

18:51 amalloy: mostly i think it just uses native deps, which work fine in lein but require some different syntax in project.clj

18:52 technomancy: man are there a lot of Japanese clojure tweets.

18:53 I wonder how far off ClojureConj.jp is

18:53 amalloy: technomancy: about halfway around the world, eh?

18:53 technomancy: badum

18:56 licenser: ^^

18:56 * licenser hates GUI Design

18:57 _ulises: you still on cough medicine?

18:59 licenser: _ulises: should be, but I figured not to take it any more, it isn't helping just making me fuzzy(er then usual)

18:59 cgray: is anyone else having problems pushing to github?

19:00 licenser: figured a good alternative is to stay awake through the night, the cough is worst there and really sucks when you try to sleep. And around 10am you are so wasted that you can sleep no matter what :)

19:01 technomancy: it's amusing how load-file doesn't take a file

19:02 _ulises: heh

19:03 jodaro: wow

19:03 this should be interesting

19:03 so i've got this little service framework in clojure

19:03 using zeromq

19:03 licenser: so my gui issue is quite easy, I have this really cool project, a programming ai game and I've a quite decent backend by now, working in erlang, nicely distributed and everything. But my gui guy abandoned me so I have a part of a gui but nothing really :( sooo frustrating

19:04 jodaro: one of the clients of said framework here needs to access it via http

19:04 so i put a stupid simple layer in front for that

19:04 in my tests

19:04 accessing via http is like 9 times slower

19:04 than the direct zeromq request/response

19:08 amalloy: jodaro: just buy eight more computers

19:08 jodaro: yeah

19:08 or i could make it even faster and buy 16

19:29 AWizzArd: technomancy: does Leiningen support something like :java-test-path in the project.clj? I saw this key mentioned in an issue, but there is no example in the sample-project.clj file.

19:29 technomancy: AWizzArd: no, there's no way to run java tests, so it doesn't make sense to specify the path to them

19:30 AWizzArd: technomancy: could one not use some test framework in Clojure (for example Midje, but it could be something else too) which can be called after "lein compile" and which then simply creates Java classes and tests them?

19:31 technomancy: AWizzArd: sure, you could do all kinds of stuff like that in a plugin

19:31 AWizzArd: This would be only for mirroring the directory structure that one can find under the src/ dir, such as src/clj and src/java, for which one can specify the :source-path and :java-source-path.

19:32 It would now look strange to have all tests just under test/. It would look more symmetric to have test/clj/ and test/java/ too.

19:32 So, you would say that it would be the best option that lein-midje adds such a key yes?

19:33 technomancy: yeah, whoever runs the test should dictate what the options look like

19:33 AWizzArd: A key like :midje-options or :java-test-path.

19:33 Okay okay, then I will continue discussing this with Brian. Thanks for your inputs :-)

19:34 technomancy: sure

19:34 maybe a "lein junit" plugin or something? that's a pretty well-defined interface to work against

19:38 AWizzArd: Yes. There is already lein-midje which adds "lein midje". That also takes a list of namespaces to test.

19:39 In principle that existing plugin could respect :midje { ... } if that was specified in the project.clj.

19:40 srid: I am tempted to name my Python module implementing some clojure primitives as "pojure.py"

19:40 or clothon.py?

19:41 licenser: AWizzArd: wow du lebst :D

19:41 AWizzArd: licenser: yes, but need to head to bed now ;)

19:41 licenser: sleep well friend :)

19:45 cemerick: Has anyone used test.generative before?

19:46 Or, more concretely, are there any alternatives out there to test.generative?

20:03 alexbaranosky: I haven't heard of any alternatives other than ClojureCheck, which I think is out of date

20:08 cemerick: alexbaranosky: Yup, I just noticed it. re-rand ended up being what I needed. https://github.com/weavejester/re-rand

20:15 budu: hi

20:16 i was wondering if anybody know of a sensible name for the following function

20:16 (defn foo [coll] (partition 2 (butlast (rest (interleave coll coll)))))

20:16 and also if it already exists?

20:17 _ulises: budu: what does it do?

20:17 budu: (foo [1 2 3 4 5]) -> ((1 2) (2 3) (3 4) (4 5))

20:17 _ulises: right

20:17 amalloy: &(partition 2 1 (range 1 6))

20:18 lazybot: ⇒ ((1 2) (2 3) (3 4) (4 5))

20:18 cgray: budu: there's (partition 2 1 (range))

20:18 too slow

20:18 budu: oh yeah, forgot about that!

20:18 cgray: what is too slow?

20:18 cgray: i am :)

20:19 amalloy beat me to it :)

20:19 amalloy: if you were reimplementing, a nicer solution would be ##(let [coll (range 1 6)] (map list coll (rest coll)))

20:19 lazybot: ⇒ ((1 2) (2 3) (3 4) (4 5))

20:19 budu: amalloy: nice one

20:37 cgray: btw, i submitted a patch through jira a few weeks ago that doesn't seem to have been noticed... is there anything i should do to change that? it's http://dev.clojure.org/jira/browse/CLJ-873

20:57 hiredman: cgray: http://dev.clojure.org/display/design/JIRA+workflow

20:58 cgray: hiredman: I've seen that, I don't know what I'm missing from it.

20:58 hiredman: cgray: your issue is in an "open" state, which means a member of clojure/core has not yet looked at the issue and decided it is a real issue

20:58 so you can go on the clojure-dev mailing list and try to get the attention of someone from clojure/core

20:59 cgray: ok, sounds like a plan

20:59 hiredman: at which point it will most likely sit in the vetted backlog until a clojure commiter (smaller group than clojure/core) decides it should be in the next release

21:00 at which point someone will look at the patch and decide if it is "good"

21:00 if it is "good" and rich oks it, it goes in

21:04 dnolen: cgray: I can't imagine that ticket getting high enough priority to be considered in anytime soon. When Clojure was simpler and rhickey was working on it all the time, patches were applied pretty quickly. Things are pretty slow these days.

21:05 cgray: dnolen: that's the way it seems... i'm only a little worried that the patch will become out of date if it sits for too long

21:06 dnolen: cgray: well it's a simple patch, so going out of date isn't such a big deal. it's your ticket and you can keep it up to date.

21:23 devn: cemerick: you around?

21:23 cemerick: devn: only notationally; what's up?

21:24 devn: cemerick: I was thinking about the volume of messages on the Clojure mailing list, secondary sources like disclojure, planet.clojure.in etc.

21:24 Raynes: Hah.

21:26 devn: I suggested to the rubyinside guy (Peter Cooper) that he should do some sort of week or month in review of the ML, up-and-coming projects, interesting ideas, IRC snippets, etc.

21:26 zakwilson: It seems like transitioning from one guy's project that a few people contribute patches for to a big community thing might be a tricky process.

21:26 devn: Mostly Lazy seemed like it might be a good place for that. Honestly if someone went through and gave me a podcast or screencast digest would be great.

21:27 d'oh. cemerick left me :(

21:28 blech -- I can't write coherent sentences. :\ I guess what I'm saying is, if someone spent the time to give a human-edited abridged clojure and/or clojure-dev ML that is something I would pay a subscription to.

21:41 ihodes: amalloy: horrible mistake there (for in lieu of doseq), but unfortunately that wasn't it

22:34 gtrak``: it's not so hard to keep track of all that, is it?

22:35 there's a 'today in the intertweets' somewhere

22:36 disclojure's rss feed has a little summary every day

22:38 so you want kind of what michael larabel does with phoronix?

22:39 he keeps track of all the mailing lists and writes articles from time to time, it's an interesting thought

22:40 I think he's making a living off of ad revenue

22:53 devn, i like the idea, seems like disclojure is where it should live

22:56 tbatchelli: gtrak``, devn: I am open to new contributors to disclojure :)

22:57 keeping track of everything is a lot of work though

23:44 amalloy: dnolen: updated my cljs patch just now. letting you know, since jira didn't email me when you commented and maybe it doesn't email you either?

23:45 dnolen: amalloy: cool, yeah I'm not sure when JIRA emails and when it doesn't

23:46 amalloy: thx, that looks great

23:47 amalloy: so far my experience has been: email me when anyone, including me, does something on any ticket ever; except the one time i don't bother checking back in because it always emails me

23:56 dnolen: amalloy: patch applied

23:57 amalloy: excellent, thanks

Logging service provided by n01se.net