#clojure logs

2012-02-21

00:00ibdknoxwhen you define a function with defremotes
00:00ibdknoxit's picking that up and storing it a reference to it
00:00tjgilliesim trying to make a system that performs a task x number of seconds after an event occcurs, i also want to add y to x if the event happens again so the task is performed (y +x) seconds after the most recent event
00:00ibdknoxthat way when you call a remote, it'll be able to call that function
00:00tjgilliesthe best way ive found to do timers is Thread/sleep but i don't know how to add to that time
00:00pandeiroibdknox: in some map? call the fn by a key?
00:00ibdknoxthe middleware intercepts those calls and does the right thing with them
00:00ibdknoxyep
00:03pandeiroibdknox: i dig low contrast schemes btw, maybe you could implement an "I'm blind" button that changes the css to all #000/#fff? i will use it when my eyesight is shot in a few years
00:04ibdknoxI'm considering adding a b/w theme to all my sites given how much people complain about real colors
00:04ibdknoxit's getting annoying
00:04ibdknoxlol
00:04TimMcScriptor: Where did you find "atom?"?
00:05ScriptorTimMc: it's in clojure.inspector apparently http://clojuredocs.org/clojure_core/clojure.inspector/atom_q
00:05TimMcOK
00:05ScriptorI haven't compiled it yet so not sure if it'll work
00:06TimMc,(meta (the-ns 'clojure.inspector))
00:06Scriptorhow do you fix the indentation of some highlighted code?
00:06clojurebot#<Exception java.lang.Exception: No namespace: clojure.inspector found>
00:06Scriptoroh come on
00:06Scriptor(in emacs for my question)
00:07TimMc,(meta (the-ns 'clojure.inspector))
00:07clojurebotnil
00:07TimMcbah
00:07pandeiroScriptor: you mean indent-region?
00:08Scriptorpandeiro: yep, just googled it
00:22alexbaranoskymuhoo, perhaps https://github.com/Raynes/tentacles ??
00:22lazybotalexbaranosky: Definitely not.
00:23tjgillieshow do you do (!= 3 4)
00:24Scriptortjgillies: (not= 3 4)
00:24tjgilliesScriptor: thnx
00:30amalloyScriptor: just press tab, right?
00:30amalloyfor what it's worth, C-M-q is bound to indent-sexp by default, and paredit adds M-q, which i love: reindent the whole function
00:31Scriptorooh, M-q sounds useful
00:31ScriptorI was looking for ways to indent sections of code rather than line-by-line
00:31Scriptorlike vim's =
00:33muhootentacles looks like interface to gitHUB API. i'm talking about raw git, no hub.
00:33amalloyScriptor: you'll want to get used to the sexp-oriented commands in emacs, like C-M-SPC to mark a sexp
00:35Scriptoramalloy: ah, didn't know about that one, that's really handy
00:35Scriptorthanks!
00:35amalloyhave a look at the output of `C-h a sexp RET` for all the commands with "sexp" in the name
01:07arohnerI don't suppose anyone remembers the idiom for mapping a macro over a seq of arguments, in another macro?
01:12amalloy`(do ~@(for ...))?
01:19arohneramalloy: yeah, I forgot about how 'do' is handled slightly differently. thanks
01:22arohnerand I forgot you could do (map #(my-macro %))
01:46Scriptorhuh, cljs just prints the code as it generates it
01:46ScriptorI guess it's captured somewhow
01:46Scriptor*somehow
01:46ibdknox,(doc with-out-str)
01:46clojurebot"([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."
01:47tjgilliesim getting a stack overflow when i run the last s-exp again after this compiles: https://refheap.com/paste/790
01:47ibdknox,(with-out-str (println "yo") (println "sup?"))
01:47clojurebot"yo\nsup?\n"
01:47ibdknoxScriptor: ^
01:47Scriptoribdknox: got it
01:50bbloomhas anyone worked with multi-repl environments? looking for kinda a survey of the practice: multiple hosts, environments, languages (clj vs cljs), etc. — I'm thinking I can hack something up pretty quick for my particular use case, but does anyone have any first hand tips?
01:50amalloythat soup of mutability is probably creating a circular reference somewhere, tjgillies, which causes a stackoverflow when you try to print it
01:51tjgilliesamalloy: the reason im moving to clojure is im tired of being a slave to improper state mentality ;)
01:52bbloomtjdillies: first order of business is to make new-neuron stop returning a ref
01:53tjgilliesbbloom: any particular reason?
01:53bbloomtwo reasons:
01:53bbloomfirstly, it's not it's responsibility
01:53bblooma "neuron" in your world is a map
01:54bbloomif someone wants a mutable pointer to a neuron, that's that caller's responsibility
01:54bbloomsecondly, you could pretty easily make a fully immutable neural net, with only a single top-level atom for the "current" net
01:55bbloomhowever, if you want to be able to reuse sub-nets you can't have circular references on the objects themselves
01:55amalloythe back-propagation (ie, cycles in the graph) make it a little bit more complicated than you're saying, bbloom, but in general that's true
01:55tjgilliesbbloom: whats easy for you is not easy for me
01:55bbloomso instead, split the graph into two parts:
01:55bbloomit's not easy for me either :-)
01:56bbloombasically, remove the subneurons from the neuron itself
01:56bbloommake a map of parent/child relationships
01:56bbloomthat lets you not mutate the nodes themsleves, only the mapping between them
01:56bbloomwhich eliminates the circular references
01:57tjgilliesbbloom: thnx
01:58RaynesSorry for spottiness in anyone who has been using refheap in the past few hours. I've been toying with fonts. Should be nice and stable now.
01:58hiredmanclojure.set has some useful functions for that kind of thing (building sets of maps with indices for fast lookup for values of certain fields)
01:59bbloomtjgillies: no problem! would love to check it out after you've reworked it. do come back and share
01:59georgekhi, I'm looking into prevalent style persistence, so far I've found Simple-Persistence, Prevayler, some other small projects...others?
02:00hiredmanhttps://github.com/hiredman/sunyata
02:03georgekinteresting! thanks hiredman, I've never heard of infinispan either
02:07emezeske_bbloom: regarding your question about multi-repl environments, I've been working on making things easier for ClojureScript: https://github.com/emezeske/lein-cljsbuild/blob/0.1.0/doc/REPL.md
02:07emezeske_bbloom: not sure if that is relevant to your question
02:07bbloomemezeske: looking...
02:09emezeske_bbloom: note: that doc is for 0.1.0 which I have not released yet
02:11bbloomemezeske_: I'm not sure this helps. I've already got a browser-connected cljs repl working. one issue is that I want my clj repl and cljs repl to share the same environment, so that I can eval defmacro forms & have the cljs repl pick up the new definition…
02:12bbloomI've been doing :cljs/quit
02:12bbloomand then (myapp.repl/repl)
02:12bbloomand running multiple repls
02:12bbloomand hacking around it
02:13emezeske_bbloom: that's an intersting problem, I haven't thought about that much
02:13emezeske_bbloom: definitely something to think about
02:14bbloomideally, i'd have one repl & be able to seamlessly eval code from my editor in the right env & namespace
02:14bbloomextra wrinkle: I'm a big time vim guy :-/ still kinda avoiding trying emacs/slime
02:14emezeske_how would the REPL know whether the code was clj or cljs?
02:14bbloomfiie extension? heh
02:14emezeske_heh, yeah, that makes sense
02:16bbloombetter yet: `:echo &filetype`
02:16emezeske_right
02:17bbloombut i had to hack the ftdetect for cljs anyway in vimclojure to detect *.cljs
02:17emezeske_yeah I have an autocmd to do that
02:17emezeske_meh
02:17bbloomthe vimclojure developer doesn't seem to monitor the github repo for pull requests& i haven't tracked him yet
02:18emezeske_thanks for the food for thought
02:18emezeske_I gotta go!
02:22tjgillieswow just by updating the variable instead of mutating the state i got rid of a lot of code
02:22tjgilliesi need to stop trying to use refs as objects in OO style
02:22tjgilliesits really tempting
02:22bbloom:-)
02:22amalloytjgillies: pretend you're working in a version of clojure that has no mutable state at all
02:23amalloyonce you've climbed up the walls for a couple hours over a particular problem and you feel state would solve it...go another hour, then ask in here if state would help
02:24amrogetting help from state is for communists
02:24amrowait what are we talking about?
02:24Scriptorhah
02:25tjgilliesClojure: state is for communists
02:27bbloomamalloy: I've found it useful to play a whiteboard game: draw an object graph & then figure out the absolute minimum number of new lines i have to draw to "mutate" the world: those are my vars/refs/atoms
02:28amalloythat number is always zero, at a certain level
02:28bbloombut that level is below practicality :-)
02:29amalloynot really. you can work entirely with immutable objects and have your only side-effects be input and output
02:29bbloomhence the existence of atoms/vars/refs ;-)
02:31bbloomof course you can. you can view the entire universe as a pure function of a previous universe… but it turns out that is a confusing way to model many problems
02:44tjgilliesi want to change the def of a variable from inside a function e.g. (defn foo [something] (def variable-name-of-something (assoc something :key value)))
02:45tjgilliesdo i want state for that?
02:48Scriptorwhee, first actual clojure project https://github.com/Scriptor/phunc
02:49tjgilliesScriptor: nice
02:49Scriptortjgillies: thanks :)
02:51bbloom tjgillies: I'm far from the expert, but i'd imagine you'd have two top level vars: 1 for the set of nodes & 1 for the set of edges. I'd probably make that two (ref) objects if you want to be able to coordinate updating both of them at once
02:54tjgilliesbbloom: im not so much working on a neural network for machine learning, but rather trying to model how a single neuron works on a biological level and how it triggers one or two neurons around it
03:22zawzeyhi, how do can you mix 2 defrecords of the same name in 2 different namespaces together. I tried to exclude the other defrecord using [:use other-namespace :exclude [defrecord-name]] but that doesn't work
03:29osa1is there a clojure library to inspect java AST ? like eclipse's AST library
03:32Fossihi all
03:42osa1I'm searching for a way to inspect some java code via AST. is there a library for it (like Eclipse AST but for clojure) or do I have to use ANTLR ?
03:51jtoyanyone using clojurescript, wanted to hear how you like it
03:54ibdknoxjtoy: I like it well enough :)
03:55jtoyibdknox: i saw you wrote some libraries, what do you recommend for doing some ajax ? I'm doing my first clojure in clojurescript, i haven't done much clojure
03:55ibdknoxI'm not sure that I would start learning Clojure with clojurescript
03:56ibdknoxI would go the other direction
03:56Scriptorjtoy: also, for doing ajax I think google closure provides just about everything
03:56ibdknoxbuuut the blog post I just posted today might be of interest to you: http://www.chris-granger.com/
03:56ibdknoxeh
03:56jtoyi currently don't need any clojure, i'm using ruby for backend stuff, but i do need to write some brand new js code
03:56ibdknoxI suggest not doing that lol
03:56Fossiyeah, <3 g closure
03:56ibdknoxfetch has very simple xhr in it
03:57Fossibut since you are using g closure anyway..
03:57Scriptorjtoy: learn clojure for your own stuff first, clojurescript is still newish and will be harder to deal with
03:57Fossiyou do, right? right? ;)
03:57jtoyoh, i saw that title on hacker news, but didn't read it, awesome
03:58jtoyhmm, ok , i guess ill wait on the clojurescript then
03:58ibdknoxfor someone brand new to Clojure, it's like to be a frustrating experience
03:59ibdknoxit's getting better every week
03:59ibdknoxbut it's definitely early days
03:59Fossiwhy?
03:59clojurebotWhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
03:59jtoyi did play a little with the clojurescript one stuff
04:00ibdknoxthe errors you get are completely unintelligible and often don't point to the actual problem
04:00jtoyi think clojurescript if clojurescirpt is ready to go out of the box, its the perfect gateway to doing a lot more clojure
04:00osa1what is the syntax for (import .. :as ..) ?
04:00osa1I've tried (import '[lib :as name]) but didn't work
04:00Fossiibdknox: didn't keep me from using clojure either ;)
04:00ibdknoxosa1: it's require, not import
04:00jtoysince you could use clojurescript in small amounts to start with
04:00ibdknoxFossi: this is far, far worse than Clojure
04:00raekosa1: import does not support :as
04:01raekso you're stuck with the java class names as they are
04:01osa1ok, thanks
04:01ibdknoxdon't get me wrong, CLJS is awesome. I just don't think it's the best starting point for someone :)
04:02Scriptorhow's cljs debugging nowadays?
04:02Fossiokay. last time i dabbled with cljs the problem was more getting oauth2 to run on node
04:02jtoyi just want to run clojurescript from my browser, not nodejs
04:03ibdknoxjtoy: well
04:03ibdknoxwhat I've done in that blogpost will show you some of that
04:03tjgillieswhats the point of clojurescript? if you want javascript, why not write javascript?
04:03Fossithen again, i have quite some clojure under my belt
04:04Fossitjgillies: because js is ugly ;)
04:04Fossiat least in some parts
04:04jtoywhats the point of clojurescript at all then? the only point for me to use clojurescript here is to learn some clojure, i don't like to code just for fun , i like fun/work mixed together :)
04:05tjgilliesi thought rich hickey was a big fan of saying superficial stuff like semicolons and how beautiful the language looks is bullshit
04:05tjgilliesits about constructs not artifcats
04:05tjgilliesartifacts*
04:05Fossitjgillies: i didn't mean visually
04:06Fossimore like in: type conversions, unexpected mutables, etc
04:06Scriptorjtoy: it's more for people already experienced with clojure who need to work with js, you can start with cljs for sure, but expect trouble from that extra hurdle, that's all
04:07tjgilliesclojurescript is a separate language from clojure for certain definitions of language anyway
04:07ibdknoxtjgillies: by that notion why use clojure at all?
04:07ScriptorI'd recommend at least getting set up with regular clojure, so you know what's clojure and what's clojurescript
04:07ibdknoxtjgillies: might as well just use Java
04:08tjgilliesibdknox: good point
04:08Scriptortjgillies: what's the point of using anything but C? ;)
04:08tjgilliesibdknox: im a fan of java though ;)
04:08Fossiassembler
04:08Fossimachine code
04:08Fossiraw power
04:08ibdknoxlol
04:08Fossioh, wait ;)
04:08aperiodicbah, i edit inodes by hand with magnets
04:13zawzeysorry i got d/c
04:13osa1how can I list all methods/fields of a class in clojure?
04:14zawzey(use 'clojure.reflect 'clojure.pprint) (pprint (reflect "hello"))
04:15osa1zawzey: thanks
04:15raekosa1: if you use emacs, you can use C-c I
04:15zawzeyhi, how can you mix 2 defrecords of the same name in 2 different namespaces together? I tried to exclude the other defrecord using [:use other-namespace :exclude [defrecord-name]] but that doesn't work
04:16osa1raek: it's output is unreadable
04:16osa1raek: full of T__x's
04:17osa1yeah looks like reflect just printed same thing with C-c I
04:18zawzeyosa1: is that a java class? u can enter (pprint (refect obj))
04:19osa1it's a class generated by antlr
04:20osa1(pprint (.getMethods (.getClass obj))) worked fine
04:32fbuhi, i'm struggling with clojure and jna
04:32fbuis it the right place to find help ?
04:35callenwould anyone be willing to toss me a hint or a train of thought to follow for http://www.4clojure.com/problem/21#prob-title ? I've been pondering using the for or while macros.
04:36amalloyneither of those are good choices, i'm afraid
04:36amalloycallen: for can only look at one element at a time, so it can't know when it's done. while could conceivably work but side effects are evil
04:37amalloypersonally, i like to solve the earlier 4clojure problems with just raw recursion, no interesting library functions, because that's something i need more practice on
04:39lypanovwhats the current suggested way to do "project in project" dev?
04:39callenamalloy: that's what I'm trying to do, is avoid side-effects. the obvious answer is nth. I'm wondering if I should be doing a fold or reduce or something.
04:39callenit feels like that kind of problem.
04:40amalloya reduce would be fine - anytime you want to produce one result from a collection, that's not a terrible choice
04:40lypanovas in, i need to edit the source to a project i depend on. i'm using leiningen. lein deps is so incredibly slow its making my work flow very difficult.
04:40amalloyit's not very appropriate to this particular problem since you have to walk the whole seq, but it would work
04:40amalloyeg, (fn my-nth [coll n] (if (zero? n) (first coll) (my-nth (rest coll) (dec n))))
04:41raeklypanov: would checkout dependencies work in your case?
04:41callenamalloy: a recursive solution with a countdown. That's much better.
04:41amalloythe zeroth element of a seq is just its first, and otherwise you can look up the N-1th of all but the first
04:41lypanovraek: as in git submodules? or thats something else?
04:41callenamalloy: I kinda wish you hadn't shown me that though :(
04:41lypanovraek: in rails/bundle i just say "gem in path". just need that.
04:41raekno, you can add symlinks to the source of other projects to the checkouts directory
04:41amalloyso now solve it with reduce
04:42lypanovah!
04:42callenamalloy: hokay.
04:42lypanovraek: something to google for :D trying!
04:42amalloythe fun part of 4clojure is you can solve the problem any way you want, whatever challenges you currently. or, whatever's easy for you currently if you need a break
04:42raekyou still need the dep in the project.clj, and it has to exist in a repo
04:42lypanovraek: (google suggested completion on checkout dependencies -> leiningen)
04:42raeklypanov: it's in the leiningen readme or tutorial
04:43lypanovyup just reading now thanks for the pointer!
04:43raekalso, lein deps should only be slow when you have SNAPSHOT deps
04:44raek(since it will look for new versions then)
04:51lypanovraek: i have lots of SNAPSHOT deps. that explains. thx for info.
04:51callenamalloy: uh...I found a way simpler/faster solution.
04:51callenamalloy: just use vec.
04:51amalloydrop/first?
04:51lypanovraek: checkouts works perfectly. thank you! already making progress :)
04:51callenamalloy: no, I think vec is better.
04:51amalloy#((vec %) %2)?
04:51callenamalloy: that's not how I wrote it, but it's the same idea.
04:52amalloythat's definitely not faster
04:52callenamalloy: no? oh.
04:52callenamalloy: is the conversion to vec slow or what?
04:52callenI can't imagine the fetch from the vec is the slow part.
04:52amalloyit has to look at every element
04:52callenso the conversion is O(n) is what you're saying.
04:52amalloyyes
04:53callenthe (first (drop... solution would be equivalent to yours, I believe.
04:53amalloy*nod*
04:53callenin the sense that it's going to look at some value less than n of the data structure.
04:53callenamalloy: thanks for batting this one around with me. I feel more comfortable with it now.
04:54callen4clojure is so amazing...
04:54callenevery language should have this.
04:54callenit's like inverse Stack Overflow.
04:55amalloyit's a lot more like SO, for the people who answer questions instead of asking them :P
04:55lypanovcallen: http://euler.net/
04:55callenI know about project euler
04:56callenI just don't care for it.
04:56lypanovy?
04:56callenpreference.
04:56amalloyproject euler is a great tool. but if you want something less-mathy and more language-tailored/hand-holdy, 4clojure is more for you, i suspect
04:57callenI don't want hand-holdy per se, I just don't like the mathiness of it.
04:57callenif it's going to be abstract, I'd rather it not seem custom-made for Haskell programmers.
04:58amalloy*boggle* what about project euler is abstract OR haskelly?
04:58amalloyit's all very concrete
04:58ScriptorI think he means the mathiness of it, which some equate with haskell's math focus
04:59Scriptorwell, not focus
04:59Scriptormathematical nature
04:59callenI might've misused the term abstract, I wouldn't fixate on that too much.
04:59Scriptorif I use binding to rebind a function f to something else, but call f inside the new function, will it use the old value of f or the newly rebound one?
04:59callenHowever, the puzzles appear to have been designed to give Haskell users an excuse to gloat about their lazy language.
05:00amalloyheh. i've done that too, but for clojure
05:00lypanovamalloy: aye maybe i should try it also i did a fair few euler tasks a while back in clojure but still find basic programming tedius because of my lack of knowledge of eg using other projects, string manip, etc.
05:00amalloymost of the euler problems can easily be done in terms of sequences
05:00callenplenty of ways to do infinite/lazy seqs in Clojure, but it seems like Haskell users do a lot more crowing about their laziness.
05:00callenit seems to be taken for granted that laziness is an option in Clojure.
05:00Scriptorbecause the whole language is lazy, so it's often emphasized
05:00raekScriptor: I don't think so. (defn foo [] ...) expands to (def foo (fn foo [] ...)) -- note the extra foo
05:01Scriptoryea...dammit
05:01raekinside the function, foo will always refer to this particular function
05:01ScriptorI guess if I did (def bar foo) beforehand I could use bar?
05:04raekScriptor: sorry I answered your "X or Y" question with a "no", I misinterpreted it a bit
05:04amalloyfunny coincidence, because i suspect Scriptor is asking an XY problem: "i'm trying to do X, and i think the solution is Y, how do i do Y?"
05:04raekyou wonder what happens if you have (defn ^:dynamic *f* [] ...) and (defn g [] ... *f* ...) and then do (binding [*f* g] ...)?
05:05amalloywhy do you want to rebind f and have it call itself? memoized self-calls?
05:06Scriptorsomething like python's decorators, have a function that intercepts the call to the function you want, do something else, and then continue the call
05:06amalloyblech
05:06ScriptorI don't think it'll do what I need anyway
05:07raekprobably better to change to root binding in that case
05:07raekScriptor: have you checked out technomancy's robert.hooke library?
05:08amalloy(defn wrap-logging [name f] (fn [& args] (pr-str (cons name args)) (apply f args))) (def logged-inc (wrap-logging inc)) (logged-inc 1)
05:08raekits focus is a bit different from python decorators, but I think you can achieve the same thing
05:08amalloyor, i guess it's (def logged-inc (wrap-loggin 'inc inc))
05:08Scriptorraek: nope, I'm still trying to figure out if anything like decorators is even what I want
05:09amalloyScriptor: the usual functional way to wrap things is just creating a function. it takes a function in, and returns a new function with the wrapped behavior (see above)
05:11Scriptoramalloy: yes, but that'd require changing the code that called the original function in the first place to call the HOF I just created, right?
05:12amalloyyes. you don't want to mutate the underlying function; it will wreak havoc with library code in general, and readability as well
05:12Scriptoryea, that's why I'm dropping the idea, it's hard to predict the results
05:13Scriptorno wonder everyone picks javascript as a target, its anonymous functions makes emulating some things really nice
05:18amalloyyou're looking at it upside down: many languages provide tons of heavy tools to help you emulate functions
05:18amalloy(i'm just trolling, mostly)
05:20callenamalloy: java.lang."I'm" cannot be cast to clojure.lang.IFn
05:20callenamalloy: [Thrown class java.lang.ClassCastException]
05:20callens/I\'m/i\'m/
05:21callenI still say -> and --> should be named little winnie and big win.
05:21callenshort for "winchester"
05:21amalloy->>
05:21callenor that.
05:21calleneither way, loading data into a cannon and firing it.
05:22amalloyjust makes me think of honey-loving bears
05:25callenI don't think that'd be a negative association to make with Clojure.
05:25callenI will say this though, we need to start a petition to get Hickey to grow a beard.
05:26callenClojure cannot possibly be taken seriously until Hickey is bearded up.
05:26kitofrw0rd
05:27callenwe don't want to fall by the wayside like Prolog.
05:28callenhttp://i.imgur.com/9e9Pp.jpg not enough hair.
05:29callenjust found the Fogus interview, it doesn't surprise me that Hickey was a music comp major. Musicians seem to make the best programmers.
05:31Scriptornot the best commenters, though :p
05:32callenScriptor: *scratches head and laughs* perhaps. :)
05:32callenit's my greatest regret that I never really mastered a musical instrument.
05:32Fossinever too late :>
07:53samaaronafternoon all
09:03timvisherhi all
09:06timvisheri seem to remember there being a function or macro that allowed me to list about a bunch of functions that were to be applied to an argument so that (f a b c d) would be become a( b( c(d)))
09:06timvisheri that ringing a bell for anyone else?
09:06timvisheris*
09:09raektimvisher: maybe 'comp'?
09:10timvisherraek: exactly!
09:10timvisherthank you
09:10timvisher:)
09:10TimMctimvisher: Specifically, that would be ((comp a b c) d)
09:10raek(comp a b c d) = (fn [& args] (a (b (c (apply d args)))))
09:19jsabeaudryI want to execute a sequence of actions, and I want that sequence of actions executed in a thread to be pausable, resumable or cancellable. Anyone has ideas on which facilities would be most appropriate for this?
09:23stuartsierrajsabeaudry: Agents can do that. Example: http://stuartsierra.com/2010/01/08/agents-of-swing
09:24stuartsierraIf you actually want to be able to pause a thread mid-calculation, you can't do that.
09:26jsabeaudrystuartsierra, thanks for writing that blog post, I'm off to devour it
09:26stuartsierrajsabeaudry: You're welcome. That post has frequently been useful to me.
09:47beffbernardHow do you inspect what classes an object implements?
09:48beffbernard…through the REPL
09:52vijaykiran(supers java.lang.String)
09:52vijaykiran,(supers java.lang.String)
09:52clojurebot#{java.lang.Comparable java.lang.CharSequence java.io.Serializable java.lang.Object}
09:52vijaykiranbeffbernard: ^^
09:57beffbernardvijaykiran: cool, thanks
09:58beffbernardvijaykiran: What about things that can't be casted into java.lang.Class? Like what a function implements
10:02cemerick,(ancestors (class #()))
10:02clojurebot#{clojure.lang.AFn clojure.lang.AFunction java.lang.Runnable java.io.Serializable java.util.concurrent.Callable ...}
10:02cemerickbeffbernard: ^^
10:03beffbernardcemerick: thanks
10:17octejava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn
10:17octewhy would i get that when i try to use 'name' on they keyword :unknown?
10:18octei can do it in the repl, but inside my function it throws that exception on the line
10:18octeprinting the (class thevar) verifies that it is a keyword
10:18octeprinting it with println prints :unknown
10:19tmciverocte: name returns a string; perhaps you trying to store it in a list without quote?
10:19TimMcocte: Because you have a local binding called "name"
10:19tmciver,((name :unknown))
10:19clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>
10:19octeof course TimMc!
10:19octethat's the problem, hah
10:19tmciverTimMc: sniped!
10:19TimMc:-)
10:20TimMcExperience gives you psychic powers.
10:20octeyes
10:20octethanks :)
10:20TimMc(experience in writing that same damn bug in one's own code over and over)
10:20tmciverTimMc: ah, that must be it. I write code without bugs. ;)
10:21TimMchaha
10:21TimMcHow will you ever learn, then?
10:22gtrak`anyone made an overtone interface for android multi-touch yet?
10:23bitrotgtrak`: There's TouchOSC for android
10:26gtrak`ah
10:28gtrak`perfect. I'm going to be having fun the next few weeks. overtone is awesome
11:11kijHi, whats a good way to interact with git repos from clojure ?
11:13vijaykirankij: clj-jgit
11:13vijaykiranit isn't complete, but you can commit - get logs etc.
11:14kijvijaykiran: Perfect - thanks!
11:19drewrb
11:19drewrsry
11:55dnolenhmm, I don't suppose there is a Clojure style guide anywhere on Confluence
11:57TimMcdnolen: I've seen one for lib contributors.
11:58TimMcCan't say as I agreed with everything.
11:58ibdknox|awayme neither
11:58ibdknox|awayunwrapping options is an anti-pattern
11:59dnolenah http://dev.clojure.org/display/design/Library+Coding+Standards
12:00dnolenthat list could use a little more meta organization
12:03TimMcdnolen: http://dev.clojure.org/display/design/Library+Coding+Standards perhaps?
12:03dnolenTimMc: yeah I found it :)
12:07TimMcibdknox|away: I wouldn't object if there were a mapply in core.
12:08TimMcMaps are the weird two-headed uncle of the collections family.
12:53scour! (+ 11)
12:54scourclojurebot: (+ 1 1 1)
12:54clojurebotIt's greek to me.
12:54gfredericks,(+ 1 1 1)
12:54scour(π ∂)
12:54clojurebot3
12:55scour^^^^^-___-%%%%%%
12:57AimHere,',(+ 3 3)
12:57clojurebot(+ 3 3)
12:57AimHere,"!(+ 3 3)"
12:57clojurebot"!(+ 3 3)"
12:58AimHereGah
12:58mdeboard,(identity ಠ_ಠ)
12:58clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ಠ_ಠ in this context, compiling:(NO_SOURCE_PATH:0)>
12:58mdeboard:-\
12:59ibdknox|awayTimMc: mapply? what would that do exactly?
12:59scour^_^
12:59ibdknox|awayTimMc: my problem with unwrapping option maps is that it completely breaks ->
13:00AimHere.(println ",(println 345)")
13:07scourseyton!
13:10Luyt_For clarity, http://dev.clojure.org/display/doc/Getting+Started+with+Cake could mention that cake and lein were merged; I learned this from the bottom answer on http://stackoverflow.com/questions/3906276/whats-the-difference-between-cake-and-leiningen
13:10muhoowhat's the difference between comp and -> ?
13:11dnolenmuhoo: comp is a function, -> is macro
13:13gfredericks(-> x foo bar) will actually call (bar (foo x)), while (comp bar foo) will just return you a function that you could pass x to
13:14muhoooh, ok. thatnks.
13:15muhoothat makes a lot of sense, hence the name "composition"
13:15gfredericksyep
13:16muhooso instead of (defn fu [x] (-> bar baz quux)), i could do (def fu (comp bar baz quux)) ?
13:17muhoosorry (defn fu [x] (-> x bar baz quux))
13:17Bronsayes
13:17gfredericksyes except in comp the order is reversed, so (comp quux baz bar)
13:17Bronsabut this way you'll lose some metadata
13:17muhooah, thanks
13:17gfredericksI think a lot of people prefer -> over comp when all else is equal, since the order is more readable
13:17Luyt_Hmmm, I added it myself. Long live Confluence!
13:19muhooagree i, important usually is order the
13:20muhooBronsa: which way loses metadata?
13:26gfredericksoh I think he meant using def instead of defn
13:26muhooaye
13:27gfredericksI believe defn adds a bunch of metadata and def does not
13:30muhooyep, like the source
13:32TimMcibdknox|away: (mapply f a b {:c 3, :d 4}) => (f a b :c 3 :d 4)
13:33TimMcibdknox|away: (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))
13:33TimMc(Dare you to make that point-free.)
13:33ibdknoxTimMc: I see
13:33ibdknoxthat would be nice, but nicer would be just not unwrapping them :p
13:34gfredericksibdknox: would that same argument apply to varargs in general?
13:34TimMcIt's a Haskeller! Get him!
13:34ibdknoxno, I don't think so
13:34ibdknoxvarargs aren't affected by ->
13:35ibdknoxat least not in the same way
13:35muhoo,guard
13:35TimMc(-> {:c 3 :d 4} (mapply f a b c))
13:35ibdknoxthough that's because of idiom, mechanically they have the same issue
13:35clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: guard in this context, compiling:(NO_SOURCE_PATH:0)>
13:35ibdknox~guards
13:35clojurebotSEIZE HIM!
13:38dnolenit's funny how often native-deps crops up
13:38gfrederickscljsbuild keeps having file permission problems when writing its crossovers :/
13:40ibdknoxI've not used crossovers
13:40ibdknoxso I'm no help :(
13:41gfredericksI've been looking at the code lately, so maybe I'll be able to diagnose/fix myself
13:45emezeskegfredericks: what version are you using?
13:52emezeskegfredericks: I changed cljsbuild to set its crossover output files as RO, which made it barf the next time it tried to overwrite them X_X
13:53emezeskegfredericks: I... released that?
13:56gfredericksemezeske: :plugins [[lein-cljsbuild "0.0.13"]] is what I have in my project.clj
13:57gfrederickscljs doesn't like two NSes in one file does it?
13:57emezeskegfredericks: bah! that "feature" did get released in 0.0.13
13:58gfredericksemezeske: at least the number was appropriate
13:58emezeskeI probably released it on a fridy!
13:58emezeskeI should probably do a quick 0.0.14 release to fix that, that's bad...
13:59gfredericksemezeske: on another note, I think my JS-API idea would work as a simple macro if cljs would allow me to emit a ns
13:59gfredericks(rather than a cljsbuild feature/add-on)
13:59emezeskegfredericks: oh, awesome
13:59emezeskegfredericks: I was thinking about whether that could be a macro, but wasn't sure
14:00gfredericksunfortunately I want it to work right now, so I'm debating what the easiest way to do that is
14:00gfredericksI could write a cljs source file from within my macro! that'd be a totally normal thing to do
14:00gfrederickseverybody writes to files from their macros
14:02emezeskehaha
14:03emezeskegfredericks: I just pushed a 0.0.14 branch of lein-cljsbuild
14:03emezeskegfredericks: Might you be able to pull that down and test it?
14:03gfredericksyou betcha
14:03emezeskegfredericks: I could also upload it to clojars if that would be easier
14:03ibdknoxapparently building ocaml is extremely taxing on my poor little laptop
14:04gfredericksmaven barfed; seems to think it can't find 0.0.14
14:05emezeskeibdknox: Hey, great job on your overtone thingie by the way
14:05gfredericksoh
14:05gfredericksyou just explained that
14:05gfredericksI read the words but didn't put too much effort into inference
14:05emezeskehaha
14:05ibdknoxemezeske: thanks :)
14:05gfredericksemezeske: yes well I don't quite know how to use it otherwise; so if you want me to test, either upload to clojars or explain me how to use it from its repo
14:06emezeskeibdknox: I'm sure you noticed, but lots of people have been wanting to see how to put together a *simple* project like that
14:06emezeskegfredericks: oh, I'll upload it then, one sec
14:06shaolynnAny VimClojure users in here? I get the following error when I try to start the REPL:
14:06shaolynnCould not determine the Namespace of the file.
14:07emezeskeibdknox: as opposed to some of the more.. heavy-handed massive examples of working applications that are hard to distill for a beginner
14:07ibdknoxemezeske: yeah, that's why I built it :)
14:07emezeskegfredericks: okay, give it a shot now
14:08emezeskeibdknox: You picked a cool example project, too -- not too much code, but you get a really neat result
14:08emezeskeibdknox: Not just another blog engine or something
14:09ibdknoxpfft who wants to build boring things? ;)
14:09gfredericksemezeske: Unable to resolve symbol: temp-file in this context
14:09gfredericks(cljsbuild/core.clj:147)
14:09pbostromI'm wondering if I can do the following in cljs without eval or load: I have a file on my server with some forms: (def foo {:a 1 :b 2}) (def bar {:c 3 :d 4}), I want to fetch the contents of the file from my cljs app, and, well, load them
14:10emezeskegfredericks: derp.
14:10gfrederickspbostrom: so you want to use the reader?
14:10gfrederickspbostrom: or you want it to run the code as well?
14:11gfredericksif you want it to run the code, that requires the compiler and so can't be done from cljs; but if it is always of the form (def x y), then you could perhaps handle that manually without much trouble
14:12shaolynnproblem solved - VimClojure doesn't work with clojure 1.3.0 - switched to 1.2.1 and now it's fine.
14:12emezeskeshaolynn: I use VimClojure with 1.3, no problem
14:13emezeskeshaolynn: The jar I use is [org.clojars.oskarkv/lein-vimclojure "1.0.0-SNAPSHOT"]
14:13ibdknoxshaolynn: that latest one does
14:13shaolynnemezeske: thx! I'll try that right now.
14:13emezeskeshaolynn: actually, ibdknox I think has a better one maybe
14:13emezeskeshaolynn: (like, it might get updated ever)
14:15emezeskegfredericks: ok, try 0.0.14 again. Since I'm dumb and didn't use a SNAPSHOT, you might need to "rm -rf ~/.m2/repository/emezeske/"
14:15gfredericksemezeske: what, no 0.0.14.1?
14:15gfredericks^ joke
14:15emezeskeO_o
14:15gfredericks:)
14:16the-ignoratihow should I route a url to a static file with compojure? should I just use slurp?
14:16gfredericksno there's a thing or something
14:17weavejesterthe-ignorati: It depends how the file is stored
14:17shaolynnemezeske: it works :D
14:17weavejesterWhether as a resource, or a literal file
14:17emezeskeshaolynn: okay, good!
14:17the-ignoratias a resource
14:17weavejesterYou can return a java.io.File or java.net.URL object from a Compojure route
14:17weavejesterSo (io/resource "blah") will work
14:18emezeskeTimMc: Nice, now I can use a mechanical selector for your library versions, and it will be robust
14:18gfredericksemezeske: I think I might be having trouble clearing the cache -- can you give me a hash for the jarfile?
14:18emezeskegfredericks:
14:18TimMcemezeske: No more bounce errors when dialing up the version!
14:18weavejesterYou can also use (route/resources "/") to serve all static resources in "/public"
14:18emezeskegfredericks: oh, I told you to delete the wrong dir
14:18gfredericksoh noes! was it my os?
14:18emezeskegfredericks: rm -rf ~/.m2/repository/lein-cljsbuild ~/.m2/repository/cljsbuild
14:18pbostromgfredericks: I want to run the code so that foo and bar are available as symbols in my cljs app, but I'm thinking I'll have to use some workaround like read-string a giant map string or something: {:foo {:a 1 :b2} :bar {:c 3 :d 4}}
14:18ibdknoxyou just deleted /usr
14:19emezeskegfredericks: haha
14:19ibdknoxgfredericks: you're screwed
14:19emezeskegfredericks: I forgot the jars are released under their own GIDs instead of emezeske
14:19the-ignoratithanks
14:20gfredericksalright here we go again
14:20emezeskework!
14:21gfredericksoh it totally works
14:21emezeskeexcellent!
14:21gfrederickswe've all released that bug before
14:22emezeske^_^
14:22gfredericksactually I've never written a useful library on which to release bugs
14:23ibdknoxI accidentally pushed a version of Noir in which routes didn't work at all once lol
14:23ibdknoxkind of defeats the purpose really
14:23emezeskerofl
14:23emezeskemakes me feel better ;)
14:23gfredericksgit commit -a -m 'no more routes'
14:24ibdknoxgit commit -m "no ones needs to build sites anyways..."
14:25devngit commit -m "Remove all useful functionality"
14:26gfredericksmakes it more secure, really
14:26gfredericksrm -rf ./* && git commit -a -m "no more bugs"
14:27devnhaha
14:29gfredericksI am becoming increasingly confused as to what cljs lets you do with (ns)
14:30gfredericks(do (ns foo.bar) (defn baz [] 8)) has weird results
14:30gfrederickseven though the compiler seems to treat it as a regular special form
14:31ibdknoxit's safe to assume that you can only use (ns ..) at the top level
14:31gfredericksoh it defines baz in the old namespace....hrmmm
14:31stuartsierra`ns` is totally a special case in the CLJS compiler.
14:31ibdknoxyeah
14:31gfredericksI suck at reading the compiler then
14:31gfredericksokay, back to writing to files from macros
14:32TimMcibdknox: At the top level or the "top level"?
14:32ibdknoxhm?
14:32TimMcibdknox: The CLJ compiler collapses (even nested) (do ...) forms at the top level so that their contents are top-level too.
14:33TimMcI guess CLJS isn't doing that?
14:33ibdknoxcorrect
14:33gfredericks"doing that" HA
14:33TimMcHAR
14:34devn"Don't do dat."
14:36emezeskeI think "top level" literally means "at the top of a file"
14:37ibdknoxyeah
14:37ibdknoxin this case
14:37gfredericksis it correct that the ns more or less has to be implemented that way so that goog.provide is only called once?
14:38ibdknoxyep
14:38gfredericksoh well I guess you could maybe allow for more ns's per file as long as you never repeated...
14:41ibdknoxhas anyone built jark from source before?
14:53muhoo~awesome
14:53clojurebotawesome is retiring
14:56muhooheh. well, i guess this is pretty awesome: http://awesome.naquadah.org/images/6mon.medium.png note the recursion there too
14:56ivanit's too bad the java code in Clojure is a horrific mix of tabs and spaces
14:57bsteuberI think there should be an rcons function
14:57bsteubersometimes one just has to append single elements to a seq, even if it is slow
14:58bsteuberand then, it should follow ->> convention
14:59bsteuberbecause now, I have to write
14:59bsteuber(->> xs (map foo) ((fn [xs] (concat xs [42]))
14:59osa1is there a way to define functions for namespace from multiple files?
15:01devnthis Atea thing is pretty neat.
15:01arohnerosa1: you can use in-ns or contrib.with-ns
15:01ibdknoxbut don't do that
15:01osa1devn: yeah, I need a KDE version of it
15:01osa1ibdknox: why?
15:01devnosa1: i was just interested to see that it was for OSX honestly.
15:02devnive never seen people take clojure and distribute as DMG with native UI stuff.
15:02ibdknoxbecause you won't be able to require it
15:02osa1ibdknox: why? then what's `in-ns` function for?
15:02ibdknoxyou're breaking the pattern that a file exists for that namespace
15:03ibdknox,(source ns)
15:03clojurebotSource not found
15:03ibdknoxmeh
15:03ibdknoxosa1: it's part of what (ns ..) does, but that's primarily for use in the context of a repl
15:11stuartsierraosa1: Do you want to split the content of a namespace across multiple files? You can use `load` to do that.
15:13brehautivan: from memory, i think the java code in clojure is in the whitesmiths indent style.
15:14ivanbrehaut: true. I'm just complaining about the tab/sp mix. I'll just pretend that tabs are 4 spaces or use IntelliJ's reformatter
15:16amalloyi don't think there's any particular named style for the atrocities in clojure's java code
15:17Scriptorhahaha
15:17Scriptorha
15:17brehautlets just assume that its a disincentive for anyone to add new java code
15:18TimMc"ugly things should be ugly"
15:18hiredmanI dunno, it doesn't really seem to be any more or less readable than general java code
15:18gfredericksTimMc: go in there and start mixing underscores and camelcase in the variable names
15:20Raynesamalloy: I think it's called omgwtfdude style.
15:20brehauthiredman: java is a disincentive to write any more java code too though
15:21amalloyhiredman: have you done much java programming? maybe i'm just spoiled by having worked primarily with the much more popular K&R-based styles, but i have a terrible time reading that stuff
15:21amalloy(compared to if it were formatted more familiarly)
15:22amalloybrehaut: you're right though, it's pretty close to whiteheads, according to wikipedia. the main difference seems to be the curiously-placed {s
15:22brehautperhaps we can blame the difference on time spent with C++ ?
15:22weavejesterWe'll probably need to wait for Clojure-in-Clojure before we can get a nicely-formatted compiler :)
15:24aidyis there an idiomatic way to do error handling in clojure?
15:24dnolenweavejester: CLJS compiler is already nicely formatted ;)
15:24muhooare there any examples of music made with overtone anywhere?
15:24TimMcaidy: Avoiding it.
15:24hiredmanamalloy: not a lot, and I would generally stick with a k&r style myself, the hard part about reading the compiler is not figuring out what lines up where
15:24amalloy*chuckle* true enough
15:24aidyTimMc: just returning false?
15:24RaynesTo be fair, clojure.core isn't really nicely formatted sometimes.
15:25amalloyi guess the style mostly bothers me when i want to edit/commit, not just read
15:25weavejesterCLJS hasn't been something I've looked into a lot… I have this irrational perception that it's somehow less than Clojure.
15:25samaaronmuhoo: the best examples are in the examples dir in overtone itself
15:25hiredmanweavejester: well, it is
15:25RaynesWell, I guess I can't say it isn't formatted nicely. Just inconsistently.
15:25samaaronmuhoo: there are other bits and pieces linked in the mailing list
15:25TimMcaidy: What I mean is, it isn't idiomatic to catch and inspect exceptions in Clojure.
15:25RaynesThere is some vim-like indentation in there as well as plenty of Emacs-like indentation.
15:25TimMcaidy: You can throw them all you like.
15:25samaaronmuhoo: one day we hope to have a gist-like site for people to place/reference/showcase their overtone sources
15:25aidyTimMc: okay :)
15:26amalloyi kinda feel like TimMc is talking nonsense, aidy. catch the exceptions you need to catch
15:26RaynesTimMc makes nonsense sound like sense.
15:26aidyamalloy: talking about signalling an error though
15:26TimMcHmm.
15:26dnolenweavejester: there's a lot there including a sensible analyzer written in Clojure that emits the beginning of something that could be generally consumed by tools
15:27TimMcaidy: The trouble is distinguishing recoverable and non-recoverable exceptions. The Java throwable system is not great for that.
15:27weavejesterI have been meaning to get around to looking at CLJS...
15:27TimMcaidy: I *do* recommend looking at slingshot and friends if you want to do that.
15:27brehautaidy: the right tool for signaling the error kind of depends on the context. exceptions can make pure functional code a bit more awkward. on the other hand, they can make side effecty / io-ish code much clearer
15:28hiredmanthe internals of cljs are nicer, but thats really all there is
15:28dnolenweavejester: it's also not that tied to CLJS, someone with some free time could easily make it pluggable to emit something else
15:28hiredmanjs isn't really a nice platform
15:29hiredmanit's a target of necessity
15:29dnolenhiredman: not just the internals, you start with a larger chunk of the language available.
15:30dnolenhiredman: not sure what other platform it should have targeted that useful to most people.
15:30aidybreh
15:30aidyTimMc: thanks I'll look into that
15:30hiredmandnolen: thats what I meant by "target of necessity"
15:30aidybrehaut: it's db code indeed
15:30dnolenhiredman: ubiquity factors into nice, same as the JVM
15:30hiredmannot so
15:31dnolenhiredman: for you
15:32brehautaidy: depending on your DB, you might already be having to handle exceptions. It'd be silly to have two mechanisms to worry about
15:32hiredmanon jvm in many cases you can make different decisions on how to handle things from what java made
15:33hiredmanwith js you are tied to js or more code to execute to emulate waht you want in js
15:33aidybrehaut: true
15:33dnolenhiredman: you have same problems on the JVM - protocols vs. interfaces
15:37hiredmandnolen: sure, I am not saying everything is 1:1 on the jvm, I am saying the jvm is a great known platform with all kinds of tools and libraries etc, while js has stuff in the pipeline here and there by and large it sucks, and isn't a great platform, except somehow it's everywhere
15:38hiredmanthe ubiquity is the only selling point of js as a platform
15:38hiredmanwhich is kind of sad, you'd hope something that is everywhere would have a compelling reason for being everywhere
15:39weavejesterhiredman: If that were true we'd all be using Lisp Machines or Plan 9 ;)
15:39dnolenhiredman: JS is reasonably fast, has tools, libraries - it's telling that it simpler to debug ClojureScript in many cases.
15:39RaynesI'm waiting for the dnolen hiredman deathmatch at Conj 3.
15:39hiredmandnolen: I find that unlikely
15:41dnolenhiredman: I've yet to have a good debugging experience in CLJ, in CLJS I can just look at the emitted source and using a real stepping debugger.
15:41hiredmandnolen: on clj I can just look at the emitted bytecode
15:42hiredman(to be fair I've only ever had to do that once for work)
15:42muhoosamaaron: i meant ogg/mp3 files not source
15:42samaaronmuhoo: not yet
15:42dnolenhiredman: you're making my point for me, in browser debugging tools for JS are pretty good now.
15:43samaaronwho needs debugging? println FTW! (ducks for cover)
15:43dnolenhiredman: that said, I don't think debugging emitted source is a good user experience either just an improvement for me. Would prefer a sexpr level debugger.
15:43hiredmandnolen: and your making mine for me, the only reason js is a reasonable target is because you know js
15:43Scriptorbut you'll still have to manually trace the js line to the clojure line, right?
15:43weavejesterprintln has a few things going for it :)
15:44hiredmanwhich of course you get on the jvm for free in stacktraces
15:44hiredmannot that people read stracktraces anyway
15:45dnolenScriptor: yes, but a good set of things are in place to do source mapping - we already track line #s for all top levels.
15:45Scriptornice
15:47aperiodichiredman: why did you need to look at the bytecode? just curious because i've always found debug
15:47aperiodicdebug-repl to be sufficient
15:49hiredmana complication deriving from a runtime require, compile time var resolution, and aot compilation
15:51aperiodicah. sounds messy
15:52hiredmanwell, as soon as I saw the string constant in the byte code was the wrong namespace the lightbulb clicked
15:53aperiodicbut you wanted it to be from the namespace that was being required at runtime?
15:53hiredmanyes
15:57aperiodicneat, i should try to replicate that sometime
16:00rplevyis there an existing script/tool to poll changes to files and then re-running lein-cucumber? it would be easy to roll one in a second, but maybe someone has already made something nice with growl integration and such...
16:07samaaronare there any linux/windows users in here interested in tryign clj-processing out?
16:09pjb3Hello, I'm looking to process a bunch of records from a SQL DB table
16:09pjb3I'd like to do something similar to ActiveRecord's find_each, in case anyone is familiar with that
16:09pjb3http://api.rubyonrails.org/classes/ActiveRecord/Batches.html#method-i-find_each
16:10pjb3which calls a function once for each row in a result set
16:10pjb3but it doesn't do "SELECT * FROM huge_table"
16:10pjb3and then call it on each in the result
16:10pjb3it does "SELECT * FROM huge_table WHERE id > ? and id < ?"
16:11pjb3where on the first batch, you use 0 and 1000, then 1000 and 2000, etc.
16:11pjb3so you avoid loading the entire dataset into memory, but you don't execute a separate query for each row either
16:11pjb3seems like a perfect use case for a lazy seq
16:11pjb3does something like this already exist?
16:12compjshould not be too hard to implement, look at lazy-cat
16:12pjb3Like, here's a SQL query, order it/paginate it by the primary key?
16:13pjb3compj: ok, thanks, yeah, didn't think it would be too hard, just wanted to check to see if there's already something for it in clojure.contrib.sql that I was missing
16:14compjjust for the information, you might like clojureql being a nice db api
16:20hiredmanstuartsierra: http://groups.google.com/group/clojure-dev/msg/37df97495f0cea16?hl=en
16:20stuartsierraare you volunteering?
16:21stuartsierraWe can add contrib committers.
16:21muhoodo hiredmen volunteer? or do they need to be.... hired?
16:22nickmbailey< guy that sent the email here btw
16:22stuartsierrado you want to be a contrib committer?
16:22nickmbaileysure
16:23nickmbaileyi wasn't sure what kind of bar was set there since I've only fixed the few jmx bugs
16:23nickmbaileybut i will gladly help out with the jmx lib
16:23stuartsierraemail clojure-dev with a clear subject line
16:23stuartsierrasay you're volunteering to take over maintenance of JMX. You've signed a CA right?
16:23nickmbaileyyep
16:23nickmbaileywill do
16:24stuartsierragreat!
16:25hiredmanexcellent
16:34TimMcstuartsierra: Is there a list of contribs that need a maintainer and are in demand?
16:34stuartsierraTimMc: That would be most of them.
16:35TimMcclojure.contrib.complex-numbers?
16:35ckirkendalldnolen: David I saw you comments on the binding and vars in clojurescript. I was wondering if people we also aware that "let" has similar issues with async code.
16:35TimMcckirkendall: let in CLJS?
16:36ckirkendallyep
16:36TimMcphew
16:36ckirkendallTimMc: phew for you :)
16:36dnolenckirkendall: I don't see how you could encounter than problem outside of loops
16:36ckirkendalldnolen: I not saying the issue exists outside of loops
16:36dnolenckirkendall: and loops in CLJS are handled
16:37ckirkendalldnolen: if you do a doseq and let inside with a settimeout you get the last binding
16:38dnolenckirkendall: shouldn't be the case on master, if it is then it's a bug
16:38ckirkendallwas this fixed recently as in the last week
16:39dnolenckirkendall: there's an old ticket for it that I fixed, please include the case that fails
16:39dnolenckirkendall: no months ago
16:42ckirkendalldnolen: hmmm
16:42ckirkendalldnolen: I have a test case that shows the issue but I need to clean it up a bit
16:43dnolenckirkendall: I just tested the basic case and it works just fine
16:43dnolenckirkendall: I'm curious what your example case looks like.
16:46ckirkendalldnolen: (doseq [x (range 1 20)] (let [y x] (js/setTimeout #(.log js/console y))))
16:47ckirkendallyou get 19 - 19 times
16:50ckirkendalldnolen: I can dig into what is going on just didn't know if you were aware
16:51dnolenckirkendall: that's actually an interesting problem.
16:52dnolenckirkendall: if you just used x it would work, since is a x loop binding
16:54ckirkendalldnolen: it seems to exist anytime you are referencing directly or indirectly the loop binding in the let binding.
16:54dnolenckirkendall: not even sure if that can be solved in a good way w/o dependency analysis
16:57TimMcckirkendall: What does that expand into?
16:57dnolenckirkendall: actually, this one is probably easy. If we're in a loop context we could just automatically preserve any internal locals found inside fns
16:57dnolenckirkendall: currently only loop locals belong to that list, we should include anything introduced by internal lets as well
16:58ckirkendalldnolen: yes I think that is the issue
16:58dnolenckirkendall: please open a new ticket w/ your case
16:58ckirkendallwill do
16:58ckirkendallTimMc: What does what expand into?
16:59TimMcckirkendall: I was curious what JS was generated by that CLJS snippet you pasted at :46
16:59TimMcif you happened to have it on hand
17:00ckirkendallTimMc: give me a sec I have it
17:00ckirkendalldnolen: what should we title this ticket so it make sense
17:00dnolenTimMc: it converts into a while loop w/ (JS) var renaming
17:01dnolenckirkendall: let scoping broken inside loop/recur
17:01dnolenckirkendall: shouldn't be to hard are you going to take a crack at it?
17:03ckirkendalldnolen: I won't get a chance to even look at it before this weekend but I give it a shot
17:03ckirkendalldnolen: I noted it was only for async calls that this case caused problems
17:05dnolenckirkendall: if it looks like a quick one I might get to it later this evening
17:05ckirkendalldnolen: cool
17:38muhooheh, i thought clj java tracebacks were impenetrable, but the stuff that floats back and forth in firebug in cljs is even weirder: https://refheap.com/paste/794
17:40mgm7734I wish people would use namespaces as intended. Try to find the repository for clj-oauth.jar: there are 6 different implementations and you can't tell which corresponds to a given jar.
17:41muhoofile a bug with the maintainers of those packages?
17:42emezeskemgm7734: It's also unfortunate when people forget to fill in the :url in their project.clj
17:42emezeskemgm7734: Clojars will display that URL on the JAR page if it's filled in
17:44mgm7734File a bug with all 6 implementers? I'm way too lazy
17:44emezeskemgm7734: Write a blog post explaining the intended use of namespaces, and link it where they might read it? ^_^
17:45emezeskemgm7734: I know I'd be interested to read such a post
17:45mgm7734Or, just find clojure related chat rooms and start bitching?
17:45mgm7734;)
17:46ibdknoxIn the beginning there was one file...
17:46emezeskeWell I'll admit that's effective for steam-blowing
17:46mgm7734The purpose is the same as hierarchical domain names on the internet.
17:47mgm7734To give everyone control over a piece of the nameuniverse
17:48Scriptorwhy does emacs keep going into hi-lock-mode
17:49Scriptoreven after I turn it off
17:52callenmuhoo: @traceback: @_@ "MOONSPEAK"
17:53muhoomgm7734: do you have a list of the names of the 6 packages? maybe someone else (me perhaps even) could email them all for you
17:53technomancymuhoo: that kind of thing could be automated with clojuresphere data
17:55emezesketechnomancy: Is that something lein could warn about? Compare the project's group-id with the files that end up in the JAR?
17:56technomancy"Reduce the time required to build the JDK and enable incremental builds by modifying the Java compiler to run on all available cores in a single persistent process" <- http://openjdk.java.net/jeps/139
17:56technomancyemezeske: yeah, sure. maybe start a thread proposing it?
17:57technomancydevn was complaining about that a few days ago; maybe he could write it =)
17:57emezesketechnomancy: sure. I'll read up on the topic a bit first; I'm not an expert in java stuff
17:57hiredmancomplaining about what exactly?
17:57hiredmanthat jar names don't match namespace names?
17:57technomancyhiredman: "it's hard to guess what to require when library authors do crazy things"
17:57emezeskehiredman: basically, group ids differing from provided namespaces in JARs
17:57technomancyafair
17:58emezeskeyeah, what technomancy said
17:58hiredmanemezeske: group ids or artifact ids?
17:58technomancypersonally I would rather just have tab completion on require and ns calls
17:58emezeskehiredman: the combination, I think
17:58technomancywarnings are easier to implement, but don't apply retroactively
17:58emezesketechnomancy: well, and people can ignore them
17:58muhooit bit me too. i was confused why jar names and ns were orthogonal at times. but then, i see the same thing in java-land, so it's not a clojure thing.
17:58hiredmanlein tends (and most clojure projects) have the same group id and artifact id
17:59technomancyenlive is weird because it has a normal group-id but a reverse-domain namespace
17:59muhooi have plenty of java libs called FooBar-1.9.jar or similarr, when the java ns is like com.blah.doh.foobar
17:59hiredmanemezeske: clojure namespaces and the maven repo namespace are not the same thing
17:59technomancyusually it's either both or the other way around
18:00emezeskehiredman: hmm, I should do more reading on the topic, I think I'm out of my depth
18:01muhooclojuresphere is very cool, thanks for whomever did that.
18:01ibdknoxit just needs to crawl more often :)
18:02devinusBefore
18:02emezeskeibdknox: seconded!
18:02technomancyyou can run it locoally
18:02technomancyheh
18:02technomancylocally
18:03hiredmanit would be interesting to have lein extract class/namespace information from dependencies and keep an index that could be injected into, say emacs, for completion purposes
18:03devinusinsertBefore
18:03devinusoops
18:04technomancyhiredman: yeah that would be slick
18:04hiredman*cough*
18:04muhooand integrate that with pomegranate
18:04technomancywe should talk someone into writing such a thing
18:04muhooso if you reference a namespace that isn't available, it can pull down the clojar for you :-)
18:04hiredmanfirst thursday is coming round
18:04technomancythere would be a leiningen sticker in it for whoever implemented such a thing, that's for sure
18:05technomancypossibly two
18:05brehauttechnomancy: how much work would that be?
18:05kijHey. Is there an good way to pull out multiple fields from an java object. Like the reverse of an doto. EX: (map #(vector (.getFullMessage %) (.getCommitTime %) ) (git-log repo))
18:05brehauttechnomancy: (for someone who hasnt worked on lein at all)
18:05technomancybrehaut: wiring the completion into slime might be difficult. making it available textually in the repl would be a few hours of work I'd guess
18:06muhoolook, i'd be happy for a database somewhere. on clojars, on clojuresphere, somewhere
18:07brehautif someone was willing to give me a hand, id like to contribute to lein in some way
18:07bsteuberkij: there's a nice new contrib lib for java interop: https://github.com/clojure/java.data
18:07technomancymuhoo: you should check out the clojuresphere codebase; it's pretty approachable
18:07technomancybrehaut: can I pm?
18:07bsteuberkij: well from-java is like an extendable, recursive bean
18:08bsteuberkij: so it can cast your obj into a map and you can use all clj goodies ta take many
18:08bsteuberif that's not too slow for you
18:09bsteuber(map [:full-message :commit-time] (from-java log)) seems pretty clean to me
18:10bsteubererm the arguments must be swapped
18:11kijbsteuber: That does indeed look more pleasent. Thanks!
18:12muhooheh, i keep reading prn-str as porn-star
18:12Bronsalol
18:12Bronsayour dirty mind
18:12hiredmantechnomancy: you've seen https://github.com/cosmin/class-finder?
18:13bsteuberkij: you can stick to plain old bean, though - but I don'e really like that anymore
18:13muhooBronsa: nothing dirty about it; it's a friend's band's name
18:13technomancyhiredman: I hadn't seen that; handy
18:14hiredmanhas a bizarre amount of java code
18:15kijbsteuber: and you lost me. Sorry, old beans ?
18:16pbostrom,(def (symbol "foo") "bar") ;seems like it would work
18:16clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
18:18muhooheh (def graph-data-file "project_graph.clj")
18:18muhoothe whole project database is stored in a clj file, and committed to git!
18:18bsteuberkij: there's a function called bean turning a java object into sth. map-like already
18:18muhooall like 16MB of it
18:19bsteuberkij: but from-java is better ^^
18:21technomancymuhoo: yeah, the checking-stuff-in part is crappy
18:24kijbsteuber: from-data it is!
18:28muhootechnomancy: git rm -f project-graph.clj
18:29muhoobut i can see why he'd want the file available when people check out the codebase, so that they don't have to run a crawl and populate the whole db just to make the thing work
18:29technomancymuhoo: yeah, it's a caching issue. it would be better to keep on s3, but then deployment would involve another set of credentials.
18:30muhoowhat's his goal here? to have it be one database, or to let people fork it and have a million clojurespheres running around?
18:31technomancylong-term: the data should just be exposed via clojars.org
18:32technomancyclojuresphere would just be a library that clojars uses
18:32technomancyshort-term: I think he'd prefer it if changes made their way back upstream
18:34muhooif the data is exposed read only, i can't see why not put onto s3 with -M -P and let everyone read it from there
18:34callenanyone else who's watched the clojure conj videos gotten tired of the musical jingle in the intro?
18:34muhooif it's going to be read-write, then you're going to have to deal with credentials somehow anyway
18:34technomancymuhoo: yeah, that would make sense
18:35Nathell,(eval `(let [f# (with-meta #(do %) {})] f#))
18:35clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
18:35technomancymuhoo: jkkramer is pretty responsive; you should open an issue on the gut hubs
18:35muhooit's always fun to remember that clojurescript is still javascript: what should this do? (+ [1 2 3])
18:35Nathellmeh, no luck
18:36muhoo&(+ [1 2 3])
18:36lazybotjava.lang.ClassCastException: Cannot cast clojure.lang.PersistentVector to java.lang.Number
18:36muhooof course. but, not in cljs...
18:36muhooit does... something else.
18:37Scriptorwha does it do?
18:37muhooScriptor: try it :-)
18:38Scriptorman, now I need to get a cljs repl set up
18:38muhooit's fun, and worth the 2 minutes.
18:39muhootechnomancy: thanks, will do.
18:39Nathell&(eval `(let [f# (with-meta #(do %) {})] f#))
18:39lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
18:39muhoobad eval, bad!
18:39muhoo(eval whimpers)
18:40Nathellmuhoo: lol. anyway it doesn't work with clojure 1.3 and I can't see any reason why it shouldn't
18:41muhoocljs is a little too bleeding-edge for my tastes, but stuff like fetch, and ibdknox's overtone tutorial, is so goddamned cool that i keep getting tempted into playing with it.
18:43muhooNathell: i tried it on 1.3 and it gave me #< clojure.lang.AFunction$1@380fe8c4>
18:43muhooi have no idea what it is supposed to do, thou
18:47Bronsaworks fine for clojure HEAD too http://i.imgur.com/UsHq1.png
18:49Nathellok, i meant this one: (eval `(let [f# ~(with-meta #(do %) {})] f#))
18:50Nathelltriggers an ExceptionInInitializerError
18:51Nathella closure with metadata on it is created and smuggled inside the let form passed to eval
18:51hiredman:(
18:51hiredmandon't do that
18:52hiredmana function object is not an s-expression, don't pass it to eval
18:52Nathellshouldn't it evaluate to itself?
18:53Nathellit used to in 1.2.1
18:53hiredmanNathell: why should it?
18:53technomancymost JS environments actually have a really nice decompiler
18:53technomancybut Clojure does not
18:54hiredmantechnomancy: well, they are interpreted, they don't decompile anything
18:54hiredmanthey keep the soure around
18:54amalloyNathell: functions happened to work in eval (and macroexpand) in very limited circumstances under 1.2. it was never a good idea to actually do it on purpose
18:55technomancyI thought they were able to work backwards from compiled functions, but I may be confusing that with their pretty-printing behaviour
18:55amalloyand that wasn't a closure with metadata - it was just a function with metadata. closures didn't work in 1.2, even. eg, stuff like (let [x 1] (eval (fn [] x)))
18:56technomancyamalloy: depends on whether fn resolves to clojure.core/fn or serializable.function/fn =P
18:58amalloy&(->> ' ^:x (foo bar) (rest) (cons 'baz) (meta))
18:58lazybot⇒ nil
18:59amalloyaw. i thought those might preserve meta
19:00Nathellamalloy: (let [x 1] (eval (fn [] x))) works in 1.2
19:01Nathellthe way I'd expect
19:02amalloydoes it? that's a bit surprising. anyway, you really shouldn't do that or rely on it. macros and eval are for code (ie, sexps), not objects (eg, functions)
19:02technomancyNathell: it's catching an earlier (def x 1)
19:03technomancyoh wait
19:03technomancyno, it's just that the eval is still in the let block
19:03amalloytechnomancy: doesn't matter
19:03technomancynever mind; misread
19:04technomancyright; if it works, it works by accident rather than by design
19:04amalloyright
19:04amalloythough those four misfires in a row remind me of those days when i should have just stayed in bed
19:06aperiodicthe local x shouldn't matter because eval only cares about vars in the namespace?
19:07Nathellaperiodic: eval never sees the x, it gets a function objects
19:08aperiodicah, right
19:08hiredmanclojure doesn't have reified environments, forms passed to eval or effectively always eval'ed at the toplevel in the given namespace
19:08hiredmanare
19:08Nathellokay, thanks, understood.
19:09aperiodicthat's what i was after, thanks
19:09technomancyif you quote the fn, it'll break
19:09sritchieRaynes: have you had any issues with lein newnew and Leiningen 1.7.0?
19:10sritchie"lein templates" is working properly, but "lein new cascading projectname" is generating a basic project named "projectname" with a namespace of "cascading.core"
19:11Nathelli'm just toying around, anyway, so if the toy relies on 1.2's behaviour it doesn't matter.
19:12sritchietechnomancy, you might know better w/ this
19:12technomancysritchie: it may be that user-level plugins are getting placed too low on the classpath. is this a problem with 1.6.2?
19:13sritchienope, everything worked fine w/ 1.6.2, lein-newnew overrode the lein new task
19:13technomancyok, could you open an issue then?
19:13technomancymight have to get a 1.7.1 out before 1.7.0 is officially announced
19:13sritchiesure, on leiningen
19:13sritchieI'll do it now
19:17sritchietechnomancy: done, thanks! https://github.com/technomancy/leiningen/issues/415
19:19kijHey, i can only find java.data on oss.sonatype.org, how can i add that to leiningen repositories?
19:20kijnwm, found :repositories
19:26kijand the cake was an lie, is java.data gone?
19:28nollidjwhat is the up-to-date way to depend on bits of clojure-contrib? i've been out of the loop since 1.2, and i am uncertain as to how to depend on contrib libraries in a lein config. i'd like to try out clojure.contrib.graph, but i don't see "graph" anywhere at https://github.com/clojure
19:29thearthurI need to tell leiningen not to use ~/.m2 as its local maven repo and settings,
19:29thearthurcan I pass maven options to leiningen?
19:32technomancythearthur: I'm not sure if this is supported. what's the use case?
19:32brehaut~contrib
19:32clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
19:32brehautnollidj: ^
19:33ibdknoxmy googling is failing me, does anyone know what necessary for a script to be used as a #! interpreter? I can't figure out how input is passed in
19:34brehauti was sure it was just stdin
19:34ibdknoxcalling read doesn't seem to do anything
19:35ibdknoxI can't get the jark client to do the right thing, so it seemed like I could trivially write an nrepl client as a node script :)
19:36technomancyI couldn't get jark to build when I tried it a few months ago =(
19:36technomancyreplaca: how hard would it be to write a pprint dispatch for defproject?
19:36ibdknoxtechnomancy: I couldn't either, ended up doing some magical things to make it work
19:37nollidjbrehaut: thanks. so it looks contrib.graph has no maintainer. but the docs on the clojure-contrib api reference still refer to it. is this because the docs are out of date?
19:37technomancyalso, anyone want to try lein-swank 1.4.1-SNAPSHOT before I cut a release?
19:37ibdknoxI kept getting assumption mismatches
19:37ibdknoxremoved the included camlp5 dep and used my own
19:37ibdknoxthat somehow made it work
19:38technomancythe whole ocaml build chain makes me depressed
19:38technomancyit's all "I HOPE YOU LIKE APT_GET BRO"
19:39hiredmanbut, hey, guys, there is a bencode encoder/decoder for ocaml, so it's cool
19:39ibdknoxunfortunately I don't know ocaml well enough/don't really want to, to try and fix whatever is broken in the client
19:40technomancyI've spent an order of magnitude more time screwing with ocaml builds than I have actually writing code
19:40ibdknoxI got that feeling
19:40ibdknoxwhich is why I am now avoiding it :)
19:41technomancydid you try downloading the precompiled client though?
19:41ibdknoxyeah
19:41ibdknoxit didn't work at all
19:41technomancyoh
19:41ibdknoxtalked to the guy, he said there was a bug that he fixed
19:41ibdknoxso I tried building it
19:41ibdknoxlol
19:41technomancyಠ_ಠ
19:41ibdknoxgot it built, it does slightly more, but doesn't seem to work still
19:41brehauti really hope my released projects arent causing anyone this amount of pain :S
19:41hiredmanbut guys, bencode!
19:41ibdknoxlol
19:42technomancybrehaut: to be fair, it isn't being offered as either stable or a release
19:42ibdknoxjark is such a fun idea
19:42ibdknoxI want to be able to write clojure scripts :p
19:42brehauttechnomancy: sure, but some of mine are :S
19:43technomancyibdknox: and I want to be able to delegate "lein interactive" so I don't have to maintain it mysef =\
19:43ibdknoxyeah
19:43ibdknoxI'm not sure I understand why this isn't just written in Clojure
19:43ibdknoxthe client can't be
19:44technomancythere's ocaml in the server‽
19:44ibdknoxthe server was implemented as a plugin I thought
19:44ibdknoxah, just starting it is
19:46thearthurtechnomancy: our build systems have a .m2/settings file that is configured to ONLY build our product
19:46thearthurtechnomancy: leiningen can't run on this box with that settings file in place
19:46thearthurif I move it then leon works and our product can't build
19:46thearthurs/leon/lein
19:48technomancyyou could try tweaking leiningen.util.maven/make-settings I guess
19:50pyribdknox: it's definitely stdin
19:50ibdknoxhm
19:51ibdknoxI must be doing something wrong then
19:52pyribdknox: i agree that on paper node.js + cljs sounds like a nice script in clojure solution
19:52ibdknoxah actually, I just want a node script to run something that sends stuff to the jark server
19:52ibdknoxso it'd be clojure
19:52technomancyI dunno; node isn't packaged very widely yet, plus it's changing at a fairly rapid pace.
19:52ibdknoxI just need an intermediary
19:52thearthuris there an environment variable that controls where maven looks for it's local repo?
19:52ibdknoxthis is just so I can play :p screw everyone else!
19:52technomancyso instead of dropping a single binary into bin, you've got to drag a bunch more runtime with you
19:53technomancyhehe
19:53technomancycarry on then =)
19:53ibdknoxhehe
19:53technomancythearthur: IIRC maven honors M2_HOME, but I have no idea if maven-ant-tasks checks it
19:56ibdknoxI guess I could learn haskell and see if kotarak's new vimclojure client will work :)
20:16aperiodictechnomancy: i'm getting a NPE when i try to lein deploy (never had any issues deploying this project before)
20:18technomancyaperiodic: lein 1.7.0?
20:19aperiodictechnomancy: 1.6.1.1
20:19technomancycan you try the latest?
20:20aperiodictechnomancy: it's the exact same NPE as this issue: https://github.com/technomancy/leiningen/issues/350
20:20aperiodictechnomancy: sure
20:23aperiodictechnomancy: upgrading did the trick!
20:23technomancygreat
20:37bsteuberjust read the william byrd interview
20:37bsteuberthat guy must really be into macro hygene
20:38technomancybsteuber: no idea what his deal is
20:38technomancyhe really wants Clojure to solve problems that only occur in CL?
20:39bsteuberyes to me it also seems rich solved "all problems" in that area
20:40bsteuberso either he didn't really get the clojure system
20:40bsteuberor I am overlooking something
20:40technomancyhis conj talk made me suspect he hasn't spent a lot of time in Clojure
20:41bsteuberor maybe he just thinks #-suffixes are ugly :)
20:41technomancyhttp://p.hagelb.org/riker.gif
20:42technomancy...is all I have to say
20:42bsteuberlol
20:42technomancyI'll be here all week
20:42aperiodici can't help but note that the last four letters in your site's domain + TLD are borg...
20:43technomancyuh oh... the secret is out.
20:43technomancy~guards
20:43clojurebotSEIZE HIM!
20:43aperiodichmm, don't see any references to the assimilation of all life-forms
20:58TimMcPutting var metadata maps between the doc-string and args: Terrible style or excellent style?
20:59TimMc(defn foo "Does stuff" {:since "1.4.5"} [x] (str x))
20:59TimMcinstead of
21:00TimMc(defn ^{:since "1.4.5"} foo "Does stuff" [x] (str x))
21:00pipelinedepends on indenting ?
21:01TimMcWell, if there's a crapload of metadata, I'll definitely do the format.
21:01TimMc*former
21:01TimMcThe latter, (defn ^metastuff name \n ...)
21:02aperiodici had no idea you could do that
21:02aperiodici vote for excellent style
21:03TimMcJust a couple minutes ago I realized I had forgotten to put :since on a public API fn, then discovered I had done it in the former style.
21:03TimMcSo, there's something to be said for the latter, which is more well-known.
21:05bsteubertechnomancy: just had to leave a comment for Mr. Byrd :)
21:08brehautTimMc: somehow i knew you could put the metadata for functions after the docstring, and yet have always done the former despite not liking it.
21:09bsteuberfirst time I see a page ordering comments not by date per default
21:16WraithanSo redis-clojure seems to be the blessed lib on redis.io but clj-redis appears to have more complete support of features... are there other ones I should be aware of, preferably something with docs and pub/sub support?
21:21aperiodicWraithan: i'd recommend using clj-redis. can't vouch for the pub/sub personally, but it's there
21:30Wraithanok
21:30WraithanIt is unfortunate that is has no docs
21:31Wraithanaperiodic: thanks
21:33aperiodicWraithan: should be pretty simple to use... get a connection with redis/init, and pass that as the first arg to any command; the rest of the args are what you'd expect for that redis command
21:34aperiodicWraithan: if you have any issues feel free to ping me here and i'll do my best to help
21:34Wraithanaperiodic: simplicity or code are not an excuse for no docs. For example, I have to look up the connection args to verify what they are called.
21:35WraithanI'll probably fork it and fix the documentation problem. Once I get used to using the lib.
21:36aperiodicWraithan: I was about to suggest that ;). Awesome!
21:37WraithanThough I am in disagreence with most of the community in that so far all the docs I've seen are monolithic .md files viewed on github. Something like sphinx where you can host on readthedocs.org or something is much preferable and looks far nicer with ToC and such
21:38WraithanI'm new to clojure though, so maybe I am wrong and you guys have a service that is like that, but in my experience that doesn't exist.
21:39aperiodicwell, good clojure libraries should provide docstrings for all of its functions, which can be accessed in the repl with (doc some-fn)
21:40aperiodicclj-redis doesn't have any docstrings, though
21:40WraithanWhich is still not real docs.
21:44brehautWraithan: marginalia is a relatively common tool for better docs, although if you want it all split up you'll probably be disappointed.
21:44ibdknoxcodox ftw
21:44brehautWraithan: however, a lot of clojure libraries (even complex ones) are small enough to not need to be split into multiple pages
21:45Wraithan1I don't think that is true at all
21:45Wraithan1There are things like dev docs, so you can say recommended practice for contributing and lib docs, they should be separate
21:45Wraithan1also having a ToC is really handy
21:46Wraithan1As well as install, as well as tons of other little caveats that come up
21:48Wraithan1brehaut: For python, sphinx lets you use docstrings and embed them in your docs
21:49brehautim quite familiar with the out put of sphinx / python. djangos docs for instance are a popular example
21:53brehauti do agree that as a community we could do better at documentation, i dont think its as dire as you make out.
21:54brehautfor one thing, its rare that a libraries installation is more complex than adding a dependancy to your project.clj
21:54brehautvs python where packaging and dependancy resolution are only a semi-solved problem
21:54WraithanIts a mostly solved problem unless you have C deps.
21:55Wraithanpip install blah
21:55brehauti use python for my day job. pip has not solved the problem.
21:55Wraithanbrehaut: But I do see your point about the installation, doesn't mean you shouldn't document it. It only takes a minute to do so and verifies that your lib is one of the simple to install ones.
21:55brehautcertainly not to the extent as lein / maven
21:56brehautit does mean you dont need a whole page devoted to installation though
21:57WraithanYou say whole page like it is a big deal. You say you are familiar with sphinx, a 'whole page' is create a single file and reference it from your TOC
21:58Wraithanbrehaut: But we can agree to disagree on this point.
21:58brehauti dont agree to disagree
22:01jtoycan someone point me to the concept of building 2 out of 3 factors in software speed/completion/ i forget the 3rd , my google skills are bad today
22:02brehautgood fast cheap ?
22:02Wraithanbrehaut: ok, that is fine too
22:02amalloyworking, beautiful, fast?
22:03amalloyi just made that one up but it's solid gold
22:03seancorfieldjtoy: http://en.wikipedia.org/wiki/Project_triangle ?
22:03ibdknoxit's usually defined as cost, scope, and time
22:03WraithanCheshire is the recommended json lib?
22:03brehautamalloy: thats not a triangle though is it? thats a process
22:04ibdknoxWraithan: yeah
22:04amalloynaw. if it works and is fast, it ain't beautiful
22:04ibdknoxlol
22:04amalloyif it's beautiful and fast, it probably doesn't work
22:04Wraithanibdknox: thanks
22:05jtoyyes, thanks
22:05ibdknoxI don't think I've worked anywhere that has fully understood those tradeoffs
22:06ibdknoxdespite the fact that they were talked about at great length :p
22:06hiredmanhttps://gist.github.com/1880975 for poping up an emacs buffer narrowed to a single top level form from a namespace
22:06brehautibdknox: sales or marketting always think they are immune ;)
22:07ibdknoxbrehaut: and it wasn't always just them ;)
22:07brehautibdknox: lol
22:08muhoofast, cheap, or reliable, pick any two
22:08brehautive never worked in a place where there was any way that they could be eliminated as a variable :P
22:08ibdknoxMicrosoft was big enough that those guys were relatively foreign concepts, though that was less true toward the latter part of my tenure there
22:09brehautyeah ive never worked anywhere that large
22:09brehaut(by orders of magnitude)
22:10ibdknoxguessing game time :D How many people do you think worked on VS?
22:11brehautwell, i think x-code is about 4, so im going to say 50
22:11ibdknoxother guesses from the channel?
22:11aperiodic30
22:11aperiodicwe could play binary search
22:12ibdknoxThe VS alias had over 2000 people on it
22:12aperiodicwoah
22:12brehautdoes that include all the language guys?
22:12brehautalso: explains a lot
22:12ibdknoxthey make up a very small portion of it actually
22:12ibdknoxbut yes
22:12ibdknoxNow the best one, how many LoC is VS?
22:12brehaut20 million
22:13brehautwait
22:13brehauttoo few zeros
22:13brehaut200
22:13ibdknox200 million? lol
22:13ibdknox3 times the size of windows?
22:13aperiodic5 million
22:13ibdknoxwell, not quite
22:13brehautits the only reason i can think of that its so slow to launch
22:13ibdknoxhaha
22:13ibdknox55 million
22:13ibdknoxwhen I left
22:15aperiodicso VS is ~20% smaller than windows?
22:16brehautto be fair to VS, its boot time has come down a long way
22:18ibdknoxyeah they did a ton of work on it while I was there
22:18ibdknoxI don't remember the windows 7 line count
22:18ibdknoxI thought it was around 80ish
22:18brehautyeah, 2010 was actually a decent product
22:19brehautits boot time was better than windows 7 on the same machine (which was the first time VS had ever beaten Win for me)
22:19ibdknoxhaha
22:43bitrotrandym: /cl
22:45duck1123did anyone ever find a solution for clojurescript adding a request for deps.js when building with lein-cljsbuild
22:47mrnoIs there a built in function to swap two elements of a vector, or is using two assocs the best way?
22:53brehaut_,((fn [v ks] (apply assoc v (mapcat #(-> [% (v %2)]) ks (reverse ks)))) [:a :b :c] [0 1]) ; so ugly
22:53clojurebot[:b :a :c]
22:57callenbrehaut_: I'm impressed anyway.
22:59mrno((fn [v i1 i2] (assoc (assoc v i1 (v i2)) i2 (v i1))) [:a :b :c] 0 1) ;looking for something more concise :)
23:00brehaut_,((fn [v i j] (assoc v i (v j) j (v i))) [:A :B :C] 0 2) ; then at least use just one assoc ;)
23:00clojurebot[:C :B :A]
23:01mrnothat's better
23:02emezeskeduck1123: Do you have any idea why it requests deps.js when you have optimizations enabled?
23:02emezeskeduck1123: I just found an interesting thread: http://groups.google.com/group/closure-compiler-discuss/browse_thread/thread/6fabcb4562317519
23:05duck1123emezeske, thanks for that link. So if I use simple, is it still readable?
23:06dnolenduck1123: simple + pretty-print is a pretty good combo.
23:06emezeskeduck1123: Simple renames locals I think, which isn't that bad
23:07duck1123I am just now getting going with clojurescript
23:07emezeskeduck1123: It looks like you can just put this above your script tag for the js: <script type="text/javascript">var CLOSURE_NO_DEPS=true</script>
23:07emezeskeI might add that to the lein-cljsbuild simple example
23:11ibdknoxI always just do simple + pretty print myself
23:12emezeskeI guess the locals that simple renames probably are not named descriptively in the first place ;)
23:15emezeskeHmm, function params seem to be relatively useful in :whitespace optimized code
23:18duck1123:whitespace gave a pretty clear indication of what was going on, which is good because I'm still learning it
23:19duck1123Of course, my attempts to get websockets working with the latest aleph failed miserably today
23:21emezeskeduck1123: My solution to the deps.js problem: https://github.com/emezeske/lein-cljsbuild/blob/0.1.0/example-projects/simple/src-clj/example/views.clj
23:21emezeskeduck1123: I can confirm that it works.
23:23duck1123Thanks, I'll try that out
23:24duck1123that works
23:25emezeskew00t
23:27dnolenanother sad day for FP, http://www.science.uva.nl/math/#item1329781416 just recently learned how neat lexical addresses are.
23:39amalloybrehaut_: #(-> [% (v %2)]), really? i'm starting to think you actually like that pattern
23:48brehaut_amalloy: bahaha
23:48brehaut_id never use it in real code