#clojure logs

2013-11-25

00:15jjjddd0Hi all, can anyone tell me what htis does:
00:15jjjddd0{#'*out* out}
00:17coventryjjjddd0: Play around with it in the repl.
00:18coventry,(let [out 'foo] ({#'*out* out} #'*out*))
00:18clojurebotfoo
00:18jjjddd0its hard to google for macros sometimes, {# yields no results
00:18jjjddd0is there a goto list somewhere ?
00:18allenj12hey what would be the best data structure if i wanted nested keywords so live {:john {:name --- :age --- :address { :street ...}}} etc...
00:19allenj12a hash-map-map?
00:19justin_smithjjjddd0: the docs for the reader help. all the reader macros are mentioned there http://clojure.org/reader
00:19justin_smithalso, there is http://symbolhound.com/ for looking up programming language symbols other engines don't index
00:20justin_smithhttp://symbolhound.com/?q=%23%27+clojure for example (that is a search for #')
00:21jjjddd0justin_smith: that one isnt in the reader macros list
00:21bitemyappjustin_smith: oh man, that is nice.
00:21justin_smithjjjddd0: it is, it is listed as Var-quote
00:21bitemyappjustin_smith: you have no idea how nice this will be for Haskell
00:22justin_smithjjjddd0: from there you would follow up to look up var
00:22jjjddd0oooh I see
00:22jjjddd0should've been looking for #' not {#
00:22jjjddd0thanks
00:22justin_smithnp
00:23bitemyappjjjddd0: { ... } is just a map yo.
00:23justin_smithjjjddd0: yeah, that {#'x x} would be read as {} with #'x and x inside may not be the easiest thing to intuit at first
00:23jjjddd0yep got that now
00:24justin_smithbut the rule is that # precedes the thing it qualifies
00:24bitemyappjjjddd0: like #inst "2013-03-03"
00:24jjjddd0but so.. what is it doing ? that's abit confusing
00:24justin_smithit introduces a reader macro
00:25justin_smithsomething that transforms the input as it is read, before it is evaluated
00:25jjjddd0creating a map with a var as a key and it's value set to... ?
00:25justin_smithjjjddd0: yeah, that is odd - perhaps it has a special behavior if you ask it to do something with #'*out*
00:25justin_smith*out* is always the default place for printing functions
00:26jjjddd0it's here line 11:
00:26jjjddd0https://github.com/Raynes/tryclojure/blob/master/src/tryclojure/models/eval.clj
00:26justin_smithso clearly it is a situation where something is saying if this thing is bound to our current output port, than return out (whatever that is bound to)
00:27jjjddd0i see, it's overidding a var '*out*' with a custom output stream
00:27justin_smithprobably something like that, yeah
00:28justin_smiththough usually you would do that by just binding *out*
00:28jjjddd0because *out* is a standard var in clojure right ?
00:29jjjddd0clever
00:29justin_smithyeah, it is the magic default place that print goes, if you rebind it, that changes where print prints to
00:29justin_smith(and the other functions that call print, of course)
00:29jjjddd0thanks for your help all
00:29justin_smithnp
00:31Raynesjustin_smith: Thanks for providing free customer support for my projects.
00:32justin_smithlol
00:32RaynesYou're a pal.
00:32justin_smithI'm just a compulsive pedant, love a chance to try to teach something
00:32justin_smithespecially if it is short term, no commitment :)
00:33RaynesYou and amalloy should have babies.
00:38bitemyappman babies. ma-bies.
01:30bellkevIs there any kind of convention clojure programmers follow for ordering there function inputs so that it's easier to compose them with "threading"? I've noticed that sometimes when I "thread" it happens that "thread-last" works better and other times normal threading works, but it's annoying that it seems kind of arbitrary depending on the input order...
01:31justin_smitha sequence should go last, an indexed collection should go second
01:32justin_smithin general
01:32justin_smitherr, first arg, second place in the form
01:34bellkevThis is the example that I started trying to write with thread-first, though "Oh, shit, this won't work", and then thought "Oh, this will work with thread-last..."
01:34bellkevhttps://gist.github.com/bellkev/7637204
01:35bellkevIt feels like a total coincidence that it worked though :P
01:35justin_smithyou generate a collection, and pass it through each function
01:35justin_smithcollection args canonically go last
01:36justin_smith*sequential collection
01:36bellkevAh, that makes sense
01:36bellkevNow that you put it that way I feel better
01:38justin_smiththere is also as-> for more flexibility
01:38bellkevI was kind of thinking of the string in the split term as being "collectiony", but now I can see it as a "collection generator" and a "collection collapsor" or whatever
01:38justin_smiththough it requires explicitly marking where the arg comes in
01:39bellkevInteresting, I'll have to look into that...
01:41justin_smith,(as-> 1 $ (+ $ 3) (if (> $ 2) $ (* $ $)) (inc $))
01:41clojurebot5
01:41justin_smithalso allows multiple references to the passed value, as you see
01:47bellkevSo, it's kind of like a little miniature 'let', but with less syntax and without the implicit 'do'?
01:47bellkevAnd for only one variable-ish thing?
01:47justin_smithyeah
01:48justin_smithif you macroexpand it that is exactly what it is
01:48bellkevokay, that seems handy
01:48justin_smithit is a handy way to express some stuff, yeah
01:48justin_smithand when you name it $ it is almost like you are doing perl or something
02:32blur3dif I have a list of hash maps, does clojure have a way to pull out certain keys? kind of like a ruby active record pluck
02:33blur3dusing select-keys works, but was wondering if something was already in core
02:33blur3d(map #(select-keys % keys) coll)
02:33TEttingerblur3d, sure. what condition do you want the keys under? do you mean values or keys?
02:33justin_smith,(map #(select-keys % [:a :b :c]) [{:a 0 :b 1 :c 2 :d 3} {:a 1}])
02:33clojurebot({:c 2, :b 1, :a 0} {:a 1})
02:34TEttinger(inc justin_smith)
02:34lazybot⇒ 13
02:35blur3dyeah, that works fine - I was just wondering if it was common enough to be in core under something like pluck [coll keys]
02:35justin_smithno, it would be a one liner if you want to write it
02:35blur3dkk, cheers
02:35justin_smiththe general clojure philosophy is to have a small number of functions that compose well and all use the same datatypes
03:03sverihi everyone, let the IDE wars begin, which IDE do you use for clojure development on windows? A friend of mine tried to convince me to use emacs now for one week, but we still dont have everything running as we would like :(
03:06justin_smithnot a windows user, but I have gotten emacs working on windows before
03:06justin_smithI saw a demo of cursive that was pretty impressive
03:06justin_smithI bet that works fine on windows
03:07justin_smithhttp://cursiveclojure.com/
03:07sverihm, i tried cursive, it opened the clojure files, but i could not get the tests running
03:15sveriany cursive users here? is it already possible to run unit tests with cursive? or am i trying something that doesnt work yet?
03:20justin_smithsveri: it has a repl, you can load the namespaces that define the tests and use (test/run-tests)
03:20justin_smiththough I would be surprised if it did not have a shortcut for that
03:21sverijustin_smith: i just cannot find one :D
03:21sverihowever, i found the repl
03:21justin_smithas in, you haven't written any tests yet?
03:22justin_smithor, you haven't found the "run tests" button
03:22sverii haven't found the "run tests" button, the tests are there already
04:25davidbe`I've a question on how to connect to an Oracle db: when running a query, I get an error that there's no suitable driver found for jdbc:oracle:thin:@<path-to-db>:1521:dwh. This url should work, using SQuierreL SQL, I can connect. I guess it has to do with requiring/using ojdbc6.jar... How can I solve this?
04:26davidbe`Or should I add ojdbc6.jar to project.clj?
04:33clgvdavidbe`: you usually need to add the driver jar to the classpath of your application on the jvm
04:34clgvdavidbe`: in a Clojure project adding it to project.clj when using leininingen is the way to go
04:34davidbe`I'm not that familiar with Java and beginning with clojure... where do I place ojdbc6.jar and how to add it to project.clj?
04:36davidbe`I've put it first in ./src (lein classpath mentions it)
04:36jowagdavidbe`: http://stackoverflow.com/questions/9898499/oracle-jdbc-ojdbc6-jar-as-a-maven-dependency
04:38jowagand http://stackoverflow.com/questions/18249901/clojure-lein-cant-find-oracle-jdbc-driver
04:40davidbe`jowag: thanks, I'm checking it out. 10 minutes ago, stackoverflow was down. Lucky it's up again!
04:53clgvdavidbe`: with leiningen you usually do not place a jar anywhere. you specify the jar as a maven-style dependency in the the project.clj and leiningen downloads it for you
04:59TEttinger(inc clgv)
04:59lazybot⇒ 9
04:59TEttinger(inc jowag)
04:59lazybot⇒ 1
05:00clgvTEttinger: thx - you cant have too much karma these days ;)
05:01TEttinger$karma TEttinger
05:01lazybotTEttinger has karma 6.
05:02TEttinger$karma technomancy for fun
05:02lazybottechnomancy has karma 86.
05:09davidbe`clgv: but how for ojdbc6.jar?
05:11clgvdavidbe`: what is there project site?
05:11davidbe`I've been going through the pages jowag was giving me, but it meant the installation of maven (I'm new to jvm...) and now it errors because there is no POM in this directory...
05:11dsrx(dec dsrx)
05:11lazybotYou can't adjust your own karma.
05:11davidbe`ojdbc6.jar is the driver for Oracle DB
05:11jowagare you using leiningen?
05:12davidbe`jowag: yes
05:12jowaglein is using maven underneath
05:12davidbe`jowag: ow...
05:12davidbe`searching the internet doesn't give me a clear example/help. It always says that ojdbc6.jar should be in your classpath
05:13davidbe`that's it, no more. I'm clueless :)
05:13clgvdavidbe`: it seems that oracle does not publish this driver as maven artifact, right?
05:14jowagtry this, add this repo in your project.clj, :repositories [["codelds" "https://code.lds.org/nexus/content/groups/main-repo&quot;]]
05:14davidbe`clgv: sorry, I cannot answer that. I don't know how maven works...
05:14Jardadoes the repl have some specia case for (float) printing
05:14jowagand then add [com.oracle/ojdbc6 "11.2.0.3"] as a dependency in project.clj
05:14clgvdavidbe`: ok I found it. add [ojdbc/ojdbc "14"] to your project.clj in the dependecies part
05:15Jardabecause in dev repl (float (read-string "19.9")) prints 19.9
05:15Jardabut in production the same code inside a ring-app produces 19.899999618530273
05:16davidbe`clgv: that gives "could not find artifact ojdbc [..] in central"
05:16clgvoh well I have no clue which is the right dependency. there is also the following on maven: [com.oracle/ojdbc14 "10.2.0.4.0"]
05:17clgvbut it seems those are only pom-files which isnt useful...
05:18clgvgo with jowags hint there is a jar in the repo he mentions
05:20davidbe`clgv, jowag: okay, I'll look into that. Thanks already!
05:22clgvdevidbe`: your project.clj needs the :repositories entry and the vector with oracle ojdbc dependency like here: https://www.refheap.com/21231
05:22clgvdavidbe`: ^^
05:29davidbe`clgv: we have a winner =)
05:30edbondhelp please with cljs - http://stackoverflow.com/questions/20189860/export-deftype-methods
05:31davidbe`clgv: thank you! I'm only wondering, with some experience with Ruby's gem and Haskell's cabal, how one can find the jar's you need in Java-world!? Those centralized repos give less headaches :)
05:32cYmenCould somebody help me spot the error in this: https://www.refheap.com/21233
05:32cYmenIt's a 4clojure problems.
05:32cYmen-s
05:32cYmenProbably some sort of type equality thing because the result looks correct.
05:33TEttingerdavidbe`, that's exactly what maven central is
05:33TEttingerthere's also clojars
05:34TEttingerhttp://search.maven.org/
05:34TEttingerhttps://clojars.org/
05:35edbondcYmen, it's infinite, there is no exit
05:35TEttingercYmen: ##(doc map-indexed)
05:35lazybot⇒ "([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item."
05:36cYmenedbond: ah, thanks
05:36edbondone can use reduce too
05:38TEttinger,(= (#(map-indexed (fn [idx item] [item idx]) %) [:a :b :c]) [[:a 0] [:b 1] [:c 2]]) ;; map-indexed is highly useful
05:38clojurebottrue
05:39jowagedbond: do not exprt deftype, export some function which will create what you need, e.g. create new instance of your type
05:39davidbe`TEttinger: thanks for the info. Yes, I understood clojars also as a central repo. It is though strange to add another repo for an oracle driver, which is not uncommon.
05:39TEttingerthat may not work on the others, I haven't tried! but you should try to do it with reduce for completeness, cYmen
05:39TEttingeryeah
05:40edbondjowag, I can export function but that deftype object doesn't have handleShow. I think it's renamed
05:40TEttingerdavidbe`, it seems to be there. http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22ojdbc14%22
05:41jowagedbond: in that case, try putting ^:export before handleShow, inside deftype
05:41TEttingeroh you need 6 I guess?
05:41davidbe`TEttinger: yes
05:41TEttingeris that a very old version?
05:42edbondjowag, I tried ^:export, generated .js doesn't have 'handleShow'. Seems export can't be applied there.
05:43edbondI thought externs can help but it ignores them too
05:43davidbe`TEttinger: bit too old. Problem is solved for now, I was only wondering why it wasn't that easy (lazy-me :-)
05:43TEttingerheh
05:44TEttingerwell lein is wonderful, it easily handles quite a lot of hassle inherited from java land
05:44TEttinger"lein uberjar" is great
05:48edbondcYmen, here is reduce version
05:48edbond,(reduce (fn [[i coll] el] (vector (inc i) (conj coll [el (inc i)]))) [0 []] [:a :b :c])
05:48clojurebot[3 [[:a 1] [:b 2] [:c 3]]]
05:49edbondoff-by-1 )
05:49edbondand map accepts many collections
05:49edbond,(mapv (fn [a b] [a b]) [:a :b :c] (range))
05:49clojurebot[[:a 0] [:b 1] [:c 2]]
05:49edbondmap-indexed of course if the winner. know your core :)
05:51cYmenheh
05:53TEttingerwhat's kinda crazy is that mapv is relatively recent -- 1.4 I think?
05:53TEttingerhttp://clojure.github.io/clojure/clojure.core-api.html#clojure.core/mapv yep
05:57clgvedbond: in case you need a map anyway ##(zipmap [:a :b :c] (range))
05:57lazybot⇒ {:c 2, :b 1, :a 0}
06:08cYmenWhat is the difference between map and mapv? Does mapv pass the arguments as a set?
06:09Ember-@(doc mapv)
06:10Ember-##(doc mapv)
06:10lazybot⇒ "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a vector 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 remai... https://www.refheap.com/21235
06:10Ember-##(doc map)
06:10lazybot⇒ "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); 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. An... https://www.refheap.com/21236
06:10Ember-cYmen: see the "Returns a <here>"
06:11Ember-there is a dramatic difference, mapv returns an eagerly initialized vector, map returns a lazy sequence
06:25cYmenTotally missed that..
06:25cYmenthanks
07:07johiddiniHi - compojure/ring question. I have a compojure app, works great in development, but now I want to properly deploy it. How can I run my uberjar as a service that starts when my EC2 instance does, and automatically restarts if it crashes? I'm not an ops guy so maybe I'm missing the obvious.
07:26dnolenedbond: not supported but not hard to add - http://dev.clojure.org/jira/browse/CLJS-698
07:27edbonddnolen, thanks, will take a look.
08:19kilenAny idea why this explodes? http://bit.ly/18j7bel (refheap), it seems trivial and the first version should be equivalent to the 2nd.
08:26ambrosebskilen: why is it [coll] instead of coll in the loop binder?
08:28kilenambrosebs: so that I don't have to wrap the initial collection in a vec in the color, it's serves as a stack
08:28kilens/color/caller
08:29kilenI culled this from a larger function, so lacks context.
08:31nonubywhy does this whole the exception instead of closing channel in a finally for example https://github.com/clojure/core.async/blob/76317035d386ce2a1d98c2c349da9b898b480c55/src/main/clojure/clojure/core/async.clj#L382
08:31nonubywhole --> swallow
08:34kilenambrosebs: yeah, that's the problem, but I thought it was legal to put an expression on the rhs of a binding. strange.
08:35mattmossnonuby: I suspect that, since (f) is in another thread, there is no easy way to handle that exception.
08:36mattmossSorry, ignore that, I misunderstood your question.
08:38ambrosebskilen: sure it's legal. You just wrapped coll in a vector, I don't know where the NPE comes from though.
08:42kilenambrosebs: oh f, i captured rest instead of calling it rst. boo.
08:43ambrosebskilen: :)
08:52dnolenpiranha: so does React actually work with advanced compilation? If so I'm curious why renaming is an issue?
08:55wakeuphi
08:55mdrogalisMorning.
08:55wakeupAnyone using cloverage here? I can't get the -n and -t options to work
08:56wakeupI am trying to run cloverage on a chosen testsuite only.
09:19dabdcould someone please help me out using clojure.walk? https://gist.github.com/dabd/7641881
09:22justin_smithdabd: postwalk does not work on anything other than generic types
09:22coventrydabd: But I believe clojure.walk2 does.
09:22justin_smithbecause it needs to know how to create an empty thing and put transformed contents in it
09:22coventryhttps://github.com/stuartsierra/clojure.walk2
09:23justin_smithI think walk2 will be in the next clojure.core
09:23justin_smithour caribou version is the only version of walk2 you can get from maven, last I checked
09:23justin_smithoddly
09:23coventryjustin_smith: Yes, troncle is still depending on it. :-)
09:23justin_smithoh yeah, we had that conversation
09:24coventryI guess you would have to extend walk2.Walkable to your record type for it to work properly.
09:24coventryHuh, there's already an extension for IRecord.
09:24justin_smithdabd: hopefully clojure.walk2 fixes your issue, otherwise, this was another thing to add to the "you probably don't want to use defrecord" list
09:24rabidsnailHow do I unescape html character entities? Googling just points to a bunch of templating libraries.
09:25justin_smithcoventry: cool, so that should fix his issue then
09:25arcatani wonder if walk2 preserves metadata
09:25coventryarcatan: Pretty sure it doesn't.
09:25coventryarcatan: It's easy to add that to the transformation functions, though.
09:26dabdjustin_smith: what should i use instead of defrecord to define nodes in a tree that can contain complex data?
09:26coventryhttp://clojure-log.n01se.net/date/2013-11-24.html#18:13
09:27rabidsnailI mean I guess I could use apache commons to do it, but that doesn't seem very clojurey.
09:27justin_smithcoventry: yup, that's where we talk about the list I would be adding to
09:28justin_smithrabidsnail: I think the ring handler that handles URL params may do this?
09:28wakeup-.- why is simply running cloverage.coverage/-main in my project so hard?
09:28rabidsnailjustin_smith: I'm not using ring (this isn't a web app)
09:29justin_smithbut web libraries are good at handling data formatted for the web
09:29rabidsnailjustin_smith: I'm pulling data from the twitter api
09:29justin_smithit is a web app: a web client app :)
09:29dabdcoventry: i am not using defrecord to represent the tree.
09:30dabdjust the nodes
09:31coventrydabd: Can you represent the node data using the standard clojure data structures?
09:31justin_smithrabidsnail: and speaking of being a web client, clj-http.client does format coercion
09:31justin_smithhttps://github.com/dakrone/clj-http
09:33rabidsnailjustin_smith: to use that I would have to write my own twitter api client, though
09:33justin_smithit is probably using a class from apache to do the URL transform though
09:33dabdcoventry: of course a simple map would work. It seems like defrecord, deftype and protocols get messy. So when should I use a simple map instead of defrecord
09:33rabidsnail(wrong layer of abstraction)
09:33rabidsnailyeah, I'll probably just use apache commons
09:34coventrydabd: http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/
09:35coventrySee the "No" "No" path.
09:36dabdcoventry: thanks. seems useful
09:36coventryNP.
09:49allenj12is there an easy way to read in txt files word by word? so maybe something like "hello john" to ["hello", "john"]
09:52dbusnenko(.split (slurp "file.txt") " ")
09:52justin_smith(clojure.string/split (slurp "project.clj") #"[ \n\t] ")
09:52justin_smithI forget the generic "split by white space" regex
09:53Mendor|s1r"\\s+"
09:53justin_smiththanks
09:54allenj12alright thanks!
09:54justin_smithMendor|s1r: that seemed to do the opposite, so I need to negate it
09:55bjacapital S is everything except whitespace
09:55bjalowercase S is all whitespace characters
09:55bjaso \\s+ vs \\S+
09:55justin_smithoh, it was "\s+"
09:55justin_smithnot "\\s+"
09:55justin_smiththat did it
09:55bjaerr, yeah. java requries the escaped \
09:56bja(not clojure)
09:56justin_smith(clojure.string/split (slurp "project.clj") #"\s+")
09:56justin_smiththat works
10:03piranhadnolen: it actually does work, almost does :)
10:04piranhadnolen: the thing is that they have this list of tags they create on DOM, and if you use them as DOM.td, advanced mode will rename them to Q.x or something like that :)
10:04piranhaI guess I should just add an extern which lists all those tags and be done with it, their names are not that long
10:04casper_(+ 1 1)
10:04clojurebot2
10:05coventry(inc 10)
10:05lazybot⇒ 0
10:06coventryDoes clojurebot have "+" hardcoded?
10:07dnolenpiranha: I'm confused why the renaming is a problem, isn't everything compiled together?
10:07Mendor|s1r,(inc 10)
10:07clojurebot11
10:07Mendor|s1rtoo many bots :)
10:07dnolenpiranha: React and your CLJS code?
10:07coventryMendor|s1r: The remarkable thing about casper_'s message is that it wasn't preceded by any kind of unquote.
10:08piranhadnolen: ok, so it's a problem only in single case
10:08Mendor|s1rcoventry: oh, I'm blind :)
10:08piranhadnolen: the thing is that DOM.div, DOM.p and other functions in React are created in runtime from an array (['div', 'p']), so they don't get renamed
10:08gfredericksWhy does the core.typed wiki describe a function as "an ordered intersection of arities"? wouldn't union make more sense?
10:09piranhadnolen: but they get renamed in a client code, which is a problem :)
10:09dnolenpiranha: ah, so those are dynamic properties? Why don't they just make them static?
10:10coventrygfredericks: What's the formal correspondance between an arity and a set?
10:10piranhadnolen: 'code size' :D
10:10dnolenpiranha: huh?
10:10gfrederickscoventry: I don't know
10:10dnolenpiranha: I can't see how it make a significant difference, and would be good for Closure dead code elimination
10:11TimMc&((juxt (fn ([] :nullary-a) ([& _] :varity-a)) (fn ([& _] :varity-b) ([] :nullary-b))))
10:11lazybot⇒ [:nullary-a :nullary-b]
10:12TimMcI don't see what order has to do withit either.
10:12piranhadnolen: yeah... well they discussed that my patch ( https://github.com/facebook/react/pull/420/files ) added half a kb of code...
10:12gfredericksTimMc: well in core.typed you might have several types for one arity
10:12gfredericksthough again that sounds like a union to me
10:13piranhaoh, it actually is other way around, it does rename
10:13piranhaah, damn, I really forgot this thing
10:13piranha:))
10:13piranhadnolen: the thing is that closure compiler does not rename them in my code! because I use [:div "something"]
10:14piranhaI was thinking about switching pump to (div "something"), that would fix the problem
10:14justin_smith(inc 10)
10:14lazybot⇒ 1
10:14justin_smithlol
10:16piranhaah
10:16piranhadnolen: I've got it other way around again :)
10:16piranhathe problem was that it renamed all the tags and you got <xf></xf> in your DOM :))))))))
10:16piranhadnolen: I'm sorry for the confusion, it took a while to switch my brain back :)
10:20dnolenpiranha: right, I'm chimed in on your pull request - from what I've seen React looks like one of the best libs to integrate into a CLJS project
10:20dnolenwould be sad to reinvent
10:20dnolenpiranha: thanks for the explanations
10:21piranhayeah, react is great
10:22piranhadnolen: it actually seems quite similar to hoplon for me, but I think alandipert doesn't agree with me; it still could be used as a backend renderer just to skip writing all this reconciliation again
10:23piranhaI would love React to be separated in libraries, but still, idea is really good - having 'render' as an idempotent function makes writing an app much simpler
10:37gfredericksI feel like it would be useful for robert.hooke to have an around function that's like add-hook but only gives you the original function with the args already applied
10:38joegallo_to save the characters of applying them yourself?
10:39joegallo_that is, so you could (f) rather than (apply f args)?
10:42gfredericksexactly
10:42gfredericksand make it clear that you don't care about the args or intend to change them
10:52justin_smithgfredericks: any relation to (defmacro thunkify [form] `(fn [] ~form))
10:52gfredericksjustin_smith: I don't believe so; robert.hooke is about monkey-patching vars
10:54justin_smithwell the hook could provide you the thunkified version of the call
10:54justin_smithis what I am saying
11:03TimMcRaynes: A coworker found this. I don't know what it is, but it really should be accessible by a lazybot $wat command: https://github.com/gf3/WAT/blob/master/wat.json
11:17dabdthis is a very basic question about trees and s-expresions. I want to represent the tree shown first here https://gist.github.com/dabd/7643940 but the clojure zipper will produce a structure like shown at the end of the file. How can I represent the first tree using a zipper?
11:18TimMcWhat have you tried?
11:18TimMcOh, misread, sorry.
11:21kilenThis fails to work: (map Integer/parseInt ["4"]) ,is there sugar or must I wrap it in a fn?
11:22TimMcdabd: I think each vector needs to specify *three* nodes -- left branch, node value, and right branch.
11:22justin_smithkilen: there is (map #(Integer/parseInt %) ["4"]) - probably the best you'll get
11:22dabdmy trees are not necessarily binary
11:23justin_smithkilen: the issue is that a static class is not a first class object, and the language would have to become much more complex to make it act like it is
11:23coventry,(macroexpand '(Integer/parseInt "4"))
11:23justin_smith*static class method
11:23clojurebot(. Integer parseInt "4")
11:24dabdfor example this clojuredoc zipper example is working with a tree that is not binary http://clojuredocs.org/clojure_core/clojure.zip/zipper
11:27kilenjustin_smith: how strange, where does that macro come from? is invocation a macro??
11:27lazybotkilen: What are you, crazy? Of course not!
11:27kilennice
11:28justin_smithkilen: it is a shorthand for fn
11:28justin_smith,(macroexpand '#(str %))
11:28clojurebot(fn* [p1__57#] (str p1__57#))
11:29kilenjustin_smith: but isn't fn a special form? I don't follow.
11:29justin_smithfn is not a special form, it is a macro
11:29coventryfn* is a special form.
11:29justin_smith#() is a macro that expands to fn* which is a special form, yes
11:30kilenjustin_smith: Then (doc fn) is a filthy liar
11:30justin_smithweird - I may be wrong
11:31coventryYep, it's lying.
11:31justin_smithit manually adds :special-form to its metadata
11:31justin_smithwhich is odd?
11:31coventryThere are a couple of other forms on http://clojure.org/special_forms which also aren't special. loop and let, at least, IIRC
11:32justin_smithbecause they are wrappers around the special form, and they are there to do the arg destructuring, right?
11:32coventryBut actually, the documentation is more useful the way it is without going into this distinction.
11:32kilenSeriously, this would never happen in scheme. *ducks*
11:32justin_smithno, it would not happen in scheme. and my boss would never deploy scheme in production :)
11:33kilenjustin_smith: ok, so #() is shorthand for fn, and fn is a macro. how does macro expansion work for (foo bar)? I don't see the fn
11:34justin_smithfoo is a var pointing at a first class function
11:34justin_smiththe problem is you can't just have a var pointing to a first class static method on a class
11:34coventryI suggest reading the code for riddley.walk/macroexpand if you really want to get into this.
11:34justin_smithbecause a first class static method on a class is not a thing :)
11:34justin_smithwe are adapting to the limits of the jvm here
11:35kilencoventry: thanks, will clone
11:36justin_smithif we wanted to be able to use static methods on classes as if they were first class things, the clojure interpreter would be more convoluted. I like that the design was kept simple.
11:36coventryIt's basically clojure's macroexpand machinery, reimplemented in clojure.
11:36TimMcdabd: I've not used zippers; how do they store node values, or do they only have data at the leaves?
11:37dabdtimmc: looks like the answer for what i'm trying to do is here http://grokbase.com/t/gg/clojure/12afy2cz9p/how-to-represent-trees-for-use-with-zippers
11:37coventryHmm, actually, I don't know that it's going to show how Integer/parseInt is handled. I think it defers to clojure's macroexpand for that. You might need to look at HostExpr in Compiler.java.
11:37dabdvector-zip will treat all vectors as branches so to explicitly represent the nodes i need to do something like caspar is showing. I'm going to try it
11:40kilenjustin_smith: let me see If I got this right, all symbols pointing to a function get expanded via the fn macro which has special sauce for static methods, is that right?
11:40justin_smithkilen: err, no
11:40justin_smitha function is an object
11:40justin_smithso a var can have it as a value
11:40justin_smitha static method is not an object
11:41justin_smithso you cannot put it in another container in the jvm
11:41justin_smiththere is no such concept, it is not a first class thing
11:41justin_smithit belongs to the class
11:41justin_smithand the class is not neccessarily a callable thing
11:42justin_smithso the jvm has its own ontology of classes vs. fields / methods, and rather than jumping through hoops and having special cases to make everything act first class, clojure is just like "well, this is java, do it the java way"
11:42justin_smithany normal clojure thing will generate objects, which are first class, and you can use in the usual handy convenient ways
11:43kilenI accept that, I'm now trying to understand how the macro which converts the invocation into java interop form gets invoked
11:43justin_smiththe macro creates an fn
11:43justin_smithan fn is a callable object
11:43TimMcdabd: Yeah, looks like vector-zip isn't what you want at all, then.
11:43justin_smithinside, it invokes a static method
11:44justin_smithit is a workaround for the fact that a static method is not something you can pass around as a first class thing
11:44justin_smithyou wrap it in something that is
11:45justin_smithand you dream of a sane design where things that should be first class functions actually are
11:45kilenjustin_smith: I'll try again to explain what's puzzling me. as macros go, I know that (someMacro quux) gets expands as the body of someMacro
11:46justin_smithright
11:46justin_smiththis happens at the moment of compilation, when the code is loaded
11:46kilenI don't understand how (NotaMacroAtAll-JavaStaticMethod) gets expand by any macro at all. there's no macro there., it looks like any other invocation.
11:47kilenahh
11:47kilenso the expansion (. foo bar) is the body of the fn that was created by expansion at compilation time?
11:47justin_smithit is inside the body of the fn
11:47justin_smithbut yes
11:48kilenclose enough
11:48kilenyay we made it! thanks :)
11:48justin_smithnp
11:48justin_smithso how about (. )
11:49justin_smithI don't know how to examine that in the repl at all
11:49justin_smithmust be a reader macro or special form?
11:49coventryIt is a special form.
11:49justin_smithI just realized I can't ask for its class, but yeah, I can call doc on it
11:50justin_smith"they all expand into calls to the dot operator at macroxpansion time"
11:50coventryI don't actually know where (Integer/parseInt ...) gets turned into (. Integer parseInt ...), though. I don't think HostExpr is the place, either, and it's not the reader.
11:50coventry,(read-string "(Integer/parseInt \"4\")")
11:50justin_smithhttp://clojure.org/java_interop#dot this is where the doc for . led me
11:50clojurebot(Integer/parseInt "4")
11:51bbloomcoventry: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L803
11:54coventrybbloom: Thanks. That's not where the expansion happens, though. It's (predictably enough, I guess) in macroexpand1. https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6517
11:54bbloomah sorry, answered the wrong question :-)
11:54TimMc&(macroexpand '(.foo bar))
11:54lazybot⇒ (. bar foo)
11:54TimMc&`(.foo bar) ;; to demonstrate that it's not read-time
11:54lazybot⇒ (.foo clojure.core/bar)
11:55dnolensomewhat less half baked CLJS for for making mutable JS object comform to a epochal time model - now with more refined ideas about handling nested objects - https://gist.github.com/swannodette/7644500
11:55justin_smithTimMc: yeah, . seems to be the bottom of things for normal inside clojure stuff - you need to start messing with the compiler to get lower than that
11:55dnolenwould be easy to write a macro to make an EpochHTMLElement or EpochCanvas
11:55nDuffblegh.
11:56nDuff...still been playing around with using core.logic for recognizing bytecode-level optimizations
11:56bbloomdnolen: the "next epoch" stuff reminds me that i need to find time to elaborate on https://github.com/brandonbloom/exstate/blob/master/src/exstate/core.clj
11:57TimMc&(macroexpand `(~(symbol "") 1 2 3))
11:57lazybotjava.lang.StringIndexOutOfBoundsException: String index out of range: 0
11:57nDuff...but most of the available libraries providing single-assignment intermediate representations for java bytecode either (1) have outright horrifying implementations [think: mess of singletons and mutable state], (2) aren't reversible back to java bytecode, or (3) aren't implemented in Java.
11:58TimMcnDuff: Aren't reversible?
11:58TimMcAs in, have no possible representation, or are just really hard to reverse?
11:58nDuffTimMc: well, don't have implementations presently available for reverse transformations.
11:59nDuffTimMc: not that it isn't possible, just it isn't done; and I'm trying to keep things narrowly-scoped.
11:59TimMcI was thinking about writing (or convincing someone else to write) a learning reverser.
11:59nDuff(Wala is the particular toolchain for which that's the case)
11:59TimMcYou'd feed it a bunch of input-output pairs for a transformation and it would build a model for the reverse.
12:04technomancynDuff: doooo eeeet
12:05dnolenbbloom: oh a lib to deal w/ external state?
12:05jcromartiewhen I'm working with records and protocols in the REPL via CIDER, and I use C-c C-k to load a file, then trying to call any protocol function on a previously-created record fails with "No implementation of method:"
12:05bbloomdnolen: yeah
12:06bbloomdnolen: i discussed the idea in here a few months ago when i first implemented that prototype
12:06nDufftechnomancy: ...write a wala IR -> JVM bytecode compiler? Eh, maybe for 1.0; for 0.1, I'm probably going to hold my nose and use Soot; I'd rather prove the concept before sinking time into improving the tools used to implement.
12:06bbloomdnolen: the premise is to view the outside world is a filesystem w/ synchronous reads and asynchronous writes. where all external services are mounted at some route & the routing tables are cheap and immutable
12:08jcromartieit happens if I use (require ... :reload) too
12:08technomancynDuff: I meant the for ocaml
12:08jcromartieI understand what's going on but I wonder how I can avoid it
12:08nDufftechnomancy: ahh.
12:08jcromartieother than avoiding interactive development with protocols and records
12:08technomancyjcromartie: pretty much
12:08jcromartiebah
12:08jcromartiethat sucks
12:08jcromartiewell at least this part doesn't change much
12:09bbloomdnolen: kinda plan9 + datomic inspired
12:13dnolenhttps://gist.github.com/swannodette/7644500, add back -update!, if a value has children you can't -update! it
12:15dnolenbbloom: I think there's an interesting opportunity here with what I've got to do batching and doing a read will fuse?
12:15dnolenwill ponder that
12:15bbloomdnolen: what do you mean by "fuse"?
12:16dnolenbbloom: actually apply the batched operations
12:17bbloomin your code? i don't see any batching...
12:17bbloomi still don't really understand it tho
12:18dnolenbbloom: nothing there yet - talking out loud :)
12:18bbloomi'm still not really convinced that this is a big issue
12:18bbloomjava interop isn't any fun b/c you need to create tons of config objects w/ builder APIs and all that nonsense
12:19bbloomjavascript interop sucks b/c you need to do the same thing
12:19bbloomonly it double sucks b/c the "builder API" has nice data notation in JS
12:19bbloom:-P
12:19bbloomit *feels* close to have a clj map and a js obj and be like "why can't i just make this magically work?"
12:19dnolenbbloom: yeah I just agree at all w/ your take on the response
12:19dnolen(js-obj "foo" "bar")
12:20dnolen{foo: "bar"}
12:20dnolennot saving many characters here
12:20dnolen"just don't agree"
12:20bbloomheh, ok, was about to ask
12:20bbloomi don't think it's about saving characters
12:20bbloomit's about some warm fuzzy feeling
12:20dnolenbbloom: don't get me wrong I think #js literal idea is a fine one
12:21dnolenand that would make people a little bit happier but really
12:21justin_smithif it's just about comfort, just ripping the bandaid off is the best policy
12:21dnolen#js {"foo" "bar"} vs. (js-obj "foo" "bar")
12:21dnolencome on
12:21bbloomdoThing(with, args, {like: "this", and: "that"}) is just much more pleasant than (js/doThing with args (js-obj "like" "this" "and" "that"))
12:21dnolenbbloom: marginal
12:21bbloomdnolen: yeah man, it's marginal to you and me
12:21bbloomdnolen: b/c we understand that it's surface beauty
12:21bbloomdnolen: but people care about that weird shit
12:21bbloomhence: ruby.
12:22bbloomwhy use a map when you can spend a bunch of time metaprogramming a fancy english-ish configuration API that essentially boils down to a map?
12:23rasmusto~map
12:23bbloomi don't have proof, but i'm pretty sure athsetics drives much of the clj->js desire
12:23clojurebotmap is laziness
12:23bbloomthat's not to say there isn't value in making the process smootehr
12:23bbloomthere certainly is
12:24bbloomespecially b/c json is so popular in js libs, where wacky class hierarchies and absurd DSLs are so popular in java and ruby respectively
12:24bbloomthe popularity of json means that there is real opportunity for a solution that may actually be broadly applicable
12:26bbloomi think an even bigger win than a #js literal would be a dot-like form tuned for js calling conventions, much like coffeescript's splat & keyword args and whatnot
12:27dnolenbbloom: #js literal maybe, sugary stuff not gonna happen, people write their macros for that stuff.
12:28bbloomdnolen: yeah, but that's what i'm saying: i think the complaints are about sugar
12:29nDufftechnomancy: Hmm. Do you have experience w/ any options for running OCaml on the JVM? Even if I'm using the IR implemented in OCaml, I'd rather not give up core.logic or have to serialize/deserialize everything crossing the boundary.
12:29dnolenbbloom: perhaps, but I'm skeptical that's the only reason
12:29bbloomnDuff: not to speak for technomancy, but i think the only reason he bothered with ocaml was to avoid the JVM :-P
12:30technomancyno, he's right
12:30technomancyI wasn't actually paying attention to what you were doing; just happened to pattern match on that one particular word. sorry =)
12:31nDuffheh, np.
12:35danneuWhat does this error usually mean? namespace 'eraser.core' not found after loading '/eraser/core'
12:35TimMcIt might mean you have a typo in either the ns or the file path.
12:35hiredmanit means you have the wrong name in your ns form, or don't have an ns form
12:35TimMcor an underscore/hyphen confusion.
12:36danneuMy test autorunner enters this state after a few autoruns lately. Otherwise the suite runs entirely a few times.
12:36danneugood opportunity to try midje
12:40coventryThere are some drawbacks to midje. http://blog.circleci.com/rewriting-your-test-suite-in-clojure-in-24-hours/
12:44TimMccoventry: What drawbacks?
12:44gfredericksTimMc: you might have to rewrite your tests in clojure.test
12:44TimMcI skimmed the blog post, but it didn't seem relevant to that.
12:45danneui read a blog post a while back about some effort towards a core.test rewrite or big refactor.
12:45TimMcOh, I see -- missed the directionality.
12:45TimMcBut it doesn't mention *why* they didn't like midje.
12:45bbloomTimMc: it only uses the word "idiomatic"
12:46bbloomor rather "unidiomatic"
12:46myguidingstarhi all, what are the best practices to mock/test file io?
12:46danneukibit called their test suite unidiomatic so they're working towards kibit compliance
12:47danneukdd
12:47justin_smithlol
12:47bbloommyguidingstar: for the O part, you can use with-out-str
12:48bbloommyguidingstar: for the I part, you can use http://docs.oracle.com/javase/7/docs/api/java/io/StringReader.html
12:48justin_smith,(with-in-str ":hello" (read))
12:48clojurebot:hello
12:48justin_smithwhy not with-in-str?
12:48justin_smithoh because you are not usually reading from *in* of course
12:49bbloomjustin_smith: i had no idea that existed
12:49technomancyguns: hey, I was going to tweet about the new slamhound release; do you have a twitter account I could include?
12:49coventryTimMc: Too much magic. While that post is explicitly about rewriting, the tone most of the way through it is "here's some more magic which makes midje tests and the results of running them hard to reason about."
12:49gunstechnomancy: oh wait!
12:49gunstechnomancy: It's not quite released...
12:49gunsTrying to shove a last bugfix out the door
12:49technomancyoh, haha. sure
12:49gunsI didn't push the 1.5.0 git tag for that reason
12:50technomancyno worries
12:50justin_smithcoventry: yeah, I looked at midge and it failed my "does it exist to emulate ruby" sniff test
12:50TimMcouch :-P
12:51TimMcMy experience has simply been that composing can be a more difficult with Midje.
12:51technomancyit reminded me a bit of CL's LOOP macro
12:51justin_smithIt is that whole magic thing. Accepting greatly increased complexity in return for minor conveniences.
12:52danneui've been using jaycfields' http://jayfields.com/expectations/ for months. `(expect :a (first [:a :b :c]))`
12:52TimMcI'd like to see some of the prerequisites stuff pulled out into a separate utility, for instance.
12:52technomancymaking up "english-like" syntax instead of using lisp calling conventions
12:52technomancyor "non-structured" rather than "english-like" I guess
12:54llasramMacros make it easy for internal DSLs to be arbitrarily different from the host language
12:54llasramI don't think the problem is that it's "English-like," but that it's no longer the host language
12:55llasramThere are lots of good ideas in Midje, but I've definitely found the cognitive load of effectively writing your tests in a different language than your code to be more than I want to absorb
12:57hiredmanis halfway between clojure.test and cucumber really a destination?
12:57danneumy last job was at a rails shop and it's easy to underestimate the load of having to write `assert User.new(name: "Chuck").valid?` as `subject.should be_valid`
12:57hiredman(given many don't actually like cucumber)
12:59danneumy favorite ruby test lib is https://github.com/sconover/wrong - `assert { <ruby code> }`. and it analyzes the code to show helpful fail messages
13:02danneuwhich is something i think every clojure lib already does
13:03coventryBwahaha
13:04coventryOh, you mean testing libs.
13:05danneuwell, if there's a cooler way to interpret the things i write, i don't want to stop you.
13:17eigenlicht /join #c
13:17eigenlichtnobody saw that, ok
13:18tbaldridgeclojurebot sees everything
13:20mdrogalis~omnipresent
13:20clojurebotExcuse me?
13:20rasmusto~omnipresence
13:20clojurebotIt's greek to me.
13:22justin_smith~πανταχού
13:22clojurebotTitim gan éirí ort.
13:22justin_smith~πανταχού
13:22clojurebotExcuse me?
13:22justin_smith(that is the greek word for omnipresence, btw)
13:23wakeupgotta love emacs unicode support
13:24rasmustooh i cant see it
13:24justin_smithI just pasted it in from google where I looked it up, heh
13:24justin_smithsadly, emacs does not do zalgo text properly
13:24justin_smiththe sacrifices I make for this platform
13:24wakeupzalgo?
13:24eigenlichtor word processing
13:24justin_smithwakeup: http://knowyourmeme.com/memes/zalgo
13:25justin_smiththere is a unicode text trick for zalgo
13:25justin_smitha classic example: http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags
13:25justin_smithtop answer is fucking hilarious
13:25wakeuprasmusto: emacs mixes bitmap fonts with ttf fonts for fallback
13:26wakeupH̘Ë͖́̉ ͠P̯͍̭O̚​N̐Y̡ H̸̡̪̯ͨ͊̽̅̾̎Ȩ̬̩̾͛ͪ̈́̀́͘ ̶̧̨̱̹̭̯ͧ̾ͬC̷̙̲̝͖ͭ̏ͥͮ͟Oͮ͏̮̪̝͍M̲̖͊̒ͪͩͬ̚̚͜Ȇ̴̟̟͙̞ͩ͌͝S̨̥̫͎̭ͯ̿̔̀ͅ
13:26wakeupdoesn't reallly work in emacs
13:26justin_smithnope
13:26justin_smithworks in the browser
13:26wakeupbt the characters itself are displayed correctly
13:26justin_smithdunno if any text-editor proper would support it
13:26justin_smithyeah
13:26wakeupjust positioning is off
13:26justin_smithit just doesn't do the layering
13:26wakeuphard to navigate if it would
13:26rasmustowakeup: i should try to get putty-tray to do that w/ comic sans
13:27justin_smithyeah, that is likely the reason
13:27wakeuprasmusto: if comic sans has a big set of glyphs which I doupt
13:27rasmustowakeup: (wingdings fallback)
13:27wakeuphaha
13:31wakeupMe going wild with math glyphs in lisp code: http://imgur.com/BaWzdBq
13:32justin_smithwakeup: do you have a low resolution screen, or really good eyesight?
13:33wakeupjustin_smith: 1280x1024
13:34justin_smithI forget that most of the world is not at super high screen resolutions sometimes
13:34wakeupgood eyesigh on short distances
13:34wakeup;)
13:34wakeupYeah the monitor I use is really old, but really really good
13:34wakeuppristine truecolors and all
13:35rasmustowakeup: im rocking an lgl246wp-bn at home, it's pretty solid
13:35rasmustobut the backlight is dimming on the left side :<
13:35justin_smithnice. Where I work everyone has a mac cinema display as their secondary monitor
13:35wakeupThe next monitor I buy has to have a feature that reduces or eliminates the fly-poop
13:35wakeupor whatever it is flies leave
13:35wakeupEIZO :)
13:35seangrovewakeup: Are those font-locks, or actual characters in the source?
13:36wakeupseangrove: actual characters in utf-8
13:36justin_smithemacs makes symbol entry pretty easy: C-x 8 <return> snowman <return>
13:36wakeupseangrove: http://repo.or.cz/w/flub.git/blob/HEAD:/bachelor-cs/set-theory.lisp
13:36justin_smithand of course you can put favorites on a simpler keybinding
13:37wakeupI have an xmodmap keybingings for math characters
13:37seangrovewakeup: More a fan of font-lock replacements in emacs, personally
13:37justin_smithseangrove: that is definitely kinder to collaborators and downstream users
13:37seangroveBut maybe that's just me being crazy, definitely could be.
13:37danneuIs there a lein plugin that auto-runs appropriate core.test suite on file save?
13:37gunsYou can also use readline bindings to write utf-8 in a shell
13:38guns❤ utf-8
13:38seangrovejustin_smith: That's my concern, but maybe it's crazy to expect collaborators who can do the whole clojure/lisp thing but can't handle utf chars
13:38wakeup
13:38wakeupsnowman!
13:38justin_smithwakeup: every unicode is available by name that way
13:38justin_smithand if you enter a * glob and tab it shows cantidates
13:38justin_smithlike check out *cat*
13:39seangrovewakeup: Wouldn't mind seeing some code with all the symbols :)
13:39justin_smith😹 <- "CAT FACE WITH TEARS OF JOY" is the name of that codepoint
13:39wakeupjustin_smith, seangrove: It's not like this is production source, this was an experiment for myself, I think programs in ASCII aren't a bad thing!
13:40seangrovewakeup: Yeah, that's no problem at all of course. Definitely fun for doing things on your own!
13:40coventryHoly cow. http://cppgm.org/about.html "Students of this online course each single-handedly develop their own original C++ compiler, standard library, and toolchain"
13:41seangroveWow, C++ grandmaster.
13:41wakeuplol
13:41justin_smithin fact, weird unicode in names is a nice substitute for the ___***name***___ convention to indicate things you probably don't want to fuck with
13:42justin_smithie. the fact it is weird to enter in may increase the amount of time spent deciding whether one should really refer to it
13:43seangrove😼
13:43TimMcjustin_smith: Such as brehaut's favorite, a suffix to mark side-effecting predicates: ‽
13:43justin_smiththat would be a good name for an internal namespace for example
13:44justin_smithseangrove: that is the C-x 8 <return> I was referencing above
13:44seangrovejustin_smith: Ah, got it
13:44justin_smiththere is also M-x describe-char
13:45justin_smithif you want to know which thing that does not print properly is at point
13:45justin_smithfor example
13:45justin_smithor if you see a sigil and want to know its name
13:45TimMcTotally works.
13:45justin_smithCAT FACE WITH WRY SMILE
13:46justin_smithcome to think of it, I use C-x 8 <return> often enough, I should totally give it a C-c binding
13:47TimMchttps://www.refheap.com/21243
13:49justin_smith(global-set-key (kbd "C-.") #'insert-char) (global-set-key (kbd "C-,") #'describe-char)
13:49justin_smithworks a charm
13:50llasramI need to update my key-bindings... I'm still using `ucs-insert`, which apparently now is just an alias for `insert-char`
13:51justin_smith"ucs-insert is an alias for `insert-char' in `mule-cmds.el'."
13:51justin_smiththats what M-x describe-function tells me
13:51llasramjustin_smith: I think that's basically what I just said...?
13:52justin_smithjust verifying
13:52gf3TimMc: re: wat.json
13:52llasramkk :-)
13:52gf3TimMc: Those are all real-life WTF comments people have made, mostly on IRC
13:52justin_smithllasram: I misunderstood what you meant by "apperently"
13:53llasram😼
13:54jcromartieso I have a rather simple set of protocols here for data model change transactors and transactions
13:54jcromartieI know, just use Datomic right?
13:54jcromartiebut just humor me
13:56jcromartie(defprotocol ATransactor (transact [x transaction] "Update state and persist transaction"))
13:56jcromartiereally it just calls (defprotocol ATransaction (run [x state] "Apply this transaction to the data model state"))
13:56jcromartiebut for a file-based transactor it would write the transaction to a log and return the new state
13:56mikerodclojure.reflect/type-reflect is called in an AOT-compiled src/main directory; it fails with ClassNotFoundException when the class is from a `defrecord` that is not AOT-compiled in a src/test directory; anyone have insight into what could be happening?
13:56jcromartiefor a SQL transactor it would insert a row, etc.
13:57hiredmanmikerod: have you loaded the defrecord definition?
13:57justin_smithmikerod: I would lein clean and restart to rule out the most trivial possible cause of the problem
13:57jcromartieso the question is
13:57llasrammikerod: IIRC, type-reflect grabs the thread context class loader, which doesn't know about e.g. defrecords added to the Clojure dynamic classloader stack
13:57jcromartiewhat about side effects
13:58mikerodhiredman: yes the definition is loaded
13:58jcromartieyou could call a transaction on a transactor and cause it to be stored but somehow ignore the result
13:58jcromartieso I think the transactor needs to be stateful
13:58llasrammikerod: Here's a work-around I submitted to a similar problem in clara-rules: https://github.com/rbrush/clara-rules/pull/8/files
13:58mikerodhiredman: and I reproduce this in a REPL setting, probably because the reflect lib is grabbing the correct classloader stack
13:58mikerodllasram: this is along the lines of what I am thinking
13:58llasrammikerod: It doesn't entirely work, because it only grabs the base loader. To allow re-compilation, you need to make sure you're grabbing the current loader
13:59hiredmanthat seems unlikely
13:59mikerodllasram: that's funny you show this patch, because this is the same lines of code that I am fighting with in Clara
13:59hiredmanit looks like the default java reflector tries to read class bytecode
13:59llasrammikerod: haha
13:59mikerodI was reading the reflector clojure stuff, and I can't see why a dynamically loaded defrecord would not be visible to it
14:00llasrammikerod: I haven't used been back to clara since that patch. Not sure if it got reverted etc
14:01hiredmanmikerod: if you create your own java classloader using the value of the var clojure.lang.Compiler/LOADER it should work
14:01mikerodllasram: your changes are in the version I am looking at/working with. I was setting up some tests where I generate some dynamic defrecords, and clojure.reflect/type-reflect is giving me the ClassNotFoundException
14:01hiredmanit takes the value of the context classloader at load time, which seems kind of gross
14:02llasramhiredman: Ah, yeah -- I think that's the problem
14:02mikerodoh
14:02hiredmanhave you considered just using reflection?
14:02mikerodI was thinking there was something going on here with grabbing the load-time classloader
14:02mikerodwhich, I guess is then unaware of any new classes being added later
14:02llasramThere's a clojure.lang.RT method makeClassLoader, which I think is the Right Way To Do It (tm)
14:03llasramI think the fix is to use that method, and call it each time you invoke type-reflect
14:03hiredmanI am not a huge fan of clojure.reflect, largely because it seems sort of half baked with things like this
14:04mikerodso you'd call type-reflect with a new :reflector each time?
14:04mikerodto keep it "fresh"
14:04mikerodhiredman: yeah, I am a bit skeptical on clojure.reflect, especially after this one
14:04llasrammikerod: I believe so. I'm not entirely certain even that will work
14:04llasramI think hiredman's suggestion of just directly reflecting on the class might be way to go
14:04mikerodindeed
14:05TimMcgf3: Do you use that file for anything>
14:06gf3TimMc: Oh yeah, we've got an IRC bot that spits those out randomly when people say "wat"
14:06gf3wat
14:06b-otgf3: Blog wat: http://grenzgenial.com/post/2414488498/javascript-and-the-brain-why-javascript-is-the-future
14:06ToxicFrogOh boy
14:08gfrederickswhere does core.typed store the annotations for vars in clojure.core?
14:09seangroveLuckily this blog-wat post isn't loading. Probably good.
14:10seangroveAh, guess it's here now http://grenzgenial.tumblr.com/post/2414488498/javascript-and-the-brain-why-javascript-is-the-future
14:10TimMcAha.
14:10TimMcwat
14:10b-otTimMc: I am having a jsp that contains a jquery tab and inside tab i am having a custom search component on clicking the component a grid will open and it will act as an overlay and i used this plugin to close the grid if the user clicks outside the gridis working perfectly in all other element click other than jquery tab selection component
14:10TimMcNice.
14:11justin_smithwat
14:11b-otjustin_smith: can i use document.write to call a json
14:11seangrove"a) No types: types are stupid. "
14:12seangroveSeems like a fairly straigthforward answer
14:12hiredmangfredericks: there is a #typed-clojure channel where you may have better luck asking such things
14:12gfrederickshiredman: I am going to go there
14:12seangrovejson is a string, and strings do not implement IFn, so no.
14:12gfrederickshiredman: thx
14:12justin_smithseangrove are you talking to b-ot?
14:13seangrovejustin_smith: Just speaking to the wider point ;)
14:13hiredmangfredericks: sure, I am in there too, and interested in seeing the answer
14:13justin_smithwat
14:13b-otjustin_smith: javascript:(unescape); lead you to function unescape() { [native code] } Native Code, eh? I wonder if '%69%6C%6F%76%65%6D%6F%6F' has anything to do with a Native Code...
14:14hiredmangfredericks: depending what you mean by "stored" there is a source file called something like base_env.clj which I think is where the types are declared, but I am not sure where in memory stuff is stored
14:14gfrederickshiredman: oh I think that's all I meant
14:15hiredmanwell
14:15hiredmanhttps://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/base_env.clj#L1073
14:16seangrovejustin_smith: The collection of quotes is incredibly difficult to parse...
14:16seangroveSeems to highlight some problems with human communication and thought processes...
14:28sdvhbhszo8yhwtu YOU MAY BE WATCHED
14:28sdvhbhszo8yhwtuWARNING WARNING WARNING, WARNING
14:28sdvhbhszo8yhwtuWARNING WARNING WARNING, WARNING WARNING
14:28sdvhbhszo8yhwtu YOU MAYWATCHED
14:28sdvhbhszo8yhwtuYOU MAY BE WATCHED
14:28sdvhbhszo8yhwtu YOU MAY BE WATCHED
14:28trptcolinsuch caps lock. noble consonants in username. wow.
14:28TimMcOh, we got this one over on foonetic as well.
14:28seangroveTrue, true.
14:32sdvhbhszo8yhwtu YOU MAY BE WATCHED
14:32sdvhbhszo8yhwtuWARNING WARNING WARNING, WARNING
14:32sdvhbhszo8yhwtuWARNING WARNING WARNING, WARNING WARNING
14:32sdvhbhszo8yhwtu YOU MAYWATCHED
14:32sdvhbhszo8yhwtuYOU MAY BE WATCHED
14:32kilon_o_O
14:33kilon_:D
14:33seancorfieldheh... thank you!
14:33kilon_i love your style
14:33technomancypew pew pew
14:33piskettipreemptive strike
14:39TimMcWhen someone takes op, I imagine them glowing slightly.
14:43technomancywhen someone who joins takes op because they forgot to turn it off before parting I imagine trumpeter fanfare
14:45shaunxcodeis it crazy talk to use the channel returned by a go block as a way of early return e.g (def ch (go ... (if x (>! ch early-result) normal-path))
14:46joegallo_technomancy's ops are over 9000!!!! http://tinyurl.com/p6cwmdz
14:46hiredmanshaunxcode: you can't, you don't have access to the returned channel inside the go block
14:47hiredmanshaunxcode: it may actually work in a def like, due to def, but it won't work with locals
14:47shaunxcodehiredman: in that example I do though (I have this working I was just wondering if it would appear odd)
14:47edoloughlinI find that using logging statements breaks a clean functional style (e.g., using 'do' everywhere). Is there an idiomatic way of doing this that I just don't know about?
14:48dnolenshaunxcode: I also don't see how that example demonstrates early return
14:48hiredmanshaunxcode: try it with a let
14:48technomancyedoloughlin: for quick debugging I often use (doto x prn)
14:48technomancy(if it's not going to get checked in)
14:49edoloughlinI'm looking for something more permanent. I.e., logging calls to a REST API. I want to be able to generate long-term logs.
14:50edoloughlin...without making my code look ugly.
14:51justin_smithedoloughlin: there are things like spy in many logging libs that return what the original form returned, while logging the form and its result
14:51edoloughlinjusting_smith: thanks. That might be a good starting point.
14:52TimMcedoloughlin: I have written "check" (a doto + when-not) that I use to log which part of an if expression's conditional is failing.
14:52hiredmanshaunxcode: the way def ends up working, you can refer to the thing being def'ed in the value of the def, as long as the def actually happens before you try and get the value
14:52edoloughlinI'm looking to do application-level logging. E.g., "user X created resource Y"
14:53hiredmanwhich basically means if you def a function and the value of the var (that def creates) is not refenced until you try and run the function
14:53hiredmanso your (def … (go …)) is actually a race condition
14:54hiredmanhas def interned the channel returned by the go block as the value of the var by the time the running go block on the threadpool or whatever has gotten to the dereference of the var
14:54edoloughlinAnyone know if http://www.clojure-toolbox.com/ is still a good catchall for libs, or is there something more current?
14:56shaunxcodehiredman: good call - trying it in let block made it clear.
14:57hiredmanshaunxcode: I dunno what your background is, but people coming from scheme often try to use def as a synonym for let, like define in scheme, but clojure's def is definitely not like scheme's define
14:58hiredmanclojure's def only operates on the global environment, nothing lexical about it at all
14:58gfredericksI've been wanting a robert-hooke based lib for logging around vars
15:17bitemyappgfredericks: uhm, I did that with blackwater.
15:17bitemyappgfredericks: but for SQL and pretty colors.
15:17bitemyappgfredericks: you could whip up what you want in a jiffy yo.
15:25Apage43juffowup
15:27bitemyappApage43: ?
15:28Apage43who knows
15:28llasramTime to start hacking Apage43's accounts I think
15:30Apage43it's never that time. That time ruins my day
15:30bitemyappgfredericks: please don't mention things I like without elaborating :(
15:32gfredericksbitemyapp: I get stalled thinking about it because I don't know how much it should be coupled with a structured logging lib
15:33seangrovegfredericks: channel all the things, decoupling.
15:33gfrederickshuh?
15:34seangrovegfredericks: Just thinking about a robert-hook logging-oriented library with core.async channel-based apis
15:34seangroveShould be pretty simple with a structure like that to pipe it into other libraries.
15:34gfredericksseangrove: the question in my mind is whether the var-hooking lib can log data or should assume it can only log strings
15:35seangroveAh, that's what you meant by 'structured'
15:35seangroveWell-made point.
15:36justin_smithoptional arg for a formatter, that can choose to print readably or whatever else? default just being calling str on the args?
15:36gfredericksI wouldn't want to use it if I had to do that every time I wanted to log something
15:37gfredericksI've gotten so used to structured logging that I can't fathom going back, but I don't know of a decent public lib for it
15:41seangrovebitemyapp: Drinks or dinner tonight somewhere on Market? Thinking orbit-room or armory club if you're inclined.
15:43hiredmanpedestal has a little logging api
15:44rkneufeldhiredman: my ears are ringing. Whose using pedestal's logging library where!?
15:44hiredmanno one, I am just throwing it out there as opensource clojure code with structured logging
15:45hiredmanhttps://github.com/pedestal/pedestal/blob/master/app/src/io/pedestal/app/util/log.clj
15:45rkneufeldCool. FWIW: It's pretty spartan, and definitely needs a bit of work
15:45stuartsierraIn retrospect, I think my addition of a new logging API in Pedestal was probably a mistake.
15:45hiredmansure, but with what little I have done with it, it seems vastly superior to, for example, what we currently use at work (which is not structured at all)
15:46seangroverkneufeld: What do you think of pedestal for a chat app for an introductory run-through? Worth it, or overblown?
15:46stuartsierraBut I'd like to have a standard API for structured log messages, unlike clojure.tools.logging which is mostly string-based.
15:46rkneufeldTimbre looks kind of neat: https://github.com/ptaoussanis/timbre. And we have a recipe on it in the cookbook: https://github.com/clojure-cookbook/clojure-cookbook/blob/master/deployment-and-distribution/logging-with-timbre/logging-with-timbre.asciidoc
15:46hiredmanstuartsierra: a start would be spinning pedestal's out in to a library
15:47gfredericksstuartsierra: I've been able to use c.t.l with structured
15:47seangroveI've noticed some of the ui patterns I've independently been working towards seem to be pretty well baked into pedestal, so it's piqued my interests recently.
15:47gfrederickswith log4j all it takes is a custom Layout class
15:47stuartsierrahiredman: Yes, it's on the (infinitely long) queue.
15:47kilenWhat's the idiom for caaddr-like helpers? firstfirstrestrest doesn't quite capture it.
15:47seangrovekilen: hahahahaha
15:48seangroveLove that idea :)
15:48gfrederickskilen: I think we mostly use destructuring instead
15:48seangroveffrrest
15:48llasramkilen: destructuring
15:48rkneufeldseangrove: Hmm, I think it would depend on the level of your audience. Admittedly, the introductory material can be a little rough aside from going through the bulk of the app-tutorial (pretty big).
15:49seangroverkneufeld: Yeah, made it about half-way through, but haven't completed it. On reflection, I think porting kandanapp over to pedestal could be a worthwhile learning experience
15:50kilengfredericks, llasram: is there sugar I'm on aware of? that only works in a binding context, no? what would (count (caaddr foo)) translate to?
15:50llasramkilen: You do a destructuring bind wherever you get `foo` from in the first place, or you do the destructuring bind on `foo` before calling `count`
15:52kilenllasram: say it's a retval of some function, can I do it outside a let or function argument decleration? if not, it's far less convenient
15:52llasramkilen: Why don't you refheap/gist up an example?
15:55ath0cd do
15:58justin_smithkilen: yes, you can destructure in a let, loop, doseq, for...
15:59justin_smith,(let [[a b c] (range)] b)
15:59clojurebot1
16:01justin_smiththere is also get-in
16:02llasramI would waaaay rather see destructuring in code than a call like `(get-in [0 1 1 1 0] foo)`
16:02justin_smith,(get-in [:a :b :c [:d :e [:f :g :h]]] [3 2 1])
16:02clojurebot:g
16:02b-otjustin_smith: Sorry, I can't find anything on [:d+:e+[:f+:g+:h]]]+[3+2+1])
16:02justin_smithwat
16:02b-otjustin_smith: How can I replace a php include navigation with jQuery?
16:03kilenjustin_smith: nice, that's much better then (first (first (rest))
16:03llasramHuh -- is b-ot also listing on ^, ?
16:03justin_smithonly works on vectors though
16:04justin_smithbut agreed with llasram that a destrucuring is usually better
16:05justin_smithget-in becomes nice when you are doing partial walks, so constructing or manipulating the sequence of keys to step into
16:06kilenjustin_smith: still, you have to add a let in there to destructure, it doesn't fit well with a series of steps you might translate into a -> form
16:07justin_smithunless you write a helper that does the destructuring
16:07justin_smithwell, no, you don't need a let, an fn would suffice
16:08hiredman,(doc as->)
16:08clojurebot"([expr name & forms]); Binds name to expr, evaluates the first form in the lexical context of that binding, then binds name to that result, repeating for each successive form, returning the result of the last form."
16:10teslanick,(source as->)
16:10clojurebotSource not found\n
16:10justin_smithyeah, the source is easier than the doc string for me :)
16:11teslanickI usually like to see how the non-special-forms bits are implemented. It helps me understand the docstring.
16:11kilenhiredman: iiuc that combins let with ->, it doesn't help destructure an intermediate result
16:12justin_smith(defmacro as-> [expr name & forms] `(let [~name ~expr ~@(interleave (repeat name) forms)] ~name))
16:12justin_smith
16:12kilenso just (def caddr (comp first rest rest)) basically if that's what you need. fair enough,
16:12hiredman,(-> {:a 1} (as-> {:keys [a]} (+ a)))
16:12clojurebot{:keys [nil]}
16:12justin_smithyeah it constructs all the lhs in the let, so it does not help destructure
16:12hiredmanclojurebot: jerk
16:12clojurebotyou cut me deep, man.
16:12llasramkilen: Also `nth`
16:13kilenllasram: only for vectors, no?
16:13hiredmankilen: I think whatever is missing here, is you don't have deep nesting of lists in clojure like you do in other lisps
16:13llasram(inc hiredman)
16:13lazybot⇒ 28
16:13hiredmankilen: in clojure you don't use alists, you use maps
16:13llasram,(nth '(0 1 2 3) 2)
16:13clojurebot2
16:13kilenhiredman: that actually makes a lot of sense
16:14kilenllasram: yeah, you can't erase silly things you say on irc unfortunately
16:14llasramkilen: Not with that attitude you can't!
16:15kilenllasram: ok
16:16llasramBecome a supervillian and erase all our minds / kill us all
16:16llasramIt just takes a positive attitude
16:17llasramkilen: I am still curious about any specific example you have, unless maps vs alists has turned it into a non-issue
16:20kilenllasram: how about (first (rest (helper foo)) as the retval expression of a function? the style advice on maps is helpful though.
16:20llasramkilen: `second` is (comp first rest), so the stdlib has you covered that far
16:22llasramkilen: I think it does come down to style, which may be a two-way street w/ what Clojure provides. If I'm using a vector as a positional "record," I'll usually turn it into a map at 3 fields.
16:23llasramIn part I'm sure because that makes it easier to access portions of the structure
16:24kilenllasram: yeah, I tend to end up with lots of first first in code, I'm going to try switching to maps. thanks.
16:37dotemacsHi, I can see that clj-pdf can be used to generate a new PDF file, but what about editing an existing PDF file, do you know of a good package for that ? Thanks
16:39bitemyappdotemacs: editing PDFs other tools generated is often messy and source-specific
16:40bitemyappdotemacs: there isn't a good high-level way to do so, you're going to be hacking it up yourself.
16:40bitemyappits just the way PDF works.
16:41justin_smithif clj-postscript existed we could run clojure in pdfs
16:41justin_smithI guess new fangled pdfs have javascript too
16:41bitemyappjustin_smith: horrific.
16:42justin_smithyeah, I know
16:42seangroveWish there was a nicer syntax for fields
16:42justin_smiththe fact that they are emphatically not passive documents but a full but unreadable programming language is actually what I don't like about pdfs
16:43kilendotemacs: you might be able to use qpdf to convert that into a text processing task. it's a pdf -> text -> pdf structure editor, I've used it before, not with clojure though.
16:43bbloomjustin_smith: wasn't that like 2005? old news :_P
16:43llasramActually, the PDF subset of PS drops Turning-completeness. The original idea was that it was essentially an entirely pre-rendered PostScript
16:43seangrove(map (juxt #(.-name %) #(.-value %)) (prim-seq (.-attributes el))) Isn't very nice.
16:43bbloomjustin_smith: still horrific, however
16:43dotemacsbitemyapp: im involved in a project that is already doing that, where PDF forms have to be filled in which works fine using pdftk (CLI tool), the only part that is missing is crossing out certain form fields with thick black lines. So if there was something which could just add thick black lines...
16:43justin_smithbbloom: it was after I learned how to use pdf, so it is new fangled :)
16:44dotemacskilen: thanks, but the PDF document needs to stay PDF, it's just the insertion of thick lines in certain forms that I need to add
16:44justin_smithdotemacs: that's at most 20 characters of postscript code
16:44justin_smiththough pdf is terrible and I am sad you have to use it
16:44dotemacsjustin_smith: ok, i'll look into that, never tried postscript coding before :)
16:45justin_smithI don't know if coding it directly is wise, most use a tool that inserts a shape or object into pdf by generating postscript
16:45kilendotemacs: like I said, it's a "structure editor" the text representation is just an IR, you should see if it fits your needs. it's not a pdf->text converter.
16:45bitemyappdotemacs: you're going to hack it up yourself.
16:46dotemacskilen: thanks, looking into qpdf now
16:46justin_smiththe issue is that pdf is not a declarative page, it is a turing complete language that outputs a page, which makes generalized editing tools a big task
16:47justin_smiththough putting an arbitrary shape on top of what is there is comparatively doable
16:47kilendotemacs: it's a analysis-synthesis type deal
16:47llasramPDF w/o JS is *not* Turing-complete
16:48justin_smithllasram: ? postscript is a programming language, and it is turing complete
16:48justin_smithpdf is a container for postscript
16:48justin_smithit is related to forth
16:48llasramjustin_smith: Yes to the former, no to the latter
16:48justin_smithit has variables and loops yo
16:48justin_smithit is turing complete
16:48llasramPDF objects may contain a subset of PS w/o control structures
16:49justin_smithoh, pdf does not allow the entirety of postscript?
16:49llasramNo
16:50bbloomit's a venn diagram
16:50llasramThere's a lot of cruft (JS) in later version of PDF, but IMHO the base spec is pretty sane
16:53bitemyappdotemacs: supposedly cemerick has a PDF extraction library, I am hunting down the name.
16:54justin_smiththe amount of papers on turing completeness that are in pdf format (and marked as such in surrounding text) makes the turing completeness (or not) of pdf a hard thing to google
16:54llasramhaha
16:54coventrybitemyapp: PDF Text Stream http://snowtide.com/
16:55dotemacsbitemyapp: doesn't that just extract text from a PDF file? This link that coventry posted, cemerick's lib
16:55bitemyappcoventry: oh is that what pays for cemerick's 100% time?
16:56llasramjustin_smith: I only worked with PDFs at a low-level for a little while, so I may be mistaken, but my memory/experience is that it essentially contains the result of running a source PS "program"
16:56bbloomi dunno if it actually covers his 100% time or not, but i just assume that anything PDF related makes absurd amounts of money for no apparent reason
16:56bbloomi call that "PDF money"
16:56brehautllasram: that + a whole lot of crazy since
16:57brehautbitemyapp: http://www.pdftextstream.com
16:57cemerickdotemacs: Yes, PDFTextStream is strictly provides extraction functionality. Sounds like you need "editing", which is a whole different ball o' wax.
16:57llasramThere's a joke in there somewhere about printing money (since many printers use PDFs as their transfer format)
16:57llasramprinters == printing companies
16:58justin_smithand have hard coded stuff to detect money even? or is that an urban legend
16:58llasramOh, no idea on that one
16:58bitemyappjustin_smith: scanners and photoshop detect money yes.
16:58kilendotemacs: if what you're trying to do is graphical, you could try cairo+poppler to load, draw and render back to pdf.
16:58llasramI hadn't heard that urban legend :-)
16:58bitemyappprinters do not, they don't need to.
16:58lumafiyeah, it's true
16:58lumafihttp://en.wikipedia.org/wiki/EURion_constellation
16:58justin_smithbitemyapp: oh, ok, it is on the input end
16:58cemerickllasram: PDF uses a non-turing-complete subset of PS
16:59bitemyappjustin_smith: you can't use a conventional printer to make counterfeit bills so it doesn't even matter, plus they'd get marked.
16:59dotemacscemerick: thanks
16:59dotemacskilen: thanks, i'll look into it
16:59llasramcemerick: Glad to have my memories confirmed :-)
17:00justin_smithbitemyapp: yeah, that unique yellow pattern each printer does, which is why you need a color cartridge to have some ink even to print black and white
17:00bitemyappThat is probably partly why.
17:01bitemyappPDF is a good example of why you should eschew turing completeness/excess power whenever possible
17:03justin_smithbecause it does it well, or because it does it poorly?
17:05bitemyappjustin_smith: you want to use as little power as possible to solve a given problem.
17:05bitemyappjustin_smith: if a regular syntax would suffice, use that. If a context free grammar would suffice, use that.
17:05bitemyappjustin_smith: PDF's turing completeness is a horrendous problem.
17:05brehautbitemyapp: thank the IRS apparently :P
17:05bitemyappcontrast processing PDF with HTML.
17:05justin_smithwhy the IRS?
17:06brehautthey apparently funded a lot of development of PDF with specific features that they wanted
17:06brehauta lot of it was apparently to do with adding 'rich document' shenanigans (big frinstance ecmascript)
17:07bitemyappthe solution is to create rules of the standard for implementers, not embed a VM. :P
17:07bitemyappif word docx can suffice with XML, there's no reason PDFs needed to be turing complete.
17:07brehautbitemyapp: ah, the CSS solution ;)
17:07justin_smithso it was like powell motors and "the homer" automobile
17:07cemerickbitemyapp: it's not turing-complete. The Javascript you can embed in it, on the other hand...
17:07coventrybrehaut: Any keywords which would be useful in searching for that story? ("IRS pdf" turns up a lot of false positives. :-)
17:07bitemyappbrehaut: that's roughly how most PDF generators work anyway, like HTML and CSS, and CSSes problems are specific to its implementation not its nature.
17:08brehautcoventry: no idea sorry; i got the info from chatting with an internet friend who worked at adobe at the time on PDF stuff
17:09bitemyappcemerick: I'm pretty sure the PostScript derivative in PDFs is turing complete.
17:09brehautcoventry: feel free to take it as 2nd hand apocryphal
17:09technomancycoventry: hey, can you remind me of what issues you ran into trying to build troncle based on nrepl-discover that lead you to embed your own stuff?
17:09bitemyappcemerick: it would be very hard for you to prove otherwise.
17:09technomancywas it just the region-as-text?
17:10bbloomhttp://www.adobe.com/devnet/pdf/pdf_reference.html have fun guys
17:11bbloomoh, right you need to BUY the reference from ISO
17:11bbloominsert look of disapproval here
17:12bitemyapphttp://www.citationsoftware.com/faqPS_vs_PDF.htm
17:12bitemyappit says PDF doesn't have looping or conditional constructs, making it not turing complete.
17:12bitemyappAfter having seen the SKI combinator implemented in CSS, I would take that as a challenge.
17:13bbloomlol ok you have to link me to that ski/css thing
17:13bitemyappsorry, Rule 110
17:14bitemyappbbloom: have you seen the Rule 110 implementatio?
17:14bitemyappimplementation*
17:14turbofaili don't think there is any substitution mechanism in PDF either
17:14cemerickbitemyapp: do you really want to blow your time thinking about the guts of PDF, etc?
17:14bitemyappI saw SKI pop up somewhere weird not too long ago, but I don't think it was CSS
17:14cemerickLet me answer that for you: no, no you don't.
17:15bbloomin any case, turing completeness is pretty much completely irrelevant to the rule of least power
17:15bitemyapphttp://beza1e1.tuxen.de/articles/accidentally_turing_complete.html
17:15bitemyappbbloom: it's not irrelevant at all.
17:15bbloompeople create *accidentally* turing complete interpreters pretty much by default
17:16bitemyappDjango templates aren't turing complete because they terminate.
17:16bitemyappat least at the compile-time level.
17:16bitemyappruntime is more complicated because runtime is whatever your language is.
17:17bitemyappthe looping and conditional constructs don't mean much because it's data, not codata.
17:17bitemyappunless you injected a non-terminating generator, in which case you're an asshole.
17:18bbloomin order to choose something with the "least" power, you have to both assume power is a singular dimension and then define it
17:18technomancycemerick: do you think nrepl needs to be more descriptive around content negotiation?
17:18bbloomturing completeness is not a useful notion for practically any practical application of the least power principal, since practically anything you ever do is still going to deal with *very large* data as opposed to infinite codata
17:19bbloomso you're gonna need timeouts and other error handling anyway
17:19bbloomthe fact that you CAN write an infinite loop is pretty much moot if i can just generate arbitrarily large inputs
17:20bitemyappthat's not the point of eschewing turing completeness whenever possinle
17:20bitemyapppossible*
17:20bitemyappthe point isn't even halting in-and-of-itself although it can be useful, it's the programmatic processing of the data/code.
17:21bitemyappThere's more to code-writing-code than human generated macros.
17:21brehautbbloom: what is codata
17:21bitemyappbrehaut: http://blog.sigfpe.com/2007/07/data-and-codata.html
17:22coventrytechnomancy: Region-as-text, full-source-as-text (or at least line/column position of region, that's what I'm using it for at the moment), plus most crucially the ability for elisp to call into the discovered functions. Having nrepl-discovered clj output useful stack traces is also incredibly valuable for development. In a sense that was what triggered the rewrite: it was more for my own understanding, I just kept pulling stuff out
17:22coventryuntil I had that working, then I kept going until it just does what I need. So I'm not rejecting nrepl-discover wholesale, but I'm anticipating that for troncle I'm going to need more than it offers.
17:22bbloombitemyapp: i agree that's about programatic processing of the data/code -- which is precisely why turing completeness is not a relevant design characteristic when evaluating usefulness for processing
17:23bbloombeing able to build a turing machine in my DSL makes me say "heh, neat" not "omg! my DSL is too powerful!"
17:24bitemyappturing completeness affects your ability to deterministically process the input.
17:24bbloomonly if you're assuming i need to execute the input to do anything useful with it
17:24bitemyappI am positive that fact hasn't escaped you, so I'm going to assume you're being contrarian for the sake of it, to the detriment of anybody trying to learn something here.
17:26bbloomi don't subscribe to the rule of least power. instead of trying to minimize power, i try to maximize leverage, which, often, coincides with lesser power
17:26benediktdoes require have something similar to :once with use ?
17:29coventrybenedikt: Do you mean :only?
17:29benediktd'oh. yes.
17:30bbloombitemyapp: consider compilers. turing completeness is a given for a general purpose language, but some languages are more or less amenable to static analysis. the same is true of any data representation that may or may not happen to be turing complete
17:31bbloombitemyapp: the question is: what type of analysis do you need to perform? how can you design a language or data representation that helps you accomplish those goals?
17:31coventrybenedikt: See :refer in the (require) docstring, and the (refer) docstring.
17:32benediktah, thanks
17:35benediktetiquette: is it considered rude to ask for help with an open and new stack overflow question?
17:37kilenbenedikt: try it, the worst that can happen is that technomancy will charge his lazers. again.
17:41bitemyappbenedikt: having a well detailed Stack Overflow question pasted with a brief explanation/title in channel is an improvement over the sort of questions we usually get.
17:41bitemyapp"does anyone use Clojure to process things?"
17:41bitemyapp"does anyone use Clojure to do Clojure-y or web things?"
17:41bitemyapp"I'm not going to ask my question until I get a population census of who uses this tool to accomplish the exact same thing my question is about"
17:42technomancybenedikt: I promise to only be slightly offended that you didn't pick #clojure as your first place to turn
17:42owengalenjonesdoes anyone have an opinion on whether it's bad form to have a default multi-method implementation that is 8 lines long rather than say defining a function and just calling it in the default implementation?
17:42kilenI'm about to dive into core.logic, I've used blackbox SAT solvers before, how's core.logic different?
17:42hiredmanwhat is a sat box solver?
17:43bitemyapphiredman: http://en.wikipedia.org/wiki/Boolean_satisfiability_problem
17:43hiredmanare you familiar with minikanren?
17:43kilenNo, that's what I'm asking.
17:45hiredmanminikanren is,uh, I guess breadth first search over a tree of possible solutions, with eaching disjunction(conde in core.logic, "or" in normal speak) being a branch
17:45benedikttechnomancy: :)
17:45hiredmannot branch, a branching
17:45kilenYou can use a modeling language to generate a formulation for a SAT problem, feed it to a solver and get an answer. that seems kinda like what core.logic does, so is there a difference?
17:45benedikttechnomancy: to be fair, i was here asking some days ago about it, with less details
17:45bitemyappbenedikt: what's the question anyway?
17:46benedikthttp://stackoverflow.com/questions/20203047/classnotfoundexception-and-classcastexception-with-lein-droid # The question
17:46bitemyappoh, android question. yep, I'm out.
17:46bitemyappbenedikt: gg gl hf
17:47benediktbitemyapp: i'm new to this wizardry as well
17:47technomancybenedikt: hardly anyone using clojure on android these days afaict
17:47dnolenkilen: SAT solvers are very specific type of powerful tool, core.logic is more an like an general embedded programming paradigm, with easy escape hatches back into functional programming.
17:47benedikttechnomancy: i just felt like it
17:47technomancybeneditk: don't imagine you'd get much help outside a mailing list
17:48dnolenkilen: there is a strong connection between constraint logic programming and SAT solving methods - but this only recently well understood as far as I can tell - and we haven't treaded there yet.
17:48hiredmanyeah, I found http://www.soi.city.ac.uk/~jacob/solver/flops.pdf, and looking over it, it seems to suggest SAT solvers are restricted to boolean expressions?
17:48kilendnolen: so are the solvable problems in one a subset of the other? are they for different things?
17:48dnolenkilen: many problems solvable in either, SAT methods better in some cases, constraint solving better in others
17:49trptcolinbenedikt: those last errors look similar to a lein issue: https://github.com/technomancy/leiningen/issues/1376
17:49dnolenkilen: but the killer thing about core.logic (which still needs work) is the level of integration with Clojure data structures
17:49dnolenkilen: not really possible with off the shelf constraint solvers or SAT solvers
17:49trptcolinas for the initial ones, you don't have access to all the usual JVM stuff on android (see http://developer.android.com/reference/packages.html - javax.json.* is not there)
17:49benedikttrptcolin: thanks
17:49dnolenkilen: or even JVM based Prologs
17:51benedikttrptcolin: is it simply the case that clojure on android isn't a great idea?
17:52technomancybenedikt: I don't know if it's a great idea, but you definitely need to be prepared to shave a big pile of yaks
17:52benedikttechnomancy: so not a great idea for a project to learn clojure?
17:52kilendnolen: Thanks.
17:53trptcolinyup. http://www.deepbluelambda.org/2011/02/ was the last i'd heard about work towards it
17:53technomancybenedikt: not so much
17:53trptcolin[the yup was to what technomancy said]
17:53bitemyappbenedikt: not at all.
17:53technomancybenedikt: I think to make progress on those lines you'd need to already be a clojure expert *and* and android expert
17:53alandipertotoh, a good project to master clojure :-)
17:54benedikttechnomancy: i have no intentions of being an android master
17:54benediktalandipert: :)
17:55benedikti'll switch to using ring and the other web things
17:57bitemyappbenedikt: http://www.luminusweb.net
17:57coventryOoh, that clojars latest-release trick in the lein-droid readme is nice.
17:58benediktbitemyapp: nice. is this what replaced noir?
17:58bitemyappcoventry: you really don't look at any of my libraries do you? https://github.com/bitemyapp/revise/
17:58bitemyappbenedikt: 'ish, the approach is different. It's pedagogical.
17:59dnolenin other news core.logic CLJS runs zebrao in ~8ms on my MBA 1.7ghz under V8, I suspect when the protocol indirection elimination via type inference lands we can probably shave off another 1-2ms.
17:59benediktbitemyapp: sounds like a similar idea to bottle in the python world
17:59coventrybitemyapp: I looked at it before this. :-) https://github.com/bitemyapp/revise/commit/846e4737b737863fcbe0e99a21b8cf35daf30b6b
17:59bitemyappApage43: trolling Ptacek about his Golang use on Twitter.
17:59bitemyappcoventry: how did you fail to notice the svg? :P
17:59bitemyappohhhhh
18:00bitemyappcoventry: it has error handling now.
18:00dnolennear order of magnitude perf improvement in a year and a half ain't bad :)
18:00coventrybitemyapp: It will definitely be on my radar when I need a database. :-)
18:00Apage43bitemyapp: oh boy
18:01bitemyappcoventry: if you need a different database, ping me.
18:02[Neurotic]Hey all - trying to work this out - Does clojure.edn/read look at data_readers.clj for tags? I can't seem to make it work (using the :readers opt is fine, but trying out both ways)
18:03hiredman[Neurotic]: data_reader.clj is read once when the clojure runtime is loaded
18:03[Neurotic]hiredman: I'm not currently running this in a REPL, so that doesn't seem to be the issue
18:03[Neurotic]Although... is that an implicit "yes edn/read does look at data_readers.clj" ?
18:04hiredman[Neurotic]: is it?
18:04hiredman[Neurotic]: it doesn't look like it
18:05hiredmanah, it does
18:05hiredmanit just grabs it in the java :(
18:06[Neurotic]Okay, so if it does, don't suppose someone would have an example of defining an EDN tag in it? I can't seem to make it work
18:07hiredmanhttps://github.com/hiredman/bytes
18:07[Neurotic]I looked at that... but that's not an EDN tag, is it?
18:07bitemyappApage43: he is now intrigued by Haskell.
18:07bitemyappmission success.
18:07Apage43I watched it play out in real time
18:07bitemyappEggscellent.
18:07bitemyappApage43: so you, too, are intrigued by Haskell.
18:07bitemyappThe fire rises!
18:07joshheadI was just reading up on some Clojure history, following links from this post: http://clojure.com/blog/2012/02/17/clojure-governance.html
18:08joshheadI see references to the first Clojure talk at LispNYC, but the links are broken. Allegedly there was an audio recording, does anybody know where to find it?
18:08Apage43you're keeping going huh
18:09[Neurotic]oh, I think it's me.. I think I worked out my issue
18:10hiredman[Neurotic]: actually the edn reader grabs the value of *default-data-readers* not *data-readers*, and data_readers.clj only sets *data-readers*
18:10[Neurotic]hiredman: aaah
18:11[Neurotic]hiredman: thanks for looking into that - that explains why it wasn't doing anything
18:11bitemyappApage43: hahaha, he actually RT'd that one.
18:11bitemyappI'm proud of that tweet.
18:14[Neurotic]hiredman: that makes sense against the docs for edn/read :readers - "When not supplied, only the default-data-readers will be used"
18:14[Neurotic]hiredman: thanks for your help
18:16hiredmanI forget that new things have docstrings to read
18:18[Neurotic]Just so I'm clear then - data_readers.clj is really about changing the clojure reader - most likely for custom things like the base64 link above
18:20emaphisI just intalled clojure-mode and cider in emacs from marmalade. When I cider-jack-in, I get this error: "java.lang.IllegalAccessError: pp does not exist". Anybody have any idea what I screwed up? I can't find anything on google.
18:20hiredmanit is sort of complicated, but yes, I think part of the genesis of the edn reader as a distinct thing was to provide a more explicit interface to reading things, since magic can happen with the clojure reader which could be bad if you are receiving random data from the internet
18:20hiredmanemaphis: do you have something in a user.clj or similar?
18:21hiredmanemaphis: my guess would be some code somwhere expects someone to already have done a (require '[clojure.pprint :as pp])
18:21emaphishiredman: im a noob. where do I find user.clj?
18:21hiredmanemaphis: well, then it is unlikely that you have one
18:21amalloyhiredman: no, that error message comes from (:require [foo :refer [pp]]), i'm pretty sure
18:21amalloynot from trying to write foo/pp
18:22[Neurotic]hiredman: yeah, that makes a lot of sense. Don't want executing code in EDN ;) Cool. Thanks!
18:22hiredmanOh
18:22hiredman,(pp 1)
18:22clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: pp in this context, compiling:(NO_SOURCE_PATH:0:0)>
18:22amalloy,(require '[clojure.set :refer [pp]))
18:22clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
18:22amalloy,(require '[clojure.set :refer [pp]])
18:22clojurebot#<IllegalAccessError java.lang.IllegalAccessError: pp does not exist>
18:22hiredman,(refer 'clojure.core 'pp)
18:22clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: pp>
18:22hiredmanyep
18:23amalloyso i'd guess a version mismatch in some library, like maybe clojure.edn exports a pp?
18:23emaphisso clojurebot has the same problem. :-)
18:23hiredmanemaphis: some something is looking for a `pp` in a namespace where it doesn't exist
18:24emaphisOk. I hunt for it. thanks. I'm not too worried, I have a working repl.
18:37emaphishiredman: when I connect to an already running "lein repl" I don't get the "PP" error. (just for reference).
18:44akurilinHas anybody here integrated results of lex/bison into a clojure app before?
18:44dnolenshould make playing around with and looking at CLJS AST considerably more fun - http://github.com/clojure/clojurescript/commit/badffafde00a29f85e256906bd1ffb0c54a0786c
18:46hiredmanHeh
18:46hiredmanyep
18:50bitemyappakurilin: InstaParse doesn't suit your needs?
18:50bitemyappakurilin: https://github.com/Engelberg/instaparse
18:52akurilinbitemyapp, I'm not completely familiar with the tooling out there. I was thinking of lex/bison since I used them before and since I'm not really experienced in this domain, it'd make finding questions to my answers much easier
18:52akurilinbitemyapp, if it's something really fancy, I'll have no idea what to do with myself.
18:52bitemyappakurilin: Instaparse is really simple to use.
18:52bitemyappakurilin: stop being afraid of leverage. Check out Instaparse.
18:53bitemyappakurilin: you're using Clojure *for* the leverage, if you eschew all the benefits thereof you're missing the point.
18:53bitemyappakurilin: whole swaths of users started programming Haskell just so they could use Parsec, which is related to Instaparse.
18:54akurilinbitemyapp, do people find the historical tools so painful they'd rather go through that?
18:56akurilinbitemyapp, anyhow, appreciate the referral, will check it out
18:57bitemyappakurilin: you've never used lex or bison before I see.
18:57bitemyappakurilin: I've seen people lose their sanity with those tools.
18:58akurilinbitemyapp, I thought lex was ok, but it was for a toy language
18:58akurilinbitemyapp, I guess I just don't know any better ;)
19:00bitemyappakurilin: Instaparse is goddamn magical.
19:10bitemyapparohner: I like the CircleCI ads, one just showed up on comonad.com
19:10arohnerbitemyapp: cool! thanks
19:11bitemyapparohner: did you see my update to Brambling?
19:11bitemyappI don't recall if we discussed it or not.
19:11technomancyyeah some of those illustrations are classic
19:11arohnerincremental migrations?
19:11bitemyapparohner: yeah, 30 million datoms ~2.2 minutes on a crappy instance.
19:11arohnerthat's incremental, but not live, right?
19:11bitemyapparohner: divide by 4-10x, then multiply by roughly the datoms your data model would turn into.
19:12arohnerbecause you're still switching DBs?
19:12bitemyapparohner: well, by live you probably mean differential migrations.
19:12bitemyappthere's never-ever going to be a live migration faculty with Datomic that Datomic doesn't itself implement
19:12arohnerby 'live' I mean 'no downtime'
19:12bitemyappand they're only going to implement very simple use-cases, not whole database transformations like what brambling does.
19:12bitemyappdifferential migrations can do "catch-up" migrations to minimize swap time.
19:13bitemyappbut the hand-over you'd be managing yourself.
19:13bitemyappif you're using core.async or a queue internally in your applications you can pause the queries long enough to flip over though.
19:14bitemyapparohner: if you're serious about using Datomic in production then it might be worth your time to spitball some of this with myself or the Datomic guys.
19:14bitemyappif not, then let me know and I'll stop bugging you.
19:14bitemyappI just knew you were one of the people that expressed an interest.
19:14arohnerI am interested, but we don't have our eval key yet
19:14arohnerand it'll probably be someone else on the team handling the migration to datomic
19:15bitemyapparohner: are they on IRC? can they be?
19:15bitemyappI'd be happy to discuss it with them and offer advice/help/pointers if they'd like.
19:17bitemyappit's irritating the degree to which I end up imitating destructuring in Python. :as and all.
19:18arohnerbitemyapp: they're not on IRC yet. I'll tell them to bug you when they're ready :-)
19:18arohnerand when I know who's going to do it...
19:19bitemyapparohner: sure sure. Cheers.
19:24Apage43anagram thing is more interesting sorted by length of word than by size of set
19:24Apage43(->> "/usr/share/dict/words" slurp clojure.string/split-lines (group-by frequencies) vals (filter #(> (count %) 2)) (sort-by (comp count first)) (take-last 100) pprint)
19:25Apage43["importancy" "patronymic" "pyromantic"]
19:25bitemyappimportant father-derived fire-crazies
19:25devnanyone here using caribou?
19:26bitemyappdevn: justin_smith is the resident expert dev/user.
19:26Apage43 ["petrography" "pterography" "typographer"]
19:26bitemyappdevn: yogthos and I have admired their work from afar :)
19:26devnthere is a reference to schmetterling which seems to imply that you need to clone the external repo
19:26devnis that correct?
19:26justin_smithdevn: schemetterling is a standalone app
19:26devnjust checking :)
19:27devni got it working by cloning it and connecting to it
19:27bitemyappjustin_smith: ...does that work modulo locals clearing?
19:27justin_smithit isn't part of caribou - you can connect it to anything running under the jdk
19:27devnjust thought maybe it was batteries included
19:27bitemyappalso how did I not hear about this earlier?!
19:27bitemyappWHAT THE FUCK
19:28bitemyappthis is really nice if it actually works
19:28justin_smithbitemyapp: yeah, as far as I know. The one problem really is that it gives you a repl in the context of the stack, and if you get an exception there the whole thing is toast
19:28justin_smithso run code in the contact of the exception stack judiciously
19:28justin_smithhopefully we will find a way to handle it gracefully in the app
19:29bitemyappjustin_smith: why isn't this an nrepl plugin?
19:29justin_smithwe wanted something our non-expert devs could just connect to their process
19:29justin_smithwith as little friction as possible
19:30bitemyappbut...nrepl is the standard protocol... ;_;
19:30justin_smithbut maybe we could do that with an nrepl plugin
19:30bitemyappplease?
19:30justin_smithwe are using standard jvm debugging sockets
19:30bitemyappthen emacs/vim/etc could use it.
19:31technomancylinky?
19:31justin_smithhttps://github.com/prismofeverything/schmetterling
19:31devnjustin_smith: an overview of things/libs caribou works with would be nice
19:31justin_smithdevn: yeah it would
19:31devni mean even just in terms of "officially supported"
19:31devnlike schmetterling
19:31clojurebotExcuse me?
19:32devnbecause the project.clj contains things like caribou.foo
19:32devnwhich doesn't expose them directly
19:32devndependencies and 3rd party lib integration i guess is what im saying
19:32devnjustin_smith: either way, nice job on caribou so far
19:32justin_smithbitemyapp: we were also aiming for total non-integration with editors, because there is a lot of diversity of editors used in our environment, easier to have something universal (the browser) than adapt to vim, emacs, sublime...
19:32justin_smithdevn: thanks, I am just a bit player
19:32devnjustin_smith: i especially liked that the default page was RESPONSIVE
19:33bitemyappnrepl...is universal...
19:33technomancyI don't know how you'd initiate a connection with nrepl
19:33bitemyapptechnomancy: idea being to tunnel the JDK stuff to nrepl
19:33devnM-x nrepl, 127.0.0.1, 44444
19:33technomancybut yeah, nrepl solves the whole diversity problem neatly
19:33technomancydevn: where does the port number come from?
19:34devnin the startup sequence, and also in the config IIRC
19:34devnive barely used caribou at this point
19:34justin_smithI think it may just be our lack of knowledge / experience with the internals of nrepl that kept it from being used.
19:34devni init'd an app, ran it, and connected nrepl to it through that port
19:34justin_smithin default caribou the port is set in boot.clj, but can be overridden in resources/config/<environment>.clj
19:35technomancyyou'd want it to be accessible from your existing nrepl session
19:35hiredmanwell, the jvm exposes the debugging info over sockets, so you would need another layer translating it in to something like nrepl
19:35hiredmanwhich, well, meh
19:35bitemyappdoes nobody care that the whole point of nrepl was to make it so every editor/environment could leverage the same tools?
19:35hiredmanyou might make something like an repl proxy, that proxies and nrepl and tunnels the debugging stuff over nrepl
19:35justin_smithschmetterling just uses a fork of the cdt lib to interact with the debug socket
19:35hiredmanyeah
19:36technomancybitemyapp: it seems like an obvious thing once you figure out the session issues
19:37hiredmanjustin_smith: it does look really neat
19:37justin_smiththe other issue is a repl is a push ui - you type something in and it gets sent. Schmetterling was envisioned to both push and pull - it pops up your stack trace from the other process, then you can send commands from the context of a stack level
19:37justin_smithperhaps we could make that work with an nrepl though
19:37justin_smithhiredman: thanks, mostly prismofeverything's work, I just helped whiteboard it
19:37technomancyjustin_smith: nrepl handlers can send unsolicited messages
19:38justin_smithso maybe we can embed this in a repl
19:38technomancyyeah, this needs to happen =)
19:38justin_smithwe looked into using ritz and just got lost - either we were too dumb or it was too complex
19:38bitemyappthis is the debugger I've been waiting for, for awhile.
19:38justin_smithor some combo
19:38technomancyor alternatively someone needs to make ritz work for mortals
19:38bitemyappjustin_smith: I didn't like Ritz either, that's why I would really like this to be adapted for nrepl.
19:38technomancynot requiring two JVMs is great though
19:38bitemyappI got Ritz to work, it's just not very helpful.
19:38justin_smithpull requests would gladly be considered :)
19:39bitemyappit's not a PR to schemetterling
19:39bitemyappit's a separate project entirely
19:39bitemyappthat schmetterling could turn into a wrapper for.
19:39technomancyyeah, extraction is needed
19:39justin_smithwell in the core is that fork of cdt, that could be the common basis, but you would likely want to extend it
19:40justin_smithhttps://github.com/prismofeverything/cdt
19:40akhudekGiven a map m, are the results of keys and vals guaranteed to be in the same order (such that each key corresponds to each val)?
19:40bitemyappakhudek: maps aren't ordered unless they're a sorted map.
19:41justin_smithakhudek: the key/val relations are fixed
19:41bitemyappthat question is baffling.
19:41justin_smithdo you mean does (zipmap (keys m) (vals m)) always = m ?
19:41akhudekjustin_smith: exactly
19:41technomancybitemyapp: no it's not
19:41technomancyit's a common question that gets asked here all the time
19:42bitemyapptechnomancy: I didn't parse out keys and vals are functions.
19:42technomancyah, ok; sure
19:44justin_smith,(into #{} (repeatedly 10000 #(let [m (zipmap (repeatedly 30 rand) (range))] (= m (zipmap (keys m) (vals m))))))
19:44clojurebot#{true}
19:44justin_smithempirically, it worked the first 10000 tries
19:44technomancyit's explicitly stated somewhere on clojure.org iirc, but it needs to be in the docstrings
19:44akhudekjustin_smith: it does seem true, but I never like to make assumptions unless they are really guaranteed.
19:45justin_smithakhudek: that's smart
19:45bitemyappakhudek: you must've used C in a past life.
19:45akhudektechnomancy: I also wish the cost complexity various operations were easier to find in docs
19:45justin_smithbitemyapp: with that attitude you could hardly write a single C program that does anything interesting
19:45akhudekbitemyapp: is it that obvious?
19:46bitemyappakhudek: I know the fear too. I used to hack in C.
19:46bitemyappjustin_smith: I somehow made my way, but C taught me some real paranoid about what "truth" is, and what "is" means.
19:47technomancy"An experienced programmer is one who looks both ways before crossing a one way street"
19:47Apage43I'm hacking on some C++ *right now*. There is no meaning in this place.
19:47bitemyapptechnomancy: I actually do that in Chinatown all the time.
19:47technomancythrow UnexpectedVehicleException
19:48Apage43Unexpected vehicle throws you!
19:48bitemyappToday on TwitteR: People with syphilis get mad at me for making fun of their favorite language.
19:48justin_smithand in the hospital they attempt to set the breakpoints after the crash
19:48justin_smithit is much like debugging
19:49justin_smiththat was a terrible pun
19:49justin_smith(dec justin_smith)
19:49lazybotYou can't adjust your own karma.
19:50technomancyhehe
19:50bitemyapp(dec justin_smith)
19:50lazybot⇒ 12
19:53akhudektechnomancy: I can't actually find any mention of the order of keys and vals on clojure.org. :-( Pretty sure I read it somewhere too though. If I can find a source I'll add a comment about it on clojuredocs.
19:53technomancyakhudek: maybe it was on the dev.clojure.org wiki instead
19:54technomancyor it could have been a mailing list. anyway, I'm 100% sure it's guaranteed.
19:54akhudektechnomancy: ok, I'll just add a comment on it then
19:56Apage43(keys) returns a KeySeq, which is a wrapper around seq'ing the map that returns just the key portion of each item
19:56Apage43https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/APersistentMap.java#L133-L162
19:57Apage43they're both in the order you get when you (seq) it
19:57bitemyappso there's no order to the seq itself, but they're paired up evenly?
19:57akhudekApage43: thanks
19:57akhudekbitemyapp: that's right
19:57bitemyappit appears that requires relying on an implementation detail, but it's good to know.
19:57justin_smithif you want to guarantee they match, there is always doing a reduce on the map and destructuring yourself
19:58justin_smiththat way you only need to create the seq once too
19:58Apage43bitemyapp: as long as you aren't crazy and don't make a map type where (seq)'ing the same value twice gives you a different order
19:58justin_smith(or would keys and vals both use the same seq?)
19:58bitemyappApage43 leading the way on reading the code. Best way to learn. :)
19:58Apage43as go *intentionally* does
19:58bitemyappApage43: that's perverse :|
19:58Apage43yeah, go randomizes order of iteration over maps
19:59devnjustin_smith: i stepped away, but in any event: caribou is definitely a nice contribution, and something of a middle ground between pedestal and "roll your own".
19:59devnthanks for your work
19:59devni'll be giving it a more in-depth try over the next week or so.
19:59justin_smithdevn: np, I will pass that along, thanks
20:00justin_smithpedastal looks cool, I mean to try it. But we need something where the frontend is not clojure, because we don't hire frontend for clojure skill, we hire them because they can make a designer's psd happen as a responsive page
20:01devndepends on what you mean by designer
20:01devnbut if by designer you mean front end developer with design skills, then i agree
20:01justin_smithpeople who use photoshop to make a pretty picture of a web page
20:01devnoh, im sorry, i misread
20:01devnyeah i think we agree
20:02devnthat was always a goal of Clojurescript One, too
20:02devnto make it easy for designers and people who were primarily front end devs to collaborate
20:03justin_smithwell what I meant is that the frontend devs know js / css / html - we don't want to make them use a clojure oriented stack, and pedastal seemed to be pushing that way (maybe I am wrong?)
20:04justin_smiththough some of them have been trying clojurescript and enjoying it for the occasional project
20:05devni have more coworkers who are currently using clojurescript than clojure
20:05devni know the state of clojure survey begs to differ
20:05justin_smithinteresting
20:05devnbut i think they're just not as connected to the community at the moment
20:05justin_smithI know if I had to do frontend, I would totally do it in clojurescript if I could
20:05devnso maybe they aren't being heard as loudly
20:06devnon all of the JS projects i've worked on recently we had lots of things in play to basically simulate clojurescript
20:06devnlike using google closure to get require and provide, etc.
20:06justin_smithmore than just underscore style fp features?
20:06devnstrong desire to use a functional style, desire for namespaces, desire for namespaces
20:07devnand desire for namespaces ;)
20:08devnunderscore is a gateway drug to FP, and then they find clojurescript and say: "oh! this is even better!"
20:09joshheadI do frontend JS work, we don't use any clojurescript but boy I'd like to
20:09devnpeople with nice functional style using underscore were given recognition for writing nice code, so other people noticed and decided to try to do it as well
20:09devnwhen they come to clojurescript they see group-by, map, reduce, etc. and they immediately get it
20:10joshheadI've got Fogus's Functional JavaScript, am hoping that it makes way for more functional style so that clojurescript seems like less of a leap
20:10joshheadI actually showed some ClojureScript to a few coworkers, they said it looked more useful than CoffeeScript
20:11devni've been surprised. people who have always had some aptitude for lisps, have written their own, etc. were more taken by what clojurescript provided than clojure as a core language
20:11dnolenjoshhead: heh
20:11devnmainly because they see how practical it is, and it makes them feel like they're not in a completely foreign land/language
20:12devnbecause they *know* javascript
20:12devnso they don't feel completely novice in clojurescript
20:12devnclojurescript is a good gateway drug
20:13devni think dnolen's posts have been inspiring a lot of people to check it out since it's so damn easy nowadays, too
20:14devngotta run, but keep on truckin' :)
21:01bitemyapparrdem: I bought an Xbone: http://i.imgur.com/k4NWp0u.png
21:09arrdembitemyapp: your timing in pinging me as I M-x erc remains spooky
21:11bitemyapparrdem: that's better than being puffnfresh. I barely let the poor bastard sleep.
21:35ambrosebsgfredericks: it's an ordered intersection function type because a function is *all* of its arity types.
21:35ambrosebsgfredericks: a (Fn [Number -> Number] [Boolean -> Boolean]) can be safely coersed to [Boolean -> Boolean]
21:35ambrosebsgfredericks: but a (U [Number -> Number] [Boolean -> Boolean]) cannot.
21:44fakedrakehello
21:44ambrosebsTimMc, gfredericks: they are "ordered" intersections because (Fn [Long -> Long] [Number -> Number]) is different to (Fn [Number -> Number] [Long -> Long]). If you pass a Long, the former returns a Long and the latter a Number.
21:45ambrosebsthe intersection (I Number Boolean) is unordered currently FWIW.
21:48fakedrakei want to write a macro that will make a special case of defn, namely more than 3 or 4 of my functions will be able to be take their arguments and also no credentials for anon login, a login object or username + password eg (defn foo "maybe doc" ([a cr] code) ([a] (foo a (anon-login) ([a u p] foo a u p))))
21:48fakedrakethat should be (login-defn foo "maybe doc" [a cr] code)
21:49fakedrakeThe problem is to me the docstring which may or may not be there
21:49ambrosebsfakedrake: have you considered keyword arguments?
21:50fakedrakeambrosebs: hmm, good idea
21:51ambrosebsfakedrake: once you start wrapping defn like that, you're stuck with extensibility. What if you want a 4th parameter?
21:51fakedrakebut still i will have to define them every time
21:51fakedrakeambrosebs: i probably will
21:52fakedrakehmm
21:57fakedrakeIll just rewrite a couple of lines each time
21:59amalloyfakedrake: you can also do that as an actual functional wrapper. eg, (defn wrap-logins [f] (fn ([a cr] (f a cr)) ([a] (f a (anon))) ([a u p] (f a (login (u p))))), (def foo (wrap-login (fn [a cr] code)))
21:59amalloyit avoids many of the problems of doing it as a macro
22:02amalloyalthough i do sorta recommend standardizing on one kind of credentials that all functions take, rather than accepting this freeform "creds or user/pass or nothing"
22:03amalloyand then you can just add one layer of abstraction somewhere, like one function that takes the freeform mess and converts it to what the rest of the system wants
22:06fakedrakeamalloy: i did the keys thing
22:06SegFaultAXI like the way warden does it (which friend kinda tries to copy)
22:07fakedrakebut now i want this map to be passed on to other functions, Is there a counterpart for `apply' only for dictionary -> keyword args ?
22:07hiredmanwelcome to a world of pain
22:07fakedrakeinstead of seq -> positional
22:07hiredmannot to contribute anything useful
22:09fakedrakehow does this look: (apply fn-with-rc-key-arg "ha" (flatten (seq {:rc 1})))
22:09fakedrake?
22:10bitemyappflatten lol, prepare for shitstorm.
22:10fakedrake:( flatten was my favourite
22:10fakedrake:P
22:11SegFaultAXfakedrake: flatten is very often considered a code smell or otherwise a hint that something has gone wrong.
22:11SegFaultAXNot always, but often enough that it's worth pointing out.
22:11fakedrakeaha
22:11fakedrakethnx
22:11justin_smithif one of your keyword args had a colleciton as a value
22:11SegFaultAXAs in this case, it's pretty smelly.
22:11justin_smithwhich is not actually uncommon
22:11justin_smithflatten would fuck that up
22:11SegFaultAXYup
22:13fakedrakethnx
22:13fakedrakeis there an alaogue to elisp's `let*' ?
22:14justin_smith,(mapcat identity {:a [0 1] :b 2})
22:14clojurebot(:a [0 1] :b 2)
22:14justin_smithan alternative
22:14amalloyfakedrake: let
22:14justin_smithpreserves substructure
22:14fakedrakeindeed i did not realize xD
22:24fakedrakelazy-cat looks awesome!
22:26amalloyfakedrake: it's unlikely you want lazy-cat - concat is a better "default", and the difference between them is fairly subtle
22:28amalloyactually i don't think i've ever used lazy-cat? that surprises me a little now i think about it
22:28fakedrakeamalloy: I get a lazy sequence of vectors from `map' and i want a defn to return a lazy sequence of the elements of the vectors
22:28amalloyfakedrake: (apply concat vs)
22:28amalloyor, really, use mapcat instead of map
22:29fakedrakedidnt know about that one
22:29amalloy~flatten
22:29fakedrakeamalloy: nice!
22:29clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
22:29fakedrakethnx!
22:29amalloyhappens to mention this solution already, so it would have been a helpful reply to your earlier attempt to use flatten
22:30fakedrakeamalloy: indeed
22:33Raynesamalloy: HEIL NOFLATTEN
23:10bellkevHey folks, I'm working on a tool to enable the generation of AWS CloudFormation templates using a Clojure-based syntax kind of like leiningen's project.clj. I'm working on how the syntax should look to be most clojurey, and I wonder if anyone has some input: https://gist.github.com/bellkev/7653342
23:22fakedrakeI am getting this strange error 'Exception in thread "main" java.lang.IllegalArgumentException: Parameter declaration uq. should be a vector' when running lein test, is it familiar to anyone?
23:22fakedrakehttp://pastebin.com/DHcqrkKv
23:22fakedrakehere is the whole thing
23:23coventryfakedrake: You may be missing a parameter list in a defn.
23:23coventryProbably in reddit_crawler.core_test.
23:24coventryAnd there's probably "uq" wheer the parameter list should be.
23:25fakedrakecoventry: i dont think i have a defun with uq as a parameter
23:25fakedrakelet me double check
23:25fakedrakeah it was a typo
23:25fakedrakecoventry: thanx!
23:26coventrynp
23:40gfredericksambrosebs: that is terribly interesting, thanks
23:41ambrosebsgfredericks: I think they're first described in www.ccs.neu.edu/racket/pubs/padl12-stff.pdf‎
23:41ambrosebs4.1
23:41ambrosebsFn is case-> in Typed Racket
23:47coventry> Seems weird that there is no update fn corresponding to update-in as assoc corresponds to assoc-in. Am I missing something?
23:49dnolencore.logic 0.8.5 going out, old stateful defrel stuff is finally dead, good riddance https://github.com/clojure/core.logic
23:50seancorfieldcoventry: what would update do?
23:53ambrosebsdnolen: nice!
23:56coventryseancorfield: Hmm, I was thinking of something like (defn update [map f key] (assoc map key (f (map key)))), but actually that gets messy when you have multiple kv pairs and args you want to pass f. I guess I see why there's no such thing.
23:57amalloycoventry: right. does it take multiple k/v pairs, or does it take &args for the f function?