#clojure logs

2010-07-05

00:14Blackfootif 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?
00:16technomancyBlackfoot: :use works with :only; :require works with :as.
00:17technomancywell, :use might work with :as, but it's weird; better not to try it.
00:19Blackfootoh man, you're right i see that in the documentation now
00:19Blackfootand you are right, it seemed to work until it stopped with weird errors
00:29itistodaywhat is the purpose of with-local-vars?
00:29itistodayhow is it different from binding?
00:30TeXnomancywith-local-vars is for mutable locals. it's not really ... good to use.
00:30TeXnomancyno idea why it's even included in Clojure, though it's a neat trick
00:31itistodayTeXnomancy: but aren't the locals mutable with binding?
00:31itistodayi used set! with them in binding just fine
00:31TeXnomancyitistoday: binding doesn't affect locals
00:31TeXnomancyit only affects vars
00:31TeXnomancyvars and locals look like the same thing, but they are really different.
00:31itistodayTeXnomancy: then i must not understand the difference
00:31TeXnomancylocals are literally immutable
00:32itistodaywhat's the difference between a local and a var? are they two different things?
00:32TeXnomancyif you do something like ((fn [x] (def x 1) (println x)) 2) it will print 2
00:32TeXnomancybecause in the context of the function, the local binding of x "wins" over the top-level var that def defines
00:33itistodayso why would you want to use with-local-vars?
00:33TeXnomancyvars are entirely a top-level thing
00:33TeXnomancyI can't think of a reason.
00:34TeXnomancybasically 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.
00:34itistodayTeXnomancy: isn't with-local-vars ... sortof defeating the purpose of a var then? essentially creating a ... local?
00:34itistodaybut a local that is a var...?
00:35TeXnomancyyeah. maybe you could make a case that it could be needed in some situations for performance, but I'm not sure I buy that.
00:35itistodayhere's where rich talks about it: http://groups.google.com/group/clojure/browse_thread/thread/3c22b35f079e0de6/95fc0b334ab77c1f
00:35TeXnomancyin fact, in most cases it will hurt perf since vars involve one extra lookup
00:37itistodayi don't think he explains what its purpose for existence is there...
00:37Blackfootanyway to get more than one error at a time with ./lein compile?
00:38TeXnomancyhah; he wrote it just so that other people wouldn't implement their own crappy version. =)
00:38TeXnomancyitistoday: sounds like almost just a proof-of-concept.
00:38TeXnomancyBlackfoot: I don't think you can get more than one error from clojure.core/compile, which lein compile uses.
00:39Blackfootok thanks
00:39itistodayTeXnomancy: 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?
00:40TeXnomancyitistoday: 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
00:40TeXnomancybut I don't want to put words in his mouth.
00:42itistodayTeXnomancy: maybe i should ask on the list?
00:42TeXnomancyif you're curious.
00:42itistodayi am too curious for my own good
00:43itistodaylike what's up with not=? why not != ? :-p
00:44TeXnomancyprobably to match better with when-not, if-not, etc.
00:44TeXnomancymaybe to keep people from complaining it looks like perl?
00:45itistodayi don't think we have to worry about that! :-p
00:45itistodayperl is horrid
00:45TeXnomancywell with the old #^{} syntax there were legitimate complaints
00:46itistodayi definitely agree
00:46itistodaywell, still not as bad as perl
00:46itistodaybut i'm *very* happy to see the new style in 1.2
00:47itistodaystill, it doesn't make sense to have =, and then do not=. it should be consistent. either equal & not-equal, nor != and =
00:47itistodays/nor/or
00:47TeXnomancyequal is way too long for something as fundamental as =
00:47itistodayi agree, so not= should be != :-)
00:48TeXnomancyand != is far from being universal; lots of people use ≠
00:48itistodayi don't even know how to type that
00:48itistoday!= is common to most imperative languages, java included
00:48TeXnomancywell, not programmers, but you know. =)
00:48itistodayevery coder knows !=
00:49TeXnomancyI think it's nice that "(if (not (=" collapses to "(if-not (="
00:49TeXnomancyor rather (if (not=; either way.
00:49Hodapp.NE.
00:50itistodayyeah, i like if-not, when-not, etc. too
00:50itistodayif-! would be weird :-)
01:03RaynesTeXnomancy: You know, there is a guy in #haskell called technogeeky. :o
01:03TeXnomancyRaynes: yeah, I used to hang out with a technoweenie too
01:04TeXnomancybegan to get really annoyed by IRC clients who use cycling completion instead of unambiguous
01:39itistodaysay i have a local bound to some function in some namespace, how do i get the namespace of that function?
01:39itistoday((fn [f] (______ f)) foo/bar) => foo
01:42TeXnomancyfunctions don't have namespaces; only vars do
01:43itistodayTeXnomancy: ok, well out of curiosity, how would you do it for a var?
01:44TeXnomancy,((fn [f] (namespace f)) #'clojure.core/reduce)
01:44clojurebotjava.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.Named
01:46TeXnomancyoh cripes; I misspoke
01:46TeXnomancy,(:ns (meta clojure.core/reduce))
01:46clojurebotnil
01:46TeXnomancyhmm... works fine here
01:47itistodaydoesn't work here, i only have {:line 774}
01:47itistoday,(meta clojure.core/reduce)
01:47clojurebot{:line 774}
01:48TeXnomancymaybe it's fixed/broken in later/earlier versions
01:48TeXnomancyactually reduce is a bad example since there's definitely a bug that screws with its metadata in the latest
01:48TeXnomancy,(:ns (meta clojure.core/+))
01:48clojurebot#<Namespace clojure.core>
01:48TeXnomancydun dun dun!
01:49itistodayhmmm
01:49itistodayso... this is a bug that it doesn't work for reduce?
01:50itistodayis there a ticket for it?
01:50TeXnomancyit's a bug that reduce's metadata is cleared; there's at least a discussion on the mailing list
01:51itistodayTeXnomancy: but in my own user defined functions it doesn't list the namespace
01:52TeXnomancyitistoday: 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
01:52itistodayTeXnomancy: doesn't work for defn in the repl...
01:52TeXnomancyweird; works for me
01:53TeXnomancy(defn h []) (:ns (meta h)) ;; <= #<Namespace user>
01:53itistodayoh wait
01:53itistodayit does... i see... it's cause i tested it on a function that i swapped out with alter-var-root
01:58itistodayhow 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)
02:00itistodayoh, just refer
02:00itistodayok
02:02TeXnomancyrefer doesn't copy the vars, it just makes them accessible
02:02TeXnomancyit's not transitive
02:02TeXnomancythere's no built-in way to do what you ask afaik
02:03TeXnomancybut you might look at nstools
02:03itistodaywhere's that?
02:03itistodayoh
02:03itistodayhttp://code.google.com/p/clj-nstools/
02:06itistodayTeXnomancy: thanks, i'll add this to my list of things to explore
02:16rubydiamondhow many of you use emacs
02:25zmilaaccording to http://devender.wordpress.com/2009/12/08/what-ide-do-you-use-for-clojure/ 26%
02:25zmilabut there was yet another poll with more voices
03:31BahmanI'm planning to write a business suite (accounting, inventory, sales, etc) using Clojure...
03:31Bahmanand did some research regarding its DB connectivity and came across the following:
03:31BahmanSQL wrapper in contribs, FleetDB and MongoDB
03:31BahmanI'm wondering which one of them is fine for my purpose?
03:32BahmanI'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.
03:32BahmanI'd appreciate any hints/ideas.
03:38scottjthere are several other libs for nosql dbs, couchdb is pretty popular.
03:42scottjSQL: olap tools (I don't know anything about them but they seem popular in business), schemas, column types, better query tools, sql.
03:47Bahmanscottj: Thanks. Well OLAP is supposed to run on a warehouse which is not necessarily the operational database.
03:47Bahmanre query tools: you're right.
03:49scottjbut don't most of them expect the warehouse to be SQL?
03:50BahmanThat's right...it's none of our business...that's something the ETL processes have to worry about :-)
03:56scottjwhy are you making a new ERP system?
03:58Bahmanscottj: At this stage I'm just planning but yes the goal is a business suite.
04:00BahmanI'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.
04:26LauJensenHopefully you learned a little from their success as well :)
04:28BahmanLauJensen: I have to think about that ;-)
04:32LauJensenI 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
05:15Licenseraloaeh!
05:16LicenserLauJensen: class Bla { void main() { System.out.println(1 + 1);}} might more or less run
05:29raekI have a strong feeling that in clojure circles I'm going to be known as "the encoding guy"...
05:30taliosThere could be worse things to be known as.
05:46LauJensenyea, like 'Licenser', the guy who puts a license on everything :(((
05:47LicenserLauJensen: funny storry the name has nothing to do with licenses in the end :P
05:47LauJensenoh .. :)
05:54BahmanPerhaps it has all sort of things to do with license in the beginning ;-)
05:58LicenserBahman: it was a typo
05:59BahmanWhen registering the nick? What was it supposed to be? Just curious :-)
05:59LicenserNo 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
06:00BahmanI bet so!
06:08LauJensenLicenser: There are many names which arent in use on the internet, and there are good reasons for it :)
06:08LicenserBut mine is cool too!
06:08LauJensenLunch! :)
08:31puredangerwhy does subseq only work on sorted collections? seems like merely being a seq should be enough?
08:34neotyk,(doc subseq)
08:34clojurebot"([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"
08:34neotykpuredanger: looks like there needs to be an order to create a subset
08:37puredangerneotyk: yeah, I can see why it needs a sorted collection in how it's defined
08:38puredangerjust wondering how the equivalent would be for a plain seq (if I'm willing to accept the O(n) perf)
08:38puredangermaybe subvec would suffice for my needs
08:39neotykand subvec is O(1)
08:43Chousukepuredanger: O(n) subseq can be emulated with drop and take
08:44Chousukesubseq itself is intended for quick access to ranges of stuff.
08:49LauJensenInteresting: http://stackoverflow.com/questions/3169051/code-golf-word-frequency-chart - Python solution in 266 characters, Scala in 592 lines :)
08:50Hodappthat's characters, not lines
08:51LauJensenOh yea he mis-typed :)
08:52LauJensenI'll cancel the blogpost :D
08:58puredangerChousuke: yeah, that's better actually (this is in a test and that's clearer)
09:52AWizzArdrhickey: Hello!
09:52AWizzArdrhickey: Can we please have defrecord/deftype markers (empty Interface)? :-)
09:53rhickeyAWizzArd: please submit a ticket for that
09:53AWizzArdok
09:53AWizzArdthank (:
09:53AWizzArd+s
10:32mitkokhey, guys. Anyone using vimclojure
11:39smiley-http://stackoverflow.com/questions/3169051/code-golf-word-frequency-chart so who will write a solution in Clojure? :)
11:58AWizzArd,(instance? Integer/TYPE (.length "hallo")) ; why is it false?
11:58clojurebotfalse
11:58AWizzArd,*clojure-version*
11:58clojurebot{:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"}
11:59neotyk,(class Integer/TYPE)
11:59clojurebotjava.lang.Class
11:59BlackfootBahman: i have not personally used the mongodb connector, but that would be the first i look into for your application
11:59neotyk,(class (.length "hallo"))
11:59clojurebotjava.lang.Integer
12:00arohnerAWizzArd: Integer/Type is the primitive, java.lang.Integer is the boxed class
12:05BahmanBlackfoot: Thanks for the hint.
12:08AWizzArdSo, with the exception of writing Integer/TYPE directly into the code there is no way to get my hands on an unboxed primitive.
12:08arohnerAWizzArd: locals coerced using (int x), (long x), etc are primitives
12:09arohnerAWizzArd: what are you trying to do?
12:10arohnerfor now, primitives can only exist inside functions. Primitives are boxed crossing function boundaries, including across the boundary of (.length "hello")
12:22AWizzArdarohner: serialization and deserialization
12:23arohnerAWizzArd: oh, and your library distinguishes between boxed and unboxed numbers?
12:27AWizzArdarohner: it may be usable from Java too.
12:28AWizzArdDon't know if this ever could run into problems. Probably not.
15:27fuchsdHowdy! 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:27fuchsdI'm coming from Python and I'm looking for something simliar to os.path.join
15:27fuchsdI have two strings and I'd like to join them to make a path in a platform-independent way
15:28fuchsd(also sorry if those msgs showed up a bunch of times; having trouble with my irc client)
15:28fuchsdSpecifically, 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:29fuchsd(using clojure 1.1)
15:30fuchsdIs there a clojure function to do this? Or a Java method maybe?
15:31itistodayfuchsd: http://richhickey.github.com/clojure-contrib/str-utils2-api.html
15:32itistodayfuchsd: see the function 'join' there
15:32boojumfuchsd, http://java.sun.com/docs/books/tutorial/essential/environment/sysprop.html
15:33boojum,(System/getProperty "file.separator")
15:33clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission file.separator read)
15:33fuchsdAwesome, that's what I'm looking for
15:34fuchsdusing that join function with file.separator
15:34fuchsdThanks!
15:34raekfuchsd: you can use java.io.File too
15:34fuchsdNice, thanks
15:35raek(defn file-path [path] (reduce #(File. %1 %2) path))
15:35raekI used this in one of my projects
15:35boojumfuchsd, also see interpose
15:35raekit takes a collection of path segments and joins them in a platform independent way
15:37fuchsdraek: thanks!
15:37itistodayhow do i use 'use' to include only a single function from clojure.contrib.str-utils2?
15:38raek(ns ... (:use [clojure.contrib.str-utils2 :only (the-single-function)]))
15:38itistodayno, using use
15:38itistoday(not ns)
15:44itistodayraek: any idea?
15:45raek(use '[clojure.contrib.str-utils2 :only (the-single-function)])
15:45raeksame, but with a quote
15:45itistodaythanks, i was trying this: (use '(clojure.contrib.str-utils2 :only (join)))
15:46itistodaywhy doesn't it work with a list?
15:47itistodayoh i see
15:48itistodayto use a list you have to do: (use '((clojure.contrib.str-utils2 :only (join))))
16:21Blackfootproxy: Note that while method fns can
16:21Blackfootbe provided to override protected methods, they have no other access
16:21Blackfootto protected members
16:21Blackfootbut do they still have access to other protected methods?
16:25hoeckBlackfoot: no
16:26hoeckBlackfoot: btw, gen-class circumvents this by making all protected methods public in the generated class
16:26Blackfoothoeck: ok thanks, saved me a lot of time. i will use gen-class to override the protected function i'm interested in
16:30hoeckBlackfoot: but gen-class will not make protected final methods public
16:30Blackfootok
16:31hoeckgot bitten by this recently
17:46mudgenhello
17:47mudgendoes anybody know how to load clojure.jar with a URLClassLoader ?
17:48mudgenand have it work?
17:57itistodaymudgen: i'd try asking on the list
17:59mudgenthe clojure googe group list?
18:00icefoxnoob 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:02kotarakicefox: no need to compile: http://github.com/clojure/clojure/downloads
18:02itistodaymudgen: yes
18:09neotykicefox: you could also use leiningen with [org.clojure/clojure "1.2.0-master-SNAPSHOT"]
18:09neotyk [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"] as :dependencies
18:10icefoxthanks, i'll read up on leiningen
18:10neotykyou're welcome, lein is very convenient
18:10kotarakicefox: clojure 1.1.0 is probably a better choice for a newbie
18:11neotykkotarak: true, true
18:11icefoxWhile being able to apt-get clojure seemed nice, seems like I shouldn't be on 1.0
18:11icefoxs/be on/learn from
18:12neotykicefox: usually installing jvm application from package manager is not a best idea
18:12itistodayreading joy of clojure, and am confused
18:12itistodaywhich macro is preferred and why: http://paste.pocoo.org/show/233932/
18:13raekthe last one
18:13itistodayif 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:13raekyes
18:13Chousukeyes.
18:13itistodayhmmm
18:14itistodaythat should be mentioned in JoC
18:14itistodaythanks guys
18:14raek(let [it 5] (awhen true (println it)))
18:14Chousukebut the first has the property that "it" refers to the condition's value in the body
18:14Chousukeso you can do (when it (print it))
18:15Chousukeor hm, a better example would be (awhen (some-fn) (print it))
18:15raekhrm, yes
18:15itistodayoh, i see, yeah, of course
18:15Chousukeit's generally considered bad style to make such macros but it's sometimes useful
18:15itistodaysoon this will click faster, i promise :-p
18:15raeksimply put: the first one introduces "magic variables"
18:15itistodaygotcha
18:16Chousukethe latter one does too but you don't know what they are :)
18:16Chousuke(it'll be it__2398 or something)
18:16kotarakproxy captures for example this
18:16raekso they wont accidentally collide with another one in use
18:17ChousukeClojure doesn't have true unique symbols like CL though
18:17itistodayChousuke: you're saying variable capture is still possible, even with gensym?
18:17itistodaylike, if i *tried* to break it? i could?
18:17Chousukeyes, but that's not really a problem. As long as you don't explicitly try to create a collision, none will happen :P
18:17itistodayhehe
18:18itistodayi'll have to start adding __#### to my symbol names from now on, just for shits
18:18Chousukeyou'd have to somehow figure out the state of the gensym serial number variable and calculate what the next one will be.
18:18Chousukeit's not very easy though
18:18Chousuke,`foo#
18:18clojurebotfoo__5001__auto__
18:18Chousuke,`foo#
18:18clojurebotfoo__5004__auto__
18:19itistodaylooks easy enough :-)
18:19itistoday,`foo#
18:19clojurebotfoo__5007__auto__
18:19itistoday+3 :-)
18:19Chousukewell, hmm
18:19Chousuke,(+ 1 1)
18:19clojurebot2
18:19Chousuke,(= `foo# 'foo_5010__auto)
18:19clojurebotfalse
18:19Chousukeoops
18:19Chousuke,(= `foo# 'foo__5013__auto)
18:19clojurebotfalse
18:19Chousukegah, I obviously need some sleep :P
18:19itistodayhmmm
18:20kotarak,`foo#
18:20Chousuke,(= `foo# 'foo__5016__auto__)
18:20clojurebotfalse
18:20clojurebotfoo__5021__auto__
18:20Chousuke,(+ 1 1)
18:20clojurebot2
18:20Chousuke,`foo#
18:20clojurebotfoo__5026__auto__
18:20kotarak,(= `foo# `foo__5024__auto__)
18:20clojurebotfalse
18:20itistodaylol
18:20Chousukesee, evaluating anything else in the middle changes it
18:21itistoday,`foo#
18:21clojurebotfoo__5032__auto__
18:21neotyk,(= `foo# `foo#)
18:21clojurebotfalse
18:21itistoday?
18:21itistoday,`(= foo# foo#)
18:21clojurebot(clojure.core/= foo__5039__auto__ foo__5039__auto__)
18:22neotyk,(let [f `foo#] (= f f))
18:22clojurebottrue
18:22itistoday,(prn `foo# `foo#)
18:22clojurebotfoo__5045__auto__ foo__5046__auto__
18:22itistodaythere's your problem
18:22itistodayit has to be in the same syntax quote
18:23itistoday,(= `foo# 'foo__5049__auto__)
18:23clojurebottrue
18:23itistodayi win!!! :-)
18:24neotykitistoday: +1
18:24leafwa new kind of roulette
18:24itistoday:p
18:28Blackfootis there a way to get more backtrace in the repl?
18:29Blackfootlein repl?
18:29itistodayBlackfoot: maybe ask on #leiningen?
18:30Blackfoothuh didn't know they had a channel
18:30technomancyBlackfoot: try clj-stacktrace
18:32neotyktechnomancy: do you have idea why rober/hooke.clj is not found in lein-javac?
18:32technomancyneotyk: lemme see
18:33technomancyneotyk: did you make hooke a dev-dependency of lein-javac?
18:33neotykdon't thinks so, lemme see
18:33neotyktechnomancy: normal deps
18:37neotyktechnomancy: with dev-deps same error
18:37neotykmore like warning actually, as it works
18:40neotykthis 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:06itistodaytechnomancy: you there?
19:06itistodaytechnomancy: i think i've figured out what with-local-vars is for
19:12itistodaywhy can I call set! on *warn-on-reflection* ?
19:14chouseritistoday: because the repl gave it a thread-local binding before giving you a prompt.
19:15itistodaychouser: i see, do you happen to know how it did that?
19:15robinklein swank using leiningen 1.2.0-RC2 doesn't seem to work.
19:15chouserI do, but it is a deep, deep secret.
19:15itistodaysomething like: (binding [*warn-on-reflection* false] (run-repl)) ?
19:15robinkToo many arguments to def
19:16chouseritistoday: right. http://github.com/clojure/clojure/blob/4bec81db4ee4e9e4227a66bb1a04ba06e95ea9b6/src/clj/clojure/main.clj#L27
19:17itistodaychouser: cool, thanks!
19:22itistodaychouser: 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:22robinkAh, needed to use 1.2.1
19:23chouseritistoday: too early for such assertions?
19:23itistodaychouser: 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:24itistodays/to make/to me/
19:24sexpbotchouser: 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:24itistodaywow...
19:24itistodaynice one sexpbot!
19:24chouseroh, you disagree with that style of code, not the way we mention it?
19:25itistodaychouser: "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:25itistodayi don't like that sentence
19:26itistodayi 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:26itistodayJoC asserts that doing it C-style "leads to confusion" but doesn't explain why
19:27itistodayi think stacking them up makes it hard to read code, and i have good reasons for that assertion.
19:29itistodaychouser: 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:29chouserah. 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:29chouserstyle.
19:31itistodaychouser: 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:32itistodaysometimes the separation (indentation from the left margin), is just a single space wide!
19:40Chousukeitistoday: the parens will feel lonely :P
19:41itistodayChousuke: i understand you're joking, but the sad thing is that i've actually heard that used as a justification for it
19:42Chousukeitistoday: 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:42itistodayChousuke: An emphatic no. :-p
19:42itistodaythe parens don't "add noise". they shape the structure of the code
19:42itistodaytherefore they are very useful.
19:42Chousukethe parens on their own lines add noise
19:43itistodayno, they don't
19:43Chousukeyes they do :P
19:43itistodaydo braces on their own add noise in C?
19:43itistodayor in Java?
19:43itistodaydoes 'end' add noise when it's put on its own in Ruby or Python?
19:43itistodayor Lua?
19:43itistodayNO.
19:43ChousukeNo, but they're fundamentally different in those languages.
19:43itistodayDoesn't matter.
19:43Chousukeyou're actually supposed to look at them, given how the language works :P
19:43Chousukewith lisp, you don't read the parens.
19:44itistodaymaybe you don't, but i do
19:44itistodayyou don't because you stack them
19:44Chousukeyou'll get over that.
19:44itistodayno, i won't
19:44itistodayi've tried
19:44Chousukeyes you will
19:44Chousukeyou'll have too
19:44Chousuke-o
19:44itistodayit's pretty arrogant of you to say that
19:44Chousukeyou won't be able to read others' code :P
19:44itistodayconsidering you know nothing about me
19:44ChousukeIt's not arrogant, it's just reality.
19:44itistodaysorry, it's your reality applied to me
19:44itistodayin other words, your viewpoint
19:45itistodaywhich is just that, a viewpoint
19:45ChousukeI'm not saying you won't be able to learn it, I'm saying you will have to learn it
19:45itistodayyou don't think i've tried?
19:45itistodayi've been coding in lisp for years now
19:46ChousukeAt any rate, you'll be in a minority if you use parens like braces in C
19:46itistodayyes, for now
19:46itistodaybut i think intelligent decisions will eventually win over stupid ones
19:47Chousukefor ever, if I can help it :P
19:47ChousukeI think the C way just looks horrible in lisp
19:47Blackfootis pr-str and eval good enough for simple map serialization?
19:47Chousukeand it doesn't help
19:47itistodayChousuke: we'll see. :-)
19:47mikemBlackfoot: don't use eval, use read
19:47Chousukeitistoday: have you tried using a structural editor?
19:47Chousukeitistoday: like paredit.
19:48itistodayChousuke: yes. i hate paredit
19:48itistodayyou know why you love paredit?
19:48itistodaybecause you stack your parens
19:48itistodayyou need paredit
19:48ChousukeI love it because it lets me stop worrying about getting trivialities right. :P
19:48Blackfootmikem: great thanks
19:49ChousukeIt relieves me from the need to match parens, and I can just work with the structure directly.
19:49Chousukeit's much more efffective
19:49Chousuke-f
19:49itistodayChousuke: but in the end your code ends up unreadable
19:50Chousukeexcept it doesn't.
19:50Chousukebecause I indent properly
19:50itistodaycan i see some examples?
19:50itistodayif your code looks anything like the standard code it's unreadable
19:51Chousuke"standard code"?
19:51itistodaywhat you call the majority
19:51Chousukeyou're just asserting that stacked parens are unreadable now
19:51Chousukewhich is not the case
19:51itistodayyou said you "indent properly"
19:51itistodayi'd like to see what that means
19:52itistodayif it means what i think it does, i would contend that you're not indenting properly
19:52itistodayat least not in a way that 99% of developers understand
19:52Chousukehttp://github.com/Chousuke/clojure/blob/clojure-reader/src/clj/clojure/lang/reader.clj
19:52Chousukestandard-ish emacs indentation
19:53Chousukeif that code is not readable, it's because it's hackish :P
19:56itistodayit'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:56itistodaythe worst i found is line 37
19:56itistodaybut i think that's just a coincidence
19:56itistodaythat this code doesn't happen to have a lot of that
19:57ChousukeI don't think there's much problem with that at all
19:57itistodayit's unreadable
19:57itistodayhow is that not a problem?
19:57itistodayhow are you supposed to know what function those parameters belong to?
19:57Chousukeparameters? where?
19:58itistodayline 37
19:58itistodaythe call to make-rh-hepler
19:58Chousukethere's a just a function call at the end of a letfn block
19:58Chousukeit's pretty obvious
19:58itistodayit's only slightly more obvious in your code
19:58itistodaybecause it happens to be in the tail position
19:58itistodaywith nothing below it
19:59itistoday*and* because nothing else is at that indentation level
19:59itistodaybut that's not always the case
19:59itistodayagain, this is less readable than if you were to use C-style indentation
19:59itistodayIt's not clear whether make-rh-helper is inside the letfn or outside of it
19:59itistodaywhat tells you it's inside of it?
20:00Chousukewell, first of all the fact that the code actually compiles, but the indentation does.
20:00itistodaylol
20:00Chousukegranted, that function is almost at the verge of being too long
20:00Chousukeit should be made shorter.
20:00itistodayok, considering your first reason is hopefully a joke
20:00itistodayand that you're not using compilation to determine where it is
20:01itistodayyou say indentation does
20:01itistodaywhat is the indentation?
20:01itistoday1 space
20:01itistodayone single fucking space
20:01Chousuketwo spaces
20:01itistodayoh
20:01itistodayok, excuse me
20:01itistodayit's so small i can't tell
20:01itistodaytwo spaces
20:02itistodayi don't know about you, perhaps years of being forced to do this has managed to give you super reading powers
20:02itistodaybut it takes me a while to figure that out
20:02itistodayto make *sure* it's in the function and not outside of it
20:02itistodayand that was a relatively benign example
20:02itistodayi've seen far worse
20:02itistodayis that right?
20:03itistodaythat two spaces should be your only clue as to something so important?
20:03itistodaywhat other language has that?
20:03itistodayi can't think of a single one
20:03Chousukeif it really bothers you, you can use rainbow parens or paren highlighting
20:03itistodayi don't use Vi
20:03Chousukeneither do I :P
20:03itistodaythe readability of your source code should *not* depend on the editor used to view it
20:03ChousukeI can sort of see your point, but I don't think it's a big issue
20:04itistodayit's a huge issue to others
20:04itistodaynot to you
20:04itistodaybut have you ever heard of people complaining about Lisp's parenthesis?
20:04Chousukelisp code would look absolutely horrible with C-style braces
20:04itistodayhaha
20:04Chousukebecause you'd have opening and closing brackets every other line
20:04itistodaythat's what my code looks like, and i think it's beautiful
20:04Chousukea 10-line function would bloat to 30 lines
20:05itistodayso what, it's more readable
20:05itistodayand you don't have to always not stack them
20:05Chousukeand about that I vehemently disagree :P
20:05itistodaythis is dogma that's been drilled into you
20:05itistodayan unfortunate decision someone made in the lisp community that has plagued it till now
20:06itistodayno other language has indentation that does this
20:06itistoday*every* other language has indentation rules that are clear and consisent
20:06itistodaythe spacing of the indentation in Lisp is variable!
20:06itistodayit goes from 1 space, to over 10 spaces
20:06Chousukeactually, no.
20:07Chousukeindentation is either 2 spaces or aligned parameters.
20:07Chousuke2 spaces per level, that is.
20:07itistodayreally?
20:07itistodaywhat about line 26?
20:07itistodaywhat is that?
20:08itistodayit's neither 2 spaces
20:08itistodaynor aligned with the paraemters
20:08Chousukeit actually is
20:08Chousukethe vector is considered a parameter.
20:08Chousukebut I think that's an emacs fail more likely
20:09Chousukeit should indent two spaces after (add-char
20:09itistodaywhat about line 169, or 166?
20:09itistodayor fuck, 168!
20:09itistodaythat's 1 space!
20:09itistodayhaha
20:10itistodaysee? your indentation is bonkers
20:10Chousukeseems like it is.
20:11Chousuke169 and 166 are fine though
20:12itistodayoh you're right, the ( on 26 looked like it was 1 space farther
20:12itistodayanyway, that's not the big issue
20:12itistodaythe big issue is that i can't tell what parameters belong to what functions
20:12itistodayand neither can anyone else coming to lisp, or using it for several months
20:13itistodayto be able to quickly discern that sort of thing has to take some serious training
20:13ChousukeI think that if it's a problem then you perhaps need to restructure the code.
20:14itistodayyes, it's a problem with how the code is structured
20:14itistodaywhich is why i'm encouraging you to restructure it and indent it properly :-P
20:14Chousukemind, I'm talking about the structure, not the text :P
20:15ChousukeI think the paren-stacking became the norm because you're not supposed to pay attention to the text
20:16itistodayi have no idea what you mean by that
20:16itistodayi pay attention to my code
20:16Chousukebut I suppose closing parens on their own line might in some cases communicate the structure better.
20:16itistodayotherwise it breaks
20:16Chousukebut I'd rather use a comment instead ;P
20:17itistodayChousuke: i think it always communicates the structure better.
20:17itistodayhttp://github.com/taoeffect/dragonfly-newlisp/blob/master/example-site/dragonfly-framework/plugins-inactive/db/database_orm.lsp
20:18itistodaybut i suppose if you're used to stacking them, that will look terrible
20:18Chousukewell, for most of those functions it's simply unnecessary :P
20:19itistodayyeah they're mostly short, but 'create-dbobj' is a good example i think
20:20itistodayand notice how it's readable on github, without syntax highlighting or rainbow parens or paren matching or any other fancy editor things
20:20itistodayit's just readable
20:20Chousukeand 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:21itistodayit takes a lot of arguments...
20:21itistodaywould you suggest putting them each on their own line?
20:22Chousukeyes? It helps a lot.
20:22Chousukeespecially when the arguments look very similar
20:22itistodayok, i could agree with that :-)
20:22Chousuke(the obj: stuff)
20:32robinkIs there a way to remove the 'versions differ' warning in SLIME?
20:36itistodayrobink: if you find out please let me know :-D
20:39robinkitistoday: Heh, 'k :-)
20:41itistodayChousuke: 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:42itistodayreferring to this: "with lisp, you don't read the parens."
20:43itistodays/down/done/
20:44itistodayfoooooo
20:44itistodays/o+/o/
20:44sexpbotfo
20:44itistodayfoooooo
20:44itistodayp
20:44itistodays/o+/o/
20:44itistodayah... of course, only the previous comment
21:02arohnerhow do you mvn install a clojure.jar built from scratch?
21:03arohner'ant' correctly produces a usable clojure.jar, but 'mvn install' builds an unusable jar, and then installs it
21:07itistodayarohner: mvn install:install-file -DgroupId=org.clojure -DartifactId=clojure -Dversion=1.2.0-master-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
21:07itistodayi think
21:08itistodayarohner: 0 guarantee that will work
21:08arohneritistoday: that's at least close enough to get me started. Thanks
21:08itistodaynp
21:09itistodayarohner: let me know if it works :-)
21:25bortrebarohner: if you built it yourself, you might consider specifying a different groupId
21:34dabdIs clojure 1.2.0 going to support annotations?
21:56chouserdabd: I think so, in defrecord and gen-class IIRC
22:19dabdchouser: thx
22:22mudgehey, are there any clojure t-shirts or hats?
22:25mudgewhen is this irc channel busy?
22:25cad_from_austinQuick question - a query to mysql for a datacount is returning this map - {:count(*) theNum}
22:25cad_from_austinHow do I get the number?
22:29_mst(themap (keyword "count(*)")) would work, but it's a bit gross :)
22:30_mstI'd be tempted to modify the sql to do a select count(*) as thecount, and then use :thecount
22:31cad_from_austinMmmm... that makes sense. Thank you _mst
22:45arohnermudge: it's probably busiest weekday mornings (american time)
23:11chousermudge: http://www.zazzle.com/clojure
23:17itistodaychouser: 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:19itistoday(don't know if you've seen the show though, it's great)
23:20itistodaya better clip: http://www.youtube.com/watch?v=3C4PqyH6Ga4
23:41cais2002a 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:54itistodaycais2002: C-a C-k is what i do
23:55cais2002itistoday, does not seem to work
23:56itistodaycais2002: i guess it depends on where your repl is. I use OS X's terminal, which supports some emacs bindings
23:56cais2002right.. i am on Win7, unfortunately
23:57cais2002I had to spend quite some time to change leiningen to work in Win7
23:57itistodayhave you considered installing ubuntu?