#clojure log - Dec 27 2011

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

0:08 mrb_bk: fun question

0:26 shales: mrb_bk: saw your email about an unpack port. does this fit the bill? https://github.com/geoffsalmon/bytebuffer

1:25 sunng: ,(conj '(1 2 3) 4)

1:25 clojurebot: (4 1 2 3)

1:26 sunng: ,(conj [1 2 3] 4)

1:26 clojurebot: [1 2 3 4]

1:28 amalloy: ibdknox: you don't get billed for the dyno-hours it sits idle. i imagine with the paid tier there's an always-on option as well as the "nah, go ahead and power it down" behavior

3:43 gf3: hi gents, I'm new to clojure, and I'm wondering if someone can point me to the "clojure way" of doing things

3:43 I am writing some ring middleware, and I need to maintain a list of routes somewhere, this list will have to be mutable. How can I go about this as cleanly and as clojure-y as possible?

3:51 amalloy: well the "clojure way" would probably be to start by double-checking what you need a mutable list for

3:54 kral: namaste

4:02 antares_zzzz: way

4:02 oops

4:06 gf3: amalloy: hi! been reading a lot of your code on GH, thank you

4:06 amalloy: oh cool, glad to be of service, corrupting the younglings with my code

4:07 gf3: amalloy: I'm sure I'm just not approaching the issue correctly, my middleware should hold a list of routes, and when it encounters those routes in a request, it will do some work

4:07 but this list of routes is what's bugging me

4:08 amalloy: mhm, but so far i don't hear it changing anytime

4:08 gf3: amalloy: the user of the middle way can add/remove routes to "watch"

4:08 *middleware

4:08 how do I store that list in a persistent way that isn't some gross global mutable?

4:10 amalloy: well, when would you really want to change it dynamically? i can only see that happening if it's some kind of debug middleware

4:13 gf3: amalloy: I suppose it's unlikely

4:13 amalloy: anyway, a short-term solution is like...just use an atom. but a long-term solution is probably...realize you don't want to solve this problem

4:16 (defn dyn-routes [init] (let [a (atom init)] [a (fn [req] (let [current-routes @a] (...)))]))

4:16 now dyn-routes returns a pair [routes-atom, handler]

4:17 install the handler wherever you want, and save the atom for later changing

4:18 gf3: iiiiinteresting, thank you

4:18 amalloy: but *really* it would be more composable to wrap, not a list of routes, but an underlying handler. maybe that handler is just some routes, maybe it's something else. just hold whatever it is in an atom, and swap that out with something different later

4:18 gf3: amalloy: I was just looking at how you do things like triggers/etc in ciste

4:18 amalloy: i have no idea how ciste works

4:24 gf3: amalloy_: good call on the atoms, looks like ciste just rebinds stuff, thank you

6:43 licenser: aloa

7:53 vijaykiran: how can I add test-only dependency in lein ?

8:39 gf3: vijaykiran: :dev-dependencies [[some-pkg "1.2.0"]]

9:01 vijaykiran: gf3: thanks!

9:01 gf3: np

9:21 clojure_0000: I can't do (apply and '( true true false tree)) because and is a macro. How do I take the and of a list of booleans?

9:32 jonasen: clojure_0000: (every? identity '(true true false tree))

9:34 clojure_0000: or maybe (reduce #(and %1 %2) [true true false true])

9:36 sandy1986: Hi I like to strore collections of items in a memcached entry. But they can only be 1mb big. How to deal with this for bigger collections? http://oi41.tinypic.com/vcuj6h.jpg

9:37 Store each item and manage them with a key for the namespace? Or linking the 1MB buckets?

9:40 clojure_0000: jonasen: ended up going with : (apply (fn [x y] (and x y)) ... )

9:40 jonasen: the identity trick is cute

9:40 #(and %1 %2) is pretty cool too

10:33 TimMc: Wow, writing Clojure without internet access is *hard*.

10:34 Most libraries have shitty or nonexistent documentation, so I have to use a search engine instead of grep.

10:36 stuartsierra: read the source

10:39 bsteuber1: ,(conj {:a 1} {:b 2})

10:39 clojurebot: {:b 2, :a 1}

10:39 bsteuber1: that's surprising to me

10:40 TimMc: stuartsierra: Ugh, I know.

10:40 stuartsierra: Source doesn't convey intent.

10:40 stuartsierra: Neither does bad documentation.

10:41 sandy1986: Does anyone know why enlive converts everything into iso-8859-1 ?

10:41 Even UTF-8 Input

10:47 stuartsierra: sandy1986: maybe something to do with the XML parser

10:48 sandy1986: stuartsierra: any idea what I can try to fix it?

10:48 stuartsierra: no, sorry

11:02 cemerick: sandy1986: can you output UTF-8 outside of enlive?

11:08 sandy1986: yes cemerick

11:08 works fine

11:08 repl etc.

11:08 but when I pass it to the enlive template and recieve the result it is iso-*

11:11 TimMc: sandy1986: Ew, I'll have to take a look at that with my own enlive-using project.

11:12 sandy1986: mhhh have written the output of enlive to the console

11:13 clojure_0000: why are all pullup towers on amazon only ~7 feet tall? I want something ~8 feet tall, so I can jump up to grab it, and be able to hant w/o bending knees

11:13 sandy1986: also utf-8 mhh

11:13 clojure_0000: hmm; I think I am in the wrong channel

11:13 sandy1986: moustache, ring , jetty

11:13 there must be the problem

11:13 TimMc: sandy1986: Ah, good.

11:18 sandy1986: netty works ...

11:19 AeroNotix: hi, is the guy who runs 4clojure here?

11:19 mdeboard: AeroNotix: You mean amalloy ?

11:19 :)

11:19 TimMc: AeroNotix: Several folks run 4clojure.

11:19 AeroNotix: Oh, ok.

11:19 TimMc: Is it down, or what?

11:19 mdeboard: orite, sorry I still associate it with him

11:20 AeroNotix: No, I just found a little bug. I presume it's already known though

11:20 TimMc: AeroNotix: You can also ask in #4clojure if you want a more targeted set of folks.

11:20 AeroNotix: ahhh interesting

11:20 brb

11:20 sandy1986: lein ring server << causes the encoding problem

11:22 maybe it is also caused by netty vs jetty

11:23 TimMc: "lein ring server", is that a new command? I seem to recall some discussion of it recently.

11:26 sandy1986: TimMc: It is a plugin for lein

11:26 Where do you bring the jetty / netty server construction call in?

11:26 when I add it to core.clj no more actions like "jar" and "compile" work, cause the server starts and waits for requests

11:27 jetty is causing the problems

11:27 changed (defonce server (run-jetty #'routes {:port 8080 :join? false})) ;(defonce server (run-netty #'routes {:port 8080 :join? false}))

11:28 and there are encoding problems again

11:31 pandeiro: what's the best way to test a map for multiple keys?

11:34 sandy1986: http://goo.gl/kFVPB

11:34 nice ;) my answer

11:34 TimMc: pandeiro: You just want to know whether a map contains all of the keys?

11:34 pandeiro: yeah

11:35 TimMc: pandeiro: Is there any chance that any of the values would be nil or false?

11:35 *values for those keys

11:35 pandeiro: umm, not really

11:36 any is a big word

11:36 but probably not

11:37 TimMc: &(every? (partial contains? {:a 3 :b 4 :c 5}) [:a :c])

11:37 lazybot: ⇒ true

11:37 TimMc: ^ That's the safer way to do it. There might be some trick with sets or keywords that only works if the attached values are logical true.

11:38 sandy1986: How to (.setCharacterEncoding response "UTF-8") on [ring.util.response :only [response]]

11:39 pandeiro: TimMc: cool, thanks... i was in the neighborhood but missing the fn composition

11:41 sandy1986: maybe I need only to add :character-encoding

11:41 TimMc: pandeiro: Here's an example of a trick that only works with keyword (or symbol?) keys and logical-true values: ##(every? {:a 1 :b 2 :c 3} [:a :c])

11:41 lazybot: ⇒ true

11:42 TimMc: No, wait... the map is the function, so anything can be used as a key. The val problem is still there.

11:42 pandeiro: TimMc: if the values are false or nil...? it returns false?

11:42 TimMc: &(every? {:a 1 :b 2 :c nil} [:a :c])

11:42 lazybot: ⇒ false

11:42 pandeiro: nice one

11:42 TimMc: &(map {:a 1 :b 2 :c nil} [:a :c])

11:42 lazybot: ⇒ (1 nil)

11:43 TimMc: I don't like those tricks, they're a bit dangerous.

11:43 Good for golf, though.

11:44 sandy1986: How to add the key :character-encoding to the response: https://github.com/mmcgrana/ring/blob/master/ring-core/src/ring/util/response.clj#L21

11:45 jonasen: pandeiro: ##(every? (set (keys {:a false :b 4 :c nil})) [:a :c])

11:45 lazybot: ⇒ true

11:45 pandeiro: jonasen: any advantage to that over just using the map?

11:46 ah i see

11:46 TimMc: jonasen: And now the only danger is nil or false *keys*, which is pretty unlikely.

11:46 pandeiro: in my case a nil or false val should return false

11:46 so TimMc's shortcut is perfect

11:46 TimMc: Ah, OK.

11:46 pandeiro: thanks guys

11:46 this is a great language :)

11:46 really enjoying the new Clojure in Action book

11:47 jonasen: TimMc: is nil even allowed as a key?

11:47 TimMc: &({nil 5} nil)

11:47 lazybot: ⇒ 5

11:48 TimMc: You really should restrict your keys to keywords, symbols, and strings though.

11:49 jonasen: I don't think I've ever seen nil as a key. If nil means nothing, then {nil 5} would mean nothing maps to 5 which is just weird

11:50 TimMc: I've used it.

11:50 I had a cache of configurations where nil (null, it was Java) indicated the default.

11:50 jonasen: TimMc: ok

11:50 AeroNotix: pandeiro: Who is that book aimed at?

11:50 TimMc: I later changed that since the default's value could change, but that was unrelated.

11:51 pandeiro: AeroNotix: amateurs like me, definitely :)

11:51 TimMc: jonasen: Not all java.util maps accept null keys, by the way.

11:51 (I think.)

11:51 pandeiro: although i think it ramps up pretty quickly, scanning the chapter titles (i'm only on 2)

11:51 AeroNotix: pandeiro: I'll check it out. I was sorely disappointed with Practical Clojure, I should have checked the page count before buying.

11:51 TimMc: sandy1986: I think you specify the character encoding using a header.

11:52 pandeiro: AeroNotix: i really like the style, more straightforward than joy of clojure

11:53 AeroNotix: Thanks for the recommendation.

11:53 sandy1986: (defn utf8response "Returns a ring skeleton withheaders." [body] {:status 200 :headers { :content-type "text/html;charset=UTF-8" :character-encoding "UTF-8"} :body body}) ??

11:53 lazybot: sandy1986: Uh, no. Why would you even ask?

11:54 sandy1986: clojure.lang.Keyword cannot be cast to java.lang.String

11:54 TimMc: sandy1986: Looks like there's a headers function farther down.

11:54 sandy1986: farther down?

11:55 TimMc: in response.clj

11:55 And it wants "Character-Encoding", not :character-encoding.

11:58 sandy1986: I'll try

11:59 ring.util.response$response cannot be cast to clojure.lang.Associative

12:00 ((header response "Character-Encoding" "UTF-8") (apply str (t/index (map :task (get-todos))) )))

12:03 TimMc: what is clojure.lang.Associative? What's the problem here?

12:06 AeroNotix: is there an IRC for clojure noobs?

12:07 Raynes: Nobody minds trivial questions/discussion here.

12:07 sandy1986: Yeah AeroNotix , that's why I am here ;)

12:08 AeroNotix: ok

12:08 I keep getting a mismatched parens error on some code, it's a really nooby question.

12:09 aaaaand I've just fixed it

12:09 Raynes: Sometimes all it takes is to talk about it.

12:09 pandeiro: Raynes: why is that?

12:09 AeroNotix: dammit, a loop vector was causing it, I had (loop [var val [var2 val2])

12:10 pandeiro: AeroNotix: do you use emacs?

12:10 AeroNotix: I do

12:10 pandeiro: paredit?

12:10 AeroNotix: Nope

12:10 I was just going to ask

12:10 is there a plugin to highlight matching-parens

12:10 I take it paredit is that plugin

12:10 pandeiro: it is kind of a nazi, but you avoid stuff like that

12:10 no just highlighting?

12:10 that's built in

12:11 AeroNotix: I have a Python editor where if I put my cursor next to a paren, it'll highlight the matching paren it's next to. Anything like that for emacs?

12:11 pandeiro: https://github.com/pandeiro/dotemacs/blob/master/my-general.el

12:11 sandy1986: (defn utf8response "Returns a ring skeleton withheaders." [body] {:status 200 :headers { "Content-Type" "text/html;charset=UTF-8" "Character-Encoding" "UTF-8"} :body body}) << works :)

12:11 don't know how to do it with "header" function in ring ...

12:12 pandeiro: and then paredit is a tool that inserts and enforces matching parens/brackets/quotes etc with a whole set of functions for manipulating sexps

12:12 AeroNotix: I'll dl it

12:13 pandeiro: you saw show-paren-mode though?

12:14 AeroNotix: I'll have to mess with it. I'm a super-emacs-noob

12:14 pandeiro: i am as well, about 4 months in

12:15 AeroNotix: I take it I just create the paredit.el file and put it in my load-path and then require it in my .emacs?

12:15 pandeiro: AeroNotix: the wisest thing you can do is use package.el and marmalade

12:15 technomancy has a starter kit that does all that for you i believe

12:15 i did it manually though, it's not too complex

12:16 AeroNotix: I've used that before. I keep re-installing emacs when I mess something up (bad learning experience, I know)

12:16 pandeiro: basically then you can do M-x package-install

12:16 AeroNotix: I'm gonna stick with it now with the current incarnation as I can use it

12:16 pandeiro: oh ok you know it

12:16 AeroNotix: Yeah, just don't have it atm

12:16 thanks for advice

12:16 pandeiro: but yeah you can just grab paredit then and require it

12:17 and for the matching parens highlighting it's just (show-paren-mode t)

12:18 AeroNotix: thanks

12:19 sandy1986: technomancy has a starter kit that does all that for you i believe << where is the stater kit?

12:19 pandeiro: sandy1986: on his github

12:19 emacs-starter-kit i think it's called

12:42 TimMc: paredit is more than a highlighter or balance-enforcer -- it is a structural editor.

12:42 You edit lists, not strings.

12:42 trees, really

12:59 choffstein: Does anyone know if incanter's matrices have an "update" ability with functionality similar to the "sel" function?

13:15 sandy1986: What editor du you prefer?

13:15 Xenocorp: emacs

13:15 sandy1986: technomancy starter Kit?

13:15 AeroNotix: i just use clojurebox

13:19 darrint: I'm having trouble figuring out how to idiomatically use prxml to find a particular tag. For instance, I have a vector of tags. I'm looking for the map that has {:tag :first_name}.

13:28 sandy1986: !google v

13:29 ahh clojurebox is for windows

13:30 can I set JAVA_TOOL_OPTIONS inside of a clojure application?

13:39 TimMc: darrint: (first (filter ...))

13:39 sandy1986: how to carry parts of a funtion to the end (so they are returned) ? => let ?

13:40 (defn save-todo [name] (let [todos (get-todos) entry (todo. name true (gen-timestamp))] (with-mc db-nodes (replace-item "todos" (conj todos entry)))))

13:40 darrint: TimMc: Thanks!

13:40 sandy1986: I want save-todo to return (conj todos entry)

13:40 but it should be passed to replace-item

13:41 now it returns a future from replace-item

13:41 TimMc: sandy1986: Just add another clause to the let.

13:41 sandy1986: You know that let can have multiple statements in its body? ##(let [] 3 4 5)

13:41 lazybot: ⇒ 5

13:42 sandy1986: Yes, like in my example

13:42 todos and todo ;)

13:42 ahh in its body?. .. ahhh

13:43 TimMc: yeah, just bind the conj's result and return that as the last expression.

13:43 sandy1986: but just to add another (conj todos entry) looks wired

13:43 TimMc: (let [..., foo (conj todos entry)] ... foo)

13:47 sandy1986: (defn save-todo [name] (let [todos (get-todos) entry (todo. name true (gen-timestamp)) result (conj todos entry)] (with-mc db-nodes (replace-item "todos" result) result)))

13:47 still returns the operationFuture

13:51 even like this:

13:51 (defn save-todo [name] (let [todos (get-todos) entry (todo. name true (gen-timestamp)) result (conj todos entry)] (with-mc db-nodes (replace-item "todos" result)) result))

13:51 but result is the last thing in let !?

13:53 TimMc: Should work.

13:54 sandy1986: worked, my repl had problems

13:56 amalloy: TimMc: strongly disagree re: restricting map keys to keywords, symbols, and strings, if you meant that as general advice

13:58 TimMc: amalloy: Mrh.

13:59 There are (at least) two uses of maps -- data structures with known-name keys, and lookup tables.

13:59 I still think my advice holds for the first case.

13:59 darrint: Can I ask emacs-slime to unload, compile, then load my file? I'm finding that sometimes old bindings allow me to compile code that won't compile in a fresh repl.

14:10 raek: darrint: one solution is to run remove-ns in the repl

14:10 followed by a require

14:12 tmciver: raek: darrint: I'm interested in the answer to this question as well. I suppose remove-ns will not work if you 'use'd your lib?

14:13 because that brings those symbols into the current namespace?

14:13 kzar: Can you access meta data using destructuring?

14:13 tmciver: Perhaps you meant to remove-ns the repl's namespace.

14:18 Raynes: kzar: Not sure I follow.

14:19 You can get metadata and destructure it, of course: ##(let [{:keys [name]} (meta #'+)] name)

14:19 lazybot: ⇒ +

14:20 kzar: Raynes: Yea, I guessed you couldn't but thought I'd ask. It's because clutch puts some stuff in meta data that it used to put in the result map.

14:20 amalloy: wouldn't that be funny though? (let [^{:keys [m]} {:keys [a b]} ^{:m blah} {:a 5 :b 20}] [a b])

14:22 TimMc: amalloy: Syntax would be tricky...

14:22 amalloy: TimMc: not really. if there's metadata on a destructuring form, then destructure the meta too

14:23 TimMc: I know almost nothing about metadata, though. :-/

14:24 &(meta `^{:keys [m]} ())

14:24 lazybot: ⇒ {:keys [clojure.core/m], :line 1}

14:24 TimMc: I guess that would work.

14:24 sandy1986: Does anyone know javascript?

14:25 TimMc: Certainly.

14:25 sandy1986: what is the best tool to modify html/javascript in the browser

14:25 to rapid test things

14:25 TimMc: sandy1986: Each browser has an inspector tool.

14:25 Some are built-in. For Firefox, get the Firebug add-on.

14:26 sandy1986: yes, but i do not only want to inspect. I want to change things

14:27 TimMc: That's what they do.

14:28 Raynes: Chrome has an excellent tool for this built in. You can use Firebug in firefox.

14:28 pandeiro: Chromium +1

14:28 TimMc: IE

14:28 pandeiro: Ctrl-Shift-I

14:28 TimMc: IE's inspector is shit.

14:28 pandeiro: why wouldn't it be?

14:28 sandy1986: Chrome has an excellent tool for this built in << ? I use chrome but I can't change the javascript code

14:28 only view it

14:28 pandeiro: sandy1986: Ctrl-Shift-I

14:28 click on Console

14:29 TimMc: sandy1986: That's pretty standard.

14:29 Raynes: I'm pretty sure you can click on 'scripts' and edit the JS directly as well.

14:30 sandy1986: I opened the script but I can not edit it

14:31 darrint: Can I ask slime/clojure-mode to pretty print a large data structure in place in a buffer?

14:31 arthurdenture: sandy1986, in chrome 16 at least you can double-click on the script contents in the inspector and just start typing. not sure about older versions.

14:32 tmciver: darrint: Yes, but it's not a clojure-mode thing: (use 'clojure.pprint) (pprint 'my-data-structure)

14:37 darrint: tmciver: good enough for this. Thanks.

14:42 blcooley: sandy1986: once you open the Scripts panel in the Developer console, there is an edit button at the bottom of the panel. You have to click that to edit the scripts, I think.

14:42 sandy1986: It is grey, I can't klick it

14:45 TimMc: Reload.

14:45 blcooley: you have to disable pretty print mode. The braces next to the edit are a toggle for pretty print mode.

14:48 timvisher: hey all

14:49 i have clojure-mode 1.11.5 installed, "GNU Emacs 24.0.90.1 (i386-apple-darwin10.8.0, NS apple-appkit-1038.36)

14:49 of 2011-10-27 on 184-243-147-41.pools.spcsdns.net", and clojure-jack-in is saying "error in process filter: Symbol's function definition is void: slime-output-buffer [2 times]" when I try to run it

14:49 any thoughts?

14:50 i just upgraded clojure-mode so it could be something weird their

14:50 there*

14:51 romanandreg: hey guys, I'm trying to implement some basic leiningen tasks on my project (in a leiningen subdir), yet whenever I'm running the task with imported leiningen libraries, I get `FileNotFoundException` with basic imports from leiningen

14:51 how can I solve this issue? :-o

14:54 dsantiago: If you know the name of a record type, is there any way to get a list of its fields?

14:54 tmciver: timvisher: I *think* that's an error I've seen when running clojure-jack-in after killing a previous slime. The only solution I know to that problem is to restart emacs :/

15:04 timvisher: tmciver: that didn't seem to do the trick. Might be something more widespread: https://github.com/technomancy/swank-clojure/issues/92

15:04 but it looks like that was on an old version

15:05 tmciver: timvisher: possibly. I'm still on emacs 23 so it may be unrelated. sorry.

15:06 timvisher: np

15:06 thanks for trying. ;)

15:10 TimMc: romanandreg: You mean you are trying to :require a leiningen namespace and it is failing?

15:11 romanandreg: TimMc: yes, exactly that :-)

15:11 pandeiro: if i run lein deps to add a new dependency while a swank clojure server is already running, how can i get it to load the new lib? it's there in lib/ but swank says it can't find it on the classpath

15:16 TimMc: pandeiro: That's because swank was started with a classpath that explicitly listed those jars.

15:16 pandeiro: TimMc: i see, so how do i do?

15:16 TimMc: Like, as a command-line argument or something.

15:16 I don't know how to update it.

15:17 pandeiro: C-x C-c yes emacs -nw

15:17 i guess

15:17 TimMc: There might be a way to patch in a classpath element later...

15:17 pandeiro: i see there's a fn clojure-load-file

15:17 not sure if that helps

15:17 arthurdenture: how about M-x slime-quit-lisp?

15:17 pandeiro: probably not

15:18 TimMc: romanandreg: And your ns has something like (:use [leiningen.deps :only [deps]]) ?

15:18 arthurdenture: or, for that matter, running M-x clojure-jack-in prompts me that an existing swank is running and should it kill it.

15:18 pandeiro: arthurdenture: huh, mine didn't do that probably because i killed the slime repl running process

15:18 romanandreg: TimMc: (ns leiningen.generative (:require [leiningen.core.eval :as eval]))

15:18 pandeiro: and slime-quit-lisp doesn't do it

15:19 romanandreg: I have a leinigen/generative.clj file in my project

15:19 pandeiro: i made a mess, i will just restart

15:20 TimMc: romanandreg: So, somehow lein's own jar isn't being added to your classpath.

15:20 romanandreg: TimMc: yes, when I see lein class path, leiningen is not there

15:21 TimMc: romanandreg: I didn't have to do anything special to trycljs' project.clj other than add the :hooks declaration. Maybe there is a typo in that?

15:21 romanandreg: TimMc: I tried adding leiningen-core to the dependencies, but I saw this is only working with a SNAPSHOOT

15:21 SNAPSHOT*

15:23 TimMc: :hooks declarations? I'm not adding any hooks to the project.clj, maybe that's it? => https://gist.github.com/23ba74ddbe42c5028a83

15:24 brett_h: Does "for" do something with stdout or side effects? Why does this return 1 but print nothing? (let [x [1 2 3]] (for [i x] (println i)) 1)

15:25 dsantiago: brett_h: for generates a sequence using the body of the for statement for the value of each item.

15:25 You want doseq.

15:26 brett_h: dsantiago: thanks, I'm still a bit confused why that wouldn't print as a side effect though

15:26 dsantiago: Because sequences are lazily evaluated, so it returns a sequence, no one wants it, it's ignored and moves on.

15:27 brett_h: gotcha, thanks

15:27 is doseq not lazy in that way?

15:27 dsantiago: Exactly.

15:27 brett_h: I'm doing something for the sidefeffects

15:27 thanks

15:28 timvisher: fwiw, downgrading from 1.4.0 to 1.3.3 seemed to do the trick for me

15:29 pandeiro: in the repl is there a way to see all the java methods an object instance has?

15:33 Vinzent: is it possible somehow to reify class known only in runtime? something like (let [c (Class/forName "...")] (reify c ...)) doesn't work

15:34 clojure_0000: clojure.core is auto loaded for all of my *.clj files. I have a file my_awesomeness.clj. I want it to be auto-loaded for all of my *.clj files. How can I make this happen?

15:34 I don't wnat to have to :require my_awesomeness in every *.clj file of mine

15:38 theignorati: does anyone know what is wrong with (command {:renameCollection "db.x" :to "db.y"}) using congomongo?

15:44 juhu_chapa: hi guys! is there a leiningen channel?

15:53 TimMc: juhu_chapa: This one, as far as I know. :-)

15:54 romanandreg: Oh, you're not writing a lein task? I guess lein tasks automatically have lein added to their classpath, or perhaps are run from inside lein's context.

15:56 juhu_chapa: TimMc: I just found the #leiningen channel

15:56 :P

15:57 chewbranca: anyone familiar with why hiccup doesn't support setting attributes in form helpers? is there a reason or is this just an issue awaiting a pull request?

15:59 sandy1986: First working example

15:59 http://78.34.71.100:8080/

16:00 Clojure application, using memcached as backend to store data

16:01 TimMc: Wow, some classy test data there.

16:01 Xenocorp: hahaha

16:02 might need some language filtering on it if it's going to be public

16:02 sandy1986: tzzz

16:02 Xenocorp: also, it seems to add from the front, rather than the back

16:03 sandy1986: yes, :)

16:03 $(x).prepend,.. easy to change it to append. But I think it's more fun this way

16:03 Xenocorp: does anyone know if I can define implementations of a function which takes a seq as an arg depending on the length of that seq

16:05 Vinzent: is it okay to maintain some state in compile time? Like, one macro adds some information to the atom, then other one uses it

16:05 sandy1986: spam-ed it, shame on you

16:06 Xenocorp: Vinzent: talking to me?

16:06 Vinzent: Xenocorp, no, to the channel

16:06 Xenocorp: oh ok

16:07 TimMc: Xenocorp: I highly doubt it, except in the case where the function is applied to a seq.

16:07 Xenocorp: ah ok

16:07 so I can't do

16:07 ([number]

16:07 number)

16:07 ([number (= (count num-seq) 2)]

16:08 where number and num-seq are args

16:08 Vinzent: Xenocorp, you want different code for the different (count num-seq)?

16:09 TimMc: Well, you can accept [x] and [x y], but you can't accept [x-of-2-elements] vs. [x-of-4-elements]

16:09 hmm, multimethods

16:09 Vinzent: or just (case (count num-seq) ...), actually

16:10 Xenocorp: ah dammit, I forgot case. Having said that, in other languages I avoid case like the plague. Is it ok in Clojure?

16:10 switch statements...

16:10 TimMc: Xenocorp: case is not switch

16:10 Vinzent: case is ok

16:10 Xenocorp: I'll re-read case docs then. Thanks

16:11 is there a bot for getting clojure doc url?

16:11 TimMc: $cd case

16:11 lazybot: clojure.contrib.condition/handler-case: http://clojuredocs.org/v/64

16:11 clojure.contrib.fcase/fcase: http://clojuredocs.org/v/298

16:11 clojure.contrib.fcase/re-case: http://clojuredocs.org/v/299

16:11 TimMc: Hmm... not quite.

16:16 Vinzent: so, what about having state in compile time between macro calls? Is it a good or a bad practice? Any ideas?

16:16 TimMc: Sounds hinky. Do you have a compelling reason?

16:16 sandy1986: is there a websocket implementation for ring?

16:16 that will be a nice fit in the todo app

16:16 geef: are there any good static analysis toolsets targeting clojure?

16:19 Vinzent: TimMc, I need to reify class which is known only in runtime. I can avoid it if I create a map with a factory functions, or if I'll save some state between my macro calls. Second sounds better, I think, but e.g. it put some restrictions on code's order

16:20 maybe there is easier way to do it?

16:28 chewbranca: ahhh interesting, I recant my previous statement about hiccup not supporting extra attributes, he is using a macro to add extra attribute support to all elements at once. A much more elegant solution than the brute force approach I had in mind. I have much to learn about clojure

16:59 AeroNotix: hi

16:59 I sorely want a decent book on clojure, any ideas?

16:59 I've read Practical Clojure

17:00 amalloy: JoC

17:01 AeroNotix: I was expecting that

17:01 :PO

17:02 clj_newb: does java swing/awt have a gui element which basically draws a rectangle + writes a piece of text around another element?

17:02 i.e. I have a text area -- I want it to have a border, and I wnat to put a label on top of it

17:02 I want to "frame" the component except I don't want a JFrame

17:02 does what I'm asking for make sense?

17:04 AeroNotix: ah, that's called a frame

17:04 pandeiro: AeroNotix: you can "preview" JoC and CiA today, why don't you check both out before SOPA passes?

17:04 clj_newb: AeroNotix: what awt/swing component do I want?

17:04 AeroNotix: I don't use swing

17:04 I use Qt

17:04 clj_newb: with clojure?

17:04 AeroNotix: but, you can use Qt.QtGui.QGroupBox (It's group box, I was confused)

17:05 no, I use it with Python, but there's a Java implementation called Jamba that people have had success with

17:06 So SOPA is going to pass 100%

17:06 ?

17:06 amalloy: that's not a frame. you want a panel

17:07 $google jpanel border

17:07 lazybot: [How to Use Borders (The Java™ Tutorials > Creating a GUI With ...] http://docs.oracle.com/javase/tutorial/uiswing/components/border.html

17:07 AeroNotix: I'll get you a pic

17:07 http://imgur.com/YyncW

17:09 clj_newb: whoa; too helpful

17:09 can you guys do my taxes too?

17:10 AeroNotix: pandeiro: Did you mean that I would have had to go to the bay of pirates to preview those books?

17:17 duck1123: Assuming it's within your means, I'm sure the authors of those fine books would prefer if you got a copy from their website

17:20 * technomancy resets the "It has been [ ] days since m-expressions were last proposed" counter.

17:20 technomancy: =\

17:25 TimMc: technomancy: Mailing list?

17:25 technomancy: yup

17:26 AeroNotix: anyone feeling up for critiquing some code/

17:26 ?

17:26 http://pastebin.com/PUmZ6qJP

17:27 duck1123: I always buy the books I want

17:27 bobhope: Has anyone been doing much with fork/join in clojure? I just wrote a very simple function to allow clojure functions to be trivially transformed into fork/join tasks

17:28 TimMc: AeroNotix: You can't run it with negative numbers.

17:28 AeroNotix: TimMc: That's interesting. Thanks.

17:29 TimMc: Runs with them for me?

17:29 TimMc: AeroNotix: (my-max [-4 -5]) => 0

17:30 AeroNotix: ah, I am running it with a quoted form

17:30 TimMc: ?

17:30 AeroNotix: (my-max '(-99 -11 -44 1 44))

17:30 I'm not 100% with the lingo

17:30 TimMc: Doesn't matter.

17:31 If all the numbers are negative, your function returns zero.

17:31 AeroNotix: ohh all negative

17:31 it does indeed. I see why

17:31 brett_h: reiddraper: https://github.com/reiddraper/sumo/pull/7

17:32 amalloy: the root issue, i think, is that max is not a total function on lists of numbers: it can't return a result for the empty sequence

17:32 AeroNotix: Isn't it that i'm setting champion to zero?

17:32 at the beginning, so all negatives are losing?

17:33 amalloy: that's a symptom of the root issue (/me seems to be getting philosophical)

17:33 AeroNotix: heh.. :)

17:33 amalloy: the right answer is to init champion to the first element in the list

17:33 AeroNotix: ahh

17:33 I tried with nil but it seems clojure sees nil as devoid of value

17:33 amalloy: but you can't always do that, because of the root issue

17:33 AeroNotix: I see

17:34 I see

17:34 amalloy: you can start it with Double/NEGATIVE_INFINITY, which would sorta work

17:34 (and is a common solution to this sort of problem)

17:35 but you're still punting on how to handle an empty list. is it really reasonable for (my-max) to return Double/NEGATIVE_INFINITY?

17:36 &(max)

17:36 lazybot: clojure.lang.ArityException: Wrong number of args (0) passed to: core$max

17:38 AeroNotix: hmm, I'm gonna play around....

17:38 this is for a 4clojure thing

17:39 when I call it as (my-max [] ) I get nil. That's correct, no?

17:39 amalloy: what is correct? what is the largest element in an empty sequence? the right answer is "you asked the wrong question, dude"

17:40 AeroNotix: Forgive me for being blunt but, are you high?

17:40 amalloy: hahaha

17:40 no

17:40 AeroNotix: :P

17:41 amalloy: i'm saying you're trying to solve a problem that can't be solved. it is impossible to find the largest element in an empty sequence. just throw an exception like clojure.core/max does

17:41 technomancy: the correct answer is 無

17:41 AeroNotix: oh right ok. Thanks. Pass the bowl, man.

17:41 technomancy: http://en.wikipedia.org/wiki/Mu_(negative)

17:41 AeroNotix: I understand now. I didn't know max threw an error when (= (empty? []) true)

17:42 amalloy:

17:43 man, unicode has all kinds of crazy stuff

17:43 AeroNotix: I once saw dead people in Unicode

17:46 bobhope: is apply fast in clojure?

17:46 or is it much faster to use a macro

17:46 amalloy: i find it hard to conceive of a case where "apply" and "use a macro" are two equivalent solutions to a problem

17:47 bobhope: so, i am writing a simple binding to fork/join

17:47 let me post it on pastebin

17:47 http://pastebin.com/M0Hpp2ST

17:48 I could make apply-fork a macro or a function

17:48 it's important for it to be as fast as possible

17:49 so I could do "`(.fork (mk-task ~the-fn ~@args))", or I could do what I already have

17:49 and a similar situation in mk-task

17:50 since if I can minimize the fork/join task creation overhead, I'll get much better performance and can use finer granulatiy

17:50 technomancy: are people trying out the new clj-stacktrace-aware swank?

17:51 amalloy: i mean, if apply-fork is always going to be a literal in your source code, with its args right there in front of it, then you can make it a macro, and it will obviously be faster by a non-zero amount

17:52 bobhope: my goal is to make it as easy as possible to rewrite divide-and-conquer code that exists to use fork/join

17:52 without thinking about it much

17:52 amalloy: but (a) you'll be limiting how apply-fork can be used, and (b) the gain will be like *nothing*

17:52 brett_h: technomancy: is that a branch?

17:52 technomancy: brett_h: it's version 1.3.4-SNAPSHOT

17:53 brett_h: it's on the 1.3.x branch, but you should just use it from clojars unless you're fixing a bug or something

17:53 amalloy: i mean, you're surely forking because you have actual cpu work to be done. if "calling a single function" is your bottleneck, your tasks are way too small

17:53 bobhope: that's one problem

17:53 i'm going to be attempting to parallelize core.logic

17:53 which is embaressingly parallel

17:53 but its tasks are tiny

17:54 and it's basically impossible to coarsen the tasks

17:54 so cutting out a 1ms overhead for dispatch could result in a 30% speedup

17:54 or ever a 100us overhead

17:55 amalloy: i doubt you'll get that much change, and also i would be surprised if everything core.logic needs to do is knowable at macro-expansion time

17:55 brett_h: technomancy: is the plugin all I need still?

17:55 technomancy: http://pastebin.com/EGQmEpQt

17:55 technomancy: brett_h: should be; just be sure you don't have an older clj-stacktrace anywhere

17:55 bobhope: i'm going to just target the main branch points in the library

17:59 brett_h: technomancy: cleaned up my old clj-stacktrace plugin but still pst-elem-str error on "lein swank"

17:59 hmm

17:59 technomancy: must still be an old copy somewhere

18:01 brett_h: technomancy: I don't know, maven repo would be fine, right? http://pastebin.com/mMABLKHq

18:01 nothing anywhere else

18:02 technomancy: copies in ~/.m2 won't be put on the classpath unless :local-repo-classpath is set

18:02 brett_h: it's not

18:02 no hackery, simple lein project

18:02 technomancy: the jars in ~/.lein/plugins are uberjars

18:03 so one of them could contain an old clj-stacktrace

18:04 brett_h: technomancy: that was it :) and wow, beautiful

18:04 <3

18:05 technomancy: definitely need to add that to the troubleshooting section before a release

18:06 brett_h: technomancy: lein-difftest was the culprit in this case, if it helps for the notes

18:06 technomancy: brett_h: aha; well I'll be sure to cut a new release of that first.

18:06 thanks

18:08 clj_newb: i'm developing in the repl; I can't use reload-all since it forces some fiels which execute defstructs to be reloaded more than once. Is there someway I can say "reload everyfile exactly once" or "unload all *.clj files" ?

18:08 or somehow tell load-file "reload all dependencies"

18:09 technomancy: best thing is to probably stop using defstructs

18:09 clj_newb: errr, I mean defrecords

18:10 typo

18:10 i'm developing in the repl; I can't use reload-all since it forces some fiels which execute defrecords to be reloaded more than once. Is there someway I can say "reload everyfile exactly once" or "unload all *.clj files" ?

18:10 technomancy: tempted to say my advice still stands =)

18:12 if you aren't using protocols you probably shouldn't use defrecord

18:14 TimMc: technomancy: I'm often tempted to use defrecord because it allows me to centralize documentation of an associative data structure's format.

18:15 * technomancy prefers reusable preconditions for that

18:15 amalloy: clojurebot: Records (and, long ago, structs) |are| "advanced features", which can cause significant pain if you don't get all the subtleties. If you're using them to create "classes" because classes are awesome, then you are probably better off just using plain old hashmaps, possibly with a :type key if you want to be clear about what type they are.

18:15 clojurebot: In Ordnung

18:17 technomancy: clojurebot: records and structs?

18:17 clojurebot: Titim gan éirí ort.

18:17 technomancy: clojurebot: (throw (InsufficientFuzzinessException.))

18:17 clojurebot: Gabh mo leithscéal?

18:19 clj_newb: amalloy: ouch :-)

18:19 amalloy: clojurebot: Records?

18:19 clojurebot: Pardon?

18:19 amalloy: sigh

18:20 brett_h: is there a debugger for clj 1.3+ ?

18:20 TimMc: clojurebot: clever bot

18:20 clojurebot: *flexes its talons while eyeing TimMc*

18:20 amalloy: clojurebot: Records |are| (and, long ago, structs were) "advanced features", which can cause significant pain if you don't get all the subtleties. If you're using them to create "classes" because classes are awesome, then you are probably better off just using plain old hashmaps, possibly with a :type key if you want to be clear about what type they are.

18:20 clojurebot: c'est bon!

18:20 technomancy: clojurebot needs replace-key and replace-value commands

18:20 clj_newb: amalloy: this is clear that Clojure has similar memory as me

18:21 TimMc: technomancy: reusable preconditions... got a blog post on that?

18:21 or any other expansion on the idea?

18:21 clj_newb: is there a way with clojure to get a list of all functions that match a given regexp?

18:22 TimMc: clj_newb: find-doc is pretty close

18:22 technomancy: TimMc: http://blog.fogus.me/2009/12/21/clojures-pre-and-post/ and JoC... maybe the trammel library

18:23 not that I've used it; it's just where I would look if "I'm having a hard time keeping track of the keys needed for this specific map" ever became a problem for me.

18:23 TimMc: thanks

18:25 I guess I'm not really worried about catching bugs so much as centralizing the documentation in a predictable place.

18:25 technomancy: I think if your preconditions are formalized in a def they can serve as documentation

18:25 TimMc: If 2 namespaces all rely on a certain data structure, where does that knowledge live? :-)

18:26 s/2/3/ whatever

18:26 technomancy: you'd have that same problem with defrecord

18:26 TimMc: Maybe a macro (def-data-structure ...) that compiles to nil. :-P

18:27 Oh, with defrecord I create a new namespace and define it there.

18:27 technomancy: (defn valid-abc-map? [x] (every? x [:a :b :c])) ; is really all it takes

18:28 TimMc: It's also easier if there is a well-defined set of operations to be performed on the data structure -- then those live in a namespace and there's a nice big comment at the top.

18:28 technomancy: none of that is specific to records

18:28 TimMc: *1 was in reference to the general case.

18:28 clojurebot: excusez-moi

18:29 technomancy: hmm; another use case for rpartial. they don't happen as often as you'd think.

18:29 AeroNotix: technomancy: off-topic but, fave clojure book?

18:30 TimMc: technomancy: rpartial?

18:30 technomancy: AeroNotix: I've only read the 1st edition of the Prags' and JoC. both worth reading; JoC is more fun.

18:30 TimMc: partial, but from the right

18:30 AeroNotix: technomancy: thanks

18:31 clj_newb: alright

18:31 this is probably the wrong way to solve this problem

18:31 but is there a way to (1) get a list of all loaded *.clj fiels

18:31 and (2) a way to mark fiels are unloaded (so they get reloaded)?

18:34 technomancy: maybe someone who actually likes records could suggest a better way to make them work with interactive development. =)

18:34 TimMc: clj_newb: Trying to write your own everything-reloader?

18:34 That might be nice.

18:34 I wonder if it is possible.

18:37 I guess as long as you don't hold on to instances of replaced classes you might be OK.

18:41 clj_newb: records have been causing me so much trouble

18:41 I really don't know why i';m not using maps

18:44 technomancy: about to release swank 1.3.4; speak now or hold much peace &c.

18:46 amalloy: clj_newb: good news, clojurebot has a suggestion for you in that case

18:46 if he managed to remember it this time

18:47 clj_newb: amalloy: what should I ask clojurebot?

18:47 amalloy: ~records

18:47 clojurebot: Records are (and, long ago, structs were) "advanced features", which can cause significant pain if you don't get all the subtleties. If you're using them to create "classes" because classes are awesome, then you are probably better off just using plain old hashmaps, possibly with a :type key if you want to be clear about what type they are.

18:47 amalloy: just referring back to that, is all

18:48 clj_newb: amalloy: I feel Like I will be a better clojure programmer if I listen to your advice more often.

18:48 technomancy: alternative approach is to just mine clojurebot's factoid database

18:49 you will either go insane or emerge victorious.

18:49 or both?

18:49 clj_newb: ha

18:50 I wrestled with defrecord

18:50 and I have won

18:50 defrecord is now hiding underground and will screw up my code on a later date.

18:51 bobhope: Is there a reason that some people wrap every java interface with a new protocol and then extend-type the java interface instead of just wrapping the methods with defns?

18:52 s/java interface/java class/

18:57 rata_: hi

19:08 alexbaranosky: Anyone know of another way to use `some` than as a predicate? It returns true of nil

19:13 rata_: alexbaranosky: what do you mean?

19:13 alexbaranosky: rata_, nothing now :) I didn't realize that some returned the first truthy value

19:13 rata_: ok

19:16 LauJensen: are you there?

19:30 alexbaranosky: we've got a `symbol?`, `keyword?`, `class?`, `string?` etc ... how about a `named?`

19:59 gnnr_: What's the best way to set class path for a new project? I have read a lot of documentation, but still can't seem to get clojure to recognize class path

19:59 Thanks for any help

20:09 technomancy: gnnr_: you shouldn't set the classpath

20:12 weavejester: FYI: https://github.com/heroku/heroku-buildpack-clojure/issues/10

20:13 weavejester: technomancy: Aha, awesome :)

20:13 technomancy: Well, when it's fixed it will be at least :)

20:14 technomancy: weavejester: yeah, I think I may decompose plugins into their own dependency listing in lein 1.6.3 rather than waiting for 2.0.

20:14 depending on how painful that is to implement without pomegranate =\

20:14 any thoughts on that?

20:15 weavejester: technomancy: I'd really like that.

20:15 technomancy: Although I wonder whether that shouldn't be 1.7.0 instead of 1.6.3

20:16 Semantic versioning and all.

20:16 technomancy: yeah, totes

20:16 gnnr_: yea I'm trying to configure swank, and slime, neat that you responded here

20:17 technomancy: gnnr_: are you having trouble with the instructions here? https://github.com/technomancy/swank-clojure/

20:18 choffstein: Hey all :) Quick question: I am calling reduce over a transient map and my function is calling (and only calling) assoc!. I keep getting a OutOfMemoryError -- which makes no sense to me, since I thought assoc! would be in place. Any ideas? (I can post a gist if necessary)

20:19 gnnr_: oh great, thank you so much. I will go through this carefully

20:19 technomancy: gnnr_: if you can leave a comment on whatever old instructions you were using earlier mentioning that they're badly out of date, that would be super too. =)

20:20 gnnr_: sure

20:20 choffstein: https://gist.github.com/1525702

20:22 amalloy: choffstein: well, i have to say it seems a little weird that you can't hold two million objects on your heap, but your code looks fine

20:22 choffstein: amalloy: Well, I am just doing the clojure repl, so that may be why?

20:23 amalloy: for given values of fine; really all you've done is reinvent (into {} (for [k (range 1 1e6)] [k (* 2 k)]))

20:23 technomancy: default heap on client jvms is pretty small

20:23 choffstein: Right. I know. I was just seeing if transients were faster than into :)

20:23 unless … into uses transients?

20:23 technomancy: but yeah... maybe if a bunch of other stuff was loaded

20:23 amalloy: give the man a cigar

20:23 technomancy: choffstein: it does

20:24 choffstein: of course it does

20:24 amalloy: and fwiw, your code runs fine for me, as has other code with larger maps

20:24 er.....except i tried running my code, not yours. let's try again

20:25 whew. yours also works fine

20:25 choffstein: haha. okay. thanks :)

20:25 it just seemed strange to me that I could do a (def ks (doall (range 1 1e6))) -- but for some reason, ran out of memory doing, what seemed like, im memory updates

20:25 kenth: why does some functions require #' in (meta #'func) while some do not?

20:26 TimMc: kenth: Some are macros.

20:26 choffstein: whoops -- gotta run. later everyone

20:27 TimMc: kenth: A macro can wrap the name in (var ...)

20:28 kenth: For example, the expansion of (doc ...) includes (meta (var ~name))

20:29 kenth: that makes sense, thanks

20:33 TimMc: doc is purely a REPL utility, so it goes for maximum ease-of-use and least flexibility. :-)

20:34 and meta is intended for use on *anything* with metadata, not just vars.

20:34 kenth: Oh, and #'foo is just sugar for (var foo), in case that wasn't clear.

20:36 gf3: hola, must be having a noob issue here, how do I compose java.lang.* functions?

20:36 devn: l

20:36 gf3: e.g. Math/sqrt

20:37 devn: gf3: could you post a failing example?

20:37 TimMc: gf3: They're methods, not functions. :-/

20:38 gf3: devn: just playing around with something like: ((comp list int Math/sqrt) 25)

20:38 devn: ,((comp list int Math/sqrt) 25)

20:38 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to find static field: sqrt in class java.lang.Math, compiling:(NO_SOURCE_PATH:0)>

20:38 devn: ,(import java.lang.Math)

20:38 clojurebot: java.lang.Math

20:38 devn: ,((comp list int Math/sqrt) 25)

20:38 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to find static field: sqrt in class java.lang.Math, compiling:(NO_SOURCE_PATH:0)>

20:39 TimMc: devn: It's not a function!

20:39 devn: :\

20:39 * devn is wearing his orthopedic shoes

20:39 * devn stands corrected

20:39 TimMc: haha

20:39 devn: I use that one a lot. Thankfully you haven't heard it before.

20:39 TimMc: gf3: Short answer, #(Math/sqrt %) is a function you can use.

20:40 gf3: TimMc: I suppose it's just confusing as it appears to work like a function: (Math/sqrt 25)

20:40 TimMc: yep

20:40 gf3: TimMc: vs (.sqrt 25) or something

20:40 TimMc: Convenient but misleading.

20:41 gf3: TimMc: thank you

20:41 mrb_bk: If someone has work in a Github repo that's more recent than what's on clojars, what's the best way to include the latest work in a project

20:41 TimMc: &(. java.lang.Math sqrt 5) ; gf3

20:41 lazybot: ⇒ 2.23606797749979

20:41 TimMc: ^ that's the fully expanded form

20:41 gf3: TimMc: ahh

20:41 TimMc: where . is a special form for Java interop

20:42 mrb_bk: You can use a lein checkout dep

20:42 Keep the dependency in your project.clj, but create a checkouts folder and symlink checked-out projects into it.

20:43 mrb_bk: ah awesome

20:43 TimMc: what about the version number?

20:43 TimMc: Hmm, dunno!

20:44 Maybe it is ignored.

20:45 mrb_bk: awesome

20:45 it does "Copying 3 files to..."

20:47 TimMc: thanks!

20:47 TimMc: No problem!

20:47 mrb_bk: Leiningen has all sorts of cool tricks. The README has some good stuff, but also look at the sample project.clj.

20:48 mrb_bk: TimMc: one more noobish thing that annoys me -- I'm working with a SLIME like setup with vim and a lein repl -- I use "lein repl" in the root of my project dir. Isn't that supposed to pick up all of my project files?

20:49 TimMc: Not sure what that last sentence meant.

20:49 It's supposed to arrange the classpath, start a REPL, and optionally select your main namespace.

20:55 devn: wow. i haven't read anything even remotely related to programming in over 4 days.

20:55 * devn boggles.

20:57 TimMc: devn: http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx

20:57 unless you're going for a record

20:57 devn: TimMc: not at all. just hopping back into the saddle tonight.

20:57 i needed a few days of food, sleep, and annoying conversations about politics to get me back into the swing of things ;)

20:59 TimMc: i already am interested. :)

21:01 TimMc: i've done a fair bit of study on vietnam, so the scare factor of this article already has me firmly within its grip

21:01 pun intended

21:02 TimMc: devn: Good, let me know if the author is talking out of his ass on that bit.

21:09 mrb_bk: TimMc: Ah yes I guess I was talking about selecting my main namespace

21:11 devn: He never mentions Ho Chi Minh which is sort of surprising IMO

21:12 TimMc: the analogy seems tied to a particular reading or two. That's not saying it misrepresents, but it is surely a wild analogy

21:17 TimMc: He misses a lot of boats when talking about Kennedy, Johnson, the reasons behind their decisions, etc.

21:17 It just doesn't work on the level he's trying to apply it unless you accept a fuzzy definition of the history of Vietnam

21:18 choffstein: Is there an available alternative to http-agents for 1.3?

22:07 romanandreg: is anyone here experienced doing leiningen plugins? :-)

22:15 I've inferred so far that, if I want to be able to use the leiningen API (have it in the classpath) I need to set the evan-in-leiningen flag to true in the project.clj of the leiningen plugin project, however, when I do that the version of the clojure running on repl becomes 1.2.1, is there anyway to use 1.3, and have the leiningen library on the class path?

22:20 amalloy: i believe the answer to that is no. leiningen and its libraries are on 1.2

22:22 romanandreg: amalloy: uhmm I'm trying to implement a small plugin to run clojure.test.generative tests, however that library requires 1.3, that being the case, I cannot implement a plugin for leiningen then?

22:22 amalloy: *shrug* not a lein expert by any means

22:24 romanandreg: amalloy: uhmm… I have been all afternoon trying to make this work :-(, I've learned tons though it's a pretty frustrating process not getting any victories so far

22:24 technomancy: whenever you have chance, pls check this questions I made before, I know is likely you could help me here, but I guess you are not around..

22:25 jackhammer2022: http://k.timmc.org:7013/ try ClojureScript

22:40 * jebberjeb is reading The Joy of Clojure

22:42 romanandreg: jebberjeb: by any chance if you have the ePub and an iPad try this app called readmill, I'm leaving a lot of comments about this book there => http://readmill.com/books/the-joy-of-clojure-thinking-the-clojure-way

22:43 jebberjeb: romanandreg: I do have the ePub, but I've got an android tab -- maybe they've got the app too

22:43 romanandreg: jebberjeb: I really hope they do, the app is pretty great, and to share highlights and comment is pretty great

22:44 jebberjeb: cool, thanks for the tip

23:24 technomancy: romanandreg: it sounds like you basically want to use the same approach as leiningen.test

23:24 you need :eval-in-leiningen, and then the code that runs in the context of the project needs to use leiningen.compile/eval-in-project

23:25 romanandreg: technomancy: yes, I tried exactly that

23:25 technomancy: however, when doing :eval-in-leiningen I get clojure 1.2.1, and test.generative requires 1.3, they are using some defs with meta-data flags that are not valid in 1.2)

23:25 technomancy: right

23:25 because you don't use test.generative in leiningen

23:26 you use it in the project

23:26 romanandreg: technomancy: I guess… I wanted to do a task to run generative tests though :-s

23:26 technomancy: right

23:26 notice that leiningen.test does not require clojure.test, it just calls eval-in-project on a form that contains (require '~'clojure.test)

23:26 romanandreg: uhmm

23:28 technomancy: so I might just try that and come back to you, I won't require test.generative on the same context as the leiningen task

23:28 as long as it is on the import block of the eval-in-project

23:28 everything should be good right?

23:29 technomancy: that's right

23:29 something like this: http://p.hagelb.org/test-generative.html

23:29 (except I have no idea how test.generative works)

23:30 it's really a shortcoming of the plugin guide that it doesn't cover this

23:31 romanandreg: technomancy: thanks! where is this plugin guide by the way… I've been able to learn all about plugin development by actually reading code :-)

23:31 I guide would be really helpful for sure

23:31 technomancy: romanandreg: it's in doc/PLUGINS.md

23:31 romanandreg: uhmm

23:31 I looked it up in the wiki

23:32 technomancy: yeah, the wiki isn't really used for official docs

23:32 I'll add a note to the wiki home

23:33 romanandreg: technomancy: I was going to suggest that :-)

23:34 technomancy: thanks for the feedback, I'll get back to you tomorrow, probably everything is gonna work...

23:34 technomancy: sure. there's also the #leiningen channel.

Logging service provided by n01se.net