#clojure logs

2012-02-02

00:00arohnercmajor7, Tcepsa: there's no performance difference between defn/recur and loop/recur
00:00kilborndnolen: 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
00:00kilbornGuess not
00:01dnolenkilborn: if you're doing something stateful, use the stateful facilities. they're pretty simple :)
00:02cmajor7Tcepsa, 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"?
00:03Tcepsakilborn: That makes sense. In this case, though, yeah, I'd say it seems like a namespace-level atom would be a good fit.
00:03dnolenkilborn: you could probably do something fancy with reify + atom, then you don't have mutate at the REPL directly
00:04dnolenyou'd get back a type that you can call fns on that do the work
00:04nuclearsandwich?
00:04nuclearsandwichwhoops. Mouse fumble.
00:05dnolenkilborn: but even then I'm not sure what that buys you over interacting on the atom via top level fns in your namespace.
00:05Tcepsacmajor7: In my opinion, no.
00:05arohnercmajor7: right. loop is solely for the times when you want to recur, but not go to the top of the fn
00:06cmajor7arohner, Tcepsa: great, thanks guys
00:06arohnerand btw, loop is exactly identical to 'let', except it's also a recursion point
00:06Tcepsacmajor7: My pleasure! ^_^
00:07Tcepsa(and I learned some new things too!)
00:08kilborndnolen: 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.
00:08kilbornTcepsa,Dnolen: thanks for your help
00:08dnolenkilborn: 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 :)
00:08Tcepsakilborn: You're welcome--good luck with Overtone; it's a really nifty project ^_^
00:09kilborndnolen: If you know live-coding, solving problem with overly complicated yas snippets is a form of cheating... :)
00:10dnolenkilborn: I bet! I'm sure samaaron will have some good pointers.
00:11kilborndnolen: yeah, mailing list is the next stop
00:21kilbornis there a special let form for doing ycombinator-like things such as (let f #( (after 1000 f)))?
00:23dnolenkilborn: letfn will let you do that I'm pretty sure.
00:34kilborndnolen: yep, tks.
01:02dnolenI'm sure someone could chime in about Lein work flow on this post http://oblong-code.blogspot.com/2012/02/unpretty.html
01:06G0SUBdnolen, checkout dependencies?
01:13dnolenG0SUB: that's what I thought I just never use that myself so not sure about the details.
01:17G0SUBdnolen, I have used it. Works as advertised.
03:01tsdhIs 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?
03:49Blktgood morning everyone
03:50ordnungswidriggood morning
03:50Blkt:D
04:04tsdhgood morning
04:56G0SUBthis channel needs 1000 more users to be elite :-)
04:58ordnungswidrigG0SUB: the other way round: it's no longer elite if it has over 1000 users.
04:58G0SUBordnungswidrig, ;-)
08:34BorkdudeIs 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?
08:34BorkdudeI'm always a bit confused about Symbols and vars
08:34solussdanyone 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.
08:34solussdsymbols name things
08:34ordnungswidrigsolussd: rpc?
08:35solussdI've been looking at aleph, but not sure how to talk to it from the ruby side
08:36samaaronBorkdude: that's how I see things
08:43the-kennysolussd: Do you need bidirectional communication?
08:44solussdthe-kenny, just request/response, so no.
08:44solussdthe clojure code doesn't need to call into the rails app
08:45the-kennyI'd use a simple REST interface with compojure then
08:45the-kennyaleph is nice too, but it's more useful for streaming of data
08:46solussdk
08:46solussdthanks
10:54semperosusing 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:55semperospossible reasons?
11:05compjsemperos: does it work when you dont compile? C-c C-l ?
11:06semperosevery time I do record/protocol work, I tend to mess up the syntax a bit, probably the case here
11:06semperoshere's a gist of what I'm doing: https://gist.github.com/1724259
11:07semperosdoesn't make a difference
11:08semperoson first compile/load, works fine; on second, claims I haven't provided an implementation for my function
11:10compjok, then my idea is wrong
11:12compjmaybe a last try, delete all aot compiled files and do the C-c C-l again
11:12compjin a new repl
11:12semperosyeah, I've tried that
11:12semperosthanks, though
11:12pjstadigsemperos: can you post the imports too
11:13semperossure, I'll include the ns decl
11:13pjstadigit 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:13pjstadigmaybe a type hint would help?
11:13semperosah
11:13pjstadigi'm not sure
11:13semperosinterestin'
11:13semperosdidn't know you could do type hints on protocol fn's...
11:14compjquestion is, why does it work the first time
11:14pjstadigalthough it is complaining that there's no impl for the RemoteServer defrecord
11:14pjstadignot the Server class
11:15semperospjstadig: https://gist.github.com/1724259
11:15semperosns included
11:15semperosrenaming fn's is No Big Deal, I'll try that
11:16pjstadigi guess having the ns is a start, but now I'd have to track down all the deps to try the code myself :/
11:16semperos:)
11:16semperosit's the library I maintain, clj-webdriver
11:16semperosbut no need to do all that work
11:16pjstadigjust give me all your code :) i promise i'll be good
11:16pjstadigah
11:16semperosthis code isn't committed in the state it's in, initial dev
11:17semperosdon't worry about going to those lengths, was just looking for a sanity check
11:17compjtried doing loading manually? (use :reload ...)?
11:18semperoswell, I'm actually *in* the namespace
11:18semperosI'm not using it
11:18semperosthough I could try from a different ns and do that...
11:18compjjust to eliminate a possible swank bug i think
11:19semperossure
11:19semperosI just upgraded to 1.4 the other night
11:23semperostried going back to swank-clojure 1.3.4, same issue...
11:24compjbut from a different ns works?
11:25semperoscompj: no, doesn't work regardless
11:25semperosonly on second compile
11:33semperosso it looks to be a bug with the version of slime that is pulled down by swank-clojure
11:33semperosrolling back to 1.3.4 and making sure the correct slime checkout was loaded solved the issue
11:38semperoshmm, perhaps I was wrong
11:38semperosin my slime session, I instantiate a RemoteServer and then do (start) on it
11:39semperosworks the first time
11:39semperosdo a recompile with C-c C-k, hop back to slime and run start again, I get the failure describe
11:39semperos*described
11:39semperoshowever, if I re-instantiate a RemoteServer record and do start again, it works fine
11:40semperosor rather, doesn't work, just says "Evaluation aborted."
11:41hugodevery time you compile a record or protocol, it generates a new type, so any existing objects no longer implement the protocol
11:41semperoshugod: makes sense
11:41semperosbut why, when I instantiate a new instance of the record, do I just get "Evalution aborted." instead of a successful run?
11:42semperoswhereas it works perfectly on the first compile and run
11:42hugoddoes *e give you anything?
11:42semperosheh
11:42semperosyes...
11:43semperoshugod: thank you, that tells me exactly why it fails
11:43semperosthough I wonder why the exception doesn't pop open an sdb buffer
11:43compjwhat was the problem?
11:44semperosmy lack of understanding about how recompilation affected records and protocols
11:44semperosI 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:45semperosand 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:05mrevilis 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:08lucianmrevil: why lock it?
12:12jkdufairwhen 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:12zakwilson_Yes
12:12jkdufairok, thx
12:12lnostdalhi guys, figured i'd to some upgrades .. but after doing lein install in the swank-clojure checkout here and symlinking ~/.lein/plugins/
12:13lnostdal~/.lein/plugins/swank-clojure-1.5.0-SNAPSHOT.jar to the file in .m2 lein swank still says it's missing
12:13clojurebotTitim gan éirí ort.
12:13lnostdal"That's not a task."
12:15zakwilsonCompiling a local file doesn't work properly on a remote server though, jkdufair; use slime-eval-buffer instead.
12:15lnostdali guess lein does some "magic" with its lein plugin install thingy ...
12:17jkdufairzakwilson: thank you! i'm struggling to understand this. that helps immensely
12:19zakwilsonjkdufair: 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:20jkdufairyes
12:20jkdufairperfect
12:20jkdufairthanks a bunch
12:43technomancylnostdal: a symlink won't work anyway because the plugin is an uberjar
12:43technomancythe symlink won't get you clj-stacktrace, cdt, and friends
12:48lnostdaltechnomancy, ah, thanks .. uberjar worked .. had to rename it slightly tho
12:49lnostdaluhm, i think
12:50lnostdalnvm
12:56technomancylnostdal: 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:58lnostdalhow?
12:58clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>
13:02technomancylein plugin install swank-clojure 1.4.0
13:03lnostdalok
13:07perezdmac users: what emacs do you use? (anything special? noob here)
13:09erewhon24.0.91 via homebrew
13:09perezdbrew wants to install 23
13:09perezdis that okay still?
13:11erewhonI 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:11perezdk thanks, I'll check it out
13:11duck1123Is 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:11erewhonlike 'brew install emacs --cocoa --use-git-head' or something like that
13:11perezderewhon: any books/resources you recommend for learning emacs?
13:12erewhongosh... it's been a while. I thought there was a tutorial built-in.
13:12perezdmaybe so
13:13erewhonthere 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:14perezdinteresting
13:14perezdokay
13:14erewhonthe Emacs starter kit (hi technomancy!) is a nice add on if you're starting from 0 (or starting over).
13:14erewhonemacs wiki is a handy resource
13:14perezdgonna just install --HEAD
13:14perezdthat appears to be the only way to get 24
13:15erewhonright
13:16erewhonyou can use it just as a development editor, but it's easy to get sucked into it and start doing everything in Emacs.
13:16erewhon(since there are packages that do just about anything)
13:16perezderewhon: thats what I hear…I actually don't really know much about emacs whatsoever…thats why I was looking for a book
13:16perezdI use vim poorly
13:17perezdbut now that I am lisping
13:17perezdemacs probably makes better sense
13:17compjtry also emacs-prelude
13:17erewhonthere'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:17perezdcompj: what is that
13:17compjsecond that, read it a few months ago, you can get it at gnu.org
13:18compjperezd: it's an alternative to emacs starter kit
13:18compja nice selection of modes and settings
13:18perezdoh cool
13:18perezdthanks all, this is really useful
13:19perezdlol
13:19compjhttp://batsov.com/articles/2011/11/30/the-ultimate-collection-of-emacs-resources/
13:19erewhonI first used it on a timeshared Unix machine via dialup in 1986....
13:19perezdog neckbeard cred
13:20compjthe builtin tutorial is also nice for a quick start imho
13:20perezdyeah, I'll start there
13:27TimMcperezd: 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:27perezdtahnks!
13:54technomancyguys... I just committed my first type hints ever
13:55technomancythought I'd share that with you
13:56tmciverAnother Red-Letter date in software engineering history...and I was there.
13:56muhoonice. commit?
13:57technomancyhttps://github.com/heroku/pulse/commit/486f9845257d4ae1e
13:57emezesketechnomancy: next thing you know, you're gonna be committing a protocol (!)
13:57technomancynoooooo
13:58TimMctechnomancy: Write an agry, passive aggressive rant on your blog.
13:59TimMctalking about how the github devs hate you.
13:59technomancythe "noooooo" was re: protocols, not github fwiw
13:59technomancyTimMc: maybe I could coin the phrase NoGithub
13:59technomancyit'll catch on like wildfire in the NoOps and NoSQL crowd
13:59TimMchaha
13:59TimMcNoOps?
14:00technomancyugh; don't get me started
14:00TimMcIs that as stupid as it sounds?
14:00TimMc...yup.
14:01TimMc"whine whine whine, I hate communication"
14:01muhoosounds like a no-op to me :-) http://en.wikipedia.org/wiki/NOP
14:02TimMc~rimshot
14:02clojurebotBadum, *tish*
14:03muhoofunny, 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:03TimMctechnomancy: So, why the type hints? Was reflection slowing something down?
14:03technomancyTimMc: yeah, it was in a tight loop
14:04muhoothe comit says "Remove reflection warnings " so i guess you were getting some kind of console spew?
14:09TimMcmuhoo: You can turn that spew on optionally.
14:09technomancyah yes, I suppose that commit message is not terribly accurate
14:09technomancyit was the reflection that I intended to remove, not the warning thereof =)
14:10jsabeaudryemezeske, cljsbuild 0.0.10 works with the dependencies without any problem so far
14:10technomancyemezeske: hey, have you tried lein 1.7 yet?
14:15emezeskejsabeaudry: thanks a bunch!
14:15emezesketechnomancy: no, I want to thought, just haven't had time
14:15emezeskes/thought/though
14:16amalloytechnomancy: fix warnings: "make the code better". remove warnings: "add 2>/dev/null to the makefile"
14:17technomancyamalloy: it's my first time using type hints; I plead noobism
14:21amalloytechnomancy: if you're looking for another reason to be sad about typehints, check out http://dev.clojure.org/jira/browse/CLJ-865
14:21technomancyyow
14:21TimMcouch
14:22TimMcI never even thought to transfer metadata.
14:23amalloyand you shouldn't have to :P
14:27muhoothat'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:28TimMcops!
14:28ibdknoxlol
14:28ibdknox~rimshot
14:28clojurebotBadum, *tish*
14:28muhoo(recursive irony since i'm using aws to host that image)
14:29perezdhey, so I tried to setup emacs-prelude, but the daemon mode errors with exit code 2 now :(
14:29perezdnot sure how to fix.
14:29cemerickamalloy: but without such things, what would book authors talk about :-P
14:30amalloyoh whoops, i forgot to copyright my jira comments so cemerick can't steal them
14:31cemerickword-for-word
14:49erewhonperezd: specify full path for emacs: /usr/local/Cellar/emacs/HEAD/bin/emacs
14:49perezderewhon: yeah, I just reinstalled it
14:49erewhonperezd: or don't use daemon mode
14:49perezdsomehow it fixed it
14:49erewhon:)
14:53LicenserRaynes it is your fault I have no cake for your birthday!
14:54perezdwho in here is using emacs-prelude ?
15:02jsabeaudryQuestion about best practices regarding rich webapps. Do you actually serve html or just javascript and the javascript takes care of generating html?
15:03ibdknoxtypically a combination
15:04mintsoupthough alot of sites seem to be tending to the javascript extreme..
15:05ibdknoxgot that t-shirt
15:05ibdknoxdon't recommend it
15:06technomancydepends on your requirements for graceful degredation I guess
15:08ibdknoxit 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:08tjgilliesafter learning more about identity and state it scares me how much mutation of state i have going on in my non clojure apps
15:08ibdknoxtechnomancy: btw, I have no idea why, but just setting xmx fixed that issue, memory usage is totally normal now
15:08technomancyibdknox: whew; glad to hear it
15:09technomancyif you're using a client JVM I think it will default to a lower Xmx, which could explain the discrepancy
15:09technomancygot a fix in the pipeline for JAVA_OPTS though, glad we caught that
15:09ibdknoxyeah
15:10technomancythe JVM is famous for using as much memory as it thinks it can get away with
15:11gf3hey guys, not sure if one of you runs the blog
15:11gf3http://www.clojure.net/2012/02/02/Monads-in-Clojure/
15:12gf3small typo
15:12gf3(appy concat (map ... )) → "apply"
15:12brehautgf3: that would be jimduey i think
15:12gf3ahh, thx
15:12gf3jimduey ↑
15:12jimdueyyep. I'll fix. Thanks.
15:13gf3jimduey: great article, thank you
15:14amalloy(apply concat (map ...)) -> (mapcat ...)
15:14amalloyi've only glanced at the article, so i can't tell if that's off-topic :P
15:16jimdueyYeah, I specifically avoided mapcat for pedagogical reasons.
15:17jimdueyGoing to be (apply union ...) when we look at the set monad.
15:24triyoWhat is the best way to extend an existing class and add a new constructor in clojure now days?
15:37amalloytriyo: 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:38triyoTrue, was thinking about that now to go with java/src option
15:42triyoAlso 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:31TimMctmciver: I'm going to rename the import-static GitHub project to "imports"
16:35Licenserout of curiosity has anyone a dedicated server with a decent network connection to run a httperf for me to test something?
16:36Licenserhttperf --server=82.210.31.101 --uri=/ --num-conns=50 --num-calls=100 is what I am running
16:37TimMcI can try from a university machine...
16:38Licenserwould 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:38TimMcNope, can't -- httperf not installed.
16:38Licenserwhich in itself isn't great but it is at least semi expected
16:38Licenserheh thanks non the less tim
16:39TimMcWell, let's see what this shitty laptop at home can do.
16:39Licenserheh
16:40LicenserI am counter trying clojure.org to see if I get a better result there
16:40Licenserthat way at least I can test if it is my machine that is slow
16:40brehautits taking quite a while on my VPS
16:40LicenserVPS?
16:41brehautvirtual private server
16:41TimMcOver 44 seconds, I got 8.5 req/s :-P
16:41Licenserah I see
16:42Licensernot really great
16:42TimMcWhat's the goal, looking for errors?
16:42LicenserTimMc trying to find the bottleneck
16:43Licenserso 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:43Licenserso I try to eliminate parts
16:43TimMcOK, trying from work...
16:43Licenserokay clojure.org gives me 4.5r/s
16:43Licenserso I start to think it is my connection in the first place
16:44TimMc5.6 req/s
16:44TimMcand it's a fast machine with a reasonable connection
16:45brehautRequest rate: 5.7 req/s (176.9 ms/req) for me
16:45TimMcI guess there's some jitter because multiple people are hammering on it.
16:45TimMcThere's no way my craptop on a home connection beats my work machine.
16:45muhoo26003 fu 20 0 21624 1676 1204 R 99.2 0.2 1:17.87 httperf
16:45Licenser*nods*
16:46Licenserheh
16:46muhoohttperf is a cpu pig
16:46Licensermy problem is that httperf on my machine eats 100% CPU and gets 25-30 req/s
16:46Licensergiven the serer is 'next door' as in just 20 km from my home
16:46muhooLicenser: yes, you now basically have a DDoS attack on that server
16:46TimMcLicenser: Hire a bot net.
16:46Licenser:P
16:46TimMcGet 4chan mad at your server.
16:46muhoouse loic
16:46devnima loadin muh lazerz
16:47Licenserheh
16:47Licenserwell I will ask a colegue tomorrow I think
16:47Licenserthanks mates :)
16:47Licenserit was at least insightful
16:47muhooRequest rate: 5.2 req/s (192.4 ms/req)
16:49devnRequest rate: 4.6 req/s (219.1 ms/req)
17:12mrevilmust cascalog always operate on tuples or can I supply a hash?
18:22arohneranyone have experience with resque-clojure?
19:31pandeiroany way to check for browser features (eg window.localStorage) in cljs?
19:32TimMcpandeiro: Besides the usual way?
19:33TimMcWhat happens if you ask for (. window -localStorage) or whatever the syntax is these days?
19:33pandeiroat the repl it blows up
19:35pandeiroTimMc: nevermind, this time it didn't... using js/localStorage throws an exception but the (.-localStorage js/window) syntax works
19:41arohnerwhat is the 1.3 replacement for c.c.prxml?
19:42TimMcInteresting. (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:42TimMcBut if you turn that 'do into a 'let, you don't escape the original namespace.
19:43arohnerhave I mentioned how much I hate the 1.3 switchover? and the total lack of a migration path?
19:44TimMcarohner: Were you here for yesterday's regularly-scheduled argument about the clojure contribution process? :-)
19:45arohnerTimMc: yes, I was :-)
19:45arohnerbut this is an orthogonal issue
19:45brehautarohner: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go says it evaporated
19:45arohnerbrehaut: sigh. thank you
19:45brehautarohner: it may have migrated into the core xml lib
19:46brehauthttps://github.com/clojure/data.xml
19:47TimMcarohner: It's sort of orthogonal... there might actually be maintainers for more of those if people felt they could contribute.
19:48arohnerTimMc: absolutely true, but I wish the 1.3 contrib switchover didn't happen at all without a better migration strategy
19:48TimMcDefinitely.
19:48arohnerbrehaut: thanks. I was hoping for a direct port. I'm upgrading https://github.com/leadtune/clj-airbrake to 1.3
19:48TimMcContri was a bad idea in the first place, though -- and I think that's most of the pain.
19:48brehautarohner: i thought you might. the whole xml space seems to be a quite in-flux area atm
19:49brehautarohner: would hiccup work?
19:49TimMcarohner: Do you need proper namespace support?
19:50arohnerTimMc: doesn't look like it: https://github.com/leadtune/clj-airbrake/blob/master/src/clj_airbrake/core.clj
19:50brehautarohner: looking at the usage of prxml you might be able ot get away with it
19:50brehauttime for cricket
19:54TimMcalexbaranosky: You said that midje haa some utility for sandbox namespaces?
19:56TimMcalexbaranosky: I might end up just using clojail. >_<
20:13technomancysjl: nice app =)
20:14sjltechnomancy: which one?
20:14technomancytypkov
20:14sjltechnomancy: ah, yeah, that was fun. Thanks1
20:15technomancyjust saw it on the intertweets
20:15sjltechnomancy: 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:16technomancythree hours; wow
20:16TimMcWow. I can't concentrate for more than
20:16sjlyeah, I pretty much started screenflow and just went until I finished
20:20TimMcDid that include doc and tests?
20:20sjlnah, and I still had to clean up a few things afterword too
20:22technomancywhat worked well for me doing the peepcode was to break it up into chapters corresponding to git branches
20:22technomancycourse I had it all scripted out ahead of time
20:22technomancybut it makes it nice for folks following along at home
20:23sjlyeah, this was more of a "well I'm making it anyway, may as well record it"
20:29TimMcIn a line, what is it?
20:30sjlTimMc: the app? It lets you paste in text you've written and created random typing lessons for you based on that text
20:38TimMcHa, cool.
20:45dgrnbrgSuppose 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:48TimMcYeah, someone I know was complaining about that.
20:49technomancyneed to either go through a var or mark it an ^:internal instead of private
20:49TimMcMaybe if you make the defn public and just hint it with :^internal?>
20:49TimMcbah
20:50dgrnbrgwhat does ^:internal do?
20:50dgrnbrgtechnomancy, is it recognized by the compiler?
20:50dgrnbrgor runtime?
20:51TimMcdgrnbrg: It's just for your audience.
20:51technomancydgrnbrg: recognized by human readers =)
20:51dgrnbrgI see
20:51dgrnbrgIs there any library for executing a dependency graph of functions?
20:51technomancyhonestly :private is entirely about communicating intent too
20:51technomancyit just has the compiler help it out a little extra
20:52dgrnbrgyeah
20:52dgrnbrgwell, i'll go with the public soln for now
20:52dgrnbrgI have an input that needs to get processed through a little graph
20:52dgrnbrgI could just have the functions call each other in turn
20:53dgrnbrgbut I was wondering if there's a bit more elegant way, perhaps by specifying their deps in a standard way?
20:54technomancymonads!
20:57technomancyor ->
20:57TimMcdgrnbrg: But you want to do it efficiently, yeah?
21:01TimMcI 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:02TimMcbut you probably want something functional, yeah?
21:02TimMc(ugh, I hate how repetitive my writing is)
21:07dgrnbrgTimMc, I'm not terribly concerned about functionality
21:07dgrnbrgtechnomancy, I think I'd like more flexibility, in case I parallelize it later
21:07dgrnbrgIs there a zipper for maps?
21:09TimMcdgrnbrg: Check ou thte cascade.clj file in my HW3 prohjec ton github
21:11dgrnbrgTimMc, that's quite good
21:12dgrnbrgIs there some kind of functional data structure like a zipper but for a map?
21:13TimMcdgrnbrg: It's a bit weird, should maybe be rewritten inside out.
21:14dgrnbrgwhat do you mean inside out?
21:18TimMcWell, since it mutates stuff, the client code really shouldn't responsible for storing the returned object back into a ref or whatever.
21:18TimMcand someone suggested having it watch atoms instead of calling dirty! on it.
21:27TimMcdgrnbrg: So, is this a DAG of processing functions where an input goes in and you get a bunch of outputs out?
21:38dgrnbrgTimMc, it's almost more of a sequence of validity checks
21:38dgrnbrgand the data must get verified
21:38dgrnbrgand some passes won't make sense until a previous pass has ran
21:38dgrnbrgand other passes rewrite the data
21:39dgrnbrgand there's a path it should take to get an answer or an error
21:45TimMcdgrnbrg: You want to shortcut on errors?
21:45TimMcOr collect all the errors?
21:55dgrnbrgTimMc, collect them all
21:55dgrnbrg(man, I don't have notifications set up properly
21:56dgrnbrgvery hard to chat in a timely manner)
22:04TimMcdgrnbrg: 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:05TimMcdgrnbrg: I bet you could do something clever with promise/deliver or futures, too.
22:05TimMc(if you only wanted the end result)
22:12tmciverTimMc: have you been doing any work on imports?
22:13tmciverTimMc: I'd like to try tackling something you're not doing.
22:14TimMctmciver: Just the testing. It's not going well. :-P
22:15TimMctmciver: So go for it. Oh, what do you think of syntax like (import+ (java.awt Color (geom :rename {Point2D$Double P2D}))) ?
22:15tmciverTimMc: Ahh! When you said "import plus" I imagined import-plus
22:15TimMcNesting packages, renaming without having to list the class redundantly in both the imports and renaming.
22:16tmciverIs it more idiomatic to use a vector? (import+ (java.awt Color (geom :rename {Point2D$Double P2D})))
22:16tmciverwait
22:16tmciverIs it more idiomatic to use a vector? (import+ (java.awt Color [geom :rename {Point2D$Double P2D}]))
22:17TimMcProbably.
22:17TimMcclojure.core/import doesn't, though
22:17TimMcIt's a little inconsistent.
22:18TimMcWe don't actually have to choose, just check for a sequential? and allow either.
22:18tmciverUgh. Let the confusion begin (coninue?)
22:18TimMcThat cuts off some future syntactic additions, but I'm not too worried.
22:19tmcivers/coninue/continue
22:19TimMctmciver: It would have confusion-parity with 'require and 'use, yes.
22:19tmciverOh, well since you put it that way...
22:20tmciverSo you're going to be tackling the renaming? I could make an attempt at importing static methods as functions.
22:21TimMcRenaming is totally something that can be folded in afterwards.
22:21tmciverSure
22:22arohnerwith midje, how do you stub a function to throw an exception?
22:22TimMctmciver: 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:24tmciverTimMc: so, what would the hinting do here?
22:26TimMcWell, you'd effectively want (defn ^double sqrt [^double x] (Math/sqrt x))
22:26tmciverTimMc: OK, that's good.
22:26TimMcI guess the macro to produce that would use with-meta on the forms it produces.
22:27TimMcIt'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:27arohneralexbaranosky: is it possible to make a midje fake that throws when called?
22:28tmciverTimMc: BTW, I fixed my warped keyboard tonight :D
22:28TimMcHaha, good! Was there a hamster or something under there?
22:29tmciverTimMc: I had improperly replaced a bracket causing it to stick up.
22:29tmciverTimMc: Nothing a hammer couldn't fix.
22:35alexbaranoskyarohner, 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:37arohneralexbaranosky: 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:37arohnerI don't want to do (provided (foo anything anything anything anything anything)), I want (provided (foo any-number-of-arguments))
22:38alexbaranoskyarohner: no sugar for that (yet)... add your approval to the issue (https://github.com/marick/Midje/issues/56)
22:39alexbaranoskyso far I've been the only one to care about this idea, so it hasn't gotten done
22:39alexbaranoskyarohner, I'm going to look at =throws=> right now
22:40arohneralexbaranosky: thanks
22:49devnheya alexbaranosky
22:54Raynesdevn: I don't know if you're aware of this, but I recently became an old man. ;)
22:54clojurebotHuh?
22:54devnRaynes: You got married?!
22:55RaynesNo, but that's certainly an interesting conclusion.
22:55devnRaynes: I don't mean that to sound incredulous: of course you got married.
22:55RaynesI turned 18.
22:55devnBahahahahaha
22:55RaynesI figured that was clearer than it actually was. :p
22:55devnDamnit Anthony.
22:56devnan "old man"
22:56devnversus being 18
22:56devnone of them is more likely for someone of my ripe old age
22:56tmciverRaynes: congrats. Too bad you have to wait a few more years to legally drink a beer.
22:56Guest33786not in New Zealand!
22:56Guest33786err
22:56RaynesHeh
22:56devnnot in 1960 in the US!
22:56ivan___so need to sort out my nick
22:56devnivan___: haskell?
22:57ivan___haskell?
22:57clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>
22:57devnivan___: i just know an old nick from #haskell which was ivan
22:57devnis that you?
22:57ivan___nah ive never been on that
22:57devnk, nvm
22:58ivan___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:58ivan___it got changed to 18 6months before i turned 18 :)
22:58tmciverivan___: that's they way it should be.
22:59devnKim Dotcom ruined it for everyone, eh ivan___?
22:59devn;)
22:59ivan___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:00ivan___devn: heh, yeah especially because we have 3 strikes laws for torrents
23:00tmciverivan___: torrents?
23:01ivan___tmciver: if we get 3 dmca notices for using bittorrent over 3 months we can be disconnected and/or fined $10k
23:01tmciverivan___: whoa!
23:02ivan___although it costs the companies $25 to issue those notices so they havent been spamming them
23:02devntmciver: just move that traffic through malaysia and no problem! :)
23:03tmcivercheaper and easier just to buy your movies/music.
23:03devndebatable
23:03devnalso defeatist
23:04devnalso, demerol
23:05alexbaranoskyarohner, looks like I coded up =throws=>... that was ease, nice!
23:05alexbaranoskyJust need to give it some error checking, and test the error checking
23:05TimMcI like to listen before I buy.
23:05alexbaranoskyarohner, and... ya know, deploy iy
23:06tmciverTimMc: get a radio! :)
23:06TimMctmciver: They don't play what I like!
23:06alexbaranoskyTimMc, thief!
23:06alexbaranosky;)
23:06tmciver~guards
23:06clojurebotSEIZE HIM!
23:06TimMcI like it when bands do this: http://www.gaiaconsort.com/lyrics.html
23:07TimMc(Basically, you can download all their music for free.) I've donated like $50 to that group, *after* listening to their stuff.
23:08ivan___tmciver: yeah i dont pirate generally, i used to when i was a student but then i stopped
23:08TimMcAnd this is a fantastic idea for ebooks: http://fictioncircus.com/news.php?id=407&amp;mode=one
23:08tmciverWell, 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:08ivan___so really the 3strikes laws dont effect me
23:09TimMctmciver: IP vs. tangible property. They're different.
23:10tmciverAs long as artists/authors get paid for their work (on their terms) I'm happy.
23:10TimMcMe too.
23:10TimMcThe question is whether any of the existing models are sustainable.
23:10ivan___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:11devntest.generative is great, but it's just quickcheck, no?
23:11tmciverI 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:11devnwhoops, nvm
23:11TimMc*just* quickcheck, he says...
23:11ivan___TimMc: it doesnt matter if its not sustainable in the long run. If people STOPPED buying media, those companies would die out
23:11devnTimMc: haha, I was not trying to downplay how cool it was
23:12ivan___and new ones would take there place
23:12ivan___that had a different distro model
23:12alexbaranoskydevn, from my understanding QuickCheck is much more fully-featured than test.generative
23:12TimMcivan___: I'm referring to the distro model of groups like Gaia Consort, too.
23:12TimMcMaybe people wouldn't donate enough.
23:12clojurebotGabh mo leithscéal?
23:12devnalexbaranosky: specifics?
23:12tmciverI don't think a system that relies on donations is sustainable.
23:13ivan___TimMc: oh i see, it might be sustainable for one group, but if others start doing it..
23:13TimMcRight, the novelty wears off.
23:13_carlos_hi!
23:14TimMcAnyway, off to bed. tmciver, I expect to see a fully hinted renaming import+ by the morning. :-P
23:14arohneralexbaranosky: awesome, thanks
23:14tmciverTimMc: OK (he didn't say *which* morning ;) )
23:15tmciverTimMc: 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_carlos_(defmacro randomly-2 [& exprs] (nth exprs (rand-int (count exprs))))
23:16_carlos_I just noticed it was small enough ^^
23:17_carlos_I just wonder.. when using "list", this macro definition stops working.. why suddenly such an exception?
23:19tmciver_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_carlos_tmciver: just a second
23:19_carlos_tmciver: oh sorry, I will give you an example
23:19tmciver_carlos_: If I call it, it just returns what I gave it...
23:20tmciver_carlos_: Oops, I was wrong; it does work
23:20_carlos_tmciver: (randomly-2 (println "spam") (println "foo") (println "bar"))
23:20_carlos_oh
23:21alexbaranoskydevn, as far as I know test.generative doesnt have shrinking
23:21devnalexbaranosky: what is that?
23:21alexbaranoskydevn, shrinking is where it attempts to reduce the failure case into the smallest possible case
23:21tmciver_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:21alexbaranoskyand in QuickCheck the shrinking correlates to the particular generator used
23:22alexbaranoskyI could be wrong, and test.generative does implement that....
23:22tmciver_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_carlos_tmciver: println expression is just an example
23:25_carlos_tmciver: was my explanation clear?
23:26_carlos_tmciver: it doesn't print all the body, just one randomly selected, in the example of a print expression
23:27tmciver_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:30muhooi 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:31tmciver_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:32tmciver_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:35tmciver_carlos_: Ha! Don't do that.
23:35_carlos_tmciver: thinking about the problem, not killing the brain
23:45muhoobraaaaaaiiiiin!
23:50_philis there a way to see if the outer function of some closure is still in progress when the closure gets called?
23:51_phil(except wrapping it with (reset! progress true) ... (reset! progress false))