#clojure logs

2012-01-15

03:34bitopshas anyone done any 2D animation with sprite maps in Clojure? any libraries or pointers?
03:35amalloybitops: just the java ones, i think
03:39bitopsamalloy: makes sense...tooling around I've found the clj-processing library. looks like it could be a good one to use.
04:39notsonerdysunnyis there a good clojure library to deal with ".zip/.z/.tar.gz/.tar/.gz" files?
04:40Raynesnotsonerdysunny: https://github.com/Raynes/fs has some functions for decompressing and unarchiving files.
04:40notsonerdysunnypreferably without depending on the system commands.. purely based on JVM stuff..
04:40hiredmanyes
04:40RaynesThey are implemented entirely in Clojure backed by core and apache libraries.. None of them shell out.
04:42notsonerdysunnythanks Raynes .. that is exactly what I was looking for.
05:09PntBlnkHi all, would someone be able to let me know how to structure a macro so that I can use the 'var' special form on an argument? Or is there an example somewhere I could study? Thanks in advance if you can help.
05:13amalloyPntBlnk: i'm not 100% sure what you mean, but binding is the only example i can think of at the moment
05:14amalloyit's a little complicated, though. a simple answer would be (defmacro my-var [x] `(var ~x)), for example
05:14PntBlnkThanks, I'll have a go... :)
05:15PntBlnkUnfortunately that doesn't work for me.
05:16amalloythat's not really an actionable statement. what did you do; what did you hope would happen; what happened instead?
05:17PntBlnkI've created a modified version of the robert-hooke code with a few extra features, and I'm currently storing hooks as a vector: [target-var <string representation of hook-var that I want to turn to a real var> hook]
05:18PntBlnkSo a hook might be [#'korma.core/exec #'my.ns/my-fn #<Atom......>].
05:20PntBlnkThe macro in question is to create the hooks. It works okay, but I'm unhappy that the hook function is currently (.replace (.getName (class f)) \$ \/), which is pretty painful.
05:22PntBlnkThe macro takes the target-var and the hook function, and tries to do everything in a syntax-quoted let: `(let [~'fn-var `(var ~~f) ~'fn-atom (atom ~f)](vector ~target-var ~'fn-var ~'fn-atom)))
05:23PntBlnkIt's getting the fn-var value which is proving challenging for my tiny noob mind...
05:26amalloyyeah, if you're trying to manage nested syntax-quotes you're just going to be sad overall
05:27PntBlnkI feel very much that way.
05:27amalloybut i don't think you need them, really
05:28amalloy`[~target-var (var ~f) (atom ~f)] is it, right?
05:28PntBlnkWell, var is a special form, and can't be treated like a function...
05:28amalloythat seems to be the less-confused version of what you seem to be trying to do
05:29PntBlnkIt is very much nicer, but still doesn't work :)
05:30PntBlnkI get #'my.ns/f ..
05:31amalloy&(let [target-var #'inc, f 'swap!] `[~target-var (var ~f) (atom ~f)]
05:31lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
05:32amalloy&(let [target-var #'inc, f 'swap!] `[~target-var (var ~f) (atom ~f)])
05:32lazybot⇒ [#'clojure.core/inc (var swap!) (clojure.core/atom swap!)]
05:32amalloypoint is, you have still not really said what you're doing. you provided a snippet of what you think is the relevant code, but without an idea of how your macro is getting called i can't really write it
05:35PntBlnkSure. Are you familiar with the robert-hook lib? I'm using a vector to hold the hooks in the form I described earlier. With this code, I can list existing hooks, remove all of them, and will be able to add them to entire namespaces if that's at all useful.
05:36amalloyi know vaguely what robert.hooke does, but nothing about the structure of the lib
05:36PntBlnkThe main problem for me was that hooks weren't playing nice when compiling my code.
05:38PntBlnkAside from the overall functionality my problem is quite simple. I want to store two vars and an atom in a vector. The first var (the target) is fine, because you provide that in #'namespace.qualified/form, but the second is not (unqualified function name), and I'm keen to keep the usage the same as the original code.
05:40PntBlnkThe var special form is not available at compile time, so you don't get the same results as in the REPL.
05:40amalloywhat do you want an invocation of your macro to look like, and what do you want it to expand to
05:41amalloythose are the important questions. once you have those answered, you generally can write the macro (or determine it's impossible)
05:44PntBlnkHere's one I was playing with before. Fine in the REPL, not so for compilation: (defmacro get-var [f] `(let [~'out (var ~f)] ~'out))
05:45PntBlnkHang on...
05:45PntBlnkThat appears to work..
05:46PntBlnkI must apologize as it seems that I have wasted your time!
05:52amalloyhappy hunting
05:53PntBlnkYeah, thanks. Still not getting a final that's done and dusted feeling, but I appreciate the time you spent. Thanks!
06:19kaelukawhat's the best way to learn clojure? book/webpage
06:25kaelukahi, btw ;-)
06:26Blktgood day everyone
06:38kaeluka..seems pretty empty here, bikt :)
06:56augustlkaeluka: practicing :)
06:57augustlbooks and writing programs are my favorite ways of practicing
07:00kaelukabut sometimes, a certain web page is better than any book
07:00kaelukai'm working with stuart halloway's programming clojure for now and maaaan, does this language look nice
07:01kaelukahave been dabbling around a bit a year ago or so but then got distracted
07:19augustlkaeluka: http://www.infoq.com/presentations/Simple-Made-Easy i
07:19augustlerr
07:19augustlkaeluka: http://www.infoq.com/presentations/Simple-Made-Easy will also teach you alot about clojure
07:19augustleven though there's no clojure in it :)
07:20kaelukaawesome, great :)
07:22kaelukabtw: what's the editor/IDE most people use for clojure? i would very much like to stick with emacs, does that make sense?
07:24augustlI use emacs at least, but I'm not an authority on clojure ;)
07:24raekkaeluka: a lot of people use emacs for clojure
07:25augustlemacs is good for parens
07:26raekkaeluka: check out the stats :-) http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/
07:26kaelukayeah, i'm guessing that paredit mode has to be awesome for clj
07:27raekit is
07:27raekkaeluka: to get started follow the official readmes of clojure-mode (elisp lib) and swank-clojure (clojure lib)
07:27raekhttps://github.com/technomancy/clojure-mode
07:27raekhttps://github.com/technomancy/swank-clojure
07:29raekthere are a lot outdated tutorials out there, so I just wanted show the correct ones early...
07:30kaelukayeah, that's why i'm asking
07:30kaelukathanks a lot!
07:32raekthe no 1 cause of problems is having an incompatible version of slime installed in emacs (so beware of that if you come from Common Lisp)
07:33raekanyway, most of the things you need to look out for are explained in the "Troubleshooting" section of the swank-clojure readme
08:15kaelukaraek: no, got no slime installed currently; thanks
08:35bpris flatten lazy?
09:44TimMc&(take 5 (flatten (range)))
09:44lazybot⇒ (0 1 2 3 4)
09:44TimMcbpr: ^
09:55raek~flatten
09:55clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
11:05bprTimMc, raek: Thanks guys. I actually did wind up using mapcat
11:24zzach1Compiling clj files with java works using a command line "java -cp clojure.jar:.:classes -Dclojure.compile.path=classes clojure.lang.Compile app.hello ". The resulting class has no debug / line number information. Which option can be used to compile including such information?
11:38yoklovwow. I'm surprised cljs has ``read''
11:44rindolfHi all. What's the best way to learn Clojure?
11:45pandeirorindolf: what's your task?
11:46rindolfpandeiro: I want to learn Clojure in order to learn a new language.
11:46rindolfpandeiro: no direct task, except maybe implementing Golf challenges in Clojure or whatever.
11:46pandeirobut what are you trying to do, specifically?
11:47pandeiroi would once you know the syntax, find code that does things that are somehow related to the problems that interest you
12:08mindbenderplease how can I get cljs.repl on my project classpath so that I can (require '[cljs.repl :as repl]) without errors
12:09mindbenderis there a jar of some sort for clojurescript?
12:11ldopamindbender: i haven't had any problems using the one from lein-clojurescript
12:11ldopamindbender: http://clojars.org/org.clojars.bartonj/clojurescript
12:13mindbenderldopa: thanks, I think that's just what I needed
13:51yoklov>:/ code, you and i both know you were running at twice this speed yesterday.
13:59yoklovhrm. how do people profile clojure code?
15:48zyfoHave some noir code that works great on two servers, but when I try to run it locally (lein deps && lein run) I get the following exception: "resource-response does not exist (route.clj)". Any ideas?
16:00Guest88848Hello, I am new to clojure and would like help using something like (reduce (map reduce +)) on a list of lists of numbers to obtain the sum.
16:00Guest88848Is this an okay place to ask such questions?
16:01_carlos_hi!
16:02_carlos_,(defn factorial [n] (-> n (+ 1) (range 1) (apply *)))
16:02clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
16:02_carlos_#(defn factorial [n] (-> n (+ 1) (range 1) (apply *)))
16:02_carlos_(defn factorial [n] (-> n (+ 1) (range 1) (apply *)));
16:02_carlos_._.
16:03_carlos_do I need to be registered to run code?
16:03William_Sharkey(reduce + 0 (map reduce + 0 '( '(1 2) '(3 4)) ))
16:04_carlos_anyway, this code doesn't work because ClassCastException clojure.lang.LazySeq cannot be cast to clojure.lang.IFn clojure.core/apply (core.clj:600)
16:04William_Sharkeymy code does not work because #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$_PLUS_>
16:04_carlos_I know I should use ->> but I don't understand why the lazy seq doesn't work the oppositte way
16:05_carlos_William_Sharkey: hahaha.. I thought you were some parrot bot for a minute
16:06_carlos_William_Sharkey: why do you have 0 as an argument?
16:07_carlos_William_Sharkey: what do you want to do?
16:07raekWilliam_Sharkey: you probably want (reduce + (apply concat [[1 2] [3 4]]))
16:08raekapply concat turns it into [1 2 3 4] and then you can simply sum that collection
16:09_carlos_raek: do you know why I can't use first-thread?
16:10William_SharkeyRaek:thank you.
16:10William_SharkeyCarlos: I wanted to sum a list of lists of numbers.
16:11raekWilliam_Sharkey: (map reduce + 0 ...) doesn't make much sense. maybe you wew thinking about something like (map (fn [x] (reduce + 0 x) ...)?
16:12raek_carlos_: the bots don't allow you to define global vars. you can use anonymous functions though
16:12raek_carlos_: ##(let [factorial (fn [n] (-> n (+ 1) (range 1) (apply *)))] (factorial 5))
16:12lazybotjava.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn
16:13raekso, the (-> ...) macro expands to this: (apply (range (+ n 1) 1) *)
16:13bobhopeAre there any clojure templating libraries? I want to general source code for a different language from a clojure program
16:14_carlos_bobhope: I heard about fleet
16:14raek_carlos_: can you write the function body without ->?
16:15_carlos_raek: I can write with ->> last-thread macro, but I wanted to understand why it doesn't work with first-thread ->. for me both make sense
16:16raekwell, they don't mean the same thing
16:16raek_carlos_: do you know about the difference?
16:16_carlos_raek: yes, I know, but both directions make sense from substitution point of view
16:16raekwhat does (apply (range (+ n 1) 1) *) mean?
16:17raeklets assume n = 5
16:17raek(apply (range (+ 5 1) 1) *)
16:17raek(apply (range 6 1) *)
16:17raek(apply () *)
16:17raekBOOM
16:17bobhope_carlos_, fleet seems interesting, but it seems like they only designed for xml-esque languages
16:17raek() is not a function
16:18raekso to me the (-> ...) version does not make sence, since the functions end up with the arguments in the wrong order
16:19_carlos_raek: n is applied as last argument of (+ 1), making it (+ 1 n), not (+ n 1)
16:20raek_carlos_: yes, since (+ a b) is equal to (+ b a) this is not a problem.
16:20raek_carlos_: but what about the call to 'range' and 'apply'?
16:20_carlos_raek: ha, sorry, just a sec
16:23_carlos_raek: why did you apply the result of (+ 5 1) to the first argument of range? range also takes the result in its last argument
16:23raek_carlos_: I'm innocent! -> did it :-)
16:24raek_carlos_: the -> macro rewrites the code in a fixed pattern. it knowns nothing about what the different argument means
16:25_carlos_raek: my bias was that is was putting it in the end of the expression. my bad! thank you very much
16:26raekthink of -> as a transformation that turns (-> a (b0 b1 b2 ... bn) ...more...) into (-> (b0 a b1 b2 ... bn) ...more...)
16:26raekand (-> a) into a
16:27_carlos_raek: I understand your previous example step by step eval.. my bad :-)
16:50_carlos_is it just me or most times clojure code is easier to read in a one liner than broken into several lines like most books do?
16:52jodaroclojure.main quit unexpectedly while using the jna8943583805303982763.tmp plug-in.
16:52jodarowoopsie
16:56brehaut_carlos_: just you?
16:57RaynesSpaces are stupid too! (foo,bar(baz),(foo,bar))
16:57brehautRaynes: why have you used such long winded symbols?
16:57RaynesBah!
16:58raekRaynes: you use commas for indentation too? :P
16:58Raynesraek: Of course.
16:59raekdoes someone know how to turn off the "fn" to "ƒ" transformation that emacs starter kit has by default?
17:00raekmaybe I could just comment out these lines in my checkout: https://github.com/scgilardi/emacs-starter-kit/blob/5937360cc91d352380d95801d1a0cebecfb47d96/modules/starter-kit-lisp.el#L85
17:01_carlos_if computer languages supported more expressive symbols, variables could be, say chinese characters. code would be much more compact
17:02raekclojure does not forbid them
17:02_carlos_raek: really? didn't know
17:03brehaut,'ß
17:03clojurebotß
17:04brehaut,((fn [ß] (inc ß)) 1)
17:04clojurebot2
17:04raekit isn't really set in stone which characters are allowed, but alphanumeric characters (even non-ascii ones) are ok
17:05brehautraek: although clojure.org says "Symbols begin with a non-numeric character and can contain alphanumeric characters and *, +, !, -, _, and ? (other characters will be allowed eventually, but not all macro characters have been determined)"
17:05_carlos_,((fn [世界] (inc 世界)) 1)
17:05clojurebot2
17:05_carlos_:o
17:06brehaut_carlos_ please dont write apljure now!
17:06raek.clj-files are always in UTF-8, so all unicode characters can be used in clojure source code
17:06_carlos_haha
17:09brehautraek: yeah sorry. i understand that, i was just mentioning that if you read clojure.org, you might get a different idea
17:10brehautraek: rather than trying to contradict you
17:13amalloyraek: .clj files are required to be UTF-8?
17:15raekamalloy: I'm pretty sure that clojure will always decode them using UTF-8, but maybe I should try to back up my claim
17:17raekhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6870
17:18raekthere
17:19amalloyinteresting. that means someone whose OS uses a different encoding by default will be unable to compile their files
17:19raekamalloy: how?
17:19brehautamalloy: you mean e.g. windows and UCS16 ?
17:20raekOS'es do not transcode dat just like that
17:20raek*data
17:21raekOS'es often have some notions of default encodings, but that doesn't affect much
17:21_carlos_from what I see, if my file is encoded with a different encoding, it will blow
17:21amalloywell. not an area i'm an expert in, but it seems like if i open up a new text file using some japanese character-encoding, then any characters which aren't encoded the same as UTF8 will be read incorrectly
17:22raekyes. this is an issue the text editor deals with rather than the OS
17:22brehautoh. UCS-2 sorry
17:22bobhopeWhat is the difference between extends? and satisfies? for protocols?
17:22_carlos_raek: so a language plugin for the editor, detecting the target language would always try to force that encoding
17:22raekand since the encoding is not actually stored anywhere, a text editor can only guess the encoding
17:23brehaut,(doc satisfies?)
17:23clojurebot"([protocol x]); Returns true if x satisfies the protocol"
17:23raekbobhope: check on a instance vs a class I think
17:24_carlos_raek: based on the extension would by concept be enough to guess de decoder
17:24_carlos_*the decoder
17:24bobhoperaek, thanks
17:24bobhopethat seems like a reason to have both
17:24raek_carlos_: yes, for some text-based formats (e.g. Clojure source files and JSON files) that is true
17:25raekbut most text-based formats are broken and do not specify an encoding or lets the user choose but does not provite any way of soting that choice
17:27raek*provide *storing
17:29bobhopeIf I want to export a bunch of vars from another namespace when my namespace is imported, should I use ns-utils/immigrate?
17:31raekbobhope: there is no perfect way of doing that in clojure
17:31bobhopeHere's my scenario
17:32bobhopeI want to provide a different numeric tower, so I want to use clojure.algos.generic +-*/
17:32bobhopebut make it so that anyone who includes my library will see those exposed to them as well
17:32bobhopeand they could even add their own extensions to those multimethods
17:32bobhopehow should I do this?
17:32raekif you use immigrate and redefine the vars in the source namespace, they won't be updated in the namespace into which they were immigrated
17:33bobhopeI'd be happy to cut & paste the code from clojure.algos.generic into my project and call it a day
17:33bobhopeis immigrate that functionality?
17:34bobhopeand is immigrate in clojure 1.3? It looked like it was only in the monolithic contrib
17:34raekbobhope: it is in monolithic contrib, i.e. not in 1.3
17:35raekhttp://dev.clojure.org/display/doc/FAQ
17:35bobhoperaek, can I use monolithic contrib and some clojure contrib 1.3 stuff?
17:35bobhopeI've never tried
17:35raek"How can I make a namespace A that "exports" all the public symbols from namespaces B and C?"
17:35brehautbobhope: i think its possible yes, if you dont mind a screed of warnings
17:36raekbobhope: no. there won't be any monolithic contrib for clojure 1.3. (and the one from 1.2 won't work in 1.3)
17:36bobhopeOk, I'll probably just reimplement the numeric tower the way I want it then
17:36bobhopeback to basics :)
17:37brehautah. its possible to use monolithic contrib with new contrib in 1.2
17:38raekyes. the new contrib libs are usually version independent. (some parts of monolithic aren't therefore monolithic as a whole isn't)
17:39raekbobhope: immigrate is pretty small, so if you really need to use it it's probably easier to just copy and paste it into your own code
17:42amrohi
17:42amroI seem to have broken lein
17:43amroException in thread "main" java.lang.NoClassDefFoundError: clojure.core.protocols$fn__5393
17:43amrothis after I installed some java stuff
17:43amroI'm not sure exactly what, I installed a few while trying to get jni.h
17:45mrevili there a way to set different environment variables when I running tests as opposed to development a environment? I need to control which database my noir tests connect to. How do I determine that code is being executed in the context of a test or swank? Ruby on Rails has 3 environments with different initialization scripts, is there something similar pre-baked into noir, clojure.test or midje?
17:48clj_newbare variables that start with _ reserved by clojure?
17:48clj_newblike _foo ?
17:49raekamro: are there files in your classes/ directory? if so, have you tried deleting them?
17:49raeksounds like you have old ahead of time compiled code lying around
17:49brehautclj_newb: ive never seen that in clojure code. do you have an example?
17:49clj_newbI want to define something like _Animal
17:49clj_newbwhich is a wrapper around Animal.
17:49clj_newbwhere Animal is a defrecord.
17:50RaynesThere is nothing special about underscores. That said, what you want to do is nuts.
17:50clj_newbRaynes: why?
17:51brehautto start with, why do you want a wrapper?
17:51clj_newbstyptype checking
17:51RaynesBecause Clojure isn't Perl. We like to use words instead of symbols.
17:51brehautstyptype?
17:51clj_newb*type checking*
17:52brehautclojure is a dynamic language; type checking is not idiomatic
17:53jodaroso i'm looking at clojure.tools.logging
17:53clj_newbbrehaut: I have never been able to write more than 10K LOC w/o typing.
17:53clj_newbbrehaut: Is there a list of good practices of "writing largescale clojure apps" ?
17:53bobhopetest your code
17:53bobhopewith unit tests
17:53bobhopeand automated tests
17:53jodaroin (defn log*, there is a line about using agents
17:53amroraek: I broke lein in general- it doesn't work at all
17:54bobhopeif your testing consists of running examples in a repl, or anything done by hand, it's called "experimentation", not testing
17:54bobhope;)
17:54jodaroand it says "for performance reasons, an agent will only be used when invoked within a running transaction ..."
17:54brehautclj_newb: write small, pure functions that can be easily reasoned about
17:54jodarois it particularly expensive to use send-off?
17:54brehautclj_newb: and leverage HoFs to not write as much code
17:56clj_newbwhat is HoFs ?
17:56brehautclj_newb: higher order functions
17:56brehautmap being a classic example
17:56clj_newbyeah; I think the problem is that I'm writing to write haskell in clojure
17:59amalloyhiredman: i have a terrible suspicion that Keyword was made non-final because it now contains non-final fields. those two things obviously shouldn't be related, but it's quite a coincidence otherwise
18:03blakesmithIs there an idiom to do the following more concisely?
18:03blakesmith&(map (fn [x y] [x y]) (range 10) (range 10))
18:03lazybot⇒ ([0 0] [1 1] [2 2] [3 3] [4 4] [5 5] [6 6] [7 7] [8 8] [9 9])
18:03brehaut(map vector …
18:04blakesmithOh, neato.
18:04blakesmithSince vector takes variable arguments...
18:05blakesmithSweet, thanks!
18:05blakesmithEr, variable argument length.
18:33Raynesbrehaut: ohai
18:33brehautRaynes: hello
18:33Raynesbrehaut: Feel like testing my Vim plugin for me?
18:33brehautRaynes: haha
18:34Raynes>_>
18:34brehautRaynes: i dont know how to use vim
18:34RaynesOh, I thought you were a vimmer.
18:34brehautRaynes: nope. just a pot stirrer
18:34RaynesHeh
18:34brehauti dislike all text editors :P
18:34Raynes:)
18:34brehautjust happen to dislike some less than others
18:34RaynesIt's unfortunate that I know so few vimmers.
18:35RaynesBut then again, I couldn't even get Emacsers to test my elisp when I wrote it.
18:35Raynes*cough* technomancy *cough*
18:38gunsRaynes: I'm in the process of streamlining my vim/clojure workflow. I wouldn't mind beta testing your software
18:39Raynesguns: It's at https://github.com/Raynes/refheap.vim if you want to give it a go.
18:40RaynesHaha
18:41technomancyalso, I wish the word "infidel" could be used more without bringing religious connotations into it
18:41technomancyit's a pretty good word.
18:41Raynestechnomancy: ARE YOU SAYING MY GOD IS FAKE?
18:42gunsRaynes: You may want to leverage the `autoload` plugin method to avoid load errors at startup
18:42brehautRaynes: not fake, just old fashioned and not self hosting
18:43technomancywhat; no, I'm not saying anything... let's just meet on Mt. Caramel with some altars and see whose gets lit.
18:43Raynesguns: I have no clue what autoload is.
18:43gunsRaynes: it's vim's lazy plugin loading system
18:44gunsGundo.vim is a pretty good example of a python plugin that employs autoload
18:45Raynesguns: It looks like I'd basically just put my stuff that checks if Python is loaded and my command! statement in the plugin stuff and the rest in autoload.
18:45gunsRaynes: yep. also, how to install pyperclip.py ?
18:46RaynesYou don't need pyperclip. Why did you think you needed that? :o
18:46RaynesOh man, did I include that?
18:46gunsline 33:
18:46gunsTraceback (most recent call last):
18:46guns File "<string>", line 1, in <module>
18:46gunsIOError: [Errno 2] No such file or directory: 'pyperclip.py'
18:46clojurebotTitim gan éirí ort.
18:47Raynesguns: That's an accidental commit. Hold on.
18:49Raynesguns: Pull again. Sorry, I forgot to commit some stuff (and accidentally committed other stuff).
18:51gunsGot a 413 (request too large) when trying to post ~24k lines (unicode table). Also, is refheap hosted on your server?
18:51gunsI suppose that's reasonable (too many lineS)
18:52technomancyas long as you don't get 418 when trying to upload coffeescript
18:52gunshaha. had to look that one up
18:53Raynesguns: Yes, refheap is hosted on my server.
18:54Raynesguns: Also, I guess the server doesn't like large requests. I have the maximum paste size capped at like 60KB, but this error wasn't because of that.
18:55gunsRaynes: it's not really your problem, but pbcopy/pbpaste is broken from within Tmux sessions. I get around that myself by using a clipboard plugin for rxvt-unicode
18:56gunsI'm not sure of a good way to solve it from your perspective though
18:56RaynesIt's a pain in the ass to copy stuff programmatically and have it work everywhere.
18:56RaynesYou can still copy the link though, at least.
18:56emezeskeguns: what is pbcopy?
18:57gunsemezeske: xclip for OS X
18:57gunsbasically
18:57emezeskeahh, gotcha
18:57emezeskeI was gonna suggest xclip :P
18:57Raynesguns: How large is your unicode table? In bytes.
18:58guns966360 bytes
18:59technomancyemezeske: hey, is there any specific reason you're publishing lein-cljsbuild using the emezeske group-id?
18:59Raynesguns: Yeah, that'd be way over what refheap is designed to accept. nginx is probably rejecting it before it even gets to me though.
18:59gunsRaynes: :) I was just stress testing
19:00Raynes:)
19:01gunsOtherwise, it all works quite well, visual selections and all. I would autoload, though, for people that move their .vim setup to different machines and don't want to easy_install * for every unix account
19:01RaynesYeah, I agree. I just didn't know about it until now. I'll definitely do that in a bit.
19:01RaynesThanks a lot for testing it.
19:01gunsnp
19:01RaynesClojurians vimmers are a rare breed.
19:08oakwiseRaynes: I'm one, but I just started down the dark road to emacs today
19:08oakwisethe propaganda got to me
19:08RaynesHeh.
19:08RaynesI'm actually a big Emacs fan. I'm just currently experimenting with other editors.
19:08RaynesWhich is good, since somebody had to write plugins for them for refheap.
19:09technomancyand pillage them for their good ideas?
19:10emezesketechnomancy: no specific reason other than... I don't know what I'm doing? :)
19:10Raynestechnomancy: Vim has a lot of good ideas. VimL isn't one of them.
19:10emezesketechnomancy: is there a preferred way to do that?
19:11gunsHaha. Vimscript is a real drop kick. It does have a map() fn, fwiw. no reduce though.
19:11oakwiseRaynes: "It's a pain in the ass to copy stuff programmatically and have it work everywhere" <-- does the * register not work?
19:11gunsoakwise: OS X doesn't use X SELECTION or CLIPBOARD
19:12technomancyemezeske: heh; sure, it's conventional to just specify lein-cljsbuild, which ends up setting the group-id to the same as the artifact-id
19:12gunspbcopy is the workaround for OS X, but not for people who use X on OS X (like me)
19:12oakwise"*y works for me on osx
19:12emezesketechnomancy: ahh, I did not know that
19:13technomancyemezeske: actually I just brushed up the plugin guide for Leiningen 2.0; I would love to hear your feedback on it since you're coming at it from a fresh perspective
19:13gunsoakwise: what terminal and what vim, I'm curious
19:13guns?
19:13technomancyhttps://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md if you get the chance
19:13oakwiseguns: I used to use pbcopy/xsel scripty workarounds, but * seems to work on my platforms now
19:13emezesketechnomancy: I'll definitely take a look, probably sometime today or tomorrow
19:13oakwiseiterm and...
19:14emezesketechnomancy: so, lein-cljsbuild depends on emezeske/clojurescript and emezeske/closure-library. should those be self-group-id'ed as well?
19:14oakwiseguns: vim 7.3
19:14Raynesoakwise, guns: I couldn't find a way to use Vim stuff to copy text that was obtained from an http response. Black magic.
19:14emezesketechnomancy: or does that matter?
19:14gunsOh, I see. The iTerm devs are pretty hardworking
19:14technomancyemezeske: no, if it's a library you didn't write then it's important *not* to have the group-id match the artifact-id
19:14gunsthey just added a bunch of tmux support I heard
19:15emezesketechnomancy: interesting, okay
19:15technomancyorg.clojars.emezeske is more common, but plain emezeske is fine too.
19:15emezesketechnomancy: cool, thanks
19:15technomancyemezeske: if you read TUTORIAL.md in the same directory as PLUGINS.md, it covers those questions too =)
19:15oakwiseguns: I just tried it in Terminal and it works fine
19:15emezesketechnomancy: so, having the group-id match the artifact-id is used to indicate the "canonical" source?
19:15emezesketechnomancy: awesome!
19:15technomancyemezeske: zactly
19:16gunsoakwise: /usr/bin/vim, and my copy of vim don't work that way
19:16gunsoakwise: do you compile with --with-darwin?
19:16technomancyemezeske: so there are a handful of things in those docs that only apply to leiningen 2, but for the most part it will apply to 1.x
19:16gunsI use --without-darwin, so that's probably my problem
19:17emezesketechnomancy: okay
19:17oakwiseguns: I think I may have compiled from source to get ruby support. Don't remember the flags.
19:19gunsoakwise: Yeah, they must have added OS X pasteboard support in the past couple of years. I switched to rxvt-unicode and started compiling vim without mac-specific features
19:19gunsBut then in my case, Raynes could still use the "* or "+ register to copy into my system clipboard
19:20gunsso perhaps you are right
19:20RaynesHrm.
19:21technomancyemezeske: I spent a few hours playing with cljs-one on Friday and most of it was spent wishing it used something like lein-cljsbuild =)
19:22emezesketechnomancy: haha, I wonder if I should ping those people to see if there's some way to coordinate
19:23technomancyI don't expect they would be particularly receptive.
19:23technomancyhttps://github.com/brentonashworth/one/issues/64
19:25technomancywhen I talked to Stu H at the conj he mentioned that he still doesn't use Leiningen in some cases because he thought it was lacking some basic feature that had been implemented since 1.1.0 or so.
19:25emezesketechnomancy: I did not know about checkout dependencies
19:25emezeskeyikes!
19:25emezeskeknowing about checkout deps is going to make my life easier
19:26ibdknoxemezeske: I'm with technomancy, I'm not sure you'll get very far with them :(
19:26oakwiseRaynes: vim.command("let @* = %r" % res)
19:26oakwisethat should replace the need for xerox I think
19:26oakwisealthough you may have to do some escaping (?)
19:27ibdknoxthey seem to like to reimplement things I've built :p
19:27emezeskeheh
19:27oakwiseguns: what does without-darwin get you?
19:27emezeskeibdknox: I kinda did that too with cljs-watch vs lein-cljsbuild :P
19:27gunsoakwise: better X integration
19:27emezeskeibdknox: don't hate me!
19:28ibdknoxemezeske: quite the opposite, I was being lazy and waiting for lein 2.0 before I did anything, now I don't have to :)
19:28gunsRaynes: remember, too that /usr/bin/vim on Lion is *not* compiled with "* or "+ registers, so you'll still need the pbcopy stuff
19:28emezeskeibdknox: haha, nice
19:29Raynesguns: Yeah, it seems like using xerox is the more general way to go here.
19:29ibdknoxI'll probably resurrect noir-cljs as soon as an official clojurescript goes up somewhere
19:29oakwiseah my bad
19:29emezeskeyeah, official cljs would be nice
19:49seancorfieldemezeske: i installed cljsbuild 0.0.4 as a global plugin and started to see AOT version compatibility errors - i didn't spend time tracking it down, just uninstalled the plugin (and will try again with a dev-dependencies entry) - just mentioning it as an FYI
19:50technomancy0.0.4? that's old news, man
19:50emezeskeseancorfield: yeah, cljsbuild (not lein-cljsbuild) is super broken
19:51emezeskethere's a bug in the clojure compiler that does not save the :macro metadata in class files
19:51seancorfieldi meant lein-cljsbuild - i was just being lazy typing
19:51emezeskeah, gotcha, there was actually a non-lein version for a while (that I wish I could eradicate)
19:51seancorfield0.0.4 was emezeske/lein-cljsbuild - nice to see you've switch to just lein-cljsbuild
19:52emezeskeI'll mess around with the global-plugin way and see if I can repro
19:52emezeskeI'd guess that the problem is the same as I mentioned (:macro metadata)
19:52emezeskeUnfortunately, it means that the clojurescript compiler cannot be AOTed. Well, it can, but it will not work correctly
19:53notsonerdysunnyIs there a way to have stacktrace at the time error display the whole thing instead of it cutting it at some point because it is too large..
19:54seancorfieldfwiw, it doesn't seem to happen with 0.0.6 as a global plugin
19:55technomancyemezeske: is it this bug? http://dev.clojure.org/jira/browse/CLJ-130
19:55technomancythat's been driving me crazy since forever.
19:55seancorfieldi just installed that and fired up a new swank / slime repl and ran the test that failed before and it didn't fall over :)
19:55technomancyI think the official line is "it will be fixed in the clojure-in-clojure compiler" =\
19:57emezesketechnomancy: very well could be
19:57emezeskeseancorfield: awesome, thanks for trying it!
20:00seancorfieldit'll be a while before i can really spend some time with it... i need to experiment with integrating with fw/1 at some point
20:01seancorfieldbut work's keeping me a bit too busy and we're not using clj for web front end stuff (yet)
20:01emezeskeseancorfield: I created https://github.com/emezeske/lein-cljsbuild/issues/10
20:01emezeskeseancorfield: if you come across any more AOT weirdness, please note it there
20:02emezeskehopefully, the problem will just never come back :)
20:04ibdknoxI really don't understand the argument against distributing cljs libs through maven
20:05hiredmanrich has some kind of objection to the forcing of a linear progression of versions on to a project (at least from what I hear)
20:06hiredmanwhich is part of maven's model I guess
20:06ibdknoxpeople can version things however they want?
20:06ibdknoxit can be a tree
20:06ibdknoxlol
20:06hiredmansure, but the way maven versions things doesn't account for a tree
20:07ibdknoxyeah. Is there some versioning scheme that does?
20:07hiredmanI am not sure really, I know he mentioned "maven tradeoffs" on the mailing list at one point, not sure if he ever elaborated on that
20:07hiredman(I think I responded asking for clarification, but I am still in the dark)
20:09hiredmanhttps://github.com/clojure/clojure/commit/59d3c724684c212fbb5eafaaaac30761c2c75a37 speaking of things I am in the dark about
20:10ibdknoxoh weird
20:16ibdknoxhiredman: there used to be a big performance gain with final classes, do you know if that's still the case?
20:17hiredmanI don't
21:26lynaghkDoes anyone know a clean way to check the arity of anonymous functions?
21:26lynaghkPreferably that works in ClojureScript.
21:27brehautthis is a guess, but unless there is metadata that tells you, there is probably no way to check arity of a clojurescript function, because there is no way to check the arity of a javascript function
21:27lynaghkYeah, I was thinking that too
21:27ibdknoxand functions don't have metadata in CLJS :(
21:28lynaghkI don't actually need the arity, I just need the more JavaScripty behavior of passing lots of args to functions with impunity
21:28ibdknoxhm?
21:28lynaghkBasically, let (#(vector %) 1 2 3 4 5) eval to [1] happily
21:29ibdknox(first %&)
21:29lynaghkChris, this is for an implementation of D3, actually.
21:29lynaghkI'm hoping I can let people write {:x #(whatever %)}
21:30lynaghkinstead of having to always catch both the datum and the index; {:x (fn [d idx] (whatever d))}
21:30ibdknoxah
21:30ibdknoxcljs let's you do that for free
21:30ibdknoxby accident
21:30ibdknoxunless that changed recently
21:31lynaghkoh
21:31lynaghkI was testing in a CLJ repl
21:31lynaghkgo figure.
21:31ibdknoxby virtue of the JS function implementation
21:31ibdknoxyou can pass in as many as you want
21:31ibdknoxand they just get ignored
21:32lynaghkSounds like some JS permissiveness is leaking into our glorious semantics.
21:32ibdknoxone of the many subtle differences between CLJ and CLJS lol
21:32technomancylynaghk: it used to work in 1.2; IIRC I opened an issue on that
21:32technomancyI'll let you guess what happened to the issue
21:32ibdknoxheh
21:32brehauttechnomancy: it was promptly fixed and closed
21:32brehautamirite?
21:32ibdknox~guards
21:32clojurebotSEIZE HIM!
21:32lynaghkI mean, I can see how arity checking of anon functions is a feature.
21:33technomancyit could be that it's something planned for the "dynamicity knobs"
21:33lynaghkIt makes sense in most cases; just this particular one where I'm expecting users to pass 'em in.
21:33ibdknoxlynaghk: yeah I just checked, that's what I did for my D3 clone
21:33ibdknoxand it seems to work
21:33brehautwhat is D3?
21:34lynaghkFor future-proof-ness and a clear indicator that it's a gross situation I might just do some try/catches.
21:34lynaghkIt's a DOM manipulation library focused on mapping abstract data to DOM elements.
21:34ibdknoxbrehaut: http://mbostock.github.com/d3/
21:34ibdknoxvery cool stuff
21:34ibdknoxyou can make really neat visualizations in it
21:34brehautoh! ive seen this. its very cool
21:35ibdknoxthere's a simple CLJS implementation of it in pinot
21:35technomancyI really wish we'd hear more about the plans for dynamicity knobs
21:35technomancysince it also seems to be blocking locals-clearing, which is needed for good debuggers
21:35ibdknoxtechnomancy: I really wish we'd hear more about plans.
21:35ibdknox:)
21:36ibdknoxbrehaut: a mere 77 lines! https://github.com/ibdknox/pinot/blob/master/src/pinot/draw/visualization.cljs
21:37lynaghkThe basic idea of D3 is pretty simple, yeah. Clojure's conciseness surely doesn't hurt either
21:37brehautibdknox: nice :)
21:37lynaghkI'm working on a D3-like library in Clojure(Script), and for a lot of visualizations the compiled JavaScript (including the cljs runtime) is half the size of minified d3.js
21:38ibdknoxlol
21:38lynaghkThen again, Bostock's library has a TON of great layouts, scales, &c.
21:39lynaghkThat's one of the nice things about Closure though; no need to worry about library bloat.
21:39brehautD3 is the successor to a similar library right?
21:39lynaghkProtovis was Bostock's earlier project
21:39brehautthats the one
21:39lynaghkit had a custom scenegraph implementation, which made it somewhat hard to debug.
21:40lynaghkibdknox, do you have any tips for writing Clojure targeting both cljs and the jvm?
21:41emezeskelynaghk: you can't do exceptions AFAICT
21:41lynaghkIf I do this try/catch hack around the arity, I'm not sure how to try to catch both kinds of errors without angering the runtimes.
21:41emezeskelynaghk: also, macros are very tricky to share
21:41lynaghkI think you can catch errors in cljs, they're all just js/Error.
21:42ibdknoxmy suggestion would be to write it for Clojure first, then worry about CLJS
21:42ibdknoxin terms of error handling
21:42ibdknoxthe best thing to do is probably to create your own macro that you then use everywhere
21:42ibdknoxand swap a single specific file out for each impl
21:42lynaghkmm, that makes sense
21:42ibdknoxbasically hide the differences in one file that changes and go from there
21:43ibdknoxotherwise it will be painful :(
22:17devna leaderboard in clojure -- ref or atom?
22:17devnsorted-map or sorted-set?
23:30devnis it possible to create a ref using sorted-set-by and have it continue to sort as items are conj'd onto the map?
23:30devnonto the set*
23:32devnit doesn't appear so.
23:35ibdknoxwhy would it being in a ref make a difference?
23:36devnidk -- but it doesn't seem to retain its sorting
23:37ibdknoxhm
23:37ibdknoxit worked for me?
23:39ibdknox,(let [r (ref (sorted-set-by >))] (dosync (alter r conj 4)) (dosync (alter r conj 1)) (dosync alter r conj 2))
23:39clojurebot2
23:39ibdknoxlol
23:39ibdknox,(let [r (ref (sorted-set-by >))] (dosync (alter r conj 4)) (dosync (alter r conj 1)) (dosync alter r conj 2) @r)
23:39clojurebot#{4 1}
23:40ibdknoxI shouldn't type code in IRC
23:40ibdknox,(let [r (ref (sorted-set-by >))] (dosync (alter r conj 4)) (dosync (alter r conj 1)) (dosync (alter r conj 2)) @r)
23:40clojurebot#{4 2 1}
23:42devnhm -- wonder what I'm doing wrong here
23:43devnibdknox: how about when conjing maps?
23:43amalloydevn: do it without refs, and then add refs in once you have it working. there is no way the refs are relevant
23:43ibdknoxdevn: ^
23:44amalloythen, if it works without refs but not with them, re-inspect how you added them, cause that'll be the part you did wrong
23:44devnfair enough -- im rewriting this anyway
23:44devni made a mess
23:45amalloyibdknox: i liked your broken examples, though. definitely an error it's easy to make *and* easy to miss proofreading
23:46ibdknoxyeah that last one is kinda scary
23:47ibdknoxhadn't really thought about the fact that that would just fail silently
23:50amalloyibdknox: proposed awful solution: (defmacro dosync [first & more] (if (coll? first) `(dosync* (do ~first ~@more)) `(dosync* (~first ~@more))))
23:51ibdknoxlol