#clojure log - Feb 02 2012

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

0:00 arohner: cmajor7, Tcepsa: there's no performance difference between defn/recur and loop/recur

0:00 kilborn: dnolen: it does, and that's what I came up with. It just felt heavy-handed and since I'm very new to clojure (scheme background) I figured there might be some language facilities i'm not aware of for exactly this sort of thing

0:00 Guess not

0:01 dnolen: kilborn: if you're doing something stateful, use the stateful facilities. they're pretty simple :)

0:02 cmajor7: Tcepsa, arohner: thank you. so then if a function only does one thing (and needs to be recursive), there is no point to use a "loop/recur"?

0:03 Tcepsa: kilborn: That makes sense. In this case, though, yeah, I'd say it seems like a namespace-level atom would be a good fit.

0:03 dnolen: kilborn: you could probably do something fancy with reify + atom, then you don't have mutate at the REPL directly

0:04 you'd get back a type that you can call fns on that do the work

0:04 nuclearsandwich: ?

0:04 whoops. Mouse fumble.

0:05 dnolen: kilborn: but even then I'm not sure what that buys you over interacting on the atom via top level fns in your namespace.

0:05 Tcepsa: cmajor7: In my opinion, no.

0:05 arohner: cmajor7: right. loop is solely for the times when you want to recur, but not go to the top of the fn

0:06 cmajor7: arohner, Tcepsa: great, thanks guys

0:06 arohner: and btw, loop is exactly identical to 'let', except it's also a recursion point

0:06 Tcepsa: cmajor7: My pleasure! ^_^

0:07 (and I learned some new things too!)

0:08 kilborn: dnolen: I can do some macro magic to wrap all the atom instantiation and emulate a setter call, or maybe implement an agent which gets messages and mutates it's own state, but that's all so heavy when the function itself is 2-3 lines. It just feels wrong.

0:08 Tcepsa,Dnolen: thanks for your help

0:08 dnolen: kilborn: might be a good idea to ask this question on the overtone mailing list, I bet they've done something like this before. I'm probably babbling non-sense :)

0:08 Tcepsa: kilborn: You're welcome--good luck with Overtone; it's a really nifty project ^_^

0:09 kilborn: dnolen: If you know live-coding, solving problem with overly complicated yas snippets is a form of cheating... :)

0:10 dnolen: kilborn: I bet! I'm sure samaaron will have some good pointers.

0:11 kilborn: dnolen: yeah, mailing list is the next stop

0:21 is there a special let form for doing ycombinator-like things such as (let f #( (after 1000 f)))?

0:23 dnolen: kilborn: letfn will let you do that I'm pretty sure.

0:34 kilborn: dnolen: yep, tks.

1:02 dnolen: I'm sure someone could chime in about Lein work flow on this post http://oblong-code.blogspot.com/2012/02/unpretty.html

1:06 G0SUB: dnolen, checkout dependencies?

1:13 dnolen: G0SUB: that's what I thought I just never use that myself so not sure about the details.

1:17 G0SUB: dnolen, I have used it. Works as advertised.

3:01 tsdh: Is there a way to let pprint print long vectors/seqs in such a way that every line has as many items as possible according to *print-right-margin* instead of only one item per line?

3:49 Blkt: good morning everyone

3:50 ordnungswidrig: good morning

3:50 Blkt: :D

4:04 tsdh: good morning

4:56 G0SUB: this channel needs 1000 more users to be elite :-)

4:58 ordnungswidrig: G0SUB: the other way round: it's no longer elite if it has over 1000 users.

4:58 G0SUB: ordnungswidrig, ;-)

8:34 Borkdude: Is it safe to say that + is a symbol which is used to denote a var, and this var points to a value which is a function that can add numbers?

8:34 I'm always a bit confused about Symbols and vars

8:34 solussd: anyone have any suggestions for ruby/clojure socket or http communication? Basically, I have a rails app that will need to request information from and process the response of a clojure app which will likely, but not necessarily, be running on the same server.

8:34 symbols name things

8:34 ordnungswidrig: solussd: rpc?

8:35 solussd: I've been looking at aleph, but not sure how to talk to it from the ruby side

8:36 samaaron: Borkdude: that's how I see things

8:43 the-kenny: solussd: Do you need bidirectional communication?

8:44 solussd: the-kenny, just request/response, so no.

8:44 the clojure code doesn't need to call into the rails app

8:45 the-kenny: I'd use a simple REST interface with compojure then

8:45 aleph is nice too, but it's more useful for streaming of data

8:46 solussd: k

8:46 thanks

10:54 semperos: using swank-clojure, when I C-c C-k a namespace once, everything is fine; if I do it a second time, Clojure throws an error saying that a function I've defined in a protocol is not implemented by a record I'm using

10:55 possible reasons?

11:05 compj: semperos: does it work when you dont compile? C-c C-l ?

11:06 * semperos tries it now

11:06 semperos: every time I do record/protocol work, I tend to mess up the syntax a bit, probably the case here

11:06 here's a gist of what I'm doing: https://gist.github.com/1724259

11:07 doesn't make a difference

11:08 on first compile/load, works fine; on second, claims I haven't provided an implementation for my function

11:10 compj: ok, then my idea is wrong

11:12 maybe a last try, delete all aot compiled files and do the C-c C-l again

11:12 in a new repl

11:12 semperos: yeah, I've tried that

11:12 thanks, though

11:12 pjstadig: semperos: can you post the imports too

11:13 semperos: sure, I'll include the ns decl

11:13 pjstadig: it might be that the .start within the start function is being interpreted as a call to the start protocol fn, instead of the start method on Server

11:13 maybe a type hint would help?

11:13 semperos: ah

11:13 pjstadig: i'm not sure

11:13 semperos: interestin'

11:13 didn't know you could do type hints on protocol fn's...

11:14 compj: question is, why does it work the first time

11:14 pjstadig: although it is complaining that there's no impl for the RemoteServer defrecord

11:14 not the Server class

11:15 semperos: pjstadig: https://gist.github.com/1724259

11:15 ns included

11:15 renaming fn's is No Big Deal, I'll try that

11:16 pjstadig: i guess having the ns is a start, but now I'd have to track down all the deps to try the code myself :/

11:16 semperos: :)

11:16 it's the library I maintain, clj-webdriver

11:16 but no need to do all that work

11:16 pjstadig: just give me all your code :) i promise i'll be good

11:16 ah

11:16 semperos: this code isn't committed in the state it's in, initial dev

11:17 don't worry about going to those lengths, was just looking for a sanity check

11:17 compj: tried doing loading manually? (use :reload ...)?

11:18 * semperos tries that too

11:18 semperos: well, I'm actually *in* the namespace

11:18 I'm not using it

11:18 though I could try from a different ns and do that...

11:18 compj: just to eliminate a possible swank bug i think

11:19 semperos: sure

11:19 I just upgraded to 1.4 the other night

11:23 tried going back to swank-clojure 1.3.4, same issue...

11:24 compj: but from a different ns works?

11:25 semperos: compj: no, doesn't work regardless

11:25 only on second compile

11:33 so it looks to be a bug with the version of slime that is pulled down by swank-clojure

11:33 rolling back to 1.3.4 and making sure the correct slime checkout was loaded solved the issue

11:38 hmm, perhaps I was wrong

11:38 in my slime session, I instantiate a RemoteServer and then do (start) on it

11:39 works the first time

11:39 do a recompile with C-c C-k, hop back to slime and run start again, I get the failure describe

11:39 *described

11:39 however, if I re-instantiate a RemoteServer record and do start again, it works fine

11:40 or rather, doesn't work, just says "Evaluation aborted."

11:41 hugod: every time you compile a record or protocol, it generates a new type, so any existing objects no longer implement the protocol

11:41 semperos: hugod: makes sense

11:41 but why, when I instantiate a new instance of the record, do I just get "Evalution aborted." instead of a successful run?

11:42 whereas it works perfectly on the first compile and run

11:42 hugod: does *e give you anything?

11:42 semperos: heh

11:42 yes...

11:43 hugod: thank you, that tells me exactly why it fails

11:43 though I wonder why the exception doesn't pop open an sdb buffer

11:43 compj: what was the problem?

11:44 semperos: my lack of understanding about how recompilation affected records and protocols

11:44 I always assume my own ignorance when I hit these snags, was just wondering where the hole was this time, thanks compj hugod and pjstadig

11:45 and the fact that a java.net.BindException wasn't popping up in an sdb buffer, so I was just seeing "Evaluation aborted" at times without knowing why

12:05 mrevil: is there an easy way to wrap a lazy sequence so I can do something like obtain a lock at the beginning and at the end release it?

12:08 lucian: mrevil: why lock it?

12:12 jkdufair: when i have a slime session connected to a remote swank server and i compile a defun, say with C-c C-c, it gets sent to the remote server, right?

12:12 zakwilson_: Yes

12:12 jkdufair: ok, thx

12:12 lnostdal: hi guys, figured i'd to some upgrades .. but after doing lein install in the swank-clojure checkout here and symlinking ~/.lein/plugins/

12:13 ~/.lein/plugins/swank-clojure-1.5.0-SNAPSHOT.jar to the file in .m2 lein swank still says it's missing

12:13 clojurebot: Titim gan éirí ort.

12:13 lnostdal: "That's not a task."

12:15 zakwilson: Compiling a local file doesn't work properly on a remote server though, jkdufair; use slime-eval-buffer instead.

12:15 lnostdal: i guess lein does some "magic" with its lein plugin install thingy ...

12:17 jkdufair: zakwilson: thank you! i'm struggling to understand this. that helps immensely

12:19 zakwilson: jkdufair: I'm pretty sure slime-compile-and-load-file calls (load-file ...) on the server, while slime-eval-buffer and slime-compile-defun sends the contents of the file or function to the server. That help?

12:20 jkdufair: yes

12:20 perfect

12:20 thanks a bunch

12:43 technomancy: lnostdal: a symlink won't work anyway because the plugin is an uberjar

12:43 the symlink won't get you clj-stacktrace, cdt, and friends

12:48 lnostdal: technomancy, ah, thanks .. uberjar worked .. had to rename it slightly tho

12:49 uhm, i think

12:50 nvm

12:56 technomancy: lnostdal: 1.5.0-SNAPSHOT isn't any different from the 1.4.0 release though iirc; might as well do it the easy way

12:58 lnostdal: how?

12:58 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>

13:02 technomancy: lein plugin install swank-clojure 1.4.0

13:03 lnostdal: ok

13:07 perezd: mac users: what emacs do you use? (anything special? noob here)

13:09 erewhon: 24.0.91 via homebrew

13:09 perezd: brew wants to install 23

13:09 is that okay still?

13:11 erewhon: I think 23 is ok, but IIRC there were things that worked better in 24. There are some switches to brew to get it to build 24.

13:11 perezd: k thanks, I'll check it out

13:11 duck1123: Is there any good documentation for, or projects that make good use of annotations in Clojure? Most of the pages I've found are from 2009-10.

13:11 erewhon: like 'brew install emacs --cocoa --use-git-head' or something like that

13:11 perezd: erewhon: any books/resources you recommend for learning emacs?

13:12 erewhon: gosh... it's been a while. I thought there was a tutorial built-in.

13:12 perezd: maybe so

13:13 erewhon: there are probably only a handful of key sequences i use continuously. besides moving around, undo (C-x u or C-_), save C-x C-s, open file C-x C-f. but there's a lot there.

13:14 perezd: interesting

13:14 okay

13:14 erewhon: the Emacs starter kit (hi technomancy!) is a nice add on if you're starting from 0 (or starting over).

13:14 emacs wiki is a handy resource

13:14 perezd: gonna just install --HEAD

13:14 that appears to be the only way to get 24

13:15 erewhon: right

13:16 you can use it just as a development editor, but it's easy to get sucked into it and start doing everything in Emacs.

13:16 (since there are packages that do just about anything)

13:16 perezd: erewhon: thats what I hear…I actually don't really know much about emacs whatsoever…thats why I was looking for a book

13:16 I use vim poorly

13:17 but now that I am lisping

13:17 emacs probably makes better sense

13:17 compj: try also emacs-prelude

13:17 erewhon: there's also the Emacs manual. i haven't read that in a long time, but as I recall there was lots of info in there

13:17 perezd: compj: what is that

13:17 compj: second that, read it a few months ago, you can get it at gnu.org

13:18 perezd: it's an alternative to emacs starter kit

13:18 a nice selection of modes and settings

13:18 perezd: oh cool

13:18 thanks all, this is really useful

13:18 * erewhon has been using Emacs for an alarmingly long period of time, so he forgets where some of the good resources are

13:19 perezd: lol

13:19 compj: http://batsov.com/articles/2011/11/30/the-ultimate-collection-of-emacs-resources/

13:19 erewhon: I first used it on a timeshared Unix machine via dialup in 1986....

13:19 perezd: og neckbeard cred

13:19 * erewhon suddenly feels old

13:20 compj: the builtin tutorial is also nice for a quick start imho

13:20 perezd: yeah, I'll start there

13:27 TimMc: perezd: There's also my "Emacs n00b start" <http://www.brainonfire.net/blog/emacs-n00b-start/&gt;, which is a quick walk through some commands you should know *before* your first tutorial.

13:27 perezd: tahnks!

13:54 technomancy: guys... I just committed my first type hints ever

13:55 thought I'd share that with you

13:56 tmciver: Another Red-Letter date in software engineering history...and I was there.

13:56 muhoo: nice. commit?

13:57 technomancy: https://github.com/heroku/pulse/commit/486f9845257d4ae1e

13:57 emezeske: technomancy: next thing you know, you're gonna be committing a protocol (!)

13:57 technomancy: noooooo

13:57 * technomancy finds himself mildly disappointed that you can't enter a SHA into github's search box and have it just work

13:58 TimMc: technomancy: Write an agry, passive aggressive rant on your blog.

13:59 talking about how the github devs hate you.

13:59 technomancy: the "noooooo" was re: protocols, not github fwiw

13:59 TimMc: maybe I could coin the phrase NoGithub

13:59 * muhoo actually really likes github

13:59 technomancy: it'll catch on like wildfire in the NoOps and NoSQL crowd

13:59 TimMc: haha

13:59 NoOps?

14:00 technomancy: ugh; don't get me started

14:00 TimMc: Is that as stupid as it sounds?

14:00 ...yup.

14:01 "whine whine whine, I hate communication"

14:01 muhoo: sounds like a no-op to me :-) http://en.wikipedia.org/wiki/NOP

14:02 TimMc: ~rimshot

14:02 clojurebot: Badum, *tish*

14:03 muhoo: funny, i got into emacs because of lisp. a friend was teaching me scheme years ago, and i got annoyed trying to work in a repl without history and sufficient scrollback, and he said, "you need comint mode and emacs", and from there i was hooked.

14:03 TimMc: technomancy: So, why the type hints? Was reflection slowing something down?

14:03 technomancy: TimMc: yeah, it was in a tight loop

14:04 muhoo: the comit says "Remove reflection warnings " so i guess you were getting some kind of console spew?

14:09 TimMc: muhoo: You can turn that spew on optionally.

14:09 technomancy: ah yes, I suppose that commit message is not terribly accurate

14:09 it was the reflection that I intended to remove, not the warning thereof =)

14:10 jsabeaudry: emezeske, cljsbuild 0.0.10 works with the dependencies without any problem so far

14:10 technomancy: emezeske: hey, have you tried lein 1.7 yet?

14:15 emezeske: jsabeaudry: thanks a bunch!

14:15 technomancy: no, I want to thought, just haven't had time

14:15 s/thought/though

14:16 amalloy: technomancy: fix warnings: "make the code better". remove warnings: "add 2>/dev/null to the makefile"

14:17 technomancy: amalloy: it's my first time using type hints; I plead noobism

14:21 amalloy: technomancy: if you're looking for another reason to be sad about typehints, check out http://dev.clojure.org/jira/browse/CLJ-865

14:21 technomancy: yow

14:21 TimMc: ouch

14:22 I never even thought to transfer metadata.

14:23 amalloy: and you shouldn't have to :P

14:27 muhoo: that's beautiful. i went searching on "noops" and found this http://siliconangle.com/blog/2012/02/01/noops-a-big-lie-or-a-political-shift/ which yeilded this: http://prn.s3.amazonaws.com/doh.jpg

14:28 TimMc: ops!

14:28 ibdknox: lol

14:28 ~rimshot

14:28 clojurebot: Badum, *tish*

14:28 muhoo: (recursive irony since i'm using aws to host that image)

14:29 perezd: hey, so I tried to setup emacs-prelude, but the daemon mode errors with exit code 2 now :(

14:29 not sure how to fix.

14:29 cemerick: amalloy: but without such things, what would book authors talk about :-P

14:30 amalloy: oh whoops, i forgot to copyright my jira comments so cemerick can't steal them

14:31 cemerick: word-for-word

14:49 erewhon: perezd: specify full path for emacs: /usr/local/Cellar/emacs/HEAD/bin/emacs

14:49 perezd: erewhon: yeah, I just reinstalled it

14:49 erewhon: perezd: or don't use daemon mode

14:49 perezd: somehow it fixed it

14:49 erewhon: :)

14:53 Licenser: Raynes it is your fault I have no cake for your birthday!

14:54 perezd: who in here is using emacs-prelude ?

15:02 jsabeaudry: Question about best practices regarding rich webapps. Do you actually serve html or just javascript and the javascript takes care of generating html?

15:03 ibdknox: typically a combination

15:04 mintsoup: though alot of sites seem to be tending to the javascript extreme..

15:05 ibdknox: got that t-shirt

15:05 don't recommend it

15:06 technomancy: depends on your requirements for graceful degredation I guess

15:08 ibdknox: it depends on lots of things unfortunately :( Not the least of which is how complicated your templating is, the levels of dependency between your models, how much you want to poke yourself in the eye...

15:08 tjgillies: after learning more about identity and state it scares me how much mutation of state i have going on in my non clojure apps

15:08 ibdknox: technomancy: btw, I have no idea why, but just setting xmx fixed that issue, memory usage is totally normal now

15:08 technomancy: ibdknox: whew; glad to hear it

15:09 if you're using a client JVM I think it will default to a lower Xmx, which could explain the discrepancy

15:09 got a fix in the pipeline for JAVA_OPTS though, glad we caught that

15:09 ibdknox: yeah

15:10 technomancy: the JVM is famous for using as much memory as it thinks it can get away with

15:11 gf3: hey guys, not sure if one of you runs the blog

15:11 http://www.clojure.net/2012/02/02/Monads-in-Clojure/

15:12 small typo

15:12 (appy concat (map ... )) → "apply"

15:12 brehaut: gf3: that would be jimduey i think

15:12 gf3: ahh, thx

15:12 jimduey ↑

15:12 jimduey: yep. I'll fix. Thanks.

15:13 gf3: jimduey: great article, thank you

15:14 amalloy: (apply concat (map ...)) -> (mapcat ...)

15:14 i've only glanced at the article, so i can't tell if that's off-topic :P

15:16 jimduey: Yeah, I specifically avoided mapcat for pedagogical reasons.

15:17 Going to be (apply union ...) when we look at the set monad.

15:24 triyo: What is the best way to extend an existing class and add a new constructor in clojure now days?

15:37 amalloy: triyo: assuming it's possible, gen-class is what you'll need to use. but personally, if i ever found myself needing to do this, i'd prefer to just do it in java where it's common, natural, and easy

15:38 triyo: True, was thinking about that now to go with java/src option

15:42 Also the class I want to extend is part of a library utilized by other java developers. This would make it easier to share the java source of improvements.

16:31 TimMc: tmciver: I'm going to rename the import-static GitHub project to "imports"

16:35 Licenser: out of curiosity has anyone a dedicated server with a decent network connection to run a httperf for me to test something?

16:35 * Licenser can't get over 30req/s from his local host

16:36 Licenser: httperf --server=82.210.31.101 --uri=/ --num-conns=50 --num-calls=100 is what I am running

16:37 TimMc: I can try from a university machine...

16:38 Licenser: would be great I really have a hard time to figure where the bottleneck is, from the same machine I get about 600 req/s

16:38 TimMc: Nope, can't -- httperf not installed.

16:38 Licenser: which in itself isn't great but it is at least semi expected

16:38 heh thanks non the less tim

16:39 TimMc: Well, let's see what this shitty laptop at home can do.

16:39 Licenser: heh

16:40 I am counter trying clojure.org to see if I get a better result there

16:40 that way at least I can test if it is my machine that is slow

16:40 brehaut: its taking quite a while on my VPS

16:40 Licenser: VPS?

16:41 brehaut: virtual private server

16:41 TimMc: Over 44 seconds, I got 8.5 req/s :-P

16:41 Licenser: ah I see

16:42 not really great

16:42 TimMc: What's the goal, looking for errors?

16:42 Licenser: TimMc trying to find the bottleneck

16:43 so it's hard when I have to choose between A) my laptops HW, B) My internet Connection, C) the internet up to my Server, D) The VM's internal network, E) the VM itself

16:43 so I try to eliminate parts

16:43 TimMc: OK, trying from work...

16:43 Licenser: okay clojure.org gives me 4.5r/s

16:43 so I start to think it is my connection in the first place

16:44 TimMc: 5.6 req/s

16:44 and it's a fast machine with a reasonable connection

16:45 brehaut: Request rate: 5.7 req/s (176.9 ms/req) for me

16:45 TimMc: I guess there's some jitter because multiple people are hammering on it.

16:45 There's no way my craptop on a home connection beats my work machine.

16:45 muhoo: 26003 fu 20 0 21624 1676 1204 R 99.2 0.2 1:17.87 httperf

16:45 Licenser: *nods*

16:46 heh

16:46 muhoo: httperf is a cpu pig

16:46 Licenser: my problem is that httperf on my machine eats 100% CPU and gets 25-30 req/s

16:46 given the serer is 'next door' as in just 20 km from my home

16:46 muhoo: Licenser: yes, you now basically have a DDoS attack on that server

16:46 TimMc: Licenser: Hire a bot net.

16:46 Licenser: :P

16:46 TimMc: Get 4chan mad at your server.

16:46 muhoo: use loic

16:46 devn: ima loadin muh lazerz

16:47 Licenser: heh

16:47 well I will ask a colegue tomorrow I think

16:47 thanks mates :)

16:47 it was at least insightful

16:47 muhoo: Request rate: 5.2 req/s (192.4 ms/req)

16:49 devn: Request rate: 4.6 req/s (219.1 ms/req)

17:12 mrevil: must cascalog always operate on tuples or can I supply a hash?

18:22 arohner: anyone have experience with resque-clojure?

19:31 pandeiro: any way to check for browser features (eg window.localStorage) in cljs?

19:32 TimMc: pandeiro: Besides the usual way?

19:33 What happens if you ask for (. window -localStorage) or whatever the syntax is these days?

19:33 pandeiro: at the repl it blows up

19:35 TimMc: nevermind, this time it didn't... using js/localStorage throws an exception but the (.-localStorage js/window) syntax works

19:41 arohner: what is the 1.3 replacement for c.c.prxml?

19:42 TimMc: Interesting. (def a 5) (do (in-ns 'temp) (def b 10) (in-ns 'user)) works from the REPL -- a is only visible outside the 'do, b is only visible inside.

19:42 But if you turn that 'do into a 'let, you don't escape the original namespace.

19:43 arohner: have I mentioned how much I hate the 1.3 switchover? and the total lack of a migration path?

19:44 TimMc: arohner: Were you here for yesterday's regularly-scheduled argument about the clojure contribution process? :-)

19:45 arohner: TimMc: yes, I was :-)

19:45 but this is an orthogonal issue

19:45 brehaut: arohner: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go says it evaporated

19:45 arohner: brehaut: sigh. thank you

19:45 brehaut: arohner: it may have migrated into the core xml lib

19:46 https://github.com/clojure/data.xml

19:47 TimMc: arohner: It's sort of orthogonal... there might actually be maintainers for more of those if people felt they could contribute.

19:48 arohner: TimMc: absolutely true, but I wish the 1.3 contrib switchover didn't happen at all without a better migration strategy

19:48 TimMc: Definitely.

19:48 arohner: brehaut: thanks. I was hoping for a direct port. I'm upgrading https://github.com/leadtune/clj-airbrake to 1.3

19:48 TimMc: Contri was a bad idea in the first place, though -- and I think that's most of the pain.

19:48 brehaut: arohner: i thought you might. the whole xml space seems to be a quite in-flux area atm

19:49 arohner: would hiccup work?

19:49 TimMc: arohner: Do you need proper namespace support?

19:50 arohner: TimMc: doesn't look like it: https://github.com/leadtune/clj-airbrake/blob/master/src/clj_airbrake/core.clj

19:50 brehaut: arohner: looking at the usage of prxml you might be able ot get away with it

19:50 time for cricket

19:54 TimMc: alexbaranosky: You said that midje haa some utility for sandbox namespaces?

19:56 alexbaranosky: I might end up just using clojail. >_<

20:13 technomancy: sjl: nice app =)

20:14 sjl: technomancy: which one?

20:14 technomancy: typkov

20:14 sjl: technomancy: ah, yeah, that was fun. Thanks1

20:15 technomancy: just saw it on the intertweets

20:15 sjl: technomancy: heh, I recorded all ~3hours of me making it as a screencast here: http://youtu.be/uTwnoZEw7FE -- It's a fun usability study of Clojure/Noir/Vim/etc

20:16 technomancy: three hours; wow

20:16 TimMc: Wow. I can't concentrate for more than

20:16 sjl: yeah, I pretty much started screenflow and just went until I finished

20:20 TimMc: Did that include doc and tests?

20:20 sjl: nah, and I still had to clean up a few things afterword too

20:22 technomancy: what worked well for me doing the peepcode was to break it up into chapters corresponding to git branches

20:22 course I had it all scripted out ahead of time

20:22 but it makes it nice for folks following along at home

20:23 sjl: yeah, this was more of a "well I'm making it anyway, may as well record it"

20:29 TimMc: In a line, what is it?

20:30 sjl: TimMc: the app? It lets you paste in text you've written and created random typing lessons for you based on that text

20:38 TimMc: Ha, cool.

20:45 dgrnbrg: Suppose I want to have a public macro that, when expanded, calls some function private to the macro's namespace (something impl-specific). When I do this with defn-, it complains about the visibility. Is there another way?

20:48 TimMc: Yeah, someone I know was complaining about that.

20:49 technomancy: need to either go through a var or mark it an ^:internal instead of private

20:49 TimMc: Maybe if you make the defn public and just hint it with :^internal?>

20:49 bah

20:50 dgrnbrg: what does ^:internal do?

20:50 technomancy, is it recognized by the compiler?

20:50 or runtime?

20:51 TimMc: dgrnbrg: It's just for your audience.

20:51 technomancy: dgrnbrg: recognized by human readers =)

20:51 dgrnbrg: I see

20:51 Is there any library for executing a dependency graph of functions?

20:51 technomancy: honestly :private is entirely about communicating intent too

20:51 it just has the compiler help it out a little extra

20:52 dgrnbrg: yeah

20:52 well, i'll go with the public soln for now

20:52 I have an input that needs to get processed through a little graph

20:52 I could just have the functions call each other in turn

20:53 but I was wondering if there's a bit more elegant way, perhaps by specifying their deps in a standard way?

20:54 technomancy: monads!

20:57 or ->

20:57 TimMc: dgrnbrg: But you want to do it efficiently, yeah?

21:01 I wrote a cascading mutater at some point that worked from a DAG of nodes that knew how to update when their dependency nodes were updated.

21:02 but you probably want something functional, yeah?

21:02 (ugh, I hate how repetitive my writing is)

21:07 dgrnbrg: TimMc, I'm not terribly concerned about functionality

21:07 technomancy, I think I'd like more flexibility, in case I parallelize it later

21:07 Is there a zipper for maps?

21:09 TimMc: dgrnbrg: Check ou thte cascade.clj file in my HW3 prohjec ton github

21:11 dgrnbrg: TimMc, that's quite good

21:12 Is there some kind of functional data structure like a zipper but for a map?

21:13 TimMc: dgrnbrg: It's a bit weird, should maybe be rewritten inside out.

21:14 dgrnbrg: what do you mean inside out?

21:18 TimMc: Well, since it mutates stuff, the client code really shouldn't responsible for storing the returned object back into a ref or whatever.

21:18 and someone suggested having it watch atoms instead of calling dirty! on it.

21:27 dgrnbrg: So, is this a DAG of processing functions where an input goes in and you get a bunch of outputs out?

21:38 dgrnbrg: TimMc, it's almost more of a sequence of validity checks

21:38 and the data must get verified

21:38 and some passes won't make sense until a previous pass has ran

21:38 and other passes rewrite the data

21:39 and there's a path it should take to get an answer or an error

21:45 TimMc: dgrnbrg: You want to shortcut on errors?

21:45 Or collect all the errors?

21:55 dgrnbrg: TimMc, collect them all

21:55 (man, I don't have notifications set up properly

21:56 very hard to chat in a timely manner)

22:04 TimMc: dgrnbrg: Let's see, you do a topo sort of the graph, and start with the first (input) layer, then work your way layer by layer to the end. For each node in a layer, if its dependencies are all valid, run the validator/transformer and collect the result or error. At the end, you have zero or more errors accumulated from the layers, and maybe a value for the output.

22:05 dgrnbrg: I bet you could do something clever with promise/deliver or futures, too.

22:05 (if you only wanted the end result)

22:12 tmciver: TimMc: have you been doing any work on imports?

22:13 TimMc: I'd like to try tackling something you're not doing.

22:14 TimMc: tmciver: Just the testing. It's not going well. :-P

22:15 tmciver: So go for it. Oh, what do you think of syntax like (import+ (java.awt Color (geom :rename {Point2D$Double P2D}))) ?

22:15 tmciver: TimMc: Ahh! When you said "import plus" I imagined import-plus

22:15 TimMc: Nesting packages, renaming without having to list the class redundantly in both the imports and renaming.

22:16 tmciver: Is it more idiomatic to use a vector? (import+ (java.awt Color (geom :rename {Point2D$Double P2D})))

22:16 wait

22:16 Is it more idiomatic to use a vector? (import+ (java.awt Color [geom :rename {Point2D$Double P2D}]))

22:17 TimMc: Probably.

22:17 * tmciver looks at refer example...again

22:17 TimMc: clojure.core/import doesn't, though

22:17 It's a little inconsistent.

22:18 We don't actually have to choose, just check for a sequential? and allow either.

22:18 tmciver: Ugh. Let the confusion begin (coninue?)

22:18 TimMc: That cuts off some future syntactic additions, but I'm not too worried.

22:19 tmciver: s/coninue/continue

22:19 TimMc: tmciver: It would have confusion-parity with 'require and 'use, yes.

22:19 tmciver: Oh, well since you put it that way...

22:20 So you're going to be tackling the renaming? I could make an attempt at importing static methods as functions.

22:21 TimMc: Renaming is totally something that can be folded in afterwards.

22:21 tmciver: Sure

22:22 arohner: with midje, how do you stub a function to throw an exception?

22:22 TimMc: tmciver: Making functions is a good first step, but I think the killer feature would be hinting. Not sure how that would work *precisely*, but it would rock.

22:23 * tmciver is not familiar with hinting

22:24 tmciver: TimMc: so, what would the hinting do here?

22:26 TimMc: Well, you'd effectively want (defn ^double sqrt [^double x] (Math/sqrt x))

22:26 tmciver: TimMc: OK, that's good.

22:26 TimMc: I guess the macro to produce that would use with-meta on the forms it produces.

22:27 It'll take some fancy footwork to extract the type information from reflection and munge it into a form Clojure likes, but again, that's down the road.

22:27 arohner: alexbaranosky: is it possible to make a midje fake that throws when called?

22:28 tmciver: TimMc: BTW, I fixed my warped keyboard tonight :D

22:28 TimMc: Haha, good! Was there a hamster or something under there?

22:29 tmciver: TimMc: I had improperly replaced a bracket causing it to stick up.

22:29 TimMc: Nothing a hammer couldn't fix.

22:35 alexbaranosky: arohner, it looks like the answer is no. But you really should be able to... imho. It might be fairly straightforward to add a syntax like this: (provided (foo) =throws=> (Exception. "boom"))

22:37 arohner: alexbaranosky: thanks. One more question while I'm at it: is there a way to avoid specifying how many arguments a function is called with?

22:37 I don't want to do (provided (foo anything anything anything anything anything)), I want (provided (foo any-number-of-arguments))

22:38 alexbaranosky: arohner: no sugar for that (yet)... add your approval to the issue (https://github.com/marick/Midje/issues/56)

22:39 so far I've been the only one to care about this idea, so it hasn't gotten done

22:39 arohner, I'm going to look at =throws=> right now

22:40 arohner: alexbaranosky: thanks

22:49 devn: heya alexbaranosky

22:54 Raynes: devn: I don't know if you're aware of this, but I recently became an old man. ;)

22:54 clojurebot: Huh?

22:54 devn: Raynes: You got married?!

22:55 Raynes: No, but that's certainly an interesting conclusion.

22:55 devn: Raynes: I don't mean that to sound incredulous: of course you got married.

22:55 Raynes: I turned 18.

22:55 devn: Bahahahahaha

22:55 Raynes: I figured that was clearer than it actually was. :p

22:55 devn: Damnit Anthony.

22:56 an "old man"

22:56 versus being 18

22:56 one of them is more likely for someone of my ripe old age

22:56 tmciver: Raynes: congrats. Too bad you have to wait a few more years to legally drink a beer.

22:56 Guest33786: not in New Zealand!

22:56 err

22:56 Raynes: Heh

22:56 devn: not in 1960 in the US!

22:56 ivan___: so need to sort out my nick

22:56 devn: ivan___: haskell?

22:57 ivan___: haskell?

22:57 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>

22:57 devn: ivan___: i just know an old nick from #haskell which was ivan

22:57 is that you?

22:57 ivan___: nah ive never been on that

22:57 devn: k, nvm

22:58 ivan___: they are changing the law here to 20 if you want to buy from a bottle shop, but bars and stuff will still be 18

22:58 it got changed to 18 6months before i turned 18 :)

22:58 tmciver: ivan___: that's they way it should be.

22:58 * tmciver considers moving to NZ

22:59 devn: Kim Dotcom ruined it for everyone, eh ivan___?

22:59 ;)

22:59 ivan___: you can drink in bars at any age if you have your guardian with you anyway.. so 18 should be the age which you can drink in bars

23:00 devn: heh, yeah especially because we have 3 strikes laws for torrents

23:00 tmciver: ivan___: torrents?

23:01 ivan___: tmciver: if we get 3 dmca notices for using bittorrent over 3 months we can be disconnected and/or fined $10k

23:01 tmciver: ivan___: whoa!

23:02 ivan___: although it costs the companies $25 to issue those notices so they havent been spamming them

23:02 devn: tmciver: just move that traffic through malaysia and no problem! :)

23:03 tmciver: cheaper and easier just to buy your movies/music.

23:03 devn: debatable

23:03 also defeatist

23:04 also, demerol

23:05 alexbaranosky: arohner, looks like I coded up =throws=>... that was ease, nice!

23:05 * tmciver has never been a fan of pirating movies/music/software.

23:05 alexbaranosky: Just need to give it some error checking, and test the error checking

23:05 * TimMc is

23:05 TimMc: I like to listen before I buy.

23:05 alexbaranosky: arohner, and... ya know, deploy iy

23:06 tmciver: TimMc: get a radio! :)

23:06 TimMc: tmciver: They don't play what I like!

23:06 alexbaranosky: TimMc, thief!

23:06 ;)

23:06 tmciver: ~guards

23:06 clojurebot: SEIZE HIM!

23:06 TimMc: I like it when bands do this: http://www.gaiaconsort.com/lyrics.html

23:07 (Basically, you can download all their music for free.) I've donated like $50 to that group, *after* listening to their stuff.

23:08 ivan___: tmciver: yeah i dont pirate generally, i used to when i was a student but then i stopped

23:08 TimMc: And this is a fantastic idea for ebooks: http://fictioncircus.com/news.php?id=407&mode=one

23:08 tmciver: Well, that's awfully nice of them. But you don't pay for a sandwich after you've eaten it. Not sure why you'd expect that from other industries.

23:08 ivan___: so really the 3strikes laws dont effect me

23:09 TimMc: tmciver: IP vs. tangible property. They're different.

23:10 tmciver: As long as artists/authors get paid for their work (on their terms) I'm happy.

23:10 TimMc: Me too.

23:10 The question is whether any of the existing models are sustainable.

23:10 ivan___: tmciver: that being said, im sure piracy would go down here if we had legal alternatives :) - but that arguement still doesnt make it right, legally or morally

23:11 devn: test.generative is great, but it's just quickcheck, no?

23:11 tmciver: I don't have a problem with artists giving away their stuff; just as I don't with artists who wish to charge for it.

23:11 devn: whoops, nvm

23:11 TimMc: *just* quickcheck, he says...

23:11 ivan___: TimMc: it doesnt matter if its not sustainable in the long run. If people STOPPED buying media, those companies would die out

23:11 devn: TimMc: haha, I was not trying to downplay how cool it was

23:12 ivan___: and new ones would take there place

23:12 that had a different distro model

23:12 alexbaranosky: devn, from my understanding QuickCheck is much more fully-featured than test.generative

23:12 TimMc: ivan___: I'm referring to the distro model of groups like Gaia Consort, too.

23:12 Maybe people wouldn't donate enough.

23:12 clojurebot: Gabh mo leithscéal?

23:12 devn: alexbaranosky: specifics?

23:12 tmciver: I don't think a system that relies on donations is sustainable.

23:13 ivan___: TimMc: oh i see, it might be sustainable for one group, but if others start doing it..

23:13 TimMc: Right, the novelty wears off.

23:13 _carlos_: hi!

23:14 TimMc: Anyway, off to bed. tmciver, I expect to see a fully hinted renaming import+ by the morning. :-P

23:14 arohner: alexbaranosky: awesome, thanks

23:14 tmciver: TimMc: OK (he didn't say *which* morning ;) )

23:15 TimMc: see you in the morning.

23:15 _carlos_: if this is a defmacro, why doesn't this expression need the "list" form? -> http://pastebin.com/3u4TCpPz

23:16 (defmacro randomly-2 [& exprs] (nth exprs (rand-int (count exprs))))

23:16 I just noticed it was small enough ^^

23:17 I just wonder.. when using "list", this macro definition stops working.. why suddenly such an exception?

23:19 tmciver: _carlos_: where did this come from? It doesn't appear to do the right thing for me.

23:19 _carlos_: (defmacro randomly-2 [& exprs] (list 'nth exprs (list 'rand-int (list 'count exprs)))) <- this doen't work properly

23:19 tmciver: just a second

23:19 tmciver: oh sorry, I will give you an example

23:19 tmciver: _carlos_: If I call it, it just returns what I gave it...

23:20 _carlos_: Oops, I was wrong; it does work

23:20 _carlos_: tmciver: (randomly-2 (println "spam") (println "foo") (println "bar"))

23:20 oh

23:21 alexbaranosky: devn, as far as I know test.generative doesnt have shrinking

23:21 devn: alexbaranosky: what is that?

23:21 alexbaranosky: devn, shrinking is where it attempts to reduce the failure case into the smallest possible case

23:21 tmciver: _carlos_: I'm not sure why it's a macro; it appears to do it's own body: (nth exprs (rand-int (count exprs)))

23:21 _carlos_: tmciver: anyway, do you find it natural to not require "list"?

23:21 alexbaranosky: and in QuickCheck the shrinking correlates to the particular generator used

23:22 I could be wrong, and test.generative does implement that....

23:22 tmciver: _carlos_: I think it's a bad macro example. You'd just write that as a function.

23:23 _carlos_: tmciver: it is a macro, because if you want to print inside the body, using a function will eval print when binding at the call, which is unintended

23:23 tmciver: println expression is just an example

23:25 tmciver: was my explanation clear?

23:26 tmciver: it doesn't print all the body, just one randomly selected, in the example of a print expression

23:27 tmciver: _carlos_: Hmm, interesting. Yes. I'm still learning macros myself. I'm not sure why the three println's above don't evaluate before being passed to the macro.

23:29 _carlos_: tmciver: if you (doc xxx) each of the functions inside, it will become clear. actually my doubt is not about the logic. usually macro expressions begin with (list ... in every expression, but this one doesn't need one. I fail to untderstand this

23:30 muhoo: i cannot get myself motivated to do anything except read clojure books and docs and such

23:30 _carlos_: tmciver: oh, I understand your question. because expressions are not evaled when entering a macro. they replace! I think that is one of the main advantages!

23:31 tmciver: _carlos_: Yes. This macro does not return s-expressions to be eval'd; the body is eval'd right away. I think the only reason it's a macro is to stop the evaluation of the args.

23:32 _carlos_: since it's not return sexp's to be eval'd, it does not need any quoting.

23:34 _carlos_: tmciver: I suspected that, but I cannot abstract it. arrrgh I want to kill my brain. 5 minutes. I need to think about it

23:35 tmciver: _carlos_: Ha! Don't do that.

23:35 _carlos_: tmciver: thinking about the problem, not killing the brain

23:45 muhoo: braaaaaaiiiiin!

23:50 _phil: is there a way to see if the outer function of some closure is still in progress when the closure gets called?

23:51 (except wrapping it with (reset! progress true) ... (reset! progress false))

Logging service provided by n01se.net