#clojure logs

2010-06-15

00:12rdsrHi all, how do I use the "reload" feature when writing it with the ns macro?
00:13rdsrI was trying something like this but it doesn't work
00:13rdsr(ns step2-clj.run
00:13rdsr (use [step2-clj.core]
00:13rdsr [ring.adapter.jetty :reload]))
00:15tomojuse :use not use
00:16rdsroh, didn't realize that, thks
00:16tomojalso I think :reload might have to go outside the vector
00:16rdsryes, that works, but then that reloads all the libs I guess
00:16tomojyou can have multiple :use's
00:17rdsrthks tomoj
00:47jarturGuys, how much slower Clojure is than java in general. I have a complex network server application written in java and I either need to rewrite it in java or clojure. I want to do this in clojure but I'm afraid that I can spend a lot of time doing that only to get some really huge slowdown in performance. Would you advise to be bold and do it?
00:50qbgAre we talking after appropriate optimization?
00:50jarturWell, I'm not a master of clojure optimizations of course
00:50jarturBut well, I'll do what I can to optimize it of course
00:51qbgNamely removing reflection by adding type hints
00:51jarturYes
00:51jarturDefinitely
00:52defnI believe you also have to do things like explicitly tell Clojure to use JVM native ints (versus a boxed class, see http://clojure.org/java_interop#...). Scala can automagically unbox Ints to native JVM ints where possible for performance.
00:52defnIs that accurate? ^^
00:53mabesjartur: I would recommend using 1.2 as well so you can take advantage of the protocols and speed advantage they offer
00:53defnAlso if anyone would like a Quora invite PM me...
00:54qbgHow fast the resulting code will be depends on what you need to to do and how you do it, of course
00:54mabesdefn: yeah, you can use the primitive int version in clojure with the (int) fn
00:54jarturmabes: Yes, I think 1.2 is the way to go. Despite it not being released yet =)
00:55mabesdefn: oh, nm, you were probably asking about scala- which I don't know about :)
00:56qbgYou should probably be able to get the code running at least half as fast as the Java version
00:56jarturBasically my app handles a lot of clients through NIO (I'm thinking of going with Netty anyway). Clients ask for some actions and server performs them. I will have to handle most of the actions synchroniously and IO bound actions asynchroniously
00:57jarturClients are connected for long time it's not a stateless HTTP-like protocol
00:57jarturThere are also timeouts for some actions.
00:58jarturWhat I have now is a mess written in Java by some guys and worsened by my fixes and feature additions.
00:58jarturI think that clojure version even if slower would give us a benefit of being more 'mutable'
00:58jarturI mean extensible
00:59technomancyjartur: what kind of work does the app do? heavy numerics, lots of string processing, etc?
00:59qbgYou can always have sections of it written in Java if need be
00:59jarturtechnomancy: Almost nothing. It's an online game.
00:59jarturtechnomancy: Basically just changes the state of the games that are going
00:59technomancyif you're not doing much work then why worry about perf? =)
01:00jarturtechnomancy: Because we have thousands people connected simultaneously
01:00jarturtechnomancy: Though I think clojure version will be easier to scale
01:00technomancyah, well if you coordinate state change in a way that fits the STM well, you will almost certainly get better perf using that vs coming up with your own synchronization mechanism involving locks in Java.
01:00technomancysimply because Rich has already done all the hard work for you
01:01technomancybut not all use cases fit the STM system perfectly
01:01jarturtechnomancy: Well, I'm not a pro in STM. And I also afraid that I will misuse it =)
01:02jarturtechnomancy: OTOH one's gotta learn somehow
01:03technomancyare you persisting state to disk anywhere, or is the canonical copy only stored in memory?
01:03jarturAlso, I think about integrating will Amazon AWS facilities. Like automatic spawning of additional instances when needed.
01:03jarturtechnomancy: Some thing are stored in DB
01:03jarturtechnomancy: LIke player accounts. Some money transactions
01:04technomancybut not the game state?
01:04jarturtechnomancy: No. Game state is in-memory only. Games are short. It's a poker. =)
01:05qbgAre you familiar with Clojure's ideas on state and identity?
01:05technomancyoh nice, so there's a limited number of players. that's a lot easier to scale than something like an mmorpg.
01:05jarturqbg: Well, yes.
01:05jarturqbg: I hope.
01:05technomancyheck, if it's turn-based you probably don't even need STM then.
01:06jarturtechnomancy: Yeah. There are lots of games going on at the same time though.
01:06technomancyyeah, but it's much easier if the games are independent of each other. I wouldn't worry at all about the speed differences between Java and Clojure in that case.
01:07jarturtechnomancy: well, I need to store current state somehow
01:07jarturtechnomancy: And I don't know how to go about timeouts. Like when a player has 30 seconds to make a trun.
01:07technomancyI suspect atoms would be a good fit for state in a turn-based system.
01:09jarturtechnomancy: And player state? Like they have money on desk and money on account. And transefrs should be atomic. And transefrs between players.
01:09technomancythat's going to depend on your database
01:09technomancycurrently there's no way to tie STM transactions into external transactions
01:09jarturI'm bound to sql.
01:09technomancythough there's a thread on the mailing list right now about this.
01:10jarturDo you think it would be difficult to achieve consitency?
01:10jarturMaybe not in a glamourous way.
01:11jarturI know that since it's my first big project in clojure it WILL be awful anyway.
01:11technomancyconsistency wrt account info, money, etc. will not be any different in Clojure from other languages; you just follow regular DB guidelines for that.
01:11technomancyheh; well there's always that. =)
01:12technomancyI don't think it'd be difficult to achieve consistency in the game state using atoms; every turn is just a transformation on the existing state that you can apply using swap!
01:14jarturDoes this smell: timeout for a turn is a future which just sleeps for set amount of time and is cancelled if player makes an action. If he doesn't make an action then when sleep ends the future just calls a callback which actually is the exact same function as the one which is used to act 'fold' by player + it sets player as timed-out somehow.
01:15technomancythat sounds decent
01:15technomancythere's even a .get method on futures that allows you to set a timeout; you don't need a separate "sleep"
01:15rdsrthis does not seem to work for me http://stackoverflow.com/questions/1665760/compojure-development-without-web-server-restarts
01:16rdsrdid anyone face problems with this?
01:16technomancyI don't think it's exposed through pure clj though; you have to hit it with java interop
01:16jarturAnd while i will be handling most of user events sync some of them (like login through FB) are IO bound and I'm gonna use agents with send-off for those. Is it okay?
01:16technomancyyou don't even need to cancel the future if an action is taken; having it return an actual value would suffice for that
01:17technomancyjartur: agents are reference types designed to act as an identity that can have many values over time... not sure if login fits into that. a future might suffice for that too.
01:18jarturtechnomancy: Hmm. Probably you're right. It's just that agents come with a thread pool for free.
01:18technomancyjartur: actually futures share the agent thread pool
01:18jarturtechnomancy: Ah.
01:18technomancythough you don't get the send/send-off distinction with futures
01:18technomancyso... is there anyone in here who has tried out leiningen recently and would like to review the documentation for the next release?
01:19technomancyI need someone who isn't too familiar with it so they can spot the holes in the docs better.
01:20jarturThanks. I will bug you guys with questions later probably. Unfortunately the project is not opensource though. But maybe if i come with some library-like things I will publish them. Though my code is never very good. =/
01:20technomancygotta start somewhere
02:15SandGorgonanyone know of any production code in clojure that talks to the database - I'm having a lot of difficulty _thinking_ about databases in Clojure. I come from the Ruby/ActiveRecord world with has_many, belongs_to, :polymorphic and all. It would be great if there were a beginners guide for ActiveRecord vs Clojure (rather than Ruby vs Clojure)
02:45tomojwow, we can already make our deftypes fn-like just by implementing IFn, duh
02:48TheBusbyoh, that does sound promising. Have a small example?
02:50tomojhttps://gist.github.com/79e5aea51bea774ed4b1
02:50tomojuseless, but small
02:51tomojit sounds promising to me too yet I can't think of a cool example
02:51Raynestomoj: That is insane.
02:51tomojinsane in a bad way?
02:51TheBusbytomoj: awesome thanks!
02:51Raynestomoj: Not really. It does feel like ancient and dark magics, but it's awesome.
02:52tomojyou get AbstractMethodErrors instead of "wrong number of args" errors though
02:52jarturIf i want to use clojure and contrib 1.2 what do I put in project.clj :dependencies?
02:53tomoj[clojure "1.2.0-master-SNAPSHOT"] [clojure-contrib "1.2.0-SNAPSHOT"]
02:54Raynesjartur: [org.clojure/clojure "1.2.0-master-SNAPSHOT"] and [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"]
02:54jarturAh. Thanks. I've missed -master- part
02:54Raynestomoj: I beat you. Go make types callable or something. ;)
02:55tomojhere, I beat you
02:55tomojirc-relativity :(
02:56tomojI wonder how often messages come in out of order
02:56Raynes:(
02:57tomojit's too bad IFn isn't a protocol though
02:57tomojthen we could be evil and make regexes and numbers and whatever be callable
02:57RaynesMaking regexes callable could be useful, actually.
02:58tomojstill would be evil, though
02:58tomojunless rich blessed it
02:58tomojstrings could do format on themselves for an epic 7 characters saved
02:59tomojwell, except no variadic protocol fns, right?
03:01tomoj(3 :days)
03:01RaynesIsn't there a way, with paredit, to turn (something here) (blah blah) to (blah blah) (something here)? I believe I heard someone talk about a way, but I can't remember how. :<
03:02tomojC-M-t with point in between
03:02tomoji.e. transpose-sexps
03:02RaynesAwesome.
03:02RaynesThanks.
03:02RaynesSexy.
03:03tomojhow do you move around?
03:03tomojI habitually use forward-word and backward-word but they suck
03:04Raynestomoj: I move around embarrassingly slow, character by character, with the arrow buttons. Or with the mouse.
03:04RaynesI'm not hardcore.
03:04Raynesv.v
03:05garybutomoj, Raynes: Clojure uses the standard Java classes for strings and regexs. These classes do not know about Clojure, and therefore are instances of these classes are not callable.
03:06tomojgarybu: blah blah blah
03:06RaynesShame.
03:06tomojprotocols man, protocols
03:06garybuThese classes are also final, so it's not a simple matter of deriving a new class with iFn.
03:07tomojderiving a new class would be too ugly anyway
03:07tomojbut there'd be no need if IFn became a protocol
03:07jarturtomoj: what about C-M-f/b/n/p ?
03:07garybuYou need to pick between compat with the rest of Java world and callable.
03:07tomojno you don't, if IFn is a protocol...
03:07tomojjartur: hadn't discovered them yet, thanks
03:08jarturtomoj: it's paredit movements
03:10tomojbut IFn can't be a protocol, at least not yet, it semes
03:13garybutomoj: Will there be an impact on perf of iFn is a protocol? If protocol is used, then function invocations can not be implemented as invokevirtual.
03:13tomojI dunno
03:14tomojnot going to happen anyway with current protocols
03:38LauJensenGood morning all
03:44bobo_godmorning on you too
03:53taliosEvening.
03:55LauJensenclojurebot: UGT?
03:55clojurebotugt is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html
04:36jarturIs there a way to emit xml from the same structure that i get with xml/parse ?
04:40LauJensen,(doc clojure.xml/emit)
04:40clojurebot"([x]); "
04:40LauJensenjartur: maybe that
04:41jarturLauJensen: why it is not here http://richhickey.github.com/clojure/clojure.xml-api.html
04:41jarturLauJensen: it works, thanks
04:42LauJensenjartur: I dunno, chouser is responsible for those pages I think. But you can always follow the 'source' link and check the neighboring functions
04:43jarturLauJensen: emit-element is even more appropriate for what I want. I guess someone just forgot to write docstrings =)
04:44RaynesBetter yet, they emitted the docstrings. ;p
04:44LauJensenyou mean 'omitted' ?
04:46RaynesOh darn!
04:46RaynesYou're right.
04:46RaynesAnd English isn't even your native language. I'm so ashamed.
04:47RaynesIn my defense, I /am/ in Alabama.
04:48taliosheh
04:48LauJensenRaynes: Dont worry, if I ever meet an American capabable of speaking English I'll send you an email
04:48LauJensens/capabable/capable/
04:48sexpbotRaynes: Dont worry, if I ever meet an American capable of speaking English I'll send you an email
04:56LauJensenhttp://www.apostropheabuse.com/
06:28canderaSo I've heard "encapsulation is folly" a bunch of times. I even sat there while Rich explained it. And it keeps slipping out of my brain. So why, again, is it folly?
06:29ChousukeI think because it hides state
06:30Chousukeat least the typical OO style encapsulation does
06:30ChousukeWhich is probably what the statement refers to
06:31silveenevery time you encapsulate something you create an entire "mini-language" just to communicate with that object
06:31silveeneven something simple as person.getName() becomes unesiceraly (spelling?) complex
06:31canderasilveen: Right. OK, there's the connection I keep missing.
06:32canderaGod it's hard to throw off 20 years of OO thinking.
06:32silveenHaha candera, yes I'm in the same boat, though my number is only 5
07:39lpetitChousuke: because it hides state, or because it hides information data ?
07:40bartjer, is anyone aware of a channel for Information Extraction research?
07:42ShardPhoenixtest
07:42ShardPhoenixhas anyone here read the early-access version of Joy of Clojure? How do you find it?
07:43raekhttp://www.manning.com/fogus/
07:44raekI haven't read it, though...
07:46bobo_i have read about half, and i realy like it.
07:53octei'm a bit confused trying to understand some code i'm reading: http://pastebin.ca/1883540
07:54octeit doesn't look like the usual (let [binding value]
07:54octewhy is the first item a map?
07:56bartjShardPhoenix: quite coincidentally, I shared this on FriendFeed - http://friendfeed.com/bart/fa401b58/some-programming-language-books-are-great-page
07:57bartjShardPhoneix: yes, I cannot quite get over that book - it is BEAUTIFUL! Go buy it, you will not regret it
07:58silveenbartj: is that so? How is it compared to Halloway's? if you've read that
07:58bobo_i regret abit that i didnt wait for the dead tree version
07:59bobo_someone did a comparision of the clojure books.
08:00bobo_cant remember who or what is said, but it was a nice comparision :-)
08:00bartjsilveen: read this - http://stackoverflow.com/questions/2578837/comparing-clojure-books for a nice comparision of Clojure books
08:01silveenbartj: cool, thanks
08:01bartjbut for me - "Joy of Clojure" is *THE* book
08:01Raynes+1
08:01RaynesJoy of Clojure is my bible.
08:01dnolenocte: that's map destructuring
08:02ShardPhoenix@barj: thanks for the info
08:02dnolenocte: you can pull out values from the map that way into locals
08:03octeah
08:04silveen"Now this book is going to be epic", good, objective, way to start the introduction
08:05octednolen, not fully understanding how it works. the find-join-by function returns a map and it creates two locals, type and many-side which are mapped to the values of the keys :type and :table in the resulting map from find-join-by?
08:07dnolenocte: formatting helps, http://gist.github.com/439024. looks like type is unused in that snippet.
08:08dnolenocte: yes that's what going on.
08:08octednolen, thanks :-)
08:09dnolenocte: anywhere you have a binding form you can destructure such as function argument lists.
08:09dnolenocte: think Python and Ruby list destructuring, x, y = [1, 2], but far more general.
08:10octeyes
08:14lypanovfogus: apple answered to the lack of epub only pdf problem with a new iphone that makes it readable. problem solved. :P
08:15foguslypanov: Great news! Hooray for Apple (again)
08:16lypanovanyone know progress on clojure in clojure? and as such clojure in js?
08:16lypanovmaybe i should just watch clojure on github and read the commit stream
08:28dnolenlypanov: Clojure 1.2 lays down the foundation for the possibility of that work I believe.
08:28wlangstrothlypanov: I recommend watching clojure on github to be humbled by rhickey's code output
09:11AWizzArdclojurebot: max people
09:11clojurebotmax people is 283
09:32defn,(let [[a b c :as d] [1 2 3 4]] d)
09:32clojurebot[1 2 3 4]
09:32defncould someone explain that please?
09:32chouser:as d means the whole input collection is bound to d
09:32defnah, so why even put the a b c?
09:33chouserif you want to deal with them individually.
09:33defn,(let [[a b c :as d] [1 2 3 4]] [a b c d])
09:33clojurebot[1 2 3 [1 2 3 4]]
09:33defnahh, i see
09:34defn,(let [[a b c :as d :as e] [1 2 3 4 [5 6]]] [a b c d e])
09:34clojurebotjava.lang.Exception: Unable to resolve symbol: e in this context
09:34defn,(let [[a b c :as d :as e] [1 2 3 4 [5 6]]] [a b c e])
09:34clojurebotjava.lang.Exception: Unable to resolve symbol: e in this context
09:34defn,(let [[a b c :as d :as e] [1 2 3 4 [5 6]]] [a b c ])
09:34clojurebot[1 2 3]
09:34defn,(let [[a b c :as d :as e] [1 2 3 4 [5 6]]] [a b c d])
09:34clojurebot[1 2 3 [1 2 3 4 [5 6]]]
09:35defnso once you use a keyword like :as, you're done?
09:36chouserhm... I guess so, except for further nesting or other keyword things
09:37defn,(let [[a b c :as d [e f g :as h]] [1 2 3 4 [5 6 7 8]]] [d h])
09:37clojurebotjava.lang.Exception: Unable to resolve symbol: h in this context
09:37chouser,(let [[a :as [b :as [c & [d]]]] [1 2]] [a b c d])
09:37clojurebot[1 1 1 2]
09:38defnwhy did my example break?
09:39chouserafter ":as d" you can only do other keyword things, not more positional things
09:39defnah gotcha
09:39defnthanks chouser
09:39chousernp
09:43defnhttp://gist.github.com/438897 <--I'm making a little gist for the answers site Quora which includes a bunch of destructuring examples. If you have any interesting permutations please add.
09:45chouserthere is also :or for maps
09:45chouserand now destructuring sequentials into maps
09:45AWizzArdchouser: what is the :or option doing again?
09:46chouserdefn: line 12 is wrong
09:47defnyeah that's [nil nil]
09:47defnsorry, meant to delete that
09:52chouser,(let [{:keys [foo bar] :or {foo 5}} {:bar 2}] [foo bar])
09:52clojurebot[5 2]
09:52chouserAWizzArd: that's :or
09:52chouser,(let [{:keys [foo bar] :or {foo 5}} (list :bar 2)] [foo bar])
09:52clojurebot[5 2]
09:53AWizzArdAh, thx
09:56defnchouser: sorry but that's still rather fuzzy for me, what is the difference between the list and the map?
09:58chouserI'm just showing that lists of alternating key/value can now be destructured into a map
09:59defnchouser: oh, i see it now. i think i need some sleep :)
09:59defngnight all
10:34AWizzArdMaven and Leiningen can start a JVM with the right classpath. Can one make Ant do the same? ant repl ==> a -server jvm with my CP plus loading swank-server
10:37technomancyAWizzArd: lein used to use ant to start its repl task, but it doesn't work very well
10:37technomancyAWizzArd: it doesn't pass stdin to the forked subprocess
10:38lpetitAWizzArd: probably coupling ant with ivvy could help, I guess, but the wiring with the project.clj remains to be done :)
10:41AWizzArdI see.
10:48technomancyAWizzArd: if you just want a swank server the stdin bug shouldn't affect you though
11:03AWizzArdtechnomancy: currently I am still using the non-swank-server model, where Emacs spawns my repl. When I C-c C-k a file, then this is doing a load file in that jvm. Does swank-clojure manage it to send this command to the remote repl instead?
11:19yacinis there an easy way to go from a map to a struct with the same keys?
11:19chouser'into' should work
11:20yacinnice, thanks
12:01mcavnew to java packaging... i'd like to install imageJ as a dependency (with leiningen), but I haven't been able to find a maven repository for it. How would I go about adding or installing it to my project as a dependency?
12:08pedroteixeiraanyone knows if it's possible, in the clojure.contrib.condition, to have a handle :default?
12:08technomancymcav: you can push it to clojars yourself; just be sure to use org.clojars.$USERNAME as the group-id so it doesn't shadow a future canonical release.
12:09mcavthanks... I just now reread the docs and see the instructions for that, that should work
12:11pedroteixeirahm.. just use a more generic dispatch function :)
12:58djpowellchouser: did you see my clojure.java.shell proposals on clojure-dev, or was the format of the mail a bit illegible?
13:00chouserI'm doing a bad job of keeping up with the mailing lists that last few weeks.
13:00chouserI see it. I'll read it.
13:00chouseroh, actually I did read it.
13:01chouserI haven't looked at your code, but I assume something like what you propose will be necessary.
13:03djpowellRuntime.exec is horrible to use
13:04chouserindeed
13:04chouserand easy to get wrong
13:04chouserwhich, apparently, I did.
13:05djpowelland ProcessBuilder, which was added to make it easier, doesn't really solve any of the problems
13:05djpowellI have been using clojure.java.shell this week. only for a process with no output though.
13:05technomancywe had some issues with the subprocess temporarily requiring as much memory as the java process it came from
13:06djpowelltechnomancy: on solaris?
13:07technomancydjpowell: no, ubuntu
13:08Raynes"Finally, the authors lay bare the value and purpose of records, prototypes, and datatypes." Manning failwhale.
13:09djpowellsolaris does a spawn by forking the process, then execing the new one; but the fork requires as much virtual memory as you are currently using, again. I understood linuxes to work in a more optimistic way, where they just assume there is enough memory and only bomb out when someone actually tries to page in the memory that didn't exist
13:11technomancydjpowell: well, maybe there's a way to do it correctly under Linux, but under some circumstances it exhibits the same bug as solaris
13:11chouserRaynes: actually, that one's probably my fault. what's wrong with it?
13:11pedroteixeirais there a more idiomatic way to get values from a map given keys?
13:11pedroteixeira,(reduce (fn [v k] (conj v (k {:a 1 :b 2 :c 3}))) [] [:a :b])
13:11clojurebot[1 2]
13:11Rayneschouser: Don't you mean protocols? :o
13:12chouserha!
13:12chouseryes
13:12chouseroops.
13:12djpowelljuxt?
13:12Raynes:p
13:12djpowell,(juxt [:a :c] {:a 1 :b 2 :c 3})
13:12clojurebot#<core$juxt__4180$fn__4183 clojure.core$juxt__4180$fn__4183@104ede2>
13:12RaynesIn that case, chouser failwhale. ;)
13:12djpoweller...
13:12pedroteixeiradjpowell: thanks!
13:12dnolenpedroteixiera: (map {:foo 1 :bar 2 :baz 3} [:foo :baz])
13:13dnolen,(map {:foo 1 :bar 2 :baz 3} [:foo :baz])
13:13clojurebot(1 3)
13:13djpowell,(map (juxt [:a :c]) {:a 1 :b 2 :c 3})
13:13clojurebotjava.lang.IllegalArgumentException: Key must be integer
13:13pedroteixeiradnolen: oh yeah.. cool.
13:13djpowell,(map (juxt :a :c) {:a 1 :b 2 :c 3})
13:13clojurebot([nil nil] [nil nil] [nil nil])
13:13tomoj,((juxt :a :c) {:a 1 :b 2 :c 3})
13:13clojurebot[1 3]
13:13djpowellah
13:46rfgI've found a typo in The Joy of Clojure.
13:47rfg,5
13:47clojurebot5
13:48RaynesI've found many.
13:48RaynesI always figure someone else has already reported them though, so I never bother.
13:48LauJensenRaynes: like 'emitted' when they meant 'left out' ? :)
13:48RaynesLauJensen: I hate you. :p
13:48LauJensensry :(
13:49Raynes<3
13:59qbgI'm liking how my wrapper around Swing is going. Example usage: http://github.com/qbg/gml/blob/master/src/gml/temperature.clj
14:02LauJensenqbg: Looks interesting. A couple of thoughts. 1) You dont need transactions for singular timelines, so an atom would be better. 2) Would it be possible to distinquish between vectors and hashmaps for objects and their properties? like [:label {:text "Celsius"}] ? I think that would make the user more clear about whats going on
14:03qbgYeah, the syntax is still a work in progress
14:14fyuryucan someone point me to examples of ::Keyword usage with extend-protocol or extend-type? I keywords used in the docs but when I try it out, I always get an error. Or maybe the docs nees updating?
14:57herdrickquestion: I'm trying to read all the forms in a file, like this: (read-string (slurp "forms.clj")) or this: (read (new java.io.PushbackReader (new java.io.FileReader "/some/path/forms.clj")))
14:57herdrickeither way i get only the first form
14:57herdrickis there a read-all kind of function?
14:58LauJensen(map read-string (read-lines "file")) ?
14:58LauJensenclojure.contrib.io/read-lines that is
14:59herdrickLauJensen: ah, ok, read-lines was the missing part I was looking for, thanks!
14:59AWizzArd,(doc read-file)
14:59clojurebotHuh?
14:59technomancyLauJensen: that won't work unless all the forms are one-liners
15:00LauJensentechnomancy: true
15:00LauJensen(map read-string) was the important bit. How to delimit each form is up to you herdrick
15:00technomancy(read-string (str "(do " (slurp myfile) ")")) ; <= hacky but gets the job done
15:00LauJensenhehe
15:00AWizzArdI thought I had seen something such as read-file somewhere.
15:01LauJensen(defn read-file [f] (read-string (str "(do " (slurp f) ")")))
15:01LauJensenthere u go :)
15:02toekutrare there any good clojure tutorials/books for programmers without java experience?
15:02toekutrfrom what i've seen, most people trying to learn the language are in the opposite position
15:02technomancytoekutr: http://nakkaya.com/2010/06/15/clojure-io-cookbook/?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed:+clojure+(Planet+Clojure)&amp;utm_content=Twitter
15:02technomancyyou're certainly not alone
15:02LauJensentoekutr: www.bestinclass.dk/blog.html
15:03technomancytoekutr: I found I/O to be the biggest hurdle learning Clojure without any other JVM experience.
15:03toekutrthat makes sense, and thanks :D
15:04AWizzArdah no, it was not read-file
15:04AWizzArd,(doc load-file)
15:04clojurebot"([name]); Sequentially read and evaluate the set of forms contained in the file."
15:05LauJensen,(read-string "(println \"Hi there\")")
15:05clojurebot(println "Hi there")
15:05LauJensenAWizzArd: wouldn't load-file just print "Hi there" ?
15:07AWizzArdI think herdrick just wants to read things, not eval them, so load-file is not what he wants. I just confused what I remembered to have seen with what I indeed saw some days ago ;-)
15:08herdrickAWizzArd: right, just read them
15:11herdricktechnomancy: re: wrapping the string with a 'do' - of course! thanks, I should have thought of that
15:11herdrickthanks to all
15:13cemerickI wonder if it's good or bad news that the HN feedback on the "review my startup" thread for DocuHarvest is almost entirely positive.
15:15AWizzArdcemerick: what do you mean?
15:16cemerickAWizzArd: I submitted a thread to HN semi-announcing DocuHarvest, asking for feedback: http://news.ycombinator.com/item?id=1433340
15:16LauJensencool cemerick, congrats
15:16clajHow to compare two dates in clojure? One of them should be the object and one of them not. How do I tell clojure which one is which?
15:17clajI'm using the java.util.Date for now.
15:17cemerickclaj: there's a compare fn that can be used to compare comparable objects. :-)
15:17tomojb
15:17clajcemerik: thx! Gotta check it out!
15:19AWizzArdcemerick: and why could it be bad news? (:
15:19cemerickoh, I see
15:20LauJensenAWizzArd: Because nobody said 'Man, you stole my idea' :)
15:21clajcemerik: thank you very much, works like a charm!
15:21cemerickAWizzArd: because the service isn't (yet) particularly useful to developers, and people sometimes don't see utility in things that aren't useful to them
15:22lypanovdnolen: thank you. i'll look into it!
15:22lypanovwlangstroth: hehe. doing so ;)
15:24ohpauleezLauJensen: I stumbled upon cgrand's moustache because of you
15:24ohpauleezThank you
15:24LauJensenohpauleez: Glad to hear it :)
15:24AWizzArdcemerick: is that your voice in the youtube video?
15:25cemerickAWizzArd: yup
15:25ohpauleezI haven't been in here in ages, but I've been working on a financial transaction system in Clojure, my first professional project in Clojure that I've been paid for
15:25ohpauleezit's been a total blast
15:25technomancyI hope he wasn't hurt.
15:26rfgWhich youtube video?
15:26LauJensenohpauleez: sounds interesting, something public somewhere?
15:27ohpauleezHopefully a piece of it soon. I'm working out the plans to open it up. I think it'll make a nice study piece for those looking to deploy clojure
15:28ohpauleezA chunk of the system runs on pylons. The transactions system runs on clojure. Everything goes through NGINX and gets load balanced
15:28lypanovjetty?
15:28LauJensenohpauleez: Where is deployed? Is it for a public service?
15:28ohpauleezMoustache is used to give RESTful access to the transaction piece. Solr is used for a search solution. Sits on top of Postgres
15:29ohpauleezIt will be. It's a company in stealth mode right now
15:29ohpauleezlypanov: Yeah, via Ring
15:30ohpauleeztechnomancy: After I wrote that, I look quizzically at my statement
15:30ohpauleezhaha
15:32LauJensencemerick: Even though I detected shameless self promotion, I still upvoted you :)
15:33cemerickLauJensen: Thanks -- self-promotion is the whole point of the review my startup threads though. :-)
15:33LauJensenI know - Like I said, I honored it :)
15:34LauJensen'largely written in Clojure' means 60% Clojure, 40% XML? :)
15:34cemerickheh
15:34TweyHaha
15:34cemerickmore like 99% on the web side
15:35cemerickprobably 30% in supporting bits, though there's a raft of "legacy" java code that's probably never going to be touched again
15:35lypanovLauJensen: just looking at your site again for the first time in a while and noticed that page load is pretty slow
15:36LauJensencemerick: Im a little disappointed, that its not called 'harvestjure' :(
15:36LauJensenlypanov: get a better connection plz
15:36cemerickLauJensen: Gaaaah! :-D
15:36lypanovLauJensen: you know about all the arcane html opts / didn't have time or want some tricks?
15:36lypanovLauJensen: plenty good connect. your site is just missing quite a few tricks that would make it a lot faster.
15:36LauJensenlypanov: all tricks are welcomed
15:37lypanovLauJensen: k. first and biggest, use a sprite for the images that construct the page layout.
15:38lypanovLauJensen: to get info on where you're missing opts. which mainstream browser you use out of preference? (even if its not the actual browser ;) )
15:38LauJensen?
15:39lypanovLauJensen: page load is way below 1s. but it could be visually instant with a few minor tricks.
15:39lypanov(i'm an anal bastard though, so maybe no one else gives a crap :) )
15:40petrilliAnyone know which snapshot of Clojure 1.2 works with the labrepl "project"?
15:41riddochcI think one of the tricks is to make sure that the dimensions of things on the page are all made explicit in the HTML so that the browser doesn't have to recompute things and re-display stuff.
15:42ohpauleezpetrilli: I'm using the latest snapshot from master, and it's working just fine
15:43riddochcFor example, making sure that image tags specify height and width so the browser can leave an appropriate space, rather than waiting for another request to go through to find an image's dimensions. Apparently the same sort of thing can apply to divs and such.
15:43petrilliInteresting, when I try and do (require 'labrepl) from a project REPL in Enclojure, I get java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol (labrepl.clj:1)
15:44petrillisorry, I get that on the SECOND (require)... first one is: #<CompilerException java.lang.ExceptionInInitializerError (control.clj:9)>
15:47LauJensenriddochc: Cool, thats definitely something I didnt consider
15:47yacinis there anyway i can find out what causes a GUI to appear in a library i'm including?
15:48LauJensenyacin: grep -nr "show" *
15:48ohpauleezpetrilli: To use labrepl, I just launched script/repl. I don't know how to launch it in Enclojure
15:49yacinLauJensen: thanks
15:49petrilliI did that too (after running lein deps) and get the same thing. The only way I can get it to run is using mvn clojure:repl
15:50riddochcpetrilli: Maybe try not quoting the symbol? It looks like it's expecting a seq and you're giving it a symbol. Just a guess...
15:50petrilliYeah, except if you don't quote it, it tries to resolve it as a var
15:50petrilli:)
15:51petrilliI'm gonna blow away my maven repository and see if it clears up the problems
15:52riddochcHm. Maybe it expects it to be in something? Like, (require '(labrepl)) or (require [labrepl])
15:53petrilliwell, the labrepl README says (require 'labrepl)... I'm wondering if Maven has gotten confused and I'm getting conflicting versions of some trhings. I've had weird problems with Compojure and Clojure 1.2 before that gave me odd errors.
15:54petrilliIt's good to know that no matter what magic Rich Hickey works, the joys of CLASSPATH continue
15:56TweyHeh
15:56petrilliand now lein deps is saying ti can't find clojure-1.2.0-master-SNAPSHOT
15:58petrilliI'm having one of those days :)
15:59riddochcpetrilli: Could be. I'm just moving a project from compojure to moustache for routing, as we speak...
15:59petrillimoustache?
15:59petrilliI'm trying to do my next web project in Clojure instead of Python.
16:00riddochcYeah, http://github.com/cgrand/moustache
16:01ohpauleezpetrilli: moustache is a light-weight routing framework
16:01riddochcAnd I'm trying to do my web project in Clojure, too.
16:01petrilliAny particular reason you moved from compojure?
16:01ohpauleezpetrilli: If all you're doing is making a restful API to a service that runs in clojure, you don't need much more. And it's face
16:01petrilliAh OK. Yeah this is bigger than that
16:02ohpauleezpetrilli: LauJensen has used enlive to build out his site
16:03ohpauleezIf you need sessions and general web-helpers, I think Compojure is totally the way to go
16:03ohpauleezotherwise, take a look at moustache
16:03riddochcSome things that I probably could find a way to do with compojure's routing that I need for my project looks a little easier with moustache, so I'm experimenting. I'm not complaining about compojure at all, really.
16:03riddochcIt's a pretty nice system.
16:03ohpauleezagreed, I too like both very much
16:03petrilliNice. Yeah this is a more "traditional" site.
16:04LauJensenohpauleez: Session is Ring Middleware now, meaning Compojure and Moustache are accessing the very same thing when we're talking 'sessions'
16:04LauJensen
16:04ohpauleezand coming from building out system with Python (mostly Pylons, some Django), it's an easy switch
16:04ohpauleezLauJensen: I didn't know that. Thanks. I'm still tearing through the stack every day and finding new gems as I need them
16:05petrilliI think I'm gonna go back to Emacs... too much magic in the IDEs :)
16:05LauJensenriddochc: Yea Compojure is nice. But since they have almost completely stripped it and put everything into Ring as middleware, Moustache is a whole lot more interesting
16:05LauJensenpetrilli: Good call :)
16:06petrilliEmacs+ECB is enough for nwo :)
16:07LauJensenif cemerick had used Emacs, Docuharvest would already have been bought by Google by now
16:08ohpauleezhaha
16:08petrilliheh
16:09cemerickLauJensen: Not to worry, the fedex just delivered the offer letter. :-P
16:10LauJensen"We will only pay 10 bucks unless you optimize with Emacs, Sincerely Google"
16:10LauJensen"and please remove all of that XML"
16:10LauJensen:D
16:12riddochcWell, I'm gradually figuring out how I can make some gestures so I can avoid the keyboard while using emacs.
16:12LauJensen?!
16:12petrilliUm, that's herasy.
16:13LauJensenWith my new setup, I'm actually 99.99% mouse-free for all my computing purposes
16:13ohpauleezLauJensen: ion or awesome? Do we need to start this conversation up again?
16:13technomancyLauJensen: the nice thing about the X-series thinkpads is that you can actually take out the trackpoint and be completely rodent-free.
16:13LauJensenohpauleez: awesome
16:13ohpauleezsame here
16:13ohpauleezlove it
16:13LauJensentechnomancy: true, but Im trackpoint free as well :)
16:14riddochcHeh. I'm trying to go the opposite direction. I use a tablet, which keeps my RSI under control.
16:14technomancyLauJensen: I mean you can actually pluck out the rubber thing off the trackpoint to disable it
16:14LauJensenriddochc: RSI?
16:14technomancyso it's mouse-like-free
16:14LauJensentechnomancy: oh
16:14LauJensengotcha
16:15riddochcRepetitive stress injury. Wrist problems.
16:15LauJensentechnomancy: I must say you are spreading the 'hacks' today! :)
16:15LauJensenriddochc: ouch
16:16lypanovriddochc: mac?
16:16LauJensenlypanov: restrain yourself
16:16technomancyriddochc: did you give the Kinesis models a try?
16:16lypanovi want a datahand :(
16:16riddochcLinux. With a vm so I can use dragon under Windows.
16:16lypanovk.
16:16petrilliHmm, how do I get "lein repl" to respect the version of clojure that's in the project? I have 1.2 in the project, but "lein repl" always uses 1.1
16:17technomancypetrilli: upgrade to leiningen 1.2.0-RC1; it behaves correctly.
16:17lypanovLauJensen: was just gonna suggest sizeup.app as a lame replacement for tiling wm under osx.
16:17riddochctechnomancy: Yeah, they don't help as much as I'd hoped. And the firmware in it has a way of freezing up when I tried to actually make use of some of the keyboard macro tools.
16:17petrilliwill selfupdate do that?
16:17LauJensenlypanov: OSX and Windows are hopeless for serious productivity
16:18technomancypetrilli: no, unfortunately that only upgrades to stable releases, not including RCs. you can download the rc1 bin script and do self-install though.
16:18lypanovi like my apple wireless thing. but would just love to get my hands on a datahand.
16:18technomancyhttp://www.flickr.com/photos/technomancy/4397554484/
16:19riddochcRelevant tools: dasher and cellwriter for text input, easystroke for gesture recognition, dragon for speech recognition, and workrave for break reminders. Oh, and dvorak with ctrl & caps lock swapped, when nothing but the kbd will do.
16:19technomancyI was pretty impressed with cellwriter when I tried it on my tablet.
16:19lypanovtechnomancy: *cute* kid.
16:19technomancybut I wasn't using it day-to-day
16:20technomancylypanov: thanks!
16:20lypanovtechnomancy: btw, you guys are using riak? (iirc it was you). hows experience been?
16:21technomancylypanov: we're still in the evaluation stage. I haven't really been too involved in those experiments yet.
16:21lypanovah. k :)
16:21technomancythe design seems solid, but we'll have to see how it works in practice.
16:21riddochcI use a wacom tablet most of the time. It doesn't seem to aggrivate my wrists as bad. And I manage to make do, but it's a hack. I could undo months of physical therapy with a full days' worth of typing.
16:21technomancyriak is one of the few systems with no single-point-of-failure
16:22petrilliDoes anyone use it in production at any scale?
16:22lypanovriddochc: i find stress and tablet to keyboard switches to be the main killer for me. but my issues are pretty minor.
16:23technomancypetrilli: I think so, but not with clojure
16:23petrilliwell, that shouldn't affect the underlying reliability...
16:23lypanovits got some very big installs afaiu.
16:23riddochcBut Clojure is awesome enough to have kept me from giving up on coding altogether. I do a lot of paper programming, which is a *major* change in the write/test/debug cycle.
16:24petrilliI've been very happy with MongoDB, but... I've not pushed it past 20-30GB of data
16:24lypanovmongodb scares me for that day when i just have to have > 2 servers with replication.
16:24jcromartiethis? http://www.korokithakis.net/node/116
16:25riddochcSo, while Clojure makes for some of the fastest interactive coding, that's actually not a very useful thing for me. ;)
16:27jrpdoes anyone use clojure + vim + screen + slime.vim as their primary setup? Im curious about the delay between sending and receiving
16:27LauJensenriddochc: If you have serious wrist problems, you might want to check you "J"
16:27riddochcLauJensen: ?
16:28LauJensenriddochc: Its a very concise programming language :) less typing
16:28cemericklypanov: mongo's seems like a perfectly reasonable architecture, as long as you're using it properly. Understand that there's very little focus on single-node durability, and you'll be fine.
16:28lypanovand the insanity you accrue will make your wrist issues seem minor.
16:28cemerick'course, I like single node durability :-)
16:29lypanovcemerick: i don't like the n * (replica pair) arch.
16:29petrilliI guess I've been beaten by single-node assumptions BADLY. RAID failures, etc.
16:29lypanovcemerick: i prefer riaks wd / w / r system.
16:29cemerickI'm not familiar with riak at all.
16:29OForero(+ 2 2)
16:29clojurebot4
16:29petrilliDon't get me started about resilvering in RAID and blowing away several TB of data :)
16:30riddochcDidn't somebody make a programming language that uses only different permutations of the various whitespace characters scattered all over unicode? ;)
16:30cemerickit was mostly an unknown quantity when I was looking at databases a while back
16:30OForero(defrecord r [a b])
16:30OForero(r. 3 4)
16:30lypanovcemerick: aye. things have really changed for the better lately.
16:30OForeroI have a question ....
16:31lypanovthey are app metadata dang it.
16:31cemericklypanov: couch has panned out quite nicely for docuharvest -- though ad hoc queries are, of course, a massive PITA.
16:31OForeroinstance? returns true when I do
16:31OForero(instance? (class x) x)
16:31OForerobut false in
16:31lypanovcemerick: yeah, i prefer to "not believe in" ad hoc queries :P
16:31OForero(instance? r x)
16:32OForerowhere r is the name returned by (class x)
16:32lypanovjcromartie: another one, if you forget to index something. it'll just silently return only the first x items in the collection and print a warning in the log file.
16:32lypanovjcromartie: till the moment that happened i loved mongodb. now i don't want anyhing to do with it.
16:32cemericklypanov: Same here, although I've been wanting them of late here and there, mostly for things in the vicinity of "reporting". I might start looking at dumping stuff out of couch into a scratch mysql db to support such things.
16:33lypanovsilent failure is simply not acceptable. i prefer instant death.
16:33jcromartiealthough the release versions haven't been demonstrated to have any problem
16:33lypanovcemerick: things like hive will fill the gap.
16:33jcromartiethat guy was using a dev/unstable version
16:33jcromartieand the mongo site says what's what
16:34lypanovuntil mongo's sharding is no longer alpha, i'm just ignoring it.
16:34tomojOForero: the name? like, a string?
16:34cemerickHadoop: "Good for when you've got an ops team in your back pocket." :-P
16:34OForeronot a symbol
16:35lypanovcemerick: :P yeah, main reason i'm going for riak actually.
16:35tomojOForero: show an actual example if possible
16:35OForeroI misspelled on purpose and get the error that symbol not found
16:35OForerook
16:36OForerohttp://paste.pocoo.org/show/225834/
16:37cemericklypanov: not knowing jack about basho (their future plans, motivations, etc) keeps me from even reading about riak.
16:37technomancycemerick: that was exactly our experience with Hadoop
16:37OForerothe class was declared with defrecord
16:37technomancyHadoop is meant to be used by Hadoop programmers
16:37cemericktechnomancy: I blew a month on it and hbase last year. Not fun. I hear things have improved, but I'll likely not be back to find out.
16:38tomojOForero: I can't reproduce
16:38tomojOForero: what is (class oforero.investors.Investor) ?
16:38OForeroit is just a record
16:38OForerolet me get you an isolated example
16:38tomojbut what is (class oforero.investors.Investor)
16:39OForerowhat do you mean by what is?
16:39lypanovcemerick: i'm used to open source where its always the case so i don't really worry.
16:39tomojtype that into the repl and tell me what it says..
16:39lypanovcemerick: otoh i am a bit concerned that i may have to pay them lots of money in the near future if they release really nice stuff for $s
16:39lypanovcemerick: but tbh, i like nice stuff and if we get to that point, we'll likely have that $ anyway.
16:41cemericklypanov: that I don't mind paying for good software. I guess I'd feel better if they had been just a consultancy to start, and then started piling on paid features.
16:41cemerickPart of that is my clinging to the stupid geek notion of understanding the whole system. CouchDB is dead-simple internally.
16:42lypanovits erlang, it must work
16:42lypanov:P
16:43technomancyriak is based on amazon's dynamo architecture IIUC
16:43technomancyit's certainly more complex than couch since it shards out of the box.
16:44tomojwhat's the tradeoff?
16:44cemerickI'm hoping I'll not have to look at databases again.
16:45lypanovtomoj: vs which db? couch?
16:45tomojbesides the extra complexity itself :)
16:45technomancytomoj: couch doesn't make it easy to work with datasets that can't fit on a single machine
16:46tomojand riak doesn't make it easy to... ?
16:46cemericktechnomancy: you can't get much easier than lounge :-)
16:46cemerickbut it's not baked-in of course
16:47technomancyor should I say it didn't when I looked at it last.
16:47arohnerwith lein, is there a way to specify two directories for jars? the project I'm on has some jars checked into source control because they're not maven-ized'
16:47arohnerand checked in jars don't play nice with lein clean && lein deps
16:48cemericktechnomancy, tomoj: http://tilgovi.github.com/couchdb-lounge/
16:48tomojlounge can't replace dynamo-style I think
16:48tomojbut what do I know
16:48cemerickno, it doesn't
16:48cemerickor, not in its current form (last I looked)
16:49technomancyarohner: I'm pretty opposed to checked-in jars; there is almost always a better way to do it. that said I would still take a patch for that.
16:49technomancyarohner: I just won't write it myself.
16:49tomojarohner: do you already know that you can put the jars into your local maven repo so that they will work?
16:49cemerickBut then, we're CPU bound, so dynamic expansion isn't that important to us right now
16:49arohnertomoj: yes, but then there's the issue of N developers finding the correct versions, etc
16:49tomojwell, couldn't you just leave them checked into a separate directory and have a script that installs them into the dev's local repo?
16:50riddochcIt's funny, how trend-driven the software development community at large is. The nosql thing is an interesting anthropological phenomenon, in my mind. I have a hard time looking at it and wondering what the database world must have looked like before SQL was standardized.
16:50tomojthen they have to remember to run the script I guess :)
16:50technomancyarohner: it's pretty easy to set up a hudson instance that can work as a private repo
16:51technomancyor even just a dumb HTTP server if the dependencies don't change often
16:51arohnertechnomancy: hmm, ok
16:52technomancyif you're on a team of more than 2 you probably want a hudson instance for CI purposes anyway
16:53OForerosorry guys
16:53OForeromy env was borked
16:54OForerore-started Swank ... and now works, I guess the symbol was bound to another class
16:55OForerois there a way to get a class from the symbol representing it?
16:57tomojjust use the symbol
16:57tomoj,(class java.lang.String)
16:57clojurebotjava.lang.Class
16:57tomojor, do you mean you have a symbol at runtime?
16:57Chousukeuse resolve
16:58arohnertechnomancy: do you have a link for setting up hudson as a maven repo? I'm not finding anything
17:00cemerickarohner: it can be as simple as serving out of the hudson user's ~/.m2/repository dir
17:00OForerook .. resolve should be the one
17:00cemerickThat's not proper, but will get you started.
17:00cemerickthough I always, always prefer setting up nexus rather than using hudson
17:01cemerick(as a maven repo, that is, love hudson otherwise)
17:01scodeFor some reason maven wants to download clojure-contrib-1.2.0-master-SNAPSHOT instead of clojure-contrib-1.2.0-SNAPSHOT even though I am really really really sure that my pom.xml does not use the 'master' branch name on the clojure-contrib dependency (and neither do I see anything with "mvn dependency:tree"). Does this ring a bell for anyone?
17:01scode(the pom.xml is http://github.com/scode/sob/blob/mavenize/pom.xml)
17:03tomojscode: http://clojars.org/repo/org/clojars/rnewman/ring/0.2.2-sessions/ring-0.2.2-sessions.pom
17:03cemerickscode: org.clojars.rnewman:ring:0.2.2-sessions depends upon c.c-1.2.0-master-SNAPSHOT
17:03cemerickman, I'm always half a second short :-P
17:04scodetomoj/cemerick: Oh. Hmm. I wonder why 'depencendy:tree' didn't print it. Perhaps it doesn't when it fails to resolve.
17:04scodeThat does explain it though.
17:04cemerickscode: maven will download it, but probably won't use it.
17:04scodeDo you know if it's correct that 'master' is deprecated/wrong for clojure-contrib?
17:04scodecodemonkeyx: Well, it's not *on* build.clojure.org so it's failing to download.
17:04scodecemerick: ^^
17:04scodecodemonkeyx: Sorry, not for you.
17:04cemerickyes, the "master" artifact of c.c is quite old
17:05scodecemerick: Ok.
17:05scodetomoj/cemerick: Thanks!
17:05cemerickif you add a dependencyManagement section forcing 1.2.0-SNAPSHOT, that'll probably prevent the download as well.
17:06scodecemerick: Ok. I only have a regular dependency in my pom which I presume explains why dependency:tree doesn't show it; but maven presumably downloads refered artifacts prior to resolution of what will actually be used.
17:06cemerickright
17:06cemerickdependency:tree shows what is actually going to be used for the build
17:06riddochcSo, clojure libraries for templating web pages that don't involve making *all* the HTML be pure data structures... what are some options? I'd like to be able to do some of my design work in something like Bluefish.
17:07cemerickriddochc: enlive is the general favorite, I think
17:07cemerickstringtemplate is often used as well -- java, but simple and functional
17:08riddochccemerick: I'll check out enlive, thanks.
17:11arohnertechnomancy: have you thought of providing functionality similar to ant tasks in lein? Basically mapping a small chunk of clojure code to a task name that can be called on the command line?
17:11arohnertechnomancy: I'm considering writing a plugin for that if it doesn't already exist
17:12technomancyarohner: sure, just define a leiningen.$TASK/$TASK function
17:12technomancyarohner: http://github.com/technomancy/leiningen/blob/master/PLUGINS.md
17:12arohnertechnomancy: oh right, you can just make a lein directory in your normal classpath. no need for a separate lein plugin. thanks.
17:13technomancyright, you'd make it a separate plugin only if it's a task that would be useful outside the context of your project.
17:15shooverriddochc: also stringtemplate
17:15riddochcshoover: Thanks, I'll look at it, too.
17:22timcharperI'm really feeling the itch to use custom exceptions in Clojure to clean up some code that currently has a lot of branching to gracefully handle errors.
17:23timcharperTo me, it seems like the best approach, but I am applying experience from the immutable, object-oriented world.
17:24timcharper(Not that raising exceptions and catching them is mutable, but they are custom objects that carry a payload with them)
17:24technomancytimcharper: have you tried clojure.contrib.condition?
17:24timcharperI wasn't even aware of it. :-)
17:24technomancytimcharper: yeah, it's underrated
17:24technomancysuper-handy though; custom exceptions with no aot required.
17:25OForerohi, another question
17:25timcharperI will research it, thank you!
17:25OForerocan I add metadata to an anonymous function?
17:25puredangerscode: you might find "mvn dependency:tree" useful in tracking down where and why dependencies are needed by Maven
17:25timcharperOForero: as I understand it, that is planned for Clojure 1.2
17:26OForerospecially :doc
17:26timcharperAs of Clojure 1.1, no
17:26scodepuredanger: Yeah, it didn't list it because it was not chosen in the end.
17:26OForerook, I am on 1.2 ... it does not fail but do not appear to work
17:26scodepuredanger: I didn't realize until now that maven probably has a good reason for downloading pom:s that are then not used, for dependency resolution purposes.
17:26scodepuredanger: thanks!
17:26puredangerscode: you might find even that if you use -X
17:26tomojyou wouldn't be able to get the :doc out with doc anyway
17:27Chousukeoh man
17:27puredangerscode: along with several thousand other useful logging statements ;)
17:27technomancyOForero: with-meta should do it
17:27ChousukeI updated to OS X 10.6.4
17:27Chousukeand now my primary mouse button does nothing
17:27ChousukeI can't click on things, except with the right mouse button
17:27OForerook
17:27OForeroI'll give it a try
17:27Tcepsa\quit System.exit(0);
17:28technomancyChousuke: Steve decided that you only need one mouse button.
17:28scodepuredanger: ;) Actually, even with -X the final tree (ignoring the DEBUG output) doesn't contain it. But yes.
17:28Chousukethe fun thing is, if I swap the button config from syspref, the non-working button becomes the other one.
17:28Chousuketechnomancy: right, because everyone needs only the context menu
17:28technomancyChousuke: clearly you don't appreciate Steve's brilliance. It's often controversial.
17:28Chousuketechnomancy: this is seriously weird
17:29ChousukeI can survive without a mouse, but wtf.
17:30Chousukeand some apps are rather crappy to use from the keyboard, like finder :(
17:36arohnerok, why is it that maven can't tell you the list of useful commands you might want to call? like compile, install, etc?
17:36arohneror do I just need to download a plugin so it will tell me the list of useful plugins
17:44OForeroalmost
17:44OForerothe meta on anonymous does not survive across namespaces
19:22yacin,((symbol ":foo") {:foo :bar})
19:22clojurebotnil
19:22yacinwhy doesn't that return :bar?
19:23yacini know read-string will work instead
19:23yacin,((read-string "Lfoo") {:foo :bar})
19:23clojurebotnil
19:23yacinerm
19:23yacin,((read-string ":foo") {:foo :bar})
19:23clojurebot:bar
19:23yacini just don't understand why the first doesn't work
19:24dsantiagoBecause you're making it into a symbol.
19:24dsantiago,(type (symbol ":foo"))
19:24clojurebotclojure.lang.Symbol
19:25dsantiago,(type (read-string ":foo"))
19:25clojurebotclojure.lang.Keyword
19:25yacinoh, whoops
19:25yacinthanks
19:27timcharperchouser: I have figured out how to use clojure.contribute.condition
19:27timcharperIt's perfect! Thank you for turning me onto it.
19:28timcharperSometimes I find that the documentation (while great) lacks examples
19:28timcharperAnd the example that I found on the thread referenced by the documentation was out of date :-)
19:29timcharper(Not that they expected it to be up-to-date, it was an example for a prototype)
19:29timcharperAnyways, here's my revised example: http://gist.github.com/439900
19:50TakeVSo, Clojure should be able to work fine with all the other JVM languages?
19:51nDuffyup
19:54TakeVHow exactly does that work? Say that I wanted to write some code in Scala, and use it in Clojure.
19:56dsantiagoYou'd probably use the regular Java interop with the names of the classes/methods as they are mangled by Scala.
19:58TakeVdsantiago: And say that I didn't know how to do that? >_>
19:58dsantiagoHeh, well, I don't know how to do that on the Scala side, I'm afraid.
19:58dsantiagoOn the clojure side, you'd use these Java interop forms: http://clojure.org/java_interop
19:59TakeVSo, I'd just compile the Scala/Groovy/Whatever into packages, import them, and then just use them like that?
20:00dsantiagoAssuming those are all languages that compile to JVM classes, yeah.
20:00TakeVCool, thanks.
20:01TakeVOh, right, what about the other way around? Calling Clojure in, for the sake of ease, Java?
20:02technomancyTakeV: you can't call just any clojure function from java; you need to make it part of a class first. it's certainly not as seamless as calling Java from Clojure, but it's still doable.
20:02nDuffwell, you -can- call just any clojure function from Java, but it's not seamless unless it's part of a class first
20:03TakeVWhat are the methods to do so?
20:05technomancynDuff: oh, I guess that's true; you can look it up through clojure.lang.RT.var and then call .invoke on it.
20:08nDuffTakeV, what technomancy just said :)
20:56herdrickdoes anyone know where the Colt docs are for the version that Incanter uses?
20:56herdrickfor example, all the docs I find for the Matrix class are for cern.colt.matrix.DoubleMatrix2D
20:56herdrickbut Incanter is apparently using cern.colt.matrix.tdouble.DoubleMatrix2D
20:57herdrickfor which I haven't found docs
20:59liebkeherdrick: Here's a link to a zip file with the docs: http://sourceforge.net/projects/parallelcolt/files/parallelcolt/0.9.4/parallelcolt-0.9.4-doc.zip/download
20:59herdrickah, never mind, I think they are here: http://incanter.org/docs/parallelcolt/api/cern/colt/package-summary.html
20:59herdrickah, ok
20:59herdrickliebke: thanks
21:00liebkeI need to update the docs I keep on the Incanter site, there's been a lot of changes
21:02herdrickoh, really?
21:02herdrickok, i'll download those
21:03liebkewell, mostly subtle, pain in the butt changes
21:06herdrickin that case I have another question
21:06herdrick(.viewSorted (matrix [[0 1 2] [3 4 5]]) 1)
21:06herdrickis what I'm trying, but I get a NPE
21:07herdrickor with any value for the final arg within range
21:07herdrick,(.viewSorted (matrix [[0 1 2] [3 4 5]]) 1)
21:07clojurebotjava.lang.Exception: Unable to resolve symbol: matrix in this context
21:07herdrick,(.viewSorted (incanter.core/matrix [[0 1 2] [3 4 5]]) 1)
21:07clojurebotjava.lang.RuntimeException: java.lang.ClassNotFoundException: incanter.core
21:08herdrickhmm, not sure how to import with clojurebot
21:09herdrick,(require 'incanter.core)
21:09clojurebotjava.io.FileNotFoundException: Could not locate incanter/core__init.class or incanter/core.clj on classpath:
21:09herdrickmaybe not
21:09liebkeClojurebot doesn't have Incanter
21:09herdrickbummer
21:10herdricksee anything wrong with how I'm using .viewSorted ?
21:11liebkeare you getting a null pointer exception?
21:11herdrickyes
21:12liebkeme too
21:13herdrickah, ok
21:20liebkeherdrick: sorry I couldn't be more help. I'll need to do some more digging to figure out what's going on. If you figure some more out, let me know. Goodnight.
21:20herdrickliebke: ok, thanks
23:15rhickeynum is alive
23:16rhickeyhttp://github.com/richhickey/clojure/commit/6ab3e4cd672092823a04c944210a23c29142785d
23:17rhickeyhttp://gist.github.com/440102
23:18tomojhoorah
23:18dsantiagoThat is awesome.
23:18dsantiagoThis is probably a stupid question, but I thought we should use #^ for type hints?
23:18dsantiagoIs that changing back?
23:19rhickeydsantiago: #^ is old, use ^
23:19dsantiagoOK, thanks.
23:19rhickeycontrib works with num
23:22rhickeynum includes prim