#clojure logs

2010-06-09

00:00Raynestechnomancy: He uses Emacs now?
00:00technomancyyeah
00:00Raynestechnomancy: Hot.
00:00lancepantzthe kinesis was really difficult at first, but after a couple of weeks, you get used to it
00:00technomancyfor the record, nothing beats keyboard pants: http://www.flickr.com/photos/technomancy/4397554484/
00:00lancepantzand it's awesome
00:00LuminousMonkeyMaybe I should give Emacs another go, but I really think I need to figure out how to redo the keybinds.
00:01Raynestechnomancy: Are you purposely requiring that each key -> value pair passed to add-query-params be a sequence?
00:02maravillastechnomancy: not even a bacon maple eclair?
00:02jarturlancepantz: damn, I will order it someday. Though it would probably never ship to my country. Will get lost at customs office or smth like that
00:02technomancyRaynes: uh... that'd be unintentional. dang.
00:02technomancythat's why they call it a snapshot I guess
00:02lancepantzjartur: if you have a problem with RSI, its a lifesaver
00:02Raynestechnomancy: Aw man. Now I'll have to change all of sexpbot's plugins again. :(
00:03Raynestechnomancy: I'll fix it in a little while, if you want.
00:03technomancythat would be super
00:03RaynesI knew it seemed a little odd (add-query-params "http://blah.com" ["key" "val"])
00:04technomancythe new snazzy keyword params would be a good way to do it, except for how it requires 1.2
00:04jarturlancepantz: not that I have really. I play piano and position my fingers on the keyboard the same way.
00:04jarturlancepantz: maybe that helps me from getting any tension
00:05jarturtechnomancy: btw, is 1.2 going to be released soon?
00:06jarturlancepantz: just want to try something completely different =)
00:06Raynestechnomancy: 1.2's keyword parameters would be a perfect match for the request function in client as well.
00:06lancepantzjartur: yeah, i'm sure it does, like i said, what really killed mine was playing fps'
00:07technomancyjartur: I wish I knew.
00:09jarturClojure is so fast-moving... It scared me at first
00:09jarturNot that now I am in any way proficient with it. But a little less scared of what is going on.
00:10scottjhas cemerick been explicit about what he feels is lacking in the big 3 ide plugins? It seems like things lacking are not company-size endeavors. a few refactorings and maybe better completion and paredit for the 2 that don't have it's basica functionality
00:10jarturscottj: which one has paredit?
00:11scottjjartur: not sure which, it's a limited version of paredit. I think eclipse
00:11jarturscottj: Ah... okay. Neve tried an eclipse one. Can't stand that product.
00:12brweber2can anyone point me to a decent blog/tutorial/etc on calling Clojure from Java?
00:12jarturBtw, does anybody know anything about the future of Clojure on .NET?
00:12brweber2I'd prefer to avoid the RT.* route if possible (I already have my classes compiled and jar'd up)
00:12tomojRaynes: with keyword args, though, what do you do if you've built up the map elsewhere?
00:12lancepantzi dont think the market would be large enough for a commercial clojure ide
00:12lancepantzi guess we're growing
00:13Raynestomoj: What do you mean? How would that effect anything?
00:13jarturbrweber2: You mean you have :gen-class'ed java classes?
00:13tomojI mean, given (defn foo [& {:as m}] m) (is that right?), what do you do if you've got a map?
00:14tomojyou can't (apply foo the-map)
00:14brweber2jartur (I did a compile of the entire namespace actually, including some defprotocols...)
00:14scottjjartur: I think the future is to have more of clojure written in clojure. be more specific :)
00:14Raynestomoj: What function are we talking about here?
00:14tomojseems like you have to do (apply foo (flatten (for [[k v] the-map] [k v]))) or something
00:15jarturbrweber2: Hmm. If you don't want to use RT.* use :gen-class and expose all the methods you want manually
00:16tomojoh, good question
00:16tomojI didn't actually think about the function you were recommending keyword args for
00:16tomojprobably no problem there, you're right
00:16jarturscottj: Rewriting clojure in clojure as much as possible is good. It will make it easier to be platform independend
00:16Raynestechnomancy: Am I right in assuming that you want add-query-params to work like so: (add-query-params url key1 val1 key2 val2)?
00:16brweber2jartur is RT.* really the preferred way to do this? This is the nastiest side of clojure I've seen to do (calling Clojure from Java)
00:16Raynestomoj: :)
00:17jarturscottj: I'm just thinking about clojure running on .NET. Imagine a nice XAML library. Writing XAML in lisp instead of actual XML looks nice.
00:17tomojadd-query-params seems like a place where a problem might happen, though
00:18Raynestomoj: I'm not entirely certain what Phil was talking about, actually. But we aren't doing that right now anyway.
00:18technomancyRaynes: that'd be fine. keeping all the params in a map for the second arg would be just as good; whichever you prefer.
00:18scottjDo ruby projects specify their dependencies w/o version numbers often? It sounds convenient, and I wondered why lein doesn't support it (afaik), but I guess it could lead to projects that don't work after awhile because of changing dependencies. thoughts on versionless (latest) dependencies?
00:19jarturbrweber2: Well... clojure's a little different from Java. I guess it's what we have
00:19technomancyscottj: everyone leaves off the version numbers at first. then they get bit by a "minor bugfix upgrade" that sneaks into production, and then they never do it again.
00:19Raynestechnomancy: I think the way above would be better. If you have a map, you can just apply it. Less line noise when you don't want it.
00:19technomancy(IME)
00:19tomojyou can't just apply it, though, can you?
00:20tomojthat's what I was trying to point out earlier
00:20brweber2jartur I love the Clojure side of Clojure, I had been misled into thinking that calling Clojure from Java is somewhat cleaner than I'm finding it to be. I have an inner class for example that I can't figure out how to call invoke on (should be not too hard...)
00:20Raynestomoj: (apply add-query-params url {"foo" "bar"})
00:20RaynesOh wait.
00:20tomojyeah :(
00:21jarturbrweber2: I think clj->java interop was given more priority that java->clj when it all was designed
00:21brweber2jartur I'm sure that was the case
00:21tomojbrweber2: you have an inner class in clojure and you're trying to call invoke on it from java? I must be confused..
00:21jarturbrweber2: I think that a really good two way interop would be too limiting
00:21Raynes$(letfn [(foo [& blah] blah)] (apply foo {"foo" "bar"}))
00:21sexpbot=> (["foo" "bar"])
00:21RaynesOuch.
00:22brweber2tomoj The inner class was generated by (compile 'my-ns)
00:22jarturbrweber2: Hmm...
00:22Raynes$(letfn [(foo [& blah] blah)] (apply foo ["foo" "bar"]))
00:22sexpbot=> ("foo" "bar")
00:22RaynesIndeed, guess we are going the map route.
00:22technomancyscottj: anyway, if you trust a project to use semantic versioning (which you probably shouldn't unless you control it) you can specify a dependency on it with a version range, which will be documented in the next lein release.
00:22brweber2interestingly, I have an inner class without an outer class (I had no idea that was allowed!)
00:22tomojbrweber2: did you already explain why you're not using gen-class?
00:23jarturbrweber2: I think you do something rather un-idiomatic
00:23brweber2tomoj I used compile to compile the entire namespace
00:23tomojthat doesn't sound like a good explanation to me :/
00:23jarturbrweber2: Yeah, but it's kust AOT
00:23brweber2should I use :gen-class to compile every method instead of the entire ns?
00:24tomojjust put a (:gen-class) in your ns
00:24Raynestechnomancy: A side note: after I installed the 2010* slime and swank a few days ago, whenever I slime connect, it warns me that my slime and swank are unmatched (2009 slime, 2010 swank). However, when it starts up, the correct date is shown. "SLIME 20100404"
00:24jarturYou should use gen-class and have methods with named like (defn -lalala .... )
00:24RaynesNot that it's causing any problems.
00:24RaynesJust curious if that is expected.
00:24jarturthese -lalala methods would be public methods of your class
00:25jarturRaynes: I have this every time I update
00:25technomancyRaynes: yeah, that's a bug in the slime build; the version number is set at compile time when the old version is still around. =\ delete the .elc file to fix it.
00:25Raynestechnomancy: Cool. Thanks. :)
00:25brweber2jartur and tomoj (adding :gen-class, will be back in a second with the results)
00:26jarturbrweber2: Have you read 'Practical Clojure'?
00:26scottjwhat's the elisp var for telling slime to ignore swank version diffs?
00:26jarturBtw, I really think that Clojure needs a nice CC book
00:26brweber2jartur No, I have Stu's book and The Joy of Clojure MEAP
00:26jarturbrweber2: Okay. I think they do have chapters about :gen-class
00:26jarturAnd how it works
00:27jarturI think you should re-read them crefully
00:28jarturIt's actually a rather powerful interface for generating java classes
00:29Raynestechnomancy: Pull req sent. No hurry, but it would be great if you could toss out a new snapshot as soon as possible so that I can get sexpbot up to date. Pace yourself though, heaven knows you're a busy man. :p
00:30scottjjartur: by cc I imagine you mean creative commons, and I'm not sure I agree. I feel like from intro to clojure youtube, rhickey videos, website, and reading core.clj, you can get a better understanding than stu etc books with less time.
00:30LajlaWhy are their two evaluating bots here?
00:30jarturscottj: Well, it depends on a person
00:30jarturscottj: I got from 'Practical Clojure' so much so fast
00:30jarturscottj: like 'It's super effective' on me =)
00:30RaynesLajla: Always good to have a backup.
00:31LajlaRaynes, if that job pays well, I might consider signing up as third.
00:31LajlaThose bots must have amazing typing speeds though.
00:31RaynesI don't use him for any specific reason over clojurebot. I just use him in every other channel but this one, so $ instead of , comes naturally.
00:31RaynesNot that I'm not biased. <3
00:32scottjjartur: fair enough, personally I don't feel like I got much out of stu's or joy meap (particularly).
00:32Lajla$"string"
00:32sexpbotCommand not found. No entiendo lo que estás diciendo.
00:32Lajla,"string"
00:32clojurebot"string"
00:33jarturscottj: Maybe you are too awesome. =) And then I didn't get much of Stu's book as well
00:33LajlaSexptbot, should've called it listbot.
00:33jarturscottj: Others I haven't read
00:33jartur$'a
00:33sexpbotCommand not found. No entiendo lo que estás diciendo.
00:33RaynesLajla: $eval "string"
00:33jartur$'(2 3)
00:33sexpbotCommand not found. No entiendo lo que estás diciendo.
00:33Raynes$eval 'a
00:33sexpbot=> a
00:33jartur,'a
00:33clojurebota
00:34RaynesThat stuff doesn't work because $( is a normal command. $eval has to be used for stuff that doesn't start with a parenthesis.
00:34jartur,'$(+ 1 2)
00:34clojurebot$
00:34sexpbotCommand not found. No entiendo lo que estás diciendo.
00:34Lajla$(write "Do you support side-effects?")
00:34sexpbotjava.lang.Exception: Unable to resolve symbol: write in this context
00:34RaynesWhoa! Bug!
00:34tomojuh oh
00:34RaynesHe's supposed to ignore clojurebot.
00:34jartur=)
00:35tomojas long as clojurebot isn't buggy at the same time we'll be OK :)
00:35jarturWell, I don't think anybody would really like to execute Y on these two
00:36RaynesThat isn't a bug. I never made him ignore clojurebot. I merely made him ignore links from clojurebot when the title scraper was on. I added the => stuff to evaluation so that infinite bot loops wouldn't be possible.
00:36tomojah
00:36RaynesHad a brainfart for a moment there.
00:37RaynesHe should still probably ignore clojurebot for annoyance's sake, but infinite loops shouldn't be possible regardless.
00:40brweber2tomoj and jartur thanks, I'm one step closer
00:40RaynesThe behavior of $( always trips people who are used to clojurebot up. I tried to avoid adding special behavior for sexpbot's evaluation. I need to put "allow special plugin-specific prepends" to my TODO list.
00:47Lajla$(do [k 10 acc 0] (if (< k 0) acc (recur (- k 1) (+ acc 1)))
00:47sexpbotjava.lang.Exception: EOF while reading
00:47Lajla$(do [k 10 acc 0] (if (< k 0) acc (recur (- k 1) (+ acc 1))))
00:47sexpbotjava.lang.Exception: Unable to resolve symbol: k in this context
00:47Lajla$(loop [k 10 acc 0] (if (< k 0) acc (recur (- k 1) (+ acc 1)))
00:47sexpbotjava.lang.Exception: EOF while reading
00:47LajlaI give up
00:48LajlaOhh, forgot brace
00:48Lajla$(loop [k 10 acc 0] (if (< k 0) acc (recur (- k 1) (+ acc 1))))
00:48sexpbot=> 11
00:48LajlaSalvation
00:48Raynes$(loop [k 10 acc 0] (if (< k 0) acc (recur (- k 1) (+ acc 1))))
00:48sexpbot=> 11
00:48LajlaI salvated first.
00:48Raynes:p
00:49LajlaRaynes, cloj doesn't support named-let, does it?
00:49Raynesnamed-let?
00:51LajlaRaynes, basically like loop, but then like (let arbitrary-name ... ) where arbitrary name becomes a function in the body.
00:51LajlaLike loop/recur, but not needing to be in the tail per se.
00:53RaynesIf I understand you correctly, I don't think so.
00:54Raynes$(let [x "hai"] x) ; We have let, in any case.
00:54sexpbot=> "hai"
00:54tomojfns can be named
00:55tomojnot sure if that would work for what you're trying, though..
00:55RaynesOh, is that what he was talking about?
00:55tomojno, but seems similar
00:56tomojdemo:
00:56tomoj$(take 10 ((fn fib [x y] (lazy-seq (cons x (fib y (+ x y))))) 1 1))
00:56sexpbot=> (1 1 2 3 5 8 13 21 34 55)
00:56tomojcould write a macro with a let-style binding form that expands to something like that I suppose?
00:57LajlaRaynes, well, a named is basically like loop/recur except that you can chose the name for 'recur' and it doesn't have to be in the tail position.
00:58RaynesYeah, normal recursion. I know what you're talking about now.
00:58LajlaLike (let recur ... ) would be in the named-let style a loop/recur in which 'recur' needn't per se be called in the tail position.
00:58RaynesThe way you said it was confusing. :p
00:58LajlaRaynes, well yeah, except that if you don't target the JVM you get tail recursion anyway. =P
00:58LajlaA thing I don't get though, is that tail recursion is lexically inferrable.
00:58tomojI think using a fn like above is equivalent?
00:58RaynesYou can do that in Clojure, but it wont be optimized.
00:59LajlaSo if loop/recur is optimized, why can't a normal tail call be?
00:59LajlaTheoretically, a compiler could even rewrite your code to a loop/recur if you used tail recursion, right?
00:59mmarczykLajla: JVM bytecode which *might consider* attempting to modify the stack won't pass verification
00:59mmarczykso that would have to happen on the JVM level
01:00mmarczykand, as we all know, it doesn't currently
01:00Lajlammarczyk, but I mean, say you have a source which has (let loop [x 0] ... (loop (+ x 1))
01:00mmarczykwhat is possible in Java is to use break foo; / continue foo; for foo a label
01:00LajlaSurely the compiler can just rewrite that source to (loop [x 0] ... recur(+ x 1))
01:00mmarczykto break out of a couple of nested loops... I wonder if whichever bytecode corresponds to this
01:01jarturmmarczyk: Lajla means pure sytactic transofrmations
01:01LajlaAnd then treat it as if it would with loop/recur?
01:01mmarczykcould be used for a named let-like recur
01:01Lajlajartur, well, no matter in what way, a tail-call is lexically inferrable.
01:01mmarczykwell, take a non-trivial scenario and try to rewrite it yourself :-)
01:01LajlaSurely the compiler can then recognise it and compile it to different code than a simple function call?
01:02mmarczykyou'll end up using some sort of flag to indicate which loop is to move forward next, I would guess
01:02jarturLajla: I don't think lexically, I think syntactically?
01:02Lajlajartur, no, lexically.
01:02mmarczykanyway, a full named let-like think is impossible without proper TCO
01:02jarturLajla: why?
01:02LajlaI mean, as an obvious example in a C-style langauge, if a function call is directly following a return statement.
01:02mmarczykbecause in the named let, say (let foo (...) ...)
01:02LajlaYou have a tail-call.
01:03mmarczykfoo is really bound to a function
01:03jarturLajla: lexical analysis is only a tokenization of the strea,
01:03mmarczykwhich you can, in particular, pass to other functions etc.
01:03mmarczyk^named let-like thing
01:03clojurebotmost horrible thing is http://tinyurl.com/b65o8e
01:03jarturLajla: you can't infer anything from lexems
01:03Lajlajartur, as far as I know my terminology, lexical analysis is all a compiler can know without running any applications.
01:03LajlaSuch as static type errors.
01:03jarturLajla: no.
01:03LajlaOr more properly proving no type errors are going to occur.
01:03jarturLajla: it's static analysis
01:03mmarczykthat's actually called static analysis
01:04mmarczykright.
01:04LajlaAh
01:04LajlaI use the terms lexical and static interchangeable.
01:04jarturLajla: it includes lexical analysis + syntax analysis + semantic analysis
01:04jarturat least
01:04LajlaAs in, determinable from program source without running code.
01:04LajlaBut anyway, doesn't matter that much, it's still statically inferrable, before running, a tail call.
01:05mmarczykso anyway, for the reason mentioned above, you cannot mimick Scheme's named let
01:05jarturLajla: Ah, I see where you come from. It's lexical like in 'lexical scoping' =)
01:05LajlaSo it could be compiled to different code than an ordinary call, right?
01:05mmarczyksome scheme to do local multi-level looping could be implemented as a macro, I guess
01:05mmarczykI'd give it a shot if I were less sleepy, but alas, another time maybe ;-)
01:05Lajlajartur, well, lexical scoping is an example yes.
01:06Lajlammarczyk, will you hug me for the idea when you succeed?
01:06mmarczykI actually had the idea before :-)
01:06LajlaThen hug yourself first, and then me.
01:06mmarczyksounds tricky
01:07Lajlammarczyk, you are the fifth greatest programmer in the world, you can do all.
01:07LajlaExcept beat the Microsoft CSA and me amongst others.
01:07mmarczykI'm not sure which ordering on the population of programmers you're using
01:08mmarczykI've ranked myself closer to 10^6th spot and I thought that bordered on hubris ;-)
01:10Lajlammarczyk, we lispers are gods, you must realize.
01:10LajlaOnly the person that invented the FAT16 filesystem can beat us.
01:10jartur,(for [x ['mmarczyk 'Lajla]] `(mmarzczyk hugs ~x))
01:10clojurebot((sandbox/mmarzczyk sandbox/hugs mmarczyk) (sandbox/mmarzczyk sandbox/hugs Lajla))
01:10mmarczyk(loop [level 0 ...lots-of-other-locals...] (case level 0 (...outer loop body...) 1 (...middle loop body...) 2 (...inner loop body...)))
01:11technomancymmarczyk: you had an idea for a lein patch that I think I missed earlier?
01:11technomancyor more than an idea?
01:12mmarczyktechnomancy: I've sent you a pull request adding handling of extra project.clj entries for inclusion in pom.xml, mailing list addresses, licenses, project url (I think that's all)
01:12mmarczykthat was a while back
01:12mmarczykso, it includes some modifications to README to explain the usage of those
01:12mmarczykbut now that you've added sample.project.clj, I could put stuff in there
01:13mmarczykin an updated version, if you feel like you might want to pull that in
01:13technomancymmarczyk: that'd be great
01:13Lajlammarczyk, well, since case, cond, and, or et cetera are all rewritten to if, the only thing you need to pay to is recursivelly it's a tail call if it's the last sub-form of the body, or part of a then or else branch of an if-form which is a tail call.
01:13mmarczyktechnomancy: cool, I expect to have a super-busy day today, so I'll probably send a new pull request tomorrow
01:14LajlaThat should be statically inferrable, after that, it can be compiled to a loop/jump on the JVM, and not an ordinary procedure call, right?
01:14mmarczyktechnomancy: incidentally, that patch allows all of :licence, :license, :licences and :licenses to be used, where the singulars take single items and plurals take seqs... are you ok with that? :-)
01:16tomojLajla: those are rewritten to if?
01:16mmarczykcase is not rewritten to if, afair
01:17mmarczykI believe it's a hash-map-like dispatch
01:18mmarczykLajla: I'm not sure what you're trying to achieve
01:19mmarczykif it's just the possibility to recur to the top of an enclosing loop from an inner loop
01:19tomojLajla wants TCO in the compiler, I thought?
01:19mmarczykthen the loop/recur form I offered above is one way of doing that and you could write a macro to expand to that
01:20mmarczykbut a full named let is impossible
01:20mmarczykbecause, as I said above, in Scheme (let foo (...) ...) binds foo to a function
01:20Lajlammarczyk, Clojure doesn't rewrite all conditionals to if with macros?
01:20mmarczykmost, but not case, I think
01:20tomoj"full named let" means with TCO?
01:20Lajlammarczyk, yeah, but a compiler can statically check if a function is called in the tail.
01:21LajlaAnd then compile to different code than an ordinary function call.
01:21mmarczyktomoj: well, sure, since we can have named let without TCO
01:21mmarczyktomoj: but I mostly meant the fact that foo is a function
01:21tomojok, was just checking I wasn't confused
01:21mmarczykLajla: actually that's not true for Clojure's compiler
01:21tomojoh, hmm, what's wrong with foo being a function?
01:21Lajlammarczyk, why can't it?
01:22mmarczykbecause it can't spit out code which could manipulate the stack
01:22mmarczykthe stack is where the arguments need to be placed
01:22mmarczykin stack frames
01:22LajlaAhhh
01:22mmarczykprior to the jump to the top of the routine being called
01:22LajlaThis JVM is a lot more complex than a typical instruction set I gather?
01:22mmarczyknot at all
01:23mmarczykbut the bytecode gets passed through a so-called "verifier" when it's loaded
01:23Lajlammarczyk, ahhh
01:23mmarczykif it doesn't meet certain safety criteria, it won't be loaded
01:23Blackfoothas anyone built clojure-couchdb? when i try to ./lein jar I just get a zip/jar file with the clj files in it
01:23mmarczykpart of that is that it must not manipulate the stack in funky ways
01:24mmarczykmeaning in a way except through regular JVM-supported method calling facilities
01:24Lajlammarczyk, and why is it not possible to for instance compile normal functions in the tail position to the same java bytecode as loop/recur gets compiled to?
01:24mmarczykLajla: and how'd you go about that?
01:24mmarczyksurely you wouldn't want to inline every function which happens to be mentioned in a tail position
01:24mmarczykat each tail call site
01:25mmarczykalso, you might make a tail call where you don't statically know which function will end up being called
01:25mmarczykapply doesn't know which functions it might apply, for instance
01:25Lajlammarczyk, I don't get you, you always statically know if a function is in the tail position.
01:25mmarczykyeah, you might know that and yet not know which function it is
01:26mmarczyk(fn [f] (f))
01:26mmarczyk(lambda (f) (f)) in Scheme
01:27LajlaThat can be lexically detected there and compile that form to a different code then if it wasn't tailed.
01:27LajlaThat's how Scheme does it I think.
01:27mmarczykum, nope
01:27LajlaHow then?
01:27LajlaIt decides it at runtime?
01:27mmarczykdepending on the implementation, Scheme programmes might be subjected to a full-programme CPS transform
01:27mmarczykthen their function never "return"
01:28mmarczykI think Chicken does that
01:28LajlaYeah, chicken compiles like that to C.
01:28mmarczykan alternative would be to rewrite the last stack frame
01:28mmarczykI would say that this sort of CPS transform is problematic for Clojure
01:28mmarczykbecause it's meant to be callable from other JVM languages
01:29mmarczykso needs to follow standard calling conventions
01:29LajlaWell, if you say so, I still think I'm missing some vital info here.
01:29tomojI trust rich will do what's best :)
01:29mmarczykin fact, I should have mentioned this earlier, since this disqualifies quite a number of possible approaches :-P
01:29LajlaTrust no one, not even me.
01:29LajlaNot even banknotes or He they say you must trust.
01:29mmarczykwell, if you can't touch the stack and can't do cps on all your functions
01:29mmarczykand also
01:30tomojif the tradeoff were worth it to get people to stop saying "WTF NO TCO?!", I'm sure he'd do it
01:30mmarczykyou can't really jump to the top of another routine
01:30Lajlatomoj, I got that idea, that's why I'm puzzled.
01:30mmarczykthere's no goto in Java, I expect the JVM not to be accommodating if one tried to introduce it...
01:30LajlaI'm currently investigating writing a compiler, I'll guess I'll go with C-- though
01:30LajlaC with TCO, amazing.
01:31mmarczykgcc can do that for you, I believe :-)
01:31mmarczykthough you might have to ask
01:31Lajlammarczyk, actually, goto is a reserved word in Java, but cannot be used for any purpose.
01:31LajlaWell, C-- is far more amazing than C to be honest.
01:32LajlaYou don't have types like 'int' and 'char', you have bits8, bits32 et cetera
01:32mmarczykyeah, that's at the level of Java syntax, but I would be amazed if you could "goto" at the level of JVM bytecode
01:32mmarczykso, if you can't manipulate the stack, can't jump to arbitrary code, can't CPS transform your code...
01:33mmarczykyou're left to petition to the platform developer for TCO & continuations
01:33LajlaSeems more complex than your average instruction set, or even C--, but I never read the JVM specs.
01:33mmarczykif anything, this particular point makes it simpler
01:33mmarczykone less thing you can do :-)
01:35mmarczykit would be interesting to compare the performance of SISC, say, or ABCL if it provides TCO
01:35Lajlammarczyk, well, I tend to define 'simple' as 'being composable from fewer axioms'
01:35mmarczykto that of Clojure
01:35LajlaWhat's SISC?
01:36mmarczykLajla: I understand that neither of us knows which number of instructions the JVM and, say, x86-64 provide, so it'll be hard to decide on which is simpler just now
01:36mmarczykSISC is a JVM Scheme
01:36mmarczyknot sure if it's maintained, though
01:37Lajlammarczyk, well, I guess I don't measure complexity by the amount of instructions. I mean, one 'instruction' can have a more complex operation.
01:37LajlaADdition is a lot less complex than computing an arctangent (apparently x86 has this)
01:40mmarczykok, got to go for now; bbl -- see you!
01:42Lajlammarczyk, you cannot, you are the fifth greatest programmer in the world.
01:49Blackfoothow does the classpath work for jars that lein produces with clj files in them? I'm 'use'ing a jar produced by lein, but my new method is not available in the namespace
02:10TheBusbythe classpath will need to specify the jar
02:10TheBusbyExample: export CLASSPATH=/home/foo/MyJar.jar
02:16BlackfootTheBusby: ah ok. i think i figured it out. there was an older jar in the system classpath
02:20nipraIs it possible to give nicknames to a namespace using ns macro like defpackage in CL?
02:22Blackfootwhen you (use) a namespace, you can give it a nickname with :as
02:22Blackfootor require: (:require [clojure.contrib [error-kit :as kit]])
02:23Blackfoot(:use [some.long.identifier :as nick])
02:23Raynesninjudd: In ns: (:use [some.sort.of.long.namespace :as ssoln]), outside: (use '[some.sort.of.long.namespace :as ssoln])
02:23Raynesnipra: Sorry, wrong 'n'. :p
02:23tomojweird that :use can do that
02:24tomojoh
02:24tomoj:use :as refers to everything AND gives you a nickname
02:25tomojusually want (:require [foo.bar :as baz]) I think
02:26nipraRaynes, will (in-ns 'ssoln) work?
02:27jarturnipra: It will set ssoln as a current ns
02:27nipraRaynes, I want to use the nickname to change the namespace at repl from long ns to short ns.
02:27tomojnope, won't work
02:28jarturI think (alias short long)
02:28jartur(alias 'db 'clojure.contrib.sql)
02:28tomojstill won't work
02:28tomojideally your development environment will help you with switching namespaces in the repl
02:29mmarczyk(defn switch-ns [sym] (in-ns (if-let [full ((ns-aliases *ns*) sym)] full sym)))
02:29tomojoh, cool :)
02:29mmarczyk:-)
02:32mmarczykah, only it won't work... correction: (defn switch-ns [sym] (in-ns (if-let [full ((ns-aliases *ns*) sym)] (.getName full) sym)))
02:33jarturThis is the first time I saw (if-let [b t] t e) form
02:34jarturSo much to learn...
02:36jarturLike the other day I have constructed an atrocious monster construct with merge and filter to filter a few keys from a hash.... Then I read about dissoc
02:37Blackfootif-let and when-let are great, i keep wishing i had them in other languages now
02:37technomancywhat'll really blow your mind is the fact that it's pronounced "dissosh"
02:37jartur=)
02:37mmarczyk(defn switch-ns [sym] (if-let [target (or (find-ns sym) ((ns-aliases *ns*) sym))] (in-ns (.getName target))))
02:37jarturYeah.
02:37technomancynot "dissock"
02:37mmarczykmore in line with the name, I guess...
02:38jarturdissauche
02:39mmarczykjartur: in case you need to do the reverse, remeber about select-keys :-)
02:39jarturmmarczyk: thanks. I'll try to remember that =)
02:41jarturI have a design question. I have a set of functions, all of which are private and call each other. Each one does a little to process input and then passes it to the other function.
02:41jarturNow, the last function in the chain actually does use a database connection
02:42jarturWhich my public function (the most abstarct one, it's the one that is the most far from the function that does the work)
02:42jarturgets when called
02:42mmarczykmaybe have them return the result of the processing, then use (-> input f1 f2 f3 ... (f-last db-connection)) ?
02:43jarturmmarczyk: Damn. It's not a dilemma anymore!
02:43jarturIt's a trilemma =)
02:43mmarczykouch :-)
02:43Blackfootheh what's the question?
02:44jarturI like this threading approach. Completely forgot about it already.
02:44jarturI was thinking about either passing the connection as a param through all the fns
02:44jarturOr using some var and call the chain with (binding ...)
02:44jarturI don't like this (binding stuff)
02:45jarturCuz it looks os wrong
02:45maxhodakwhen something's a personal project, is the convention to do "maxhodak.foo.bar" or "com.maxhodak.foo.bar" or ...?
02:45jarturBut having the same param everywhere is such a nuisance
02:45mmarczykmaxhodak: some examples of things which started out as personal projects include Clojure, Compojure, Ring, Enlive, ... :-)
02:46mmarczykEnlive does use net.cgrand.enlive-html as the main ns name
02:46jarturBut now when I see (-> ...) I think I have to re-think some things
02:46jarturLike how not awesome I am =/
02:47mmarczykjartur: I went through a period of not using -> / ->> at all in the beginning of my time with Clojure
02:47mmarczykto reimplementing it as a syntax-rules macro for use in Scheme :-)
02:47jarturmmarczyk: I come to clojure with some Scheme background.
02:48jarturmmarczyk: So for me making all just functional seems like the most 'right' thing
02:48mmarczykyeah
02:48jarturmmarczyk: And writing macros in scheme is not painless =)
02:48jarturI can't believe how simple clj macro system is
02:48mmarczykin this case, you'll just need to look around the standard lib and you'll feel right at home :-)
02:49mmarczykwell, you probably already do
02:49mmarczykas for your private functions, I think it's a bit wasteful to have them call each other
02:49mmarczykrather than simply return the result of their little bit of processing
02:50jarturI just need to shift my approach to FP in general
02:51jarturAlso I think one (me included) should resist any temptation to use vars as long as it doesn't *really* make things cleaner.
02:51Lajlajartur, pain is the essence of good programming.
02:51LajlaTo have a dark side.
02:51mmarczykjartur: agreed on binding
02:51jarturLajla: I love scheme macros actually
02:52jarturLajla: define-syntax is awesome
02:52Lajlajartur, my own hygienic macro system is so much more awesome.
02:52LajlaBut I agree, it is.
02:52jarturLajla: But not easy. Esp. when you do it your first several times
02:52LajlaI just miss sequencing in it.
02:52Lajlajartur, it's fairly human readible, is it not.
02:53LajlaIt's almost WYSIWYG macroing.
02:53jarturLajla: Yes, but getting to understand all this syntax-objects
02:53Blackfootthreading data through functions makes the functions easier to test, too
02:53mmarczyk(define-syntax -> (syntax-rules () ((-> x) x) ((-> x ()) (error)) ((-> x (y . ys)) (y x . ys)) ((-> x y . ys) (-> (-> x y) . ys))))
02:54jarturmmarczyk: you are a maniac, no?
02:54mmarczykone of the nice cases where macro by example is simpler :-)
02:54mmarczykum? ;-)
02:55Lajlajartur, my system works like this: {define-syntax {let ((<symbol:name> <form:value>) ...) <form:body>} ({lambda (<symbol:name> ...) <form:body>} <form:value> ...)}
02:56mmarczykLajla: a fan of PL:AI?
02:56Lajlammarczyk, what is that?
02:56jarturI used syntax-case
02:56jartursyntax-case is a little more difficult than syntax-rules I believe
02:57Lajlajartur, it's also not fully static.
02:57LajlaIs my impression
02:57Lajlait seems to be able to evaluate expressions, strangely.
02:57mmarczykProgramming Languages: Application and Interpretation, by Shriram Krishnamurthi
02:57Lajlammarczyk, never heard of it.
02:57Lajlammarczyk, why?
02:57LajlaThey also use extremely complicated, barely readable hygienic macro systems?
02:58jartur=)
02:58jartursyntax-case is just a little mind-boggling
02:58Lajlajartur, and I believe, not static.
02:59Lajlajartur, but one day, you'll be the third best programmer in the world, and understand it all.
02:59mmarczykLajla: just because of your use of {}
03:00Lajlammarczyk, ohhh, nonononono, my lisp firmly destinghuishes {syntax . <list:parametres>} from (function-call . <list:arguments>)
03:00LajlaSyntax is not data, you can kiss your eval goodbye.
03:00jarturhttp://gist.github.com/431147 - example of a relatively not simple syntax-case macro
03:00mmarczykyour lisp is not a lisp then, but of course it might still be a nice language ;-)
03:01Lajlammarczyk, well, considerate point.
03:02LajlaI found it particularly ideal to seperate syntax, which has its own evaluation model from functions, which do not in terms of compilation.
03:02RaynesYo dawg, we herd u liek lisp, so we put a macro in your macro, so you can generate code while you generate code.
03:04mmarczykjartur: ah, looks nice... regrettably I never spent much time with syntax-case
03:04LajlaRaynes, well, all people like lisp.
03:05LajlaI consider revoking people status for those that don't.
03:05RaynesThat's a lot of people, sir.
03:05RaynesYou give humans too much credit.
03:05LajlaSo that we may lock them up into 1 by 1 prisons with five of them and feed them hormones so that we can eat their delicious meat.
03:05jarturmmarczyk: looks nice, but no so nice when you are newbie and try to write that
03:05mmarczykI do recall having a paper by Dybvig on my pile which will probably lead to me learning about it, though :-)
03:05LajlaRaynes, it's hard not to overcredit people.
03:05LajlaRaynes, but you, you I will always love.
03:06mmarczykjartur: there's some mercy in the fact that a newbie will *not* try to write that :-)
03:06jarturmmarczyk: I did =)
03:06Lajlammarczyk, I disagree.
03:06LajlaMost people learn programming in reverse, they first do things, then they learn to understand what they did 4 years later.
03:06mmarczykjartur: apparently you never noticed the point at which you ceased to be a newbie then ;-)
03:07mmarczykLajla: hah! actually I think you're totally right
03:07jarturmmarczyk: About the time i've finished that and a couple of other macros =))
03:07LajlaIt takes an average C programmer 5 years to realize the fact that "Hello, World!" as an expression evaluates to a char pointer and has the side effect of statically allocating a lot of chars and a 0 which is not larger than a short int into memory.
03:07LajlaThey also seem to forget a lot that the C standard actually allows for char to be the same size as int.
03:08Lajlammarczyk, I myself praefer to first be able to write a formal specification in a language before I begin printing hello world, it makes me feel intelligent.
03:08LajlaJust like writing 'praefer' with ae, I think you all find me very intelligent and interesting then, amirite?
03:09jarturLajla: most definitely so.
03:10LajlaAnd think that I have a bookshelf of Encyclopædiæ Britannicæ and various diplomata from academic institutes, and by my wise skills have never been caught by computer virus, whose linguistic use of mine is but surely only a mass noun.
03:10LajlaI was thinking of putting 'octopodes' in that sentence, but found no adequate place.
03:10Fossiaught by computer virus octopodes
03:11Fossithere you go
03:11Fossialthough i think pseudopodes is even better
03:11LajlaWhat's a pseudopod? An animal with incomplete legs?
03:11LajlaPlatypodes is also nice.
03:12LajlaOr people that use plurals like mujihadeen and use the singlar 'talib' for one member of the taliban.
03:12LajlaAnd use tullaab when it's an Arabian member of the Taliban.
03:12jarturI like my octothorps.
03:13Lajlajartur, I think we should not longer use the word 'to program' but drop it in lieu of 'prographize'
03:13LajlaOr be really Icelandic and use 'to forewrite'
03:14jarturThough I have to admit that I don't know English that well. It's neither my native language nor a language of my surroundings.
03:14LajlaMight as well bring back the infinitives like forewriten.
03:15jarturAnd why do you need all these stupid articles like 'the' or 'a' which I never know how to place properly I don't know.
03:15Lajlajartur, I think this is more related to Greek than English, but as the second best programmer in the world I must make the impression of being very educated, which I'm not, I just make that impression well.
03:15Lajlajartur, slavic?
03:15jarturLajla: yes.
03:15Lajlajartur, which?
03:15jarturLajla: La Russe.
03:16LajlaAll I can say in Russian is 'I am a paederast'
03:16LajlaI can even spell it in cyrillic, but that takes time.
03:16jarturLajla: This is a very very important thing to know. Just don't ever use it when russians are around.
03:16mmarczykare there any articles in Finnish?
03:17jarturNope, I think
03:17jarturThey don't even have prepositions.
03:17jarturIIRC 'finland' = suomi / 'in finland' = suomissa
03:18jarturSomething like that anyway
03:18jarturThey have lots of cases
03:18Lajlammarczyk, nahh
03:18LajlaWell, in some dialects.
03:18jarturTheir language is not even indo-european
03:18LajlaTHey use 'se' (it/that/he/her) also as 'the'
03:18LajlaAnd yks (one) as 'a'
03:19LajlaOr well, depends, like, if you say 'olla tai ei olla, se on se kysymys' you use 'se' an article, as in 'to be or not to be, that is the quaestion'
03:19LajlaWithout se it would sound like 'that's a quaestion' like 'that's a thing you could ask' or 'that's a problem you deal with'
03:20LajlaNot 'that's the thing you should ask'
03:20mmarczykLajla: from "they use" I deduce you're not Finnish yourself?
03:20jarturWell some words which to some extend approximate articles are used in most languages
03:20Lajlammarczyk, well, no.
03:21jarturBut they are more like what the and a used to be
03:21LajlaActually, my Finnish is superb crap, but quote inhumanly good unquote when you realize that I learnt it from hearing my roommate talk to her mother on the phone.
03:21jarturNot 'put me in every time I don't know why' kind of words
03:21mmarczykLajla: ah, cool :-)
03:22Lajlammarczyk, I simply lack a lot of vocabulary, but it's grammatical and I have a feeling for the language and it's quite fluend and accentless, I just don't even know what a car is in Finnish.
03:22jarturLajla: perkele!
03:22Lajlajartur, saatanan kyrvä!
03:22Lajlakyrvät*
03:22jarturSuomi on suuri maa
03:22jarturAnd...
03:22jarturKissa on valkoinen
03:22jarturEi on musta
03:22jartur=))
03:22Lajlajartur, ei, on maa depressivalaisen kanssa, kaikki ja kaikkialla.
03:22jarturThat's about my finnish
03:22mmarczykoh good, I somehow managed to introduce Finnish to #clojure without speaking a word of it :-)
03:23Lajlammarczyk, I thought you addressed me actually, because I some times speak Finnish here.
03:23eevar2ei saa peitaa!
03:23mmarczykhm, I had a vague memory of "a mention of Finland", but that might be inaccurate
03:24LajlaI have no idea what verb sakaa or what it could be is or what verb peitaa is.
03:24mmarczykso, you're the one to have performed the introduction then.
03:24Lajlammarczyk, some one accused me of talking too much Finnish.
03:25Lajlammarczyk, well, I am eager to talk Finnish, a bit too much perhaps, I enjoy the boring work of inferring linguistic patterns, any patterns really, this is because I am very autistic, but I make up for all this by being a good cook.
03:25Lajlammarczyk, you are less autistic than I, surely because you are only fifth.
03:25eevar2"do not cover", stamped on ovens and such. probably missing some accents+++
03:26Lajlaeevar2, google translate?
03:26LajlaImperative negation is with älä, not ei, namely.
03:26mmarczykI envy your cooking ability.
03:26eevar2nah, oven vendor translation
03:26LajlaLike älä päästä koskaan <- don't ever let go. From a very cheesy Finnish chickflick which I watched.
03:26LajlaAhahaha
03:27Fossi:D
03:27Fossisuomi <3
03:27eevar2have that phrase in a dozen or so languages. try googling it ,)
03:27Lajlammarczyk, I like to think that all people envy me in all ways, they want to hate themselves like I do, but they can never parallel my fantastic level of self-harm and nightmares, never be as great as I.
03:27Fossii learned all my finish at the same time as my toki pona
03:27Fossii mix them all the time
03:27Fossithey are pretty similar in some ways
03:28LajlaFossi, oletko säkin suomalaista?
03:28LajlaMiksi, miksi, kaikki teitä on IRC:lla, ja mun kanavalla.
03:29LajlaThe point about learning Finnish from listening to some girl who's lived in another country since she was two is that you gain the impression that you can just coin new words on the fly in Finnish from English and Dutch roots.
03:30LajlaLike, you think that 'internetti' and 'aipotti' and 'utrehti' are actually words.
03:41cgrandgood morning #clojure!
03:42Lajlacgrand, mene pois tai puhu suomea.
03:42LajlaTää on kanava joka on puhumaks suomea.
03:42Lajlacgrand, I'm just kidding.
03:45Raynescgrand: Good morning.
03:45jarturcgrand: good evening
03:47canderacgrand: good whatever you call 3:45AM. :)
04:09esjMroning All
04:14LauJensenMorning esj
04:21Lajlaesj, terve, miten menee, on kaikki hyvää?
04:21Lajlaonko
04:21esjLajla: I'm going to go for, "make it a double"
04:27Lajlaesj, I agree
04:28LajlaShaken, not stirred.
06:53korreinfoq relased an interview with John Hughes http://www.infoq.com/interviews/john-hughes-fp if anny one is interested :D
07:37rhickeyso, if you needed symbols and letters to designate 64-bit integers and 64-bit floating point numbers, what would they be? taking a step back from the host words long and double (although they are candidates)
07:39rhickeyIt's kind of a shame int and float terms are bound to 32-bit on the JVM/CLR
07:39rhickeyin a vacuum, they're probably what I'd pick
07:43wlangstrothrhickey: any objection to using something with "64" in it?
07:44greghfixint?
07:44rhickeywlangstroth: well, 32 won't be an option. And the letter version might be used in places as well
07:45greghtoo bad there isn't really a unified numeric tower where you can just call them "number"
07:45jonasenZ and R as in math?
07:45rhickeythe letters might best be shortenings of the words
07:46greghzinteger :)
07:47wlangstrothrhickey: for integers, "long" is difficult to beat
07:47esjditto that for double
07:48rhickeywlangstroth: yes, l can be a problem as a suffix though, although mostly when i is also in play
07:49wlangstrothoh, I see what you mean now
07:52axilong=fat?
07:56wlangstrothhow about "whole"?
07:57esjwide ?
07:57wlangstrothoh, right - you'd end up with "whole" as the integer, and "wide" as the float!
07:58esjnot that clever, i was thinking wide_int & wide_float.
07:59Licensercookies
07:59wlangstrothI was thinking in terms of rhickey's readable suffix problem
07:59axibut he wants unique letters for each type?
07:59wlangstrothwide is pretty good
08:00axioh, he just wants them to be readable
08:01LicenserI'd go with long and double too, just my 2 cents, or int64 or somethinlike that
08:02LicenserI'm against R and Z since 64 bit numbers are not really much more R or Z then 32 bit
08:02wlangstrothLicenser: but there won't be a 32 bit option
08:03Licenserah it is not opposite to 32 bit?
08:03rhickeyright, the idea is that these are big enough to subsume all of the primitive integer and floating point primitives on the platform
08:03esjLicenser: agreed. it doesn't seem that long & double, are 'broken' so why change ?
08:04rhickeyesj: if you were to design a language from scratch that had only 64-bit integers and 64-bit floating point numbers, would you call them long and double?
08:04wlangstrothdouble, no
08:04wlangstrothI've never been a fan of "double"
08:05Licenseractually I think their name, at least classically is host based, on a x64 system a C int is 64 bit (one register) when I remember right a long would be 128 ) two registers) or am I mistaken
08:05rhickeylong and double only work as comparators to their shorter brethren
08:06esjrhickey: no, I'd call them int and real, but those terms are taken. Further, those using my language already have nouns that are familiar to them so it makes sense to use them.
08:06axicouldn't you implement int and float using a different case?
08:06wlangstrothexactly, but "long" isn't explicitly comparative
08:07rhickeywlangstroth: if there is only one thing, how to choose between long and short then?
08:07esjLicenser: I think you are correct in that.
08:07esjLicenser: certainly i've used C in an embedded context where the length of primitives varies.
08:07rhickeylong doesn't say anything about numbers the way int does
08:08wlangstrothrhickey: I mean it's not "longer", but fair point. I'd say "integer", naturally
08:08wlangstroth... but as you say, "i" is taken
08:08axithen use num(ber)?..
08:08rhickeyinteger and floating
08:09rhickey?
08:09cgrandintnum and floatnum? bleh :-(
08:09wlangstrothinteger and floating
08:09Chousukehmh
08:10esjand its a visual pun.... very clojure.
08:10Chousuketoo bad the host has taken the good names :(
08:11rhickeyesj: just to be clear, I'm playing devil's advocate here to see if there's something better than long and double, which win by default
08:11Chousukeif you want to separate between "clojure" primitives and host primitives, it would be better to call host integers hostint or something but that would be a breaking change :/
08:11esjrhickey: :)
08:13wlangstrothHaskell has "Integral", but that's pretty close to "int"
08:16wlangstroth"floating" without "point" looks funny
08:16wlangstroth(okay, I've stopped being helpful - carry on)
08:20axihttp://thesaurus.com/browse/integer
08:20axiit looks like the only alternative word for integer is digit
08:26Licenserrhickey: integer sounds not to bad, but floating sounds a bit odd, I'd percive it more as a value type that does some kind of floatin between places (a thread that can float between different hosts for example)
08:27Licenserwhat about fixednum for int, I know it's from the ruby world but it also kind of makes sense
08:28axioh nvm, a digit would be a 4-bit integer =p
08:28ravahello
08:29hugodscientific - as in scientific notation?
08:36cemerickwhat likely Clojure host doesn't use long and double?
08:38rhickeycemerick: javascript
08:38cemerickheh
08:38cemerickrhickey: not exactly a reasonable source of a veto w.r.t. numeric anything :-)
08:38cemerickI don't know anything about LLVM, so that's a wildcard for me.
08:39chouser"fixed" and "inaccurate" -- f and i
08:39cemerickchouser: stop causing trouble ;-)
08:39rhickeycemerick: this is more of a what-if exercise. I agree any deviation from host is going to have use explaining the relationship between e.g. "integer" and ints and longs
08:39rhickeyus explaining
08:40cemerickyeah, I saw your devil's advocate msg above. I guess my Q would be, why is long and double bad in theory?
08:40rhickeyeveryone is ok with long and double being the only supported primitives in fns?
08:40cemerick(aside from their being defined in terms of smaller numerics)
08:40rhickeycemerick: you would never choose them in a clean-slate design
08:43cemerickclean-slate or not, primitive numerics always have host limitations. Just by calling things int and float (for example), that wouldn't make 64-bit primitive maths appear in javascript, or in a 32-bit embedded environment. *shrug*
08:43wlangstrothbeside the fact that it's going to bother me all day now?
08:43wlangstrothit's surprisingly hard to find accurate terms
08:46Licenserrhickey: whoat about just using int and float and then giving a special option to access the 'host version'
08:46Licenserso h:int or h:float
08:46Licenserwhile this might sound silly but it might be better suited when we deploy on multiple hosts
08:46wlangstrothwith a colon?
08:46Licenserit is just an idea
08:47wlangstroth(oh wait, you're the @->-- guy)
08:47Licenser(<3 'clojure)
08:48wlangstrothhaha
08:48Licenserwhen I stop waling funny I'll go and send rhicky the CA and some candy so he lets me put <3 in c.c!
08:48wlangstrothcemerick: but how close to the metal are we really talking in this context?
08:48cemerickwlangstroth: I understand "primitive" to be the unboxed (if relevant) numerics provided by a host.
08:49rhickeywlangstroth: all the way, to single instructions on chip
08:49LicenserWhat I see is that in java we might have doulbe and long, do we have it in .net? or javascript, or ObjC, or (I can go on here)
08:49cemerickrhickey: given that, the names have to correspond with whatever host you're targeting, no?
08:50rhickeycemerick: no, there will be one pair of names, and they'll map to whatever your host can do for 64-bit ints and floats
08:50chouserlong and double were surely not intuitive when first introduced
08:50rhickeylong and double work for JVM/CLR
08:51rhickeychouser: still a mystery of C
08:51cemerickrhickey: what about decimal in .NET-land?
08:51rhickeycemerick: not covered by this
08:51canderaCLR int/long broke with the C/C++ tradition for that name.
08:51rhickeythe point of primitives is to reach the hardware
08:52rhickeycandera: followed Java in that
08:53chouserI'm not sure clojurescript would ever support primitives. Even if it did, it would have to map them to JavaScript types which show no sign of being unboxed ever.
08:53Licenserchouser: there are different js engines which might behave differently :P
08:54rhickeyso, let's leave it at long and double for now. Is everyone ok with only long and double primitive support for fns?
08:54chouserif the unboxing or primitives are somehow automatic, then the clojure compiler need not worry itself with them. If not, declaring them would be a change to the language spec and that's exactly what I find unlikely in the forseeable future.
08:55rhickeychouser: ?
08:55chouserif the unboxing or primitives are somehow automatic in a particular JS engine, then the clojure compiler need not worry itself with them. If not, declaring them would be a change to the JS language spec and that's exactly what I find unlikely in the forseeable future.
08:55rhickeyah
08:56wlangstrothrhickey: expedience wins
08:57cemerickrhickey: you had a formal reason for not bothering with int and float, right? Overload counts, was it?
08:57rhickeycemerick: several. Simplicity, redundancy, no information loss moving up, combinatorics
08:58rhickeyalso the 64-bit ops are proving to be no more overhead
09:00rhickeybut essentially, the smaller the footprint, the smaller the downstream overhead. This is a problem with e.g. CLR value types - they propagate complexity down the chain. It is easy to envision mapl, mapd...
09:02rhickeycemerick: so while you may look at this as a host thing, it really is not. It's about reaching the hardware. Not providing a mapping to every host lang data type
09:03rhickeye.g. most of the Java integer types are fictions - it has no bytecodes for things smaller than 32-bit
09:03cemerickrhickey: that's where I get fuzzy, just because I lose sight of things under my nose. Java's "primitives" aren't necessarily machine primitives
09:03rhickeycemerick: ^^ not even bytecode primitives
09:03cemerickright
09:03cemerickI'm not clear on that stuff at all. Mud, really.
09:06Licenserwhat about getting a license to use 'God wrote in Lisp' as clojurs theme song?
09:06chouserClojure's not that kind of Lisp
09:07Licenserthat does not matter, the song is cool
09:07rhickeythe hardware's not written in or for Lisp, and we have to deal with that
09:08cemerickIf I see one more "but it's not Genera"....
09:09wlangstrothcemerick: don't even
09:09Licenserwhat does Genera mean?
09:09wlangstrotha guy I used to work with would go off on that any chance he got
09:10chouserLicenser: http://en.wikipedia.org/wiki/Genera_%28operating_system%29
09:10cemerickwlangstroth: Oh, I won't! :-)
09:10Licenserway thank you chouser *reads*
09:10cemerickLicenser is going to be crawling ebay for a vintage model before COB.
09:10cemerick;-)
09:11Licensercemerick: I have some cool old stuff already :P
09:13wlangstrothwait, Java's primitives aren't JVM bytecode primitives? I obviously have some reading to do.
09:13dnolenrhickey: so does this mean primitive support is on the table for 1.2 ?
09:14cemerickwlangstroth: I understood those things for about 3 weeks when I had to learn the details for some JNI work. Now it's all a muddle.
09:15rhickeydnolen: it's on the table with its guts hanging out :)
09:15dnolenhaha
09:16rhickeythis :static thing is bigger tha nprimitives
09:16rhickeythan
09:17dnolenrhickey: yeah, I wasn't totally understanding the repercussions of :static ...
09:17chouserstatics are still vars at compile time, right? their varness goes away at call sites?
09:18rhickeychouser: there will be vars, and they have IFns in them. But calls made by name through the var get inlined into static method calls
09:18rhickeyname of the var
09:19rhickeyIFn methods just call the static ones, so no bloat
09:19chouserah, interesting. hense the non-closure restriction
09:19wlangstrothcemerick: ditto, except my exposure was in school
09:20rhickeychouser: right. I'm trying to make the one of the few. Today I'm adding support for variadics and recursive calls
09:20rhickeykeyword callsites currently require 'this' as well, need to change that
09:21chouserkeyword callsites as in (:foo bar) ...but surely bar needs to be an instance, thus 'this'?
09:22rhickeychouser: the callsite is in the caller of (:foo bar)
09:22chouserah!
09:22rhickeyso right now statics can't call (:foo bar)
09:22chousergot it
09:23rhickeysurprisingly. not an issue for most of core. But variadics and recursion were
09:23rhickeyunacceptable limits
09:38AWizzArdI spread lots of functions and records over several namespaces. Now I would like to offer my users one single namespace which they can require and in which they find all the functions they need.
09:39AWizzArdWhat is a good way to export my functions from the namespaces X, Y and Z into my public NS?
09:41MrHusAWizzArd why not use the ns macro and use :only
09:42AWizzArdMaybe I was not expressing clearly enough what I would like to do: I want that you can say: (require 'awizzards.ns :as wiz) and then you can call wiz/foo, wiz/bar and wiz/baz
09:42AWizzArdBut the function foo actually sits in the namespace awizzards.ns.X while bar sits in a.ns.Y and baz in a.ns.Z
09:43cemerickAWizzArd: there's immigrate
09:43AWizzArdI want to export a public user interface of all Records, constants and fns into one namespace, so as if I would have put all my code into that ns
09:43AWizzArd,(doc immigrate)
09:43clojurebot"clojure.contrib.ns-utils/immigrate;[[& ns-names]]; Create a public var in this namespace for each public var in the namespaces named by ns-names. The created vars have the same name, root binding, and metadata as the original except that their :ns metadata value is this namespace."
09:44MrHus(doc refer)
09:44clojurebot"([ns-sym & filters]); refers to all public vars of ns, subject to filters. filters can include at most one each of: :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol For each public interned var in the namespace named by the symbol, adds a mapping from the name of the var to the var to the current namespace. Throws an exception if name is already mapped to something else in the current name
09:44cemerickMrHus: refers are not visible to those that require the namespace that uses refer
09:45djpowellon other platforms what will 'long' be expected to map to? reminds me a bit of C99's http://en.wikipedia.org/wiki/Stdint.h
09:45MrHuscemerick Ok good to know
09:46djpowellah, reading up, they'd be (at least?) 64-bit
09:46AWizzArdI could of course implement all public fns in my NS again and just call the real thing under the hood, but that would be an unnecessary indirection and would cost some performance too.
09:46AWizzArdIt seems that immigrate is doing exactly this.
09:47djpowellC99 has int_fast64_t - which is basically at least a 64-bit int
09:48AWizzArdIt would just be userfriendly if the users of my system could require this one public interface NS and find there everything they want, instead of having to require 8 NSs and have all the goodies spread over those.
09:51MrHus AWizzArd maybe its the users job to select the functions they need out of your library :P
09:51chouserAWizzArd: I've heard vague warnings from people who've used immigrate
09:52chouserAWizzArd: you're sure it makes sense to define a logically-single public api in a bunch of different namespaces?
09:52AWizzArdMrHus: technically that's right, it just is more comfortable to hide 95% of my internal fns and just offer the users a friendly public interface.
09:53MrHusAWizzArd how about defn-
09:53AWizzArdchouser: I can maybe just remove the different NS names from the files. My main idea was to spread logical function units into different files.
09:53AWizzArdMrHus: my code is full of those
09:54AWizzArdI don't know how strongly Clojures namespaces are bound to Java packages, but a system that would allow me to publish a public api would be nice.
09:54chouserI've generally experienced more pain from splitting functionality into too many files/namespaces than from combining too much into one.
09:56AWizzArdYes, in principle I would just need one .clj file, though this could also work out as not too easy to manage, as well as having 250 small .clj files. A good mix may be the right thing.
09:56MrHusI think its a habit, you just get so used to one class per file. And you feel like cheating when you put many functions in one namespace / file.
09:57chouseruntil your file passes core.clj in size, you shouldn't worry.
09:57rhickeychouser: not the same for files vs namespaces, though, right?
09:58chouserWell, I guess I hardly ever use multiple files per ns, but right that's another option clearly demonstrated by core
09:58AWizzArdThis is something that I could do.
09:59chousercore.clj is 5664 lines. All the core .clj files together: 7154
10:00rhickeythe bootstrapping nature is somewhat unusual. You should be able to break most namespaces into multiple files easily
10:01rhickeynature of core
10:02AWizzArdAlthough core.clj then again is kind of a special case, as it wants to export everything, and most stuff in there is unrelated, whereas I have a good bit of code that I would like to hide per default from the user.
10:03AWizzArdBut yeah, splitting one NS into multiple files and heavily working with {:private true} could be one solution.
10:03rhickeywith :static, making a ns that exposes an enumerated subset of stuff from several other namespaces is a macro away, and no overhead
10:03chousercore has several private things, but I understand the ratio may be very different from your ns
10:04AWizzArdrhickey: that sounds interesting
10:04rhickeyAWizzArd: but tedious, and still probably wrong
10:04arohnerI find myself not splitting nses into multiple files because I find the (in-ns 'foo) at the top of the file much less readable than the (ns foo)
10:05arohnerin the (in-ns 'foo) file, I don't have the list of what's been required imported, etc
10:06chouserhm. you can require and import as needed in each file, though I wonder to what extent that defeats the tooling support that the ns macro is trying to provide
10:07arohnerchouser: yeah, maybe that's a job for slime, to tell me whats in my ns
10:09chouserare there any editors that color locals differently from var names?
10:09chouserI asked around a bit yesterday about making that work in vim, and if it's possible at all it'll be rather tricky.
10:09arohnerslime sometimes colors vars differently, but I haven't figured out the strategy yet
10:10chouserI'm thinking specifically of (map ...) vs (let [map x] (if map ...))
10:11arohnerchouser: no, slime doesn't do that
10:11arohnerit appears it colors vars and macros from clojure.core differently from everything else
10:11felideonhello. quick question, since my Googling is failing me. could a Clojure app run on Jave ME / CLDC?
10:14chouserI don't think I've heard of anyone actually attempting that.
10:18AWizzArdCurrently I would think that when I want to split one NS across several files that I will have to (load them) in my original one, where the ns declaration sits. Is that right?
10:19AWizzArdoh okay, core.clj is doing this too
10:25felideonchouser: thanks
10:31AWizzArdIs there a safe way to read the signature of a fn at runtime? I am not thinking about the :arglists meta data, as this can be changed.
10:31AWizzArdI am thinking more about something like introspection.
10:32chouserAWizzArd: Java reflection on the class, but of course that's an implementation detail that rhickey is busily changing at this very moment. :-)
10:32AWizzArdgreat
10:36chouseris there any way to insert line numbers into code generated by eval?
10:37chouserbleh, what a vaguely-worded question.
10:41arohnerchouser: I think you'll get line numbers as long as the code was read with a line numbering reader
10:44arohneror you can assoc the line numbers on to the forms
10:47AWizzArd(defn foo [a #^Integer b] (+ a b)) and then (vec (.getParameterTypes (first (.getDeclaredMethods (.getClass foo)))))
10:47AWizzArd==> [java.lang.Object java.lang.Object]
10:47AWizzArdAny idea why the Integer did not end up in the result?
10:49chouserarohner: I do get line numbers, but stack traces point to the line where the eval was called, not to the line where the code that got sent to eval was built
10:50chouserAWizzArd: IFn instances only take Object args and always return Object
10:51arohnerchouser: there's a small chance that might be caused by this bug: http://groups.google.com/group/clojure-dev/browse_thread/thread/1c2687d40f9b1a6f/0abf8719450457cd?show_docid=0abf8719450457cd
10:51chouserrhickey: you're not saying Clojure will never support primitive fn args on closures, are you? Just not yet?
10:52chouserarohner: hm, good point. though this is a runtime error, so I'm not sure.
11:05noidihow can I check if an object is a (byte) array?
11:05arohnernoidi: (class object)
11:05noidi[B
11:06noidihow can I pass that to instance? ?
11:06noidi,[B
11:06clojurebotEOF while reading
11:07AWizzArd,(instance (class (byte-array 0)) (byte-array 100))
11:07clojurebotjava.lang.Exception: Unable to resolve symbol: instance in this context
11:08AWizzArd,(instance? (class (byte-array 0)) (byte-array 100))
11:08clojurebottrue
11:09noidiisn't there a better way to get a hold of the array class?
11:10chouser,(Class/forName "[B")
11:10clojurebot[B
11:10chousernoidi: not really
11:10chouserthat is, not that I know of.
11:10AWizzArd(def +byte-array-class+ (Class/forName "[B"))
11:10yacini'm trying to profile some code. when i call the -main function, it profiles correctly
11:11AWizzArdAnd then you can refer to that constant.
11:11yacinbut when i make an uberjar and run it, it doesn't work
11:11yacinany idea why?
11:11chouserI guess Java has special syntax for array type names
11:11yacin(call the -main function in the slime repl)
11:11AWizzArdyacin: you say it does not work. What happens when you try it?
11:12yacin(profile ...) doesn't output anything
11:12yacinmy main looks like
11:12yacin(defn -main [& args]
11:12yacin(profile (doseq [pcap-path args] (run pcap-path))))
11:12yacinrun has:
11:12yacin(prof :feature-vector (get-feature-vector pcap-path))
11:13AWizzArdDoes the profiler need to be turned on during compilation? I don't remember if it is a macro which can be compiled away, depending on some flags.
11:13yacinin the function get-feature-vector, i have (binding [*enable-profiling* true] ... )
11:13yacinaround the function body
11:13yacinbut i figured it was something like that
11:14yacinso i thought i'd ask here
11:15AWizzArdI did not use that profiler for quite a long time, but instead typed "jvisualvm" in the shell and used what popped up.
11:17yacini like having the profile code built in
11:17yacinhmm
11:18noidithanks arohner, AWizzArd, chouser
11:18noidiI'll go with Class/forName
11:18AWizzArdBut maybe it is no longer built in. Perhaps when you created the Überjar the profiler code was not included.
11:22HerrBlumeHello, I want to format a subnet mask, I have a list of the form ("255" "255" "255" "128")
11:22HerrBlumenow i want dots betwen these values
11:23AWizzArdHerrBlume: better would be to have a look at http://java.sun.com/javase/6/docs/api/java/net/InetAddress.html
11:23chouser,(apply str (interpose \. [255 255 255 128]))
11:23clojurebot"255.255.255.128"
11:23HerrBlumeahh, thank you very much!
11:24AWizzArdOr: (require '[clojure.contrib.string :as str]) ... (str/join "." ["255" "255" "255" "128"])
11:24AWizzArd,(doc join)
11:24clojurebot"clojure.contrib.str-utils2/join;[[separator coll]]; Returns a string of all elements in coll, separated by separator. Like Perl's join."
11:25AWizzArd,(join "." ["255" "255" "255" "128"])
11:25clojurebotjava.lang.Exception: Unable to resolve symbol: join in this context
11:25AWizzArdurgs, str-utils2 :-)
11:25AWizzArdBtw, why was clojure.contrib.io renamed to clojure.java.io?
11:32caljuniorI am having some troubled with circular references between namespaces.
11:33caljunioris it legal to have two namespaces refer to each other with :use?
11:34caljuniorI have a gui namespace that initiates an event loop in a different namespace which in turn is firing table data updates to the gui tables.
11:36caljuniorCannot get these namespaces to load in the repl as either the event loop initiator isn't loaded yet or the table model.
11:37chouserloading a namespace changes the state of the namespace world, so order matters.
11:37chouseris there a reason you can have it all in a single namespace?
11:37chousercan't
11:43AWizzArdIs there a get -like fn that throws an Exception if the specified key is not in the map?
11:46hugodzakwilson_: thanks - fixed. I've also include osx keychain integration (if your on a mac)
12:01caljuniorchouser: sorry for the delay. I can put it all in one namespace. was hoping to keep to be able to seperate it for clarity.
12:02chouseryou can use two files but still a single namespace.
12:04caljuniorok, thanks.
12:07HerrBlumehello, i want to create an uberjar using leiningen
12:07HerrBlumeif i start swank and load a namespace vie (require 'namespace.) it works fine
12:08HerrBlumebut 'lein uberjar' complains about the name space missing
12:09LauJensenHerrBlume: Have you declared your namespace in project.clj ?
12:10HerrBlumeah...
12:10HerrBlumeLauJensen: thank you
12:12caljuniorchouser: works perfectly. thanks again.
12:12chousercaljunior: np
12:13LauJensenHerrBlume: If you get stuck there's at least 1 or 2 blogposts on my site (bestinclass.dk) which shows how its done
12:22HerrBlumeLauJensen: i will look at it...
12:26rhickeyrecursive statics are alive
12:27cgrandyeah!
12:28rhickeyso (fib 38) now 425 ms
12:28chouserheh. nice.
12:29rhickeywould like to get rid of the need for these (long 1) (long 2) bits
12:30chouserhave you heard from any heavy Incanter users about your ideas for handling of numerics? Seems like they'd by the most likely source of push-back.
12:30rhickeychouser: why would they push back?
12:30chouserif they expect auto-promotion and that changes
12:30rhickeythey use doubles for everything
12:31chouseroh, ok.
12:31rhickeyIncanter is Colt, so no BigAnything
12:31cgrandrhickey: weren't you considering reader support for primitives earlier? or was the suffix thing only for mapd and mapl?
12:32rhickeycgrand: It ends up reader support doesn't help. The reader must read Objects in any case. But given a Long constant, the semantic difference prevents me from treating it like a long
12:33powr-tocdamn it... I'm getting another Exception in thread "main" java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V (cookie.clj:1) error
12:33technomancyclojurebot: restfn?
12:33cgrandyeah thought of the boxing right after hitting [enter]
12:33rhickeyto fix, the semantics would have to be unified on throw-on-overflow
12:33clojurebotant clean and rebuild contrib
12:33technomancyclojurebot: clojure.lang.RestFn.<init>(I)V
12:33clojurebotclojure is the best way to learn java
12:33technomancy~botsmack!
12:33clojurebotOwww!
12:34rhickeyad you'd have to ask for 2big to get bigint semantics
12:34technomancypowr-toc: you've got .class files AOT'd with an older version of clj
12:34powr-toctechnomancy: does ring AOT?
12:34clojurebottechnomancy is to blame for all failures
12:35powr-tocahh wait.. lets try a mvn clean first
12:36powr-tocphew... it's gone... technomancy thanks for the clue... now onto my next error :-)
12:37powr-tocI'd forgotten I had some AOT'd namespaces
12:38cgrandrhickey: and I guess that wrapping primitives in new Number classes has too many consequences, too much complexity
12:38rhickeycgrand: right
12:45powr-tocLauJensen / cgrand : out of interest is there a google group for moustache?
12:48cgrandpowr-toc: good idea
12:48powr-toccgrand: I take that as being "shortly" :-)
12:49powr-toccgrand: Is there a function that'll wrap a standard java servlet into a ring handler? I know you can turn a handler into a servlet, but I need the reverse
12:54cgrandpowr-toc: http://groups.google.com/group/moustache-club
12:54powr-toccgrand: awesome name!
12:56cgrandpowr-toc: none that I'm aware of but you are the second person I hear asking for such a facility
12:57powr-toccgrand: it'd sure be handy
12:58cgrandyeah but it involves mocking servlet objects (request, response, context etc.)
12:58powr-tocas without it I have to maintain effectively two routes... one in moustache (or compojure) and the other as some hand rolled jetty wiring :-\
13:01powr-toccgrand: ouch... might you be able to use clojure protocols to wrap those types into a clojure.lang.Associative ?
13:02HerrBlumemy project name includes a '-', and lein gets confused. The compile task assumes prefix-suffix. The uberjar task assumes prefix_suffix.
13:03powr-tocor would it be going the other way...
13:03HerrBlumeMay the project name not include '-'?
13:03clojurebotproject euler is http://ProjectEuler.net
13:07cgrandpowr-toc: I think the simple path is to build upon something like http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/mock/web/package-summary.html
13:08cgrandno wrapping: copy data to/from servelt objects from/to ring maps at the boundary
13:12powr-toccgrand: yes... interesting idea... I wish I'd discovered that API a few years ago
13:20patrkrisam I the only one who hopes Clojure doesn't gain too much in popularity? I like having a secret tool :)
13:21HerrBlumepatrkris: no, look at common lisp
13:24_fogus_dnolen: Thanks for the submission. :)
13:29dnolen_fogus_: no problem, nice post! Makes me want to write a Clojure.js ...
13:30_fogus_dnolen: Let me know and I'll submit it for you. ;-)
13:32powr-toccgrand: btw... good call on allowing a single app call which works with middlewares!!! My big gripe with compojure was it's wrap call relied on mutation...
13:33powr-toci.e. it would mutate the top level var... which seemed pretty nasty, and far less declarative
13:37KirinDave_fogus_: Charles Nutter must have shed a single tear when you talked about ruby.clj
13:37KirinDave"But what about jruby? :("
13:39_fogus_KirinDave: Oh man! I hate making him mad.
13:39_fogus_and sad
13:42cgrandpowr-toc: it's all the def and redefing in Compojure that prompted me to write Moustache -- and the destructuring route syntax
13:43powr-toccgrand: yeah... I gotta admit I found that part of it very frustating...
13:44briancarperpower-toc: You don't have to use defroutes and wrap! in Compojure though, do you? Use (routes ...) and -> to do the wrapping and def the vars yourself.
13:44powr-toccgrand: Though I quite like the sinatra style string syntax in clout... it feels very HTTP-like... more so than moustache... which feels less HTTPy and more Clojurey...
13:45briancarpers/power-toc/powr-toc, sorry
13:45powr-tocbriancarper: thanks, I hadn't noticed that function
13:46briancarperdefroutes is a very thin wrapper over routes. Though all the documentation uses defroutes and wrap!, so it's easy to miss.
13:48cgrandpowr-toc: more "clojurey" is a design choice -- like I "clojurified" css selectors in enlive
13:48powr-tocbriancarper: yeah... I found the whole 0.3.x -> 0.4 transition pretty confusing at first... and the fact the docs keep changing
13:49dnolencgrand: are the routing vectors in moustache first-class like selectors are in Enlive now?
13:50powr-toccgrand: absolutely... and it's obvious... so job well done! :-) It's just a comment, that superficially the clout syntax is more obviously routing HTTP than the moustache one... still I really like how flexible app is...
13:50cgranddnolen: no, and they are binding forms so I won't be able to make them firstclass without changing the syntax or introducing an alternative syntax
13:51cgranddnolen: do you have a usecase?
13:51dnolencgrand: 1) gotcha 2) no :)
13:51cgrandphew!
13:51powr-toccgrand: though I do find the number of equivalent syntactic varients staggering and potentially confusing... i.e. knowing whether or not two forms are semantically equivalent or not
13:52powr-tocso some guidelines on what each variation is for... and perhaps the idioms to use might be useful
13:52cgrandpowr-toc: I confess I may have crammed too many things in one poor macro
13:52powr-toccgrand: still, must've been fun :-)
13:53cgrandit was liek designing a swiss-army knife :-)
13:53cgrandlike even
13:58rhickeyvariadics in statics now alive
13:59scgilardilet the retweets begin
14:00rhickeyheh
14:01powr-tocrhickey: any idea on the time frame for 1.2.0 yet? (No rush - just curious)
14:02dnolenrhickey: so I'm taking it that statics will bring significant performance gains to the average Clojure program? (thus much bigger deal than primitive support :)
14:04rhickeydnolen: depends on what you are doing. potentially, yes. If you've ever (let [f f-in-a-var] ...) and it mattered, yes
14:52cemerick_fogus_: thankfully, your post's juice isn't killing my blog server today :-)
14:52_fogus_cemerick: Mine is just barely keeping up. I had to disable a bunch of plugins
14:53cemerickI got crushed yesterday, sadly. m1.small + cruddy old glassfish setup is not a good combo :-/
14:53_fogus_Your survey is going to inspire many a post. :-)
14:54cemerickGood. I did it (mostly) get people talking.
14:54cemerickI wonder how many people within the community are really going through the results, taking the comments to heart.
14:54_fogus_Not sure, but I know I am
14:55kotarakcemerick: vim maybe ranks second, because it supports syntax highlighting, auto-indent, code eval, dynamic highlighting, omni completion and the like since Q3/2008. The "big three" (ccw, enclojure, la clojure) catch up only recently.
14:55kotarakcemerick: But it think vimclojure's share will drop with wider adoption in the java world (which will boost the IDEs share, I would expect)
14:56cemerickkotarak: yeah, I'm sure it's a good env. I'm cursed with the prejudice that "vim isn't for lisps", etc. :-)
14:56technomancykotarak: curious how you solve the "separate versions of clojure for vimclojure vs the projects running in it" problem.
14:57technomancyor is that not an issue?
14:57briancarper_fogus_, cemerick: Should've written your sites in Clojure, mine survived reddit+YC yesterday. :)
14:57cemerickbriancarper: I just use confluence, poorly set up in an old build of glassfish.
14:58_fogus_briancarper: I'm one step ahead of you, but sadly too late for today
14:58kotaraktechnomancy: the solution is "no clojure". The clojure used in vc is mostly version independent. The few things, that are are caught be conditional includes. The one part which would require gen-class (hence introduce harmfal AOT compilation) is written in Java. So I cheat a little bit.
14:58technomancyhandy
15:06lpetitkotarak, technomancy: congratulations for your great scores in the survey !
15:07kotaraklpetit: you, too :D I think, you will catch in the near future. With Clojure becoming adopted in wider range, the share of the IDE will increase.
15:10lpetitkotarak: there's also something I have in mind: I tend to think of emacs or vim users as "power user" individuals. Those individuals will certainly have catched the twitt or the email concerning the survey. I guess that maybe more classical "GIDE" users may not all be always reading the ml or following cemeric et a on twitter. So maybe there are even more users of graphical IDEs. Something...
15:10lpetit...like one person introduces clojure and one IDE in a company, surveys the language ml closely. And when he answers the survey, he is really answering for him and maybe 2-4 of his collegues as well :-p
15:11lpetitcemerick: we'll wait for the end of your new survey :-)
15:12lpetitcemerick: oh, damn. What if several people of the same company answer your survey ? Will you try to average the results given for a certain company (provided that it is possible at all to group the answers for a same company) ?
15:12cemerickFYI: we're now in production with DocuHarvest, a web application built using clojure, compojure, clutch, pallet, etc. http://bit.ly/9AvbUR
15:12lpetitor maybe create a Clojure Foundation :-)
15:12chouserlpetit: When answering the original survey, I passed it around at my company so others using Clojure could answer for themselves.
15:12lpetitcemerick: congratulations !
15:12lpetitchouser: don't break my dreams :)
15:13cemericklpetit: thanks :-) Just getting started.
15:14lpetitcemerick: working full time on ccw for one year would be for sure a fun experience !
15:15chousercemerick: docuharvest looks really interesting!
15:15cemerickthanks :-)
15:16cemericklots of stuff in the pipeline
15:16bobo_ive read clojure in action / the joy of clojure, any point in reading programming clojure? want something on paper
15:17briancarpercemerick: Awesome idea. I wish I'd had that kind of service 2 years ago.
15:17cemerickbriancarper: well, now you'll have it next time :-D
15:25LauJensenbobo_: Maybe, but I think the next logical step is http://conj-labs.eu :)
15:31cemerickILC 2010 is in Reno? :-o
15:32cemerickoh, colocated with splash *shrug*
15:33chousercemerick: was fun last time. Won't be going this time. :-/
15:33bobo_LauJensen: i agree! so come to stockholm! :-)
15:33cemerickNor will I. Reno? :-|
15:34LauJensenbobo_: You dont have that nice hotels in Stockholm :)
15:34bobo_sure we do! i guess, never been in one
16:14silveenhello, could anyone help me with a problem I'm been having? I've got a set of entities, and a painting thread trying to paint these entities, but the painter thread never seems to see them, if I copy and pase the exact same code to repl however they do show up. I'm using a ref for the set, what am I missing?
16:15chouserany agents involved?
16:16silveenyeah, an agent is running the rendering loop
16:16silveenaka the painter thread
16:16rhickeycemerick: congrats on docuharvest!
16:16chouseryou're sure that loop is actually looping, and not stuck?
16:18silveenyes, I've got a little (println "I'm painting") just before the (for ..., if I put the same println expression inside the for, it doesn't spam
16:20chousersilveen: I can't think of any other common errors. Can you post the code somewhere so we can reproduce the problem?
16:20chouserpreferrably as simple a version as possible
16:21cemerickrhickey: thanks :-) It actually made its debut at ClojureNYC, though it was in rough shape then :-)
16:22rhickeycemerick: I remember that, nice to see it go public
16:24silveenchouser: I'm not quite sure I got the meaning of reproduce there, but I've posted the interesting code here http://pastebin.com/SDYykHp4
16:26chousersilveen: I don't think #
16:26silveenMaybe I've misunderstood the entire thing (I'm new to this) with refs and agents, but isn't that supposed to set up a "shared state" between all threads?
16:26chouser(defstruct enemy (ref :health) :position :level :dir) does what you want
16:27chousersilveen: yes, values committed to a ref should be visible in all threads.
16:27chousersilveen: what you're trying to do sounds right, so it's just a matter of figuring out why that's not what's actually happening
16:28silveenyeah I've been trouble shooting this for a good hour now (learning syntax as I go)
16:29chouser,(let [enemy (create-struct (ref :health) :position :level :dir), e (struct enemy 1 2 3 4)] e)
16:29clojurebot{#<Ref@1fed553: :health> 1, :position 2, :level 3, :dir 4}
16:29chouser,(let [enemy (create-struct (ref :health) :position :level :dir), e (struct enemy 1 2 3 4)] (:health e))
16:29clojurebotnil
16:30chouserbut I think the problem you're actually seeing is because 'for' is not an imperative loop
16:30chousersilveen: try replacing (for [enemy @horde] (do ...)) with just (doseq [enemy @horde] ...)
16:30silveenokey chouser, will try that :)
16:31chouserthe reason it works at the REPL is because the lazy-seq returned by 'for' is forced in order to print it.
16:32chouserbut in 'do-render' that lazy-seq is just thrown away, so it never does the work you want.
16:32silveenokey now I understand
16:32silveenit worked by the way, thanks alot chouser :)
16:32chouseryou're welcome.
16:32chouserdo see what I said about :health above. That defstruct isn't what you want.
16:33chouserAnd I'd recommend using a different name for the defstruct than for your locals. Using 'enemy' for both will hurt you later. You might use 'Enemy' or something for the defstructu
16:33silveengood point
16:35chouserIs this your first Clojure program?
16:36silveenyes actually it is, I've been fiddling a little in Java for a few years and heard about clojure about a week back, so this is all very new to me
16:36chousersilveen: well, it looks great so far. Welcome. :-)
16:37silveenthank you :)
16:37chousersilveen: thanks for using clojure-style indenting and formatting. much easier to help than if you didn't.
16:38silveengenerally or in the pastebin? (I couldn't find clojure in their list of languages so I chose lisp)
16:39chouserin the pastebin. I see a lot of closing-parens-on-their-own-lines and such
16:40chouserso it's nice to debug perfectly-formatted code like this.
16:40silveenoh you mean you don't like seeing ))\newline)? yeah well it's difficult having matched curly bracers for so long, but I do try
16:49silveenchouser: about the :health issue, I don't fully understand it but I do see the problem, how should I go about creating a struct with a "thread safe" health value?
16:50chousersilveen: first of all, you probably shouldn't have a mutable value in there at all
16:50chouserwill the enemy's position change?
16:51chouserit's direction? why treat health differently from those?
16:51silveenbecause towers will damage the monsters, while only the monster will change it's own position and direction
16:53chousertry to think about values separately from identities. An 'enemy' struct is a value, just like any of clojure's collection types -- you can compute a new value with various functions such as update-direction or accrue-damage
16:53silveenthat way I was thinking I could do a (not sure about the exact syntax here) dosync commutative dec @health if (neg? @healt remove monster
16:54chouseryou should do that, but you should do it for the whole enemy, not the health individually.
16:55chouserthat is, the enemy should be stored in a reference object (ref, agent, whatever), and that's the mechanism through which all its value can be updated
16:55silveenah okey, yeah that makes sense. I was thinking I could use smaller locks and avoid locking the entire enemy while he might want to move
16:56silveenbecause if I lock him like that, he basically stops moving whenever he gets damaged?
16:57chouserpresumably there will be some kind of delay between updates in his position?
16:57silveenI wanted to avoid alot of failing transactions, "I can't move because I was damaged", but now that I think about it, that's not necessarily true
16:57Chousukedamage changes could be commutative.
16:57chouserbut yes, if two threads try to change his state at the very same time, one of them will have to retry
16:58silveenyeah ofc there will be a sleep somewhere, you're right
16:58silveenyes Chousuke they will
16:58chousersilveen: you're right to be thinking about these things, but I'd recommend going for fewer refs and avoiding nested ones unless you actually see that it's a problem.
17:01silveenchouser: okey
17:01silveenthanks for all the tips and help by the way, I really appriciate it (it ain't being easy being new to things)
17:02bmasonwhat's this mean? error in process filter, Wrong number of arguments: 0, nil
17:02silveennow that the painter seems to work fine, off to implementing the a* algorithm :)
17:02bmasonthat was in my slime status bar
17:03chousersilveen: We have a tidy little A* implementation in our book, though I'm not sure that chapter is public yet.
17:03silveenchouser: I found a pretty neat guide on the net already actually http://nakkaya.com/2010/06/01/path-finding-using-astar-in-clojure/
17:04chouseroh, actually it is -- chapter 6
17:06silveenchouser: what book? Might be good putting a bookmark before I forget
17:06chousersilveen: yeah, I saw that on etoo
17:06chousersilveen: http://joyofclojure.com/
17:07chouserit's not clear to me where the nakkaya.com one is examining paths in order of estimated total cost
17:07chouserbut maybe I've just not read it carefully enough yet.
17:12mmarczykchouser: he replaces old paths to any given square with new paths if their cheaper
17:12mmarczykthey're
17:13chouserah, I see, he re-sorts the seq for each 'add-nodes'
17:15mmarczykI wonder how this compares to a priority queue on larger maps
17:16mmarczykI'm used to thinking of A* as essentially based on a PQ
17:32chousermmarczyk: we used a sorted-set
17:33chouserO(log n) for inserts and removals.
17:33chousera finger tree might be even better -- O(log n) insert, O(1) removal from front
17:33mmarczykan "simple" sorted-set or a sorted-set-by ?
17:34chouserjust sorted-set. Turns out sorted-set-by is often trickier to use.
17:35mmarczykdidn't mean that as a suggestion, I've yet to use sorted-set/map-by :-)
17:35chouserno, I mean I tried it but it turned out not to be useful in this case
17:35mmarczykinteresting
17:35mmarczykso, do you maintain a "closed set" and an "open set", like nakkaya does with lists?
17:36cemerickI often wish sorted-set-by would continue to use equality to determine duplicates vs. the result of the provided comparator.
17:36mmarczykif you're willing to disclose that -- otherwise I can wait for MEAP to catch up with you guys :-)
17:37mmarczykcemerick: that seems to be brought up pretty often and is totally contrary to my intuitions
17:38chouserno, we don't have two lists. hm... what did we do...
17:38mmarczykadmittedly, these were formed in studying pure logic rather than data structure representations of sets.
17:39cschreinerwhat is a process-fitler in slime?
17:39cemerickmmarczyk: it makes total sense to me. Maybe that variant should be called a multiset?
17:39mmarczykcemerick: I'm not sure which variant you're referring to :-)
17:39cschreinerit says: error in process filter: Args out of range: "(0) passed to: PersistentVector (slot.clj:0)", 14, 2
17:39mmarczykriddochc: oh, cool
17:40mmarczykcschreiner: does anything actually break for you?
17:40cemerickmmarczyk: where equality is relevant for duplicates, comparator used only for ordering
17:40cschreinermmarczyk: it does not compile
17:40mmarczykcschreiner: I get "process filter" msgs from time to time and just ignore them with no further trouble
17:40mmarczykcschreiner: would you be using a particularly old or new version of swank-clojure?
17:40cschreinertotally fresh
17:41mmarczykcemerick: ah, makes sense
17:41cemerickmmarczyk: the 'multiset' term, you mean?
17:41mmarczykyup
17:42cemerickhrm, maybe I'll suggest it seriously then
17:42mmarczykI distinctly remember this being brought up several times
17:42mmarczykas a problem people were having with sorted-set
17:43cemerickeh, the formal definition of multiset doesn't jibe with what I'd like
17:43mmarczykso you'd probably have some supporters :-)
17:43cemerickat least according to http://en.wikipedia.org/wiki/Multiset
17:43mmarczykas a function X -> Naturals or something?
17:44cemerickyeah, multiplicity, etc.
17:45cemerickthe point is not to count repeated values, but to ensure that members with the same sort order aren't treated as dupes
17:45cemerickconsider indexing points along a single axis, etc.
17:45mmarczykbut
17:46mmarczykwhat do you propose to do with things which compare as 0
17:46mmarczykI can't say I've thought about this much, but at first glance I'm worried about e.g. bogus rebalancing
17:46cemerickif they're not =, retain them in order relative to the other members that are -1 or 1 of them.
17:47cemerickThe order of members that compare as 0 would be undefined.
17:47cemerickI can't remember how I worked around this when I last needed it.
17:48mmarczykthen we could use sorted-set-by as a practical device to form total completions of any partial ordering :-)
17:48mmarczykhm, then again not quite
17:48mmarczykactually
17:49mmarczykwhat's a zero supposed to mean
17:49mmarczykcoming out of (compare x y)
17:49cemerickmmarczyk: watch out, I don't know jack about math :-)
17:49mmarczykdocs say "x is equal to y"
17:49mmarczyk:-)
17:49cemerickshite :-)
17:50cemerickmmarczyk: where does it say that?
17:50cemerick,(doc compare)
17:50clojurebot"([x y]); Comparator. Returns a negative number, zero, or a positive number when x is logically 'less than', 'equal to', or 'greater than' y. Same as Java x.compareTo(y) except it also works for nil, and compares numbers and collections in a type-independent manner. x must implement Comparable"
17:50mmarczykyeah, right here
17:50mmarczyk"logically" equal to
17:50mmarczykwhatever that means
17:51cemerickThe docs for java.util.Comparator are interesting.
17:51mmarczykso according to what you're saying, it would be convenient for comparators to implement total orderings on partitions of their domains
17:52mmarczykthen (compare x y) just means x and y both reside in the same block of the given partition
17:52cemerick(zero? (compare x y)), yes
17:53mmarczykit can't possibly be a totally arbitrary partial ordering, e.g. with two two-element chain elements (members of either incomparable with members of the other one) + bottom + top it would break
17:53rhickeywhew, adding :static to everything in core is a lot more work than the magic direct binding of clojure.*
17:53mmarczykI mean break an attempt to construct a sorted-set-by with it
17:53mmarczykrhickey: does this entail no (binding ...) for core Vars with no earmuffs?
17:54rhickeymmarczyk: that's already been the case for a while with direct binding
17:54mmarczykright.
17:59technomancyrhickey: thanks for making the effort!
17:59rhickeytechnomancy: you're welcome, :static is coming soon...
17:59technomancynext time you could probably outsource the grunt work to the channel. =)
18:00mmarczykI thought I had a rough idea of all the reasons why 1.2 is going to be awesome
18:00rhickeytechnomancy: I'm doing this myself in order to shake out any issues. If someone else did it they'd just be scratching their head when it didn't work :)
18:00mmarczykguess I was to quick to jump to that :-)
18:00technomancyhah; right.
18:00chouserthough we had a work-around by adjusting the metadata of the core var before compiling code that used it. Is that still the case?
18:01technomancyI think now it's opt-in instead of opt-out for clojure* only?
18:01technomancy(FSVO "now" which may actually be in the future)
18:02cemerickmmarczyk: turns out I did something along these lines: https://gist.github.com/2f6cb5c287bd15d3bd79
18:02rhickeychouser: I don't understand that
18:03chouserI blogged it! :-)
18:04chouserrhickey: http://blog.n01se.net/?p=134
18:04mmarczykcemerick: but that means that if (zero? (compare x y)), (not= x y), you have both x < y and x > y according to your comparator
18:05mmarczykcemerick: not sure if that is a cause for concern, maybe it's just me feeling uneasy...
18:06rhickeychouser: oh that. I can't promise any such hacking based on implementation details is going to work
18:06cemerickmmarczyk: in this case, yeah. I think I might have used a another comparison to establish a secondary sort order. As is, that should just make for undefined ordering of that partition though.
18:06cemerickmmarczyk: would you be worried about poor amortized perf?
18:06chouserrhickey: right, I'm just wondering if there is some other work-around available for :static
18:07RaynesWasn't a function to get all permutations of a sequence moved to core not too long ago?
18:07rhickeychouser: call with #^
18:07chouserok
18:07rhickeysorry , #'
18:08mmarczykcemerick: exactly, but that's not to say I know or even necessarily expect that problems would arise... I'd like to check, though
18:09mmarczykcemerick: also: ((conj (sorted-set-by funky-comparator [1 2 3] [4 5 6] [7 8 9]) [10 11 12] [13 14 15]) [7 8 9])
18:09mmarczykfunky-comparator comes from the third revision of your gist
18:09mmarczykthis evaluates to nil for me
18:10mmarczykyeah, that's why I feel uneasy
18:10mmarczykthis breaks order-based lookup in the tree
18:11cemerickmmarczyk: interesting -- I was only ever using it to do traversals via subseq and rsubseq
18:11cemerickmmarczyk: I could always use (compare (hash x) (hash y)) as a secondary source of ordering ;-)
18:12mmarczykyeah, but than you don't need a special kind of sorted-set-by
18:12mmarczyksince you're likely to have a total ordering anyway
18:13cemerickheh, no -- though this is a helluva wart in any codebase
18:13mmarczykand if you might have hash clashes, then lookup will break in some other way
18:13cemerickthat's what the ;-) was for
18:13mmarczyk:-)
18:14mmarczykI wonder if a reasonable conclusion might be that we really could use finger trees :-)
18:15cemerickIn practical terms, I always have other stable sortable attributes, so the seconary/tertiary comparisons don't impact any lookups (were I to do them)
18:15cemerickI can imagine that not being the case though.
18:17mmarczykright
18:17mmarczykat any rate, the comparator needs to be useful for deciding which branch to take when going down the tree
18:17mmarczyka 0 would mean "umm, let's try both"
18:18mmarczykso perhaps there's no escaping custom solutions for 0 not meaning "dupe"
18:18cemerickbleh
18:20cemerickmmarczyk: a fn similar to core/comparator that composed some number of fns in order to yield a final verdict on ordering would simplify things quite a bit
18:23mmarczyklike so? http://gist.github.com/432276
18:25mmarczykargh, still doesn't work.
18:26mmarczyk(silly mistake, will fix)
18:27mmarczyk(updated now)
18:27cemerickyeah, like that, though if I were the only one using it, I'd reify an actual Comparator.
18:28cemerickmmarczyk: very nice :-)
18:28mmarczykright
18:28mmarczykthanks :-)
18:28mmarczykoh, actually the first version was probably ok too -- I misapplied it later :-P
18:29cemerickI understand the convenience of having comparator take predicates, but the efficiency issues can be serious.
18:30neotykwhere I can read more about :static?
18:30mmarczykthere are two version in the Gist now, one composing comparators, one composing predicates
18:31mmarczykyou could rewrite the first one to reify an actual Comparator of course
18:31mmarczykneotyk: http://clojure-log.n01se.net/
18:33neotykI found few messages today, but doesn't really explain what is it
18:34neotykok, see a bit more yesterday
18:35mmarczykcemerick: a reify-based version up now
18:35mmarczykneotyk: you know, it's not yet available on GitHub
18:35mmarczyknot quite the stage where extensive documention is to be expected ;-))
18:35neotykmmarczyk: but attracts interest already
18:36mmarczyk(multi-comparator: seems to work)
18:37cemerickmmarczyk: nice -- why not keep the reduce?
18:37mmarczykneotyk: as well it should :-)
18:37mmarczykcemerick: hm, not sure actually
18:37mmarczykcemerick: might as well, now that you mention it :-)
18:38cemerickit's certainly prettier :-)
18:40mmarczykyup, added a reduce-based version now :-)
18:41mmarczykthe reduction function could have a ^Comparator type hint on c and use .compare
18:41mmarczyknot sure there's much to be gained in that though...?
18:42cemerickmmarczyk: I'd add it so it doesn't matter whether you're using preds or java/reified comparators
18:42mmarczykah, good point
18:43mmarczykupdated
18:54mmarczykdarn, my Ubuntu box just crashed (!) :-(((
19:07fanaticoIs case unable to dispatch off types/classes?
19:07mmarczyk$(case (class :foo) clojure.lang.Symbol :sym clojure.lang.Keyword :key)
19:07sexpbotjava.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.MapEntry
19:08mmarczykhm.
19:09mmarczykah, of course
19:10Lajlammarczyk, what had you written first in C, a hellow world program, or understood the semantics of the string literal in source "Hello, World!"
19:10mmarczyk(eval `(case (type :foo) ~clojure.lang.Keyword :key :unknown))
19:10mmarczykcase has implicit quoting
19:11mmarczykso the clojure.lang.Keyword in the version which doesn't work is treated as a symbol
19:13mmarczykif you really wanted case-like dispatch for classes, you could write a macro to attempt to resolve symbols and if they happen to resolve to classes, replace them by those classes...
19:14fanaticommarczyk: of course, thanks.
19:14mmarczyknp
19:14mmarczykLajla: well, let's see; I *have* written a hello world programme in C, but I'm not entirely sure that I understand the semantics of the string literal -- never spent enough time with C to think about it
19:15mmarczykif forced to guess, I'd say sth like you did yesterday, I think... too late to be sure now that I've read it, though :-P
19:16Lajlammarczyk, noooooo
19:16lancepantzdoes slime-auto-connect work with swank?
19:16Lajlammarczyk, also, programme is a faux-french, a folk etymology if one likes.
19:16Lajlaprogram comes from greek, not French.
19:16cemerickmmarczyk: that last version should go into contrib :-)
19:17LajlaIt is a verbal noun of prographein, literally meaning 'to forewrite'
19:17lancepantzlike if i ^d my lein swank process, and restart it, can slime reconnect automatically?
19:17mmarczykcemerick: you think so? thanks :-)
19:18cemerickmmarczyk: have you filed a CA?
19:18mmarczykcemerick: not yet, but I'd love to do that
19:18cemerickif not, do so, and yes, into contrib that should go
19:19scottjlancepantz: I run lein swank from a script that also tells emacs to reconnect slime
19:19mmarczykcemerick: thanks for the encouragement :-)
19:19mmarczykI think I'll do that
19:19lancepantzscottj: how does that work? a shell script?
19:21alvatarohmygod!
19:22alvatarclojure has way more people than lisp and scheme!
19:22scottjlancepantz: http://paste.lisp.org/display/111307
19:22Lajlammarczyk, you'ren't going to defend your abuse of etymology?
19:24scottjlancepantz: I just updated it with sl5 from .emacs
19:26lancepantzthanks scottj
19:27jarturLajla: Maybe he was using the french word?
19:28mmarczykLajla: programme is the British spelling
19:28mmarczykLajla: I can spell either way with my preferred way being consistent ;-)
19:29Lajlammarczyk, well, not for the noun.
19:29LajlaOnly for the verb.
19:29LajlaAt least, not for a computer program.
19:29mmarczykhttp://dictionary.reference.com/browse/programme
19:29jarturLajla: J'ai ecrit un 'Hello world' programme.
19:29mmarczykn. & v. Chiefly British
19:30LajlaI'd rather not abide to the idosyncracies of any groupa nd rather spell sensibly.
19:30mmarczyknot a Brit I take it?
19:31Lajlammarczyk, most Brits spell computer programs as this though.
19:31jarturLajla: Sensible English spelling... It's like an oxymoron or something.
19:31LajlaA programme is a programme of a festifal or whatever.
19:31Lajlajartur, I begt to differ.
19:31LajlaSpelling needn't per se be systematic with respect to sound.
19:31LajlaCan also be with respect to etymology.
19:31mmarczykwell, at any rate, you're free to follow your own aesthetic sense
19:31Lajlammarczyk, but the point is that you're too.
19:32LajlaInstead of being forced to do as I tell you, who created this awful place? What have I ever done to you, God!
19:32mmarczykI'm inclined to agree, in fact that seems to be what I'm doing :-)
19:32Lajlammarczyk, wouldn't you rather serve me? Like Clojurebot?
19:32Lajla,'serve-Lajla
19:32clojurebotserve-Lajla
19:33Lajla,'I-worship-his-shadow
19:33clojurebotI-worship-his-shadow
19:33jarturLajla: Lexx?
19:34Lajlajartur, on to me, aren't you.
19:34LajlaWorship me, my divine shadow, that is.
19:34jarturI stopped writing "Hello, World" programs some time ago. I always check with "Why, Hello!" now.
19:35LajlaI do 'Hello, Nurse!"
19:36Lajlajartur, this one is the coolest: (extend standard-import-port/line "Hello, World!"), not only because it's 8 times harder to understand than that C variant.
19:36technomancy"Hello, sailor."
19:37Lajla'h ': "ello, World!"
20:16_rata_hi
20:17jartur_rata_: Hello
20:21ravagreetings
20:21rava(defonce server (run-jetty #'chdweb {:port 8080 :join? false}))
20:22ravacould anyone tell me why that binding comes unbound after compiling and running in swank?
20:22ravai did it this way so i could (.start/stop ) the jetty instance, but i get a "symbol unbound" error
20:22tomojare you in the right namespace?
20:23ravayes
20:24ravai'd C-c k the file, then in the slime repl i load up with swank-clojure-project /path/to/prj , i'd go into the namespace and try to do the start/stop in the repl
20:24tcrayfordyou tried using (var chdweb) instead of the reader macro?
20:25tcrayford(don't think that'll make a difference tho)
20:25ravanope
20:25ravathe odd thing is that i was able to get it working that way once
20:25ravabut i've not changed the code nor my init.el file
20:25ravaso i'm at a loss
20:26fjunkerI'm currently trying to install vimclojure 2.1.2 on Mac OS X Snow Leopard and I cannot build vimclojure.jar. Says there is an Unmatched delimiter in de/kotka/vimclojure/backend.clj on line 171
20:26tomojrava: the error is that 'server is unbound?
20:26ravafjunker: yeah i've never been able to compile vimclojure
20:26ravafjunker: just grab the .jar file precompiled
20:27fjunkerrava: I wonder how that one was compiled
20:27ravajava.lang.IllegalStateException: Var chdweb.server/server is unbound. (NO_SOURCE_FILE:0)
20:27rava [Thrown class clojure.lang.Compiler$CompilerException]
20:27ravafunny thing is swank sees the var
20:27ravavia tab completion in the repl
20:27tomojoh, hmm
20:27tcrayforddoes it show up in ns-publics?
20:28rava{chdweb #'chdweb.server/chdweb, server #'chdweb.server/server}
20:28tomojif server is unbound, defonce should bind it..
20:29ravaif i try to run the defonce line again, i get an error that that port is already bound
20:29tcrayfordis this for compojure?
20:29ravaso an instance of jetty is running on that port
20:29ravayes
20:29ravai can gist the file, its not much
20:29tomojwell, you're going to have to kill your jvm I guess to get rid of the rogue jetty
20:30tcrayfordI usually just run def the server from the repl, in the user namespace
20:30ravahttp://gist.github.com/432400
20:30tcrayfordthat way stuff still shows up when you reload whatever ns your app is in
20:30tomojjust curious, why "#'chdweb" instead of just "chdweb" ?
20:31scottjtomoj: so you can redefine chdweb
20:32tcrayfordif your using compojure 0.4, use the wrap-reload middleware
20:32tcrayfords/your/you're
20:32tomojI see
20:33ravathe documentation is fairly sparse, am not aware of wrap-reload
20:33tcrayfordif its 0.4, google for "mark watson compojure setup" and that should help
20:34tomojthat seems to use #'handler instead of wrap-reload :)
20:34ravatcrayford: thanks i shall
20:35tcrayfordyou still have to use a var somewhere, I think combining jetty with defonce is kinda eurgh at this stage
20:35tomojoh, it uses both
20:35tomojI had used defonce with run-jetty successfully once
20:36tomojbut I can't find it now
20:36ravai just checked out the compojure site and they have a funky line using future
20:36rava(future (run-jetty (var your-app) {:port 8080}))
20:36scottjrava: that's the same as :join? false
20:37tcrayfordso it just puts the server on another thread?
20:37ravanot sure, i'm still fairly newby myself :)
20:37ravaya pretty much
20:38ravapretty slick actually, that way i don't have to ever worry about that instance again
20:38ravajust toss it at another thread, let it ref the ns var and go to town reloading at will
20:39tcrayfordI'm debating atm wether to use 0.3.2 or 0.4 for a new app. Choice seems kinda hard
20:39ravasee anything particularly tasty you want/need in .4?
20:40scottjtcrayford: I prefer 0.3.2 but since new extensions and features will be for .4 I deal with all the things I don't like
20:40tcrayforddon't know enough about it I guess, I've used 0.3.2 in anger a lot though, so I'm pretty familiar with the api
20:40ravalol
20:41ravaafk
20:42tcrayfordthink I might as well use .4, seeing as its the way forwards (ish)
20:44ravatcrayford: you'd eventually have to update to it anyway
20:46tcrayfordyeah, its a decent point. Night all
20:46scottjrava: resolve your prob?
20:54rhickeyit's alive!: http://github.com/richhickey/clojure/tree/prim
20:55rhickey:static, longs and doubles arg/returns
20:56mmarczyk!
20:56mmarczykgreat :-)
21:03dnolenrhickey: :D
21:04cemerickrhickey: looks like it was a massive pile of work
21:10Lajlammarczyk, are you an expert on lambda calculus and its theorems?
21:14dnolenrhickey: do you have a gist or paste of your fib example that shows the syntax?
21:20livingstonI would really like to mapcon right now, but I don't know the equivalent function in clojure
21:21scottjlivingston: mapcat?
21:22livingstonI need mapcat but on each rest of the list (map and mapcat give you the first each time)
21:25livingstonI guess I don't need the appending part of the mapcon I can do that myself with (mapcat ... (but I need a function here that gives me all the rests of a list))
21:29dnolenhmm, prim branch and swank-clojure 1.2.1 don't like each other much, complaints about ARef
21:32ysph(doc ->)
21:32clojurebot"([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
21:32ysph(doc ->>)
21:32clojurebot"([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."
21:33tomojlivingston: dunno if there is already such a function, but
21:34tomoj,(take-while identity (iterate next [1 2 3 4 5]))
21:34clojurebot([1 2 3 4 5] (2 3 4 5) (3 4 5) (4 5) (5))
21:34livingstonhuh
21:34livingstonthat's better than what I came up with
21:35livingstonI just recursively built up a vector of the rests
21:36_rata_has somebody used fnparse? i'm trying to do a simple work with it but am not getting it right (I get a stack overflow)... how can I debug it? is there a way to track what's going on?
21:50dnolenuh, prim branch Clojure just got injected with jet fuel, yowza
21:50rhickeydnolen: fib primitive example http://gist.github.com/432465
21:51dnolenrhickey: I note that (:foo bar) is crazy fast now, or am I just seeing things
21:51dnolenrhickey: thx
21:52rhickeydnolen: (:foo bar) hasn't changed, but there are a lot more inlining opportunities through core fns
21:53tomojso what does ^:static mean?
21:54rhickeytomoj: a few things. First, calls made directly by name will be static method calls not going through the var. Also, static metods support long and double arg and return hints
21:56dnolenI'm seeing half a billion addition operations in about second. Bye bye boxing.
21:58livingstonwhy can't I attach metadata to a string? that would be hugely valuable. I would have assumed meta just creates a container that wraps whatever... but I guess in practice that would be a real pain to code in everywhere,.. I guess that makes sense it's just a shame.
21:59ataggartlivingston: clojure strings are java strings which are final. breaking that relationship would kill interop.
22:00ataggartwell, ignore the second part, there may be a way to do it; but the first part is true.
22:07silveenquestion: I've got a vector of strings and I'd like to get the 2D coordinate of a certain character, any idea on how I could get that?
22:09livingstonsilveen: you need the version of some that returns an index instead of the item
22:10livingstonand then call that on a string inside of a call to the same function on each string in the vector
22:10herdrickquestion: is there any thought of adding the type-based dispatch of defmethod to variadic fns? Or is that already possible?
22:10livingston(more or less)
22:11livingstonherdrick: if I understand you question, I think it is...
22:11herdrickrelated question: is there a way to get type-based dispatch like defmethod in a lambda?
22:12herdricklivingston: oh?
22:13livingstonwell I have a pretty old version of 1.2 but your saying dispatch with functions of multiple args?
22:13silveenlivingston: thanks for the pointer, however I can't seem to find any function that returns the index
22:14livingstonsilveen: you may need to write it by mapping on a counter to the string ... no wait there's a java string function that should get you the index in a string, right? use that
22:14ataggart,(.charAt "hello" 1)
22:14clojurebot\e
22:15livingstonherdrick: I remember seeing commentary that it wasn't allowed, but I have a defmulti that disapatchs to various functions that take different numbers of arguments - and it seems to work fine
22:15silveenataggart: the other way around tho, but thanks anyway :)
22:15ataggartah
22:15herdricklivingston: dispatch with the same number of args, but different types.
22:15herdrick(fn
22:15herdrick ([x] :int (foo x))
22:15herdrick ([x] java.io.File (bar x)))
22:15herdrickoops!
22:15ataggart,(.indexOf "hello" \e)
22:15clojurebotjava.lang.IllegalArgumentException: No matching method found: indexOf for class java.lang.String
22:16ataggart,(String/indexOf "hello" \e)
22:16clojurebotjava.lang.IllegalArgumentException: No matching method: indexOf
22:16ataggartwhat the...
22:16ataggartah
22:16herdrickok, with defmulti then? That's the fully general option I think. ?
22:16ataggart,(.indexOf "hello" "e")
22:16clojurebot1
22:16herdricklivingston: thanks!
22:17livingstonherdrick: no I think you just have to make that into a multi
22:17livingstonI may have missed the point of your question
22:17herdrickmake what into a multi? this: (fn ([x] :int (foo x)) ([x] java.io.File (bar x))) ?
22:19livingstonyeah reify the function (name it) and give it a dispatch function on type, then defmethod each
22:19herdrickok - i was looking for something more succint
22:19herdrickthanks!
22:19livingstonI know that will work - but I didn't realize what you were asking.
22:20livingstonyou can just use a cond if you need it packed into the same block
22:20herdrickyeah
22:23TimMcIs there a place I can download the Clojure API docs in HTML format?
22:25dnolenClojure 1.2 is going to be crazeeee
22:25dnolenawesome
22:26tomojTimMc: the gh-pages branch
22:27TimMctomoj: Ah, much obliged. http://github.com/richhickey/clojure/tree/gh-pages
22:28TimMcNow, why would it be a branch of clojure?
22:29tomojso that it shows up at http://richhickey.github.com/clojure/
22:29tomojand so that anyone who checks out the source gets the docs
22:29TimMchmm
22:30TimMcIt seems like an abuse of the concept of a branch. Then again, I'm fairly new to git.
22:31tomojit's pretty common
22:31tomojbranches in git don't have to share any commits, they can be separate trees
22:34RaynesTimMc: Also, that's a github thing. Not a Rich Hickey thing.
22:34TimMcI guess it just offends my sensibilities or something. :-P
22:34Raynes;P
22:35TimMcThis Rich Hickey fellow seems to have done a bang-up job.
22:35TimMcI'm very impressed by the language design.
22:39tomojhear, hear
22:40TimMc(I've been watching the presentation he gave at some Lisp conference.)
22:40tomojI imagine most language designers think hard about the choices they have to make
22:41tomojdifference is, rich gets them right :)
22:42TimMcWell, I'm not convinced about all the choices he has made, but I have yet to finish watching that presentation -- he might justify them to my satisfaction for all I know.
22:44hiredmanhttp://www.infoq.com/presentations/Towards-a-Universal-VM <-- "do what ever rich says, because he is normally right"
22:51hiredman,(doc doall)
22:51clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time."
22:52dnolenrhickey: should map/reduce be slower on microbenchmarks on the prim branch?
23:04_rata_can anyone help me with fnparse lib? I'm trying to write a parser for simple aritmetic expressions
23:05_rata_and I could make one for extremely simple arithmetic expressions: one addition or one substraction
23:06_rata_but when I try to make one for multiples additions and subtractions, I get a stack overflow
23:08_rata_I have: (def digit-lit (lit-alt-seq "0123456789")) (def number-lit (rep+ digit-lit)) for number literals
23:09_rata_is there a pastebin for clojure?
23:09tomojuse any you like
23:13_rata_is there any pastebin with clojure syntax highlighting?
23:13tomojgist
23:14tomojpastie too Ithink
23:15silveenpastbin got a lisp mode which works kinda okey
23:17_rata_http://gist.github.com/432521
23:18_rata_with the commented code I got it right for just one addition or one subtraction
23:19_rata_but when I tried to make it work with multiple additions and subtractions it stopped working
23:20tomojyou probably need to remove the left recursion? I'm not sure, never used fnparse
23:21_rata_oh you are right
23:21_rata_tomoj, thanks :)