#clojure logs

2012-01-17

00:11clj_newbis there anyway in clojure to define (ns animals) in a file besides animals.clj, and have (:require animals) still be able to find (ns animals) ?
00:12clj_newbis there anyway in clojure to define (ns animals) in a file besides animals.clj, and have (:require animals) still be able to find (ns animals) ? [I realize the answer might be: don't do this, or why do you want to do this, but hypothetically, is this possible? :-) ]
00:22ambrosebsclj_newb: the answer is don't do this.
00:22ambrosebs(or see the source for clojure.core if you really want to)
00:24ambrosebsyou could :use other namespaces in "animals.clj", and when you :require animals, you'd also get access to the functions animals :use's
00:25ambrosebssee core.logic for an example of that
00:25ambrosebsalthough core.logic may be all in one file, I can't remember
00:29ambrosebscorrection: I was wrong about :use'd functions being transitively :use'd
00:33ambrosebsclj_newb: another strategy: define all public functions in "animals" and use a child namespace to define the private helpers
00:59clj_newbambrosebs: noted. thanks!
01:28seancorfieldclojurescript question...?
01:28seancorfieldif i do getElementsByTagName() i get a NodeList... how can i convert that to a sequence i can call map on?
01:29seancorfieldi know Array.prototype.slice.call(tags) turns it into a JS array but that didn't seem to help...
01:38daakui'm writing some docs using Marginalia, and was wondering how to document functions generated by some macros i've written
01:39daakumy macro doesn't take a doc string or metadata atm, not sure if there's some easy way to add that (if that works with Marginalia)
02:00devngood lord clojurescript one is great
03:50amalloy$google clojure tools.macro name-with-attributes
03:50lazybot[clojure.tools.macro - Tools for Macro Writers 0.1.2 API documentation] http://clojure.github.com/tools.macro/
03:50amalloydaaku: ^
03:58kralnamaste
04:08Blktgood morning everyone
04:08bluezenixgood
04:52wiseencan anyone help me out with this error : "CompilerException java.lang.IllegalArgumentException: Can't define method not in interfaces: handleDownstream, compiling:(NO_SOURCE_PATH:9)" I simply use (defrecord foo [x] Interface (bar [x]))
04:52wiseenand handleDownstream is in the interface
05:12zoldarwiseen: If possible, you could paste a more complete example here: https://refheap.com/paste , with interface itself as well, that would make it easier to spot the issue
05:13wiseenzoldar, i figured it out I needed to add a ref for the [this foo bar]
05:13wiseenthis
05:13bluezenixis there a place to offer clojure jobs without being considered a spammer? :)
05:13zoldarright
05:14zoldarbluezenix: http://functionaljobs.com/ ?
05:14bluezenixinteresting, thanks
05:16nybbleshi does anyone know if there is something i need to do to enable precondition checking? (defn foo [x] {:pre [#(< x 10)]} x) (wtf 10) is not throwing an assertion error for me
05:17raeknybbles: skip the #
05:17zoldarnybbles: http://blog.fogus.me/2009/12/21/clojures-pre-and-post/
05:17babilennybbles: And you surely meant (foo 10) not (wtf 10) there?!
05:18nybblesraek, zoldar: thanks argh i was looking at that blogpost but didn't see that the '#' was not required
05:18nybblesbabilen: uhhh sorry, the function was originally called 'wtf', but i changed it to 'foo' for the channel, but then forgot to change the call too :P
05:18nybblesthanks everyone.. maybe it's time for bed :|
05:19babilennybbles: Yeah, no problem -- But you never know when people ask questions like this. Just wanted to point it out if you did, in fact, call wtf, but declared foo with preconditions.
05:19raekalso, only use pre- and postconditions to catch bugs. since they can be disabled then shouldn't be used for validating user data etc
05:20raek*they
05:20nybblesraek: good point hm
05:21nybblesbabilen: i should just not be shy about leaving my function names as they are, i guess..
05:22nybblesfortunately, 'wtf' is about as colourful as it gets
05:22babilenindeed :)
05:24zoldarnybbles: maybe this library will get you interested https://github.com/fogus/trammel (along with the whole approach)
05:26nybbleszoldar: awesome thanks this looks really useful
05:43BorkdudeDoes it matter if you use get or nth for a vector?
05:47raekBorkdude: not as long as the index is within bounds
05:47raek,(get [] 1)
05:47clojurebotnil
05:47raek,(get [] 1 :not-found)
05:47clojurebot:not-found
05:47raeknth throws if the index is out of bounds
05:48Borkdudeah
05:48raek'get' has more of an "map-like" behavior and 'nth' more of an "array-like"
06:25raekLeiningen-using Clojurians, don't forget to fill in this! http://lein-survey.herokuapp.com/
06:26clgvraek: oh
07:16FolconHey everyone, I've been building viterbi in clojure and I'm wondering if anyone would have some time to discuss my implementation?
07:17FolconI'm not really put together anything like this in clojure and it's quite slow so any help would be appreciated
07:22FolconIt's viewable here https://gist.github.com/1626486
07:41clgvFolcon: a few general hints: string functions can cause performance problems and you should be using type hintsfor primitive values like int, double, etc. to avoid repeatedly boxing and unboxing
07:42clgvFolcon: did you measure performance bottlenecks yet?
08:56Folconclgv: I've been doing some micro benchmarks but it's hard to get a good idea for where the issues are arising from, mostly I've been using Java VisualVM and trying to work out how to speed up the functions.
08:56FolconI'll typehint the strings, but I should be working with primitives for the computation?
08:57clgvFolcon: do you use clojure 1.3?
08:57FolconShould I change over to primitive values only in the scope of a computation?
08:57Folconclgv: Yes
08:58clgvyes. and in clojure 1.3 you should type hint the functions that return primitives
08:58Folconclgv: I see.
08:58clgvFolcon: additionally for a vector of primitives there is 'vector-of
08:59Folconclgv: That's good to know :)...
08:59clgvyep. saves boxing as well
08:59clgvs/saves/avoids/
09:00Folconclgv: Thanks for your help, anything else?
09:01clgvFolcon: not without a concrete bottleneck I think ;)
09:06Folconclgv: Brilliant, thanks a lot. I'll start with those and see where it gets me :)... Much appreciated!
09:07Folconclgv: It's times like this I wish there was a stackoverflow like site for collaborative code review :)
09:07Folconclgv: Thanks again!
09:07clgvnp.
09:07jfieldsI'm looking for a fn similar to clojure.set.subset, but with maps. something that behaves like so (submap {:a {:b 1}} {:a {:b 1 :c 2} :d 3}) => true and (submap {:a {:b 1}} {:a {:b 2}}) => false. Is there anything in core that does this already?
09:12clgvjfiels: have a look at select-keys
09:12raekjfields: do you want to check if the set of keys is a subset or if the set of entries is a subset?
09:13clgvoops. misread
09:14LicenserFolcon I think you always can post a copy of your code on github or related and aks oppinions
09:16jfieldsraek, I want the keys & values to match
09:16jfieldsraek, so, entries, I believe.
09:17clgvjfiels: there is a clojure.data/diff function in clojure 1.3 you could use
09:17clgv&(doc clojure.data/diff)
09:17lazybotjava.lang.RuntimeException: Unable to resolve var: clojure.data/diff in this context
09:17clgv&(use 'clojure.data)
09:17lazybot⇒ nil
09:17clgv&(doc clojure.data/diff)
09:17lazybot⇒ "([a b]); Recursively compares a and b, returning a tuple of [things-only-in-a things-only-in-b things-in-both]. Comparison rules: * For equal a and b, return [nil nil a]. * Maps are subdiffed where keys match and values differ. * Sets are never subdiffed. * All sequ... https://refheap.com/paste/318
09:18jfieldsclgv, thanks, I'll give it a look
09:34raekjfields: I don't think that exact function exists, but you could implement it as (def map-subset? [x y] (= (select-keys y (keys x)) x))
09:41jfieldsraek, thanks, that's what I was thinking. After looking at diff I might go with this: (defn submap [sub super] (-> (clojure.data/diff sub super) last (= sub)))
09:41jfieldsraek, the select-keys version falls down when a val is a map and it has keys that I'm not concerned with.
09:44raekah, you wanted to do this check recursively...
10:10TimMczoldar: Does functionaljobs actually *have* any jobs listed right now?
10:13babilenWhat are your thoughts regarding multimethods with different optional arguments? I somehow dislike the idea of different signatures, but some arguments just don't make sense for all methods.
10:13stuartsierraRelevance is still hiring.
10:19jsabeaudryI have a method accepting a number and at some point I need to round it so I use (Math/round ) but it fails with method not found if it happens to be an Integer, is there another round with the trivial definition for integer?
10:20joegalloMath/round takes a double or float. In java, if you passed in an int, it would automatically get upcasted.
10:21joegalloI think you can probably (Math/round (double x))
10:21joegalloand you'll be happy
10:21joegallonot positive, though
10:21rlbhttp://richhickey.github.com/clojure-contrib/math-api.html#clojure.contrib.math/round
10:21lazybotNooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/math-api.html#clojure.contrib.math/round and try to stop linking to rich's repo.
10:21babilenjsabeaudry: What about numeric-tower/round?
10:21rlblazybot: tell google ;>
10:21RaynesOr, if you're paranoid, ##(if (integer? 1) 1 (Math/round 1))
10:21lazybot⇒ 1
10:22babilenjsabeaudry: https://github.com/clojure/math.numeric-tower (if you are using clojure 1.3.*) -- clojure.contrib.math if < 1.3
10:22RaynesDoesn't help much anyway, since clojure.contrib libs are out of date themselves, so linking to even the canonical repo isn't helpful.
10:23RaynesNot that you were being unhelpful...
10:23RaynesBah.
10:24jsabeaudryAlrighty, numeric tower is a strange name to me but I guess that is the option that will yield the most readable code
10:25clgvwhere was that decision chart for reify, genclass & co?
10:26Raynesclgv: https://github.com/cemerick/clojure-type-selection-flowchart
10:29mdeboardOh, nice.
10:29mdeboardSee, where, does defstruct fit in there?
10:30RaynesIt doesn't.
10:30mdeboards/where,/where
10:30mdeboardThen what's defstruct fer?
10:30Raynesdefstruct is essentially deprecated.
10:30mdeboardby/because?
10:30Raynesdefrecord/deftype are in all instances better.
10:30mdeboardin what way?
10:30RaynesThey're faster, for one.
10:31mdeboardIn what cases?
10:31clgvthx
10:31mdeboardJust trying to reconcile their deprecation with their use in Cascalog
10:33mdeboard(since I'm using cascalog as a reference for a thing I'm working on)
10:34Raynesmdeboard: I don't really know the exact performance comparison between the two.
10:35mdeboardmmkay, doesn't matter per se for me, just curious.
10:35RaynesCascalog isn't going to explode because it uses structs.
10:35RaynesI imagine it wont always use them.
10:35RaynesSwitching to deftypes/records would probably be trivia.
10:36Raynestrivial*
10:37Raynesmdeboard: From http://clojure.org/datatypes: "Overall, records will be better than structmaps for all information-bearing purposes, and you should move such structmaps to defrecord. It is unlikely much code was trying to use structmaps for programming constructs, but if so, you will find deftype much more suitable."
10:37mdeboardCool.
11:18Licenserare there really leiningen stickers?
11:19joegalloreally and truly
11:19joegalloand they are awesome
11:21zerokarmaleftwhy get stickers when you can get an infant bodysuit?
11:21mdeboardwat
11:22zerokarmaleftcafepress puts logos on everything
11:22mdeboardlein depends
11:22mdeboardadult diapers
11:23zerokarmalefti just think that's a particularly bizarre niche product
11:23actasgeekisi it possible to update cljr to Clojure 1.3?
11:23RaynesLast I heard, technomancy_ was ordering a new batch of stickers.
11:23Licenserzerokarmaleft why would I want a leiningen infant bodysuit?
11:23RaynesI am awaiting mine.
11:23mdeboardyour bodysuit?
11:23RaynesYes.
11:23mdeboardI'm terrified.
11:23clojurebotIt's greek to me.
11:24zerokarmaleftLicenser: i was kidding, just seeing the random stuff available at http://www.cafepress.com/technomancy
11:29actasgeekRaynes, was that yes directed at me?
11:30RaynesNope.
11:30actasgeekbummer. LOL
11:32actasgeekLet me rephrase the question. I like the approach of cljr because I don't create a lot of projects. How do people handle this situation and dependencies? I'm sort of used to a Ruby/RubyGems like arrangement.
11:36geoffeg_cHow can I deploy my clojure/compojure webapp to a tomcat server? https://github.com/alienscience/leiningen-war is a "dead project" so what do i use now?
11:38joegalloleiningen-war suggests lein-ring
11:38joegalloon the page you linked to
11:38joegalloon the page for lein-ring, it says you can lein ring war
11:38geoffeg_ci thought lein-ring was only to to be used for development.. like ruby's web brick
11:39joegalloi don't know, not having used either of them -- i'm just pointing out stuff from the webpages you posted
11:39geoffeg_cthanks, i'll take a look
11:40joegallonp good luck
11:41RaynesI heard that Clojure is only to be used for development.
11:41RaynesWe shouldn't use it in production.
11:41Raynes;)
11:47clgvRaynes: thats true - dont dare to ;)
11:55geoffeg_cjoegallo: that worked, thanks!
11:55solussdwhat XML parsing/emitting libraries are available for clojurescript?
11:59arkhsolussd: do you need parsing at the compile stage or run-time, on-the-browser?
11:59arkhI don't know of any parsing in-the-browser - google comes up with this from 2008: http://ejohn.org/blog/pure-javascript-html-parser/
12:00arkher - sorry, not even xml per se
12:06TimMcsolussd: Parsing into what?
12:06TimMcI'm sure you could just "eval" it by loading it as a subdocument of some sort.
12:09sritchiehave any of you guys used core.cache?
12:09arkhI haven't been able to install clojure-mode : / I have emacs 24.0.92.1 so package.el is present, I've added marmalade package sources to ~/.emacs.d/init.el and done a M-x package-refresh-contents
12:10arkhwhen I try a package-install within emacs, it finds other packages but not clojure-mode
12:10TimMcarkh: When you do M-x package-list-packages, is clojure-mode missing?
12:11arkhI get a long list but nothing clojure.+
12:13arkhhmm - available packages list isn't that long actually, maybe 20 to 25 items
12:13arkhthat "long list" is mostly have I already have installed
12:13arkh<-- just started using emacs for the first time yesterday
12:13gtrakpaste your init.el
12:14TimMc~paste
12:14clojurebotpaste is gist
12:14TimMcclojurebot: You are terrible.
12:14clojurebotExcuse me?
12:15Rayneshttps://refheap.com
12:15Raynes</shamelessplug>
12:16TimMcclojurebot: paste is https://refheap.com/
12:16Raynes<3
12:17gtrakwell done making clojure the default, a subliminal attack :-)
12:17RaynesWAR!
12:17clojurebotc'est bon!
12:17TimMcRaynes: Ugh, browserid is broken or something.
12:17RaynesTimMc: In what way? Seems to be working for me.
12:18TimMcI click buttons, things fail to happen.
12:18RaynesWhat browser?
12:18TimMcMozilla Firefox 3.6.*
12:18RaynesOh, yeah, I definitely am not trying to support that.
12:18RaynesI imagine browserid isn't either.
12:18TimMcBrowserId is an ill-conceived weak-ass piece of shit anyway, so... whatever.
12:19RaynesOkay.
12:19TimMcI really had my hopes up when it was first described, but ti turned out to be YAOpenId.
12:19TimMc</rant>
12:20arkhTimMc: https://gist.github.com/1627592
12:20RaynesBut why such an old firefox?
12:21TimMcRaynes: Linux Mint
12:21TimMcI suppose there's a newer Mint, but this is my work computer, and it would take a while to upgrade and make sure everything still works.
12:22RaynesWell, in any case, I apologize for my ill-conceived weak-ass piece of shit sign in button not working for you. ;)
12:22TimMcUbuntu has made me upgrade-shy.
12:22tmciverarkh: the only difference between what you have and my .emacs is the last 't' argument to add-to-list; I don't have that.
12:23tmciverarkh: not sure if it matters - just my two cents.
12:24tmciverlooks like that is an append flag, so it shouldn't matter.
12:25arkhtmciver: hey, thanks for looking. I know I copied it verbatim and wondering what the t meant. I removed the t, did a package-refresh-contents - still no dice
12:25Raynesarkh: Github actually doesn't support elisp anymore specifically than refheap does. It uses the scheme lexer behind the scene. You can do the same on refheap (wrt https://refheap.com/paste/321). Just a heads up.
12:26RaynesI should add an "Emacs Lisp" button like gist, I guess. I guess it feels kind of dishonest, since it'd use the scheme lexer.
12:27arkhrefheap is black and makes me feel like a haX0r :3
12:27RaynesIt also means cluttering the list with what are essentially duplicates, but you gain the ability to know precisely what language it is by looking at the language name in the upper left corner, so I'm somewhat torn.
12:27RaynesHaha
12:28arkhmy vote would be for specificity
12:28RaynesYeah, I think I agree.
12:28arkhit's data that could yield something later on *shrug*
12:29arkhRaynes: you made refheap?
12:30Raynesarkh: With Alex McNamara, yes.
12:43technomancy_arkh: can you paste the list of available packages?
12:46technomancy_TimMc: you should use nix: http://nixos.org/nix
12:46TimMctechnomancy_: Probably.
12:46technomancy_you can keep your system package manager super-stable and out of date while using nix for newer stuff
12:46technomancy_and it never breaks
12:47technomancy_or rather, if it breaks, it's trivial to roll back
12:49dakronetechnomancy: does nix have a pretty large package list so far?
12:49TimMcI hear it can not only make toast, but even make two different kinds of toast at once.
12:49technomancydakrone: not as big as Debian, but it's got everything I've wanted so far.
12:50gtrakarkh: perhaps did you try to restart emacs after the changes?
12:50technomancyI was able to update its tmux package to 1.5 and have it accepted upstream within a day of starting to use it.
12:58technomancyinteresting; there are only 3 new contribs in the top-30 depended-upon list: http://clojuresphere.herokuapp.com
13:01TimMctechnomancy: data.json, tools.logging, and java.jdbc?
13:01technomancyyeah
13:01technomancykinda surprised java.jdbc isn't higher
13:01technomancyalso tools.cli, but I guess that makes sense considering clojure's CLI story sucks in general
13:02TimMcDoes it?
13:03technomancyit does.
13:03TimMcoh
13:03TimMcNow I know.
13:04technomancyjline is surprising to see in the top 30 though
13:04TimMctechnomancy: Are you referring to slow startup-time or things like stream handling, options parsing, etc.?
13:05technomancyTimMc: slow startup time, the lack of a canonical shell launcher, and the fact that every CLI app either has to distribute two files or resort to mildly heinous jar haxx.
13:05TimMcAh, right -- the executable problem.
13:06TimMcEh, I'm OK with uberjars for now.
13:07TimMcjar haxx == concatentation?
13:07technomancyyeah, something like that
13:08metajackErlang has more or les expected the concatenation trick as normal nowaday. It works surprisingly well now.
13:08metajacks/expected/accepted/
13:09metajackThe startup time isn't nearly as much of a problem though, so there's more benefit there to making that an easy thing to do.
13:10technomancyI also wonder if you can set -Xmx and friends that way
13:10technomancyoh, of course you can
13:11TimMc`lein jarhaxx`
13:12metajackRebar has it as a plugin. rebar escriptize :)
13:12TimMcHow different is this really from self-unpacking shell scripts?
13:12technomancyself-unpacking shell scripts are also crazy?
13:12clojurebotexcusez-moi
13:22TimMcand pretty common
13:26Raynestechnomancy: We should buy that guy a domain name.
13:27Raynestechnomancy: I'll buy clojure, you buy sphere. We'll put 'em together and send them gift-wrapped.
13:28technomancyvery thoughtful
13:29arkhgtrak: yes, I have restarted emacs
13:31arkhtechnomancy: I just thought of something network related because emacs doesn't seem to be getting the list of packages - brb
13:31arkhtechnomancy: doing a packet capture to see what's up
13:32technomancyyeah, I have been bitten by that; if you try it behind a captive portal or something it can get pretty confused
13:50arkhtechnomancy: when I do a package-refresh-contents emacs only grabs from elpa.gnu.org despite my init.el, shown here: https://refheap.com/paste/331
13:50arkhinit.el should be a copy from the github clojure mode repo
13:54arkhit must be a configuration issue because no attempt is made to resolve or connect to marmalade-repo.org
13:54technomancyvery strange. you don't have a funny network proxy situation or anything do you?
13:55arkhit's funny in that I'm going through two NATs but that shouldn't affect anything. I've had trouble with some ftp servers in the past, however
13:55arkhno proxies
13:57technomancysorry, I'm out of ideas =\
13:57arkhoh noes!
13:58arkhthank you for looking into it
13:59TimMcarkh: Maybe that init file isn't being read?
13:59TimMcPut a syntax error in it to check.
14:01Vinzenttechnomancy, by the way, about your http://dev.clojure.org/jira/browse/CLJ-879: I found myself using [:use ns :only [] :as alias] instead of :require. Why adding :refer support to :require would be better?
14:01technomancyVinzent: :use with :as technically works, but it's undocumented and unsupported
14:01technomancyhaving to add in :only [] strikes me as very hacky.
14:02technomancyit's only necessary because of a design flaw in :use
14:02arkhTimMc: that's the problem ... sorry, dummy mistake on my part. It doesn't like something so therefore it's not acting on the marmalade stuff
14:06Vinzenttechnomancy, hm, haven't know it's unsupported - I was using :as for a long time, but only recently began to avoid :require.
14:06chouser_I use :only [] because it looks as hacky as it is, and I'm very much looking forward to :require with :refer
14:06technomancyVinzent: it works by accident
14:07technomancyit's an implementation detail that the :as argument is passed along
14:07technomancychouser: did you vote on the issue? =)
14:07arkhTimMc: error is here: https://refheap.com/paste/333
14:07chouserhm, no.
14:07chouserI guess I should
14:07Vinzenttechnomancy, but it opens the way to deprecate require, and if allow in 1.4 to write (:use [ns :all]), which would do the same as (:use ns), it'd be possible to deprecate :use without :only or :all in 1.5
14:08technomancychouser: because, you know, every vote counts!
14:08technomancyVinzent: deprecating :use instead of :require would be a lot less drastic
14:08chouserI thought it was fully discussed and without objection.
14:08technomancychanging the behaviour of :use would break a lot of things. enhancing :require is a purely additive change.
14:08technomancychouser: me too!
14:08technomancybut then it's been ignored.
14:09arkhTimMc: nvm - I think I see the problem now
14:09chouserdoes it need to be screened or something? I can't keep our process straight in my head.
14:09technomancymaybe?
14:10chouseroh, I've had this open in a tab to screen when I get a chance.
14:10Vinzenttechnomancy, why? I'm not saying about breaking things. I'm saying that use of :use without :only clause or :all keyword should be discouraged. It won't break any code.
14:10technomancythe dude next to me in the coffee shop asked me about my "my other car is a cdr" sticker and now he's going to try out clojure =)
14:10gtrakawesome
14:11technomancyVinzent: it's already discouraged
14:11technomancywell, not by the official docs
14:11technomancybecause there really are no official docs
14:13Vinzenttechnomancy, yes, and :use already supports all required features, so only 2 thins need to be done: 1. Allow to write (:use [ns :all]) - just ignore this :all keyword and 2. state in the doc to use that in future it should not be used without :all or :only
14:13chouserI've been so busy using Clojure the last 3 months or so, I've been doing much less working on it.
14:13chouserI've got my own pet patch sitting here, not even submitted yet.
14:14technomancychouser: you're not the only one
14:14technomancyeverybody's seen and filled out http://lein-survey.herokuapp.com/ right?
14:15chouseryep. clojure-jack-in gorgeous. as is evil. and so is lonocloud, for what it's worth. :-)
14:16technomancyI read that "and is evil."
14:22emezeskearrg, I'm having a really hard time not double posting to the clojure google group
14:22emezeskeI'm new, so I'm in the moderation time bubble. After every post though, I'm left wondering, "did that *really* go through?"
14:23technomancydoesn't your first accepted post get you non-moderated status?
14:24emezeskeit's not really clear, that's what I would have thought, but...
14:25emezeskethere's just really no feedback; it would be nice if google groups showed my message with a "this post is being held for moderation" tag on it
14:25emezeskeor something
14:29arkhlonocloud doesn't have much info on their site
15:07arohner`technomancy: have you tried any experiments using robert hooke in code you own? I know the docs say it's better for hooking 3rd party code
15:42mpenetHi
15:43mpenettechnomancy: if you have a minute could you give me your feedback on this issue: https://github.com/technomancy/leiningen/issues/365
15:48TimMcheck yes, imma get me a Leiningen sticker
15:50geoffeg_ci'd like a clojure sticker too
16:14pyrmpenet: hey, there seeems to be a precedent here: https://github.com/technomancy/s3-wagon-private
16:18emezesketechnomancy: the lein PLUGINS.md for 2.0 looks very good. the pprint example plugin was a good idea.
16:20technomancyemezeske: great; thanks
16:22mpenetthanks pyr I'll check
16:23technomancypyr: precedent for what?
16:23pyrtechnomancy: plugins importing custom wagons
16:23pyrtechnomancy: though not the project.clj syntax
16:23technomancympenet: oops; must have gotten disconnected; I meant to say that your issue looks totally reasonable and should make it into 1.7.0
16:24mpenetawesome
16:24technomancypyr: yeah, wagons are easy; they just have to be on the classpath.
16:24technomancympenet's patch looks like it adds a lot more than just wagons
16:24mpenetI will send you a pull request asap
16:25mpenetyes extensions can do many things apparently
16:25technomancympenet: the thing is that the pom task is getting totally rewritten in 2.0
16:25mpenetI only ran into this because of dav support
16:25mpenetyes I noticed
16:29mpenetI will try to follow what happens with 2.0 and update this for it when the time comes.
16:29mpenetBut it seems a bit early now
16:30technomancympenet: actually there are only three tasks (pom included) blocking a release of Leiningen 2.0 "preview edition", so even though a final release is still far off, it could be usable for everyday things in a matter of weeks
16:32mpenetok, I have yet to learn how 2.0 works, I just scratched the surface
16:33technomancympenet: I just rewrote a lot of the docs for it; in particular https://github.com/technomancy/leiningen/blob/master/leiningen-core/README.md
16:33technomancyvery interested in feedback on that
16:34mpenetI will have a look
17:00nickmbaileyis it possible to 'rename' a static method from a java class? for example (def nan? Double/isNaN)
17:00nickmbaileythat doesn't work because clojure thinks isNaN should be a static field
17:01technomancynickmbailey: java methods are not first class and can't be stored in locals or vars unfortunately
17:01technomancyI guess theoretically method handles could be in java7, but clojure doesn't support it
17:01nickmbaileybollocks
17:01technomancywow, backport-util-concurrent is released in the public domain.
17:01technomancycrazytown
17:02raeknickmbailey: you could store a function though... (defn nan? [n] (Double/isNaN n))
17:02dnolennickmbailey: what raek said
17:02nickmbaileyyeah i just did that
17:02nickmbaileyjust wondering if there was a way to do it the other way
17:02raektoo bad public domain is only legally valid in the US (and possible some other countries)
17:03raekin the other countries you fall back to "all rights reserved"...
17:03technomancyraek: yeah, that was a high-profile enough project that you'd expect them to be a bit more internationally-minded
17:03raekwhich is kinda the opposite of the intention
17:04TimMcraek: So just take their stuff and license it for them, eh? :-)
17:05TimMcI wonder what the legality of that is.
17:05technomancyin germany at least it's the "moral rights" of the author that come into play
17:05raekTimMc: if I would have lived in the US maybe I could have done that... interesting
17:05TimMcI think Creative Commons has a public-domain-equivalent license also.
17:05technomancyso third-party relicensing is invalid
17:05TimMcand there's always the WTFPL
17:06technomancybackport-util-concurrent is useless though; I let it slip into the deps list by accident
17:06raekyeah, you can't transfer the ownership of copyright in swedish law
17:06pjstadighttp://unlicense.org/
17:07raekbut the copyright holder can of course make contracts and licenses, etc
17:07technomancycrikey; sbcl is PD'd?
17:07pjstadigthe Unlicense license i think tries specifically to deal with the problem of not having public domain in some countries
17:07pjstadigso is sqlite
17:08technomancythe crazy thing about SBCL is that it's a fork of CMUCL; also PD'd
17:08technomancyso even if they wanted to license it they couldn't do it in a way that would apply internationally
17:08raekpjstadig: cool
17:09cemerickwow, Tuesdays *are* for license griping! ;-)
17:09pjstadighehe
17:18technomancycemerick: do you have a more canonical version of https://gist.github.com/1452640 ?
17:21cemericktechnomancy: you mean, a lein plugin?
17:21technomancycemerick: it's more that I'm looking for something that will run without having to guess where the defns come from =)
17:22cemerickah :-)
17:22technomancyoh... does that require something newer than pomegranate 0.0.1?
17:22cemerick0.0.2
17:22technomancythat'd do it; thanks
17:22cemerickboth functions of interest are in cemerick.pomegranate.aether
17:23cemerickThat would have been helpful :-/
17:24cemerickgist updated FWIW
17:25technomancythanks
17:25cemerickI can reasonably start on a proper lein2 plugin for pomegranate this weekend.
17:26technomancycemerick: specifically for the tree display?
17:26technomancylein2 is already built around pomegranate =)
17:26cemerickyeah, tree and list views.
17:27cemerickhrm, perhaps that stuff should then just be a pull req into lein?
17:27technomancyyeah, that's useful enough to justify being built-in
17:28cemerickjust be a pprint call with tweaked formatting probably
17:28technomancythough if you've got some hack time making pomegranate support repository arguments as maps that contain auth info and snapshots vs releases would rank higher on my own personal list.
17:29cemericktechnomancy: already in there :-)
17:29technomancyoh hey, cool.
17:29cemerickThat was part of xeqi's killer contrib
17:30technomancycemerick: have you seen trptcolin's reply lib?
17:30cemerickmaybe?
17:30technomancythe jline2 thingy
17:30cemerickoh, the REPL he was working on at the conj
17:31cemerickmy TODO list at the moment is (1) nREPL spike (2) tree/list chrome (3) a new CouchDB .app for OS X. That should carry me through Monday or so.
17:32technomancyyeah, ideally I'd like lein to use reply as a client and nrepl as a server, but that's probably not going to happen for the preview
17:34cemerickI'll have to read up on reply, see what it's all about.
17:34technomancyapparently it already has pretty decent completion from the CLI
17:58replaca_Q: is their some reason that "lein uberjar" takes over a minute to get to the first "compiling..." line? This is over and over, not just on the first run of the day.
18:29kephalereplaca_: doesn't uberjar do a clean (and a deps?) task before compiling?
18:32amalloyif uberjar does a clean that's pretty dumb, right?
18:33kephalethe deps?
18:34technomancykephale: it will only do deps if they've changed
18:34kephaleaha
18:34replaca_since I'm running it back to back the deps should be instant
18:34replaca_that's why I'm confused - it feels like it's trying to lock something it can't or something like that
18:38phzboxIn repl: Math/sqrt output: CompilerException java.lang.RuntimeException: Unable to find static field: sqrt in class java.lang.Math, compiling:(NO_SOURCE_PATH:0). Why?
18:38phzboxOr (map Math/sqrt [9]) doesn't work but (Math/sqrt) work
18:40dnolenphzbox: because Math/sqrt is not a function
18:40dnolen,(map #(Math/sqrt %) [9 25])
18:40clojurebot(3.0 5.0)
18:42phzboxoh :/
18:43phzboxSo if it works when I do (Math/sqrt), it's because it's a reader macro that translate it to something else?
18:43hiredman,(macroexpand '(Math/sqrt 1))
18:43clojurebot(. Math sqrt 1)
18:44phzboxok, I see. So there's no way to have a "reference" to a normal java function, right? I.e. (def x Math/sqrt) or something similar?
18:45amalloy"a normal java function" - no such thing exists, which is why this is hard
18:45amalloywell. "hard"
18:45phzboxMy bad, a static java class function
18:47amalloy"java function" - no such thing. there are only methods, which are not first-class objects the way functions are in clojure
18:47Raynes$dict pedant
18:47lazybotRaynes: noun: One who pays undue attention to book learning and formal rules.
18:48amalloyuh, it might be pedantry if it weren't relevant
18:48phzboxAight thanks. I was just experimenting in the repl and didn't get why one was working but not the other.
18:49amalloyhe's imagining it will be easy because it's easy for functions; methods are different
18:50hiredmanit seems like it should be possible use a static method as a value
18:51hiredman(which is what you want when you try to map one over a seq)
18:51amalloyhiredman: in java, or in clojure?
18:51hiredmanin clojure
18:51hiredmanthe "value" of a static method would be a fn that calls the method
18:54amalloyhiredman: sure, but you end up generating a big old function, usually for no reason. (static->fn Math/sqrt) would have to expand to something like (fn ([] (Math/sqrt)) ([x] (Math/sqrt x)) ([x y] (Math/sqrt x y))), right?
18:54amalloy(ignoring for now whether static->fn is actually a reader macro that gets applied implicitly by magic)
18:55hiredmanamalloy: if you can reflectively tell that Math/sqrt is a static method you can also determine arity, etc
18:55hiredmanit would be part of symbol resolution
18:57hiredmanthe compiler would say "Oh, you are trying to take the value of the symbol Math/sqrt, which has no value in the current environment, but there is this Math class and it has a static method sqrt, I got your back bro"
18:57Raynesamalloy: Isn't 'method' just a special case of 'function' -- as in a function that is tied to a class? I was assuming just slightly incorrect terminology rather than a complete misunderstanding about how the universe works, but I accept that I could be wrong.
18:57amalloyhiredman: right, that's vaguely what i meant by my hand-wavy "reader macro"
18:57technomancyyeah, static methods are rather friendlier at compile-time
18:57amalloyRaynes: methods don't have a runtime value like functions do
18:58hiredmanthey sort of do, java.reflect.Method but thats not really useful here
18:58hiredmanyou could do this with invokedynamic, but it's not really required
18:59hiredmanI wonder how hard it would actually be to implement
18:59amalloyhiredman: for just static methods?
18:59hiredmansure
19:00amalloywell, i was going to say it would be pretty easy, but i suppose you have to do it in java with a very limited toolset
19:00hiredmanno hope of doing it without runtime reflection for instance methods
19:00hiredmanamalloy: right
19:00hiredman:(
19:01amalloytbh i have no idea where in the compiler symbol-resolution happens. hint, anyone?
19:03amalloyi see static Symbol resolveSymbol(Symbol sym), but that's more like namespace-quoting
19:03hiredmanthe way I would do it stick a dummy var in the var cache for the enclosing function
19:04hiredmanwhich is maybe lookupVar
19:05amalloyi'm not sure how well that will work, because that will also get called for (Math/sqrt 1), right?
19:07hiredmanamalloy: no, Math/sqrt will get turned into the static method call before you get that far
19:07hiredmanI believe
19:07hiredmanthe first position is special
19:08amalloyi'll take your word for it. there's a lot i don't know about the compiler
19:08hiredmanwe are gazing over the abyss in to lisp-2 land
19:10amalloyhah
19:10hiredmanyeah, macroexpansion happens before analysis
19:10amalloyoh right, i forgot that happens in macroexpansion. of course
19:11hiredmansomeone write this down
19:55c0smikdebristrying to install cake through homebrew is giving me a 404. is there any other way i can install it?
19:57Raynesc0smikdebris: Development of cake has pretty much ended. We all decided we'd rather work on Leiningen and have a single canonical build tool.
19:59c0smikdebrisahh. I'm new to clojure and i'm trying to setup a dev environment. should I use Leiningen then?
19:59RaynesYes. Leiningen is excellent.
20:00c0smikdebrisRaynes: cool. thanks
20:19TimMcWho are (were) the cake devs?
20:23alexbaranoskyninjad, Raynes, not sure... probably amalloy ?
20:23TimMcah, found the repo
20:24amalloyi did a little. in order of amount contributed, it's gotta be ninjudd, lancepantz, Raynes, and then maybe me or some other random contributor)
20:24amalloyhttp://github-high-scores.heroku.com/flatland/cake/high_scores/
20:25TimMchttps://github.com/flatland/cake/graphs/impact confirms
20:25TimMcamalloy: wtf
20:27amalloyTimMc: best app ever, eh?
20:27TimMcpretty wild
20:29technomancyneeds to ease off on the anti-aliasing of the avatars imo
20:30Scriptorwas there a conscious decision to have most seq functions return lazy seqs (as in clojure) in clojurescript or was it done just to keep them similar?
20:31technomancyhttp://github-high-scores.heroku.com/clojure/clojure/high_scores/ <- ha ha, clojurebuild is #5.
20:32technomancygets into the triple-digits disappointingly quickly
20:35Scriptorafaik, laziness is most beneficial with very long lists, which I don't think happens a lot in js apps
20:35Scriptorbut I'm not sure if I'm right about that
20:36technomancyit's also beneficial in that it lets you not have to think about whether a list will be consumed or not when you're constructing it
20:40Scriptorwhat specific ways does that help? I can see it freeing you from worrying about making a list too computationally expensive if it's consumed all at once
20:40clj_newbdumb question: how do I convert a _lazy_ list of chars to a String ?
20:40stuartsierraapply str
20:40technomancyScriptor: it helps avoid complexity in cases where the seq is never fully consumed
20:41clj_newbstuartsierra: nice, I was using (str, rather than (apply str
21:42mindbenderI'm having trouble getting my browser to connect to the clojurescript repl started from my emacs. I suspect the .js emitted from the cljsc/build without advanced optimizations does not reference the other required .js with the correct directory location. Here is an sample output .js from the build process of the hello world example from https://github.com/clojure/clojurescript/wiki/Quick-Start: https://gist.github.com/1630506. Observe that the hello.js
22:52wallhello. i have questions about fnparse. How get info about position token (start and end column) in rule?
22:57wallhas anybody help me?
23:10espringeHow can I turn this into a 1-functioner [so i can give it to 4clojure]:
23:10espringe(def fib-seq (lazy-cat [0 1]
23:10espringe (map + fib-seq (rest fib-seq))))
23:10espringe#(take % fib-seq)
23:28amalloyespringe: that's relying on the mutability of a def to accomplish a self-recursive data structure. to use the same algorithm without a def, you need another mutable structure. in this case, a promise is probably most appropriate
23:29espringeamalloy: Is the best way to do this with an immutable datastructure?
23:30espringeLike this would be very easy in haskell, i'd just map fib to an infinite range
23:30amalloyright, that's the haskell formulation
23:30espringenot sure how to do the same thing in clojure though
23:30espringeThe best way is a promise?
23:30amalloyno, blech
23:30amalloythat's just how to do the haskell impl in clojure :P
23:31amalloythe canonical clojure implementation is something like ##(->> [0 1] (iterate (fn [[a b]] [b (+ a b)])) (map first) (take 10))
23:31lazybot⇒ (0 1 1 2 3 5 8 13 21 34)
23:31espringeSo my recurisve def solution is the idiomatic clojure way? Except 4clojure just doesn't allow it?
23:32espringeSweet, thanks :D
23:32Scriptorwhich 4clojure problem is that?
23:32espringehttp://www.4clojure.com/problem/26#prob-title
23:32amalloy$google 4clojure fibonacci
23:32lazybot[My solutions for the first 50 problems on 4clojure.com | yyhh.org] http://yyhh.org/blog/2011/05/my-solutions-first-50-problems-4clojure-com
23:32adiabatic4clojure allows def now? :D
23:32espringeNo, that's the problem :( :P
23:33Scriptorhmm, looks like I just used loop/recur
23:33adiabaticI did https://gist.github.com/1630994 . I'd probably try a loop/recur thingy if I were to take a second crack at it.
23:34adiabatic<-- single-assignment newbie
23:36Scriptormine: https://gist.github.com/1631002
23:37espringeI just hijacked amalloy's: #(->> [1 1] (iterate (fn [[a b]] [b (+ a b)])) (map first) (take %)) which works really nicely :D
23:39amalloywe actually could allow def now: we have the tools. but i really like the brain-expansion that you get by realizing that you never *need* the side effects that def creates: any single value you want to manufacture can be constructed as the result of a single expression
23:41adiabaticI think it'd be darn nice to be able to use def in a file (for println debugging), and then be able to copy-and-paste wholesale without having to aim for the second paren from the end
23:41espringeI'd like to be able to use def, just as I'm using 4clojure to learn clojure -- so the more of the language and practical it is the better :D
23:42Scriptorif you use paredit, the aiming for the 2nd paren isn't much of a problem :)
23:42adiabaticIs that an emacs thing?
23:42espringeSpeaking of paredit, I started using it a couple days ago -- but I have a big problem. Say I have (an s expression) and I want to wrap it with [] how do I do that?
23:43espringeAnd since paredit doesn't allow me to have anything unbalance,d I can't do it manually
23:43Scriptoradiabatic: yep, it helps with editing paren-heavy language files
23:43espringeAnd I can use the barf/slurp to wrap something in [ ]
23:43amalloyespringe: well, you can bind M-x paredit-wrap-square to a key if you want
23:44amalloyi used M-[, but that interfered with ssh ascii escape characters, so i just settled for using slurp
23:45espringeamalloy: Great, thanks! Didn't know about paredit-wrap-square
23:45espringeHow do you use slurp with [] ? I can't get that working
23:45espringeThat's my ideal solution, if i could just slurp it into the [ ]
23:45amalloyjust...type [], move point inside, then slurp?
23:47espringeDoesn't work for me :S, By slurp you mean, paredit-forward-slurp-sexp ( or C-) )
23:49amalloyindeed. are you using like version 0 of paredit? or do you not have it set up to treat [] as a balanced pair?
23:49espringeLike I have this: [](blah blah) and I want to end up with: [(blah blah)] ?
23:49amalloyright. putting point inside of [] and then slurping should do it. if it doesn't, weirdness is happening
23:50espringeI have the latest version (only installed it a few days ago) and it's treating [] very balanced (i can't figure out how to have unbalanced [ ] for the purposes of manually doing it
23:52espringeAh nice, I restarted and its working. Since i was using paredit in the repl thing, something must have messed it up