#clojure log - Aug 10 2011

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

1:45 ibdknox: I added remote calls to pinot :)

1:46 so you can essentially make a call in clojure script and have noir return the result to you

2:16 callen: so uh, is github freaking out or what?

2:16 leiningen's self-install is failing because the jar link 404s.

2:16 Failed to download https://github.com/downloads/technomancy/leiningen/leiningen-2.0.0-SNAPSHOT-standalone.jar

2:18 amac: https://github.com/downloads/technomancy/leiningen/leiningen-1.6.2-SNAPSHOT-standalone.jar

2:18 think you just had a bad link, that seems to be the most up-to-date posted jar

2:19 hiredman: callen: there is 2.0.0-SNAPSHOT, so a 404 sounds right

2:19 depy: dudes, what IDE / editor do you prefer for clojure? I tried out compojure in eclipse and it had some issues, I didn't really like the one in netbeans, vim clojure is cool but I have to start nailgun server everytime i use it :S

2:19 amac: depy: emacs+slime

2:20 callen: that seems to have fixed it.

2:20 depy: emacs => <3

2:21 depy: hm.. I really like vim, and I finally learn it a bit

2:21 is it really worth switching to emacs? :D

2:21 callen: depy: yep.

2:21 depy: gimme few reasons :)

2:21 ibdknox: if you use lein ngserver nailgun is fine

2:21 callen: depy: just today, I opened a zip file in emacs, it seamlessly allowed me to edit the files within the zip without any manual unpacking/repacking of the zip of any sort.

2:22 amac: not really, both take a long time to master -- learning both is not as useful as learning one really well

2:22 ibdknox: callen: you can do that in vim too

2:22 callen: depy: if the indentation is broken in a python file, I can call untabify on the buffer and rectify all indentation instantly.

2:22 depy: ibdknox: Explain more? I tried leiningen yesterday so I'm not that experienced with ii... :)

2:22 callen: ibdknox: I'm sharing my personal experiences, not attempting to be authoritatively exclusive.

2:22 depy: and besides, slime.

2:22 depy: / swank

2:23 depy: I heard about those two but have no idea what they do :D

2:23 callen: ibdknox: also, Tramp beats netrw on vim by far.

2:23 ibdknox: netrw sucks.

2:23 ibdknox: callen: I don't think I've ever actually used it lol

2:23 callen: ibdknox: ido-mode is peerless for letting you breeze through things.

2:23 depy: And yes, feel free to explain. Few different oppinions won't kill anybody... :)

2:24 callen: ibdknox: the unified one-true elisp is fantastic and lets all emacs users share code.

2:24 ibdknox: lol

2:24 why are you telling me this? :)

2:24 callen: ibdknox: as opposed to vim extensions being variously vimscript, python, ruby, c, etc.

2:24 ibdknox: you're the thomas.

2:24 ibdknox: the thomas?

2:25 callen: ibdknox: google "doubting thomas"

2:25 ibdknox: lol

2:25 I'm more than well aware of what emacs can do

2:25 I also know what VIM can do

2:25 * amalloy chimes in to support emacs against its flood of detractors

2:25 amalloy: because i'm just sick of #clojure being full of nothing but emacs-haters

2:26 ibdknox: and it mostly comes down to preference and which one you learn first :)

2:26 amalloy: lol

2:27 amalloy: ibdknox: i'm not sure that's true. i hobbled my way with vim for like four years, barely knew how to copy/paste. obviously there's a lot more you *can* do, but it was never easy to learn. emacs took an effort to learn, but the path and the motivation were there, and i was outpacing my vim skills in two weeks

2:27 depy: what about plugin/extension installing? I don't like the vim style with all the files and editing vimrc ...

2:27 amalloy: depy: if you want an extensible text editor, you have to be willing to edit text files :P

2:27 ibdknox: amalloy: I'm not sure I understand that argument? Emacs has a lower initial learning curve but a longer overall time to master

2:28 callen: ibdknox: you're right about it coming down to what you learn first, but you're fortunate if the first you encounter is Emacs.

2:28 hiredman: you can tell emacs is a serious editor because it runs as part of its own build process

2:28 ibdknox: vim has an extremely steep initial curve and then levels off

2:28 callen: ibdknox: and doesn't go much further than that.

2:28 amalloy: eclipse, for example, is superb for installing plugins, depy. but if you want something that's not already in a plugin...

2:28 callen: ibdknox: and any of its advantages can be encapsulated in viper or vi-mode.

2:28 ibdknox: all the other power is exclusive to Emacs.

2:28 ibdknox: lol

2:28 dogmatic much?

2:29 callen: ibdknox: it merits it.

2:29 hiredman: I used to use vim, and then had to switch to emacs for work, and it's just better

2:29 amalloy: in emacs, and presumably in vim, you can write up a new feature you want without much trouble and just slap it in your .emacs

2:29 * depy is a flamewar starter... O_ô

2:29 ibdknox: depy: haha apparently

2:29 amalloy: depy: well, you asked about editors. it's a touchy topic, for reasons that are not really hard to understand, and people love to argue about it

2:29 ibdknox: I was unaware that I was somehow offending emacs folks by saying VIM is a capable editor

2:30 I will be shunned from #clojure now

2:30 depy: :)

2:30 amalloy: ibdknox: vim is a capable editor. it would be my third choice for java, and second choice for anything else

2:30 scottj: storing new features that are compositions of other features is arguably easier and more obvious in VIM since the code for the feature looks like what you type whereas in emacs it looks like the function names of what you type

2:31 granted they may be more maintainable/robust in emacs

2:32 callen: scottj: in Emacs, any code I write, or that someone else writes, can always be understandable and usable.

2:32 scottj: in vim, the plugins can be any number of languages or extension methods.

2:33 amalloy: callen: that seems like a bizarre argument

2:33 callen: amalloy: it's pretty important, I share the elisp I write with other emacs users in my area.

2:33 amalloy: and I get stuff from them too.

2:33 amalloy: you can add an interpreter for any language to your .emacs, and write your extension in that

2:33 scottj: callen: I wasn't clear, I meant keymacros/bindings

2:36 I think on strictly text-editing features stock VIM beats stock emacs with more advanced movement (separate beginning/end of word movement), replacement, etc commands

2:36 amalloy: i guess i don't know what vim extensions look like, so i half-withdraw my claim of absurdity

2:36 scottj: on # of email/irc clients, emacs is the clear winner

2:40 callen: scottj: viper mode has all the movement/editing commands that vi mode does, including the various modes such as visual/insert/command, and others

2:40 scottj: callen: by easier and more obvious I mean :bind ,a "add3jj" (whatever hte syntax is) vs (defun my-user-function () (move-char 1) (kill-to-end-of-line) (move-point (char-min)) (next-line)) (global-set-key (kbd ....) my user-fn)

2:40 callen: scottj: so, emacs can do anything vim can editing wise, and it can do everything else better.

2:41 scottj: also the various programming language specific modes are remarkably powerful compared to what vim offers.

2:41 scottj: use of the erlang mode for Emacs will make that very clear.

2:41 depy: I installed emacs

2:42 callen: scottj: I have a Python environment, which is common to many Python programmers that use Emacs, that literally has a Python process running that is always evaluating my python code so that it can provide hints and follow variables to their definitions.

2:42 depy: C - f,b,p,n = wtf

2:42 callen: depy: not really what you usually use

2:42 depy: usually you'll use ace-mode-jump or search to navigate.

2:42 depy: my C-f is actually bound to ace-mode-jump.

2:42 depy: I'm going trough tutorial

2:43 Am I suppose to have 20cm fingers to move around a file? :D

2:43 callen: depy: good good, do the tutorial.

2:43 scottj: callen: I think some language's syntax highlighting is superior in vim

2:43 callen: scottj: not been my experience, but at least with emacs all the code is elisp including the built-ins so anything is changeable.

2:44 depy: no no, you'll learn to navigate in a more natural manner after you do the tutorial.

2:44 ibdknox: lol

2:44 depy: I hope so... :)

2:44 callen: scottj: only the core is C, such as the engine for elisp.

2:44 ibdknox: this is getting a bit ridiculous

2:44 scottj: callen: actually a ton of it is C

2:44 callen: scottj: not at all

2:44 scottj: about 20-30% is C

2:44 scottj: 3/4s is Elisp

2:44 scottj: callen: I've tried editing various faces/graphics stuff and most oft hat is C

2:45 callen: scottj: if you measure by LOC

2:45 depy: I think the topic of this channel should include: Don't ask about editors...

2:45 callen: scottj: well of course the graphics layer is C, but i'm not what you tried to change that was C. Virtually everything you could *imagine* is exposed, and as for faces, it supports xft and everything else.

2:46 scottj: callen: I wanted to add a pulsating cursor and cool animations when it moves :)

2:47 callen: my refuation was only that more than elisp engine was C

2:47 lots of the core movement functions are also C

2:48 amalloy: depy: "if you ask about editors, the response will be a spirited discussion that you don't care about and are not involved in"

2:48 callen: scottj: it's a text editor, not a video game.

2:49 amalloy: a little more clear. feel free to ask about editors if you enjoy starting spirited discussions

2:49 scottj: callen: tel that to M-x tetris

4:08 leo2007: what's the best way to get documentation?

4:08 ie something similar to common lisp's hyperspec?

4:10 opqdonut: clojuredocs.org is pretty nice

4:10 also, (doc doc)

4:10 jsoft: Is there some giant downloadable docs .tar.gz thing or something for java api/classes?

4:11 opqdonut: well yes, there are the javadoc docs of the standard library

4:11 which you can most probably download from wherever you downloaded your jdk

4:12 jsoft: hmm

4:12 leo2007: opqdonut: thanks. for offline reference?

4:12 opqdonut: well there's the doc macro which you can use in the repl. also there might've been a way to generate html pages of docstrings

4:13 but I don't know the details

4:13 leo2007: ok

4:36 jsoft: Why cant I seem to find an offline docs thing for java/clojure on debian :\

4:39 raek: jsoft: you can clone the ghpages branch of the clojure git repo to get the clojure api in html form: https://github.com/clojure/clojure/tree/gh-pages

4:40 I think the javadoc should be available as a debian package somewhere

4:41 clojure api zip: https://github.com/clojure/clojure/zipball/gh-pages

4:42 jsoft: Ahh thanks.

4:42 * jsoft looks

4:47 leo2007: any idea why there are two defs of throw-to-toplevel in src/swank/commands/basic.clj

5:14 fhd: Is defrecord considered depreacted?

5:14 amalloy: no

5:14 fhd: amalloy: OK, read that somewhere

5:14 kumarshantanu: fhd: did you mean defstruct?

5:15 fhd: kumarshantanu: The guy in the article might have meant that, yeah

5:15 kumarshantanu: defrecord is the new thing that's supposed to be used

5:16 fhd: kumarshantanu: OK, thanks

5:16 amalloy: fhd: defrecord *is* not recommended unless you have a compelling reason to use it. don't just use it because it's a great way to pretend you're doing OOP

5:23 fhd: amalloy: Well, we do need a "type" at this point, so I'd rather not use a map

5:23 amalloy: How is that typically handled in Clojure?

5:23 brb

5:24 amalloy: $google cemerick blog flowchart type clojure

5:24 lazybot: [Flowchart for choosing the right Clojure type ... - cemerick] http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/

5:24 amalloy: that's all from me. g'night

5:26 depy: so, basically if u want something like classes but wont use polymorphism and you won't interact with java , the best option is map? :)

5:35 fhd: amalloy_: Nice, thanks :)

5:42 tufflax: depy yes, but records can also be used as maps, so u can make a map into a record later with minimal problems. Also, you can get polymorphism with maps too through multimethods

5:42 depy: oh right

5:43 so protocols = polymorphism for records and multimethods = polymorphism without records?

5:44 I'm not that far with clojure actually :D so maybe i'm mistaken

5:44 raek: protocols = single type dispatch polymorphism with grouping of methods

5:44 depy: blah.. time to google :D

5:44 raek: multimethods = arbitrary dispatch without grouping of methods

5:46 depy: have you seen this video by Stuart Halloway: http://vimeo.com/11236603

5:47 depy: not yet

5:47 tnx, will look at it when I come home.. :)

6:47 callis: FYI: "Procedural Programming with Clojure in Max" - http://cycling74.com/2011/08/08/programming-with-clojure-in-max/

8:37 dnolen: I don't suppose there's a simple way to get ClojureScript objects printing sensibly in the browser console?

8:52 chouser: pr-str might be close

9:10 timvisher: hey all

9:11 i'd like to transform every seq? in a map to a set, with potentially none of the values actually being a seq?, is there an easy way to do that?

9:18 ''(zipmap (keys {:x ["a" "b"] :y "c"}) (map #(if (sequential? %) (into #{} %) %) (vals {:x ["a" "b"] :y "c"})))

9:18 '(zipmap (keys {:x ["a" "b"] :y "c"}) (map #(if (sequential? %) (into #{} %) %) (vals {:x ["a" "b"] :y "c"})))

9:18 \,(zipmap (keys {:x ["a" "b"] :y "c"}) (map #(if (sequential? %) (into #{} %) %) (vals {:x ["a" "b"] :y "c"})))

9:19 bah

9:19 can't remember how to access the bot

9:19 ambrosebs: just a comma isn't it?

9:19 timvisher: ,(zipmap (keys {:x ["a" "b"] :y "c"}) (map #(if (sequential? %) (into #{} %) %) (vals {:x ["a" "b"] :y "c"})))

9:19 clojurebot: {:x #{"a" "b"}, :y "c"}

9:19 timvisher: yay!

9:19 anyway, that's about what I want

9:19 I just need it for a json interface anyway

9:19 so i'm only concerned with vectors becoming sets

9:20 leonid__: if none of the values are actually a seq, why are you testing if they are sequential?

9:20 timvisher: my problem is that i'm bringing in a JSON param and I would like all the lists to become sets.

9:21 are you saying I could be even more specific?

9:21 sometimes, though, the input won't have any lists in it

9:21 just some string or number values

9:21 in that case, I'd like the code to still run fine

9:24 manutter: what's wrong with the solution you just posted?

9:26 timvisher: manutter: seems verbose?

9:26 nothing really, I suppose

9:26 it even avoids the case of thinking a string is a sequential, which is nice

9:26 I thought i'd have to do some special logic for that

9:27 figured it might be something that's common enough that there's a special function for it, like update-in

9:27 etc.

9:27 manutter: hmm, does sound plausible

9:29 I'm not finding anything on clojuredocs tho

9:29 timvisher: i didn't either, hence the question

9:30 i'm famously incapable of using the internet. :)

9:32 cemerick: timvisher: There's all sorts of "mapmap" fns floating around. e.g. http://tech.puredanger.com/2010/09/24/meet-my-little-friend-mapmap/

9:32 timvisher: cemerick: nice!

9:33 hadn't found those yet

9:33 i guess it's not something that clojure-core thinks is common enough to include in the core libraries?

9:33 cemerick: if you search for "clojure mapmap" (avoiding google's unhelpful mangling of your query), you'll find a bunch of different variations.

9:34 Scriptor: I guess you'd have to make sure kf is one-to-one

9:35 cemerick: If a single, obviously superior implementation with sane semantics emerged, that might have a better shot of getting into core.

10:29 choffstein: Would anyone mind taking a look at this gist (https://gist.github.com/1136913)? I've been getting an error whenever I try to use that file as a library to another project: "Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol (core.clj:8)"

10:30 However, running a "lein install" for the project is fine -- no errors. Just when I try to use it as a library within another project.

10:32 ejackson: choffstein: try putting the dependencies into [ ... ].

10:33 so something like (:use [clojure.tools.logging]

10:33 [clj-logging-config.log4j :only logger]) etc

10:33 just guessing here though

10:33 choffstein: Thanks for the thought, but that doesn't seem to be the problem...

10:34 It doesn't seem to like the :only

10:34 ejackson: try put logger in [] :)

10:34 choffstein: …yeah, that just hit me :)

10:35 now I get "logger does not exist".

10:37 Oy. Well, that's better, I suppose

10:37 raek: choffstein: lein install does not AOT compile the source by default. this is why you got the error when you first used the lib.

10:37 choffstein: that makes sense

10:39 malcolmsparks' clj-logging-config is not playing very nice with me

10:42 seems getting rid of :only logger just did the trick. Going through the source, :only logger doesn't make much sense anyway...

11:00 solussd: what's more idiomatic clojure- (apply + …) or (reduce + ….) ?

11:00 tufflax: How do I create an inputstream form a string of contents, not a filename?

11:00 s/form/from

11:00 lazybot: <tufflax> How do I create an inputstream from a string of contents, not a filename?

11:01 tufflax: solussd not sure, apply maybe, since it looks a little bit simpler

11:01 I don't think it matters that much :p

11:01 solussd: k

11:01 :D

11:01 tomoj: tufflax: using clojure.java.io?

11:01 tufflax: possibly

11:02 tomoj: (clojure.java.io/input-stream (.getBytes "foo"))

11:02 IOFactory has an implementation for byte arrays

11:02 tufflax: ok, thank you

11:09 choffstein: another day of smashing my face against the keyboard...

11:19 jweiss: when i run (future (throw (Exception. "oh no"))) either in repl or within a running clojure program at the terminal, the exception never shows up anywhere in stdout. is there a reason, or way to change that?

11:19 not sure what happens to unhandled exceptions in future's internals

11:28 ah looks like it's thrown on deref, i guess that makes sense.

11:29 my future was side-effecty so i hadn't bothered to deref it

11:33 choffstein: Anyone seen this error before: "Caused by: java.lang.NullPointerException

11:33 at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)

11:33 at clojure.lang.Namespace.find(Namespace.java:188)"

11:33 Whoops … sorry for the multiple lines there

12:08 replaca: choffstein: that's what happens when you pass nil to find-ns

12:10 (or in-ns and probably some others as well)

12:14 manutter: Any Eclipse/CCW users around? I'm curious how the everyday workflow goes re: adding external libs (compojure) as dependencies etc

12:14 Or do you just stick with lein?

12:15 technomancy: making your build depend on eclipse is really a bummer if you are ever going to be not the only programmer on the project

12:15 not that I'm biased or anything

12:16 manutter: oh, there's some other editor you like better? :D

12:16 I'm fine with lein/emacs actually

12:17 just curious about how people are using other environments.

12:17 technomancy: well that's just the point; the editor must be totally orthogonal to the build process

12:17 wunki: technomancy: what's your opinion about vim? (not trying to start a flame)

12:18 technomancy: it seems pretty nice except for vimscript

12:18 wunki: I switched from vim fairly recently because of your emacs setup

12:19 technomancy: cool

12:19 wunki: but I do miss it sometimes though :)

12:20 technomancy: anything specific or just generic homesickness?

12:23 jaley: protip - don't hit C-x C-s in vi...

12:23 dnolen: ClojureScripters, has there been any talk of: (cljsc/build "src" {:output-to "foo.js" :watch true})

12:23 where watch simply polls for changes in the directory, say every 1/4 of a second or something?

12:26 ejackson: dnolen: I thikn abedra achieved that effect with a linux command.... digging.

12:28 dnolen: ejackson: it seems preferable to do that for that to work in the REPL because of compilation times.

12:29 ejackson: yeah, its in the repl, but there is a background process that pings updates... didn't work for me (osx)

12:29 there's this: https://github.com/maxweber/cljs-devmode but its not what I was thinking of

12:30 dnolen: ejackson: hmm seems like it should drop to polling if you're not on Linux

12:31 ejackson: here we go: search the ML for "Minimalist autocompile workflow for ClojureScript"

12:31 technomancy: jdk7 has cross-platform io notification iirc

12:31 or maybe that was 8?

12:31 ejackson: it was alex osburne, sorry.

12:32 hugod: I started a clojurescript minor mode, that hooked into slime to trigger compiles, but haven't found time to complete it

12:32 dnolen: technomancy: jdk7 has that in NIO.2, but jdk7 doesn't have rhino right?

12:32 hugod: ooo

12:33 technomancy: dnolen: oh, no idea about rhino. isn't it available as a jar you can run on any JDK though?

12:33 hugod: dnolen: https://gist.github.com/1103191 was as far as I got

12:37 mattmitchell: i need to call a bunch of methods on a java object, is there a threading operator for that? can't remember what that was?

12:37 manutter: ,(doc doto)

12:37 clojurebot: "([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))"

12:38 mattmitchell: manutter: very nice thank you

12:38 manutter: np

12:53 fliebel: Phew, I'm back. Now I have some time to get ClojureScript to work, and to find out some other things.

12:53 dnolen: fliebel: welcome back!

12:54 ejackson: fliebel: howdy dude.

12:56 wunki: technomancy: sorry, was eating. But I mainly miss vim's speed. It just seems snappier

12:59 fliebel: dnolen, ejackson: Hi

13:00 mattmitchell: what's the best way to invert a map... where the keys become the values and the values become the keys?

13:01 fliebel: dnolen: So I noticed a link suggesting you got the prdicate dispatch working, is that true? What about logos on Clojurescript? :D

13:01 ibdknox: mattmitchell: clojure.set/map-invert

13:03 mattmitchell: ibdknox: great thank you

13:03 wunki: anyone tried the "Seven languages in seven weeks" book?

13:04 manutter: I've been on the first week for the last 2.5 months

13:04 dnolen: fliebel: nope predicate dispatch is a ways off, deep dive into pattern matching at the moment (tho really the difference between pattern matching and predicate dispatch is a static vs dynamic distinction + implication)

13:04 wunki: manutter: who is to blame, you or the book?

13:04 dnolen: fliebel: I'm interested in getting core.logic running on ClojureScript but busy with the match stuff.

13:04 manutter: wunki: My boss. Busy busy busy.

13:04 ibdknox: dnolen: when will match be ready for prime time? there are a couple places in Noir I'd like to use it.

13:05 fliebel: dnolen: goog, good. d'oh, diner time. I was hoping I could stick around longer now :P

13:05 wunki: manutter: are you already familiar with clojure?

13:05 manutter: wunki: the book is good, I recommend it.

13:05 wunki: manutter: ok, will put it on the list!

13:05 manutter: wunki: I've been playing with clojure for a while now, like a year-ish

13:05 wunki: manutter: and you like the language? (since you are in #clojure)

13:05 manutter: Then I have to code in PHP all day and it rots my brain.

13:06 oh yeah, big fan of clojure

13:06 dnolen: ibdknox: probably a few weeks at the soonest. I'd like to see support for :as (arbitrary naming), :when (guards), and Or Patterns.

13:06 ibdknox: dnolen: okidoke. Great work btw.

13:07 wunki: manutter: I'm starting to learn it now. With the "Clojure Programming" book, which is now in "Rough cut"

13:07 dnolen: ibdknox: tho if it already works you feel free to put it up on Clojars under your own namespace.

13:08 manutter: wunki: Yeah, I bought that one too (Rough Cuts, that is)

13:09 wunki: manutter: nice, I'm only dissapointed that it's PDF only. Could use a .epub one

13:10 manutter: That'd be nice.

13:16 arohner: it would be nice if (ns) supported alias, so you can alias other namespaces without requiring them

13:17 that would make some circular require situations easier to deal with

13:19 oh, alias does work, it just doesn't fit the naming convention very well

13:25 mattmitchell: ok, why doesn't this work? (-> ["one"] first (fn [x] (str x "_")) keyword) -- i'm expecting :one_

13:25 ,(-> ["one"] first (fn [x] (str x "_")) keyword)

13:25 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>

13:26 mattmitchell: ,(-> ["one"] first (fn [x] (str x "_")))

13:26 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>

13:26 mefesto: ,(-> ["one"] first (str "_") keyword)

13:26 clojurebot: :one_

13:26 mattmitchell: wow, i need to read the -> docs again :)

13:28 mefesto: it would be like writing this: (keyword (str (first ["one"]) "_"))

13:36 mattmitchell: mefesto: i see, i thought that (str "_") would be evaluated too soon, but i guess since this is a macro it's captured and evaluated when needed?

13:37 manutter: ,(macroexpand '(-> ["one"] first (fn [x] (str x "_")) keyword))

13:37 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>

13:37 manutter: ,(doc macroexpand)

13:37 clojurebot: "([form]); Repeatedly calls macroexpand-1 on form until it no longer represents a macro form, then returns it. Note neither macroexpand-1 nor macroexpand expand macros in subforms."

13:38 manutter: ,(macroexpand-1 '(-> ["one"] first (fn [x] (str x "_")) keyword))

13:38 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>

13:38 manutter: Interesting

13:38 ,(macroexpand-1 '(-> ["one"] first (str "_") keyword))

13:38 clojurebot: (clojure.core/-> (clojure.core/-> ["one"] first) (str "_") keyword)

13:39 manutter: ,(macroexpand '(-> ["one"] first (str "_") keyword))

13:39 clojurebot: (keyword (clojure.core/-> (clojure.core/-> ["one"] first) (str "_")))

13:39 manutter: ,(macroexpand-all '(-> ["one"] first (str "_") keyword))

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

13:43 fliebel: Has anyone tried Jiraph on CouchDB? Masai has memcached support, and Couchbase has memcached.

13:54 sritchie: hey all -- does anyone have any advice on how to access a file in the resources directory from code, once a project's been uberjarred?

13:55 technomancy: sritchie: clojure.java.io/resource

13:55 sritchie: great, thanks

14:01 fliebel: Raynes: ping!

14:02 Scriptor: any rumors on the next clojurenyc meetup?

14:02 I think I can make this one

14:07 dnolen: Scriptor: hmm maybe I should present match there.

14:08 Scriptor: dnolen: dude, that'd be perfect

14:08 technomancy: are those generally recorded, or is it only in special cases?

14:09 dnolen: technomancy: special cases I think

14:16 ordnungswidrig: hi all

14:16 Scriptor: hello

14:17 technomancy: well match is more interesting to me than clojurescript; maybe this could be considered a special case. =)

14:17 hiredman: ditto

14:17 fliebel: (inc technomancy)

14:17 lazybot: ⟹ 1

14:18 * technomancy realizes the whole "someone else please do a lot of work for me that you won't personally benefit from" is not really a viable strategy

14:18 ordnungswidrig: (dec |)

14:18 lazybot: ⟹ -1

14:18 ordnungswidrig: (inc -1)

14:18 lazybot: ⟹ 1

14:18 ordnungswidrig: huh

14:19 Scriptor: dnolen: send an email to Thorsen, he's mentioned that trying to find speakers has been a huge time-sink

14:19 fliebel: $mail Raynes I saw you wrote the Memcached backend for Masai. I would like to make that work nicely with Jiraph and CouchBase, where to start?

14:19 lazybot: Message saved.

14:20 fliebel: ordnungswidrig: That command is like Karma, not actual Clojure.

14:20 ordnungswidrig: *dow*

14:21 Aquamacs users, is there a way to set the path to the lein binary for clojure-jack-in?

14:22 technomancy: ordnungswidrig: you can set clojure-swank-command

14:22 it's not tested on aquamacs

14:22 but it might work

14:23 ordnungswidrig: technomancy: is it customizable or setq-able?

14:24 technomancy: should work with setq

14:26 ordnungswidrig: technomancy: seems to work

14:26 * fliebel thinks CERN should use Clojure. Expected assembly, R and Prolog. actual: Python

14:28 manutter: heh, I'm just reading on slashdot about CERN enlisting the help of LHC@home to help look for the Higgs boson.

14:31 ordnungswidrig: cacalog might by a good fit as well

14:31 s/ca/&s/

14:31 lazybot: <ordnungswidrig> &s&slog might by a good fit as well

14:32 ordnungswidrig: s/^ca/\0s/

14:32 manutter: we know what you mean :)

14:38 dsantiago: What is the problem with :use that people keep talking about on the mailing list?

14:40 manutter: if you use ":use" without an ":only" clause, you may get more than you intended, and might pollute your namespace

14:41 Scriptor: only use :use with :only

14:42 thorwil: too bad there's a with in that statement

14:43 manutter: use :use with :only only

14:43 It's like a palindrome

14:43 sideways, sorta...

14:43 ibdknox: lol

14:44 so in fact not a palindrome ;)

14:44 manutter: we live in an imperfect world.

14:44 ibdknox: it's true :D

14:44 wastrel: a man a plan a canal panama

14:45 manutter: Able was I ere I saw PHP.

14:45 or Elba, whatever.

14:45 wastrel: bilbo

14:46 that's what smaug says

14:46 able i was ere i saw bilbo

14:46 manutter: ok, that's going on a T-shirt as soon as I can get to CafePress and some clip art.

15:23 amalloy: mattmitchell: (-> ["one"] first (fn [x] (str x "_")) keyword) expands to (fn (first ["one"]) [x] (str x "_"))

15:25 mattmitchell: amalloy: thanks! I should start using macroexpand to get a better understanding of what they're doing under the hood

15:53 pyr: hi

15:56 so I wrote a nice small DSL in clojure for an internal project, now I would like the files to be loaded dynamically

15:56 so I used find-namespaces-in-dir

15:56 which works great if the DSL files are bundled inside a project

15:57 now let's say I want to make that directory configurable and potentially outside of the project's resources

15:57 find-namespaces-in-dir breaks

15:58 ibdknox: it breaks?

15:58 pyr: hey ibdknox :)

15:59 ibdknox: pyr: hey :)

15:59 ordnungswidrig: pyr: in which way does it breake?

15:59 pyr: yeah, complains about not being able to find namespaces

16:00 well, for the sake of example, let's say I name my ns 'project.dyn.foo'

16:00 I store it in a /tmp/dyn/foo.clj

16:00 ibdknox: ah

16:00 ordnungswidrig: pyr: then you're missing a "project/"

16:00 ibdknox: yeah

16:00 ordnungswidrig: pyr: I guess

16:01 ibdknox: pyr: the dir structure is rigid as far as I know

16:01 pyr: where the root of that structure is located doesn't matter

16:01 so long as it's on your classpath

16:01 pyr: but it's not

16:02 /tmp cannot be on my classpath

16:02 but I see your point

16:02 ibdknox: ,(doc load-file)

16:02 clojurebot: "([name]); Sequentially read and evaluate the set of forms contained in the file."

16:03 arohner: ibdknox: how do you feel about this? https://gist.github.com/1138051

16:03 pyr: ibdknox: yep, i guess i'll have to resort to that

16:04 ibdknox: arohner: I don't think I want to get away from the normal destructuring stuff

16:04 arohner: it's hard enough to understand

16:05 arohner: ibdknox: ok. I'm trying to find ways to eliminate boilerplate

16:05 ibdknox: arohner: absolutely

16:06 arohner: seems like every page I have, it's (my-model/find-one :where {:id (Integer/parseInt id)})

16:06 ibdknox: yeah

16:06 arohner: my current implementation doesn't replace normal destructuring

16:06 it just sticks an extra let around ~@body

16:07 ibdknox: let's say you wanted to catch that exception, how would you do it?

16:07 arohner: true

16:07 it'd have to be in the multimethod, or not at all

16:07 or a middleware

16:08 ibdknox: middleware seems wrong to me for that

16:08 though that's just a knee jerk reaction

16:09 arohner: about a year ago I tried to do this, with the coercion being a middleware. didn't work very well because I needed access to the fn that was going to be called

16:09 and required hacking up compojure to separate "identify the route that matches" from "call the route that matches"

16:09 ibdknox: yeah

16:10 as a side note

16:11 not really related, I guess, but you could at least have the route ignored by using a regex for the route param

16:11 Generic_Dumbass: so, what's the weirdest clojurescript code so far that compiles properly?

16:11 ibdknox: that doesn't solve the boilerplate issue

16:13 ordnungswidrig: what is best practice when using slime and protocols. When I C-c C-k a buffer with a protocol then all implementations are void and I must load all other ns using that procotol.

16:14 dnolen: ordnungswidrig: yup

16:14 ibdknox: Generic_Dumbass: I'm not sure I understand your question. What's the weirdest clojure code that CLJS compiles properly?

16:15 ordnungswidrig: I like protocols but they are a little undynamic

16:15 dnolen: ordnungswidrig: yup

16:15 technomancy: what has worked well for me so far is not using protocols

16:15 ibdknox: lol terseness ftw

16:15 technomancy: well, not writing my own protocols anyway

16:15 ibdknox: (inc dnolen)

16:15 lazybot: ⟹ 1

16:15 ordnungswidrig: I try to stay away as well

16:17 dnolen: it's awesomer than writing Java, but not awesomer than writing pure Clojure.

16:17 ibdknox: dnolen: I wonder what we should do to espouse that wisdom to people

16:17 dnolen: sticking with the dynamic side of Clojure I mean

16:17 ordnungswidrig: Do you consider this a valid use case: I want to specify a file name encoding scheme such that I can build a file name for a certain ID and parse the ID from a certain file name. I used (defprotocol NamingScheme (file->id [this file]) (id->file [this id])

16:17 ibdknox: those coming from imperative backgrounds (most) will always see those and go "ooooo"

16:17 dnolen: ibdknox: I try my best, but people see them and "Oooh shiny OOP stuff"

16:18 heh yeah

16:18 technomancy: ordnungswidrig: anything involving files is probably going to be I/O bound, hence multimethods are probably never going to be a bottleneck

16:18 dnolen: (inc technomancy)

16:18 lazybot: ⟹ 2

16:18 ordnungswidrig: technomancy: are multimethods more dynamic in the above sense?

16:18 ibdknox: are multimethods particularly slow?

16:18 hiredman: clojure is pretty static for a dynamic language

16:18 ordnungswidrig: I like that procotols define a set of related functions

16:19 hiredman: all name resultion is done at compile time

16:19 technomancy: ordnungswidrig: yes, there is only one gotcha/bug, and that is that you can't change the dispatch function without undefing it first.

16:19 keep that in mind and you will do fine

16:19 ordnungswidrig: hiredman: java is pretty dynamic for a static language

16:19 dnolen: ibdknox: depends on how complicated your dispatch is

16:19 hiredman: ordnungswidrig: and?

16:19 technomancy: only once you profile it and determine multimethods are a bottleneck should you switch to protocols

16:19 hiredman: ordnungswidrig: I mean, who said anything about java?

16:19 ibdknox: dnolen: fair enough

16:20 technomancy: ibdknox: they are a lot harder for hotspot to inline

16:20 for extremely tight loops

16:20 ordnungswidrig: technomancy: nice hint. I think I've been bitten by that one before

16:20 ibdknox: ah

16:20 that makes sense

16:20 technomancy: ordnungswidrig: it's annoying; they did the right thing in earlier versions of clojure, but I think this regression was intentional. =(

16:21 ordnungswidrig: hiredman: I mean, clojure *is* that static because the jvm somewhat enforces this.

16:21 technomancy: ordnungswidrig: one solution is to just have (def mymulti nil) (defmulti mymulti [...])

16:21 which is hideous

16:21 ordnungswidrig: technomancy: hmm, (defmacro redefmulti ….)

16:21 hiredman: ordnungswidrig: no

16:21 technomancy: ordnungswidrig: that works too =)

16:21 hiredman: var resolution could easily happen at run time

16:21 ordnungswidrig: hiredman: but?

16:22 hiredman: it doesn't

16:22 ibdknox: lol

16:22 hiredman: because rhickey didn't want to

16:22 ordnungswidrig: hiredman: I know. But why?

16:22 hiredman: you'd have to ask him

16:22 I imagine his anwser would be preformance

16:22 ordnungswidrig: My guess is that is was because of limitations^h^h^h^h^hproperties of the jvm

16:22 hiredman: no

16:22 not true

16:23 as I said you could easily do it at runtime on the jvm

16:23 ordnungswidrig: …regarding performance

16:23 pyr: ibdknox: while you're here, https://github.com/pyr/noir/commit/65da23991b548ffdcefbfb83b4794aa08c5a0cee

16:23 ibdknox: nitpick, really

16:24 ibdknox: pyr: hm, I can't remember why I did it that way

16:25 ordnungswidrig: hiredman: don't get me wrong. I see that the current implementation is "valid" and at a sweet spot regarding the forces working on it. I just wondered.

16:25 dnolen: ordnungswidrig: Clojure has become consistently less dynamic by default, while retaining dynamic escape hatches.

16:26 ordnungswidrig: dnolen: like the change regarding declaring dynamicity [sic?] explicitely?

16:26 dnolen: ordnungswidrig: tho I don't see how you can protocols dynamic w/o invokeDynamic or something like that.

16:26 ibdknox: pyr: can you send a pull request to the vnext branch for that?

16:26 pyr: ibdknox: sure

16:27 ordnungswidrig: btw. is there migration chart regarding the functions in monolitic contrib and modular contrib?

16:27 dnolen: ordnungswidrig: also numeric changes

16:27 ordnungswidrig: dnolen: isn't invokeDynamic just arrived in jdk7?

16:27 dnolen: ordnungswidrig: yes, but Clojure solidly support JDK 7, ClojureScript might help move that needle.

16:27 ordnungswidrig: dnolen: that was what I stumbled upon first.

16:27 pyr: ibdknox: done

16:27 dnolen: support JDK 5 I mean

16:28 ordnungswidrig: (defn current-file [{dir :dir naming :naming rotate-after :rotate-after iteration :iteration :as rotator}]

16:28 (file-for-id naming dir (- iteration (mod (dec iteration) rotate-after))))

16:28 ups, sorry

16:28 pyr: ibdknox: vnext is the dev branch ?

16:29 ibdknox: pyr: yeah, it's where 1.1.1-SNAPSHOT is coming out of

16:29 although

16:29 with the changes I've been making lately

16:29 ordnungswidrig: back to the protocol-redifinition problem and slime… is remove-ns a safe workaround?

16:29 ibdknox: I think the next official will be 1.2.0

16:29 pyr: ibdknox: 'k yeah you're pushing cljs in there too

16:30 ordnungswidrig: pyr: using reduce for wrappers seems to be a common theme, recently.

16:31 hiredman: ordnungswidrig: no

16:31 it has nothing to do with the namespace

16:31 pyr: ordnungswidrig: how so ?

16:32 ordnungswidrig: pyr: I think I saw it the other day. And I wrote the same code today :-)

16:32 pyr: ahah, great

16:32 lobotomy: hey guys, what's a good way of doing debug printing in the middle of clojure code?

16:33 ordnungswidrig: hiredman: ah, I was a little vague. To be able to C-c C-k the buffer I needed to remove-ns to avoid an error about an existing alias

16:33 dnolen: lobotomy: middle of what?

16:33 lobotomy: in my java thing i just do if(DEBUG) System.out.println("whatever"); in the middle of everything, but that's ugly even there :)

16:33 ordnungswidrig: lobotomy: clojure.contrib.true used to be a good way

16:33 arohner: lobotomy: https://gist.github.com/1138179

16:34 ordnungswidrig: (let [a 1 b 2] (* (trace "a" a) (trace "b" b))

16:34 pyr: ordnungswidrig: ah, but you're the one who replied on my article :)

16:34 ordnungswidrig: pyr: so you're the one who wrote that article :-)

16:35 arohner: oh, I didn't know about trace

16:35 that's nice

16:35 lobotomy: arohner, that looks like exactly what i need, cheers

16:35 the trace one is more complicated to use isn't it?

16:36 arohner: I think trace works the same way, and is built-in

16:36 the nice thing about the macro is you can put it around arbitrary expressions, and it tells you which expr is being printed

16:37 (inspect (foo)) (inspect (bar)), as opposed to (trace "foo" (foo)) (trace "bar" (bar))

16:37 ordnungswidrig: arohner: that's a point. And, clojure.contrib.trace is not (yet) ready for 1.3

16:38 but it can also print "call trees"

16:39 lobotomy: hmm, trace isn't built-in though? it seems to be in contrib

16:40 arohner: yes, it's in contrib. I was assuming you were already using it though

16:40 guess I shouldn't, anymore

16:41 lobotomy: i am actually :) just a terminology nitpick heh

16:53 ordnungswidrig: how stable is the support for pr and records in 1.3? Will (read-string (pr-str (ARecord. 1 2 3))) work?

16:54 It works for me at the moment but I don't want to rely it if it might break again

16:59 dnolen: ordnungswidrig: I'd consider them stable at least for 1.3.0, don't see any reason for them to change.

17:07 liquidproof: hello

17:08 is it possible to change the current namespace, like a with-ns macro or something?

17:08 so you can extend core functionality from, say, plugins

17:08 and then swap back to the current namespace

17:08 ibdknox: ,(doc in-ns)

17:08 clojurebot: "([name]); Sets *ns* to the namespace named by the symbol, creating it if needed."

17:08 TimMc: Yes, but that may not be the best apporach for your goal.

17:09 liquidproof: TimMc: why not? : o

17:10 TimMc: Not sure, just feels hacky. I don't know enough to even tell you why, just saying that you might want to wait for others to weigh in. :-)

17:10 ibdknox: is this in the repl?

17:12 liquidproof: nope

17:12 ibdknox: oh

17:12 don't do that then

17:12 liquidproof: yeah, figured so

17:12 but i'd like to just change the namespace for an expression set

17:12 and then swap back

17:12 if that's even idiomatic

17:13 something like a with-ns macro that allows you to extend some other ns

17:13 again, for the sake of ad-hoc plugins

17:13 ibdknox: just use a sub namespce

17:13 namespace*

17:14 mything.plugins.awesome

17:14 liquidproof: hmm

17:14 yeah, maybe that'd be cleaner

17:14 and just contain hook functions

17:14 like event handlers

17:15 ibdknox: or you can register a plugin if you wanted

17:15 have an atom in the plugins.clj with a register function

17:15 then each plugin simply calls and registers itself

17:16 liquidproof: would all the plugin files get loaded?

17:16 even if they're not referenced by other code

17:16 ibdknox: plugins could require all subnamespaces if you wanted

17:17 plugins.clj that is

17:17 liquidproof: oh, yeah, but what's the advantage

17:17 i would still have to have the event handlers there

17:17 ibdknox: sure

17:18 liquidproof: but then i'd have control which plugins to load

17:19 gtrak: I need a with-open that calls an arbitrary method, does it exist?

17:20 ordnungswidrig: gtrak: on exit?

17:20 gtrak: yes

17:20 instead of .clsoe

17:20 close*

17:22 surprised it doesn't exist yet

17:24 ordnungswidrig: writing you own with-open which you can pass an expression on close is not hard.

17:24 technomancy: you can use with-open if you reify an inputstream or some such

17:24 gtrak: hmm...

17:25 so dirty :-)

17:25 i'll try it

17:25 ordnungswidrig: reify might make the code more bloat than using (try … (finally(my-close-expr))

17:25 gtrak: problem is I need it to work on a let binding

17:26 same as these guys: http://groups.google.com/group/clojure/browse_thread/thread/86c87e1fc4b1347c

17:26 ordnungswidrig: (let [h (my-open…){

17:26 ups

17:27 liquidproof: gtrak: you could look up with-open source

17:27 ordnungswidrig: grok: like this? (let [h (my-open…)] (try body… (finally (my-close h)))

17:27 liquidproof: and modify the line with .close to your callback

17:27 or even better pass the argument to the macro and unquote it there

17:27 gtrak: ordnungswidrig, yes exactly, except h is local scope so it doesn't work

17:30 ordnungswidrig: gtrak: (try…) is in the scope of the let.

17:30 gtrak: ah, it's fine unless there's an exception in the let

17:31 ordnungswidrig: in this case you should not need to close, I assumed

17:31 gtrak: ah, probably right

17:32 ordnungswidrig: but it gets ugly as soon as you're wrapping multiple opens. That's what with-open handles for you.

17:34 joegallo: http://download.oracle.com/javase/6/docs/api/java/io/Closeable.html

17:34 just gonna drop that there before you reify inputstream

17:34 gtrak: ya, i saw that

17:35 i think i'll just leave it ugly for now, I'm kind of noobish on protocols and reify still

17:43 hiredman: https://github.com/hiredman/clojurebot/blob/master/src/hiredman/horizon.clj

17:43 ~scope

17:43 clojurebot: scope is at http://paste.lisp.org/display/73838

17:43 hiredman: 2 years and 6 months

17:44 http://dev.clojure.org/jira/browse/CLJ-2

17:49 sritchie: hey guys -- is there a good way to kill a clojure function call, if it takes longer than some set amount of milliseconds to execute?

17:50 technomancy: (.get (future @(promise)) 1000 MILLISECONDS)

17:50 some variant of that

17:50 sritchie: ah, got it

17:50 gtrak: ah, thanks hiredman

17:52 hiredman: sritchie: that won't actually kill it, using a future will let you poll for completion and cancel if it takes too long

17:55 ordnungswidrig: sritchie: killing a thread in java is not cleanely possible from outside. I the function is running in a loop you can set a flag to indicate to exit early.

17:55 sritchie: ordnungswidrig: I'm following url redirects, and looks to bail of the process takes longer than some time

17:59 ordnungswidrig: sritchie: then you can exit early between the redirects. Or maybe you use limit the absolute number of redirects. You can also interrupt the http requests but this depend son the library you use.

18:00 joegallo: right, so i think the idea is to have the thing exit cleanly from the inside if it's taken too long, rather than having something on the outside that is watching it to kill it

18:00 sritchie: ordnungswidrig: yeah, I think I'm going to go ahead and limit the total number, and catch the thrown java.net.ProtocolException --

18:00 that should speed things up enough for now

18:01 ordnungswidrig: I think a maximum of 5 redirects should catch 99% of all valid cased.

18:02 PPPaul: hello

18:02 i'm having trouble with multimethods

18:02 sritchie: ordnungswidrig: great, that's good to know

18:03 PPPaul: i am making a very simple dispatch (boolean) but it's not working. i've tested the dispatch function and it works. would someone be able to help me with this? thanks https://gist.github.com/1138397

18:03 hiredman: ~contains

18:03 clojurebot: contains? is for checking whether a collection has a value for a given key. If you want to find out whether a value exists in a Collection (in linear time!), use the java method .contains

18:04 PPPaul: ok

18:04 i've tested the dispatch method in the repl (contains) and it seems to work as intended

18:04 hiredman: and you'll most likely run into problems with the defonce behaviour of defmulti when changing the dispatch method

18:05 PPPaul: oh?

18:05 i don't intend to change the dispatch method

18:05 hiredman: have you changed it?

18:05 PPPaul: no

18:06 ordnungswidrig: cu all. going to bed.

18:06 PPPaul: i recompile my code when i change things

18:06 hiredman: ,(doc defonce)

18:06 clojurebot: "([name expr]); defs name to have the root value of the expr iff the named var has no root value, else expr is unevaluated"

18:06 PPPaul: um

18:07 when i combine the dispatch function in the defmulti, i get the same behavior

18:08 hiredman: that sentence doesn't parse

18:08 "combine the dispatch function in the defmulti" is nonsensical

18:08 PPPaul: ok

18:09 my multimethod used to have the (contains-transaction? [transactions transaction] (contains? transactions (:TransactionID transaction))) in it

18:09 i think this is related to the defonce you are talking about?

18:11 hiredman: PPPaul: if it is, restart your clojure repl and you should be fine

18:11 PPPaul: um.. ok i'll try that

18:15 srid: there seems to be more than one ways/tools to setup a appengine clojure project. which of them is recommended?

18:15 * srid tried https://github.com/gcv/appengine-magic but 'lein appengine-new' failed to run as there was no such sub-command.

18:18 raek: srid: did you run lein deps?

18:18 (after you added appengine-magic as a dev-dependency)

18:18 srid: raek: i just fixed it; i added it to :dependencies instead of :dev-dependencies (caught while reading http://stackoverflow.com/questions/5613977/lein-appengine-prepare-fails/5614279#5614279 )

18:19 * srid is opening a pull request to clarify this potential confusion

18:22 bortreb: this is random, but does anyone know of a famous programmer who is also blind?

18:23 technomancy: bortreb: T.V. Raman is sorta famous

18:23 or at least the closest I've heard

18:24 pyr: add-classpath is marked as deprecated

18:24 srid: and he works at google, I believe.

18:24 pyr: is there any replacement function that can modify the classpath ?

18:24 technomancy: he wrote emacspeak, and audio frontend to Emacs

18:25 bortreb: thanks!

18:26 srid: bortreb - just curious, why do you ask?

18:29 bortreb: I couldn't imagine how one could do it so I wanted to see an example

18:29 technomancy: probably can't be done without emacs =)

18:29 ibdknox: pyr: when I tried to use add-classpath it failed miserably

18:30 VS also works with screen readers :)

18:30 technomancy: yeah, but it doesn't handle mail and irc =)

18:30 ibdknox: haha fact.

18:34 hiredman: seancorfield: ping?

18:34 pschorf: is there an idiomatic way to start a background task in clojure?

18:35 technomancy: pschorf: future or (doto (Thread. myfn) .start)

18:36 depending on whether you need a value back and whether you want it in a pool

18:36 pschorf: technomancy: thanks

18:36 the latter works

19:02 seancorfield: hiredman: yup?

19:06 hiredman: seancorfield: nm, just having weird issues fetching the jdbc jar, everything is working now though, was going to ask if there had been any pom shuffling or something

19:07 seancorfield: ah... i pushed some doc updates today (or was it yesterday?) but nothing else... certainly no new builds to maven lately

19:08 hiredman: *shrug*

19:08 seancorfield: blame the government for network glitches :)

19:09 hiredman: we've recently switched all uses of clojure.contrib.sql to java.jdbc, so I expect big things :)

19:10 seancorfield: heh, no pressure then... gee... i was pleased that with the :fetch-size enhancement Shoeb was able to match the java program performance

19:10 hiredman: excellent

19:11 seancorfield: there's not match open tickets against c.j.j and we're using it heavily in production with MySQL so I'm _reasonably_ confident in it now

19:11 s/match/many

19:11 lazybot: <seancorfield> there's not many open tickets against c.j.j and we're using it heavily in production with MySQL so I'm _reasonably_ confident in it now

19:11 seancorfield: aaron has said we'll get mysql and postgresql up on build.clojure.org soon so we can run automated tests against those (in addition to derby and hsqldb)

19:12 i run the test suite against derby, hsqldb and mysql but i still want to add a lot more tests

19:21 arohner: ibdknox: I pushed the coercions code into a separate branch, if you want to take a look at it. https://github.com/arohner/noir/commit/83399b8e7eacb1469ad389b7ef0f63fa8b02685e

19:21 ibdknox: I don't expect it to get merged, I just didn't want to lose it

19:22 ibdknox: arohner: I'll take a look :)

19:23 so much new stuff! I think we need a Noir 1.2.0 soon

21:44 owl__: hi

21:44 i'm interestet in something like riak core in clojure

21:44 is there any development in this direction?

21:45 maybe a java library, i'm not very familiar with this topic

21:47 hiredman: clojure's dependency management system (maven) is more mature than erlangs, so stuff is more likely to be delivered a la carte

21:47 any particular feature you are looking for?

21:49 owl__: this has nothing to do with dependencys

21:49 its an architecture for a distributed system

21:50 hiredman: owl__: really? seems like a bunch of what would be seperate libraries, but is released as one large one because it is easier to use

21:50 owl__: but i can't even find a gen_server for clojure.... so its a lot of work

21:50 hiredman: well, clojure isn't erlang so expecting to find gen_server is kind of odd

21:51 owl__: i thought someone might have done it

21:51 hiredman: there are various state machine implementations for clojure

21:51 owl__: gen_server and supervisor would be useful in clojure

21:51 hiredman: some of them are even distributed

21:51 owl__: hm, ok

21:51 i will look for it

21:51 thanks

21:51 hiredman: *shrug* only if you like erlang and want to program clojure like it is erlang

21:52 owl__: but why not? embrace the actor model

21:52 cemerick: the one true gospel?

21:53 hiredman: ^-

21:53 it isn't one

21:53 owl__: i just think that riak core is a good architecture

21:53 hiredman: thats it really

21:56 cemerick: owl__: I'm sure.

21:56 There's oodles of distributed computing libraries and frameworks in the Java space, if you want to build on top of something.

21:56 And there's all sorts of options in Clojure-land too.

21:56 hiredman: infinispan!

21:56 owl__: if someone is interested, i just got overwhelmed by these "posts" https://github.com/rzezeski/try-try-try/tree/master/2011

21:56 but i did a lot of erlang recently

21:57 Praetor: with "name" and "symbol" I can go back and forth between symbols and string... how do I go back and forth between atom-or-form and strings?

21:58 hiredman: I guess I am kind of bias, lots of bad experiences with riak at work

21:58 biased

21:58 TimMc: Praetor: Example of an atom-or-form?

21:58 cemerick: hiredman: didn't you put together a clojure wrapper for that lately?

21:58 hiredman: no, not me

21:58 Praetor: TimMc: I want to convert (fun this) into "(fun this)" from inside a macro

21:59 owl__: i didn't use it ;)

21:59 hiredman: well, yes, actually, but it's not publicly available, so not the one you are thinking of

21:59 :)

21:59 TimMc: Praetor: read and pr-str

21:59 or thereabouts

21:59 cemerick: I can't find what I was thinking of, anyway.

22:00 hiredman: it may have been mmgrana

22:00 Praetor: TimMc: that's what I tried, but I cant' find "read", plus if it's anything like Common Lisp, "read" would do the opposite of what I want, i.e. go from string to form

22:00 hiredman: https://github.com/mmcgrana/clj-riak/blob/ce9d4598e9fb46d8e670471165af6fd05563ca7a/Readme.md

22:01 TimMc: Well, you did want back *and* forth. :-)

22:01 Praetor: TimMc: oh, so pr-str is the opposite? lemme try

22:02 TimMc: can you give me an example usage of pr-str ?

22:02 TimMc: (I don't have the exact names at hand at the moment, sorry.)

22:02 .findfn "(+ 5 4)" '(+ 5 4)

22:02 &findfn "(+ 5 4)" '(+ 5 4)

22:02 lazybot: java.lang.Exception: Unable to resolve symbol: findfn in this context

22:03 TimMc: Bah, been away from this channel too long. Someone give me a hand?

22:03 Praetor: if there were an atom? function, that'd help too

22:03 arohner: ,(read-string "(+ 5 4)")

22:03 Praetor: then I wouldn't need pr-str

22:03 clojurebot: (+ 5 4)

22:03 hiredman: Praetor: this is not common lisp

22:04 atom is a reference type

22:04 arohner: ,(pr-str '(+ 5 4))

22:04 clojurebot: "(+ 5 4)"

22:04 hiredman: there is nothing that is an "atom" in the common lisp sense

22:04 so there is no predicate you can use

22:04 Praetor: hiredman: how about list? or form? ?

22:05 arohner: list? exists

22:05 TimMc: Oh, you were thinking of atoms in the CL sense, got it.

22:05 arohner: ,(list? '(+ 5 4))

22:05 clojurebot: true

22:05 Praetor: hiredman: if that doesn't work for me in the repl, what am I missing?

22:05 arohner: ,(list? 3)

22:05 clojurebot: false

22:05 TimMc: $findfn "(+ 5 4)" '(+ 5 4)

22:05 hiredman: if what doesn't?

22:05 lazybot: [clojure.core/read-string]

22:05 Praetor: hiredman: your helpful pr-str and read-string examples

22:06 hiredman: TimMc: findfn may not eval the result, so maybe don't quote them

22:06 Praetor: how do they not work?

22:06 TimMc: Praetor: THat was arohner

22:06 Praetor: hiredman: nvm, it actually works. thanks :)

22:06 hiredman: ,(read-string (pr-str '(+ 1 2)))

22:06 clojurebot: (+ 1 2)

22:06 TimMc: hiredman: I finally found the right incantation for findfn.

22:06 Praetor: TimMc: oops, you're right

22:06 arohner: thanks for the examples, arohner

22:07 arohner: Praetor: np

22:09 Praetor: is there a favorite pastie here?

22:09 ,paste

22:09 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: paste in this context, compiling:(NO_SOURCE_PATH:0)>

22:09 TimMc: Praetor: GitHub gists are popular, I guess

22:09 although I despise their too-light color scheme

22:10 hiredman: ~paste

22:10 clojurebot: http://gist.guthub.com

22:10 hiredman: clojurebot: really?

22:10 clojurebot: Pardon?

22:10 TimMc: guthub haha

22:10 Praetor: ok

22:10 TimMc: curiously, guthub.com redirects properly

22:11 thank goodness

22:18 Praetor: http://paste.lisp.org/display/123951

22:19 I'm trying to write a function kf that allows me to split up a function name so that I can call a function with the arguments interspersed

22:19 However, I can't solve this last problem

22:20 hiredman: "arguments interspersed"

22:20 interspersed with what?

22:20 Praetor: with the function name

22:21 hiredman: what?

22:21 clojurebot: what is seq

22:21 Praetor: if the function is called add.to. I want to make a call (add. 2 to. (+2 3))

22:21 hiredman: you will have a number of problems with that

22:21 Praetor: hiredman: kf will be the macro that allows me to make that call: (kf add. 2 to. (+ 2 3)) will become (add.to. 2 (+ 2 3))

22:22 hiredman: first functions don't really have names, but they can be bound to name locally (via something like let) or globally as a var (via def)

22:22 Praetor: hiredman: i looks simple, and each step works independently in the repl, but I can't code the last step into the macro

22:22 TimMc: hiredman: I think I see what Praetor is trying to do; it is not that.

22:22 hiredman: *shrug*

22:23 TimMc: (macroexpand-1 `(kf add. 2 to. (+ 2 3))) => `(add.to. 2 (+ 2 3))

22:23 I think it's a bad idea, since it manipulates names, but whatever.

22:24 Praetor: TimMc: it's an experiment, I want to see if it's doable

22:24 TimMc: I can't map pr-str onto the args in the last bit of my macro

22:24 that's all I need

22:24 when I map it, it complains that it can't find the symbol... it's too eager to look the symbols up

22:25 TimMc: I can't remember if namespace qualification is going to give you trouble here.

22:26 Praetor: I can get very close, as you can see, all the way to "(((do. not.) (fun this) that))" (as a form, not a string), but the only reason is that I'm cheating with (quote)

22:26 so as to supress evaluation

22:26 otherwise it won't let me do it

22:26 :)

22:27 TimMc: OK, so you are combining syntax-quote and list, which is not going to help.

22:28 Praetor: TimMc: I only did it to show how far I can get

22:28 TimMc: Not bad in and of itself, just not what you mean here.

22:28 Praetor: but yes, quote isn't going to help

22:29 I only used quote so that it'd stop looking up symbols that don't exist.

22:29 otherwise it'd try to evaluate "do." and it'd say that that symbol doesn't exist...

22:30 that's why I can't (apply str (map pr-str ....

22:33 TimMc: oh, wait... CLojure isn't going to like this.

22:33 Praetor: because of namespaces?

22:33 TimMc: Putting a dot at the end is going to make it think "Whee! Class constructor!"

22:34 Praetor: oh...

22:34 I wanted to use colons instead but couldn't

22:34 TimMc: Yeah, those are keywords.

22:34 ,(type :foo)

22:34 clojurebot: clojure.lang.Keyword

22:34 Praetor: heh. what punctuations are available for naming?

22:34 ,(type &foo)

22:34 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: &foo in this context, compiling:(NO_SOURCE_PATH:0)>

22:35 Praetor: can I use ampersand?

22:35 TimMc: Not really, no. You *can* use a bunch of stuff, but there's a list f what is guaranteed future-safe.

22:36 "Symbols begin with a non-numeric character and can contain alphanumeric characters and *, +, !, -, _, and ?"

22:36 Praetor: ok, I'll just use the letter t just to see if I can get to where I want

22:36 oh, I see

22:36 TimMc: Prefix with underscore, how about that?

22:36 or postfi

22:37 Praetor: yep, underscore sounds good

22:38 TimMc: OK, the net step is getting rid of namespace nonsense.

22:39 Otherwise (apply str (getkeys args)) gives you user/do_user/not_ or whatever.

22:39 Praetor: well, I'm trying to avoid the evaluation of symbols

22:40 TimMc: http://paste.lisp.org/display/123951#1

22:40 TimMc: gives: Unable to resolve symbol: do_ in this context (NO_SOURCE_FILE:652)

22:40 TimMc: The macro gets the symbols already prefixed with namespace.

22:41 Praetor: Here's the state of my work so far: https://gist.github.com/1138805

22:42 BY the way, there is also clojure.contrib.seq/separate

22:42 Praetor: hmm... why do you call kf with macroexpand-1 and not (kf ... ?

22:44 TimMc: Because then I don't have to have a valid expression. It's helpful for work in progress.

22:44 It takes a form and returns a form.

22:44 Praetor: ah. so that's what's keeping you from having the problem I'm having :)

22:46 TimMc: defmacro is also supposed to take a form and return a form :)

22:46 TimMc: a macro does that, yes

22:47 macroexpand-1 allows you to use the macro as a function of forms -> forms

22:48 Praetor: my common lisp brain can't make sense of that. a macro is supposed to be such a function, whose type is Form -> Form

22:48 TimMc: $findfn 'user/foo 'foo

22:48 lazybot: []

22:48 Praetor: that's why I'm lost as to why it keeps evaluating my stuff

22:54 I can't get any closer to solving this

22:54 it's maddening

22:55 TimMc: OK, I think I have it...

22:55 Praetor: let's see

22:55 TimMc: https://gist.github.com/1138805

22:55 I'm using (use '[clojure.contrib.seq :only (separate)]) by the way

22:56 Praetor: I was about to ask that. I'm on the repl, copying and pasting that doesn't work

22:56 by "that" I mean your (use... form

22:57 TimMc: Really?

22:57 Praetor: java.io.FileNotFoundException: Could not locate clojure/contrib/seq__init.class or clojure/contrib/seq.clj

22:57 TimMc: Oh, you must not have contrib on the classpath. Sorry.

22:58 Praetor: what do I do then?

22:58 TimMc: Use filter instead, I guess.

22:58 Praetor: what's the result of running your gist code?

22:59 did you finally join the strings?

22:59 TimMc: (do_not_ 2 (clojure.core/+ 3 4))

22:59 Praetor: wow, you got it

22:59 now can you do it without using macroexpand-1 ?

22:59 TimMc: yeah

22:59 once I (defn do_not_ [a b] a)

23:00 Praetor: oh... gotcha

23:00 lemme try here

23:01 with filter

23:01 TimMc: use complement

23:01 instead f repeating yourself

23:02 Praetor: I thought about that but complement is for switching a boolean-returning function

23:02 or am I mistaken?

23:02 TimMc: Praetor: check ouy the gist again

23:03 See how I composed filter and complement?

23:03 Praetor: right, yes. :) I'm not a newbie at FP :)

23:03 TimMc: ok, cool

23:03 ibdknox: has anyone seen this error? Caused by: java.lang.NoSuchMethodError: clojure.lang.RT.keyword

23:03 Praetor: heh

23:03 TimMc: I'm still working on making it work here with filter, hang on

23:05 TimMc: Praetor: OK. I updated mine to just use filter.

23:05 Praetor: TimMc: another reason I hadn't done that refactoring of is-key is because I didn't know Clojure's let was like Haskell's instead of like Scheme (in Scheme you'd have to use let*)

23:06 TimMc: there you go! that's it :)

23:06 you proved it's doable!

23:06 my only problem then was that I hadn't defined do_not_ before

23:07 TimMc: Praetor: Yeah, and if you use let* in Clojure you get a nasty surprise.

23:07 Praetor: that's why I kept getting stopped at that error

23:07 TimMc: it's an internal helper for let

23:07 Praetor: ouch :P

23:07 TimMc: In a way, it is exactly opposite. >_<

23:07 Pays to read http://clojure.org/lisps about once every week.

23:07 Praetor: y'know, I was much prejudiced against Clojure at first

23:08 I was a Schemer and then a CLer

23:08 but now that I've watched Hickey's lectures... he's really smart

23:08 so I've changed my mind about Clojure :)

23:08 TimMc: Nice balance of practical and theoretical, yeah.

23:08 Praetor: so I support doing away with let*. I like Haskell's let better anyway

23:08 yes, indeed

23:09 if Clojure had reader macros we could do away with "kf" :P

23:09 TimMc: You wouldn't want that.

23:09 I know a guy who worked at ITA, where they use Lisp for just about everything.

23:10 Praetor: yeah they're big in CL

23:10 TimMc: He's a bit cold on Lisp now, because they used macros to splice together functions names.

23:10 It was hell to find where anything was defined in the codebase.

23:10 Praetor: oh, so he was using an equivalent of my kf function?

23:11 TimMc: The moral equivalent of it.

23:11 amalloy: immoral

23:11 TimMc: precisely

23:11 Praetor: I have to write some Obj-C and I really enjoy the spliced function=arguments thing

23:12 I was wondering how it'd feel in a functional language

23:12 since I could never try it in haskell

23:12 I think one of the problems with FP languages is that functions have tons of arguments and it's hard to memorize the order in which you have to pass things

23:13 Scriptor: good editors can help with that :)

23:13 Praetor: a function call is way too terse in functional languages, so they become obscure

23:13 amalloy: if only we had some way to combine arguments into a sort of "list" or "map" structure

23:13 Praetor: Scriptor: I use emacs, it doesn

23:13 doesn

23:13 t help me one bit

23:13 TimMc: It could.

23:13 Praetor: (sorry, keyboard went crazy)

23:14 Scriptor: it helps me

23:14 TimMc: I haven't bothered to set it up yet.

23:14 Praetor: Scriptor: it helps me when I'm writing CL code, not when I'm reading it

23:14 TimMc: I just hit clojuredocs.org all day.

23:14 Scriptor: ah, good point

23:14 amalloy: if you have trouble remembering what order to pass arguments in, just pass a map instead, with keys named to help you remember

23:14 Praetor: Scriptor: :)

23:15 amalloy: that smells too much like ruby and too little like the power that a Lisp can give me :)

23:15 arohner: Praetor: if you use slime, you get fn arguments

23:15 Scriptor: Praetor: at least argument order is fairly consistent, couldn't say the same of some other languages

23:16 Praetor: arohner: I got beaten when trying to set up slime with CL, not sure I have the guts to reconfigure it to use Clojure :P

23:16 TimMc: Praetor: The ordering is usually such that (partial ...) is useful. :-)

23:16 clojurebot: Ack. Ack.

23:16 TimMc: ugh, clojure

23:16 *clojurebot

23:16 Praetor: TimMc: heh, if that was so, Haskell wouldn't have a flip function

23:16 TimMc: clojurebot: The ordering?

23:16 clojurebot: Excuse me?

23:16 TimMc: Oh, good.

23:17 amalloy: clojurebot: Praetor: The ordering?

23:17 clojurebot: Praetor: The ordering is usually such that (partial ...) is useful. :-)

23:17 amalloy: TimMc: sucker

23:18 TimMc: argh

23:18 Praetor: so Tim... about that issue I have loading up libraries in the repl... any clues on that?

23:18 TimMc: Depends how you're getting a repl/

23:19 Scriptor: I prefer doing partial with functions that take a seq as a 2nd or 3rd argument, though that might just be me

23:19 TimMc: I run `lein repl` from anywhere and get clojure + contrib.

23:20 Praetor: ok, let me tell you what I know. I'm running clojure 1.2.1, I created a clj executable on my /usr/local/bin that contains exactly this: http://en.wikibooks.org/wiki/Learning_Clojure/Installation#Linux.2FOSX_Configuration

23:20 TimMc: OK, so you would either need to add clojure-contrib.jar to that classpath or use Leiningen. :-)

23:21 Praetor: for some reason I already have lein installed... I typed lein repl and got in and now (use ... works.

23:21 how can I check that it's using my clojure 1.2.1 and not some old one, from within?

23:21 from within the repl

23:21 TimMc: some global

23:22 ,*clojure-version*

23:22 clojurebot: {:interim true, :major 1, :minor 3, :incremental 0, :qualifier "master"}

23:22 TimMc: ,(clojure-version)

23:22 clojurebot: "1.3.0-master-SNAPSHOT"

23:22 Praetor: TimMc: great. you're great, sir. I have no more questions :)

23:23 TimMc: Praetor: I am making liberal use of clojuredocs

23:23 Praetor: that'll be the next thing I'll learn to use, then

23:23 TimMc: clojuredocs.org, that is

23:23 not a doc feature

23:24 Praetor: indeed, searching for "clojure version" on it gives me that function ma

23:24 name

23:24 Tim, thanks a lot, I won't bother you anymore. I'll go back to coding and reading now. :)

23:25 TimMc: The search is a little wonky, by the way -- hyphens mess up the main search, but not the autocomplete.

23:25 Have fun!

23:25 Back to Python for me.

23:25 Praetor: TimMc: I'd usually search this way: on google: clojure version site:clojuredocs.org

23:26 TimMc: Good idea.

23:26 Praetor: :)

23:26 Scriptor: Praetor: which browser do you use?

23:26 Praetor: Scriptor: firefox. I really need the copyAllUrls plugin, and the TreeStyleTab one

23:26 that's the only reason

23:26 why?

23:26 clojurebot: Praetor: because you can't handle the truth!

23:26 Scriptor: for me, it's "clo"-tab-function name

23:26 on chrome

23:27 Praetor: "clo" means you start typing that anywhere, regardless of where the focus is in Chrome?

23:27 Scriptor: in the url bar

23:27 so I just need to open a new tab first

23:27 but anyway, it's because it detects the search inside clojuredocs.org

23:28 (as opposed to using google to search the whole site)

23:28 Praetor: hmm. I'll see if I can enhance firefox's awesome bar to do some of that later

23:28 Scriptor: the only issue is that the results page you get from that is far more inferior than what you get from the autocomplete dropdown

23:28 no idea why

23:29 TimMc: I use search keywords -- "cld version<enter>" takes me to http://clojuredocs.org/search?q=version

23:29 Praetor: I'd use chrome if it had the plugins I need

23:29 TimMc: on FF?

23:30 TimMc: Praetor: Yeah, I have http://clojuredocs.org/search?q=%s bookmarked with cld as the keyword.

23:30 magic

23:30 Praetor: I never knew that worked

23:33 TimMc: great tip. I set it up for cljd. I'd never remember "cld" :)

23:59 amac: Is there any way to bind (let/binding) a vector of k/v pairs? Something along the lines of `(let ~passedvec ~@body) in a macro; I'm not strong with macros but it seems I need a way to expand the passedvec before the let gets expanded...

Logging service provided by n01se.net