#clojure logs

2011-11-22

00:33boborygmy?
01:19callenis anyone aware what the preferred library or mechanism for event handling/callbacks in Clojure is?
01:20callenI've got a dumb loop in my code right now, and I really don't want to go through the pains required to make it non-retarded.
01:20callenI found spectator, but it seems specifically wrapped around maps, oddly enough.
01:20callenand it seems less like an event library and more of a signals thing for mutation.
01:23amalloylamina? or just functions?
01:24callenamalloy: taking a look at lamina. Tbqh, something like twisted would serve my needs really well.
01:25callenamalloy: basically I need to keep a socket connection alive, and start firing stuff off based on what I get.
01:25callenamalloy: I might make my parsing/processing asnychronous or secondary to the main event loop for performance, but in general, I need to keep the damn socket alive and make certain stuff goes.
01:26callenamalloy: twisted happens to be really good at what I described, and given that I don't know Clojure that well yet, I'm trying to force myself to do the project in clj.
01:26amalloyif you want *networked* event-listeners, see also aleph and the millions of message-queue impls like zeromq and rabbit. i don't know anything about any of those, but probably at least one of them is good
01:26callenamalloy: I was just going to say that I think Aleph is more appropriate.
01:26callenamalloy: rabbitmq and zeromq are totally inappropriate for my use-case, hahaha.
01:27callenamalloy: don't recommend either of those to people who don't necessarily know what they want, fyi.
01:52tolstoyThe thing I really love about leiningen is that if I have a question, I can just read the source and actually understand it.
01:52tolstoyI mean, the files are named after the tasks.
01:53tolstoyJust had to get that out there.
01:56diptanuctolstoy: SBT is lik a dragon.
01:57tolstoyxsbt....
01:58tolstoythe old SBT was a bit easier.
02:00tolstoyJust about every time I need to write a leiningen plugin, I write it, then look in the sample-project.clj file, and realize I didn't have to. But if I did, it's so easy.
02:01tolstoyscottj: Have you actually found which top-level dir to look in over at https://github.com/harrah/xsbt?
02:08callentolstoy: I wish more stuff was written like lein.
02:10tolstoycallen: I find a lot of clojure stuff much more understandable than I would have thought.
02:11tolstoycallen: For instance, the docs on congomongo are slim and reading the code is not the irritating chore I thought it would be.
02:11callentolstoy: I don't think it has much to do with Clojure actually, more that Clojure attracts smart people
02:11callentolstoy: and smart people write good code.
02:12callentolstoy: I could write some seriously incomprehensible Clojure if you liked.
02:12callentolstoy: I mean, do you really think it's anything other than technomancy_ that is why lein is so nicely organized?
02:12callentolstoy: you do him a disservice by attributing it to Clojure, as nice as clj is.
02:13tolstoyI'm sure his example inspires a lot of others.
02:15tolstoycallen: Kudos to technomancy, of course, but (as well) I do think that the whole ethos of clojure helps a lot.
02:15brehaut“In [OO], everything happens somewhere else.” — Adele Goldberg
02:16tolstoybrehaut: OO is like a rainbow when you're a kid. You keep running toward stuff, but....
02:17callenI hate following ravioli code.
02:33ivan`newbies like me might be interested to know there's now an Anki deck with the language API
04:29BahmanIs this code (make-writer index-file [:append true :encoding "UTF-8"]) correct to append to an output writer?
04:30raekwhat is make-writer?
04:31brehaut,(use 'clojure.java.io)
04:31clojurebotnil
04:31Bahmanraek: clojure.java.io/make-writer
04:31brehaut,(doc make-writer)
04:31clojurebot"([x opts]); Creates a BufferedWriter. See also IOFactory docs."
04:31Bahman([x opts])
04:31Bahman Creates a BufferedWriter. See also IOFactory docs.
04:32brehautraek: i think its used by other higher level c.j.io functions?
04:32raekif you want to open a writer to a file in append mode, use (io/writer index-file :append true :encoding "UTF-8")
04:32brehautfrinstance writer
04:32raekbrehaut: as brehaut said, make-writer is an implementation detail of writer
04:33raek(inc Bahman)
04:33lazybot⇒ 1
04:33raekfor being explicit about the encoding of the file
04:34Bahmanraek, brehaut: Thanks. That worked.
04:35BahmanHow can I figure if I should not use a function, such as in my case 'make-writer'?
04:36raekgood question... I guess it's hard to know in this case
04:36raekwriter has more docs than make-writer
04:36raekand make-writer is a protocol method
04:37raekthese can be hints that the function is more low-level
04:37Bahmanraek: How can you tell make-writer is a protocol method?
04:38raekI happened to know that :)
04:38BahmanOh, I see :-) Thank you.
04:39RaynesBahman: There is invisible text prefixed the name that says 'protocol method' that only experienced Clojurians can see.
04:40BahmanAlright Shao Lin masters...when I write my own language I'll put invisible text such as no one but myself can see :-D
04:40RaynesThat's cheating.
07:20kzar`Is there a function that I can use to take a sequence and return two sequences, one with every first item, one with every other one. So for example, something like this: (? [1 1 3 4 5 6]) -> [[1 3 5] [1 4 6]]
07:24clgvkzar`: ##(let [s [1 1 3 4 5 6]] [(take-nth 2 s) (take-nth 2 (rest s))])
07:24lazybot⇒ [(1 3 5) (1 4 6)]
07:25kzar`clgv: Oh shit, should have got that one. Thanks
07:25clgvkzar`: you'll remember next time I guess ;)
07:26licenserwhoa up to 353 kilo tokens a second with the clojure scanner :D
07:26clgvlicenser: what clojure scanner?
07:26licenserclgv: for the highlighter
07:26clgvwhich highlighter? ;)
07:27licensermine ;)
07:27clgvgithub-link? ;)
07:28licenserclgv: https://github.com/Licenser/clj-highlight
07:28hoeckparsing clojure is not that hard, its a lisp at all!
07:28kzar`Is there a quicker way to convert a character to integer than (Integer. (str \1)), I find myself doing that a lot
07:29kzar`(I've just defined a tiny function anyway, just wondered)
07:29clgv&(- (char \1) 49)
07:29lazybotjava.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number
07:29clgv&(- (int \1) 49)
07:29lazybot⇒ 0
07:29clgvok 48^^
07:29clgvdont know if thats quicker. It's directly from char to in at least.
07:29clgv*int
07:30kzar`clgv: or I guess ({\0 0 \1 1 \2 2...} \1)
07:31licenserhoeck: I don't talk about hard, I talk about fast
07:31kzar`clgv: Think your way's the best except it doesn't check the character represents a number
07:31clgvkzar`: thats an option as well. map lookup (potential hashfunction) vs char-conversion + subtraction
07:32hoecklicenser: sorry, no offense, I just meant its relatively simple to parse and therefore probably efficient as well
07:33licenserhoeck: well the approach is a general one, which makes it a magneitute slower since I can't just use (read …) :P
07:33hoecklicenser: I once wanted to write a incremental parser for sql, hoping that I could built a better autocompletion, and I initially though, 'how hard can that be, I once wrote a parser for lisp'
07:34licenserhoeck: I know the topic quite well, lisp is incredible simple
07:44clgvlicenser: customizable syntax highlighting would be great. "predicate => style" pairs :)
07:48erluko,(eval (read-string (pr-str '#(123))))
07:48clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
07:51licenserclgv: you can do that
07:51erlukoHaving a little trouble reading the printing of a quoted form. Quoting a #() function adds {:line 1} metadata to the body. The 1 is a java.lang.Integer. Reading turns it into a java.lang.Long, which causes a class-cast exception the compiler.
07:51licenserinstead of style I use a token kind then you can just define styles for the kind
07:51licenserthat way you can group multiple predicates towards one style
07:59licenserhoeck: for the record, the java scanner only get 54 kTokens/s
08:04clgverluko: clojure 1.3?
08:04erlukoyep
08:05clgverluko: integers are always long in 1.3 - for java interop you have to cast them explicitly to Integer when calling the java method
08:06erlukoAbsolutely. The change doesn't seem to have made it to clojure.lang.Compiler.analyzeSeq()
08:10erlukoclgv: /* in Compiler.java */ line = (Integer) RT.meta(form).valAt(RT.LINE_KEY);
08:11erluko,(map class [4 (int 4) 2.2 (float 2.2)])
08:11clojurebot(java.lang.Long java.lang.Long java.lang.Double java.lang.Float)
08:12erlukoclgv: Note the second term above. That makes it a little harder to work around the explicit cast in the compiler
08:17clgv,erluko: the behavior of your map form is expected for the int afaik it converts to int and back again when you put it into the vector
08:17clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid token: erluko:>
08:17clgvoops .
08:18clgv,(clojure-version)
08:18clojurebot"1.3.0"
08:18erlukoAh, of course. I needed to use (Integer.)
08:18clgv&(clojure-version)
08:18lazybot⇒ "1.3.0"
08:18clgvuff no 1.2 bot here anymore
08:19erlukoStill odd that the compiler insists that when it sees {:line X}, X must be a java.lang.Integer
08:19erluko-- in certain contexts
08:20erlukoclgv: I meant ^{:line X}
08:20clgvdo java.lang.Thread objects get garbage collected when the run method exits?
08:22BahmanIt's probably very naive but how can I use 'byte-array'? Every time I try to use it like (byte-array 3 [1 2 3]) exceptions are thrown at my face saying Long cannot be cast to Byte.
08:25clgvBahman: (byte-array 3 (map byte [1 2 3])) works. but it's not nice to have to do the conversion like that, indeed.
08:27Bahmanclgv: AFAIK on JVM, you can't count on the exact timing of GC. But yes, when the Thread exits if there are no more refs to it, it is marked for recycling on the next GC run.
08:27BahmanThanks clgv.
08:27clgvok. exact timing is not needed. I wasnt sure if threads might be treated special
08:28licenserI start to hate clojure-jack in :( for no good reason it starts or stop working with the oddest of errors :.(
08:30erlukolicenser: does it break after a change to project.clj?
08:30licensererluko: map, it told me now that it does not find lein
08:32erlukoCan it still be found in a shell? Does 'lein swank' work in the root of your project?
08:32licenserperfectly
08:32licenser
08:32clgvlicenser: I wouldnt wonder if bash didnt find lein here since it's that foggy here
08:32licenserclgv: I even called /bin/bash lein to make sure it works
08:32licenserbut I wonder why it would work 1s ago and then stops
08:33clgvrestart^^
08:33clgvonly emacs I mean ;)
08:33cemerickOT: is there any way in the github UI to just fast-forward commits from pull requests instead of creating separate merge commits?
08:33licenserclgv: did taht
08:38licenserinteresting, parsing huge files is faster in a lazy mode, small files are faster in a non lazy mode
08:51broquaintDon't think so, cemerick.
08:52cemerickbroquaint: that's what I thought. Bizarre. Do people not like clean commit histories? :-P
08:52erlukoclgv: I had a bad lein plugin do that to my setup once
08:53clgverluko: a lein plugin made your bash foggy? :D
08:54broquaintNot the github guys at least, cemerick ;)
08:54erlukoclgv: I think that was the gin. :D
08:54erlukolicenser: have you tried lein clean?
08:55licensererluko: it just started to work again , I have no clue why
08:55Bahmanlicenser: Have you appended the path to lein to PATH in .bash_profile?
08:55licenserBahman: lein is in my global path
08:56BahmanSome X programs only regard variables defined in .bash_profile not .bashrc
08:58clgvBahman: usually .bash_profile is loading .bashrc if it exists ;)
08:58erlukoclgv: re Integer issue. Turning on *print-dup* makes (eval (read-string (pr-str '#(123)))) work again
08:59erlukow/out dup: (fn* [] ^{:line 1} (123)) w/dup: (fn* [] ^#=(clojure.lang.PersistentArrayMap/create {:line #=(java.lang.Integer. "1")}) (123))
08:59erlukoThe magic is in (java.lang.Integer. "1")
09:00Bahmanclgv: I know...it's sourcing .bashrc as the first line but I have run into this weird problem before. It might be worth a try.
09:00clgvoh ok. I always used *printdup* when experimenting with read and writing clojure forms. so I didnt notice that.
09:23BorkdudeI am trying out Clojure from the console instead of emacs, to prepare some assignments for students.
09:24TimMccemerick: My main objective is to ensure that every commit leaves the tree in a buildable state where the same or fewer tests fail. I also like to commit features + tests + doc together.
09:24BorkdudeI was wondering, what is jline supposed to enhance? I see no difference
09:24TimMccemerick: Beyond that, I try to make commits as small in scope as possible, in order to make merges easier.
09:24cemerickTimMc: Of course, but if a changeset doesn't require a merge commit at all, why add one?
09:24TimMca merge commit?
09:25joegalloBorkdude: ability to hit up and get back the previous line is the primary thing that i noticed
09:25cemerickTimMc: Yeah, that was my original gripe re: github pull requests
09:25cemerickthe web UI produces a merge commit even if one isn't necessary
09:25Borkdudejoegallo: the normal clojure repl does that already
09:26fliebelAny idea how I can tell lein to check the maven repos? It just bombs out immediately.
09:27TimMccemerick: Huh, haven't seen that.
09:27cemerickI've never seen a pull request *not* produce a merge commit.
09:27joegalloBorkdude: not for me, it doesn't
09:27cemerickWhereas if I do the pull on the command line, I get a clean history.
09:27joegallohow are you running it?
09:28TimMccemerick: Ah, I see. I've never done collab using github.
09:28Borkdudejoegallo: I just downloaded the jar and hit "java -jar clojure-1.3.0.jar"
09:28joegalloand i as well
09:29joegallowhat terminal and shell are you using on what os? is it possible that you're benefitting from an external feature provided by something else?
09:30joegalloi'm using iterm2 on osx to ssh into a linux virtual machine
09:30Borkdudejoegallo: hmm, I now found out it works in Windows but not in OS X and jline makes a difference there
09:31Borkdudejoegallo: iTerm2 here also on OX
09:31BorkdudeOSX
09:31TimMccemerick: Aha! I misread your question that started this whole thread. >_<
09:32Borkdudeis there smth which enhances the repl with paren matching and nice colors?
09:32TimMcFor some reason I thought it was about rebasing groups of commits.
09:32cemericknah
09:32cemerickbut I do always rebase my work into one or two commits so as to eliminate extraneous chaff :-)
09:33Borkdudecemerick: I know how that works now ;)
09:33TimMcI think I was remembering an earlier comment of yours to that effect.
09:36hugodcemerick: you probably know this already, but you might find http://notes.envato.com/developers/rebasing-merge-commits-in-git/ interesting
09:41cemerickhugod: that's a great post about --rebase
09:56jweissi'm seeing some strange behavior here, is it possible for a lazy seq to "escape" a try/catch in which it's calculated? eg (let [x (try (calc-seq) (catch Exception e e))] (do-other x)) and do-other throws an exception from calc-seq?
09:56Chousukejweiss: yes.
09:56Chousukejweiss: lazy seqs generally do no calculation until you consume items from them
09:57meliponehow do you write wrapping macros like with-out-writer in duckstreams?
09:57jweissChousuke: wow really? but when it is calculated, shouldn't it still be done in the context of the try/catch?
09:57Chousukejweiss: no
09:57jweissChousuke: ok, i was hoping i'd missed something. so what's the proper way to do what i want?
09:57Chousukejweiss: if you consume a value from it outside a try block, you can't catch the exception if the generation throws one
09:58jweissjust force the whole seq with doall?
09:58Chousukeeither that, or wrap the code where the seq is used in a try block
09:59Chousukeor try to make it so that it doesn't throw exceptions
09:59Chousukeeg. you can catch the exception when the item is generated and just not return anything, thus ending the sequence
10:00Chousukeit might not be a good solution for your problem but it is an option :)
10:00jweissChousuke: ok thanks for the info, i had a hard time believing that was really what was happening, thx for confirming :)
10:01Chousukejweiss: lazy seqs are a bit unintuitive the first time you encounter it; and I guess dynamic scope in general.
10:01Chousukemelipone: that question is a bit vague. Have you looked at how with-out-stream is implemented?
10:02Chousukeer, out-writer
10:03Chousukeclojurebot: def with-out-writer
10:04Chousukehm :(
10:45chouserI'd like to use lein's checkouts dir to point to a couple non-lein projects (clojure itself and another with a pom.xml)
10:46chouserShould I give up now, or is it possible perhaps by adding stub project.clj's to those projects?
10:52cemerickchouser: that's all that's required AFAIK. The child projects' source, compile, and resources paths will be added to the parent's classpath for e.g. REPL interactions, compilation, etc.
10:54mdeboardIs anyone here doing high-volume crawling/scraping with Clojure?
10:57chousercemerick: perfect, thanks.
11:04fliebel_How long does it usually take from a hudson build to availability in maven central?
11:10cemerickfliebel_: can be a number of hours, depending on central's promotion schedule that day, and the phase of the moon
11:10cemerick:-P
11:10cemerickOuter bounds I've seen are 20 minutes - 24 hours.
11:11fliebel_cemerick: I can't see the moon, it's to foggy here.
11:12cemericktea leaves or chicken entrails will do in that case
11:12fliebel_oh, we have chickens... *looks up what entrails are*
11:13fliebel_uhm, that's not going to work either. Our chickens are enclosed by fethers. Let's have some tea instead.
11:15Borkdudecemerick: I decided to give ccw a spin
11:16fliebel_Borkdude: good pun :)
11:16Borkdudewhen I right-click a .clj file and select Run As Clojure Application (preload file) I do get a REPL but it doesn't do anything with my input
11:17Borkdudefliebel_ :)
11:17chousercemerick: works perfectly, thanks again.
11:18cemerickchouser: thank technomancy :-)
11:18cemerickBorkdude: you mean it's not loading the file you selected?
11:18clgvBorkdude: what is your file like?
11:18clgvBorkdude: CTRL+ALT+S on the file will definitely load its content in the repl
11:19Borkdudefile is like this: https://gist.github.com/1386029
11:19cemerickFWIW, I greatly prefer to start a "project-level" REPL with nothing preloaded, and then I load files in as I like.
11:19Borkdudeclgv: is S the super key or the capitalized letter s?
11:19clgvs
11:19Borkdudecemerick: I find that acceptable, but such a repl still doesn't do anything
11:20clgvBorkdude: well you will have to call the hello function to see something happening in your repl
11:20cemerickBorkdude: what do you mean by "doesn't do anything" — is helloworld/hello not defined when the REPL comes up?
11:20Borkdudecemerick: clgv I can just type whatever I want in the repl
11:20Borkdudebut no evaluation what so ever
11:21BorkdudeI upgraded btw
11:21clgvBorkdude: then your nrepl server probably died
11:21Borkdudenot a fresh install
11:21Borkdudebut that should work right?
11:21cemerickBorkdude: you hit return and it just adds a linebreak, you mean?
11:21Borkdudecemerick: yes
11:21cemerickCtrl+Enter evaluates the REPL input :-)
11:22clgvkill that repl view and stop everything on the console view and refresh the project
11:22Borkdudeah wtf ;)
11:22cemerick(maybe Cmd+Enter on Mac by default, I've long forgotten what the defaults are)
11:22Borkdudethat's it
11:22clgvyeah Enter only evaluates if you are at the end of the input
11:22Borkdudethey should have put sound to that getting started video ;)
11:22cemerickclgv: not even that on the latest builds
11:23clgvcemerick: there is a recent update?
11:23Borkdudeclgv: what do you mean, end of input? you can always type one extra character?
11:23cemerickyeah, 0.5.0
11:23clgvuuuuh
11:23cemerickclgv: handling enter like that was interfering with accepting completion suggestions, etc.
11:23Borkdudecemerick: does it do autocomplete or suggest what parameters my hello functions wants?
11:23clgvcemerick: yeah that sucked sometimes
11:24Borkdudefunction
11:24cemerickBorkdude: Yes, completion is available in the REPL, and parameters and documentation is given in the completion popup.
11:24Borkdudecemerick: Cmd+Enter on OS X
11:25Borkdudecemerick: where should I see this popup
11:25Borkdudeand when
11:25cemerickIf you type (helloworld/ …and then request completion (probably Ctrl+Space by default) you'll get suggestions (or an immediate completion if there's only one match)
11:26clgvah a block comemnt is in as well? great
11:26cemerickdocs and parameters are not (yet) offered if the function position symbol is already in place
11:26cemerickBorkdude: The getting started video is quite out of date AFAIK.
11:27Borkdudecemerick: what is a good resource to get started then
11:27clgvI would love if CCW would also provide autocompletion without an active repl
11:27Borkdudecemerick: ah ctrl+space works, I am so used to tab ;)
11:28cemerickBorkdude: you can rebind all of the defaults to your preferred shortcuts in the preferences FYI
11:28Borkdudecemerick: yes, ctrl+space is fine, it's just that I'm so used to emacs ;
11:28Borkdude)
11:29cemerickclgv: There has to be a running environment of some kind to provide any kind of autocompletion. We're hoping to automatically take care of one in the background so you don't have to start a REPL yourself though.
11:29Borkdudecemerick: is there some documentation for people to get started?
11:29clgvcemerick: yes, thats what I thought how it can be done^^
11:29Borkdudecemerick: no outdated stuff
11:30Borkdudecemerick: or are these things all I need to know? ;)
11:30clgvcemerick: I would also love a short "get potential CCW developers started" guide for CCW. exploring the source on your own was kinda futile for me.
11:33cemerickBorkdude: Actually, that screencast is more up to date than I thought. There's http://code.google.com/p/counterclockwise/wiki/Documentation which is in decent shape, and if you choose Help > Help Contents, you should see a Counterclockwise group in the sidebar.
11:33Borkdudecemerick: another question (just firing away as usual..) how do I do eval-last-sexp kind of things in cCW?
11:33cemerickBeyond that, ping me or the ML, which is well-trafficked.
11:34cemerickBorkdude: Ctrl+up / Ctrl+down
11:34Borkdudecemerick: say I want to re-evaluate the hello function
11:34cemerickor maybe Alt+up / down, I forget the defaults
11:35Borkdudealt-up is transpose-line so to see
11:35duck1123I believe it's Control up
11:35duck1123but it has a conflict on OSX
11:35Borkdudectrl-up just moves the cursor to the sexp above
11:35Borkdudecmd-up I mean
11:35duck1123That's what I was told anyway when I had the same question
11:35Borkdudectrl-up brings up mission control
11:36clgvthe java ThreadPoolExecutor with a bounded queue throws an RejectedExecutionException - can I try to convince it to just freeze the submitter until there is space in the queue again?
11:36cemerickmission control?
11:36Borkdudecemerick: an overview of all open applications
11:36Borkdudecemerick: in the current space
11:36cemerickah, right
11:37duck1123I think you have to either disable that, or find out if you can rebind it
11:37cemerickBorkdude: There's a long-standing issue on OS X where some default keybindings conflict with OS X system stuff. The workaround is to either disable spaces, or rebind the expression history keybindings to something else.
11:37cemericke.g. Preferences > Keys — filter by "REPL"
11:38tcjI've got a really basic compojure question: How do I pass multiple values to a hiccup function that renders HTML? I'm using compojure. My handler function needs to pass a sequence of maps and a number. Right now, I have the handler passing the sequence of maps to the hiccup function, but I'm not sure the best way to pass multiple values. I'm thinking of using juxt to solve this. I'm not sure...
11:39tcj...if this is even an asnwerable question...
11:39Borkdudecemerick: I think I found it in the documentation: cmd-shift-x
11:39cemerickBorkdude: oh, you wanted to evaluate the current top-level expression in an editor!
11:40Borkdudecemerick: yes
11:40duck1123tcj: if you want to render multiple hiccup elements, wrap them in a (list )
11:40cemerickI interpreted "eval-last-sexp" as command history recall in the REPL :-)
11:40Borkdudecemerick: actually the last sexp, so like (do (first-thing)| (second-thing)) -> eval-last-sexp should evaluate (first-thing)
11:42cemerickBorkdude: No corollary for that in ccw. Cmd-Shift-X will evaluate the current top-level or the selected region.
11:42Borkdudecemerick: that's good enough for my students ;)
11:58clgvhow do I convince clojure/java that it can determine the right constructor. those are up for selection:
11:58clgv[ 1] <init> (int,int,long,TimeUnit,BlockingQueue,RejectedExecutionHandler)
11:58clgv[ 2] <init> (int,int,long,TimeUnit,BlockingQueue,ThreadFactory)
11:58clgvtype hint ^RejectedExecutionHandler seems not to work
11:59clgvwithout the last handler it knows exactly what constructor to choose
12:02clgvhumm using the setter afterwards is a workaround - but it is really strange that typehinting does not work
12:09jcromartieKorma: I WANT TO BELIEVE
12:09kzar`Can you convert an exception to a string?
12:09jcromartie(try (/ 1 0) (catch Exception e (str e)))
12:09jcromartie&(try (/ 1 0) (catch Exception e (str e)))
12:09lazybotjava.lang.SecurityException: You tripped the alarm! catch is bad!
12:09jcromartieoh yeah
12:09jcromartie...
12:10TimMc=> "java.lang.ArithmeticException: Divide by zero"
12:15kzar`jcromartie: Cool OK, that easy eh?
12:15kzar`assumed it was harder!
12:16jcromartiestr just calls .toString on most objects
12:16jcromartie&(map str [1 2 3 '(4 5) {:x :y}])
12:16lazybot⇒ ("1" "2" "3" "(4 5)" "{:x :y}")
12:16jcromartie&(map str [(Object.) (Exception. "hi")])
12:16lazybot⇒ ("java.lang.Object@95bf88" "java.lang.Exception: hi")
12:37Borkdudecemerick: does it make sense that I don't get suggestions for (String/ <ctrl-space> ?
12:57hiredmanthe implementation of drop-last is too cute by half
13:01TimMchiredman: Oh man, that's... kind of absurd.
13:02TimMc(That's https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L2526 for those of you following along at home.)
13:04ejacksonTimMc: hiredman: sneaky, sneaky.
13:04TimMcSo, what is that illustrating... commutativity of addition?
13:04TimMcassociativity?
13:05ejacksonneither, I don't think.
13:07TimMcTaking (first) of a drop-last should then realize roughly the first n elements, yeah?
13:09TimMc&(take 5 (drop-last 20 (range)))
13:09lazybot⇒ (0 1 2 3 4)
13:09TimMcVery cute.
14:18TimMccemerick: Are you saying that you'd prefer the diagram on the right in http://nvie.com/img/2010/01/merge-without-ff.png or am I completely misunderstanding you?
14:19amalloyTimMc: for those of us who aren't caught up on the backlog, what did cemerick say (or, a link to where he said it)?
14:24TimMc&(range)
14:25lazybotjava.lang.OutOfMemoryError: Java heap space
14:25TimMcamalloy: just a sec
14:25TimMc,(range)
14:25clojurebot(0 1 2 3 4 ...)
14:25cemerickTimMc: generally, yeah. There are circumstances where I prefer to retain the separate "feature" history, but they're rare.
14:26TimMcamalloy: GitHub pull requests apparenly create an empty merge commit, which cemerick doesn't like.
14:26technomancybut forcing it for single-commit branches is silly
14:26amalloyTimMc: accepting a pull request from the github web ui creates a merge commit, anyway
14:27TimMcamalloy: right
14:27cemericktechnomancy: roughly my point
14:27TimMcFeature request time! :-D
14:27cemerickan extra button wouldn't hurt
14:27amalloyi wonder, what is everyone's opinion about rebasing pull requests?
14:27TimMc"Please to be adding a ticky-box."
14:27cemerickbitching on twitter is my feedback line
14:28hiredmanrebasing :(
14:28amalloylike, i get pull requests based on some snapshot of master from a month ago
14:28TimMcA rebase once set my grandmother on fire.
14:28TimMcor so I hear
14:28amalloyand i don't want a stupid merge there, so i often rebase them. but then the submitter's commits aren't actually in my tree, just another version of their commits. so they have to junk em and fetch master again
14:29amalloyideally submitters would rebase it themselves, but in practice not everyone knows how
14:29hiredmanjoegallo has opinions on rebasing
14:29joegallorebase ALL THE THINGS!
14:29cemerickI like having only one commit to represent _all history_
14:30RaynesI wish I cared about the state of my git repos as much as you people.
14:30RaynesI bascially just execute different git commands until things look okay.
14:30TimMcI demand that my repo history look like a geodesic.
14:30TimMconly triangles
14:31TimMcRaynes: Those two are not mutually exclusive. :-(
14:32technomancy,(= #"" #"")
14:32clojurebotfalse
14:32amalloyhaha awesome
14:32joegallomy typically work flow ends up being something like: branch from master, make a bunch of commits (rebasing onto master as i go), and when i'm finally finished i reset (soft!) back to master and then commit individual bits and pieces of the final giant delta with nice little commits
14:32TimMctechnomancy: Perhaps because Pattern can represent non-regular languages? :-)
14:33drewrjoegallo: why the soft reset? why not just fix them as you rebase?
14:33technomancyamalloy: yeah, I rebase pull requests all the time; I try to get contributors to use topic branches
14:34amalloydrewr: at the end he can craft a patch series with full knowledge of the diff and group things "logically" instead of temporally
14:34amalloynot really my style, but i like that git lets him do that without bothering me
14:34hiredman"patch series" what is this mercurial?
14:35joegallodrewr: i dunno, sometimes it just seems easier to redo the commits from nothing but a ball of unchecked in changes -- particularly if i have something is one commit already and i want it to become two or three
14:35drewramalloy: yeah, I just do that with interactive rebasing as I go
14:36drewrjoegallo: I like to retain some semblance of the thought-progression
14:36joegalloi find that interactive rebasing is great for reordering and squashing, but bad for splitting (but that's probably just my own ignorance, and in fact the tool is amazing for that, also)
14:36TimMcjoegallo: But then you lose all the archaeological value of your commit history!
14:36drewrTimMc++
14:36joegallojust the crap
14:36technomancyTimMc: but you get to appear smarter than you really were!
14:36joegalloi lose the crap
14:37TimMcjoegallo: and more importantly, that makes it easy to have broken-build commits on master.
14:37joegalloyes, you have to be really careful to avoid those
14:37pjstadigyou guys are all insane
14:37joegalloif those are even something you try to avoid
14:37drewrjoegallo: you're too busy shining your perfect little merge commits
14:37joegalloeach one is a precious pearl, drewr
14:37joegalloa unique beatiful snowflake, with it's very own sha1
14:37joegallough, its
14:38amalloyjoegallo: rebase -i actually is pretty good for splitting too, though i don't often do that
14:38joegalloyeah, i love the -i, how do you make it do splits nicely?
14:38joegallos/pick/edit/?
14:38amalloyif you mark a commit as "edit", you can perform multiple commits before --continue
14:39joegallobut doesn't it drop you into a clean working directory?
14:39joegallodo you reset the commit off HEAD to split it?
14:39amalloyjoegallo: eh. git reset HEAD^
14:39joegallobingo, okay.
14:39amalloyor HEAD, or whatever. one of those
14:40joegallookay, that's perfectly logical. i sortof imagined you could make that work, but never bothered to try it.
14:40joegallothanks!
14:42triyoIs there a way to specify in leiningen libraries (jars) to be included that are not in any repo?
14:42TimMctriyo: You can install them in your local Maven repo.
14:43TimMcThere's some "install" command.
14:43TimMcfor mvn, not lein, I think
14:44amalloytriyo: yes, but technomancy wishes you wouldn't do that
14:44TimMcRaynes: Merge conflicts are where I start flailing wildly until things work.
14:45triyoamalloy: ok so whats the way to approach this when you get 3rd party jars you have no control over?
14:45triyoThey not in any maven repo, etc.
14:46joegallowhich particular library?
14:47drewrjoegallo: by rebase above I was talking about rebase -i (I do with magit which is much nicer)
14:47technomancytriyo: report a bug with the library; it's a pretty serious failing on their part
14:47joegalloi really should learn to use that well, drewr
14:47technomancywhile you're waiting for the bug to be fixed you can use the lein-localrepo plugin or set up your own private archiva/nexus server
14:48triyotechnomancy: I see what you mean
14:49TimMcOf course, at work I use git-svn, so it all gets linearized anyway -- and I can't even do branches safely.
14:50amalloyTimMc: you can merge with svn. if you've ever merged with cvs, svn feels like a breath of fresh air
14:50amalloygit is a thousand times easier, of course
14:51TimMcamalloy: git-svn is a special case -- you're restricted in what features you can use from either system.
14:51TimMcAnd I would contend that git is more awesome, but more complicated.
14:51amalloydoing simple things with git is certainly more complicated than doing them with svn
14:52TimMcright
14:53joegallos/complicated/awesome/ :)
14:53R4p70rGit just has better command line tools. I love how you get a pager for default and how much options you have. SVN has some nice UI though.
14:54R4p70r*how many options
14:54amalloyR4p70r: the command line is a UI. unclear what you mean
14:54R4p70rGUI sorry
14:55RaynesWe should all use bzr.
14:55R4p70rI've tried some git GUIs but I just don't get them. Would be nice to have something like "rebase --interactive" where you could drag commits to reorder them or something.
14:56amalloyR4p70r: so, you want a text editor that lets you use a mouse? those are pretty common
14:56amalloyand rebase --interactive does exactly that; i'm not sure whether you realized that or were wishing for it
15:01R4p70rA text editor isn’t the kind of graphical UI I’m hoping for. It’s been a while since I looked at what was available. Maybe there are more interesting options now.
15:01TimMc"git topiary"
15:03davidd_we have an svn project at work and my coworker asked me how to rebase in svn
15:03davidd_lol
15:05R4p70rTimMc, What is that?
15:06TimMcR4p70r: It's a term I just came up with to describe obsessive git history sculpting.
15:11R4p70rTimMc, Well Guilty as charged
15:13gfredericksTimMc: I spend way more time sculpting my git history than I do taking advantage of my sculpted git history
15:14gfredericks$findfn nil ()
15:14lazybot[clojure.core/distinct clojure.core/lazy-cat clojure.core/sequence clojure.core/vec clojure.core/concat clojure.core/seque clojure.core/drop-last clojure.core/reverse clojure.core/cycle clojure.core/rest clojure.core/lazy-seq clojure.core/flatten clojure.core/sort]
15:16mebaran151what's the most recent guide for setting up emacs 24 on windows with slime; something broke my current setup and I've decided to redo it from scratch
15:27raekmebaran151: https://github.com/technomancy/clojure-mode and https://github.com/technomancy/swank-clojure
15:27raekmebaran151: clojure-mode is the only thing you need to install in emacs if you use the "jack in" approach
15:45jcromartiewhat's the idiomatic way to handle resources (like input/output streams)
15:45jcromartiea la C#'s using
15:46raekwith-open
15:46raekthe same as calling .close in a finally block
15:46jcromartieright, thanks
15:47duck1123take a look at clojure.java.io for some other helpers if you're using io streams
15:48jcromartieyeah, I'm using those
15:49jcromartieWOAH File/pathSeparator is not to be trusted!
15:50jcromartiejeez, how wrong can Java be?
15:50jcromartieit uses a colon on Mac OS X
15:50jcromartieold school
15:51TimMcWhat is it supposed to be on Mac?
15:51jcromartiea slash
15:51darrintIs 4clojure.com working for anyone else right now? All my solutions are answered with "clojure.lang.PersistentList cannot be cast to clojure.lang.IFn"
15:52raekjcromartie: what do you get if you use (clojure.java.io/file "foo" "bar")? "foo/bar"?
15:52duck1123jcromartie: The system-dependent path-separator character. This field is initialized to contain the first character of the value of the system property path.separator. This character is used to separate filenames in a sequence of files given as a path list. On UNIX systems, this character is ':'; on Microsoft Windows systems it is ';'
15:52TimMcjcromartie: No, this is for separating paths, not path components.
15:52amalloydarrint: should be fixed now
15:52amalloywe're having a bumpy deploy cycle :P
15:52raekah.
15:52TimMc,File/separatorChar
15:52clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: File, compiling:(NO_SOURCE_PATH:0)>
15:52TimMc,java.io.File/separatorChar
15:52clojurebot\/
15:52TimMc,java.io.File/pathSeparatorChar
15:52clojurebot\:
15:53jcromartieohderp
15:53jcromartiethanks for the smackdown
15:53TimMcheh
15:53jcromartieI thought it was stuck in OS 9 days
15:54raekjcromartie: the Java default encoding on OS X is still Mac Roman, though :( (and OS X acually uses UTF-8)
15:54jcromartieyes
15:56mebaran151I think those are installed, but run-lisp doesn't work
15:56raekrun-lisp?
15:58darrintstupid browser
15:58mebaran151run-lisp in the clojure mode guidelines says it will start a quick repl
15:58darrintamalloy: Thanks. Thought I had lost my mind.
15:58mebaran151failed for me :(
15:59mebaran151also slime-connect throws an error about an unbound slime-clj
15:59raekmebaran151: uninstall the slime-clj package. it's another implementation of slime that causes conflicts
16:00raekslime-clj + swank-clj are alternative implementations of the more common slime and swank-clojure
16:01raek(they have also been renamed, but they are still available under their old names)
16:03mebaran151thanks raek, now everything works; I had to delete slime-fuzzy and slime-clj
16:03mebaran151I still have slime and slime-repl installed; is that optimal?
16:04raekyou don't need to have those installed if you use clojure-jack-in
16:04mebaran151oh I sometimes use slime-connect
16:05raeksince clojure-jack-in loads a slime.el file (that has a suitable version) from swank
16:05raekif it doesn't cause problems, then keep it :)
16:05raekslime-connect is useful too
16:13mebaran151clojure-jack-in fails on Windows still
16:14wiseenif I have (defmacro foo[bar] '(let [x ~bar] ...)) why does the macro result expand x to namespace variable, eg. (foo apple) => (let [foobar/x apple] ...)
16:14wiseenassuming I call foo from a different namespace
16:14mebaran151how do I get the autodoc back working in emacs with the new clojure mode?
16:14raekwiseen: you should use x# in the let
16:15hiredmanwiseen: you are using ` not '
16:15wiseenhiredman, yeah `
16:15hiredmanwiseen: but you should be using `, so that is ok, just the example code you pasted does not match what you really have
16:15Bronsawiseen: ~'x
16:16raekBronsa: that will result in symbol capture
16:16hiredmanin the future being precise about this kind of thing when asking for help will serve you well
16:16mebaran151strike that; just had to start slime :)
16:16Bronsaraek: right
16:16wiseenraek, is # some magic ?
16:17wiseenlike ` is for (quote)
16:17raekwiseen: in most cases you want the symbols that are emittet by your macros to either be qualified with a namespace or be autogensymed
16:17brehaut' is for (quote …) ` is quasiquote
16:17raekwiseen: yes, the # suffix is special syntax-quote syntax
16:18raekall occurances of the same x# in the syntax-quoted expression will become a symbol starting with "x" but with a unique suffix
16:18raek,`(x# x#)
16:18clojurebot(x__27__auto__ x__27__auto__)
16:18brehaut,(read-string "['(quoted a b c) `(quasiquoted a b c)]") ; wiseen ` and ' are different
16:18clojurebot[(quote (quoted a b c)) (clojure.core/seq (clojure.core/concat (clojure.core/list (quote sandbox/quasiquoted)) (clojure.core/list (quote sandbox/a)) (clojure.core/list (quote sandbox/b)) (clojure.core/list (quote sandbox/c))))]
16:19hiredmanbrehaut: syntax quote
16:19Raynes&`((gemsym) (gemsym))
16:19lazybot⇒ ((clojure.core/gemsym) (clojure.core/gemsym))
16:19RaynesDuh.
16:19brehauthiredman: crap. thanks
16:19wiseenbrehaut, oh I see, tnx
16:20raekwiseen: if you take a piece of code from the macro caller and wrap that in a (let [x ...] ...), you can accidentally capture the x symbol (and break the user code, if it happens to use that symbol name)
16:20jcromartiehm
16:20jcromartieI can't get DigestOutputStream to work here
16:20brehauti dont know why ive been calling syntax-quote quasiquite. is that some older lispism?
16:20jcromartieusing clojure.java.io's copy
16:21jcromartiethe copy works fine
16:21raekwiseen: so clojure makes it simple to get unique names that won't conflict with the user code
16:21amalloybrehaut: yes
16:22amalloyi think we call it syntax-quote because it does the namespace prefixing, which traditional quasiquiting doesn't do
16:22jcromartiebut the digest is of null data
16:22jcromartiei.e. openssl sha1 /dev/null
16:22brehautamalloy: thanks
16:22mebaran151how do I get the locals debugger back working in Slime by the way?
16:25jcromartiecan someone look at this real quick? https://gist.github.com/dda2e42a45226972aee5
16:25jcromartieusing clojure.java.io
16:25mebaran151now just to get color-theme working and I'll be set
16:25jcromartieand DigestOutputStream to compute the SHA-1 of the file on the way out
16:26amalloyjcromartie: you're not writing to the digest-stream at all?
16:27wiseenraek, got it to work, tnx !
16:27joegalloamalloy: right, he's bypassing the digest-stream
16:27amalloyyou need to copy in to digest-stream, not to out
16:27jcromartieah ha
16:27jcromartiederp
16:27jcromartieI have even done this before!
16:27jcromartiethanks
16:28jcromartieta-da
16:59tolstoyin lein 1.6.2, "lein uberjar my-app.main" gets me this error: Wrong number of args (2) passed to: clean$clean
16:59tolstoythe source suggests that supplying a main is legit.
17:00technomancytolstoy: can you paste a stack trace?
17:00bhenryif lein compile fails how can i see the "12 more" lines of the stack trace?
17:00tolstoyWhat's the preferred paste bot here?
17:00bhenrygist
17:01tolstoyok
17:01technomancybhenry: you could try clj-stacktrace
17:02amalloybhenry: you don't need the "12 more" - it only trims subsections which are already present in the trace
17:02bhenrynone of the current lines are part of my project
17:02amalloyyeah, compiler errors don't happen in your code; they happen in the compiler, which is reading your code
17:02bhenryah. i want to know what's wrong with my code that won't compile
17:03joegallogist the entire stacktrace, and i bet you can get a pretty helpful answer
17:03amalloythe stacktrace from the compiler is a good start. usually one of the exceptions has a *message* indicating which line of your code is at issue
17:03tolstoytechnomancy: regarding lein uberjar: git://gist.github.com/1387132.git
17:03tolstoytechnomancy: regarding lein uberjar: https://gist.github.com/1387132
17:04tolstoy(Sorry.)
17:04technomancytolstoy: looks like you've got a hook that is screwing things up
17:04tolstoytechnomancy: Just noticed that. Hm. I'll check it out.
17:04bhenryhttps://gist.github.com/85463179180fcbc9cbd8
17:07joegallobhenry: you are calling something that expects a symbol, but you're giving it a string. shot in the dark -- check the syntax of your namespace declaration.
17:07amalloyagreed that it looks like a bad ns decl
17:07amalloybut hard to be sure
17:07bhenryjoegallo: does the stacktrace indicate that it's happening when compiling floyd.server?
17:08hiredmanjoegallo: have you looked at bytescript at all?
17:09amalloybhenry: i think when compiling one of the files that floyd.server depends on?
17:09hiredmanjoegallo: apropos your interest in asm
17:10pjstadighiredman: you mean bitescript?
17:10joegallobhenry: yes, that, or a depency of it (but some that must not be a dependency of floyd.version)
17:10pjstadighttps://github.com/headius/bitescript
17:12joegallohiredman: i have not, but it is pretty
17:12joegalloman is it pretty
17:12jcromartiedoes anybody else read "prn-str" as "porn star">
17:12jcromartie?
17:12joegalloalways
17:12brehautnever
17:12bhenryamalloy: joegallo: well i don't think it's a namespace dec because i checked all the ones that changed between the last successful compile and my latest push
17:13brehautjcromartie: but not im not going to be able to unsee it
17:13joegallobhenry: is this open source code? why not just push the problem to a branch and send us a link?
17:13bhenryit's not open
17:13bhenry: /
17:14bhenrybut my last push only changes files that don't have anything to do with floyd.server. they are new files independent of the rest of the app. i'm going to see what happens if i remove them, but they shouldn't be part of lein compile.
17:15joegallowell, it could be any one of the transitive dependencies of floyd.server
17:17bhenryhaha i think i figured it out. i added :main to project.clj so i could start the server with lein run but for some reason it used to work with :main "floyd.server" and now wants floyd.server i guess.
17:17technomancybhenry: I don't think strings for :main has ever worked
17:19bhenryby some magical force i've been using lein run for the last week
17:19technomancyoh... interesting. it may work for run, but not for compile.
17:20bhenrygotcha
17:21jodarowoop: Clojure in Action just arrived
17:22jamiltronI keep getting UPS stickers on my door saying they missed me and I have to pick mine up :(
17:22jodarothere will be some clojure in action tonight!
17:22jamiltronBut I'm super excited for it.
17:25jodaroyeah me too
17:37devnI peeked at a friend's copy of Clojure in Action. It looks good.
17:37justicefriesi have the MEAP, haven't opened it yet.
17:38justicefriesoh I guessI have the full version now.
17:41kephaleis there a way to just use the integer bitops?
17:43justicefriesanybody using a majority of Clojure in production?
17:44RaynesLots of people.
17:44Rayneshttp://dev.clojure.org/display/community/Clojure+Success+Stories are some public examples.
17:45justicefriesah ha. I'm working on getting it going in production.
17:45brehaut,(apropos 'bit) ; kephale
17:45clojurebot(bit-or bit-set bit-xor bit-flip bit-and ...)
17:46hiredmanjusticefries: yes
17:46kephalebrehaut: yes but ##(type (bit-shift-left (int 16) (int 7)))
17:46lazybot⇒ java.lang.Long
17:47brehautkephale: ah right, so you mean primative bit ops?
17:47kephalebrehaut: exactly
17:47brehautin that case, i have no idea sorry
17:48amalloykephale: that doesn't necessarily show that you're not using primitive ints
17:48kephaleyeah, but *digs up an example*
17:49amalloyyeah. clojure.lang.Numbers/shiftLeftInt takes two ints and returns an nit
17:49amalloy*int
17:49brehautkephale: are you on 1.2 or 1.3 ?
17:50kephaleamalloy: ♥, i'll try that and the example being ##(bit-shift-left 0xFF 24)
17:50lazybot⇒ 4278190080
17:50kephalebrehaut: 1.3
17:51Raynesamalloy: Oh how I wish it returned a nit.
17:51amalloykephale: yeah, i think it actually does box them up as a long first
17:52amalloyyou can call (clojure.lang.Numbers/shiftLeftInt (int x) (int y)), which should work
17:53amalloy&(clojure.lang.Numbers/shiftLeft (int 0x7ffffff) 1)
17:53lazybot⇒ 268435454
17:54amalloy&(clojure.lang.Numbers/shiftLeft (int 0x7fffffff) 1)
17:54lazybot⇒ 4294967294
17:54amalloyhmph. why it isn't overflowing i'm not sure
17:54brehautkephale: btw, https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L3047-3058 i dont think type does what you think it does
17:55kephalebrehaut: mmm probably a time to be using class indeed
17:56brehautkephale: well even class wont tell you if somethings primative i think?
17:56amalloyindeed, which is what i meant by "that doesn't necessarily show that you're not using primitive ints"
17:57brehauti dont think there is a way on the jvm to even write a 'primative?' equivalent if you dont have static types?
17:57amalloytechnomancy: find a funny comic with a monkey in it so brehaut will realize "primative" is about primates
17:57kephalelol
17:58kephaleamalloy: hrm, clojure.lang.Numbers doesn't seem to have a bit-or for integers : X
17:58brehautfine. i cant speel
17:58amalloykephale: you have an allergy to objects or something?
17:58technomancyhttp://achewood.com/index.php?date=10262001 best I could do on short notice, sorry
17:58amalloyjust box em up in Integers
17:59brehauttechnomancy: umm. wow.
17:59amalloytechnomancy: looks like you got it to stick in his memory. that's a win
18:00kephaleamalloy: ok, i'll do that, but i am working on large sets of images
18:00kephaleamalloy: thank you
18:06choffsteinHey all. I just updated one of my projects from 1.2 to 1.3 and am getting a strange error with clojure-csv. Specifically, "Can't dynamically bind non-dynamic var: clojure-csv.core/*strict*". Any thoughts, generically, on this type of issue?
18:06RaynesThat means clojure-csv has dynamic vars that aren't explicitly declared dynamic.
18:06RaynesIt'll need to be updated if it isn't already.
18:07Rayneschoffstein: 1.3.2 uses 1.3-beta1, so it should work.
18:07Raynes(1.3.2 of clojure-csv, I mean).
18:08Raynesdsantiago: Update those deps, boy.
18:09hiredmanchoffstein: vars are not dynamic by default anymore
18:09RaynesGod I wish he would unignore me.
18:09choffsteinhmmm, I am using 1.3.2...
18:09hiredmanclojure-csv needs to mark that var as dynamic if that is the intent
18:09hiredmansure, since 1.3
18:09dsantiagoIt does mark it dynamic.
18:09Rayneshttps://github.com/davidsantiago/clojure-csv/blob/master/src/clojure_csv/core.clj#L33 is marked dynamic.
18:10hiredmandsantiago: most likely not with the version he is using
18:10dsantiagoI missed the fact that it depends on 1.3.0-beta1, I can update that in a few.
18:10Raynesdsantiago: Doesn't really matter.
18:10RaynesThe top-level dep is preferred.
18:10dsantiagoI wouldn't think it would, but it seems to be causing him a problem..
18:10choffsteindsantiago: a million things could be causing my issue ;)
18:10choffsteindon't assume its with you
18:10dsantiagoOh, I see, it looks like he is using an older version of clojure-csv.
18:11dsantiagoYou need at least clojure-csv to work with clojure 1.3+.
18:11dsantiagoEr, clojure-csv 1.3.0
18:11hiredmanthat would be my guess, or hasn't fetch deps or something
18:11choffsteinI am using clojure-csv 1.3.2
18:11hiredmanis that the jar that is in your ~/lib/ ?
18:12amalloy~/lib?
18:12clojurebotTitim gan éirí ort.
18:12hiredman./lib
18:13choffsteinclojure-csv-1.3.2.jar
18:13hiredmanany other clojure-csv jars there?
18:14choffsteinNope.
18:14dsantiagoI'm baffled.
18:14choffsteinMe too.
18:14hiredmanchoffstein: have you cleaned out ./classes since you upgraded clojure-csv?
18:14Raynes'lein clean' is known to cure cancer.
18:14choffsteinhiredman …
18:15choffsteinstupid … stupid … stupid
18:15hiredmanare you aot compiling?
18:15hiredman(if so why?)
18:15choffsteinannnddddd that fixed it
18:16hiredmanthat means you are aot compiling
18:16dsantiagoGlad that's fixed.
18:17hiredmanyou may want to look into setting :clean-non-project-classes to true in your project.clj
18:18technomancythe latest lein will automatically clean when you pull in new deps
18:20R4p70rTimMc, amalloy, or anyone interested: I did a quick mockup of a git graphical UI I might like http://twitpic.com/7i1vl6 Do you know anything like it or have any thoughts?
18:21amalloyit seems pretty pointless to me. but you can try gitk and/or gitgui
18:22hiredmanmagit
18:22R4p70rhiredman, Thanks I'll take a look.
18:23R4p70ramalloy, How is it pointless? When I was working with SVN on windows I used to go back and forth between the Tortoise UI and command line a lot.
18:26R4p70rGranted the Windows command line is awful. no patch or find or whatever. I had a bunch of unix tools installed.
18:26hiredmanthere is a solution to that
18:26hiredmanwhy in the world are you developing on windows?
18:28amalloyR4p70r: all a gui will do is make you fiddle with the mouse to move things around instead of using muscle memory to move things around in a text editor with the keyboard
18:32amalloy(or, more often, typing out quick commands on the cli vs clicking through a couple levels of menu)
18:32R4p70rI mostly used Windows for work... As for gui I someting use it on Linux as well "xdg-open ." to see thumbnails of image files in nautilus or something. Not anywhere as often as on Windows/OS X though
18:33R4p70rYou can have keyboard friendly GUIs though
18:33R4p70ra/somting use/sometimes use"
18:38amalloyyou're free to disagree, and to implement that gui if you're so inclined. you asked for thoughts, and my thought is: most of the git community would rather use the cli even with a pretty nice gui
18:40R4p70rOkay. Thanks for your feedback
18:41tolstoyThere are some pretty nice GUIs out there for git, for those inclined.
18:41tolstoyhttp://www.git-tower.com/
18:42tolstoyWindows one: http://www.syntevo.com/smartgit/index.html
18:46alex_baranoskytolstoy: tower looks really nice, but I find myself asking why I would need it
18:47tolstoyalex_baranosky: Same here. The only reason I can think of is something that helps you visualize a complicated history. Which is something I don't need.
18:48amalloytolstoy: actually github does a fantastic job of that. it's the main (only?) gui tool i use for git
18:48technomancyamalloy: you don't use magit?
18:48amalloyno
18:48tolstoyamalloy: Well, not everyone's on github, of course. ;(
18:49tolstoyamalloy: But yeah.
18:49alex_baranoskyI just use gitk if I want to visualize the history. It's always been enough for me
18:50technomancyamalloy: it will change your life
18:50Raynestolstoy: They should be.
18:50RaynesWe shouldn't considered them equals until they are.
18:51dakroneugh, the worst part of releasing in writing a message to the clojure group about it
18:52dakrone*is
18:52technomancydakrone: the hoe tool for ruby actually automates release messages
18:53dakronetechnomancy: when can I expect that in lein? ;)
18:53technomancydakrone: go for it. =)
18:54R4p70ramalloy, The weird thing about github is that you can’t use it until the changed are pushed there.
18:54R4p70rtolstoy, I'll have to look into these as well
18:56R4p70rI can't type
18:56hiredmancemerick: why not sexps for nrepl?
18:57amalloyhiredman: harder to write parsers for every client
18:57hiredmanamalloy: evidence?
18:57hiredmanis there a language someone hasn't written a lisp reader in?
18:57hiredmanis it any harder then writing a bencoding or netstrings decoder?
18:58amalloyhiredman: when ninjudd was poking at this on the flight from the conj, the bash netstring decoder is like two lines
18:58hiredmanscala seems to use sexps just fine for ensime
18:58hiredmanamalloy: ok
18:58hiredmando we care about clients written in bash?
18:59amalloyi got the impression that we do, but i'm not the expert here
18:59hiredmanif you want such a thing use a socket repl
18:59hiredmannrepl is for tools, right? are our tools going to be written in bash?
18:59ninjuddhiredman: yes. all of them
19:00ninjuddyou didn't hear?
19:00hiredmanI bet you could read sexps in bash if you really wanted to
19:00ninjuddsure, wouldn't be that hard
19:00hiredmanI mean, it just seems like nrepl is bending over backwords to avoid signs of "favoritism" or something
19:01hiredmanI am not even proposing all sexps, just lists, strings, and numbers
19:01hiredmanwith a padded hex byte count prefixed
19:02ninjuddhiredman: for the entire string?
19:02hiredmanyes
19:02hiredman0x00001D:(("code" "(+ 1 2)") ("id" 1))
19:02ninjuddso you want that instead of netstrings so that the prefix is fixed-width?
19:02hiredmanif you want to send binary use nrepl to negotiate a more suitable channel
19:03hiredmanlike websocket negotiation over http
19:03hiredmanninjudd: yes
19:03hiredmanso you can easily tell if you have a whole message or not
19:05hiredmancolon and 0x could be left out, I dunno
19:07ninjuddi'm not opposed to this idea
19:07ninjuddi think the main objection will be the inability to send binary
19:08hiredmanwhich is ridiculous
19:08hiredmanuse nrepl to ask for an http endpoint
19:08hiredmanDONE
19:09hiredmanlike, we are not build a protocol on which the entire internet is going to use
19:10hiredmanit's a repl protocol
19:10ninjuddi like that much better than adding all this crazy accepts stuff to the base protocol
19:10hiredmanwhat does binary data have to do with reading, evaluating, printing, and looping?
19:11ninjuddricher printing i suppose
19:12hiredmanricher display
19:14hiredmanI really just should ignore the nrepl thread and see what comes out of it, reading it just makes me want to grab people by the shoulders and shake them
19:14ninjuddheh. what's your take on this Atoms vs. Agents thing?
19:15hiredmanwho cares?
19:15ninjuddawesome
19:16hiredmanthe wire format and mock interactions (to get a feel for it) are 1e10 times more important then how it might currently be implemented
19:18ninjuddi'm not sure i agree with that. i'd say the semantics of the map being passed is equally important
19:19hiredmanI don't follow how that is different from what I said
19:20hiredman"passed" means going over the wire?
19:20ninjuddhiredman: i thought that by wire-format, you meant: how to represent the map, not the meaning of the keys in the map
19:21hiredmanin my mind "the wire format and mock interactions" covered everything going on between a client and server
19:22ninjuddgot it
19:23hiredmanhttp://www.joelonsoftware.com/articles/fog0000000018.html
19:27BahmanIs there some equivalent to DOLISP in Lisp? I need to iterate a list and apply a function to each element.
19:27amalloy*chuckle*
19:27amalloyBahman: you probably don't actually need that, but if you do it's ##(doc doseq)
19:27lazybot⇒ "Macro ([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."
19:28BahmanThanks amalloy!
19:28cemerickhiredman: sounds like you would like to essentially just lift clojure.main/repl onto a socket and call it a day
19:28hiredmancemerick: no, I don't thing exposing the rich set of sexps that clojure has is easy, a simple subset is good
19:29hiredmanand prefixed with a bytecount
19:29hiredmancemerick: and again, clojure.main/repl is an implementation detail that at this phase in design has no place
19:29ninjuddhiredman: the decision about agents vs atoms has a lot to do with how mock interactions work
19:30hiredmanninjudd: I fail to see how, you make the mock interactions do what you want, then pick the bits you need to implement it
19:31ninjuddwell, in this case, the implementation choice of atoms or agents influences the interface, which dictates how it works
19:31hiredmanI would be much more likely to implement nrepl using something like a thread pool of repls that are given a state and a form and return new state and a result
19:32hiredmanninjudd: I disagree
19:33hiredmanit is one thing to be mindful of the tools you have, it is another thing to make everything a nail or screw when you have a screendriver and a Mjöllnir
19:33hiredmanheh
19:33hiredman(irssi setup to replace h a m m e r with Mjöllnir)
19:33amalloyhaha awesome
19:34hiredmanscrewdriver
19:34ninjuddhiredman: so you would pass the state from the client with every command?
19:35hiredmanninjudd: most likely keep a separate map of id => state or session id => state or something like that
19:36hiredmanbut I imagine that and agents both might run into issues with debuggers which may not like you jumping around on threads
19:36hiredmannot sure
19:38ninjuddoh, so you'd just reimplement a bad version of agents instead of using them. cool
19:38hiredmanis it a bad version of agents?
19:38hiredmancould be
19:39ninjuddwell, you'd probably implement a decent version i suppose
19:39hiredmanbut my point is, we should decided what we want, what is best, and that should drive the code we write, not the other way around
19:40hiredmanif we want forkable repls, fine, make that a requirement
19:40cemerickhiredman: That's the whole point of the wiki page and the problem statements, etc. therein.
19:40cemerickIf those are the wrong problems or an incomplete statement of them, speak up on the ML
19:41hiredmansure, the wikipedia does a better job of staying on (what I consider to be the) topic than the ml thread does
19:42ninjuddfine. it was just easier to say: "what do you think of Atoms vs. Agents" than, "what do you think about having the resulting state of parallel commands be undefined"
19:43hiredmanthat is interesting
19:44hiredmanenforced serialization seems to be the currect answer, but I don't know
19:44hiredmancorrect
19:44hiredmanthe wiki
19:49hiredmancemerick: is the desire not use sexps because "well, if we use sexps we may as well just put a repl on a socket?"
19:50hiredmansexps seem just as compelling as bencoding or netstrings, the with bonus that we already have a reader and a printer
19:54xcvDon't know if you guys consider this off topic, but I wanted to check whether anybody had experience writing a serious client-side web app in Clojurescript, how you like it and whether switching from jQuery / learning to use the Google Closure stuff instead was a bad experience or reasonably easy and worthwhile...?
19:56tolstoyIs there a handy function that's like cycle but remembers where it left off each time you call it?
19:57xcvthe idea of writing the client-side code basically in clojure, with a mostly-clojure REPL, sounds like a dream, and I'm pondering whether to start investing my startup in it sometime in the coming months
19:57hiredmantolstoy: cycle generates a lazy seq, just walk it
19:57xcvby all means, opine :)
19:57amalloytolstoy: you want a mutable sequence? kinda dangerous/gross, but otherwise that's all there is to it
19:58tolstoyamalloy: hiredman: Here's the use case: I have three IP addresses. Each time a function calls this X thing, I want it to move on to the next IP in the sequence, then start over.
19:58tolstoyKind of a yield thing.
19:58tolstoyI have a habit of re-implementing core functions, so I was just curious. ;)
19:59hiredmantolstoy: best is if you do it as a lazy seq
19:59tolstoyhiredman: Okay. Thanks.
19:59hiredmane.g. you return an infinite lazy-seq of ip addresses, and first/rest as needed
20:00amalloyan infinite sequence of IP addresses! that would solve the ipv4->6 problem trivially
20:00ninjuddxcv: you may get more response if you post you question to the mailing list
20:00tolstoyha ha.
20:01hiredmanif you turn the caller of X into a fn that takes the ip as a parameter instead of calling X you can do (map (fn [ip] stuff) (cycle ips))
20:01tolstoyHmm.
20:03hiredmanif you have other parameters (map (fn [other ip] stuff) other (cycle ips))
20:03tolstoyThen take the first of that?
20:03hiredmanwell, replace the second other with others, unless it really is singular
20:03hiredmantolstoy: hmm?
20:03hiredmantake how ever much you need
20:04tolstoyI have something like: (let [data (cycle addrs)] (defn next-addr [] (first data)))
20:04hiredman:(
20:04hiredmanthat is horrible
20:04tolstoyNot only that, but it doesn't work! ;)
20:04hiredmanthe cycle there is pointless
20:04tolstoyHeh.
20:05hiredmando your futures have meaningful returns values?
20:05hiredmanfunctions
20:05tolstoyWhat I need is a generator.
20:05tolstoyThink a rabbit-mq connection, and a series of IP addresses in a cluster.
20:05hiredmanif so then you want map anway, and you can just use it
20:05hiredmansure
20:05hiredmanI understand how rabbitmq works
20:05tolstoyWhen a rabbit-mq connection goes down, I want to call a magical function called "get me the next one in the list".
20:06tolstoyAlas, I seem to have drawn a total blank. I probably need to rest.
20:06hiredmanI think you'll find .newConnection on the connection factory takes an array of hosts
20:06tolstoyDoes it?
20:07tolstoyHm. I must have looked in the wrong place for that sort of thing.
20:07hiredmanat least the version I am using does
20:07amalloylike i said, you're just asking for a mutable sequence, if this is the api you really want (i think hiredman is right that you probably don't want this api). but it's simple to do with a ref: (let [ips (ref (cycle addrs))] (defn next-addr [] (dosync (let [x (first ips)] (alter ips rest) x))))
20:07hiredmantolstoy: so you should just pass in your ips
20:08hiredman(map compute-stuff (repeatedly (partial connect-to-rabbit params)))
20:08hiredmanor something
20:09tolstoyamalloy: Yes, that makes sense. And, yes, if I can find a place to supply the IPs direct to rabbit mq, I'd be happier.
20:10tolstoyYou say .newConnection takes a list? I'm not seeing it.
20:10hiredmanit takes an array
20:10hiredmanhttp://www.rabbitmq.com/releases/rabbitmq-java-client/v2.6.1/rabbitmq-java-client-javadoc-2.6.1/
20:10hiredmanhttp://www.rabbitmq.com/releases/rabbitmq-java-client/v2.6.1/rabbitmq-java-client-javadoc-2.6.1/com/rabbitmq/client/ConnectionFactory.html#newConnection%28com.rabbitmq.client.Address[]%29
20:11tolstoyHm. I wonder if they dropped that on 2.7.0?
20:12tolstoyhttp://www.rabbitmq.com/releases/rabbitmq-java-client/v2.7.0/rabbitmq-java-client-javadoc-2.7.0/com/rabbitmq/client/ConnectionFactory.html#newConnection()
20:12tolstoyPerhaps they moved it to these magical "client properties" object.
20:14hiredmanthats kind of annoying
20:14tolstoyNo kidding! :)
20:18tolstoyPretty interesting that they took it out. I guess I can post to a mailing list and ask why they did that.
20:20pandeirohow does one execute a do...while loop in clojure, where the condition is checked after at least one iteration?
20:21amalloynever, to a first approximation
20:21hiredmanstop looping
20:21amalloysimply because while and do/while are atrociously non-functional
20:21pandeirook
20:22pandeiroi am trying to convert a string to byte array... any suggestions?
20:22tolstoypandeiro: loop / recur might work.
20:22tolstoy(.getBytes "string")
20:22hiredman,(.getBytes "foo")
20:22amalloy$javadoc String getBytes
20:22lazybothttp://download.oracle.com/javase/6/docs/api/java/lang/String.html#getBytes(int,%20int,%20[B,%20int)
20:22clojurebot#<byte[] [B@136407c>
20:22pandeiroClojureScript :)
20:22lancepantzthey were waiting for that one
20:22hiredmanreduce
20:22tolstoyHeh.
20:23amalloypandeiro: if you do it youself, you'll do it wrong. i know i would
20:23pandeiroamalloy, i am using a pretty standard JS impl as the template
20:24amalloywhat i'm getting at is such functions usually don't bother with character-encoding. characters contain more information than bytes (and not just because java uses two bytes to hold a char)
20:24pandeirohttp://sprunge.us/IggK?js
20:25pandeiroi see.
20:25hiredman:(
20:25hiredmanhorrid
20:26hiredmananyway, use reduce
20:26pandeirohiredman, ok i will meditate on that, thanks
20:26amalloyhiredman: more like a mapcat, isn't it? (mapcat (fn [char] [byte1 byte2 ...]) s)
20:26tolstoyIs this ongoing? http://clojure.org/streams Clojure 1.4, for instance?
20:27hiredmanamalloy: could be, depends if he wants to produce a seq or a js array
20:27amalloytolstoy: (Note: this section describes work in progress, currently only available in SVN)
20:27hiredmantolstoy: dead as far as I know
20:27amalloythat tells me it is extremely old
20:28tolstoyYeah, I figured. Google has it at 2009.
20:28hiredmanit is, pre-1.2, possibly pre-1.0
20:28hiredmantolstoy: I know you are googling for "clojure generators" please stop
20:28amalloyinteresting to see that clojure was defining map*, filter*, and so on, the way lamina does now
20:28tolstoyhiredman: Heh. No such thing and never will be?
20:29hiredmando what amalloy suggested with the atom, or use map
20:29amalloygenerators are isomorphic with lazy-seqs
20:29amalloybut they're presented in a much more stateful way
20:29amalloyclojure doesn't like the statefulness, and already has lazy-seqs, so it isn't getting generators
20:30tolstoyOkay, okay. Just exploring a little.
20:33reiddraperI'm going to implement my own set "type" with deftype, and I'm looking for the protocol/interfaces I should implement to make it respond in the same way as a "normal" set. Where can I find this? The closest I've found is http://fiji.sc/javadoc/clojure/lang/IPersistentSet.html
20:34hiredman,(supers (class #{}))
20:34clojurebot#{clojure.lang.APersistentSet clojure.lang.IPersistentCollection clojure.lang.AFn java.util.Set clojure.lang.IEditableCollection ...}
20:34hiredmanall the interfaces in that set (not the abstract classes)
20:34amalloyreiddraper: https://github.com/flatland/ordered/blob/develop/src/ordered/set.clj
20:35reiddraperthanks hiredman, amalloy
20:35hiredmanwow, yesterday was clojurebot's birthday
20:36amalloyhiredman: first commit, 1.0, first login...?
20:36hiredmannov. 21st, 2008 was the first gist
20:36hiredmanhttps://gist.github.com/27733
20:37technomancyyeah, I got started on Clojure from the pragprog black friday sale
20:38hiredmanhah, look at all those docstrings
20:40hiredmanclojurebot: what is your origin story?
20:40clojurebothttp://clojure-log.n01se.net/date/2008-11-21.html#13:04
20:56devncemerick: you around?
20:58jcromartiemeatdata, and lolcathost
21:00reiddraperI'm trying to understand how one might do something like implementation inheritance with deftype. I see the light of polymorphism with multimethods and defrecord, but in cases where you should use deftype, what options are there?
21:01RaynesYou don't.
21:02reiddraperRaynes: alright, so perhaps someone can help me think about this problem "differently". I have two different Set types I'd like to implement, which have some underlying similarities.
21:02hiredmanthere are a number of ways to do that
21:02reiddraperI suppose I could create a builder func that would set some bool on the type and my funcs can decide whether they want to switch on it or not
21:02hiredmanthe simplest is just put the shared functionality in a function, and have both implementations call the function
21:03hiredmanbut you can really do whatever you want, you can write macros to generate two deftypes that differ slightly
21:05hiredmanhttps://github.com/hiredman/tuples/blob/master/src/tuples/core.clj#L47 generates distinct types for tuples, with two element tupls also implementing Map.Entry
21:05reiddraperhiredman: I rather like that second idea. I get the idea that I shouldn't necessarily be inheriting someone else's implementation details
21:05reiddraperbut it also seems wrong to have two quite similar types and have to declare that they are using the same funcs for 30% of their calls
21:05hiredmanwrong how?
21:06reiddraperverbose, for one. I'd at least like to be able to do it for a whole protocol. Perhaps this is where the power of macros come in
21:06goodieboyhow can i select alternating values from a list?
21:08hiredman,(doc take-nth)
21:08clojurebot"([n coll]); Returns a lazy seq of every nth item in coll."
21:08reiddraperhiredman: the tuple-for example you sent is great, thanks
21:08goodieboy,(take-nth 2 '(1 2 3))
21:08clojurebot(1 3)
21:08hiredmanit is certainly something
21:08goodieboyhiredman: nice thanks!
21:09hiredmanmy first use of detype for a 'real' datastructure
21:16goodieboyi'm attempting to create a macro that defines a set of "lettings", I can't figure out how to make this work? https://gist.github.com/1387726
21:17goodieboyoops... just edited that to actually make sense :)
21:18alex_baranoskyok
21:20alex_baranoskygoodieboy: looks liek aplain let to me
21:20bhenrysame here
21:20goodieboyalex_baranosky: but how can i pass in arbitrary "lettings"?
21:21alex_baranoskyyour example is just 'let
21:21Raynesalex_baranosky: For a moment there I felt like I was playing madgab.
21:22bhenrygoodieboy: what are you trying to do?
21:22goodieboyso yeah, sorry... that example doesn't describe what it is i'm trying to do fully
21:22bhenry,(let [one 1 two 2]
21:22bhenry      (str "1 => " one " and 2 => " two))
21:22clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
21:23alex_baranoskygoodieboy: create a nicer example, and I'm sure someone will help out
21:23bhenrythat's a head scratcher
21:23goodieboyyes you're right, let met create a better example :)
21:24alex_baranoskyRaynes: typing's a mofo sometimes ;)
21:25cemerickdevn: hi
21:28goodieboyman, this is still probably a bad example, but what I'm trying to do is create a little dsl, and provide bindings for various values that might be needed within the body: https://gist.github.com/1387726
21:31brehautgoodieboy: you are using a macro so you can override or in the context of the query?
21:32cemerickhiredman: sexps are only beneficial if both sides of a connection are Clojure (or some other lisp, at a minimum) and you only care about pushing around the structures supported by the flavor of sexprs you choose, i.e. no efficient binary
21:33goodieboybrehaut: well, overriding or is not really what i'm doing specifically, but what I was hoping to illustrate is that I don't want to eval the code immediately, so I need a macro
21:34goodieboyi'm probably not thinking about this correctly, i guess i'm more curious about how you can create bindings that the body of a macor (when evaluated) can have access to?
21:34goodieboyerr, macro :)
21:35brehautgoodieboy: do you understand (defmacro bogo-let [bindings & body] `(let ~bindings ~@body))
21:36chouserthis must be some circle of hell Dente never imagined
21:36goodieboybrehaut: ahh yeah, i just tried something very similar!
21:37amalloychouser: i'm trying desperately to come up with a dental pun here
21:37chouserheh
21:37chouseroops
21:37brehautgoodieboy: macroexpand and macroexpand-1 are your friends
21:38pandeirohiredman: implemented string-to-bytes with reduce but how do i deal with the case of a char larger than one byte? http://sprunge.us/OieA?cl
21:38chouserI'm trying to port some code to Clojure 1.3, but it uses a lib that needs some tweaks, which uses a lib that needs some tweaks
21:38amalloychouser: that's pretty much been the 1.3 story for months
21:38chouser...so now I'm debugging build failures in a maven projects three levels deeper than I care about.
21:38goodieboybrehaut: geez, that was too simple in the end. thanks for that.
21:39brehautgoodieboy: clojure has a bunch of ways of delaying evaluation beyond macros too. functions are the most obvious, but also delay and force are worth you looking at
21:39duck1123chouser: there was a time when just about every lib I depend on was like that
21:40goodieboybrehaut: cool thanks, i'll be sure to check those out
21:40duck1123thankfully, It's much better now
21:40chouserI take back everything I ever said about enjoying breaking other peoples' code.
21:40amalloybrehaut, goodieboy: delay and force are just macros on top of the *real* way to delay evaluation, which is just wrapping something up in a function
21:40brehautamalloy: of course; but theres no sense reinventing that
21:41chouserI don't mind so much fixing clojure code, but build errors drive me a bit crazy.
21:42brehautchouser: i thought you were talking about being demoted by chanserv. build is definately a more hellish circle
21:42duck1123chouser: Especially when you find yourself asking "how did this ever work in the first place?"
21:43chouseramalloy: any new thoughts on macroexpansion metadata?
21:43chouserduck1123: yeah, exactly
21:43chouserone of the few really solid benefits of gentoo was if you could install it, you could build it.
21:44chousernot true in .jar land, is it. :-(
21:45chouseramalloy: the non-meta part of the form passed to a macro is only input, and what the macro returns is exactly the output
21:45chouserthe current proposal has metadata being the input and also clobbering the output
21:45amalloychouser: i don't htink i understand the significance of that statement
21:46amalloyah. i didn't wait long enough, i see
21:46chousersorry
21:47chousermaybe patching defmacro was the right approach, because then there could be a new defmacro (defmacro* ?) that has the old behavior, that is gives the macro full control of the output.
21:48amalloyi don't think it makes sense to think of it as clobbering the output. it's just a compile-time assoc, right? it's like (-> some-map (f) (assoc mykey myval))
21:48chouseramalloy: yes, but (f) has limited control of the final output
21:48amalloythe caller is explicitly saying, "i need this form to have metadata X", so they assoc it in before they "look at" the result of macroexpansion
21:50ninjuddcemerick: so i take it you're opposed to establishing a separate channel for communicating binary data?
21:50chouserhm, it is true that a macro can has plenty of other ways to accept input. besides all the args, it has metadata on the args and on its own name
21:52cemerickninjudd: not opposed, but such things get really complicated, especially if the REPL server is on a remote environment. Port privileges, firewalls, an implementation hurdle for clients and tools…
21:52cemerickSo, ok, maybe opposed :-)
21:52brehautwhy not just http over spdy
21:52brehaut(only mostly joking)
21:53amalloychouser: i agree there's a place for something like defmacro* but it seems extremely uncommon to want to ignore metadata that the caller has put on the form
21:53chouserbut it wouldn't be ignoring it necessarily. It could be taking it as input and doing something else with it.
21:53cemerickbrehaut: carrier pigeon would resolve the firewall and port issues. :-P
21:54ninjuddcemerick: yeah. base64 encoding sounds way simpler that all that
21:54Rayneschouser: You're so adorable. I saw hiredman's origin-of-clojurebot IRC log where you said that an IRC bot would annoy people.
21:54chouser^Foo (mac) --> (do ^Foo (that thing) (this thing))
21:54RaynesThree years later and we would all curl up and die if the evalbots disappeared.
21:54cemerickninjudd: which is dreadfully slow, even using the fastest base64 impl :-/
21:54ninjuddyeah
21:55chouserclojurebot: do you annoy people?
21:55amalloychouser: i've been having trouble constructing a form where this sort of behavior is useful, and i don't think yours is an example
21:55clojurebotmin people is 5
21:55chouseramalloy: heh.
21:55amalloyhinting the return value of a form that doesn't get used is useless
21:55chouseramalloy: good point
21:55brehautcemerick: lol
21:56amalloyi see what you're saying though. in the current system you can have a "back channel" to talk to the macro by settings its &form metadata to control how it behaves in some other way, without setting a typehint in your expansion context
21:56chouserRaynes: do you have a link?
21:56Rayneshttp://clojure-log.n01se.net/date/2008-11-21.html#13:04
21:56chouseramalloy: that's what I'm saying, but I'm not at all sure it's important
21:57chouserWhat metadata on an expression matters to the compiler besides the type hint, line number, and filename?
21:57duck1123ahhh... memories
21:57amalloyi think it's probably not, especially with your CRAZY hack of setting metadata on the macro's own name
21:58amalloychouser: i'm not sure. i haven't read the whole compiler, but those are the only three that stick out to me
21:58chouserHm -- that's interesting. What if we turned the exception around and only applied :tag, rather than applying everything other than :line and :file?
21:58amalloychouser: static, inline, dynamic
22:00chouserthose are on var names, right? places where a macro can't expand anyway?
22:00hugodis there a clojure wrapper for WeakHashMap?
22:00amalloychouser: as far as i know that's correct. i'm just listing relevant keywords in Compiler.java
22:00chouserhm
22:01amalloychouser: i don't see any immediate failure cases for applying only :tag. i keep *thinking* it would be a problem if some external macro needed to mess with the metadata, but macros go outside-in
22:01chouserRaynes: I think you're misrepresenting my reaction. But you called me adorable so I guess I'll let it slide.
22:02amalloyi guess: ^{:foo 1} (macro1) => ^{:foo 1} (macro2)
22:03amalloyis a cause that might break: you put meta on macro1 in order to get it to macro2, which looks at its &form meta
22:03chouserooh, interesting.
22:03amalloyand you lose that ability if we only apply :tag
22:03chouserright
22:04amalloynot clear to me that this is an important ability, of course :P
22:05amalloywell. i guess that wouldn't work in the current setup unless macro1 looked at its &form also
22:06chouseryeah, we've got one clear point -- the default case can be better. The consequences of making it always work that way for :tag or for other metadata is all vague.
22:06amalloyand if it *is* looking at &form, then it must be setting meta on its return value to get it macro2, and that would still work under your proposal. so we wouldn't break an existing usage by applying only :tag, we'd just lose the automatic-forwarding through a "dumb" macro1 to a "smart" macro2 that my original patch adds
22:07chouserdoes that argue for a change of smaller impact now? re-apply :tag for now, and add others either individually or en masse later?
22:07amalloyhmmmm
22:08chouserBTW, this is me just practicing at careful design. I assume whatever we come up with will be shot full of whole later in the process.
22:09amalloywell, i shot a bunch of holes myself by writing three patches. so i appreciate the goal
22:09chouserNot that the proposal won't ultimately be accepted, just that no matter how hard I work at careful design I seem to have blind spots for gaping holes elsewhere.
22:10amalloychouser: i'm actually not sure whether adding just :tag is more or less likely to be accepted. it's smaller-impact, but has more "specific" things we could have gotten wrong
22:11chouserwell, one last thought. If we did want to support defmacro* in the future, I wonder if it would be worth abstracting the applyMacro bit so that both macroexpand and add-meta could use it
22:11chouserI've gotta run. ttyl
22:11amalloynight, thanks
22:12amalloydidn't understand that last point but not exactly urgent
22:13reiddraperin the definition of a type, what's the difference between (.seq this) and (seq this), if I've implemented the seq func for IPersistentSet?
22:14amalloyreiddraper: the latter routes through clojure.lang.RT but ends up the same place
22:14reiddraperamalloy: thanks
22:50RaynesMan. Why is fogus never here?
22:57jcromartieRaynes: dance class?
22:57RaynesEh?
23:02duck1123I just spent a good 45 minutes debugging a tricky set of multimethods I have only to just now realize I had the order of arguments wrong for one of them.
23:02duck1123go little used code
23:03amalloyduck1123: better than discovering a library author changed the argument order in an update, at least
23:06duck1123true. I have this series of multimethods that return different values depending on the value of two other dynamically bound values. For the longest time, I used two convenience macros for setting them up, but when I created a macro merging the two, I got the order backwards from how I had used it elsewhere
23:21reiddraperWhat determines how a type looks when it's printed at the repl? The result of pr on that obj?
23:21reiddraperI've made my own type and I'm curious where the look of it printed is coming from
23:23amcnamaraamalloy: subtle.
23:23brehautreiddraper: print-dup (a multi)
23:25reiddraperbrehaut: and is there a way to see which func it's being dispatched to?
23:27brehautreiddraper: i dunno. /me dives into source
23:27amalloy&(apropos 'method)
23:27lazybotjava.lang.RuntimeException: Unable to resolve symbol: apropos in this context
23:27amalloydangit brehaut, how do you use that thing
23:28brehaut$(use 'clojure.repl)
23:28brehaut&(use 'clojure.repl)
23:28lazybot⇒ nil
23:28brehaut(apropos 'method)
23:28brehaut&(apropos 'method) ; excuse me while i fail a lot
23:28lazybot⇒ (clj_http.core.proxy$org.apache.http.client.methods.HttpEntityEnclosingRequestBase$0 make-service-method remove-method find-protocol-method defmethod -reset-methods remove-all-methods prefer-method method-sig methods print-method get-method wrap-method)
23:28amalloyget-method
23:29amalloy&(get-method print-dup '(1 2 3))
23:29lazybot⇒ nil
23:29amalloyfeh
23:29brehaut&(keys (methods print-dup))
23:29lazybot⇒ (nil clojure.lang.PersistentVector java.util.regex.Pattern java.lang.Number clojure.lang.IPersistentList clojure.lang.Fn clojure.lang.PersistentHashMap java.lang.String java.lang.Character clojure.lang.ISeq java.lang.Double clojure.lang.BigInt clojure.lang.Ratio ja... https://gist.github.com/1387884
23:30reiddraperamalloy: yeah I get nil too in my repl
23:30amalloyoh, right
23:30brehautit'll probably fall through to a default?
23:30amalloy&(get-method print-dup (class '(1 2 3)))
23:30lazybot⇒ #<core$fn__4992 clojure.core$fn__4992@be0cd7>
23:30brehautactually, clojure.lang.IRecord
23:30brehautis a likely candidate
23:31amalloyIRecord? is that in 1.3?
23:32brehauti guess it must be, my 1.2 repl isnt finding it
23:32brehauthttps://github.com/clojure/clojure/blob/master/src/clj/clojure/core_print.clj#L217
23:33brehautso it turns out there is a crap ton of detail in what implementation is chosen for a particular type
23:34brehautand i see that a) im missing a bunch of the specially named characters in inc-clojure-brush and that b) the pygments brush is missing them all
23:34amalloyspecially-named characters? you mean like \newline?
23:34brehautyeah
23:34amalloyi covered those in pygments
23:34brehauthttps://github.com/clojure/clojure/blob/master/src/clj/clojure/core_print.clj#L248-253
23:34amalloy\, followed by either any single character or a-z+
23:35brehautamalloy: perhaps github isnt using the latest version of the brush ?
23:35amalloybrehaut: they updated to my version at least. are you sure it's pygments and not their css?
23:36reiddraperbrehaut: thanks, looks like it's getting called here https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_print.clj#L240
23:36reiddraperfor my type
23:36brehautamalloy: yeah, the spans are wrapping (for example) '\n' a 'ewline' 
23:37amalloyoh. i bet i just did it in the wrong order
23:37brehautreiddraper: bonus lesson: the clojure clojure source code is pretty readable
23:37amalloy(.|[a-z]+), instead of the other way round
23:37brehautoh true, that'd do it
23:37reiddraperbrehaut: yeah I'm finding that out :)
23:37brehautnow you have two problems
23:38brehautamalloy: im going to copy your rule for my brush
23:38brehautmuch easier than hardcoding a bunch of names
23:38amalloybrehaut: copy+fix it, plz :P
23:38brehautamalloy: ha yes :P i have no regexp though, so i wont fall into the same trap ;)
23:38amalloyclever
23:39brehauti did it for speed more than correctness :P
23:39reiddraperbrehaut: so I think we're calling get-method wrong
23:39brehaut(all though as a side effect it fixed a couple of really curly bugs)
23:39reiddraperthe last arg should not by the obj, but the result returned from defmethod
23:39reiddrapererr defmulti
23:40amalloyreiddraper: that's what i did the second time
23:40amalloy&(get-method print-dup (class '(1 2 3)))
23:40lazybot⇒ #<core$fn__4992 clojure.core$fn__4992@be0cd7>
23:40reiddraperamalloy: oh yes, sorry I missed that
23:40alexbaranoskysay you wanted to mock any arbitrary java method call, how would you go about it?.... I ask because I'm looking for ideas on good ways to add the ability to do this to Midje
23:43amalloyalexbaranosky: am i implementing the feature or using it?
23:43brehautamalloy: damnit. im still going to need to explicitly check for &amp; &lt; and &gt; . what a pita
23:43alexbaranoskyamalloy: depends on your enthusiasm level
23:43amalloyi mean, what is the question you're asking
23:43brehautnow i have to catch a bus
23:44alexbaranoskyI want to make it so that in midje you can say (fact (foo 2) => 8 (provided (.size bar) => 40)
23:45alexbaranoskyamalloy: I'm wondering what some approaches to that problem might work under the hood
23:46amalloyand the thing you're mocking is some java object that has to continue behaving the way it already does except for this change?
23:47alexbaranoskyamalloy: well there are different possibilities: what you're describing is usually called a spy
23:47alexbaranoskyamalloy: but the standard is to assuem a mock is a totally new object, that only does the stuff you specified
23:47alexbaranoskyamalloy: thus, we don't need to preserve behavior
23:48duck1123it would be nice though if you could mock only a particular method
23:48amalloywell. if you can require the user to provide a class or interfaces that this thing should extend/implement it's not hard
23:48alexbaranoskyduck1123: yeah we could have spies too perhaps???
23:48lazybotalexbaranosky: Oh, absolutely.
23:48amalloybut we can't just add arbitrary methods to an object/class like we could in ruby or java
23:49amalloyone possibility is to define an interface on the fly, with the methods you want, and then return a reification of that interface
23:49duck1123or java?
23:49amalloyduck1123: by just making up a new class that has those methods
23:49alexbaranoskyit could looks something like: (provided (.size ^Bar ...bar...) => 40) maybe?
23:49amalloyclojure's class-creation demands interfaces
23:50duck1123ahh, rspec handles this kind of thing quite nicely
23:50amalloyalexbaranosky: (provided (mocking bar IBar (.size [this] 10)))?
23:51amalloyie, you want the syntax to look exactly like reify
23:51amalloywhich makes it easy for users to understand, and easy for you to transform to a reify
23:52alexbaranoskyamalloy: I'm not as much concerned about ease of transforming to reify, but am definitely very concerned about people understanding the API
23:53amalloyalexbaranosky: your => 40 syntax fits better with the rest of midje, but doesn't really "scale" to mocking multiple methods as far as i can tell
23:54alexbaranoskyamalloy: in midje you can already say things like: (fact (x) => 1 (provided (foo) => 2 (bar) => 3 (baz) => 4))
23:54amalloyand neither syntax really handles the possibility that they need to extend a concrete class
23:55alexbaranoskyextending concrete classes, in my mind is a rare except I haven't done it in months home or at work
23:56duck1123I guess your best bet is to adjust your function lines till you can easily pass in mocked out classes for the inner functions and use traditional midje mocking for the rest
23:56amalloyagreed, but you're trying to provide a facility for mocking java objects. those objects aren't always designed as clojure-friendly
23:57alexbaranoskyyou make good points
23:57duck1123is there a clojure wrapper for jmock?
23:57alexbaranoskywhat do you think of?: (fact (x) => 1 (provided (.foo IFoo f) => 2 (.bar IBar b) => 3 (.baz IBaz bz ) => 4))
23:58duck1123I haven't gotten around to playing with that yet
23:58alexbaranoskymidje could identify these as method calls by their symbol names