#clojure logs

2013-11-26

00:00seancorfielddnolen: is there somewhere we can read about the defrel / pldb change and how it affects usage? if it does...
00:00seancorfieldyou mentioned it might be a breaking change so i was looking for code before / after examples... or is it too esoteric for casual users to care?
00:01dnolenseancorfield: https://github.com/clojure/core.logic/commit/1375f34ef42ee6b288ccb110b5c8c4aeb87a39a9
00:01seancorfieldthx... reading...
00:01dnolenseancorfield: is the only thing currently available, I'll try to find some time to write up about it
00:02dnolenseancorfield: but tldr; this is just way more idiomatic
00:02dnolenseancorfield: no mutable madness
00:10seancorfieldthe tests sort of explain it... i guess i hadn't seen the madness that it was before :)
00:11seancorfieldthe fact databases, esp. the merging across them, looks very nice...
00:16dnolenseancorfield: yep, and this code has been used in production >1 year, more?
00:16dnolenseancorfield: I'll definitely write up a transition - can more or less use the tests as a starting point
00:16dnolentransition guide
00:21seancorfieldi'm looking forward to hitting a problem at work for which core.logic is the perfect solution :)
00:21seancorfieldone day, one day... :)
00:22seancorfieldi have played with it in the repl several times... it really is very cool... i used to do a fair bit of prolog (back in the... late 80's I guess) but haven't hit a "real" problem for which i've needed that much firepower lately
00:33andyfIs there an easy way to make pprint show metadata, too?
00:34andyfdoh! And of course (binding [*print-meta* true] (pprint ...)) does it, but somehow I didn't think it did despite trying it a few days ago.
00:53devnDoes (with-pprint-dispatch code-dispatch (pprint ...)) include that binding?
01:03seancorfielddoesn't look like it devn
01:03seancorfield,(source clojure.pprint/with-pprint-dispatch)
01:03clojurebotSource not found\n
01:04seancorfieldhmm, worth a try... but all it does is bind *print-pprint-dispatch*
01:11myguidingstarhi all, I want to test a function that generate code but got this https://gist.github.com/myguidingstar/7654141
01:12myguidingstarhow can I force the test to skip resolving namespaces?
01:14myguidingstarFYI, I am writing a lein plugin that will read some symbols "and", "or" from project.clj
01:21tufflaxmyguidingstar: I have not used midje so im not sure how it works, but maybe you could use ` instead of ' in your fact? :P
01:22myguidingstartufflax, it works!!!!!
01:22myguidingstarthanks a lot ^^
01:23tufflaxmyguidingstar: np
01:30myguidingstartufflax, but when evaluating the generated code, I got java.lang.RuntimeException: Can't use qualified name as parameter
01:31tufflaxhm
01:31myguidingstardoes that mean I have to use ' instead of ` for all the code?
01:31tufflaxprobably not
01:31myguidingstar(hmm, that looks weird)
01:32tufflaxYou mean when you eval what is after Expected: in your gist?
01:33myguidingstaryep, something like this (eval `(fn [my-ns/s] ...))
01:34tufflaxshow exactly what
01:34myguidingstarwell, I just apply eval to the result
01:35myguidingstarand because the symbol s is qualified with my current ns, so (fn [...]) doesn't work
01:37tufflaxoh
01:37tufflaxnow im starting to understand
01:37tufflaxyou have to do `(fn ['~x] ...)
01:38tufflaxfor function parameters
01:38tufflaxi think that's it
01:38myguidingstarok, I'll try
01:42tufflaxmyguidingstar: did it work? :P
01:43myguidingstartufflax, it works perfectly now
01:43tufflaxnice
01:44myguidingstarbut a little change in syntax
01:44myguidingstar,`(fn ['~x])
01:44clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
01:44myguidingstar,`(fn [~'x])
01:44clojurebot(clojure.core/fn [x])
01:44tufflaxoh
01:44tufflaxyeah :p
01:46seancorfield,`(fn [x#] (if (string x#) "yup" x#))
01:46clojurebot(clojure.core/fn [x__84__auto__] (if (sandbox/string x__84__auto__) "yup" x__84__auto__))
01:46seancorfieldyou can use gen-sym here i think?
01:48tufflaxseancorfield: yes probably, but that would perhaps again break his test :P
01:48seancorfieldwasn't sure whether he really wanted an anaphoric macro or not...
01:49tufflaxthis approach to tesing macros seems to be a bit broken :p
01:51seancorfieldthe gist has timed out / gone away so i can't check it
01:54tufflaxhe was basically comparing macro expansions, so differing symbol names would make the test fail
01:56seancorfieldah so he didn't really care about execution of the macro, just the expansion?
01:57tufflaxI imagine he cares about execution too, but he was writing tests at the moment
02:01tufflaxmyguidingstar: You probably want to do what seancorfield said and use s# instead of ~'s
02:05myguidingstarthanks seancorfield tufflax for your suggestions. It's a very small function, not a macro
02:08seancorfielda macro is just a function that manipulates clojure forms :)
02:09SegFaultAXThat's evaluated at compile time.
02:09emaphisa compile time lambda.
02:13brainproxynot looking for upvotes per se, but recommendations from the clojure crowd would be welcomed: https://news.ycombinator.com/item?id=6799511
02:33tufflaxbrainproxy: this book got a stellar review http://www.amazon.com/review/R2CE1AUN4BVEXM
02:39brainproxytufflax: :/
02:40tufflaxI actually did not find the book that bad, but there are proabably better ones :p
02:40brainproxythis one is relatively new: http://www.digitalgrammars.com/ipl-book/
02:40brainproxyno reviews on amazon, though
02:42tufflaxbrainproxy: here is a free one http://www.diku.dk/~torbenm/Basics/
02:48brainproxytufflax: nice! thanks
02:48tufflaxbrainproxy: how much background do you have?
02:48tufflaxdo u know what automata are and how to write a context-free grammar etc?
02:49dnolenCLJS AST + core.logic is entertaining https://gist.github.com/swannodette/7654717
02:49brainproxytufflax: nope
02:49brainproxybut I like to eat monads for breakfast and generally can learn as I go
02:49dnolenpartial maps are pretty sweet for this ... need more sugar though
02:50andyfMinor victory: An update to the eastwood linting tool that uses the latest tools.analyzer contrib library by Bronsa to find redef'd vars in Clojure code.
02:51tufflaxThis book is ok for learning about automata, grammars, turing machines, grammars and so on. Does not talk a a great deal about parsers or generating code though http://www.amazon.com/Introduction-Automata-Languages-Computation-Edition/dp/0321455363
02:52tufflaxbrainproxy: ^
02:55brainproxytufflax: got it, thanks
02:55brainproxylooked up the Sipser book mentioned by a reviewer too
02:56brainproxycertainly have some options now :)
03:43jcidahoanyone got a good example of using core.async tap?
03:43jcidahowant to check the size of a chan
04:55d11wtqHi all. Newb question. I'm building a REST API in Compojure and want to keep my handlers in e.g. my-proj.handlers.users/show, my-proj.handlers.users/delete etc. Given I'll have resources of types other than 'users' in other namespaces, is there a form of (:use ... ) that will import my-proj.handlers, so I can simply refer to users/show and users/delete without the preceding namespace?
04:55d11wtqI'm happy to blindly import all namespace under my-proj.handlers.*, since they'll all be used in the defroutes.
05:04tangrammerHi @d11wtq, maybe the behavior you are thinking about is similar to "loading functions/classes/libs into the namespace on the invoking of a function →"
05:05tangrammer@d11wtq take a look to this code https://github.com/nathanmarz/cascalog/blob/develop/cascalog-core/src/clj/cascalog/playground.clj#L7-L12
05:05tangrammerit's used to dynamically load require dependencies
05:05piranhadnolen: problem with externs is that you'll have to specify them every time you include react in some project
05:06d11wtqtangrammer: thanks! Exactly what I was getting at!
05:07tangrammerd11wtq: i discovered it very recently, i'm glad with my first contribution in this channel :)
05:17llasramtangrammer, d11wtq: Calling `require` outside of your `ns` form is pretty uncommon, and there isn't usually a great reason to do it...
05:18llasramd11wtq: Did you just need (:require ... :as ...) ?
05:19tangrammerHi @llasram, i suppose that this code will conform to the clojure standard use https://github.com/nathanmarz/cascalog/blob/develop/cascalog-core/src/clj/cascalog/playground.clj#L7-L12
05:21llasramtangrammer: Not really. `use` is semi-deprecated, and like I said, calling `require` outside of `ns` is unusual. It makes sense there because it serves the non-standard purpose of letting you quickly slurp some vars into the `user` namespace for experimentation, but I wouldn't suggest using it as a pattern for production code
05:22tangrammerllasram: thanks a lot for your comemnts, I really appreciate them
05:24llasramEr, np :-)
05:50justin_smithtangrammer: just saw an answer of yours on SO - fyi
05:50justin_smith,@(future + 1 2 3)
05:51clojurebot#<SecurityException java.lang.SecurityException: no threads please>
05:51justin_smithanyway, that returns 3
05:51justin_smithfuture takes a normal body as an argument
05:52tangrammerjustin_smith: hi justin!, can you be a bit clear please?
05:52justin_smithtangrammer: @(future (+ 1 2 3)) actually works as expected
05:52justin_smiththat would return 6 if clojurebot let me use futures
05:53justin_smiththis is regarding your answer on http://stackoverflow.com/questions/20203013/how-to-write-concurrent-program-in-clojure-using-ref-agent-and-future
05:53tangrammerjustin_smith: actually i've never used futures, let me see again
05:56tangrammerjustin_smith: when i try to evaluate the code with the parenthesis then my nrepl-connection get closed,..
05:56tangrammerjustin_smith: but if i remove the extra parentheses then the code print the results in the console
05:57justin_smithin a repl, run the two examples I pasted here
05:57justin_smith@(future + 1 2 3)
05:58justin_smith@(future (+ 1 2 3))
05:59justin_smiththe first one is the equivalent of (do + 1 2 3) - no function application, just returning the last one specified
06:00ddellacostasomebody hope me! https://www.refheap.com/21254
06:00tangrammerjustin_smith: you are right with your example!
06:01ddellacostasorry, being silly. I want to figure out how to deref a form and pass a variable in--generated in the macro--so that I can use it in the form I pass in
06:01ddellacostathere is something basic I'm confused about wrt macros here
06:01justin_smithtangrammer: there are clearly other things wrong with that guy's code, just saying using future that way is just avoiding a symptom, not fixing the code
06:01tangrammerjustin_smith: let me check again,
06:02justin_smithddellacosta: ~@body spits out body into the surrounding form
06:03clgvddellacosta: just use ~body
06:03justin_smitheither don't use @, or pass in (#(+ 3 %)) instead of #(+ 3 %)
06:03ddellacostajustin_smith, clgv: thanks!
06:03tangrammerjustin_smith: (future transfer(balanceA balanceB 20 1 (rand-int 100))
06:03justin_smithdepending on what you want other usages to look like
06:03clgvddellacosta: splicing unquote (~@) enrolls a list/sequential
06:03justin_smithtangrammer: totally wrong
06:04tangrammerjustin_smith: it need to be replaced with (future (transfer balanceA balanceB 20 1 (rand-int 100)) (prn "result" @balanceA @balanceB))
06:04tangrammeri got it
06:04ddellacostaclgv: right, now it makes sense.
06:04tangrammerand thanks a lot
06:04justin_smith(future (transfer balanceA balanceB 20 1 (rand-int 100)))
06:04justin_smithtangrammer: yeah, you got it
06:04tangrammerjustin_smith: i'll change the code in SO, you are a crack! thanks!
06:04justin_smithnp
06:05noncomanybody here users of CounterClockWise?
06:05justin_smithI am unfamiliar with that idiom
06:05justin_smithtangrammer: spanish slang?
06:05clgvnoncom: yes, what's your question?
06:06tangrammerjustin_smith: yes, sorry! it's like a great guru
06:06justin_smithwell, shucks
06:07noncomclgv: i am specifying -Xmx1024M in VM parameters of the launch config, then I click "Run", the repl starts and I eval my things there and with time the app slows down and then the Heap Exception is thrown. The task manager says that the java process still takes no more than about 330 Mb...
06:07noncomhow do I set more memory for the VM correctly?
06:08noncombtw, there is 1Gb free ram for sure, so it should be available to the jvm
06:09clgvnoncom: the memory config for the REPL needs to be set in the run configuration
06:09justin_smithso counterclockwise uses a separate vm for the repl?
06:09clgvnoncom: oh right you said you did
06:09clgvjustin_smith: yes
06:10noncomi should also say that i am using 0.13 beta version (which is dated, but it has the necessary leiningen interaction)
06:10justin_smithif it is using leinengen, maybe the vm args should be in the project.clj?
06:10justin_smithjust a wild guess
06:10ucbjustin_smith: being a crack is usually used in the context of sports in Spanish - most notably football; it means being a star. :)
06:11noncomjustin_smith: oh, maybe! the point is that CCW above 0.13beta do not use lein and setting configuration properties works for them.. so I gonna check it with the projcet.clj
06:11tangrammerucb: but it's also used in programming contexts
06:11justin_smithucb: gotcha. In american english, crack as a noun is likely to mean "some crack" as in the drug, or "a crack" as in what people have on their ass
06:12ucbjustin_smith: heh
06:12ucbtangrammer: indeed; I was just referring to the potential origin of the expression plus it's most common use? (I've not seen it quite in the programming context)
06:13clgvnoncom: afaik CCW does not use the full project.clj there are a lot of features missing
06:13justin_smithclgv: well if he is intentionally using a version that farms out to lein...
06:14noncomclgv: but 0.13beta is special - it delegates all launch to leiningen, so that should be the spot!
06:14clgvjustin_smith: he probably means support to run leiningen tasks. that feature is not implementing full project.clj compliance
06:14clgvnoncom: is it gone on the current beta channel? I'd doubt that
06:15clgvnoncom: there is a channel for each branch afaik
06:15justin_smithanother option is env _JAVA_OPTIONS=-DXmx1g <command>
06:15noncomclgv: you mean that newer ccw beta versions still delegate to leiningen?
06:15justin_smiththat should get passed to each jvm within the process tree under that point
06:16justin_smithnoncom: he is claiming that no delegating to leiningen ever happens
06:16clgvnoncom: I specify 10GB for my repl which worked in stable 0.12.x and works now in stable 0.20.0
06:17noncomi see.. well i can only say that i talked to lpetit and we had that long talk of fighting a bug that was happening with me. finally we came to the decision that it is about the launch config. and he said that 0.13beta was special in that regard. and i have to use it. it is there lying specially in the "legacy" folder on the update link
06:17clgvjustin_smith: I now that Laurent was working on creating direct launchers for arbitrary leiningen tasks. but if they are experimental on a beta branch I doubt that he replaced the working REPL bootstrap with that
06:18noncomfor that single reason
06:18noncomso 0.13beta really wokred
06:18noncomwhere others did not
06:18clgvnoncom: what exactlly do you do? are you running custom tasks from integrated launchers?
06:19noncomclgv: well, i am not sure what is a lein custom task, but i think no. i just refer some jars in the :resource-paths which a program launched from CCW only finds if CCW is 0.13beta
06:22noncomso, i tried setting Xmx in project clj and seems like it works... so really, it simply asks lein to launch the app
06:23justin_smithwell, glad my ignorant guess may have helped
06:30clgvnoncom: weird. then this was reverted for stable 0.20.0
06:31clgvnoncom: so you need classpath entries via the specification in project.clj. for folders this works with current ccw but maybe there is an issue with the jars - I dont know
06:31noncomclgv: you mean it is absent in 0.20? if so then yes, Laurent said that it was experimental and the last version that had it was 0.13beta. Then he removed the feature. He said he planned to work on it more later, after 0.2x so that he can get the main CCW features ok and then work in these things
06:32noncomclgv: I tried it with some of the latest versions of CCW, like 0.19 or 0.20 idk, and as far as i remember it did not work, but I gonna try again with the latest - maybe it'll work.. wanna work with the latest version and not 0.13 :)
06:40clgvnoncom: so the problem was that you wanted the contents of a jar in a directory specified as resource path accessible, right?
07:18noncomclgv: yes, i wanted the program to be able to see and use the JMonkeyEngine3 from the path (i know that there is the repeatability approach and JME repos mainained by some ppl)
07:34silasdavisCan anyone tell me how to get line numbers displayed in timbre log messages?
07:34silasdavisI've found this, but it's not entirely clear to me how it's meant to work: https://github.com/ptaoussanis/timbre/issues/22
07:35silasdavisI have the vague idea that appenders are particularly logging endpoints, but it seems that that is missing something
08:23mdrogalisThe ClojureBridge mailing list is pretty incredible. Clojure reaches literally everywhere.
08:25clgvnoncom: so you do this to have a normal dependency?
08:26clgvnoncom: you should just upload the jmonkey release you need to clojars and use leiningen normally. the uploading is easier than you might think
08:33noncomclgv: yeah, i tried.. i even have some own projects uploaded to clojars.. but clojars do not accept more than 20mb files, and i may need nighties every day and even make custom changes to the engine code and other stuff.. also from time to time i have to link other libs.. i agree that clojars is good and stuff but for now, working 100% only with it makes more pains than i really need..
08:34noncomactually many people here already have jme repositories that anyone can use
08:34noncombut nevertheless yet it is harder to use than the copy/paste thing. maybe sometime the unified repo technology will progress enough..
08:36schmirI need to base64 encode a byte array. do I need the data.codec for that or is there a builtin function?
08:37noncomschmir: idk but i doubt it is a build-in one
08:38schmirnoncom: ok. will go with data.codec then...
08:50clgvnoncom: hm ok. I am runnning a private apache archiva myself, so a file size limit is no issue...
08:52noncomclgv: agree, but installing that server thing on all machines that i might be working on and then commiting all the things to it.. it is cool, but it just does not beat the copy/paste technique (for my case). so i just have all stuff in my project and then beam it up and down from the mercurial repo on bitbucket and it works really fine!
08:54noncomi guess that technically it happens to be that i just use mercurial instead of the central repo
08:55noncomand it is a copy/paste filesystem-based thing when with the maven i have to setup a bunch of stuff and then deal with all these manifests pom and others
08:57clgvnoncom: no, the point is to install it only on one server ;)
09:03noncomclgv: ahaha :) got you :) but in country where i live, you are never sure aout network or internet.. :(
09:04clgvnoncom: well just use ssh and https with the security level you think you need ;)
09:04noncombut i am thinking about migrating to that approach anyway. coz all people say it is great
09:05noncomclgv: nono, not security is issue, but the presense of internet itself.. when in big cities it it no problem, it can be a real pain if you go somewhere..
09:05noncombut you're right, i have to adopt correct techiques for the jobs
09:08clgvoh ok
09:08clgvwhere are you from?
09:09noncomrussia :)
09:09clgvin the european or asian part?
09:10noncomeuropean, namely, saint-petersburg. spb and moscow are ok, but if you go like 50km away... you never know what you get... and there we often have some clients with bit projects..
09:10noncoms/bit/big
09:12clgvnoncom: oh ok. clients in the "desert" so to say ;)
09:13noncomyeah :D they have museums there and all kinds of memorials and stuff. they often want some graphical installations or integrated systems... cool the development is coming but i hope it comes sooner :)
09:30noncomnen yf fylhjtlf[ cblbn&
09:30noncomsorry
09:46TimMcSounds like Russian. :-P
10:06jcromartierunning "lein ring server &" yields a non-functioning webserver
10:06jcromartieis there any way to run a ring server as a background job?
10:06mdrogalislein ring server-headless I think?
10:16ath01(run-jetty #'app {:join? false}) if you're going that route
10:29myguidingstarhi all, I'm writing a lein plugin and want to test some functions. How can I access the project map inside tests?
10:31myguidingstarfor example, given my project (defproject name "0.1.0" :some-key "some-value"), how can I get "some-value" with tests?
10:38noncommyguidingstar: your plugins entry point function takes the project map?
10:38noncomi mean sure it does, so it is the way
10:38noncomdon't hesitate to study the leiningens writing plugins guide
10:39noncomthere is much useful info there
10:44dnolengiven this https://gist.github.com/swannodette/7654717, we can easily do what Facebook does https://github.com/facebook/pfff/blob/master/h_program-lang/database_code.pl
10:45nDuffdnolen: Heh. That's... pretty closely related to what I'm working on (albeit coming from bytecode rather than source).
10:45myguidingstarnoncom, thanks but I'm trying to access the value from tests, not the plugin function
10:52nDuffdnolen: related: have you seen damp.ekeko? It uses core.logic for queries against Eclipse's idea of the Java AST.
10:53dnolennDuff: yep pretty familiar with it
10:53llasrammyguidingstar: The project map is just a map. You generally do one of two things: (a) just make a map with the keys you want to test, and call your plugin function(s) on that map
10:53dnolennDuff: I've fixed a few bugs for them. Would like to enhance core.logic to make their lives easier but that's further off.
10:54llasrammyguidingstar: (b) Setup a full stub project and shell out to `lein` in the test
10:56myguidingstarllasram, what do you mean "shell out to lein"?
10:57llasramActually run an instance of `lein` in a subprocess of the JVM running your tests
10:58BobSchackping devn
11:00myguidingstarhmm, I want some unit tests, so how can I access the project map inside normal code? I want to run `lein test`, not `lein my-plugin` to test those util functions
11:00llasramYou literally do not
11:00llasramYou can synthesize a project map and call your functions with it
11:00llasramOr you can shell out to a lein subprocess
11:00llasramThose are your two options
11:02myguidingstarok, thanks
11:09jonasendnolen: cool stuff with core.logic / cljs ast. Reminds me of my datomic/cljs project: https://github.com/jonase/scape/blob/master/src/scape/core.clj#L256
11:13jonasendnolen: one recursive step and you have a implemented a (GClosure-free) tree-shaker for cljs :)
11:13bbloomnice.
11:20tbaldridgejonasen: how fast/slow was your code?
11:20tbaldridgejonasen: if you ran it against something like core.cljs did queries take a few ms, or a few sec?
11:21jonasentbaldridge: pretty fast if I remember correctly. Especially when the datalog optimizer was removed :)
11:21jonasenms
11:21tbaldridgenice, I worked on some hobby code like this once, but never ran it against a large codebase
11:24jonasenIt's 1.5 years since I touched it so I might remember incorrectly. I should update to latest cljs analyzer (and Bronsas clojure analyzer) someday.
11:24devnBobSchack: talk to me
11:24jonasenI had lots of fun working on it...
11:25BobSchackdevn you free today at noon?
11:25devnBobSchack: what time zone, and for what? :)
11:25tbaldridgejonasen: yeah, I'd love to see something like Scheme's nanopass compiler, but using core.logic
11:25devnoooohh!
11:25devnthat'd be really cool
11:25BobSchackdevn it's Peter at the Tenney building
11:25BobSchack:)
11:25devnBobSchack: oh, confusing name!
11:26devnBobSchack: unfortunately i dont think im going to have time this week :\
11:26devncan it be an email? i have a lunch meeting today and im working out of my normal timezone
11:26devnoutside of*
11:26BobSchackI'm seeing if I can make a fressian port in js and wanted to talk to you about it
11:27BobSchacksure
11:27devnBobSchack: gah, i want to talk about that
11:27tbaldridgeBobSchack: I started on that once, got a bit hung up on how to handle string encoding.
11:27devnbut yeah, send me an email
11:27devntbaldridge: have you seen BobSchack's core.async port?
11:27tbaldridgeBobSchack: but I would seriously use that if you made it, esp if you wrote it in CLJS :-P
11:28tbaldridgedevn: maybe? do you have a link?
11:28devnBobSchack: link this man!
11:28BobSchacktbaldridge I was looking into making it in JS first like fressian is written in Java for maximum portability
11:29devnBobSchack: i cant find the repo URL
11:29BobSchackunfortunately JS doesn't have good maps or sets until you get to EMCAScript 6 :(
11:29devnwhat's your github username again?
11:29BobSchackhttps://github.com/Schuck-Johnson/csp-channel
11:29BobSchackSchuck-Johnson
11:29devngotcha
11:30tbaldridgeBobSchack: nice work!
11:31devntbaldridge: yeah, he showed this to me and i went "whoa" like keanu. really nice work. more people need to know about it!
11:31BobSchacktbaldridge thanks once you know how to do JS well porting cljs code isn't that hard, testing it to make sure it work otoh :(
11:32tbaldridgeBobSchack: nice! it supports closure. That'd be nice to have for your fressian port.
11:32BobSchackI was meaning to ask you about the writer caching.
11:34bbloomi really enjoyed stu's fressian talk. i've needed something like fressian in the past. protobufs got the job done & probably worked out a little nicer for the java-folks that had to maintain it... but i had to suffer with an extra code generator cluster fuck :-P
11:34BobSchackIt uses hashing which is kind of not there in JS so I was wondering why it uses a new datastructure instead of using a map of object to cache id
11:35bbloomBobSchack: can you link to the relevant code?
11:35BobSchackhttps://github.com/Datomic/fressian/blob/master/src/org/fressian/impl/InterleavedIndexHopMap.java
11:36clgvbbloom: what are the killer features of "fressian"?
11:36BobSchackbinary edn I believe
11:36bbloomclgv: https://github.com/Datomic/fressian/wiki/Rationale
11:37bbloomclgv: do you understand the rational for BSON in places where people need faster/smaller JSON?
11:37dnolenjonasen: yeah I was just thinking that this morning, dead code elimination would be relatively simple with this - not sure about perf though? but perhaps tabling would mitigate that? would need to fix core.logic tabling though.
11:38bbloomclgv: it's that, but with all the stuff you've come to expect from EDN over JSON (sets, tagged values, etc) plus some extras
11:38clgvbbloom: ah ok.
11:39tbaldridgeclgv: and it's also the format Datomic uses to store its data.
11:39dnolenjonasen: yes I remember, so did you walk the AST putting certain kinds of facts into the DB?
11:39clgvtbaldridge: yeah I read that few months ago..
11:40bbloomtbaldridge: there was some discussion in here last night about PDF/postscript/turing complete. I'm totally going to make Fressian 2.0 -- A Forth Dialect :-P
11:40clgvah compression via caching is builtin as well
11:40bbloommostly.
11:40jonasendnolen: yes: https://github.com/jonase/scape/blob/master/src/scape/emitter.clj
11:41bbloomBobSchack: so i think this is about cache locality
11:41bbloombut i'm not sure
11:41bbloomhttp://en.wikipedia.org/wiki/Interleaved_memory
11:41devnare the data.fressian slides online from stu's talk?
11:41dnolenjonasen: oh huh, you're emitting more than I thought, and find all callers and all callees was fast over all of core.cljs?
11:42jonasendnolen: If I remember correctly, yes.
11:42jonasendnolen: indexing FTW
11:43bbloomdnolen: i see no reason why we can't *destroy* the perf and quality of transformations that gclosure performs
11:43bbloomdnolen: javascript is just much much harder to analyze, even w/ google's type system
11:43dnolenjonasen: will have to play around with that intuitively all those joins would seem prohibitive w/ set oriented semantics
11:44dnolenjonasen: I don't see any real all callees or callers query in your project.
11:46jonasenhttps://github.com/jonase/scape/blob/master/src/scape/core.clj#L221
11:46upwardindexHow do I call the javascript + from clojurescript (I did js/+ but that yields _PLUS_ and that is undefined)?
11:47jonasendnolen: my weekend project should be to update to latest cljs analyzer so we could play with it some more
11:47dnolenjonasen: ah cool, didn't see those there
11:47dnolenjonasen: how long does it take to dump core.cljs into the DB?
11:48jonasendnolen: sorry I don't remember. A few seconds perhaps?
11:48seangrovebbloom: Presumably you'd do the dead-code elimination and transforms in cljs-land, then generate the reduced javascript, then pass that off to gclosure for concatenation/minification?
11:48seangroveupwardindex: Interesting, what are you trying to do?
11:49bbloomseangrove: initially, yes. but over time, it would be much more efficient to do the work on our end.
11:49upwardindexseangrove: remove warnings regarding adding dates or similar stuff
11:49bbloomseangrove: otherwise we still need to pay the extra round-trip to text-on-disk just for concat/minify
11:50bbloomseangrove: and we can already generate unique names on our end, so it's only a manner of tweaking the name generation to use single letter names and capitalize on knowledge of javascript scope
11:50seangrovebbloom: Certainly could be very interesting
11:50dnolenjonasen: that's pretty awesome - I never looked at it closely - I see you're only putting in the relevant parts of the ast into the DB
11:51devnstupid white paper pay walls
11:52dnolenjonasen: it'd be cool if this was online like your other projects ;)
11:53seangrovejonasen: scape looks pretty interesting!
11:54jonasenseangrove: kind of similar to codeq (minus the git import + more advanced code analysis)
11:54seangrovejonasen: That's what I was thinking. Still not sure what codeq is good for other than as a toy, but I feel like there must be something very useful
11:55devnseangrove: i think the model needs to be extended
11:55dnolenseangrove: scape is more interesting, but does having all that git history scape less usable?
11:55dnolen"make scape less usable?"
11:56jonasendnolen: I remember trying to combine the two projects, but failed.
11:57devni would like to see codeq with additional analysis tools added into the mix, like ambrosebs' jvm.tools.analyzer
11:59devnjonasen: combining it with codeq you mean?
11:59jonasendevn: yes
11:59devncodeq is a pretty big model to get your head around
12:00devnwhich is why adding jvm.tools.analyzer to it would be a bear
12:03dnolenBronsa: so for your passes do you have pre/post?
12:04tbaldridgedevn: the new analyzer is actually pretty clean. It'd be a bear to write the insert queries
12:04Bronsadnolen: yes but simply pre/post is not sufficient for some passes for the jvm
12:04BronsaI also have a right to left walk
12:04dnolenBronsa: what's that for?
12:05Bronsait's needed by the clear-locals pass, it needs to walk the children nodes in backward order
12:06dnolenBronsa: ah got, so do you just maintain two vectors of passes or something?
12:06dnolen(disregarding the right left thing)
12:06Bronsadnolen sorry, give me 5 minutes, I'm walking home :)
12:07dnolenBronsa: heh, k
12:11dabdStupid question why is the following not working: ,(z/edit (z/vector-zip [1 [2 3]]) (fn [n & args] (if (odd? n) (* 2 n) n)))
12:12jonasendevn: understanding codeq wasn't the problem. Any "real" analyzer will have to do macro expansion. Codeq hands you only a file so you can't just run the analyzer on it since it can't find the macros.
12:14Bronsadnolen: so, for the jvm passes it's not so easy as having a vector of passes and (reduce apply-pass ast passes)
12:14Bronsathere are passes that need to be run multiple times/passes that require to be re-run once the result of a previous pass gets invalidated
12:15Bronsaso ATM I'm composing the passes manually it's pretty complex actually https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/jvm.clj#L327-L359
12:16dnolenBronsa: ah got it, make sense. Was curious how to improve the *passes* feature in CLJS
12:17Bronsadnolen: I've been thinking for a while on how to make this as simple as pushing the pass in a queue and letting the analyzer compose them automatically, but I still have to find a satisfying solution
12:18TimMcdabd: What do you expect it to do, and what does it actually do?
12:18dnolenBronsa: k, thanks for the info. I'll probably leave *passes* alone for now then.
12:18dabdreturns an error: IllegalArgumentException Argument must be an integer: [1 [2 3]] clojure.core/even? (core.clj:1338)
12:18dabdi would like to multiple the odd numbers in the tree by 2
12:19dabd*multiply
12:19TimMcdabd: Oh, this is the same problem you were having yesterday. Does z/edit edit the current node, or map over all nodes?
12:19Bronsadnolen: yeah, I poked at it and for CLJS it looked fine as it is for now
12:19alandipertBronsa, dnolen: are you guys into the idea of relations for passes? seems like the situation is amenable to core.logic
12:19dabdit's the clojur.zip/edit function so it edits the current location according to the docs
12:19TimMcdabd: Well, the current location is a vector. :-)
12:20technomancycemerick: have you done any brainstorming on nrepl content types?
12:20dnolenalandipert: yes thinking about that now - would be cool - might be too slow of course (w/o some long outstanding core.logic optimization work)
12:20dabdbut function that is passed to edit applies node to the location so it shouldn't be a vector
12:21TimMcThe location *is* a vector. What else could it be?
12:21Bronsaalandipert: using core.logic over the AST seems like a really cool idea (like how dnolen has shown in his gists today) but I don't think it will be fast enough
12:21dabddo you know how to change my code so it works?
12:22alandipertbut dnolen has put every of the perf into core.logic!
12:22alandipertalso there are lots of opportunities to memoize and cut when you're unifying, the way the people with the fast type checkers do
12:23TimMcNope, not to familiar with what zipper data structures are available.
12:23TimMc*not too
12:23TimMcbut you'll need to find something capable of storing values at the nodes
12:23dnolenBronsa: in the future it could be fast enough - the big optimization I haven't had time to implement - skipping unification when ground and just invoking CLJ/CLJS fns
12:23dnolenBronsa: something serious Prologs do
12:24coventrydabd: Have a look at the examples in http://clojure.org/other_libraries#Other%20included%20Libraries-Zippers%20-%20Functional%20Tree%20Editing%20(clojure.zip)
12:25coventrydabd: z/edit basically does the z/replace and the z/node part of those for you.
12:26dabdany expert here could illustrate how to change my example so it works with clojure.zip/edit? ty
12:27bitemyapp"do my homework plz kthxbai"
12:28coventrydabd: As far as I know, the zipper library doesn't provide any function which walks/edits the structure for you. You have to walk it yourself as demonstrated in those examples.
12:28cemericktechnomancy: not since the conj. Steeped in all sorts of non-tooling yaks of late. FWIW, here's what I did just prior to nREPL going to contrib https://github.com/cemerick/tools.nrepl/commit/a6851d9cbfa35374c9bad2f8abc738d988b4b55e
12:28cemerickIIRC, that predates the use of bencode, so the base64 encoding business is unnecessary
12:29Bronsadnolen: honestly I haven't done anything serious with core.logic other than playing around a bit, I need better core.logic-fu before considering using it if you say performances might not be a problem
12:29technomancycemerick: cool; thanks
12:29cemericktechnomancy: also, wasn't suggesting regular MIME types there yet, though that's obviously better than dumb png/txt/etc tokens
12:30technomancycemerick: was just about to ask =)
12:30TimMccoventry: That's kind of surprising. There's no prewalk-map or whatever?
12:30dnolenBronsa: we have supercomputers and very little Clojure code
12:30dnolenit might have been a problem in the the 1980s
12:31Bronsadnolen: then I have no excuses :)
12:31technomancycemerick: are you still keen on rendered-* responses?
12:31xeqiBronsa: to use tools.reader with source logging, I should be able to replace `readers/indexing-push-back-reader` with `reader/source-logging-push-back-reader` correct?
12:31dnolenBronsa: which isn't to say traditional approaches won't be an order or two magnitude faster even if I optimize core.logic
12:32Bronsaxeqi: yes
12:32dnolenstill I think there's a lot of FUN to be had here
12:32coventryTimMc: As far as I know, in clojure.zip itself. There may be a tool in a different library for that.
12:32xeqiblah, time for some fun debugging. https://www.refheap.com/21263
12:32coventryTimMc: At any rate, z/edit only edits the current node, it doesn't walk the tree as dabd is hoping.
12:33Bronsaxeqi: https://github.com/clojure/clojurescript/commit/36d401797f85c99794eef8a71239641930c36871
12:33cemericktechnomancy: probably not. If a client sends :accepts ["application/png" "text/plain"], then a response that contains a map of mime types to the slots that actually contain the associated data makes more sense.
12:33bitemyapptechnomancy: http://motherfuckingwebsite.com
12:34cemerickrendered-* only "worked" because dumb tokens were being used
12:34technomancybitemyapp: I hate how that site doesn't wrap
12:34Bronsaxeqi: that's a bootstrapping issue with cljs, in order to make that work you have to dissoc :source in analyze-wrap-meta
12:34bitemyapptechnomancy: beg pardon? it wraps for me.
12:34cemericktechnomancy: also, there's the (undocumented) escape hatch for binary data: https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/transport.clj#L96
12:34technomancybitemyapp: it's a proven fact that paragraphs beyond a certain width are more difficult for eyeballs to track
12:34cemerick...which I'm not super-fond of, but I never came up with a better solution...
12:34bitemyapptechnomancy: yeah, I agree...the page wraps for me.
12:35bitemyapptechnomancy: are you sure there isn
12:35bitemyappisn't something peculiar to your uncommon browser choice here?
12:35technomancybitemyapp: I mean it wraps to the browser's width, which is too wide
12:35bitemyappohhhhh
12:35technomancyit would be more readable if it defined a maximum width for paragraphs
12:35bitemyapptechnomancy: I like mostly unstyled text with a max width.
12:35clojurebotExcuse me?
12:37xeqiBronsa: awesome, you just saved me a couple hours of source diving
12:37technomancybitemyapp: http://baymard.com/blog/line-length-readability
12:37gunsAlso, 72 col hard-wrapped mail please.
12:37technomancyscience!
12:41llasramWhich is also why max 80 columns of code is the best! :-D
12:45seangrovetechnomancy: You have an unusual browser choice? Are you using the rms system?
12:46dabdone way to solve my problem is this: https://gist.github.com/dabd/7662792
12:47technomancyseangrove: not quite: http://conkeror.org
12:47dabdthe branches are vectors so i need a test like number? while navigating the tree
12:47dabdmaybe there is a simpler way»
12:48technomancyseangrove: I think they took this down when they got a new maintainer, but it used to say "In order to ensure Conkeror remains pure, I do not own a mouse."
12:48technomancyit's the best
12:49gunsthat's dedication
12:49technomancylmao if your browser doesn't have dotfiles
12:49coventrydabd: You might take a look at clojure.walk. It is less powerful than zip, but adequate to that problem.
12:49guns:) vimperator makes firefox usable
12:50bitemyappxmonad makes life tolerable.
12:50gunsI could never get into tiling WMs. I already do tiling in Vim and in tmux
12:50gunsanother layer of tiling is madness
12:51coventrySawfish. Scheme as configuration language FTW!
12:51seangroveAh, would love xmonad on osx
12:51gunsI do my openbox config in Clojure
12:51technomancycoventry: iirc sawfish has some crazy bespoke lisp
12:51technomancyif it used scheme I'd probably still be using it =)
12:52bitemyappthe language is called "rep"
12:53BronsaI'm coding in clojure, in an editor written in emacs lisp, in a wm written in common lisp
12:53coventryOh, you're right, lisp.
12:53Bronsalisp all the way down™
12:53technomancyBronsa: on a space cadet keyboard hopefully
12:54Bronsaif only
12:54technomancyI actually have a keyboard with an embedded JVM
12:54gunsyou kid
12:54technomancyno, for real
12:54technomancyhang on
12:54gunssmartcard reader?
12:55technomancyhttps://en.wikipedia.org/wiki/FingerWorks one of these
12:56technomancyI can't find a citation for it having an onboard JVM, but basically you program it with preset gesture recognition loaded onto the firmware
12:56gunsThe image search looks like I searched for 70's scifi interfaces
12:57coventryAh, it has a scheme flavor http://librep.sourceforge.net/
12:57gunsyou must collect keyboards
12:57seangroveBronsa: What wm?
12:58Bronsaseangrove: http://www.nongnu.org/stumpwm/
12:58seangrovetechnomancy: It must have quite an old version of an embedded jvm
12:58seangroveBronsa: Ah yes, that's the one. Nice.
12:58technomancyseangrove: 1.4 I think
12:59technomancyguns: sort of. this one is actually pretty miserable to type on though
12:59gunsput it on the wall
12:59technomancyit's like typing on a touchscreen; ~80% accuracy
12:59technomancyhehe
13:00technomancyguns: got one of these in the mail on its way: https://www.massdrop.com/ext/ergodox/assembly
13:00technomancyyet somehow I don't have a Model M yet
13:01gunslol; I think you are playing down your hobby
13:01gunsbut, I am jealous. I have read all the mechanical keyboard threads on the internet
13:02seangrovetechnomancy: But have you written an OTP erlang program to automate the ordering and disposable of various keyboards yet?
13:03technomancyseangrove: I was waiting till after I'd finished my arduino forth interpreter
13:03seangrove"When the temperature drops below 10C, buy a Model M and a MS Ergonomic 4000"
13:07Fenderhey, how can I implement e.g. clojure.lang.Counted like in:
13:07Fender(defrecord Replayer [size current-time queue]
13:07Fender Counted
13:07Fender (count [this] size))
13:07Fenderwithout getting a "Duplicate method name&signature in class file" exception?
13:08Fenderactually, it is a java.lang.ClassFormatError
13:08hiredmanFender: records implment Counted already by default
13:08Fenderand how could I override it?
13:08hiredmanso if you want a custom Counted you have to use deftype
13:08Fenderor shouldn't I be using records in the first place then?
13:09Fenderactually I want an "object" so maybe defrecord isnt the way to go?!
13:09Fendersry, I said the word ;)
13:09llasram~guards
13:09clojurebotSEIZE HIM!
13:10technomancyobjects aren't a goal in and of themselves. what is it you actually want?
13:10dnolenFender: you can't override, if you want your own definition you need to everything from scratch.
13:10dnolens/to/to do
13:11Fenderok, no worries, it is the first o***** I want to write after 18 months of clojure, so I hope I am forgiven ;)
13:12FenderI need a wrapper for a PersistentQueue that adds some functionality
13:12Fenderso I though about defining a container that, well, contains the queue plus the other stuff
13:13seangroveWe need more blue ovals!
13:13seangroveobjects?
13:14seangroveclojurebot: objects is just adds a blue oval.
13:14clojurebotYou don't have to tell me twice.
13:14seangroveobjects?
13:14clojurebotobjects is just adds a blue oval.
13:14seangroveHrm, not quite right.
13:14jtoyhow would I write this simple imperitave python in clojure, I couldnt find something that works http://pastie.org/8510498
13:18jtoyi dont think i can use map or reduce for that since I need to stop at the first match
13:18technomancy(doc reduced)
13:18clojurebot"([x]); Wraps x in a way such that a reduce will terminate with the value x"
13:19technomancyjtoy: ^^
13:19bitemyapptechnomancy: perceptive and brief.
13:19coventryjtoy: https://github.com/bigmlcom/sampling#weighted-simple-sampling
13:19technomancybitemyapp: I'm good with bots. they trust me instinctively.
13:19mpenetjtoy: you can exit reduce using reduced
13:20mpenet,(doc reduced)
13:20clojurebot"([x]); Wraps x in a way such that a reduce will terminate with the value x"
13:20mpenetalternatively you can use loop/recur
13:20bitemyappmpenet: do you read?
13:20jtoyI never heard of reduced, should I now use this for reference: http://clojure.org/cheatsheet
13:21TEttingerjtoy, clojuredocs is stuck on 1.3 for now. I think there may be efforts for new clojure references too
13:21llasramjtoy: Without `reduced`: (fn [probs] (let [z (rand)] (or (->> probs (reductions + 0.0) (map-indexed vector) (filter (fn [[_ x]] (> x z))) ffirst) (-> probs count dec))))
13:21coventryHmm, that library uses reductions https://github.com/bigmlcom/sampling/blob/master/src/bigml/sampling/simple.clj#L72
13:22TEttingerI think clojuredocs is great for core parts of clojure.core, but stuff that's newer, even like mapv and reduced, would primarily be documented on that cheatsheet
13:22jtoyhm, no examples of reduced online searchable through google
13:23stuartsierra`reduced` was added in Clojure 1.5
13:23bitemyappjtoy: https://www.google.com/search?q=Clojure+%22reduced%22&amp;oq=Clojure+%22reduced%22&amp;aqs=chrome..69i57j0l3j69i64.3014j0j1&amp;sourceid=chrome&amp;ie=UTF-8
13:23stuartsierraAlong with the reducers framework.
13:23seangrovejtoy: https://www.refheap.com/21269
13:23seangroveNot sure it's right, but just gave it a shot
13:24coventryreductions is better for repeated sampling, because you only build the CDF once.
13:24seangroveIt doesn't return the index, not sure what you're doing with it
13:24jtoyi would modify it to return the actual item
13:26TEttingercoventry, I think I joined after the question?
13:26jtoyllasram: wow, that has a couple of functions I have never seen, ffirst and reductions
13:26bitemyappjtoy: never ridden in a caar eh?
13:27coventryTEttinger: http://clojure-log.n01se.net/#13:14e
13:27jtoythanks seangrove , I wil test all of them
13:27nz-_what would be right way to redefine how liberator library encodes application/json responses? https://github.com/clojure-liberator/liberator/blob/master/src/liberator/representation.clj#L73
13:27TEttingerthanks coventry
13:30nz-_I can redefine the multimethod that does the encoding and that seems to work. (defmethod liberator.representation/render-map-generic "application/json" [data context] (do my thing) ) but is that the right way to do it?
13:31danneuwow, i get 50x speedup from converting my regular find-by-eid Datomic queries into d/datoms raw-index lookup.
13:32TEttingerpfft who needs... WHAT 50 TIMES! :)
13:32myguidingstarhi all, how can I handle key events in Clojure console apps?
13:33bitemyappdanneu: to be fair, you shouldn't actually be using datalog queries for dumb entity fetches.
13:33TEttingermyguidingstar, consoles don't send events
13:33TEttingerat least not in the traditional GUI sense
13:34myguidingstarwell, so how to catch some basic key combinations? Ctrl+C, Ctr+D, Enter etc?
13:34TEttingerit's definitely possible, BUT some may be platform-specific. obviously windows and apple cmd keys
13:35TEttingerlet me check
13:35TEttingerit probably is the same as for java
13:35llasramThere's http://code.google.com/p/lanterna/
13:35technomancyjline2 is able to do stuff like that too; key-by-key handling
13:35technomancybut you don't get anything for that out of the box
13:36llasrammyguidingstar: What are you doing at a higher level?
13:38TEttingerllasram, heh I just remembered http://sjl.bitbucket.org/clojure-lanterna/terminals/ too
13:38JDShuhi I'm really new to clojure - is there anything I need to keep in mind when choosing an SQL DSL for my project?
13:38danneubitemyapp: yeah, that makes sense now. although i've never encountered a datomic resource that asserts it.
13:39JDShuhttps://github.com/clojure/java.jdbc lists three choices
13:39timJDShu: keep it simple, and try clojure jdbc first: http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html
13:40myguidingstarllasram, well, I'm writing a lein plugin that has a watcher and I want when users press Enter the watcher is forced to run again
13:40tbaldridgeJDShu: every DSL adds new bugs/features/complexity. I say stay away from them unless you really need them.
13:40technomancymyguidingstar: is it a generic watcher, or something that's coupled to a specific lein task?
13:41danneuJDShu: the state of sql in clojure is what propelled me to try datomic
13:42myguidingstartechnomancy, it's a compiler. What do you mean 'coupled to a lein task'?
13:42JDShutbaldridge: alright thanks for the advce!
13:42tbaldridgeJDShu: I also really like yesql, mostly because it isn't a DSL: https://github.com/krisajenkins/yesql
13:42danneusomething like korma is nice, but i also used jdbc in the same codebase to handle the things i couldnt do or figure out with korma. so i have this mix of abstractions and sql strings. i bailed
13:42technomancymyguidingstar: well, a watcher ideally would be usable for any lein task. writing yet another single-purpose watcher is silly.
13:43technomancynot that it's stopped people from doing it over and over and over again =\
13:43myguidingstarfor the watcher I use filevents
13:43JDShudanneu: haha awesome good to know
13:45myguidingstartechnomancy, that means I don't reinvent the wheel, I just want some special behaviours
13:46xeqicemerick: any opposition to moving piggieback to use tools.reader for reading forms like how cljs does now?
13:46technomancymyguidingstar: what you need to do is decouple the watching behaviour from the action you want triggered
13:47bitemyappdanneu: supposed to use entity and touch :P
13:48danneubitemyapp: what are you referring to? this is what i came up with naively https://www.refheap.com/21270
13:48TEttingermyguidingstar, there's also the problem mentioned at http://stackoverflow.com/a/11709814
13:48myguidingstartechnomancy, thanks, I did it
13:48danneubitemyapp: day-of-datomic also uses all datalog queries for its finders
13:49bitemyappdanneu: there's a lot in day-of-datomic that isn't a good idea.
13:49TEttingerctrl-c I believe is... a challenge for JVM apps to grab, because it sends a signal to the JVM if I'm reading this right
13:49bitemyappdanneu: we had to replace the "maybe" function from d-o-d because it was really slow.
13:51seangrovetechnomancy: lynaghk was working on something pretty relevant for that a few months ago. Not sure it every panned out though
13:51myguidingstarTEttinger, interesting
13:51llasrammyguidingstar: I think what technomancy is getting at is that someone (maybe you) should write a generic higher-order file-watcher task, which accepts another task to run when things change
13:52technomancyseangrove: yeah, pretty much every time anyone mentions it in the channel I tell them to do it the right way instead
13:52llasrammyguidingstar: So there only needs to be file-event->lein integration once, then you can automatically reuse that for any existing or future task + plugin
13:53myguidingstarllasram, oh I didn't get it. You're right
13:53cemerickxeqi: none at all, has been a long-term TODO
13:54cemerickxeqi: actually, eval'ing namespaced keywords in CLJS over piggieback probably doesn't work right now, because that move to tools.reader hasn't happened
13:55xeqicemerick: heh, glad I haven't had to use namespaced keywords yet for my projects then
13:56xeqiwill try and write up a patch in a few days, is required for repl source info through piggieback
13:56cemerickxeqi: nice; the error gets swallowed silently, even :-P https://gist.github.com/cemerick/ec873e84115fc6e83f6a
13:57cemerickxeqi: definitely, much appreciated :-)
13:57bitemyappORM caching destroying my sanity again. Thanks Python.
13:58danneubitemyapp: some sort of datomic cookbook would be nice to bridge the gap between d-o-d and, for example, independently arriving at "oh, i should use d/datoms for dumb lookup"
13:58danneumaybe you can attract brambling contribs by dispersing cookbook tidbits of insight among its docstrings
14:00bitemyappdanneu: it would be nice if my company wasn't the only one using Brambling.
14:01bitemyappreiddraper: incidentally, one of Nodejitsu's earliest founders (since forced out?) is a complete psychopath that threatened to shoot me.
14:02bitemyappdanneu: a Datomic cookbook is a good idea. I'd only consider putting one together if I could get a publisher interested and the blessing of the Coggies.
14:02danneubitemyapp: ive started using it B-)
14:02seangroveDamnit, I can't get paredit to turn on automatically with cider.
14:02bitemyappthere's a lot I have yet to explore with Datomic, particularly there's a huge set of unknowns operationally that I'd like to experiment with but haven't had the time or hardware to poke at.
14:02reiddraperbitemyapp: wow, not the response from that tweet i was expecting… that's disturbing
14:03bitemyappin particular, I'd like to test some sharding strategy ideas.
14:03bitemyappreiddraper: the more you know *------
14:04cemerickxeqi: an issue FWIW https://github.com/cemerick/piggieback/issues/19
14:04bitemyappdanneu: I'm glad you're using it. Next feature I'd like to make happen is differential migrations. Should only require swapping out the "source", sinking should be identical but sans schema injection.
14:04coventryseangrove: I have (add-hook 'clojure-mode-hook 'paredit-mode) in the emacs configuration I use to test cider.
14:04coventryseangrove: Works for me.
14:05seangrovecoventry: You use clojure mode in the cider repl?
14:06technomancyseangrove: won't paredit break if you have repl output that includes unmatched delimiters?
14:06coventryOh, in the repl buffer? I don't have paredit on there.
14:06technomancyI've never actually tried it because the repl buffer contains a lot of stuff that isn't code and thus isn't guaranteed to match
14:06seangrovetechnomancy: Hasn't been a problem for the past year so far, no
14:06technomancyhuh
14:07coventryHmm, I should try that. I've definitely missed it there.
14:07seangroveI can't find the right place to add the hook to turn it on automatically though
14:07coventryI can't currently turn it on, though, because the buffer has mismatched parens. :-)
14:07llasramtechnomancy, seangrove: I find it breaks occasionally and I need to wipe the REPL buffer, but it's not usually a big deal
14:08seangrovellasram: That's possible I suppose, I just haven't had it happen enough that it comes to mind at all
14:08danneubitemyapp: what if it was just a brainstorm-centric bitemyapp/datomic-cookbook
14:09dotemacstalking of parenthesis I use smartparens and have it turned on globally, no issues, in repl or elsewhere
14:09danneua place accumulate morsels and bulletpoints if nothing else
14:10hiredmanI tried smart parens and found it to be a huge hassle, it didn't seem to be as smart about things like different types of quotes as paredit
14:10coventryI'm getting "text is read-only" when I try to wipe the repl buffer. Anyone know what could be causing that/how to deal with it? toggle-read-only doesn't fix it.
14:10hiredmanand didn't try as hard to keep the document well structured
14:10seangrovehiredman: Yeah, paredit seemed to be quite a bit nicer.
14:10seangrovecoventry: C-c M-o?
14:10llasramcoventry: Try the command `cider-clear-buffer` (or `nrepl-clear-buffer`)
14:10bitemyapphiredman: Emacs Live has a good smartparens Clojure config.
14:10hiredmanevery time I typed ` it would match it, which drove me nuts in clojure
14:10bitemyapphiredman: you have to have a custom config that distinguishes things like ' and ` from "
14:10coventryThanks, guys. C-c M-o did the job.
14:11bitemyapphiredman: https://github.com/overtone/emacs-live/blob/master/packs/dev/clojure-pack/config/smartparens-conf.el
14:12bitemyapphiredman: I use smartparens because it's more flexible I favor the behavior over how paredit works.
14:12bitemyappparedit is too restrictive.
14:12seangroveDamnit, just can't get it http://dl.dropbox.com/u/412963/Screenshots/4t.png
14:12dotemacsregarding the PDF form filling using clojure question I asked yesterday (in case that you care): wrapped up iText and it works well
14:13technomancysmartparens seems like a toolkit for building a mode that does what you want, rather than something that Just Works out of the box
14:13bitemyappseangrove: ouch, Cider?
14:13bitemyapptechnomancy: which is why you can use the Emacs Live config to get something intelligent for Clojure out of the box...
14:13seangroveProbably enough time trying to automate this for today
14:13coventryseangrove: Try cider-repl-mode-hook rather than cider-repl-mode.
14:14hiredmanwhich would be great if a mode was what I wanted, I guess
14:14seangrovecoventry: That was the one, thank you
14:16bitemyappseangrove: that's a general pattern too, *-mode-hook
14:16seangrovebitemyapp: Yes, my fault for not paying attention. Nice to have others around to sanity-check :)
14:16coventryGlad it works for you. It causes my nrepl to hang during startup. :-) ("lein repl" works at the CL, though.)
14:17bitemyappI don't understand people that use nrepl-jack-in.
14:17seangroveI use it exclusively
14:17bitemyappI want a persistent nrepl server with a port for each project I work on, not stuff bound to my Emacs session.
14:17bitemyappmy Emacs sessions have shorter life spans than my nrepl servers.
14:17technomancybitemyapp: all your projects in one server? huh?
14:17bitemyapptechnomancy: no, I use a separate server and port for each project.
14:17seangrovebitemyapp: I have the opposite experience - my emacs sessions tend to go for weeks at a time
14:18bitemyappseangrove: I do things that kill my Emacs regularly.
14:18technomancyyou monster
14:18seangrovehahaha
14:18coventryThat must be hell for your workflow.
14:18bitemyappcoventry: well, I'm an idiot and I do dumb things when I work with large datasets.
14:19bitemyapp`cbp: tell 'em. I'm a dummy.
14:19seangrovebitemyapp: Yeah, I suppose if I was working with data that constantly threatened to kill emacs, I would want something like a separate nrepl server
14:19`cbpindeed.
14:19coventryOh, yeah, that's happened to me. Helps a lot to send output to a file, but it's easy to forget that.
14:19danielszmulewiczSo for you guys who run long-standing emacs sessions, I have the following question: M-x b shows me a whole lot of buffers from different projects. What is your solution?
14:20bitemyappcoventry: streaming output + tail -f == sanity retained
14:20seangrovecoventry: Yeah, I think that's one of the worst parts of the emacs integration - the fear of accidentally killing everything
14:20bitemyappdanielszmulewicz: fuzzy-search in my buffer lists.
14:20bitemyappC-x b
14:20bitemyapp+ IDO
14:20bitemyapp+ iswitchb
14:21coventryThere's a tool for opening a file within a git project. I haven't had much need for it yet, though.
14:21technomancydanielszmulewicz: I have a separate emacs instance per project
14:21bitemyappseangrove: that's like 90% of the reason I keep separate nrepl servers. large data killing my Emacs.
14:21danneudanielszmulewicz: i use https://github.com/bbatsov/projectile to flash between projects. using whatever buffer command from projectile can just show the buffers related to the project that contains the current buffer
14:21hiredmandanielszmulewicz: what is the problem?
14:21bitemyappI've had nrepl sessions that lagged Emacs so badly I had to finish my work in the terminal.
14:21technomancybut I keep the emacs instance running for as long as I'm hacking the project
14:21technomancybitemyapp: M-x nrepl-restart?
14:21danielszmulewiczI would like to filter the buffers per project, so that M-x b shows only relevant buffers
14:21bitemyapptechnomancy: I can try that next time it happens.
14:22technomancybitemyapp: only works if you jack-in, I think
14:22seangrovetechnomancy: That's crazy talk. I have one emacs server, and a bunch of emacsclient -t's
14:22technomancyseangrove: I like my namespacing
14:22danielszmulewicztechnomancy: Oh, interesting, I like fast startup so I run a daemon
14:22technomancyI don't want to accidentally switch to an email buffer when I'm hacking lein
14:22bitemyapptechnomancy: oh well fuck it then.
14:22bitemyapptechnomancy: I'm not doing that. :P
14:22technomancydanielszmulewicz: with package.el and autoloads it's pretty trivial to get subsecond launch times
14:23bitemyapptechnomancy: I kill my Emacs and reconnect it to the same nrepl session, that resolves the lag usually.
14:23seangrovetechnomancy: Understandable. I tend to keep the window layout pretty sparse, and push most of the data management stuff into emacs
14:23technomancybitemyapp: no would killing your nrepl repl buffer and reconnecting
14:23bitemyapptechnomancy: that too
14:23technomancy*so would
14:23danielszmulewiczdanneu: projectile-switch-to-buffer?
14:24bitemyapptechnomancy: I've done both.
14:24bitemyappdanielszmulewicz: I have 375308 LOC in my ~/.emacs.d/, Emacs takes ~3-5 seconds to start.
14:24bitemyappdanielszmulewicz: I also have 8719 lines of Python.
14:25bitemyappthe 375k is just Lisp.
14:25danielszmulewiczI think projectile should push its buffers to speedbar.
14:25danielszmulewiczSome modes do that kind of interop with speedbar
14:26danneubitemyapp: what kind of yakshaving have you got going on in 375308
14:26danneulines
14:26seangroveClearly LightTable is the answer here.
14:26bitemyappdanneu: Find out for yourself, but the answer is a long history of vendoring and customizing things (many years) github.com/bitemyapp/dotfiles/
14:26danielszmulewiczI tried workgroups2 but that didn't work out
14:27seangrovewat
14:27b-otseangrove: any idea what the 'proper' way to display a flash object on a website is that gets passed throuhg w3c?
14:27bitemyappseangrove: yes I can't wait for Chris to single-handedly replace everything I use Emacs for.
14:28seangrovebitemyapp: He's got a lot of work ahead of him, hope he's waking up early these days.
14:29danielszmulewicztechnomancy: how many instances of emacs do you end up running simultenously?
14:30technomancydanielszmulewicz: seven right now
14:30technomancythree of which are over tmux+ssh
14:30seangroveo_O
14:30seangrovetechnomancy: Are you OSX? How do you keep them straight?
14:30technomancyseangrove: haha. no.
14:30rasmustotmux editor sessions are the best
14:31bitemyappseangrove: well, point being, his current focus is good. He can't/shouldn't attempt to replace every little thing people use an editor for.
14:31technomancyit's just xmonad. easy. ¯\_(ツ)_/¯
14:31bitemyappseangrove: XMonad is my favorite thing about working on Linux at home.
14:31bitemyappeasily.
14:31seangrove😥
14:31technomancyseangrove: all my work stuff is done as a separate unix user for compliance reasons
14:32danielszmulewiczI like stumpwm. Stays in the family.
14:32technomancyso I have two instance for email, one for IRC+IM
14:32seangrovetechnomancy: Sounds like a pretty sane setup, actually.
14:32technomancyseangrove: yeah, the separate user thing works out better than I expected
14:32seangroveI'll eventually have to make time to setup a xmonad-capable machine
14:33technomancyconkeror for regular browsing and x-forwarded chromium for work stuff
14:34technomancyseangrove: also I keep the hacking emacs instances apart by using a separate color theme for each.
14:34danielszmulewicztechnomancy: That setup running on your 4 year old thinkpad? :-)
14:34technomancydanielszmulewicz: yeap
14:34danielszmulewicztechnomancy: awesome
14:35technomancyit's great
14:35rasmustot420?
14:35rasmustoer, 400?
14:35hiredmant1000
14:35technomancyrasmusto: X200s
14:35rasmustotechnomancy: ah nice. I have an x220 myself
14:36technomancyrasmusto: can't bring myself to buy a low-res model =\
14:36technomancyholding on to this one for dear life
14:36rasmustoI know, that's my only real complaint, aside from the squeaky expansion slot
14:36technomancythat's the last one with the classic keyboard though, right?
14:36rasmustoat least there are plenty of 11pt px-mapped fonts. Yes, classic keyboard
14:36technomancynice
14:37seangrovetechnomancy: Separate color schemes sounds like a good idea as well. Might be worth trying out some time.
14:37rasmustowell, except for the control/fn nonsense, but I use caps for control anyways
14:37danielszmulewicztechnomancy: the tmux instances must be teminal emacs, the others you run in X or also in a terminal?
14:37technomancydanielszmulewicz: mostly in X, though there's not much difference between the two in my setup
14:38technomancyjust having access to the X clipboard instead of the tmux clipboard primarily
14:39rasmustohiredman: t1000-carbon-chiclet?
14:39bitemyappjust got to show a coworker (into {} (map vector ...)) and (frequencies ...) - feeling brilliant :D
14:39seangrovebitemyapp: Be sure to show them group-by as well, one of my favorites
14:40coventryThe page for xmonad is not really selling me on it. What's nice about it?
14:40hiredmant1000's are a mimetic poly-alloy
14:40bitemyappseangrove: they've already seen that, it's in the Tardis codebase.
14:40bitemyappcoventry: it's advanced alien technology.
14:40technomancycoventry: difficult to explain. it just works perfectly and does everything right.
14:41coventryHeh, "It's not stupid, it's ADVANCED!" I'll give it a go.
14:41technomancyI'm used to tweaking my setup endlessly, but xmonad pre-empts that by just reading my mind and doing what I want
14:41rasmustois this as good as frequencies? ,(into {} (map (fn [[k v]] [k (count v)]) (group-by identity [:a :a :b :c])))
14:42rasmustoexcept being harder to type ofc :P
14:43technomancycoventry: one cool thing is that you can change workspaces of individual displays independently
14:43rasmustoI can't quite grok the assoc!/transient thing in the frequencies impl
14:43technomancycoventry: takes a bit of getting used to, but is definitely a superior model
14:43justin_smithyeah, I like the workspace per display thing
14:43justin_smithand full screen also being per display
14:44`cbprasmusto: read up on transients then :P
14:44rasmustotechnomancy: awesome3 lets you "tag" windows to multiple workspaces, so you can have a single thing in multiple places
14:44rasmusto`cbp: aw, ok :)
14:44technomancyrasmusto: yeah, that was one thing I liked about wmii. in practice I never used it personally.
14:44bitemyapprasmusto: (into {} (for [[k v] (group-by identity "abbbc")] [k (count v)]))
14:44justin_smithI actually switched to notion, because I like having absolute control of window layout independent of app instances (yes I know that is weird), but I miss xmonad features and may just hack the behavior into xmonad one of these weekends
14:45coventryrasmusto: You get the same result as if you hadn't used transients, but it's faster in some circumstances because assoc! is bashing a data structure in-place.
14:45bitemyappI actually think the transients implementation is pretty elegant.
14:45justin_smithcoventry: is allowed to, but not guaranteed to :) you still need to use the return value of the transient op
14:46rasmustoOkay, reading the transient rationale (and "tree falling in the woods" thing) cleared it up :)
14:46dnolenbitemyapp: it's also pretty novel, I'm not aware that they exist elsewhere - certainly nothing in the literature
14:47danielszmulewicztechnomancy: If you ever going to try stumpwm, you might want to take a look at this: https://gitorious.org/dss-project/stumpmacs/source/1a2d69f20f0843fce5c5213a539824020786ad27:
14:48bitemyappdnolen: Context please?
14:48dnolenbitemyapp: transients
14:48bitemyappdnolen: they most certainly exist in Haskell, in a much richer variety and forms.
14:49bitemyappdnolen: that's part of the whole point of the ST Monad among other things.
14:49dnolenbitemyapp: link?
14:49dnolenbitemyapp: yeah not even remotely the same thing
14:49coventryHmm, xmonad causes emacs to run off the screen. I'll play with it more later.
14:50bitemyappdnolen: http://hackage.haskell.org/package/vector-0.7.0.1/docs/Data-Vector.html
14:50bitemyappdnolen: data freezing (after building from something mutable but hasn't escaped a monadic scope) is very common.
14:50dnolenbitemyapp: the novelty around transient is specifically taking Ideal Hash Tries and wrapping the nodes w/ edit markers so you can do O(1) conversion to and from in
14:51dnolenbitemyapp: yes that's the simple idea - not what is novel about Clojure implementation of PersistentVector/HashMap Transients
14:52bitemyappdnolen: that's getting incredibly implementation specific.
14:52bitemyappthe point was that the concept of building something mutably and freezing it into something immutable is a thing in Haskell.
14:52dnolenbitemyapp: that was my whole point - you said implementation
14:52danielszmulewiczIs there a manual somewhere for clojurebot? Don't want to bother anyone with basic usage questions.
14:52dnolenbitemyapp: I'm not saying that isn't common in Haskell
14:53bitemyappSee, the nitpicking, this is why I cringe everytime you ask me to elaborate on something.
14:53bitemyappbecause I know invariably you're going to keep digging until you've got something you can contradict me with.
14:54tbaldridgebitemyapp: It can be good to welcome such interactions, can help you learn
14:54dnolenbitemyapp: heh don't worry, I won't. I thought you were making a specific point about how elegant they are - and I agreed, and I'm not ware that the idea has been done elsewhere where Ideal Hash Trie data structures are available.
14:55bitemyapptbaldridge: there's no learning here, I was talking about a different aspect of what I saying Haskell offered (freezing mutable data or containing/scoping side effects)
14:55bitemyappdnolen: I don't think it's out of the question that unordered-containers in Haskell could implement the same thing. It just doesn't matter because when people are solving this general category of problem they use monads/unsafe/freezing.
14:56bitemyappdnolen: the reason it doesn't exist in that exact form is because comparable solutions exist, my point was that comparable solutions exist. Most languages outside of Clojure and Haskell don't have this in any form at all.
14:56danielszmulewiczlazybot, I meant.
14:57dnolenbitemyapp: look, I know this - I just thought you were talking about how cool the Clojure implementation is all and that other people should copy it :)
14:57danielszmulewicz$help
14:57lazybotYou're going to need to tell me what you want help with.
14:57bitemyappdnolen: unsafeFreeze on MArray in Haskell is a non-copying O(1) as well.
14:58`cbp$help me
14:58lazybotTopic: "me" doesn't exist!
14:58danielszmulewicz,$help entry
14:58clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: $help in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:58danielszmulewicz$help entry
14:58lazybotTopic: "entry" doesn't exist!
14:58TEttingerdanielszmulewicz, yeah I made my own commands command for my lazybot
14:58TEttingerit sends like 5 messages...
14:58danielszmulewicz,commands
14:58clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: commands in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:59danielszmulewiczTEttinger: what do I type?
14:59dnolenbitemyapp: but do you get O(1) unsafeThaw, that is the point
14:59TEttingerhttps://github.com/flatland/lazybot/tree/master/src/lazybot/plugins you go here for now...
14:59danielszmulewiczTEttinger: thanks
14:59TEttingerbecause that bot isn't on this server
14:59TEttingerlazybot and my roguebot have diverged a bit
14:59TEttingerI last checked out in may
15:00bitemyappdnolen: yes.
15:00danielszmulewiczTEttinger: what's running here?
15:00TEttingerlazybot and clojurebot
15:00TEttingerI copied an older lazybot
15:00danielszmulewiczTEttinger: OK
15:00bitemyappdnolen: the unsafe thaw and freeze are non-copying O(1) for multiple types of arrays.
15:00danielszmulewicz,cmd
15:00clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: cmd in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:00TEttingeradded a bunch of features, maybe i did some poorly
15:00coventryTEttinger, is lazybot yours? For some reason, I thought it was Raynes's.
15:00TEttingeryou can /msg lazybot
15:01TEttingerno not mine
15:01TEttingerit is Raynes
15:01TEttingerRoguebot is mine, but it's on Quakenet only (that hive of scum and villainy)
15:01bitemyappdnolen: literally the only thing missing is the specific combination of unordered-containers + O(1) non-copying freeze/thaw. Which most Haskell users don't care about (unordered-containers)
15:01Rayneslazybot would be the combined consciousness of a Raynes and an amalloy_.
15:01dnolenbitemyapp: unsafeThaw makes no such guarantees based on the documentation, must be provided for by the underlying implementation
15:01bitemyappThey usually use more specialized collection types.
15:01dnolenbitemyapp: http://hackage.haskell.org/package/array-0.3.0.2/docs/Data-Array-MArray.html
15:01seangrovecoventry: I think it's actually a feral bot
15:01coventryHeh. Where's the power cord???
15:01lazybotcoventry: Oh, absolutely.
15:02coventryOh dear.
15:02bitemyappdnolen: it...is...implemented...
15:02bitemyappdnolen: did you look at the types provided for?
15:02TEttingerand Raynes is the man, if it weren't for lazybot I would still be messing with painful stuff to get my own bot running and featureful
15:03dnolenbitemyapp: anyways we're going into the weeds, unsafeThaw doesn't guarantee anything - anyways my point is only the implementation of transients and their novelty - moving on now
15:03TEttingermoving onto cats
15:03TEttingerhttp://i.imgur.com/Bmb9P.jpg
15:04bitemyappdnolen: the guarantees are part of the type system, not the runtime implementation
15:04bitemyappdnolen: Haskell decomplected safety from runtime behavior >:)
15:04bitemyappTEttinger: they're eating my soul
15:04dnolenbitemyapp: the doc string for unsafeThaw is scary, we must be reading different things
15:05bitemyappdnolen: you're expecting to understand what the IO and ST monad are doing for you.
15:05TEttinger(inc Raynes)
15:05bitemyappexpected*
15:05lazybot⇒ 37
15:07seangroveWow, "Iran Facts" is advertising on youtube. This can't be a good thing.
15:08bitemyappsaw a tweet recently, "I wonder how Iran will react when they find out they can't keep their health insurance plan?"
15:08TEttingerIran "Facts"
15:08mattmossIran fax
15:08TEttingerIron fox
15:09bitemyappdnolen: everything in Haskell, including the mutable data types, is designed around equational reasoning. Even Oleg will abandon a line of investigation that cannot maintain that property.
15:09seangroveWow, the 2 minute scaremongering ad ends with a huge bomb explosion and says we need to protect ourselves.
15:09seangroveLovely.
15:09dnolenthe safety of unsafeThaw/Freeze http://www.haskell.org/pipermail/glasgow-haskell-users/2005-November/009235.html
15:09bitemyappseangrove: didn't we win the Cold War with blue jeans and Coca Cola?
15:11bitemyappdnolen: yep, anything with unsafe* or acme-* at the beginning is a Bad Idea (TM) unless you know what you're doing.
15:11bitemyappacme is typically a bad idea even when you do.
15:12coventrybitemyapp: That sounds a lot less handy than the "just add bangs to everything and it'll work the same, but faster" deal you get wiht transients, though.
15:12bitemyappcoventry: there's a continuum of solutions in Haskell to that general problem, you just have to choose your preferred balance of safety and performance.
15:14bitemyappcoventry: another difference is that the general attitude is that if the type system can statically verify the safety of the code, that the compiler output produces something that uses mutability isn't very important.
15:14coventrySo what on that continuum corresponds to the safety and performance of transients?
15:15bitemyappcoventry: almost anything that uses a mutable data structure inside of ST.
15:15bitemyappI say almost because you can certainly do things that crash, but that's pretty easy to avoid by not using the "scary" packages.
15:17bitemyappcoventry: having an optimizing compiler with very high-level (monadic) static type information means you can get away with some interesting optimizations while maintaining safety.
15:19bitemyapphaving access to unboxed value types is really nice too.
15:20bitemyappyou can pass the equivalent of struct A { int a; }; around.
15:40iKillCypherb
16:12seangroveSometimes the cljs repl just freaks out and consumes 700% cpu across all cores.
16:14winkis there some sort of goto auth/user framework/lib for webapps? more like django than noir
16:16dnolenseangrove: browser REPL or are you talking about piggieback?
16:16dnolenseangrove: or both?
16:17seangrovednolen: piggieback/austin/cider, somewhere in there. I just kill it and restart everything right now. Not sure how to track it down other than at the process level.
16:17TEttingerwink: I've heard of friend a few times
16:18winkthx
16:18TEttingerhttps://github.com/cemerick/friend
16:18dnolenseangrove: I wonder if this is memory related?
16:19coventryTEttinger, wink: That's specifically for auth, though, whereas it sounds like wink's asking about a django-style framework.
16:19winkcoventry: no, just a little more laid out than libnoir/bare
16:20coventryCool.
16:20sritchieseangrove: I think it's related to ac-nrepl
16:20sritchiethere was a friend bug about that
16:20sritchieerr, a cider bug
16:21dnolenwink: http://www.luminusweb.net? also http://let-caribou.in
16:21bitemyappdnolen: luminus doesn't really have an auth library.
16:21bitemyappdnolen: you just implement your own.
16:21bitemyappI have no idea if caribou does or doesn't.
16:21dnolenbitemyapp: you can't just add some middleware?
16:21bitemyappdnolen: that's our attitude towards it.
16:22bitemyappdnolen: We don't really like the existing auth libraries and don't consider it a particularly difficult problem.
16:22winkexactly
16:22dnolenbitemyapp: got it
16:22bitemyappwe just show people an example and let them take it from there.
16:22winkwell I haven't had the energy to come up with those few lines
16:22winkI wanted some plug-and-play thing for the few small apps I have
16:24bitemyappwink: if you're that lazy, copy-pasta from neubite or Luminus.
16:24bitemyappwink: https://github.com/bitemyapp/neubite/blob/master/src/neubite/middleware.clj#L35-L44
16:24winkbitemyapp: thanks
16:24bitemyappwink: provide the "get-user-by-email" functionality and toss a :user-email into the session (encrypted)
16:25bitemyappwink: https://github.com/bitemyapp/neubite/blob/master/src/neubite/handler.clj#L49-L51
16:25bitemyappthat's the middleware for the encrypted sessions
16:25bitemyappall told, 5-10 LOC
16:25winkwoo *frantically writes down links*
16:27bitemyappfor how small it is, I get a lot of mileage out of pointing people to Neubite for web stuff.
16:31gunsDoes anyone object to telling new users to install :user :dependencies as "LATEST" or "RELEASE"?
16:32coventryThat sounds handy, actually. Do you need to specify anything in your project.clj file for that to work?
16:33gunsNo, it's just a maven keyword AFAICT
16:33coventryThanks.
16:34technomancyguns: as long as it's a dev or user profile only thing it's not bad
16:34gunsI'll be sure to point that out
16:35gunsI'm recording a slamhound screencast, actually
16:35technomancyoh, the other thing is it'll trigger a check for an update every 24h
16:35technomancyso that could get annoying
16:35seangroveWow, cool to hear guns
16:35gunsI see
16:35technomancylooking forward to the screencast =)
16:35gunsMaybe I won't bother the
16:39coventryIs the clojure compiler thread-safe in the sense that it can safely compile multiple forms in simultaneous threads?
16:42lnostdalnot in my experience .. e.g. defonce vs. the same `name` is not thread safe
16:43coventryGood point. Thanks.
16:50alexyakushevHello friends, I've just created #clojure-android IRC channel and will try to hang there periodically. If you have questions too instant to come to mailing list, feel free to ask on the channel
17:48srrubyI have a small module that uses a template which it loads from disk. Is it better to NOT load the template in the module? If not then how? The reason I ask is that loading the template uses IO and I understand that it is better to code with pure functions. https://gist.github.com/rothfield/7667730
17:51typeclassysometimes it's "better" to code with "pure" functions, but i really don't think you're going to have much trouble loading a single template from a file
17:51bitemyappsrruby: I already added a comment about one possible improvement. I don't see anything else wrong with it given the provided context.
17:52bitemyappsrruby: more context would tell me more about what to improve.
17:52srrubyThanks all!
17:52bitemyappsrruby: pure functions when you can, when you can't, whatevs.
17:52bitemyappsrruby: the way to split it out is to separate the lilypond stuff from the resource/slurp invocations so that it just takes a string.
17:57srrubybitemyapp: Thanks. I guess it is a good rule to do IO stuff in main.
17:58bitemyappsrruby: uh, not "main"
17:58bitemyappsrruby: just separately.
17:58bitemyappsrruby: I try to separate IO into actions/providers that feed into the pure code.
17:59bitemyappsrruby: makes the both bits of code more reusable.
17:59srrubyok
18:00bitemyappsrruby: don't make a religion out of anything though. one-off code is what it is.
18:02pmonksSpeaking of religion - should I be concerned that we have 666 members right now? o.O
18:02pmonksDOH - riley526 spoilt my observation!
18:03riley526pmonks: hah
18:03riley526no more need for concern.
18:03pmonks(phew)
18:03pmonksOH NOES!!!!
18:05bitemyappsrruby: to maintain "easy" you can wrap the IO stuff and pure stuff with an outer layer.
18:06danneuIs there a simpler way to select a map based on a key value? (first (filter #(= 3 (:thing/idx %)) all-things))
18:07srrubybitemyapp: OK.
18:17hyPiRiondanneu: (first (for [{elem :thing/idx :as m} all-things :when (= 3 elem)] m)) ?
18:18bitemyappI never use for. I feel like I'm missing something therer.
18:18bitemyappthere*
18:20rasmustoisn't that the same thing?
18:20hyPiRionsemantically the same, sure.
18:21rasmusto(some (fn [{elem :thing/idx :as m}] (if (= 3 elem) m)) all-things) works too, yea?
18:21technomancybitemyapp: it's great for nested loops
18:22bitemyapptechnomancy: I just write horrific artifacts of my time spent in Python and CL that are nested map/filter/reduce.
18:22bitemyapptechnomancy: so instead of a single for clause, I'll have like 4 or 5 of those babies.
18:23technomancybitemyapp: for most things, ->> with map+filter is fine
18:23rasmustomy only wish for "for" is that you could do (for [:let [a 'foo] b (range)] [a b)
18:23technomancybut ->> with a nested map gets ugly fast
18:23bitemyapptechnomancy: I don't ->>
18:23bitemyapp(((((( :lol :die ))))))
18:23technomancywell then I don't even know what's wrong with you
18:23bitemyapptechnomancy: Common Lisp and Python. That's what.
18:23justin_smithI have a config storage that can have atoms in it, and has a special case for embedded atoms so they can be swap!'d or reset!'d rather than being replaced in the parent map
18:23rasmustodo you -> bitemyapp ?
18:23TEttingerpfffffft. you only wish you could be using hundreds-of-character regexes as part of a (map read-string ...) https://dl.dropboxusercontent.com/u/11914692/class-formatter.clj
18:24bitemyapptechnomancy: the limitations of single-expression lambdas warped me.
18:24technomancybitemyapp: they have recovery programs for that
18:24technomancywell, tehy should
18:24bitemyapprasmusto: oh I do use -> and ->>, it's just that for this specific instance, when I'm building up what would ordinarily be a list comprehension I'll just accumulate and nest map/filter.
18:24justin_smithif I want a client to be able to use an avout distributedAtom, but don't want to add a distributedatom dependency, what is the best way to make that modular?
18:24bitemyapppeople still use Avout? Sweet!
18:25justin_smithis there a better option? it seems nice so far
18:25rasmustobitemyapp: ah, okay. I feel like I use ->> about half the time, depends on how much I care about individual elements, or if I do partitioning/destructuring
18:25JDShuis there a goto solution for user management for clojure web applications?
18:25justin_smithI mean I guess I could add avout as an unconditional dependency of my lib, but leaving it modular would be nice
18:26bitemyappjustin_smith: uh not really. I'd like a high-performance Mnesia'ish data store for Clojure but Avout is all we have atm.
18:26rasmusto,(for [[a b] (partition 2 1 (range 10))] [a b])
18:26clojurebot([0 1] [1 2] [2 3] [3 4] [4 5] ...)
18:26bitemyappjustin_smith: maybe Spacebase's stuff?
18:26bitemyappor Immutant.
18:26bitemyapp'ish
18:26TEttingerJDShu, this happened to be asked not long ago. http://let-caribou.in http://www.luminusweb.net https://github.com/cemerick/friend
18:27rasmusto,(->> (range 10) (partition 2 1) (fn [[a b]] [a b]))
18:27clojurebot#<sandbox$eval81$fn__83 sandbox$eval81$fn__83@13e043>
18:27rasmustoah well, you get the point
18:28JDShuTEttinger: I found friend through a search, would you say that's pretty much it?
18:29TEttingerI don't do web dev in clojure yet, caribou might be an alternative?
18:30JDShuTEttinger: alright, thanks :) I guess I'll try using friend for now
18:30TEttingerit seems to be well-supported
18:31TEttingerfriend questions are certainly more frequent than caribou ones in here
18:31JDShuawesome, thanks for the context!
18:33technomancyargh "performant"
18:35TEttingertechnomancy, I never know if performant is a word or not
18:35technomancyTEttinger: I don't want to get into the "not a word" debate
18:35technomancyactually
18:35TEttingeryou're not a word
18:35typeclassyi have over thirteen years of experience in web application performancy
18:35technomancyhere we go https://mobile.twitter.com/aphyr/status/403596006211604481
18:36justin_smithwait, how would caribou replace friend? as a caribou dev that proposal sounds odd at first glance
18:37technomancyjustin_smith: do you have the power to replace s/performant/efficient/ on the caribou homepage?
18:37justin_smithI do!
18:37justin_smithI'll consider that, thanks
18:37technomancysweet
18:38technomancyI like the logo
18:38justin_smiththanks
18:38justin_smithwe have some good designers here
18:40justin_smiththe answer to my above question turns out to be: implement a protocol, have an avout extension of the protocol, so that avout can be injected by a user of the lib but someone who does not need avout (or wants mongo or immutant for coordination instead) can avoid the avout dep
18:40justin_smithI think
19:08justin_smithtechnomancy: pr submitted, with any luck we should see the change in the next deploy of the site
19:08justin_smiththanks again for the suggestion
19:08technomancy\m/
19:09technomancyI have a (pretty short) list of words I can't read without cringing, and that is on it.
19:09technomancyalong with "utilize", "webinar", and "ask" as a noun
19:10brehauttechnomancy: i hesitate to query this, but how can ask be a noun
19:11technomancybrehaut: happy to hear the madness hasn't spread to your locale yet
19:11technomancy"Let me look over the document and I'll send you a list of my asks." - an actual human, not joking
19:11brehauti just died a little
19:11technomancygrown ups say this
19:12technomancyin 'murikka
19:12brehautis this the same category of grownups who communicate via .ppt files rather than plain text?
19:12brehaut(likely the same category that bemoan text messaging as destroying language)
19:12technomancyI believe there's some correlation
19:20hyPiRiontechnomancy: that's a strange abuse of the word ask. I guess they meant 'requests' in that context?
19:21technomancyyeah, I don't understand it
19:22technomancylanguage evolves, but I would prefer it to evolve in ways that make sense, like maybe *finally* adding a plural "you" to English which has been bereft for bloody centuries
19:24Bronsatechnomancy: that would be *great*
19:24justin_smithtechnomancy: clearly the word you are looking for is all-y'all
19:24brehautis y'all singular now?
19:24brehautwait
19:24brehautbrain fart
19:24justin_smithbrehaut: depends on dialect
19:24dsrx"y'all" can be singular or plural
19:24dsrxmuch like "you"
19:25dsrxbut unlike "you all"
19:25technomancy._.
19:25pmonksPretty sure it's singular in TX.
19:25brehautthats it. im never visiting america
19:25justin_smithall-y'all is unambiguous though
19:25pmonksall y'all is plural
19:25pmonks(in TX)
19:25brehauthow long till all y'all is signular again, and you have to use all all y'all
19:26brehautin some ridiculous peano number style greating
19:26justin_smiththe deplurality treadmill
19:26brehauts/ea/ee/
19:26justin_smithnot nearly as fun as the dysphemism treadmill
19:26technomancybrehaut: with a preliminary handshaking phase to determine which enlgish version is active
19:27justin_smithoh, handshaking, in that case the Texans will love it
19:27technomancyI honestly don't see what's wrong with https://en.wiktionary.org/wiki/yous
19:27hiredman"sup" "hello" version mismatch
19:27brehauttechnomancy, hiredman: nicely done
19:29technomancyhttps://en.wiktionary.org/wiki/Wiktionary:List_of_protologisms_by_topic/third_person_singular_gender_neutral_pronouns
19:30technomancythat's quite the list
19:32amalloyone of my math professors love to talk about all-yall, and so on. his favorite was yins
19:36technomancyso... I'm thinking of how cool it would be to support rich content types in nrepl
19:36technomancyso you could have operations that returned jpegs or SVGs
19:36technomancyor html or whatever
19:38amalloytechnomancy: doesn't hiredman have something like that?
19:38hiredmanI have lots of things
19:38technomancyis this awesome? [Y/n]
19:38dsrxlol, peano number style greeting
19:39technomancyhiredman: you had a gui repl thing, right?
19:39Wild_Cattechnomancy: kinda like IPython Notebook? That'd rock.
19:39hiredmanseveral, and I had a pr for session to use nrepl, and this clojruescript browser scratchpad thing
19:39technomancyWild_Cat: I haven't used IPython, but DrRacket and Factor do a great job at this
19:40Wild_Cattechnomancy: http://ipython.org/notebook.html
19:40technomancyI want someone to write a monitoring endpoint that can return SVG graphs
19:40technomancyfor load and memory usage
19:40hiredmanthe thing with content types is you get, you know, a hunk of xml data that is svg
19:40Wild_CatI saw a presentation or two at Pycon, and it blew my mind
19:40Wild_Catnow all I have to do is find reasons to use it :p
19:40technomancyWild_Cat: right; why shouldn't that be built-in to nrepl?
19:40hiredmanwhere I think something like the reader tags would be better
19:41hiredman#chart/rows [[1 2] [3 4] [5 6]]
19:41technomancyhiredman: how do you do content negotiation then?
19:41Wild_Cattechnomancy: other than "because it runs in a console widget", I have no objections. In fact, it'd rock.
19:41technomancyWild_Cat: yeah, you would need graceful degradation
19:41Wild_Catif anything because it'd finally rid ourselves of the abomination that the Windows console widget is.
19:41justin_smithtechnomancy: regarding the idea of making something like schmetterling as an nrepl middleware, would that mean using that middleware in the debugged process, or the debugging one? some combo?
19:42justin_smithI think bitemyapp had some input on this too
19:42technomancyjustin_smith: it would belong on the project process
19:42technomancythe debugee
19:43hiredmantechnomancy: the idea is not to do content negotiation
19:43justin_smithso instead of stopping the debuggee and poking at the halted process, you leave it running and...
19:43technomancyhiredman: ah, so the server is unaware of the client's capabilities
19:43hiredmantechnomancy: #chart/rows [[1 2] [3 4] [5 6]] is data and readable even if you don't know what #chart/rows is
19:44hiredmanyou can get the vector and fiddle with it
19:45hiredmanI dunno, there are some trade-offs with that approach as well, but it is currently what I am thinking I will do for my current pass at computational documents for clojure
19:46hiredmanI'll need to replace pr with a protocol display, that by default gives you "#display/pr-str <result of pr-str escaped as string>"
19:46technomancyhiredman: yeah, that puts a lot more logic in the client, which I'm less fond of
19:46hiredmanso the client will edn/read everything to get back whatever to render
19:46technomancyright now you don't need a reader to be an nrepl client
19:46technomancyplus I don't know how you'd support things like the inspector offering hyperlinks
19:47hiredman#display/html
19:47justin_smithtechnomancy: re s/performant/efficient - just got merged
19:47technomancyhiredman: but many clients can't do anything with HTML
19:47hiredmantechnomancy: yeah, well I have the luxary of using clojurescript as the client, so I don't have a reader
19:48hiredmantechnomancy: how do hyperlinks work in your scheme?
19:48hiredman#display/link
19:48hiredmanerr
19:48hiredmanI do have a reader
19:48hiredmaneven with the ability to send back content types from nrepl
19:48hiredmanhow do you do it?
19:49hiredmanyou have to replace the pr whatever nrepl middleware with an nrepl specific thing that can transform the data in to some representation and content type to send back
19:49technomancyhiredman: bunch of HTML with <a href="/myop?k=v">stuff</a>
19:49technomancy^ actually got that working at the conj
19:50hiredmanwell, yeah, that is the samething as what I said with #display/html
19:51hiredmanmy plan is on the client side I'll have the tag display/html return something that can render the html has a child when given a dom node
19:51technomancyexcept you're putting it all in the :value key, yeah
19:51hiredmanso things come off the wire knowing how to render themselves in my little document
19:56mmgis there a way to do this? (map quote [a b c]) = ['a 'b 'c] ?
19:57Bronsammg: if you think about it, that doesn't make sense
19:57technomancymmg: only in the context of a macro
19:57coventrymmg: You mean pull out the symbol names and stick them in the compiled code? The dbg macro does something like that.
19:57technomancyin normal context [a b c] is evaluated before map gets called
19:58coventryOr if that's not what you mean, '[a b c] may meet your purposes.
19:58mmgtechnomancy, I am indeed trying to do this in the context of a macro, it's.... an evil anamorphic macro, I realize this isn't really the clojure way
19:59coventrymmg: Look at &env and &form
19:59mmgwill do, thank you coventry
20:13amalloymmg: i rather doubt that the proposed solutions are really what you want, even in the context of evil. perhaps you would get better guidance if you gave an example of how you want your macro to be used and what it would expand to
20:16mmgamalloy, it's a deep rabbit hole.... I've been reading Let over Lambda from Doug Hoyte and trying to recreate what he's doing in clojure
20:16technomancyuh oh
20:16amalloyblugh
20:16mmgok I'll stop ;)
20:17amalloymost of the macros in that book are really neat for common lisp and terrible for clojure
20:17mmgyes but climb every mountain right?
20:17amalloybut you shouldn't need &env or &form for any of them that i can recall
20:17technomancyas an exercise, maybe. just don't subject anyone else to hoyte-inspired macros =)
20:17mmgit's just for fun
20:18mmgit's this problem (defmacro foo [x] `(* ~x ~x))
20:18amalloytechnomancy: with-cxrs was a fun one to implement in clojure
20:18mmgif x is some function it evaluates twice
20:19mmgthat's what I was trying to solve
20:19justin_smithmmg: the common answer there is to put a let binding in the macro
20:19Bronsammg: this is what you want: `(let [x# ~x#] (+ x# x#))
20:19Bronsaduh `(let [x# ~x] (+ x# x#))
20:19amalloysee how you get a much better answer when you give your actual problem rather than a partial solution you've thought up, mmg? :)
20:20mmgwell it sounds alright for this case
20:20mmgbut I was looking at (defmacro!....)
20:20mmgfor the arbitrary case
20:20mmgso (defmacro! ) will return a quoted (defmacro...)
20:20amalloymmg: defmacro! is a common-lisp solution to the problem that clojure's auto-gensyms already solve better
20:21amalloyif you wanted to do it using only tools that hoyte has available, you could (let [m (gensym "x")] `(let [~m ~x] (* ~m ~m)))
20:22mmggot it, thank you
20:24justin_smithis it totally gauche to name my protocol in all lower case?
20:24amalloyyes
20:24justin_smithcool, glad I asked
20:24justin_smiththe code works lower case, but it occured to me it may get in the way of comprehension
21:55danneuhttp://stackoverflow.com/questions/2685435/cooler-ascii-spinners
21:59egosumWhat are people using/should use to run web apps which need to do a lot of HTTP requests (and other blocking calls) on the server-side of things? http-kit? jetty with core.async?
22:00danneugonna make people's jvm boot worthwhile to watch my app work
22:01danneuegosum: core.async is really fun to use for that
22:02egosumdanneu: fun as in "won't make you hate yourself because you chose node for a MVP?" or another kind of fun?
22:03justin_smithegosum: you can make your requests parallel easily with http-async.client https://github.com/neotyk/http.async.client
22:03justin_smithor yeah, use core.async
22:04justin_smithalso a smart caching layer (as apropriate) can do wonders
22:04egosumYes, I was looking at http.async.client, as well as http-kit (as well as core.async). They all look very nice (though I'm leaning toward core.async). I was wondering if people might have experience (or know of posts regarding said experience) using them in production?
22:04justin_smithnow if your requests are stateful (ruling out caching) and semantically serial (ruling out parallelization of requests) then get a server in the same data center your services in and cross your fingers ?
22:05egosumCaching for sure, but these are wildly dynamic requests I"ll be sending out; users will determine them
22:05egosumjustin_smith: if only :)
22:05egosumjustin_smith: I'm working on networked finite state machines as a server :)
22:05egosumservice*
22:05egosumso they can send out requests to other APIs as you transition states
22:05justin_smithwell core.async turns normal looking code and turns it into a fsm
22:06egosumessentially, they're a way to tie together existing APIs with state
22:06justin_smithwell, if you are signing up to implement state, good luck with that :)
22:06egosumjustin_smith: well, essenially every business application implements a finite state machine
22:07egosumwhich describes their business process
22:07egosumessentially*
22:08danneui use https://github.com/ztellman/aleph for tcp stuff
22:08justin_smithfrom what I hear aleph has nice conceptual abstractions but isn't the choice if you have performance bottlenecks
22:09amalloyaleph has great performance
22:09justin_smith oh?
22:09justin_smithok, I heard wrong
22:09danneualeph offers great things right out of the box
22:11justin_smithhttps://github.com/ptaoussanis/clojure-web-server-benchmarks based on this chart, I would not choose aleph if I had performance bottlenecks
22:11amalloyTBH, the great conceptual abstractions are the hard part. after working with aleph/lamina for almost a year it basically makes sense to me, but when first starting with it the new ideas are pretty confusing
22:11justin_smithit could be that chart is wrong
22:13danneuamalloy: yeah, i agree and i'm new to it. however, i find it easier to fake it til i make it with aleph's higher level tools than the newbie issues i floundered with in core.async. like rolling my own introspection tools
22:13justin_smithactually the comparison of http-kit and nginx on there makes me a little skeptical - but if it is true that is awesome
22:13bitemyappjustin_smith: slowness is almost always in the application stack anyway.
22:13lnostdalegosum: http-kit has been excellent for me .. simple and to the point; does exactly what it needs (http) .. personally i prefer it to e.g. aleph
22:13bitemyappjustin_smith: we use http-kit, really happy with it. very low overheard. It's not magical though.
22:14justin_smithright, you always have to look for the weakest link performance wise
22:14justin_smiththe thing that really blows my mind on that chart is how bad tomcat is
22:15bitemyappjustin_smith: that bit didn't surprise me at all.
22:15justin_smithinteresting
22:15bitemyappjustin_smith: http://www.techempower.com/benchmarks/ in case you wanted corroboration of the http-kit numbers.
22:15bitemyapphttp-kit is why I keep telling people not to use fucking dynamic vars.
22:15bitemyappyou can't use http-kit if you use dynamic vars. not safely.
22:16egosumis http-kit being actively developed?
22:17bitemyappit's maintained but it's essentially done
22:17justin_smithbitemyapp: yeah, I remember you mentioning that about dynamic vars
22:17bitemyappjustin_smith: *grumble grumble*
22:17egosumdanneu: so using core.async is pretty rough around the edges right now?
22:17bitemyapppet peeve.
22:17bitemyappegosum: core.async is fine to use, there's just not a shake-n-bake way to make it the driver of your web stack.
22:17bitemyappI'm not utterly convinced it should or needs to be.
22:18bitemyappI'd use core.async + http-kit if I needed asynchronous processing in a web app.
22:18bitemyappoh cool, raw WAI is faster than http-kit. How nice.
22:18egosumbitemyapp: http-kit async?
22:18justin_smithjust barely
22:19bitemyappegosum: http-kit is async
22:19bitemyappjustin_smith: yeah but look at yesod.
22:19egosumah, the chart made me think there was a sync version as well
22:19bitemyappjustin_smith: Yesod does some weird fucking shit.
22:19bitemyappegosum: they're talking about their handler, not http-kit itself.
22:19egosumah, got it
22:19egosumit almost seems too good to be true; no more callback hell?
22:19egosumno more promise bullshit?
22:19egosumlovely
22:19justin_smiththat is what core.async is for
22:19bitemyappit's not too good to be true. This sort of niceness exists in other languages too.
22:20bitemyappjust not very many.
22:20egosumbitemyapp: I know, CSP and all. I'm mostly being dramatic; getting fed up with Node, though it's given me the opportunity to make some cool hacks and thrash the stack.
22:20bitemyappThe cool kids async club is basically restricted to Akka users (kinda icky), Erlang, Go, Clojure, and Haskell.
22:20bitemyappegosum: I really hated writing code for Node.js
22:20justin_smithegosum: you can do CSP on node, thanks to cljs :)
22:20bitemyappit was less productive than Python
22:20egosumbitemyapp: it was fun for a bit, but yes, i found python more productive
22:20bitemyappGolang was less productive than Python too.
22:21bitemyappClojure was faster *and* more productive than Python.
22:21egosumI was writing node code entirely functionally, as much as possible anyway
22:21egosumClojure is the most productive I've been
22:22justin_smithyes, clojure is definitely a high-developer-productivity language
22:23justin_smithespecially once you figure out the workflows / concepts that match its impedence
22:23justin_smith(so to speak)
22:38uvtcIs there any way to copy a file out of a project's resources directory? Or can you only read files from there (and write them out if necessary)? Currently, I see that I can do:
22:39uvtc`(let [content (slurp (io/resource "the-file.whatev"))]`, then `(spit "the-file.whatev" content)`.
22:39justin_smith(spit "/path/to/dest" (slurp (io/resource "relative/path/to/resource"))) maybe?
22:39bitemyappuvtc: you can read the contents of resources into memory or stream it out somewhere else.
22:39bitemyappspit/slurp will load the whole thing into memory
22:39justin_smithtrue
22:39uvtcRight. Ok. Thanks. For my case, it's a small file, so slurp/spit is fine. Thanks for the info.
22:40bitemyappjustin_smith: probably one of the major changes I've made in the last year of programming professionally is I default to laziness/streaming/async-safety by default more often.
22:40bitemyappit's made my stuff more reliable ^_^
22:40justin_smithcool, I am gradually going that way
22:40bitemyappwell, I default when it's a production thingy
22:41bitemyappobviously I don't care when it's a one-off script.
22:41justin_smithI changed our image resizer so it can resize from the asset bucket to the asset bucket - next step is doing it without needing the whole thing to be in ram
22:41bitemyappahhh always the tricky part :)
22:41uvtcbitemyapp, so, just curious, how would I do it lazily? If I just wanted some lines, with possibly needing more (up to the end of the input file)?
22:41bitemyappuvtc: most people just use the vanilla Java streaming interfaces.
22:41bitemyappsame stuff you use for Files, Sockets, etc.
22:42justin_smithwould io/copy do it without the whole thing in ram?
22:42bitemyappbut don't do this if you don't need to.
22:42bitemyappjustin_smith: depends on the type of the input.
22:42uvtcHm. Not something with line-seq?
22:42bitemyappjustin_smith: https://github.com/richhickey/clojure/blob/8c9b0574a83f6c77576325b724c837cf4143eb33/src/clj/clojure/java/io.clj#L368
22:42amalloyslurp/spit isn't a good idea for binary files
22:43amalloynothing that converts to strings is, so that rules out line-seq too
22:43justin_smithtrue enough
22:43amalloyjust use streams and io/copy or something
22:43bitemyappI've abused base64 way too much for this.
22:43bitemyappuvtc: io/copy will do what you want as long as you pass it the Stream, not a string.
22:43bitemyappor the File handle
22:44uvtcbitemyapp, Ok. Trying io/copy, since that seems to be closer to what I want.
22:44uvtcbitemyapp, thanks.
22:48uvtcOh. Nice. This worked: `(io/copy (io/file (io/resource "my-file.whatev")) (io/file "my-file.whatev"))`
22:48justin_smiththat (io/file (io/resource)) part will fail if you deploy in a jar
22:48justin_smithtry io/input-stream instead of io/file
22:49bitemyappuvtc: the concept of a "file" is loosey-goosey in a jar.
22:50justin_smithbitemyapp: IllegalArgumentException Not a file: jar:file:/media/justin/806084F16084EEEA/m2/repository/clojure-complete/clojure-complete/0.2.3/clojure-complete-0.2.3.jar!/project.clj clojure.java.io/fn--8522 (io.clj:67)
22:50uvtcbitemyapp, works. Thanks.
22:51uvtcbitemyapp, (works when the app is uberjar'd too. :) )
22:51justin_smithit's not loosey-goosey in a jar, it just plain doesn't work
22:52uvtcjustin_smith, thanks for the help.
22:53justin_smithnp
23:06bellkevjustin_smith: If you have a second, I'd love to get your opinion on this topic: https://groups.google.com/forum/#!topic/clojure/BNIdWCehEAI That's the project that was the source of my various newbie questions the other day...
23:06bellkevSomeone on that thread pointed out an interesting library, prismatic/schema, for doing validation-ish stuff
23:07bellkevIt looks pretty cool, though it kind of reminds me of JAXB with its abundance of classes...
23:19sm0keisnt someone rewriting emacs in clojure
23:19sm0kewould be very cool
23:23echo-areaHi sm0ke :)
23:23sm0keheh hello
23:24justin_smithhey bellkev
23:25echo-areasm0ke: I think you meant this: https://github.com/hraberg/deuce
23:25bellkevhey
23:26sm0keecho-area: nice
23:26sm0kebut i think the dev has given up already
23:27justin_smithsm0ke: there are many rewrite-emacs-in-better-language projects
23:27justin_smithcommon lisp, haskell, scheme, and now I guess clojure
23:27nightflylets write emacs in bash!
23:27sm0keemacs in viml?
23:28sm0kehahah insane
23:28justin_smithsm0ke: only if you get enough compatibility to make evil mode work
23:28Apage43https://github.com/tpope/vim-rsi gives you some of the keybinds ;)
23:30sm0kehmm the problem with vim is its customizable by a a chosen few
23:30justin_smithbellkev: my opinion of macros is that they should only be used when needing a macro to leverage it is an acceptable cost
23:31justin_smithwith functions, you can easily compose them with other functions - with many macros that breaks down
23:31justin_smithso if your tool will be utilized by or in conjunction with other tools, relying on macros can cause frustration
23:31Raynessm0ke: Or anyone who takes a few hours to learn just enough to write a Python plugin to do what they want :P
23:32bellkevYeah, that's what I've gathered to be the prevailing opinion in the community
23:33bellkevI think for sure my approach will do all the heavy lifting with plain functions/values, but I think it would be nice to have a way to tie the whole thing (for a "template") into one "package"
23:34justin_smithdeftemplate would be OK if it is just a thin wrapper on (def X (make-template ...)) and make-template accepts a reasonable data structure
23:34sm0keRaynes: i dont think its that easy, vim scripting is doomed like pythons GIL. And both together are match made in hell.
23:35bellkevLike, in the latest revision of the gist (https://gist.github.com/bellkev/7653342) the middle section, which is all values and functions, I feel like it's a trillion times more readable/writable than standard JSON CloudFormation templates
23:35Raynessm0ke: Well I did it.
23:35Raynessm0ke: https://github.com/Raynes/refheap.vim
23:35bellkevHowever, I really like the idea of packaging things in one "deftemplate"
23:36bellkevThe thing I'm wrestling with right now is basically, is it okay to have nested defs (or lets) inside my macro, so that vars/symbols introduced in part of the macro body can be used elsewhere...
23:36sm0keRaynes: may be you are the chosen one :D
23:37sm0kemay be i should look into viml once more
23:38bellkevFor example, in the ns macro, if you introduce a namespace with a :require directive, it's available later in a :use directive
23:39bellkevThat's the kind of behavior I'm going for, but I know that ns is kind of special and that :use is deprecated...
23:39justin_smithbellkev: in the normal ns macro they are totally independent of one another - or am I missing what you are saying?
23:39amalloyi think he's just confused about how ns works
23:41bellkevMaybe I am confused by how ns works.... I thought that you could only :use something if it was already in a :require, but that's not the best analogy anyway... I believe this slide: http://www.slideshare.net/cgrand/dsl-5537797/21 from a conj talk really gets at what I'm wondering about
23:41bellkevThat slide, and the slide after it, seem to address the pros/cons of introducing new variables or manipulating symbols in macros, but I'd like to see more discussion of that same topic...
23:42justin_smithhe is showing a pattern for farming out most of the macro to functions
23:43justin_smithone function that extracts the bound names, the other extracts their values
23:44justin_smithseeing keywords instead of symbols is confusing in the final part of your gist - keywords are meant to be self-evaluating (stand for themselves)
23:45bellkevOkay, I get that part. I guess what I'm wondering is, what kind of syntax is it acceptable to use to introduce new lexically scoped variables into your macro?
23:45justin_smithwell, macros are for when you need a new syntax, so that is really a question that depends on your domain
23:45bellkevOkay, I was wondering about the keyword thing too... I stole the idea from here: http://www.slideshare.net/cgrand/dsl-5537797/39
23:46justin_smiththat is showing how you can avoid using a macro
23:46justin_smithsince that is already a valid clojure data literal
23:46justin_smithand nothing needs escaping
23:47justin_smithbut if you need to bind things, don't use a keyword for the target of the binding
23:48bellkevOkay, that all makes sense, let me whip up one more example to make one more point
23:51amalloybellkev: if you're looking for examples, https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L108 is probably the only justifiable anaphoric macro i've written in my clojure career
23:52amalloyi'm not following the discussion closely, so this may not be entirely relevant
23:53bellkevHere's an attempt to clarify, what kind of syntax should be used if I DO want to bind new symbols within the body of my macro? https://gist.github.com/bellkev/7670855
23:54bellkevBut thanks, amalloy, I'll check out that link
23:55justin_smithbellkev: that is definitely more readable - I can differentiate keywords that stand fora themselves from bindings that refer to some prior definition
23:55bellkevThe thing with this macro I'm working on, is that it's used to generate data (JSON), but that data represents a kind of mini-program that executes in the context of an AWS CloudFormation stack, with an order of execution, inputs/outputs, some scope rules, etc
23:57justin_smithbellkev: if you let bindings sit outside the defining form, that could just be a long let statement
23:57justin_smithie. (mapping my-mapping :first-level-key-one ...) -> my-mapping (mapping :first-level-key-one ...)
23:58justin_smithand that could be the clue to the function that helps you implement the macro
23:59justin_smithbut imho being able to specify the bound thing inside the form defining it has very low utility compared to the overhead of remembering to read it that way
23:59justin_smithunless of course we are replicating something in the domain that makes it clearer