#clojure log - Sep 08 2009

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

0:09 duck1123: Is there any way to make stack traces give out a little more context as to what namespace a file is in? I deal with 3 files for any given name

0:10 I could always add -controller and -view, etc. but I'd rather not have to deal with that all the time

0:10 appname.controller.user-controller (or some variant) seems redundant

0:31 technomancy: duck1123: with slime you can just press v with the point over the stack trace frame to jump to that function

2:53 tomoj: whaaat aquamacs is unsupported?

2:54 oh, that doesn't mean it doesn't wor

3:10 somnium: what is the idiomatic way to call (fn [x y z] {x (y+z)}) with (seq 1 2 3))?

3:12 cark: (apply your-func your-seq)

3:12 that's if i understood your question

3:13 somnium: that did it, thanks

3:13 cark: =)

3:13 somnium: didn't realize apply used the arity of the function you call it with

3:14 cark: it doesn't

3:14 apply does not know anything about arity

3:14 somnium: ? then how does it pass the right number of args?

3:14 cark: mhh that's implementation details i'm not comfortable going into

3:15 somnium: ok... well it seems to use arity :) I don't really care it does what I wanted

3:15 cark: hehe right =)

3:41 jamesp__: Hi, I'm sure I'm missing something obvious here, but how do I expand a list into the arguments for a function?

3:41 hiredman: ,(doc apply)

3:41 clojurebot: "([f args* argseq]); Applies fn f to the argument list formed by prepending args to argseq."

3:44 jamesp__: Perfect. Thanks hiredman, one step closer! Cheers

3:50 Fossi: eh. seems like it apply day today

4:20 somnium: are there any good resources on becoming *really* productive with slime/emacs clojure? I've gotten comfortable enough but always this feeling I'm using 5% of the features

4:34 Chousuke: somnium: heh, I have the same problem :P

4:34 that 5% is probably enough for now.

4:34 somnium: are you already using paredit.el? :)

4:34 somnium: yeah

4:34 though sometimes it irritates me

4:35 have a hard time deleting parentheses, I'm sure theres some shortcut but I havent found it on the cheat sheet yet

4:35 end up using cut and paste

4:35 ctrl + arrow keys is very handy at times though

4:36 Chousuke: you should never need to delete individual parentheses :/

4:36 somnium: pairs of them

4:36 Chousuke: just backspace? :)

4:36 somnium: it refuses unless they're empty

4:37 Chousuke: sometimes I end up with a mismatched paren but C-q ( or ) to match it again and then deleting it works fine.

4:37 somnium: oh, of course.

4:37 somnium: use C-k to kill the entire sexp

4:37 somnium: ah, maybe that's what I've been missing

4:38 perhaps it will feel like 6% now ;)

4:39 I have the cheatsheet but nothing seems to stick, maybe I'll paste it to the wall

4:39 Chousuke: paredit has more features than that of course but I'm doing well with just C-k, paren matching and barf/slurp

4:40 somnium: to make it stick I guess you need to spend some time *forcing* yourself to use the more complicated functionality, even if it feels slower than the simple way.

4:40 once your hand learns the motions it should become a lot faster :)

4:41 somnium: yes, I only just remapped ctrl to caps-lock

4:41 Chousuke: heh

4:42 somnium: Id like to try switching to vim for a slightly simpler life, but I can't get vimclojure to work

4:42 Chousuke: you can try viper.el in emacs :P

4:42 I actually mapped meta to capslock and ctrl to the cmd keys

4:42 having two controls helps

4:43 and they're easy to press with the thumbs

4:44 somnium: hmm, I tried viper but I just stay in insert mode and use emacs commands out of laziness(?)

4:44 and I don't know how to configure (haven't bothered to see how yet)... configuring .vimrc compared to configuring .emacs is... night and day

4:49 Fossi: i guess everybody has that 5% margin left to go

4:50 that's why emacs rocks so much

4:50 oh, i misread

4:51 somnium: it would be nice if it was possible to use clojure instead of elisp

4:51 Fossi: well, that's just an emacs rewrite away ;)

4:51 somnium: !

4:51 clojure-emacs-script

4:52 elisp-generator, how hard can it be to translate a lisp to another lisp?

4:56 Chousuke: well, Clojure has lexical scoping and immutable data structures

4:56 elisp has dynamic scoping and very mutable data structures :P

4:58 somnium: true... pure code-generation might not be so bad, but that would require intimately learning elisp, and by the time I did that I suspect I wouldn't want to write the program anymore

4:58 like removing parentheses from lisp or something

5:00 Chousuke: the human brain is good enough at removing the parentheses when needed :)

5:01 somnium: I find indenting my expressions so I can read them again at a glance is far more challenging than parsing parentheses

5:07 Fossi: is there something like yasnippets for clojure? a more useful slime-complete-form?

5:10 somnium: you could use yas if you write your own snippets couldn't you?

5:11 is there a standard way to combine two seqs, like (foo bar) and (nil nil nil nil) to get (foo bar nil nil) ?

5:16 I guess (take (count b) (cons a b)) isnt so bad

5:19 Fossi: sure i could, but maybe there's something useful already

5:20 somnium: macros = snippets++ ;)

5:21 (= macros (inc snippets)) #=> true

5:25 Chousuke: (defn dropcat [a b] (lazy-seq (if (seq a) (cons (first a) (dropcat (rest a) (rest b))) b)))

5:28 somnium: I wish there were more examples in some of the doc-strings

5:29 liwp: somnium: and cross references to other related fns

5:29 Chousuke: cross-refs would be more useful as separate metadata

5:29 liwp: sure

5:33 somnium: hmm, maybe a doc-string browser like gem-server would do the trick

5:34 still would need the metadata...

5:34 liwp: I guess ideally the examples would be separate metadata as well

5:35 i.e. the doc string would be multiple entries that then get compiled together when you call (doc) or for online documentation

5:36 somnium: it would be nice to have a little swing app that has a cross-referenced db of core and contrib with hyperlinks to relations

5:36 and related javadocs

5:37 ,(doc lazy-seq)

5:37 clojurebot: "([& body]); Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls."

5:37 somnium: where to get doc for Iseq and Seqable?

5:41 tomoj: somnium: you could build it yourself with javadoc

5:41 but for ISeq you might as well just look at the source

5:41 not much there

5:41 Chousuke: There's no javadoc for the interfaces yet I think :/

5:42 which is a shame.

5:42 tomoj: similarly for Seqable

5:42 Seqable is just one method, seq(), which returns an ISeq

5:42 ISeqs can do cons(Object), first(), more(), next()

5:43 I guess more==rest?

5:43 ~def rest

5:43 yup

5:44 Fossi: somnium: well, for defn it would make sense to have a snippet

5:44 and i guess there are other

5:45 tomoj: I guess Reversible is a contract for constant-time rseq like Counted is a contract for constant-time count?

6:02 Fossi: somnium: i'd also like a thing that's like eldoc, but with a template

6:07 cschreiner: nested #() are not allowed, how to solve?

6:07 hiredman: use fn

6:07 cschreiner: ok

6:07 * hiredman blinks

6:07 cschreiner: so it's a reader-problem

6:08 hiredman: nesting #() would be a pain anyway

6:08 Chousuke: it's not that difficult to implement

6:08 hiredman: argument names all are the same

6:09 Chousuke: it just would be confusing :/

6:09 hiredman: clojurebot: #()?

6:09 clojurebot: #() is not a replacement for fn

6:09 hiredman: clojurebot: function literals?

6:09 clojurebot: Function literals are cute, but overused

6:09 cschreiner: yes, I see the point with % in nested #()

6:11 I fucking love the expressivity of clojure, is it ok to say that?

6:11 liwp: can one use #() in macros?

6:11 hiredman: liwp: best not

6:12 Chousuke: ,`(do #(foo %))

6:12 clojurebot: (do (fn* [sandbox/p1__4222] (sandbox/foo sandbox/p1__4222)))

6:12 liwp: yeah I've avoided them so far

6:12 Chousuke: that would fail I think :/

6:13 yep: Can't use qualified name as parameter: user/p1__2363

6:14 liwp: indeed

6:14 Chousuke: though you can use #() in macros as long as it's not part of the generated code.

6:14 somnium: Chousuke: thanks for that dropcat fn, its proving very handy

6:15 cschreiner: Chousuke: yep, thanks for the input

6:15 kitos, or whatever you say

6:15 liwp: Chousuke: yeah that's right, but I was specifically interested in the generated code case which wasn't working for me IIRC

6:15 Chousuke: cschreiner: two i's

6:15 cschreiner: :-)

6:16 Chousuke: liwp: best just use fn in those cases.

6:16 liwp: so it would seem :)

6:16 Chousuke: ,`(fn [x#] (inc x#))

6:16 clojurebot: (clojure.core/fn [x__4226__auto__] (clojure.core/inc x__4226__auto__))

6:18 liwp: so the difference here is that #() generates a qualified name as a param?

6:18 ,`(do #(inc %))

6:18 clojurebot: (do (fn* [sandbox/p1__4230] (clojure.core/inc sandbox/p1__4230)))

6:18 Chousuke: liwp: the difference is that it expands at read time so ` qualifies the symbols.

6:18 liwp: ahh yes

6:18 Chousuke: ,'#(foo bar)

6:18 clojurebot: (fn* [] (foo bar))

6:18 Chousuke: ,'#(foo bar %)

6:18 clojurebot: (fn* [p1__4237] (foo bar p1__4237))

6:18 Chousuke: ,`(fn* [p1__4237] (foo bar p1__4237))

6:18 clojurebot: (fn* [sandbox/p1__4237] (sandbox/foo sandbox/bar sandbox/p1__4237))

6:19 liwp: cool, thanks

6:20 Chousuke: wonder if I should submit my syntax-quote macro for inclusion in Clojure already :/

6:22 my reader is not yet ready but syntax-quote only needs a couple tweaks and it should be fine.

6:23 liwp: Chousuke: what is this reader work that you've been doing? Why are you writing your own reader?

6:24 Chousuke: liwp: well, I thought it might be a fun project, and if it turns out good enough it could replace the current reader (which is written in java)

6:24 somnium: any chance of sneaking in reader-macros?

6:25 Chousuke: not until rhickey approves of them :P

6:25 liwp: which does not seem likely ATM

6:25 Chousuke: my current reader code makes only a few direct calls to java so it could be usable from ClojureCLR and other ports too. that would be a bonus

6:26 though all this is just talk. I still have a lot of work to do until the reader is really usable

6:26 somnium: any talk of making a ClojureC by anyone?

6:26 Chousuke: it's mostly feature-complete already but I haven't even looked at what it would take to make Clojure actually use it. :P

6:27 liwp: Chousuke: that does sound like a nice little project. For some reason I didn't realise that the current reader was writtne in Java althought have seen LispReader.java in the source tree...

6:30 Chousuke: if you want to see what I have currently just browse http://github.com/Chousuke/clojure/tree/clojure-reader (it's src/clj/clojure/lang/reader.clj, and syntax-quote is in core.clj)

6:32 it should have no major omissions anymore so feel free to test. I might have forgotten something though. :P

6:32 but now I must hurry away

6:32 liwp: I'll have a look...

6:43 cemerick: somnium: you mean a C compile target?

6:45 somnium: yeah, a pure C implementation, seems unlikely I guess

6:45 cemerick: I think targeting chicken scheme, which emits C, is more likely

6:49 LauJensen: Good afternoon gents

7:09 cemerick: speaking of, I don't think I've ever seen a woman's name in the channel or on the group :-/

7:15 just how evil would it be to use an atom to control the termination of a for comprehension? Any less evil if I'm immediately consuming the comprehension?

7:16 I've got a bit of a nasty nested loop, and I'm toying with reimplementing it using something like (last (for ...))

7:16 clojurebot: 0

7:16 Fossi: 0?

7:18 out of curiosity: how do you format a number, if you don't know whether it might be a BigDecimal?

7:28 konr|afk: Is there a template system, like php's smarty or python's tenjin, for clojure?

7:28 durka42: there are a few

7:28 enlive is one

7:29 konr|afk: hmm, any idea which is the fastest?

7:29 durka42: i do not know

7:31 cemerick: isn't templating the least of one's concerns, vs DB access, bandwidth/latency, etc? (when templating for a web environment, anyway)

7:32 konr|afk: I think you are right...

7:32 the bottleneck of my application is the DB access

7:33 I think - at least mysql is the most cpu-consuming app when the server gets laggy

7:35 cemerick: optimize thine queries :-)

7:49 LauJensen: cemerick: it would be very evil

7:49 cemerick: LauJensen: yeah, I know :-)

7:50 I'm working on unifying the loop

7:50 LauJensen: good - if you fail I'll have to ban you from the group

7:56 Guys, have you seen 'rising links' on DZone this morning? :)

7:59 ambient: the page doesn't work for me, so paste a link

8:00 LauJensen: www.dzone.com

8:00 ambient: javascript:void(null)

8:00 i mean the rising links tab

8:00 LauJensen: oh.

8:00 the only way to see it is to have that js evaled, that'll give you a new tab

8:00 but the point was that my 'java vs clojure' post was on top

8:02 ambient: cool ;)

8:03 hmm, i wonder if i can add a macro to vimperator that adds sites to whitelist in adblock+

8:26 LauJensen: It happend, Java vs Clojure is #2 on the frontpage of DZone :D

8:27 ambient: grats

8:27 LauJensen: Thanks :)

8:53 gerryxiao: hello

8:53 what's chunks?

8:54 how to make (range 0 1000) to trunks?

8:58 Chouser: ,(chunked-seq? (seq (range 0 1000)))

8:58 clojurebot: true

9:01 Chouser: gerryxiao: does that help?

9:04 gerryxiao: i want to know why use chunk,and how

9:05 Chouser: chunked seqs are an implementation detail -- you're meant to be able to ignore them.

9:05 gerryxiao: oh

9:05 Chouser: many builtins now produce chunked seqs when you call 'seq' on them, like range and vectors

9:05 gerryxiao: but it seems master branch not support it yet?

9:06 Chouser: I think it does. Did you try that snippet I showed above?

9:06 gerryxiao: why still have one chunks branch?

9:07 Chouser: just hasn't been deleted yet, I guess. Looks like all its patches are in master.

9:08 gerryxiao: it works under master

9:09 Chouser: If the chunked seq API is documented anywhere, I can't find it. For now I guess you'd have to read the code.

9:10 ...if you want more details.

9:10 gerryxiao: how to make ant create a new dir to build another branch for clojure?

9:10 ok

9:10 yes, i can't find any docs about it

9:11 Chouser: I dunno. If I want different builds of clojure, I usually just check out a whole new local repo.

9:11 maybe there's a better way I don't know about.

9:11 gerryxiao: it should work, but i have to change clj script

9:12 Chouser: yeah, the clj script I use allows aliases, so I can run clj or clj-1.0

9:12 but it's a bit of a pain to set up, so I haven't published it anywhere.

9:13 gerryxiao: that's problem of git?

9:13 Chouser: hm, dunno.

9:13 gerryxiao: when will 1.1 be released?

9:15 Chouser: there's no firm date. I think once the reify a.k.a. "new new" is finished, you can expect a 1.1 release.

9:16 gerryxiao: i have only one clojure git local copy, if i want another builds, just check it out and rebuilt it with ant

9:17 Chouser: sure. if you want to keep both, the only way I know is to git clone a new local copy

9:26 gerryxiao: i use Math/round in clojure, but complier complain it can't be resolved

9:28 Chouser: can take float or double, so tell it which, such as (Math/round (double x))

9:28 ambient: try (Math/round (double 5.6))

9:29 hmm, does this work

9:29 ,(Math/round (double 5.6))

9:29 clojurebot: 6

9:29 gerryxiao: i used (Math/round ( * 3 (float 4)))

9:30 Chouser: ambient: sure. But with a literal like that it's not needed.

9:30 gerryxiao: so i have to :(Math/round (float (* 3 (float 4))))?

9:30 Chouser: ambient: Clojure reads 5.6 as a Double, so it knows to generate a call with a double arg.

9:31 ambient: k

9:31 Chouser: gerryxiao: you don't actually have literals there, do you? But this will work: (Math/round (double (* 3 4.0)))

9:32 gerryxiao: Chouser: that's just one example, my code is like that

9:32 i think clojure should figure it out

9:33 Chouser: gerryxiao: it does. You only need those casts if you're trying to avoid runtime reflection.

9:33 those compiler complaints are only warnings -- it'll run fine.

9:33 gerryxiao: ok

9:35 clojure need one good way for type hints

9:35 Chouser: and in real code even if you want to avoid reflection you can usually put a few hints or casts on some args or locals and be done, rather that repeating them in the body of the code.

9:36 Fossi: namespace whoes

9:36 ambient: i don't really completely get clojure namespaces either

9:37 Fossi: i thought my files are getting a little big, so i tried to refer some things

9:37 gerryxiao: sometimes, i have to repeat type hints

9:37 Fossi: but apparently i don't get ut either :)

9:38 Chouser: Fossi: 'refer' is hardly ever used anymore.

9:38 Fossi: Chouser: but 'load' is ugly :(

9:38 Chouser: Fossi: if you want multiple files for one namespace, use 'load'

9:38 gerryxiao: it seems hints in let block not work sometimes

9:39 Chouser: Fossi: if you want multiple namespaces, use 'use' or 'require'

9:39 Fossi: i want multiple files for one namespace

9:40 for example, load wants to load auto-mail.clj

9:40 but the rest of clojure wants me to name it auto_mail

9:40 gerryxiao: does newnew fast than proxy?

9:41 why in-ns not support :use :import?

9:41 Fossi: and if i use load, the file compiles, but the symbol don't seem to be "imported"

9:41 ah. i guess i can't use another namespace then in the other file

9:42 Chouser: gerryxiao: I would be very surprised if hints on 'let' names sometimes fails. got an example?

9:43 Fossi: dashes in file names aren't really supported, because of Java naming rules. I'd try naming the file "auto_mail.clj" and then calling (load "auto_mail")

9:43 gerryxiao: yes, newnew is faster than proxy

9:43 Fossi: dashes in filenames are all over the place

9:43 ol3: (doc circle)

9:43 clojurebot: Excuse me?

9:43 ol3: (doc circel)

9:43 clojurebot: Titim gan éirí ort.

9:44 gerryxiao: in my code, in let block [g2d #^Graphics2D g] (doseq [x y] (.drawString g2d ....))

9:44 i got .drawString not resolved

9:44 Chouser: gerryxiao: try (let [#^Graphics2D g2d g] ...)

9:44 Fossi: that has nothing to do with the type hint

9:45 Chouser: gerryxiao: so that you're hinting the name an not the value.

9:45 Fossi: "all over the place"?

9:45 Fossi: Chouser: well, half of clojure-contrib has them

9:46 Chouser: Fossi: nope. namespace names, sure, but no dashes in file names

9:46 gerryxiao: g2d #^Graphics2D g is change g to Graphics2d

9:46 type cast

9:46 right?

9:46 liwp: gerryxiao: yes, but g2d is still of type Object

9:47 with [#^Graphics2d g2d ...] you've type hinted g2d as of type Graphics2d

9:47 gerryxiao: so i have type #^Graphics2D twice?

9:47 Chouser: actually, that's not the problem

9:47 Sorry, I mislead.

9:48 liwp: gerryxiao: no, just once

9:48 Chouser: It's more likely the args to .drawString -- there may be multiple methods, so you'd have to hint one or more of the args as well, if you want to avoid reflection.

9:48 again, reflection isn't the end of the world, it's just a runtime performance hit.

9:49 Fossi: "gerryxiao: i got .drawString not resolved" sounds to me as if you call it with the wrong parameters anyway

9:49 gerryxiao: Chouser, yes, drawString have many overide methods, and it's in Graphics

9:49 Fossi: afaik things should work without any cast

9:49 gerryxiao: that's Graphics2D supper class

9:49 Fossi: (but a little slower)

9:50 gerryxiao: Fossi: no, if parameter is wrong, i will get error not warning

9:51 Fossi: ok, i thought it was an error

9:52 Chouser: sorry, i misread

9:52 but still, it's ugly to have to load "auto_mail" if i would use "auto-mail"

9:52 gerryxiao: yes, it works without type hints

9:53 Chouser: Fossi: if you're using 'load', I don't think you'd ever mention 'auto-mail'.

9:53 ol3: (doc cycle)

9:53 clojurebot: "([coll]); Returns a lazy (infinite!) sequence of repetitions of the items in coll."

9:53 ol3: clojurebot: thanks

9:53 clojurebot: Pardon?

9:53 Fossi: and it's ugly that ns :load etc don't have the same semantics as load etc

9:53 Chouser: can i still define a namespace in the other file?

9:54 or do i have to use require and use directly?

9:54 Chouser: a new namespace?

9:54 gerryxiao: i want in-ns support :use :import

9:54 Fossi: point is, i might want to use some of these files diretly as well

9:54 Chouser: if the other file defines a new namespace, it should do so using 'ns' and :use/:require. Then your current file can use :use/:require instead of load.

9:55 gerryxiao: i have to use :use :import only in one file

9:55 Fossi: i have foo which wants to use 'service' which is a bunch of services

9:55 gerryxiao: i don't want use (use ) (import)

9:56 Fossi: so i thought i'd :refer auto-mail and other services into a bigger namespace

9:56 hchbaw: Fossi: actually, clj/core.clj does (load "core_proxy") and such.

9:56 Fossi: for a bar, i might refer some other things as 'service' later on

9:56 gerryxiao: first file main.clj (ns www.dfj.com (:use ..) (:import) ...)

9:57 Fossi: hchbaw: i didn't say it doesn't work, i just think it's ugly :)

9:57 hchbaw: Oh, sorry :)

9:57 gerryxiao: second file helper.clj (in-ns www.defj.com ) (import ...) ) ???

9:57 Fossi: hchbaw: you wrote the fuzzy-complete, right?

9:58 hchbaw: Fossi: yes, almost copied from the original CL implementation.

9:58 Fossi: gerryxiao: normally, i put it in another namespace and use that from main.clj

9:58 liwp: gerryxiao: can't you use the (ns) macro in your file which does support :use etc.?

9:59 Fossi: hchbaw: almost works here now. it's a little weird what symbols it can complete and which not

9:59 liwp: ,(ns foo (:use bar))

9:59 clojurebot: java.io.FileNotFoundException: Could not locate bar__init.class or bar.clj on classpath:

9:59 Fossi: hchbaw: i guess it's best used with hippie-complete

9:59 liwp: ,`(ns foo (:use bar))

9:59 clojurebot: (clojure.core/ns sandbox/foo (:use sandbox/bar))

9:59 Chouser: It's not recommended to use 'ns' for the same namespace in more than one place.

9:59 liwp: ahh, I missed that bit of the problem

10:00 how do I get the macro expansion out of clojurebot?

10:00 ,(macroexpand (ns foo (:use bar)))

10:00 clojurebot: java.io.FileNotFoundException: Could not locate bar__init.class or bar.clj on classpath:

10:01 liwp: ,(macroexpand '(ns foo (:use bar)))

10:01 clojurebot: (do (clojure.core/in-ns (quote foo)) (clojure.core/with-loading-context (clojure.core/refer (quote clojure.core)) (clojure.core/use (quote bar))))

10:01 Fossi: i wish use would support [namespace class class2]

10:01 liwp: Chouser: so why shouldn't one use (ns) for the same namespace from more than one file?

10:02 is it that with-loading-context bit that causes problems? Or possibly refer 'clojure.core?

10:03 Chouser: liwp: well, it mostly works. :refer-clojure wouldn't do what you expect, but other than that I think it's about maintaining a clear difference between the controlling and controlled files.

10:03 liwp: ok

10:04 I was just thinking that in the repl you would do (in-ns 'foo) and then def a bunch of stuff which is sort of the same thing as using (ns) with the same namespace in multiple files...

10:04 but apparently not exactly the same thing looking at the expansion of (ns)

10:07 ol3: hello, is it possible to escape from an doseq form, or should i use something like every?

10:08 Chouser: ol3: other than :while clauses, there's no escape.

10:09 ol3: hm

10:10 * cgrand had forgotten that doseq was the side-effectful twin of for

10:11 ol3: (every? (fn [item] (do-something-with-item) (if (continue?) true false)) seq)

10:12 Chouser: ol3: hm... I guess you could do all that in a :while clause

10:12 ambient: does there exist a list anywhere, of all the features and keybindings of clojure-mode for emacs?

10:12 or is it simply all in the clojure-mode.el file?

10:13 stuartsierra: ambient: Type "C-h m" in a clojure-mode buffer

10:13 Chouser: cgrand: I can't forget -- every time one gets a feature, I end up porting it to the other!

10:14 ambient: stuartsierra that does nothing

10:14 cgrand: "doseq, a sisyphean drama"

10:15 ambient: weird, C-h m works in repl, but not in file buffer

10:15 stuartsierra: ambient: hmm, I dunno, that's the standard describe-mode command in Emacs

10:19 Fossi: ok, i got load to work. i still think it's an ugly solution

10:20 why is refer 'deprecated'?

10:20 it seems like the cleaner way of doing this

10:20 Chouser: it's not deperecated, it's just usually used via 'use' instead of on its own.

10:21 Fossi: well, use doesn't do what i want

10:21 ambient: is there a way to load a java library to the repl that is not in the classpath?

10:21 like (load-jar "swt.jar")

10:21 Fossi: i want to smash multiple namespaces together

10:23 Chouser: Fossi: 'use' does a 'load' and then a 'refer'

10:23 stuartsierra: ambient: there is add-to-classpath, but it does not work in all situations and is vaguely deprecated

10:23 Chouser: 'refer' by itself doesn't do anything with files -- won't load a new one.

10:23 Fossi: hmmm. so i can call function from other namespaces in that one then?

10:23 i thought that was what refer does

10:25 (ns foo (:use some.service :as service)) (service/baz) - ( (ns some.service (:refer service-part)) - (ns service-part) (defn baz)

10:26 would that work?

10:27 Chouser: that would work, though baz would not be visible in foo (using neither 'use' nor 'refer')

10:27 oh

10:27 sorry, wait.

10:28 no, service/baz would not work

10:29 Fossi: hmm. too bad.

10:31 hmmm. if i load a file then, how do i call functions of the namespace i'm being loaded into?

10:31 or can i require it as well?

10:31 ah, this is ugly

10:31 Chouser: some.service could say (def baz service-part/baz) to make it available to users of some.service.

10:31 Fossi: i need to find some other way

10:32 thanks for the help so far though

10:57 ambient: this is pretty cool http://travis-whitton.blogspot.com/2009/09/hot-code-swapping-with-clojure.html

10:59 Chouser: reloading a lib is not atomic

10:59 ambient: yeah that part seemed pure conjecture for me too

11:01 how would one go about making lib reloading atomic?

11:02 100% written with clojure?

11:03 Chouser: ambient: maybe try to load everything into a new namespace and then do a CAS swap somehow.

11:20 ol3: Is it possible to get a sequence of all threads?

11:21 Chouser: ,(keys (Thread/getAllStackTraces))

11:21 clojurebot: java.security.AccessControlException: access denied (java.lang.RuntimePermission getStackTrace)

11:21 Chouser: well, that'll work outside a sandbox

11:22 tmountain: hey guys, I wrote that blog post above, I'll update it to indicate that reloading isn't atomic

11:23 ol3: Chouser: cool thanks

11:24 Chouser: tmountain: sounds good. Depending on the change you're loading, it may not matter.

11:25 tmountain: each def (and defn) is atomic, so you won't load a half-redefined function, but if your change is in two different defn's, and those changes rely on each other, you could potentially have problems.

11:25 tmountain: Chouser: ok, good to know. I will include that in my update.

11:25 Chouser: thanks! nice post, btw. :-)

11:27 tmountain: thanks, Clojure is just too much fun!

11:28 ambient: im still having trouble in getting all the edged smoothed out in my development process :/

11:29 netbeans is bad at building simple one-file test projects and emacs takes time to get used to

11:30 cemerick: ambient: are you using enclojure?

11:31 ambient: i tried it but had trouble managing the files in my project and connecting the repl to the files

11:32 seems there's no proper getting started for any IDE, which would explain the whole development process so it's all diving into the deep end of the pool no matter what i try

11:32 cemerick: You should just be able to right click on your project, and start a repl for it.

11:32 stuartsierra: ambient: I recommend you first get comfortable configuring your project, classpath, REPL, etc. at the command line.

11:32 Then tackle the IDE integration, you'll find it much easier.

11:33 ambient: yeah, seems that's the only way to *truly* get it

11:33 cemerick: stuartsierra: is that sort of like "learn math with a pencil, then use the calculator"?

11:33 stuartsierra: cemerick: yes. Or like "learn assembly, then write C"

11:34 Although I never really learned assembly.

11:34 ambient: i know both and would just stay with idiomatic K&R C first

11:34 cemerick: and I never really learned C (though I did plenty of damage with it :-P )

11:35 ambient: perhaps more appropriate analogy would be to buy a ball before you start playing football

11:35 otherwise you're just kicking around on empty air

11:35 ..hoping to hit something

11:41 raphinou: hi, any vimclojure user here?

11:49 stuartsierra: More Maven-fu, setting up your own public repository: http://stuartsierra.com/2009/09/08/run-your-own-maven-repository

11:52 tmountain: raphinou: me

11:53 raphinou: tmountain: I have installed it successfully (I think: syntax coloring works, I can call a repl manually), but the mappings are not working.

11:53 AWizzArd: Oh funny, I found a bug in Suns regex code.

11:53 ,(re-find #"(a)?123|x" "xyz")

11:53 clojurebot: ["x" nil]

11:53 AWizzArd: ,(re-find #"(a)?1234|x" "xyz")

11:53 clojurebot: nil

11:54 AWizzArd: It's already submitted to Sun.

11:54 ol3: is it ok to construct a lazy-sequence which values depend on a ref, or is this too clever?

11:55 AWizzArd: Perl, clppcre and Co perform correctly.

11:55 tmountain: raphinou: did you define maplocalleader?

11:55 raphinou: let maplocalleader = "," (in your vimrc)

11:56 raphinou: tmountain: not currently. tried it this morning but without success.

11:56 I'll try again for 100% security

11:56 tmountain: raphinou: did you confirm nailgun was running?

11:56 raphinou: yes, laingun is fine, and its classpath ok

11:57 tmountain: raphinou: I've found it can be slightly challenging to get it setup, but once it's working, you'll love it

11:58 raphinou: when I press the , the screen flashes, which doesn't happen when I have a mapping defined

11:58 tmountain: yes, that's why I'm still trying :-)

12:01 tmountain: raphinou: do you have let vimclojure#NailgunClient = "/your/path/vimclojure/ng" and let clj_want_gorilla = 1 ?

12:02 raphinou: tmountain: yes, as explained on the website and the doc

12:02 I think the problem is more that the mappings are not available. Don't know how that comes

12:05 tmountain: raphinou: they're sourced from clojure.vim (loaded from ~/.vim/ftplugin/clojure.vim)

12:06 raphinou: if you search that file for "vimclojure_namespace", you'll see their definitions

12:07 raphinou: tmountain: yes. But I suspect not everything is loaded correctly. the function vimclojure#EvalLine is defined and I can call it, but it gives errors: Undefined variable: b:vimclojure_namespace

12:08 tmountain: raphinou: the definitions are provided via ~/.vim/autoload/vimclojure.vim. it sounds as if that file isn't being sourced properly

12:11 raphinou: what happens if you start vim on a new empty clojure file (i.e., vim new.clj) and then type ,sr ?

12:12 raphinou: tmountain: starts fine with syntax highlighting ok

12:12 no error messages

12:13 and filetype detexted is clojure

12:14 tmountain: does it start a repl, or no?

12:15 raphinou: tmountain: no

12:18 tmountain: raphinou: what operating system?

12:18 raphinou: debian linux, vim 7.1

12:19 tmountain: raphinou: what's the output of ps aux | grep -i nail ?

12:20 hamza: hey guys, is there a revers of assoc for vectors? instead of using subvec to remove an item at a specified index. the doc dissoc does not say it is suitable for vectors?

12:24 raphinou: tmountain: martiansoftware on

12:30 tmountain: raphinou: start vim once more on a new file (i.e., foo.clj) and try this - :call vimclojure#Repl.New()

12:32 raphinou: tmountain: I'm restarting everything from scratch now (clean environment, etc)

12:33 tmountain: raphinou: ok, if you still have issues, try the previous suggestion to determine whether vim can talk to nailgun

12:34 raphinou: tmounain: ok, repl is there now, but I don't know why it started working as it's before I restarted from scratch :(

12:36 tmountain: still issues when opening existing file, but it's a problems with classpath. I'll investigate further. Thanks for your help!

12:38 tmountain: raphinou: no problem, best of luck

12:38 raphinou: try opening a file without a namespace at the top, and I bet it works

12:39 raphinou: tmountain: you're right

12:40 any idea how to fix this?

12:40 but the mappings still arent there though :(

12:42 tmountain: raphinou: the namespace thing is a classpath issue

12:43 basically the file has to be part of nailgun's classpath

12:43 not your local shell classpath

12:44 raphinou: tmountain: classpath (for nail server and the vim I start) contains base directory of the clojure file's namespace

12:45 tmountain: ok, it was the classpath env variabels that was not exported I think....

12:46 tmountain: raphinou: yeah, it's pretty finicky

12:46 raphinou: tmountain: it's working at last! wow

12:47 tmountain: raphinou: awesome ;-)

12:47 raphinou: thanks a bunch for you help! No I'll be able to see if it was worth the effort as you said :-)

12:47 s/No/Now/

12:47 tmountain: it's great tool for developing without leaving your editor

12:48 just eval a form, go into a repl, test, etc...

12:48 raphinou: yes. I already remember the evaluate line mapping :-)

12:48 just in time as I need to go now. See you later, bye!

13:17 ambient: i find this curious: if i have music.clj and namespace foo.bar.music, and i want to extend to foo.bar.music.one and foo.bar.music.two i have to destroy music.clj, create music directory and create one and two.clj into that dir?

13:18 Chouser: you can have foo/bar/music.clj and foo/bar/music/one.clj

13:18 for foo.bar.music and foo.bar.music.one respectively.

13:18 ambient: oh ok :)

13:49 Fossi: what was the idiom again for turning [[1 2] [1 2]] into [[1 1] [2 2]]?

13:50 ah, interleave

13:50 hmm. almost

13:50 ;)

13:52 anything better than (partition 2 (apply interleave [[1 2] [1 2]]))?

13:54 AWizzArd: stuartsierra: about clojure.contrib.profile, I may have found a bug. When you have (defn foo [x] (prof :foo (+ x 10))) and then do (profile (map foo (range 5))) ==> java.lang.IllegalArgumentException: Wrong number of args passed to: core$max

13:54 clojurebot: max people

13:54 clojurebot: max people is 164

13:56 AWizzArd: stuartsierra: but (profile (doseq [i (range 5)] (foo i))) works fine.

14:00 Fossi: actually, the solution to my problem is (let [foo (apply interleave [[[10] [20]] [[11] [21]] [[12] [22]]])] (split-at (/ (count foo) 2) foo)) :)

14:00 but i bet there is a nicer way

14:02 stuartsierra: AWizzArd: ok I'll take a look. Could you file an Assembla ticket?

14:35 Anybody have a link for the slides (not video) to rhickey's talk "Clojure for Java Programmers"?

14:35 Chouser: ,(apply map vector [[1 2] [1 2]])

14:35 clojurebot: ([1 1] [2 2])

14:39 stuartsierra: ah, found it on the Group Files page.

14:43 AWizzArd: stuartsierra: I need an account on Assembla to open a ticket, yes?

14:43 Chouser: AWizzArd: no, just use the "support" tab

14:43 AWizzArd: ok good, thx

14:47 Chouser: hmm, on http://www.assembla.com/spaces/clojure-contrib/support/tickets it tells me "You must login or register to submit a support ticket".

14:48 I will try a BugMeNot account

14:49 Chouser: hm, I wonder if that changed at some point. I guess you need an assembla account, but no special permissions.

14:50 LauJensen: Did we decide what a Clojure programmer is called? Clojurist? Clojurian ? Clabango?

14:52 stuartsierra: Cluje

14:52 drewr: LauJensen: "Clojure programmer"

14:53 stuartsierra: "Smug Java Weenie"

14:53 drewr: a "clojurian" is someone who sits around trying to think about what to call clojure programmers :-)

14:53 LauJensen: noobs :)

14:55 Chouser: Clojurian

14:56 http://clojure-log.n01se.net/date/2008-10-17.html#08:26b

14:59 also: http://www.computerworld.com.au/article/313989/-z_programming_languages_clojure?pp=3

14:59 LauJensen: Its settled and documented :)

15:01 Perfect reference, thank you Mr. Chouser sir

15:02 Chousuke: Clabango :D

15:02 Maybe that could be used as the title of an experienced Clojurian.

15:03 LauJensen: Chousuke: No, its just something rhickey exclaims when he hands you your black belt

15:07 hiredman: ~suddenly rhickey hands you a belt made of fine black italian leather!

15:07 clojurebot: CLABANGO!

15:07 LauJensen: hehe

15:09 manic12: does clojure have a test library?

15:09 Chousuke: clojure.test if you're using master, contrib.test-is if 1.0

15:10 manic12: ok, I'll have to try it on this arm9 that clojure seems to run on

15:10 Chousuke: note that if you're using 1.0 you need the 1.0-compatible branch of contrib

15:10 manic12: is 1.0 the newer?

15:11 stuartsierra: 1.0 is the official release; Git master is current development, like SVN trunk

15:11 manic12: ok

15:12 with all the concurrency stuff, a 200mhz arm board is probably a boring target

15:12 Chousuke: heh.

15:12 well, it'll be an interesting experiment nonetheless

15:12 to see what happens :P

15:13 manic12: it works so far

15:17 am i supposed to git test-is or is there a tar.gz or bz2 somewhere?

15:17 technomancy: the 1.0 release is a tarbomb IIRC, so watch out.

15:17 stuartsierra: manic12: test-is can be found in the "clojure-1.0-compatible" branch of Clojure-contrib.

15:18 http://github.com/richhickey/clojure-contrib

15:20 manic12: for my workstation I do prefer git, but for this arm board, if I could find where that 1.0-compatible tarball is, it would be useful

15:20 I guess I could make one

15:20 stuartsierra: there is no tarball

15:21 hiredman: you can download the branch as a tarball from github

15:21 stuartsierra: ture

15:21 true

15:22 hiredman: actually

15:22 can you?, I don't see a way to do that anymore

15:22 manic12: anybody know the git clone repository name for the 1.0 compatible contribs?

15:24 Chousuke: manic12: it's in the contrib repo

15:24 you clone it, then just checkout the master branch in your clone.

15:24 er

15:24 Chouser: http://github.com/richhickey/clojure-contrib/tarball/clojure-1.0-compatible

15:24 Chousuke: the compatible branch of course.

15:24 Chouser: that's the tarball link

15:24 Chousuke: or you can do that I guess :)

15:25 manic12: thx

15:34 it takes about 30 seconds from the time you start clojure till the time the user=> prompt shows up on this computer

15:40 hiredman: the jvm startup times can be painful

15:40 (but is five seconds or less here)

15:43 ambient: how can i generate character frequencies from a string into a map?

15:44 should i just write loop/recur?

15:45 hiredman: sounds like reduce

15:46 ,(let [+i (fn [n] (inc (or n 0)))] (reduce #(update-in % [%2] +i) (seq "foo bar baz"))

15:46 clojurebot: EOF while reading

15:47 hiredman: ,(let [+i (fn [n] (inc (or n 0)))] (reduce #(update-in % [%2] +i) (seq "foo bar baz")))

15:47 clojurebot: java.lang.ClassCastException: java.lang.Character cannot be cast to clojure.lang.Associative

15:47 hiredman: ,(let [+i (fn [n] (inc (or n 0)))] (reduce #(update-in % [%2] +i) {} (seq "foo bar baz")))

15:47 clojurebot: {\z 1, \r 1, \a 2, \b 2, \space 2, \o 2, \f 1}

15:47 manic12: hiredman: jamvm actually, not jvm in this case

15:47 hiredman: manic12: jamvm is a jvm :P

15:48 Chouser: ,(reduce #(assoc % %2 (inc (% %2 0))) {} "foo bar baz")

15:48 clojurebot: {\z 1, \r 1, \a 2, \b 2, \space 2, \o 2, \f 1}

15:49 ambient: ok, ty.

15:49 hiredman: Chouser: cute

15:49 (% %2 0)

15:49 Chouser: heh

15:50 its meaning is obvious, right?

15:50 hiredman: sure sure

15:50 ambient: you're using the key as a function?

15:50 hiredman: "obvious"

15:50 Chouser: the map as a function.

15:50 could say (get % %2 0)

15:50 and waste 4 chars

15:50 hiredman: that might be a little more clear

15:51 ambient: well i still need to think about that. functional style programming is just very slowly absorbing information for me

15:52 somehow it's a lot easier with scheme because it has so few core operations

15:53 i think almost all my functions exploited some kind of tail recursion, now that i can't do it, i miss it

15:54 stuartsierra: ambient: you can still do tail recursion with loop/recur

15:54 ambient: yes, but that's not the same :)

15:56 stuartsierra: Usually it is. Writing recur in a function without an enclosing loop is the same as a tail recursive call in Scheme.

15:56 Clojure is just a little more restrictive regarding the definition of "tail position."

15:57 Chouser: ,(-> [a b] (fn (assoc a b (-> b (a 0) inc))) (reduce {} "foo bar baz"))

15:57 clojurebot: {\z 1, \r 1, \a 2, \b 2, \space 2, \o 2, \f 1}

15:57 ambient: yes, it might be the same semantically but i can wrap my head around scheme's way of doing things a lot better

15:57 Chouser: there, that should clear things up

16:00 ambient: now priority queue... this will be harder

16:01 manic12: is there an apropos?

16:01 Chouser: ambient: I've got most of a priority queue working, built on finger trees.

16:02 ambient: idk, maybe i could use sorted map

16:02 Chouser: manic12: (find-doc "find-doc")

16:02 ambient: Chouser cool

16:02 i hope you blog about them that the rest of us mortals can comprehend ;)

16:02 hiredman: ,(pl (↕reduce "foo bar baz" {} λab (assoc a b (inc · a b 0 ))))

16:02 Chouser: ambient: so as long as you don't need it for a week or so, you can probably just wait 'til I'm done and then use it.

16:02 clojurebot: {\z 1, \r 1, \a 2, \b 2, \space 2, \o 2, \f 1}

16:03 * hiredman cheats

16:03 * Chouser needs to get UTF8 working on the irc log pages

16:03 ambient: i spy lambda with my little eye

16:04 clojure character support is more than ASCII?

16:05 stuartsierra: ambient: yes, it supports anything Java supports, so at least UTF-8.

16:05 hiredman: utf8

16:05 ambient: that's nice, and weird :)

16:05 stuartsierra: Not all editors play nice with UTF-8, though.

16:05 ambient: and not all fonts

16:05 hiredman: :/

16:05 clojurebot: the man?

16:05 clojurebot: ☝(^_^)☝

16:05 duck1123: and those shall not be talked about

16:06 ambient: you made me switch to dejavu sans mono :|

16:06 hiredman: yeah

16:07 dejavu sans mono has the best coverage of any fixed width font I've tried

16:07 duck1123: I wonder how crazy a clojure minifier could get. I'm sure you could do some crazy tricks

16:07 ambient: but i want to use my old MS-DOS fonts :(

16:07 borland turbo c, oh yeah

16:08 duck1123 APL is pretty sweet in that regard

16:09 * duck1123 longs for the day when he can replace javascript with clojure just as he did with java

16:10 ambient: which will be never

16:10 duck1123: you don't think it'll happen?

16:10 Chouser: of course it will happen

16:11 ambient: if you mean using clojure to write javascript then, yeah

16:11 duck1123: I was talking more about clojurescript

16:13 Chouser: quite a lot was working there for a while -- persistent vectors, maps, destructuring, macros, dynamic binding, for, loop/recur, ...

16:13 probably still works if you don't mind that it's pre-1.0 clojure. :-/

16:14 ambient: well im looking at this: http://code.google.com/p/jc-pheap/ atm

16:14 hiredman: maybe clojurebot should export its brain as a set of rdf triples

16:15 duck1123: I would like to be able to include a certain javascript library and have it load any text/clojurescript script elements and executes them

16:15 hiredman: yes please

16:15 hiredman: I'd have to learn how to do that

16:16 duck1123: I've got some old Jena/clojure code in my archives that I threw out

16:16 I could dig them out and paste them if you want, but i think someone did a library

16:17 Chouser: rhickey did a library

16:17 stuartsierra: I did too

16:17 duck1123: I gave up on actual rdf parsers/libraries when I decided to fake it

17:13 drewr: stuartsierra: do you have a way to tie in custom deserialization in c.c.json.read?

17:20 stuartsierra: not sure what you mean

17:21 It just reads JSON. You can't extend its idea of what valid JSON is, if that's what you mean.

17:23 drewr: I'd like to have a fn called on a value after it's deserialized

17:24 stuartsierra: Like a callback? No, it doesn't do that.

17:24 drewr: wanted to make sure I wasn't overlooking something

17:24 stuartsierra: Just call the function directly on the deserialized object.

17:26 It's not a streaming parser, some Java libraries do that.

17:30 drewr: ok, so I'd like to traverse my resulting object and convert all the Longs to Dates, trying to use walk to do it

17:30 what's wrong with this?

17:30 (walk #(if (= % "bar") :bar_was_here %) identity {:foo "bar"})

17:30 => {:foo "bar"}

17:31 stuartsierra: don't call walk directly, use prewalk or postwalk

17:32 drewr: ah, thanks

17:33 stuartsierra: user> (prewalk #(if (= % "bar") :bar_was_here %) {:foo "bar"})

17:33 {:foo :bar_was_here}

17:33 clojurebot: foo is is Short, Self Contained, Correct (Compilable), Example http://sscce.org/

17:34 hiredman: clojurebot: what is wrong with you?

17:34 clojurebot: Roger.

17:36 lowlycoder: has anyone written a 3d opengl game using clojure? the jogl/jni calls are really hurting me right now

17:36 stuartsierra: there are 2 JOGL wrappers in Clojure; look on the mailing list

17:36 I think they're still findable there

17:41 LauJensen: I'm doing a post on PHP (typical webdev) vs Cloure/Servlets, anybody that can find 5 minz to skim, just to see if I touched on the most important stuff?

17:46 unlink: Am I missing out on a more obvious way of doing this? (reduce (fn [acc x] (assoc acc x (inc (get acc x 0)))) {} coll)

17:49 hiredman: ,(pl (↕reduce "foo bar baz" {} λab (assoc a b (inc · a b 0 ))))

17:49 clojurebot: {\z 1, \r 1, \a 2, \b 2, \space 2, \o 2, \f 1}

17:49 Chouser: that looks familiar

17:49 hiredman: Chouser: yeah, almost like you could have written it…

18:15 ambient: Chouser got that finger tree source code lying anywhere on the web?

18:15 *laying around

18:20 Chouser: ambient: http://github.com/Chouser/finger-tree

18:21 not yet alpha, but it is what it is.

18:21 ambient: well it looks heave, something for me to parse while i listen to trance

18:22 *heavy

18:22 Chouser: heh

18:22 oh, it needs the newnew branch of clojure

18:23 hiredman: (reify)

18:50 jbell: hey guys, can anyone show me how to make a powerset function in clojure?

18:55 Chousuke: hmm

18:55 (doc reductions)

18:55 clojurebot: "([f coll] [f init coll]); Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init."

18:55 Chouser: ~google clojure powerset

18:55 Chousuke: damn, no namespace.

18:55 clojurebot: First, out of 5150 results is:

18:55 Cribbage points counter in Clojure « Occasionally sane

18:55 http://gnuvince.wordpress.com/2008/10/11/cribbage-points-counter-in-clojure/

18:56 jbell: sure, I saw that, thanks.. is that the best way to do it? it's quite different from the lisp map way I'm used to

18:59 hiredman: someone must have use'ed that namespace

18:59 Chousuke: I thought about writing a powerset with reductions but it's not quite a powerset :P

18:59 ,(reductions (fn [a b] (conj a b)) #{} [1 2 3 4])

18:59 clojurebot: (#{} #{1} #{1 2} #{1 2 3} #{1 2 3 4})

19:01 Chousuke: wait. why did I use that anonymous function.

19:03 jbell: is the reductions function/macro from another namespace?

19:03 Chousuke: I think it should be c.c.seq-utils

19:03 or something

19:03 jbell: cool, I'll try that

19:26 am I right to think that the clojure contrib 1.0.0 jar doesn't include seq-utils

19:26 ?

19:26 hiredman: which "the"

19:27 as far as I know there is no "the" clojure contrib jar

19:27 jbell: I got it packaged with enclojure

19:29 Chousuke: I'm not sure if I got the namespace right, even

19:29 hiredman: jbell: and what leads you to believe it does not include seq-utils?

19:29 Chousuke: ~def reductions

19:31 jbell: thanks clojurebot

19:32 how do I get and compile the freshest version of contrib to have a jar in netbeans?

19:33 I expect I d/l from github, but then how do I compile it?

19:36 Chousuke: you can try without compiling first I suppose.

19:37 I mean, plain "ant" will give you a jar to use.

19:37 jbell: hmm, I think it's a maven project

19:37 Chousuke: if you actually want to compile (the pretty printer requires it) then you need to do ant -Dclojure.jar=/path/to/clojure.jar

19:38 and I can't give any IDE-specific advice /:

19:38 I don't use IDEs myself. besides emacs, which is actually the Borg

19:38 jbell: ahh right ok :)

19:38 I like vim, although I don't know how much more trouble I'd be in setting that up

19:39 Chousuke: in 50 years emacs will have become self-sufficient and develops itself through mind-washed coder drones

19:41 Actually, maybe that already has happened. :/

19:41 technomancy: Chousuke: I give it five years.

19:41 * Chouser isn't a mind-washed drone in the service of emacs.

19:41 Chousuke: Chouser: that's what the emacs wants you to think!

19:42 it's a symbiotic relationship anyway

19:43 Chouser: Chousuke: emacs codes in you!?

19:43 Chousuke: emacs takes advantage of humans but in exchange we get... emacs.

19:46 I wonder what it would take to compile and run some ancient version of emacs.

19:46 I'm kind of interested in what it was like when it was young :P

19:47 but maybe later.

19:50 jbell: if you can sum up emacs and its significance to your coding I'd like to know it

19:51 technomancy: jbell: simple: it's trivial to modify your environment at-will during runtime.

19:51 http://technomancy.us/115 <= sums it up in longer format

19:51 jbell: cool will look

19:52 * technomancy is biased though; he wrote the Emacs Peepcode screencast

19:52 technomancy: in interests of full disclosure

19:53 damned if it isn't hard for me to type "closure" correctly these days

19:58 tomoj: technomancy: +1 on emacs-starter-kit working fine in aquamacs :)

19:58 thanks bunches

19:58 technomancy: tomoj: great!

20:02 ambient: hmm, there's must be a better way of doing this (reduce #(conj % [(get %2 1) (get %2 0)]) (sorted-set) freqs)

20:05 arbscht: ambient: what is freqs and what is your code supposed to do?

20:05 ambient: freqs is character frequency map like {\a 2, \h 5, \m 1} etc

20:05 Chouser: (into (sorted-set) (map (comp vec reverse) freqs))

20:05 dunno if that's better

20:06 (into (sorted-set) (for [[k v] freqs] [v k]))

20:07 ambient: yeah, that's better :)

20:08 Chouser: (reduce (fn [s [k v]] (conj s [v k])) (sorted-set) freqs)

20:08 ambient: is that in any way better?

20:09 ah well.. time to construct the binary sequences

20:09 Chouser: (into (sorted-set) (map vector (vals freqs) (keys freqs)))

20:10 so many ways to skin that particular cat. I guess I like the 'for' best so far.

20:10 ambient: yeah the first one is the most readable

20:10 with for

20:12 jbell: Chouser, how would you skin the powerset cat?

20:12 Chouser: Chousuke: had a nice one, didn't he?

20:13 ,(reductions conj #{} [1 2 3 4])

20:13 clojurebot: (#{} #{1} #{1 2} #{1 2 3} #{1 2 3 4})

20:13 Chouser: pretty hard to beat

20:14 jbell: lol, I've only just realised what clojurebot is

20:16 that one isn't powerset function though

20:17 if clojurebot is evaluating it correctly

20:17 Chouser: oh.

20:17 oh, indeed.

20:18 jbell: I posted a link. the first google hit for: clojure powerset is a blog post with a code snippet

20:19 jbell: sure, I saw that, I wondered if you had a better way to skin it :P

20:30 ambient: oh, there was frequencies already in seq-utils :)

20:33 nathanmarz: hey all

20:33 looking at clojure core code

20:33 why is reverse defined like this:

20:33 (defn reverse

20:33 "Returns a seq of the items in coll in reverse order. Not lazy."

20:33 [coll]

20:33 (reduce conj () coll))

20:34 doesn't conj not guarantee where in the array things will get added?

20:35 rhickey_: nathanmarz: conjing onto a list puts things at the front, so walking one seq and building a list will reverse it

20:36 nathanmarz: ah right, cool

20:36 rhickey_: ,(conj () 1 2 3)

20:36 clojurebot: (3 2 1)

20:37 rhickey_: ,(conj [] 1 2 3)

20:37 clojurebot: [1 2 3]

20:42 Chouser: rhickey_: I'm currently using consLeft and consRight as method names for double-headed things. How does that strike you?

20:42 for such a thing 'cons' would call consLeft, 'conj' would call consRight

20:43 hiredman: :/

20:43 seems like it would be nice to be able to switch somehow from left conj to right conj

20:44 IRightConj ILeftConj

20:45 Chouser: I tried to do that, but at least for finger-trees I couldn't find a way to switch from one way to the other in O(1) time.

20:45 hiredman: I see

20:45 rhickey_: Chouser: sounds ok

20:45 Chouser: the problem being when you concat a forward to a reversed tree.

20:51 ,((fn pset [c] (when-let [[f & r] c] (concat (map #(conj % f) (pset r)) (pset r) [#{f}]))) [1 2 3 4])

20:51 clojurebot: (#{1 2 3 4} #{1 2 4} #{1 2 3} #{1 3 4} #{1 4} #{1 3} #{1 2} #{2 3 4} #{2 4} #{2 3} #{3 4} #{4} #{3} #{2} #{1})

20:52 Chouser: that'll blow the stack for big input collections

20:52 clojurebot: for is not used enough

20:52 ambient: aw, i don't think there's sorted-set-by :(

20:52 i can't set the comparison function for sorted-set

20:53 Chouser: ambient: http://www.assembla.com/spaces/clojure/tickets/79

20:55 jbell: cool, that's more like what I wanted to do

21:00 Chouser: I just wanted to write a quick powerset function to test something out, so I was going for natural rather than efficient

21:01 * Chouser nods

21:01 Chouser: This is slightly better:

21:02 ,(letfn [(pset [[f & r :as c]] (when c (lazy-cat (map #(conj % f) (pset r)) (pset r) [#{f}])))] (pset [1 2 3 4]))

21:02 clojurebot: (#{1 2 3 4} #{1 2 4} #{1 2 3} #{1 3 4} #{1 4} #{1 3} #{1 2} #{2 3 4} #{2 4} #{2 3} #{3 4} #{4} #{3} #{2} #{1})

21:02 Chouser: using lazy-cat means it can give you the head of the seq faster.

21:02 hiredman: will that work with a list instead of a set?

21:02 Chouser: yes

21:02 * hiredman squirrels that away

21:03 Chouser: just use (list f) instead of #{f}

21:03 or [f]

21:07 jbell: I was really intrigued when Rich said about how you could do aspect/context programming by dynamically binding the functions, but my attempt failed, and I couldn't find anything online

21:07 hiredman: failed how?

21:09 jbell: I tried to use let to bind the function in context, I think I know now... you use letfn?

21:09 hiredman: now

21:09 no

21:09 arbscht: ,(doc binding)

21:09 clojurebot: "([bindings & body]); binding => var-symbol init-expr Creates new bindings for the (already-existing) vars, with the supplied initial values, executes the exprs in an implicit do, then re-establishes the bindings that existed before."

21:09 hiredman: well, you can use let to bind a name to something else in a lexical scope

21:10 but you most likely want dynamic scope, which would use binding

21:13 jbell: great thanks

21:14 hiredman: woa

21:14 what is this?

21:15 jbell: does anyone else think that 'cross-cutting concerns' isn't a great name for aspects covered by AspectJ?

21:16 hiredman: rhickey is going to be on the MS campus next week, according to twitter

21:20 rhickey: is this true?

21:25 jbell: I guess I won't have to care anymore lol

21:26 Chouser: why would you want the head of the seq faster?

21:28 Chouser: why not?

21:29 it helps if you only need the first few items, or if you're going to process the seq in parallel with something else such as with pmap or seque

21:30 jbell: right, so is pset utilising that change?

21:30 sorry...

21:30 that was nonsense lol

21:30 Chouser: oh, good. I couldn't understand. :-)

21:30 jbell: lol, I saw p for parallel

21:30 Chouser: ah!

21:31 yeah, sorry, bad abbreviation.

21:31 Chousuke should have slapped me.

21:32 jbell: I just couldn't see how in this algorithm getting the head faster would make any improvement. I haven't analysed it very much, though

21:32 hiredman: clojurebot: whose job is it to make sure everyone uses good abbreviations?

21:32 clojurebot: You don't have to tell me twice.

21:32 hiredman: :/

21:32 Chouser: clojurebot: whose job?

21:32 clojurebot: whose job is it to make sure everyone uses good abbreviations

21:33 hiredman: something is broken

21:33 *sigh*

21:33 Chouser: Who's on first.

21:33 jbell: it's just lazy-cat vs. concat.

21:33 jbell: concat is a fn, so all its args are evaluated up front, even if don't need the later items until later

21:34 jbell: lazy-cat is a macro, and it delays evalling the args until they're needed.

21:34 not a big deal under most use cases.

21:36 rhickey has no comment on the MS visit. :-)

21:40 duck1123: is it possible to use flymake with clojure

21:47 Chouser: ,(inc nil)

21:47 clojurebot: java.lang.NullPointerException

21:48 Chouser: ,(first (map inc (list 0 1 2 nil)))

21:48 clojurebot: 1

21:48 Chouser: map is lazy!

21:50 hiredman: clojurebot: whose job is it to make sure everyone uses good abbreviations?

21:50 clojurebot: that's hiredman's job

21:50 hiredman: :(

21:51 jbell: I like clojure bot... not for that reason!

21:51 hiredman: clojurebot: whose job is it to like clojurebot?

21:51 clojurebot: that's metric's job

21:53 jbell: clojurebot: does metric like you though?

21:53 clojurebot: excusez-moi

21:54 hiredman: ~scala ((x: Int) => x + 1)(2)

21:54 clojurebot: Int = 3

21:56 jbell: clojurebot: metric vous aime, clojurebot?

21:56 clojurebot: Pardon?

21:56 jbell: he only pretends he knows french.

21:56 hiredman: clojurebot: whose job is it to deal with french?

21:56 clojurebot: that's albino's job

21:57 Chouser: it could pick names in proportion to how often the talk

21:57 hiredman: yeah, which would require collecting stats, which it should do

21:58 duck1123: it would be funny if you had clojurebot open a ticket somewhere whenever that happens

21:58 not in a real ticketing system, however

21:59 hiredman: ~ticket #1

21:59 clojurebot: {:url http://tinyurl.com/ntftnj, :summary "Add chunk support to map filter et al", :status :test, :priority :normal, :created-on "2009-06-13T14:38:41+00:00"}

21:59 duck1123: I was saying clojurebot needs to record the fact that it's albino's job to deal with french

22:00 hiredman: yeah, but then it would have to remember it

22:00 clojurebot: whose job is it to deal with french?

22:00 clojurebot: that's dthomas's job

22:02 duck1123: clojurebot: whose job is it to prove P = NP

22:02 clojurebot: Ack. Ack.

22:02 jbell: lol

22:03 hiredman: oh

22:03 you broke it

22:03 clojurebot: whose job is <reply>that's #someone's job

22:03 clojurebot: Ack. Ack.

22:04 hiredman: you need to end a question with "is" in it with a "?"

22:12 jbell: what else can clojurebot do?

22:13 that's implemented?

22:13 hiredman: ~google clojurebot

22:13 clojurebot: First, out of 52 results is:

22:13 hiredman&#39;s clojurebot at master - GitHub

22:13 http://github.com/hiredman/clojurebot/tree/master

22:14 hiredman: clojurebot: translate to fr from en: hello

22:14 clojurebot: from en: Bonjour

22:14 hiredman: er

22:14 clojurebot: translate to fr: hello

22:14 clojurebot: bonjour

22:14 jbell: cool

22:14 hiredman: 1d20+5

22:14 clojurebot: 9

22:15 jbell: lol

22:16 hiredman: ~quote JAVA

22:16 clojurebot: excusez-moi

22:16 hiredman: ~ticker JAVA

22:16 clojurebot: JAVA; +0.01

22:17 ambient: hmm, my huffman is just 3 lines and it would need heap queue to finish :/

22:18 quess it's time to implement O(n) insertion heapq

22:20 jbell: you could make clojurebot translate people on the fly, like clojurebot:translate user from es

22:20 ambient: or better yet, translate from english->chinese->english->spanish->english and see what comes out

22:21 technically i think it's mandarin

22:25 jbell: you could do something like run skinning challenges (after Chouser's skinning cats), and allow people to vote via clojurebot, and then clojurebot would keep track of the scores lol... yeah.

22:27 but I'm guessing from what you said before that it doesn't keep state

22:45 if clojure had a secure aspect then clojurebot could be programmable

22:49 how are generics handled in clojure? I seem to remember Rich mention them, and say that they weren't a problem..?

22:50 Chouser: right. Java uses type erasure, so you can just ignore them.

22:54 jbell: so what happens if I want to create an instance of an ArrayList<String> to pass to the Java side?

22:54 or is that not done for good reason?

22:55 Chouser: ,(java.util.ArrayList. (map str (range 10)))

22:55 clojurebot: #<ArrayList [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]>

22:55 Chouser: it just works, as long as the only thing you put in the ArrayList are Strings.

22:56 If you break the contract, you get a runtime exception.

22:56 jbell: oh ok, I've also found a log where you explained it to someone else too!

22:56 Chouser: :-)

22:58 jbell: now I know how you can reskin so fast :P

23:31 technomancy: evening dudes

23:31 also possibly dudettes

23:33 durka42: evening technomancy

23:33 * durka42 is not a dudette, but i still like the word

23:47 * technomancy has a nasty classloader problem with the MavenEmbedder

23:48 technomancy: any ideas what's wrong here? http://p.hagelb.org/screw%2fmaven.clj.html

23:49 it's a direct port of code from the maven embedder unit tests

23:49 the only difference I can think of is that the classloader it hands off to maven may be different in the context of Clojure

23:49 arbscht: 404

23:50 technomancy: sorry: http://p.hagelb.org/maven.clj.html

23:56 still not sure I understand how classloaders work and how Clojure interacts with it

23:58 I suppose Clojure has its own classloader, and it's not playing nice with the other maven classes that are supposed to be loaded via plexus.

23:59 tomoj: I wish I could even begin to understand what you're talking about

23:59 java is still a mystery to me :(

Logging service provided by n01se.net