#clojure log - Aug 11 2010

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

0:00 Scriptor: that's good

0:00 Raynes: git add RE<tab> LI<tab> test/ src/

0:00 ;)

0:00 Scriptor: now, continue to follow the directions, so commit

0:00 Give it a message explaining what you changed

0:03 ataggart: finally

0:05 the benefit of 4 steps vs 1 is lost on me, but oh well.

0:05 at least it's uploaded

0:05 Scriptor: ataggart: the benefits become clearer when you're dealing with a ton of code and numerous changes :)

0:06 ataggart: given that I'd then be constrained to the output from a console, I have a hard time imagining that.

0:07 I'll care more about git once someone makes a fully functional ui

0:07 Scriptor: there are UI's, but consoles aren't constraining

0:07 most people use them anyway

0:08 technomancy: eh; I hate using git without magit.

0:09 Scriptor: nub :p

0:10 ataggart: ^ another reason I'm loath to deal with git

0:10 Scriptor: have you used other version control systems?

0:10 ataggart: yes

0:10 rlb: ataggart: the index is an extra level of complexity, but it can be handy -- think of it as a staging area.

0:11 "git add FILE" merges whatever's in a file into the index (so the index contains the current state of that file at that point).

0:11 If you edit the file further, the index will still contain the old version, and a "git commit" without "-a" will just commit whatever's in the index.

0:12 You can run "git add" as many times as you like to refresh the index.

0:12 ataggart: so the index is an equivalent to the local repo?

0:13 well no that wou;dn't make sense considering the comment goes with commit

0:13 rlb: Though in one really common case, you can ignore the index entirely and just use "git commit -a" which will commit the working tree state of every file (that git already knows about).

0:13 It won't handle new files.

0:13 You need to "git add" those.

0:13 technomancy: -a is the "turn my lightsaber into a shotgun" flag

0:13 rlb: ataggart: the index is basically a list of file names along with a secret copy of their contents at the point they were added to the index.

0:14 Scriptor: it's really not that complicated, you make a bunch of separate changes, you add certain files to the staging area, commit, and repeat

0:14 rlb: Those files are "staged" -- i.e. they're in the staging area, and git commit (without -a) just commits whatever's in the staging area.

0:14 "git commit -a" behaves more like svn, etc.

0:15 ataggart: "simple" is clearly a relative word

0:15 rlb: ataggart: I suspect that if you continue to use git, you'll find the index handy eventually.

0:15 ataggart: good thing it's in my face right at the get go then, eh?

0:15 rlb: ataggart: but you can ignore it much of the time if you use "-a".

0:16 ataggart: and of course "git status" is useful (to help see what's going to happen).

0:16 ataggart: so to get a change from my editor to the repo on git hub, I need to add it to the index (which does?) and then commit it (which does?) and then push it, which gets it to where I want the changes to go.

0:16 Scriptor: ataggart: if all you're doing is changing a text file, sure

0:16 or

0:17 you commit as much as you want, until you've got everything ready

0:17 and then you push

0:17 rlb: I'd also recommend setting color.ui to auto in your ~/.gitconfig. "git config --add color.ui auto"

0:17 ataggart: and I bet the first time you make use of some of something like "git commit --amend" you might start becoming more fond of git, but who knows?

0:19 No doubt it can be complicated, but I've been particularly impressed by the fact that I have yet to back myself in a corner, or want to do something that it can't do (after some occasional help from #git).

0:19 ataggart: I'm loath to go there.

0:19 Scriptor: why?

0:19 clojurebot: why not?

0:19 rlb: ataggart: hmm -- they've always been friendly to me...

0:19 ataggart: My experience with git-vocates is much like my experiecen with rubyists

0:19 Scriptor: have you been there before?

0:20 * rlb likes "git reset --hard HEAD^" sometimes too...

0:20 ataggart: no, because I don't really care enough

0:20 a few beers in me and I just want to get the bytes onto the damn server

0:20 stroking linus' "workflow" just annoys me at this point

0:21 rlb: ataggart: also, fwiw, some of the commands that look arcane are explained pretty well in the manpage EXAMPLES.

0:21 (or in the output of "git status", etc.)

0:22 Scriptor: ataggart: well, it sounds like we probably won't suddenly convince, just be sure to keep an open mind

0:22 ataggart: perhaps I'm not in the right mindset, but the 99% case of simply moving changes (along with a comment) to the repo should be a fairly basic operation

0:22 clojurebot: use comp for a point free, pointless style

0:22 ataggart: clojurebot confuses me

0:22 slyrus: and it is...

0:23 Scriptor: ataggart: well, repos are just what's on your computer, github just happens to be a repo that's integrated with their site

0:23 ataggart: anyway, my next hurdle will be trying to get thoser changes from my fork of contrib over to official contrib

0:23 rlb: Oh, and I suppose I should mention that you shouldn't use some of those commands (like "commit --amend" or "reset --hard .." if you've already pushed the relevant commits. If you do, you'll make other people grouchy. You're basically editing public history in that case.

0:24 Raynes: ataggart: What VCS do you use right now?

0:24 rlb: (But at least git makes that *possible* for the cases where you only have local changes.)

0:25 Scriptor: ataggart: oh, that's easy, go to the original repo's github page and click pull request

0:25 give them a brief gist of what you've done, and they can then pull your code themselves

0:25 ataggart: Raynes: svn, though I haven't needed to use the commandline for about 4 years.

0:25 well, I have commit rights to contrib

0:26 but it wasn't clear to me what the process should be

0:26 so I forked it

0:26 scottj: Is there's a simpler fn for merge-with to ensure vals are colls and concat them than this: http://paste.lisp.org/display/113394

0:26 Raynes: I don't think of the command-line as something I need to use as much as it is something I'd rather use. Except with magit, of course.

0:27 ataggart: Raynes: I like being able to see every file that has either an incoming or outgoing change, be able to instantly see a visual diff between local and remote sitting side-by-side, etc.

0:27 the console sucks for that

0:28 Raynes: Fair enough.

0:28 * Raynes hugs magit

0:29 ataggart: plus console is ugly :)

0:29 used almost exclusively for runnign commands on remote machines or tailing logs

0:30 wwmorgan: ataggart: gitx has a pretty good diff viewer

0:30 gitx / gitk

0:32 ataggart: wwmorgan: where?

0:32 ah, I see. ugh, that over/under style

0:33 how do you see the diff between a local and remote file?

0:34 wwmorgan: well, you have the whole repo history, so you just view the local commit on your machine

0:35 scottj: ataggart: what diff viewer's format do you like?

0:37 ataggart: scottj: side-by-side. subclipse has a very nice one that keeps the two sides in sync relative to non-changed lines, etc.

0:38 though you need some screen realestate, so it doesn't show well in cramped screenshots

0:42 scottj: maybe EGit does that

0:58 slyrus: hmm... I think the two arg repeatedly should go away and the one arg repeatedly should become the (now non-existent) one arg iterate, meaning that repeatedly could just go away.

0:58 but what do I know

1:00 ataggart: repeatedly (even the old one-arg version) doesn't do the same thing as iterate

1:02 namely the elements of repeat are all just (f)

1:02 *repeatedly

1:15 technomancy: slyrus: Clojure has gone for years with only two backwards-incompatible changes, so a change like that is extremely unlikely.

1:16 slyrus: technomancy: yeah, and I see ataggart's point about iterate passing it's result to the next iteration.

1:16 nvm...

1:18 technomancy: a total of two (intentional) breaking changes is pretty amazing if you ask me.

1:19 bozhidar: technomancy: what were those two changes?

1:19 raek: which were those, btw?

1:19 ataggart: and I go ahead and make a dozen in c.c.logging

1:21 wwmorgan: bozhidar: the regular expression macro syntax was changed around two years ago

1:21 *reader macro

1:21 bozhidar: there is some similar change in 1.2 as well I think

1:22 the metadata reader macro was changed or something like that

1:22 I read something of the sort in "Practical Clojure"

1:23 ataggart: ^ is the new #^

1:23 but I think the old style will still work in 1.2

2:05 kumarshantanu: hi

2:05 Scriptor: hey kumarshantanu

2:06 kumarshantanu: @Scriptor registered just now, so trying out if it works

2:12 scottj: Is it correct that macros can't do anything with the values of symbols they're passed, only output code that does something with them? They can make decisions about what code to output based on the symbols that were passed, but not the value of those symbols?

2:13 Scriptor: scottj: not quite, macros, in a sense, are just passed unevaluated code

2:13 for example, if you pass a macro a number, it can read that number, if you pass it (< 3 3), it will be passed a list of 3 elements

2:14 scottj: and if a is 3 and I pass it a can the macro figure out that a is 3 or does it have to output code that that does that?

2:14 Scriptor: it can figure it out

2:15 so if the definition is (defmacro m (a))

2:16 and you call it: (m 3) or (m some-var) where some-var is 3

2:16 a should just be 3

2:17 wwmorgan: scottj: you have the right idea. I'm not sure what Scriptor is getting at

2:18 scottj: Scriptor: if you do some-var it will be some-var

2:18 Scriptor: oh, right

2:18 sorry, like I said, it won't evaluate some-var

2:20 raek: the macro doesn't really know about the value, since the expansion is done in compile time, not in run-time

2:20 but if the variable a i bound in compile time, it is possible

2:21 however, you would need to call resolve or eval or something like that

2:22 macros are usually unevaluated code in, code to compile out

2:23 but as they have access to everything in clojure, they can perform computations (like evaluating an expression)

2:25 scottj: ahh eval the feature that does just what I want but will get my head bitten off if anyone ever sees my code

2:27 kumarshantanu: hi, can somebody share c.c.sql experience with me?

2:27 scottj: kumarshantanu: haven't used it for awhile but I found it pretty simple and didn't notice any bugs.

2:28 kumarshantanu: i want to able to find out the ID auto-generated by the DB after an INSERT

2:28 scottj: any encounter with auto-generated IDs?

2:29 scottj: kumarshantanu: yeah, I think that's not sql generic and you have to issue a command for your specific db that will return the last one

2:29 kumarshantanu: scottj: i see

2:30 raek: scottj: there is probably a more safe (and simple) way than using eval in a macro (e.g. generate code that does what you want instead)

2:31 may I ask what you want the macro to do? (input, desired effect)

2:34 you can always do something like this if you want to make a decision based on a value:

2:34 kumarshantanu: scottj: there is this -- http://download-llnw.oracle.com/javase/6/docs/api/java/sql/Statement.html#getGeneratedKeys()

2:35 raek: (defmacro m [x] `(let [y# x] (if (odd? y#) :odd :even)))

2:35 kumarshantanu: scottj: seems it's a standard way to get IDs, so i was wondering if it's possible to use that

2:37 wwmorgan: raek: the x needs to be unescaped. This would also work: (defmacro m [x] `(if (odd? ~x) :odd :even))

2:38 raek: wwmorgan: yes, that's true :)

2:39 as for the let, I just wanted to demonstrate how the gensym# symbols look

2:39 scottj: raek: but what if x is a symbol that has sexps that aren't valid clojure, and I want to look at them before deciding what macro to feed them to?

2:40 raek: ah, maybe I misunderstood you before

2:40 you most certainly can do that

2:40 just do that outside any syntax-quote

2:41 scottj: but that only tells me the symbol, not its value

2:42 raek: (defmacro simple-infix-to-prefix [exp] (asset (= (count exp) 3)) (let [[arg1 op arg2] exp] `(~op ~arg1 ~arg2)))

2:42 it is better to transform the non-clojure code into clojure code

2:43 that is what a macro usually does

2:43 you probably want the symbol to be evaluated in the environment the macro "call" is made

2:44 and not in the compiler's environment

2:45 I got to go now, but I will get back to this channel later

2:45 scottj: ok that makes sense, thanks

2:49 limux1972: hi, raek

2:51 I do a little test use hiccup in command

2:51 no use of jline

2:51 it's ok

2:52 it seems to hiccup is ok

3:08 raek: limux1972: ok. great then!

3:08 limux1972: did you find the thing that caused the trouble?

3:25 limux1972: i just do the test to find whether hiccup cause the issue

3:26 It seems hiccup is ok

3:30 raek: do you still get ???s instead of the characters?

3:30 limux1972: (html (doctype :xhtml-tag "en" [:body "你好"])) will generate the string ""

3:31 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/

3:31 TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html lang=\"en\" xml:lang=\"en\" xmlns=\"ht

3:31 tp://www.w3.org/1999/xhtml\"><body>你好</body></html>"

3:32 no ??? appeared

3:33 raek: if you wrap that in seq so you get (seq (html ...))), do you get ... \b \o \d \y \> \你 \好 \< \/ ... at the end?

3:34 limux1972: try http://gist.github.com/ if you want to paste many lines of code

3:34 limux1972: ok

3:37 yes, i can get "... \b \o \d \y \> \你 \好 \< \/ ..."

3:38 raek: alright, then there is nothing wrong with tour terminal or hiccup, as far as I can tell

3:40 limux1972: thanks for your so much and nice help

3:42 too confused

3:48 xkb: hi

3:48 Is there any way to improve this piece of code: http://paste.lisp.org/+2FHX ?

3:48 I think the ugly check on type might not be needed

3:50 bozhidar: why don't you operate on seqs be default?

3:50 I don't like the type checks either

3:51 limux1972: would you like to take a moment to do someting to reproduce the error

3:51 bozhidar: and I doubt you care about the underlying implementation that much...

3:51 limux1972: ie, download that code from githun to do a test with render the html by replace the content in body with some chinese characters

3:51 xkb: I could maybe use take and drop to get somethign more general on seq's

3:52 limux1972: just only a simpler test

3:52 xkb: bozhidar: correct, I don't mind at all. Actually it is a function operation on generated code, so seq is better anyway

3:54 limux1972: perhaps you will find the reasons of issue occured on me

3:55 it too hard for me to find that because of my poor clojure experences

3:56 xkb: limux1972: so your problem is the chinese characters are not displayed?

4:04 limux1972: yes, xkb

4:06 raek: limux1972: did you get it working correctly on you computer in the end?

4:07 limux1972: raek, is it possible lein which cause those errors?

4:07 on

4:07 the browser displays ??? yet

4:08 my last test is in a relatively pure clojure REPL, not lein

4:08 raek: but the things we tried yesterday worked?

4:08 lein repl?

4:09 limux1972: i used lein-run

4:09 to start the jetty-adapter

4:10 the command is lein run script/run.clj

4:10 just before, i use clojure REPL

4:11 with all the necessary jars execpt jline

4:12 no lein, no lein-run

4:12 raek: you could test that example you wrote before both from the repl and from your run script

4:13 things you enter *through* the lein repl gets through JLine, which breakes UTF-8

4:13 limux1972: all things i tried yesterday worked if no hiccup used

4:14 or it will display the annoying ???

4:15 raek: limux1972: you could try this http://groups.google.com/group/compojure/browse_thread/thread/44a25e10c37f3b1b/d4a17cb99f84814f?lnk=gst&q=utf8#d4a17cb99f84814f

4:16 I guess you will have to try different combinations of lein repl / lein run, hiccup / no hiccup to pinpoint where the fault is

4:16 but note that the code you type throught the lein repl might get messed up, due to JLine

4:17 (since it lein repl uses JLine)

4:19 limux1972_: i am willing to try what you say until it's ok

4:23 raek: I'm sorry, but I'm a bit busy now

4:23 limux1972: no matter

4:24 raek: I'll probably be around later, around 16:00 GMT maybe

4:27 scottj: New way of writing web apps that I'm experimenting with: http://gist.github.com/518689 Thoughts?

4:29 xkb: slice em and dice em

4:29 ;-)

4:29 Raynes: Tasty website pie.

5:00 limux1972: raek, is there a middleware in ring used to echo the html text stream to console?

5:01 raek: you could always run the (html ...) in the repl

5:04 (defn debug-println [x] (do (println x) x))

5:05 or, you could wrap the (html ...) form in debug-println: (debug-println (html ...))

5:06 xkb: hmm this is odd, I do lein uberjar on a project, and he starts to run it

5:07 instead of building the jar

5:10 defn: scottj: that is exactly my idea

5:10 scottj: but sort of a messy implementation IMO

5:10 no offense

5:11 the slices ought to be a product of some higher template-level stuff you're doing

5:11 you need to combine your slices into a template

5:12 scottj: I had that but why? can't the slices themselves be the templates?

5:12 defn: they should be less templates

5:12 lesser

5:12 IMO

5:13 scottj: i really like what you're doing -- it is close to what i imagined

5:13 but this seems gorier than it should be

5:14 scottj: scottj: well the example is ugly in part because I parameterized a bunch of stuff that normally wouldn't be, like all those div ids etc

5:14 defn: scottj: /me nods

5:14 scottj: maybe that's not what you meant

5:14 defn: scottj: im not going to tell you you're doing it wrong because i haven't worked on it

5:14 scottj: http://github.com/defn/double-bubble

5:14 ^my project

5:14 ;)

5:14 raek: xkb: to you have code that starts the server at the top level?

5:15 if so, move that to a main method

5:15 otherwise the compiler will end up starting the server (since it evaluates all top-level expressions)

5:15 defn: scottj: i think my main problem with your code is that it seems rather jumbled -- i think the result of what you're trying to do should be incredibly modular code snippets

5:16 like you should be applying :css at one level

5:16 and :clj at another

5:16 as opposed to the same level

5:16 scottj: do you follow?

5:17 like (defn foo [title, body] [:html [:head [:title content]] [:body body]])

5:18 (with-css foo [:background-color #333])

5:19 scottj: oh I see decorate the html with css, js, etc

5:19 defn: (deftemplate home (with-css #(foo "Hello world) [:background-color #333])

5:19 something along those lines

5:19 that last thing i wrote is gibberish

5:19 but it's sort of what i imagined

5:20 (deftemplate home [foo (with-css [:background-color #333])])

5:20 that's closer I think

5:21 it's like enlive, but add CSS transformations into the mix

5:21 CSS selector mutation

5:23 scottj: what selector is your with-css using?

5:29 defn: your repo leaves something to be desired :)

5:30 so yeah, with slice some of the ideas are a slice wouldn't necessarily have any html. It could be any combination of 0 or more snippets of js, clj, css, html, etc

5:30 and slices compile to functions

5:31 and when they're composed they act like templates, and the top level one gives you a valid html page with either inlined or linked css/js

5:33 I really like the idea of having a uniform unit of code regardless of what language it's going to end up. so even small concepts that span multiple languages can be in one spot that comes up when you M-. on it

5:38 xkb: how come 1.2 is so much slower sometimes?

5:40 scottj: defn: I had a version working without the :var and argument lists features, but I suspect that the difficulty implementing or afterward understanding how to use those features correctly might lead me to understand the value of your approach.

7:35 zmila: , (sort-by (comp < last) {:a 1, :c 3, :b 2})

7:35 clojurebot: ([:a 1] [:c 3] [:b 2])

8:11 LauJensen: Good morning all

8:26 esj: LauJensen: heavy night ?

8:27 LauJensen: hehe, no, Im just trying to go with the whole UGT thing to avoid all the repetivetive chatter about timezones, so its all good morning when I come in, and good night when I check out

8:27 dnolen: pretty good article on Clojure strengths (and weaknesses) - http://programming-puzzler.blogspot.com/2010/08/racket-vs-clojure.html

8:27 LauJensen: thanks dnolen

8:38 dnolen: excellent read - I think except for his dislike of Java/Java-land and ignorance of Emacs, he brought up some very good points

8:40 dnolen: LauJensen: heh, "ignorance of Emacs". Aren't we *all* ignorant of Emacs, even those of us that use it? But yeah, the dislike of Java-land is a bit irrational.

8:41 LauJensen: Hehe - I just expected that he simply hasn't tried it yet. But I like how that article is so focused on data-structures, usually that doesn't get the attention it deserves in the x vs y things

8:50 chouser: that puzzler article is quite good. the list of "unproven features" is insightful and fair.

9:10 rhickey: chouser: the STM ding is a bit naive. Not that STM isn't unproven, but people have unrealistic expectations when given short vs long transactions. That scenario has inherent problems no automated solution (short of serialization) could solve, and there are plenty of practical workarounds given a concrete case

9:11 also the transients comment dings the lack of compliant interfaces, but interfaces can't be compliant

9:12 chouser: rhickey: yes, I'd buy that. And I haven't seen those "early reports" on multimethod "prefer"

9:12 rhickey: either conj returns a persistent thing or it doesn't

9:12 chouser: er

9:12 prefer-method

9:12 LauJensen: rhickey: true on both counts, though I think to most people the STM inner workings are still cryptic and hard to go in-depth with. I mean its still a research problem in some regards right?

9:13 chouser: but it's fair to have doubts about these things. Personally, I'm a whole-hearted believer in protocols already, despite their youth.

9:13 rhickey: chouser: mikel evins and I had some long discussions early on on prefer-method vs CLOS

9:14 chouser: one of the challenges of Clojure is that the first 2 years of me changing my mind (and hopefully improving my ideas) happened in private, now it's all public :)

9:15 chouser: :-)

9:15 some of us prefer it this way

9:16 bozhidar: maybe rhickey doesn't ;-)

9:16 I find it amusing and enlightening to be able to follow the development of new features in the public space

9:16 rhickey: I'm fine with it, just as long as people are mature and realize it is a process, things don't drop from the sky all perfect

9:17 bozhidar: you see the debates, the alternatives and in the end you know that all this lead to something good by no accident

9:17 indeed

9:19 rhickey: I'm sometimes wondering do you plan at some point to author a book on Clojure yourself. Often language architects have created masterpieces, after all you have an unique perspective on your creations

9:19 LauJensen: bozhidar: I asked that a year ago, he said "Do you want me to work on a book or Clojure?", .. so I stopped asking about books :)

9:20 rhickey: bozhidar: Right now it is a choice between work on a book on Clojure or work on Clojure

9:21 chouser: rhickey has put significant time in helping us improve Joy of Clojure, which is a pretty awesome compromise from my perspective.

9:22 bozhidar: rhickey: I think it'll always be this choice, but I've enjoyed your short essays on the clojure web site immensely and I'd love to get more of them. This probably goes to all the clojure users

9:24 rhickey: bozhidar: the pods work has helped me refine my ideas around process and that might warrant another essay. Otherwise most of my more complete thoughts are out there.

9:25 bozhidar: chouser: I'm quite impatient about this one. I read that the book was almost completed. Any chance it'll be shipping before the November estimate?

9:26 LauJensen: rhickey: An essay relating to pods would be fantastic - Would probably boost uptake in the community quite a bit

9:26 rhickey: so much todo for Clojure, short list here: cinc, better method inference, letmacro, JSR 292, modularity, android, pods, parallelism, primitives, scopes...

9:27 chouser: bozhidar: I believe all the content except for foreward and appendices are available electronically now if you buy the meap via http://joyofclojure.com/

9:27 LauJensen: rhickey: That list sounds daunting, but isnt this Clojure/core crew speeding up development quite a bit?

9:27 rhickey: LauJensen: but people aren't well served by descriptions of things that are speculative or changing a lot. I don't need to drum up adoption of new things, I need to temper it :)

9:28 jcromartie: ^ wisdom

9:28 chouser: I heard a rumor Clojure/core (or just some members of it?) are spending most of their time using Rails.

9:28 LauJensen: rhickey: of course not - I was thinking post-release, it they come into being

9:29 bozhidar: rhickey: I know you have some ideas for improvements in the JVM. Are you by some chance involved to some extent in the development process of Java 7?

9:29 jcromartie: chouser: like Ruby on Rails?

9:29 LauJensen: chouser: I guess that would make them Clubyists ? :)

9:29 chouser: jcromartie: I haven't verified that at all (hoping rhickey will confirm or deny), but yes that's what I heard.

9:29 rhickey: LauJensen: yes, Clojure/core is helping a lot, especially freeing me to think about these things rather than e.g. maven builds

9:29 bozhidar: not at all

9:30 LauJensen: hehe, great, thats a big win :)

9:31 bozhidar: chouser: I've been thinking about the MEAP lately, I just wasn't sure about it's shape - because from my experience a lot of changes get made at the last moment. I guess you're better organized than I am :-)

9:31 chouser: bozhidar: oh, I'm sure there will be last-minute changes.

9:42 LauJensen: chouser: How does it feel to be wrapping up a project as big a JOC ?

9:42 chouser: LauJensen: daunting. Fogus is my salvation.

9:44 LauJensen: Im sure you're a great team, supporting each other in different ways

9:44 s/You're/you make/

9:44 sexpbot: Im sure you make a great team, supporting each other in different ways

10:01 perkinsc: The clojure.org site has llots of really great documentation about the rationale behind clojure's design. Will similar essays be posted about protocols, deftype, etc. when 1.2 is released?

10:02 MayDaniel: http://clojure.org/datatypes http://clojure.org/protocols

10:04 perkinsc: OK, cool. I assume they will be linked from the some page once 1.2 is out. Thanks for the links.

10:04 a/some page/home page

10:04 MayDaniel: Yeah. They're pretty well hidden.

10:20 edbond: whats the best coupon for 'joy of clojure' now? I see clojure35 for 35%

10:22 LauJensen: chouser: what was joyofclojure.com/buy the url you suggested to purchase from ?

10:22 chouser: that's it

10:23 sometimes there's coupon codes on joyofclojure.com itself

10:41 scottj: Is there a function that will replace all instances of symbol a in a sexp with symbol b? (replace 'a 'b '(c (d a))) => (c (d b))

10:44 chouser: ,(clojure.walk/prewalk-replace '{a b} '(c (d a)))

10:44 clojurebot: java.lang.ClassNotFoundException: clojure.walk

10:45 chouser: ,(use 'clojure.walk)

10:45 clojurebot: nil

10:45 chouser: ,(clojure.walk/prewalk-replace '{a b} '(c (d a)))

10:45 clojurebot: (c (d b))

10:45 chouser: scottj: how's that?

10:45 scottj: chouser: perfect, thanks

10:47 zmila: why quote before map {a b}?

10:48 scottj: zmila: prewalk-replace is a function so args get evaluated and we want symbols a b not what they're bound to

10:49 zmila: i need to think this about :)

10:50 scottj: zmila: it's the same reason the list (c ...) is quoted

10:50 spewn: scottj: It's slightly different because ('c ...) won't work, but {'a ...} would.

10:51 scottj: spewn: yeah I realized right after I said that that I was confusing myself because lists are special since they represent function calls

10:51 chouser: ,(let [a 1, b 2] {a b})

10:51 clojurebot: {1 2}

10:51 chouser: ,(let [a 1, b 2] '{a b})

10:51 clojurebot: {a b}

10:52 zmila: ,(clojure.walk/prewalk-replace '{Math/sin Math/sqrt} '(println (Math/sin 4)))

10:52 clojurebot: (println (Math/sqrt 4))

10:52 chouser: I think that's the first time I've used clojure.walk

10:52 danlei: :)

10:52 zmila: ,(clojure.walk/prewalk-replace {Math/sin Math/sqrt} '(println (Math/sin 4)))

10:52 clojurebot: java.lang.Exception: Unable to find static field: sin in class java.lang.Math

10:52 spewn: Is there ever any reason to do (into [] foo) over (vec foo)?

10:53 chouser: spewn: I don't think so

10:56 spewn: chouser: Good, thanks :)

10:56 zmila: into is different when applied not to empty literal [] but to other vector, yes?

10:57 LauJensen: zmila: how?

10:58 spewn: ,(into [1 2 3] [4 5 6])

10:58 clojurebot: [1 2 3 4 5 6]

10:58 zmila: correct, spewn

10:58 LauJensen: ah ok, really didn't get that from the question

10:59 scottj: ,(let [ensure-coll #(if (coll? %) % (vector %))] (merge-with #(mapcat ensure-coll %&) {:a 1} {:a [2]} {:a [3] :b 1}))

10:59 clojurebot: {:b 1, :a (1 2 3)}

10:59 scottj: Is there a shorter way to write that?

11:00 zmila: (frequencies (flatten (vals your-data)))

11:01 pdk: (doc condp)

11:01 clojurebot: "([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, its result-fn, which must b

11:02 zmila: not, (map #(flatten (vals %)) (frenqencies your-data))

11:05 scottj: zmila: I don't see it :)

11:05 pdk: (condp = 1 2 :2 0 :0 :1)

11:05 ,(condp = 1 2 :2 0 :0 :1)

11:05 clojurebot: :1

11:05 pdk: ,(condp < 1 2 :2 0 :0 :1)

11:05 clojurebot: :0

11:09 dpro: hi

11:10 thx to this channel my emacs/swank setup works as expected now, but java eats ~40% cpu for an idle "lein -swank" REPL, is that normal ?

11:10 LauJensen: dpro: Should idle around 0 - 1%

11:11 dpro: LauJensen: hmm my top output begs to differ ;)

11:12 LauJensen: If you've filled up the memory of the system, then swapping might explain it, but not a fresh repl

11:12 dpro: I'll restart and reconnect ... maybe some previously closed windows

11:12 processes weren't garbage collected

11:13 LauJensen: dpro: And make sure your -Xmx isnt set sky high

11:13 neotyk: how do you get form parameters in defroutes in compojure?

11:14 how to destructure it?

11:14 dpro: looks better now ...

11:14 LauJensen: neotyk: form parameters in defroutes?

11:15 neotyk: (POST "/sample/" {{a :a} :params} (fn [a] a))

11:15 pdk: (doc defroute)

11:15 clojurebot: Gabh mo leithscéal?

11:15 LauJensen: dpro: good, I think the only caveat is memory consumption, and you can control that at command-line

11:15 neotyk: LauJensen: how do i get fomr param named a from this route?

11:16 s/fomr/form/

11:16 sexpbot: LauJensen: how do i get form param named a from this route?

11:16 dpro: LauJensen: cheers, but I don't think swapping was the problem

11:16 LauJensen: neotyk: this might help http://bestinclass.dk/index.clj/2010/02/reddit-clone-in-10-minutes-and-91-lines-of-clojure.html

11:16 DISCLAIMER: Compojure has changed a bit since that 0.3.2 post

11:16 dpro: apparently just closing a window isn't enough to clean it all up after a (load "something")

11:16 neotyk: LauJensen: checked this already

11:16 LauJensen: If you need specific 4.0 tips Im blank - Im deeply invested in Moustache now

11:17 neotyk: trying to build reddit clone running on GAE with new compojure

11:17 LauJensen: neotyk: But, if you forget about wrappers, then in 'params' there's a key called 'body. In there, you'll find the params

11:18 something like (->> (:body request) (repeatedly #(.read %)) (take-while pos?) (map char) (apply str)). That will give you something like "a=1&b=2" depending on whats posted. Run java.net.URLDecoder/decode on the values to get pure text

11:19 Though.. Im sure they wrapped that somehow, its a common thing with Ring

11:28 neotyk: (POST "/new/" {{title "title" url "url"} :params} (add-link title url))

11:28 that made it\

11:40 LauJensen: Interesting approach

11:51 dnolen: so is any excited enough about good TextMate support to be willing to contribute some code? :D, so far Eval, Eval pprint, Show Source, Load File, Macroexpand, and Macroexpand are all working. Everything is implemented in Clojure so need to use a less powerful language to extend the bundle.

11:51 Macroexpand All

11:52 s/any/anyone

11:54 esj: we're all afraid of Lau raining fire on us :P

11:56 dnolen: esj: heh, well I'll keep hacking on it, tho I'm won't be surprised if there aren't many TextMaters since Clojure TextMate support has been pretty dismal until now. Just thought I'd throw it out there.

11:57 esj: dnolen: i'm just joking of course, and improving tools is a huge plus for us all

11:57 LauJensen: esj: what?! :)

11:58 Yea Im all for all IDEs - But I must admit I've never tried this thing called 'text mate'

11:59 * danlarkin is trying very hard not to question why someone might choose textmate over emacs

11:59 * danlarkin has failed

11:59 LauJensen: hehe

11:59 Its a valid question though

12:00 danlarkin: I used textmate for a couple years. Thinking back on it I can't justify why

12:00 esj: dnolen: warned you, I did :P

12:01 LauJensen: esj: cool it Yoda :)

12:02 dnolen: well everyone I work with uses TextMate (a couple VIMers), they're all scared of Emacs.

12:02 technomancy: danlarkin: the people I used to know who liked textmate mostly used it because they were allergic to lisp.

12:02 LauJensen: Maybe its time for a more rigorious comparison of the different IDEs. There must be some strong incentives to choose Emacs > Eclipse > Netbeans > ... and so on. But I have too limited knowledge of most of them

12:02 technomancy: or they thought they were at least

12:03 dnolen: I'd like to think of my TextMate bundle as yet another gateway drug ... to Emacs

12:03 Chousuke: heh

12:03 danlarkin: LauJensen: problem is, no one can make an objective comparison :)

12:03 LauJensen: danlarkin: I guess thats true

12:04 Chousuke: I think emacs' extensibility is what primarily draws people to it

12:04 and the fact that everything integrates with it :P

12:04 esj: full disclosure - I use emacs exclusively. But others don't.

12:05 chouser: the last time I stopped using emacs it was because its integration with cscope was broken compared to vim

12:06 LauJensen: chouser: But you never got the keycombos into your fingers did you?

12:06 alexyk: anybody uses La Clojure?

12:06 chouser: LauJensen: yeah, I was pretty comfortable with it. Used it for all my email and code editing

12:07 alexyk: dnolen: there were some ingenious clojure bundles for textmate, most abandoned though; invoking repl with some ruby tricks, does your do that?

12:07 Chousuke: I like the vim interface to editing, I just don't like the editor itself as much as I like emacs :P

12:07 LauJensen: chouser: cool

12:08 technomancy: is cscope like a tags generator?

12:08 Chousuke: it's a shame that viper/vimpulse doesn't work very well together with most emacs add-ons

12:08 chouser: Chousuke: yeah, it really is.

12:08 and that's mainly a culteral thing, I assume, which is harder to fix than code. :-/

12:08 LauJensen: Chousuke: But are vi-bindings really superior to Emacs'? Because if they're not, or at least if its debateable, why not just use the combos which are natural to emacs?

12:09 chouser: LauJensen: they really are superior.

12:09 :-)

12:09 danlarkin: LauJensen: muscle memory?

12:09 Chousuke: LauJensen: it's not just about bindings, it's about the whole paradigm of having modes and actions and "targets"

12:09 LauJensen: Chousuke: I know, but now I was thinking about the bindings

12:09 (ive never been able to pick up vims)

12:09 dnolen: alexyk: it relies on Cake. Cake launches persistent VMs. I convinced them to add a bunch of features to make integrating with TextMate simpler.

12:09 LauJensen: s/able/willing/

12:09 sexpbot: (ive never been willing to pick up vims)

12:10 Chousuke: LauJensen: vim's bindings could probably be improved while keeping the core paradigm intact, too

12:10 dnolen: alexyk: for example I can write a executable script with !#/usr/bin/evn cake run at the top of a .clj file and it runs blazingly quickly since the JVM has already been started up.

12:10 dakrone: Chousuke: how would you improve vim's bindings?

12:10 dnolen: it's also get the entire shell environment passed to in a bound var *env*

12:10 Chousuke: dakrone: I haven't thought much about it but if I were to write a new editor from scratch I'm sure I would find something :)

12:11 alexyk: dnolen: I convinced them of features first! :) Is your bundle new, or cake functionality is new?

12:11 dnolen: so you get figure out what the damn current directory is as well as other envrionment vars

12:11 alexyk: dnolen: do you know that in the horror world called Windows, there's an editor called e-texteditor which runs TextMate bundle as is?

12:11 chouser: Chousuke: I agree. vim kept more compatibility with vi than it now really needs.

12:12 dakrone: Chousuke: seems like key-bindings are an easy thing to fix in both Vim or Emacs

12:12 since you can bind your own

12:12 dnolen: alexyk: I'm punting Windows compatibility to Cake, they seem concerned with that. I'm assuming my work can be adapted to the Window's TextMate editor

12:13 Chousuke: If I were to write a new editor I'd do it with GNU Guile or something and make it like vim, but then again I would also attempt to design it so it can handle more than just text editing (like emacs does)

12:13 alexyk: dnolen: that conceivably may bring a cute clojure IDE to Windows

12:13 Chousuke: but then again, I'm not going to write a new editor so hmm :P

12:13 chouser: dakrone: you'd think, but then when you do anything a little unusual (hyperlinking, directory-tree browsing, org-mode, etc.) each of those plugins want to take over a set of bindings.

12:14 dakrone: chouser: that sounds like more a criticism of model editing than regular keybindings, is that correct?

12:14 chouser: they're usually careful to provide bindings that are compatible with what "most people use", which of course is different in each editor.

12:15 dakrone: I'm not sure what you mean

12:16 dakrone: chouser: are you saying you prefer Emacs' bindings because they can be standardized over a wider range of buffers since they are all non-text characters (ie, C-a, C-e, etc)?

12:17 Chousuke: dakrone: I'm sure a number of commands could be "standardised" over different modes even in a vi-like editor

12:17 chouser: oh, not at all. I consider emac's bindings to be modal as well, you just have to hold down your mode keys all the time.

12:17 dakrone: Chousuke: yea, and they are, I'm just trying to understand the argument

12:17 I still don't understand the basic argument against it then

12:18 chouser: my point is just that when a plugin adds new bindings in either editor, it tries to avoid clobbering default bindings, so it's much easier to use plugins when you use that editor's default bindings.

12:18 and so you run into problems trying to use viper in emacs or cream in vim

12:19 * dnolen wasn't trying to trigger yet another editor comparison :D Only get help for his TextMate bundle

12:19 dakrone: ahh yea, okay, as a hardcore Vim person who attempted to use Emacs via Viper for about a week, I certainly agree

12:20 then I found myself actually sinking into depression trying to use Emacs, so I stopped ;)

12:21 chouser: it would require so much work for me to bend emacs to my will, and all that work would be in a lousy ancient lisp ... it's just daunting.

12:21 Chousuke: heh

12:21 and writing new editors really is not feasible nowadays :(

12:22 LauJensen: chouser: really? because you would redesign the ways keybindings work and such ?

12:22 dakrone: chouser: so what do you normally use anyway?

12:22 chouser: there's plenty I don't like and/or don't know well enough in vim, but it mostly works how I want already, so I stay.

12:22 Chousuke: "It doesn't even do autocompletion for source code, what a lousy editor!"

12:22 chouser: Chousuke: yeah. :-(

12:23 I need to look at waterfront.

12:23 still

12:23 dakrone: Chousuke: Vim does autocompletion for code...

12:23 chouser: dakrone: he's talking about a theoretical new editor written from scratch

12:23 like textjure. :-P

12:23 dakrone: oh okay, I apologize, sorry Chousuke

12:29 Chousuke: It's a problem with software in general I suppose

12:30 Nowadays we'd know how to do most things "right" but it's not feasible to start from scratch ;/

12:31 (and even if you did it, the same thing would repeat a couple decades later)

13:03 slyrus: I don't suppose java has built-in support for 2-bit array elements... can anyone recommend a good java library that does this? (and 4-bits, while we're at it).

13:10 dpro: has anyone done some YASnippets for clojure so far ?

13:10 polypus: can lein compile java sources? if so where to place them, how to do it?

13:13 dakrone: polypus: check out lein-javac http://github.com/antoniogarrote/lein-javac

13:13 polypus: dakrone: ty

13:13 LauJensen: dpro: they're not very helpful. perhaps for function definitions

14:09 apgwoz: polypus: i just started using lein-javac today, and it works perfectly fine

14:11 LauJensen: I think 'select-keys' might be poorly named, seeing how its not selecting keys but key/val pairs

14:21 AWizzArd: ,(doc select-keys)

14:21 clojurebot: "([map keyseq]); Returns a map containing only those entries in map whose key is in keys"

14:21 AWizzArd: maybe select-entries

14:22 LauJensen: exactly

14:22 AWizzArd: Though, a function returning keys that were its input sounds more like identity :)

14:24 chouser: could be filter-map

14:24 though it isn't, quite.

14:35 apgwoz: `select-keys` seems like the right name to me. `select-in` would also be acceptable to me.

14:36 (i.e. (select-in {...} [k1 k2])))

14:39 AWizzArd: On the other hand it’s no tragedy.

14:40 alexyk: how do you switch back to "global" namespace in repl after going to some other with (in-ns smth)?

14:42 chouser: there's no global namespace

14:43 but you're in 'user by default, so (in-ns 'user) may do what you want

14:45 alexyk: chouser: ah ok. say I have a file with: (ns hey) (member:defn hey [x] (print (str "hey, " x))). I load it into a repl. If I do (in-ns 'hey), should I be able to say just (hey "man") ?

14:45 member: is extraneous

14:45 colloquy loves him rotten

14:46 AWizzArd: yes, when you in-ns into hey, then you can call all fns in it directly

14:46 without the ns specifier

14:50 LauJensen: apgwoz: select-in is also good

14:50 rhickey: chouser: where are those nice tests mentioned here: http://groups.google.com/group/clojure/msg/04302f0aa80bc52b ?

15:01 alexyk: after a while I forget how to show two things from repl: (1) clojure version, (2) classpath. So -- how, and are they in a FAQ somewhere?

15:02 tomoj: *clojure-version*, *classpath*, dunno

15:02 AWizzArd: (System/getProperty "java.class.path")

15:02 * alexyk makes a note "ask tomoj next time after a few months hiatus"

15:03 Nikelandjelo: Is there built-in function, analogous defn- ,but more general, for def?

15:03 alexyk: AWizzArd: see, yours I knew and could never remember; tomoj's, OTOH, I can

15:03 tomoj: I think we do need a #clojure FAQ

15:03 Nikelandjelo: *macro

15:03 alexyk: tomoj: it wills say "ask tomoj" :)

15:04 chouser: is the gentleman in the top hat on the cover of TJoC supposed to remeble rhickey ?

15:04 resemble

15:04 LauJensen: alexyk: no thats Chouser in his sunday suit :)

15:04 alexyk: LauJensen: chouser on github pic looks slimmer :)

15:04 LauJensen: its only a headshot

15:05 alexyk: LauJensen: but kind of extrapolates to a slimmer build, if you will

15:05 kencausey: no infobot here?

15:05 LauJensen: Im only kidding ofc, its just something MEAP does to all their books in order to scare away customers I think

15:06 alexyk: LauJensen: AFAIU authors do get to pick a person? Seeing the cover reminded me of clojure videos for some reason :)

15:06 LauJensen: oh... I didn't know that

15:06 hiredman: clojurebot: infobots |are| inferior

15:06 clojurebot: You don't have to tell me twice.

15:07 * kencausey meant 'infobot' in the most abstract sense

15:08 kencausey: clojurebot: help

15:08 clojurebot: http://www.khanacademy.org/

15:08 * kencausey sees no docs for clojurebot there

15:08 hiredman: it's help in the most abstract sense

15:09 kencausey: clojurebot: clojure version

15:09 alexyk: hiredman: better make it an NSFW site

15:09 clojurebot: see swank

15:09 cemerick: ,*clojure-version*

15:09 clojurebot: {:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"}

15:09 alexyk: ,*classpath*

15:09 clojurebot: java.lang.Exception: Unable to resolve symbol: *classpath* in this context

15:09 alexyk: tomoj: ^^?

15:09 cemerick: ,(System/getProperty "java.class.path")

15:09 clojurebot: java.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read)

15:09 cemerick: heh, oh well

15:10 alexyk: cemerick: yeah, but tomoj mentioned *classpath* and I was elated. Why don't we define that?

15:11 hiredman: because any classloader can add it's own classpath, so what would *classpath* be except a listing of the system classloader's classpath

15:11 which is what you set with with -cp

15:12 so, uh, whats the point?

15:12 cemerick: alexyk: I can imagine people rebinding *classpath*, and then being very confused as to why it doesn't do what you'd hope for.

15:12 alexyk: hiredman: rememberability

15:13 tomoj: alexyk: weird, I have it

15:13 alexyk: tomoj: did you define it yourself?

15:15 tomoj: nope

15:15 must be swank-clojure

15:15 I have it when I connect to a swank server, not in a plain repl

15:28 alexyk: aha

15:29 whoever wrote swank-clojure, he was a smart man

15:29 or she

15:29 a smart woman then

15:29 dnolen: is your TextMate bundle operational?

15:29 Raynes: Wasn't it jochu?

15:34 dnolen: alexyk: the basics are there yes, http://github.com/swannodette/textmate-clojure/tree/cake

15:34 alexyk: I have quite a bit of finessing to do before I want to do any kind of announcement tho.

15:35 alexyk: dnolen: did you build on the existing extensive bundles with syntax/repls etc?

15:35 dnolen: alexyk: I want to be able to intelligent determine the sexpr enclosing/preceding the cursor using Clojure. also wrap all commands in try/catch to produce nice formatting stack traces with urls to source files

15:36 alexyk: dnolen: beautiful

15:36 dnolen: alexyk: i used mcgrana's it just does syntax highlighting. all the other bundles are too hacky for my tastes. my bundle pretty much puts all the logic in Clojure

15:36 alexyk: dnolen: that's great. It means it should be portable to Windows then, hopefully

15:37 dnolen: so cake repl is TextMate's response to swank, right?

15:38 dnolen: alexy: cake has swank. what cake does is create persistent VMs. so instead of booting each time, it just hooks into a running VM

15:38 alexyk: originally I was using cake eval, which can take an sexpr and evaluate it in a peristent VM, but that became unweildy.

15:39 alexyk: so I requested "cake run". Which will take a .clj file and execute it with bake/*env* bound to all the shell environment vars when "cake run" was executed

15:39 alexyk: dnolen: right, right. I'm just wondering what the workflow w.r.t. repl can look like from TM. I never saw anything like an efficient repl in textmate. Used to send lines to an existing repl in iTerm via an applescript snippet in TM.

15:39 dnolen: you still want to execute selections

15:39 dnolen: alexky: that already works

15:40 alexyk: as well as loading a file to compile it. It even guesses the name space and ensures that new eval'ed expression happen in the namespace for that file.

15:41 basically I want this to be the core of the SLIME experience, without SLIME

15:42 alexyk: dnolen: README still refers to a github path from mmcgrana

15:42 dnolen: "slime experience without slime" is a good company motto :)

15:43 dnolen: alexyk: yeah, lemme fix

15:45 alexyk: fixed, and cake is now the master of my repo

15:45 alexyk: dnolen: awesome

15:46 saved me a git checkout cake :)

15:46 dnolen: alexyk: there's certainly going to be a lot rough edges, this is only a couple days of work :)

15:47 alexyk: dnolen: as a friend replied to a scared newbie driver pulling out of a driveway onto a main street, saying "I can't see", -- "don't worry, you'll hear" :)

15:47 LauJensen: hehe

15:48 alexyk: dnolen: btw, why does everybody show osascript command to reload bundles if you can do it from a menu?

15:49 dnolen: alexyk: no idea

15:49 alexyk: not like you're avoiding TM menus anyway

15:51 dnolen: do you have to start cake repl from a Terminal? I did iTerm and get a refusing to quit eval error on shift-cmd-x

15:53 dnolen: alexyk: I haven't tried iTerm, in general you should issue cake repl FIRST before trying to run any commands.

15:53 alexyk: dnolen: did that. Hmm: Load File: unknown task: run

15:54 (shift-cmd-K)

15:54 dnolen: alexyk: you need an up to date version of cake, do you have 3.8 installed?

15:54 alexyk: known issue, load file doesn't work on unsaved files, files that don't belong to project. it's on the TODO list, which is in the repo

15:55 alexyk: ok, updated cake. up to date means pull again next day :)

15:57 dnolen: I get an NPE now on eval or run, in eval.clj:1

15:58 dnolen: alexyk: huh, can you gist the stacktrace please.

15:59 alexyk: dnolen: if I could scrape it out of that pop-up :)

15:59 ah I can

15:59 dnolen: alexyk: yup, sooo lame. I need to fix that.

16:00 clj-stacktrace to the rescue I think for that.

16:00 alexyk: dnolen: http://paste.pocoo.org/show/249031/

16:00 that's the error

16:00 in the popup upon shift-cmd-x in (4+5)

16:00 cake repl started before

16:01 dnolen: is it sending to the Terminal, or only internally?

16:01 dnolen: alexy: (4 + 5) ? you mean (+ 4 5)

16:01 alexyk: README said (4+5)! :)

16:01 dnolen: alexky: haha

16:01 alexyk: like any good FORTRAN!

16:02 wait, it's not #Fortran66?

16:03 still same thing on (+ 4 5), or load file, something's fishy with the setup

16:03 dnolen: alexyk: and you verify that the cake repl is working just fine?

16:03 alexyk: in the Terminal, yes

16:04 should I restart TextMate just in case?

16:04 dnolen: alexyk: sometimes things get into a weird state, especially if you've used cake before. I recommend "cake kill --all", then "cake repl"

16:04 alexyk: no need to restart TM

16:04 alexyk: dnolen: I have to cake jvm's now. I'll just start cake repl again.

16:05 dnolen: replace 2 seconds by 7 in the README for coldstart expectations :)

16:06 "and, in 7-11 seconds, you'll have a repl"

16:06 dnolen: still the same

16:07 dnolen: after I git pull in cake, do I have to rebuild it?

16:07 lancepantz: alexyk: no

16:08 alexyk: lancepantz: what I thought

16:09 dnolen: shift-cmd-K works!

16:09 -X fails as before

16:10 dnolen: alexyk: incredible.

16:10 alexyk: but for -K, you deserve hugs and kisses! :)

16:10 and cake people get chocolates

16:10 magically, stuff is injected into your repl from TM.

16:11 dnolen: alexyk: yup. that's weird about X, it's working here. I need to try this on a clean setup and see what's going on .

16:11 alexyk: so I can have my repl in a normal console, not some gnuish emacs you have to switch to :)

16:11 dnolen: sorry, my bad, I didn't select sh*t.

16:12 I placed a cursor within it

16:12 expecting you to fund the sexp

16:12 dnolen: alexyk: on the todo list

16:12 alexyk: http://github.com/swannodette/textmate-clojure/blob/cake/TODO.txt

16:13 alexyk: might as well start opening tickets :)

16:13 dnolen: alexyk: sure

16:14 alexyk: lancepantz: so is run doing cake compile? i.e. cake compile injects into project's JVM?

16:16 lancepantz: alexyk: compile creates class files, completely different process than reloading the classes in the jvm

16:16 clojurebot: the unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation

16:16 dnolen: alexyk: I think compile generates class files right? run just sends the contents of the file to the running JVM I believe.

16:17 alexyk: lancepantz: so why does run task say "Compilation finished"?

16:17 dnolen: alexky: I added that

16:17 remember the the part about "rough edges"

16:17 lancepantz: ah, had us confused for a second :)

16:17 alexyk: dnolen: I didn't know if you capture the status or pass it along :)

16:18 lancepantz: you'll now hear shouts from above via dnolen :)

16:18 ok it all works, whew

16:18 clojure productivity award of 2010

16:19 2009 went to lein

16:19 2010 is cake + TM

16:20 dnolen: alexyk: haha we'll see, there's a lot work to do for the TM experience to match Emacs

16:20 alexyk: dnolen: I used to get by with a simple send to terminal. BTW, also would be good to have eval current line.

16:20 (so you don't care where the cursor is)

16:22 lancepantz: dnolen: ninjudd just showed me how you figured out how to make clojure files executable

16:22 that is really freaking cool

16:22 they also don't have to end in .clj

16:23 alexyk: lancepantz: I guess this is where the global jvm will be handy

16:23 can start cake on Mac boot and have it clojure-scriptable

16:23 lancepantz: yeah

16:23 Blue-Fox: hi

16:23 alexyk: then can also add Dcake.project to it so scripts don't pollute projects if happen to be launched from them

16:24 LauJensen: Do you guys see such a great use for a persistent jvm, that you keep one running constantly ?

16:24 Blue-Fox: clojure supports sockets, doesn't it?

16:24 LauJensen: Blue-Fox: Clojure supports everything which Java supports, so yes

16:24 lancepantz: alexyk: that's a good idea too

16:24 alexyk: LauJensen: cake launches a global jvm if it's outside o f a project

16:24 Blue-Fox: LauJensen: wow

16:24 lancepantz: LauJensen: yeah, i do, mainly because i'm connected to it with swank usually

16:25 so its just there

16:25 Chousuke: Blue-Fox: Clojure runs on the JVM; you have full access to all java libraries.

16:25 LauJensen: alexyk: Yea I know - Im just saying, when I look at the stuff I use Clojure for, that seems wasteful, to keep it running

16:25 alexyk: LauJensen: I want to be able to open the lid of my MacBook, type someting, and eval right away.

16:25 Chousuke: Blue-Fox: Most of the time they're not very well fitting with clojure idioms though.

16:25 LauJensen: Lets say I launch cake+jvm for project X, and later I want to work with project Y, does cake update the classpath and everything for that?

16:26 ninjudd: LauJensen: 'cake kill --all' will stop all persistent JVMs. you can run it occasionally if you are short on resources

16:26 Chousuke: Blue-Fox: but they're usable, which is what matters :)

16:26 alexyk: LauJensen: cake runs a jvm per project.

16:26 LauJensen: alexyk: ah

16:26 Blue-Fox: clojure isn't OOP, is it?

16:26 alexyk: LauJensen: you have to discipline your consumption of jvms :)

16:26 LauJensen: Blue-Fox: http://clojure.org/rationale

16:26 Chousuke: Blue-Fox: Not the classes-and-inheritance kind of OOP anyway

16:26 ninjudd: i regularly have 10 running and don't even notice

16:26 Chousuke: Blue-Fox: I'd say it's mostly functional and interface-oriented :P

16:27 ninjudd: we played around with having them stop automatically when idle

16:27 LauJensen: alexyk: I would see the point if it had a very intelligent way to handle classpath, so that one instance could be used throughout the day

16:27 ninjudd: i could pick that back up if it is a widespread concern

16:27 Blue-Fox: LauJensen and Chousuke: thanks

16:27 alexyk: ninjudd: wait until you do data mining with 30 GB per JVM. I guess using -Dcake,project will be handy in case you don't care about resuing JVMs

16:27 reusing

16:27 Blue-Fox: good night

16:27 LauJensen: night

16:27 alexyk: ninjudd: simply an option to reuse a jvm will be fine

16:28 like, in project.clj, :cake-jvm-from "path"

16:28 ninjudd: projects can't really share JVMs safely

16:29 alexyk: :cake-insafe-jvm-from :)

16:29 unsafe

16:29 or just reuse global

16:30 LauJensen: ninjudd: well... not easily

16:30 alexyk: i.e. then you "merge" you project dir to that of a parent project, virtually; same effect as if you merge their src/ dirs

16:30 last proj wins

16:30 ninjudd: i really don't think multiple JVMs will be a problem

16:31 i could add an option in ~/.cake/config: max_jvms = 10

16:31 and it could stop inactive JVMs if you exceed that

16:37 cryptic_star: hi all, I have a question about lein-clojars...it looks like it should be able to push to a specified remote repository using similar syntax to scp, so "lein push <username>@<server>:<path>", but I continuously get auth failures, despite having generated keys with lein keygen and placed them on both the host and remote server - any idea what's up?

16:38 ninjudd: alexyk: or .cake/config: inactive.shutdown = 30 # minutes

16:39 alexyk: ninjudd: what I care about is not max number of JVMs, but having a ver beefy one with lots of RAM. But probably I shouldn't have more than one anyways.

16:39 I'd probably like reusing the fat one for some unrelated namespaces

16:39 ninjudd: how about that, reuse for nonoverlapping namespaces?

16:39 LauJensen: ninjudd: I understand cake works with gems, whats their story on linux/osx/windows?

16:40 alexyk: LauJensen: gems work everywhere

16:40 better portability than bash

16:41 LauJensen: cool

16:41 dakrone: cryptic_star: does pushing with scp instead of lein work?

16:41 ninjudd: cake *mostly* works on windows

16:41 LauJensen: argh there it came

16:41 I was just about to say 'thats the first piece of software Ive heard works on windows'

16:41 alexyk: ninjudd: do you mean Windows as in cmd or PowerShell, or under cygwin?

16:41 ninjudd: cryptic_star: is your key in .ssh/id_rsa, .ssh/id_dsa, or .ssh/identity?

16:41 alexyk: LauJensen: it will work on Windows, or we invade Denmark.

16:42 LauJensen: No problem, I could do with a vacation on Hawaii :)

16:42 cryptic_star: @ninjudd my key is in ./ssh/id_rsa

16:42 LauJensen: We've been invaded before, we know the drill

16:42 alexyk: LauJensen: there's a Microsoft presence there, that's why we'll invade it :)

16:42 cryptic_star: @dakrone I have not tried using scp - was hoping to get it to work with lein first, but that might be a good indication

16:42 ninjudd: LauJensen: there are two open issues that i'm working on, but it wasn't very hard at all to get it running on windows

16:43 alexyk: Hawaii, of course, is where Microsoft folks vacation, too

16:43 dakrone: cryptic_star: jssh doesn't pick up settings in ~/.ssh/config, so if you have any there it may not work

16:43 LauJensen: ninjudd: One of my major objections to lein, is that it has no Windows story yet

16:43 alexyk: ninjudd: so, cygwin or plain cmd shell? should it need any changes under cygwin?

16:43 lancepantz: alexyk: cmd

16:43 ninjudd: LauJensen: Windows was one of the primary reasons we chose Ruby instead of bash

16:44 alexyk: lancepantz: so cygwin should be ok?

16:44 lancepantz: alexyk: yeah, i don't think anyone has tried it yet though

16:44 cryptic_star: so scp did work

16:44 LauJensen: ninjudd: Good pick

16:44 ninjudd: alexyk: plain shell. cygwin should work too though

16:44 alexyk: lancepantz: I will next time I reboot my MBP into Windows 7. I share Maven repo across the Mac and Windows partition.

16:44 I share the cake git repo too :)

16:45 ninjudd: cryptic_star: if you're feeling adventurous, cake has a built in release task that pushes to clojars

16:45 alexyk: with Java-based stuff, you can reuse most of it. I can run IDEA on both.

16:45 ninjudd: lancepantz are you guys aware of PowerShell? very cute

16:45 lancepantz: alexyk: heh, did you have to buy two licenses? :)

16:45 cryptic_star: @ninjudd Ahh, I see you're pushing your project? :)

16:46 alexyk: lancepantz: IDEA is now open-source in Community Edition, which has Maven and Git and Clojure plugins

16:46 cryptic_star: @ninjudd I'll take a look at it actually, looks cool

16:47 alexyk: lancepantz: you can git clone idea and enjoy the power of git on 70 MB checkout

16:47 lancepantz: alexyk: ah, had no *idea* :)

16:47 alexyk: lancepantz: well, you get the *idea* now :)

16:47 lancepantz: alexyk: when did this happen?

16:48 alexyk: lancepantz: a while back, six months or so

16:48 ninjudd: cryptic_star: cool. still prerelease, so let me know if you have problems (either here or in #cake.clj)

16:48 alexyk: jetbrains.org

16:48 LauJensen: ninjudd: how incompatible are you guys with lein ?

16:48 cryptic_star: @ninjudd definitely, I'll let you know

16:48 thanks all

16:52 lancepantz: LauJensen: the main thing is we do not allow you to change the directory structure

16:52 you have to use /src /test /lib

16:52 LauJensen: so lein plugins etc work with cake as well ?

16:52 lancepantz: and tasks are incompatible as well

16:52 they do not

16:52 LauJensen: ok

16:53 Do you export pom files?

16:53 lancepantz: yes

16:55 LauJensen: Sounds like you've guys have put a lot of work into this, I look forward to taking it out for a spin

16:57 herdrick: hi - is there a function for writing objects? i.e. making a representation of them that the reader can read?

16:57 ninjudd: LauJensen: awesome! we'd love to hear your input once you take a look

16:58 LauJensen: ninjudd: If I can get your stuff to run on all 3 OS's I expect to blog about it - if I have critique I'll come to you guys directly :)

17:09 alexyk: dnolen: so in case there's no selection, something better should be pringted by eval than a giant error roll :)

17:09 printed

17:10 raek: herdrick: I've heard some discussions about a reader syntax for records

17:11 herdrick: raek: ok

17:11 raek: it's probably somewhere in the google group archives

17:11 that is all I know

17:11 herdrick: but how about a function for writing the objects that already have a readable syntax?

17:12 raek: for most simple cases (especially when you don't need type polymorphism) maps are sufficient

17:12 what do you mean by "object"?

17:12 herdrick: how to write this: ["foo" ["bar" "bazz" 3]] for example (using a function that works on other things, too)

17:12 raek: there is the pr* family

17:12 LauJensen: ,(prn {:one 2 :three 4})

17:13 raek: pr prn

17:13 clojurebot: {:one 2, :three 4}

17:13 raek: etc

17:13 it is similar to the __repr__ of python

17:13 herdrick: right, those write to System.out

17:13 raek: yes, you can use pr-str to get it in a string

17:13 LauJensen: herdrick: they write to *out* which can be rebound

17:13 ,(with-out-str (prn {:one 2 :three 4}))

17:13 clojurebot: "{:one 2, :three 4}\n"

17:13 raek: or wrap it in (binding [*out* some-other-print-writer] ...)

17:14 LauJensen: ~source with-out-str

17:14 Which is what goes on there

17:14 raek: pr* works for all clojure data structures and scalars

17:14 herdrick: ok, that's what I'm looking for, thanks folks. shouldn't that be a core function?

17:14 raek: it is

17:15 herdrick: not prn

17:15 prn surrounded with "with-out-str"

17:15 raek: ,#'prn

17:15 clojurebot: #'clojure.core/prn

17:15 herdrick: that's what i suggest

17:16 chouser: ,(pr-str ["foo" ["bar" "bazz" 3]])

17:16 clojurebot: "[\"foo\" [\"bar\" \"bazz\" 3]]"

17:16 raek: ,(prn-str ["foo" ["bar" "bazz" 3]])

17:16 clojurebot: "[\"foo\" [\"bar\" \"bazz\" 3]]\n"

17:16 raek: the -n is for new line

17:30 Lajla: ->(let [[I worship his shadow] '(+ 1 2 3)] (I worship his shadow))

17:30 sexpbot: java.lang.IllegalArgumentException: Wrong number of args (3) passed to: Symbol

17:33 chouser: try (list + instead of '(+

17:36 bmaddy: Hi all. Does anyone have any good tutorial recommendations for getting clojure running on app engine?

17:37 There seems to be a few out there--just curious if there's one that's better than the others.

17:51 dnolen: alexyk: noted

17:56 apgwoz: bmaddy: http://compojureongae.posterous.com/

17:57 bmaddy: Hey, thanks! I'll check that one out! (gotta run right now though)

18:04 bortreb: whats the right way to use duck-streams -- I have (ns rlm.twitter (:use [clojure.contrib duck-streams def])) but I can't use the namespace at all wth clojure 1.2. it says spit already refers to: #'clojure.contrib.duck-streams/spit in namespace: rlm.twitter

18:05 apgwoz: bortreb: i've seen that warning too.

18:05 chouser: I always recommend against naked :use like that

18:05 bortreb: then what's the right way to use it

18:06 chouser: I generally prefer (:use [clojure.contrib.duck-streams :as ds :only []] [clojure.contrib.def :as def :only []])

18:07 the :only [] parts mean no names are brought into your namespace automatically (though you can add specific ones in those :only vectors if you want to)

18:07 the :as ds means you can say (ds/reader ...) or whatever.

18:07 though on 1.2 you might prefer clojure.io

18:08 apgwoz: chouser: is the issue that 1.2 has it's own `spit`?

18:08 bortreb: yes

18:09 apgwoz: cool. i figured as much, but didn't worry about it since it still worked.

18:09 chouser: (ns foo (:use [clojure.java.io :as io :only []])) .... (io/reader ...)

18:10 bortreb: I've recently found that it's extremely inconvienent to use clojure to show my friends anything, because I have to use all these namespaces everywhere. It also is a barrier to making short scripts when more than half the file us a bunch of header junk.

18:11 I have my own custom namespace with everything loaded which helps a little

18:11 but it's stiill hard to do scripting

18:11 anyone else have this problem?

18:13 raek: bortreb: does this occur in clojure for you more often than in other languages?

18:14 bortreb: oh yeah -- a specific example is my friend and I working on an ardunio -- we needed to go through a file and do a semi complicated regex replace

18:14 technomancy: it happens more in clojure than ruby since in ruby if you're in a nested module you can reach into the outer modules relatively

18:15 bortreb: in perl I'd just put a nice short shebang line, OPEN the file, regex replace, and be done with it

18:15 technomancy: it would be like being in clojure.contrib.condition.foo and being able to refer to stuff in c.c.condition without qualification

18:16 bortreb: clojure is more elegant and would be nicer, but it's ~7-8 seconds of starting a repl, making sure the jars are in the right place, using duckstreams and str urils and repl utils

18:18 raek: correct me if i'm wrong, but I think that scripting was not a primary design goal for clojure

18:18 chouser: bortreb: yeah, clojure is not (currently) well suited for the kind of dash-one-off command-line scripts that perl always excelled at.

18:18 aria42: Anyone remember these neat reduce macros which people were posting a week or so back, which removed some of the boiler from a standard reduce?

18:18 Anyone have a link to a gist?

18:18 chouser: bortreb: but it doesn't have to remain that way...

18:19 polypus: recommended way of loading a clojure file from java?

18:19 raek: however, cljr should make it simpler to do one-off repl sessions that need libraries

18:19 danlarkin: aria42: the channel is logged, check le goog

18:19 technomancy: aria42: http://github.com/Seajure/reducate

18:19 bortreb: I don't see why not -- the actual, usefull content of the core of the program is actually shorter than perl

18:19 but that stupid java-like verbose setup at the start just kills it

18:19 aria42: technomancy: thanks! exactly what I was thinking of

18:20 raek: cljr sort of has the same package model as perl, python and ruby -- a central repository of installed packages

18:20 bortreb: I always feel like I'm fumbling around whenever I'm "on the spot" and want to show someone something

18:21 raek: I heard that cake could be used to make short commands in a persistent jvm

18:21 so there isn't the jvm startup delay between invokations

18:22 (hrm, invoKe - invoCation)

18:22 polypus: best way to execute a clojure file from within java?

18:23 is there a best practice way of doing it that's unlikely to change out from under me?

18:23 bortreb: hmmmm I'll look into cake. it sounds like nailgun, but you run into problems when for example you're showing someone your cool clojure graphics dsl, something screws up, and you have to do killall -KILL java

18:24 but maybe that's more a problem with the jvm itself

18:24 raek: bortreb: http://github.com/ninjudd/cake

18:24 it hangs?

18:25 bortreb: but how bad would it be to have some ns option that is just "use EVERYTHING clojure can do right now" and be done with it

18:25 the shebang line can be made short enough already

18:26 raek: I guess the problem lies in "EVERYTHING clojure can do"... which libraries does this include?

18:26 ...and which version?

18:26 -s

18:26 bortreb: easy -- everything in contrib that's not duplicated in core

18:26 if you want something else then you use it like normal

18:27 (ns fast-script (:use :all))

18:27 raek: contib is not an official part of clojure, merely a collection of neat things

18:27 I guess it would possible to do such a macro

18:29 my experince with what I need from contrib seems to be quite different from yours

18:29 bortreb: I think such an extention could extend clojure in a whole direction, because

18:30 then it would be shorter than the equivalent perl script

18:30 raek: the only contrib lib I use often is c.c.def

18:30 for scripting, this makes sense...

18:31 but I have a hunch that the majority of the clojure projects are not scripts, so this might be the reason the default is the way it is

18:32 maybe one could do a (cljscript) macro that one puts at the top of the file, when one wants to quickly make scripts

18:33 bortreb: however, the impedance against "getting up and running" could be a lot lower and would make it more flexible

18:35 how hard would it be to get something like this added to (ns)

18:35 raek: polypus: it can be done with some method of the clojure.lang.RT class, but maybe there is a more straightforward alternative nowadays

18:35 bortreb: something like (ns whatever :script)

18:36 no I mean into the language itself

18:36 it'd help a lot when explaining to people too; I could just say "put :script" at the top and now let's focus on the algorithms

18:37 raek: are there many algorithms that depend on contrib?

18:37 bortreb: one of the hardest things when starting out really is actually getting things to *do* something: opening files, writing to files, using urls, etc

18:38 when you already don't know what you're doing, it's really hard to discover this stuff *and* figure out how to use it.

18:39 at least, in my experience trying to teach people clojure

18:39 raek: I guess that the current philosophy is that only the least common denominator should be in clojure.core

18:40 if one does not want to use io, it should not be loaded

18:40 maybe this is a topic for the google group

18:40 bortreb: I'd love to bring it up! how do I do that?

18:41 raek: just post an email to the clojure gooogle group

18:41 polypus: raek: ty. just looking through the source, it looks like Compiler.loadFile does it

18:41 raek: join here: http://groups.google.com/group/clojure

18:41 polypus: don't know how stable that is, though

18:42 polypus: yeah. that was my concern. oh well. if it changes, i'll just have to change it

18:43 raek: I guess the gen-class thingy could be used too

18:44 polypus: actually, looks like RT.load might be a better bet

18:45 lancepantz: polypus: you will have to use genclass and compile it using core/compile before hand

18:45 afaik, you can't load a clj file in java as they require a different classloader

18:46 polypus: lancepantz: what will i have to compile?

18:46 lancepantz: the ns you wish to access from within java

18:47 polypus: lancepantz: really. that would suck

18:48 lancepantz: pretty sure

18:48 polypus: i'll mess around a bit and see what i can pull off

18:50 dpritchett: i saw a sticky note on a coworker's wall this morning that said "startrepl.sh"... I excitedly asked him what it meant and he told me it was a batch job to replicate his SQL Server database :(

19:36 polypus: anyone know with some certainty, how to load a clojure file from java, in such a way as to then have access to the vars and namespaces in that file and files required by that file through RT.var(ns, name)?

19:37 lancepantz suggested that i need to AOT the clojure, but wasn't 100% sure

19:37 arete: polypus: check out http://github.com/clojure/clojure/blob/master/src/jvm/clojure/main.java, that's basically waht it does

19:39 polypus: thanks arete

19:40 arete: np, wrote a little application loader using those APIs, works great =)

20:01 bortreb: ,(time (doall (pmap (fn [_] (Thread/sleep 500)) (range 10))))

20:01 clojurebot: java.lang.Exception: No such namespace: Thread

20:02 bortreb: well, anyway , if you replace (range 10) with (doall (take 10 (iterate inc 0))) it takes twice as long, how could it possibly do that, given that pmap is a function?

20:24 drsnyder: i'm looking for help on a simple function to read in lines from a file and return a sequence

20:26 here is the function: (defn f-to-seq[file] (with-open [rdr (java.io.BufferedReader. (java.io.FileReader. file))] (let [seq (line-seq rdr)] seq)))

20:26 Raynes: (doc line-seq)

20:26 clojurebot: "([rdr]); Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader."

20:26 drsnyder: when I run this in the repl, i get java.lang.RuntimeException: java.io.IOException: Stream closed (NO_SOURCE_FILE:0)

20:27 dnolen: drsnyder: because you're using with-open, that's closing the file when it leaves scope.

20:27 Raynes: drsnyder: What version of Clojure are you using?

20:28 drsnyder: 1.1.0

20:28 dnolen: bindings and lazy-sequences are not designed to interact together

20:28 drsnyder: oh, interesting. if i understand correctly, you need to read it into a sequence and return that

20:30 any hints on how to do that?

20:32 tomoj: (doall (line-seq rdr)) would work

20:32 dnolen: tomoj: that still won't close the file.

20:32 that's why line-seq takes a reader and not a file

20:33 you need to hold onto to close it yourself when you've exhausted the sequence

20:34 tomoj: couldn't you do (with-open [file (FileReader.) rdr (BufferedReader.)] (doall (line-seq rdr))) ?

20:34 er

20:34 except pass the file param, obviously

20:34 dnolen: tomoj: oh sorry I misunderstoood, yes yes, if you want to just read the whole file at once.

20:35 tomoj: but that's already implemented in contrib anyway

20:36 (doall (clojure.contrib.io/read-lines "filename")) ?

20:36 dnolen: drsnyder: one clever trick would be to put the file handle on the lazy sequence as metadata I think. then when the sequence is exhausted you can get the metadata and close the file.

20:36 this way you get all the benefits of lazy file processing

20:37 drsnyder: giving doall a try

20:38 tomoj: dnolen: so someone calling f-to-seq opens up the metadata of the return value to find the file handle to close?

20:39 dnolen: tomoj: I think that would work.

20:39 tomoj: agreed

20:39 but isn't it a bit strange?

20:39 dnolen: I never tried this myself but it just occured to me.

20:39 tomoj: it sounds like using metadata to simulate multiple return values

20:39 dnolen: tomoj: why, if you want to process the sequence efficiently?

20:39 drsnyder: this worked: (defn f-to-seq[file] (with-open [rdr (java.io.BufferedReader. (java.io.FileReader. file))] (doall (line-seq rdr))))

20:40 dnolen: memory efficiently. doall puts the whole file in memory.

20:40 tomoj: but why not return [the-seq the-file-handle]

20:41 then people will have to deliberately ignore part of the return value instead of being able to just let file handles rot away in metaspace

20:43 dnolen: tomoj: ah, true. auto closing line-seq would be nice, eh?

20:44 tomoj: isn't that clojure.contrib.io/read-lines?

20:45 drsnyder: but that will still leave the FileReader open, won't it?

20:45 maybe I misunderstood dnolen

20:45 drsnyder: tomoj: i don't think so

20:45 tomoj: i think with-open will close it when you leave scope

20:46 tomoj: with-open closes the BufferedReader

20:46 does the BufferedReader then close the FileReader itself?

20:47 fairly easy to test, will do

20:48 dnolen: tomoj: oh yeah, yr right read-lines. my ignorance of contrib is sometimes profound.

20:48 tomoj: it looks like it does close the FileReader

20:49 so that will work if you are OK with having the whole file in memory at once

20:52 dnolen: tomoj: read-lines is lazy

20:53 tomoj: so is line-seq?

20:54 dnolen: tomoj: but it doesn't close once exhausted

20:54 tomoj: exactly

20:55 you wanted a non-lazy autoclosing line-seq?

20:56 dnolen: drsnyder: clojure.contrib.io/read-lines might be what you want, it'll close the file for you once you've read all the lines from the file. you can avoid the doall

21:03 tomoj: as long as you actually are sure to read the whole file

21:12 dsantiago: dnolen, I was checking out your textmate/cake integration earlier. I don't know much about how Textmate bundles work, but do you think it will be possible to have a persistent repl you can type into, instead of a window that pops up?

21:13 dnolen: dsantiago: hmm ... not sure how that would work, also pretty un-TextMate-ish, right? I usually startup a REPL in Terminal.app and keep it open.

21:13 dsantiago: thx for trying it out.

21:14 dsantiago: Oh, well, sending stuff to a repl in a terminal would be even better, but I didn't think that was possible from the way it worked.

21:16 dnolen: dsantiago: I'm open to ideas. Just don't know how to get the output to actually appear in a REPL in Terminal.app. I've never used a TextMate bundle that worked liked that.

21:16 dsantiago: to be fair, Emacs isn't much better, you get the output of eval last sexpr in the mode line

21:17 dsantiago: Oh, OK. I'd love to use TextMate, but I've gotta have that repl integration from Slime, so I can send it a function I'm working on, and then run some test code by hand at the repl that uses it.

21:18 dnolen: dsantiago: then why not keep the Terminal.app REPL open? That's what I've been doing. Eval in TextMate, test code REPL in Terminal.app

21:19 dsantiago: Hm, I'm not sure I understand. What I want is something like C-c C-c and C-c C-k in Slime.

21:19 dnolen: dsantiago: C-c C-k loads the whole file. You get that in TextMate with Shift-Command-K

21:20 dsantiago: Right, but it just gives you the output in the popup window, it doesn't send it to the repl in the Terminal.

21:20 dnolen: dsantiago: it does get sent

21:20 dsantiago: just cake repl, and all your code will be there

21:20 dsantiago: Oh, hm. I did, it wasn't working.

21:20 I must have something wrong.

21:20 That was what I thought was supposed to happen, but it wasn't.

21:21 dnolen: dsantiago: you have to make sure you're in the right namespace for one. if you have a name filed in a project, you need to switch into that namespace in the REPL

21:21 s/name filed/named file

21:22 dsangtiago: at some point I'll look into making this magically work with AppleScript or something, but that's not a high priority. it's early days for this project :D

21:28 dsantiagio: cause it check if there's isn't a filename yet

21:28 eval in user ns if no path to file

21:28 dsantiago: http://github.com/swannodette/textmate-clojure/blob/cake/TODO.txt

21:28 those are my immediate plans

21:28 dsantiago: Oh, hm. Maybe I should file that then.

21:30 dnolen: dsantiago: please do. I'd like to fulfill a reasonable amount of the slime expectations.

21:32 tomoj: dnolen: are you planning to write the sexp stuff inside textmate or using an external library somehow?

21:33 dnolen: tomoj: the bundle is basically pure Clojure. the bundle just executes clojure scripts by submitting them to cake

21:33 tomoj: means people don't have an excuse for not contributing :D

21:33 dsantiago: How much control is there over the windows TextMate pops up?

21:33 tomoj: nifty

21:33 dnolen: dsantiago: unknown, this is my first remotely serious bundle.

21:34 dsantiago: OK, I know even less about it. :)

21:34 dnolen: dsantiago: I believe it's a webkit window, so some JS might do the trick. will investiage.

21:34 tomoj: textmate 2 didn't come out while I was away, did it?

21:35 dnolen: tomoj: nope. I'm not holding my breath either. but that doesn't seem to phase the gigantic userbase.

21:36 dsantiago: Oh, I just meant preventing it from appearing.

21:36 dnolen: basically why I left for Emacs. Emacs caught up.

21:38 dsantiago: it's something for me to look into. that some people just don't want that window and they should be able to suppress it. of course it easy for you just to tweak the bundle. Just discard the output of the commands you don't care about in the Bundle Editor for the Clojure mode. Of course this will break for you until things settle down as new versions roll out, unless you setup a fork.

21:43 dsantiago: OK, thanks dnolen. I'll see what I can do.

21:50 dnolen: dsantiago: thx for the feedback and trying it out.

21:56 tomoj: dnolen: you left for emacs, but you're building a TM bundle?

21:57 dnolen: tomoj: yup. because Emacs and Java IDEs are just too much of a hurdle for most people. I think good TM integration would get a lot more people to try it out. And from what response I've gotten seems like people unwillingly left TM for Emacs because of Clojure.

22:04 tomoj: admirable cause

22:05 Raynes: Too bad TM isn't cross-platform. I can't even try it.

22:05 dnolen: Raynes: eh, if you're already on Emacs I don't see the point ;) I'm just trying to widen the potential audience.

22:06 Raynes: Still.

22:30 vIkSiT: hi all

22:30 if i've got a list like ("a" "b") - is there a way to combine all the elements (which are strings), separated with spaces?

22:31 for instance, (apply str ("a" "b")) results in "ab"

22:31 (and i'm looking to get "a b")

22:34 spewn: ,(apply str (interpose \space ["a" "b"]))

22:34 clojurebot: "a b"

22:35 lancepantz: there is also a join function in contrib.string, but i always use interpose as well

22:35 vIkSiT: ah

22:35 thanks, let me check it out!

23:53 bmaddy: Has anyone else gotten compojure to work?

23:57 arbscht: bmaddy: yes. and you'll find some more at #compojure :)

23:58 bmaddy: Oooh, good call--I'll head over there for those questions. :)

Logging service provided by n01se.net