#clojure log - Jan 17 2012

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:11 clj_newb: is 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) ?

0:12 is 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? :-) ]

0:22 ambrosebs: clj_newb: the answer is don't do this.

0:22 (or see the source for clojure.core if you really want to)

0:24 you could :use other namespaces in "animals.clj", and when you :require animals, you'd also get access to the functions animals :use's

0:25 see core.logic for an example of that

0:25 although core.logic may be all in one file, I can't remember

0:29 correction: I was wrong about :use'd functions being transitively :use'd

0:33 clj_newb: another strategy: define all public functions in "animals" and use a child namespace to define the private helpers

0:59 clj_newb: ambrosebs: noted. thanks!

1:28 seancorfield: clojurescript question...?

1:28 if i do getElementsByTagName() i get a NodeList... how can i convert that to a sequence i can call map on?

1:29 i know Array.prototype.slice.call(tags) turns it into a JS array but that didn't seem to help...

1:38 daaku: i'm writing some docs using Marginalia, and was wondering how to document functions generated by some macros i've written

1:39 my 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)

2:00 devn: good lord clojurescript one is great

3:50 amalloy: $google clojure tools.macro name-with-attributes

3:50 lazybot: [clojure.tools.macro - Tools for Macro Writers 0.1.2 API documentation] http://clojure.github.com/tools.macro/

3:50 amalloy: daaku: ^

3:58 kral: namaste

4:08 Blkt: good morning everyone

4:08 bluezenix: good

4:52 wiseen: can 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]))

4:52 and handleDownstream is in the interface

5:12 zoldar: wiseen: 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

5:13 wiseen: zoldar, i figured it out I needed to add a ref for the [this foo bar]

5:13 this

5:13 bluezenix: is there a place to offer clojure jobs without being considered a spammer? :)

5:13 zoldar: right

5:14 bluezenix: http://functionaljobs.com/ ?

5:14 bluezenix: interesting, thanks

5:16 nybbles: hi 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

5:17 raek: nybbles: skip the #

5:17 zoldar: nybbles: http://blog.fogus.me/2009/12/21/clojures-pre-and-post/

5:17 babilen: nybbles: And you surely meant (foo 10) not (wtf 10) there?!

5:18 nybbles: raek, zoldar: thanks argh i was looking at that blogpost but didn't see that the '#' was not required

5:18 babilen: 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

5:18 thanks everyone.. maybe it's time for bed :|

5:19 babilen: nybbles: 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.

5:19 raek: also, only use pre- and postconditions to catch bugs. since they can be disabled then shouldn't be used for validating user data etc

5:20 *they

5:20 nybbles: raek: good point hm

5:21 babilen: i should just not be shy about leaving my function names as they are, i guess..

5:22 fortunately, 'wtf' is about as colourful as it gets

5:22 babilen: indeed :)

5:24 zoldar: nybbles: maybe this library will get you interested https://github.com/fogus/trammel (along with the whole approach)

5:26 nybbles: zoldar: awesome thanks this looks really useful

5:43 Borkdude: Does it matter if you use get or nth for a vector?

5:47 raek: Borkdude: not as long as the index is within bounds

5:47 ,(get [] 1)

5:47 clojurebot: nil

5:47 raek: ,(get [] 1 :not-found)

5:47 clojurebot: :not-found

5:47 raek: nth throws if the index is out of bounds

5:48 Borkdude: ah

5:48 raek: 'get' has more of an "map-like" behavior and 'nth' more of an "array-like"

6:25 Leiningen-using Clojurians, don't forget to fill in this! http://lein-survey.herokuapp.com/

6:26 clgv: raek: oh

7:16 Folcon: Hey everyone, I've been building viterbi in clojure and I'm wondering if anyone would have some time to discuss my implementation?

7:17 I'm not really put together anything like this in clojure and it's quite slow so any help would be appreciated

7:22 It's viewable here https://gist.github.com/1626486

7:41 clgv: Folcon: 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

7:42 Folcon: did you measure performance bottlenecks yet?

8:56 Folcon: clgv: 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.

8:56 I'll typehint the strings, but I should be working with primitives for the computation?

8:57 clgv: Folcon: do you use clojure 1.3?

8:57 Folcon: Should I change over to primitive values only in the scope of a computation?

8:57 clgv: Yes

8:58 clgv: yes. and in clojure 1.3 you should type hint the functions that return primitives

8:58 Folcon: clgv: I see.

8:58 clgv: Folcon: additionally for a vector of primitives there is 'vector-of

8:59 Folcon: clgv: That's good to know :)...

8:59 clgv: yep. saves boxing as well

8:59 s/saves/avoids/

9:00 Folcon: clgv: Thanks for your help, anything else?

9:01 clgv: Folcon: not without a concrete bottleneck I think ;)

9:06 Folcon: clgv: Brilliant, thanks a lot. I'll start with those and see where it gets me :)... Much appreciated!

9:07 clgv: It's times like this I wish there was a stackoverflow like site for collaborative code review :)

9:07 clgv: Thanks again!

9:07 clgv: np.

9:07 jfields: I'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?

9:12 clgv: jfiels: have a look at select-keys

9:12 raek: jfields: do you want to check if the set of keys is a subset or if the set of entries is a subset?

9:13 clgv: oops. misread

9:14 Licenser: Folcon I think you always can post a copy of your code on github or related and aks oppinions

9:16 jfields: raek, I want the keys & values to match

9:16 raek, so, entries, I believe.

9:17 clgv: jfiels: there is a clojure.data/diff function in clojure 1.3 you could use

9:17 &(doc clojure.data/diff)

9:17 lazybot: java.lang.RuntimeException: Unable to resolve var: clojure.data/diff in this context

9:17 clgv: &(use 'clojure.data)

9:17 lazybot: ⇒ nil

9:17 clgv: &(doc clojure.data/diff)

9:17 lazybot: ⇒ "([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

9:18 jfields: clgv, thanks, I'll give it a look

9:34 raek: jfields: 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))

9:41 jfields: raek, 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)))

9:41 raek, the select-keys version falls down when a val is a map and it has keys that I'm not concerned with.

9:44 raek: ah, you wanted to do this check recursively...

10:10 TimMc: zoldar: Does functionaljobs actually *have* any jobs listed right now?

10:10 * giant_g2 wonders if there is a job for him anywhere

10:13 babilen: What 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:13 stuartsierra: Relevance is still hiring.

10:19 jsabeaudry: I 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:20 joegallo: Math/round takes a double or float. In java, if you passed in an int, it would automatically get upcasted.

10:21 I think you can probably (Math/round (double x))

10:21 and you'll be happy

10:21 not positive, though

10:21 rlb: http://richhickey.github.com/clojure-contrib/math-api.html#clojure.contrib.math/round

10:21 lazybot: Nooooo, 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:21 babilen: jsabeaudry: What about numeric-tower/round?

10:21 rlb: lazybot: tell google ;>

10:21 Raynes: Or, if you're paranoid, ##(if (integer? 1) 1 (Math/round 1))

10:21 lazybot: ⇒ 1

10:22 babilen: jsabeaudry: https://github.com/clojure/math.numeric-tower (if you are using clojure 1.3.*) -- clojure.contrib.math if < 1.3

10:22 Raynes: Doesn't help much anyway, since clojure.contrib libs are out of date themselves, so linking to even the canonical repo isn't helpful.

10:23 Not that you were being unhelpful...

10:23 Bah.

10:24 jsabeaudry: Alrighty, numeric tower is a strange name to me but I guess that is the option that will yield the most readable code

10:25 clgv: where was that decision chart for reify, genclass & co?

10:26 Raynes: clgv: https://github.com/cemerick/clojure-type-selection-flowchart

10:29 mdeboard: Oh, nice.

10:29 See, where, does defstruct fit in there?

10:30 Raynes: It doesn't.

10:30 mdeboard: s/where,/where

10:30 Then what's defstruct fer?

10:30 Raynes: defstruct is essentially deprecated.

10:30 mdeboard: by/because?

10:30 Raynes: defrecord/deftype are in all instances better.

10:30 mdeboard: in what way?

10:30 Raynes: They're faster, for one.

10:31 mdeboard: In what cases?

10:31 clgv: thx

10:31 mdeboard: Just trying to reconcile their deprecation with their use in Cascalog

10:33 (since I'm using cascalog as a reference for a thing I'm working on)

10:34 Raynes: mdeboard: I don't really know the exact performance comparison between the two.

10:35 mdeboard: mmkay, doesn't matter per se for me, just curious.

10:35 Raynes: Cascalog isn't going to explode because it uses structs.

10:35 I imagine it wont always use them.

10:35 Switching to deftypes/records would probably be trivia.

10:36 trivial*

10:37 mdeboard: 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:37 mdeboard: Cool.

11:18 Licenser: are there really leiningen stickers?

11:19 joegallo: really and truly

11:19 and they are awesome

11:21 zerokarmaleft: why get stickers when you can get an infant bodysuit?

11:21 mdeboard: wat

11:22 zerokarmaleft: cafepress puts logos on everything

11:22 mdeboard: lein depends

11:22 adult diapers

11:23 zerokarmaleft: i just think that's a particularly bizarre niche product

11:23 actasgeek: isi it possible to update cljr to Clojure 1.3?

11:23 Raynes: Last I heard, technomancy_ was ordering a new batch of stickers.

11:23 Licenser: zerokarmaleft why would I want a leiningen infant bodysuit?

11:23 Raynes: I am awaiting mine.

11:23 mdeboard: your bodysuit?

11:23 * Licenser wants one two

11:23 Raynes: Yes.

11:23 mdeboard: I'm terrified.

11:23 clojurebot: It's greek to me.

11:24 zerokarmaleft: Licenser: i was kidding, just seeing the random stuff available at http://www.cafepress.com/technomancy

11:29 actasgeek: Raynes, was that yes directed at me?

11:30 Raynes: Nope.

11:30 actasgeek: bummer. LOL

11:32 Let 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:36 geoffeg_c: How 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:38 joegallo: leiningen-war suggests lein-ring

11:38 on the page you linked to

11:38 on the page for lein-ring, it says you can lein ring war

11:38 geoffeg_c: i thought lein-ring was only to to be used for development.. like ruby's web brick

11:39 joegallo: i don't know, not having used either of them -- i'm just pointing out stuff from the webpages you posted

11:39 geoffeg_c: thanks, i'll take a look

11:40 joegallo: np good luck

11:41 Raynes: I heard that Clojure is only to be used for development.

11:41 We shouldn't use it in production.

11:41 ;)

11:47 clgv: Raynes: thats true - dont dare to ;)

11:55 geoffeg_c: joegallo: that worked, thanks!

11:55 solussd: what XML parsing/emitting libraries are available for clojurescript?

11:59 arkh: solussd: do you need parsing at the compile stage or run-time, on-the-browser?

11:59 I 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:00 er - sorry, not even xml per se

12:06 TimMc: solussd: Parsing into what?

12:06 I'm sure you could just "eval" it by loading it as a subdocument of some sort.

12:09 sritchie: have any of you guys used core.cache?

12:09 arkh: I 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:10 when I try a package-install within emacs, it finds other packages but not clojure-mode

12:10 TimMc: arkh: When you do M-x package-list-packages, is clojure-mode missing?

12:11 arkh: I get a long list but nothing clojure.+

12:13 hmm - available packages list isn't that long actually, maybe 20 to 25 items

12:13 that "long list" is mostly have I already have installed

12:13 <-- just started using emacs for the first time yesterday

12:13 gtrak: paste your init.el

12:14 TimMc: ~paste

12:14 clojurebot: paste is gist

12:14 TimMc: clojurebot: You are terrible.

12:14 clojurebot: Excuse me?

12:15 Raynes: https://refheap.com

12:15 </shamelessplug>

12:16 TimMc: clojurebot: paste is https://refheap.com/

12:16 Raynes: <3

12:17 gtrak: well done making clojure the default, a subliminal attack :-)

12:17 Raynes: WAR!

12:17 clojurebot: c'est bon!

12:17 TimMc: Raynes: Ugh, browserid is broken or something.

12:17 Raynes: TimMc: In what way? Seems to be working for me.

12:18 TimMc: I click buttons, things fail to happen.

12:18 Raynes: What browser?

12:18 TimMc: Mozilla Firefox 3.6.*

12:18 Raynes: Oh, yeah, I definitely am not trying to support that.

12:18 I imagine browserid isn't either.

12:18 TimMc: BrowserId is an ill-conceived weak-ass piece of shit anyway, so... whatever.

12:19 Raynes: Okay.

12:19 TimMc: I really had my hopes up when it was first described, but ti turned out to be YAOpenId.

12:19 </rant>

12:20 arkh: TimMc: https://gist.github.com/1627592

12:20 Raynes: But why such an old firefox?

12:21 TimMc: Raynes: Linux Mint

12:21 I 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:22 Raynes: Well, in any case, I apologize for my ill-conceived weak-ass piece of shit sign in button not working for you. ;)

12:22 TimMc: Ubuntu has made me upgrade-shy.

12:22 tmciver: arkh: 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:23 arkh: not sure if it matters - just my two cents.

12:24 looks like that is an append flag, so it shouldn't matter.

12:25 arkh: tmciver: 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:25 Raynes: arkh: 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:26 I 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:27 arkh: refheap is black and makes me feel like a haX0r :3

12:27 Raynes: It 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:27 Haha

12:28 arkh: my vote would be for specificity

12:28 Raynes: Yeah, I think I agree.

12:28 arkh: it's data that could yield something later on *shrug*

12:29 Raynes: you made refheap?

12:30 Raynes: arkh: With Alex McNamara, yes.

12:43 technomancy_: arkh: can you paste the list of available packages?

12:46 TimMc: you should use nix: http://nixos.org/nix

12:46 TimMc: technomancy_: Probably.

12:46 technomancy_: you can keep your system package manager super-stable and out of date while using nix for newer stuff

12:46 and it never breaks

12:47 or rather, if it breaks, it's trivial to roll back

12:49 dakrone: technomancy: does nix have a pretty large package list so far?

12:49 TimMc: I hear it can not only make toast, but even make two different kinds of toast at once.

12:49 technomancy: dakrone: not as big as Debian, but it's got everything I've wanted so far.

12:50 gtrak: arkh: perhaps did you try to restart emacs after the changes?

12:50 technomancy: I was able to update its tmux package to 1.5 and have it accepted upstream within a day of starting to use it.

12:58 interesting; there are only 3 new contribs in the top-30 depended-upon list: http://clojuresphere.herokuapp.com

13:01 TimMc: technomancy: data.json, tools.logging, and java.jdbc?

13:01 technomancy: yeah

13:01 kinda surprised java.jdbc isn't higher

13:01 also tools.cli, but I guess that makes sense considering clojure's CLI story sucks in general

13:02 TimMc: Does it?

13:03 technomancy: it does.

13:03 TimMc: oh

13:03 Now I know.

13:04 technomancy: jline is surprising to see in the top 30 though

13:04 TimMc: technomancy: Are you referring to slow startup-time or things like stream handling, options parsing, etc.?

13:05 technomancy: TimMc: 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:05 TimMc: Ah, right -- the executable problem.

13:06 Eh, I'm OK with uberjars for now.

13:07 jar haxx == concatentation?

13:07 technomancy: yeah, something like that

13:08 metajack: Erlang has more or les expected the concatenation trick as normal nowaday. It works surprisingly well now.

13:08 s/expected/accepted/

13:09 The 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:10 technomancy: I also wonder if you can set -Xmx and friends that way

13:10 oh, of course you can

13:11 TimMc: `lein jarhaxx`

13:12 metajack: Rebar has it as a plugin. rebar escriptize :)

13:12 TimMc: How different is this really from self-unpacking shell scripts?

13:12 technomancy: self-unpacking shell scripts are also crazy?

13:12 clojurebot: excusez-moi

13:22 TimMc: and pretty common

13:26 Raynes: technomancy: We should buy that guy a domain name.

13:27 technomancy: I'll buy clojure, you buy sphere. We'll put 'em together and send them gift-wrapped.

13:28 technomancy: very thoughtful

13:29 arkh: gtrak: yes, I have restarted emacs

13:31 technomancy: I just thought of something network related because emacs doesn't seem to be getting the list of packages - brb

13:31 technomancy: doing a packet capture to see what's up

13:32 technomancy: yeah, I have been bitten by that; if you try it behind a captive portal or something it can get pretty confused

13:50 arkh: technomancy: 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:50 init.el should be a copy from the github clojure mode repo

13:54 it must be a configuration issue because no attempt is made to resolve or connect to marmalade-repo.org

13:54 technomancy: very strange. you don't have a funny network proxy situation or anything do you?

13:55 arkh: it'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:55 no proxies

13:57 technomancy: sorry, I'm out of ideas =\

13:57 arkh: oh noes!

13:58 thank you for looking into it

13:59 TimMc: arkh: Maybe that init file isn't being read?

13:59 Put a syntax error in it to check.

14:01 Vinzent: technomancy, 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:01 technomancy: Vinzent: :use with :as technically works, but it's undocumented and unsupported

14:01 having to add in :only [] strikes me as very hacky.

14:02 it's only necessary because of a design flaw in :use

14:02 arkh: TimMc: 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:06 Vinzent: technomancy, hm, haven't know it's unsupported - I was using :as for a long time, but only recently began to avoid :require.

14:06 chouser_: I use :only [] because it looks as hacky as it is, and I'm very much looking forward to :require with :refer

14:06 technomancy: Vinzent: it works by accident

14:07 it's an implementation detail that the :as argument is passed along

14:07 chouser: did you vote on the issue? =)

14:07 arkh: TimMc: error is here: https://refheap.com/paste/333

14:07 chouser: hm, no.

14:07 I guess I should

14:07 Vinzent: technomancy, 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:08 technomancy: chouser: because, you know, every vote counts!

14:08 Vinzent: deprecating :use instead of :require would be a lot less drastic

14:08 chouser: I thought it was fully discussed and without objection.

14:08 technomancy: changing the behaviour of :use would break a lot of things. enhancing :require is a purely additive change.

14:08 chouser: me too!

14:08 but then it's been ignored.

14:09 arkh: TimMc: nvm - I think I see the problem now

14:09 chouser: does it need to be screened or something? I can't keep our process straight in my head.

14:09 technomancy: maybe?

14:10 chouser: oh, I've had this open in a tab to screen when I get a chance.

14:10 * chouser creates a chance.

14:10 Vinzent: technomancy, 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:10 technomancy: the 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:10 gtrak: awesome

14:11 technomancy: Vinzent: it's already discouraged

14:11 well, not by the official docs

14:11 because there really are no official docs

14:13 Vinzent: technomancy, 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:13 chouser: I've been so busy using Clojure the last 3 months or so, I've been doing much less working on it.

14:13 I've got my own pet patch sitting here, not even submitted yet.

14:14 technomancy: chouser: you're not the only one

14:14 everybody's seen and filled out http://lein-survey.herokuapp.com/ right?

14:15 chouser: yep. clojure-jack-in gorgeous. as is evil. and so is lonocloud, for what it's worth. :-)

14:16 technomancy: I read that "and is evil."

14:22 emezeske: arrg, I'm having a really hard time not double posting to the clojure google group

14:22 I'm new, so I'm in the moderation time bubble. After every post though, I'm left wondering, "did that *really* go through?"

14:23 technomancy: doesn't your first accepted post get you non-moderated status?

14:24 emezeske: it's not really clear, that's what I would have thought, but...

14:25 there'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:25 or something

14:29 arkh: lonocloud doesn't have much info on their site

15:07 arohner`: 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:42 mpenet: Hi

15:43 technomancy: if you have a minute could you give me your feedback on this issue: https://github.com/technomancy/leiningen/issues/365

15:48 TimMc: heck yes, imma get me a Leiningen sticker

15:50 geoffeg_c: i'd like a clojure sticker too

16:14 pyr: mpenet: hey, there seeems to be a precedent here: https://github.com/technomancy/s3-wagon-private

16:18 emezeske: technomancy: the lein PLUGINS.md for 2.0 looks very good. the pprint example plugin was a good idea.

16:20 technomancy: emezeske: great; thanks

16:22 mpenet: thanks pyr I'll check

16:23 technomancy: pyr: precedent for what?

16:23 pyr: technomancy: plugins importing custom wagons

16:23 technomancy: though not the project.clj syntax

16:23 technomancy: mpenet: oops; must have gotten disconnected; I meant to say that your issue looks totally reasonable and should make it into 1.7.0

16:24 mpenet: awesome

16:24 technomancy: pyr: yeah, wagons are easy; they just have to be on the classpath.

16:24 mpenet's patch looks like it adds a lot more than just wagons

16:24 mpenet: I will send you a pull request asap

16:25 yes extensions can do many things apparently

16:25 technomancy: mpenet: the thing is that the pom task is getting totally rewritten in 2.0

16:25 mpenet: I only ran into this because of dav support

16:25 yes I noticed

16:29 I will try to follow what happens with 2.0 and update this for it when the time comes.

16:29 But it seems a bit early now

16:30 technomancy: mpenet: 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:32 mpenet: ok, I have yet to learn how 2.0 works, I just scratched the surface

16:33 technomancy: mpenet: I just rewrote a lot of the docs for it; in particular https://github.com/technomancy/leiningen/blob/master/leiningen-core/README.md

16:33 very interested in feedback on that

16:34 mpenet: I will have a look

17:00 nickmbailey: is it possible to 'rename' a static method from a java class? for example (def nan? Double/isNaN)

17:00 that doesn't work because clojure thinks isNaN should be a static field

17:01 technomancy: nickmbailey: java methods are not first class and can't be stored in locals or vars unfortunately

17:01 I guess theoretically method handles could be in java7, but clojure doesn't support it

17:01 nickmbailey: bollocks

17:01 technomancy: wow, backport-util-concurrent is released in the public domain.

17:01 crazytown

17:02 raek: nickmbailey: you could store a function though... (defn nan? [n] (Double/isNaN n))

17:02 dnolen: nickmbailey: what raek said

17:02 nickmbailey: yeah i just did that

17:02 just wondering if there was a way to do it the other way

17:02 raek: too bad public domain is only legally valid in the US (and possible some other countries)

17:03 in the other countries you fall back to "all rights reserved"...

17:03 technomancy: raek: yeah, that was a high-profile enough project that you'd expect them to be a bit more internationally-minded

17:03 raek: which is kinda the opposite of the intention

17:04 TimMc: raek: So just take their stuff and license it for them, eh? :-)

17:05 I wonder what the legality of that is.

17:05 technomancy: in germany at least it's the "moral rights" of the author that come into play

17:05 raek: TimMc: if I would have lived in the US maybe I could have done that... interesting

17:05 TimMc: I think Creative Commons has a public-domain-equivalent license also.

17:05 technomancy: so third-party relicensing is invalid

17:05 TimMc: and there's always the WTFPL

17:06 technomancy: backport-util-concurrent is useless though; I let it slip into the deps list by accident

17:06 raek: yeah, you can't transfer the ownership of copyright in swedish law

17:06 pjstadig: http://unlicense.org/

17:07 raek: but the copyright holder can of course make contracts and licenses, etc

17:07 technomancy: crikey; sbcl is PD'd?

17:07 pjstadig: the Unlicense license i think tries specifically to deal with the problem of not having public domain in some countries

17:07 so is sqlite

17:08 technomancy: the crazy thing about SBCL is that it's a fork of CMUCL; also PD'd

17:08 so even if they wanted to license it they couldn't do it in a way that would apply internationally

17:08 raek: pjstadig: cool

17:09 cemerick: wow, Tuesdays *are* for license griping! ;-)

17:09 pjstadig: hehe

17:18 technomancy: cemerick: do you have a more canonical version of https://gist.github.com/1452640 ?

17:21 cemerick: technomancy: you mean, a lein plugin?

17:21 technomancy: cemerick: it's more that I'm looking for something that will run without having to guess where the defns come from =)

17:22 cemerick: ah :-)

17:22 technomancy: oh... does that require something newer than pomegranate 0.0.1?

17:22 cemerick: 0.0.2

17:22 technomancy: that'd do it; thanks

17:22 cemerick: both functions of interest are in cemerick.pomegranate.aether

17:23 That would have been helpful :-/

17:24 gist updated FWIW

17:25 technomancy: thanks

17:25 cemerick: I can reasonably start on a proper lein2 plugin for pomegranate this weekend.

17:26 technomancy: cemerick: specifically for the tree display?

17:26 lein2 is already built around pomegranate =)

17:26 cemerick: yeah, tree and list views.

17:27 hrm, perhaps that stuff should then just be a pull req into lein?

17:27 technomancy: yeah, that's useful enough to justify being built-in

17:28 cemerick: just be a pprint call with tweaked formatting probably

17:28 technomancy: though 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:29 cemerick: technomancy: already in there :-)

17:29 technomancy: oh hey, cool.

17:29 cemerick: That was part of xeqi's killer contrib

17:30 technomancy: cemerick: have you seen trptcolin's reply lib?

17:30 cemerick: maybe?

17:30 technomancy: the jline2 thingy

17:30 cemerick: oh, the REPL he was working on at the conj

17:31 my 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:32 technomancy: yeah, 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:34 cemerick: I'll have to read up on reply, see what it's all about.

17:34 technomancy: apparently it already has pretty decent completion from the CLI

17:58 replaca_: 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:29 kephale: replaca_: doesn't uberjar do a clean (and a deps?) task before compiling?

18:32 amalloy: if uberjar does a clean that's pretty dumb, right?

18:33 kephale: the deps?

18:34 technomancy: kephale: it will only do deps if they've changed

18:34 kephale: aha

18:34 replaca_: since I'm running it back to back the deps should be instant

18:34 that's why I'm confused - it feels like it's trying to lock something it can't or something like that

18:38 phzbox: In 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:38 Or (map Math/sqrt [9]) doesn't work but (Math/sqrt) work

18:40 dnolen: phzbox: because Math/sqrt is not a function

18:40 ,(map #(Math/sqrt %) [9 25])

18:40 clojurebot: (3.0 5.0)

18:42 phzbox: oh :/

18:43 So if it works when I do (Math/sqrt), it's because it's a reader macro that translate it to something else?

18:43 hiredman: ,(macroexpand '(Math/sqrt 1))

18:43 clojurebot: (. Math sqrt 1)

18:44 phzbox: ok, 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:45 amalloy: "a normal java function" - no such thing exists, which is why this is hard

18:45 well. "hard"

18:45 phzbox: My bad, a static java class function

18:47 amalloy: "java function" - no such thing. there are only methods, which are not first-class objects the way functions are in clojure

18:47 Raynes: $dict pedant

18:47 lazybot: Raynes: noun: One who pays undue attention to book learning and formal rules.

18:48 amalloy: uh, it might be pedantry if it weren't relevant

18:48 phzbox: Aight thanks. I was just experimenting in the repl and didn't get why one was working but not the other.

18:49 amalloy: he's imagining it will be easy because it's easy for functions; methods are different

18:50 hiredman: it seems like it should be possible use a static method as a value

18:51 (which is what you want when you try to map one over a seq)

18:51 amalloy: hiredman: in java, or in clojure?

18:51 hiredman: in clojure

18:51 the "value" of a static method would be a fn that calls the method

18:54 amalloy: hiredman: 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:54 (ignoring for now whether static->fn is actually a reader macro that gets applied implicitly by magic)

18:55 hiredman: amalloy: if you can reflectively tell that Math/sqrt is a static method you can also determine arity, etc

18:55 it would be part of symbol resolution

18:57 the 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:57 Raynes: amalloy: 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:57 amalloy: hiredman: right, that's vaguely what i meant by my hand-wavy "reader macro"

18:57 technomancy: yeah, static methods are rather friendlier at compile-time

18:57 amalloy: Raynes: methods don't have a runtime value like functions do

18:58 hiredman: they sort of do, java.reflect.Method but thats not really useful here

18:58 you could do this with invokedynamic, but it's not really required

18:59 I wonder how hard it would actually be to implement

18:59 amalloy: hiredman: for just static methods?

18:59 hiredman: sure

19:00 amalloy: well, 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:00 hiredman: no hope of doing it without runtime reflection for instance methods

19:00 amalloy: right

19:00 :(

19:01 amalloy: tbh i have no idea where in the compiler symbol-resolution happens. hint, anyone?

19:03 i see static Symbol resolveSymbol(Symbol sym), but that's more like namespace-quoting

19:03 hiredman: the way I would do it stick a dummy var in the var cache for the enclosing function

19:04 which is maybe lookupVar

19:05 amalloy: i'm not sure how well that will work, because that will also get called for (Math/sqrt 1), right?

19:07 hiredman: amalloy: no, Math/sqrt will get turned into the static method call before you get that far

19:07 I believe

19:07 the first position is special

19:08 amalloy: i'll take your word for it. there's a lot i don't know about the compiler

19:08 hiredman: we are gazing over the abyss in to lisp-2 land

19:10 amalloy: hah

19:10 hiredman: yeah, macroexpansion happens before analysis

19:10 amalloy: oh right, i forgot that happens in macroexpansion. of course

19:11 hiredman: someone write this down

19:55 c0smikdebris: trying to install cake through homebrew is giving me a 404. is there any other way i can install it?

19:57 Raynes: c0smikdebris: Development of cake has pretty much ended. We all decided we'd rather work on Leiningen and have a single canonical build tool.

19:59 c0smikdebris: ahh. I'm new to clojure and i'm trying to setup a dev environment. should I use Leiningen then?

19:59 Raynes: Yes. Leiningen is excellent.

20:00 c0smikdebris: Raynes: cool. thanks

20:19 TimMc: Who are (were) the cake devs?

20:23 alexbaranosky: ninjad, Raynes, not sure... probably amalloy ?

20:23 TimMc: ah, found the repo

20:24 amalloy: i 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:24 http://github-high-scores.heroku.com/flatland/cake/high_scores/

20:25 TimMc: https://github.com/flatland/cake/graphs/impact confirms

20:25 amalloy: wtf

20:27 amalloy: TimMc: best app ever, eh?

20:27 TimMc: pretty wild

20:29 technomancy: needs to ease off on the anti-aliasing of the avatars imo

20:30 * technomancy has mostly used https://github.com/up_the_irons/git-winner

20:30 Scriptor: was 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:31 technomancy: http://github-high-scores.heroku.com/clojure/clojure/high_scores/ <- ha ha, clojurebuild is #5.

20:32 gets into the triple-digits disappointingly quickly

20:35 Scriptor: afaik, laziness is most beneficial with very long lists, which I don't think happens a lot in js apps

20:35 but I'm not sure if I'm right about that

20:36 technomancy: it'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:40 Scriptor: what 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:40 clj_newb: dumb question: how do I convert a _lazy_ list of chars to a String ?

20:40 stuartsierra: apply str

20:40 technomancy: Scriptor: it helps avoid complexity in cases where the seq is never fully consumed

20:41 clj_newb: stuartsierra: nice, I was using (str, rather than (apply str

21:42 mindbender: I'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:52 wall: hello. i have questions about fnparse. How get info about position token (start and end column) in rule?

22:57 has anybody help me?

23:10 espringe: How can I turn this into a 1-functioner [so i can give it to 4clojure]:

23:10 (def fib-seq (lazy-cat [0 1]

23:10 (map + fib-seq (rest fib-seq))))

23:10 #(take % fib-seq)

23:28 amalloy: espringe: 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:29 espringe: amalloy: Is the best way to do this with an immutable datastructure?

23:30 Like this would be very easy in haskell, i'd just map fib to an infinite range

23:30 amalloy: right, that's the haskell formulation

23:30 espringe: not sure how to do the same thing in clojure though

23:30 The best way is a promise?

23:30 amalloy: no, blech

23:30 that's just how to do the haskell impl in clojure :P

23:31 the canonical clojure implementation is something like ##(->> [0 1] (iterate (fn [[a b]] [b (+ a b)])) (map first) (take 10))

23:31 lazybot: ⇒ (0 1 1 2 3 5 8 13 21 34)

23:31 espringe: So my recurisve def solution is the idiomatic clojure way? Except 4clojure just doesn't allow it?

23:32 Sweet, thanks :D

23:32 Scriptor: which 4clojure problem is that?

23:32 espringe: http://www.4clojure.com/problem/26#prob-title

23:32 amalloy: $google 4clojure fibonacci

23:32 lazybot: [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:32 adiabatic: 4clojure allows def now? :D

23:32 espringe: No, that's the problem :( :P

23:33 Scriptor: hmm, looks like I just used loop/recur

23:33 adiabatic: I 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:34 <-- single-assignment newbie

23:36 Scriptor: mine: https://gist.github.com/1631002

23:37 espringe: I just hijacked amalloy's: #(->> [1 1] (iterate (fn [[a b]] [b (+ a b)])) (map first) (take %)) which works really nicely :D

23:39 amalloy: we 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:41 adiabatic: I 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:41 espringe: I'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:42 Scriptor: if you use paredit, the aiming for the 2nd paren isn't much of a problem :)

23:42 adiabatic: Is that an emacs thing?

23:42 espringe: Speaking 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:43 And since paredit doesn't allow me to have anything unbalance,d I can't do it manually

23:43 Scriptor: adiabatic: yep, it helps with editing paren-heavy language files

23:43 espringe: And I can use the barf/slurp to wrap something in [ ]

23:43 amalloy: espringe: well, you can bind M-x paredit-wrap-square to a key if you want

23:44 i used M-[, but that interfered with ssh ascii escape characters, so i just settled for using slurp

23:45 espringe: amalloy: Great, thanks! Didn't know about paredit-wrap-square

23:45 How do you use slurp with [] ? I can't get that working

23:45 That's my ideal solution, if i could just slurp it into the [ ]

23:45 amalloy: just...type [], move point inside, then slurp?

23:47 espringe: Doesn't work for me :S, By slurp you mean, paredit-forward-slurp-sexp ( or C-) )

23:49 amalloy: indeed. are you using like version 0 of paredit? or do you not have it set up to treat [] as a balanced pair?

23:49 espringe: Like I have this: [](blah blah) and I want to end up with: [(blah blah)] ?

23:49 amalloy: right. putting point inside of [] and then slurping should do it. if it doesn't, weirdness is happening

23:50 espringe: I 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:52 Ah nice, I restarted and its working. Since i was using paredit in the repl thing, something must have messed it up

Logging service provided by n01se.net