#clojure logs

2008-08-29

07:38parth_mHello. I just started using clojure.contrib. I have basically added clojure-contrib.jar to the classpath. Just wanted to check it thats the recommended way of doing things. Seems to be working fine.
07:38parth_mCLASSPATH=$CLOJURE_JAR:$CONTRIB_JAR
09:16cemerickrhickey: you said earlier this week you were looking (or planning on looking) at the >18 arguments issue I posted about; any ideas there? I ask only because it looks like the netbeans profiler is choking on that bytecode...
09:17rhickeycemerick: have you gotten the NB profiler to profile Clojure code at all?
09:19cemerickI was trying just a moment ago (not to profile clojure code specifically -- just an app that happens to have some clojure stuff floating around at the periphery). It's pretty unsuccessful -- an exception occurs with roughly the same message as what I posted.
09:19rhickeycemerick: Ok
09:19rhickeywas focusing on getting lib in first - that's done
09:20cemerickSure, absolutely.
09:27hoeckrhickey: built-in lib support rocks, just on par with cl's defpackage and a bit of asdf :)
09:28rhickeyhoeck: thanks to Steve Gilardi et al
09:28rhickeyhoeck: did you ever post the print multimethod?
09:29hoeckno, sorry, will do so as soon as i'm home from work
09:39ChouserThe "requir" exception last night got me thinking -- I think it'd better if the :keywords and functions for ns had exactly the same name.
09:40ChouserThe declarative sense of "uses" and "requires" is nice, but if it's good enough for the ns keywords then I think we should use it for the function names too.
09:42Chouserhaving ns do English grammar transforms on users' code seems like a bad idea. Rails does that and I don't think it turned out well.
09:59Chouserrhickey: what do you think. Are you dead-set on leaving it how it is now?
10:00rhickeyChouser: why/when would you use the functions now?
10:01rhickeyChouser: also, there is a difference in that one set are macros and the other needs quoted data
10:01rhickeyI had thought about changing the function names to the more declarative ones
10:01ChouserI don't plan to use the functions, but my main concern is the attempt to compute English grammar within the API
10:02rhickeyI don't understand
10:02Chouser...and the fact that that makes the public API less simple with little benefit.
10:03Chouserthe ns macro programmatically converts :requires to 'require and :uses to 'use.
10:03ChouserI guess it's lucky there's not a 'try that needs to be computed from :tries
10:03rhickeyChouser: that's an implementation detail
10:04rhickeycould just as easily be a map
10:05Chouseryes, but it's exposed in the public API of providing the keywords and the functions, and in the stack traces produced when you forget (understandably) to use the present-perferct form form because you're inside the ns call.
10:06Chouserit seems like complexity (in the programmers head and in the ns implementation) with very little benefit.
10:07rhickeyChouser: I understand and am not strenuously opposed, but you are speaking from the perspective of one who has been using the functions a la carte. For instance, you get alias from using :as
10:07rhickeybut I wouldn't call alias as nor :as :alias
10:07ChouserI understand, and if the a la carte functions were made private, I think my argument would be much weaker.
10:08rhickeyMy thinking was - the new method would be to use ns. Everything is declarative and the names are good...
10:09rhickeythen, at the repl you need to reload something, seems weird to call (requires ...)
10:11rhickeyso, if unified, the keywords would be :use, :import, :require - I'd be ok with that. But there's still the difference in API - quoted vs not, that make them incompatible - the bigge issue last night wasn't requir, it was the quoted data in :requires
10:11ChouserI can certainly see how we arrived here, and in a vacuum I'd probably prefer (requires ...), but with the existance and eventual prevalence of :requires, I think having (require ...) is actually more confusing.
10:11rhickeyI would really like to discourage use of the functions in source
10:11rhickeyto the extent of saying tools will only analyze ns declarations
10:13Chouserwell, I've lodged my complaint and I think you understand my argument.
10:13ChouserMaybe I'm extra-skittesh on this one because of how far Rails took it
10:14Chouser...and what a poor choice that now seems to be (although I'm surprised how few complaints I hear about it).
10:14rhickeyanyone else? on the table is changing :uses/:imports/:requires to :use/:import/:require in the ns macro
10:14rhickeywhat is the Rails problem?
10:15Chouserthey do it everywhere. The prominent example is that class names are generated from table names, but are converted from plural to singular along the way.
10:15ChouserA table named customer-entries is handled by a class named CustomerEntry
10:16rhickeythat's pretty common ORM I think, ORM being awful in the first place
10:17Chouserwell, you'd better be sure your understanding of the rules of English grammar are exactly the same as Rails', or you're going to have trouble. ...and grep is suddenly much less useful.
10:17Chouseranyway, as I said I don't actually hear people complain about it, but having written my one big Rails app, it seems like a big ol' waste.
10:18rhickeyI understand, but the problem is in the approach to data as much as the names
10:18rhickeyI'm ok with :use/:require/:import
10:18Chouserclearly the (ns) issue is smaller because you're in complete control of both ends (both the ns API and the underlying functions).
10:25rhickeychanged :requires/:uses/:imports in ns macro to :require/:use/:import
10:26cemerickFWIW, +1 on that
10:28cemerickChouser: what I hear from my Ruby colleagues is that, once you're past some initial prototyping stage, using the autogenerated stuff is a no-go (due to database performance issues)
10:31rhickeyORM is a bad idea
10:31rhickeyOODB is a bad idea
10:33Chousercemerick: I think that's actually a separate issue. Even if you don't use the tool-generated code, the underlying ORM still uses that computed name mapping. I think. ;-)
10:34cemerickI'm completely not a ruby programmer, but from what I've heard, high-volume sites end up dropping the ORM entirely.
10:34cemerickor, the automated ORM, to be precise -- one ends up specifying mappings between columns and attributes, etc.
10:35Chouseroh, wow. huh.
10:35Chouserwell, I'm apparently not a rails programmer either, then. :-) Ruby was probably my favorite language pre-clojure.
10:41cemerickkeep in mind, that's not much more than rumor -- just what I hear from friends :-)
11:33DrewRcemerick: High volume sites end up dropping Rails, not just ORM. :-)
11:34DrewRHaving written a few highish-volume Rails sites I can officially say all the convenience it affords makes you yell profanity later.
11:35DrewRRuby is a difficult framework language.
11:36DrewRIt's great when you're building a framework because it's flexible, but it sucks when someone else needs to reverse engineer.
11:36DrewRAnd because the abstractions usually leak in very bad ways, you always have to do the latter.
11:37DrewRIt's what drove me back to Python. What a clear, modular language.
11:37DrewRClojure is well on its way there and I'm excited.
11:40DrewRAnyway, all that said, I vote for unambiguity in ns. :-)
11:40DrewR...which it looks like rhickey just checked in.
11:41rhickeydrewr: yup
11:43rhickeyit's weird to be over 1000 checkins...
11:43DrewRCongratulations.
11:44DrewRI'm really impressed you stuck with this for so many years.
12:32ozzileeIs anyone working an an http library for Clojure? The amount of code needed to issue a PUT in Java is ludicrous.
12:32Chouserfrom the client side?
12:34ozzileeChouser: Yeah.
12:38Chouserhttp://groups.google.com/group/clojure/browse_thread/thread/f696552b40aa95da/0ff01dbe3b318cae
12:39ChouserI haven't tried that out, but I remembered it being mentioned.
12:40ozzileeHmm, I'll take a look.
12:40ozzileeI'm trying the apache commons httpclient right now, might be ok.
12:40Chousersure
13:11abrooksWow, I've been using FoxMarks for 10 minutes and already have 42 backup IDs (revisions).
13:11abrooksThis seems a bit excessive.
13:11abrooksI don't think I've made that many changes.
13:11abrookser.... wrong channel.
13:29abrookssf.net is getting slower and slower it seems. I just pulled the entire clojure mercurial mirror in 7 seconds. It takes as much as twice (somtimes even more) that long to do most operations that involve the Subversion server. (Although it takes only 2.5 seconds to do a noop svn update.)
15:06notyouravgjoelis there any clojure OO implementation, or is it most common to do oo stuff in Java?
15:07notyouravgjoelalso, do clojure ints have a max size, or will they automatically become bigint-like things?
15:13DrewRnotyouravgjoel: As a functional language, Clojure doesn't support the OO paradigm.
15:14DrewRArguably you can create much better abstractions.
15:15notyouravgjoelwell, what about a struct system, then?
15:15DrewRTo your second question, they grow automatically.
15:15DrewRuser> (* 99999 99999999999999999999)
15:15DrewR9999899999999999999900001
15:15DrewRYep, it's got structs and generic functions.
15:15notyouravgjoelfun fun
15:16notyouravgjoelugh, poor xchat for windows
15:16kotaraknotyouravgjoel: struct + multimethods are probably more flexible than the average OO system in <yourfavoriteOOlanghere>.
15:17notyouravgjoelI believe it
15:25notyouravgjoelwhat about using random standard java things, such as hibernate?
15:38achim_pnotyouravgjoel: you can create new java object instances and call methods on them, and you can define your own via proxy: http://clojure.org/java_interop
15:55notyouravgjoelthanks for the answers =)
15:57notyouravgjoelone last thing: I'm thinking of writing a web bot in clojure, which will basically behave like a browser, parse web pages, and do actions based on the content. Any advice/sensible libraries/considerations?
16:06fyuryunotyouravgjoel: check out HttpUnit
16:09notyouravgjoelthanks =)
16:15hoecknotyouravgjoel: there is also http-client.clj in the files section of the google group
16:46abrooksrhickey: Are things all set for your Sept. 29th Boston Lispers talk?
16:47rhickeyYes
16:47abrooksVery cool. If the current plans stick, I'll be there. What's the topic?
16:49rhickeyIt will be about the Lisp nature of Clojure, Clojure as a Lisp, why I wrote a new Lisp etc
16:49rhickeyI can presume the audience knows Lisp, and dig in a bit more
16:50kotarakwill the slides or video be available afterwards?
16:50rhickeykotarak: If it's a good talk :)
16:51kotarakrhickey: it will be. :) No doubt.
16:52rhickeyI've been thinking about doing an online study group on something like yugma: http://www.yugma.com/
16:53rhickeythe talks I give are limited to being overviews/introductions
16:53kotarakThat would be nice. I know Webex from work.
16:54rhickeywould people be willing to 'meet' regularly for a study group?
16:54rhickeyI guess time zones would be an issue
16:54kotarakMost likely.
16:57kotarakHow much does yugma cost? I know our local solution work to be quite expensive.... But that's for a company. There everything is twice the price.
17:00rhickeykotarak: I think it's free for ad-hoc sessions of 10 people, full-featured is $10/10, $30/30 $70/100 per month
17:02kotarakrhickey: o.O That's nice. Our service charges per minute and participant.
17:03abrooksThere's some features (such as whiteboard) which are only free for 15 days after signup on the personal plan, it appears.
17:03rhickeyabrooks: right
17:21roblallyI've been playing with the new ns feature in head. Very nice. But I've been seeing one strange side-effect. I can load a file with (use) if I embed it in a (ns) call. But if I call the function (use) outside of the (ns) call I get an error. Am I using it correctly?
17:21kotarakWhat kind of error do you get?
17:22roblallyException in thread "main" clojure.lang.Compiler$CompilerException: all_tests.clj:1: Unable to resolve symbol: bowling-tests in this context
17:22roblallyWhere I'm calling (use bowling-tests)
17:22kotarak(use 'bowling-tests) Not the quote
17:23kotaraks/Not/Note/
17:23roblallyThanks, the odd thing is that (ns anything (use bowling-tests)) works fine.
17:23kotarakIt's because it's a macro, while use is a function.
17:24kotarakSo bowling-tests is evaluated before it is passed on to use.
17:24roblallyThat makes sense.
17:24kotarakSince there is no variable of that name you get the Exception.
17:24kotarakns is macro. So it can decide itself whether to evaluate bowling-tests or not.
17:25roblallyIs there an advantage to use being a fn rather than a macro in this context? I'm thinking purely of consistency.
17:25kotarakMaybe the ns should behave the same as use/require and friends?
17:25kotarakSame thought. :)
17:26roblallyThanks for the help. I'll get to grips with this soon ... honest.
17:27kotarakroblally: take your time. Speed is often dangerous.
17:27roblallyParticularly when you're stumbling around blindly!
17:28kotarakhttp://norvig.com/21-days.html
18:07rhickeyanyone with google code experience? They now support EPL license (successor to CPL) and so now is an option for Clojure
18:08rhickeyat this point I'm not using SF for anything but SVN
18:09kotarakThey only support SVN, IIRC. I prefer Mercurial, but to be honest I have no experience with it.
18:09kotarakGoogle Code, I mean.
18:09rhickeyI'm fine with SVN
19:46kid_meieranybody active in here?
20:09DrewRkid_meier: Sure.
20:10kid_meiertrying to figure out some stuff with the classpath..
20:10kid_meierany idea why the new load-resources does not use the RT.baseLoader() to find the resource?
20:18DrewRHm. I haven't had the chance to play with it yet.
20:20kid_meierits puzzling. Rich also recently added (add-classpath) but thats the not the classloader used by (load-resources)
20:21kid_meieri must be missing something. or perhaps I'm doing something silly.
20:49rhickeykid_meier: no, that's wrong - Steve switched from using classloaders to using RT.loadResourceScript which doesn't use any - I'll look into it...
20:59kid_meierrhickey: good to know. it felt like I was going to have to write a separate function to load resources off of RT.baseLoader(). thanks.
21:01rhickeykid_meier: try the latest (rev 1012)
21:05kid_meierrhickey: Thanks! that does it