#clojure log - Jun 20 2013

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

0:15 tomjack: derek_c: I'm guessing you mean the asterisks in particular?

0:16 it doesn't really mean anything in clojure, it's just a convention

0:16 conventionally, it means that the variable is dynamic

0:17 which in turn basically means it can be used with the binding macro

0:18 TimMc: They're called earmuffs, and the compiler will chide you a little if you use them on anything but a dynamic var.

0:18 Or rather, on a non-dynamic var. I don't think it cares in the slightest if you use them on locals.

0:18 And yes, it's syntactically irrelevant.

0:23 derek_c: I see. Thanks!

0:24 has anyone here used Ojo for monitoring file system events?

0:36 tomjack: readme says "use defwatch". interesting.

0:57 technomancy: the starter kit is totally overrated

0:58 too much magic

0:58 brehaut: wait, isnt it your starter kit?

0:59 technomancy: yeah, I wouldn't diss it so blatantly if it weren't

1:00 brehaut: fair

1:00 technomancy: https://github.com/technomancy/better-defaults <- much better starting place

1:01 brehaut: i fear i am going to be finagling my emacs config again

1:03 tomjack: the x clipboard thing is very interesting..

1:05 I've been fighting with everything that isn't conkeror or urxvt for a long time over the clipboard

1:06 brehaut: technomancy: so instead of starter kit, you just dump this into init.el and then use packages for everything else?

1:08 gt`: hi need some help on appengine-magic

1:09 brehaut: ~anyone

1:09 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

1:10 ddellacosta: is there a way to move to different lein projects in a single repl session?

1:10 …without killing it and cd'ing to that directory, then running lein repl again?

1:11 gt`: doing a project here is the project.clj

1:11 (defproject my-exams "0.1.0-SNAPSHOT"

1:11 :description "FIXME: write description"

1:11 :url "http://example.com/FIXME"

1:11 :license {:name "Eclipse Public License"

1:11 :url "http://www.eclipse.org/legal/epl-v10.html"}

1:11 :repositories {"releases" "http://appengine-magic-mvn.googlecode.com/svn/releases/&quot;

1:11 "snapshots" "http://appengine-magic-mvn.googlecode.com/svn/snapshots/&quot;}

1:11 :dependencies [[org.clojure/clojure "1.5.1"]

1:11 [appengine-magic "0.4.6-SNAPSHOT"]]

1:11 tomjack: ddellacosta: I don't think so, but why?

1:11 gt`: :plugins [[appengine-magic "0.4.6-SNAPSHOT"]])


1:11 lein debs and all the library are downloaded

1:11 when i lein appengine-new i am getting some error

1:11 ddellacosta: gt`: in general, good practice to put it in a gist/refheap

1:12 tomjack: are you working on a fixed small set of libraries?

1:12 ddellacosta: tomjack: for example, I'm doing testing now, and I'm using multiple libraries

1:12 tomjack: or just want to be able to switch easy

1:12 ddellacosta: tomjack: jinx

1:12 heh

1:12 gt`: making a skeleton for a Google App Engine application

1:12 java.lang.NullPointerException

1:12 at java.io.File.<init>(File.java:251)

1:12 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

1:12 tomjack: do you know about checkouts?

1:12 gt`: at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

1:12 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

1:12 at java.lang.reflect.Constructor.newInstance(Constructor.java:525)

1:12 at clojure.lang.Reflector.invokeConstructor(Reflector.java:180)

1:12 at leiningen.appengine_new$appengine_new.invoke(appengine_new.clj:47)

1:12 ddellacosta: tomjack: hmm, maybe that would work…I want to test different namespaces in the repl, so I guess that would suffice

1:13 gt`: please use https://www.refheap.com

1:13 gt`: ok

1:13 ddellacosta: do not cut and paste tons of code and output into IRC please.

1:13 gt`: oh ok sorry

1:14 ddellacosta: you'll get a better response that way too. ;-)

1:14 tomjack: I use checkouts all the time for e.g. testing changes in one core library while I'm using them in another library

1:14 gt`: :) thanks

1:14 ddellacosta: tomjack: okay, that's a good idea, I just didn't think of it. Let me give it a shot--thanks!

1:17 gt`: so my problem is when i am lein appengine-new why do i have errors ?

1:19 ddellacosta: gt`: at the risk of being "that guy," do you really need to use app-engine? It's definitely a less well-supported environment within the Clojure community, in my experience, and the appengine-magic lib doesn't seem to get a lot of updates recently (and is still labelled experimental it would seem).

1:21 that aside, it looks like you've got an older version--try updating to 0.5.0?

1:22 gt`: ddellocosta: I wanted to experiment with something writing an app on GAE

1:23 ddellacosta: gt`: yeah, the first thing I would try is seeing if 0.5.0 helps, as you are two versions back, it would seem

1:23 gt`: ddelocosta: any other way of doing it which is well supported is welcome

1:24 ddelocosta: let me try with 0.5.0 thanks

1:25 ddellacosta: gt`: if you *do* have the flexibility, and just want to deploy *somewhere*, definitely take a look at Heroku--they make it easy: https://devcenter.heroku.com/articles/clojure

1:25 gt`: in any case, good luck!

1:38 tomjack: yeah, that didn't work unfortunately, can't get to my test namespaces in checkout projects

1:38 ah well

1:40 tomjack: strange

1:40 I see test dirs on my classpath for my checkotus

1:41 just to confirm, you added a dependency in project.clj with a matching version (potentially requiring `lein install` in the checked-out project), and put a symlink in ./checkouts ?

1:42 (that the version matches shouldn't really matter unless you changed deps since last version)

1:44 ddellacosta: tomjack: if I use lein install, then I shouldn't need to have it in checkouts, no?

1:44 also, I should be clear how I'm using it: I'm trying to load my tests into the repl, and run my tests that way

1:44 my end goal is to run multiple projects tests in one repl session

1:45 tomjack: hmm

1:45 and are you going to be editing the code for any of these projects?

1:46 ddellacosta: tomjack: yeah, the item I'm working now has functionality which needs to be implemented across a few libraries--so I'm testing in one, then moving to the next library, testing there, etc.

1:46 tomjack: well you'd need checkouts to be able to switch to editing another library without starting a new repl

1:47 ddellacosta: tomjack: yeah, and I think that part of it works--changes get picked up without needing to run lein install

1:47 but it I can't figure out how to expose my test namespaces in the checked-out project to my main repl session

1:47 I mean, not such a big deal, just wanted some extra convenience. ;-)

1:48 tomjack: if you were able to edit the checked-out project, must be set up right. strange, it should just work

1:49 ddellacosta: meh, I'll keep playing with it. If you've gotten it to work in the past it must just be something weird with my setup then.

1:49 in any case, thanks for helping me to get it working.

1:50 tomjack: confirmed I can require clojure.core.async-test with core.async in checkouts, but it has an explicit :test-paths in project.clj

1:50 that wouldn't seem to matter

2:39 asura: I'm learning Clojure and I'm having an issue mapping an anonymouse function... I have a simple function defined... (defn is-factor? [[product factor]] (= (mod product factor) 0))

2:39 this function works when applied to a literal list, as in: (map #(is-factor? [10 %]) '(1 2 3 4 5 6))

2:39 but not for: (map #(is-factor? 10 %) (take 5 (iterate inc 0)))

2:41 racycle: asura: are you missing the [10 %] ?

2:42 asura: oops, I'm not, but I removed the brackets testing a moment ago.

2:46 racycle: the second produces a 0 while the first doesn't

2:46 use inc 1 insread

2:46 instead

2:48 iterate: Returns a lazy sequence of x, (f x), (f (f x))

2:48 asura: Aha! I guess it's some kind of silent div/0 error from the mod?

2:48 racycle: yepp

2:49 asura: Cool, thanks for your help!

2:49 racycle: np

2:52 derek_c: I might be missing something obvious here, but I have this java method that has this signature:

2:53 register(WatchService watcher, WatchEvent.Kind<?>... events)

2:53 so it takes in a variable amount of parameters

2:53 now I have this Clojure array of parameters. how do I call this function with these parameters?

2:55 ddellacosta: derek_c: (.register instance param1 param2 param3 …)

2:55 derek_c: check this out too, it has examples for most of this kind of thing: http://clojure.org/java_interop

3:17 derek_c: ddellacosta: but I have an array, like [param1 param2 param3]

3:17 how do I put them into the parameter list?

3:18 ddellacosta: derek_c: so, you want to use the contents of that array each as individual parameters/

3:18 ?

3:18 then it has nothing to do with Java, just to be clear--you want apply

3:18 &(doc apply)

3:18 lazybot: ⇒ "([f args] [f x args] [f x y args] [f x y z args] [f a b c d & args]); Applies fn f to the argument list formed by prepending intervening arguments to args."

3:19 derek_c: ddellacosta: ah right! forgot about apply

3:19 thanks!

3:19 ddellacosta: not sure but you may need to do something like pass the java method to partial first, so you can pass it to apply

3:19 but in any case, you're welcome! ;-)

3:21 murtaza52: how do I convert text into clojure data (read "[:a :b]") => [:a :b]

3:24 ddellacosta: murtaza52: you can use read-string for a small string

3:24 &(read-string "[:a :b]")

3:24 lazybot: ⇒ [:a :b]

3:25 ddellacosta: this is a good article on the subject, btw: http://copperthoughts.com/p/clojure-io-p1/

3:26 murtaza52: thanks

3:27 If I do - (def a (future (iterate inc 1))

3:27 and then (future-cancel a) => false

3:28 shouldnt it give me true, bcoz its an infinite seq ?

3:56 noncom: how do i say that function takes an arbitrary map, without passing a map explicitly? example: (my-fun :a 1 :b 2), i tried like (defn my-fun [& {m}]) but does not work

3:57 s-h: (defn my-fun [& {:keys [a b]}] (...))

3:57 noncom: s-h: yeah, but the point is that idk what keys will be there

3:58 s-h: noncom: well then you _have_ to wrap it in a map

3:59 noncom: s-h: how do you think, will (den my-fun [{:as m}] ...) work?

3:59 oh forgot &

4:00 s-h: without specifying any keys at all?

4:00 ..never tried that before :P

4:00 noncom: s-h: yeah, i just want to avoid using unnecessary {} when passing params

4:00 hey, the thing with :as worx :D

4:00 s-h: cool :-)

4:23 echo-area: Does anyone know what could be the possible reason that an HTTP service provided by ring-jetty-adapter can't be accessed from a foreign host? It already listens on

4:23 brainproxy: echo-area: how are you trying to access it?

4:24 possibly a CORS issue if you're doing browser XHR

4:24 echo-area: In many ways. One of them is "wget -O - http://IP:PORT/&quot;

4:24 brainproxy: have you checked the firewall settings of the machine running the http server?

4:24 maybe the port is blocked

4:44 echo-area: brainproxy: Checked with iptables -L, didn't see any.

4:45 arcatan: can you e.g. ping the machine?

4:46 echo-area: Yes

4:46 And 80 and 8080 are accessible

4:47 I'm using port 3000, which is inaccessible

4:48 mpenet: that screams for a fwd issue

4:48 firewall

4:48 maybe not locally, but upstream

4:48 dunno how's your network

5:08 hyPiRion: amalloy_: It is also the fourth diagonal of pascal's triangle

5:14 loz: do string are collections of characters in clojure?

5:16 RCarter: Hi everybody

5:20 Blkt: good day everyone

5:22 noncom: loz: they're java strings. check this out http://clojure.org/data_structures

5:24 vijaykiran: ,(first "one")

5:24 clojurebot: \o

5:24 vijaykiran: loz: alomost :) ^

5:30 RCarter: Hello, I'm learning Clojure and I would like to try integrate clojure with ZK Framework (www.zkoss.org), can I ask you some question about this?

5:31 vijaykiran: RCarter: "Don't ask to ask; just ask" :)

5:33 hyPiRion: ~anyone

5:33 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

5:33 hyPiRion: ^

5:33 loz: you know, clojurescript works :D

5:47 RCarter: ZK is a web framework in Java, you have to configure the usual web.xml file, write some xml file that will be render as html by the framework, and you have to provide some Java class that will be used as ViewModel. I would like to write ViewModel classes in Clojure (maybe writing some macros to eliminate the boilerplate). The question is I don't know how to setup a web application "the ugly way", using a provided web.xml, where to put xm

5:47 templating files etc. Is there some article I can read about this?

5:48 vijaykiran: RCarter: Do you have a javadoc of the ViewModel class ?

5:48 RCarter: first step is to start with Clojure's java interop documentation

5:48 pledias: Hi! Should I use Carmine 2.0.0-alpha1, if I just want to do basic Redis stuff reliably? (Not the fancy Tundra stuff.)

5:48 antares_: pledias: you should probably use an earlier Carmine version

5:49 RCarter: I also don't know if it's better to try to integrate ZK in a ring webbapp or to setup the web app in the usual way (java) and to use Clojure generated classes for ViewModels

5:49 antares_: I'm sure Carmine 2.0.0-alpha1 works well but things may change a lot to alpha2

5:49 pledias: antares_: Ok, thanks. I'll use 1.12.0 then.

5:49 mpenet: unless you are using the exotic stuff it should be backward compatible

5:49 and stable

5:49 but better be safe antares_ is right

5:50 RCarter: @vijaykiran Thanks, a ViewModel is a simple POJO with some annotations

5:50 pledias: mpenet: Thanks, good point.

5:50 RCarter: http://books.zkoss.org/wiki/ZK_Developer's_Reference/MVVM/ViewModel

5:53 vijaykiran: RCarter: I'd suggest starting with just using clojure to write ViewModels

5:53 RCarter: I think you can specify annotations using metadata - never used it, so not sure

5:58 RCarter: vijaykiran: thanks again, will look at that

6:19 noncom: how often do you find yourself writing thin wrappers in Clojure and ClojureScript? is it ok to write thin wrappers? I usually collect all wrapping functions in one spot, and in other places i can avoid using the dot-notation, making the code lookmore lispish. Does this give a serious overhead and is this considered a good practice?

6:20 like, i do a wrapper (defn do-that [x] (.doThat x))

6:20 this kind of thing

6:20 mpenet: very often

6:21 it's a good way to avoid type hinting all over the place too

6:21 noncom: ah yes, type hints go there too

6:21 mpenet: in cljs it will be "simplified" at compile time anyway, so it has no cost

6:22 well I think so at least, I haven't used cljs in a little while

6:22 noncom: actually,now i think that these wrappers better be macros, in Clojure at least

6:23 mpenet: defeats the goal to make them composable

6:23 so imho no

6:23 noncom: you're right - inlining is the best choice here

6:24 hmmm..

6:24 yes, youre right..

6:46 RCarter: vijaykiran: It's working! https://github.com/mbarbieri/cloj-zk

6:47 vijaykiran: RCarter: awesome :) with Annotations ?

6:48 RCarter: not yet

6:48 will try soon

6:48 vijaykiran: Clojure = Teleportation so true!

6:52 vijaykiran: RCarter: :) - why ZK ? Enterprise requirements ?

6:53 RCarter: vijaykiran: yep, but I really like it, for enterprisey apps is very cool

6:54 vijaykiran: and I suck at HTML/CSS

6:54 loz: you can generate at least html from clojure

6:54 not sure about css

6:55 vijaykiran: loz: https://github.com/noprompt/garden

6:56 But I don't use them - I prefer HTML/CSS to be - in HTML/CSS, easy to work with "design"

6:56 RCarter: loz: I can write html and css, but only ugly pages :(

6:56 loz: well you need a designer :D

6:56 vijaykiran: or Bootstrap/Foundation :)

6:57 RCarter: loz: agree :)

6:57 loz: vijaykiran: foundation? is it set of templates like bootstrap?

6:57 RCarter: vijaykiran: I know, but zk has lots of enterprise components, and fully ajax

6:57 vijaykiran: loz: http://foundation.zurb.com/

6:57 RCarter: vijaykiran: and open source

6:58 vijaykiran: RCarter: true. the tables and charts and others - I'm kinda favoring Primefaces at the moment

6:58 RCarter: Used ExtJs in the past

6:59 RCarter: vijaykiran: I like primefaces too

7:00 vijaykiran: wait, are you using primefaces + clojure?

7:00 vijaykiran: RCarter: ah - no - not yet. It is just a JEE App

7:00 clojurebot: Ik begrijp

7:00 RCarter: vijaykiran: ah, so you have a job :D

7:03 vijaykiran: RCarter: yup

7:38 Morgawr: I have a question, if I want to access a keyword from javascript (clojurescript here), do I need to use "\ufdd0mykeyword" or "\ufdd0:mykeword"?

7:49 dnolen_: Morgawr: depending on the representation of keywords is not a good idea - likely to change

7:50 Morgawr: I recommend making a helper and exporting it so you can write keyword("foo") from JS to avoid future breakage

8:06 cemerick: dnolen_: is dynamic extension of types to protocols off the table for cljs?

8:07 dnolen_: cemerick: what do you mean?

8:08 cemerick: dnolen_: extend to Object, then conditionally extend to the concrete type based on marker predicates, e.g. seq?

8:08 dnolen_: cemerick: you absolute cannot extend to Object

8:08 massive breakage will ensue

8:09 do you mean the primitive object special case?

8:09 cemerick: yes; just trying to translate my Clojureisms here.

8:10 Specifically, (extend-protocol P (type x) ....) doesn't work. I suspect it never will?

8:11 dnolen_: cemerick: no I don't see a reason for that not to work, dynamic extension should work just like it does in Clojure

8:11 cemerick: if it doesn't work it just hasn't been worked on

8:11 cemerick: heh, ok

8:11 the above is an analysis error at the moment

8:12 dnolen_: cemerick: yeah that's likely, will need to dive into some gnarly stuff to fix that

8:13 cemerick: been hoping Bendlas would submit his refactor but I haven't seen anything yet

8:13 cemerick: dnolen_: oh, is that a gsoc that may produce an impl/solution here?

8:14 dnolen_: cemerick: unrelated to gsoc, Bendlas was working on a specify patch - instance level extend-type

8:14 which would massively rock

8:19 Kototama: dnolen_: hello, do you know of any changes in ClojureScript that could have introduce this bug https://github.com/emezeske/lein-cljsbuild/issues/203 ?

8:20 cemerick: dnolen_: dunno, I wouldn't expect the dynamic twiddling of prototypes to survive advanced compilation...

8:20 dnolen_: Kototama: hmm nothing comes to mind but it's certainly possible

8:21 cemerick: I don't see why not, it's not being done with strings

8:23 Kototama: if it is a ClojureScript bug a patch is most welcome. Probably easiest thing to do is git bisect on ClojureScript to figure out which commit borked it

8:24 Kototama: dnolen_: i see. I will try to find some time to do that

8:25 dnolen_: Kototama: it's hard to tell where the problem might be though from the ticket. Best would be a minimal project demonstrating the issue

8:26 Kototama: you can follow the instructions here to build the minimal against a local checkout of ClojureScript - https://github.com/clojure/clojurescript/wiki/Patches

8:26 "the minimal project"

8:27 Kototama: so then you can easily git bisect between the version of CLJS pinned to 0.3.0 and the version of CLJS pinned to 0.3.2 to figure out what happened

8:28 Kototama: dnolen_: ok. thank you for the help

8:29 dnolen_: Kototama: I'm somewhat surprised I haven't heard about this sooner as CLJS users seem to follow cljsbuild quite closely

8:30 Kototama: probably worth at least mentioning the issue on the ClojureScript Google Group to make sure

8:34 tjb1982: cemerick: I made another example for the friend-demo site. I wasn't sure if I did the fork/pull request thing right (I've never contributed to another project on github before)

8:35 cemerick: tjb1982: yes, I saw :-) I just haven't gotten to looking at it yet

8:36 tjb1982: no rush. I just wanted to make sure I did the pull request the right way

8:41 Kototama: dnolen_: I got this error when compiling http://pastebin.com/gXkmRDEC

8:46 dnolen_: Kototama: yes that looks like weird interaction between cljsbuild and the compiler

8:47 Kototama: that stack trace is somewhat informative - probably best to produce a minimal reproducible project and attach it to the cljsbuild issue

8:48 Kototama: i see

8:48 dnolen_: Kototama: given that it starts in lein cljsbuild I'm sure Evan can see the issue quickly and determine if it's something I need to look at

8:49 Kototama: I chimed in on the cljsbuild ticket

8:50 Kototama: that's nice from you, i'm going to build a small project and try reproduce the problem

8:57 cemerick: dnolen_: hah, it's actually not that hard to "fix", if you don't count emitting perhaps-nonsense :tag metadata :-P

9:00 jweiss: i have a bugfix for clojure.data.xml, can someone point me to how to run the tests? there's no leiningen project file, so i do not know how the unit tests are normally run

9:02 s-h: jweiss: they are using Maven. Run "mvn test" to execute all tests

9:03 jweiss: s-h, huh, i looked in the pom file and didn't see anything clojure specific there, but i'll give it a shot

9:04 s-h: jweiss: yeah, i think they put all that clojure stuff in their parent POM

9:07 stuartsierra: jweiss: Yes, `mvn test` to run the tests. `mvn install` to install a -SNAPSHOT version in your local Maven repo which you can depend on in a Leiningen project.

9:11 futile: Do you ever just find yourself wandering in here because you're stuck on a totally confusing bug and have no guesses as to what could be wrong?

9:12 pisketti: Was that a rhetorical question?-)

9:13 Morgawr: what's the point of compiling clojure (also clojurescript) code when running "lein install" when the .jar just comes with source code (.clj and .cljs)? I feel like I'm wasting a lot of time when I have to compile and repackage everything when all I need is just put my new .clj(s) files into the .jar and then compile them in my actual project that uses the library

9:13 is there a way to skip compilation when running "lein install"?

9:16 tomjack: does cljsbuild run on `lein install`?

9:16 Morgawr: tomjack: yes

9:17 tomjack: dunno why that is - to make sure you don't `lein install` a project that can't compile?

9:17 Morgawr: when I do "lein install" it says "Compiling clojurescript..." and then goes on to check if there are errors etc etc and then builds and install the .jar (which doens't use the compiled output either way)

9:17 tomjack: yeah, does seem a bit funny :)

9:17 Morgawr: I can understand if I want to make sure my project actually works, but most of the time I find myself adding simple tests (like a single console.log() to test stuff) and I have to wait while it compiles

9:18 ddellacosta: how can I hide CLJS code from clojure.tools.namespace.repl?

9:19 er, by that I mean stuff that is calling cljs.compiler I guess

9:19 it's obviously not loading my ClojureScript

9:19 stuartsierra: ddellacosta: As far as I know, you don't need to hide CLJS files from tools.namespace. It will only search for .clj files.

9:19 ddellacosta: yeah, sorry, I guess what is going on is that it is picking up my macros

9:20 futile: pisketti: no

9:20 ddellacosta: and specifically it is complaining about the cljs.compiler/cljs.core I have required

9:20 futile: Is there any testing lib for ClojureScript?

9:20 ddellacosta: futile: I've been using clojurescript.test

9:21 futile: ddellacosta: thanks :)

9:21 ddellacosta: futile: np. There is also something else by the Prismatic folks

9:22 tomjack: Morgawr: I'd maybe try adding the cljs project as a checkouts dep so that you don't have to `lein install` when you change it

9:22 dunno how/if that will work out with cljsbuild though

9:23 ddellacosta: stuartsierra: I think the real issue may be that there are libs (cljs.compiler for example) that are present during CLJS build time, but they make tools.namespace unhappy. I suspect it's not picking up my src paths in my project file? Not sure how I should be doing that to load things properly.

9:24 futile: this is what I was thinking of, by the Prismatic folks: https://github.com/Prismatic/cljs-test

9:24 futile: clojurescript.test is here: https://github.com/cemerick/clojurescript.test

9:24 futile: ddellacosta: ahh, cool. thanks again

9:24 stuartsierra: ddellacosta: You can control what directories clojure.tools.namespace.repl/refresh is using with `clojure.tools.namespace.repl/set-refresh-dirs`

9:25 ddellacosta: stuartsierra: got it, that's probably what I was missing. Will give it a shot, thanks. And thanks for that great write-up a few weeks back, that's why I'm working with it now. :-)

9:25 stuartsierra: By default it just scans the java.class.path System property.

9:26 ddellacosta: You're welcome! Hope it's useful to you.

9:26 ddellacosta: stuartsierra: even without getting it fully working properly, it's helped me test Ring handlers…so yes, it's super useful.

9:26 stuartsierra: Great.

9:31 loz: is it real to write real-world web sites on clojure?

9:31 ddellacosta: loz: If you are asking if it is viable, I have done it a number of times. So, yes.

9:32 loz: can i see a link pls?

9:32 dnolen_: core.match primitive array specialization via type hints http://gist.github.com/swannodette/5822664

9:33 ddellacosta: loz: I'll do you one better, check out this (still ongoing) thread: https://groups.google.com/forum/?fromgroups#!topic/clojure/a4Dp8gdHev8

9:35 loz: okey, thanks

9:35 ddellacosta: I'm not sure if my boss(es) are cool with me talking about our tech, so I'm over-cautious and won't say…but I'm proud and exceed to be using Clojure in production, writing it full-time.

9:35 exceed -> excited. Broken spellcheck

9:37 loz: gj :)

9:38 cemerick: dnolen_: you're like 1 step away from erlang-style binary destructuring

9:38 loz: you mean pattern matching?

9:38 dnolen_: cemerick: there's already experimental support for that, been there for 2 years

9:38 cemerick: it's crazy fast

9:39 cemerick: the vector matching stuff was designed early on to specialize on anything that can be matched sequentially from vectors to binary data

9:43 cemerick: dnolen_: right, I guess I was talking more about notation than anything else.

9:44 dnolen_: cemerick: oh, yeah

9:46 fun project for someone - `defm` which supports everything `defn` does via destructuring but instead uses pattern matching

9:46 cemerick: dnolen_: so, if the incoming value is hinted as ^bytes, pattern rows could treat e.g. namespaced keywords differently. [[:name:4 :len:4 :type:8]], etc

9:48 dnolen_: cemerick: something like that yes though would be nice for that generalize to everything else

9:48 tomjack: how would you use that then?

9:49 dnolen_: [[(name 4) (len 4) (type 8)]] so it could work on vectors as well - not sure it would make much sense for arrays

9:50 tomjack: can a row introduce bindings?

9:50 dnolen_: tomjack: for a long time now

9:50 2 years

9:50 you can both have named wildcards

9:50 cemerick: tomjack: that's just a dumb transliteration of erlang binary destructuring

9:50 tomjack: I see, nice

9:50 dnolen_: or wrap a pattern in :as to give it a name

9:50 cemerick: matching, whatever

9:51 dnolen_: byte arrays or ByteBuffers ~ network messages

9:52 dnolen_: once we get function application core.match + instaparse should be pretty sweet for rapidly building languages

10:04 gdev: finally got a chance to watch "The Language of the System" talk....mind blown

10:07 loz: ddellacosta: do you use foundation?

10:08 ddellacosta: loz: you mean this? http://foundation.zurb.com/

10:08 loz: yep

10:08 ddellacosta: nope. been wanting to try it out, just haven't had the occasion yet.

10:09 mannymanny: hi all, I'm looking for a way to define a sort of build depedencies hierarchy using lein (e.g. when I run "lein test" the "lein something" get ran before)

10:17 hyPiRion: mannymanny: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L91-L94 ?

10:18 That would not create a build dependency hierarchy, but at least you can define what task to run before other tasks

10:19 If I wanted some make-like functionality, I think I would use https://github.com/hyPiRion/lein-shell and make in prep-tasks

10:20 gdev: hyPiRion, doesn't leiningen have something for showing a deps?

10:20 s/a/project

10:21 hyPiRion: gdev: yeah, `lein deps :tree`

10:21 gdev: mannymanny, use lein deps :tree

10:22 hyPiRion: gdev: well, that can't do what he asks for though. He wants a way to e.g. do `lein something` before running `lein test`

10:22 gdev: mannymanny, scratch that, that won't work apparently

10:23 puredanger, ohhai Alex

10:23 puredanger: gdev: hi!

10:24 hyPiRion: mannymanny: actually, the simplest would probably to define aliases. So, for example in your case, you could add in `:aliases {"test" ["do" "something," "test"]}`. Then running `lein test` would be the same as running `lein do something, test`

10:24 (And no, it won't lead to an infinite recursion, aliases are only applied once)

10:25 mannymanny: hyPiRion: thank you all guys, I'm going to try the aliases one

10:27 hyPiRion: np

10:31 edbond: how to display full collection? repl cuts it at say "(1 2 3 4 ...)"

10:31 gdev: change your print-length

10:31 (set! *print-length* nil)

10:32 edbond: gdev, thx

10:33 gdev: yes! achievement unlocked, I successfully answered a question about clojure on irc

10:38 mikerod: ,(inc gdev)

10:38 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: gdev in this context, compiling:(NO_SOURCE_PATH:0:0)>

10:38 mikerod: It wasn't meant to be

10:39 justin_smith: (inc gdev)

10:39 lazybot: ⇒ 1

10:39 justin_smith: he earned it

10:39 mikerod: :)

10:39 gdev: nice =D

10:40 justin_smith: (inc inc)

10:40 lazybot: ⇒ 1

10:40 mikerod: Hmm

10:40 justin_smith: #clojure, where you can upvote the upvote system

10:40 mikerod: That seems fitting for clojure

10:41 justin_smith: it's recursion all the way down

10:41 someone should make a self-hosting LOGO, just so they can say "it's turtles all the way down"

10:44 clgv: (inc 42)

10:44 lazybot: ⇒ 1

10:44 clgv: ;)

10:44 justin_smith: (inc 42)

10:44 lazybot: ⇒ 2

10:44 justin_smith: eventually the output will be correct

10:45 tomjack: then some asshole will do it one more time

10:45 oh, can you dec?

10:45 justin_smith: lol

10:45 clgv: yes

10:45 justin_smith: (dec 42)

10:45 lazybot: You want me to leave karma the same? Fine, I will.

10:45 clgv: oh maybe not anymore

10:45 (dec lazybot)

10:45 lazybot: ⇒ 18

10:46 clgv: (dec lazybot)

10:46 lazybot: ⇒ 17

10:46 clgv: ^^

10:46 (dec 10)

10:46 lazybot: ⇒ -1

10:46 clgv: (dec 42)

10:46 lazybot: You want me to leave karma the same? Fine, I will.

10:46 mikerod: ##(print "I thought this was how to lazybot")

10:46 lazybot: ⇒ I thought this was how to lazybotnil

10:48 clgv: ,(print "Hello lazybot! ##(print \"Good day, clojurebot!\")")

10:48 clojurebot: Hello lazybot! ##(print "Good day, clojurebot!")

10:48 clgv: damn, that got disabled... ;)

10:48 mikerod: Hah, that would be pretty interesting

10:48 clgv: worked a while back ^^

10:49 ,(print "&(print \"Good day, clojurebot!\")")

10:49 clojurebot: &(print "Good day, clojurebot!")

10:50 tomjack: "delimited continuations via codensity" https://gist.github.com/ekmett/1015030 hmm

10:51 clgv: ,(print "$google clojure")

10:51 clojurebot: $google clojure

10:54 hyPiRion: clojurebot: lazybot ignores clojurebot

10:54 clojurebot: clojurebot is pretty cool

10:54 hyPiRion: clgv i meant

10:55 clgv: hehe

10:55 it was not always like that^^

10:56 or was it the other way round? ....

10:56 hyPiRion: it was not always like that

10:56 clgv: &(println ",(print \"Hello, lazybot\")")

10:56 lazybot: ⇒ ,(print "Hello, lazybot") nil

10:56 hyPiRion: I am the reason why lazybot now ignores clojurebot :(

10:56 clgv: what did you do with it?

10:57 hyPiRion: clgv: http://clojure-log.n01se.net/date/2012-12-17.html#22:30

10:57 I managed to create a multi-bot quine which would pong stuff between the bots every 16 hours

10:57 clgv: muhahaha

11:01 hyPiRion: It would actually be easier to just pong it immediately, but you know

11:01 I would've been hellbanned from this channel if I did :s

11:01 justin_smith: when I worked on a mud, banning was for simple forgivable stuff

11:02 if someone really fucked up, they got a special flag on all their characters

11:02 that accelerated hunger, thirst, and derangement of mental state

11:02 it would accumulate over months

11:02 until every action they took would randomly fail, or target a random entity (possibly themselves) regardless of intended target

11:03 clgv: "mud"?

11:03 justin_smith: this was all secret, mentioning the existence of this flag to mortals was banned

11:03 multi-user-dungeon

11:03 vijaykiran: multi user dungeons

11:03 ah :)

11:03 justin_smith: imaging WoW with the user interface of zork

11:03 *imagine

11:04 the first large scale multi player online games

11:04 one advantage over graphic games: very easy for users to script in any language that takes a text stream as input, and emits one as output

11:04 which is just about any usable programming language

11:06 djanatyn: I found my old clojure game of life implementation :)))

11:06 https://github.com/djanatyn/game-of-life/blob/master/src/game_of_life/core.clj

11:07 justin_smith: looks like a good cantidate for clojurescript / canvas

11:14 bobbrahms1: anyone using core.typed? I'm trying this getting started thing at http://www.clojure.net/2013/03/14/Typed-Clojure/, and the first time I call check-ns I get a:

11:14 clojure.lang.Compiler$CompilerException: java.lang.UnsupportedOperationException: Unknown Collection type, compiling:(clojure/core/typed/path_rep.clj:12)

11:16 justin_smith: are you using the same versions of things they are with the demo?

11:16 do you have other deps that may have overriden the deps there?

11:17 bobbrahms1: re: same versions, I can't tell. Probably not since that thing was written 3 months ago and I'm using the latest.

11:18 justin_smith: is clojure.core.typed something in 1.5 or is a separate library?

11:18 bobbrahms1: I suppose it's possible that I have overridden deps

11:18 separate library

11:19 justin_smith: do you have other deps in the same project? (other than clojure)

11:20 bobbrahms1: well this is a big maven project with lots of deps. I'm just firing up a new repl and trying the typed stuff

11:21 new repl, require clojure.core.typed, load a file with nothing but a simple namespace, call check-ns, get an exception

11:22 I could simplify it and see if the problem persists. I just wondered if this sounded familiar

11:22 justin_smith: I would try in a bare bones project then if that works (which I would guess it would) compare the versions of things that show up under lein deps :tree

11:23 then you probably need some :exclusions in your project.clj - I am guessing

11:23 bobbrahms1: this is not a lein project.

11:23 justin_smith: oh, never mind then, someone else will need to help you with that

11:23 bobbrahms1: would there be a maven equivalent?

11:23 OK

11:24 justin_smith: mvn has a deps command

11:24 mvn deps:tree or some such

11:24 bobbrahms1: I mean I could certainly set up a barebones thing anyhow

11:24 thanks

11:25 djanatyn: justin_smith: I'd love to do that! how do I get started?

11:26 I found my old ant simulation thingy too :) https://gist.github.com/djanatyn/5823689

11:26 justin_smith: https://github.com/clojure/clojurescript/wiki/Quick-Start

11:26 djanatyn: I forgot about all this clojure code I wrote in my java class ;)

11:27 justin_smith: I have had a bunch of fun visualizing clojure stuff in html5 canvas (with the help of the aleph lib for websockets), my next step is to try to use clojurescript instead of js

11:29 djanatyn: justin_smith: do you know of any place to learn about canvas? I've never used it before ^_^;

11:29 or is there some sort of clojurescript wrapper library?

11:30 justin_smith: http://yogthos.net/blog/32-ClojureScript+Adventures was going to be my starting point

11:30 I was just reading javascript docs and making a canvas, putting objects in it

11:30 (before moving over to clojurescript, which will be much more sane for programming in than vanilla js)

11:31 anyway, things like life or ants really beg to be visualized on a 2d plane

11:31 arrdem: hyPiRion: my hat is off sir

11:34 djanatyn: wow, this should be pretty easy, as I already have my logic seperated from my UI

11:34 I think my code will actually work untouched

11:35 justin_smith: djanatyn: awesome

11:35 I was having some good luck with sending json arrays with objects to draw from clojure

11:36 and then a foreach / conditional to draw each thing that came in (rect / bitmap / line / ...)

11:36 the foreach / conditional being on the javascript end that is

11:41 ciphergoth: "or" is a macro, so I can't do (update-in thing [:this :that] or "default-value")

11:41 what's the right thing to do there?

11:42 justin_smith: #(or %1 %2)

11:42 (is one solution)

11:42 ciphergoth: so (update-in thing [:this :that] #(or %1 "default"))

11:43 hyPiRion: justin_smith: can %1 be false?

11:43 or just nil?

11:43 ciphergoth: %1 will be a string or absent altogether

11:43 justin_smith: well that is just replicating the behvior of or

11:43 ,(update-in {:a 0} [:b :c] #(or %1 %2) 2)

11:43 clojurebot: {:b {:c 2}, :a 0}

11:44 dnolen_: huh

11:44 justin_smith: ,(update-in {:a 0 {:b {:c 0}}} [:b :c] #(or %1 %2) 2)

11:44 clojurebot: #<RuntimeException java.lang.RuntimeException: Map literal must contain an even number of forms>

11:44 dnolen_: with support for binary data I guess you could easily do a binary lambda calculus interpreter in core.match

11:44 justin_smith: oops

11:44 ,(update-in {:a 0 :b {:c 0}} [:b :c] #(or %1 %2) 2)

11:44 clojurebot: {:a 0, :b {:c 0}}

11:45 tomjack: &(map #(update-in % [:this :that] (fnil identity "default")) [{} {:this {:that "foo"}}])

11:45 lazybot: ⇒ ({:this {:that "default"}} {:this {:that "foo"}})

11:45 justin_smith: tomjack: nice

11:45 hyPiRion: tomjack: yeah, I was thinking about that, but it's not taking any args in

11:45 well hm

11:46 tomjack: half joke

11:46 hyPiRion: (defn assoc-if-not-in [m kws elem] (update-in m kws (fnil identity elem))) is probably a good one

11:46 tomjack: (fnil identity "default") is longer and probably harder to understand than #(or % "default")

11:47 devn: technomancy: you around? I am trying to use Syme with someone in India and they're having trouble connecting. I'm wondering if the region the instance is being hosted is an issue. Have you heard of anything like that happening?

11:47 tomjack: or even #(if (nil? %) "default" %)

11:49 Lajjla: justin_smith, I have bought a desk fan

11:51 callen: devn: networking with a developing nation that has many undeveloped regions is going to possibly mess up your networked application?

11:53 glosoli: Hey folks, anyone can recommend some nice resource online to get started with clojure for someone who is complete unfamiliar with LISP and such ?

11:53 devn: callen: heh

11:53 callen: he's in a nice area :)

11:53 callen: devn: so 56k modem?

11:53 devn: aww come on

11:53 have you been to india?

11:53 callen: no no, this is India, 2.5g GSM USB dongle?

11:54 no, but I've had a lot of conference calls with people in India

11:54 memories of paaaaaiiiiiin

11:54 glosoli: 4clojure and buy a book

11:54 glosoli: I recommend cemerick's book, "Clojure Programming". It's designed for non-LISPers. Just pay no mind when he grumbles about CLR and the JVM.

11:54 clgv: glosoli: yeah get a book, read it and play with 4clojure

11:55 callen: clgv: I would've said, "you could just say, 'what callen said'", but really - that's static and constantly the case anyway.

11:56 glosoli: callen: thanks! :)

11:56 clgv: you too thanks

11:56 callen: clgv: ever been to ##C?

11:56 clgv: callen: a "C" IRC channel?

11:57 callen: yes, although what I'm speaking of is fairly notorious and common to FreeNode and EFNet

11:57 I can tell #clojure attracts a better quality of person than ##C, because whenever I would tell the carpetbaggers to get a book, they'd tell me to get stuffed and tell them the answer to their homework question.

11:57 clgv: haha

11:57 callen: and they would invariably be in desperate need of a book.

11:58 clgv: well, if you really want to learn the language a book is the best choice to get you started fast.

11:58 glosoli: callen: cemerick = Chas Emerick ?

11:58 callen: glosoli: da comrade.

11:58 glosoli: ok

11:58 callen: clgv: the book makes certain any critical gaps are filled, which is especially important so that you don't make other programmers angry.

11:58 clgv: I had a student that try to avoid reading the suggested book on purpose

11:59 you could see it in his code that he never understood the complete picture... :/

11:59 callen: clgv: hopefully you did like a proper zen master and fwacked them with a stick over the head.

11:59 that's my approach anyway. I don't have many students anymore.

11:59 too many brain-fevers and dropouts.

11:59 glosoli: clgv: I love books

11:59 callen: I love people that love books.

11:59 * callen winks suggestively at glosoli before toddling off to get more coffee.

12:00 glosoli: heh, have a nice coffee

12:01 callen: I drink buckets of it. It doesn't have to be especially good, just hot and ready to go.

12:05 glosoli: callen: Same here, hmm as oddly as it sounds, it doesn't seem to affect by health in any bad way, can't drink like seven coffee per day or more

12:06 callen: glosoli: supposedly up to six coffees a day is fine.

12:07 glosoli: callen: hmm, I always thought it's something like two tops

12:07 callen: glosoli: naw.

12:07 glosoli: no negatives of any verified sort seep in until 6 per diem

12:08 verified being the key word here, most of the studies showing weak negative effects for 1-5 coffees haven't been reproducible science, 6+ have been (speaking from memory)

12:08 generally speaking, drinking coffee is correlated (for whatever that is worth) with a longer lifespan.

12:09 TimMc: This is all in the absence of complicating factors such as acid reflux.

12:09 callen: of course. personal circumstances may vary.

12:09 glosoli: callen: Pardon me for my english, but just to be sure correlated means connected in the sense of more coffee longer life span ?

12:09 callen: I drink tea in addition to coffee to control for acid and stomach upset.

12:10 hyPiRion: glosoli: It means people who drink more coffee has, on average, a longer life span

12:10 callen: glosoli: correlated has a very specific and (to the public anyway) slippery scientific meaning. Just remember that it's a statistical association, not a causal relationship.

12:10 hyPiRion: that doesn't mean coffee gives a longer lifespan

12:10 TimMc: or that naturally long-lived people prefer to drink a lot of coffee.

12:11 callen: which would be an interesting thing to try to prove given that that sort of thing is usually due to cultural factors and it'd be hard to pin coffee down to a single cohort.

12:11 technomancy: could also mean coffee companies secretly are killing off non-coffee-drinkers

12:11 just throwing that out there

12:11 callen: my best guess is that coffee drinking sifts out lower and lower middle class people and selects for middle / middle upper class officeworkers.

12:11 so, money, career, access to healthcare, class.

12:12 most poor people I've known didn't drink coffee.

12:12 glosoli: callen: hmm out here most poor people tend to drink coffee

12:12 callen: technomancy: drinking some canned stuff I got from Nob Hill. Dark columbian stuff.

12:12 hyPiRion: callen: are you implying that people without access to clean water or food doesn't drink coffee?

12:12 callen: hyPiRion: poor people in the US have access to clean water and food.

12:13 hyPiRion: they tend to drink soda and the like, rather than coffee.

12:13 hyPiRion: callen: yeah, it was a joke :-)

12:13 callen: glosoli: ^^

12:13 stain_: I think British construction workers etc. have little access to good quality coffee, therefore they go for tea rather than nescafe

12:13 which I fully support

12:13 callen: I drink a lot of tea too, mostly green and oolong.

12:13 I really don't care for cheap tea though.

12:13 stain_: nescafe? that's just grotesque.

12:13 glosoli: nescafe is known as fertilizers out here

12:14 that's how people call them

12:14 callen: my father simply took a thermos with him to work everyday so that he'd have his coffee.

12:14 biiiiig thermos

12:15 justin_smith: my father is a machine that turns coffee into frames for houses, I am a machine that turns coffee into code

12:16 stain_: I think I'm a machine that turns coffee into emails :(

12:16 TimMc: Alfréd Rényi said, "a mathematician is a machine for turning coffee into theorems"

12:16 hyPiRion: justin_smith: well, apparently your machinery is able to talk on IRC too

12:16 justin_smith: don't need coffee for that

12:16 code, on the other hand

12:17 glosoli: callen: thanks for the recommendation again, just bought that book, will go on reading

12:17 dnolen_: WHOA

12:18 callen: glosoli: sweet. Please enjoy.

12:18 dnolen_: yeah, he looks like a younger you - right?

12:18 dnolen_: Luc Maranget's lazy pattern matching algorithm seems to find ROBDDs in the simple cases ?????

12:19 cemerick: glosoli: yeah, that's me

12:19 mannymanny: update on "how to define task dependencies in lein in order to run "lein something" before "lein test" --> I've opted for the :prep-tasks combined with the lein-shell plugin --> :prep-tasks [["shell" "./my-script.sh"]]

12:19 callen: cemerick: I need to be getting referrals for constantly bumping your book in here.

12:19 hyPiRion: mannymanny: And that is working fine?

12:19 justin_smith: I ordered it, it is awesome, now gimme my cash too

12:20 (just kidding about the cash part, the rest is true)

12:20 mannymanny: actually is running the shell script before _any_ task

12:20 callen: I own a copy as well from AMZN.

12:20 ciphergoth: TimMc: *googles* heh, always heard that attributed to Paul Erdős, but Wikiquote agrees with you!

12:20 * glosoli got it from Oreillys

12:20 TimMc: I was surprised as well.

12:20 mannymanny: but given that the script is taking less than a second it's ok

12:20 ciphergoth: And of course a comathematician is a machine for turning cotheorems into ffee.

12:21 justin_smith: ciphergoth: Erdös would likely have said meth instead of coffee

12:21 based on his actual practice

12:21 ciphergoth: Amphetamine rather than methamphetamine AIUI#

12:21 justin_smith: opps, yeah

12:21 ystael: ciphergoth: you owe me a new keyboard

12:21 hyPiRion: mannymanny: yeah. If you want to only do it before tests only, you can do `:aliases {"test" ["do" "shell" "./my-script.sh," "test"]}`

12:21 dnolen_: I just put in a Binary Decision Diagram from a tutorial into core.match and it produced the ROBDD illustrated

12:22 ciphergoth: ystael: :)

12:22 callen: ciphergoth: *nice*

12:22 dnolen_: no redundant tests and the correct variable testing order

12:23 TimMc: ciphergoth: That's fantastic. Gonna quote you on that.

12:24 Who would you like it to be misattributed to?

12:24 justin_smith: Abraham Einstein

12:25 ciphergoth: Qiaochu Yuan? http://mathoverflow.net/questions/1083/do-good-math-jokes-exist

12:25 arkh: why does this block? (.start (Thread. (loop [] (send-off myagent myfunc) (Thread/sleep 5000) (recur))))

12:25 but this doesn't: (.start (Thread. (loop [] (prn "hi") (Thread/sleep 5000) (recur))))

12:25 TimMc: ciphergoth: Ah, OK. :-)

12:26 ciphergoth: this is from 1996, could be the invention http://mathforum.org/kb/thread.jspa?forumID=13&threadID=20573&messageID=48418

12:26 justin_smith: mbinitorics, mputer science, lol

12:29 seancorfield: lack of mprehension? :)

12:32 cemerick: callen: feel free to pass around your own amazon url :-)

12:32 callen: cemerick: I'm a bloody fool, I already have an affiliate account. Woe is me!

12:35 mannymanny: hyPiRion: actually I've found out that I prefer to have the script to be run always, it's a javascript minifation that I prefer to have always in place (not only during test....), I've tried the alias thing but it isn't working: run the script but doesn't run the tests

12:36 hyPiRion: mannymanny: ah, okay.

12:41 devn: technomancy: is there a way to set a different region for the AWS instance with Syme?

12:43 technomancy: devn: I think AMIs are tied to a given region, so if you specify a custom one in another region it should just work?

12:43 haven't tried it myself; let me know if it works =)

12:44 futile: foo

12:52 kmicu: Quijure anyone? http://www.mathstat.dal.ca/~selinger/quipper/

12:52 akells`: I have a string that looks like this: "[:wood \"birch\"]- [:tree \"pine\"]" and I want to remove the [ \ and ] characters. Is there any built in way to replace multiple characters at once? Right now I could put something together using this (clojure.string/replace "[:wood \"birch"]&[:tree \"pine"\]" #"\[" "") but I'd have to repeat myself a few times

12:54 LE_CESSMASTEUR: akells`, first, kneel before me.

12:54 And I may yet let you live, mortal.

12:56 edlothiol: akells`: you can use a pattern in replace, e.g. #"\[|\]|\\"

12:57 LE_CESSMASTEUR: edlothiol, do not encourage this behaviour in front of the court.

12:58 akells`: thanks edlothiol, this will work perfectly. much appreciated

13:03 cemerick: Just fixed two "long"-standing bugs due to extending protocols to e.g. js/Number. dnolen_, is there a writeup anywhere about js/Number vs. number and similar, motivations/objectives/etc?

13:04 dnolen_: cemerick: I need more context, we don't do anything with js/Number incore

13:04 in core

13:05 tomjack: &(macroexpand-1 '(.getName Math))

13:05 lazybot: ⇒ (. (clojure.core/identity Math) getName)

13:06 cemerick: dnolen_: yeah, I know, *I* did in one of my projects. I suspect I've been using e.g. boolean and js/Boolean interchangeably for a while, which I can see now is strictly wrong w.r.t. protocols. Was just wondering if there was anything I could read on the implementation differences and whys and wherefores, aside from the impl.

13:06 dnolen_: cemerick: the principle is simple, don't extend JavaScript language natives

13:06 cemerick: anything listed as a JS type in the EcmaScript 262 specification should not be touched

13:07 cemerick: This is where my being an idiot w.r.t. js is killing me.

13:07 dnolen_: isn't that what prototypes are for, at least ostensibly?

13:07 dnolen_: cemerick: extending to CLJS types is generally OK as that's all under the control of Closure

13:07 cemerick: at the risk of breaking everything, sure

13:08 cemerick: even extending to browser natives must weighed carefully

13:08 cemerick: dnolen_: i.e. if other libs happen to make changes as well, the whole unscoped monkeypatching problem?

13:08 dnolen_: which is why I'm looking forward to specify

13:08 cemerick: yes

13:09 specify would allow us to scope changes to an instance

13:09 giving us the flexibility we want and none of the craziness

13:09 impossible in Clojure, but certainly doable for JS

13:11 cemerick: I thought that was why prototype extensions are munged up the wazoo. e.g. who's going to touch Number.prototype.cemerick$sedan$impl$Sedan$ ?

13:11 dnolen_: cemerick: that's not what happens after advanced compilation

13:11 Number.prototype.cB

13:11 and stuff like that

13:12 tomjack: but extending to 'number' is OK, right?

13:12 cemerick: yeah, I guess. This is a very conservative approach.

13:12 dnolen_: tomjack: yes

13:12 cemerick: right, that's the whole base-types thing in core.clj

13:13 dnolen_: please distinguish between "javascript natives" and "browser natives"; the former is stuff in ecma, the latter is...DOM bits?

13:14 dnolen_: ROBDD fun http://gist.github.com/swannodette/5824533

13:14 cemerick: yep

13:14 cemerick: ok

13:14 tomjack: :(

13:14 * cemerick is tempted to add a linter to cljsbuild that warns on any js native usage within protocols

13:15 dnolen_: cemerick: I'm not against adding warning for the base-types to the compiler

13:15 I see this mistake all the the type

13:15 cemerick: ah, ok

13:15 tomjack: I don't see how specify would be of help here

13:15 dnolen_: js/Object makes me want to cry

13:15 cemerick: I'll add an issue

13:15 dnolen_: tomjack: instance *local*

13:16 no program wide

13:17 tomjack: I see how it could prevent the craziness, I don't understand how it's useful for someone who was thinking "I want to extend my protocol to Element" or whatever

13:17 dnolen_: tomjack: clone the element and extend that just like anything else

13:18 cemerick: tomjack: I have protocols extended to various DOM classes. Perhaps that's wrong, but it works.

13:18 tomjack: but suffers the craziness?

13:18 dnolen_: cemerick: not wrong, just less modular than it could be

13:19 tomjack: so (defn my-protocol-fn-wrapper [x] (my-protocol-fn (if (instance? js/Element x) (specify ...) x))) ?

13:20 dnolen_: tomjack: it just depends, but the point is you get pick the level of modularity you need

13:20 even with specify, you need to touch the prototype to at least define the semantics of cloning

13:20 but there's also specify! if you don't care about cloning

13:21 cemerick: dnolen_: finally, what's 'default for? Isn't '_' just another name in javascript?

13:21 identifier, rather

13:21 dnolen_: cemerick: it's just the default

13:22 a catch all

13:23 cemerick: dnolen_: i.e. union of nil and object?

13:23 dnolen_: dnolen_: different from nil or object

13:24 the dispatch is based on the value of goog.typeOf

13:24 which returns "null", "function", "object", "boolean", "number", "array"

13:24 if we find no method in the table for those, we check "_"

13:25 cemerick: okay

13:25 dnolen_: Thanks very much for the brain-dump. I feel thoroughly clarified now. :-)

13:25 dnolen_: cemerick: np

13:36 futile: [joke about decimal-time]

13:44 Raynos: I found this thread ( http://grokbase.com/t/gg/clojure/135a8m6exn/not-using-dependency-injection-how-do-i-share-services-around ) about DI very interesting, does anyone have other good recommended reading material on the subject ?

13:48 bbloom: technomancy: i'm like 99% sure i have the right passphrase, but of course it doesnt work :-P

13:48 tomjack: the "punchline" sounds like what I thought when I read about angular's "solution" for demeter violations

13:50 stuartsierra: Raynos: Maybe my recent blog post: http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded

13:51 There are more examples in the comments on that post.

13:52 hbstunt: lastlog

13:53 (oops)

14:03 Okasu: Back to that discussion about pronouncification of `assoc', in which part of america people saying 'a-sh-o-sh-iate'?

14:04 * Okasu not sure if someone even remembers it.

14:13 jweiss: when including clojure lib jars on classpath, does it work like java classes when there are two versions of the same lib on the classpath? (in java land, the first one wins).

14:13 stuartsierra: jweiss: Probably. Clojure uses Java classloaders to find files.

14:14 jweiss: i am seeing really weird behavior. i patched clojure.data.xml and uploaded to clojars under my own group name. but another lib i use depends on an older version of clojure.data.xml

14:14 i'm wondering if uploading to clojars under my own group name was a bad idea

14:14 since now lein considers them two different libs.

14:15 stuartsierra: jweiss: You can make that work if you add an :exclusion for the older version.

14:15 cemerick: jweiss: you can add a project-wide exclusion

14:15 stuartsierra: Or :exclude, I forget the syntax.

14:15 jweiss: would that work though? one is org.clojure/data.xml and the other is weissjeffm/data.xml

14:16 i guess it would since the namespaces are the same.

14:16 stuartsierra: Yes, as long as you keep the older JAR off the classpath, and the namespaces are the same, it should work.

14:16 jweiss: ok thanks

14:17 stuartsierra: I don't think Leiningen makes any promises about the *order* in which things appear on the classpath, so you have to exclude what you don't want.

14:17 hyPiRion: yeah, true

14:18 stuartsierra: I'd hesitate to rely on order anyway, even if it were promised.

14:18 technomancy: you don't get order guarantees within :dependencies, but on-disk directories should always have priority over jars.

14:18 stuartsierra: OK, that makes sense.

14:19 jweiss: i really hope this is what caused the weird behavior because after this i got nothin :)

14:23 bbloom: technomancy: ok, i seriously can't get into my gpg key…. what do i do? *sigh*

14:24 technomancy: bbloom: if you lost the passphrase you should publish your revocation cert and make a new key pair

14:25 bbloom: technomancy: i'm just 100% convinced that i know my passphrase, but it apparently doesn't work, so maybe i fucked up making the key

14:25 anyway, where do i publish that revocation? to clojars somehow?

14:25 hyPiRion: bbloom: ohumm, what are you using?

14:25 technomancy: bbloom: no, to a key server like MIT's

14:25 bbloom: technomancy: oh nevermind, i saw that in the help

14:26 hyPiRion: bbloom: you've tried with raw GPG, not from lein, right?

14:26 (I'm fairly certain the stdin/out stuff is fixed, but can't be too sure)

14:26 bbloom: hyPiRion: yeah i'm doing this: echo '1234' | gpg --no-use-agent -o /dev/null --local-user FC97C2D7 -as - && echo 'got it!'

14:26 hyPiRion: okay

14:27 bbloom: hyPiRion: what was the issue?

14:28 hyPiRion: technomancy/leiningen#957

14:28 lazybot: lein run doesn't close stdin of the clojure process. -- https://github.com/technomancy/leiningen/issues/957 is closed

14:29 amalloy: (inc lazybot)

14:29 lazybot: ⇒ 18

14:29 hyPiRion: plus #1080 and #1173 and friends. It's a mess because we're sending data around, but we can't just pass the fd to a child proc

14:32 bbloom: technomancy: what if i can't find my revoke key? lol

14:32 technomancy: i suck.

14:36 owengalenjones: I guess its impossible to have a multi variadic function with a rest argument right?

14:37 hyPiRion: owengalenjones: not if it's possible to distinguish between the variants

14:37 owengalenjones: yeah that makes perfect sense after thinking about it

14:38 hyPiRion: ,((fn f ([a b] (f a b 5)) ([a b & c] (apply + a b c))) 1 2)

14:38 clojurebot: 8

14:39 owengalenjones: thanks hyPiRion

14:39 hyPiRion: np

14:54 bbloom: technomancy: ok, i can't revoke my old key, but i made a new one and republished all of my artifacts with that key

14:54 technomancy: and this time i made a revoke key & will back everything up

14:55 technomancy: the docs don't seem to say what things need to be backed up though. looks like gnugpg stores keys in some binary format. is there a good way to gather all the plain text files i need for making a backup?

14:56 https://gist.github.com/chrisroos/1205934 <- is method 2 the way to go here?

14:58 futile: What's some idiomatic Clojure code that demonstrates just how simple it is compared to the alternative using OOP (and instance variables etc)?

14:58 Chousuke: futile: that's a pretty vague question

14:58 futile: yep

14:59 jweiss: we as a community should have an answer for that somewhere though :)

14:59 Chousuke: well, I don't know.

14:59 some things are easier, some things are not

14:59 jweiss: map is a nice example maybe

14:59 i did a blog post a while back that wasn't too far off this subject

14:59 Chousuke: but to pick an example, I often wish I had a good sequence toolkit when working with pythong

14:59 ... -g

15:00 futile: jweiss: sure, any individual core function is pretty easy. but it'd be nice to see using them together to do something in a simpler way than the OOP way

15:00 Chousuke: HA

15:00 jweiss: futile: here's an example i posted a while ago http://jweiss.com/blog/?p=140

15:01 hyPiRion: futile: the expression problem is usually a common one

15:01 chouser did a video on that I think

15:01 Chousuke: it's so often that Iwant to write code that goes like filter / extend -> transform -> reduce/transform -> ...

15:01 and I have to write lots of loops in python

15:01 and make copies of things so I don't clobber stuff

15:02 hyPiRion: futile: yeah, here it is http://www.infoq.com/presentations/Clojure-Expression-Problem

15:03 Chousuke: for example, I'm working on some visualization code that goes through a list of units on a rack, and I wanted to fill up the "blanks" on the list so that it's easy to render

15:03 but it's pretty tough in python to just insert stuff in the "middle" of a list

15:05 and after debugging a problem for 15 minutes that resulted from a missing "return" keyword I configured emacs to automatically run pylint :P

15:06 bbloom: Chousuke: haha. that's bit me before too w/ javascript. after clojure, coffeescript, ruby, and a few other things…. "return" is a code smell to me, it implies an imperitive break from a loop :-P

15:07 Chousuke: I've almost got my emacs configured just right for python

15:07 kmicu: too many "python" word, my eyes hurts...

15:07 clojurebot: bcrypt. http://codahale.com/how-to-safely-store-a-password/

15:07 Chousuke: the only thing missing is completion in ipython shell

15:07 bbloom: lol thanks for the reminder, clojurebot

15:07 hyPiRion: ahah

15:08 Chousuke: as usual, all documentation online is outdated or hidden inside someone's .emacs.d on github. emacs is awesome, but...

15:09 I tried to find how to configure that nice fuzzy autocompletion that emacs starter kit had

15:09 futile: apparently English has an intentional pattern where words that start with "fl" are associated with fast sudden movement

15:09 Chousuke: but I don't even know what to google for

15:09 benkay: now that i've been infected with this state management paradigm the idea of database migrations makes me cry

15:10 Chousuke: the feature that allows you to type eg- p-i-p and get package-install-package

15:11 and the one that searches the directory tree when you just type a file name. browsing directories manually in the minibuffer is a bit painful even with autocompletion

15:11 I know emacs can do all this, I just have no idea what it's called and how it's enabled

15:14 TimMc: futile: flotsam? floating? flat? flange?

15:15 flax, flour...

15:15 futile: TimMc: only words that started out as English

15:15 TimMc: flense

15:16 hyPiRion: flute, flint, etc

15:18 TimMc: floor, flimsy, flinders...

15:19 Bronsa: flatulence.

15:20 stuartsierra: Chousuke: smex

15:20 and ido

15:21 rkneufeld: Chousuke: I use projectile's find-file-in-directory (?)

15:36 Chousuke: stuartsierra: ido I already have but smex I guess is the one I'm missing

15:55 futile: ok

16:03 oooh

16:05 i kinda wanna try porting this to clojure, https://github.com/JoshCheek/seeing_is_believing/blob/master/lib/seeing_is_believing.rb

16:05 just because of all the instance variables and methods, just to see how much cleaner it would look simply by being functions

16:06 not to mention being clojure

16:07 tomjack: would it have to be at the top-level?

16:07 like the interface is a macro which instruments the code inside?

16:08 futile: tomjack: uhhh

16:09 wat?

16:09 clojurebot: For Jswat: start clojure with -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888

16:10 devn: technomancy: do you know if there are multiple endpoints? It looks like syme just uses us-west-2 right now.

16:10 tomjack: futile: I mean you couldn't e.g. trace code you had already defined in a namespace somewhere

16:10 (or could you?)

16:11 futile: tomjack: oh, i dont mean that it would actually work

16:11 tomjack: you want to write a port that doesn't work?

16:11 futile: tomjack: i just wanna see the code transformation when going from ruby to clojure

16:11 tomjack: ah

16:11 futile: i bet it'd look way cleaner

16:11 and less confusing

16:11 tomjack: ..so presumably with some parts missing

16:11 futile: yeah it might call some non-existing functions

16:12 the kinda stuff thats ugly and necessary when making it work, but isnt the business-logic of this lib itself

16:18 technomancy: devn: my understanding is that the region is determined by the AMI you use, but I haven't confirmed this

16:20 devn: technomancy: interesting

16:20 testing it now

16:22 technomancy: I got an "error"

16:22 not sure what the log looks like

16:22 technomancy: =\

16:22 I haven't tested the custom ami stuff at all yet

16:22 do you have a heroku account? I can collab you on it if you want to take a look now

16:22 devn: yeah

16:23 technomancy: in this case it's "The image id '[ami-4923611b]' does not exist" but I'll add you if you want to do more debuggin'

16:24 devn: technomancy: yeah i think the endpoint needs to change

16:24 technomancy: i was thinking there'd be a dropdown for region, so if you select a region, it will use the default 64bit ubuntu 12.x AMI, unless you specify an AMI ID

16:26 technomancy: yeah, a dropdown for region would be fine

16:29 TimMc: technomancy: Thoughts on the instantserver.io thing?

16:29 technomancy: TimMc: wonder what the Mean Time to Bitcoin is for services like that

16:30 TimMc: :-D

16:30 technomancy: TimMc: the cool thing about that one is that they can have a pool of ready instances, whereas with syme you need to spin up a node on demand, so it's a lot slower

16:31 I was thinking about if I ever do something like Syme Pro it could have a slack pool, but it complicates things

16:31 anyway, it's free software; if anyone wants to build Syme Pro they're welcome

16:31 all I ask is for a free lifetime account =D

16:33 TimMc: Ooh, good point about the pool.

16:36 technomancy: pros and cons of running entirely in the user's account

16:43 justin_smith: I has successfully run lein based web servers on the instant server site

16:43 log in; aptitude install leiningen git; clone my project; lein run

16:43 boom

16:43 pretty smooth process actually

16:45 technomancy: that's an OK way to go if you only have a single node

16:45 justin_smith: it was just to show something to a friend for a few minutes

16:45 without having to allocate a real server etc.

16:45 technomancy: yeah, a real deploy is going to need more infrastructure around repeatability

16:46 justin_smith: and the fact that it is free helped

16:46 yeah, of course

16:46 technomancy: `lein with-profile production run` would be better

16:46 keep dev deps away

16:46 justin_smith: good point

16:46 technomancy: also you can save memory with trampoline

16:47 plus you want to freeze your deps so snapshots don't get upgraded out from under you

16:47 at some point it gets simpler to just ship an uberjar to your server

16:47 but it works for a demo =)

16:47 justin_smith: yeah, just showing a friend the state of my work, the kind of thing I think instant server is best for

16:48 technomancy: oh; I missed the "instant" part

16:48 heh

16:48 really looking forward to seeing lein2 in debian though

16:48 the profile stuff actually won't work in that scenario since apt still gets you 1.x =\

16:49 justin_smith: stability: the cause of, and the solution to, all of debian's problems

16:52 technomancy: more or less

16:59 LE_CESSMASTEUR: Raynos, do you still love me?

17:00 Raynos: What

17:02 futile: Raynos: correction: "WAT"

17:02 Raynos: I would also except "wat"

17:03 Raynos: or "ಠ_ಠ"

17:04 Raynos: wat

17:07 futile: (inc Raynos)

17:07 lazybot: ⇒ 1

17:07 Raynos: I think I may have to leave

17:07 futile: i was just about to say, "stop wasting so much time on irc guys"

17:07 so yeah

17:08 Raynes: Raynos: We were just talking IRL about how your name screws up tab completion for amalloy when he is trying to complete my IRC nick. :p

17:09 Raynos: Oh.

17:09 Well

17:11 tomjack: hmm, could a dispatch map be a map which specifies a new equality impl on incoming keys?

17:12 no.. that won't work

17:13 jweiss: anyone have any insight into what's happening here? https://www.refheap.com/15966 it's bizarre, the same clojure.data.xml call, over and over, loading different supposedly unrelated libs in between, and suddenly i get different output. the weird thing is is not consistent, after some random require, the behavior changes forever until i restart the repl.

17:19 hiredman: jweiss: all that is not using a specific xml parser, it is just sort of grabbing one from the ambient environment, most of those libraries can use several different parsers depending on what is available

17:20 or generators or whatever

17:21 so they sniff the classpath or loaded vars or whatever

17:22 ztellman: can you get &form on inlined functions?

17:22 or is that only for macros

17:22 amalloy: ztellman: i don't think you can

17:23 ztellman: well, that sucks

17:23 amalloy: ztellman: if(inline != null) {return analyze(context, preserveTag(form, inline.applyTo(RT.next(form)))); }

17:24 so, definitely no

17:24 ztellman: oh, hmm, the reason I wanted the &form was to preserve the tag

17:24 because it seems to be vanishing

17:27 amalloy: ztellman: tbh, trying to tag function/macro calls is unreliable enough already that i'd say whoever is writing ^Whatever (your-inlined-function) shouldn't be terribly surprised that the tag falls off

17:27 ztellman: yeah, this is actually nested inlined functions

17:28 and the outer inlined function is explicitly using with-meta on the inner inlined form

17:28 to no avail

17:28 amalloy: hah. i see. and you don't want to let it, because then you lose whatever benefit inlining gave you

17:29 ztellman: amalloy: I was using let before, I was just curious if that has any performance implications

17:29 amalloy: well, it might or might not. but it means your inline function has less information to work with

17:30 eg, perhaps the inlined thing notices that one of its inner calls is (identity x) and replaces that with just x; if you first (let [y (identity x)] (my-inlined-fn y)), it can't do that

17:30 ztellman: right, in this case I'm just playing bytecode golf with a bunch of aloads and astores

17:31 I'm trying to understand if they have any impact, post-jit

17:31 but there are certainly other reasons you don't want to have to use the let indirection all the time

17:34 tomjack: and no &env either..

17:34 I guess an inlined fn could look at LOCAL_ENV?

17:35 amalloy: jweiss: you could sorta test hiredman's theory by, before requiring any "unrelated" namespaces, (alter-var-root #'clojure.data.xml/indenting-transformar memoize)

17:37 that would mean the same transformer is always being used

17:40 dnolen_: yowza JavaScriptCore is closing the gap w/ V8 as far as ClojureScript is concerned

17:40 bbloom: dnolen_: nice.

17:42 wastrel: do emacs users tend to use the gui window or stick to command line

17:44 jouiswalker: wastrel: i find the gui more convenient since i dont have to bother with weird terminal specific behavior

17:49 dnolen_: bbloom: 46ms for JSC to build build a transient vector of 1000000 elements, vs. 20ms on the JVM

17:49 hiredman: I use gui emacs locally (so pretty on a mac) and terminal emacs on lots of vms

17:51 justin_smith: hiredman: ever try tramp instead of terminal emacs?

17:51 amalloy: wastrel: i prefer gui when possible, because there are some combined keystrokes i can't manage to send properly to a terminal (over ssh, at least)

17:52 justin_smith: more key commands work in the gui, that don't map nicely to terminal

17:52 ie. in the gui you can have an alt key, a meta key, and a super key

17:52 ansi can't do that I don't think

17:52 Bronsa: i use emacsclient -nw because I tend to switch a lot between emacs and zsh

17:53 gtrak: you can use different font sizes in the gui, that's convenient

17:54 hiredman: justin_smith: the vm is really a total working environment

17:54 justin_smith: you can still ssh in, correct/

17:54 hiredman: there are services I interact with outside of emacs on there

17:54 sure

17:54 I ssh in and run tmux

17:54 then emacs

17:55 I am sure 80% could be done easily very tramp

17:55 justin_smith: I realized recently how much more convenient tramp over ssh is rather than ssh in and run emacs

17:55 hiredman: but I really care about the 100%

17:55 justin_smith: ok

17:58 jouiswalker: i'm going to keep tramp in mind

17:58 that seems really convenient

18:14 ztellman: amalloy: for the record, the solution is to write a version of macroexpand that also calls (-> (first x) resolve meta :inline) when it exists, and to use that within the inline form function

18:14 amalloy: an interesting question came up on stackoverflow, and i wonder what the folks in here think. what, if anything, is the difference between a form and an expression?

18:15 ztellman: form as in def, if, etc?

18:16 Chousuke: I think the CL hyperspec actually defines what a form is

18:16 amalloy: ztellman: form as in list of things. (+ x 1) is an example of a form in any lisp i've heard of

18:17 Chousuke: but my understanding is that a form is something lisp-specific while expressions exist in all languages

18:17 technomancy: amalloy: an expression implies evaluation; a form may not

18:18 amalloy: technomancy: that's basically what i think as well (http://stackoverflow.com/a/17223015/625403), but i think it's enough of a philosophical question ("what is the nature of evaluation?") that there are other reasonable answers

18:19 brehaut: something something side effects and statements something

18:19 * brehaut waves hands

18:19 technomancy: amalloy: the arglist is a good example; it's a form without being an expression

18:19 amalloy: technomancy: loads of forms (under my definition are not expressions

18:20 )

18:20 clojurebot: ) is http://xkcd.com/224/

18:20 technomancy: heh

18:20 hiredman: ~botsnack

18:20 clojurebot: botsnack is scoobysnack

18:35 futile: Is there such a thing as, like, (memoize-for-seconds 60 ...) ?

18:35 That'd be pretty cool for caching.

18:36 bbloom: futile: https://github.com/clojure/core.cache has TTL caches

18:36 futile: Neat.

18:37 bbloom: futile: however, they rely on cache misses to trigger timeouts, which is potentially a problem if you have infrequent reads and want to reclaim memory

18:37 futile: not for me

18:37 bbloom: it would be a pretty trivial extension to add an asynchronous timeout

18:42 futile: thanks bbloom

18:44 devn: technomancy: you've got a PR and a few messages from me. Let me know if you want me to roll back prod.

18:56 TimMc: &(.append (StringBuffer.) 5)

18:56 lazybot: ⇒ #<StringBuffer 5>

18:56 TimMc: &(.append (StringBuffer.) nil)

18:56 lazybot: java.lang.IllegalArgumentException: More than one matching method found: append

18:57 TimMc: ...but I can't figure out how to type-hint the nil.

18:57 amalloy: TimMc: (let [^String x nil] (...))

18:57 TimMc: :-(

18:57 amalloy: (.append sb ^String (identity nil))

18:57 hyPiRion: or Object, for that matter?

18:58 TimMc: (defmacro its-a-goddamn [class val] (with-meta `(identity ~val) {:type ~class}))

18:59 Well, s/~class/class/

19:00 (.append (StringBuffer.) (its-a-goddamn String nil)) ;;= #<StringBuffer null>

19:00 Thanks, amalloy.

19:00 amalloy: TimMc: also, s/type/tag?

19:00 TimMc: Hmm, yes.

19:00 amalloy: like, that just works because the compiler decides (identity nil) is an Object

19:00 hyPiRion: Oh, this I did not expect.

19:00 &(.append (StringBuffer.) ^Object (and))

19:00 lazybot: ⇒ #<StringBuffer true>

19:00 TimMc: Indeed.

19:00 hyPiRion: &(.append (StringBuffer.) ^Object (or))

19:00 lazybot: java.lang.IllegalArgumentException: More than one matching method found: append

19:00 amalloy: hyPiRion: type-hinting macros is fraught with peril

19:01 both 'and and 'or have discarded your typehint entirely

19:01 it works because (and) evals to true, which the reflector can figure out; (or) evals to nil, which has TimMc's original problem

19:01 hyPiRion: So it just reflected on boolean then

19:01 TimMc: (╯°□°)╯︵ ┻━┻

19:02 hyPiRion: &(#(.append (StringBuffer.) ^Object %) nil)

19:02 lazybot: ⇒ #<StringBuffer null>

19:02 n_b: cemerick: No reason to do this 140 characters at a time; Long term I'd like to backport a bunch of the Fireplace enhancements in terms of connection/nrepl to a more VimClojure-esque interface, so I'll definitely peek at that Python module and try and contribute back

19:02 mthvedt: type hints are reader macros. they don't become part of the macro, they become part of the list you're passing to the macro

19:02 …i think

19:03 cemerick: n_b: hi :-) You'll likely want to look at the module I'm building now, which is one level above nrepl-python-client. Basically a thin shell specifically for vim<=>nrepl interop.

19:03 hyPiRion: &(#(.append (StringBuffer.) ^int %) nil) ; ?

19:03 lazybot: java.lang.NullPointerException

19:04 hyPiRion: I suppose it's casting it to int or something.

19:05 cemerick: n_b: I know exactly *zero* about vim UI stuffs, even less about its conventions. Largely, I'll be flaunting them. Again, roughly creating in vim what ccw (and enclojure, and lispworks, etc) has.

19:05 hyPiRion: (That was a dumb statement, of course it has to)

19:05 n_b: cemerick: Will definitely keep my eye out; I'm subscribed to the vimclojure ML and just haven't been keeping my eye on it. All in on /[CF]#/ for the time being

19:05 cemerick: I'm more or less in the same boat; I learned vimscript purely to make some tools for writing and have never had a good experience with it, which has always dissuaded me from learning more. It makes one pine for elisp





19:07 n_b: cemerick: All the work in terms of dealing with async that I've seen has been along the lines of vim-dispatch, which is really punting on the issue. It's a complaint people have had for a long time but lots of inertia behind it that makes any easy fix more or less impossible

19:08 cemerick: n_b: my really minor experimentation leads me to believe you can toss stuff at vim from threads in python at will, and it responds as expected

19:09 If (big, big IF there) that holds up, then I suspect the vim-can't-do-async is more of a cultural thing about "everything should be in vimscript, python/ruby/whatever deps is unclean"

19:11 n_b: I don't know enough to speculate on the reasons; but I'd be very excited to have a proper, emacs-like REPL in vim

19:12 (mostly I just want to be able to C-c when I accidentally evaluate a 25MB form at the REPL :P)

19:12 vsync: will i have any luck at all trying to run nrepl in xemacs?

19:13 technomancy: vsync: very low chances

19:13 vsync: is it just a lot of interactive-p versus called-interactively-p and move-beginning-of-line vs beginning-of-line?

19:14 technomancy: I'm sure the incompatibilities go a lot deeper than that

19:14 vsync: or a lot of hairy stuff with all the emacs variants of trying to catch up to xemacs features?

19:14 :P

19:14 technomancy: lots of low-level socket communications going on

19:15 Raynes: tpope: HALp

19:17 technomancy: cemerick: then you're going to move on to the nrepl-discover stuff, right?

19:20 Apage43: https://floobits.com/help/plugins/#vim

19:20 floobits does some trickery to get vim async stuff working

19:21 cemerick: technomancy: one step at a time :-P

19:21 Though if I start thinking of ways to build a scheme into vim, come shoot me. :-P

19:22 hiredman: if you don't just embed guile...

19:26 Morgawr: http://www.morgawr.eu/p/1371770066.gif woo, clojurescript game engine is slowly coming along :D

19:41 dnolen_: Morgawr: neat!

19:54 cemerick: dnolen_: were you meaning to cut a cljs release?

19:54 dnolen_: cemerick: yep

19:54 cemerick: dnolen_: it's stuck

19:55 dnolen_: cemerick: oh I didn't do anything

19:55 cemerick: that's some stuart sierra does

19:55 something

19:55 cemerick: dnolen_: oh, cljs releases aren't fully automated?

19:56 the staging repo is fully staged on oss....

19:57 Zamarok: Is it possible to write some sort of lazily evaluated list in Java that Clojure can access as an infinite sequence?

19:58 Maybe someone could point me in the right direction? Examples or libraries to look into..

19:58 brehaut: ,(doc iterator-seq)

19:58 clojurebot: "([iter]); Returns a seq on a java.util.Iterator. Note that most collections providing iterators implement Iterable and thus support seq directly."

19:59 Zamarok: hmm

19:59 noonian: was just going to say that in a somewhat more wordy and most likely less correct way

19:59 Zamarok: I will try some stuff out, thanks

20:00 hiredman: if your whole deal is java->clojure you could just use LazySeq

20:03 amalloy: lazyseq would be okay, but honestly i'd just return something that implements iterable

20:04 since seq works on those

20:05 otoh, just trying to sketch out how i'd write such an iterable, i now suspect hiredman's suggestion to use LazySeq might be easier

20:05 dnolen_: cemerick: all i know is i always ask stuart sierra to do a release

20:08 noonian: dnolen_: whats having a new release?

20:09 dnolen_: noonian: just release ClojureScript artifact

20:09 noonian: ah cool, thanks

20:59 jimrthy: I have a .jar under my ~/.m2 tree. It's in `lein classpath`. Trying to require any of the namespaces that `jar -tf` claims it provides at the REPL causes FileNotFoundException.

21:00 I feel like a total moron because I'm probably missing something obvious because I don't think I really grasp the way CLASSPATHs work.

21:00 Is there a decent resource available to help me understand why I'm having this problem (it involves JNI)?

21:01 hiredman: how are you requiring it?

21:01 in what kind of environment (lein repl, nrepl, etc?)

21:02 have you restarted the repl since you added the dependency to project.clj?

21:02 jimrthy: I've tried every variation I can think of of (require 'org.zeromq.jzmq)

21:02 noonian: and this is a leiningen repl?

21:02 jimrthy: leiningen NREPL through emacs, and I've learned to just restart every time I change everything in project.clj

21:03 hiredman: jimrthy: and what is the exact file it says is not found?

21:03 (my guess it is a native library jzmq depends on)

21:03 jimrthy: Could not locate org/zeromq/ZFrame__init.class or org/zeromq/ZFrame.clj on classpath: clojure.lang.RT.load (RT.java:443)Could not locate org/zeromq/ZFrame__init.class or org/zeromq/ZFrame.clj on classpath: clojure.lang.RT.load (RT.java:443)

21:04 hiredman: or it could be this org.zermq.jzmq is just a broken library

21:04 jimrthy: I get the same error from a basic lein repl

21:04 hiredman: jimrthy: which library is this?

21:05 jimrthy: Yeah, I was about to break down and put together a basic java project to see, but I figured I'd check here first.

21:05 amalloy: looks to me that it's likely a java library that doesn't provide any clojure namespaces

21:06 jimrthy: zeromq is a C lib. jzmq is supposed to be a fairly mature JNI piece on top of it.

21:06 seancorfield: in which case (import ...) instead of (require ...)

21:06 hiredman: amalloy: sure, if jimrthy isn't pasting the actual error he sees

21:06 muhoo: hmm, first time i've blown up the heap. i've got 2GB of memory assigned to the JVM, and 2GB of it used as heap, says visualvm, but only a tiny fraction of it as "used heap"

21:06 noonian: yeah, I think you need to import not require

21:06 hiredman: but he is loading org.zeromq.jzmq, and the error mentions org.zermoq.ZFrame

21:06 muhoo: the "perform gc" button is greyed out. alas, i am a jvm ignoramus :-(

21:07 jimrthy: (import 'org.zeromq.jzmq)

21:07 amalloy: oh, so he is. i figured he was trying (require 'org.zeromq.ZFrame)

21:07 jimrthy: ClassNotFoundException org.zeromq.jzmq java.net.URLClassLoader$1.run (URLClassLoader.java:366)

21:07 muhoo: heap dump shows 11MB of strings and PHM's, but not anythign that looks like 2gb

21:07 hiredman: which would only happen if org.zeromq.jzmq is clojure and is trying to load a non-existent org.zermoq.ZFrame

21:07 amalloy: or he is really bad at asking for help with errors

21:07 muhoo: somewhere, i suspect, a head is being held on to

21:07 hiredman: (I dunno why I just don't jump right to that)

21:07 jimrthy: Oops, yeah...did I mention that I've been trying lots of variations?

21:08 amalloy: ~helpme

21:08 clojurebot: A bug report (or other request for help) has three parts: What you did; what you expected to happen; what happened instead. If any of those three are missing, it's awfully hard to help you.

21:08 hiredman: jimrthy: that is a java library, not a clojure one, so you need to load the java classes using import

21:09 jimrthy: I'm sorry...I'm quite the clojure newb.

21:09 muhoo: somewhere, a java.util.HashMap$KeyIterator keeps growing and growing in size, even though i'm not doing anything

21:09 jcromartie: so who's the new "Senior Clojure Engineer" at LivingSocial eh?

21:09 seancorfield: jimrthy: so you have [org.zeromq/jzmq "2.2.0"] in your dependencies?

21:09 hyPiRion: muhoo: well, you must be doing something

21:09 noonian: muhoo: are you sure you blew the heap? not the stack? what computation causes the error?

21:09 seancorfield: and you should (import 'org.zeromq.jzmq.SomeClass)

21:09 muhoo: hyPiRion: noonian: it's heap. i'm getting OOM exceptions when doing anything

21:10 hiredman: I would recommend looking at just about any alternative because why would you want to doom yourself to fighting with native libraries from the start? https://github.com/spotify/netty-zmtp gives you what I understand is a slightly dated version of zeromq has a jvm library

21:10 seancorfield: you have to import specific classes, not packages

21:10 muhoo: and, visualvm shows heap maxed out, but not used.

21:10 jimrthy: 2.2.0?? Where did that come from?

21:11 hyPiRion: $latest org.zeromg/jzmq

21:11 lazybot: No project by this name exists on clojars.

21:11 hyPiRion: oh, you. Only on clojars? I had hopes up dude.

21:11 muhoo: and indeed i'm not doing anything. i have nrepl running, no threads, my webserver threads appear to have shut down. bizarre.

21:11 seancorfield: jimrthy: I just picked the latest version I found on Maven

21:12 jimrthy: what dependency do you have in project.clj?

21:12 muhoo: anyway, i've build this house of cards, adding library after library, and now i'm screwed. my own fault. RAM is not an infinite resource, apparently.

21:12 seancorfield: you could paste your project.clj file to http://refheap.com

21:12 muhoo: and some of these libs, or my own code, may have a memory leak.

21:12 noonian: muhoo: I don't know much about java vm settings, but when you said you have 2G for java and also 2G for the heap makes it sound like theres no memory to use for the stack?

21:12 jimrthy: @seancorfield 2.1.0-SNAPSHOT...which it's what's in .m2. 1 second

21:13 muhoo: OutOfMemoryError PermGen space java.lang.Class.getDeclaredMethods0 (Class.java:-2)

21:13 hyPiRion: noonian: the jvm has a constant stack on 64kb afaik

21:13 by default

21:13 the heap can't eat from it and vice versa

21:13 muhoo: the error i'm seeing loks like heap, PermGen space, it says

21:13 noonian: hyPiRion: cool, thanks for the clarification

21:14 muhoo: anyway, no prob, if there's no easy/obvious answer, i'll just run with visualvm running and see if i can catch it behaving badly.

21:14 jimrthy: https://www.refheap.com/15971

21:14 * muhoo restarts jvm

21:14 hyPiRion: muhoo: are you redeploying much? That may be it

21:15 muhoo: hyPiRion: what do you mean by redeploying?

21:15 i'm doing a ton of C-c C-k in nrepl.el, for sure.

21:15 which causes the ns to recompile.

21:15 seancorfield: jimrthy: well, i don't know where you're getting that version from - it's not maven

21:16 jimrthy: @hiredman netty-zmtp may be my best bet

21:16 hyPiRion: muhoo: uh oh, that's likely the classloader then

21:16 seancorfield: but you should be able to (import 'org.zeromq.ZFrame) - that works for me with 2.2.0 in the depencies

21:16 hyPiRion: muhoo: http://frankkieviet.blogspot.ca/2006/10/classloader-leaks-dreaded-permgen-space.html

21:16 muhoo: hyPiRion: fantastic, thanks!

21:16 jimrthy: @seancorfield It's a self-build, based on advice from a blog post. I'll give the maven version a shot

21:16 seancorfield: jimrthy: but basically the syntax is (import 'some.package.ClassName)

21:17 jimrthy: or (import '(some.package ClassNameA ClassNameB))

21:17 but you want import not require

21:17 hyPiRion: np

21:17 seancorfield: and you want to specify class names not just a package

21:18 noonian: is it more idiomatic to use lists for importing java classes instead of vectors?

21:19 hiredman: yes

21:19 seancorfield: and that's because it's (package Class Class Class) so the first element is "special"?

21:19 hiredman: sure

21:20 seancorfield: (i've always thought it's a weird difference but it's how i keep seeing it in people-who-know-better's code)

21:21 jimrthy: @seancorfield That loads at least. Thank you.

21:21 hiredman: well, that is a very good rationalization, but the reason is because then emacs indents it right

21:21 noonian: lol, ok thanks

21:21 technomancy: it's not just emacs

21:21 it's everyone who copies emacs too =)

21:21 jimrthy: @hiredman Thank you, too.

21:21 seancorfield: omg! of course hiredman - that's makes perfect sense! thankyou!

21:21 hiredman: ok, all good and correct editors

21:23 noonian: yeah, I've been going with emacs indentations except on some def/with-like fns and multiple arity fn declarations

21:31 amalloy: (inc hiredman)

21:31 lazybot: ⇒ 18

21:33 janpaulbultmann: does somebody know how to read the class attribute of an interface? a la Foo.class in java?

21:33 justin_smith: ,(class 1) ; is this what you want?

21:33 clojurebot: java.lang.Long

21:33 amalloy: janpaulbultmann: that's just Foo

21:34 &[String Long Class]

21:34 lazybot: ⇒ [java.lang.String java.lang.Long java.lang.Class]

21:36 janpaulbultmann: justin_smith, amalloy:seems to be of the wrong time thoug

21:36 http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#readAttributes(java.nio.file.Path, java.lang.Class, java.nio.file.LinkOption...)

21:36 god dammit even the javadoc urls are broken by design

21:37 http://bit.ly/17qO1SA

21:37 this horrible Files api expects the .class attribute of an interface

21:39 amalloy: janpaulbultmann: what you're saying doesn't make sense

21:39 only rage against things that are actually possible. interfaces are classes

21:39 janpaulbultmann: amalloy: I would agree if it wasnt written right here

21:39 Files.readAttributes(path, PosixFileAttributes.class, NOFOLLOW_LINKS);

21:40 http://docs.oracle.com/javase/7/docs/api/java/nio/file/attribute/PosixFileAttributes.html

21:40 amalloy: you're probably running into the same problem everyone who tries to use nio.file does, ie that java varargs are really arrays

21:41 hiredman: janpaulbultmann: .class isn't a really member

21:42 janpaulbultmann: hiredman: yeah I know, don't really know what to call it then though ^^, syntactically its an attribute

21:42 noonian: ,(class "foo")

21:42 clojurebot: java.lang.String

21:42 noonian: ,java.lang.String

21:42 clojurebot: java.lang.String

21:42 hiredman: janpaulbultmann: if you want to get super technical java doesn't have "attributes"

21:43 java classes have "members"

21:43 Foo.class is similar looking to member access

21:43 but what you can is the instance of Class for that class

21:43 which in clojure is just Foo, or in this case PosixFileAttributes

21:44 if that is not working for you, I suggest looking at the exception

21:44 noonian: ,(Class. "testing")

21:44 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Class, compiling:(NO_SOURCE_PATH:0:0)>

21:45 noonian: ,(java.lang.Class. "testing")

21:45 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Class, compiling:(NO_SOURCE_PATH:0:0)>

21:45 noonian: ,(. (class "foo") "class")

21:45 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Malformed member expression, compiling:(NO_SOURCE_PATH:0:0)>

21:46 noonian: ,(. "foo" class)

21:46 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: class for class java.lang.String>

21:47 janpaulbultmann: hiredman: according to those no such method exists,I first assumed this was because of type mismatch but now I lean towards amalloys vararg hypothesis ^^

21:50 noonian: ,(.getClass "foo")

21:50 clojurebot: java.lang.String

21:54 janpaulbultmann: hm nope, even when wrapped in (to-array [f PosixFileAttributes LinkOption/NOFOLLOW_LINKS]) it still fails :(

21:55 hiredman: ,(to-array ["foo"])

21:55 clojurebot: #<Object[] [Ljava.lang.Object;@a499fa>

21:55 hiredman: what is the type the array created by to-array? does it match the type expected by the method?

21:56 janpaulbultmann: hiredman: I assume it will be an object array as it is used to interact with java varargs

21:57 hiredman: no, it will be of whatever type the docs say

21:57 janpaulbultmann: or is only the variardic part in that array

21:57 hiredman: that

22:00 janpaulbultmann: ,(Files/readAttributes f PosixFileAttributes (into-array LinkOption [LinkOption/NOFOLLOW_LINKS]))

22:00 clojurebot: #<CompilerException java.lang.RuntimeException: No such namespace: Files, compiling:(NO_SOURCE_PATH:0:0)>

22:01 janpaulbultmann: still fails with No matching method found: readAttributes

22:01 so close but jet so far ^^

22:01 hiredman: what is f?

22:02 janpaulbultmann: a file

22:02 ah

22:02 goddamit

22:02 who designs this shit

22:02 one thing for shure, if I get this garstly api running I'll create a library around it

22:03 so that no one ever has to feel the pain of java native file io

22:03 hiredman: clojure definitely needs more libraries written by people who don't know clojure

22:03 wastrel: does it?

22:04 i don't know clojure!

22:04 n_b: That seems like a recipe for disaster

22:04 jcromartie: janpaulbultmann: sounds like you are on the wrong Java version?

22:04 wait

22:04 n_b: at the very least, unidiomatic code that's hard to integrate with existing infrastructure

22:04 jcromartie: janpaulbultmann: never mind, you are figuring it out

22:05 brehaut: hiredman: maybe they could take on the neglected web framework space

22:05 janpaulbultmann: jcromartie: yeah every damn place accepts an file

22:05 except for this one where it has to be a path

22:05 jcromartie: except that :)

22:05 janpaulbultmann: god dammit I hate java with as much passion as I love clojure

22:06 jcromartie: janpaulbultmann: don't hate Java, hate the… OK, hate Java

22:06 n_b: The issue here is more that Clojure does very little to hide details of the host platform

22:07 and it's not an issue, so much as a design choice; one I think that makes interaction between e.g. Clojure and Java much more natural

22:07 hiredman: brehaut: I would hate to think that we had exhausted all possible ways to push bytes down a pipe

22:08 TimMc: Poll: With java.net.URL, which "default" value for port do you hate more? -1, or null

22:08 brehaut: man, rails is almost ten years old

22:08 TimMc: I'm writing Yet Another One True URL Library, you see, and this is a very important design decision. :-P

22:09 brehaut: TimMc: i hate -1 more

22:09 hiredman: why not -5?

22:09 TimMc: (That is, java.net.URL returns -1, but it could have been designed to return an Integer.)

22:09 janpaulbultmann: n_b: interop is great, it is really java that is madness, ever tried to find out when a thread pool runs empty without polling or killing the damn thing?

22:09 TimMc: hiredman: Yeah. :-/

22:10 n_b: janpaulbultmann: I have, actually. On the whole j.u.c is really well designed though...

22:10 janpaulbultmann: n_b: how? custom queue implementation?

22:11 n_b: IIRC I used latches

22:13 janpaulbultmann: n_b: yes that works for a bounded work load where the size is known in advance. Once you have an unkown number of jobs or even worse jobs that spawn new jobs, there is simply no way except for a custom queue.

22:14 and even then you won't know if the threads all finished running,so you need a custom thread as well ^^

22:14 n_b: Ah, yea. That's considerably more complex than what I was doing

22:16 nsxt: Somewhat off-topic but I'm looking for a rosetta stone here... I'm looking for the equivalent of Clojure's partition in Ruby.

22:17 janpaulbultmann: nsxt: you provide a binary function that returns true at places to split

22:17 ?

22:18 n_b: nsxt: Probably taking the length and enumerating across a range and then calling .slice is the interview-question-attempt-#1 approach to it

22:19 nsxt: n_b: I figured as much, just didn't know if there were a more concise way of doing it

22:19 ddellacosta: nsxt: maybe chunk will do it? http://ruby-doc.org/core-2.0/Enumerable.html#method-i-chunk

22:19 n_b: if it's in stdlib it'll be defined in Enumberable

22:20 ddellacosta: nsxt: but you still have to give it some condition regarding the index I suppose

22:20 nsxt: The thing is, I'm not really looking to supply a binary function

22:20 janpaulbultmann: nsxt: sorry reversed that relation, I thought a clojure equivalent for a ruby method ^^

22:20 nsxt: I'm just looking for a grouping

22:20 More concrete: I have a range of dates

22:20 muhoo: has anyone used clojure.tools.trace? i've been trying to figure out how to get it to trace just one function

22:20 n_b: nsxt: .each_with_index + an accumulator I think

22:21 oh

22:21 muhoo: it will trace the hell out of a whole NS though, producing a spew that crashes emacs. and i haven't figured out how to turn tracing OFF either

22:21 n_b: nsxt: each_slice(Int n)

22:21 nsxt: Say from Jan 1, 2012 to Feb 1, 2013. I want groups of full years within that. So the return result should be [Jan 1, 2012..Jan 1, 2013, Feb 1, 2012..Feb 1, 2013]

22:21 n_b, yeah, that's close, but just not quite

22:23 with clojure it'd be (partition 12 1 [etc])

22:27 janpaulbultmann: hiredman amalloy: thanks the problem really was in the vararg stuff, and the path/file types I messed up.

22:27 nsxt: n_b: I suppose I could just loop, use each_slice(), and then drop the first element on each iteration

22:28 Not the most elegant, but... thanks, everyone.

22:28 n_b: Just go at it loop/recur style :)

22:31 janpaulbultmann: nsxt: or you could write a thin wrapper in clojure and use jruby ;P

22:31 nsxt: janpaulbultmann: haha, trying to not go the overengineering route.

22:32 janpaulbultmann: hehe

22:56 TimMc: &(.getPort (java.net.URL. "http://google.com:६"))

22:56 lazybot: ⇒ 6

23:08 tomjack: crazy

23:09 &(.getPort (java.net.URI. "http://google.com:६/&quot;))

23:09 lazybot: ⇒ -1

23:09 tomjack: &(.getPort (.toURL (java.net.URI. "http://google.com:६/&quot;)))

23:09 lazybot: ⇒ 6

23:10 tomjack: oooh

23:11 I thought that was xi

23:12 &(Long/parseLong "६")

23:12 lazybot: ⇒ 6

23:20 spoon16: getting an NPE when I try to run "lein ring war", "lein ring jar" works

23:20 anyone have any ideas, the stack trace is not helpful and I can't see anything obvious in the google searches that I have tried

23:20 configuration contains the :ring {:handler

23:21 and 'lein ring server' works fine as well

23:30 technomancy: muhoo: I have something for that in nrepl-discover

23:30 https://github.com/technomancy/nrepl-discover

23:30 M-x nrepl-toggle-trace

23:34 tomjack: wow, I don't think I had ever seen tools.trace

23:50 mdeboard: Is there a better way of implementing an interface than https://gist.github.com/mattdeboard/5828655

23:51 The whole protocol/type/record/reify family of tools gives me trouble wrapping my head around it.

23:56 muhoo: technomancy: awesome, thanks

23:57 technomancy: muhoo: still pretty experimental, but it might do the trick

23:58 mdeboard: If anyone responded to me I had to restart emacs so lost chat

23:58 muhoo: it looks very promising. worth playing around with for sure.

Logging service provided by n01se.net