#clojure log - Aug 01 2009

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

0:31 iBong: (for [x (range 4) y (range 4)] (print (+ x y)))

8:08 dysinger: monin

8:08 rhickey: hey

8:09 lbj: Hey guys - Ive imported ServletFileUpload into my namespace and I'm having a problem calling a method. Is there a way to list all methods imported from that namespace, ie ServletFileUpload/* and possibly see which args they take?

8:15 dysinger: can you pastie the error / code ?

8:16 lbj: You dont need it to tell me how to avoid hitting the javadocs everytime I have a question about a method :)

8:17 dysinger: That's what javadocs are for :)

8:17 You said you were "having a problem calling a method"

8:23 lbj: are you using emacs / slime ?

8:30 lbj my guess is that you are used to an IDE w/ refletion code completion pop ups

8:31 some of the newer ide plugins for clojure have that

8:31 I just hit C-c C-d C-d in emacs / slime to jump to the javadocs if I need it.

8:32 The intellij guy who is writing the clojure plugin showed it to us at the june meetup

8:32 looks pretty slick but i don't think I could ever leave emacs for lisp development

8:33 The editor still kicks arse all over the IDEs

8:36 lbj: Sorry, I was afk :)

8:37 Yes I think I'll be hard to drag away from Emacs as well. I think kotarak succeeded in doing Java reflections for his VimClojure

8:37 ...and if Vim can do it ...

8:37 @ dysinger

9:48 dysinger: Is there any code in contrib to reflect java object methods ("like poor-mans java version of find doc") ?

9:48 I didn't see any

9:48 was going to write one

9:49 Chouser: repl-utils/show ?

9:49 dysinger: dogh guess I didn't look hard

9:51 there we go :)

9:51 thanks Chouser

9:51 lbj: there you go ^

9:52 rhickey: anyone try new new yet? the latest infers the types

10:17 Chouser: rhickey: I'm getting NoSuchMethodError: clojure.lang.RestFn.<init>(I)V

10:17 still trying to find the specific cause

10:18 lbj: dysinger, Chouser: Thanks

10:18 rhickey: Chouser: getting it with the very latest?

10:19 chouser: did you ant clean contrib? I had that problem before I did

10:20 the latest new code builds and tests cleanly the latest contrib

10:20 Chouser: that's probably it -- just a sec

10:21 rhickey: Mark Tarver throws in the towel on Qi - "There is no such thing as free software. That’s the fallacy. There is only software that is paid for by somebody else."

10:21 Chouser: :-(

10:21 rhickey: http://groups.google.com/group/Qilang/browse_frm/thread/592773c562017d87

10:23 Chouser: ant clean in contrib fixed it.

10:24 so now if I hint any args on a new's method, all the unhinted are assumed to be Object or something?

10:24 rhickey: Chouser: right, no hint is Object, no hints at all tries to find a single method in your supers to override

10:25 methods overloaded w/same arity in supers require full matching type spec

10:26 in the no hints, override found, you'll get the exact signature from the super

10:27 http://www.lambdassociates.org/blog/prolegomena(1).htm

10:29 drewr: rhickey: thank you for paying for clojure

10:29 Chouser: well this is beautiful. the proxy form in lazy-xml has become a new that is smallar and undoubtedly more efficient

10:30 rhickey: I swapped out future-call and promise with new new

10:30 still to go: efficient self-calls and volatile

10:34 drewr: the bill is in the mail :)

10:35 Mark_Addleman: i see a weird interaction between a (println) statement and a very large sequence...

10:36 (deftest test-lots-of-times

10:36 (let [s (repeatedly #(java.util.Date. (long 0)))]

10:36 (dorun

10:36 (take 10000000 s))

10:36 #_(println "done")))

10:36 this code runs fine

10:36 but when i remove the comment, i get an out of memory error (my JVM has 32m of heap)

10:37 why would the presence of println cause clojure to retain memory?

10:41 opqdonut: i'd guess because s doesn't leave scope as quickly then

10:42 lbj: I'm looking forward to the answer rhickey, looks like unexpected behaviour :)

10:42 opqdonut: hmm, but isn't take lazy?

10:42 lbj: Hence the dorun

10:42 opqdonut: ah, dorun

10:42 yes

10:42 Mark_Addleman: just ran another test:

10:42 (deftest test-lots-of-times

10:42 (let [s (repeatedly #(java.util.Date. (long 0)))]

10:42 (dorun

10:42 (count (take 10000000 s)))

10:42 #_(println "done")))

10:43 drewr: lisppaste8: url

10:43 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

10:43 Chouser: Mark_Addleman: please don't paste multiple lines here

10:43 Mark_Addleman: this also explodes with OOM. i'd expect count to be a simple accumulator and not hold onto the head

10:43 drewr: Mark_Addleman: ^^

10:43 Mark_Addleman: ah, sorry

10:43 lbj: Chouser: Is it really a problem when were speaking 5 - 6 lines?

10:43 I think thats an easier read than hunting links, personally

10:44 lisppaste8: Mark_Addleman pasted "unexpected out of memory" at http://paste.lisp.org/display/84564

10:45 Mark_Addleman pasted "untitled" at http://paste.lisp.org/display/84567

10:46 Mark_Addleman annotated #84567 "untitled" at http://paste.lisp.org/display/84567#1

10:49 Mark_Addleman: if i'm not doing something stupid with the code, i'll file a bug report. what's the process for that?

10:52 lisppaste8: Mark_Addleman pasted "untitled" at http://paste.lisp.org/display/84568

10:53 Mark_Addleman annotated #84568 "untitled" at http://paste.lisp.org/display/84568#1

10:54 Mark_Addleman annotated #84568 "untitled" at http://paste.lisp.org/display/84568#2

10:54 Mark_Addleman annotated #84568 "untitled" at http://paste.lisp.org/display/84568#3

10:55 Mark_Addleman annotated #84568 "untitled" at http://paste.lisp.org/display/84568#4

10:55 Mark_Addleman annotated #84568 "untitled" at http://paste.lisp.org/display/84568#5

10:56 rhickey: Mark_Addleman: locals are cleared only on tail calls

10:56 Mark_Addleman: locals are cleared only on tail calls

10:57 Mark_Addleman: rhickey: i don't follow. isn't the the local lazy? i understand why it would retain the latest value from the seq, but why more than that?

10:58 rhickey: following the count cal with print means local s is held until the print call

10:58 lbj: Ah ok, makes sense

10:58 rhickey: dorun walks while local s holds head

10:59 realizing entire list

10:59 lazy != ephemeral

10:59 Mark_Addleman: according to the docs, dorun does not retain the head. doall does

11:00 opqdonut: right

11:00 it's s that retains the head

11:00 Mark_Addleman: ah! alright

11:00 opqdonut: it has to be held on to in case the println needs it

11:00 Mark_Addleman: thanks for that

11:00 rhickey: this has nothing to do with dorun/doall holding the head, local s is holding the head

11:02 Mark_Addleman: ok, so what i want is a generator. i want to return an infinite number of dates (where each date is one second later than the previous one). i don't need to retain the head.

11:02 Chouser: I'm certainly sympathetic with Traver's frustration with his own project, but I find his broader conclusions uncompelling. I hope he finds the personal satisfaction he's seeking.

11:03 Mark_Addleman: i know how to write a function that does that, but i want that function to play well with the seq library... that's where i went awry

11:04 Chouser: java.util.Dates?

11:05 Mark_Addleman: yes

11:05 Chouser: if you use something like 'iterate', you shouldn't have to worry about cleared locals, tail calls, etc.

11:07 Mark_Addleman: ok... i've seen the iterate function but i haven't wrapped my head around how to use it

11:08 Chouser: ,(take 3 (iterate #(let [d (.clone %)] (.setSeconds d (inc (.getSeconds d))) d) (java.util.Date.)))

11:08 clojurebot: (#<Date Sat Aug 01 08:11:29 PDT 2009> #<Date Sat Aug 01 08:11:30 PDT 2009> #<Date Sat Aug 01 08:11:31 PDT 2009>)

11:09 Mark_Addleman: i see. i was using a true stateful function with a ref to store my counter (thinking there had to be a functional solution).

11:09 thanks for the pointer

11:12 lbj: By the by - Anyone know of a simple thin interface to unix syslog from Java ?

11:18 dysinger: lbj to write or read ?

11:18 Mark_Addleman: you want to post to syslog?

11:18 dysinger: log4j has a syslog adapter

11:18 but thats write only

11:18 lbj: To write

11:18 I'm looking at syslog4j atm

11:19 dysinger: that's why I'm using log4j under commons logging

11:19 lbj: Just wondering if one had tried something and came back with a good report

11:19 dysinger: is because I can pipe it to syslog for production

11:19 I have not wired it up yet but that's the plan

11:19 lbj: Ok

11:20 dysinger: no other popular loggers can pipe to console in dev & syslog in production

11:20 that I know of

11:20 lbj: So where are you piping it now?

11:21 I'll take a loo at log4j

11:21 syslog4j looks very simple too though

11:21 Mark_Addleman: depending on what you're trying to do, log4j can be too much candy for a nickle

11:21 Chouser: lbj: clojure.contrb.logging ?

11:22 lbj: Oh you know I never look in contrib :)

11:22 Chouser: that just wraps other libs though, like log4j. I think.

11:23 lbj: Ah ok, Ill check it out

11:24 Google Code still comes up as the first hit when I search for Clojure contrib, consider shutting it down ?

11:27 (defmacro log4j-logging) is a macro which takes no arguments and returns a struct - why is that a macro ?

11:36 Chouser: I sense you had a hand in this :)

11:41 bairespace: I keep seeing the suggestion that clojure-in-clojure might be adapted to run on the objective C runtime

11:41 & I'm wondering: could a similar thing be done wrt the emacs runtime? or wrt other lisps?

11:41 Chouser: lbj: logging? not at all.

11:42 bairespace: in order to run clojure inside emacs? or emacs on the iPhone?

11:44 bairespace: chouser: clojure inside emacs

11:50 lbj: Back up the iPhone - Somebody found a way to execute Clojure on it ?

11:51 bairespace: http://github.com/technomancy/clojure-mode/tree/master <-- Technomancy has an install function which will pull down all dependencies and show you an example of .emacs

11:51 bairespace: Chouser: clojure inside emacs.

11:52 lbj: thanks.

11:52 Chouser: bairespace: an interesting idea. don't see why not.

11:52 bairespace: it wouldn't be full Clojure of course -- not threads, etc. but it might be possible for some subset of clojure code to be compiled to elisp

11:54 lbj: back to the iphone.... :)

11:54 bairespace: I was thinking there might be some other snag: slowness, maybe. Luke Gorrie's distel did something similar for a subset of erlang, I think.

11:56 lbj: dysinger: I dont see syslog as an output option for log4j, Windows NT Log Service is supported however

12:14 bairespace: Chouser: only need to call or create elisp code from Clojure, really. Especially if it was convenient to use more than one such adaptation of Clojure in the same program--with Clojurescript, say.

12:15 got to go...

12:19 Mark_Addleman: lbj: http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/net/SyslogAppender.html

12:25 lbj: Mark_Addleman: Thanks

12:44 Let me just see if I got this straight. If I wrap my functions in a log macro, which then uses send-off to start some logging service, then send-off it self will regulate how many threads to launch at a time so that this does not destroy overall performance of the app ? Or do I need to be more strict with my ressources?

12:46 Chousuke: lbj: agents have a thread pool

12:46 so it won't spawn new threads for every send-off

12:53 lbj: So I wont need to be more strict, but also be prepared for some delay. Sounds good

14:57 alrex021: When using for example :only keyword when importing specific function from another namespace, why are square brackets used? e.g. (use '[clojure.contrib.math :only (round)])

14:57 trying to get my head around this

14:58 Chousuke: it's a list of specific functions to import

14:58 in your case, a list with one item

14:58 alrex021: I though lists where represented with () and not like vectors []

14:58 I mean

14:58 Chousuke: ah, wait, I misread

14:59 alrex021: sorry I see square brakets before the use '\

14:59 if no keywords, then it looks like (use 'clojure.balabla.bla)

14:59 Chousuke: yeah

14:59 the plain symbol is just a shortcut

15:00 the vector specifies a library and its options.

15:00 alrex021: oh I see, so it has to be a vector in those cases

15:00 Chousuke: yeah.

15:01 (use 'foo.bar) is short for (use '[foo.bar])

15:01 but it doesn't work if you have :as or :only etc.

15:01 so you need the vector.

15:02 there was some talk about improving the import syntax, but I don't think anyone did anything :/

15:07 alrex021: yup, confusing for new comer to the language like myself

15:09 I understand shortcuts like #(..... %) for fn [] body ....but no so much the one above :)

15:10 Chousuke: the ns macro syntax is not too complex after you get it... but it isn't that well documented either.

15:10 the documentation is kind of scattered

15:11 alrex021: I'm reading the clojure book for the second tome

15:11 time...things ae making more sense this time around

15:11 Chousuke: heh

15:12 I suppose it's true that you need to read a book at least twice to make any sense out of it.

15:12 alrex021: I tell you what, first time coming to any lisp dialect, what a mind f***

15:13 Chousuke: heh

15:13 I think it's the functional programming that gets people at first.

15:13 and the parentheses, until they understand it's really no worse a syntax than reserved words and curly brackets

15:13 alrex021: that book maid very little sense first time, makes you feel a bit helpless especially having over a decade in programming behind me....well oop and less fp

15:15 but starting to really enjoy it now... I have a strong web dev background so I see myself joining the web framework dev efforts in clojure space

15:15 if I get that far ;)

15:18 u r abs right. it is the fp that get ppl

15:25 hserus: in my case, im currently stumbling at the lazy concepts :)

15:25 got a quick question on that, is there a pattern on when to evaluate a lazy sequence?

15:27 hoeck: hserus: what do you mean by "evaluating"?

15:29 hserus: i mean realizing a lazy sequence (basically doing a dorun)

15:30 what do you usually refer this as?

15:30 hoeck: maybe "forcing" a lazy sequence

15:31 only when the computation itself has side effects

15:32 and you want those side effects now

15:32 hserus: right, when i want to test a function that returns a lazy sequence (and since that is the default, i guess in most cases) i end up forcing the lazy sequence

15:34 hoeck: yeah, and printing (e.g. at the repl) always forces the lazy sequence

15:34 hserus: yup, learnt is the hard way.. i was wondering why my unit tests fail, but the same code works on repl

15:39 Chousuke: sometimes you want to force stricness so that you don't get "too lazy"

15:39 strictness*

15:40 I mean, there are situations where you end up generating so many thunks that it blows the stack.

15:40 hserus: currently, for my web app, an example where im doing this is just before persistence of my entities..

15:40 is that correct?

15:41 Chousuke: I can't say.

15:41 but if it works, it's probably okay :P

15:41 hserus: hehe

15:42 Chousuke: forcing strictness only gets you potentially suboptimal performance if you end up doing it in places where you could afford to be lazy.

15:43 hserus: my doubts has been around unit testing, so is it fine that i have to force sequences in my tests for functions that return lazy sequences?

15:47 hoeck: only if the lazy-seq returning functions, for some good reason, have side effects you want to test

15:49 lbj: How is arity dispatching handled when in a macro ?

15:50 hoeck: hserus: if you only compare the results with a literal list, like (= '(1 2 3) (my-fn)), then you don't have to (doall (my-fn)), = does this when necessary

15:51 hserus: hoeck: even when my-fn returns a lazy seq?

15:52 hoeck: lbj: at compile time, the compiler counts the expressions passed to the macro

15:53 lbj: hoeck, I meant practically :) I would have imagined something like this to work (defmacro tst ([x] `(tst 5 ~x)) ([x y] `(+ ~x ~y))), but no dice

15:57 hoeck: lbj: it works, try (macroexpand-1 '(tst 1))

15:58 lbj: Interesting - It expands correctly in both cases, but throws a 'new instance' exception when run... ?!

15:58 hoeck: hserus: '=' will just evaluate as much elements as it needs to compute a result

15:59 lbj: user> (macroexpand-1 '(tst 1 2))

15:59 (clojure.core/+ 1 2)

15:59 How can this blow up with an exception ?

16:00 Argh, my bad, misplaced symbol

16:00 sorry

16:00 danlarkin: ,(let [s "/\\\""] (= (name (symbol s)) s))

16:00 clojurebot: false

16:00 danlarkin: is that a bug?

16:07 hoeck: ,(name 'a/b)

16:07 clojurebot: "b"

16:08 danlarkin: d'oh

16:08 it's thinking it's the namespace I guess?

16:08 iBong: any idea why I get a "function import is void" error when trying to eval a source file buffer, but it runs fine when pasted into the REPL?

16:11 hoeck: danlarkin: well, "/" is at reserved for namespace-name separation, so it makes no sense to use it as a symbol character except for divide

16:11 danlarkin: Hmmm

16:12 hoeck: danlarkin: so symbol just reads "/bla" as symbol bla without a namespace

16:12 danlarkin: hoeck: ah yes, of course, you're right

16:13 hoeck: danlarkin: mhhh, only the name function returns the correct name, str returns "/bla"

16:14 danlarkin: yeah, now I have to decide it I should use name or subs str

16:15 hoeck: danlarkin: I guess one should be careful when generating symbols from strings, using symbol, the reader is more strict and doesn't read symbols like '/bla

16:16 danlarkin: well this is just covering corner cases in my tests

16:27 falkor: hi, I am trying clojure and am having a 110% newbie problem...

16:30 hserus: falkor: what is it?

17:12 l0st3d: ,(do (def t 0) (binding [t 1] (println t)))

17:12 clojurebot: DENIED

17:15 l0st3d: Hi, I'm learning clojure atm - correct me, but shouldn't (def t 0) (binding [t 1] (println t)) print "1" ? - it prints "0" on my machine

17:17 fffej: lost3d: it prints 1 for me if that helps

17:17 danlarkin: l0st3d: prints 1 for me too

17:17 fffej: perhaps try updating to the latest version?

17:17 l0st3d: ok thanks guys

17:21 fffej: If I've got a pattern like (doseq [x (iterate f 0)] body) is there any way to interupt the body of the doseq? At the moment I'm throwing an exception to get out of it which feels completely wrong (it's for a GUI and the user can interupt (by means of setting an atom) the process

17:31 hoeck: fffej: you could wrap the seq generation in a take-while

17:32 fffej: hoeck: thanks, that sounds perfect

17:32 hoeck: fffej: (doseq [x (take-while (fn [_] @abort) (iterate f 0))] ..)

17:33 fffej: thanks, works a treat

17:40 lisppaste8: iBong pasted "let abuse?" at http://paste.lisp.org/display/84590

17:40 lbj: I just tried to let a servlet accept an upload of 250Mb and according to my logging the upload went fine, and the file landed remotely as it should, but afterwards Firefox crashed. Any idea why ?

17:41 iBong: I find myself writing lots of code like this, it seems somehow "imperative", just wondering if it's a bad habit or if its just a question of style (I find these kind of let blocks make my code more readable)

17:43 fffej: iBong: I think it's only let abuse if there's side effects, I use let a lot too because (as you say) it makes it more readable

17:43 iBong: no side-effects

17:43 fffej: so no abuse (in my limited experience!)

17:43 iBong: that's good to hear then

17:45 * rhickey added volatile to new new: feels ... so ... icky

17:45 fffej: what is "new new"?

17:46 rhickey: fffej: like proxy but faster

17:47 fffej: rhickey: sounds good!

18:07 dysinger: am excited about our clojure team build out ;)

18:08 Anniepoo: is there a good reason, given 'don't wrap java unnecessarily', for shell-out?

18:14 dysinger: "new new" sounds like a character from Teletubbies

18:16 Anniepoo: Rich Hickey secretly has a TV in his tummy - pass it on

18:17 rhickey: dysinger: cool - how many devs are you up to?

18:19 dysinger: 4 and maybe 5 this month

18:20 rhickey: awesome

18:20 finding good people?

18:20 dysinger: they are lined up

18:20 I just had to mention it on twitter

18:20 everybody is people in here that you know

18:21 Anniepoo: having a meetup?

18:21 dysinger: s/everybody is/every person is

18:21 whatever - you got me

18:22 Anniepoo: no building a team of devs to work on clojure projects.

18:22 Anniepoo: ah, cool

18:23 rhickey: start of some docs for new new: https://www.assembla.com/wiki/show/clojure/New_new

18:24 * dysinger reading

18:29 mattrepl: dysinger: sent you a pm re: clojure jobs

18:33 tomoj: there are jobs for clojure? O_o

18:34 chouser_: ,(map #{1 3 4 5 6} #{1 2 3 5 6 7})

18:34 clojurebot: (1 nil 3 5 6 nil)

18:36 rhickey: interesting visit by chouser?

19:19 pokey9: what is sqrt in clojure?

19:24 Anniepoo: you can use the java Math/sqrt

19:25 or the math API in clojure.contrib

19:25 http://code.google.com/p/clojure-contrib/wiki/MathApiDoc

19:26 if you use the latter you'll have to do (:use clojure.contrib.math) in your ns at the top of your file

19:27 ns is kinda like java's package / import

19:27 do you know Java?

19:30 dysinger: Anniepoo: yes

19:30 on both

19:30 well sort of - it's not a direct mapping

19:31 but close

19:31 Anniepoo: yes, I'm assuming he's a beginner to Clojure, and offering a useful metaphor

19:32 dysinger: whos "he" ?

19:33 Anniepoo: pokey9

19:33 dysinger: Oh I got turned around - I thought you were asking not commenting.

19:34 Anniepoo: (I'm also assuming pokey9 is a man, rather than a woman, it seems the Bayesian thing to do, but

19:34 I'm probably not being a good feminist by doing it)

19:35 16:19] <pokey9> what is sqrt in clojure?

19:35 pokey9: Anniepoo, i have CLisp installed in my .emacs as well, and like to use the slime command for lisp interaction with that

19:35 but i put the Clojure code in my .emacs file so now when i do M-x slime it does Clojure REPL

19:36 how do i differentiate so i can do CLisp sometimes and Clj others?

19:36 Anniepoo: dunno, somebody else will have to address that, I'm an IntelliJ user

19:36 dysinger: There is an alternate way of starting slime that lets you pick

19:36 I forget what it is - one sec

19:39 pokey9: it's C-u M-x slime and it will ask you which impl to use

19:40 pokey9: dysinger, thanks. My alternative was going to be to comment out whichever one i didnt want to use in the .emacs file every time. So this is an improvement :)

19:40 dysinger: If you search cliki wiki for slime there is a bunch of tips

19:41 * dysinger needs to play more with scheme & cl but have my hands full with elisp & clojure

19:42 JAS415: clojure is nice for doing stuff

19:57 prospero_: if I want to have one thread sleep until another has completed a task, do I need to use java concurrency primitives?

20:06 Anniepoo: prospero, do you mind my asking why you want to use Java threads in the first place?

20:07 One of Clojure's advantages is that it has better concurrancy mechanisms

20:07 JAS415: what if you have to do something that is timed

20:07 like i want my doodad to update every 5 minutes

20:08 Anniepoo: I think you'd use a Java timer, but that's NOT an authoritative answer, I'm kind of a beginner myself

20:08 prospero_: Anniepoo: I'm working with OpenGL

20:08 Anniepoo: ah, cool

20:09 I'm a graphics person too

20:09 prospero_: and it needs to be on a particular thread

20:09 Anniepoo: sure

20:09 swing's same way

20:09 prospero_: right now I'm working with GPGPU

20:09 Anniepoo: ooh, sweet

20:09 prospero_: and I'd like to be able to treat it as thread-agnostic, even though it isn't

20:10 Anniepoo: sure

20:10 prospero_: so the best way I can figure is wrap up the call in a macro which acquires a semaphore, pushes off a request to the render thread, and then releases the semaphore at the end of the render call

20:10 Anniepoo: ok, then yes, just use the Java interop like normal java

20:10 prospero_: I just wasn't sure if there was a more clojure-ish way to do it

20:11 Anniepoo: check out ref's

20:11 that's what that mechanism is for

20:11 do you have Stuart Halloway's book?

20:15 prospero_: yes

20:16 STM seems a little bit of a weird fit for the problem, even if it could pull it off

20:56 rabidsnail: My script runs fine in the repl, but when I try to load it using clojure.main or clojure.lang.Script, I get a java.lang.ExceptionInitializerError.

20:58 here's the backtrace: http://paste.lisp.org/display/84597

21:08 mattrepl: rabidsnail, can you paste your script?

21:09 it looks like you're attempting to load a properties file that isn't on your classpath

21:10 rabidsnail: http://paste.lisp.org/display/84599

21:10 I just downloaded clojure.jar again and now it works

21:12 JAS415: neat

21:30 Anniepoo: strange

21:30 ,(sh "notepad.exe")

21:30 clojurebot: java.lang.Exception: Unable to resolve symbol: sh in this context

21:31 Anniepoo: ,(use 'clojure.contrib.shell-out)

21:31 clojurebot: nil

21:32 Anniepoo: ,(sh "notepad.exe")

21:32 clojurebot: java.security.AccessControlException: access denied (java.io.FilePermission <<ALL FILES>> execute)

21:32 Anniepoo: hmmm

21:32 I'm trying to launch an external process from Clojure, via the sh

21:33 I've also tried using java.lang.Runtime

21:34 on my (windows XP) machine if I (sh "notepad.exe") it returns an empty string but no notepad window pops up

21:34 Chouser: Anniepoo: I wrote shell-out, but have tested it only on Linux.

21:35 Anniepoo: same behavior for calling Runtime#exec directly

21:37 Chouser: You asked earlier why it's worth wrapping Runtime -- for trivial cases (string in, string out) 'sh' is a much simpler API

21:37 Anniepoo: ok, I see that

21:38 that was when I was 'this is a trivial thing to do

21:38 now I'm still trying to do it

21:38 Chouser: heh

21:41 Anniepoo: it's not the path, cause it does what you expect if you say (sh "notarealfile.exe")

21:41 in my repl it returns ""

21:42 in my code it's just not launching, either photoshop or notepad

21:42 I'd use linux but I need to use projectors ;c)

21:45 mebaran151: Anniepoo, projectors?

21:46 Anniepoo: sorry, inside joke - Rich Hickey came to a special baclojure meeting during JavaOne, they

21:46 were going to do speed talks, each person does 10 minutes. All these engineers had linux on laptops and none could get

21:47 them to work with the room projector.

21:47 mebaran151: hahaha, that's pretty funny

21:47 the newer xorgs though don't have that problem as much, especially with xrandr

21:48 my coworker was so surprised when it just worked: (we'd spent an afternoon fighting jetty so we were expecting more Linux wars...)

21:48 Anniepoo: I had visions of somewhere across town a bunch of marketing flacks smoothly running presentations off windows vista

21:50 mebaran151: no no , off Mac OS X laptops with cruddy bad blitting graphics cards

21:51 JAS415: i wrote a restful api interfacing library writing library, do you think people would find that useful?

21:52 so like, i wrote a twitter interface in a few lines of code that compiles mostly to calls to apache httpclient and oauth signpost library

21:52 mebaran151: man fighting the pomp and circumstance of bdb is beginning to get a bit tiresome: anybody know of a nice simple functional btree library

21:52 just for storing ordered collections

21:53 JAS415, sounds pretty neat: wrap it up in a JAR and tell the world!

21:53 (if you want a nice async http library check out xlightweb as well)

21:53 (I have a basic wrapping of it if you want to borrow it)

21:55 JAS415: okay, i'm just nervous because my code always works for what *I* use it for but never stands up to academic scrutiny

21:56 Anniepoo: ignore the academic scrutiny

21:56 mebaran151: oh people on the mailing list have been pretty chill

21:56 they'll even fix it for you

21:57 I'm probably going to split out my bdb clj bindings if anybody wants them

21:58 Anniepoo: I'm on a standards working group (groan). We have a loudmouth who tells everybody how it is and why their ideas suck

21:58 mebaran151: I'm still trying figure out a good way to integrate secondary indexes, or whether I'd might as well try to do all the joining myself

21:58 Anniepoo: one day she proposes something that is easy to test (I've forgotten what), and tries to actually write it.....

21:59 after we saw her code we took her pronouncements less seriously

21:59 mebaran151: ha

21:59 I'm so sick of Oracle Engineering

21:59 Oracle should change their name to Over Engineering

22:00 only they would have a Factory class for a Config class that gets passed to another factory

22:02 JAS415: I dunno, maybe i'm not a team player, but I just write code so that it works and don't worry about it until it is proven to not work...

22:03 mebaran151: well it's nice to have a quick test suite

22:03 most useful in deployment actually: when you put the code up, run the tes suite ad make sure all the libraries got up okay

22:08 Anniepoo: nice.

22:08 now I've corrupted my project file, apparently

22:08 not my day

22:17 mebaran151: in eclipse?

22:20 JAS415: which is why i use emacs now

22:20 mebaran151: I'm in netbeans: I could never really stick with emacs

22:20 always was a vim guy

22:21 but now I'm spoiled by the gui goodness of netbeans

22:22 JAS415: I just really like being able to hit ctrl+alt+q and have my code indent itself

22:22 that's actually the only thing i missed when i was trying to use eclipse or emacs

22:22 mebaran151: you can use alt-r with clojure plugin

22:22 ctrl a and alt r

22:23 and shotgun line up

22:23 JAS415: ah really?

22:23 i guess the other thing was i kept printing things that were longer than the eclipse repl would handle

22:23 by emacs above i meant to say netbeans*

22:24 anyway i normally assume that my failure to use a tool properly is my fault rather than the IDE's

22:24 you know what you know, as they say

22:25 mebaran151: oh there's an option somewhere for that

22:25 but usually, when I want something printed

22:25 I want ALL OF IT (grrr)

22:26 JAS415: well in eclipse I would generally crash eclipse completely

22:26 I would tell it to grab some xml output and parse it to a zip

22:27 mebaran151: eclipse lieks to eat all of my RAM

22:27 for no apparent reason

22:27 JAS415: it would print the first 100 lines or so and then die horribly

22:27 mebaran151: so the clojure plugin on eclipse is not ready for the big time yet?

22:27 JAS415: not if you want to do repl development

22:28 which is really my style

22:28 if you just want to build projects it is fantastic honestly

22:29 mebaran151: I like to throw some code at the repl every now and again

22:29 JAS415: nice simple creation of directories and sub directories and stuff

22:29 mebaran151: I'm glad they got ... file management working :P

22:29 JAS415: i kind of have a weird background i guess

22:29 for work I use common lisp and we don't have a full IDE for it

22:29 it is old and broken in horrible ways

22:29 so I do a lot of repl debugging and print statements

22:30 mebaran151: no emacs?

22:30 JAS415: to figure out what the hell is happening

22:30 i have emacs but no slime

22:30 mebaran151: oh

22:30 pity

22:30 JAS415: so i'm copy/pasting

22:30 mebaran151: I never did get into using a breakpointer either

22:30 I do throw debuging

22:30 JAS415: yeah is just because we use goldhill common lisp which is a *bit* before slime

22:30 mebaran151: as in, let's see how far we can get before we throw

22:31 JAS415: yeah the problem is that sometimes your customers figure out a clever way to wreck your code with throw debugging

22:31 just because people are inherently baysian and likely to follow the same gui paths that they did before

22:31 mebaran151: usually before I release, I go through and destroy all my throws

22:32 JAS415: so you get a new human and they take a different path and you find different errrors

22:33 mebaran151: that's why you got reduce the number of humans :)

22:33 JAS415: that's right, that's why we gotta fight the marketing and sales guys tooth and nail

22:33 mebaran151: only in Javaland would the standard library have a full fledged sql library but no simple library for basic sorted hash btree persistence

22:36 JAS415: i'm not sure i know what hash btree persistence is, but I adapted the 'memoize' function in clojure.core to extend to printing out hashtables when they get updated

22:36 so you you get a function that is cached between user sessions

22:37 and obviously there are limitations as a lot of things don't have printable representations

22:39 anyway i'm looking for a better way to do it as it is annoying to have to write the whole map out to file every time it gets updated

22:41 iBong: what's the standard way to remove a seq of keys from a map?

22:43 gko: dissoc

22:43 hiredman: ,(apply dissoc {:foo 1 :bar 2 :a 3 :c 4} [:a :c])

22:43 clojurebot: {:foo 1, :bar 2}

22:43 hiredman: ,(reduce dissoc {:foo 1 :bar 2 :a 3 :c 4} [:a :c])

22:43 clojurebot: {:foo 1, :bar 2}

22:44 mebaran151: JAS415, I was just saying a dictionary btree

22:44 something like bdb where you store keys and values, without the 20 thousand extra classes to make the whole task as difficult as possible

22:46 and you would rewrite the whole structure on updates

22:49 *wouldn't rewrite

22:51 JAS415: mebaran, after much googling i have figured out what a dictionary btree is :-)

22:51 you'll have to excuse my ignorance as my training is philosophy :-P

22:51 mebaran151: oh me too actually

22:52 tried to open a Proverbial Philosophy Store, and that just Didn't Work Out (tm)

22:52 JAS415: haha

22:53 I've been told that philosophy is a major with no practical application but computer science seems to fit it just fine...

22:53 mebaran151: yep, pretty easy transition

22:54 JAS415: i dunno, what is cs except math and language

22:55 mebaran151: not even as much pure math as there should be...

22:57 Anniepoo: ok, I know i have to add the source and the output paths to my classpath for the compile statement to work

22:57 JAS415: knowing is half the battle

22:58 i think that the other half is figuring out how to configure a classpath

22:58 Anniepoo: but if my file is namespace edu.uh.foo located in src/edu/uh/foo then will I add the foo directory or the

22:59 src directory?

22:59 JAS415: i think you would add edu

22:59 mebaran151: the directory above all those think

22:59 Anniepoo: I freaking corrupted my intellij project file

22:59 mebaran151: did you have an git or hg version backup?

22:59 it is cases like this where recloning is the one true way towards Enlightenment

23:00 Anniepoo: no, I'm working on this alone so I don't have a recent backup

23:01 JAS415: well if you look at like a jar file

23:01 you'll see that its by subdirectories

23:02 so like the namespace me.apibuilder.foo would be me/apibuilder/foo.clj

23:02 mebaran151: that sounds about right

23:02 Anniepoo: ok, then hang on

23:05 JAS415: so for example the classpath to contrib jar for me is: /clojure/clojure-contrib/clojure-contrib.jar which means that java starts looking inside the 'jar' file (which is a trumped up tar file)

23:05 lisppaste8: Anniepoo pasted "say what?" at http://paste.lisp.org/display/84605

23:05 JAS415: so i look inside the jar

23:05 and i see path

23:06 clojure/contrib/*.clj

23:06 Anniepoo: yes, I understand java jar files

23:06 clojurebot:

23:06 JAS415: yeah i didn't when i started this stuff

23:06 Anniepoo: but I'm utterly baffled, when I compile, I throw this exception

23:07 what this rather unremarkable function has to do with ANYTHING is beyond me

23:07 JAS415: that is saying that the path doesn't exist

23:07 Anniepoo: which path?

23:07 mebaran151: hey cemerick

23:08 cemerick: evening :-)

23:08 Anniepoo: I understand "the path specified" doesn't exist

23:08 mebaran151: the ExceptionInitializer errors in Clojure are a little nasty

23:09 Anniepoo: LOL

23:09 JAS415: *photoshop-startup-directory* "C:\\Program Files\\Common Files\\Adobe\\Startup Scripts CS3\\Adobe Photoshop\\")

23:09 Anniepoo: how, pray tell, does it even KNOW I'm eventually turning that string into a file?

23:09 (and that is indeed a valid directory)

23:10 JAS415: i *think* you can use forward slashes instead of escaping the \

23:10 i kind of forget but i think thats ok

23:10 mebaran151: yep

23:10 Anniepoo: I can't say (def *what-I-would-like-to-say-now* "!@##$%@")???

23:10 mebaran151: WinXP is smart enough to figure out forward slashes

23:11 cark: hello all

23:11 Anniepoo: strange part is, this all was working for a while

23:11 JAS415: waitwait

23:11 sh *photoshop-exe*

23:11 that is where you use it like a path right?

23:12 jwhitlark: clojurebot: def true?

23:12 cark: ,(.numerator (/ 3 2))

23:12 clojurebot: 3

23:12 cark: is there a core function for this ?

23:12 clojurebot: for is a loop...in Java

23:13 JAS415: (def *photoshop-exe* "C:\\Program Files\\Adobe\\Adobe Photoshop CS3\\Photoshop.exe")

23:13 (def *photoshop-start-dir* "\"C:\\Program Files\\Adobe\\Adobe Photoshop CS3\\\"" )

23:13 Anniepoo: yes, but #_ on that followed by a dummy

23:13 gives the same error for the dumme

23:13 JAS415: you got extra slash on photoshop start dir?

23:13 mebaran151: it actually shouldn't matter

23:13 JAS415: hum

23:13 mebaran151: the extra slash

23:13 JAS415: bummer

23:14 Anniepoo: no, I don't

23:14 I have an escaped quote

23:14 the whole thing is in quotes

23:14 JAS415: oooooh

23:15 Anniepoo: further, comment around the entire thing, both the

23:15 lisppaste8: Anniepoo annotated #84605 "untitled" at http://paste.lisp.org/display/84605#1

23:15 Anniepoo: I comment the whole mass out as a sanity check

23:15 JAS415: and sh just sends it to shell

23:15 Anniepoo: stick in (defn do-photoshop-script [foo] nil)

23:15 JAS415: ?

23:16 Anniepoo: and I get the same thing, can't find file specified

23:17 pointing at the line with my dummy replacement

23:17 JAS415: hmm

23:17 what line is it then?

23:18 lisppaste8: Anniepoo annotated #84605 "untitled" at http://paste.lisp.org/display/84605#2

23:18 Anniepoo: 35 for the one with the dummy func

23:18 Chouser: so I've got this nested vector dumped out to a .clj file -- 89K worth.

23:18 and it won't load: java.lang.ClassFormatError: Invalid method Code length 188191 in class file user$eval__952 (data.clj:8)

23:19 mebaran151: Chouser, are there any secret btree implementations for clojure that don't rely on more classes than I can shake a stick at?

23:19 Chouser: I'm a bit stumped on how to work around this.

23:19 Anniepoo: hey, is *root-dir* reserved for something?

23:19 that smells generic

23:19 JAS415: doesn't seem so

23:20 ser=> *root-dir*

23:20 *root-dir*

23:20 java.lang.Exception: Unable to resolve symbol: *root-dir* in this context (NO_SOURCE_FILE:0)

23:20 user=>

23:20 mebaran151: Chouser, this probably seems incredibly silly, but have you tried splitting it up into two files or so and just conjoining both results?

23:20 Chouser: mebaran151: on-disk btree, like a simple database?

23:21 mebaran151: yeah

23:21 something real simple

23:21 I'm working BerkeleyDB right now

23:21 Anniepoo: ah!

23:21 JAS415: 89k i wouldn't expect to be too big

23:21 Chouser: mebaran151: I would... yeah, bdb.

23:21 mebaran151: but I've made so many Factories, I feel like the soviet union

23:21 Anniepoo: I put (comment ....) around the entire file

23:21 Chouser: ha!

23:21 JAS415: and?

23:21 Anniepoo: followed by

23:21 (defn make-floortile-file [a b] "howdy pardner")

23:21 JAS415: lol

23:21 Anniepoo: and it complains about the last line

23:22 JAS415: wow

23:22 Anniepoo: ( I didn't include the ns in the comment)

23:22 cupertinochad_: Hi all. Can I ask a newbie question? I just asked it on the mailing list, but I am impatient, so I thought I'd try here ;-)

23:22 JAS415: ok

23:22 Chouser: cupertinochad_: go for it

23:22 mebaran151: Chouser, I spend half my time tryig to avoid bdb's insane attemts to reserialize things

23:22 cark: chouser : are you using the reader or is it in a function ?

23:22 mebaran151: they really want you to just use the collections api, which demands annotations and nonesuch

23:23 cupertinochad_: I have a newbie question about anonymous functions. Why does the first form below work and the second form does not?

23:23 user> ((fn [] "foo"))

23:23 "foo"

23:23 user> (#("foo"))

23:23 Chouser: cark: it's just a really big vector. (load-file "foo.clj") fails

23:23 cupertinochad_: ; Evaluation aborted.

23:23 cark: chouser : why do you need to evaluate ?

23:23 mebaran151: ,(#("foo"))

23:23 clojurebot: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn

23:23 Chouser: cupertinochad_: #("foo") becomes (fn [] ("foo"))

23:23 mebaran151: ah yes

23:23 cark: chouser : you could try only loading

23:23 JAS415: cuper, because i think #( ) has special read syntax

23:23 mebaran151: Chouse beat me true it

23:23 Chouser: cark: oh! yes!

23:24 JAS415: its secrekt

23:24 chouser: i've written and read bigger than 89k files in clojure, nothing bad happened

23:24 is it possible that there is a nesting limit?

23:25 Chouser: it's not nested deeply 3 levels I think.

23:25 cupertinochad_: Hmm. So if I want a no-argument anonymous function that just returns a constant, how do I do that? Do I have to use (fn [] "foo")?

23:25 JAS415: that shouldn't be a problem

23:26 cark: chouser : just slurp the file and use the read function, i think that would work

23:26 JAS415: (constantly "foo")

23:26 i think

23:26 cark: hum or directly read the stream actually

23:27 Anniepoo: ok, so I think the line that's ACTUALLY not finding it's file is

23:27 (compile 'edu.uh.hhp.sl.automation.lessonPrimEditor.ui.LessonPrimPane)

23:27 Chouser: cark: indeed! perfect! thanks

23:27 JAS415: cupertinochad: ((constantly "foo"))

23:28 cupertinochad: Thank you.

23:29 cark: Chouser: cool =)

23:29 cupertinochad: Another newbie question: Where do I find the source for macros like #(expr)?

23:30 Anniepoo: ok, so I am indeed in 'source and object have to be on the classpath' hell

23:30 JAS415: oh shit, i dunno, you can download the source and look obviously...

23:30 cark: ,(macroexpand '#(expr))

23:30 clojurebot: (fn* [] (expr))

23:30 JAS415: woah

23:30 i was thinking in terms of the source of the macro itself

23:31 Chouser: cupertinochad: LispReader.java, line 548

23:31 cark: mhh reader macros are special

23:31 which is a shame ! (but dont tell rhickey)

23:32 cupertinochad: Thanks again. Slime lets me hit M-. to jump to a function def, but I didn't know where to find reader macros

23:34 Chouser: FnReader for reading #(): http://tinyurl.com/l67t5h

23:35 hiredman has started looking at rewriting that in Clojure, but I'm not sure if he plans to continue.

23:36 cupertinochad: Chouser: And thanks for the link, too!

23:37 Is there an archive of the IRC channel that I can peruse?

23:37 Chouser: sure! It can be fun and enlightening to poke around in the .java sources.

23:37 ~log

23:37 clojurebot: see logs

23:37 Chouser: ~logs

23:37 clojurebot: logs is http://clojure-log.n01se.net/

23:42 Anniepoo: not finding Clojure much fun right now

23:43 cark: ,(.round 0.0003333M (new java.math.MathContext 4))

23:43 clojurebot: 0.0003333M

23:43 cark: that seems strange

23:43 mebaran151_: Anniepoo, what's doing?

23:43 cark: how would i achieve a rounding to 4 digits ?

23:44 Anniepoo: I'm in classpath hell

23:44 gimme a moment, I'm documenting it in lisppaste

23:45 mebaran151_: awww man, there ain't nothing worse than classpath wars

23:46 I got into a brief argument on #java with a guy who was adamant that we should all love the classpath dearly; I disagreed

23:48 r2q2: JAS415: Are you putting your twitter library on github?

23:49 lisppaste8: Anniepoo annotated #84605 "untitled" at http://paste.lisp.org/display/84605#3

23:51 mebaran151_: if I wanted to give the world my beautiful (har har) bdb library, should I just spam the mailing list with it, or are there better packaging procedures?

23:52 JAS415: yeah i'm in the process of putting it on github

23:52 Chouser: mebaran151_: there's a thread for announcing libs, or you can just announce it. It's the best we've got so far. :-/

23:55 Anniepoo: sadly, the documentation of how it interprets the classpath is pretty lacking

23:55 mebaran151_: have you tried just make a new clojure project and manually copying your code over :/

23:56 sometimes if things get bad deleting everything can be a lovely way to get back at th machines

23:56 Anniepoo: yes

23:56 that's what I'm doing

23:56 I'm trying to make a new project

23:56 mebaran151_: yeah it sometimes sucks when things like this go wrong

23:56 use mercurial though to version stuff, even for single projects

23:56 that way you can always rollback to a less broken state, and it's actually really easy to use

23:57 Anniepoo: yes, in retrospect of course I should have had it in svn

23:57 but that's not going to be very useful now

Logging service provided by n01se.net