#clojure log - Jul 05 2010

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

0:14 Blackfoot: if i :use a namespace with :as, do its functions get put in the current namespace *in addition* to being able to refer to them with the :as symbol?

0:16 technomancy: Blackfoot: :use works with :only; :require works with :as.

0:17 well, :use might work with :as, but it's weird; better not to try it.

0:19 Blackfoot: oh man, you're right i see that in the documentation now

0:19 and you are right, it seemed to work until it stopped with weird errors

0:29 itistoday: what is the purpose of with-local-vars?

0:29 how is it different from binding?

0:30 TeXnomancy: with-local-vars is for mutable locals. it's not really ... good to use.

0:30 no idea why it's even included in Clojure, though it's a neat trick

0:31 itistoday: TeXnomancy: but aren't the locals mutable with binding?

0:31 i used set! with them in binding just fine

0:31 TeXnomancy: itistoday: binding doesn't affect locals

0:31 it only affects vars

0:31 vars and locals look like the same thing, but they are really different.

0:31 itistoday: TeXnomancy: then i must not understand the difference

0:31 TeXnomancy: locals are literally immutable

0:32 itistoday: what's the difference between a local and a var? are they two different things?

0:32 TeXnomancy: if you do something like ((fn [x] (def x 1) (println x)) 2) it will print 2

0:32 because in the context of the function, the local binding of x "wins" over the top-level var that def defines

0:33 itistoday: so why would you want to use with-local-vars?

0:33 TeXnomancy: vars are entirely a top-level thing

0:33 I can't think of a reason.

0:34 basically an identifier like x in that fn will only look for a var if the compiler determines there's no local named x in scope.

0:34 itistoday: TeXnomancy: isn't with-local-vars ... sortof defeating the purpose of a var then? essentially creating a ... local?

0:34 but a local that is a var...?

0:35 TeXnomancy: yeah. maybe you could make a case that it could be needed in some situations for performance, but I'm not sure I buy that.

0:35 itistoday: here's where rich talks about it: http://groups.google.com/group/clojure/browse_thread/thread/3c22b35f079e0de6/95fc0b334ab77c1f

0:35 TeXnomancy: in fact, in most cases it will hurt perf since vars involve one extra lookup

0:37 itistoday: i don't think he explains what its purpose for existence is there...

0:37 Blackfoot: anyway to get more than one error at a time with ./lein compile?

0:38 TeXnomancy: hah; he wrote it just so that other people wouldn't implement their own crappy version. =)

0:38 itistoday: sounds like almost just a proof-of-concept.

0:38 Blackfoot: I don't think you can get more than one error from clojure.core/compile, which lein compile uses.

0:39 Blackfoot: ok thanks

0:39 itistoday: TeXnomancy: heh, ok, hope that's all it is. really should be more documentation on it though, as it could encourage its use, and if it's not good to use it... why do that?

0:40 TeXnomancy: itistoday: if I had to guess I'd say rich would take it out if he didn't have to worry about backwards-compatibility and people complaining

0:40 but I don't want to put words in his mouth.

0:42 itistoday: TeXnomancy: maybe i should ask on the list?

0:42 TeXnomancy: if you're curious.

0:42 itistoday: i am too curious for my own good

0:43 like what's up with not=? why not != ? :-p

0:44 TeXnomancy: probably to match better with when-not, if-not, etc.

0:44 maybe to keep people from complaining it looks like perl?

0:45 itistoday: i don't think we have to worry about that! :-p

0:45 perl is horrid

0:45 * itistoday hopes no perl fans are here

0:45 * Blackfoot is here

0:45 TeXnomancy: well with the old #^{} syntax there were legitimate complaints

0:46 itistoday: i definitely agree

0:46 well, still not as bad as perl

0:46 but i'm *very* happy to see the new style in 1.2

0:47 still, it doesn't make sense to have =, and then do not=. it should be consistent. either equal & not-equal, nor != and =

0:47 s/nor/or

0:47 TeXnomancy: equal is way too long for something as fundamental as =

0:47 itistoday: i agree, so not= should be != :-)

0:48 TeXnomancy: and != is far from being universal; lots of people use ≠

0:48 itistoday: i don't even know how to type that

0:48 != is common to most imperative languages, java included

0:48 TeXnomancy: well, not programmers, but you know. =)

0:48 itistoday: every coder knows !=

0:49 TeXnomancy: I think it's nice that "(if (not (=" collapses to "(if-not (="

0:49 or rather (if (not=; either way.

0:49 Hodapp: .NE.

0:50 itistoday: yeah, i like if-not, when-not, etc. too

0:50 if-! would be weird :-)

1:03 Raynes: TeXnomancy: You know, there is a guy in #haskell called technogeeky. :o

1:03 TeXnomancy: Raynes: yeah, I used to hang out with a technoweenie too

1:04 began to get really annoyed by IRC clients who use cycling completion instead of unambiguous

1:39 itistoday: say i have a local bound to some function in some namespace, how do i get the namespace of that function?

1:39 ((fn [f] (______ f)) foo/bar) => foo

1:42 TeXnomancy: functions don't have namespaces; only vars do

1:43 itistoday: TeXnomancy: ok, well out of curiosity, how would you do it for a var?

1:44 TeXnomancy: ,((fn [f] (namespace f)) #'clojure.core/reduce)

1:44 clojurebot: java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.Named

1:46 TeXnomancy: oh cripes; I misspoke

1:46 ,(:ns (meta clojure.core/reduce))

1:46 clojurebot: nil

1:46 TeXnomancy: hmm... works fine here

1:47 itistoday: doesn't work here, i only have {:line 774}

1:47 ,(meta clojure.core/reduce)

1:47 clojurebot: {:line 774}

1:48 TeXnomancy: maybe it's fixed/broken in later/earlier versions

1:48 actually reduce is a bad example since there's definitely a bug that screws with its metadata in the latest

1:48 ,(:ns (meta clojure.core/+))

1:48 clojurebot: #<Namespace clojure.core>

1:48 TeXnomancy: dun dun dun!

1:49 itistoday: hmmm

1:49 so... this is a bug that it doesn't work for reduce?

1:50 is there a ticket for it?

1:50 TeXnomancy: it's a bug that reduce's metadata is cleared; there's at least a discussion on the mailing list

1:51 itistoday: TeXnomancy: but in my own user defined functions it doesn't list the namespace

1:52 TeXnomancy: itistoday: it works for defn; I don't think it would ever work for a fn that wasn't attached to a var since those are truly anonymous

1:52 itistoday: TeXnomancy: doesn't work for defn in the repl...

1:52 TeXnomancy: weird; works for me

1:53 (defn h []) (:ns (meta h)) ;; <= #<Namespace user>

1:53 itistoday: oh wait

1:53 it does... i see... it's cause i tested it on a function that i swapped out with alter-var-root

1:58 how do i create a new namespace and copy all the vars of another into it? (essentially copy a namespace but give it a different name)

2:00 oh, just refer

2:00 ok

2:02 TeXnomancy: refer doesn't copy the vars, it just makes them accessible

2:02 it's not transitive

2:02 there's no built-in way to do what you ask afaik

2:03 but you might look at nstools

2:03 itistoday: where's that?

2:03 oh

2:03 http://code.google.com/p/clj-nstools/

2:06 TeXnomancy: thanks, i'll add this to my list of things to explore

2:16 rubydiamond: how many of you use emacs

2:25 zmila: according to http://devender.wordpress.com/2009/12/08/what-ide-do-you-use-for-clojure/ 26%

2:25 but there was yet another poll with more voices

3:31 Bahman: I'm planning to write a business suite (accounting, inventory, sales, etc) using Clojure...

3:31 and did some research regarding its DB connectivity and came across the following:

3:31 SQL wrapper in contribs, FleetDB and MongoDB

3:31 I'm wondering which one of them is fine for my purpose?

3:32 I'd rather avoid JPA or Hibernate as the resulting code is like an awkward Java (written in Clojure). I mean I'm looking for some clojure libs.

3:32 I'd appreciate any hints/ideas.

3:38 scottj: there are several other libs for nosql dbs, couchdb is pretty popular.

3:42 SQL: olap tools (I don't know anything about them but they seem popular in business), schemas, column types, better query tools, sql.

3:47 Bahman: scottj: Thanks. Well OLAP is supposed to run on a warehouse which is not necessarily the operational database.

3:47 re query tools: you're right.

3:49 scottj: but don't most of them expect the warehouse to be SQL?

3:50 Bahman: That's right...it's none of our business...that's something the ETL processes have to worry about :-)

3:56 scottj: why are you making a new ERP system?

3:58 * Bahman wonders how scottj read his mind.

3:58 Bahman: scottj: At this stage I'm just planning but yes the goal is a business suite.

4:00 I'm and have been member of some prominent OS ERPs for about 5 years...those projects have their own pros and cons...I think I have learned from their mistakes.

4:26 LauJensen: Hopefully you learned a little from their success as well :)

4:28 Bahman: LauJensen: I have to think about that ;-)

4:32 LauJensen: I realize that the jvm can boot with a max heap size of 6Mb, but any idea how a small utility will run with that small amount of space? I imagine the jvm+clojure alone will take up more than that

5:15 Licenser: aloaeh!

5:16 LauJensen: class Bla { void main() { System.out.println(1 + 1);}} might more or less run

5:29 raek: I have a strong feeling that in clojure circles I'm going to be known as "the encoding guy"...

5:30 talios: There could be worse things to be known as.

5:46 LauJensen: yea, like 'Licenser', the guy who puts a license on everything :(((

5:47 Licenser: LauJensen: funny storry the name has nothing to do with licenses in the end :P

5:47 LauJensen: oh .. :)

5:54 Bahman: Perhaps it has all sort of things to do with license in the beginning ;-)

5:58 Licenser: Bahman: it was a typo

5:59 Bahman: When registering the nick? What was it supposed to be? Just curious :-)

5:59 Licenser: No back back back when I was young and naiv, it stuck with me since then, and seriousely noone else uses the name :P I'm the one and only Licenser on the interwebs, not many people can claim that

6:00 Bahman: I bet so!

6:08 LauJensen: Licenser: There are many names which arent in use on the internet, and there are good reasons for it :)

6:08 Licenser: But mine is cool too!

6:08 LauJensen: Lunch! :)

8:31 puredanger: why does subseq only work on sorted collections? seems like merely being a seq should be enough?

8:34 neotyk: ,(doc subseq)

8:34 clojurebot: "([sc test key] [sc start-test start-key end-test end-key]); sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true"

8:34 neotyk: puredanger: looks like there needs to be an order to create a subset

8:37 puredanger: neotyk: yeah, I can see why it needs a sorted collection in how it's defined

8:38 just wondering how the equivalent would be for a plain seq (if I'm willing to accept the O(n) perf)

8:38 maybe subvec would suffice for my needs

8:39 neotyk: and subvec is O(1)

8:43 Chousuke: puredanger: O(n) subseq can be emulated with drop and take

8:44 subseq itself is intended for quick access to ranges of stuff.

8:49 LauJensen: Interesting: http://stackoverflow.com/questions/3169051/code-golf-word-frequency-chart - Python solution in 266 characters, Scala in 592 lines :)

8:50 Hodapp: that's characters, not lines

8:51 LauJensen: Oh yea he mis-typed :)

8:52 I'll cancel the blogpost :D

8:58 puredanger: Chousuke: yeah, that's better actually (this is in a test and that's clearer)

9:52 AWizzArd: rhickey: Hello!

9:52 rhickey: Can we please have defrecord/deftype markers (empty Interface)? :-)

9:53 rhickey: AWizzArd: please submit a ticket for that

9:53 AWizzArd: ok

9:53 thank (:

9:53 +s

10:32 mitkok: hey, guys. Anyone using vimclojure

11:39 smiley-: http://stackoverflow.com/questions/3169051/code-golf-word-frequency-chart so who will write a solution in Clojure? :)

11:58 AWizzArd: ,(instance? Integer/TYPE (.length "hallo")) ; why is it false?

11:58 clojurebot: false

11:58 AWizzArd: ,*clojure-version*

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

11:59 neotyk: ,(class Integer/TYPE)

11:59 clojurebot: java.lang.Class

11:59 Blackfoot: Bahman: i have not personally used the mongodb connector, but that would be the first i look into for your application

11:59 neotyk: ,(class (.length "hallo"))

11:59 clojurebot: java.lang.Integer

12:00 arohner: AWizzArd: Integer/Type is the primitive, java.lang.Integer is the boxed class

12:05 Bahman: Blackfoot: Thanks for the hint.

12:08 AWizzArd: So, with the exception of writing Integer/TYPE directly into the code there is no way to get my hands on an unboxed primitive.

12:08 arohner: AWizzArd: locals coerced using (int x), (long x), etc are primitives

12:09 AWizzArd: what are you trying to do?

12:10 for now, primitives can only exist inside functions. Primitives are boxed crossing function boundaries, including across the boundary of (.length "hello")

12:22 AWizzArd: arohner: serialization and deserialization

12:23 arohner: AWizzArd: oh, and your library distinguishes between boxed and unboxed numbers?

12:27 AWizzArd: arohner: it may be usable from Java too.

12:28 Don't know if this ever could run into problems. Probably not.

15:27 fuchsd: Howdy! I'm new to clojure; please forgive me if this is not the correct place to ask, and feel free to tell me to rtfm (though the location of the specific fm would be helpful )

15:27 I'm coming from Python and I'm looking for something simliar to os.path.join

15:27 I have two strings and I'd like to join them to make a path in a platform-independent way

15:28 (also sorry if those msgs showed up a bunch of times; having trouble with my irc client)

15:28 Specifically, I'm trying to write a leiningen plugin, and I'd like to create a file in the project dir + a user specified dir

15:29 (using clojure 1.1)

15:30 Is there a clojure function to do this? Or a Java method maybe?

15:31 itistoday: fuchsd: http://richhickey.github.com/clojure-contrib/str-utils2-api.html

15:32 fuchsd: see the function 'join' there

15:32 boojum: fuchsd, http://java.sun.com/docs/books/tutorial/essential/environment/sysprop.html

15:33 ,(System/getProperty "file.separator")

15:33 clojurebot: java.security.AccessControlException: access denied (java.util.PropertyPermission file.separator read)

15:33 fuchsd: Awesome, that's what I'm looking for

15:34 using that join function with file.separator

15:34 Thanks!

15:34 raek: fuchsd: you can use java.io.File too

15:34 fuchsd: Nice, thanks

15:35 raek: (defn file-path [path] (reduce #(File. %1 %2) path))

15:35 I used this in one of my projects

15:35 boojum: fuchsd, also see interpose

15:35 raek: it takes a collection of path segments and joins them in a platform independent way

15:37 fuchsd: raek: thanks!

15:37 itistoday: how do i use 'use' to include only a single function from clojure.contrib.str-utils2?

15:38 raek: (ns ... (:use [clojure.contrib.str-utils2 :only (the-single-function)]))

15:38 itistoday: no, using use

15:38 (not ns)

15:44 raek: any idea?

15:45 raek: (use '[clojure.contrib.str-utils2 :only (the-single-function)])

15:45 same, but with a quote

15:45 itistoday: thanks, i was trying this: (use '(clojure.contrib.str-utils2 :only (join)))

15:46 why doesn't it work with a list?

15:47 oh i see

15:48 to use a list you have to do: (use '((clojure.contrib.str-utils2 :only (join))))

16:21 Blackfoot: proxy: Note that while method fns can

16:21 be provided to override protected methods, they have no other access

16:21 to protected members

16:21 but do they still have access to other protected methods?

16:25 hoeck: Blackfoot: no

16:26 Blackfoot: btw, gen-class circumvents this by making all protected methods public in the generated class

16:26 Blackfoot: hoeck: ok thanks, saved me a lot of time. i will use gen-class to override the protected function i'm interested in

16:30 hoeck: Blackfoot: but gen-class will not make protected final methods public

16:30 Blackfoot: ok

16:31 hoeck: got bitten by this recently

17:46 mudgen: hello

17:47 does anybody know how to load clojure.jar with a URLClassLoader ?

17:48 and have it work?

17:57 itistoday: mudgen: i'd try asking on the list

17:59 mudgen: the clojure googe group list?

18:00 icefox: noob question: I see there is a clojure 1.0 deb package with ubuntu these days, but reading around it sounds like I should compile from git, would this be correct?

18:02 kotarak: icefox: no need to compile: http://github.com/clojure/clojure/downloads

18:02 itistoday: mudgen: yes

18:09 neotyk: icefox: you could also use leiningen with [org.clojure/clojure "1.2.0-master-SNAPSHOT"]

18:09 [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"] as :dependencies

18:10 icefox: thanks, i'll read up on leiningen

18:10 neotyk: you're welcome, lein is very convenient

18:10 kotarak: icefox: clojure 1.1.0 is probably a better choice for a newbie

18:11 neotyk: kotarak: true, true

18:11 icefox: While being able to apt-get clojure seemed nice, seems like I shouldn't be on 1.0

18:11 s/be on/learn from

18:12 neotyk: icefox: usually installing jvm application from package manager is not a best idea

18:12 itistoday: reading joy of clojure, and am confused

18:12 which macro is preferred and why: http://paste.pocoo.org/show/233932/

18:13 raek: the last one

18:13 itistoday: if i had to guess i'd say the second is preferred. i'm not sure, but the first might be susceptible to variable capture, correct?

18:13 raek: yes

18:13 Chousuke: yes.

18:13 itistoday: hmmm

18:14 that should be mentioned in JoC

18:14 thanks guys

18:14 raek: (let [it 5] (awhen true (println it)))

18:14 Chousuke: but the first has the property that "it" refers to the condition's value in the body

18:14 so you can do (when it (print it))

18:15 or hm, a better example would be (awhen (some-fn) (print it))

18:15 raek: hrm, yes

18:15 itistoday: oh, i see, yeah, of course

18:15 Chousuke: it's generally considered bad style to make such macros but it's sometimes useful

18:15 itistoday: soon this will click faster, i promise :-p

18:15 raek: simply put: the first one introduces "magic variables"

18:15 itistoday: gotcha

18:16 Chousuke: the latter one does too but you don't know what they are :)

18:16 (it'll be it__2398 or something)

18:16 kotarak: proxy captures for example this

18:16 raek: so they wont accidentally collide with another one in use

18:17 Chousuke: Clojure doesn't have true unique symbols like CL though

18:17 itistoday: Chousuke: you're saying variable capture is still possible, even with gensym?

18:17 like, if i *tried* to break it? i could?

18:17 Chousuke: yes, but that's not really a problem. As long as you don't explicitly try to create a collision, none will happen :P

18:17 itistoday: hehe

18:18 i'll have to start adding __#### to my symbol names from now on, just for shits

18:18 Chousuke: you'd have to somehow figure out the state of the gensym serial number variable and calculate what the next one will be.

18:18 it's not very easy though

18:18 ,`foo#

18:18 clojurebot: foo__5001__auto__

18:18 Chousuke: ,`foo#

18:18 clojurebot: foo__5004__auto__

18:19 itistoday: looks easy enough :-)

18:19 ,`foo#

18:19 clojurebot: foo__5007__auto__

18:19 itistoday: +3 :-)

18:19 Chousuke: well, hmm

18:19 ,(+ 1 1)

18:19 clojurebot: 2

18:19 Chousuke: ,(= `foo# 'foo_5010__auto)

18:19 clojurebot: false

18:19 Chousuke: oops

18:19 ,(= `foo# 'foo__5013__auto)

18:19 clojurebot: false

18:19 Chousuke: gah, I obviously need some sleep :P

18:19 itistoday: hmmm

18:20 kotarak: ,`foo#

18:20 Chousuke: ,(= `foo# 'foo__5016__auto__)

18:20 clojurebot: false

18:20 foo__5021__auto__

18:20 Chousuke: ,(+ 1 1)

18:20 clojurebot: 2

18:20 Chousuke: ,`foo#

18:20 clojurebot: foo__5026__auto__

18:20 kotarak: ,(= `foo# `foo__5024__auto__)

18:20 clojurebot: false

18:20 itistoday: lol

18:20 Chousuke: see, evaluating anything else in the middle changes it

18:21 itistoday: ,`foo#

18:21 clojurebot: foo__5032__auto__

18:21 neotyk: ,(= `foo# `foo#)

18:21 clojurebot: false

18:21 itistoday: ?

18:21 ,`(= foo# foo#)

18:21 clojurebot: (clojure.core/= foo__5039__auto__ foo__5039__auto__)

18:22 neotyk: ,(let [f `foo#] (= f f))

18:22 clojurebot: true

18:22 itistoday: ,(prn `foo# `foo#)

18:22 clojurebot: foo__5045__auto__ foo__5046__auto__

18:22 itistoday: there's your problem

18:22 it has to be in the same syntax quote

18:23 ,(= `foo# 'foo__5049__auto__)

18:23 clojurebot: true

18:23 itistoday: i win!!! :-)

18:24 neotyk: itistoday: +1

18:24 leafw: a new kind of roulette

18:24 itistoday: :p

18:28 Blackfoot: is there a way to get more backtrace in the repl?

18:29 lein repl?

18:29 itistoday: Blackfoot: maybe ask on #leiningen?

18:30 Blackfoot: huh didn't know they had a channel

18:30 technomancy: Blackfoot: try clj-stacktrace

18:32 neotyk: technomancy: do you have idea why rober/hooke.clj is not found in lein-javac?

18:32 technomancy: neotyk: lemme see

18:33 neotyk: did you make hooke a dev-dependency of lein-javac?

18:33 neotyk: don't thinks so, lemme see

18:33 technomancy: normal deps

18:37 technomancy: with dev-deps same error

18:37 more like warning actually, as it works

18:40 this is only when building lein-javac, if I have normal deps on r/h that I don't get this warning while using plugin

19:06 itistoday: technomancy: you there?

19:06 technomancy: i think i've figured out what with-local-vars is for

19:12 why can I call set! on *warn-on-reflection* ?

19:14 chouser: itistoday: because the repl gave it a thread-local binding before giving you a prompt.

19:15 itistoday: chouser: i see, do you happen to know how it did that?

19:15 robink: lein swank using leiningen 1.2.0-RC2 doesn't seem to work.

19:15 chouser: I do, but it is a deep, deep secret.

19:15 itistoday: something like: (binding [*warn-on-reflection* false] (run-repl)) ?

19:15 robink: Too many arguments to def

19:16 chouser: itistoday: right. http://github.com/clojure/clojure/blob/4bec81db4ee4e9e4227a66bb1a04ba06e95ea9b6/src/clj/clojure/main.clj#L27

19:17 itistoday: chouser: cool, thanks!

19:22 chouser: btw, loving tJoC! making my way through it as we speak. Finishing chapter 7 currently. Only real qualm i have is the bashing of putting closing parens on their own lines at the start. :-p

19:22 robink: Ah, needed to use 1.2.1

19:23 chouser: itistoday: too early for such assertions?

19:23 itistoday: chouser: well, just based on the current version is all (i didn't think the reasons for stacking parens up is very good, to make it makes code hard to read)

19:24 s/to make/to me/

19:24 sexpbot: chouser: well, just based on the current version is all (i didn't think the reasons for stacking parens up is very good, to me it makes code hard to read)

19:24 itistoday: wow...

19:24 nice one sexpbot!

19:24 chouser: oh, you disagree with that style of code, not the way we mention it?

19:25 itistoday: chouser: "Although a familiarity with C-style languages like Java and C# will compel a new Clojure programmer to close their forms according to instinct, Lisp-like languages reject that practice as it leads only to confusion."

19:25 i don't like that sentence

19:26 i personally feel the exact opposite, and i've seen this expressed by a lot of people, though not outright usually, that stacking up parens makes Lisp code hard to read.

19:26 JoC asserts that doing it C-style "leads to confusion" but doesn't explain why

19:27 i think stacking them up makes it hard to read code, and i have good reasons for that assertion.

19:29 chouser: i have no problem with the fact that the examples in the book though use the typical paren style. i just don't like that it discourages the other style without providing reason.

19:29 chouser: ah. I'll see if we can justify it better. But I fully believe that if you stick with Clojure long enough you'll come to appreciate this style.

19:29 style.

19:31 itistoday: chouser: i'm pretty sure i won't. :-p. My eyesight, though 20/20, isn't good enough to pick apart that code sometimes without real consternation. when parens are done C-style, I can instantly understand and see where one function ends and another begins.

19:32 sometimes the separation (indentation from the left margin), is just a single space wide!

19:40 Chousuke: itistoday: the parens will feel lonely :P

19:41 itistoday: Chousuke: i understand you're joking, but the sad thing is that i've actually heard that used as a justification for it

19:42 Chousuke: itistoday: the point is that putting closing parens on their own lines just adds noise; you won't be matching them by eye anyway, as the indentation is supposed to tell you how the code is grouped

19:42 itistoday: Chousuke: An emphatic no. :-p

19:42 the parens don't "add noise". they shape the structure of the code

19:42 therefore they are very useful.

19:42 Chousuke: the parens on their own lines add noise

19:43 itistoday: no, they don't

19:43 Chousuke: yes they do :P

19:43 itistoday: do braces on their own add noise in C?

19:43 or in Java?

19:43 does 'end' add noise when it's put on its own in Ruby or Python?

19:43 or Lua?

19:43 NO.

19:43 Chousuke: No, but they're fundamentally different in those languages.

19:43 itistoday: Doesn't matter.

19:43 Chousuke: you're actually supposed to look at them, given how the language works :P

19:43 with lisp, you don't read the parens.

19:44 itistoday: maybe you don't, but i do

19:44 you don't because you stack them

19:44 Chousuke: you'll get over that.

19:44 itistoday: no, i won't

19:44 i've tried

19:44 Chousuke: yes you will

19:44 you'll have too

19:44 -o

19:44 itistoday: it's pretty arrogant of you to say that

19:44 Chousuke: you won't be able to read others' code :P

19:44 itistoday: considering you know nothing about me

19:44 Chousuke: It's not arrogant, it's just reality.

19:44 itistoday: sorry, it's your reality applied to me

19:44 in other words, your viewpoint

19:45 which is just that, a viewpoint

19:45 Chousuke: I'm not saying you won't be able to learn it, I'm saying you will have to learn it

19:45 itistoday: you don't think i've tried?

19:45 i've been coding in lisp for years now

19:46 Chousuke: At any rate, you'll be in a minority if you use parens like braces in C

19:46 itistoday: yes, for now

19:46 but i think intelligent decisions will eventually win over stupid ones

19:47 Chousuke: for ever, if I can help it :P

19:47 I think the C way just looks horrible in lisp

19:47 Blackfoot: is pr-str and eval good enough for simple map serialization?

19:47 Chousuke: and it doesn't help

19:47 itistoday: Chousuke: we'll see. :-)

19:47 mikem: Blackfoot: don't use eval, use read

19:47 Chousuke: itistoday: have you tried using a structural editor?

19:47 itistoday: like paredit.

19:48 itistoday: Chousuke: yes. i hate paredit

19:48 you know why you love paredit?

19:48 because you stack your parens

19:48 you need paredit

19:48 Chousuke: I love it because it lets me stop worrying about getting trivialities right. :P

19:48 Blackfoot: mikem: great thanks

19:49 Chousuke: It relieves me from the need to match parens, and I can just work with the structure directly.

19:49 it's much more efffective

19:49 -f

19:49 itistoday: Chousuke: but in the end your code ends up unreadable

19:50 Chousuke: except it doesn't.

19:50 because I indent properly

19:50 itistoday: can i see some examples?

19:50 if your code looks anything like the standard code it's unreadable

19:51 Chousuke: "standard code"?

19:51 itistoday: what you call the majority

19:51 Chousuke: you're just asserting that stacked parens are unreadable now

19:51 which is not the case

19:51 itistoday: you said you "indent properly"

19:51 i'd like to see what that means

19:52 if it means what i think it does, i would contend that you're not indenting properly

19:52 at least not in a way that 99% of developers understand

19:52 Chousuke: http://github.com/Chousuke/clojure/blob/clojure-reader/src/clj/clojure/lang/reader.clj

19:52 standard-ish emacs indentation

19:53 if that code is not readable, it's because it's hackish :P

19:56 itistoday: it's not as bad as some of the Lisp code that i've seen, but that's because for some reason you don't have very many instances there of ... what's the word... where a parameter to a function is used far past the function start and it ends up indented to the left of the code above it

19:56 the worst i found is line 37

19:56 but i think that's just a coincidence

19:56 that this code doesn't happen to have a lot of that

19:57 Chousuke: I don't think there's much problem with that at all

19:57 itistoday: it's unreadable

19:57 how is that not a problem?

19:57 how are you supposed to know what function those parameters belong to?

19:57 Chousuke: parameters? where?

19:58 itistoday: line 37

19:58 the call to make-rh-hepler

19:58 Chousuke: there's a just a function call at the end of a letfn block

19:58 it's pretty obvious

19:58 itistoday: it's only slightly more obvious in your code

19:58 because it happens to be in the tail position

19:58 with nothing below it

19:59 *and* because nothing else is at that indentation level

19:59 but that's not always the case

19:59 again, this is less readable than if you were to use C-style indentation

19:59 It's not clear whether make-rh-helper is inside the letfn or outside of it

19:59 what tells you it's inside of it?

20:00 Chousuke: well, first of all the fact that the code actually compiles, but the indentation does.

20:00 itistoday: lol

20:00 Chousuke: granted, that function is almost at the verge of being too long

20:00 it should be made shorter.

20:00 itistoday: ok, considering your first reason is hopefully a joke

20:00 and that you're not using compilation to determine where it is

20:01 you say indentation does

20:01 what is the indentation?

20:01 1 space

20:01 one single fucking space

20:01 Chousuke: two spaces

20:01 itistoday: oh

20:01 ok, excuse me

20:01 it's so small i can't tell

20:01 two spaces

20:02 i don't know about you, perhaps years of being forced to do this has managed to give you super reading powers

20:02 but it takes me a while to figure that out

20:02 to make *sure* it's in the function and not outside of it

20:02 and that was a relatively benign example

20:02 i've seen far worse

20:02 is that right?

20:03 that two spaces should be your only clue as to something so important?

20:03 what other language has that?

20:03 i can't think of a single one

20:03 Chousuke: if it really bothers you, you can use rainbow parens or paren highlighting

20:03 itistoday: i don't use Vi

20:03 Chousuke: neither do I :P

20:03 itistoday: the readability of your source code should *not* depend on the editor used to view it

20:03 Chousuke: I can sort of see your point, but I don't think it's a big issue

20:04 itistoday: it's a huge issue to others

20:04 not to you

20:04 but have you ever heard of people complaining about Lisp's parenthesis?

20:04 Chousuke: lisp code would look absolutely horrible with C-style braces

20:04 itistoday: haha

20:04 Chousuke: because you'd have opening and closing brackets every other line

20:04 itistoday: that's what my code looks like, and i think it's beautiful

20:04 Chousuke: a 10-line function would bloat to 30 lines

20:05 itistoday: so what, it's more readable

20:05 and you don't have to always not stack them

20:05 Chousuke: and about that I vehemently disagree :P

20:05 itistoday: this is dogma that's been drilled into you

20:05 an unfortunate decision someone made in the lisp community that has plagued it till now

20:06 no other language has indentation that does this

20:06 *every* other language has indentation rules that are clear and consisent

20:06 the spacing of the indentation in Lisp is variable!

20:06 it goes from 1 space, to over 10 spaces

20:06 Chousuke: actually, no.

20:07 indentation is either 2 spaces or aligned parameters.

20:07 2 spaces per level, that is.

20:07 itistoday: really?

20:07 what about line 26?

20:07 what is that?

20:08 it's neither 2 spaces

20:08 nor aligned with the paraemters

20:08 Chousuke: it actually is

20:08 the vector is considered a parameter.

20:08 but I think that's an emacs fail more likely

20:09 it should indent two spaces after (add-char

20:09 itistoday: what about line 169, or 166?

20:09 or fuck, 168!

20:09 that's 1 space!

20:09 haha

20:10 see? your indentation is bonkers

20:10 Chousuke: seems like it is.

20:11 169 and 166 are fine though

20:12 itistoday: oh you're right, the ( on 26 looked like it was 1 space farther

20:12 anyway, that's not the big issue

20:12 the big issue is that i can't tell what parameters belong to what functions

20:12 and neither can anyone else coming to lisp, or using it for several months

20:13 to be able to quickly discern that sort of thing has to take some serious training

20:13 Chousuke: I think that if it's a problem then you perhaps need to restructure the code.

20:14 itistoday: yes, it's a problem with how the code is structured

20:14 which is why i'm encouraging you to restructure it and indent it properly :-P

20:14 Chousuke: mind, I'm talking about the structure, not the text :P

20:15 I think the paren-stacking became the norm because you're not supposed to pay attention to the text

20:16 itistoday: i have no idea what you mean by that

20:16 i pay attention to my code

20:16 Chousuke: but I suppose closing parens on their own line might in some cases communicate the structure better.

20:16 itistoday: otherwise it breaks

20:16 Chousuke: but I'd rather use a comment instead ;P

20:17 itistoday: Chousuke: i think it always communicates the structure better.

20:17 http://github.com/taoeffect/dragonfly-newlisp/blob/master/example-site/dragonfly-framework/plugins-inactive/db/database_orm.lsp

20:18 but i suppose if you're used to stacking them, that will look terrible

20:18 Chousuke: well, for most of those functions it's simply unnecessary :P

20:19 itistoday: yeah they're mostly short, but 'create-dbobj' is a good example i think

20:20 and notice how it's readable on github, without syntax highlighting or rainbow parens or paren matching or any other fancy editor things

20:20 it's just readable

20:20 Chousuke: and some of them are difficult to read anyway because you have things like (first (dbobj-assoc-rows obj:db obj:table (map first obj:revert-set) obj:finder 1)) on a single line

20:21 itistoday: it takes a lot of arguments...

20:21 would you suggest putting them each on their own line?

20:22 Chousuke: yes? It helps a lot.

20:22 especially when the arguments look very similar

20:22 itistoday: ok, i could agree with that :-)

20:22 Chousuke: (the obj: stuff)

20:32 robink: Is there a way to remove the 'versions differ' warning in SLIME?

20:36 itistoday: robink: if you find out please let me know :-D

20:39 robink: itistoday: Heh, 'k :-)

20:41 itistoday: Chousuke: btw, if you don't read parens in Lisp why don't you set their color to the background color and be down with it?

20:42 referring to this: "with lisp, you don't read the parens."

20:43 s/down/done/

20:44 foooooo

20:44 s/o+/o/

20:44 sexpbot: fo

20:44 itistoday: foooooo

20:44 p

20:44 s/o+/o/

20:44 ah... of course, only the previous comment

21:02 arohner: how do you mvn install a clojure.jar built from scratch?

21:03 'ant' correctly produces a usable clojure.jar, but 'mvn install' builds an unusable jar, and then installs it

21:07 itistoday: arohner: mvn install:install-file -DgroupId=org.clojure -DartifactId=clojure -Dversion=1.2.0-master-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

21:07 i think

21:08 arohner: 0 guarantee that will work

21:08 arohner: itistoday: that's at least close enough to get me started. Thanks

21:08 itistoday: np

21:09 arohner: let me know if it works :-)

21:25 bortreb: arohner: if you built it yourself, you might consider specifying a different groupId

21:34 dabd: Is clojure 1.2.0 going to support annotations?

21:56 chouser: dabd: I think so, in defrecord and gen-class IIRC

22:19 dabd: chouser: thx

22:22 mudge: hey, are there any clojure t-shirts or hats?

22:25 when is this irc channel busy?

22:25 cad_from_austin: Quick question - a query to mysql for a datacount is returning this map - {:count(*) theNum}

22:25 How do I get the number?

22:29 _mst: (themap (keyword "count(*)")) would work, but it's a bit gross :)

22:30 I'd be tempted to modify the sql to do a select count(*) as thecount, and then use :thecount

22:31 cad_from_austin: Mmmm... that makes sense. Thank you _mst

22:45 arohner: mudge: it's probably busiest weekday mornings (american time)

23:11 chouser: mudge: http://www.zazzle.com/clojure

23:17 itistoday: chouser: thanks to your link, I was lol'd in memory at this: http://www.youtube.com/watch?v=JCjs-QhJYcs <- https://encrypted.google.com/search?q=ich+bin+ein+nerd <- http://www.zazzle.com/ich_bin_ein_nerd_tshirt-235025057064586625

23:19 (don't know if you've seen the show though, it's great)

23:20 a better clip: http://www.youtube.com/watch?v=3C4PqyH6Ga4

23:41 cais2002: a quick question, in REPL, how do I cancel a line that's half-typed. in shell/cmd, I can do Ctrl+C. but doing that on REPL will terminate the REPL

23:54 itistoday: cais2002: C-a C-k is what i do

23:55 cais2002: itistoday, does not seem to work

23:56 itistoday: cais2002: i guess it depends on where your repl is. I use OS X's terminal, which supports some emacs bindings

23:56 cais2002: right.. i am on Win7, unfortunately

23:57 I had to spend quite some time to change leiningen to work in Win7

23:57 itistoday: have you considered installing ubuntu?

Logging service provided by n01se.net