#clojure logs

2010-11-12

00:05replacaKirinDave: it seems that the consensus is that deftype and defrecord completely subsume defstruct
00:08KirinDaveI thought so
00:08KirinDaveJust wanted to make sure.
00:08KirinDaveI'm doing a brief history of clojure OO for The Book.
00:12TheBusbyEr, is their a simple/standard way to convert a string into a Clojure numeric?
00:15scgilardiTheBusby: one simple way is (read-string "300")
00:15TheBusbyscgilardi: that's perfect thank you!
00:16scgilardiyou're welcome
00:18technomancyeven before defrecord there was hardly a reason to use defstruct
00:20KirinDavetechnomancy: I'm only mentioning it in a sidebar.
00:20technomancysounds good; mostly of historical interest
00:24LauJensenGood morning all
00:24amalloymorning LauJensen
01:31ppppaul~#90
01:31clojurebot90. Computation has made the tree flower.
01:31ppppaul~#89
01:31clojurebot89. One does not learn computing by using a hand calculator, but one can forget arithmetic.
01:32ppppaul??
03:00bartj, (doc fmap)
03:00clojurebotIt's greek to me.
03:00bartj&(doc fmap)
03:00sexpbotjava.lang.Exception: Unable to resolve var: fmap in this context
03:00amalloy$source fmap
03:00sexpbotSource not found.
03:00amalloyhrm
03:01amalloy~source fmap
03:01amalloywtf guys
03:01bartjgah, fmap doesn't preserve the structure!
03:01bartjyou guys are lying the documentation
03:01amalloybartj: what do you mean?
03:01bartj(fmap #(* 10 (first %)) {:a [1] :b [2] :c [3]})
03:01bartjI was expecting this: {:a [10] :b [20] :c [30]}
03:02amalloybartj: how on earth could fmap know to do that?
03:02amalloyit knows it got [1] as an argument, and you gave it 10 as a result
03:02bartjthe documentation says it preserves the structure
03:02bartjhmm
03:02amalloyyeah, it preserves the map
03:02bartjyou mean the keys of the map?
03:03amalloythe keys, and makes sure they still match with the same transformed values
03:03amalloybut what you do to the values is your business
03:03amalloyanyway (fmap (comp vector #(* 10 %) first) {:a [1] :b [2] :c [3]})
03:05bartjamalloy, hmm
03:05amalloyif fmap faithfully reproduced the structure, which conceivably it could, how would i turn {:a [1]} into {:a 1}?
03:06bartjok, it leaves the transformation of the values to the user
03:06bartjthanks!
03:06amalloyright
03:06amalloyenjoy!
03:06bartjone more thing: is there a function which does (complement nil?)
03:06bartjI want to check that a value is not nil
03:06bartjand I don't want to do a (complement nil?)
03:07amalloydo you care if it's false?
03:07amalloythat is: do you want it to return true or false when given false as the input
03:07bartjthe values are generally strings only
03:08amalloythen the function you're looking for is identity :P
03:08amalloy&(keep identity ["str" 1 nil :a])
03:08sexpbot⟹ ("str" 1 :a)
03:09bartj,(doc keep)
03:09clojurebot"([f coll]); Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f must be free of side-effects."
03:10amalloybartj: (keep f s) is basically (filter identity (map f s))
03:10amalloyor i guess, (remove nil?), since apparently it includes false
03:10bartjor (remove nil? collection) is easier :)
03:11amalloysure. but i'm demonstrating identity for you
03:11bartjto remove the nil IMO
03:11bartjoh ok!
03:11amalloyif you just want to drop nils from a seq, i'd use filter identity, personally
03:11amalloybut there's nothing wrong with remove nil?
03:19ppppaulcan someone give me suggestions for extracting strings from strings in clojure?
03:20ppppauldo i have to do java interlop?
03:20amalloyppppaul: um, it depends on what you mean by "extracting strings from strings". what's an example of what you want to do?
03:21ppppaul"abcd" -> "ab"
03:21ppppaul(apply str (take 2 "abcd"))
03:21bartj, (apply str (take 2 "abcd"))
03:21amalloyclojure.string probably has that, though the interop is really easy too
03:21clojurebot"ab"
03:22ppppaulin this case, using apply isn't helping to make my code understandable
03:22amalloy&(clojure.string/take 2 "abcd")
03:22sexpbotjava.lang.Exception: No such var: clojure.string/take
03:22ppppaulclojure.string has some nice stuff for splitting and replacing... but i want subsections
03:22amalloy(use 'clojure.string)
03:23amalloy&(require 'clojure.string)
03:23sexpbot⟹ nil
03:23amalloy&(clojure.string/take 2 "abcd")
03:23sexpbotjava.lang.Exception: No such var: clojure.string/take
03:23amalloybah
03:23ppppaultake is not in string
03:23ppppaulit's in core
03:23amalloyoh. i'm looking at clojure.contrib.string
03:23amalloy&(require 'clojure.contrib.string)
03:23sexpbot⟹ nil
03:23ppppauloh
03:23ppppaulmaybe i should look there too
03:23amalloy&(clojure.contrib.string/take 2 "abcd")
03:23sexpbot⟹ "ab"
03:23ppppaulnice
03:23ppppaul:D
03:24bartjppppaul, http://richhickey.github.com/clojure-contrib/string-api.html has a whole lot of string functions
03:25ppppaulbartj, replace 'richhickey' with 'clojure' for he updated site
03:25ppppauli'm looking at it now... has tons of sexy string stuff :D
03:25bartjhmm, ok!
03:27tWipwhat's the deal with clojurebot sending weird private messages?
03:27tWipby weird, I mean unsolicited, like "Huh?"
03:28amalloytWip: i've never seen him do that. private messages?
03:28tWipor are they channel notices or something similar
03:29amalloytWip: are they going to you personally, or to the channel in general?
03:29RaynesI've never seen him PM somebody with an odd message. I imagine that would be a bug.
03:29tWipperhaps it's a bug in irccloud, as I don't remember getting them with irssi
03:31ppppaulclojurebot sending me oppressive messages is a bug?
03:31Raynesppppaul: Sending them in PM would probably be a bug. Not the messages themselves. He's always sent random messages when people say certain things.
03:32ppppauli think the 8ball is broken
03:32amalloyRaynes: apparently it's not just certain things. hiredman specifically has him respond to 0.5% of messages
03:32RaynesHow could it possibly be broken? :p
03:32ppppaul~8ball is the 8ball broken?
03:32clojurebotPardon?
03:32amalloy$8ball is this working?
03:32sexpbotamalloy: Yes.
03:32ppppaul$8ball is the 8ball broken?
03:32sexpbotppppaul: Yes.
03:32ppppaulthere
03:32ppppaulproof
03:33RaynesYep, that solves it.
03:33ppppaulanyway, i would like to propose a fortune cookie feature
03:34Raynes$fortune
03:34sexpbotI have no fortune cookies. Please feed me some!
03:34Raynes$addfortune You will yawn in 5 seconds.
03:34ppppaul$fortune
03:34sexpbotFortune cookie eaten.
03:34sexpbotYou will yawn in 5 seconds.
03:34ppppaul$addfortune one day sexpbot will have a large fortune database
03:34sexpbotFortune cookie eaten.
03:35ppppaul$addfortune sometimes the 8ball is wrong.
03:35sexpbotFortune cookie eaten.
03:36rpierichanyone wish to chat?
03:38ppppaulis this a chatting room?
03:38rpierichi'm not sure
03:38ppppaul& (#(% %) #(% %))
03:38sexpbotjava.lang.StackOverflowError
03:39ppppaul$8ball is this a chatting room?
03:39sexpbotppppaul: Very doubtful.
03:39ppppaulwell then...
03:39ppppaulwanna chat about monads?
03:39rpierichwhat is a monad?
03:40ppppaulit is a way to represent a change in state using functions
03:40ppppauli think
03:40ppppauli could be wrong
03:40RaynesYou are.
03:42ppppaulenlighten me
03:43amalloythey're like burritos
03:43amalloy$google monad burritos
03:43sexpbotFirst out of 200 results is: Code To Joy: Monads are Burritos
03:43sexpbothttp://codetojoy.blogspot.com/2009/03/monads-are-burritos.html
03:43ppppaulwow
03:43ppppaulshould i eat them?
03:43RaynesOnly if they're poisoned.
03:45ppppaulpoisoned with smaller burritos?
03:46ppppaul(ns rosettacode.align-columns
03:46ppppaul (:require [clojure.contrib.string :as str])) i made a mistake, but my code is similar to the clojure documentation at http://clojure.org/libs
03:47ppppaulwhat do?
03:48ppppauldid i make a tpyo/
03:48RaynesWhat is the problem?
03:49ppppaulstr.take doesn't work
03:49Raynesstr/take
03:49ppppauloh shit
03:49RaynesAlso, clojure.contrib.string = clojure.string now.
03:49ppppaulreally?
03:49amalloyRaynes: no
03:50Raynesamalloy: maybe
03:50amalloyclojure.string has a lot less stuff
03:50RaynesMy statement isn't really incorrect though.
03:50RaynesSome of it was moved over.
03:51RaynesI /did/ use = and not identical?, so yeah. Sue me.
03:51amalloyRaynes: (not= #{1 2 3 4 5} #{1 2})
03:51RaynesWe can't be friends anymore.
03:52amalloy&(boolean "amalloy and Raynes are friends")
03:52sexpbot⟹ true
03:53ppppaullol
03:54ppppauli now have a padding function!
03:54ppppaulextra padding
03:55Raynes*cough*format*cough*
03:56ppppaulindeed
03:56ppppauloh
03:56ppppauloh
03:56ppppaullooking that up now
04:00ppppaulwoah, format is big
04:00Raynes$source format
04:00sexpbotformat is http://is.gd/gXJXY
04:03ppppaulformat doesn't seem to do center justification
04:20noidiis there a built-in function like (fn [a b] (if-not (nil? a) (cons a b) b))
04:21noidiI seem to need something like that quite often when using recursion and destructuring
04:23amalloynoidi: do you need to cons it right away, or are you building something up lazily?
04:24ppppaulwhat would be a good way of going about adding meta data to a string?
04:24esjmorning all
04:24noidiamalloy, right away. I'm doing macro-like stuff (only in a function).
04:24noidiI think I'll just write that little helper
04:25ppppaul$8ball morning?
04:25sexpbotppppaul: Without a doubt.
04:26amalloynoidi: i'm not at all convinced that macro-y stuff is related to non-laziness
04:26Chousukeppppaul: you can't add metadata to strings.
04:29ppppauli know i can't
04:29RaynesThen why ask how you can?
04:29ppppaulwhich is why i'm asking about a good way to do so... should i use records or lists or lambdas?
04:30noidimy function takes a vector defining a list of things [:foo :bar :baz], and each of the definitions may be followed by one or two optional arguments [:foo, :bar [...], :baz [...] {...}]
04:30amalloyppppaul: maps?
04:30ppppaulhashmaps
04:31noidiright now I do this when parsing the definition (let [[a b c & rest] definition] ...)
04:31ppppauli think lambdas may be the best way, cus they could return the string
04:32noidithe thing is, I have to cons b and c back to rest, but only if they're non-nil (which either means that there was a nil in the input sequence or the sequence ended)
04:32noidimaybe I'm approaching this the wrong way...
04:32ppppaulfilter nils
04:32ppppaulnils are icky
04:33noidippppaul, hmm... true! there's no point in supporting them in the "dsl", since they contain no information.
04:35ppppaul(filter nil? everything)
04:35ppppaul(remove nil? everything)
04:35ppppauli think filter does the opposite
04:40noidippppaul, thanks, everything got way easier with that :)
04:42noidinow I got rid of the icky cons stuff and can just do (recur ...accumulation... (concat (remove nil [b c]) rest)) in the branch that handles the case with no optional arguments (where b & c are regular elements or nils if a was the last item in the seq)
04:42ppppaul:D
04:50ppppauli want to return 0 when an exception happens in the below code... i get a cast error right now
04:50ppppaul(try
04:50ppppaul (count (nth % n))
04:50ppppaul (catch Exception e (eval 0)))
04:50ppppaulwhen (nth goes out of bounds, i want to return 0
04:51amalloyppppaul: (eval 0) is bizarre. just return 0
04:51ppppaulthat is the idea
04:52amalloyjust put 0 there instead of (eval 0)
04:52amalloyis what i am saying
04:52ppppaulit was
04:52ppppauli didn't change it back, yet
04:52noidi,(try (count (nth [] 10)) (catch Exception _ 0))
04:52clojurebotnoidi: excusez-moi
04:52noidiworks for me
04:53ppppaulok, my bug must be somewhere else, then
04:53ppppaulthanks :)
04:53amalloyand is this your real code, or an example to demonstrate exceptions? i'd suggest writing your code to do checking ahead of time instead of waiting for exceptions
04:55amalloy&(if-let [x (seq (drop 3 [1 2 3 4 5]))] (first x) 0)
04:55sexpbot⟹ 4
04:55amalloy&(if-let [x (seq (drop 3 [1 2]))] (first x) 0)
04:55sexpbot⟹ 0
04:55amalloyppppaul: ^^
04:57ppppaul^^ indeed
04:57ppppaulparens were wrong
04:58ppppaulwould be nice to have a short-hand for the try-catch stuff
04:58ppppaul(on-exception (code) (exception code))
04:59ppppaulor maybe (try+
04:59amalloyppppaul: you could write that macro easily enough, but a lot of your try/catch code will involve interop, which often has side effects
05:00amalloytherefore you can't just assume the first form is the "working" case and the rest are "error" cases
05:00ppppauli guess i don't have much experience with exception handling... didn't use it much when i did java
05:02ppppauli would actually like the syntax to be something like (code) (:oops exception return)
05:02clojurebothttp://homepages.inf.ed.ac.uk/kwxm/JVM/codeByNo.html
05:03amalloyppppaul: you already have that syntax. it's try-catch
05:04ppppauli guess i could do something like (? (body) (simple exception-body)
05:04ppppaulyeah, but (catch Exception e (body)).... i just want (body)
05:05ppppaule = % or something
05:05amalloy(try+ (.init someObj) (bar someObj) 10)
05:06amalloyhow can try+ know where the try ends and the catch begins?
05:06ppppaul(try+ (body) (catch body))
05:06ppppaullike if
05:07ppppaulcould just have a keyword :oops
05:07amalloyppppaul: so write the macro yourself. it's not complicated
05:07ppppaul(? (body) :oops %)
05:07amalloythen use it for a while and see if it's useful
05:08ppppauli'll write it up
05:08ppppaul*learning how to write macros*
05:10bmhCan I easily convert a vector of strings into a java string array? I've looked at functions like object-array, but nothing fits the bill.
05:10amalloybmh: into-array
05:11LauJensen2 more features and ClojureQL is 1.0 :D
05:11bmhamalloy: Thanks. That was easy.
05:11amalloybmh: we aim to please :)
05:14esjLauJensen: cool bananas !
05:14amalloy(defmacro ? [& body] (let [[work [_ & broke]]
05:14amalloy (split-with (complement #{:oops}) body)]
05:14amalloy `(try ~@work (catch Throwable ~'_ ~@broke))))
05:14amalloyppppaul: ^^
05:15ppppaul:D
05:15ppppaulthanks
05:15amalloywelcome. i'm off to bed now
05:15ppppaulnight
05:16LauJensenesj: yea - speaking of bananas, did you see you were listed on disclojure.org today?
05:16esjcourtesy of you.... thanks :)
05:16LauJensenToni Batchelli actually, he hand picks
05:16esjpretty sweet indeed
05:37fliebelmorning
05:38fliebelI remember people talking about some Bonjour git stuff for the conj, anyone know what that was? I found bananajour, but I'm not sure it's the thing.
05:40esjbananajour ! ahhahaha
05:50hsuhi was happily using leiningen and its project structure, but now i have a second application (something that will run on another computer, say) for the same project, which should share files with the other application. how should i organize this ?
06:20LauJensenRemind me, how is it I disable that warning "slime versions differ x y z (y n ) ?"
06:20hsuh+1
06:22hsuhi think you can force it with (setq slime-protocol-version 'ignore)
06:23hsuhyep, that worked
06:24LauJensenthanks
06:24hsuhof course that will come back to bite us when we update swank or slime :)
06:27LauJensenlive for today hsuh :)
06:59Raynescemerick: Good morning.
07:00cemerickRaynes: :-)
07:00hsuhhow could/should i share "utility functions" across projects (using leiningen) ?
07:04cemerickhsuh: hopefully lein will support artifact deployment to non-clojars repos soon.
07:05hsuhhm.. but that is the case for small stuff that you're still adding to, i guess
07:05hsuh*not the case
07:11hsuhwhat i have actually are two different apps which share some source code (for db access for example) and i dont know how to organize that... i'm considering even making a single project with two different run scripts (but then lein jar wont work in the future)
07:12cemerickhsuh: The typical thing to do would be to put the common utilities, etc. in their own project, which produces its own versioned artifact that is then added to a repository that you control. Then your other projects can add a dependency upon that common artifact.
07:13hsuhhm, ok... but what if these common files are also being developed? pain?
07:14RaynesSounds like you want something like cake's subproject dependencies.
07:14cemerickhsuh: every sane development environment has something like lein's checkout dependencies, or better.
07:15RaynesLook for it in the cake readme: http://github.com/ninjudd/cake
07:15RaynesI'm sure Leiningen does something similar.
07:15octe/12/12
07:15RaynesRight, checkout dependencies is lein's version, I think.
07:15cemerickRaynes: neither of them will solve his problem unless his build tool will push the common artifact to his own repo
07:16hsuhRaynes, cemerick: cool, that exactly that.. i was just searching the mailing list for the wrong keyword
07:18cemerickhsuh: Notice my last msg @ Raynes. You need to get that common utility project deploying into your own repo in order for the main application projects to build.
07:19hsuhcemerick: yeah i typed that before seeing yours... although cake's says that "If you really do want changes to clojure source files to show up immediately, you can always add the subproject src directory to your project classpath in .cake/config like this:"
07:19cemerickAFAICT, that's intended for developement-time only.
07:20cemericki.e. it won't affect actual builds.
07:21hsuhcemerick: oh but i'm worried about development now
07:22cemerick"We'll be fine; I've got enough in the larder to last through February!"
07:22cemerickI think I remember that from a Little House on the Prairie episode ;-)
07:26raekto me, leiningen's checkouts feature sounds like what hsuh is looking for
07:27raekat least I have used it for doing development on two projects at the same time, without having to push jars to the local repo
07:27hsuhperhaps it should be a single project with two ways of building (two different mains)... that would be much simpler
07:27cemerickraek: how do you get the artifacts into that local repo?
07:28raekI haven't done anything repo-related
07:28cemerickraek: oh, misread "without" in your last msg
07:28raekleiningen simply adds the classpaths of the other projects into the current one
07:28cemerickright, but....
07:29cemerickis this typical, setting up projects so that they can be used and built on a local machine, but require significant classpath relationship setup elsewhere?
07:31raekelsewere = production or another dev setup?
07:31hsuhi dont really have two projects - they will "always" be developed together, its just that it should produce two jars (for now)
07:31cemerickraek: all of the above
07:31raekI use checkouts when the version of the dep I want to use does not have a jar
07:32cemerickhsuh: sure, I have one cluster that is ~12 projects that are all developed together. Not splitting them up would have been a nightmare.
07:32raekmy experience is limited.
07:34raekI think "checkouts" are best suited for "local hacking"
07:34cemerickthat's what they're intended for, yes
07:34cemerickraek, hsuh: I've been dancing around pointing both of you at maven. It solves these problems in a general way.
07:35hsuhcemerick: otoh everyone heard the horror stories
07:35raekwhat is maven's approach to this problem?
07:36hsuhwhat are "checkout dependencies" called in maven land ?
07:36cemerickhsuh: yeah, lots of horror stories about lisp, too :-P
07:36hsuhtrue, i dont see any parens
07:38cemerickraek: checkout dependencies are orthogonal to the build and release process, so maven leaves that up to one's tooling; the major IDEs provide supersets of the "checkout dependency" feature. However, we'll be adding something similar to clojure-maven-plugin for those that prefer emacs/vi/textmate: http://groups.google.com/group/clojure-maven-plugin/browse_frm/thread/ec87a43c3bfac1b6
07:39cemericks/leaves/wisely leaves
07:39sexpbot<cemerick> raek: checkout dependencies are orthogonal to the build and release process, so maven wisely leaves that up to one's tooling; the major IDEs provide supersets of the "checkout dependency" feature. However, we'll be adding something similar to clojure-maven-plugin for those that prefer emacs/vi/textmate: http://groups.google.com/group/clojure-maven-plugin/browse_frm/thread/ec87a43c3bfac1b6
07:42Raynescemerick: You'll never convert me to maven. NEVAR.
07:42cemerickRaynes: Funny, you use maven every time you touch/touched lein. #toolate :-P
07:43RaynesI don't use leiningen.
07:43cemerickwell, you *did*
07:43RaynesAnd, I've never had to touch a .pom file, so meh.
07:43Raynescake uses maven (for the time being) as well, so you could have used that as an example.
07:43cemerickwhichever
07:44cemerickThe blub paradox is alive and well w/ Clojure devs vis a vis build tooling. :-/
07:49neotyk`Guys is following snippet in good style?
07:49neotyk`,(let [m {:k1 {:a [1]} :k2 {:a []} :k3 {:a nil}}] (select-keys m (for [[k v] m :when (not-empty (:a v))] k)))
07:49clojurebot{:k1 {:a [1]}}
07:57Raynescemerick: I still <3 you.
07:57cemerickRaynes: Likewise :-)
07:57cemerickRaynes: But you'll end up using maven someday.
07:57cemerickSorry. :-)
07:58RaynesWhen dead men walk and man can fly.
07:58neotyk`cemerick: or aether
07:58RaynesNobody likes clojail. :< no new watchers.
07:58AdamantRaynes: when there's no room in hell and the dead walk the Earth, we'll be too busy fighting the undead to worry about Maven
07:58RaynesI guess a sandbox is kind of a... really domain specific thing.
07:59RaynesAdamant: Touché.
07:59cemerickneotyk`: sure, but then if backends count, then Raynes has already used maven via lein and cake
07:59RaynesIf backends count, then sure. Pretty much everybody has used maven then.
08:00cemerickRaynes: …or when your first job has 14 modules, and the prospect of using anything else makes people go pale.
08:01neotyk`in our project we maintain both pom.xml and project.clj as pom doesn't allow us such a nice integration with emacs like elein does
08:01RaynesIf ever I need something that cake cannot provide or easily be made to provide, than I will succumb to mavens rule
08:01neotyk`but we have multiple modules
08:01cemerickneotyk`: `mvn clojure:swank`?
08:01neotyk`and java dev in projects
08:01neotyk`cemerick: not lein, but elein
08:02cemerickneotyk`: never heard of it?
08:02neotyk`elein is https://github.com/remvee/elein
08:02neotyk`clojurebot: elein is https://github.com/remvee/elein
08:02clojurebotIn Ordnung
08:03neotyk`so I can do M-x elein-swank or elein-reswank or elein-deps from within emacs
08:04neotyk`all no need to start in shell swank server
08:04Raynescemerick: Are you wearing a wife-beater in your twitter image?
08:05cemerickneotyk`: you keep separate project.clj's in sync just to use a 180-line elisp module? :-O :-)
08:05cemerickRaynes: I'm pretty sure I've never worn a wife-beater in my life. :-)
08:05neotyk`well, I don't have to maintain poms ;-)
08:05neotyk`I maintain project.clj
08:05neotyk`sometimes just help a bit with poms
08:06cemerickneotyk`: Ah; my point being, writing an emvn.el or somesuch would seem to be a more efficient route :-)
08:06hsuhtwitter just told "Similar to @cemerick chrishouser Follow"
08:06cemerickRaynes: nah, that's just a green polo shirt
08:06neotyk`cemerick: I'm still kind of afraid of writing my own emacs packages
08:15fogus_I need to add triangle-key support to clojure-mode.el! http://lispm.dyndns.org/news?ID=NEWS-2008-07-27-1
08:16Raynesfogus_: ohai
08:18cemerickHyper-Super-Meta-Control :-P
08:18fogus_cemerick: Thanks for the pom tips. I will clean it up later today
08:20cemerickfogus_: None of it is *bad*, was just FYI.
08:22fogus_cemerick: It's good stuff. I need to learn these things
08:23fogus_Raynes: Hello to you sir
08:29cemerickI guess it's safe to say that *no one* uses update-proxy.
08:32fogus_cemerick: I know a certain book that devotes a half page to it. :-O
08:32cemerickfogus_: indeed, I found that surprising!
08:32cemerickit's a neat facility, but I wouldn't be surprised if it went away so as to maximize proxy perf
08:33fogus_cemerick: I think update-proxy is a great incremental development tool.
08:33fogus_That's kinda the angle we took
08:35fogus_It would be ashamed if it went away
08:36stuartsierraAs far as proxies go, I wouldn't expect it to change
08:36cemerickfogus_: I'd much rather explicitly delegate to an external var, and then I can just load code to update my "proxied" function.
08:37cemerickI suppose you might actually want a *single* instance to gain a different method impl, but I've not encountered that use case.
08:38cemerickstuartsierra: having to pay the indirection cost just because you have to extend a concrete class is a bummer. Combined with the lack of use of update-proxy, and… *shrug*
08:38stuartsierraI think deftype/reify is the performant path
08:39fogus_cemerick: using proxy and gen-class pollutes my beautiful Clojure semantics, so I like the benefit of dynamism ... it dulls the pain a bit. ;-)
08:39stuartsierradunno if that performance can be matched when extending a concrete class
08:47neotyk`(find-doc "every")
08:47neotyk`sorry not this window
08:52jweiss_how do i convert a map into a seq? (not the keypairs, just a list (k v k v etc)
08:53Raynes&(flatten (seq {:a :b :c :d}))
08:53sexpbot⟹ (:a :b :c :d)
08:54cemerick&(mapcat identity {:a :b :c :d})
08:54sexpbot⟹ (:a :b :c :d)
08:54jweiss_ah good ones
08:54RaynesMine is two characters shorter, mhm.
08:54Raynes;)
08:54jweiss_i think Raynes' is a bit more obvious what it does too :)
08:55Raynesmapcat is really simple though, if you read the docstring.
08:55cemerickI've never liked flatten much
08:55jweiss_me either
08:55RaynesAlmost certainly faster as well.
08:55cemerick&(flatten {:a :b})
08:55sexpbot⟹ ()
08:55Innarsexpbot is some kind of script that recognizes clojure forms and evals them?
08:55cemerick^^ feels wrong
08:55Raynessexpbot does a lot more than evaluate clojure code.
08:55Raynes$whatis sexpbot
08:55sexpbotsexpbot does not exist in my database.
08:55jweiss_hehe
08:55RaynesSomething wiped my whatis db.
08:56RaynesSomething being me, accidentally.
08:56Rayneshttp://github.com/Raynes/sexpbot
08:56neotyk`I think cemerick's solution has one less node
08:56cemerickjweiss_: use whatever reads better to you :-)
08:57jarpiain,(flatten (seq {:a [1 2] :b '(3 4)}))
08:57clojurebot(:a 1 2 :b 3 4)
08:57jweiss_cemerick: even though the flatten one seems more readable, i don't like flatten. so i'll go with yours
08:57Raynes&(mapcat identity {:a [1 2] :b '(3 4)})
08:57sexpbot⟹ (:a [1 2] :b (3 4))
08:58RaynesYou'd better go with his.
08:58RaynesHis actually works.
08:58Raynes;)
08:58fogus_identity is too verbose! (mapcat #(-> %) {1 2 3 4}) :p
08:58KjellskiI want to write a function that prints every char in a two dimensional Character/TYPE array, but a newline at every end, what's the best way to do that?
08:58jweiss_Raynes: yours would have worked too, for my purposes - the vals are all strings
08:58Raynes&(flatten {:foo "foo" :bar "bar"})
08:58sexpbot⟹ ()
08:58Raynes&(flatten (seq {:foo "foo" :bar "bar"}))
08:58sexpbot⟹ (:foo "foo" :bar "bar")
08:59cemerickRaynes: see, that first one always bothers me
08:59Raynescemerick: Indeed, I didn't notice that behavior until a moment ago.
08:59jweiss_that behavior is not at all obvious from the doc either.
08:59cemerickI'd much prefer that it simply leave unflattenable values in the seq, untouched
09:00cemerick&(flatten "foo")
09:00sexpbot⟹ ()
09:00jweiss_yeah, i thought flatten would basically just remove inner braces/parens
09:00jweiss_if there aren't any, then it's done
09:01jweiss_except replacing the outer braces with parens, in the case of a map
09:01jweiss_but maps aren't seqs... so i guess the doc isn't *wrong*, just leaves out what it does
09:02cemerickjweiss_: I don't think it leaves anything out necessarily -- just that providing it with non-Sequential values is essentially bad input
09:03cemerickTossing an exception would probably be preferred, if that's the case.
09:03jweiss_cemerick: yeah, i just don't see why it was limited to seqs
09:03cemerickjweiss_: it's not -- it's limited to sequential things
09:03jweiss_i don't see why it can't handle maps too
09:04jweiss_&(flatten [:a {:b :c} :z :y])
09:04sexpbot⟹ (:a {:b :c} :z :y)
09:04jweiss_it just leaves maps alone when they're not toplevel
09:06tonylping?
09:06clojurebotPONG!
09:19KjellskiWhat could be the problem when "alength" was not found?
09:20tonylalength? is it an object method?
09:20tonyloh got it :P
09:22Kjellski,(doc alength)
09:22clojurebot"([array]); Returns the length of the Java array. Works on arrays of all types."
09:22Kjellski=( should I :use it in my namespace? I mean it's in clojure.core ... I don't get it ...
09:23tonylgist of the code you are using it?
09:34lrenncemerick: What are your thoughts on Ivy?
09:35cemericklrenn: it's a good solution for dep management, if you're stuck in ant.
09:36cemerickI think gradle uses it too, but I might be mistaken on that.
09:37lrenncemerick: Oh, you don't think it's better than maven for dependency management? How is maven better re: dep management?
09:37lrenncemerick: and yes, the gradle folks were smart enough to realize that maven was not what they wanted.
09:38cemericklrenn: Maybe it's not, but insofar as maven defines the standard that ivy adheres to, I'd be surprised if ivy offered much more.
09:38cemerickBesides, if I were to use ivy, then I'd have to use *something* for doing actual builds, which leaves me in the cold AFAICT.
09:38lrenncemerick: ivy only adhers to that standard when it's force to stoop down to maven's leven (ie, maven compatibility) :)
09:39lrenncemerick: what is wrong with lein/cake? Build tools that were built from the ground up with Clojure in mind, as opposed to maven which has been 99% built to do something other than build clojure projects.
09:39cemericklrenn: nothing's wrong with lein or cake, if they meet one's requirements
09:39lrenncemerick: how do lein/cake not meet your requirements?
09:40cemerickI don't like the reimplementation aspect of them, but *shrug*
09:40cemericklrenn: interop with existing tools and a large plugin ecosystem for starters
09:40lrennnot liking the reimplementation aspect of them (what does that mean exactly?) is different thatn not meeting your requirements.
09:44cemerickI mean that, at least from my perspective, build tools aren't very interesting, and are orthogonal to writing Clojure applications. Insofar as the latter will inevitably require interop with platform-esque tools/environments/etc, there's far less friction involved in using what is mostly standard on the host platform, than in tackling the hairy build problem from scratch.
09:45cemericki.e. if I were to ever do any serious work with ClojureCLR, I'd go find what the Microsoft camp uses for builds, and use that.
09:45lpetitIrenn, cemerick: my 2 cents. lein started simple, because it did not address a large spectrum of needs. My feeling is that as time passes, lein will have to cover more and more needs, as the kind of projects built with it grows. So in the end, lein will be as big as maven. I think that a better approach could be towards maven as clojure is towards java: a thin layer over existing stuff.
09:46Kjellskitonyl: https://gist.github.com/674172 =)
09:47lrennlpetit: the large number of people who use gradle and or still use ant would disagree with that.
09:48tonylKjellski: let me take a look
09:48lrennI think this thought that we have to use maven because that's what some java people use is silly. As far as I'm concerned Phil and Justin have already built a better build tool.
09:49Kjellskitonyl: thanks!
09:49lrennThe only real objection I've heard is that you lose the plugin support.
09:49cemericklrenn: Just because someone with fewer/different requirements uses a different tool, doesn't mean that that different tool is somehow superior/better/etc.
09:50lpetitIrenn, cemerick: the real question I'm still asking myself is: are we throwing the baby with the bath water ? maven's syntax is something. maven's plugins ecosystem is another.
09:50cemericklrenn: and tooling support. I use eclipse and hudson. Those are more important than my build tooling.
09:50lrenncemerick: agreed. I still would like to stick up for lein/cake. I should not have said they are "better", but for building clojure code, I fail to see how they are inferior.
09:51Kjellskitonyl: Hmmm... somehow it's working now... sorry for taking your time and thanks for having a look =)
09:51cemericklrenn: you don't need to stick up for them at all -- no one's tearing them down :-)
09:52lrenncemerick: I see a growing chorus of people suggesting it is silly for us to use lein/cake when maven already exists. That sentiment was already expressed once during this conversation :)
09:53cemerickLOL @ growing chorus :-)
09:54cemerickFor the most part, those of us that use maven for clojure builds keep our head down, because of a constant barrage of "why would you torture yourselves with that thing" comments.
09:55tonylKjellski: it works for me. also there is no need to put a for loop inside a for loop
09:55tonylthe for construct does it for you if you just write (for [row (range (alength scene)), col (range (alength scene))] ...)
09:56tonylthe most inner loop would be on the right and work it's way up to the left
09:56tonylI am guessing your problem could be ns related?
10:07lrenncemerick: you're right, "growing chorus" was not the correct phrase ;) Anyway, I don't think it's the blub paradox, I truly believe a build tool built and designed specifically for clojure is preferable to maven. I appreciate your time.
10:08cemericklrenn: I'd disagree re: blub, esp. if "building clojure" is the only aspect of the charter. Build, release, and deployment is far more wide-ranging than that.
10:09lrenncemerick: i include release/deployment as well.
10:23bartjcan someone please give an example of a java "NaN" stored inside a clojure variable?
10:26tonyl(def NaN java.lang.Double/NaN)
10:26tonyl(def NaN Double/NaN)
10:27bartjtonyl, thanks...
10:28bartjI am wondering why does this result in an error: (read-json (json-str [Double/NaN]))
10:28tonyloh, that is nat a javascript NaN though
10:28bartjbecause (json-str [Double/NaN]) certainly does not throw an error
10:28bartjso why is read-json complaining?
10:28bartjis this a bug ?
10:29tonylbecause it needs a javascript NaN since it reads json which is a based on javascript
10:29bartjI think the NaN comes from some Java code
10:29bartjhow best to gracefully handle this case?
10:30bartjit would be nice if NaN is stored as a string
10:30tonylyou could with javascript Math.sqrt(-5).toString()
10:31chouserthat's not valid json
10:31chousersurely
10:32bartjchouser, I completely agree
10:33bartjbut, I am helpless since it comes from some Java code I have no control of
10:33chousersounds like JSON defines no way of storing NaN
10:33bartj:(
10:34tonylyeah I would say store it as a string "NaN"
10:34chouseryou'll have to either use an "extended" JSON (who doesn't, after all) or encode it differently.
10:35bartjhmm, thanks guys
10:36chouserI suppose if json-str is shooting for conformance, it should complain when you give in NaN
10:37tonyl(require '[clojure.contrib.json :as json])
10:37tonyl&(require '[clojure.contrib.json :as json])
10:37sexpbot⟹ nil
10:37tonyl(json/json-str [Double/NaN])
10:37tonyl&(json/json-str [Double/NaN])
10:37sexpbot⟹ "[NaN]"
10:38tonyl&(json/read-json (json/json-str [Double/NaN]))
10:38sexpbotjava.lang.Exception: JSON error (unexpected character): N
10:39bartjchouser, my point exactly!
10:39bartjbecause (json-str Double/NaN) works just fine
10:40tonyl&(json/read-json (json/json-str [Double/NaN]) false)
10:40sexpbotjava.lang.Exception: JSON error (unexpected character): N
10:40chouserbartj: well, maybe it doesn't work since it generates something that is not technically valid JSON
10:41tonyl&(json/read-json (json/json-str ["NaN"]) false)
10:41sexpbot⟹ ["NaN"]
10:43chousersome options for encoding NaN: 1) "NaN", 2) NaN, 3) { "double": 0, "isNaN": true }
10:43bartj&(json/read-json (json/json-str [Double/NaN]) false)
10:43sexpbotjava.lang.Exception: JSON error (unexpected character): N
10:43chouser2 is what json-str is doing, but it's not valid JSON
10:43stuartsierrajson-str should throw an error on NaN
10:44stuartsierrabecause it's not defined in the JSON spec
10:44bartjtonyl, why doesn't false work in my case ?
10:45bartjstuartsierra, is this a bug ?
10:45stuartsierrayes
10:45tonylbecause NaN either way when it is compile in json it is not a valid name
10:46tonylin fact even in javascript you have to create a NaN variable
10:46tonyllike Math.sqrt(-5)
10:46tonylin javascript there is only the NaN error and the isNaN() function
10:47tonylI am guessing when read-json tries to get the value in the array it fails
10:47bartjtonyl, I mean you don't need the false
10:47tonylon the read-json call?
10:47bartj&(json/read-json (json/json-str ["NaN"]))
10:47sexpbot⟹ ["NaN"]
10:48bartjtonyl, yes
10:48samx&(json/read-json (json/json-str Double/POSITIVE_INFINITY) false)
10:48sexpbotjava.lang.Exception: JSON error (unexpected character): I
10:48tonylno you don't
10:48samx(json/read-json (json/json-str Double/NEGATIVE_INFINITY) false)
10:48samx&(json/read-json (json/json-str Double/NEGATIVE_INFINITY) false)
10:48sexpbot⟹ -Infinity
10:48tonylnow that is weird
10:49bartjI am unable to understand what the false param does from the documentation
10:49tonylhttp://clojuredocs.org/clojure_contrib/clojure.contrib.json/read-json
10:49stuartsierrakeywordized map keys
11:01bartjthanks everyone
11:25opqdonuthow can I cast a char into a byte in clojure?
11:25opqdonut,(byte \c)
11:25clojurebotjava.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number
11:25opqdonut,(byte (.charValue \c))
11:25clojurebotjava.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number
11:26cemerick,(byte (int \c))
11:26clojurebot99
11:26opqdonutah.
11:26opqdonutthanks
11:41chouserI wonder if that's acceptable, in light of what rhickey has said about coersion functions being for interop
11:42cemerickchouser: I was assuming opqdonut was asking for an interop context…
11:43alpheusI need to learn about configuration for clojure programs. I've declared a few vars that must be bound before my program's external functions are called but don't know where to have the user store them. Loading a clojure file specified by the user seems convenient, but how do I handle namespaces etc.
11:43opqdonutinterop yes
11:43opqdonutbuilding some packets in a bytebuffer
12:29xkbhi
12:30tonylhello
12:31quollDoes anyone know why leinengen might complain "That's not a task" on autodoc if I have a :dev-dependenies entry of [autodoc "0.7.1"] ???
12:31quoll(with corrected spelling of dev-dependencies, of course) :-)
12:32amalloyquoll: i don't use autodoc, but is it possible you need to specify an organization id to help it find the autodoc jar?
12:32hiredmanquoll: did you run lein deps?
12:33xkbdoes clojure have something like haskell's $ for function application?
12:33replacaquoll: I don't think the autoodoc plugin is working in the latest lein
12:33amalloyxkb: i don't know what $ does in haskell, but yes :P
12:33replacaquoll: it suffers from version-itis, which I'm working to fix
12:33amalloyprobably the answer is (apply f arg args)
12:34quollhiredman, no. I'm new to leinengen, and I figured it would do the deps automatically. Running now
12:34xkbamalloy: its like shorthand: sum (map sqrt [...]) becomes sum $ map sqrt etc.
12:34quollreplaca: should I go with 0.7.0?
12:34xkbI have this really long line of function applciations in clojure, and want to make it a bit more readable
12:34hiredman->
12:34sexpbotjava.lang.Exception: EOF while reading
12:34amalloyxkb: we don't have that, but -> and ->> are similar
12:35hiredman,(-> 1 inc inc inc inc)
12:35clojurebot5
12:35quollhiredman: deps worked. Thank you.
12:35xkbamalloy: Ok, will check them on the clojure site! Thanks
12:35amalloyxkb: for example: ##(->> (range) (filter even?) (drop 100) (take 5))
12:35sexpbot⟹ (200 202 204 206 208)
12:36xkbamalloy: ahh exactly what I was looking for
12:36replacareplaca: you can try it, but I think the problems run deeper than that
12:36xkbnice
12:36replacaleinigen has moved forward, but autodoc hasn't
12:36amalloyxkb: great
12:37replaca(I meant quoll)
12:37technomancyreplaca: what's the root problem?
12:37replacaquoll: so is autodoc working for you, then
12:37replacatechnomancy: (we talked about this a long time ago)
12:37quollreplaca: yes indeed. Browsing the html now
12:37quollmuch easier than (doc .....) :-)
12:37replacatechnomancy: the fact that autodoc wants to be both a lib and an executable
12:38replacaquoll: that's great news
12:38technomancyah, right.
12:38replacatechnomancy: and therefore has its own clojure version deps
12:38replacatechnomancy: I'm surprised to hear it works at all now, but my plan is to make a shim that goes between
12:39replacatechnomancy: and does an exec in proj
12:39replacatechnomancy: just haven't gotten to it yet
12:40technomancyreplaca: you should know about the :eval-in-leiningen key you can use to avoid spinning up tests for the project in a separate process.
12:43replacatechnomancy: right, but doesn't that use whatever version of clojure that lein is using?
12:44technomancyyeah, I don't think you can avoid making the executable its own project
12:44replaca"end of file while reading" would be a whole lot more useful if it told me which file! (and maybe the beginning of the top-level form as well)
12:45replacatechnomancy: and that's not really a big deal. Still, I'm a little befuddled about how it works at all currently. That 0.7 version quoll is using in based on Clojure 1.1 and I swear it didn't used to work
12:47quollreplaca: I'm not doing anything fancy with it either. Just added the :dep-dependencies entry and ran it. No other settings at all
12:48replacaquoll: if it works at all, I would expect it to be easy :). still I'm surprised (and happy - I thought folks using lein were suffering)
12:51quollyeah, I figured it was an all or nothing deal, but then again, I also figured that it didn't hurt to let you know that I hadn't done anything unexpected
12:53replacaquoll: thanks!
12:54quollnp
12:54quollthanks for working on autodoc :-)
12:55replacaquoll: I try! :)
12:56ninjuddcemerick: just to be clear, maven is not the backend for cake. we use maven only for dependencies, and lrenn is working on making that pluggable so you can use ivy instead
12:56ninjuddthough we plan to still support using maven too
12:57cemerickninjudd: *a* backend, then? :-)
12:57cemerickninjudd: do you have two sentences on "Why ivy?"
12:58ninjudd27 deps -> 2 deps. i'm sure lrenn can expand on that ;)
12:59ninjudd3 deps.. sorry
12:59cemerickninjudd: oh, I was wondering more about capability
13:00ninjuddcemerick: from my research, it looks like ivy can do everything with regard to deps that maven can and more.
13:00cemerickyeah, I knew it was at least equivalent.
13:01cemerickanyway, I didn't intend to open up another build tool discussion :-)
13:01ninjuddcemerick: i'm working on a response to your mailing list message
13:02ninjuddi might be misunderstanding, but i don't see what we would get from using maven instead of a 4 line macro
13:03ninjuddsounds like it is going in the wrong directlion: simple -> complex
13:04ninjuddcemerick: i'd prefer to someday have cake implemented purely in clojure eventually (save for a *very* small client script if you want a persistent jvm)
13:04ninjuddwith options to use maven/ivy for deps if you really need something only they offer
13:15jcromartieis there any sort of work for image-based Clojure development?
13:16jcromartieI've always found it to be a very productive way to program but it seems to be an idea absent from mainstream languages
13:16jcromartieSmalltalk, Forth, common lisp even
13:17dnolenjcromartie: seems like something JVM would have to support directly right?
13:17jcromartiewhat would a Clojure image "look like"? maybe some special def forms?
13:17jcromartieI think it could be bolted onto the JVM
13:17jcromartieforget about threads and other objects at first
13:18jcromartieI'm mostly concerned with the code I write in a repl... sometimes I want it to stick around
13:19pdlogan(having worked for gemstone, I can attest that an image-based anything on the jvm is... more problematic than you might first imagine)
13:20dnolenjcromartie: persistent jvms are fun that way, one thing I like about cake, I can try some stuff in ns user, quit, come back later and it's still there.
13:20jcromartiecake does that?
13:20jcromartiepdlogan: oh cool, you're a smalltalk vet?
13:21pdloganyes
13:21jcromartiepdlogan: I'm recently enamored with Pharo and Seaside
13:21dnolenjcromartie: yes it, tho if you restart your machine it's gone of course.
13:22jcromartieah, I see
13:31jfieldswhat's the easiest way to get from {:a 565 :b 878 :c 565 :d 997} to {:b 878 :d 997} ? (removing all kv pairs where the value equals X)
13:33dnolen(->> (remove (fn [[k v]] (= v 565)) {:a 565 :b 878 :c 565 :d 997}) (into {}))
13:33dnolen,(->> (remove (fn [[k v]] (= v 565)) {:a 565 :b 878 :c 565 :d 997}) (into {}))
13:33clojurebot{:b 878, :d 997}
13:33dnolenis one way
13:34jfieldsdnolen, thanks
13:37LOPPwhat's the best way to merge/concatenate sets
13:37jfieldsLOPP look in clojure.set
13:37jfieldsthere's union
13:40chouseror use into
13:40dnolen,(reduce (fn [m [k v]] (if (not= v 565) (assoc m k v) m)) {} {:a 565 :b 878 :c 565 :d 997})
13:40clojurebot{:d 997, :b 878}
13:40dnolenjfields: that's more verbose but faster than my first suggestion
13:41technomancyinto uses transients
13:41chousermaybe dissoc would be good
13:43chouser,(let [m {:a 565 :b 878 :c 565 :d 997}] (reduce (fn [m [k v]] (if (not= v 565) m (dissoc m k))) m m))
13:43clojurebot{:b 878, :d 997}
13:43dnolenchouser: nice, but turns out it's about the same speed as my second attempt
13:44chouserdnolen: on a that small array-map?
13:45dnolenchouser: yeah, it seems so
13:46chouserI would guess it would matter more on a larger hash-map. And then probably depend on whether most of the input entries match or not.
13:48fogus_Slight mod to chouser's:
13:48fogus_,(let [X {:a 565 :b 878 :c 565 :d 997} R #{565}] (reduce (fn [m [k v]] (if (R v) (dissoc m k) m)) X X))
13:48clojurebot{:b 878, :d 997}
13:49chousernice
13:49chouserthe local is to avoid re-evalling the set?
13:50fogus_That is one advantage... the other being it's easier for me to add/remove values when testing
13:51chouserI've been recently re-remembering that quoting collections avoids re-evaluation
13:52chouser(if ('#{565} v) ...)
13:53jarpiainthe compiler would cache that set since all the elements are compile-time constants
13:53fogus_chouser: Nice! Mind if I use that as a @learnclojure tweet?
13:54chouserjarpiain: the Clojure compiler, or hotspot?
13:54jarpiainat least cljc does and I copied that from Compiler.java :)
13:54chouserhmmm
13:54chouserjarpiain: only because it's in the function position?
13:55chouserI was pretty sure I looked at the bytecode for this not long ago.
13:56LOPPI don't understand this talk about collection re-evaluation
13:57chouser,(map (fn [x] #{x}) (range 5))
13:57clojurebot(#{0} #{1} #{2} #{3} #{4})
13:57chouserLOPP: in that case, the #{x} clearly has to be re-evaluated for each value of x, to generate all those sets.
13:57jarpiainin https://github.com/clojure/clojure/blob/d7787a758031fcc21f16c613cb759c5a6bee7a8a/src/jvm/clojure/lang/Compiler.java#L2719 it checks if all the elements are LiteralExpr
13:58LOPPfor my question on merging sets earlier I think I went with (apply (partial conj set1) set2)
13:58LOPPthat's clear yes
13:58hiredmanchouser: well, the set doesn't need to be reevaluated
13:58hiredmanx needs to be re-evaluated before the set is created
13:59dnolenjarpiain: yeah I remember seeing that commit, constant datastructures optimization, especially useful in cases like [], #{}, {} etc
14:00amalloyLOPP: that's equivalent to (apply conj set1 set2)
14:02chouserjarpiain: clearly you are correct. I wonder what I'm thinking of.
14:03chouserfogus_: might want to skip tweeting that one. :-)
14:07cemerickninjudd: simplicity shouldn't be an objective in and of itself IMO.
14:07cemericki.e. function before form
14:10dnolencemerick: "function before form", that's the root cause of most bad software I'd say ;) "function *and* form"
14:10cemerickdnolen: I'd agree with you in almost every other domain.
14:10dnolencemerick: we can agree to disagree about that.
14:11danlarkinI'm going to throw you all off your game and say "neither function NOR form!"
14:11danlarkinha ha
14:12cemerickdnolen: It's forced upon us by the tools and community issues.
14:12ninjuddcemerick: so what function do we get by replacing a 4 line macro with pmaven?
14:12fogus_For once I wish someone would say, "Let's disagree to agree"
14:12dnolenfogus_: ha!
14:12cemerick(inc fogus_ )
14:12sexpbot⟹ 1
14:12cemerickninjudd: I thought I was clear about that in my msg to that ggroup.
14:12fogus_Hmmm, my karma seems to be stuck at 1. :(
14:12cemerick(inc fogus_ )
14:12sexpbot⟹ 2
14:13cemerickshazam!
14:14cemerickninjudd: The endgame re: cake, lein, pmaven, etc. isn't great if things continue as they are now. Either Clojure is going to get really significant use in industry or not; in the former case, maven/pmaven will be in widespread use, but if people can't work together because of their build tool preferences/requirements, that does no one any good.
14:16hiredmancemerick: I must say say, speaking of industry, sonian ditched maven for lein and everyone is happier for it
14:16cemerickhiredman: plucky startups aren't what I really had in mind. But, good data point.
14:17ninjuddcemerick: maybe i'm being dense, but i think we actually lose function by using pmaven to parse project.clj instead of the clojure reader
14:18cemerickninjudd: you can make pmaven parse project.clj however you want
14:18cemericki.e. you and technomancy and whoever else cares about the topic would be in control of the mapping between project.clj and the POM
14:19ninjuddby reimplementing the clojure reader?
14:19cemerickno
14:19cemerickpmaven has all of clojure at its disposal
14:19lrenncemerick: who says the industry will use maven/pmaven? That didn't happen with groovy, what makes you think it will happen with clojure?
14:19amalloyi don't see clojure.[contrib].string containing an equivalent to clojurel.core/split-at. is there a reason c.c.string has take/drop/partition but not split-at? eg, there's something else i should be using instead?
14:20stuartsierrac.c.string is dead
14:20ninjuddcemerick: does pmaven currently use the clojure reader to parse pom.clj? i was under the impression that it didn't
14:20stuartsierrareplaced by clojure.string
14:20amalloystuartsierra: since when? c.c.string has all kinds of nice stuff c.string doesn't
14:20amalloyin 1.2, anyway
14:20stuartsierratoo bad
14:21amalloystuartsierra: why?
14:21cemericklrenn: Every exposure I've had to groovy in "corporate" environments involved it being built using maven, not gradle. *shrug*
14:21stuartsierranot enough value, the important stuff is in clojure.string now
14:22cemerickninjudd: I don't know what the implementation details are, but if jvanzyl was accurate in his email from a few weeks ago (you got that, yes?), then there are no limits on what you can use to implement the de/serializer for pmaven POM files.
14:23ninjuddcemerick: you still haven't told me what function we get for paying the price of a very large set of 20+ dependencies
14:24ninjuddcemerick: i would be happy to share my implementation of defproject as a separate project though, so pmaven can use it
14:24stuartsierrasupport for all Maven plugins
14:24cemerickninjudd: Again, it's in my msg to that ggroup. (a) One implementation of the model, not 3+, (b) free interop with all tools that support maven 3/pmaven, (c) access to all maven plugins
14:25cemerick(http://groups.google.com/group/projectclj---spec/browse_frm/thread/855ce112689fb33f for those following along)
14:25ninjuddusing pmaven to parse project.clj doesn't give us support for all maven plugins. the price for that would be even higher
14:25ninjuddthe price for that would be selling our soul to maven, which i'm not prepared to do
14:25cemerickoh, crud
14:26stuartsierraoh dear god
14:27cemerickninjudd: Do you have a hyperbole-free objection?
14:27ninjuddwhat i mean by that is, i'm not willing to have the cake's core implementation be dependent on maven
14:27cemerickno one suggested that.
14:28fogus_cemerick: I am definitely stealing that phrase for my next all-hands meeting
14:28cemerick"you could add commands to your
14:28cemerickrespective frontends to drive various pmaven/maven-provided
14:28cemerickfunctionality, such as generalized deployment, using existing maven
14:28cemerickplugins, etc."
14:28ninjuddi would love to have a cake plugin that provides support for all maven plugins in cake
14:28cemerickninjudd: If you want to reimplement commodity build processes, that's your perogative, but that doesn't mean you can't delegate off to pmaven to invoke maven plugins.
14:28ninjudd(LauJensen and i have discussed creating such a plugin)
14:29ninjuddcemerick: it sounds like i misunderstood your message then. i thought you were suggesting we depend on pmaven for the model
14:30ninjudd(which is why i asked here before responding)
14:30cemerickYes, I'm suggesting that you use the POM. It's the only formal build model anywhere, and is the gateway to interop with essentially all JVM-land build/deploy/mgmt tooling.
14:31stuartsierraUsing the model doesn't mean you have to use any particular implementation of that model.
14:31slyrusso... when you guys live on the bleeding edge with, say, 1.3.0-alpha3 and the corresponding contrib jars, do you just pick them up from maven/clojars or do you build your own jars?
14:31cemerickwhat stuartsierra said
14:31ninjuddi'm happy to produce a pom.xml, if that is what you mean
14:32slyruscemerick: what are "commodity build processes"?
14:32tonyli build my own
14:32stuartsierraMaven / Hudson / Nexus
14:32danlarkinformal build model is made up? First you're asserting that it is something, and then you're asserting that it is something desirable
14:32slyrustonyl: and you install them in your local maven repo?
14:32cemerickslyrus: compiling code, assembling jar files and other artifacts, deploying them to repositories, etc.
14:32slyruscommodity?
14:32tonylI don't use maven neither lein or anything else
14:33slyrusah, good for you
14:33ninjuddcemerick: currently cake uses ant for most of that
14:33tonyljust a bash script the runs the repl or the clj script i pass it to it
14:34tonyli should start learning more about them though, my projects are starting to get bigger
14:35cemerickninjudd: that's fine, but totally orthogonal to the discussion of the model
14:35ninjuddcemerick: so what do you mean when you say "use the POM"?
14:35tonyli thought somebody posted that clojars has an alpha 1.3.0 though
14:38pppaul$8ball women?
14:38sexpbotpppaul: Reply hazy, try again.
14:38ninjudd$8ball what does "use the POM" mean?
14:38sexpbotninjudd: Ask again later.
14:39ninjudd:)
14:39lrennstuartsierra: but the clojure community has no say over that model right?
14:40stuartsierraWe have spies inside Sonatype.
14:41pppaulwhat model?
14:41slyrusso clojure contrib is now split amongst 76 jars?
14:41lrennSo, it should have been "selling our souls to sonatype" as opposed to maven...and would thus not be hyperbole.
14:41pppaulhas there been a photo shoot?
14:41stuartsierraI don't have a soul anyway.
14:41pppaul76 jars... wow
14:42stuartsierraAnd I prefer to call it "participating in the broader Java community."
14:42stuartsierraThis includes things like getting Clojure and major libraries into the central Maven repository network.
14:42slyrusam I the only one who thinks that the name "complete-[version].jar" is a bit ambiguous?
14:43stuartsierrano
14:43stuartsierraGot a better name?
14:43slyruscomplete what???
14:43hiredmanclojure-contrib-complete-[version].jar
14:43slyruscontrib-complete would certainly be better
14:43pppaulobviously string completion
14:43slyrusor what hiredman says
14:43stuartsierracomplete is really just for legacy compatibility
14:44slyrusok, so I should be using the other 75 jars instead?
14:44stuartsierraNew projects under the "contrib" umbrella will have their own repositories and releases.
14:44cemerickI'd be surprised if further contrib umbrella artifacts were set up…?
14:44stuartsierrathe "legacy" contrib with 70-some modules will be phased out I hope
14:44cemerickslyrus: you probably only need a handful, suited to your project's actual dependencies.
14:45slyrusfair enough
14:45stuartsierraas a bonus, this makes your project's footprint smaller
14:46stuartsierrathe 70-module thing was my (failed) attempt to make it easier to contribute
14:46ninjuddstuartsierra: there is a subset of the larger java community that only uses ant and ivy without using the POM at all
14:46stuartsierraninjudd: they're still using Maven's group/artifact/version and repository layout
14:46hiredmansure it's only for legacy compat, but complete.jar is the worst jar name ever
14:46slyrusso if I'm following along at home and building my own clojure-contrib I just do some #!/bin/bash hackery to install each jar into my local maven repo?
14:46stuartsierrahiredman: yeah
14:47stuartsierraslyrus: no just run "mvn install" at the top level
14:47stuartsierrahiredman: I've got bigger problems
14:47ninjuddstuartsierra: yes, i don't plan to move away from using group/artifact/version, but what does "use the POM" mean other than that?
14:47ninjudddoes it mean, use the project lifecycle goal names that maven uses?
14:48slyrusIs there a -n (as in make -n) argument for mvn? as in "tell me what you're going to do, but don't actually do it"
14:48ninjudddoes it mean: support maven plugins?
14:48stuartsierrait will mean differet things to different people
14:48stuartsierraTo *me*, it means it is possible to build, test, and deploy the project using only Maven.
14:48stuartsierraeven if you also support other tools
14:50stuartsierraslyrus: yes
14:50tonylslyrus: there is a README file in the top level describing what you can do with mvn
14:50ninjuddstuartsierra: so build, test and deploy are the only goals you care about then?
14:50lrennstuartsierra: no they're not.
14:51lrennstuartsierra: see springsource.
14:51stuartsierrawhat about it?
14:51slyrustonyl: I prefer to do as little as possible with mvn :)
14:51cemerickninjudd: AFAIC, it means defining a single canonical clojure serialization of the POM, ideally whose structure and semantics has a passing resemblance to maven's.
14:51slyrusI see it as an unnecessary evil
14:52stuartsierracemerick: that would be nice
14:52cemerickninjudd: "test" and "deploy" are phases, not goals :-)
14:52ninjuddok, maven newbie question. can i change the default locations of src, test, target, etc?
14:52stuartsierrayes
14:52cemerickninjudd: of course
14:52ninjuddcemerick: phases. that's the word i was searching for
14:52lrennstuartsierra: https://ebr.springsource.com/repository/app/faq
14:52cemerickninjudd: see https://github.com/sonatype/polyglot-maven/tree/master/pmaven-clojure for the current pmaven clojure impl.
14:53stuartsierralrenn: ok, that's OSGi
14:53stuartsierraThe only other widely-used JAR repository format
14:53tonylslyrus I understand, to get my contrib 1.3.0 i just mvn install and rename the resulting jar
14:53ninjuddcemerick: so what about features that are only implemented by cake or lein? where do those go in the universal POM?
14:54stuartsierraas plugins
14:54slyruswhat's the difference between standalone and complete?
14:54stuartsierrastandalone = one big jar
14:54jfieldsif you don't care about the result, for example, you wanted to log a bunch of things, which is better (doall (map log-stuff coll)) or (doseq [i coll] (log-stuff i))
14:54stuartsierracomplete = lots of little jars
14:54ninjuddstuartsierra: what about features only implemented by maven? plugins too?
14:54cemerickninjudd: what stuartsierra said, or: it's perfectly fine if stuff that's above and beyond what the formal POM is included IMO. But it should come with big warning flags about it likely not working with other tools.
14:55dnolenjfields: doseq reflects the side-effect-y nature of the code better
14:55stuartsierrawhat cemerick said
14:55lrennstuartsierra: ?? OSGI is not a jar repository format.
14:55jfieldsdnolen, agreed. performance wise any pref?
14:55stuartsierrait's a way of packing up JARs for distribution tho
14:55cemericklrenn: what's this about OSGi?
14:56stuartsierraSpringSource has a "bundle repository"
14:56lrennstuartsierra: um, sort of. But that that has nothing to do with the format of their repository.
14:56dnolenjfields: doseq is strict, doall is realizing lazy computations. doseq is probably going to be faster for side-effect-y things.
14:56cemericklrenn: presumably similar in concept to p2, I suppose?
14:56jfieldsthanks.
14:56stuartsierraand the springsource repo still follows the maven/ivy layout
14:57jfieldswhy is there no (doseq f coll) -- (doseq [i coll] (f i)) feels so verbose.
14:57slyrusstuartsierra: so what's in complete.jar if not the contents of all of the little jars?
14:57stuartsierranothing
14:57stuartsierrait's just their as a dependency
14:57stuartsierrathere
14:58stuartsierralein/maven dependencies need "complete.jar" to be a real file to work
14:58slyrusoh, so we're lying to our build tools? cool.
14:58stuartsierrarub it in. I can take it
14:58cemerickslyrus: not lying -- just getting around there being no support for multiple POM inheritence :-P
14:59dnolenjfields: just a macro away :)
14:59jfieldsdnolen, indeed.
14:59jfieldsthanks.
15:00dnolenjfields: doseq supports list comprehension style things, something to consider.
15:01lrennstuartsierra: no, it actually doesn't. It may look that way to you, but the way organizations are handled is different.
15:03amalloyjfields: (dorun (map f coll))
15:04cemericklrenn: am I simply imagining the directions for how to use the spring bundle repo with maven, then?
15:05lrenncemerick: the urls are different, the "ivy" version starts with /ivy.
15:06cemericklrenn: so I guess they explicitly provide direct support for maven and ivy. Is that bad?
15:07lrenncemerick: no, it's not bad at all. As someone who uses ivy and spring at work, I am very grateful they do so :)
15:07cemerickCool.
15:08cemerickThen everything is unicorns and rainbows. :-)
15:08malkomalkoquick question.. I'm really loving clojure lately.. ya know, gettin' into the whole (lisp) thang... but alas, I feel like I'm turning into an ahole.. is that ok?
15:08cemerickmalkomalko: you mean you feel "Smug Lisp Weenie" syndrome coming on? ;-)
15:09lrennmalkomalko: "Just because we Lisp programmers are better than everyone else is no excuse for us to be arrogant." --Erann Gat
15:11hiredman~#19
15:11clojurebot19. A language that doesn't affect the way you think about programming, is not worth knowing.
15:17cemerickmalkomalko: Fight the urge. :-) Patience, empathy, and kindness are always called for, even if you've a sense of grandiosity.
15:18malkomalkoI wear a size 7 1/2 hat, I'm just worried my head's going to get a little too big
15:18malkomalkobut it's a lot of fun :)
15:19bobo_putting the log of this channel on a webpage is the best thing since sliced bread! so many times it solved my problems via google :-)
15:21arkhtrying to understand how memoize works (and underlying clojure by association) and the first question I have is: how is mem retained between calls? It looks like it falls out of lexical (let) scope.
15:23slyrusso all of my "dependencies" specify a particular version. How do I find out what the "current" version for something like swank-clojure is?
15:23stuartsierraslyrus: at the moment, search clojuars
15:23stuartsierra*clojars
15:24lrennspeaking of clojars, does anyone know if Alex (ato) is still maintaining it?
15:25slyrusstuartsierra: http://clojars.org/search?q=swank-clojure
15:26slyrusclojars searching is pretty lame it seems
15:26samxarkh, mem is in the lexical scope of the function 'memoize' returns. the returned function retains it's lexical scope as a lexical closure, so every time you call the returned function, it's accessing the same local variable.. it's not retained between differnt calls to 'memoize', only to the function returned by memoize
15:26abedraslyrus: that won't actually pull up swank-clojure
15:26stuartsierraslyrus: yeah
15:26abedraslyrus: you have to search for swank
15:26abedraand then find it
15:27stuartsierraclojars definitely needs work, it's been kind of in limbo for a while
15:27abedrayes
15:27stuartsierradliebke was experimenting with alternatives
15:27abedrathe search has gotten a little better, but exact matches still don't work
15:27slyrusmind you, I don't actually want to use clojars, just to know what the latest version is
15:27abedrastuartsierra: yeah, cljr works quite well :)
15:27abedraslyrus: yeah, that's what i use it for as well
15:28slyrusand I see swank-clojure doesn't have a pom.xml, so mvn install doesn't DTRT
15:29slyrusnot that I'm complaining about swank-clojure not supporting maven of course...
15:30ninjuddslyrus: 'lein install' should work, or 'lein pom && mvn install'
15:30ninjudds/lein/cake/
15:30sexpbot<ninjudd> slyrus: 'cake install' should work, or 'cake pom && mvn install'
15:30ninjudd(also)
15:30slyrusoh, thanks. that's certainly easier than export SWANKDIR=~/.emacs.d/site-lisp/swank-clojure
15:30slyrus mvn install:install-file -DgroupId=swank-clojure -DartifactId=swank-clojure \
15:30cemerickstuartsierra: nexus on the backend with a slick search UI tapping whatever APIs it provides would seem to be an obvious option?
15:30slyrus -Dversion=1.3.0-SNAPSHOT -Dpackaging=jar -Dfile=${SWANKDIR}/swank-clojure-1.3.0-SNAPSHOT.jar
15:30slyruswhoops
15:30slyrusninjudd: oh, the bait and switch!
15:30stuartsierracemerick: yeah, I like Nexus
15:31slyrusI thought "lein install" sounded nice :)
15:31cemerickWell, nexus *works*. :-) I don't like that UI toolkit.
15:31slyrusnow I see I need cake
15:31ninjuddslyrus: i figured you were more likely to have lein which is why i said that first
15:31slyrusindeed
15:31stuartsierracemerick: yeah, esp. the fact that the login form doesn't autocomplete
15:31ninjuddbut i wanted to make sure someone watching along at home knew that either would work ;)
15:33arkhsamx: thanks; your explanation helps me understand both memoize and closures better
15:33dnolenslyrus: cake/lein install is awesome
15:36slyrusyecch... clojure-1.3.0-alpha3 and clojure-1.2.0 on the classpath :(
15:42slyrusshouldn't clojure.jar be a dev-dependency of swank-clojure so it doesn't get pulled into projects that use swank-clojure?
15:46arkhin memoize, how does the sequence 'args' work as a key to the map referred to by 'mem'? Isn't the sequence '(:one 2) a different sequence every time its used?
15:49samxarkh, 'memoize' function isn't really using 'args' for anything.. it's just returning a function that has a formal parameter 'args'.. so 'args' won't be bound to a value, until you invoke a call to the function that was returned by 'memoize'
15:49hircusslyrus: but how can you have a Clojure project without depending on clojure.jar ?
15:50slyrushircus: dev-dependency
15:51hircusslyrus: sure. but what are you trying to achieve? a project.clj that has no dependencies and only a single dev-dependency?
15:51amalloyarkh: ##(= [:one 2] [:one 2])
15:51sexpbot⟹ true
15:51slyrusI'm trying to have my own projects which have swank-clojure as a dev-dependency not pull in the version of clojure that was used to build the swank-clojure jar
15:51hircusah
15:52slyruswhy would i want 1.2.0 and 1.3.0 on the classpath? seems like a recipe for disaster
15:52stuartsierraslyrus: you can declare an exclusion
15:52hircusso your project is built against clojure 1.3.0 alpha but swank pulls in 1.2.0 for its own use
15:52stuartsierranot ideal, maybe, but it works
15:52slyrushircus: yes
15:52amalloyarkh: maps use = and hashcode to index things, so equivalent sequences will be looked up correctly even if they're not identical objects: ##((juxt = identical?) [:one 2] [:one 2])
15:52sexpbot⟹ [true false]
15:53hircushave you tried a newer version of Swank -- they have 1.3.0 snapshots, I think
15:53slyrusstuartsierra: or I can change my local swank-clojure/project.clj to pull in clojure as a dev-dependency and everything seems fine
15:53slyrushircus: this is from the latest swank-clojure git HEAD
15:53hircushmm
15:53stuartsierrayeah, you'll have to take that up with swank-clojure's current maintainer
15:53slyrustechnomancy?
15:53clojurebottechnomancy is to blame for all failures
15:54slyrusyou the man, clojurebot
15:54arkhamalloy: that actually sounds fascinating - I need to look at the relevant source
15:55stuartsierraclojurebot: stuartsierra ?
15:55clojurebotstuartsierra is awesome
15:55slyrussurely there's an army of swank-clojure using minions here?
15:55stuartsierra:)
15:55stuartsierrait used to say "stuartsierra is volunteering"
15:55abedrastuartsierra: evidently you upgraded
15:56abedraclojurebot: abedra ?
15:56clojurebotHuh?
15:56abedralol
15:56abedraexactly
15:57stuartsierra:)
15:57slyrusso there's no magic syntax for lein's dependencies like "my-proejct-THE-NEWEST-AND-KEWLEST-VERSION-EVARRR"?
15:58slyruswhich makes me think that clojure.jar should be a dev-dependency for all of my projects
16:00technomancyslyrus: swank has clojure as a dependency so you can have standalone swank sessions outside a project
16:00stuartsierraYo, haters, check out "rebuild" branch at https://github.com/stuartsierra/clojure/tree/rebuild
16:00stuartsierrafix the tests for me
16:01technomancyslyrus: but if leiningen is preferring swank's version of clojure over the one you're specifying in project.clj that is a bug.
16:01technomancyI don't think that's what you mean though
16:02stuartsierratechnomancy: it happens when swank is a dev-dependency
16:02stuartsierrayou get one clojure in lib/dev and another in lib
16:02technomancyoh, ok; is this bad because it's messy or because it's causing actual breakage?
16:03stuartsierracauses breakage
16:03stuartsierraI work around it by using :exclusion[s org.clojure/clojure]
16:04arkhwhere's the clojure code that implements = ?
16:04amalloyarkh: not in clojure
16:04amalloyit's in java. src/jvm/clojure/lang/RT, i think
16:05slyrustechnomancy: what do you mean a "standalone" swank session? surely whatever environment is going to try to invoke functionality from swank-clojure.jar can be smart enough to find a clojure.jar somewhere?
16:05technomancyso... jars from lib/ definitely have precedence over lib/dev.
16:05arkhamalloy: thank you
16:05stuartsierraok
16:05amalloyarkh: and i think the relevant method is called equiv
16:05slyrustechnomancy: I'm not sure what you mean by precedence, but they're both on the classpath
16:05amalloy$source =
16:05sexpbot= is http://is.gd/gYMyK
16:05technomancyslyrus: the ~/.lein/bin/swank-clojure shell script starts a standalone swank session
16:05technomancyslyrus: the classpath operates on a first-entry-wins basis
16:06stuartsierraI ran into some bugs when both 1.2 and 1.3 were present
16:06amalloyarkh: apparently it's clojure.lang.Util.equiv(x, y)
16:06stuartsierrabut maybe that was caused by something else
16:06slyrustechnomancy: bin/swank-clojure sets up its own classpath!
16:07technomancyif they are easily reproducible then I would love to hear more, especially as there's a release soon.
16:07slyrusif it were pulling it from ~swank-clojure/project.clj your argument might hold water
16:08arkhamalloy: you rock
16:08lrenndoes maven not do evictions? (ie, if it finds clojure 1.2 and 1.3 it will use 1.3 but tell you it isn't going to use 1.2)
16:08technomancyslyrus: right; that's what "lein swank" is for
16:08technomancythe swank-clojure shell script is something totally different
16:08stuartsierralrenn: it does, but lein has 2 separate dependency lists
16:08amalloysexpbot: botsnack
16:08sexpbotamalloy: Thanks! Om nom nom!!
16:09slyrustechnomancy: you said " slyrus: the ~/.lein/bin/swank-clojure shell script starts a standalone swank session" and "swank has clojure as a dependency so you can have standalone swank sessions outside a project"
16:10technomancyanyway, if you can reproduce a problem that arises from having dev-deps on the classpath please file a bug report; I need to head off
16:10slyrusare you saying that swank-clojure's project.clj needs clojure as a dependency to make lein happy?
16:10slyrusdev-deps on the classpath aren't a problem!
16:10slyrustwo clojure jars on the classpath is the problem
16:11slyrusswank's clojure.jar should be a dev-dependency, if you ask me
16:11lrennstuartsierra: right. thanks.
16:12slyrusand it's fine (as far as I'm concerned) for lein to have clojure as a dependency, rather than a dev-dependency, which should make standalone swank sessions work fine
16:18tonyl&(source =)
16:18sexpbotjava.lang.Exception: Unable to resolve symbol: source in this context
16:18tonyl~#source =
16:18clojurebotIt's greek to me.
16:18tonylclojurebot: help
16:18clojurebothelp is http://clojure.org
16:18hiredman~source =
16:18tonyl$help
16:18sexpbotYou're going to need to tell me what you want help with.
16:18tonyl$help source
16:18sexpbottonyl: Link to the source code of a Clojure function or macro.
16:19tonyl$source =
16:19sexpbot= is http://is.gd/gYMyK
16:19hiredmanoh hell
16:20tonyl$help help
16:20sexpbottonyl: Get help with commands and stuff.
16:20tonyl$help list
16:20sexpbottonyl: Lists the available help topics in the DB.
16:20tonyl$list
16:20sexpbotI know about these topics:
16:31amalloytonyl: i don't think there's a list of all commands available directly from sexpbot, but there's one at https://github.com/Raynes/sexpbot/wiki/Commands
16:32tonylamalloy: thanks
16:33amalloysexpbot: remind me to add that
16:33amalloysexpbot: also remind me to add a $remind command :P
16:34tonylamalloy: is it possible to sed sexpbot responses?
16:35amalloytonyl: you mean, ask sexpbot to repeat the last thing he said, but sedded? not currently
16:35tonylsexpbot technomancy ?
16:35tonylsexpbot: technomancy ?
16:36amalloy$whatis technomancy
16:36sexpbottechnomancy does not exist in my database.
16:36tonylor change the reply to why?
16:36tonylwhy?
16:36clojurebothttp://clojure.org/rationale
16:36tonylthose kind of replies
16:37amalloyyou'd have to write a new plugin for it. and also convince Raynes and me that it's a good idea :P
16:37tonylalright :P
16:37amalloyclojurebot already jumps on a lot of messages; it's hard enough keeping the two of them from stepping on each other's toes
16:37tonylyeah
16:37tonyli likt the $command syntax though
16:38amalloy$whatis sexpbot
16:38sexpbotsexpbot does not exist in my database.
16:38amalloy$whatis sexpbot the bestest sexpbot ever
16:38sexpbotsexpbot does not exist in my database.
16:38tonyl$whatis clojure
16:38sexpbotclojure does not exist in my database.
16:38amalloyoh right
16:38amalloy$learn sexpbot the bestest sexpbot ever
16:38sexpbotMy memory is more powerful than M-x butterfly. I wont forget it.
16:38amalloy$whatis sexpbot
16:38sexpbotsexpbot = the bestest sexpbot ever
16:38tonylnice
16:54belun$learn belun not what, but who ? strong male
16:54sexpbotMy memory is more powerful than M-x butterfly. I wont forget it.
16:54belun$whatis belun
16:54sexpbotbelun = not what, but who ? strong male
16:57lrenndo sexbotp and clojurebot work just the same if you /msg them? :)
16:58tonyl$tryhaskell reverse "hello"
16:58sexpbot=> "olleh"
16:59amalloylrenn: yess
17:00amalloyoh, i get it. you were subtly telling them to stop spamming :P
17:00amalloyi missed the :) - a lot of people actually don't know and aren't willing to try it
17:01tonyl :P
17:02tonyl:P you are right
17:10bendlasHey, folks
17:10tonylhello
17:11bendlasIs there a resource for conj talks somewhere?
17:12lancepantzbendlas: dont think so yet
17:13bendlasSpecifically I'd be interested in rhickeys reasoning about making ^:static default
17:14dnolenbendlas: there quite a bit of chatter about that in the irc logs while you wait for the video
17:15bendlasI'll check that out, thx
17:15hiredman^:static is not default
17:15hiredmanI really wish people would stop saying that
17:16hiredmanI specifcly asked rich to clarify that at the conj
17:16hiredmannon-dynamic is not the same thing as :static
17:16dnolenbendlas: hiredman is correct, the changes were really about binding, the benefits of static fell out of the changes.
17:17bendlashiredman, in which way will those differ?
17:17bendlas_isn't_ static all about binding time?
17:18hiredmanno
17:18bendlasWhere, of course static enables compile time inlining, ...
17:19hiredman:static causes "hard references" to the class of a function to be inserted at compile time
17:19hiredmanno
17:19hiredman:static is not compile time inlining
17:19bendlasBut enables it
17:19hiredmanno
17:20dnolenbendlas: any perf benefits from ^:static were from hotspot optimizing your code at run time, ^:static also supported primitive arg/return
17:21bendlasOk
17:22dnolennow since dynamic binding is no longer the default, and the semantics of unbounds has changed, you get the benefits of static w/o doing anything at all, you can redef (:static didn't allow this), and you get primitive arg/return. primitive fns can now interop w/ protocol fns as well.
17:24bendlasWas just gonna ask that, thx
17:25dnolenbendlas: the biggest difference in the new world is that unbound vars no longer throw errors during compilation.
17:25bendlasSo you'll need :dynamic for (binding ...) ?
17:25dnolenbendlas: yes
17:26tonylis this in 1.3.0 alpha2 ?
17:27dnolentonyl: yes
17:27bendlasdnolen, sounds reasonable
17:28bendlasDoes that mean you can defn in arbitrary order like in a java class body?
17:29jarpiainthe compiler must resolve the vars on the first pass so you still have to (declare ...)
17:32tonylping?
17:32clojurebotPONG!
17:33tonyl$ping
17:33sexpbottonyl: Ping completed in 0 seconds.
17:33bendlasOk guys, thanks for the info. Blog material on the issue still seems a bit sparse
17:35amalloytonyl: any reason you need to ping both of them?
17:35amalloyand not, say, /msg one or both of them?
17:36jarpiain(declare x) (def y x) throws unbound var error in 1.2
17:36jarpiainbendlas: ^^
17:37tonylmy bad, out of habit
17:38dnolenbendlas: it is alpha stuff, and most people are still trying to understand 1.2.0 :)
17:44neotyk`how do you jump to end of expression with paredit?
17:45scottjC-M-n
17:49scottjand C-M-e depending on definition of expression
18:05amalloyanyone happen to know the maximum length of an irc message?
18:07mabes(set! *warn-on-reflection* true) issues warnings on compilation.. is there a way to have the warnings issued whenever Reflector.getMethods is used?
18:07mabesI've type hinted all the code that seems like a bottleneck but Reflector.getMethods is still taking ~20% of the process
18:09neotyk`scottj: thanks!
18:24powr-tocwhat's the purpose of Channels? I mean what do they offer over lazy-seqs?
18:25powr-tocIs it just that they're queues?
18:28amalloypowr-toc: channels in what context? like java.nio.Channels?
18:33powr-tocamalloy: as in aleph/lamina... I'm guessing they might be nio channels underneath https://github.com/ztellman/lamina
18:33powr-tocbut I think they're using a clojure.lang.BlockingQueue
18:34amalloypowr-toc: not that i know anything about lamina, but those are definitely not nio Channels
18:34powr-tocno they're not nio channels
18:34powr-tocthey're purely for in process communication
18:36amalloypowr-toc: did you read the wiki entry as the readme suggests?
18:36powr-tocyes...
18:37powr-tocI mean I see how they're different from seqs... in that seqs are pulled and they're pushed
18:37slyrusis there a new (clojure-1.3-ish) replacement for c.c.except?
18:38slyrusand it looks like all of the various clojure-contrib-1.3-ish changes mean that folks code/build-hackery that works on 1.3 isn't likely to work will under 1.2 anymore, right?
18:38powr-tocI'm just not sure what to use them for
18:39amalloypowr-toc: and they allow arbitrary amounts of forking - four channels which are all dumping into one master channel, which is again being sucked into two duplicate channels with different callbacks
18:40powr-tocamalloy: I saw that... I guess the thing I'm not clear on, is how multiple consumers can ever use these without interfering with each other
18:41powr-tocI guess I need to play with them...
18:41amalloypowr-toc: instead of having them all plugged into the same channel, you can fork the channel
18:41amalloythen they each get a private copy
18:43powr-tocamalloy: but fork consumes and removes all the messages from the channel
18:43powr-tocor am I reading that bit wrong
18:43amalloyyou are
18:44amalloysee also near the top "If two callbacks are registered on an empty channel, they both receive the next message."
18:45powr-tocamalloy: ahhh ok... I missed that bit... now it makes a bit more sense
18:47slyrusanyone have a good example of a clojure-1.3-ready lein project.clj?
18:50slyrusah, this is the syntax I was looking for: [org.clojure.contrib/def "1.3.0-SNAPSHOT"]
18:54slyrus:( is swank-clojure broken with the current slime?
18:59amalloyslyrus: i've heard technomancy say that slime breaks all by itself pretty often; there's some version or other he recommends you stick with, rather than living on the edge
19:00rata_hi all
19:01slyrusamalloy: and with that attitude it will never get fixed :)
19:01amalloyslyrus: feel free to join the emacs slime community :P
19:03insomniaSaltVersions differ: 2010-11-03 (slime) vs. 20100404 (swank). Continue? (y or n) y
19:03DeranderI'm using nil (slime)
19:03Deranderdon't know how I ended up w/ that
19:03slyrusinsomniaSalt: yeah, but it's been doing that for a long time. that's not the breakage I'm referring to.
19:04lancepantzslyrus: yes, swank clojure is broken with slime HEAD
19:04insomniaSalti remember trying to fix that :-)
19:04slyrus:( ok, thanks lancepantz
19:08slyrushmm... I wish slime had two histories. one for my CL REPLs and one for my clojure REPLs.
19:09slyrusM-p isn't very useful when it's giving me back CL forms in a repl connected to a swank-clojure instance
19:10amalloyslyrus: two emacs frames/screens?
19:10slyrusamalloy: sure, but when I start a new session it doesn't keep track of the two old ones
19:11slyrusand I'm not supposed to use *earmuffs* for non-dynamic vars anymore?
19:15slyrusperhaps it was premature to try to go to 1.3
19:16technomancyearmuffs have always been only for dynamic vars
19:22slyrustechnomancy: there's a difference (in my mind anyway) between a constant var that is globally accessible and a globally accessible var whose value can be changed by bind
19:28amalloypppaul: ping
19:28pppaul$8ball pong?
19:28sexpbotpppaul: Most likely.
19:28slyrusI guess I'm just used to CL's special variables
19:29pppaulno specials in clojure?
19:29amalloypppaul: just wondering whether you're finding the try/catch macro useful or inadequate
19:29slyruspppaul: you have to declare your vars as dynamic now if you want (bind [...] ...) to work
19:29pppauloh, i didn't get it to work... i tried macro-expanding and it would just give me the evaluated forms...
19:30pppauli went to sleep after you gave it to me, and i haven't done anything with clojure since then ^_^
19:30amalloypppaul: (macroexpand '(whatever)), not (macroexpand (whatever))
19:30pppaulooooooooooooh
19:30pppaulsilly me
19:31amalloy##(macroexpand '(when (pred x) x))
19:31sexpbot⟹ (if (pred x) (do x))
19:31pppauli think i broke clojure... can't find the defmacro symbol
19:34pppaulcool
19:34pppaullooks like it works ^_^
19:37amalloylet me know whether you find it convenient or annoying when you've played with it a bit
19:38pppaul(defn col-width [n table] (reduce max (map #(? (count (nth % n))
19:38pppaul :oops 0)
19:38pppaul table)))
19:38pppaulseems good for simple try-catches ^_^
19:39pppaulmaybe i should be using the maybe monaaaaaaaaaaaaaaaaaaad
19:39amalloythat doesn't really seem applicable to finding a max
19:40pppauli don't really know what to apply any monad to right now... the wikipedia entry isn't helping much since it's all in haskell
19:43rata_pppaul: http://intensivesystems.net/tutorials/monads_101.html
19:43pppaulreading that too
19:43rata_ok
19:43pppauli thought it would be better for me to start with wikipedia, though
19:45rata_i thought the same, but that article resulted to be much more useful for me
19:47pppaul^_^
19:47pppaul(doc map)
19:47clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."
19:48pppaulwoot, seems to work the way i want it to
19:48pppaulmap is so sexy
19:51slyrushrm... what am I supposed to make of this: NoSuchMethodError clojure.core$concat.invokeStatic(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; clojure.contrib.def/defalias (def.clj:66)
19:53amalloyslyrus: that's java's equivalent of a linkage error
19:53amalloythe code was compiled against one version of clojure, and is running against another
19:54slyrusah, but which code?
19:54amalloyclojure.contrib doesn't match clojure.core
19:54slyrusoh, I see... ok.
19:54slyrus:(
19:54amalloymake sure your deps are right in project.clj
19:54amalloyand lein deps. maybe that will help
19:56slyrusI think I built clojure-contrib improperly
20:01amalloyslyrus: why build it at all? just get the binary
20:01slyrusthat just seems _wrong_
20:04DeranderI have an atom @keep-running.
20:04DeranderI am trying to swap its value out from true to false
20:04Derander(swap! @keep-running false) says "java.lang.Boolean cannot be cast to clojure.lang.Atom"
20:04amalloyDerander: two errors there
20:04amalloy&(swap! (atom true) (constantly false))
20:04sexpbot⟹ false
20:04amalloy&(swap! @(atom true) (constantly false))
20:04sexpbotjava.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.Atom
20:04amalloy&(swap! @(atom true) false)
20:04sexpbotjava.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.Atom
20:05amalloyanyway, the first is what you want
20:05technomancythree if you count using swap! instead of reset!
20:05Deranderah, thank you
20:05amalloytechnomancy: yeah, i suppose so
20:05Derandertechnomancy: checking documentation
20:05Deranderamalloy: thanks for your examples :P
20:06Deranderokay, that is indeed what I want
20:06technomancyDerander: swap+constantly will work, but reset! is what you really mean.
20:06Deranderyeah
20:06DeranderI misunderstood how swap worked
20:06Deranderit's all good now
20:23pppaulhow do i do newlines with pr-str?
20:39tonylprn-str
20:42pppauldoesn't seem to be working
20:43pppaul&(prn-str ".....\n.....")
20:43sexpbot⟹ "\".....\\n.....\"\n"
20:43pppaul&(pr-str ".....\n.....")
20:43sexpbot⟹ "\".....\\n.....\""
20:43pppaul&(prn-str ".....\\n.....")
20:43sexpbot⟹ "\".....\\\\n.....\"\n"
20:45pppaul&(print ".....\\n.....")
20:45sexpbot⟹ .....\n.....nil
20:46pppaul&(print ".....\n.....")
20:46sexpbot⟹ ..... .....nil
20:46pppaulprint is more like what i want than prn-str.... but still not doing newlines
20:47tonylprn-str appends a newline char at the end. do you want it somewhere else?
20:48pppauli have newlines in my strings
20:48pppauli think sexpbot doesn't do newlines
20:49tonylso u want to get rid of them or actually display them in the repl like a new line?
20:49pppaulyeah, (print is working
20:49tonylok
20:50alexykevening
20:51alexykI have a gigantic lazy seq, like there's no tomorrow
20:51alexykI want to extract pieces from each element and dump into a text file, line per elem
20:51pppaul$8ball is there a tomorrow?
20:51sexpbotpppaul: Concentrate and ask again.
20:51alexykis write-lines meaningful for it?
20:51alexykor it will force lines?
20:52alexyklazy seq is produced from mongodb as (fetch :collection)
20:52tonylwhen u r using i/o i think there is no way than to force the seq
20:52pppaul(apply write-lines seq) ???
20:52tonylthat would probably cause an SOE
20:53tonylbut who knows
20:53alexykSon of Eve?
20:53pppaullol
20:53tonyllol stackoverflow error
20:53tonylyou can partition the seq and then map through it
20:54alexykyeah... what do we do when we can't us ewrite-lines, like some nasty file handle and a writer?
20:54alexyktbatchelli: I always play Bocelli when you join
20:55tbatchelli:D
20:56tbatchellialexyk: not a bad choice
20:56alexykbatchelli sounds like a batch version, as opposed to an interactive one
20:57tbatchellialexyk: I am glad you didn't parse it as bat-chelli... as in MS-DOS
20:58alexyktbatchelli: any luck with Twitter data?
20:58tbatchellialexyk, not yet, got distracted with other cool stuff :) re: #pallet
20:59alexyktbatchelli: bat-chelli are like multiple MS-DOS chello synthesizers, or miniature chelloes for bats :)
20:59livingstoni'm driving myself crazy trying to get mvn clojure:swank to run the JVM with more memory (e.g. the equivalent of setting -Xmx4G) ... the variables are documented on the clojure-maven-plugin site, but I can't figure out how to set them through maven. Do any of you do that?
21:00alexykpallet looks cool indeed, I'd like to get a cluster to test it
21:01alexyktbatchelli: I meant celli of course
21:01alexykform cello
21:01alexyklivingston: isn't a whole point of maven to drive one crazy?
21:02livingstonup until this point it has saved me a lot of trouble
21:02tbatchellialexyk: I like miniature chelloes for bats... make for a nice image in my brain :)
21:03tbatchellilivingston; part of the license you're accepting by running maven is that you sell your soul to the devil... and the devil eventually comes back to claim it. It's still the best alternative out there though.
21:03alexyktbatchelli: imagine a whole cave with all the bats playing celloes! now that's a great Xmas card
21:04alexyklivingston: "up to this point" means it's the point of no return :)
21:04livingstoni'm also assuming that (.maxMemory (Runtime/getRuntime)) will show me the value of the -Xmx argument
21:06alexyklivingston: seems to report correctly
21:08livingstonalexyk: yeah I keep seeing 129957888 instead of the 4G I ask for
21:09alexyklivingston: I switched to lein and cake... but you can ask on clojure-maven list
21:13livingstonalexyk: arghhh I just noticed pom was requesting clojure-maven plugin v1.3.2 the feature I wanted was added at 1.3.4 and 1.3.5 is current doh! (still have a problem, but it's a start)
21:13alexykaha
21:18alexykchouser: there's not a single write-lines in TJoC?!
21:19chousereh? write-lines?
21:20alexykchouser: yeah, from duck streams. Not a single usage!
21:20livingstonalexyk: yeah lein isn't really an option for me, we have too much java in house and it's the primary language, so I need something that plays more nice with java
21:20alexykI wanted to find IO wisdom!
21:21alexyklivingston: understood, I did the same in a joint Scala/Clojure project
21:22alexykchouser: I was spoiled by write-lines and can't find a simple way to just open a damn writer and write line by line. What is the clojure way to do that?
21:22lancepantzlivingston: does maven not honor $JAVA_OPTS ?
21:22alexykbesides calling a javaesque writer directly
21:22tonylwhat about with-open
21:22livingstonlancepantz: I really don't know
21:22lancepantzi would expect it to
21:23alexyktonyl: and then chain nasty buffered writers on top of writers?
21:23livingstonlancepantz: the thing is this is weird because it's a java called by the clojure-maven plug-in that starts the swank server
21:23chouseralexyk: I generally use Java methods directly
21:24alexykchouser: :(
21:24livingstonI don't necessarily want to globally set my java to 4G either
21:24chouseralexyk: maybe clojure.java.io/writer
21:24chouser...and then java methods. *shrug*
21:24livingstonthis worked: mvn -Dclojure.vmargs=-Xmx4G clojure:swank but this does not: mvn -Dclojure.vmargs="-d64 -Xmx4G" clojure:swank so I'm not sure how to set 2 options yet
21:24alexykyeah
21:28alexyklancepantz: I read the above as, "does maven has no honor anymore?!"
21:29lancepantzyes!
21:30lancepantzor no! depending on how you parse the negative
21:31alexyklancepantz: yeah. or no. :)
21:33hugodlivingston: https://github.com/hugoduncan/pallet/blob/master/pom.xml sets clojureOptions for clojure-maven-plugin
21:34livingstonhugod: thank you so much - I was using the wrong setting I guess, I was using clojure.vmargs
21:35livingstonit's unclear to me what the different settings are for
21:38livingstonhugod: that seemed to work although it was nice having the command line option
21:41hugodlivingston: https://github.com/talios/clojure-maven-plugin seems to suggest that there isn't one in "Configuring your clojure session"
21:44livingstonyeah, but what's the difference between "jvm args" and "additional jvm args" ?
21:50hugodlivingston: vmargs doesn't seem to appear anywhere in the clojure-maven-plugin source
21:51livingstonhugod: odd. it does respond when I gave it the single parameter to raise the heap size though... it's gotta be in there somewhere?
22:12ustamillshey all
22:12ustamillsAre there really 236 users in this room? Or did my chat client miscount?
22:13KirinDaveNope.
22:13amalloyustamills: most of them are idling, usually, like most irc channels :P
22:13ustamillsWe had maybe 9 Wednesday.
22:14amalloyin #clojure?
22:14ustamillsYeah
22:14amalloyno way
22:14ustamillsUnless there's another clojure chat room, yeah way.
22:14amalloythere are more than 9 people who never log out
22:14hiredman<--
22:14KirinDaveNetsplit.
22:14KirinDavePerhaps?
22:14amalloycould be
22:15ustamillsWhat's netsplit?
22:15amalloylarge-scale connection problems
22:15ustamillsi c
22:16ustamillsThis is good, then. Wed night was my first night on. This is a pleasant surprise.
22:16DeranderI never log out
22:17amalloyyeah. on occasion there can be no talking for an hour or two, but never are there so few people around
22:18ustamillsQuestion then. I don't get recur vs basic recursion just yet. Why do we need the recur function (or special form, or whatever it is) rather than just use straight recursion?
22:18amalloyustamills: you run out of stack space without recur
22:19ustamillsI haven't in other Lisps. What happens in clojure?
22:19amalloy&(let [f (fn x [] (x))] (f))
22:19sexpbotjava.lang.StackOverflowError
22:19ustamillsIt's a java thing?
22:19amalloy&(let [f (fn x [] (recur))] (f))
22:19sexpbotExecution Timed Out!
22:19amalloyno, any language will have it
22:19amalloyyou can easily overflow the stack; i did when i was learning CL
22:20livingstonustamills: the jvm does not support the standard things compilers do to implement tail recursion
22:20ustamillsI guess, just practically, I didn't see it in z-lisp. Maybe it was possible.
22:20ustamillslivingston: Thanks, I was wondering about the java part (not a java expert at all)
22:20dnolenustamills: recur and recursion from the tail position are equivalent. but recur also works with anonymous fns and loop.
22:21livingstonreal lisp compilers are smart and optimize tail recursion for you BUT they aren't required to like they are in say Scheme, in common-lisp it's just a bonus if you get it
22:22johndeoThe jvm is likely to support tail call optimization at some point, right?
22:22johndeoThat's what rich hickey says in his talks.
22:22amalloyand you can write code that's hard, or impossible for any compiler to optimize right
22:22dnolenjohndeo: less likely in the near future with Oracle driving.
22:22livingstonustamills: since there are some ways to support TCO (tail call optimization) without the JVMs help, Rich decided to implement them, but to be sure you don't think you are getting it when you aren't he decided to make you request it, and if it can't give it to you it will error
22:22johndeoThat Oracle stuff is CRAZY
22:23johndeobut typical
22:23Deranderof course oracle would start fucking with java right as I start to use it/clojure :P
22:23Deranderliterally within 1 week
22:23livingstonkeeping people from shooting themselves in the foot is ok sometimes, not sure how happy I am with this particular design decision though
22:23hiredman~oracle
22:23clojurebotThe sky is falling!
22:24ustamillsMaybe somebody could look at this. I'm trying to write my first recur function, an exponent function. Easy in recursion, but I don't get the recur version....
22:24johndeoI can't see any way they can pull the rug out on 50 bazillion companies using open source Java
22:24hiredmanthey aren't
22:24hiredmanthey never said they would
22:24hiredmanthey have infact said they won't
22:24ustamills(defn pwr [ x y ]
22:24ustamills (loop [myx x
22:24ustamills myy y]
22:24ustamills (if (>= y 1)
22:24ustamills (recur (* myx myx) (dec myy))
22:24ustamills myx)))
22:24hiredmanjohndeo: please don't spread that fud here
22:24ustamillsI know the (* myx myx) bit isn't what I mean. Not sure how to say what I mean though.
22:25johndeoOkay, I'll go get more informed.
22:25livingstonjohndeo: I don't know, it would be nice, if they implement it. the JVM is far ahead of Java so... you never know.
22:26amalloyustamills: you're close
22:27ustamillsI tried to execute (using Slime) and it just went away and never showed anything
22:27amalloyustamills: because you're testing y, not myy
22:27livingstonustamills: i'm not sure that's computing x^y but something more like factorial? or weirder
22:27ustamills,DOH
22:27clojurebotjava.lang.Exception: Unable to resolve symbol: DOH in this context
22:28amalloy&'DOH!
22:28sexpbot⟹ DOH!
22:28amalloybut you need to actually recur on three parameters. (1) the base, (2) the exponent left to work on, and (3) what the product so far is
22:29ustamills#3 is the part I'm missing.....
22:29amalloywell er
22:29livingstonyou can also recur to the main call too, remove the loop and recur directly to pwr itself
22:29amalloy(1) isn't necessary, since base is a constant
22:30amalloy&(loop [base 2, pow 5, acc 1] (if (zero? pow) acc, (recur base (dec pow) (* acc base))))
22:30sexpbot⟹ 32
22:31livingstontbatchelli: I just climbed into the depths of maven and reclaimed my soul, at least for today. we'll see when it gets me again (trying to simultaneously develop code in the repl from two projects will probably be another 10 round knock-out challenge)
22:31amalloyustamills: is how i would write it. look over it, try to make sense of it, and ask whatever questions you have left
22:31ustamillsWoot! Thanks!
22:31ustamills(defn pwr [ x y ]
22:31ustamills (loop [res x
22:31ustamills myy y]
22:31ustamills (if (> myy 1)
22:31ustamills (recur (* res x) (dec myy))
22:31ustamills res)))
22:32amalloyustamills: please don't make huge pastes here
22:32amalloyuse a paste site like https://gist.github.com/
22:32ustamillsWill do. Thanks.
22:33amalloyyep, that looks like a perfect exponent function
22:33tbatchellilivingston: are you sure you are the same person than a couple of hours ago? I think you need to be quarantined!
22:34amalloyustamills: to convert a singly-recursive function to a tail-recursive function, usually you need to add one more variable, which "accumulates" the value you're planning to return
22:34livingstontbatchelli: i do have this cough, ..
22:35ustamillsBecause we aren't really doing recursion, we're doing, basically, goto's.
22:35amalloyright
22:36amalloy(and not just basically gotos. actually gotos)
22:36ustamillsIf Java had tail call optimization, would Clojure still use recur?
22:37amalloythat's a philosophical question, i suspect
22:37dnolen,((fn [base exp] (reduce * 1 (take exp (repeat base)))) 2 0)
22:37clojurebot1
22:37dnolen,((fn [base exp] (reduce * 1 (take exp (repeat base)))) 2 16)
22:37clojurebot65536
22:38dnolenustamills: strong support for lazy sequences are another useful tool to work around the lack of TCO.
22:38livingstonustamills: it would become redundant, unless there were still some cases where it couldn't be had and people still wanted you to beg for it. -- I would hope that it would go away at that point though, certainly it shouldn't not give it, just because you didn't ask.
22:38ustamillsdnolen: Thanks for the post, I just realized my fn doesn't handle the 0 exponent
22:38_fogus_ustamills: I think yes
22:38livingstondnolen: lazy seqs are useful, but they are not directly related to TCO
22:39dnolenustamills: the current real painpoint for lack of TCO is mutally recursive functions, trampolines work but are kinda slow
22:39amalloydnolen: (= (repeat exp base) (take exp (repeat base)))
22:39ustamillsNot grokking the lazy sequences just yet ......
22:39dnolenlivingston: they are in the sense that rhickey forefronted them in the lang specifically because lack of TCO.
22:40KirinDaveHuh
22:40KirinDaveIt's disappointing to see someone as smart as nk say shit like: http://twitter.com/nk/status/3234929919918080
22:40amalloyustamills: they're incredibly powerful. if you ever find yourself actually writing recursion or loop/recur, often you should reevaluate and use the builtin lazy functions
22:41dnolenKirinDave: I saw that, I was thinking of snarky responses, but not worth it.
22:41_fogus_KirinDave: That is a lot of nothingness. I don't even understand his point.
22:41DeranderI'm lost too :P
22:41livingstondnolen: I don't see what one has to do with the other? one is a way to use things like map even though you know you aren't going to go all the way through the list; the other is a way to write simpler code without blowing the stack -- they are orthoganal
22:41amalloy&(nth (iterate #(* 2 %) 1) 6)
22:41sexpbot⟹ 64
22:42Derander"java runs on processors. clearly procedural programming is better."
22:42hiredmanmost of the state in the clojure compiler is bound vars (threadlocal)
22:42amalloylivingston: no
22:42dnolenlivingston: not true, lazy sequences are a general way to represent any kind of computation without blowing the stack.
22:42KirinDave_fogus_: I think he' arguing that "if immutability is so great, why don't you marry it?
22:42amalloylivingston: lazy seqs let you write simpler code without blowing the stack too
22:43hiredmanoffhand I can't think of any state in the compiler that isn't in vars
22:43_fogus_KirinDave: If purity is so great, then why even turn on the machine?
22:44hiredman103103
22:44hiredman~#103
22:44clojurebot103. Purely applicative languages are poorly applicable.
22:44livingstonyes, lazy seq happen to work like the recur implementation, but that doesn't mean they are isomorphic -- regardless it's not important to me at this time of night
22:45dnolenlivingston: you can think what you like, but rhickey has said as much. I defer to him ;)
22:45livingstoner, maybe in this case they can substitute for each other, but the use cases are or should be different
22:46KirinDaveWhat's even weirding is that clojure is all about controlling mutability
22:46KirinDaveNot immutability.
22:47KirinDaveThat's prolog, down the hall.
22:47livingstonI tend to write a lot of recursive code as if I was in Scheme, it's not necessarily good style, but the Franz Allegro compiler was so good I got kind of spoiled. having to flag it all the time is a real bummer now.
22:47ustamillsbegs the question.... Why use recur over lazy seqs, or the reverse?
22:48livingstonustamills: recur is for when you intend to go the whole way, and just want to save the stack frames, lazy seq is for being speculative that you might not go all the way down the rabbit hole and would like to save the work if you can
22:49livingston.. in general - from a readability and intent point of view.
22:50dnolenustamills: recur is 'strict' simpler semantics, lazy is just that lazy, there's all kinds of implication because of that. many a Clojurian has been burned by a lazy sequence.
22:51livingstononly if you are counting on side effects ;) (which is frequently unavoidable once you brush too close against java)
22:51amalloylivingston: still wrong
22:51livingstonactually it hits me a lot when I want to wrap time around something
22:52amalloyyou can build lazy sequences that blow the stack if you try
22:53dnolenlivingston: there's lots of scenarios where laziness will bite you even when you're writing purely functional code. i.e. debugging lazy code is generally a big PITA.
22:53livingstonanyone can blow anything up if they do it wrong, but I don't get it, here you all just spend I don't even know how long trying to tell me lazy = recur ...
22:56ustamillsGetting recur very slowly ... (and maybe the bot too)
22:56ustamills.((fn pwr [x y] (loop [r 1 i y] (if (>= i 1) (recur (* r x) (dec i)) r))) 2 3)
22:56amalloyustamills: comma or &, not period
22:56ustamills:) tx
22:57amalloy(& is the bot Raynes and i work on, , is hiredman's bot)
22:57ustamills,((fn pwr [x y] (loop [r 1 i y] (if (>= i 1) (recur (* r x) (dec i)) r))) 2 3)
22:57clojurebot8
22:57ustamills((fn pwr [x y] (loop [r 1 i y] (if (>= i 1) (recur (* r x) (dec i)) r))) 2 0)
22:57ustamillsooops
22:57ustamills, ((fn pwr [x y] (loop [r 1 i y] (if (>= i 1) (recur (* r x) (dec i)) r))) 2 0)
22:57clojurebot1
22:58ustamillstx everybody. Now I go read seqs.
23:06harishtelladoes anyone know of a good example/tutorial on understanding clojure java interop ( stuff like proxy and binding)
23:08amalloyharishtella: binding isn't really to do with java interop
23:09amalloybut labrepl has a good thing on proxy/swing interop
23:09amalloyhttps://github.com/relevance/labrepl
23:10harishtellaamolloy: got that, will look into it
23:10harishtellathanks
23:14harishtellaI wish http://clojuredocs.org/ was more prominently linked on clojure.org
23:19livingstonlater. thanks for the conversation / help everyone.