#clojure logs

2010-01-18

00:11tolstoyIs there a nice way to prompt for and read in a value from the repl?
00:13tolstoyAh. Hm. Maybe it's just the Netbeans repl that's the prob with (read).
00:15tolstoyOr maybe not.
02:36LauJensenMorning crew
02:47woobyhi all, when destructuring... how might i go about separating head and tail in an fn's arglist?
02:47woobyi'm aware of :as but that seems to yield the entire arg list
02:47tolstoy(let [[a b & rest] (some-list)]....) ?
02:48woobyoh duh, thanks tolstoy
02:48tolstoyno prob. I just learned you can do whacky map {} things that way, too.
02:50woobyi saw that
02:51woobypretty soon my fn's won't have any bodies left :)
03:16yangsxit seems the problem of using swank-clojure/slime won't be resolved soon (let me know if I'm mistaken), I'm looking for using clojure on netbeans or eclipse. Anyone has any suggestions?
03:16tolstoywhat's the problem?
03:18yangsxLatest versions have a problem that renders interactive using slime on clj source files impossible, but repl is OK.
03:19tolstoyYou mean you can't eval functions or buffers into the image?
03:21yangsxtolstoy: that's right.
03:22tolstoyYikes. I've been using the elpa package for slime / clojure mode, and then making my own standalone swank server (with appropriate classpath). Seems to work.
03:23yangsxtolstoy: see http://paste.lisp.org/display/92713
03:29janmejayhas anyone experienced this problem where slime repl console doesn't
03:29janmejayevaluate forms on pressing return
03:29janmejay?
03:33janmejayhitting return executes slime-repl-return but doesn't evaluate the expression and doesn't return the prompt either
03:35janmejayinferior-lisp buffer however responds to return key and evaluates the expression
03:38ordnungswidrigjanmejay: I remember to have encountered this behaviour but this was surely some month ago. I now use clojure-mode from elpa with a swank server started from leiningen and have no problems.
03:41janmejayordnungswidrig: in my case, clojure is running as an inferior process, will try starting swank server and connect to it
03:43janmejayordnungswidrig: any ideas where the problem is? any other ways to fix it?
03:44LauJensenjanmejay, if par-edit is active in the REPL nothing will evaluate
03:46janmejayLauJensen: it doesn't have paredit mode
03:47janmejayany other gotchas?
03:47LauJensenWhich modes are active?
03:49janmejayLauJensen: REPL, {user clojure} and autodoc
03:50LauJensenhmm... You don't need autodoc, but it doesn't appear to be a mode thats causing it. Try disabling it
03:51janmejayLauJensen: didn't help
03:51janmejayLauJensen: it responds to return key, does new lines and all that, but doesn't eval the expression and return prompt
03:57LauJensenjanmejay: then I don't know - You could try following these instructions http://www.bestinclass.dk/index.php/2009/12/clojure-101-getting-clojure-slime-installed/
03:57LauJensenThen I'm sure it'll work
03:58janmejayLauJensen: sure, will try this one
04:20vu3rddyangsx: are you running Debian?
04:20vu3rddI resolved the problem.
04:22vu3rddyangsx: Debian's netbase package had an issue which was causing the problem.
04:23vu3rddThe default port being listened was an ipv6 port. You can fix it by either of the two following ways
04:24vu3rdd1. open /etc/sysctl.d/bindv6only.conf and make net.ipv6.bindv6only=0
04:24vu3rdd2. Start Java with -Djava.net.preferIPv4Stack=true
04:25vu3rddeither of this will work fine
04:39jevgeniHi guys, I wonder, is the Clojure Google Group premoderated for new members just for the first message or is there some other logic behind?
05:10angermanIf i have(let [t {:a {:b 1} :b {:a 2}}]) how do I get 1 or 2. ((t :a) :b)? or can I do something like (t :a :b)?
05:12esj(-> :b t :a)
05:13esjor (-> :a t :b)
05:13angermanthanks
05:13esjnp
05:13angermanI guess (->> t :a :b)
05:14angermanis more "readable" :D
05:14angermanbut i totally forgot about threading
05:14LauJensen->> is incredible useful and easily read
05:15esjyeah, I always forget that one. Feels like playing Robin Hood :)
05:16LauJensenSteel from the rich do you ?
05:16LauJensenSteal
05:18LauJensenIts a healthy headache though
05:18esja neurogenesis headache
05:21angermanclojure has list comprehention, right_
05:22esjfor
05:22angermanok
05:25Chousukeit produces a lazy seq, though, but close enough, right? :)
05:45LauJensenChousuke: lazy-seq != list comprehension ?
05:49powr-tocDoes anyone know why add-classpath is deprecated?
05:52lpetitpwor-toc: because it was black magic :-)
05:54powr-toclpetit: How is it black magic... other than of course
05:54powr-tocbeing classloader related :-) All it seems to do is add the jar
05:54powr-tocclasses into the classloader clojures compiler uses
05:59lpetitI don't remember the exact details
05:59unfo-nice ctcp spam
05:59unfo-could somone set +R
05:59andreas1"nice"?
06:00unfo-holy fuck.
06:00unfo-aaaah /ignore #clojure CTCP helps a lot :)
06:00angermanAgain. if I have a structure that looks like {:key1 {:subkey1 value}}. so the values are the leafs, can I apply a function to all leafes an get a new structure back?
06:18LauJensenI wonder what kind of money you make off a ctcp spam campaign
06:18VorTechSnone, it's an attack against freenode
06:19Chousukewell, they might also gain some spambots
06:19LauJensenOh, seems a little futile then
06:19LauJensenAlthough its surprising that Freenode didn't have some kind of mechanism in place which stopped it
06:20ChousukeWell, that's easy to say, but do you have any idea what that mechanism could be? :P
06:20LauJensenLooks like a simple IPTables rule could have stopped it
06:20Chousukesure, but how do you know the network before the attack happens?
06:20LauJensenOr just to check if a ctcp message contains a link
06:21Chousukethat's too general.
06:21LauJensenNot really - Who needs links in CTCPs ? :)
06:21ChousukeWell... someone might.
06:21LauJensenChousuke - You're either with us.... or against it
06:21LauJensenSo whats it gonna be spam-lover?
06:21Chousuke:P
06:23VorTechSI understand our new daemon will prevent these attacks
06:31powr-toc /ignore #clojure CTCP
06:32unfo-powr-toc, indeed
06:57angermanHmm bad network.
06:57angermanSorry to ask again. if I have a structure that looks like {:key1 {:subkey1 value}}. so the values are the leafs, can I apply a function to all leafes an get a new structure back?
06:59Chousukeangerman: there's update-in
07:00angermanChousuke: thanks, will look into
07:00Chousukethough if you need to apply a function on the values of the entire submap given a key, it might be better to do it "manually"
07:04dabdHow do I pass a Map to a Clojure function from Java?
07:05Chousukehmm
07:05Chousukeclojurefn.invoke(themap)?
07:07dabdChousuke: thx
07:08ChousukeI haven't actually tested it, but it's something like that
07:09dabdhowever I still don't get how to create the keywords in Java so the Clojure function retrieves them as they are expected in the function signature...
07:11Chousukeclojure.lang.Keyword.someStaticMethod :P
07:11Chousuketake a look at the source
07:11Chousukethe java side of Clojure is not very well documented. Though I think I saw Chouser working on that.
07:12ChousukeI hope I didn't hallucinate
07:12andreas1Hi!
07:12andreas1Did I understand that correctly that there is no such thing as a mutable vector in Clojure?
07:12ChousukeDepends on what you mean.
07:13Chousukethe native Clojure vectors are persistent, but you can always use java things.
07:13AWizzArdOT: how do I say this correctly? "The user may call the web server's /xyz resource." Is it "servers" or "server's" or "servers'" or better "The user may call the /xyz resouce of the web server."?
07:14LauJensenandreas1: (transient []) is mutable
07:14andreas1Chousuke: Mh, I see.
07:14ChousukeLauJensen: no, it's transient!
07:14andreas1The difference being?
07:14LauJensenChousuke: Its mutable eve nstill
07:14andreas1(using Java is cheating in my book...)
07:14Chousukeandreas1: calling it mutable might make you think you can use it like a mutable vector :P
07:15dabdChousuke: it looks like it should be like this: clojure.lang.Keyword.intern(null, "name");
07:15andreas1Ah!
07:15Chousukedabd: yeah.
07:15LauJensenandreas1: The difference is, that once you've worked on it, persist it with (persistent ..). That way it cant leak into your system. It has its own set of functions like conj! assoc! etc
07:15LauJensenIts for local mutations only, not something which is passed all around your project
07:15Chousukeandreas1: or I guess the correct phrasing should be "you might be tempted to use it like a non-functional data structure"
07:16LauJensenandreas1: http://clojure.org/transients
07:19andreas1Hm, transients. I see.
07:19ChousukeIt's very important to remember that you still need to write functional algorithms if you use transients
07:20ChousukeThey don't allow you to escape into the imperative world :)
07:20andreas1Hm...
07:20LauJensenChousuke: If he read Richs rationale I'm sure he'll be good to go :)
07:21andreas1Even though I appreciate persistent data structures and functional programming, I sometimes feel like mutable data structures are a good thing, if used carefully.
07:21ChousukeIf you need mutable data structures, the JVM's are as good as anything.
07:21andreas1And what if I'm using ClojureCLR?
07:22Chousukethen I guess you need to use the CLR's data structures :/
07:22andreas1That... is not a satisfactory answer. :)
07:22Chousukeif portability matters, you'll need to write a wrapper
07:23ChousukeClojure doesn't offer you mutable data structures because you're not supposed to use them :D
07:23andreas1That does start to sound like the IO monad.
07:24andreas1btw., how can making a structure transient be O(1) if it copies said structure?
07:25Chousukeit doesn't.
07:25ChousukeMaybe some time in future Rich or someone else will come up with a way to integrate real mutable data structures into the clojure model of programming, but that hasn't happened yet.
07:27Chousukethe thing is, they don't work well with most of the good stuff Clojure has to offer. the STM breaks with mutable data, as do seqs. Probably some core functions presume that the things passed to them are persistent, too.
07:28dnolenandreas1: in the docs it says "shares structure", there's no actual copy op.
07:28andreas1Hrm. One could use escape analysis to get the performance of mutable data structures out of persistent structures.
07:28Chousukeperhaps.
07:29Chousukethat's up to the JVM folks for now :)
07:29ChousukeThere isn't much interest in making the Clojure compiler very smart
07:29andreas1That is a huge mistake, if you ask me.
07:29Chousukeit just tries to produce code that's easy for the JVM to work with.
07:29andreas1Sure, the JVM does a lot of interesting optimizations.
07:30ChousukeWell, maybe someone will work on it after it gets reimplemented in Clojure
07:30Chousukebut for now, it's not a priority.
07:30andreas1But there are some things the JVM just can't do, because it lacks information the Clojure compiler has.
07:31ChousukeI mean, certainly no-one would object to a having a smarter compiler, but currently the cost-benefit ratio is not very good.
07:31andreas1Does the current compiler do any kind of type inference?
07:31dnolenandreas1: not really.
07:32andreas1The thing I would be afraid of is that there are things in the language design that make writing a good compiler intractable.
07:33ChousukeI don't think that will be a problem.
07:33dnolenandreas1: i doubt that.
07:33andreas1I don't have an opinion on that yet, as I don't know enough clojure yet.
07:34andreas1But the way multi methods work looks suspicious. One wants to have the capability to resolve dispatch at compile time.
07:35dnolenandreas1: look into deftype and defprotocl then.
07:35Chousukebut that would break dynamicity
07:35Chousukeand the JVM can optimise such things pretty well.
07:36andreas1I'm coming from a Dylan background, btw., the last attempt at a better Lisp dialect.
07:36andreas1dnolen: I will.
07:36Chousukebut yeah, multimethods are needlessly slow for the common case. that's why everyone's excited about deftype and protocols :)
07:36dnolenadnreas1: mikel, a dylan fan, really got into Clojure. So I assume there will be plenty in Clojure to make you happy ;)
07:37Chousukebut now I must leave for food. Later.
07:37andreas1dnolen: Clojure is certainly the first language in this millenium that I'm getting excited about. :)
07:37andreas1Chousuke: later!
08:01LauJensenhttp://www.assembla.com/wiki/show/clojure/Protocols
08:03andreas1LauJensen: thanks.
08:04LauJensennp
08:05andreas1Although given all the research done on multimethods, I fail to see the point of introducing yet another mechanism to do about the same.
08:08esbenagen-and-load-class is an unknown symbol for me - what do I need to do to make it available?
08:09dnolenandreas: deftype and defprotocol are mostly about performance as well as being the groundwork for implementing Clojure-in-Clojure. If you want something more flexible/general multimethods are certainly the way to go.
08:11andreas1dnolen: if performance is the reason, somebody didn't do their homework on how to make multimethods fast.
08:27ohpauleezCan anyone point me to a resource that will help me hook up a clojure REPL to a maven project?
08:28ohpauleezor is the typical way to make a clojure script that does all the imports and starts a repl
08:39alexyk~maven clojure
08:40alexykclojurebot: google maven clojure
08:40clojurebotFirst, out of 9260 results is:
08:40clojurebottalios's clojure-maven-plugin at master - GitHub
08:40clojurebothttp://github.com/talios/clojure-maven-plugin
08:40ohpauleezthe maven clojure plugin?
08:40alexykyep
08:40ohpauleezcool, thanks
08:41ohpauleezI was just about to try it, I couldn't tell if it was strictly for handling clojure projects, or if I could also use it for interop
08:41alexykam not sure
08:48cemerickohpauleez: talios' plugin is very good, FWIW
08:48ohpauleezcool, thanks cemerick
08:48cemerickWe don't use clojure projects per se -- just regular java projects + clojure-maven-plugin
08:49ohpauleezthat's exactly what I'm looking for
08:50cemerickI'm not sure what a "clojure project" would be, actually. Enclojure has the concept, but as far as I can tell, that just pulls in some custom packaging mechanism (which has been rapidly subsumed by other efforts, IMO).
08:51cemerickohpauleez: not sure what environment you use, but enclojure provides a 'start repl here' command for *any* project, which is nice.
08:51ohpauleezthat's what I'm looking for
08:52ohpauleezat whatever level I'm at, I want to have a repl
08:52ohpauleezwith all the dependencies I need
08:52ohpauleezso I don't have to do all the imports
08:53cemerickyeah, the nice thing about enclojure is that, even if you have a pure-java project that depends upon clojure (or another project that depends upon clojure), but which has no clojure code itself, the 'start repl' command will work without a hitch.
08:54ohpauleezcool, I'll take a look at it
08:55andreas1try/catch unwinds the stack before caling your exception handler?
08:58jcromartieso is compojure + enlive kind of a "blank slate" in terms of how you set it up?
08:58jcromartielike, there's no convention for how to name things or where to put stuff?
09:11chousersomeone on the internet is wrong!
09:11_foguschouser: Go get em!
09:11chouser:-P
09:12dnolenandreas1: try/catch is from java so yes. you might want to look at chouser's error-kit in clojure-contrib
09:12andreas1dnolen: I see, thanks.
09:13chouser,(fn [] (loop [i (int 0)] (recur nil)))
09:13clojurebotjava.lang.RuntimeException: java.lang.IllegalArgumentException: recur arg for primitive local: i must be matching primitive
09:14chouserlook at that, a nice tidy compile-time error because i is an unboxed primitive and so nil is not a possible value
09:14LauJensenuuuh
09:14LauJensenthats new
09:14chousersince when?
09:14chouserI mean, not very new.
09:14ChousukeI think that's quite old, actually.
09:14jcromartiehow do you all structure your compojure projects?
09:14dnolenjcromartie: no conventions, definitely blank slate.
09:15jcromartiemaybe at least have views/ for Enlive templates
09:16jcromartiemaybe src/ and public/
09:18_fogusThat quote is from here: http://clojure.org/data_structures
09:18chousergah!
09:18chouserrhickey: may I please fix that?
09:19LauJensen_fogus: when you say 'that quote' what do you mean ?
09:19_fogusThe other quote is from here: http://clojure.org/runtime_polymorphism
09:20_fogus"Clojure does not support implementation inheritance." and "nil is a possible value of any data type in Clojure (since primitives are always boxed)"
09:20jcromartiewhat's the most up-to-date Clojure tutorial?
09:20jcromartieerr
09:20jcromartieCompojure
09:21andreas1fogus: You seem to be reading my tweets. :)
09:21jcromartie(sorry parsing only this morning C.*j.*)
09:21_fogusandreas1: That would not be false. ;-)
09:22cemerickjcromartie: we follow maven conventions. Enlive templates are in src/main/resources.
09:22jcromartieah, so you can then just deploy as a WAR?
09:22chouserandreas1: it looks like the official pages are a little out of date or something.
09:23LauJensenjcromartie: I think I have a few blogposts on Compojure, www.bestinclass.dk
09:23cemerickactually, src/main/webapp so they're in proper position w.r.t. css and js, but we define src/main/webapp as a resource root so that they're copied into the war as classpath-accessible resources
09:23cemerickjcromartie: right
09:24chouserperhaps just overly broad.
09:24rhickeychouser: fix what?
09:24chouser"primitives are always boxed" on http://clojure.org/data_structures
09:24andreas1chouser: I see... however, what is the truth in this case?
09:24andreas1"nil is a possible value of all data types except unboxed"?
09:25AWizzArdDoes the master branch now include most recent updates, such as deftypes, the new agent error handling, etc?
09:25cemerickcgrand: is there any potential downside to using xml-resource to consume xhtml in enlive?
09:25rhickeychouser: ok - fixed to say what?
09:26chousernil is a possible value of any non-primitive, I guess
09:27cgrandcemerick: no, as long as it's xhtml xml-resource is ok
09:27chouseror "primitives are boxed except when held in primitive locals or fields"
09:27cemerickcgrand: OK, that's what I figured, but your github msg got me slightly worried :-)
09:28andreas1Is there documentation on what primitives are?
09:28andreas1I think btw. that nil being a possible value for all non-primitive data types is one of the major misfeatures of Java.
09:28chouserLauJensen: that compile-time check of the primitive has been in place at least since Jun 1 2008
09:29Chousukeandreas1: well, java only really has two things: primitives and references
09:29chouserandreas1: it is true that Clojure is (mostly) dynamically typed, which almost necessarily brings in some of the things I think you're objecting to.
09:30andreas1chouser: That's not true. I can easily have a dynamic language with a type that doesn't allow nil.
09:30_foguschouser: Why not just change the part in parens to "(except for primitives)" with a link to http://clojure.org/java_interop#toc37 perhaps
09:30LauJensenchouser: I guess I'll just have to give up my old habit of immediately dismissing the backtrace in order to look at the code :)
09:30Chousukeandreas1: it might be useful to have references that you can't explicitly nullify, but hm.
09:31chouserlike "no type inference" -- it's mostly unnecessary because Clojure's dynamically typed, though there is a little bit of type hint deduction going on...
09:31andreas1Chousuke: it is extremely useful, because I don't have to deal with nil all over the place.
09:31_fogusThe problem with nil isn't that it's there... it's that it plays double or triple duty
09:31Chousukeandreas1: but nil is also a very useful value sometimes.
09:31Chousukeandreas1: as "I have nothing"
09:32chouserandreas1: hm, maybe we're not meaning the same thing. there's no such thing as a nil vector, for example, but anything that can hold a vector (a local, a var, a ref, etc.) could also be nil
09:32andreas1Chousuke: type unions of your type and the canonical false value serve this purpose pretty well.
09:32Chousukeandreas1: what if you want the value to be false?
09:32andreas1chouser: and type inference is extremely useful to get performance out of dynamically typed languages.
09:32chouser_fogus: yeah, I like your solution.
09:33andreas1Chousuke: I just cons up a special magic "no such value" object.
09:33Chousukeor you could just use nil :)
09:33ChousukeI think Clojure handles nil pretty well.
09:33andreas1What if you want nil to be a legal value?
09:33Chousukewell, it is.
09:34andreas1Type inference in dynamic languages was pioneered by CMU CL, btw., some 20 years ago.
09:34Chousukein most cases it just means "nothing".
09:34andreas1Yeah. However, sometimes it doesn't make sense to pass "nothing".
09:34ChousukeI mean, it's not perfect, but in a dynamic language there's not much use in having separate "nothing" types.
09:35andreas1I think this is the time to ask what exactly your definition of a "dynamic language" is.
09:36andreas1Because yes, it makes perfect sense to allow "nothing" values only in those places in your program where they do make sense.
09:36chouserandreas1: "allow" as in to otherwise prevent at compile time?
09:36Chousukeyes, but I think it would make no difference if the null is of type "String null" or "Keyword null" because it would behave the same in every case
09:37andreas1chouser: at compile time if you can, at run time if you must.
09:37_fogusChousuke: I can imagine a separate nothing type being highly useful in a language with Clojure-like multimethods
09:37andreas1It wouldn't be "String null". It would be type union of "String" and "null".
09:38Chousukeso Maybe String, then? :P
09:38chousercurrently, Clojure does to rather less at compile time than it could, but there are interesting possibilities ahead.
09:38andreas1(def maybe-string (type-union :String :Null))
09:38andreas1Why not.
09:38Chousukebut how is that different from Maybe Keyword, if the type is necessarily determined at runtime anyway.
09:39ChousukeI mean, because the language is dynamic, you can pass a Maybe Keyword to something that expects a Maybe String
09:39Chousukeand it'll just fail.
09:39Chousukeat runtime.
09:39Chousukeyou might be able to do static compile time checks to prevent such things, but fundamentally you must not make it *impossible*
09:40Chousukebecause then the language would not be dynamic
09:40andreas1I don't think it is a good idea to have everything dynamic anyways.
09:40andreas1I don
09:41andreas1I don't see why it should be a bad idea to write a function and declare "this function takes two strings as its argument".
09:41Chousukeit's not a bad idea.
09:41Chousukebut you should also be able to redefine that function to take two keywords
09:41Chousukein a static language, that's impossible.
09:42andreas1And I don't see why it would be less dynamic just because I get a meaningful type error at compile time or runtime when trying to call the function with something else than a string.
09:42andreas1Plus, I don't mind when redefining the function signature at runtime is an expensive operation.
09:43Chousukeyou (ideally) do get meaningful type errors at runtime in a dynamic language.
09:43chouserClojure has pre/post conditions to help check things at runtime
09:43_fogusandreas1: You can get some of this using :pre and :post
09:43chouser:-)
09:43_fogus... or what chouser said
09:43Chousuketht's the point. the types are there; whether the code makes sense is determined when you actually execute it
09:43Chousukeyou can't add together two strings
09:44andreas1I prefer if the type system automatically takes care of that.
09:44Chousukeunless you define the + operation for them somehow, which might be possible in a dynamic language.
09:44chouserAnd I am looking forward to the static checking that datalog may be bringing.
09:44andreas1chouser: datalog?
09:45Chousukeandreas1: it's a difference in approach
09:45chouserandreas1: there's a datalog lib in contrib. I don't know how far away it is from providing what I'm hoping to see...
09:46Chousukeandreas1: that said, dynamicism doesn't completely preclude static checking
09:46chouserthe idea is that it could be used to make deductions and assertions about your code at compile time -- just just classic types, but whatever other assertions you which to make based on facts you provide in the code at compile time.
09:47chousers/just just/not just/
09:47andreas1chouser: that sounds good.
09:47chouserandreas1: I think so too, but like I said I don't know how far away it is.
09:47_fogusSpeaking of contrib's datalog... is that actively maintained?
09:47Chousukeandreas1: however, I consider it important that you can just tell the compiler to shut up and let you write the code :)
09:48andreas1Chousuke: I second that.
09:48sparievhi, is there any yaml parser in clojure ?
09:48Chousukeandreas1: for example, with a dynamic system it's trivial to write "incomplete" systems that you *know* will fail if you execute a certain code path, simply because it's not implemented yet.
09:48Chousukeandreas1: it's very nice for incremental development.
09:48chouser~google java yaml
09:48clojurebotFirst, out of 187000 results is:
09:48clojurebotJYaml - Yaml library for the Java language
09:48clojurebothttp://jyaml.sourceforge.net/
09:48andreas1I have that pet theory that the difference between static and dynamic languages is that the former throw errors at compile time, and the latter throw warnings and introduce runtime type checks.
09:49chouserspariev: there you go!
09:49andreas1Chousuke: Yes, but when I'm done hacking, I want to be able to tidy up the code and make it run fast.
09:49andreas1Chousuke: Without having to rewrite it all in a different language.
09:49Chousukeandreas1: sure, and a dynamic system can allow that.
09:50chouserandreas1: Clojure does some interesting things to get performance out of dynamic code, esp. post-1.1
09:50andreas1Chousuke: I'm coming from a Dylan background, which does have such a dynamic system. :)
09:50sparievchouser: thanks, I know about jyaml, I just thought there are exist pure clojure lib
09:51chouserspariev: oh, I see. I don't know of one, but I would recommend embracing Java libs that get the job done. :-)
09:51andreas1chouser: I hope you're not referring to defprotocol here...
09:52Chousukeandreas1: I just think that you don't need static checking to get faster code :)
09:52andreas1Chousuke: Let me give you an example.
09:53chouserandreas1: hm, don't you like defprotocol? :-) I was referring to the keyword call-site caching stuff.
09:53andreas1In Dylan, the for loop is a macro.
09:54andreas1Chousuke: in Dylan, the FOR loop is a macro.
09:54andreas1You write 'for (i in collection) do-something(i); end;'
09:55andreas1The macro expands into a call to a multimethod, that returns a number of functions to iterate across the collection.
09:55andreas1A local function with tail recursion is used to implement the loop, and the functions are called to do the iteration.
09:56andreas1Now if the compiler happens to know that 'collection' is, say, a vector, it can resolve the multimethod call.
09:56andreas1It can then inline the call to the specific method for vectors.
09:57Chousukeright.
09:57andreas1It can then inline all the functions that make up the iteration protocol.
09:57andreas1Tail recursion removal kicks in, too.
09:57Chousukethe JVM does stuff like that at runtime :)
09:57andreas1In the end, a whopping 4 assembler instructions are emitted.
09:57andreas1An init, an increment, a compare and a branch.
09:58chouserMmmm. That does indeed sound like some good engineering.
09:58Chousukeit can notice that 99% of the objects passed to a certain function are of a certain type, and inline code based on that.
09:58chouserIf you later pass in something that's not a vector, does it drop back to a slow path?
09:59andreas1chouser: You make a promise at compile time that this will always be a vector.
09:59chouserah, so not dynamic anymore.
09:59andreas1No.
09:59Chousukethe JVM? As far as I know, yes.
09:59chouserright, so that's one interesting trade-off.
09:59Chousukethe fun thing is, the type check should be free
09:59andreas1chouser: If you have the compiler at run time, you might be able to do stuff like that dynamically.
10:00Chousukebecause of weird out-of-order processor black magic
10:00chouserChousuke: right
10:00chouserfree. amazing.
10:00andreas1chouser: exactly. I can write dynamic code for my experimental hacking, and then when I'm down with it, I sprinkle a couple of type declarations over my code, and it becomes fast.
10:01chouserandreas1: sure, but I meant a trade-off between dynamic-to-the-end (with as much speed as possible) vs. speed via staticness
10:02Chousukechouser: I don't claim to understand the details, but I think it in essence executes both codepaths simultaneously and just throws out the one that fails :P
10:02Chousukechouser: black magic.
10:02chouserandreas1: anyway, my main purpose is not to convince you of anything, but I want to make sure you at least have correct facts about Clojure on which to base your conclusions. :-)
10:03andreas1chouser: This is well appreciated.
10:03chouserClojure does have some things (sprecifically primitive locals) that cannot hold nil, and the compiler even does some of that checking at compile time.
10:04Chousukeyou also get compile-time checks for tail-recursion
10:04Chousukewhich is fun.
10:05chouserClojure can be aware of the (host vm) types of things at compile time, and make very simple deductions (not sure I would call it "inference") based on those.
10:06ChousukeAlso why I think recur should stay even if the JVM gains a TCO guarantee. And maybe for mutual recursion you could have a (recur-at somefn args)
10:06chouserClojure does allow you to define objects (via proxy and now reify) that inherit implementation from host vm classes.
10:06andreas1I keep reading "host vm". :)
10:07chouserbut having said that Clojure does not encourage implementation in heritence (I think rhickey considers it a misfeature) and instead encourages more of mixin approach
10:07chouserandreas1: yes you do. :-)
10:07Chousukeandreas1: There are two implementations of Clojure on two different hosts. :)
10:08chouserThree if you count JavaScript. Which I don't. So 2.
10:08ChousukeThat said, Clojure on the JVM is the "standard" and ClojureCLR just tries to look like it as much as possible.
10:08andreas1I'm just saying that it is cheating to point to the host VM for features that I feel missing in a language.
10:08chouserno! not cheating!
10:08andreas1Especially if there are multiple.
10:08ChousukeWell, Clojure is very tightly bound to the host
10:09chouser...whichever host you happen to choose. :-)
10:09ChousukeThat might become less true as things advance, but right now ClojureCLR and ClojureJVM are quite separate entities
10:10andreas1And if I got my terminology right, "mixins" do have implementation inheritance.
10:10andreas1The thing without implementation inheritance is "interface".
10:10chouserit's really a lovely idea. Maybe one day someone will create a vm designed specifically for running Clojure code, but I have a hard time believing it will be able to compete with other broader vms
10:10andreas1I just don't see why you wouldn't have all your language features specified independently of the host vm.
10:11Chousukeandreas1: well, you could. but some of those features could be a really bad fit for the host
10:11chouserandreas1: "mixin" may not be quite the right word. when you extend a protocol, you can reuse existing functions or groups of functions.
10:11Chousukeso you'd have to implement all kinds of workarounds and you'd lose the "seamlessness" that clojure provides.
10:12ChousukeThat's the reason strings don't have metadata, among other things
10:12andreas1I *was* wondering about that.
10:13andreas1And I haven't made up my mind about metadata yet.
10:13ChousukeThe tight interop is sometimes limiting, but it's still a feature. :)
10:15chouserI do think the JVM is probably the single biggest drawback to Clojure, as well as one of its most important features.
10:16andreas1Hm. You probably have a point there.
10:16andreas1The thing that attracts me ATM is the new approach towards concurrency.
10:17chouserbut as yet unconvinced about the persistent collections?
10:18andreas1Still unconvinced. The transient thing might be the right solution, I need to meditate about that.
10:18andreas1I know why persistent collections are required to make concurrency work.
10:18Chousuketransients are just a performance optimisation for a very specific use case, though.
10:18chouserwhat about immutable locals? How does that sit with you?
10:18andreas1However, sometimes I don't need concurrency, but fast mutable vectors.
10:19andreas1Again, Dijkstra's algorithm comes to mind.
10:19chouserandreas1: Java has a nice suite of mutable collection types that are handy to use.
10:20andreas1chouser: from a language designer perspective, that's considered cheating.
10:20andreas1Akin to "if you want performance, use assembler".
10:20chouserbut from a language user's perspective, it's fantastic.
10:20chousernono, they interoperate quite nicely
10:20datkadropping to java is much different from dropping to assembler
10:20chouser,(for [x (java.util.ArrayList. [1 2 3])] (+ 10 x))
10:20clojurebot(11 12 13)
10:20andreas1Immutable locals... I don't see why they are needed yet. SSA transformation does exist.
10:21andreas1So, why isn't there a mutable array in Clojure that's *implemented* using a Java vector?
10:21chouserthat's clojure's lazy-seq-generating 'for' macro walking through a mutable Java ArrayList
10:21chouserandreas1: why bother?
10:21Chousukeandreas1: what would that win you over just using the java vector? :/
10:21andreas1Chousuke: consistency?
10:22Chousukein which way?
10:22andreas1No need to touch my code when porting to ClojureCLR?
10:22chouserah, well. That's a whole different feature set that Clojure does not attempt to provide
10:22Chousukethe thing is, you couldn't allow the java things to use conj etc. because then they could get mixed with persistent collections
10:23chouserClojure JVM helps you port between Windows/Mac/Linux, but what language lets you port between JVM and CLR? Certainly not Dylan...
10:23Chousukewhich is not acceptable. :)
10:23Chousukechouser: Common Lisp implementations perhaps.
10:23chouserChousuke: hm, perhaps. Good point.
10:24andreas1In theory, I could write Dylan backends for both JVM and CLR. In practice... well... me and which army? :)
10:24Chousukeproviding you don't use threading or anything nonportable :P
10:24andreas1Scheme should run on both VMs.
10:24chouserandreas1: right. :-/
10:25andreas1Ok, folks, I'm going to get lunch. Has been nice talking to you, thanks for all the information.
10:25chousersame applies to Clojure of course. How much effort do we want to put into rewriting mutable vectors in pure Clojure compared to getting more advanced concurrency features. or whatever.
10:25chouserandreas1: thanks for dropping by :-)
10:26andreas1I try to kick my ass intro writing a decent blog entry on all this.
10:26Chousukeandreas1: you could try specifying a protocol for mutable things and then implementing it on both ClojureCLR and Clojure :)
10:27andreas1Chousuke: Yeah, something like that. Introduce mutability into Clojure!
10:27Chousukeand watch as people run away from you
10:28andreas1Well, one day there will be a language that's close to perfect. And Clojure explores an important point in the design space.
10:28andreas1Anyways, cu all!
10:36AWizzArdI just read some parts of this discussion static vs. dynamic. One thing that I would like is optional static typing.
10:37AWizzArdThe typing system can spit out all info about the problems it finds. And the developer can decide how many of these warnings he/she wants to remove. This could end up in a completely statically typed program, or there could be no change at all.
10:37Chousukelisp can be anything :/
10:37Chousukeit's so malleable
10:37ordnungswidrigAWizzArd: hmmm, static typing plus persistence sounds a lot like haskell. You'll be soon in higher-order-type hell :)
10:38_fogusAWizzArd: Have you looked at Qi?
10:38AWizzArd_fogus: yes
10:39_fogusIs that along the lines of what you're talking about?
10:39AWizzArdI was thinking about something like that: http://groups.google.com/group/clojure/browse_frm/thread/7a48f48e4b197a15/9538dbdb1549f1c6?tvc=1&q=thieme+#9538dbdb1549f1c6
10:41AWizzArdOne interesting alternative could be to extend an already existing bug detector with the necessary capabilities to do full optional static type checking of Clojure programs. FindBugs (http://findbugs.sourceforge.net/) could be such a plattform.
10:42AWizzArdThis can (over time) become more integrated into the different IDEs, by using the API to analyse Clojure code.
10:55jcromartieIs this really necessary when using Enlive, currently? (:refer-clojure :exclude [empty complement])
10:55jcromartieit seems like a straightforwardly bad design
10:55jcromartielike it would be better for enlive to specify its own empty and complement fns explicitly rather than making me dance around their redefinitions
11:05Chousukejcromartie: don't :use enlive :)
11:05jcromartieoh?
11:05Chousukeyou should use :require instead, so you can specify an alias for enlive
11:05Chousukethen you can type (en/empty ...)
11:06jcromartieoh sorry I thought you were saying "don't use enlive" (sans ":")
11:06jcromartie:)
11:06jcromartieyeah that makes sense
11:07Chousukeit's a bit more typing, but should be worth it in the long run
11:08ChousukeI think it's also possible to import functions and rename them, but I don't remember the syntax for that.
11:08jcromartieyeah, I guess I was just considering repl use
11:08jcromartieI usually just launch a repl and (use ...)
11:09jcromartiethen I stick things in source files when they work well enough
11:09jcromartieby the way, rlwrap is a real gem of an tool
11:09Chousukeheh.
11:09Chousukeyou could write a custom import macro and put it in user.clj :P
11:10Chousuke(import-rename-conflicts ...)
11:20Hali_303hi! How to test that a function returns true on all element of a list?
11:20Hali_303something like "forall"
11:21cgrandjcromartie: enlive doesn't clash with clojure
11:21jcromartieyeah, sorry to badmouth your lib :P I am still getting my head around the idiomatic way to import libs in different cases
11:22jcromartieI assume that it's fine to (:use net.cgrand.enlive-html) in an ns in a source file
11:22jcromartieas long as I don't use empty or complement
11:22jcromartie(and then I can just specify which one I want)
11:22cgrandwhat's the problem with empty and complement? Which version are you using?
11:23cgrand:use (without :only) of any library is strongly discouraged except at the REPL
11:24ChousukeHali_303: "every?"
11:25Hali_303Chousuke: thanks :)
12:13osirisx11hi
12:13osirisx11i want to use a clojure program but it is in source form only, clojure looks interesting but i don't have the time to learn it right now
12:14osirisx11please, can anyone tell me how i can compile this code? http://github.com/esessoms/gvgw/blob/master/
12:14osirisx11http://github.com/esessoms/gvgw
12:15r2q2http://github.com/zitterbewegung/blank-appengine-clj <- I made a blank slate for people to start with google app engine
12:17osirisx11thank you r2q2
12:17datkaIf you can get a repl with the src/ in your classpath, you could (require 'com.nubgames.gvgw)
12:17r2q2no problem
12:17r2q2i think there might be mistakes i will test it
12:18r2q2but basically its just following a blog post I believe it requires gae 1.2.0
12:18somniumarent they on 1.3 now?
12:18r2q2yea thats the point alot of the blog posts are from 1.2.x not 1.3
12:18r2q2*point/problem
12:19osirisx11datka: i appreciate your help, i am a very skilled web dev and i know lots of languages, but clojure is not one of them (yet), can you please provide me specific instructions on how i can compile?
12:19datkaIt's unfortunate that this project doesn't include a build file
12:20osirisx11it can't be inferred based on the libs and the clj files?
12:20r2q2somnium: I'm not sure if it actually works with 1.3 though
12:21Hali_303two questions: 1. how to evaluate if a list contains only unique elements? 2. how to tell if a function returns true on at least one element of a list?
12:22somniumr2q2: Ive been using 1.3 with no problems, though I hardly touch the sdk tbh, so no idea :)
12:22r2q2somnium: Okay maybe its my incompetence then.
12:23_fogusHali_303: For #2, look at some
12:23_fogus,(doc some)
12:23clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
12:24somniumHali_303: for #1, you could try (= (count coll) (count (distinct coll)))
12:25_fogusHali_303: And for #1, sets always contain unique values.
12:25datkaosirisx11: If you look at http://clojure.org/getting_started it gives you the line to start a repl, add the dirs for the libs and src to the classpath (after the -cp)
12:25osirisx11thanks
12:26datkaThere are many other ways of starting clojure, but that's just one way
12:27osirisx11i installed a binary package on my ubuntu 9.10
12:27datkayou could probably steal one of the build.xml or pom.xml files from another project if you wanted it compiled to a jar
12:27osirisx11so i don't know if referencing the jar will work
12:27osirisx11ok
12:27osirisx11thanks
12:27osirisx11i have one handy from enlive
12:28Hali_303_fogus: somnium: thank you
12:29osirisx11wow that worked great!
12:29osirisx11all i did was a replace from enlive to gvgw and ran ant
12:30osirisx11umm ant is complaining it can't find clojure.jar yet it also said build successful and output my jar files
12:31r2q2i hate ant :-(
12:31jcromartieI'm happy to have some shell scripts to handle my builds right now.
12:32jcromartiemy stuff is simple
12:32osirisx11Exception in thread "main" java.lang.NoClassDefFoundError: //gvgw/jar Caused by: java.lang.ClassNotFoundException: ..gvgw.jar
12:32jcromartieenv vars to handle dependencies
12:32osirisx11so i guess it didn't compile?
12:33jcromartielet me take a crack at it on my system
12:34jcromartieosirisx11: how do you intend to use this without using Clojure itself?
12:34jcromartieit doesn't export any classes as far as I can tell
12:35jcromartieit looks like it is only intended to be used from a Clojure lib/repl as it is
12:37osirisx11jcromartie: i did install the packages for it, which also includes clojure.jar in /usr/share/java
12:37jcromartieosirisx11: yeah, but I mean what are you going to do with a clojure lib that has no Java interface?
12:37jcromartieor does it run by itself
12:37osirisx11thanks jcromartie, i have no clue about repls
12:37osirisx11i have no clue about this project either
12:38jcromartiek
12:38jcromartiewell let's ee
12:38jcromartiesee
12:38osirisx11thanks jcromartie
12:38osirisx11i'm a great programmer in other langs, but clojure and scheme is totally new to me
12:38jcromartieit looks like it has a main so you can in fact run it by itself
12:39osirisx11james@james-desktop:~/projects/gvgw$ clojure src/com/nubgames/gvgw/main.clj
12:39osirisx11Exception in thread "main" java.lang.Exception: Unable to resolve symbol: defn- in this context (main.clj:7)
12:39osirisx11am i doing it right?
12:39jcromartiethat's not good
12:40jcromartiedefn- is part of clojure.core
12:40osirisx11lol
12:40jcromartiewhat's your script for starting gvgw?
12:40osirisx11just what i pasted
12:40jcromartieso what's clojure?
12:40jcromartiethe command?
12:42osirisx11jcromartie: http://pastebin.ca/1756301
12:42osirisx11i also have the jar in /usr/share/java/clojure.jar
12:44jcromartieoh that's new to me I didn't know there was an official clojure command :)
12:44jcromartiewhere is that from?
12:45r2q2when i use clojars
12:45r2q2i feel like im in a spongebob squarepants movie
12:45jcromartiehah, what?
12:45r2q2look at the errors when you do something wrong
12:46r2q2 Blistering barnacles! Something's not shipshape:
12:46r2q2Password can't be blank
12:46jcromartieosirisx11: I was assuming clojure was a custom shell script or something
12:46r2q2Password: Hunter1
12:46jcromartiethat's hilarious
12:46osirisx11jcromartie: it came when i did apt-get install clojure
12:46jcromartieah, fancy dancy apt user
12:47jcromartienice stuff though
12:47osirisx11*shrug* everyone's got their flavor
12:47jcromartieso clojure.jar should already be somewhere
12:47osirisx11yes, as i said, /usr/share/java
12:47osirisx11i do appreciate your help
12:48jcromartiewhen you just run clojure, do you get a prompt?
12:48jcromartieyou should be able to type defn- and hit enter and get some sort of message
12:48jcromartieother than a missing symbol error
12:49jcromartie"Can't take value of a macro" would be good
12:49jcromartieotherwise there's something seriously messed up
12:49osirisx11yes i got that can't take a value of a macro at the clojure prompt
12:50osirisx11wow i didn't think this would be so hard to compile a clojure app
12:50r2q2osirisx11: Its industrial strength
12:50osirisx11what happened to good ol' ./configure make make install?
12:50r2q2osirisx11: Try out incanter
12:50r2q2osirisx11: I mean lein
12:51r2q2osirisx11: Much easier than ant in my opinion
12:51datkaosirisx11: in this case, there's no "makefile" that's the only reason it's so hard
12:51osirisx11datka: i made one
12:51osirisx11still won't compile...hmm
12:51jcromartieosirisx11: you generally don't just compile a clojure app
12:52osirisx11oh, well i'm okay with just running it
12:52osirisx11or however
12:52jcromartieyah
12:52osirisx11but idk how to do that either
12:52osirisx11lol
12:53jcromartieOK so the deal with this gvgw is that you need to put all of its dependencies on the classpath
12:53jcromartiethat's lib/*.jar
12:53jcromartieand more, elive too
12:53jcromartieenlive
12:54osirisx11ya i have a lib folder
12:54jcromartiethis project is not quite ready for prime time when it comes to being runnable
12:54osirisx11i fixed enlive, everything is good on libs
12:54jcromartieok cool
12:54hiredmanI would ditch whatever script you are using to launch clojure
12:54osirisx11is there not a one liner to start this sucker?
12:54jcromartieapparently not
12:54osirisx11java -cp clojure.jar clojure.main gvgw something?
12:54hiredmanosirisx11: yes
12:55osirisx11what is that?
12:55hiredmanbut you also need any other required jars in the classpath
12:55hiredman-cp clojure.jar:whatever.jar
12:55osirisx11it's in the lib folder there
12:55osirisx11ok
12:55osirisx11i can't just reference the one folder huh
12:55hiredmannope
12:56hiredmanclojurebot: simple?
12:56hiredmangah
12:56datkablame java, not clojure for that one
12:56hiredmanclojurebot: ping?
12:56clojurebotPONG!
12:56hiredmanclojurebot: dirt simple
12:56r2q2yay pushed to clojars
12:56hiredmangar
12:57osirisx11i'm giving up
12:57hiredmanclojurebot: how much do you know?
12:57clojurebotI know 528 things
12:57r2q2clojurebot: I <3 you
12:57hiredmanhttp://www.thelastcitadel.com/dirt-simple-clojure
12:58hiredmanclojurebot: dirt simple setup is http://www.thelastcitadel.com/dirt-simple-clojure
12:58clojurebotAck. Ack.
12:58hiredmanclojurebot: dirt simple setup?
12:58jcromartieOK I got it running
12:58clojurebotdirt simple setup is http://www.thelastcitadel.com/dirt-simple-clojure
12:59jcromartieincoming Gist in a few
12:59jcromartiehttp://gist.github.com/280232
13:00jcromartieOK that script will put together a classpath with all of the jars in lib/ and then start a repl
13:00osirisx11thanks hiredman, why are they skipping step VII?
13:00jcromartieat which point you can load gvgw
13:00osirisx11thanks guys
13:00RaynesGist incoming!! Take your positions! FIRE!
13:00hiredmanosirisx11: don't worry about it
13:01jcromartieosirisx11: I must admit this is way more work than most languages
13:01jcromartiebut I've gotten my clj down to irb simplicity
13:01osirisx11i blame java for most of it
13:01jcromartieindeed
13:01jcromartiethe classpath
13:02osirisx11yeah
13:02osirisx11java is so bloated and falling over itself
13:02jcromartiebut it is supposed to be finer-grained control over what you load
13:02jcromartieand java is not supposed to be used for small utilities
13:02osirisx11so many ways to do things in java, and most of them are not the Right way
13:02jcromartieeh, I don't think that's really the case
13:03jcromartiethe way to run a Java program is to specify where to find the classes in $CLASSPATH and specify the main class
13:03ajazzhello, how can I change *default-encoding* in clojure.contrib.duck-streams (http://bit.ly/7kZ3Fy)?
13:03jcromartiethat's it really
13:03osirisx11rlwrap not found
13:04jcromartieoh, I use rlwrap
13:04jcromartieyou should install it :)
13:04osirisx11just installed it
13:04jcromartieit makes things without readline much more pleasant to interact with
13:04osirisx11now getting Classnotfound on clojure.lang.Repl
13:04osirisx11lol
13:04hiredmanosirisx11: use the dirt simple setup
13:04osirisx11i should forget the binary install from ubuntu repos i think
13:04osirisx11ok thanks hiredman
13:04hiredmanit does not advocate using deprecated classes
13:05jcromartieoh?
13:05hiredmanlike Repl and SCript
13:05osirisx11any idea why they skip VII?
13:05jcromartieI didn't know those were deprecated
13:05hiredmanthey are
13:05jcromartieosirisx11: VII is for older JVMs
13:05hiredmanclojure.main is better and has been around forever now
13:05jcromartieah
13:05jcromartieman
13:05jcromartiethe docs are all over the place out tehre
13:05jcromartiethere
13:05hiredmanthis is why I said ditch the script
13:05jcromartienot the official docs
13:06alexykI reduce a lazy seq, dumping intermediate results every N elements. I need to dump the remainder as well. One way to do it is to append a terminating element to the seq. How is it done so laziness is preserved? The seq is coming from a database...
13:07Chousukeconcat is lazy
13:07alexykChousuke: how about conj?
13:07osirisx11oh man i am running open source java
13:07osirisx11i should be using the sun version, shouldn't i?
13:07hiredmanopenjdk is fine
13:07osirisx11ok cool
13:07hiredmangcj is not
13:07Chousukealexyk: that one's not.
13:07alexykok
13:07Chousukealexyk: but you can do (concat yourseq [terminator])
13:08alexykgood, thx
13:08osirisx11well the version num isn't matching for this dirt simple instructions though.. what is java ver 7.4 for openjdk?
13:08hiredmanosirisx11: what does java -version say?
13:09osirisx11doh.. i..had a typo.. i'm at 1.6.. i'll keep following dirt simple
13:10osirisx11i've been up all night heh
13:13osirisx11bah
13:13osirisx11i can't get this
13:13osirisx11anyone looking for a small closure side job? :D
13:13osirisx11i'll paypal
13:15jcromartieyou're not far off
13:15jcromartieit's just a matter of getting all of the jars on the classpath and then loading the lib and running (main)
13:16jcromartiedo you have all of the Postgres stuff set up?
13:17osirisx11i dont have time to learn and do all this stuff
13:17osirisx11i do appreciate all the help, everyone
13:18jcromartiesure
13:18osirisx11but i am giving up on it for now
13:18osirisx11if anyone wants to help me for pay, pm me
13:20lypanovstarbucks? :D :P
13:22wiligtechnomancy: http://github.com/wilig/swank-clojure
13:23technomancywilig: excellent! I'll try to merge that in later today.
13:24wiliglet me know how it works for ya. And code pointers would be graciously received. :-)
13:25technomancysure thing
13:34lypanovdo it.
13:34lypanovend of line spacing or just general style complaints?
13:35RaynesHow would I zip two sequences together?
13:35chousertechnomancy: I sympathize. :-)
13:35lypanovtechnomancy: my coworkers would hate you. i would love ya.
13:35lypanovwell, first they will hate me, when i tell them we're switching from ruby to clojure.
13:35RaynesLike (zip [1 2 3] [4 5 6]) should yield (1 4 2 5 3 6).
13:35lypanov:))
13:35chouser,(interleave [1 2 3] [4 5 6])
13:35clojurebot(1 4 2 5 3 6)
13:36RaynesThat'll do it.
13:36RaynesThanks.
13:36chousernp
13:36jcromartie,(let [required [:foo :bar] x {:foo 1}] (every? x required))
13:36clojurebotfalse
13:37jcromartie,(let [required [:foo :bar] x {:foo 1}] (filter (fn [k] (not (x k))) required))
13:37clojurebot(:bar)
13:37jcromartiehandy for web parameters :)
13:45lypanovyo LauJensen
13:45LauJensenHey heey
13:45lypanovLauJensen: /me has arch running on his ibook now
13:46technomancylypanov: mostly trailing whitespace and extra-long lines
13:46technomancyalso mixing tabs and spaces
13:46lypanovall evil. i'd say enable.
13:47technomancylypanov: http://www.emacswiki.org/pics/static/TabsSpacesBoth.png
13:47LauJensenlypanov: So are we enemies now, or are you liking it? :)
13:47the-kennyI thinkg highlight80+ should be enabled by default
13:48the-kennys/kg/k/
13:49LauJensenhighlight 80+ is nice, but should it be 100 nowadays? :)
13:49the-kennyI use 80
13:50the-kennyMaybe 100 is fine too
13:50LauJensenI remember trying to enforce the 80c rule on a PHP team once, they objected strongly because of SQL statements... of course ClojureQL fixes that for us
13:51chouser80
13:51hiredmantypographically speaking the optiminal characters per line is somewhere around 60, so 80 splits the difference with 100
13:51the-kennyIt's almost impossible to enforce the 80 rule with Java or so. But it's really easy in Lisp, in my opinion
13:52LauJensenAlso very doable in ASM
13:52the-kennyheh
13:54lypanovLauJensen: loving it. excellent distro.
13:54LauJensenGlad to hear it :)
13:54lypanovdidn't get any time whatsoever to play with clojure itself though yet.
13:54lypanovppc archlinux isn't quite as easy as x86
13:55LauJensenTakes about 2 minz to install though
13:55technomancywith 80 cols you can have two side-by-side windows on a reasonably-sized laptop without squinting
13:55lypanovLauJensen: totalled 6 hours yesterday for me.
13:55LauJensenoh... I spoke to soon :)
13:55lypanovLauJensen: biggest complication, couldn't find a ethernet cable.
13:55lypanovended up setting up network sharing via firewire.
13:55chousertechnomancy: exactly
13:55lypanovtrivial in the end.
13:56lypanovsecond complication, i installed twice. first time i missed out the "mount your partitions step"... reboot. and blank drives. everything was in the unionfs ;)
13:56LauJensenhehe
13:56LicenserI don't really see the reason for the 80c rule any more, screens are so big that it often is totally annoying if code only uses 1/3rd of it - at least to me
13:57chouserI suppose an editor with sufficiently smart wrap/autoindent functionality could eliminate the need for width restrictions, but I've never seen such a thing.
13:57hiredmanLicenser: the point is you have multiple columns of code
13:57technomancyLicenser: you want to carry a 23-inch monitor with you on the subway? =)
13:58Licensertechnomancy: I mostly use 25" ones for the subway, the 23" screens are not handy to beat people of the chairs with
13:58LauJensenchouser: Wouldn't be too tricky to do in Emacs
13:58Licenserthey just don't pack the punch
13:58technomancyhehe
13:58Licenserhiredman: but why 80c then and not 'whatever fits your screen best'
13:59hiredmanLicenser: because everyones screen is different
13:59hiredmanif you know everything is going to be 80 columns you can adjust your setup until you get a nice fit for 80 columns
14:00hiredmantwo, three, or four side by side
14:00lypanovagreed
14:01lypanovi do prefer 100ish though.
14:06lypanovLauJensen: and now, together with using awesome as my wm, i no longer need anything other than a netbook..
14:07jcromartieI downloaded clojure-1.1.0 and when I run it I get Clojure 1.0.0-
14:08hiredmanwhere did you download it from
14:08jcromartieclojure.org
14:09jcromartiehmm, apparently it comes with a 1.0.0 jar
14:09jcromartierunning ant results in a 1.1.0 jar
14:09lypanovoops
14:10hiredmanjcromartie: works for me
14:10hiredmanwhere on clojure.org?
14:10hiredmanhow did you start clojure?
14:10jcromartieor rather http://code.google.com/p/clojure/downloads/list
14:10hiredmando you have a different clojure.jar on your classpath?
14:10jcromartiestarted with java -cp and the path to clojure.jar
14:10jcromartieperhaps
14:11jcromartiehmm, no, no $CLASSPATH
14:11jcromartieI'm setting up clojure on a server
14:11hiredmanI grabbed the zip and the clojure.jar inside is 1.1.0
14:11jcromartiehmm weird
14:12jcromartienot sure what happened then
14:12lypanovevil proxy conspiring against you!
14:13konrWhat was the list-length function called?
14:13jcromartiecount
14:13konrjcromartie: thanks!
14:14jcromartieyay I'm good for something!
14:15konrhaha
14:34Hali_303how to launch REPL giving it a directory of Java classes that I can import in REPL?
14:34the-kennyHali_303: Read about the classpath
14:34the-kenny(java -cp)
14:35Hali_303the-kenny: thanks
14:36the-kennyLeiningen is just awesome
14:39mitchellhHali_303: Here is a simple bash script if you need something quick and fast: http://gist.github.com/280294
14:39mitchellhoh wait dead link one sec
14:40mitchellhHali_303: http://gist.github.com/280295
14:42the-kennyYou can also use M-x swank-clojure-project if you're using emacs
14:43LauJensen~swank-clojure
14:54woobyanyone recall off hand that function that returns a swing window showing a value's structure?
14:58mabeswooby: you mean clojure.inspector? http://richhickey.github.com/clojure/clojure.inspector-api.html
14:58woobymabes: exactly what i was looking for, thank you
15:00mabesnp
15:09Hali_303I'm using the maven goal clojure:repl, however, if I specify a replScript parameter, maven exists after running the script instead of starting the REPL, any idea on this?
15:12alexykcan I "break" out of a reduce on a condition inside fn?
15:13alexykI mean I can feed it pairs (keepgoing,realval) and eff with the keepgoing global from within fn...
15:14alexykbut then FPistas will ostracize me
15:14ynnivthe idea of "break" is not functional
15:14ynnivthats why clojure has lazy sequences
15:15ynnivyou keep processing them until you've had enough
15:15ynnivthats kind of like "break"
15:15alexykynniv: use case. reduce wrks with a humongous seq of days. Test runs must be limited to N days. In advance, we don't know how much of a seq to take.
15:15the-kennyThis reminds me a bit of monads
15:15ynnivalexyk: yeah... there's no way to force something like that to break
15:15alexykOr, how do we tell reduce it had enough when the fn sees a terminating case inside an element?
15:16alexykynniv: see, FP dogma breaks.
15:16ynnivyes, it does... thats why most useful systems aren't only FP :)
15:16LauJensenalexyk: if you saw my Reddit Scraper it kinda breaks :)
15:17alexykLauJensen: didn't see it, how do you solve this?
15:17ynnivI would write your own reduce that checks the time after each iteration and stops appropriately
15:17LauJensenhttp://www.bestinclass.dk/index.php/2010/01/hadoop-feeding-reddit-to-hadoop/
15:17LauJensenalexyk: Have a look, the code is posted there
15:17ynnivthe other method is to dispatch to a thread and kill it if it times out
15:18alexykLauJensen: ok
15:18alexykynniv: killing things is overkill, I'd prefer a zen approach :)
15:19ynnivhmm, i kind of think that killing the thread is more zen...
15:19ynnivits certainly more FP-like than a break equiv
15:19Chousukealexyk: you might try a hybrid approach
15:20Chousukealexyk: write a reduce-some function tht reduces a subseq of the sequence, then returns the result and the rest of the sequence
15:20Chousukealexyk: then use that in a procedure that determines whether it should keep going.
15:20RaynesI has parseded XML in Clojurez.
15:21Chousukealexyk: the point is not to avoid side-effects, but to keep them clearly separated from functional code :)
15:21Chousukeor well, the point IS to avoid side-effects, but you can't always do that :P
15:22ynnivChousuke: yes, knowing exactly where side effects happen is important
15:22alexykChousuke: promising. So I have a predicate (day twit) which tells me which day is this twit from. Upon the day change, a summary stats must be run; also the thing must be limitable to N days, and the end of sequence must force day change anyways. Indeed it looks like it needs a special-case reduce.
15:23alexykhiredman: how do I locate source for reduce again?
15:24alexyki.e. reduce must do take-while on the seq
15:24Chousukeif you want to do it the quick and lazy way, then (defn reduce-some [seq n] [(reduce (take n seq)) (drop n seq)])
15:24alexykChousuke: day is hidden inside elements, so I can't know n in advance
15:25alexykI can break them as soon as I fetch them
15:25alexykbut I fetch them lazily from mongodb
15:25Chousukedoes it matter if you reduce a bit too much? :/
15:25Chousukei guess you could just use take-while and drop-while instead
15:25alexykChousuke: it matters as each day is about 2M twits and I want tests to run fast.
15:26hiredmanyou could, you know, *not* use reduce if what you are doing is not what reduce does
15:26Chousukealexyk: well, if you do the reducing in chunks of 1000, it's not going to be that bad.
15:26hiredmanI really don't know why you keep insisting on a round peg in a square hole
15:27Chousukehiredman: isn't collecting stats from a sequence fundamentally a reduction? :P
15:27alexykhiredman: I do everything with map and reduce :) But I guess this is the case where a special-case function with recur and accumulator may be just what the Dr. ordered
15:27hiredmanChousuke: but if what he wants to do does match what reduce does (early termination) why shoe horn it into reduce?
15:28Chousukewell, the early termination is handled with take-while and drop-while I guess.
15:29alexykI'd have to change the condition for -while's, so reduce would be driven by a manager anyways
15:35jcromartieshould I be able to access a var defined in another namespace?
15:35ynnivalexyk: (use 'clojure.contrib.repl-utils) (source reduce)
15:35jcromartielike if I have a lib, foo, with foo.clj doing (def *bar* :whatever)
15:35chouserjcromartie: only if you're 'use'd or 'require'd that namespace
15:35jcromartiehmm
15:35alexykynniv: thx
15:36the-kennyalexyk: Or in Emacs: M-.
15:36jcromartietried that
15:36the-kennyIt'll take you to the source of the function in Emacs
15:36jcromartieI have foo.clj and foo/access.clj
15:36jcromartieand access.clj (:require foo)
15:36jcromartiebut I get "no such var" on foo/*bar*
15:37alexykthe-kenny: ok
15:37Chousukejcromartie: are the namespaces really named like that? :p
15:37jcromartieno
15:38Chousukeif the require succeeds then it should work
15:38Chousukeyou're not using any shorthand for the namespace in access.clj, are you?
15:39jcromartiewhich namespace?
15:39jcromartiein foo.clj I am doing (:use [foo.access :as access])
15:39Chousukeeg. if the namespace you've :required is foo.bar then you need to say foo.bar/*var*
15:40jcromartiehmm, no access.clj does (:require foo)
15:40hiredmanthat looks like a cyclical dependency
15:40alexykwhat's the idiom to recur on a parameters elems depending on whether it's x & xs or not?
15:40alexykelems is the trailing parameter out of many
15:41Chousuke(if (seq elems) (recur elems) (something when no elems left))?
15:41jcromartiehiredman: yeah it is
15:42hiredmanjcromartie: don't do that
15:42jcromartieyeah
15:42Chousukeheh.
15:42jcromartieI should let foo/access.clj handle its own refs
15:42alexykChousuke: I mean the whole idiom from breaking elems to x & xs to recur; so I'd have to do (let [[x & xs] elems ...] <ahead of your stuff)) right?
15:43Chousukealexyk: ah. I guess so.
15:43Chousukeusually it's the function parameters that are structured so, though
15:43alexykin ocaml/haskell I could pattern-match on top of the function body, but if I have may parame I guess I can't do that by arity...
15:44jcromartieI'm wondering if I shouldn't be passing around an application instance object
15:44alexykChousuke: so would I have parameters as [a b c x & xs]?
15:44jcromartiesomething like a ref with the various bits of state
15:44jcromartiethat would be smart
15:44jcromartiethen I can encapsulate saving and loading it, etc.
15:46Chousukealexyk: hm
15:47alexykChousuke: a b c etc. are accumulators and static limits; x & xs are elems.
15:48alexykI.e. if the number of preceding things is fixed, can I do the breaking in the parameter list?
15:48Chousukethen it'd go something like (fn [a b c [x & xs]] (if (seq xs) (recur a b x xs) ...))
15:49Chousukea b c* for the recur
15:49alexykright.
15:49Chousukeyou can also do it with let, but that's your choice
15:50Chousukeone common idiom is to have an inner function do the walking for you, so that you don't need to pass the static things to recur
15:50alexykChousuke: but when you said the fn is usually structured for x & xs, did you mean [x & xs] as above in the params?
15:51alexykChousuke: and the inner is defined in a (let walker (fn [a b c [x & xs]] ... (walker a b c elems))?
15:52Chousukeeg (fn [a b c elems] (letfn [(dostuff [acc [x & xs]] (recur (+ a b c x acc) xs))] (dostuff 0 elems)))
15:52alexykah! letfn
15:52Chousukelet works too
15:53Chousukethe point is the inner function doesn't need to take the statics as parameters because it can just close over them :)
15:53alexykChousuke: so the inner sees the outer's vals
15:53Chousukeyes.
15:53alexykand clojures over them :)
15:53Chousukec:P
15:54Chousukeclojuring over a function sounds weird.
15:54alexykthat's a good point to ask, " do you remember what the language you're programming in is called"? :)
15:54ChousukeWe need some new closure-like object in Clojure so that we can say that something forms a clojure.
15:55alexykyeah
15:58alexykletfn allows, instead of a let's pair: name (fn [params] exprs), write (name [params] exprs), possibly many, and then have a body inside same [], vs let's name val pairs inside [] and then body, right?
15:58alexykI sense a discrepancy: (let [...] body) vs (letfn [.....])?
15:59alexyki.e. (letfn [.... body])?
15:59alexykno that's not right
16:00Chousuke(letfn [(fnname [args] body)*] body)
16:00alexyk(doc letfn) is confusing: ([fnspecs & body])
16:00clojurebot"([fnspecs & body]); Takes a vector of function specs and a body, and generates a set of bindings of functions to their names. All of the names are available in all of the definitions of the functions, as well as the body. fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+)"
16:01alexykha, (doc ...) triggered clojurebot
16:01alexyk(doc google)
16:01clojurebotTitim gan éirí ort.
16:01Chousukethat's not too weird
16:01alexyk,(doc google)
16:01clojurebotGabh mo leithscéal?
16:01ynnivdon't forget that you can rebind global vars for the duration of a scope
16:01Chousukefnspecs is the vector containing fns and body is the body
16:02ynnivso global variables aren't as "bad" in clojure as in C or java
16:02somniumhmm, letfn* is a special form, is there more to it than a shortcut for (let [f (fn f* ...)])?
16:02alexykChousuke: so *those* []s are the params to the letfn
16:02scodeHmmm. WHat would be the idiomatic equivalent of (read-line) that takes a reader rather than using *in*? (I know I can rebind *in*)
16:03ynnivscode: heh, i was going to suggest rebinding *in* :)
16:03polypusynniv: in java there are lots of global variables, which aren't frowned upon. they're called classes :)
16:03scodeynniv: ;)
16:05ynnivpolypus: well... sure. they're still messy because a different thread can access them, and if someone overwrites them temporarily they won't necessarily restore the original value at the appropriate time
16:05ynnivbut (binding [varname value] ...) does exactly this
16:05Chousukebinding is dangerous too, sometimes
16:06ynnivhmm. how so?
16:06Chousukeespecially when laziness is involved
16:06Chousuke,(binding [+ -] (for [x (range 10)] (+ x 5))
16:06clojurebotEOF while reading
16:06Chousuke,(binding [+ -] (for [x (range 10)] (+ x 5)))
16:06clojurebot(5 6 7 8 9 10 11 12 13 14)
16:06Chousuke,(binding [+ -] (doall (for [x (range 10)] (+ x 5))))
16:06clojurebot(5 6 7 8 9 10 11 12 13 14)
16:07Chousukehmm
16:07ynnivheh
16:07Chousukegah
16:07somniumI think + is inlined on 2 args :P
16:07Chousukebad example again
16:07Chousukeyesh
16:07ChousukeI always forget that
16:07Chousuke,(binding [+ -] (doall (for [x (range 10)] (+ x 6 5))))
16:07clojurebot(-11 -10 -9 -8 -7 -6 -5 -4 -3 -2)
16:07Chousuke,(binding [+ -] (for [x (range 10)] (+ x 6 5)))
16:07clojurebot(11 12 13 14 15 16 17 18 19 20)
16:07Chousukethere.
16:07ynnivi see where you're going tho - if a computation is returned outside your binding, the binding won't apply when its evaluated
16:07Chousukeyeah
16:08Chousukeand inlining further complicates things, as it makes binding completely ineffective ;/
16:08alexykcan lambda fn hace a docstring?
16:09alexykhave
16:09Chousukeno.
16:09_fogusyes
16:09alexykdiscord!
16:09Chousukenot yet, anyway
16:09Chousukesince fns don't support metadata
16:09alexykand those defined by letfn are plain fn's?
16:09Chousukeyes.
16:09jcromartieooh, even better...
16:10Chousukewait, wtf.
16:10jcromartie,(filter (complement {:foo :bar}) [:bat :baz])
16:10clojurebot(:bat :baz)
16:11Chousukehm, got confused about nothing for a moment
16:11Chousuke(it wasn't about fogus leaving)
16:11alexykwas it a _fogus from the future where fn's have docstrings?
16:12Chousukewell, you can always do (def #^{:doc "somestuff"} foo (fn ...))
16:12Chousukebut that's not the fn that has a docstring :)
16:12alexyknah,  a comment will do
16:13jcromartieis 'future' a decent general-purpose way to do something in a separate thread?
16:13Chousukeprobably.
16:13Chousukeif you don't care about the result, just don't store a reference to the future
16:14jcromartieyeah
16:14jcromartieI've used things like (doto (Thread. (fn [] ...)) .start) before but it seems easier to just use future
16:14Chousukethat's basically what future does anyway
16:15jcromartieright
16:15hiredmanfuture uses a threadpool
16:15jcromartiewell then that's one more point for future
16:15hiredmanindeed
16:18alexykso in an if/when condition (boolean), (seq elems) is exactly the same as (not (empty? elems))?
16:20chouseralexyk: yep
16:21chouseralexyk: empty? is defined at (not (seq coll)) :-)
16:21alexyk:)
16:25AWizzArdDo we have experts in Open Source licenses here?
16:25AWizzArdI would like to know in very short words the differences between 1) Apache Licence 2, 2) Eclipse Public License and 3) Mozilla Public License 1.1
16:28ChousukeAWizzArd: wikipedia probably knows :P
16:28janmejayHi, i used swank-clojure elpa install and got it working, but i can't get my old SBCL repl now. here is the error (Couldn't load "/home/janmejay/.emacs.d/elpa/slime-20091016/swank-loader.lisp": file does not exist.)
16:28janmejayany ideas?
16:29the-kennyjanmejay: You have to install the sbcl-swank-backend
16:29janmejayi tried loading autoloads file from clojure and swank-clojure from the elpa directory without package.el, which didn't work either(i was using slime HEAD)
16:29the-kennywith asdf
16:29janmejaythe-kenny: from elpa?
16:29the-kennyno
16:29the-kennyelpa only contains emacs lisp files
16:30the-kennyyou need a common lisp file with the necessary code to run swank in sbcl
16:30AWizzArdChousuke: yes right :-)
16:32janmejaythe-kenny: i have slime HEAD and i tried preloading it, and then loading clojure-mode and swank-clojure by adding directories in load-path and loading the autoload files, but that doesn't work either(all that loads in sbcl repl)
16:32janmejaythe-kenny: M-- M-x slime RET clojure RET doesn't work with that setup
16:33the-kennyjanmejay: You need to understand that the "real" slime distribution ships with a bunch of .lisp files which contain the backend (swank) for many common lisp derivates
16:33the-kennyjanmejay: The elpa-version only ships emacs-lisp files
16:33the-kennyYou have to install the backend for sbcl by hand
16:34janmejaythe-kenny: is the best way to do it is dumping it inside the elpa slime directory?
16:34the-kennymaybe.. but I would install it with asdf-install
16:34the-kennyasdf-install is the packet manager for common lisp
16:34janmejaythe-kenny: sure, i let me try it using asdf
16:35the-kennyjanmejay: http://www.cliki.net/Swank
16:36the-kennyjanmejay: Everything should be in a checkout from the slime cvs
16:40Chousuketechnomancy: proto-skynet
16:40ohpauleezhahaha
16:42alexykhow can I have two optional parameters, like [a & b c]?
16:42Chousukealexyk: you can use destructuring, but overloading on arity is more common
16:43technomancyif you want them to default to nil and don't mind losing arity checks, destructuring is the way to go
16:44Chousukeeg. (defn foo ([a] (foo a 0)) ([a b] (foo a 0 1)) ([a b c] (someop a b c)))
16:44Chousukeoops
16:45Chousukeshould be (foo a b 1) in the middle and (foo a 0 1) in the first :P
16:45alexykright, I have a huge body and these things are optional, so destructuring will do
16:45alexykbut I'll remember arity, hard to divine a ( after function name! Java flashback!
16:46alexykJeopardy $200 questionL in which Lisp-like language, there's an opening paren after a function name?
16:46chouserdylan
16:47alexykchouser: am not familiar with the language dylan... is it a lisp with inverted syntax?
16:47Chousukealso common lisp :P
16:47Chousukeyou didn't specify what it's for.
16:47qbgalexyk: Javascript?
16:47Chousuke(defun foo (a b c) ...), isn't it.
16:47chouserdylan is generally considered lisp like, but with more C-ish syntax. I don't know much else about it.
16:47ChousukeI think dylan actually has macros
16:48alexykqbg: well... :)
16:48Chousukebut I have no idea how they're implemented.
16:49danm_learn to let go of syntax and be happy
16:50somniumjavascript should stand as a warning to all who would try to 'fix' lisp's syntax
16:52alexykso if I want 3 totally optional params, I declare (defn foo [& [a b c]] ...)?
16:52chouseralexyk: that's one way.
16:52arjis there a shorter way to write (not (= X Y))?
16:52qbg(not= x y)
16:52chouseralexyk: another is (defn foo ([] (foo nil nil nil)) ([a] (foo a nil nil)) ([a b] (foo a b nil)) ...)
16:52arjqbg: thanks :)
16:53alexykchouser: I'll stick to the first :)
16:53chouseralexyk: :-)
16:54chouseralexyk: the second may be better when you have: non-nil defaults, defaults in a different order, or need maximum speed.
16:54alexykchouser: ok
16:55chouseralexyk: but if you just need default-to-nil in the normal order, yes destructuring is much tidier.
16:56alexykI actually may need to flip order, so may come in handy
16:56chouseralso note I said "may" -- it may also be easier to just destructure and fiddle with order or non-nil defaults. just depends
17:01RaynesHow would I map a function to all of the values in a map?
17:02chouser(zipmap (keys m) (map f (vals m)))
17:02kotarak(zipmap (keys the-map) (map f (vals the-map)
17:02RaynesThanks. :D
17:02kotarakhehe :)
17:02kotarakchouser: m was shorter. I wasted time on the-map. ;)
17:02chouserheh. yep.
17:05hiredmanare keys and vals guaranteed to always return keys and values in the same order?
17:05chouserfor the very same map, sure.
17:06chouseronce you insert something, you have a new map with a new order
17:06arjhas anyone seen this kind of error before? my repl gets completely filled with endless of these messages and then stops. I can't seem to see where it all starts: http://pastebin.com/m73da1552
17:06Rayneshttp://gist.github.com/280420 yayme!
17:06chousersince the map is immutable it would have to work pretty hard get different orderings out of it.
17:07chouserarj: hm, infinite recursion
17:07hiredmanchouser: yes, but that is a by product of the implementation of map, not part of the contract of keys and vals
17:07arjchouser: ok, I don't really do any recursion in my code as far as I know. Maybe in some code I'm calling
17:08arjany idea how I can figure out where it starts?
17:08chouserhiredman: I believe rhickey has said it's guaranteed
17:08Hali_303how to make functions cascadable? by that I mean if I have functions (test1 pred coll1) and (test2 pred coll2), how to have a "master function" that takes a predicate which is like fn [x y] (test-based-on-x-and-y) I hope you get what I mean :)
17:08hiredmanok
17:08Hali_303where x is bound to something in coll1 and y is bound to an element in coll2
17:09rhickeyhiredman: yes, will always be same order. Not much utility otherwise
17:09Hali_303I mean something like a nested for loop with an if inside (in an imperative language)
17:10rhickeybut might not be adequately documented
17:10kotarakHali_303: (filter #(apply test-based-on-x-and-y %) (map vector coll1 coll2))?
17:11chouserHali_303: 'for' can take multiple bindings and treat them like nested loops
17:11chouser,(for [a [1 2 3], b [10 11 12]] (+ a b))
17:11clojurebot(11 12 13 12 13 14 13 14 15)
17:11Chousukehmm
17:12Hali_303ah I see, thank you
17:12kotarak,(filter #(apply = %) (map vector [3 2 1 0] [1 2 3 0]))
17:12clojurebot([2 2] [0 0])
17:13chouserHali_303: kotarak's showing you how to walk two seqs "in step" if that's what you wanted instead.
17:14Hali_303thank you guys, I'll try to decode that :)
17:17RaynesHow can I get all but the last element in a sequence?
17:18lpetit,(doc butlast)
17:18clojurebot"([coll]); Return a seq of all but the last item in coll, in linear time"
17:18RaynesThanks.
17:20kotarakWow. It's surprising how far you can get with excluded =, and, or, not, ...
17:22jcromartiejust for anybody else who might be using it
17:23chouserkotarak: excluded = ?
17:24chouserarj: are you using 'filter' in your code anywhere?
17:25kotarakchouser: (ns foo (refer-clojure :exclude (= not= < <= > >= not and or nil?))) And didn't have to change a line in ca. 80 lines of code.
17:25chouseroh! huh.
17:25chouserwhy? :-)
17:26kotarakBecause non of these functions were used. :)
17:26chouserI mean, why would you want to exclude them? Why does it matter if they were used?
17:27kotarakchouser: I have to provide = and friends for a DSL. http://gitorious.org/clojureql/pages/FrontendReworked
17:27chouserahh
17:27kotarakSo I have to exclude the core ones.
17:28kotarakI don't want the query-= hack.
17:28kotarakI prefer query/=.
17:28janmejaythe-kenny: thanks for the help
17:28chouserany users of the lib will have to exclude those as well, then, right?
17:28the-kennyYou're welcome
17:29kotarakchouser: no. (ns user.namespace (:require [clojureql.query :as q])) (q/only (q/= :table/x 5) (q/from :table)).
17:29chouserah! very good.
17:29kotarakOnly if you :use clojureql, you have to exclude them probably.
17:29chouseryes
17:30kotarakI'm a bit undecided about verboseness, though....
17:33Chousukehmm
17:33Chousukeif you're inside a namespace, can you do (def namespace/= ..)?
17:33Chousukethat would get around having to exclude core = etc.
17:34kotarakChousuke: don't think so.
17:34chouserdef doesn't let you give some other namespace
17:34Chousukewhat if it's the namespace you're in?
17:35chouserIt would be so easy to do that I assume the inability is intentional
17:35Chousukehm
17:35kotarakIn general I design my namespace for require with :as and not for :use. But I in this case... hmm...
17:35Chousukeit actually works.
17:35ChousukeI can do (def user/z 5) in the repl
17:36chouseryeah.
17:36chouserinteresting.
17:36Chousukeuseful, too
17:36chouserreally?
17:36kotarak,(name (ns-name *ns*))
17:36Chousukewell, say you need to define your own seq in terms of clojure.core/seq :)
17:36clojurebot"sandbox"
17:36kotarak,(def sanbox/= 5)
17:36clojurebotDENIED
17:37chouserChousuke: you still need to exclude core/seq from your own ns
17:37chouserChousuke: at which point you can just (def seq ...)
17:37Chousukeare you sure, though?
17:37Chousukecouldn't you just do (defn myns/seq [...] (seq (weirdstuff))
17:37chouser(def user/map 1)
17:38chouserjava.lang.IllegalStateException: map already refers to: #'clojure.core/map in namespace: user
17:38Chousukehm, apparently not :( damn.
17:43Hali_303how to or a sequence of booleans? I've tried (reduce or coll) but that does not work
17:43the-kenny(apply or coll)?
17:43chousernope
17:43chouseror is a macro
17:43the-kenny:(
17:43the-kennyoh, of course it is..
17:43chouser,(some identity [nil false 1 2])
17:44clojurebot1
17:44chousernah, it's a natural mistake
17:44chouseronce upon a time (apply or coll) would return code you could 'eval' to get your answer.
17:45chouser,(apply #'or [1 2 3])
17:45clojurebot(clojure.core/let [or__4472__auto__ 1] (if or__4472__auto__ or__4472__auto__ (clojure.core/or 2 3)))
17:45chouserheh. don't do that.
17:48the-kennyisn't there apply-macro, whoch no one should ever use? :D
17:49Chousukeclojurebot has some feature creep
17:49Hali_303thanks, I've used (some true? coll) this work
17:50Chousuke,(true? 3)
17:50clojurebotfalse
17:50chouserHali_303: sounds good, but not that doesn't behave the same as 'or'
17:50chousernote
17:50kotarak,(if 3 true false)
17:50clojurebottrue
17:50kotarak,(or 3 false)
17:50clojurebot3
17:50Hali_303chouser: you mean in the sens of lazyness?
17:50chouserno, as kotarak is showing
17:51ChousukeHali_303: true? only returns true if it's argument is the literal 'true'
17:51Hali_303ok, that's true, but I don't need that
17:51kotarak,(some true? [3 false])
17:51clojurebotnil
17:51chouserok, good enough then.
17:51Hali_303I have a collection of trues and falses
17:54hiredmanChousuke: some?
17:54Chousukehiredman: :P
17:58sethsquestion on deftype... is it strange to use Object as the supertype when I only want to override methods from Object?
17:58sethse.g. (deftype Foo [bar] Object (toString [] (str (gndn bar))))
17:59somniumdeftypes have supertypes?
17:59sethsI'm probably mixing the terms up
18:00sethsin Java-ese, extending Object
18:01Chousukein deftype's case, Object is treated more as an interface rather than a class
18:02kotarakchouser: (ns user.space (:use [clojureql.query :as q :exclude (= not= < <= > >= not and or nil?)])) (only (q/= :table/x 5) (from :table)) Seems to a be a compromise.
18:02sethsq2: I'm tempted to override the factory methods, but what type of thing should I return?
18:02seths(defn Foo [bar]
18:02seths (throw (Exception. "hola!")))
18:02sethsthat works as a proof of concept, but doesn't clue me in at all
18:03ChousukeI don't think you should do that :P
18:03Chousukehmm
18:03sethschousuke: which? both?
18:03Chousukemaybe (def old-Foo Foo) (defn Foo [] (old-Foo .....))
18:04ohpauleezjust a sort of poll, Am I the only one who likes error-kit more than the current try/except?
18:14the-kennyohpauleez: I like it, however I haven't done very much with it yet - Just saw some code in clojure-couchdb
18:14ohpauleezahh cool
18:17ohpauleezalso, congrats chouser and fogus, ch 1 was great!
18:23chouserohpauleez: great, thanks! fogus is in the process of revamping it right now, along with the rest that was released in the MEAP
18:24ohpauleezcool, once I get this bonus for my current contract, I plan on buying a copy
18:25chouserwe're working on a "bundle" deal: the book + 1 year clojure funding. We'll see if that actually happens...
18:25ohpauleezthat would be awesome, my bonus is basically going to bounties, clojure, and similar efforts
18:26chousercool, that's a good idea
18:27ohpauleezI know how it goes, PyPy was always in that situation, so now that I have more contracts, it feels only natural to give it all
18:28sethschouser: I would definitely do the package deal
18:28sethsand have already funded
18:36sethschousuke: no dice with old-Foo. I want to sometimes remap the input value of a factory argument before it winds up as the value of a field
18:37sethsafter old-Foo my Foo is immutable
18:37sethser foo
19:02konr```What should I use to turn HTML into XML? TagSoup?
19:02ohpauleezkonr```: enlive
19:02ohpauleezit's based on TagSoup
19:03ohpauleezhttp://wiki.github.com/cgrand/enlive/
19:03ohpauleezit allows you to apply a template to html or xml to do transformations, exactly what you need
19:04alexykis (or ...) always short-circuiting?
19:04ohpauleezalexyk: I would assume so
19:04konr```ohpauleez: looks great! thanks!
19:05ohpauleezkonr```: totally welcome
19:09tcrayfordis there any point to unit testing macros?
19:10sethschousuke: I r moron. sry.
19:17alexykhow do you load a .clj file into repl?
19:19sethsants.clj uses load-file
19:19seths,(doc load-file)
19:19clojurebot"([name]); Sequentially read and evaluate the set of forms contained in the file."
19:20alexykthx!
19:20sethsde nada
19:28derridaHey guys, i've been trying to have a little fun with clojure but am having some trouble shifting emacs/slime to work alongside clojure. typing clj from teh commandline works fine, i set all my env. vars in that script and the repl inside SLIME does actually work and say it is clojure but there are problems and slime never connects: http://pastie.org/784097
19:29derridaif anyone had any ideas I would really appreciate it :) sorry this isn't exactly clojure specific
19:39AWizzArdCan there be conflicts when trying to use/require a NS? A conflict such as that there is more than one NS with the given name on the classpath?
19:39replacaalexyk: yes, or is always short-circuiting
19:40alexykok
19:43jcromartieAWizzArd: there won't be any conflicts when using require
19:43jcromartieuse, however, imports all of the defs in the use'ed namespace
19:43alexyktechnomancy: where did $RLWRAP go from lein??
19:44AWizzArdjcromartie: let's say I have the dirs X and Y in my CP. Both include a file z.clj which begins with (ns z ...). How will Clojure decide which lib it will load?
19:44jcromartieoh
19:44jcromartiethat's not good
19:44jcromartiethat's why you should make detailed namespaces
19:45RaynesHow would I remove a key from a map?
19:45hiredmanAWizzArd: just like java, what comes first on the classpath
19:45hiredmanAWizzArd: also, don't use single segment names
19:46jcromartieAWizzArd: are these third-party namespaces? if so, you should point them out
19:46AWizzArdhiredman: and there is no way to enforce loading a specific lib in such a case?
19:46jcromartiemaybe the authors could fix it
19:46jcromartiethere's no way to load the "second" one, no
19:46hiredmanAWizzArd: not that I am aware of
19:46RaynesAh, dissoc.
19:46AWizzArdjcromartie: I don't have the problem, but was thinking about using a single word as my namespace
19:47hiredmanAWizzArd: don't
19:47jcromartiea single *unique* word, like the name of your very uniquely named project, for instance, is probably OK
19:47hiredmanjcromartie: no
19:47jcromartiebut if your project is "utils" or "game" or "app" then no
19:47jcromartiehiredman: want to tell it to rhickey ?
19:47jcromartie:)
19:47hiredmanyou should not use a single segment namespace
19:47jcromartiecompojure
19:48hiredmanjcromartie: compojure is broken
19:48AWizzArdeven if i use more complex names, it will then only make it more unlikely that there will be a collision, but it can never be guaranteed
19:48hiredmanrhickey is the one that moved clojure to clojure.core
19:48jcromartieis it broken in any discernible way?
19:48jcromartieor is it broken because it breaks the rules?
19:48jcromartiehiredman: I thought clojure.main was a class
19:48jcromartiein clojure
19:48jcromartiea single-segment namespace
19:49hiredmanjcromartie: you don't know what you talking about
19:49jcromartiebut that's just an assumption
19:49hiredmanclasses are java constructs
19:49hiredmannamespaces are clojure
19:49hiredmanclasses don't live in namespaces
19:49jcromartieright but packages/namespaces use roughly the same concepts in terms of paths
19:49hiredmanand besides, the namespace is clojure.main, not a single segment namespace
19:50jcromartieOK
19:50jcromartieI'm just going off of the various projects I've seen
19:51hiredmanjcromartie: I was sitting here in this irc channel when rhickey announced the switch in AOT compilation schemes that made single segment namespace inadvisable
19:51jcromartieI believe you
19:51hiredmanwhen he renamed the clojure namespace to clojure.core
19:51hiredmannone of those projects asked me
19:51hiredmanor I would tell them the samething
19:51hiredman~namespaces
19:51AWizzArdhiredman: is there a strategy for handling conflicts with multi-segment namespaces?
19:51clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
19:51alexykhow do you specify the dependency on clojure and c.c. in a lein project?
19:51hiredmanAWizzArd: the first on the classpath wins
19:52AWizzArdno java tricks to rename those beasts when starting up the jvm?
19:52hiredmannope
19:52jcromartiesomeone should document this on clojure.org
19:53jcromartieat least in a more conspicuous place
19:53jcromartielike here http://clojure.org/namespaces
19:53jcromartiebut as far as I can tell it's not mentioned
19:53jcromartieand the practices demonstrated by community projects don't help
19:54jcromartiemaybe a warning is in order
19:54hiredmanvery true
19:55jcromartiethis seems to be the best explanation of it http://groups.google.com/group/clojure/browse_thread/thread/8618a1d93cbbf8b7
19:56hiredmanclojurebot: logs?
19:56clojurebotlogs is http://clojure-log.n01se.net/
19:56AWizzArdBasically someone could invest a lot of his freetime to develop an incredibly useful library and then name the namespaces like org.apache and such ;-)
19:59AWizzArdWell, sounds like Sun is in the position to fix this, though it seems to be very unlikely to encounter such a problem.
19:59alexykwhy did pom.xml for clojure-contrib stayed at 1.1.0-master-SNAPSHOT when clojure proper inc'ed?
20:05jcromartieAWizzArd: well, I think Java has a simple system for loading resources, and the people in here are advocating simple guidelines to avoid problems with that system.
20:05jcromartienow someone tell me why I can (use 'my.lib) but not (compile 'my.lib) :)
20:05jcromartieI have a classes directory
20:05jcromartiejava.lang.RuntimeException: java.lang.ClassNotFoundException
20:06alexyksomnium: if I want to work with clojure 1.2.0-master-SNAPSHOT, should I build congomongo with it, i.e. have to edit project.clj?
20:06somniumalexyk: hmm, yes but cant guarantee ClojureDBObject wont break
20:08somniumalexyk: well, it shouldnt break, but will need to recompile the .clj files I think
20:08alexyksomnium: is db-object now a separate projetc?
20:08alexykcongomongo project.clj lists it as a dependency
20:09lypanovwhats the best way to work on a linux gui in java nowadays?
20:09somniumalexyk: no I just suck at ant and maven so it was easier to compile the .java separately
20:09alexyk:)
20:10jcromartiespeaking of compiling
20:11jcromartietrying to compile from the REPL is giving me problems, namely: java.lang.RuntimeException: java.lang.ClassNotFoundException: my.company.ns$loading__6327__auto____24 (NO_SOURCE_FILE:0)
20:12jcromartieif I say (use 'foo) it works, (compile 'foo) does not
20:12hiredman~compile
20:12clojurebotthe unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation
20:12jcromartieand?
20:12AWizzArdjcromartie: you don't have the classes dir in your namespace
20:12jcromartie./classes/ exists
20:13AWizzArdit needs to be on your classpath
20:13jcromartieah... I see
20:13hiredmanjcromartie: so follow the instructions on the website
20:13jcromartieI must yield to the almighty classpath
20:13hiredmanalso, unless you need to
20:13hiredmanI would recommend against aot compilation
20:14Guest24347is there a way to create a seq from an Iterator (without the Iterable)?
20:14AWizzArdjust decide for any directory on your classpath and then (binding [*compile-path* "/home/jaycro/hg/com/example/any/dir/on/cp/"] (compile 'my.ns))
20:14hiredmanyou trade off the dynamic for almost no gain
20:14hiredman,(doc iterator-seq)
20:14clojurebot"([iter]); Returns a seq on a java.util.Iterator. Note that most collections providing iterators implement Iterable and thus support seq directly."
20:15Guest29961thx hiredman
20:16jcromartiehiredman: how about for deploying a web app?
20:16jcromartiesource would work there, I suppose
20:16hiredmanjcromartie: for compojure you do need to compile a Servlet class
20:16jcromartieah
20:17hiredmanso you will need to compile
20:17jcromartieright now I'm running my web app from a REPL
20:17jcromartieeven on the server
20:18jcromartiebut it's very much under active development :P
20:18chousereven if you AOT compile with gen-class, you can still load new method implementations on the fly
20:19hiredmanI am not that familiar with compojure's internals so I am not sure wha the minimum you need to compile is
20:40RaynesI wish I had known 45 minutes ago that Twitter blocks duplicate tweets. Would have saved me 45 minutes of trying to find a non-existent bug in my code.
20:56janjani'm getting a bit confused with the import/use/refer functions
20:56janjanis there one that allows me to
20:56janjanuse a java static method as a function in my namespace?
20:57hiredmanno
20:57hiredmanmethods, static or otherwise, are not fns
20:57janjanbummer
20:58qbgWhat do you need it for?
20:58hiredmanbut, I imagine you are just confusing your terms
20:58albinocan't he call it whether it's a clojure function or not?
20:58hiredmanif you want to, for example call the static method shuffle from java.util.Collections
20:59janjanI wanted to import org.apache.commons.lang.StringUtils.Join as Join
20:59hiredman,(import 'java.util.Collections)
20:59clojurebotjava.util.Collections
20:59hiredman,(import 'java.util.ArrayList)
20:59clojurebotjava.util.ArrayList
20:59janjanyea, importing the class works
21:00janjanbut I don't need all of it, and I thought it would save me some typing
21:00qbgIf you wanted to do that for enough static methods, you could write a macro
21:00hiredman,(let [a (doto (ArrayList.) (.add :a) (.add :b))] (Collections/shuffle a) a)
21:00clojurebot#<ArrayList [:b, :a]>
21:00janjanneed to use the :as thing I guess
21:00hiredmanno
21:00hiredmanuse and requre are not for java classes
21:00hiredmanrequire
21:00janjanow
21:01hiredmanimport is for java classes
21:01janjanguess I missed that part
21:01janjanthx
21:01janjanI thought they were more or less interchangeable
21:01hiredmannope
21:02hiredman,(macroexpand-1 '(Collections/shuffle a))
21:02clojurebot(. Collections shuffle a)
21:02hiredman,(macroexpand-1 '(.foo a))
21:02clojurebot(. a foo)
21:03hiredman,(macroexpand-1 '(foo. a))
21:03clojurebot(new foo a)
21:34defn hello all
21:35defn,(macroexpand-1 (
21:35clojurebotEOF while reading
22:00wilighmm, now I've got no excuse not to start my project. swank-clojure was a nice distraction.
22:07alexyktechnomancy: ping
22:22alexykhow do I print classpath in repl?
22:23hiredmanclasspath?
22:23clojurebotclasspath is (System/getProperty "java.class.path")
22:24chouserthat's one of them, anyway.
22:47alexykhow do I tell lein to ise a specific version of clojure? it seems not respecting it
22:48chouseralexyk: do you mean when you launch a repl using it?
22:48alexykyep
22:49chouserI haven't tried lien yet, but I think I've heard that for the repl it uses the clojure that came with it.
22:49chouserOr something. Does that make any sense?
22:49defnalexyk: you can specify a different version of clojure by changing the dependencies entry for it
22:49defnand then running lein deps
22:50alexykdefn: is not respected
22:50defnso you've changed it with no results?
22:50alexykyep
22:50defnfrom what to what
22:50alexykI see CLOJURE_JAR hardcoded in lein
22:51alexykwhich it's using for itself
22:51defni remember tricking it awhile back into using 1.1.0 by just overwriting .clojure/... with the newest version, same name as the old
22:51defnyou could change that env var in the script i suppose as well
22:52defnbut lately i seem to remember just setting the dep to a more recent version and then running lein deps
22:52derridai'm struggling witht his too
22:52defnthat gave me the most recent version in a swank session
22:52defnderrida: that's because you are named derrida
22:52derrida;>
22:52defneverything will be inherently more complex for you as a result
22:52derridait's the story of my life :)
22:53defnI suggest changing your name to Foucault
22:53defnyou might have a better experience ;)
22:53derridahis friend is my altnick ;>
22:53defn<chomsky> will probably have the best chance at solving problems in clojure
22:53derridahahaha
22:54defnalthough it will likely involve a lot of mentions of hegemony, anarcho-syndicalism, etc.
22:54defn(defn anarcho-syndicalism)
22:57derridawhen i start slime, it continuously polls ... swank? but never connects
22:57defnderrida: add :dev-dependencies [[swank-clojure "1.1.0"]] to your project.clj
22:57defnthen run lein deps
22:59derridadefn: ahh project.clj, i kept seeing that as package.el for some reason :)
22:59defn:) did it work okay for you?
23:00defnhmmm, i need to implement an anarcho-syndicalism function with agents
23:00derridahm
23:00derridaseems to have the same result
23:01derridais there a systemwide project.clj?
23:01defnderrida: no
23:01defnderrida: pastie your project.clj somewhere and let me take a look
23:02defni might step away for an hour, but ill take a look when i get back
23:02derridamy problems actually occur without a project.clj at all, when i start slime this is the output: http://pastie.org/784269
23:03derridano problem i'll be here :)
23:03derridai'll take the opportunity to grab food
23:03defnderrida: how are you starting slime
23:03derridaM-x slime
23:03defnah okay, i thought you were running swank-clojure-project
23:03defnand then selecting the project root dir
23:04defnM-x swank-clojure-project
23:04derridaoh? :)
23:04defnare you using elpa?
23:04derridayes
23:04defndo you have slime, slime-repl, swank-clojure, and clojure-mode installed?
23:04derridayep
23:05derridai removed everything emacs on my whole system in fact hehe
23:05defnhmmm, do you have a ~/.clojure/ dir?
23:05derridayes, which is one confusing part of the whole thing for me
23:05defnbrb derrida -- keep up the deconstruction until i get back
23:05derridaemacs wanted to install to ~/src
23:05derridadefn: ;)
23:06derridaI did M-x clojure-install ~/.clojure
23:06derridawhich seemed to work :)
23:07derridaexcept that things arent really working hehe :)
23:13joeggI'm just getting started with clojure (and lisp) but not java or programming. Can anyone offer some suggestions on http://paste.lisp.org/display/93599?
23:13joeggI don't know agents and such yet, and will expand into that soon.
23:14joeggFor now, I'm looking for even more basic things, like I just discovered if (instead of cond) a few minutes ago; and I'm not really thrilled with all the dotos.
23:15joeggThe code above "(def spiro ..." is more library-ish, and the rest is using the very simple library.
23:21technomancyalexyk: that method of getting the classpath only gets you the classpath Java was launched with, not the classpath of the nested classloader
23:21technomancyalexyk: I need to document that better for the next release and include a function to get the nested classpath
23:22technomancybut you *should* be using the correct (project-level) version of clojure
23:22alexyktechnomancy: forget classpath! how do I make lein respect clojure version from project.clj?! :)
23:23alexykI get the prompt for Clojure 1.1.0 even when desirous of 1.2.0-master-SNAPSHOT
23:23technomancyderrida: M-x clojure-install is deprecated; see the swank-clojure readme
23:23alexykthe latter is dutifully moved into libs/ by lein deps
23:23alexykyet the prompt is 1.1.0
23:23technomancyalexyk: oh... one further bug is that the lein repl task is the only one not to use the subclassloader
23:24technomancytests, compilation, and launching the swank server should all work correctly
23:24derridatechnomancy: i saw that but the readme's advice seemed a bit ..
23:24technomancybut there are issues with clojure.main not setting *in* correctly
23:24alexyktechnomancy: are you saying I'm out of luck with repl?
23:24alexykwhat if I hack git checkout to use 1.2.0...?
23:25derridai'm using 1.2.0 now
23:25alexykderrida: apaprently not in repl?
23:25derridarepl shows 1.2
23:25alexykrepl from lein repl?
23:25derridaonly if i install manually htough
23:25derridaoh
23:25derridasorry :)
23:26technomancyalexyk: it's easiest to use lein-swank or lein-ng
23:26derridao O
23:26derridathis is really getting crazy
23:26alexykan hour ago I could do work. Now I decided to upgrade clojure, contrib, and some deps, and it's a horrible mess since clojure people don't version by clojure version!
23:27technomancyyou can't use clojure 1.2.0 with contrib right now
23:27technomancysince contrib is still compiled using 1.1.0 =\
23:28alexykah ok. So I'll rollback. Still, clojure people, do version by clojure version, please! :)
23:28technomancyyes
23:28technomancy=(
23:28technomancycontrib is a bit of a mess right now
23:29hiredmansecretly?
23:29derridai agree, there needs to be more seperation if it causing this.
23:29technomancyhiredman: don't tell anyone
23:29alexyktechnomancy: lein hardcoded LEIN_JAR to $HOME/.m2/... and CLOJURE_JAR to same repo, not to the checkout!
23:29alexykthat's the bin/lein from git.
23:29technomancyalexyk: yes, that's the version of clojure that lein uses, not the version that your project is loaded with
23:30alexykshouldn't LEIN_JAR point to the checkout?
23:30technomancy(except for the bug in the repl task as noted in the readme)
23:30technomancyoh, the checkout of leiningen?
23:30alexykyeah
23:30euwynworking my way through the pragmatic bookshelf book. any suggestions on a good first clojure project. have some experience with functional languages (ml) from college, but rusty.
23:31technomancyalexyk: well the checkout of leiningen has its src/ on the classpath in front of LEIN_JAR, so it will take priority
23:31derridawhat precedent does leiningen follow?
23:31alexyktechnomancy: one massive problem remains: no respect for settings.xml
23:31alexykmy ~/.m2/settings.xml specify the repository in /opt/m2/repository
23:31technomancyalexyk: it's on the roadmap
23:32alexykok
23:32derridait's hard to know what to equate it to, is it inteded to function like cabal?
23:32alexykderrida: it's simply lipstick on a pig of maven
23:32alexykclojure lipstick on a maven pig
23:33derridai'm getting discouraged too :(
23:33alexykit installs into maven repo and drags jars to a local libs/ to fool old-time tools
23:33alexykI'm in fact encouraged and applaud technimancy
23:33derridahave you used cabal?
23:33technomancyderrida: it's a lot easier to write a package manager in a language that allows you to alter the load path at runtime
23:34alexykderrida: not much better than CPAN for that matter
23:34derridatechnomancy: i bet
23:34alexyknothing wrong with maven, really :) and lein avoids XML, so it's just fine
23:34derridacpan is pretty excellent
23:34derridamaven is just driving me mad
23:34alexykit's the clojure people who should straighten up and version properly
23:35technomancyyes
23:35technomancystuart is doing the right thing with the release of contrib 1.1.0, it's just taking a while
23:35technomancysince it's a 1-man volunteer show
23:35derridawell, the key to getting more volunteers is getting more users
23:35alexykwell, around the new year, I'm not surprised
23:36derridaif we can't use it we're not going to be able to contribute
23:36alexyktechnomancy: so, to sum up, there's no quick and dirty way to force lein repl to behave?
23:36technomancyderrida: contrib has had a bit of an aristocratic vibe to it for a while
23:36technomancyalexyk: yeah, it's really hard to get a subclassloader working without screwing up *in*
23:36alexykI'm on a paper deadline and to revive my Emacs with elscreen and sidebar would be too obssessive
23:36technomancyalexyk: have you tried nailgun?
23:37technomancyI think that should be more straightforward than swank
23:37derridawhat is nailgun?
23:37alexyktechnomancy: once or twice. Can I drive it from any editor?
23:37derridasimilar to MrED?
23:37alexykclojurebot: google java nailgun
23:37clojurebotFirst, out of 1820 results is:
23:37clojurebotNailgun: Insanely Fast Java
23:37clojurebothttp://martiansoftware.com/nailgun/index.html
23:38derridathat sounds interesting
23:38technomancyalexyk: vimclojure uses it, you can also use it with clojure-mode (without slime) by setting inferior-lisp-program
23:38derridadoes vim-clojure work better than swank?
23:38technomancynever tried it
23:38derridai'm more than happy to use vim for a while
23:38derridadamn
23:38derrida:)
23:39hiredmanvimclojure has its own set of issues
23:39derridai'm one of those sickos that likes both
23:40derridaso .. how are people writing clojure code? :)
23:40technomancytbh swank-clojure is not great
23:40derridanot slime quality?
23:40technomancyI haven't been able to give it the attention it deserves
23:40alexykderrida: I do it all in repl and paste back into textmate, then eval in repl what I need.
23:41derridaalexyk: you've gotta be kidding me?!
23:41alexykmy textmate has a snippet to send it to iterm.
23:41alexykit's so damn compact, you can write 5 lines an hour and get it done by the EOD
23:42alexykhiredman: how's vimclojure then? what are the issues?
23:42hiredmanthe dynamic features of vimclojure require it to eval every buffer you open
23:42derridaon open?
23:42hiredmanwhich is annoying if you have something like (iterate inc 0)
23:42hiredmanyes
23:43derridableh
23:43hiredmanso i have that part turned off
23:43derridait turns off you had to excise?
23:43alexykhiredman: how do you turn them off?
23:43hiredmanthe highlighting and indentation is pretty good
23:44derridamy vimrc is like 500 lines :s
23:44hiredman""let g:clj_want_gorilla=1
23:44hiredmanso without that line
23:44derridaomg 560 lines ...
23:44hiredmanI haven't really kept my vimclojure install up to date
23:44hiredmanmine is only 220
23:45hiredmanmy .emacs.el is only 127
23:45derrida560 is insane, i'm embarassed, i knew it had gotten long but ..
23:45hiredmanthat is a lot of vimscript :(
23:45alexyk"my chomsky is bigger than yours" :)
23:46derrida560 is more like being obese than having a big .. :>
23:47hiredmanI used notepad++ to do a few euler problems with clojure
23:47derrida:(
23:47alexykI can never remember how to save things into buffers and then recall them properly in vim. Emac sis easy
23:47derrida:h @
23:47derridait's really easy in vim
23:47hiredman:wq
23:47hiredman:tabn
23:47derridai dont think thats what he means
23:48derridabut maybe it is!
23:48hiredmantabs are sweet
23:48derridai just use buffers, never tried tabs
23:48hyp3rvigi1antwhen i started to learn vim years ago, i found reaching for Esc and then doing a Shift+colon all the time to be extremely annoying...never used vim much...more recently have started using emacs a lot, and like it much better
23:49derridahyp3rvigi1ant: everything new takes getting used to
23:49hyp3rvigi1anttrue
23:49alexykI mean cut and paste
23:49hiredmanI have < and > mapped to tabp and tabn
23:50derrida< > indent though :(
23:50hiredmanget errors in emacs because M-: is eval elisp and w isn't bound
23:50derridahiredman: i do that constantly haha
23:50derridaor ZZ in the middle of documents lol
23:51derridahiredman: gg=G reformats the entire docuement btw
23:52derridaalexyk: anything you delete goes into the buffer
23:52derridaalexyk: so, dd - deletes a line
23:52derridaalexyk: p - will paste that line
23:52derridaalexyk: you can deliberately copy with 'y' for yank
23:52alexykderrida: that I know. I use it for years for sysadmin tasks, and can never remember reching back into the sequence of yanks
23:53alexykin emacs it was easy
23:53derridaalexyk: yeah, thats not easy in vim
23:53alexykscroll through yanks to pick one
23:53derridaalexyk: hehe sorry for the lesson :)
23:53alexyknp, thats a few basics which is enough
23:54alexykI cound lines etc. I used ed even on the iphone
23:54derridahehe
23:54derridathat's hardcore ;)
23:54alexykvi on the iphone was really cool, in a tiny term
23:55derridatechnomancy|away: one thing that would be really helpful is a screenshot of a succesful swank-clojure launch so we know what we're shooting for
23:56derridamy reply *does* work for simple evals
23:56defnderrida: get it figured out yet?
23:56derridadefn: :)
23:56derridadefn not quite hehe :)
23:57defnderrida: where you at now?
23:58alexykclojars search is so broken, oh man
23:58derridai ran lein deps after adding that line to the project.clj of one of my projects
23:58defnalexyk: yeah :(
23:58defnalexyk: it's best to just use the repo view
23:59defnhttp://clojars.org/repo/
23:59derridadefn: it downloaded several jars but i still get that same http://pastie.org/784317
23:59alexykis _ato around generally?
23:59defnderrida: did you paste your project.clj file?
23:59alexykhow do you ask irc when a person was seen last again?