#clojure log - Aug 21 2009

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

0:01 cemerick: the night of the mutant hybrid CLASSPATH

0:53 lowlycoder: besides databses/ the sql interfaace, what's a good solution for persistent storage for clojure aplications?

0:53 something like java hibernate? ...

1:34 tomoj: hmm

1:34 maybe it's too late for me to think clearly

1:35 in ruby I can do crazy stuff like this: https://gist.github.com/cae3276f892d692f9017

1:35 is it just me or is that impossible in clojure?

1:42 Anniepoo: certainly you can make a circular list

1:44 arbscht: a naive translation might look like this http://gist.github.com/171688

1:45 tomoj: ah, yes

1:45 I was thinking just in terms of immutable maps

1:48 Anniepoo: LOL

1:48 Clojure's easy integration of projects occasionally has side effectis

1:49 The project I'm working on has a weird napkin look look and feel

1:49 it's migrated into Waterfront

2:14 Chouser: I think the swing-utils are yours, yes?

2:14 sorry, that was intended as private

2:55 demas: I'm going to working with text files from clojure (read and write). I will be thankfull if you give me any information, how-to's, examples.

2:57 As I see, Clojure don't have self API for working with files and I need to work with Java classes. Is it right ?

3:00 mikem`_: demas: there's with-open to help you open/close files

3:00 ,(doc with-open)

3:00 clojurebot: "([bindings & body]); bindings => [name init ...] Evaluates body in a try expression with names bound to the values of the inits, and a finally clause that calls (.close name) on each name in reverse order."

3:02 _mst: clojure.contrib.duck-streams and line-seq are very useful for reading files line by line

3:09 LauJensen: Top of the morning guys

3:15 Fossi: hi LauJensen

3:54 tomoj: duuuude

3:55 C-c RET = slime-macroexpand-1 is sweet

6:11 LauJensen: When I thought all hope was lost for America, I found one last thing to love: http://imgur.com/kzoxU.jpg

6:14 opqdonut: auld

7:59 adityo: hey piyush_

7:59 piyush_: hey tyo

8:20 hamza: hey guys, how can i access left field of an insets object insets/left return no such namespace error.

8:25 Chouser: (.left my-insets)

8:26 the Foo/bar notation is for either a namespace Foo or a class Foo with a static member bar

8:28 hamza: kk thank you.

8:28 that worked.

8:39 cark: mhh something i'm not quite sure about with refs

8:39 i have a connection pool

8:39 it's using a persistentqueue

8:39 so i need to peek the queue, then if it's not empty, i can remove the connection from the queue

8:40 should i (ensure *clients*) before peeking the queue ?

8:41 ~paste?

8:41 clojurebot: lisppaste8, url

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

8:42 cark pasted "untitled" at http://paste.lisp.org/display/85798

8:42 cark: in other words : does this make sense or is the ensure redundant ?

8:43 Chouser: that's a good question. I still have to think very hard about such things.

8:44 cark: it seems to me that without the ensure, it might be possible that another thread succeeds in modifying the ref between my peeking and my poping

8:44 Chouser: you're going to write to the same ref in either case

8:44 right?

8:44 rhickey: if the ref is something you are going to be changing, you need not ensure it. Your transaction works with a snapshot of the world

8:44 cark: yes there is only one ref

8:45 mhh

8:46 rhickey: write skew (and thus the need for ensure) only occurs when you make a decision based on a ref you are *not* writing and need to make sure the value read is unchanged at the end of your transaction

8:46 cark: allright ! thanks a lot that's precisely what i was not understanding

8:47 rhickey: ensure should rarely be used

8:48 cark: thanks, it makes for easier code in many places

8:50 LauJensen: Ok, so ensure is only in the case where I'm strictly reading, and need to ensure that I get the same value with multiple reads?

8:51 rhickey: LauJensen: no, all transactions work with a snapshot

8:52 ensure is for what I said, when you make a decision that effects a write based upon a ref you are not writing, and need to make sure the value you read is no different when your transaction ends

8:52 the classic example is, you can make either of two accounts go negative but not both

8:53 so a transaction making one negative will have to read the other (to make sure it is not negative), and *ensure* that is still the case when it finishes

8:54 that has nothing to do with seeing different values during the course of your transaction - that never happens

8:55 cark: that's very good information right there

8:57 LauJensen: rhickey: Ok, I gotcha.

8:57 rhickey: http://en.wikipedia.org/wiki/Snapshot_isolation

8:58 except in the section: Making Snapshot Isolation Serializable, rather than fabricate a write/write conflict you can use ensure in Clojure's STM

8:59 and should use ensure, as multiple ensures on the same ref don't conflict

8:59 cark: ah i was going to say this was like a fake write

8:59 rhickey: fake writes would conflict

9:00 so you might ensure things like permissions, without conflict

9:01 Chouser: ah! that's the first I've understood the benefits of ensure over fake write.

9:01 cark: ok got it

9:02 let's say an half-assed fake write then =P

9:02 rhickey: Chouser: until recently it was just a theoretical promise of the design

9:02 Chouser: fake writes always conflict while ensure only causes retries when something actually changed?

9:02 yeah, I saw that change go in, just didn't grok the difference.

9:03 rhickey: ensures conflict with writes, but not with each other

9:05 but really the best part about ensures is that the say what you intend, fake writes are confusing

9:06 lisppaste8: raphinou_ pasted "untitled" at http://paste.lisp.org/display/85799

9:06 rhickey: admittedly write skew can be subtle, but snapshot isolation rocks

9:07 raphinou_: In my pasted code, isn't addListener called on the WPushButton instance?

9:07 Chouser: snapshot isoloation is an amazing promise. I hope to get a chance to actually take advantage of it some day. :-)

9:07 raphinou_: it seems to be called to Signal1, but I don't see why

9:08 cark: raphinou_ : usually you get this error when the number of parameter is wrong or at runtime the type of some parameters is wrong

9:08 raphinou_: ok cark, I'll look in that direction

9:09 Chouser: raphinou_: you're calling .addListener on the return value fo WPushButton's 'clicked' method -- is that what you intend?

9:09 cark: ahyes =P

9:10 raphinou_: Chouser: that might be the problem indeed. I'll check!

9:10 cark: maybe use doto

9:10 raphinou_: or should I instanciate the WPushButton in the let?

9:11 cark: (.addListener (doto (WPushButton. ....) .clicked) ...

9:12 raphinou_: I checked and aadListener has to be called on the value returned by clicked

9:12 cark: ah =/

9:12 raphinou_: cark: has the doto form you posted a different meaning or is it the same?

9:13 cark: nope, doto returns its first argument

9:13 raphinou_: ok, thx!

9:13 cark: so it's no good is you need the return value of cllicked

9:16 raphinou_: indeed, but I'll remember it for other uses!

9:17 how do I pass arguments to methods called with ..?

9:18 is this valid ? (.. my_obj method1 (method2 arg1 arg2))

9:18 Chouser: raphinou_: yes

9:18 raphinou_: ok, thx

9:18 Chouser: or: (-> my_obj .method1 (.method2 arg1 arg2))

9:20 cark: i prefer the latter

9:20 easier to read

9:23 lisppaste8: raphinou_ pasted "untitled" at http://paste.lisp.org/display/85802

9:23 raphinou_: here's the java code I try to translate in clojure

9:24 cark: what is Signal1 ?

9:25 LauJensen: raphinou: I can paste a few macros I use for swing apps if you paste?

9:25 hehe.. "if you want"

9:25 raphinou_: :-)

9:25 I'm interested, thought this isn't swing. But interested to look at it!

9:26 Signal1 is a class for implementing a signal/slot system

9:26 LauJensen: pasting

9:26 raphinou_: the whole code is at http://www.webtoolkit.eu/jwt#/src/hello

9:26 cark: i think you want (proxy [Signal1$Listener] ....)

9:26 raphinou_: I'm just learning jwt too, so I can't lean on deep knowledge of that framework....

9:26 lisppaste8: Lau annotated #85802 "swing macros" at http://paste.lisp.org/display/85802#1

9:27 LauJensen: So for button I would eval (onClick button (println "Button has been clicked"))

9:28 raphinou_: cark: I'll look at it, as I don't know that notation Signal1$Listener

9:28 thx LauJensen!

9:28 cark: the $ is for enclosed classes

9:28 hum don't remember the proper name of these

9:29 you might want to fully qualify the name too

9:29 as the rules for importing are a bit strange for these

9:29 LauJensen: np

9:30 raphinou_: yes cark, I'll try the fqname, as it can't resolve with the $

9:30 cark: where is the javadoc =/

9:32 raphinou_: hmm, the Signal1.Listener is an interface

9:32 http://www.webtoolkit.eu/jwt/latest/doc/javadoc/

9:32 cark: well it's a nested interface

9:33 i think you could use it as a nested class from clojure, though i'm not sure about that

9:33 eu.webtoolkit.jwt.Signal1$Listener should do it

9:35 raphinou_: you're right cark, that's working fine!

9:35 thanks!

9:35 cark: great =)

9:35 raphinou_: now checking the code does what I want :-D

9:39 LauJensen: raphinou_: I think its a good idea to annote your pastes with the solution, once you arrive at it. Could be a help for others in the same situation

9:40 raphinou_: ha, good suggestion LauJensen. I usually do it on fora and mailing lists, but I don't have the reflex on pastes. Will do!

9:41 lisppaste8: raphinou_ annotated #85802 "untitled" at http://paste.lisp.org/display/85802#2

9:44 LauJensen: Thats cool man :)

9:54 raphinou_: ok, my code is working fine. Thanks for the help!

9:54 I'll blog about it soon, and post it to the google group

9:55 cark: did you manage the import section of your ns form ok ?

9:55 or did you keep the full qualified name in there ?

9:56 raphinou_: I kept the fully qualified name for now

9:57 cark: the trick is to import the nested class too

9:58 raphinou_: Signal1 is imported, but I can't use Signal1$Listener

9:58 cark: (ns org.bleh (:import [org.foo Signal1$Listener]))

9:58 or something like it

9:59 i wouldn't bother you with it if that was not for this blog post !

9:59 raphinou_: importing Signal1$Listener works

9:59 I juste tested it when you posted suggestion :-)

9:59 cark: hehe ok

10:00 raphinou_: and be sure you don't bother me, I appreciate your help!

10:00 cark: =)

11:05 arohner: lisppaste8:

11:05 lisppaste8: url

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

11:08 arohner pasted "new macro?" at http://paste.lisp.org/display/85810

11:09 arohner: I'm thinking about writing a macro something like what I posted. Is there anything that already works like that, or a better way to write the original code so that a macro isn't necessary?

11:10 Chouser: arohner: hm, defn allows you to define pre- and post- conditions.

11:10 oh, all fns not just defn.

11:11 or you could use cond

11:11 cark: where are those pre-conditions documented ?

11:12 arohner: yeah, my problem with cond is I have to state the predicates negatively

11:12 what I want is sort of the inverse of cond

11:13 Chouser: arohner: I wonder if you can use condp somehow

11:20 arohner: cark: I think here's your documentation, for now

11:20 http://github.com/richhickey/clojure/commit/0ac482878a1dd520cbee2faa0f5f6ab1082ffa76

11:20 cark: ah thank you

11:25 Chouser: (condp (fn [t e] (not t)) nil (pred1) "1 failed" (pred2) "2 failed" "all succeeded")

11:25 not very pretty, but maybe better than nested ifs

11:26 AWizzArd: Oh nice, I didn't know that there was a limit of how many chars one can have in one line of code :)

11:27 Is that a Clojure, Java or Emacs limit? I sit in Slime/Emacs and do: (apply str (repeat 65533 "0"))

11:28 I copy the generated string and try to paste it into the repl. I get an Exception: java.lang.ClassFormatError: Unknown constant tag 34 in class file user$eval__1913

11:29 Probably the 65533 chars plus two double-quotes plus EOL break the limit of 2^16 chars per line.

11:31 cark: mhh i would say it's the function size limit of the jvm

11:31 ole3: ist the limit of max arguments to apply

11:32 AWizzArd: the (apply str ..) is not the problem

11:32 cark: i don't think there is a max argument limit in clojure

11:33 cemerick: non-variadic fns have a max arg count of 18

11:34 or 20, I forget -- maybe 18 is the limit for proxy method impls

11:36 cark: right, but you may apply an infinite list to a variadic function

11:37 ,(apply (fn [& items] (take 2 items)) (repeat :a))

11:37 clojurebot: (:a :a)

11:38 cark: which is neat =)

11:39 cemerick: AWizzArd: (apply str (repeat 65533 "0") works fine for me (aside from printing out 64K zeros) in enclojure

11:40 cark: every time you press enter in the repl you do evaluation

11:40 which means compiling

11:41 so you hit the jvm limit

11:41 Chouser: right, I think it's a class bytecode size limit

11:41 cemerick: it is, but it sounds like emacs/slime is doing something odd when returning values from the REPL

11:42 Chouser: ,(count (read-string (str \" (apply str (repeat 7e5 "0")) \")))

11:42 clojurebot: 700000

11:42 cark: emacs/clçojure-mode has no trouble returning huge values ... it is sometimes very annoying =/

11:43 Chouser: huh. even eval is ok for a string that size.

11:43 Neronus: And let's not talk about infinite lists

11:43 cark: chouser : nope you're only reading, not evaluating

11:44 Chouser: right, but when I do (eval (read-string ...)) that also works

11:45 cark: that was a mean trick to make my emac print a huge string =P

11:46 Chouser: sorry. (count (eval (read-string ...))) :-)

11:46 AWizzArd: cemerick: do you copy&paste that produced string into the repl?

11:47 cemerick: AWizzArd: yup

11:47 AWizzArd: I also have no problem to generate a very long string and look at it. Emacs shows it. But when I then copy&paste it, only then I get this funny Exception.

11:47 cemerick: There's a class being generated somewhere with that value included literally.

11:48 I'll bet the swank interface is using read-string on a vector or map being sent over the wire.

11:48 cark: ,(eval (read-string (str \( "print" \" (apply str (repeat 7e5 "0")) \"\))))

11:48 clojurebot: DENIED

11:48 cark: ah

11:48 well try this

11:48 same error

11:49 Neronus: cemerick: How is enclojure these days? Pretty much complete?

11:50 AWizzArd: cark: yes, that also gives me the same error

11:50 cemerick: Neronus: it's pretty darn good. Good remote repl capability, solid editor.

11:51 cark: i stand by the bytecode size explanation

11:51 cemerick: The debugger works, but it's definitely rough around the edges. Same with code completion.

11:51 cark: though that doesn't help you one bit with the problem at hand =)

11:51 AWizzArd: cark: but why does it work for cemerick?

11:51 cemerick: because I'm not using emacs.

11:51 or swank, or whatever

11:52 cark: i guess enclojure has a different way of doing repl

11:52 AWizzArd: maybe swank transports huge objects not correctly to the jvm

11:52 cark: there is no swank in my case

11:53 Neronus: cemerick: Well, I'm going to try it. I'm mostly interested in the debugger and java integration. emacs seems to be lacking in that respect

11:53 cemerick: cark: IIRC, enclojure uses a streaming model that doesn't wait for the entire result before printing.

11:53 AWizzArd: cemerick: what OS are you using?

11:54 cemerick: Neronus: I think you'll like it. I give it a 7/10 right now. :-)

11:54 AWizzArd: OS X 10.5.x

11:54 Neronus: We'll see once netbeans finished downloading :)

11:54 AWizzArd: funny, now I go to the shell (under Windows) and did a java -cp clojure.jar clojure.lang.Repl and pasted carks eval example.

11:54 Even there I get the error. So, it is nothing with emacs/swank.

11:56 Neronus: FWIW it works finde for me (linux, java 6, clojure HEAD)

11:58 AWizzArd: maybe some issue in the jdk for Windows *shrugs*

11:59 cemerick: AWizzArd: it's possible that different builds of the JVM have different classfile size limits

11:59 read-string on large inputs is never safe

12:01 Chouser: cemerick: why is read-string a problem? I thought we'd pinned this on eval?

12:03 cemerick: Chouser: yes, sorry, eval.

12:03 I was up late. :-/

12:11 Neronus: cemerick: I downloaded the plugin, installed it in netbeans, restartet netbeans. Am I supposed to be able to create a clojure project now?

12:19 gcv: does Clojure have a way to check if a variable is bound? I'm looking for an equivalent to CL's boundp.

12:19 Chouser: you want to know the difference between (def x) and (def x value) ?

12:19 gcv: exactly

12:21 Chouser: (.isBound (var x))

12:21 I think that's as good as it gets

12:22 there's also 'defonce'

12:22 ...which uses .hasRoot, not exactly the same as .isBound

12:23 Chousuke: hm

12:23 I'm getting a weird error when trying to (require) my reader namespace :/

12:24 gcv: interesting. .isBound is not bad, but it returns false for things which have been declare'd, rather than def'ed.

12:24 Chousuke: it says "can't def syntax-quote because clojure.lang.reader refers to #'clojure.core/syntax-quote"

12:25 Chouser: gcv: (declare v) is the same as (def v)

12:26 they imply slightly different things, but there's no way to tell which was used to create v

12:26 stuartsierra: Chousuke: I think syntax-quote is the expansion of the ` reader macro.

12:27 Chousuke: stuartsierra: nah, it's my own macro.

12:27 gcv: Chouser: got it, makes sense. thank you.

12:27 Chousuke: in the java reader ` expands to what the result of a syntax-quote macro would be

12:27 Chouser: the difference with .hasRoot will be for thread-local bindings

12:28 stuartsierra: Chousuke: but if you try to define syntax-quote in your clojure.lang.reader ns, it will conflict with the definition in clojure.core.

12:28 Chousuke: stuartsierra: the only definition is in clojure.core and it's mine :/

12:28 stuartsierra: Oh, then I have no idea what's going on. :)

12:29 Chousuke: it's working just fine from the repl. just not when I try to create a new namespace which requires my reader namespace

12:29 and that error is weird

12:31 actually. let me just try rebuilding the clojure.jar...

12:32 yeah. that did it :P

12:45 wavister: is it impossible to sandbox multiple code bases within the same jvm?

12:47 stuartsierra: It's quite possible, there are Java libs dedicated to this.

12:52 wavister: ok. i've been looking for a class that i could instantiate that would encapsulate a clojure codebase, like x = new clojure.main(); x.evaluateCode(stuff);

12:52 cemerick: Neronus: There is a clojure project type, but I don't use it.

12:52 wavister: but maybe i'm looking for the wrong thing

12:52 cemerick: I just use a regular j2se projects.

12:53 I think clojure projects are just a thin veneer around j2se projects

12:54 wavister: cemerick: projects? is this a design pattern i'm not familiar with?

12:54 stuartsierra: wavister: You can't do that because Clojure is a compiler, not an interpreter. There is no "instance" of Clojure running in the JVM.

12:54 cemerick: wavister: IDE project types

12:57 wavister: stuartsierra: ok, but if I have a program running and i have some clojure code, how do I call B from A, assuming the clojure code is neither compiled, nor written to be used from java?

12:58 stuartsierra: You can use the methods in clojure.lang.RT to load and evaluate Clojure code source code.

12:58 cemerick: wavister: clojure lib A can require B and make calls to it directly. It's a lot simpler than it sounds like you're thinking it is...

13:00 oh, I see what you're saying. Yes, as stuartsierra said, use RT.load to load your namespaces, and then you can use RT.var to access and invoke different vars defined therein.

13:00 stuartsierra: That's for calling Clojure code from Java code, of course.

13:01 wavister: ok I think that's what I need to look into then

13:01 there's a lot of methods in RT. looks like much of the api...

13:02 can I load lines of a codebase incrementally?

13:02 cemerick: very little of it is relevant from a user perspective

13:02 stuartsierra: Yeah, the important ones are, as cemerick said, RT.var and RT.load. You may also need Var.invoke.

13:03 wavister: ok

13:07 cark: what's the typep predicate in clojure again ?

13:07 hum got it

13:08 instance?

13:41 Chousuke: ooh.

13:42 my reader can now read its own source, and evaluating the read data structures does not throw exceptions or screw up the reader

13:43 Chouser: nice

13:44 Chousuke: it's still missing bits and pieces now.

13:44 though* :P

13:44 for example, I still don't support \uNNNN

13:44 but at least it works!

13:57 next milestone, reading core.clj :P

13:57 but I think I'll leave that for another day.

13:58 cark: nice work, though i wonder how is performance

13:59 Chousuke: well, it doesn't take years. but it's entirely unoptimised at the moment :)

13:59 Chouser: no reason it has to be worse than the java one

14:01 cark: i hope so

14:01 as binary serialization is unavailable right now, i use the printer

14:02 and read back

14:02 Chouser: cark: keywords serialize now. is there something else you're missing?

14:02 cark: oh i didn't know that

14:03 Chouser: as of last night

14:03 :-)

14:03 cark: mhh yes, how about lazy sequences ?

14:03 Chousuke: well, it does take a second to read itself, which is pretty slow

14:03 but I think it has lots of room for optimisation

14:03 cemerick: cark: I'm going to be tackling binary serialization shortly.

14:03 I can't imagine it's going to be particularly difficult.

14:04 Chousuke: I guess the biggest problem is going to be that it generates lots of small vectors

14:04 cark: i wouldn't mind if infinite sequences serialization was to run out of memory

14:04 i guess that's up to the caller to make sure of that kind of stuff

14:04 Chousuke: I'll have to get rid of that... but then it means I have to figure out some other way to pass "state" around

14:05 cark: Chousuke : do you have your work on github ?

14:05 Chousuke: yeah

14:05 Chouser: I wouldn't assume creating a lot of small vectors are a performance hit -- measure before you eliminate

14:05 ericthorsen: hmm...gen-class method overload resolution seems undocumented?

14:05 Chousuke: cark: http://github.com/Chousuke/clojure/tree/clojure-reader

14:06 Chouser: Chousuke: but if they are, maybe newnew would help.

14:06 cark: Chousuke : thanks

14:06 Chousuke: but I make no guarantee that this branch won't go away due to reorganisation or a rebase :P

14:06 I think I'll have to split out the syntax-quote macro into its own patch at least.

14:07 the code is also "optimistic" in that it assumes well-formed symbols etc.

14:08 hm, actually, it doesn't take namespaces into account for symbols at all.

14:09 * Chousuke makes some todos to reader.org

14:19 duck1123: is it better to have your project's config.clj file be a properly namespaced def statement, or a raw data structure that can be read and assigned to a var?

14:19 currently, I've been going with the former, but I'm not so sure

14:22 cemerick: we're upgrading our version of clojure over the weekend. Is there any consensus as to the most recent stable point?

14:22 Chouser: never found a config system I like. Either they machine-writable and you can't do any branches or computation in them, or they're code and can be updated cleanly via a gui or tool. Or they're some scary combination thereof.

14:24 duck1123: my config file is currently only my db info (I know, there are better ways) passwords for my XMPP connection, and a handful of bools

14:26 Chouser: I guess unless you specifically want to allow evaluation of stuff (computing config values based on other values, custom variables, external info, etc.) just reading will be faster and has the remote possibility of being written out again (minus comments and formatting).

14:29 duck1123: That was what was making me think of this. I want to do a install page for my app if I decide to open-source it, and the way most sites I've seen have done it was to write back to the config file. That won't work as well with me having a namespaced config var (as source)

14:30 cark: why not just use an ini file ?

14:30 Chouser: ew

14:30 cark: hehe well it's hackable by the customer

14:30 and writable with tools

14:31 Chouser: ini can't handle structure

14:31 duck1123: I'd use yaml before using ini, but it still feels a shame with clojure having such a great representation

14:31 cark: if you have structure it's not configuration anymore, it's data

14:31 Chouser: you might think you just have a list of simple vars, but then one of them has to be a list of things and suddenly ini hurts.

14:36 duck1123: What's the best solution if I want to create precisely-formatted clojure code files? I'm thinking of code generators (ala Rails)

14:36 cark: i think c.c.pprint has a code formatter option

14:36 Licenser_: aloa everyone

14:37 cark: but aren't we supposed to use macros for code generation ?

14:37 duck1123: I've thought about c.c.pprint, but I figured it wouldn't be able to generate quite what I want.

14:38 cark: macros remove your preprocessing stage

14:38 duck1123: cark: macros only take you so far, they can't do the (ns) without being both messy and brilliant

14:39 cark: macros can be messy i give you that =)

14:39 then again code generation is messy too

14:39 duck1123: my use case is adding the 3 relevant files for a MVC architecture as well as generating schema files etc

14:40 Chouser: I'd try really hard to do that without writing new code to files on disk.

14:40 personally

14:41 what's a schema file? not clojure code?

14:42 duck1123: well, sql code currently, but I've been wanting to switch that to clojure code

14:43 Basically, I want something to generate anything I need to add a new model to my app

14:44 Licenser_: duck1123: working on a rails like framework?

14:44 duck1123: basically, it's mostly what I've come up with after working with compojure

14:45 cark: the one time i tried rails, as soon as i understood it was pre-generating code i deleted the whole thing =)

14:45 duck1123: Adding a new model involes doing exactly the same thing to 3 new files in 3 different folders, with only the names changed

14:46 hiredman: there is clinorm, but that doesn't seem very active

14:46 duck1123: I use my fork of clj-record

14:47 it works really well because I can multi-method dispatch based on the type of record I have.

14:47 hiredman: ah

14:48 I thought clnorm looked kind of emptier then I remembered, I must have been remembering clj-record

14:48 duck1123: clj-record is the more complete one, I think. We just got a googlegroup the other day

15:01 Licenser_: I must say the more I look into it the more I start to like clojure

15:02 duck1123: there's a lot to like about clojure

15:02 luis: Licenser_: Lisp is fun. :-)

15:02 Licenser_: God wrote in Lisp!

15:03 duck1123: I would have to say, programming in clojure has made me more aware of performace characteristics of different datatypes

15:03 Chouser: if so, it wasn't Clojure. Lisp may be built on itself, but Clojure is built on the JVM.

15:03 Licenser_: And yes Lisp has a certain charm, while I only got drawn to look into CLojure since they promised a nice suport for paralelism or what ever the fancy word for that was

15:03 luis: Chouser: yawn, is this that Clojure-is-not-a-pure-lisp rant?

15:04 Chouser: luis: I prefer clojure to any lisp I've ever tried.

15:04 duck1123: Licenser_: I assume you know http://xkcd.com/224/

15:04 luis: Chouser: ok, just checking. :-)

15:05 Licenser_: Yes I knwo all the XKCD comic :P but I was reffering to a song

15:05 rsynnott: But did god write in lisp-1 or lisp-2? You could get a good crusade or two out of that :)

15:05 Licenser_: http://www.youtube.com/watch?v=5-OjTPj7K54

15:05 Chouser: luis: :-) but Clojure picks up a whole lot from Java -- mostly (but not entirely) good.

15:05 duck1123: god writes in lisp-7, his version of CL is that odd

15:05 rsynnott: along with the odd schism over how lisp-2s are almost never actually lisp-2 ;)

15:06 normal cl is about lisp-7

15:06 Licenser_: I can use print and not System.out.print() one thing that makes it a LOT better then Java in my eyes

15:07 duck1123: Licenser_: it gets better when you consider you can then re-bind *out* and print to whatever you want

15:07 Licenser_: danlarkin: I know, that is very very very nice ^^

15:07 duck1123: wrong dan

15:08 rsynnott: In reality, of course, he probably got an exemption and got to write it in C, just like all of those military contractors who were meant to be using ADA :)

15:08 Licenser_: plus it does hot have that ugly mixup of primitiv and object data dypes that java has - at least I didn't stumbled into that yet

15:08 Chouser: actually it does :-/

15:09 Licenser_: I quit o.O

15:09 Chouser: nah, it won't hurt too bad.

15:09 Licenser_: I hate it, hate hate hate hate it. It is one of the things I dislike most about java

15:10 Chouser: you can generally ignore the primitive types unless you need them for memory or time efficiency

15:10 Licenser_: the second you have to use that ugly thing called Integer in java you can toss all your code out of the window and hang your self in an infinit loop

15:10 duck1123: You only really get into it when you start reading the "... fast as java" threads

15:10 luis: Licenser_: it's useful to have unboxed types. Java makes it a pain though.

15:11 Licenser_: though it's better nowadays with automatic (un)boxing isn't it?

15:11 Licenser_: not sure, didn't ever touched Integer again since I discovered that + isn't working for it

15:12 Chousuke: hm? :/

15:12 Licenser_: And I likely will never do it until they allow me to at least add two Integers without chaning one gazillion function calls and typecasts. It's like an embargo against silly use of Objects

15:12 Chousuke: ah, in java. :P

15:12 luis: Licenser_: seems like you haven't used Java with automatic (un)boxing. It's almost bearable now.

15:13 Licenser_: Chousuke: don't worry in Clojure it works, it was the second thing I tried.

15:13 luis: Licenser_: works in Java too.

15:13 Licenser_: luis: I will try that, if I ever see a reason to do so.

15:14 Then again to try that I'd have to create a new class and all that horible things

15:14 hiredman: http://blogs.sun.com/jrose/entry/fixnums_in_the_vm some day

15:16 Licenser_: luis: now I'm pretty impressed

15:16 luis: Licenser_: how so?

15:16 Licenser_: that actually works quite well.

15:16 luis: Licenser_: impressed by Java? :)

15:17 Licenser_: I let text mate generate my all the silly classes and functions I needed to test it and I acntually it can do: (new Interger(2) + 1.2)

15:17 That is like a huge leap into the direction of being not entirely horrible

15:18 luis: Or you can just avoid Java. That works pretty well too.

15:18 Licenser_: I know, but at least I learned something new today something I'd not expected :P

15:18 rsynnott: hiredman: in time for the mars landing and fusion power, no doubt ;)

15:18 Chouser: ,(+ 2 (double 1.2))

15:18 clojurebot: 3.2

15:19 hiredman: rsynnott: :/

15:20 I have pictures from one of the mars rovers as my desktop background

15:20 Licenser_: Chouser: I didn't expected it not to work in clojure, I didn't even expected it not to work in Java when I first ran into this problem which is why it was so extremely frustrating back then.

15:20 rsynnott: or in time for the sun engulfing earth, if you want fixnums on java _on a mac_

15:20 Chouser: Licenser_: I understand. I just thought I'd show you the clojure equiv.

15:21 Licenser_: Chouser: thanks :)

15:21 Chouser: 2 by itself is an Integer. 1.2 would be a Double, but (double 1.2) is a primitive.

15:21 hiredman: rsynnott: *shrug*

15:21 Licenser_: ah sneaky

15:21 so I could do:

15:21 ,(+ (int 2) (double 1.2))

15:21 clojurebot: 3.2

15:21 Licenser_: yay

15:21 <- starts to learn ^^

15:22 Chousuke: autoboxing happens though.

15:22 rsynnott: (apple has finally embraced java 1.6, but only quite recently)

15:22 Chousuke: rsynnott: and only on 64-bit platforms :P

15:22 rsynnott: well, yes, but you can't expect miracles

15:22 Chousuke: but I suppose that doesn't matter much.

15:22 cemerick: do they even sell 32-bit macs anymore?

15:23 Chousuke: no :)

15:23 cschreiner: how to perform a (range 1.0 10.0 0.1) ?

15:23 rsynnott: Apple used actually be a big fan of java, but they've taken to ignoring it of late

15:23 Licenser_: I want java 1.6!

15:23 rsynnott: cemerick: not since 2006, I think

15:23 cschreiner: since range only accepts integers

15:23 cemerick: they've been churning out updates pretty good lately

15:23 stuartsierra: ,(take 5 (range 1.0 10.0 0.1))

15:23 cemerick: esp. if you watch the dev previews

15:23 clojurebot: (1.0 1.1 1.2000000000000002 1.3000000000000003 1.4000000000000004)

15:23 cschreiner: aha

15:23 rsynnott: ah, but what happens when 1.7 turns up? :)

15:24 Licenser_: *downloads*

15:24 cschreiner: why this behaviour?

15:24 stuartsierra: cschreiner: floating-point math.

15:24 cschreiner: ok, how do I round? like (round %) ?

15:24 stuartsierra: ,(take 5 (range 1.0M 10.0M 0.1M))

15:24 clojurebot: (1.0M 1.1M 1.2M 1.3M 1.4M)

15:25 kotarak: Math/round

15:25 cschreiner: nice, thanks

15:25 stuartsierra: my last example uses BigDecimals

15:25 Chouser: ,(range 1 3 1/10)

15:25 clojurebot: (1 11/10 6/5 13/10 7/5 3/2 8/5 17/10 9/5 19/10 2 21/10 11/5 23/10 12/5 5/2 13/5 27/10 14/5 29/10)

15:25 cschreiner: hey

15:25 that IS nice

15:25 Chousuke: ratios!

15:25 I almost forgot they exist.

15:25 Licenser_: yes it is very nicely nice

15:25 hiredman: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4617197 Priority: 5-Very Low

15:26 I love how full product version is java 1.3

15:27 weissj: i get the feeling that calling create-ns inside a let is a bad thing to do? for some reason the namespaces end up not being created?

15:27 hiredman: weissj: eh?

15:28 weissj: i guess i better pastie, hiredman, 1 wec

15:28 sec

15:28 hiredman: ,(let [] (create-ns 'bob))

15:28 clojurebot: #<Namespace bob>

15:29 kotarak: ,(let [foo (create-ns 'alice)] foo)

15:29 clojurebot: #<Namespace alice>

15:29 weissj: ,(all-ns)

15:29 clojurebot: (#<Namespace clojure.set> #<Namespace hiredman.sandbox> #<Namespace hiredman.schedule> #<Namespace hiredman.clojurebot.seenx> #<Namespace hiredman.clojurebot.dice> #<Namespace hiredman.clojurebot.sb> #<Namespace org.danlarkin.json.decoder> #<Namespace hiredman.clojurebot.delicious> #<Namespace user> #<Namespace hiredman.clojurebot.google> #<Namespace clojure.main> #<Namespace org.danlarkin.json> #<Namespace clojure.core>

15:29 weissj: how come they are not there

15:29 cschreiner: ,(map #((.round Math (* % 10)))(take 5 (range 1.0 10.0 0.1)))

15:29 clojurebot: java.lang.IllegalArgumentException: No matching method found: round for class java.lang.Class

15:29 kotarak: weissj: obviously create-ns is not ns. as create-struct is not defstruct

15:30 cschreiner: any hint?

15:30 kotarak: cschreiner: Math/round

15:30 hiredman: ,(.contains (all-ns) (create-ns 'bob))

15:30 clojurebot: true

15:30 hiredman: it is there

15:31 weissj: hiredman: am i blind? i don't see it

15:31 cschreiner: kotarak: no

15:31 , (map #((. Math/round (* % 10)))(take 5 (range 1.0 10.0 0.1)))

15:31 clojurebot: java.lang.Exception: Unable to find static field: round in class java.lang.Math

15:31 kotarak: ,(map #(Math/round (* % 10)) (take 5 (range 1.0 10.0 0.1)))

15:31 clojurebot: (10 11 12 13 14)

15:31 hiredman: weissj: clojurebot obviously elides output after a certain length

15:32 weissj: hiredman: oh ok

15:32 hiredman: you can tell because there is no closing paren

15:32 lisppaste8: weissj pasted "title" at http://paste.lisp.org/display/85831

15:32 cschreiner: oh, the parantesis

15:32 hiredman: ~map

15:32 clojurebot: map is *LAZY*

15:32 kotarak: cschreiner: and the dot

15:32 weissj: hiredman, when i run the code i pasted, i don't see the printlns

15:33 well i see the first one, println 'hi

15:33 Licenser_: ~Licenser_

15:33 clojurebot: I don't understand.

15:33 cschreiner: so in this case the dot does not denote anything?

15:33 Licenser_: I want him to say Licenser_ is *LAZY* :(

15:33 hiredman: weissj: let me do this again

15:33 ~map

15:33 clojurebot: map is *LAZY*

15:33 hiredman: ugh

15:33 weissj: oh right. :)

15:33 hiredman: and def is altering the global namespace

15:34 so using def inside a function is very icky

15:34 weissj: hiredman: i am not sure how else to do it

15:34 i can't do those defs until after i've loaded my properties

15:35 kotarak: cschreiner: static class methods are called with a /: (Math/round ...) not (.round Math ...) the letter would call the .round method on the Class instance denoting Math, which doesn't exist and hence gives you the error you wrote above

15:35 hiredman: weissj: sure you can

15:35 they are all atoms, so they are mutable

15:35 weissj: hiredman: oh i see, i can def them as nil first

15:35 Licenser_: well see you all later

15:36 cschreiner: kotarak: ok

15:36 thanks for clearing that out

15:36 kotarak: cschreiner: clojure.org/java_interop

15:36 IIRC

15:39 cschreiner: what is the (static?) java method for rounding with decimals?

15:40 kotarak: cschreiner: you mean to a certain precision?

15:40 cschreiner: yes

15:40 so my list would look like (0.01 0.02 0.03 ...)

15:41 weissj: hiredman: that plus the (doall (map ...)) fixed it, thanks!

15:42 kotarak: cschreiner: dunno, there is with-precision

15:42 (doc with-precision)

15:42 clojurebot: "([precision & exprs]); Sets the precision and rounding mode to be used for BigDecimal operations. Usage: (with-precision 10 (/ 1M 3)) or: (with-precision 10 :rounding HALF_DOWN (/ 1M 3)) The rounding mode is one of CEILING, FLOOR, HALF_UP, HALF_DOWN, HALF_EVEN, UP, DOWN and UNNECESSARY; it defaults to HALF_UP."

15:43 kotarak: Hmm.. dunno

15:43 cschreiner: so you set this locally?

15:43 like, inside a (do ) block

15:43 kotarak: (with-precision 2 (do-things) (do-more-things))

15:44 cschreiner: no do block necessary

15:44 cschreiner: Ah

15:44 hmm, helps to actually read the definiton ;-)

15:44 yeah, that solves it, I think

15:45 kotarak: cschreiner: Everything with "& body" in the arglist doesn't need a do.

15:45 cschreiner: right

15:45 kotarak: ,(:arglists ^#'for)

15:45 clojurebot: ([seq-exprs body-expr])

15:53 cemerick: is there really any hope of getting fixnums on the jvm anytime soon? I thought that was effectively a pipe dream.

15:54 wtetzner: ,(rest [1])

15:54 clojurebot: ()

15:55 wtetzner: i thought if there were no more items, a sequence was supposed to return nil?

15:55 ,(first (rest [1]))

15:55 clojurebot: nil

15:55 kotarak: ,(next [1])

15:55 clojurebot: nil

15:55 wtetzner: oh

15:55 hiredman: ~lazier

15:55 clojurebot: excusez-moi

15:55 hiredman: ~lazy

15:55 clojurebot: lazy is hard

15:55 hiredman: bah

15:55 kotarak: wtetzner: http://clojure.org/lazy

15:56 hiredman: also http://clojure.org/lazier

15:56 wtetzner: thanks

15:56 hiredman: but I think both pages speak of the change as something brand new, but the change was pre-1.0 so it's been around for months now

15:56 wtetzner: ok

16:03 Chouser: in 18 months there will be a public draft of the results of considering whether it is practical to add new features to support networking, threads, internationalization, foreign-function interfaces, etc. for a "large" scheme language.

16:03 we'd better watch out.

16:03 http://scheme-reports.org/2009/working-group-2-charter.html

16:03 hiredman: *snort*

16:03 LtU has a thread on it

16:03 Chousuke: wait, results of considering whether it's practical?

16:04 luis: Chouser: Scheme is a fine language.

16:04 cemerick: eh, I can't bag on the schemers

16:04 They'll probably be around long after CL and clojure are gone

16:05 kotarak: Yes. Scheme is a nice language. I liked for its small core (as I like Clojure for that reason (among others)). I'm not sure I like R6RS, though...

16:06 luis: kotarak: saying Clojure has a small core (being a JVM language) is a bit disingenious.

16:06 Chouser: luis: depends on whether you're weighing the whole package or trying to maintain the code base.

16:06 hiredman: it is small, compared to say scala

16:07 Chousuke: the JVM is not counted into the "core". it's something Clojure gets for free. :)

16:07 kotarak: luis: how does the JVM influence the core of CLojure? Is Basic a huge language, because it runs on Windows?

16:08 stuartsierra: Is there a fn like select-keys but that removes the given keys?

16:08 hiredman: reduce+dissoc?

16:08 Chouser: ,(dissoc {:a 1 :b 2 :c 3 :d 4} :a :c :d)

16:08 clojurebot: {:b 2}

16:09 uninverted: Anybody know why "slime-complete-symbol" in emacs with slime doesn't work with clojure?

16:09 hiredman: or just dissoc

16:09 stuartsierra: Right, dissoc, thanks.

16:09 danlei: uninverted: works for me

16:09 uninverted: donlei: hmm...

16:10 danlei: uninverted: cvs upped slime, pulled swank-clouren and clojure-mode today (clojure.jar also HEAD)

16:10 luis: kotarak: I'm using the wrong terminology perhaps. What do you call all that java.lang.* stuff?

16:11 danlei: *swank-clojure

16:11 cemerick: luis: Java is certainly clojure's only target at the moment, but that will change in relatively short order

16:11 hiredman: useful for java interop

16:11 well, there is Clojure.NET

16:12 wtetzner: luis: the stuff you import using java.lang etc. is accessing libraries

16:12 hiredman: and the currently broken clojurescript

16:12 wtetzner: it's not part of the core of the language

16:12 cemerick: yeah, a .NET target that tracks head will probably the first alternative target

16:12 hiredman: wtetzner: actually java.lang.* is auto imported :P

16:13 wtetzner: so then it's an auto-imported library :)

16:13 uninverted: danlei: That's not really an option for me; I've got a weird slime/emacs setup held together with twigs and scotch tape, so updating would be hard.

16:13 clojurebot: for is not used often enough.

16:13 luis: wtetzner: a lot of the language seems to defined in terms of what's in java.lang.*; nothing wrong with that, just pointing it out.

16:13 Chousuke: luis: actually, most of it is defined in terms of clojure's own interfaces.

16:13 luis: but yeah, there are many java dependencies.

16:14 but those can be eliminated :)

16:14 luis: I'm sure they won't be hard to eliminate, sure.

16:14 kotarak: luis: In Scheme there are strings. In Clojure there are Strings. Does it matter, that Clojure uses a java.lang.String?

16:15 danlei: uninverted: hm, I've followed head for clojure-mode, swank-clojure, ccl, and slime head since ... a long time, without bigger problems at any point in time. I'd guess it's your combination/duct-tape which somehow messes things up.

16:15 stuartsierra: luis: Rich's usual answer usually goes something like, Java will remain the primary platform for Clojure in the near future. But we will try to make it easier to port to other platforms.

16:15 luis: kotarak: suppose java.lang.String is really bloated (I have no idea if it is), then it matters, right?

16:16 Chousuke: the only problem with java.lang.String is that it's final. :/

16:16 Chouser: insufficiently bloated? :-)

16:17 stuartsierra: The advantage to java.lang.String is that it's tightly integrated with the JVM, so it's generally quite efficient.

16:17 Chousuke: yeah. Though interface injection would be cool.

16:17 luis: stuartsierra: sure. Nobody is arguing that.

16:17 stuartsierra: That is, Sun knows lots of people will be using java.lang.String, so it's in their interest to make it as efficient as possible. And they can't do that if people can extend it.

16:17 But I agree interface injection would be cool.

16:18 Chousuke: it'd be really neat if it were possible to add support for new interfaces, even with the restriction that you can't add new fields.

16:18 uninverted: danlei: Probably. Does "Synchronous Lisp Evaluation Aborted" mean anything to you?

16:20 danlei: uninverted: no, sorry

16:22 stuartsierra: Would interface injection require changes to the VM, or could it be done in Clojure?

16:22 danlei: uninverted: since I'm on cygwin emacs since (a few months) I'm using swank/swank-clojure + slime-connect, maybe that does make a difference, but I don't know; no bigger problems here (despite read/read-line/... never returning in a slime repl)

16:22 Chouser: stuartsierra: it would be a jvm feature, I believe.

16:23 stuartsierra: ah, no fun then.

16:23 cemerick: stuartsierra: it's ostensibly coming in jdk 7

16:23 stuartsierra: Really? Interesting, didn't know that.

16:23 uninverted: danlei: I have the same problem with read(line) :|.

16:24 danlei: uninverted: Rich's tip: press return :D seriously: I'd love to get that fixed ...

16:24 kotarak: well, we can define an interface in terms on multimethods and then do a (derive String ::Foo), or do I get the idea of interface injection wrong (besides that would not be a java interface, of course)

16:25 cemerick: stuartsierra: or, to be clear, it's part of JSR 292, and is #4 in the MLVM priority list: http://openjdk.java.net/projects/mlvm/subprojects.html

16:25 danlei: uninverted: atm I've no idea where the problem lies (concerning read/...)

16:26 Chouser: kotarak: you're right -- clojure already has this level of flexibility for its own constructs. But if you want the speed of a java method dispatch, you need the jvm to add this support.

16:26 Chousuke: kotarak: It'd be neat to have Strings support IMeta for example.

16:26 clojurebot: for is not used enough

16:26 kotarak: Chouser: I'm happy with multimethods. :) Quite happy actually. :)

16:26 uninverted: danlei: Also, (do (print "foo") (read)) doesn't work, it reads before printing.

16:26 hiredman: it would be nice to, for instance, inject Seqable into String

16:27 Chouser: Chousuke: well, that would require a metadata field, right?

16:27 Chousuke: yeah... with no-data interface injection that wouldn't be possible I guess.

16:27 uninverted: danlei: Not just in emacs, either

16:27 hiredman: uninverted: use println

16:27 Chouser: but regex.Pattern could be IFn

16:27 Chousuke: unless you had a global metadata repository for strings.

16:27 which would be icky

16:27 danlei: uninverted: sounds like flushing problem

16:27 hiredman: uninverted: output streams need to be flushed, a newline or flush will flush

16:28 danlei: but the read/... problem has nothing to do with this (i think)

16:28 just (read) will freeze slime for me

16:28 hiredman: which read problem?

16:29 danlei: hiredman: read/read-line freeze the repl for me since a few weeks

16:29 kotarak: hiredman: a SLIME problem

16:29 * danlei nods

16:29 hiredman: uninverted: use printlnh

16:29 er

16:29 oh

16:30 yeah, you emacers chose your boat

16:30 danlei: emacs is clearly the best option, even if read is broken atm

16:30 but that's just taste, nothing to argue about

16:30 * hiredman rolls his eyes

16:31 kotarak: It wouldn't work with VimClojure also. Since Vim just sends data from a buffer. You can't pass though stdin... So no read from the buffer repl.

16:31 * kotarak disagrees. Obviously. ;)

16:31 Chousuke: I'm pretty sure slime has some tunable for that anyway :P

16:34 danlei: well, slime is kind of a fast moving target, I'm sure I could get it back to work if I just check out some version ~1month ago, but I'll just wait for the open-source-fairy :)

16:34 Chousuke: emacs has convinced me that I need a better keyboard though.

16:35 uninverted: Chousuke: How so?

16:36 Raynes: I has a Microsoft Ergonomic Keyboard.

16:37 Chousuke: well, the modifier keys are asymmetrically placed and rather small

16:37 uninverted: Raynes: Microsoft and it's keyboards are like McDonalds and Chipotle.

16:37 Chousuke: on my macbook keyboard that is.

16:37 currently I have caps lock as meta and cmd keys act as controls

16:38 * danlei doesn't understand, how caps lock as meta would be better, since the thumb has more power than the pinky, and doesn't have to move that far. (different story for caps lock/escape exchange)

16:39 Chousuke: danlei: the meta is needed less :P

16:39 danlei: hm, in emacs, I use meta all the time

16:39 Chousuke: control combos are usually more complicated

16:40 danlei: hm, ok

16:40 uninverted: I use CL as control. On my keyboard there isn't that weird gulf.

16:40 Raynes: I bet I can C-x C-f faster than Chousuke

16:40 danlei: :)

16:41 editor war avoided, keyboard layout war started :)

16:41 Chousuke: Raynes: I dunno, my right thumb rests on cmd and left index finger on f :P

16:41 stuartsierra: I love Emacs with my Kinesis Contour Dvorak, worth every penny.

16:41 Chouser: stuartsierra: that puts the modifiers under your thumbs, right?

16:42 stuartsierra: yes, all of them, plus space, backspace, delete, & enter

16:42 danlei: sounds nice

16:42 uninverted: I'd get one if not for the price and inertia.

16:43 Chouser: I'm not that discontent

16:43 Chousuke: In any case, I'm pretty much completely converted from vim nowadays :P

16:43 stuartsierra: Mine's lasted for 7-8 years, and I'm not gentle with it.

16:43 danlei: but doesn't have ALL modifiers under the thumbs make you move your whole wrist kind a lot?

16:43 * danlei googles for pictures

16:44 stuartsierra: No, the keys are clustered, so you never move your wrists at all.

16:44 http://www.kinesis-ergo.com/contoured.htm

16:44 Chousuke: emacs is just forcing me to push its limits.

16:44 stuartsierra: It does require re-learning how to type. I have tendinitis, so every little bit helps.

16:45 danlei: stuartsierra: ah, I see, really looks useful

16:45 Chousuke: with vim I never bothered to do anything beyond basic syntax highlighting because any addons were always a bother to set up :/

16:45 uninverted: I've always thought about using vim or viper-mode but I really don't type fast enough for it to be worth it.

16:46 kotarak: Relearning is so hard.... I tried NEO. (A layout especially for german). But had more trouble getting the hard-wired motions out of the way, than doing productive work. :(

16:46 Chousuke: viper mode is nice, though it doesn't agree with paredit

16:46 and paredit is pure bliss :P

16:46 kotarak: Chousuke: I found emacs plugins much harder to setup than plugins for Vim. Most just work.

16:46 danlei: kotarak: that's what keeps me from alternative layouts too

16:47 Chousuke: kotarak: Hmm. well, you know vimscript so maybe that helps :)

16:47 uninverted: kotarak: Emacs sort of requires you to learn elisp, but I don't think you really need any VimScript for vim.

16:48 Chousuke: I'm not an expert with vim, and emacs is more self-documenting.

16:48 Chouser: :w is vimscript, isn't it?

16:48 uninverted: Chouser: :)

16:48 kotarak: Chouser: hehe

16:48 danlei: I've used vi(m) for quite a long time, and was pretty assured that it rules as an editor, but when I started using (and knowing) emacs, I just thought of vi as a kind of moded keyboard-layout. the editor "system" itself is, imho, inferior. (just MY opinion and personal experience with both religions :)

16:48 kotarak: Let's say Vimscript is a super set of ex commands

16:49 Chouser: I'm willing to abandon vim for something sufficiently better. I'm just not sure emacs is that.

16:49 * danlei still uses vi now and then

16:49 rzoom: can i send an email to clojure-dev without being a member?

16:49 Chousuke: and elisp is a plus too. I can look at elisp code and understand it because it's lisp :/

16:49 Chouser: not sure I'm willing anymore to abandon vim-like key bindings.

16:49 uninverted: Chouser: You don't really have to abandon it. Look at viper-mode

16:49 Chousuke: lisps aren't fundamentally that different from each other. :P

16:49 Chouser: rzoom: I don't think so

16:49 Chousuke: at least, until you get to details.

16:50 * rzoom waits for approval then

16:50 Chouser: uninverted: I have -- it feels pretty clumsy.

16:50 kotarak: ELisp is a plus, but modal editing is better. I'm also yet to find a better alternative. Emacs definitively is not.....

16:50 Chouser: uninverted: lots of modes don't work quite.

16:51 I've been meaning to look at waterfront. anybody using that?

16:51 kotarak: I had a look at the implementation, but don't use it.

16:51 I was almost up to start cultjure. ;P Yet another project doomed to death...

16:52 uninverted: You can get something a lot like waterfront in emacs with slime and a lot of cusom keybindings.

16:52 * custom

16:52 kotarak: VimClojure is sufficient for me....

16:52 Chouser: i want something a lot like emacs in waterfront

16:52 well, in clojure.

16:52 kotarak: If just Vim had a better scripting language...

16:53 ...eg. Clojure :)

16:53 Chouser: hm... there are bindings for everything...

16:53 danlei: kotarak: Cljim? :)

16:53 kotarak: Jep. :)#

16:53 uninverted: Chouser: I agree. Clojure is just about the perfect language for an editor. A lisp that's good at string munging.

16:54 danlei: (looks like dutch)

16:55 Chouser: well, texture is my start at it. but stalled, of course, as is almost every project I start.

16:55 uninverted: Plus it would run jost about anywhere with the JVM. Imagine emacs on your phone.

16:55 hiredman: I think javascript might be a better language for scripting these days

16:56 do you really want your editor to have the jvm startup time?

16:56 uninverted: hiredman: Couldn't be slower than emacs

16:56 danlei: well, if it's a little like emacs, it wont have to start :)

16:56 *won't

16:56 JAS415: who cares about startup time?

16:57 hiredman: well, I don't use emacs, so...

16:57 JAS415: do you open and close your editor all day?

16:57 danlei: emacsclient to the rescue

16:57 JAS415: lets microbenchmark it

16:57 kotarak: JAS415: If you are a sysadming... yes

16:57 hiredman: sometimes

16:57 yeah

16:57 danlei: why shouldn't an admin use tramp?

16:58 hiredman: it depends

16:58 uninverted: vi does win for sysadmins because of its ubiquity.

16:59 danlei: that's somehow a point, if you have no other access than pysical, yes

16:59 Chousuke: a sysadmin would run emacs on his own machine and set emacsclient to connect to that instance over ssh :P

17:00 danlei: I'd just use tramp

17:00 so, basically: yes

17:01 Chousuke: or use vi, if it's some config file editing.

17:01 kotarak: If Vim just hadn't so much niceties. For example C-n completion, or C-xC-f file completion....

17:01 hiredman: and then he tries to write the config file he just edited, and it turns out the user his ssh client connected as doesn't have permissions

17:01 danlei: kotarak: ever heard of hippie-expansion?

17:02 kotarak: danlei: no

17:02 uninverted: kotarak: It's basically the best thing ever.

17:03 kotarak: uninverted: which has yet to be proven. They say the same about org-mode.

17:03 danlei: kotarak: you can add as many completion-types to it, used in the order of the list of expansions to try. bound to a convenient binding, and you wipe the bottom with C-xC-f file

17:04 kotarak: danlei: and they deliver all those fancy, super completions with their plugin? Or do they just provide the infrastructure to define them?

17:04 Chousuke: I have tabcompletion in my buffers

17:05 danlei: like: (setq hippie-expand-try-functions-list '(try-expand-dabbrev try-complete-lisp-symbol try-complete-your-grandmother) ... some are built in, some come with modes ... depends.

17:05 Chousuke: I wonder if combine ido fuzzy completion with that

17:05 kotarak: danlei: and it also learns the keywords of all open buffers?

17:06 Chousuke: though ido is pretty slow for large lists. would probably need some performance tweaking.

17:06 danlei: kotarak: depends on the completions you actually use, for the most cases: yes

17:07 kotarak: but for that, you can just use slime-complete-symbol, already does that, as far as lisps are concerned. (I especially like partial completion for lisp)

17:08 Chousuke: you already know smex?

17:08 Chousuke: nice add-on for ido, for commands

17:09 Chousuke: smex?

17:09 danlei: Chousuke: http://www.emacswiki.org/emacs/Smex

17:09 Chousuke: nothing earth-shaking, but I use ido too, and find it useful sometimes

17:10 Chousuke: hmm.

17:10 I already have ido in M-x but I guess that's a bit smarter.

17:10 ido fuzzy completion is nice but it still introduces noticeable delays when you have many matches ;/

17:11 I also typo - as . often and noticing that would be nice too :D

17:11 then I could just type cl.de or something to get clojure-mode

17:11 danlei: usually I just use partial-completion with M-x, it's still fastest for me

17:12 smex is just for exploring things, when I'm not sure what I'm looking for

17:13 (but anyway: if you already have ido completion for M-x, nothing new, I guess)

17:15 Chousuke: I wish egg had the ability to control the size of chunks when staging changes :/

17:15 but it doesn't seem straightforward to implement.

17:16 magit does it, but magit's interface is not as neat ;(

17:16 danlei: I just use vc-git atm, eshell for the rest :|

17:17 Chousuke: and magit gets confused if you name your tracking branch differently from the remote branch you track.

17:17 Anniepoo: anybody using waterfront?

17:18 Chousuke: danlei: you should try magit. it's really much nicer than git add --patch :P

17:18 danlei: Chousuke: Yes, I really should :\, maybe I'll check it out this weekend

17:18 Chousuke: the interface is really spartan though.

17:19 danlei: Well, atm I'm basically just using C-x v v and eshell -- can't get any more spartan I guess :)

17:19 Chousuke: I only found out by accident that you can specify the remote to push to with the prefix argument to P (push)

17:20 and the default faces are all grey

17:20 add some colour and it becomes much more pleasant :P

17:21 danlei: so ... would you suggest magit, or egg?

17:21 guess I should really take the time to investigate them both ...

17:22 Chousuke: danlei: well, egg is a lot easier to use but magit has more features (being able to shrink and enlarge chunks for staging is really, really nice)

17:23 magit seems better maintained too.

17:23 danlei: Chousuke: yes, that's surely a nice one

17:26 Chousuke: basic usage of magit is easy though: just do M-x magit-status, then you'll get a buffer of changed files, staged and unstaged files which you can scroll with n and p; tab will expand a file for per-chunk staging, s will stage a selected file/chunk, u unstages, and c brings up the commit message window (C-c C-c does the actual commit)

17:26 and then there are a million other features you can discover via the completely unorganised menu :P

17:27 danlei: :)

17:27 ok, thanks, I'll definetly check it out ... no more git add -p :)

17:28 Anniepoo: hmm... I'm writing a GUI editor. So far it's only edited one sort of thing. Now I'm going to add a second mode

17:28 danlei: *definitely

17:28 Anniepoo: that edits a second thing in a different way

17:28 Chousuke: egg instead has a minor mode that activates when you open a git-controlled file. then it overrides C-x v v to mean "next action" (staging modifications or committing), and C-x v s for "status" and C-x v l for history view

17:29 danlei: Chousuke: hm

17:29 Chousuke: how is it different from vc-git then?

17:29 Chousuke: that's what I can do right now ...

17:30 Chousuke: danlei: the status and history buffers have all kinds of functionality. and there's more that what I mentioned

17:30 danlei: Chousuke: ah, ok

17:30 Chousuke: sounds as if it would be an easier transition

17:30 Chousuke: but I'll have a look at magit

17:31 Chousuke: well, egg is a fork of early magit, so they share many of the key commands.

17:31 Anniepoo: I currently have a dispatch-down for the first mode. Is this a sane place for a multimethod, or am I abusing it?

17:31 Chousuke: but I wouldn't call them similar :)

17:31 danlei: :) ok, ty

17:31 Chousuke: But if egg had the ability to shrink/enlarge chunks I'd definitely use it instead of magit :/

17:32 danlei: just a matter of time, and some solution including the kitchen sink will be part of emacs proper, I guess ;)

17:33 Chousuke: heh

17:33 yeah, that's one of the nice things about emacs.

17:34 danlei: sure is :)

17:34 Chousuke: it doesn't accumulate bloat. it accumulates features.

17:34 danlei: I'd say it ... assimilates :)

17:34 * danlei chuckles

17:35 Anniepoo: I'd love to be assimilated, but couldn't get it to set up the clojure related modes

17:35 Chousuke: But you're on windows, right?

17:35 Anniepoo: yes

17:36 Chousuke: I had exactly zero problems setting up clojure-mode with clojure-install when I tried it, but I'm on OS X :/

17:36 danlei: I use cygwin emacs on windows, fire off swank-clojure + slime-connect in emacs and that pretty much does it. (everything HEAD)

17:36 devinus: Is anybody using clojure that doesn't know Java?

17:36 Chousuke: what is clojure-install ?

17:37 danlei: well ... If you exclude some mandatory course at university, I guess I don't know anything about java ;)

17:37 Chousuke: devinus: a feature of clojure-mode that downloads slime, swank, clojure and clojure-contrib for you.

17:37 Anniepoo: danlei, mind if I bug you for help on getting emacs up under cygwin?

17:37 danlei: Anniepoo: If I can help, I will, sure

17:38 Anniepoo: lovely

17:38 Chousuke: Now I have a more proper slime setup though.

17:38 I actually set up clojure as just one lisp for slime. I don't have other lisps but they would be easy to add. :P

17:40 Anniepoo: danlei, I'm on private to you, are you seeing it?

17:42 Chousuke: I actually found a nice function from clojure-swank that made setting up the proper command for clojure easy

17:42 http://github.com/Chousuke/emacs.d/blob/ec575853806e43434f92c1f28278910afd1dd96b/init-clojure.el

17:45 Licenser_: what is slime and swank?

17:46 Chousuke: SLIME is the Superior Lisp Interaction Mode for Emacs and swank is a thingy SLIME uses to talk with the actual lisp instances.

17:47 Licenser_: ah okay no use for that I'm not an EMACS person

17:47 thanks for the answer so Chousuke :)

17:47 rsynnott: it's really very nice; you should consider giving it a go

17:47 devinus: what is the META key for emacs on Macs?

17:48 Chousuke: devinus: by default, option

17:48 Licenser_: I startet out of VIM, went to TM on mac since it has a incredile nice integration here on my MAC and I tried the mac emacs port - it just does not work soo well, just as much as gvim is horrible

17:51 devinus: when i try to do M-x slime on emacs on my mac it doesn't do anything it's just trying into the file "slime"

17:52 Chousuke: slime is not included in emacs by defauly.

17:52 t

17:52 devinus: Chousuke: i know, i have everything set up. i think it's a key issue

17:54 cschreiner: devinus: I agree

17:56 devinus: so i'm using both the ctrl and alt/option keys

17:56 neither is M-x

17:58 Chousuke: hm

17:58 aquamacs?

17:58 in aquamacs it's cmd-x I thkn

17:59 esc x will work if that doesn't

18:22 Raynes: Clojure and that FlightCaster site got a slashdot. :>

18:27 devinus: can you do slime/swank/clojure-mode in aquamacs?

18:28 bitbckt: Yes.

18:28 devinus: is it the same process?

18:28 Raynes: AFAIK.

18:28 bitbckt: clojure-mode + clojure-install works in that env.

18:31 Aquamacs and Carbon Emacs both use CMD as M, by default...

18:44 devinus: wow

18:45 aquamacs with clojure-mode is a great dev environent

18:45 i don't even know emacs yet, but i get the feeling that i'll feel rather stupid thinking i could have gone my entire life as a programmer satisfied with just a text editor

18:46 bitbckt: hehe

18:49 devinus: is there a way to get a darker theme for aquamacs?

18:50 bitbckt: install the color-theme package

18:50 devinus: http://www.emacswiki.org/emacs/ColorTheme

18:59 mtd: devinus: check out the zenburn theme

19:36 cschreiner: devinus: emacs is wonderful

19:39 uninverted: Is everyone still talking about emacs? :\

19:40 bitbckt: uninverted: This *is* a Lisp-related channel... inevitable, really.

19:41 uninverted: bitbckt: All channels do inevitably gravitate to editors...

19:41 bitbckt: hehe

19:42 IRC is the event horizon of an Holy War black hole...

20:06 AWizzArd: In Compile.java in line 56: int count = args.length; Is count used at some point later?

20:20 tomoj: ,(into [] (map inc [1 2 3]))

20:20 clojurebot: [2 3 4]

20:20 tomoj: is that efficient?

20:21 guess it's still linear

20:42 Chouser: yes linear, but pretty efficient. into will use a transient vector to build up the result and do an O(1) conversion to persistent before returning it.

20:45 rhickey: why does into use (#( ... )) ?

20:54 lowlycoder: is there a good clojure/swing tutorial anywhere? I'm trying to translate: http://java.sun.com/docs/books/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start//HelloWorldSwing.java and am a bit stuck

20:54 I have (import [javax.swing JFrame JLabel ]) so far

20:55 and that's about it

20:55 tomoj: Chouser: wait, what?

20:55 I figured (map inc [1 2 3]) built up a seq, then the into has to go and copy it into a vector

20:58 dreish: tomoj: "Built up a seq" doesn't mean anything.

20:59 lowlycoder: user=> (import [javax.swing JFrame JButton JOptionPane])

20:59 java.lang.ClassNotFoundException: javax.swing (NO_SOURCE_FILE:2)

20:59 wtf ... isn't javax.swing part of standard java?

20:59 or am i missing a *.jar file

21:00 dreish: tomoj: I guess it could, if you hang on to the head, but otherwise a seq is a little closer to an iterator than a list.

21:00 tomoj: dreish: ah, yeah

21:00 dreish: lowlycoder: Try (import '(javax.swing JFrame ... etc))

21:01 lowlycoder: that worked

21:01 dreish: thanks ... but isn't [] like '() in the context of import?

21:01 i ssee the two swapped back & forh all the time

21:01 tomoj: so into has to consume the seq, where a plain map just leaves it unconsumed

21:01 dreish: No, but '() and '[] work about the same.

21:01 tomoj: lowlycoder: put your import inside an ns, then you don't have to quote anything

21:01 dreish: With [], the members of the vector are still subject to evaluation.

21:02 ,[(+ 1 2) (+ 3 4)]

21:02 clojurebot: [3 7]

21:05 lowlycoder: got it; thanks :-)

21:05 tomoj: yes, the inside namespace must have been where I saw the [] w/o the quote

21:09 tomoj: other than that, just check out the java interop section on clojure.org

21:09 and doto

21:47 ycombination: what are the advantages of clojure over Scala and JRuby?

21:48 headius: what's the advantage of peanut butter over chocolate?

21:49 ycombination: headius: not the same thing

21:49 luis: ycombination: exactly.

21:49 :-D

21:50 ycombination: luis: headius' example is not the same thing as my question.

21:50 luis: ycombination: perhaps you could be more specific in your question.

21:51 ycombination: otherwise, you should read the nice overview in Clojure's website.

21:52 ycombination: it seems to me that Scala, Clojure and jruby are popular choices for jvm based shops

21:52 tomoj: hmm. I seem to want transactions to see the snapshot of the "ref world" rather than the in-transaction values. I suspect this means I'm thinking wrongly..

21:53 luis: ycombination: apparently so.

21:53 ycombination: however I don't know enough about them to assess what are Clojure advantages and disadvantages over them... right now I'm tending towards Clojure

21:54 luis: ycombination: well, go for it. Do you know any other Lisps?

21:54 ycombination: I know Java

21:54 and C++

21:55 tomoj: if you understand the y combinator you should have no problem :)

21:55 ycombination: I learned some functional programming with Erlang

21:55 luis: ycombination: I'm sure you'll like Clojure. Get the book, have fun.

21:55 ycombination: luis: ok, programming clojure?

21:56 luis: ycombination: right.

21:57 ycombination: I'll ask slightly narrower questions then. How fast is Clojure in general? Like Common Lisp?

21:57 luis: ycombination: there are so many CL implementations. Some are quite fast. So is the JVM.

21:58 ycombination: luis: SBCL

21:58 luis: ycombination: that one's pretty fast, yeah.

21:59 ycombination: you should be fine with Clojure, I wouldn't worry about that.

21:59 ycombination: luis: coming from languages like C++ and Java, I'm not ready to a slow language like jruby.

22:00 so I wonder if Clojure is generally considered fast. I'm fine with it being 1/10 of java's speed. 1/40 would not be acceptable tough.

22:01 tomoj: even in the rare case that clojure is too slow, you can just write that part in java

22:01 ycombination: tomoj: is it that well integrated with Java?

22:01 tomoj: yep

22:01 but rich says clojure is "as fast as java"

22:01 ycombination: tomoj: so I can use any Java library I want?

22:02 tomoj: yep :)

22:02 and your clojure data structures can be passed to those libraries, etc

22:02 ycombination: that's groovy... I mean... that's clojure :D

22:02 luis: ycombination: if after profiling you find a piece of Clojure code that's not fast enough there are plenty of ways of optimizing it. Type hints, rewriting in Java, etc.

22:02 Anniepoo: public thanks to danlei, who just got me up on emacs/swank/slime/etc after an insane amount of struggle

22:03 ycombination: ok, what about IDE support? What do you recommend?

22:03 Anniepoo: though clojure tends to be fast enough if you're really in THAT much of a hurry you'll probably want to use a GPGPU CUDA program

22:04 JAS415: i think the key is to mix clojure wtih the right java libraries

22:04 then you get speed + lisp power easily

22:04 tomoj: ycombination: emacs/swank/slime/etc :)

22:04 ycombination: tomoj: oh I'm not familiar with those

22:04 tomoj: if you're not on windows it shouldn't be an "insane amount of struggle"

22:05 well, learning emacs might be a bit of a struggle...

22:05 ycombination: tomoj: I'm on MacOSX

22:05 luis: ycombination: I suppose you could start with one you're familiar with then. But soon enough you'll become an hardcore Lisper and fall in love with Emacs. :)

22:05 JAS415: there's eclipse and netbeans plugins too...

22:05 ycombination: I'm familiar with textmate, eclipse and netbeans

22:05 Anniepoo: I use IntelliJ and La Clojure

22:05 tomoj: ycombination: imo, get aquamacs emacs, the emacs starter kit, clojure-mode

22:05 JAS415: i use emacs myself

22:06 tomoj: ycombination: I might be blogging sometime soon about getting all that set up

22:06 ycombination: tomoj: I like the idea. Any tutorial to learn emacs fast?

22:07 Anniepoo: I'm just learning, found this useful

22:07 http://dsl.org/cookbook/cookbook_14.html

22:07 tomoj: I dunno of any good ones

22:08 Anniepoo: the tutorial that comes up when you start a newly installed emacs is helpful

22:09 or by ctrl-h t

22:10 ycombination: I will do that then

22:12 tomoj: ah, yes, that's how I got started

22:13 rzoom_: is rhickey the only one who can approve for the clojure-dev google group?

22:14 Chouser: rzoom_: I believe so

22:17 rzoom_: okie doke

22:18 i have a patch ready to go, just waiting for approval

22:24 Chouser: for an existing ticket?

22:26 rzoom_: no

22:26 adding not-found param to get-in

22:26 wanted to see if there was any interest

22:27 i need it for a project i am working on at work

22:27 Chouser: well, you can create a ticket on assembla. Dunno if you can attach a patch or not without membership.

22:29 rzoom_: yeah i am just a watcher

22:29 was going to just send the patch to dev-group list and see if anyone thought it was worth applying

22:29 Chouser: I think he prefers unrequested issues be brought up on one list or the other first.

22:30 I haven't figured out when to start a thread -dev vs. clojure.

22:31 rzoom_: plus i have that ssl-server patch for contrib. will send that to the list as well.

22:34 Chouser: yeah, I guess -dev's the right place for that. Sorry I can't do anything for you there.

23:02 rzoom_: Chouser, no problem. thanks for the info :)

23:50 ycombination: I built clojure.jar, how do I add it to the "classpath"?

Logging service provided by n01se.net