#clojure logs

2014-04-29

00:00cbpI used it once to implement logging levels as an example
00:00cbpand that's the only time
00:00Jaoodegghead: arrdem: I hear zippers follow the transients philosophy too
00:00arrdemJaood: the issue with macros is that most of the time functions will do where people may traditionally reach for macros and as macros are meaningless at runtime (what is map of a macro? what is the value of a macro?) they aren't worth it.
00:00eggheadzippers! lenses!
00:00eggheadliving life to the fullest
00:01eggheadJaood: most of the ideas are actually simple, they just have scary names
00:01Jaoodarrdem: got it
00:02cbplenses?
00:02arrdemJaood: that's not to say I haven't written macros, it's just that macros are reserved for doing funky syntax extension tasks that a function _can't_ do.
00:07amalloyi used multimethod hierarchies twice at geni. one was on closed-source code that wasn't terribly interesting, and the other seems to have been replaced or removed, but i think it was part of cake or one of cake's supporting libraries (uncle maybe?)
00:10Jaoodarrdem: you mean DSLs?
00:10arrdemJaood: a lot of "dsl"s can be done with just datastructures and functions...
00:10arrdemJaood: macros are for when you need a syntax extension that genuinely writes defs or something else crazy
00:11Jaoodso macros are not that favored as in the CL world
00:12cbpturns out having syntax for more than one datastructure removes most of the need of macros for DSLs :-P
00:12arrdem(inc cbp) ;; truth hurts
00:12lazybot⇒ 4
00:12arrdem$karma `cbp
00:12lazybot`cbp has karma 3.
00:12arrdemcbp: tut tut
00:13Jaoodcbp: are you referring the unified abtractions over the clojure collections?
00:13Jaood*to
00:14Jaoodis the reference documentation on clojure.org normally up to date?
00:14arrdemJaood: he's referring to the fact that we have reader syntax for more than just lists.
00:14arrdem,#inst
00:14clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
00:14arrdem,#inst "now"
00:14clojurebot#<RuntimeException java.lang.RuntimeException: Unrecognized date/time syntax: now>
00:15arrdem,(type :foo)
00:15clojurebotclojure.lang.Keyword
00:15arrdem,(type {:foo :bar :baz 9001})
00:15clojurebotclojure.lang.PersistentArrayMap
00:15arrdem,(type [1 2 3 :foo {:baz :bar}])
00:15clojurebotclojure.lang.PersistentVector
00:15arrdemand of course
00:16arrdem,(type '(1 2 3 4 :foo bar cojure.core/cons))
00:16clojurebotclojure.lang.PersistentList
00:16Jaoodyou missed one
00:16Jaood,(type #{1 2 3 4})
00:16clojurebotclojure.lang.PersistentHashSet
00:16Jaood:P
00:16cbpdocumentation online is rarely up to date
00:17arrdem:P there's sets and there are some other reader lits too.. there's even a way to do user defined reader types
00:17cbpyour best friends are clojure.repl/source, clojure.repl/doc and clojure.repl/apropos and some other function i forgot the name of
00:17arrdemcbp: juxt?
00:18cbpns-publics i think
00:18amalloyarrdem: i found my use of defmulti hierarchies! it was in depot, which contained the pom-generating stuff that cake used: https://github.com/ninjudd/depot/blob/develop/src/depot/pom.clj
00:19amalloyit's not super-compelling, since all it does is eliminate the repetition of treating ::dependencies as a list of ::dependency and ::repositories as a list of ::repository
00:20amalloybut i had in mind that idea that the pom task would have to be extended to include more stuff
00:32arrdemthoughts on tweaking the meajure reader lit so that (= #meajure/unit [2 :feet] #meajure/unit [2 :feet 1])?
00:37arrdem,(let [θ₀ (/ Math/PI 2) θ₉ (/ Math/PI 4)] (- (* -1 (Math/cos θ₀)) (* -1 (Math/cos θ₉))))
00:37clojurebot0.7071067811865475
00:42myguidingstarhi all, is it possible to run lein tasks inside current project-local nREPL?
00:43arrdemlein != nrepl
00:44TerranceWarriordo you people use slime or cider for emacs? what about vim, is fireplace.vim the end all of interactive repls or quasi thereof?
00:45arrdemfireplace is the be all end all, slime is depricated in favor of nrepl.el or cider.el
00:45arrdembelieve me, fireplace is better than what came before :P
00:47TerranceWarriorarrdem: i will take your word for it! :)
00:48arrdemTerranceWarrior: nrepl.el still totally works, it just isn't being actively developed anymore. be careful with cider and what emacs repository you install from, nightlies of cider are notoriously likely to be broken and suck hours of dev time to repair.
00:49technomancyclojurebot: melpa?
00:49clojurebotIt's greek to me.
00:49technomancyclojurebot: melpa is not what you want.
00:49clojurebotAlles klar
00:49Frozenlo`I went back to nrepl after trying cider
00:50arrdemI've been using cider successfully, but I couldn't tell you what's different besides the name :P
00:55myguidingstartechnomancy, is it possible to run lein tasks using *current* project-local nREPL session?
00:55technomancymyguidingstar: sure, try setting :eval-in :nrelp
00:55technomancy*:nrepl
00:56myguidingstarwhat about running lein task inside REPL, something like (lein ...)
00:57technomancymyguidingstar: you can do that with grenchman
00:57technomancybut you need a separate repl session for that
00:57technomancylein has to be isolated from your project to run
00:58myguidingstartechnomancy, yeah, the msg "launch `lein repl :headless' from outside a
00:58myguidingstarproject directory" from grench confused me
00:59technomancymyguidingstar: what's confusing about it?
01:01myguidingstartechnomancy, I thought I can't reuse curent project-local nREPL session for lein tasks (as my first question)
01:02technomancyoh right; that's correct
01:02technomancysorry
01:02technomancywell
01:02technomancysome tasks run project code
01:03technomancythose tasks can run that project code inside the existing repl session
01:03technomancybut the actual task itself can't run inside there
01:03TerranceWarriorarrdem: ok, so don't cross the streams. thanks arrdem.
01:04myguidingstarso some tasks will work, and some don't?
01:04technomancymyguidingstar: what specifically do you want run in the existing repl?
01:04technomancymyguidingstar: do you understand the difference between things like `lein run` which run project code vs `lein clean` which don't?
01:05technomancyyou can never run a task itself inside a project repl, but you can tell a task to run *its* project code inside an existing repl rather than starting a new JVM
01:08myguidingstartechnomancy, so what's `:eval-in :nrepl` for? Those like `lein run` or `lein clean`?
01:09technomancymyguidingstar: it's for `lein run` type tasks
01:10myguidingstargot it, thanks a lot technomancy
01:12technomancynp
01:14TerranceWarriorany of you working in play-clj?
01:20amalloy~anyone
01:20clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
03:21szymanowski(clojurescript): what does this error means? WARNING: my-ns/my-fn no longer fn, references are stale
03:41vijaykiranwell that was new - getting spam from id's here
04:01kevinwebsterIs there a way to hack on a project source quickly with clojure and lein? Something analogous to Ruby bundler's :path option in the Gemspec (for any ruby people)?
04:02vijaykiranI'm not familiar with Ruby stuff - what kind of workflow are you looking for ?
04:03TEttinger"lein try" has been mentioned before, a plugin
04:05kevinwebsterThis may not be idiomatic in clojure, but in ruby if I wanted to "play around" with a dependency (gem) I would clone the source and then include the root directory of the source in a specific way. After that I could change things in the dependency's source and see the results in my project
04:07kevinwebsterwould a solution be to add the source somewhere in the classpath and then remove it from the project.clj's dependencies?
04:08ucbkevinwebster: lein has checouts
04:08ucbcheckouts*
04:08ucbkevinwebster: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies
04:09kevinwebsterucb: I think that is exactly what I am looking for, thanks!!
04:09ucbnp
04:25brainproxyhmm, when I make a mistake in a cider repl, no error is shown, like its going to another buffer or something but I can't find it
04:25brainproxyrecently upgraded some emacs packages, haven't noticed this before
04:27ucbbrainproxy: I recently upgraded to 0.7.0-alpha
04:27ucbbrainproxy: and had the same thing. I reverted to 0.5.0 and all is well.
04:27ucbbrainproxy: in sum: it didn't quite work for me; unfortunately I wasn't virtuous so I didn't investigate nor filed any bug reports.
04:28ucbbut it is a thing
04:31brainproxyucb: turned out I needed cider/cider-nrepl as a lein plugin
04:31brainproxyin profiles.clj
04:31brainproxythen bounced emacs altogether
04:31brainproxyand all is well
04:32ucbhuh
04:32brainproxyjava 1.8, clojure 1.6
04:32ucbinteresting
04:32ucbI should try that then! :)
04:32brainproxywhat was confusing me was the message i needed cider nrepl installed, but I thought that referred to an emacs pkg
04:32brainproxywhen in fact it refers to a lein thing
04:32brainproxyi.e. the cider-nrepl plugin
04:33brainproxythe message was showing in Emacs messages buffer, amidst other stuff
04:33ucbI got that message too. Did look for an emacs package. Couldn't find it. Reverted to 0.5.0 :)
04:36brainproxyyep, something popped into my head to look in clojars
04:36brainproxyotw, I was about to do the same
05:49luxbock,(case (type "a string") java.lang.String true false)
05:49clojurebotfalse
05:49luxbockwhy does this fail?
05:59mpenet,(doc case)
05:59clojurebot"([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are not evaluated. They must be compile-time literals, and need not be quoted. If the expression is equal to a test-constant, the corresponding result-expr is returned. A single default expression can foll...
06:02luxbockI still don't understand. in my mind case expands to (cond e (= result clause-1) do-stuff (= result clause-2) something), but I guess I'm mistaken?
06:04mpenetClasses are not compile time constants for case, there are a few "improved" case versions out there with their own problems too
06:05mpenetnippy has case-eval and cgrand did something a bit similar I think
06:05pyrtsa,(clojure.walk/macroexpand-all '(case x 1 :one 2 :two))
06:05clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.walk>
06:06pyrtsa,(macroexpand '(case x 1 :one 2 :two))
06:06clojurebot(let* [G__93 x] (case* G__93 0 0 (throw (java.lang.IllegalArgumentException. (clojure.core/str "No matching clause: " G__93))) ...))
06:07luxbockhmm ok
06:08mpenet,(case (type "a string") #=java.lang.String true false)
06:08clojurebot#<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>
06:08mpenetmeh
06:23TEttinger,(case (type "a string") (class "whee") true false)
06:23clojurebotfalse
06:23TEttinger,(print (type "a string") " " (class "whee"))
06:23clojurebotjava.lang.String java.lang.String
06:27clgvTEttinger: the values in a case expression need to be compile time constants
06:27TEttingerah yeah
06:27clgvTEttinger: and lists are interpreted as different options
06:28TEttingerand before you got here we talked about how classes aren't compile time constants
06:28TEttingerI was trying to figure out how to get [03:04;09] <mpenet> ,(case (type "a string") #=java.lang.String true false) to work
06:29clgvTEttingeryou can write a wrapper macro around case which resolves symbols
06:29TEttingersure, it wasn't my problem in the first place
06:29TEttingernippy's case-eval was mentioned
06:40sm0keis there a way to make a function really first class in clojure?
06:40sm0keso every time i define a function it generates a class
06:41sm0kewhich means it can not be passed around in the network
06:42the-kennySo you want to serialize functions?
06:42sm0kefeels like a cheat to say clojure has first class status
06:42the-kennyhttps://github.com/technomancy/serializable-fn
06:42clgvsm0ke: huh why? what's your definition of "first class function"?
06:43sm0keshould be same as values in terms of behaviour when comes to passing around
06:45the-kennyDefine "passing around" then
06:46ucbanybody got experience with slingshot? I'm having a hard time throwing+ a record and then catching it
06:49martinklepschsm0ke, couldn't you just pass it around as edn?
06:49sm0kemartinklepsch: not if the function you define is anonymous and not :aot'd beforehand
06:50ucboh, ignore me, I'm just an arse
06:50the-kennysm0ke: how would you handle a function's environment when passing it around in a network?
06:51sm0kethe-kenny: lets assume there are no closures
06:51rurumateI'm confused. When I define (ns foo-bar.baz) (defrecord Foo) in one project, I can (import [foo_bar.baz Foo]) in another, even without having aot'ed the lib project, right?
06:51TEttingersm0ke: Wat and Kernel have first class everything. they're also dog slow
06:53clgvrurumate: you need to require the namespace otherwise you cant. if you see it working thats due to another namespace requiring that namespace or stale class files which might explode unpredictably in the future
06:54clgvsm0ke: so you mean according to metadata? or do you just want to inspect the function source expressions?
07:03rurumateclgv: I can't get to work reliably, I've even tried without lein
07:04rurumateTo demonstrate, I will push more horrible code in a minute here: https://github.com/methylene/class-not-found
07:08rurumatedone
07:10clgv rurumate: you need to (:require foo-bar.baz) and (:import foo_bar.baz.Foo) - I am not sure if the order makes any difference, you'd have to lookup that in the source. but you are on the safe side if you first require then import
07:11rurumateclgv: that's what I'm doing. have a look at https://github.com/methylene/class-not-found/blob/master/src/class_not_found/core.clj
07:12clgvrurumate: that should work. but you should use the keyword version in ns
07:12rurumatewhy?
07:12clojurebotwhy is Why
07:13rurumateoh why
07:13clgvbecause it is idiomatic to do so and better readable
07:13clgvwhere does record-holder.def come from?
07:14rurumatehmm, ok, I also noticed that using (gen-class :main true) instead of (:gen-class :main true) fails
07:14rurumateclgv: it's from a lein project in lib
07:15rurumateis it me, or is this on-the-fly compilation thing a bit brittle
07:16clgvrurumate: the proper version of your namespace should look like https://www.refheap.com/82895
07:22rurumateclgv: ok, will update it in a few secs
07:22rurumatewhy no :main true in gen-class? is it default?
07:22clgvrurumate: the functions require, use and co are mostly for REPL usage
07:22devurandomHello!
07:22clgvrurumate: yes
07:23clgvrurumate: all my namespaces with -main methods only have (:gen-class)
07:23rurumateit's pushed
07:23devurandomCan someone please point me to the docs for cond-> ? http://clojuredocs.org/search?q=cond-%3E does not give any results.
07:23rurumateclgv: can you start a repl?
07:24clgvdevurandom: there is nothing on this site since cond is clojure 1.5+
07:24devurandomclgv: Is there a more up-to-date documentation?
07:24clgv$(doc cond->)
07:24clgv$doc cond->
07:25hyPiRion,(doc cond->)
07:25clojurebot"([expr & clauses]); Takes an expression and a set of test/form pairs. Threads expr (via ->) through each form for which the corresponding test expression is true. Note that, unlike cond branching, cond-> threading does not short circuit after the first true test expression."
07:25hyPiRioneventually just
07:25hyPiRion(doc cond->)
07:25clojurebot"([expr & clauses]); Takes an expression and a set of test/form pairs. Threads expr (via ->) through each form for which the corresponding test expression is true. Note that, unlike cond branching, cond-> threading does not short circuit after the first true test expression."
07:25clgvdevurandom: do you have an explicite question?
07:25devurandom(Light Table has no docs on it, either)
07:25clgvhyPiRion: confused it with lazybots "source" ;)
07:26clgvdevurandom: the builtin doc string is echoed by clojurebot above
07:26hyPiRionclgv: ah, yeah
07:26devurandomAh, ok. So it is not a general Clojure command?
07:26devurandomAnd still, Light Table seems to have less docs than clojurebot. :(
07:26clgvdevurandom: it is. but clojuredocs.org is very much outdated ;)
07:27clgvdevurandom: you get a printed docstring when you evaluate "(doc cond->)" on your repl that works for all functions/macros
07:27devurandomAnd (doc ...) would normally reference clojuredocs.org?
07:27clgvno
07:27devurandomOr what does "it" refer to in your sentence?
07:27devurandomSorry, I got confused...
07:28clgvdevurandom: (doc ...) displays builtin docstrings
07:28clgv,(doc map)
07:28clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."
07:28clgv,(doc cond->)
07:28clojurebot"([expr & clauses]); Takes an expression and a set of test/form pairs. Threads expr (via ->) through each form for which the corresponding test expression is true. Note that, unlike cond branching, cond-> threading does not short circuit after the first true test expression."
07:28clgvyou'll get the same result on your repl
07:29devurandomWeird. I tried to execute (doc cond->) in LightTable via Ctrl+Enter, and get an error message: "Cannot call method 'call' of undefined"
07:29rurumateclgv: added another update, is this even a lein problem?
07:29devurandomI thought LT would send stuff through the REPL when I press Ctrl+Enter
07:30clgvrurumate: what error do you get exactly?
07:30devurandomMaybe doc is not defined. Maybe because it is actually cljs and not clojure...?
07:31ashish_is there is any way to redifine the function temporary
07:31ashish_is there is any way to redefine the function temporary
07:31clgvdevurandom: ah maybe you need to (require 'clojure.repl) first. on "lein repl" that is done by the frontend
07:32rurumate_clgv: I get some 20 lines of stacktrace when I try a lein repl
07:32ashish_is there is any way to redefine the function temporary
07:33rurumate_can you start a repl?
07:33devurandomIt seems cljs works very different from the standard Clojure you refer to. (require) is also not defined.
07:33clgvrurumate: no not with the clone repo
07:33ashish_is there is any way to redefine the function temporary
07:33ashish_is there is any way to redefine the function temporary
07:33ashish_is there is any way to redefine the function temporary
07:33devurandomBut anyway, now I know how to get a clojure repl: "lein repl".
07:33devurandomashish_: please... stop it...
07:34rurumate_clgv: fI'll be afk now
07:34rurumate_sorry, good, I'll be afk for a while.
07:34clgvdevurandom: clojure does not load the namespace clojure.repl atuomatically anymore. some dev environments do that automatically some dont
07:34devurandomclgv: And regarding your earlier question: No, I do not have an explicit question. I was just seeing this call in example code, and did not know what it does.
07:35clgvdevurandom: conditional threading similar to ->
07:35devurandomYep, thanks to clojurebot I understood it now :)
07:36rurumate_clgv: c u later; here's the actual error: http://pastebin.com/r4bin9Uw
07:36clgvdevurandom: next time just (require 'clojure.repl) and you can use (doc cond->) on your repl
07:36devurandom(I am currently working through the Om tutorial, after I got recommended to use ClojureScript instead of JavaScript to display the data in my simulation.)
07:37clgvdevurandom: oh so thats quite a headstart ;)
07:37devurandomclgv: It seems cljs has no (require) function. Seems the only possibility is to call it from the (ns) definition.
07:37clgvdevurandom: I always recommend to read one of the books to learn fast
07:37devurandomI am currently very far away from any book, I fear. ;) I.e. no easy access to international bookshops.
07:38clgvdevurandom: when developing cljs you should also have a clojure repl as far as I read (I did not use cljs yet)
07:38clgvdevurandom: there are ebook versions of all recent books
07:39devurandomI think cljs implements a subset of clojure, so yes, I would assume I get most of clojure. Will figure it out. :)
07:39clgvdevurandom: otherwise there are several websites (http://www.braveclojure.com/, http://aphyr.com/tags/Clojure-from-the-ground-up)
07:39devurandomclgv: Yes, a PDF might be nice. Any recommendation?
07:39devurandomclgv: Thanks! :)
07:42clgvdevurandom: "Clojure Programming" or "Programming Clojure (2nd Edition)"
07:45ashish_is there is any way to redefine the function temporary
07:46ashish_i wnt to use a new database for testing how it is possible
07:46devurandomclgv: Thanks!
07:47ashish_i wnt to use a new database for testing how it is possible so that it does not effects my original dta base
07:48mpenet,(doc with-redefs)
07:48clojurebot"([bindings & body]); binding => var-symbol temp-value-expr Temporarily redefines Vars while executing the body. The temp-value-exprs will be evaluated and each resulting value will replace in parallel the root value of its Var. After the body is executed, the root values of all the Vars will be set back to their old values. These temporary changes will be visible in all threads. Useful for mockin...
07:48the-kennyashish_: with-redefs. And you might want to take a look at https://github.com/stuartsierra/component
07:50ashish_there is a problem with-redefs i can not call from any function
07:51ashish_<mpenet> <the-kenny> there is a problem with-redefs i can not call from any function
07:51ashish_if i call then it store the value permanently
07:52the-kennyhow are you calling it?
07:56ashish_<the-kenny> i put this in a function (with-redefs [db (fn [] testschema/db-spec)])(db)) and call from any other namespace if i do like this then this function give new value which i stored for temporay every times
07:56grimmulfrOk, this seems to be a wee more active than #clojurescript: I cleaned a project, and now compilation won't make my out
07:56grimmulfr folder with the required files. Any idea why? I don't get any error,
07:56grimmulfr but only thing that gets compiled is the actual js file, and not the
07:56grimmulfr helpers (goog, etc)
07:56grimmulfroops, sorry. copied :(
07:57the-kennyashish_: that sounds strange
07:57the-kennygrimmulfr: what's :output-dir and :optimizations set to?
07:59grimmulfr:output-to "basic-site.js"
07:59grimmulfr :output-dir "out"
07:59grimmulfrthing is, it worked. after I cleaned, it won't recreate anymore
08:00grimmulfrit creates the main js but not the helpers
08:00grimmulfrwell, not helpers, you kanow what I mean. goog :)
08:00the-kennyyes, I understand
08:00grimmulfroptimizations is none (tried whitespace too)
08:01the-kennyashish_: I don't think `with-redefs' has such a fundamental but. Must be something in your code.
08:01the-kennygrimmulfr: never had that happen. No idea, sorry
08:02grimmulfrNo problem
08:09mskoudAnyone know how to insert a background/watermark pdf file into a newly generated pdf using clj-pdf? This does not work: (pdf
08:09mskoud [{}
08:09mskoud [:graphics (PdfReader. (FileInputStream. "background.pdf"))]
08:09mskoud [:phrase "some text"]]
08:09mskoud "testresult.pdf")
08:19clgvmskoud: you could search for itext tutorials for that
08:27mskoudtried google got only java code, nothing about clj-pdf
09:29mskoudAbsolute positioning of text in pdf using clj-pdf?
09:36pandeirois there anywhere the clojure/cljs core.async APIs are documented? the sequence functions analogs particularly
09:36pandeiroor does one just use the source?
09:37voldymanpandeiro: http://clojure.github.io/core.async/
09:42pandeirois (async/map identity [my-chan]) the cleanest way to just copy a channel?
09:43BobSchackpandeiro try using into
09:43BobSchackoops I thought you meant seq onto a channel nevermind
09:44pandeiroBobSchack: np thanks; i thought i had seen an async/copy somewhere but i don't see it in the API now
09:44BobSchackare you looking to split a channel into multiple channels?
09:45pandeiroBobSchack: no i just want a copy of the channel so i can debug without consuming the actual original channel
09:46pandeiromaybe (tap (mult my-chan) (chan)) is what i am after
09:48BobSchackI think that still consumes the original channel it just allow you to split the original channel into multiple channels (ala fan out)
09:49pandeiroyeah, not what i wanted... i will just try map
09:51pandeirohm, that also doesn't work
09:52BobSchackYou want get the data on the channel for debugging and not have actual work happen in the meantime right?
09:53pandeiroBobSchack: exactly
09:56BobSchackokay I don't think you'll be able to do that directly. I have to head out for a meeting but if you ask your question later some of the core.async devs should be around.
09:56pandeiroBobSchack: yeah i am thinking it isn't possible; my bad
09:56BobSchackalso the clojure mailing list is a good place to ask
10:07arrdemyou're quite likely to get an answer there at any rate, it has a somewhat larger reach than this channel.
11:00jcromartieI'm trying to figure out the best way to version our Clojure application
11:01jcromartiewe have regular sprints (2 weeks) and at the end of that sprint we deploy to an alpha environment, and then that build eventually gets promoted to a beta environment, and then eventually to production
11:02jcromartiebut keeping track of things across project.clj, tags, the develop and master branches, etc. is getting hairy
11:03TimMcjcromartie: You might keep separate branches for alpha, beta, and master (production).
11:03jcromartiethat's kind of what I was thinking
11:03TimMcand make sure that every merge to alpha updates a CHANGES.txt file as appropriate.
11:03arrdem$google git flow
11:03lazybot[A successful Git branching model » nvie.com] http://nvie.com/posts/a-successful-git-branching-model/
11:04TimMcThe one thing about this that worries me is not easily knowing which changes have been merged to which branches.
11:04arrdem^ the above is essentially that sort of branching model, using only one layer of dev builds.
11:05jcromartiewhat's the point of CHANGES.txt
11:05TimMcAt work we often just develop against master, but then it's sometimes not clear what features and bugfixes are new since last release.
11:05jcromartiewhy not just git log master..alpha
11:05TimMcjcromartie: ^ see last statement
11:05arrdeman alternative, and what we did at Calxeda, is that each commit starts with the ticket number and only "full patch" commits make it into the alpha/beta/dev branches.
11:06arrdemso it's easy to do `git log` and the first token on each line is the name of the ticket patched by that commit
11:06jcromartieyeah we do that
11:07arrdembut yeah maintaining a CHANGES.txt that tracks all the fixes since last "release" is a good idea, abet an overhead you can probably incur when snapshotting out a "final" alpha/beta/dev tag
11:07arrdemrather than having all devs patch it all the time, which makes merges messy.
11:07jcromartieI don't see the point in a change file vs a good commit log
11:07arrdemjcromartie: it's just a summary that the person who does the release puts together for user convenience.
11:07jcromartieok
11:08jcromartieyou could also have lines in your git commits like "CHANGELOG …" that would help create that file automatically
11:08jcromartiewell anyway
11:08jcromartieI like the idea of a change file for users
11:08jcromartiebut if we have three major environments, having three branches makes sense
11:09jcromartiemuch easier than saying "uh, what's on what server now?"
11:09jcromartieand then "let me go check the hash on the release folder"
11:10arrdempffft "what's the hash on the server", I "fixed" the build system so that we had the hash in our firmware builds -_- "what hash is running on the exhibiting hardware"
11:10arrdembetter bust out the FRU reader and find out...
11:11jcromartie:P
11:20TimMcGit log is not enough for a changelog.
11:20TimMcFor instance, lets say you need to revert some merged commits. They still show as merged, they're in the history -- but at least the changelog has been reverted.
11:21TimMcIt's also different in terms of what it says. A feature may be implemented in the course of three different merges; you might not list debugging commits in the log; doc changes don't need changelog entries...
11:22TimMcAnd the merge conflicts for appending stuff to a log are pretty minimal. If you use a good mergetool like meld, it's a few extra seconds and that's it.
11:28hyPiRionTimMc: should be pretty minimal regardless of merge tools
11:38jcromartiewhat are my options for no-downtime deployments of a Ring app?
11:40clgvjcromartie: a wrapper in front of the real app to be able to exchange the implementation on the fly?
11:40mpenetnginx reverse proxy on 2 instances of the app
11:42jcromartieyeah
11:42mpenetvia http://nginx.org/en/docs/http/ngx_http_upstream_module.html, I think there's an example in the clojars-web repo
11:42jcromartieso how do you handle the swap?
11:42jcromartieah great
11:43jcromartieI'll read into this
11:43mpenetit's described here: https://github.com/ato/clojars-web/blob/46a6525ab9984e6bedb163c4ea14d2a6bac3c6b0/SYSADMIN.md
11:45mpenetthis goes into the details of the process http://p.hagelb.org/clojars-deploy
11:51myguidingstarhi all, what is `:provided` profile in leiningen for?
11:54ispolinjcromartie: Roomkey had a presentation at this year’s Clojure/West about their deployment strategy. Be wraned, it’s pretty involved: https://www.youtube.com/watch?v=vFX6T5oQC7Y#t=1250
11:54jcromartiemaybe it's designed for dependencies that are already available locally to the project or something?
11:54jcromartiecool thanks
11:57nzmyguidingstar: http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
12:00ispolinjcromartie: TLDR: Roomkey spins up a new instance of their app, then cut over first the DB(as in old app is using new db instance), and then the traffic via DNS updates
12:00myguidingstarnz, thanks
12:01jcromartieyeah that seems pretty heavy duty
12:01jcromartiewe'd like to do it on the same host
12:01jcromartienginx might be the answer
12:09jcromartieare there any advantages to using "java -Dfoo=bar …" over an environment variable?
12:09jcromartieI am thinking no
12:10jcromartieespecially considering how env vars work no matter how you run it (via lein or an uberjar or whatever)
12:11technomancyjcromartie: the only difference afaik is you can change system properties at runtime
12:12technomancycan be nice during development
12:12nullptri like that it's explicit, envs can be a bit wonky (shell env differs from system env, for example)
12:14johnjelinekhihi all
12:14johnjelinekhow's it goin'?
12:14johnjelinekhow do I put an anonymous function in a (->?
12:15johnjelinekexample: (-> (http/client {:port 443 :host base-uri :ssl true}) (http/post authorize-uri access-token-handler) (fn [x] (println x) x) (http/end (authorize-body code apikey redirect-uri apisecret)))
12:16johnjelinekbut (fn [x] (println x) x) is an error
12:16johnjelinekI want to just analyze the output as it goes through there
12:17gfredericksyou can do an anon fn with an extra pair of parens around the fn; but your specific use case is easier done with (doto (println))
12:17clgvjohnjelinek: don't. if you really want to use two levels of parentheses ((fn [x] ...))
12:18johnjelinekthe 2nd pair of parens will execute the anon fn?
12:18clgvyes
12:18gfredericks,(macroexpand-1 '(-> x (fn [y] (z y)))
12:18clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
12:18gfredericks,(macroexpand-1 '(-> x (fn [y] (z y))))
12:18clojurebot(fn x [y] (z y))
12:18gfredericks,(macroexpand-1 '(-> x ((fn [y] (z y)))))
12:18clojurebot((fn [y] (z y)) x)
12:18gfredericksjohnjelinek: ^ compare those two
12:19clgv,(require 'clojure.data)
12:19clojurebotnil
12:19clgv,(clojure.data/diff (macroexpand-1 '(-> x (fn [y] (z y)))) (macroexpand-1 '(-> x ((fn [y] (z y))))))
12:19clojurebot[[fn nil [y] (z y)] [(fn [y] (z y))] [nil x]]
12:20johnjelinekI see the diff, it makes sense (I don't know how to read the data/diff though)
12:20gfredericksI don't think the data/diff is a helpful approach for understanding
12:20clgvI was just curious to see whether it helps. but it does not here ;)
12:21johnjelinekdoto does work though :)
12:21johnjelinekthanks!
12:22gfredericksnp
12:22clgvah lol you want print+return^^
12:22johnjelinekbingo
12:22johnjelinekso I can keep on going down the (->
12:22clgvdid miss the "x" due to line wrapp^^
12:23clgvjohnjelinek: that might be interesting for you https://github.com/dgrnbrg/spyscope
12:25johnjelinekinteresting
12:25johnjelinekthanks
12:27coventryjohnjelinek: Use clojure.tools.trace/trace
12:28clgvcoventry: how'd that help in the threading macro?
12:41coventryclgv: With one argument, it does exactly what johnjelinek wanted: (require '[clojure.tools.trace :as ctt]) (-> 1 inc ctt/trace inc) prints out "TRACE: 2".
12:41johnjelinekcool
12:57johnjelinektcrawley: you around?
12:58johnjelinekwhat format do I pass headers into http/get-now?
12:58johnjelinekit's requesting a multi-map
12:58johnjelinekerm, expecting*
12:58johnjelinekcan i not just pass in a vector of k/v pairs?
13:01jcidahoHi. I've got a weird behavour with pr-str. Sometimes when I do (spit f (prn-str {:a "ho"})) f contains {:a ho} as oppose to {:a "ho"}
13:01jcidahowhen I try to reproduce from the REPL the quoted version is put in the file, but at other times in the code it's the unquoted form
13:13jcidahonevermind, some lazyiness * weirdness
13:18coventryAre you actually doing a map literal in the prn-str? I would do something like (def dbg (atom nil)) prior to the suspected code, then (reset! dbg printed-object) (read-string (prn-str printed-object)) to trigger an exception, and inspect @dbg in the repl.
13:30justin_smithcoventry: another trick is (def dbg (atom {})) ... (defn problematic-function [args] (swap! dbg assoc (java.util.Date.) args)) ...
13:31justin_smithtime indexed tracing to introspect from the repl
13:34cbp(inc justin_smith)
13:34lazybot⇒ 38
13:35justin_smitha macro variation of let that returned {:val (what let returned) :bindings {:key-of-binding val ...} would be cool for debugging
13:36justin_smithmaybe there is some internal that already gets this for a let?
13:43amalloyjustin_smith: i don't quite understand what that would look like
13:46johnjelinekgot a question about higher order functions
13:46justin_smithamalloy: I tried to type out what I had in mind but it looks clumsy
13:46justin_smithpoorly thought out at the moment, sorry
13:46amalloyjohnjelinek: you're in luck! HOFs are the answer to all questions!
13:46johnjelinekcan I pass a function to a function and then return the result of that function in the parent function?
13:47johnjelinekhere, maybe a refheap will help
13:48sm0ke,((fn [f] (let [r (f)] (inc r))) (partial inc 2))
13:48clojurebot4
13:48dbaschjohnjelinek: yes
13:48johnjelineknot-fully thought out example: https://www.refheap.com/82957
13:49justin_smithjohnjelinek: yeah, we do stuff like that all the time
13:49sm0kesure can be done, functions are first class values
13:49johnjelinekI either want to treat the hof like a callback or take the stuff that executes in the (fn [response ...) and return that at the end of the function
13:49sm0keexcept when you pass then around wire
13:49justin_smithjohnjelinek: passing in some function that may be conditionally used especially
13:50justin_smithsm0ke: to be fair, only the edn subset of clojure is first class
13:50sm0keyes
13:50johnjelinekso, what do you recommend my my scenario?
13:50justin_smithsm0ke: java objects that are not edn don't pass over the wire either
13:50sm0kefunctions are not serializable, so they are not first class imo
13:50sm0ketruly*
13:51johnjelinekmaybe I could just inline the result instead of calling the hof, that way it would return the data at the end
13:51johnjelinekI'm just not sure how to extract the data from the inner fn
13:51justin_smithsm0ke: as was mentioned above, the problem is closures, they are tricky things to serialize, and they are extremely important to deciding what a function actually means
13:51johnjelinekdoes my scenario make sense?
13:51amalloyjohnjelinek: http/get is asynchronous, yes?
13:52johnjelinekamalloy: yes
13:52llasramsm0ke: Well, functions aren't *data*, but that doesn't mean they aren't first-class
13:52johnjelinekhttp/get has a handler fn as 3rd arity
13:52amalloyso this function, request-data, is actually returning long before the get is finished, so thus before your lambda is even called
13:52johnjelinekand so that gets executed upon completion
13:52grimmulfrCan't be this hard to use clojurescript :(. I'm going nuts here. It feels like everything's alpha
13:53sm0kellasram: how did you solve the function passing for live development for parkour?
13:53amalloyyou're sure you want to take this async function and force it to be synchronous? there's probably a better synchronous primitive if that's the behavior you want
13:53grimmulfrI seem to be doing everything ok, compuiles once, compiles the second time but ohly half the files, no error, yet nothign works
13:53justin_smithgrimmulfr: much of clojurescript is very new
13:53grimmulfrbut it worked :(
13:53grimmulfrI have a project that works, and one that doesn't. same settings
13:53johnjelinekamalloy: I'm not entirely sure ... ultimately, what I'd like to do is pass in a token, a uri for data to fetch, and then pass it to a go-block
13:54johnjelinekthen whenever events in a channel are received broadcast to stuff
13:54dbaschgrimmulfr: maybe you have stale js? have you done a clean?
13:54sm0kecascalog has something weird, which i saw today, it serializes a function which is closure over locals!
13:54johnjelinekwhere the data being broadcast is the response from polling from request-data
13:54sm0kepretty hip stuff
13:54grimmulfrdone all sorts of clean. even started a new project and then manually added everything
13:54johnjelinekamalloy: make sense?
13:54grimmulfrcompiles the js, but not the goog files which I got when I first did it
13:54amalloyjohnjelinek: you don't actually care what this function returns at all, then. you just want it to have a (go ...) in the on-body
13:54grimmulfrnow it compiled goog/base.js, but not deps.js
13:55amalloyadd a channel parameter to the function request-data, and in on-body, write to it with >!
13:55grimmulfrNo error either, which is even more anoying
13:55justin_smithsm0ke: what happens when a different vm tries to access the function, but the locals are from a library that the other vm does not have in the classpath?
13:55grimmulfrAll the examples that I find use ring but I don't want a local server, I just want a html that loads my app.js :-<
13:55amalloyor pass it a function that contains a (go ... (>! ...)), whatever
13:55justin_smithsm0ke: or does it encapsulate every library closed over in the function?
13:55johnjelinekamalloy: yes, I want to have a go on the on-body, but I wanted to make request-data a little more generic
13:56johnjelinekhrm ... maybe I don't need it to be more generic
13:56justin_smithsm0ke: that seems like it would be huge
13:56sm0kejustin_smith: lets just assume all libraries are present everywhere
13:56johnjelinekI was thinking about wrapping request-data in a go-block rather than having the go-block for on-body
13:56dbaschgrimmulfr: not a problem, just navigate to the html page that ring would serve (or create one)
13:56johnjelinekbut the on-body go-block prolly makes more sense
13:56justin_smithsm0ke: that's a really weird assumption
13:56sm0kejustin_smith: thats pretty normal for a distributed system
13:57johnjelinekamalloy: I'll try out some of your suggestions
13:57johnjelinekthanks
13:59justin_smithsm0ke: given assurance that deserialization will happen in an environment that has identical bindings that are visible at the site of serialization, that is kind of cool. But if all code is visible at all hosts, why is the serialized function needed, couldn't you just send the ns and var name and let the other host resolve it?
13:59bizniz98Getting "Exception in thread "main" Wrong number of args (3) passed to: PersistentHashMap". There's something fundamental here I'm not getting...
13:59amalloybizniz98: too many parens
13:59llasramjustin_smith, sm0ke: Since it's specifically for cascalog, it can make the assumption the same libraries are available where the function will be serialized, because the job driver makes it so be
13:59sm0kejustin_smith: yes true, but what if i want to create function on the fly?
14:00amalloyyou have ((x y) a b c) instead of something like (do (x y) a b c)
14:00llasramI'm still not a big fan of the approach as a general solution to delivering Clojure code to distributed systems though
14:00justin_smithllasram: ahh, OK. There is a larger defined system making those guarantees, that makes sense
14:01sm0kehttps://github.com/nathanmarz/cascalog/blob/develop/cascalog-core/src/clj/cascalog/logic/fn.clj
14:02bizniz98amalloy: Thanks! That was it. I went the do route but still wound up with an extra set of parens!
14:02sm0kethough it requires you to use its own `fn` macro
14:04sm0keDid anyone had some insights into how spark framework works, it seems to serialize anonymous functions with closures over local
14:04sm0kei doubt if scala provides that oob
14:04amalloyhuh. does the epl allow cascalog to borrow from technomancy/serializable-fn without attribution and not under epl?
14:04sm0ke:P
14:06technomancyamalloy: no attribution is fine, but you can't take someone else's code and change the license ever.
14:06technomancyassuming it's above the copyright threshold
14:07sm0kehmm then its a problem ? its Apache
14:08amalloytechnomancy: i mean, https://github.com/technomancy/serializable-fn/blob/master/src/serializable/fn.clj and https://github.com/nathanmarz/cascalog/blob/develop/cascalog-core/src/clj/cascalog/logic/fn.clj#L6 clearly have a common ancestor, although they're far from identical
14:08technomancyhaha; they kept the docstring
14:08sm0keyes seems like nathanmarz/serializable-fn was pulled into cascalog
14:08amalloyi know, right?
14:09sm0kewhich is fork of technomancy/serializable-fn
14:09technomancyyeah, that's not legal
14:09sm0kei think technomancy is cool with it?
14:09sm0keor is he? :D
14:09technomancysm0ke: I would be happy to relicense it if they asked
14:10amalloytechnomancy: when you make millions of dollars suing them, i'll take 25% for noticing the infringement, and 33% for contributing lots of the code
14:10technomancysm0ke: I'm not cool with ignoring copyright law
14:10sm0keyes just remeber me for bringing this
14:10koalallamatechnomancy: let me know if you need legal representation. I can find you a lawyer on google
14:10technomancysuch a helpful bunch
14:11sm0kelol
14:13hyPiRiontechnomancy: just file an issue
14:13hyPiRionI guess you knew that already though
14:14koalallamahyPiRion: is that what Oracle told Google? Just file an issue?
14:14cbpwith the copyright office amirite
14:15mdrogali`lol
14:16sm0ketbh, i think its ok, doesnt a community thrives on adapting good code from each other?
14:17sm0kealthough an attribution would have been good
14:17technomancysm0ke: it's not about attribution, it's about following the law
14:18justin_smithsm0ke: and communities get screwed over by code getting relicensed or closed up (see gosmacs and the origins of the fsf / gnu project)
14:21technomancyhttps://github.com/nathanmarz/cascalog/issues/249
14:21amalloytechnomancy: edit to include links to both files?
14:22technomancygood call
14:24sm0kehurm wow
14:25hiredmanugh
14:25johnjelinekamalloy: I'm starting to think I'd like the data to return at the end of my request-data fn
14:25sm0kei dont see how they will fix that without chaning license
14:25johnjelinekmaybe I'm not thinking about it right
14:25hiredmanthe # thing in the code comments is due to print-length and print-level being bound
14:25amalloysm0ke: well, asking technomancy nicely to offer them another license, as he said earlier he would happily do
14:25hiredmansomeone should open an issue with cascalog about that too
14:26johnjelinekmaybe I'm thinking about it too synchronously
14:26hiredmanmaybe I will
14:28grimmulfrnote to self, cljs compiles cljs files, not clj.
14:28grimmulfrffs
14:29grimmulfrI had everything inside my source as a clj, trying to compile to cljs, and a bunch of other stuff mixed in
14:29nullptrgrimmulfr: been there :)
14:29hyPiRionamalloy: or perhaps license that particular part of the project as EPL? I'm not sure if that's even possible though.
14:30amalloyperhaps. i can barely even spell lawyer, so i'm not going to speculate
14:30llasramhyPiRion: IANAL, but the Apache guidelines allow including EPL code as long as the code is in it's own file and notices etc clearly indicate that file is EPLed
14:31llasramI actually pulled+modified the Clojure EdnReader into Parkour recently and had to figure out what seemed to be the best approach
14:32llasramhttps://www.apache.org/legal/resolved.html#category-b
14:32hyPiRionllasram: I wish there were a website with examples on how to handle such things
14:32hyPiRionwere/was, I no English
14:32l1xtechnomancy: why is it a license violation?
14:33l1xbecause he does not display the source of the code?
14:33amalloyhyPiRion: you had it right: were
14:33technomancyl1x: because he took something he didn't write that was EPL-licensed and just proclaimed that it was apache-licensed
14:33justin_smithl1x: he is changing the license terms
14:33l1xoh i see
14:33l1xinteresting
14:34llasramI hereby declare this bacon to be Vegetarian and Kosher!
14:34hyPiRionamalloy: thanks for confirming
14:34technomancyhyPiRion: most native english speakers don't follow the "correct" usage there anyway =)
14:34l1xtechnomancy: what would be the correct action in this case? license the software under EPL?
14:35amalloywell, i think it's simpler than that: EPL says that you can include EPL source into your own programs iff you license it as EPL and don't remove any copyright notices
14:35technomancyl1x: yes, or ask for the code to be dual-licensed
14:35l1xi see
14:35l1xthank you guys
14:36amalloyi bet in a decade or two, "was" will be acceptable over "were" there. english doesn't really have much of a subjunctive anyway
14:36amalloyi mean, already it's "acceptable", i guess
14:36llasramamalloy, hyPiRion: I definitely wouldn't blink at either
14:36technomancyat this point it's like who/whom
14:36amalloytechnomancy: you mean that snobby people use the wrong one so that they can sound educated?
14:37technomancyheh
14:37amalloyllasram: yeah, i wouldn't say anything unless asked to proofread
14:37l1xso what happens when I use an example code from a clojure project? like i use tools.cli https://github.com/clojure/tools.cli and I use the example displyed there
14:37hyPiRionIf people already use it wrongly, then that would explain why I am confused
14:38technomancyl1x: there's something called the "threshold of copyright" meaning that trivial expressions can't be copyrighted
14:38arrdemtechnomancy: because that holds so strongly in the software domain...
14:39l1xbut if i want to be sure that nobody sues my ass i better license my code under EPL just because i used the example from tools.cli ?
14:39technomancyyou need to display some modicum of creative effort to claim copyright
14:40technomancyno, license your code under the EPL because it's a good license =)
14:40justin_smithalso I think that things used as documentation as examples are assumed to provide permission to reuse and modify
14:40joegallohttp://en.wikipedia.org/wiki/Subjunctive_mood#English study up, there'll be a test later
14:41l1xjustin_smith: i hope so
14:41l1xtechnomancy: what is the difference between EPL vs APL v2
14:41l1xmy understanding was that APLv2 is good because you have to give up your IPs
14:41arrdem,(number? 2/3)
14:41clojurebottrue
14:42arrdem,(type 2/3)
14:42clojurebotclojure.lang.Ratio
14:42technomancyl1x: the main differences are that EPL is copyleft and APL makes you put a bunch of boilerplate junk in every file
14:42technomancyl1x: "give up your IPs" doesn't really mean anything
14:42technomancyunless you're talking about a DHCP lease
14:42llasramtechnomancy: I don't think the Apache license requires that. I think the Apache foundation just requires that
14:43amalloydangit, technomancy beats me to the punch on an IPv4 joke
14:43sm0kelol
14:43technomancyllasram: oh, gotcha
14:43kenrestivoi didn't really consider EPL copyleft
14:43technomancykenrestivo: it's weak copyleft like the LGPL
14:44arrdemthe EPL is so weakly copyleft that the FSF rips on it :P
14:44amalloyit's a less aggressive copyleft than GPL for sure
14:44l1xtechnomancy: right i was referring to copyleft
14:44technomancyexcept it doesn't have "GPL" in the name, so it doesn't freak out the suits
14:44l1xso afaik both EPL and APL are copylefty
14:44technomancyIIRC the main difference between the LGPL and the EPL is the latter has slightly stronger patent protection provisions
14:44l1xhttps://tldrlegal.com/license/apache-license-2.0-(apache-2.0) https://tldrlegal.com/license/eclipse-public-license-1.0-(epl-1.0)
14:44technomancyl1x: no, APL is more permissive
14:47l1xi see
14:47devn(defn third [coll] (nth coll 3)) (defn thirst [coll] (third (first coll))) (defn thirsty? [coll] (boolean (first coll)))
14:47devngood times.
14:47sm0keWelcome to #licensing! For more info visit http://licensing.com/
14:48technomancymaybe Licenser would have some advice
14:48l1xwell, sorry but it is relevant to this channel :)
14:49arrdemsm0ke: well that's not what I expected...
14:49sm0keyou had a problem, and tried to use license, now you have two law suits
14:49arrdem(inc sm0ke)
14:49lazybot⇒ 6
14:49arrdembloody suits... c&ding me for my fan programming projects..
14:50l1xi have to think twice to opensource any code it seems
14:50jcromartiearrdem: which one would that be?
14:51technomancyl1x: it's a lot less complicated if everyone sticks with the same license
14:51arrdemjcromartie: one that's no longer public at the request of Privateer Press.
14:51l1xtechnomancy: yes but my company approved only APLv2
14:52technomancyoh, that's crappy =\
14:52technomancybut as long as you don't copy/paste you should be ok
14:52devnwhat is the dyson bladeless fan of programming languages?
14:52kenrestivoarrdem: Elsevier?
14:53arrdemkenrestivo: huh? no...
14:54dbaschPrismatic’s fnhouse looks promising, but I can’t find a good sample app. It comes with an extremely basic one (guesthouse) that’s not very well documented.
15:02Licensertechnomancy don't use GPL ;)
15:05johnjelinekquestion: at what point do you look at your functions and say, "I need to refactor this"
15:05johnjelinekor "this is too gross to look at"?
15:06justin_smithjohnjelinek: it is time to refactor when I look at the code and don't have any idea what I was trying to do
15:06johnjelinekjustin_smith: lol, only then?
15:06justin_smithoften I am forced to notice this when a bug is lost in the logic somewhere
15:07johnjelinekisn't it too late when you've come to that point?
15:07justin_smithjohnjelinek: that's not the only time I refactor
15:07johnjelinekwhen is the earliest you refactor?
15:07justin_smithwhen a function is more than 7 lines long
15:08justin_smith(I just made that number up, it's a hunch I get as functions get longer)
15:09johnjelineklol
15:09johnjelinekreal scientific, I see ;)
15:10justin_smithalso if I see I am repeating myself
15:10technomancyI have an emacs mode that forces you to stop typing if your function is over 25 linees
15:11TimMcOh, like Eclipse + PMD.
15:11TimMcexcept it only tells you when you try to build
15:12TimMcActually, no, it's not at all the same.
15:15kenrestivotechnomancy: link?
15:16technomancyhttps://github.com/technomancy/dotfiles/blob/master/.emacs.d/phil/programming.el#L30
15:18cbpthat is horrible
15:18johnjelineklololol
15:18johnjelinekwhy?
15:18clojurebotwhy is the ram gone
15:18justin_smithcbp: no, horrible would be a timer where it lets the code sit there for 30 seconds and then comes back and deletes it
15:19technomancycalling it a mode may be a bit generous
15:19pjstadigjust turn it into a oneliner...done!
15:20cbpI bet he has another where it stops you from going past 80 column lines so it fits into his terminal
15:20pjstadighmm
15:20pjstadiggood point
15:20justin_smithhow about a cookiecutter function, cuts off anything to the right of 8 columns, and anything below 26 lines
15:20justin_smithif it can't fit on an old school terminal window, it shouldn't exist
15:20justin_smith*80
15:21johnjelinektechnomancy: do lets go into your line count?
15:22technomancyjohnjelinek: yeah, it's not picky
15:22pjstadigTBH, if you're counting lines in a lisp you're doing it wrong
15:23dbaschyou could end up with abominations like this, to fit in 25 lines: https://gist.github.com/dbasch/6923514
15:27grimmulfrWhat would be an "official" way of getting json requests from within clojure/clojurescript? clj-http?
15:28justin_smithgrimmulfr: in clojurescript, probably just use interop / AJAX
15:28dbaschgrimmulfr: from cljs, cljs-ajax
15:28grimmulfrCheers, will look into those.
15:29justin_smithslurp will work for get requests, clj-http if you need anything fancy
15:29justin_smithalso there is http.async.client for async requests if you need that
15:32grimmulfrI just need a way to get JSON formatted data from my backends into my code so I can interpret, so anything will probably do I guess, as long as it;s not overkill to implement.
15:33grimmulfrJust your average "send details" and interpret response. Forms and whatnot
15:33kenrestivogrimmulfr: i use (require '[cheshire.core :as json]) (-> "http://something.com/foo&quot; slurp (json/decode true))
15:33kenrestivoain't no official tho, just expedient
15:35justin_smithkenrestivo: yeah, if you don't need to do the request async, or make a post request or query parameters, that's the right way as far as I am concerned
15:39grimmulfrOk, will look into all of those. Cheers
16:08technomancyamalloy, hiredman: you two are ok with APL-ing serializable-fn, right?
16:10mpenetanyone knows if c.c.typed can annotate defmethod ?
16:10hiredmantechnomancy: sure
16:10mpenetdefmulti yes, but I can't find an example for defmethod
16:25technomancyheh, cascalog claims to be EPL'd in some places and Apache'd in others
16:26gfredericksmpenet I think the idea might be that you only need to do the defmulti?
16:26gfredericksand all the defmethods have the same type
16:26gfredericksotherwise it would be difficult to determine the type of a call
16:29blake__Hey, if I have "(defmacro whatever [parm] code code code...)" immediately followed by "(defmacro whatever [parm] parm)" am I correct to assume that the second defmacro overwrites the first?
16:29blake__And that this might be done to deliberately stub out the first (potentially expensive or disruptive) call without breaking code?
16:29justin_smithblake__: I think it is done so that you can have proper recursion
16:30justin_smithor maybe not with macros actually...
16:30blake__justin_smith: How would that be even if they were functions? Since the second one does nothing but return the passed value?
16:31justin_smithblake__: it does it so that the recursion would be possible
16:31justin_smitheven though clearly you did not use that facility
16:32blake__justin_smith: I don't get it.
16:34justin_smithblake__: it has to have its own symbol resolvable within its body
16:34justin_smithin case you wanted recursion
16:36blake__justin_smith: OK, but in this case, is it reasonable to assume the second macro exists to stub out the first? (It's not my code, and the first macro looks to be for profiling.)
16:37technomancyamalloy: ping
16:38ToxicFrog<violets> https://www.youtube.com/watch?v=qE9Pn0eBK https://www.youtube.com/watch?v=v3cZbQaqYN4 https://www.youtube.com/watch?v=qE9Pn0eBKRA
16:38ToxicFrogEr
16:38justin_smithblake__: I really don't know, the second macro, if both are in the same ns, totally replaces the first
16:38ToxicFrogMischan, disregard.
16:39justin_smithI would take that as a smell indicating a poorly maintained codebase
16:39blake__justin_smith: OK, thanks.
16:45amalloytechnomancy: i'm back! i was suffering from a linode outage
16:45technomancyamalloy: my condolances
16:45technomancyamalloy: just thought I'd confirm you're OK with the dual-licensing of serializable-fn
16:45amalloyyeah, feel free
16:46technomancycool
16:46amalloyi was wondering whether you needed my consent or not
16:47technomancyif it were just a matter of me giving the thumbs up then I'd feel kinda silly opening an issue with them
16:47amalloyeh, i dunno. it's still useful to remind them that copyright matters
16:47technomancy"there is a problem. please ask me to re-license some software in order to fix it." / "will you re-license it?" / "ok" / "well then"
16:48technomancyI know, but it's good to do it in a way that doesn't make you sound like a pedant
16:48technomancyeven if you are one
16:48technomancyclosed https://github.com/nathanmarz/cascalog/issues/249
16:48gtraktechnomancy: my attempt at structure, let's see what happens :-) https://github.com/clojure-emacs/cider/issues/546
16:48justin_smithtechnomancy: I see it more like "this is my request that you demonstrate that you know how to ask nicely"
16:49justin_smithwhich is reasonable, and doesn't need to involve pedantry
16:49justin_smithjust respect
16:49technomancyjustin_smith: it's easier to justify the request if it involves coordinating among multiple people, but yeah.
16:50technomancyit becomes "would you like me to help you with your problem" instead of "I'm causing your problem" =)
16:50amalloywell, there goes my chance at patent-troll millions
16:50technomancygtrak: cool; hope that goes well
16:52justin_smithgtrak: if that is accepted, I may even try cider. I check it out occassionally but I see scary visions of a hairy yak that threatens to steal days of my productivity. A stable release would help.
16:53gtrakjustin_smith: yea, I hate the emacs way of doing things :-). cider needs that.
16:54gtrakI learn things in emacs by accident.
16:54technomancyemacs is drawing you deeper into its gravity well
16:56gtrakDon't worry, I'm a pretty hateful person.
16:56gtrakbut maybe that's why it works.. sigh.
16:57technomancyhttp://its.a.trap.jpg.to
16:58gtrakjust yesterday I accidently typed M-s o in a C-s search and was flabbergasted at the utility.
16:59technomancy3>
16:59gtrakoccur-mode
16:59justin_smithgtrak: cool, I use occur because it is very handy, but did not know about the m-s o binding
17:00justin_smithalso m-x rgrep if you want something similar, but based on a subtree of your fs
17:00gtrakbeen using ack-and-a-half for that
17:00justin_smithgtrak: is that package thing?
17:00gtrakyea, it's a UI over ack, which is like a grep made for code.
17:01technomancyM-x rgrep is nice, but rgrep from eshell is nicer
17:01justin_smithahh cool, so I assume it ends up with a clickable reference buffer like occur / rgrep do
17:01gtrakjustin_smith: yes
17:01justin_smithawesome
17:01gtrakwhat's great about ack is it just looks nicer than grep with no effort on your part
17:01gtrakuse it the same way
17:01justin_smithtechnomancy: thanks for the hint
17:02technomancyjustin_smith: but without the promptfest
17:02nullptrgrep, ack, ag, and now pt -- https://github.com/monochromegane/the_platinum_searcher
17:02nullptrand all four have emacs packages
17:02justin_smithtechnomancy: hmm, rgrep from eshell does not give me clickables
17:03technomancyjustin_smith: weird!
17:03gtraknullptr: I read that as 'all have four emacs packages', which is true for ack.
17:03nullptrheh
17:03justin_smithtechnomancy: probably a config or version thing
17:04justin_smith(that was a low information statement)
17:04technomancyjustin_smith: oh yeah crap. I forget if I submitted this back upstream: https://github.com/technomancy/dotfiles/blob/master/.emacs.d/phil/my-eshell.el#L6
17:09coventryIs there a command-line rgrep for OS X?
17:09justin_smiththe above ack / ag / pt are all osx I think
17:10justin_smithand of course grep -R
17:10Raynes<3 ack
17:11justin_smithwith vanilla grep, -r does not follow symbolic links, -R does
17:11justin_smiththough of course you probably want egrep not grep
17:11dbaschyou can always combine find and grep to save time
17:11justin_smithgrep is how it is for posix reasons
17:12justin_smithdbasch: is it faster because you can tell it which files to search for matches in?
17:12dbaschjustin_smith: right
17:12dbasche.g. find . -name \*.clj -exec grep main {} \;
17:12justin_smithM-x rgrep does that (it prompts for a regex for the files to check for matches in)
17:30mercwithamouthso clojure experts and people generally smarter than me... for the last few days i've been looking over this article about using friend and liberator together and i'll admit it's still overwhelming. http://sritchie.github.io/2014/01/17/api-authentication-with-liberator-and-friend/
17:30mercwithamouthI'm wondering...is this approach absolutely necessary? do you have to tie the two libraries together in order to use both liberator and friend?
17:31eggheadnope mercwithamouth
17:31justin_smithmercwithamouth: well, security only makes sense if you have a clean division of "inside" and "outside" - if anything liberator does crosses the inside/outside boundary, then they have to be integrated
17:32eggheadyou can just use friend over your route definitions
17:32eggheadinstead of deep integrating with liberator
17:32justin_smithahh, good point egghead yeah
17:32justin_smith(that's still a kind of integration :P)
17:32eggheadbut the integration is w/ compojure instead of liberator :)
17:32eggheadand liberator happens to integrate very nicely w/ compojure too :x
17:32justin_smithfair enough
17:33eggheadI hit that same wall w/ friend + liberator
17:33mercwithamouthhmm
17:33mercwithamouthegghead: you wouldn't happen to have any public code would you?
17:33eggheadsure mercwithamouth
17:34justin_smithhttps://github.com/hiredman/ideapad/blob/master/src/com/thelastcitadel/ideapad.clj this is a friend example that hiredman shared
17:34eggheadmercwithamouth: https://github.com/eggsby/warden/blob/master/src/clj/warden/api.clj#L117-L152
17:34eggheadnothing fancy
17:35mercwithamouthsweet! thanks
17:36mercwithamouthegghead: the simpler the better...i can build up from there once i get more comfortable
17:36eggheadya, that example is just basic http auth
17:37eggheadand no roles, just either you are authed or not
17:37eggheadthe one justin_smith linked is a lot more in-depth
17:41mercwithamouthegghead: yeah yours is clear...i should be able to pick up on most of what i think i'll need from these two examples
17:42mercwithamouthlol it's clear that i have a long way to go with understanding lisp...
17:53dnolen_wow, 9 GSoC Clojure projects?
17:56justin_smithvery impressive
18:11d0kyhello does enybody know how to post data with goog.net.Xhrio ? im trying to post vector of string or string .. depend on situatuions .. and i receive only something like params {:v nullo=null} how send all data like ["viktor" "one"] i tried (pr-str data) but it didn't work ..
18:13hiredmand0ky: https://github.com/hiredman/drawbridge-cljs/blob/master/src-cljs/drawbridge/client.cljs#L70-L94 the most relevant bit being the QueryData object
18:17d0kyhiredman: and is there any simplier way ? when i use read-from from enfocus it works ... but now i dont send data from any form
18:18Frozenlockd0ky: What are you trying to do? There might be libraries for that.
18:19hiredmand0ky: dunno, I am not familiar with enfocus
18:20d0kyFrozenlock: i want to send data from multiselect but before sending it i want to filter them with an atom to send the less the possible data to server
18:21FrozenlockI don't understand... why would you need an atom to filter?
18:22d0kyFrozenlock: i have stored some data
18:22d0kyFrozenlock: in atom
18:23d0kyso i have vector i want to send to server
18:25Frozenlockd0ky: ok... so the atom and filtering stuff really isn't revelant. :-p
18:25FrozenlockYou want to send a vector to the server. I've been using this recently and I like it https://github.com/JulianBirch/cljs-ajax
18:25d0kyFrozenlock: yes it isnt :)
18:27d0kyFrozenlock: thanks .. i will try there a solution :)
18:29d0kyFrozenlock: it works when i created a map like: {:in (pr-str dest-user)} and i can clearly read data on server
18:29TravisDGiven some r, is there any non-stylistic difference between (dosync (ref-set r (f @r))) and (dosync (alter r f))?
18:30hiredmanyes
18:30hiredmanthe later is correct
18:31TravisDThat's what i thought, but I'm confused about why the first one is wrong. Since both the reading and writing to r occur in a transaction, aren't they protected from other reads and writes?
18:39TravisDhiredman: do you know the answer?
18:41hiredmanTravisD: actually I may be wrong, it looks like derefing a ref is actually recording as a read in the transaction, so it may restart the transaction if a deref'ed ref's value changes
18:41justin_smithbut the latter is still more clear
18:42amalloythere might be some weird corner cases where f is a non-pure function, which alters r and also some other ref?
18:42amalloybut in most cases the former is just a grosser version of the latter
18:43hiredmanamalloy: well, it would still be altering the other ref in a transaction
18:43justin_smithI wonder if the former would be more likely to trigger a retry of the transaction?
18:44TravisDCool. I was mostly asking because I was worried that there were some sneaky situations in more complicated transactions that could cause problems
18:45TravisDlike, in a more complicated transaction I could see using @r in a let block which eventually set-refed r again
18:45TravisDref-set
18:46hiredmanI have yet to see code outside of maybe the ants demo, where using refs and the stm was good, in general most places I have seen it would be just as correct, and simpler, using an atom
18:47TravisDAh, I see
18:47amalloyyeah, that's my rule of thumb for concurrency: "if you think you need a ref, you're probably wrong"
18:47coventryTravisD: My understanding is that the ref-set version isn't going to trigger a retry if r has changed during the transaction, whereas alter will.
18:47hiredmanso if you have large complicated usages of the stm, I take a good long look at it
18:47amalloycoventry: no, because reading r with @r causes it to be protected by the transaction
18:48TravisDhehe, cool. Anyways, I'm actually just rereading the chapter on concurrency
18:48TravisDg2g!
19:47zeroemyogthos: considering using selmer for a non html templates. Is there an easy way to disable escape-html for the entire call to render?
19:48whompi can't get vim mode to work in light table, any ideas?
19:49yogthoszeroem: don't think there is, another problem is that tags that are on lines by themselves will leave a blank line currently
19:50whompnm got it
19:58zeroem1yogthos: thanks, may be a pull request in the future
20:00yogthoszeroem1: sure thing, it could easily be a flag
20:42TravisDamalloy, hiredman: Sorry about leaving so abruptly. I realized that I was already 10 minutes late for a meeting! Anyways, I wasn't using refs in any complicated way, but I have been reading about concurrency in clojure and I was just wondering :)
21:04TravisDDoes await always return nil?
21:06tickingTravisD: looks like it, await returns (. latch (await)), which in turn is a void method
21:06TravisDAh, cool. I feel like it should be mentioned in the docstring, since it's pretty plausible that it would return the agent's value or something
21:07TravisDthe docstring for await-for also doesn't say that it returns true if the await didn't time out
21:07tickinguse to code luke
21:07ticking*the
21:07TravisD:)
21:07TravisDI looked at it quickly, but then decided to ask
21:07tickingbut yeah you are right, it should be mentioned
21:12arrdemlazybot: reading the code is a poor excuse for worse documentation
21:12TravisDlazybot seems not to care
21:38TravisDwith a ref transcation, I can do multiple things like first read the value of the ref, and then update it. Is there a way to do the same with atoms? I have a lazy-seq of numbers and I want multiple threads to take turns reading them so that no two threads get the same numbers
21:39gfredericksyep
21:39gfredericksTravisD: https://github.com/Prismatic/plumbing/blob/master/src/plumbing/core.clj#L325-335
21:39TravisDoh cool
21:40gfredericksalternatively you could add a nil onto the front and then just make the first thing be assumed to have been read already
21:40TravisDI don't understand the second thing you said
21:41gfredericks,(let [my-nums [10 20 30 40] a (atom (cons nil my-nums)) read-num #(first (swap! a rest))] [(read-num) (read-num)])
21:41clojurebot[10 20]
21:42gfredericks,(defn make-iterator [nums] (comp first (partial swap! (atom (cons nil nums)) rest)))
21:42clojurebot#'sandbox/make-iterator
21:42TravisDaha.
21:42gfredericks,(def my-nums (make-iterater (shuffle (range 20))))
21:42clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: make-iterater in this context, compiling:(NO_SOURCE_PATH:0:0)>
21:42gfredericks,(def my-nums (make-iterator (shuffle (range 20))))
21:42clojurebot#'sandbox/my-nums
21:42gfredericks,(read-num my-nums)
21:42clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: read-num in this context, compiling:(NO_SOURCE_PATH:0:0)>
21:42gfredericks,(my-nums)
21:42clojurebot19
21:42gfredericks,(my-nums)
21:42clojurebot3
21:42gfredericks,(my-nums)
21:42clojurebot16
21:43TravisDI came kind of close. I imagined doing (do (swap! a rest) (first @a))
21:44gfredericksoh yeah that's racey
21:44TravisDyeah :(
21:44gfrederickswhich is of course why swap! returns the new value
21:44TravisDyeah :D
21:44TravisDit is exactly the reason
21:44gfredericksI've also done hairier things where you set some metadata on the return value and pull it out afterwards
21:44tickingarrdem: It depends I'd say, if you just want to know a property like a return type in weird border cases of a fn like in this case, the code is the right place to go. Having to read through all the code to learn a lib is a different thing though.
21:45TravisDah, yeah, I never think of using metadata for anything
21:45gfredericksdespite what bbloom says I think metadata usage is mysterious and impossible to summarize
21:45bbloom gfredericks: did i ever say it makes perfect sense? i'm constantly flip flopping on how i feel about it :-P
21:46TravisDhehe
21:46arrdemticking: how is the _constant return value_ of a function a "weird border case"?
21:46bbloommost important thing: metadata does not influence equality
21:46gfredericksbbloom: yes this is the exact statement I'm complaining about
21:46bbloomboth useful and terrible :-)
21:46arrdemticking: that something is "(constantly nil) for side effects" should be docstring content.
21:46gfredericksbbloom: because that has nothing to do with the usage of metadata on fns and references
21:46tickingarrdem: seems like it was emergent behaviour, which the author did not really care about
21:47TravisDbbloom: One might mistakenly read that as "terribly useful"
21:47bbloomTravisD: that too
21:47tickingarrdem: (.await latch) could have returned something useful, or may do so in the future
21:47arrdemTravisD: zippers would argue that case...
21:47gfredericksbbloom: I could imagine arguing that metadata on values and metadata on other things are just two different features with the same name
21:48TravisDare zippers in clojure implemented using metadata??
21:48lazybotTravisD: What are you, crazy? Of course not!
21:48TravisDheh
21:48arrdemticking: then the docs should _say so_. return types are bloody important!
21:48bbloomgfredericks: you mean metadata on value vs identity equality semantics?
21:48bbloomyeah, metadata on identities seems a bit odd...
21:48gfredericksbbloom: but super useful though
21:48bbloomyeah
21:49gfredericksvars being the biggest example of course
21:49tickingarrdem: I'm not saying it should't do it, I said that it would be useful in this case, still it took me literally 3 seconds to look up the function and see what it does
21:49gfredericksbut say you wanted to attach a history tracker to an identity; super easy with metadata & watchers
21:49bbloomgfredericks: for sure. i basically view metadata as a MASSIVE IMPROVEMENT on the proplists stuff in CL but still not quite "right" yet
21:49tickingarrdem: docs are important yes, but the computer does not execute documentation, and it's our job to read code...
21:50gfredericks,(alter-var-root #'partial (fn [f] (comp #(vary-meta % assoc :type :partial-fn) f)))
21:50clojurebot#<core$comp$fn__4192 clojure.core$comp$fn__4192@9b9707>
21:51gfredericks,(alter-var-root #'partial (fn [p] (fn [& args] (vary-meta (apply p args) assoc :type :partial-fn :args args))))
21:51clojurebot#<sandbox$eval242$fn__243$fn__244 sandbox$eval242$fn__243$fn__244@cb43a9>
21:51gfredericks,(defmethod print-method :partial-fn [f pw] (print-method (list* 'partial (:args (meta f))) pw))
21:52clojurebot#<MultiFn clojure.lang.MultiFn@1643eda>
21:52gfredericks,(partial + 1 2 3)
21:52clojurebot#<core$partial$fn__4232 clojure.core$partial$fn__4232@1923658>
21:52arrdemticking: saying "oh well I can just grab source" is just waving aside the failure of the documentation in question. I can't claim that I'm innocent of this, but that we have the luxury of open source libraries is no excuse for lacking docs, especially when it comes to effective return type.
21:52gfredericksaw snap
21:52gfredericks,(meta (partial + 1 2 3))
21:52clojurebotnil
21:52gfredericks,(alter-var-root #'partial (fn [p] (fn [& args] (vary-meta (apply p args) assoc :type :partial-fn :args args))))
21:52clojurebot#<sandbox$eval99$fn__100$fn__101 sandbox$eval99$fn__100$fn__101@15316d4>
21:52gfredericks,(meta (partial + 1 2 3))
21:52clojurebot{:args (#<core$_PLUS_ clojure.core$_PLUS_@11e8225> 1 2 3), :type :partial-fn}
21:52gfredericks,(partial + 1 2 3)
21:52clojurebot(partial #<core$_PLUS_ clojure.core$_PLUS_@11e8225> 1 2 3)
21:52TravisDAlright. So what I really want is to have a convenient way for different threads to get their own random number generators. I also want to be able to reproduce results by using one seed to set up the entire system. Is this a reasonable approach? In each new thread you could invoke whatever random-wizardry you wanted, wrapped with a (with-new-rng...)
21:52gfredericksmeh
21:52TravisDhttps://www.refheap.com/22d202e77c7d58b429d818c9b
21:53arrdemticking: this isn't you, I'm on a docstrings tear today :P
21:53gfredericksTravisD: github.com/fredericksgary/four
21:53tickingarrdem: again, I said it should be changed
21:53TravisDgfredericks: Ah, cool. I saw it on the clojars search, but the name "four" threw me off
21:53gfredericksit's so obvious!
21:54TravisDgfredericks: Does the snippet of code I posted look sane anyways?
21:55TravisDand what does four mean?
21:55gfrederickshttp://xkcd.com/221/
21:55TravisDAh!
21:55TravisDamazing
21:55TravisD(inc gfredericks)
21:55lazybot⇒ 53
21:55tickingarrdem: but lets face it, most code, even clojure code, sucks monkeyballs. the docs are even worse if they exist at all, so learning to read code (clojuredocs.org has a small code box for every fn) will only help you become more independent (and be a better programmer)
21:56gfredericksTravisD: yeah it looks fine; you could use this var instead if you wanted: https://github.com/fredericksgary/four/blob/master/src/four/stateful.clj#L4
21:56tickingarrdem: I feel though that there is quite a general dogma against reading code
21:57gfredericksunless that custom random class you have there is not a subclass of java.util.Random :/
21:57TravisDgfredericks: I don't think it is :( I read some terrifying posts about running into trouble doing experiments with crappy random number generators
21:57TravisDso I was looking for a library with a few different prngs
21:57TravisDapache.commons.math3 has the main ones, I think
21:58gfredericksis it weird that rand-int uses java.util.Random to generate longs that get turned into a double that gets coerced back into an int?
21:58TravisDpft, no, that's obviously the right way to do it
21:58arrdemticking: speaking as a compiler author, code is not literature. Code is directives to your retarded best friend, the compiler, explaining to him how to tell his dumber moneky the processor how to munge integers into getting the right result. Code was never supposed to be written by humans for reading by humans. Humans read code because either something's wrong or because the human who wrote the code in the first place didn't make obvious what
21:59TravisDKnuth disagrees!
21:59TravisDor, not really, actually
21:59arrdemTravisD: Knuth wants us to write books that _contain_ code.
21:59gfredericks,(time (nth (repeatedly #(rand-int 100)) 1000000))
21:59clojurebot"Elapsed time: 272.405993 msecs"\n45
21:59TravisDyeah, I remembered that after blurting it out :(
22:00tickingarrdem TravisD: hal abelson disagrees though Programs must be written for people to read, and only incidentally for machines to execute.
22:00gfredericks,(let [r (java.util.Random. 42)] (time (nth (repeatedly #(mod (.nextLong r) 100)) 1000000)))
22:00dbasch(inc ticking)
22:00clojurebot"Elapsed time: 314.686804 msecs"\n44
22:00lazybot⇒ 1
22:01gfredericksTravisD: looks like it's still pretty fast though :)
22:01TravisDgfredericks: :)
22:01gfredericksmaybe it's the mod
22:01gfredericks,(let [r (java.util.Random. 42)] (time (nth (repeatedly #(bit-and (.nextLong r) 127)) 1000000)))
22:01clojurebot"Elapsed time: 137.186877 msecs"\n92
22:02TravisDticking: I don't actually feel strongly on the subject. It would be wonderful if all code could be read, but I also think that many things are complicated without explanation
22:02gfredericksyay now it's faster
22:02TravisDhuh, wow. That's a surprisingly big difference between mod and bit-and
22:02arrdemticking: Okay great, you can say that, but the reality is that code is written for machines to run it. We built computers because we wanted to tackle integer and matrix programming problems that were too complicated for humans to do by hand in a reasonable timeframe.
22:03dbascharrdem: have you ever worked as part of a large software team?
22:03arrdemticking: It wasn't until later that we developed languages above the machine directive layer
22:03tickingarrdem: Thought = Math = Code
22:04tickingand Speech = Thought
22:04arrdemticking: you just made my argument for documentation in two lines.
22:05tickingarrdem: elaborate
22:07arrdemticking: What's to say? We can't transmit or persist thoughts, so we persist writing and sometimes sound as the closest proxies thereto yet invented by man. These contain the math from which code is derived. Thus documentation is an isomorphism of the code in a human "native" format rather than a ^^ (somewhat less) retarded compiler native format.
22:08tickingarrdem: why do you asume that code is not a native human format, it was invented by humans, long before there were computers (e.g. lamba calc)
22:08tickingand to me it seems that Speech = Thought = Math = Code =|= an informal ad hoc description
22:08arrdemticking: what was the last time you read FORTRAN code :P
22:09tickingwhat does fortran have to do with that?
22:09tickingfortran is still more readable albeit slower than assembly
22:10tickingalso why do you say that speech and writings are only an aproximation of thought?
22:10tickingto me it seems that they are a serialization format which allows you to perfectly recreate thoughts
22:10arrdembecause "true" thought storage would be networked BCIs and a hivemind.
22:11tickinghow is telepathy transmitted by air any different than telepathy by magic/electricity
22:11arrdemtext is, as you say, a serialization that allows us to recover thoughts often imperfectly with learning involved.
22:13arrdemthe three are functionally identical, and distinct from text in that there is no learning involved on the part of a reader. I have before me an algorithms textbook and homework. Simply by reading the textbook I am not armed with the tools required to solve the problems therein. I have to explore the ideas therein for myself and populate my own understanding neural graphs in a way that "shared" thought does not/would not demand.
22:14tickingsorry my bt keyboard gave up
22:14arrdemWhen I read code, I play compiler and interpreter. I have to understand, scan, parse, and explore the behavior of the code. When I read docs (good ones at least) I am given functions as black boxes that I can reason about easily with little to no loading.
22:15tickingyes but the same is true for regular thought
22:15tickinghttp://en.wikipedia.org/wiki/Subvocalization_(Learning_and_Memory)
22:15dbascharrdem: I’m 44. I’ve been in the software industry for decades. I’ve seen things you wouldn’t believe. 5 1/4 floppies on fire off the shoulder of Orion
22:16tickingthere is no regular thought without speech, when you hear you inner voice to reflect about the world, you activate your vocal cords involutarily, this is not surpressable and required
22:16TravisDdbasch: :) I can see the rain
22:16dbaschenjoy reading beautiful documentation while you can, one day you might get paid to… I won’t spoil it
22:17arrdemdbasch: I've already been paid to revers engineer an undocumented OS boot sequence so that I could inject bringup timing sensitive driver code. I'll fight for my documentation thank you.
22:17dbaschTravisD: c-beams glitter and all that :)
22:17TravisDhehehe
22:17TravisDI will watch that movie tonight.
22:17tickingdbasch TravisD arrdem: I think the marginalia aproach is really good, code for the what and how, documentation for the why and wtf
22:18dbascharrdem: I foresee endless battles against Directors/VPs who *need* everything to work yesterday
22:18TravisDticking: Yeah, I was taking a look at that before. It makes really pretty documents
22:19tickingTravisD: could need a better index and search though, but that is first world complaining
22:19TravisDticking: Also, in your last message I mentally replaced "wtf" with "what they're for" ;)
22:19arrdemdbasch: funny... if the hardware team had documented that MMIO segment worth a damn when the built it, my job would have taken 30 minutes rather than three weeks...
22:20dbascharrdem: if I had a dollar for every time I heard something like that… wait, I do :)
22:20tickingarrdem: and if they had documented it wrongly it would have taken you three months ^^
22:20tickingno docs > wrong docs
22:20dbaschor docs that used to be right, probably the more common case
22:21arrdemwell I had _those_ :C
22:21TravisDold docs might provide clues for the code detective
22:21tickingdbasch: yeah, people that write wrong docs on the first try are a special kind of species
22:22tickingTravisD: yeah, but unless you know that they are outdated, they will f*** you in the a**
22:22TravisDticking: It's getting harder to avoid your profanity with clever substitutions ;)
22:22TravisDFling you in the air
22:22tickingnice
22:23TravisDone too many letters though :(
22:23tickingTravisD: I spend an entire day debugging cluster code that fails because of how the compiler precompiles lambdas and then serializes them
22:24tickingTravisD: so trust me, I'm holding back on the profanities ^^
22:27TravisDhehe :) I must live in some sort of heaven
22:28dbellfun to run if you want to get an idea of how clojure deals with order of hash-map entries as size increases: (keys (apply hash-map (interleave (range 1000) (range 1000 2000))))
22:36gfredericksis bound-fn terrible?
22:37bbloomgfredericks: http://okmij.org/ftp/Computation/dynamic-binding.html
22:37bbloomgfredericks: bound-fn : call/cc :: something-better : shift/reset
22:38gfredericksbbloom: hell if I will ever understand continuations
22:39bbloomgfredericks: good news: i attempt to explain them in this audio: http://www.mixcloud.com/paperswelove/bbloom_3_17_2014_programming_with_alegebraic_effectshandlers/ :-)
22:39gfredericks,(def ^:dynamic *x* 33)
22:39clojurebot#'sandbox/*x*
22:39gfredericks,(def get-x (binding [*x* 44] (bound-fn [] *x*)))
22:39clojurebot#'sandbox/get-x
22:39gfredericks,(get-x)
22:39clojurebot44
22:40gfredericks,(binding [*x* 55] (get-x))
22:40clojurebot44
22:40gfredericksoh wait nevermind
22:40gfredericksbut do mind this part
22:40gfredericks,(def get-x (bound-fn [] *x*))
22:40clojurebot#'sandbox/get-x
22:40gfredericks,(binding [*x* 99] (get-x))
22:40clojurebot99
22:40gfredericksI know what's going on but it just makes me grumpy
22:41amalloy,(first (binding [*x* 99] (lazy-seq [(get-x)])))
22:41clojurebot33
22:41amalloyjust for fun
22:41bbloomgfredericks: yeah, bound-fn is wonky
22:41bbloomgfredericks: oleg's thing explains how it should really work
22:42tickinghas anyone experience with proxy and serialisation? I'd prefer to avoid custom java classes, but I could imagine that serializing proxies might create a lot of classes.
22:54gfrederickswell now I know about *print-readably* :/
22:55tickingdat unicode unsuport
22:57amalloygfredericks: i know that it exists, but not what it does. it sounds almost like the opposite of print-dup, but it can't be that
23:00gfredericksamalloy: it turns of pr I think
23:00gfredericks,(pr-str "foo")
23:00clojurebot"\"foo\""
23:00gfredericks,(binding [*print-readably* false] (pr-str "foo"))
23:00clojurebot"foo"
23:00gfredericksno idea why that is a thing you would need to do in that manner
23:01gfrederickswe should have another var that makes println act like print
23:05gfredericksfor every function foo we should have a parallel dynamic var *foo-works* that defaults to true
23:09MarlaBrown1why does conj behave differently for lists and vectors?
23:10dbaschMarlaBrown1: because it inserts the element at the “cheapest” place for each structure
23:10dbaschfor a list, the cheapest place is the head
23:10dbaschfor a vector, the end
23:10MarlaBrown1cheapest meaning most efficient in the internal tree structure?
23:10dbaschyes
23:11MarlaBrown1gotcha, thanks
23:37yedidoes anyone know the link that has cljs and the equivalent js stuff side by side
23:39yedifound it
23:41TimMcI'd like to use drawbridge to get a remote REPL, but I don't want to pass my password on the command line when doing `lein repl :connect http://...` -- is there a way I can store the HTTP authentication in profiles.clj or something?
23:48gtrakwhat would you guys recommend for pairing over the net for 2 emacs users?
23:48gtrakI haven't used anything.
23:48arrdemfloobits, if you can get it working...
23:48technomancygtrak: definitely tmux, as long as you don't need to share a browser
23:49technomancyfloobits is neat, but it's only really interesting if you want to cross editor boundaries
23:49gtraktechnomancy: that assumes like a shared server, yea?
23:49gtrakI don't have any infra set up.
23:49technomancygtrak: no need, https://syme.herokuapp.com
23:49technomancyassuming you have an AWS account and like fifteen cents
23:50gtrakaha
23:50gtrakthat might be perfect.
23:50gtrakoh god, floobits uses emacs packages
23:51gtrakprobably not going to work :-)
23:51gtrakI'll do syme.
23:51technomancyI could never get the hang of floobits since you don't share the whole screen
23:51technomancyso stuff like shells and repl sessions are hard to get right
23:51gtrakI need to just be able to give the guy a link.
23:51technomancyyou can share them as long as only one person types, but it's really annoying
23:55gtraktechnomancy: how do you setup stuff like emacs on syme?
23:56technomancygtrak: just fork this repo and tweak to your liking https://github.com/technomancy/.symerc
23:57gtrakah good. This is where my 'close to stock' config comes in handy :-).