#clojure logs

2015-03-26

01:46wefwefattempting to run lein repl results in the following: Could not transfer artifact org.clojure:tools.nrepl:pom:0.2.6 from/to central (https://repo1.maven.org/maven2/): java.lang.RuntimeException: Unexpect
01:46wefwefed error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
01:47wefwefon OpenJDK Runtime Environment (build 1.8.0_31-b13)
01:47wefwef
01:49wefwefnot currently behind proxy, any jvm type settings to check?
02:19Kneivawefwef: http://stackoverflow.com/questions/4764611/java-security-invalidalgorithmparameterexception-the-trustanchors-parameter-mus ?
02:21Kneivawefwef: here's one with openJDK http://architecturalatrocities.com/post/19073788679/fixing-the-trustanchors-problem-when-running
03:24hamidhello there :) Would anyone help me solve this one? :P http://clojurescriptkoans.com/#destructuring/7
03:26kungihamid: yes I would. I always have a look at this tutorial when I'm not sure about destructuring: http://blog.jayfields.com/2010/07/clojure-destructuring.html
03:27hamidka2u, awesome thanks.
04:55sveri "Working on siwf in clojure and clojurescript" just went live!, check it out here: http://www.twitch.tv/sveri80
06:03anewtf watching people code is now a thing?
06:03the_freyit is?
06:04justin_smithevidently, but hey if people want to watch, why not
06:11clgvhalf-pair-programming? :P
06:12clgvane: did you spot plenty of videos being uploaded?
06:18justin_smithclgv: sveri just posted a link
06:23clgvjustin_smith: too early for me ;)
06:29elvis4526Where are static files served when running lein run with http-kit ?
06:30justin_smithelvis4526: whereever you tell ring to look for them (via wrap-static)
06:30justin_smithelvis4526: though generally wrap-resources is better, because it allows serving files from inside an unexploded jar
06:30elvis4526I use compojure
06:31justin_smiththat doesn't change things
06:31justin_smithcompojure uses ring
06:31justin_smithring uses the wrap-static or wrap-resources middleware
06:31elvis4526sorry i didn't finish what I wanted to say lol
06:31elvis4526I did (files "/public") in my routes
06:31elvis4526this is relative to where when running lein run ?
06:32justin_smithI've never used that "files" thing, I've always used wrap-resources or wrap-static, and those are relative to the classpath
06:33elvis4526classpath = where you're clj file are ?
06:33elvis4526when deploying into a jar, /public really refer at the root of the jar
06:33elvis4526(if this is any help)
06:33justin_smithreally? that seems like a terrible idea
06:34justin_smithclasspath is the set of places where the jvm looks for resources at runtime
06:34elvis4526where does static file should live ?
06:34justin_smiththe primary job for lein is to set up your classpath
06:35justin_smiththey can be whereever is convenient, but I typically put them is resources/ and then use wrap-resources to point to the folder they are in
06:35justin_smitheg if I put them in resources/public/ then I use (wrap-resources "public")
06:35elvis4526so there are available at localhost/public/blabla.js ?
06:35justin_smithright
06:35elvis4526that's what I did
06:55justin_smithelvis4526: actually, I take that back - if you do (wrap-resources "public") and had the file resources/public/bla.js, you would access it as "localhost/bla.js"
06:59sveriane clgv justin_smith I tried that a few times now and, the funny thing is, it really helps me concentrate and not get distracted (coding for private things always suffer my procrastination wishes), it's an interesting concept and, at the same time, you can get people attracted to clojure :-)
07:12justin_smithheh, it was interesting to see intellij in action
07:13sveriI was never able ti get productive with emacs, tried it three times for severl hours, but...
07:23lauriojustin_smith: wow, didn't know that
07:25laurioi started to use cond instead in order to avoid hard coding values more than once
07:26elvis45261Is there a way to speed up lein run ?
07:26elvis45261it's crazy slow.
07:27justin_smithelvis45261: https://github.com/technomancy/leiningen/wiki/Faster
07:27justin_smithLEIN_FAST_TRAMPOLINE is good
07:28elvis45261that's what I was about to ask
07:28elvis45261it seems the only "okay" solution
07:28justin_smithanother trick is to not use lein at all
07:29justin_smithlein cp > "class_path.txt"; java -cp $(cat class_path.txt) clojure.main -m your.ns
07:30justin_smithbut that's only going to be marginally faster than LEIN_FAST_TRAMPOLINE - remember that that only works when you do "lein trampoline run" - "lein run" is not affected by the LEIN_FAST_TRAMPOLINE setting at all
07:39agarmanI tried nailgun before, but it becomes convoluted as soon as you have multiple projects or change dependencies or etc.
07:40borkdudeordnungswidrig I'm unsure how to combine existing? and put! or post! I want to enfore that someone can only put! or post! when :exists? is true. but when I set put-to-existing? to true, a normal get responds with a 201..
07:51zoldarborkdude: you hardcode put-to-existing? to true?
07:53borkdudenever mind, it seems to be a glitch because of code reloading in the repl
07:54zoldarborkdude: ok
07:54zoldarborkdude: I suppose that you are aware of this: http://clojure-liberator.github.io/liberator/assets/img/decision-graph.svg
07:54borkdudezoldar yes
07:55zoldarjust making sure
09:09borkdudeordnungswidrig I'm still not sure how I must do this with liberator: someone puts!, but if the thing doesn't exist? it should return a 404
09:10borkdudeordnungswidrig I have implemented :exists? and set :can-put-to-missing? to false, but that doesn't work
09:10justin_smithborkdude: I thought the idea with PUT is that it creates a resource where there wasn't one previously
09:10borkdudejustin_smith I thought that was post
09:11borkdudejustin_smith maybe I'm wrong
09:11justin_smithborkdude: the relevant rfc http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
09:12justin_smith"The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line."
09:12justin_smith"The PUT method requests that the enclosed entity be stored under the supplied Request-URI."
09:17justin_smithborkdude: so maybe you don't want PUT requests at all, and actually want only POST to be allowed?
09:18borkdudejustin_smith in plain english: I want to store an attribute/column in an existing record. which should I use then?
09:18justin_smithpost
09:18justin_smithput is for making new records
09:18justin_smithpost is for adding details to something that is already there
09:19borkdudeok
09:20justin_smithlike, if this were eg. reddit, "put" would be for creating a new link, and "post" would be for adding a comment to that link
09:20borkdudejustin_smith so put for a new "top level" thing
09:20justin_smithyeah
09:21sveriborkdude: idempotent is the word you are looking for here, if your operation adds something and is idempotent, make it a PUT. Otherwise make it a POST
09:21justin_smithsveri: it's not just that though. He wants a 404 for a non-existing URL, which is something POST would do, but not PUT
09:22justin_smithPUT would just create the new thing
09:22justin_smith(if PUT is accepted at the route targeted, of course)
09:22sverijustin_smith: ok, sry, I joined to late I guess and misunderstood the question
09:24borkdudefor sake of understanding, it's this resource I'm talking about: https://www.refheap.com/98907
09:24borkdudeI would expect a POST to listen to existing?, but that's not what's happening
09:26sveriborkdude: "listen to existing?" what do you mean exactly?
09:28borkdudeehm, I mean: it will return a 404 when exists? is nil or false
09:29sverihm, just shooting blindly here, what does (if-let return? maybe try an if statement instead of if-let?
09:29justin_smithsveri: if-let returns the same as if would
09:29borkdude(if-let [a nil] a) is nil
09:29sverikk
09:29justin_smithit just adds a convenient let binding
09:30justin_smithborkdude: and I assume you have verified that answers/read-by-invitation isn't returning ()
09:30justin_smithsince () is truthy of course
09:30borkdudeah, I should set can-post-to-missing? to false
09:31borkdudehttps://www.dropbox.com/s/0inkfr1wwsqqpm2/Screenshot%202015-03-26%2014.30.00.png?dl=0
09:31justin_smiththat sounds applicable. I've been meaning to try liberator.
09:31borkdudethanks for thinking along guys
09:32justin_smithso that fixed it?
09:32sveriyea, that looks nice
09:32sveriborkdude: do you handle authentication / authorization with liberator?
09:32borkdudesveri authentication no, authorization yes
09:33sveriis your code publicy available? I'd like to have a look at it
09:33borkdudesveri I'm using lib-noir for authentication
09:34borkdudesveri but I wouldn't go there anymore, since it's deprecated by luminus
09:34sverihm, I see
09:34borkdudesveri just look at the luminus website how to do authentication and then use :authorized? (fn [ctx] .... (-> ctx :request :session ...)) etc to authorize whatever you like
09:35sveriOk, so no fancy wrapper / abstraction stuff like friend
09:35borkdudesveri no. I tried friend, but I never got the hang of it
09:36sveriI dropped friend in favor of buddy, which seems pointless after I finally grasped friend :D
09:36borkdudesveri buddy is also used in luminus
09:36borkdudesveri I kind of fall back on luminus for standard web stuff, so my colleagues can look at that if they have to work on my project in the future. nice references
09:37sveriYea, he really put a lot of effort into the documentation. I used it as a reference for my own template
09:53dxlr8rhello. small question. how do I join/concat regex patterns?
09:53clgvdxlr8r: you dont.
09:53dxlr8rI have a usecase where I need it to not repeat myself
09:53clgvdxlr8r: you can concat strings to a single string and convert that to a regex
09:54dxlr8rhmmm
09:54dstocktonuse re-pattern and combine the patterns as strings
09:54justin_smithdxlr8r: ##(re-seq (re-pattern (str #"a" #".")) "bananananana")
09:54lazybot⇒ ("an" "an" "an" "an" "an")
09:54clgvmaybe you can get the string representation back from the regex
09:54justin_smithclgv: yup
09:54justin_smithand then create a new regex from that
09:55dxlr8rjustin_smith: thx :)
09:55dxlr8rwill use re-pattern. how could I overlook that? :)
09:57caterndear #clojure
09:57caternis there a way I can easily get my incanter data into my LaTeX document?
09:58caternlike, for R there is something (I think) where you can just put R variables or something into your LaTeX, and they will get filled in at pdflatex time
09:58caternis there anything clever I could do to get that for Incanter...?
09:59dxlr8rjustin_smith: I get "unsupported escape character" when I try to store my regex
09:59dxlr8r\d that is
09:59dxlr8rneed to use \\ :/ stupid :P
10:00justin_smithdxlr8r: or you can do what I did above (str #"\d" #"whatever")
10:00justin_smith#"" requires less escaping
10:00dxlr8rhmmm
10:02dxlr8rnice :) thanks for having patient with a total clojure idiot... come to think of it, not that good on programming in general :)
10:08clgvcatern: sure 3-4 lines of clojure get that done
10:08caternclgv: er, how?
10:08clgvcatern: just write out the columns then iterate over the rows
10:08caternwhat
10:09caternthink you're answering someone else's question :)
10:09clgv(str/join " & " column-values) will do the table stuff for altex
10:09clgvcatern: nope yours
10:09caternI don't want to do table stuff
10:09caternI have no tables, just single values
10:10clgvcatern: what is "incanter data"? just values?
10:10caternyes
10:10caternI mean
10:10clgvwell just copy them over then
10:10caternI have table data as well
10:10caternclgv: :/
10:10caternuh
10:10caternno?
10:10clojurebotno is tufflax: there was a question somewhere in there, the answer
10:11justin_smithclojurebot: you're weird.
10:11clojurebotexcusez-moi
10:11caternclgv: i'd rather not?
10:11clgvcatern: I guess I dont understand what your problem is.
10:11caternnevermind
10:11caternclgv: have you ever used R and LaTeX together?
10:12clgvyou found out that your p-value is 0.031 and want to have that in latex - then just copy the 0.031 over there.
10:12tickinglol
10:12caternclgv: I want that value to update when I re-run the analysis
10:12caternwhich you can do with R and LaTeX, http://en.wikipedia.org/wiki/Sweave
10:12clgvcatern: well then you maybe want some kind of templating
10:12tickingcatern: an you want it in what context?
10:12caternclgv: yes, agreed
10:15clgvcatern: the sweave approach looks frightening
10:15tickingcatern: sorry I mist most of the discussion what is the tool you want to use? gorilla repl, clojure ipython? plain html?
10:15clgvhow do you plan to submit latex sources to a journal?
10:15caternclgv: I plan to make a PDF?
10:15clgvcatern: I guess having a latex file with place holders for the computed values, is probably the best approahc
10:16caternclgv: are you telling me to copy them in again?
10:16clgvcatern: journals almost always want your latex ;)
10:16caternagain, would rather not copy this stuff in manually
10:16clgvcatern: no. your program can readin the latex file and fill in the values automatically
10:16caternso templating
10:16caternyes
10:16clgvso you use the latex file as template
10:16caternsuggestions?
10:17clgvcatern: we have used selmer for html templating
10:17clgvshould work with latex as well
10:17tickinghttp://www.tetrisrockstar.com/dynamic-latex-documents-with-clojure-and-fleet/
10:18caternticking: thank you but I have already googled and seen that
10:18tickingcatern: k
10:18clgvticking: interesting
10:19clgvcatern: looking at fleet, I'd stick with selmer for your requirements
10:34irctc__Can someone point me in the right direction? I'd like to idiomatically turn a sequence of hash-maps with keys :a :b :c to a new sequence of hash-maps with only keys :a and :c
10:34irctc__so ({:a 1 :b 2 :c 3}{:a 4 :b 5 :c 6}) becomes ({:a 1 :c 3}{:a 4 :c 6})
10:35tatut(map #(dissoc % :b) coll)
10:35justin_smith&(map (partial select-keys [:a :c]) [{:a 1 :b 2 :c 3}{:a 4 :b 5 :c 6}])
10:35lazybot⇒ ({} {})
10:35Bronsa,(map (partial dissoc :b) [{:a 1 :b 2 :c 3}{:a 4 :b 5 :c 6}])
10:35clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to clojure.lang.IPersistentMap>
10:35irctc__ahh dissoc
10:35Bronsa,(map #(dissoc % :b) [{:a 1 :b 2 :c 3}{:a 4 :b 5 :c 6}])
10:35clojurebot({:a 1, :c 3} {:a 4, :c 6})
10:35justin_smith&(map #(select-keys % [:a :c]) [{:a 1 :b 2 :c 3}{:a 4 :b 5 :c 6}])
10:35lazybot⇒ ({:c 3, :a 1} {:c 6, :a 4})
10:35irctc__without looking it up, can it handle multiple keys to dissoc at the same time?
10:35Glenjamin(doc select keys)
10:35clojurebot#error{:cause "Wrong number of args (2) passed to: core/eval54/fn--55/my-doc--56", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (2) passed to: core/eval54/fn--55/my-doc--56", :at [clojure.lang.Compiler macroexpand1 "Compiler.java" 6628]}], :trace [[clojure.lang.Compiler macroexpand1 "Compiler.java" 6628] [clojure.lang.Compiler macroexpand "Compiler.java" 6694] [clojure.lang.Compiler eval "Compiler.java" 676
10:35clgvirctc__: or select-keys depending on the exact use case ;)
10:35irctc__aah
10:36Bronsairctc__ yes
10:36justin_smithirctc__: dissoc is varargs, but select-keys is closer to what you want I think
10:36irctc__thanks all! select-keys/dissoc
10:36Glenjaminhrm, no response to my doc request :(
10:36justin_smithGlenjamin: you had a typo
10:36Glenjaminoh
10:36Glenjaminhaha
10:36Glenjaminthat stack trace makes sense now
10:47clgvoh clojurebot changed to string-serializable exceptions?
10:47stuartsierraNo, Clojure did!
10:47dysfunwhy can't i (defn [f & fs :as all-fs] all-fs) ?
10:47clgv,(clojure-version)
10:47clojurebot"1.7.0-master-SNAPSHOT"
10:47clgvstuartsierra: for real? is there some blog post or similar about that?
10:48clgvstuartsierra: is it just a printmethod impementation?
10:48patrickgombertclgv: https://github.com/clojure/clojure/commit/692645c73c86d12c93a97c858dc6e8b0f4280a0b
10:48stuartsierradysfun: Because function arity is not the same thing as destructuring, although they share the same syntax.
10:49clgvpatrickgombert: thanks
10:49dysfunokay. is there something cleaner than do what i've done and just use a let underneath and a precondition to assert length is pos?
10:50patrickgombertclgv: it’s a nice change, really useful for quickly scanning
10:51clgvhopefully nil-safe ;)
10:52clgvuhh there is a (set! *warn-on-reflection* true) i it... :P
10:53justin_smithdysfun: how about (defn [& [f & fs :as all-fs]] all-fs)
10:53dysfunewww :)
10:54justin_smithit does what you want though
10:54dysfunyeah, not denying it :)
10:54dysfunstill need the precondition
10:55dysfunobviously i could write a macro,
10:56clgva (set! *warn-on-reflection* true) in core_print.clj is going to be fun ;)
10:59caternhmmm
10:59caternclgv: Actually I asked in #latex and have a somewhat better idea
10:59catern you can generate them in the form \def\foo{val} from within the clojure (or whatever else you use) script and then \input{|"script"}
11:00catern(where "script" is something that outputs \def\foo{val} on stdout)
11:00caternand \input includes that into the document
11:00clgvcatern: yeah, pretty similar approach but limiting the document generation to the external file
11:01caternclgv: to the external file?
11:01caternit seems like a really good approach - at first I was hesistant because I'd need to define all my variables that I wanted to include in advance
11:01clgvyou do not include an external file ?
11:02caternclgv: oh, no no, \input{|"script"} executes script and includes its stdout into the document
11:02clgvyou want to actually run a clojure program from the \input statement?
11:02caternvery unixy :)
11:02caternclgv: definitely!
11:02caternsome lein task, probably
11:03clgvhaha, your editing will suck due to the much longer latex compilation duration ;)
11:03caternclojure startup times :(
11:03caternthe worst thing about clojure
11:04clgvbetter use \include{constants.tex} and generate that file via a manual call to your clojure program
11:04justin_smithcatern: what about if "script" was "curl localhost/clojure-server/get-data"
11:04justin_smiththen you don't have to wait for startup
11:04clgvjustin_smith: woah, complexity is exploding! :P
11:04caternjustin_smith: hey, that's smart and also a TERRIBLE HACK
11:04caternbut I like it
11:04justin_smithhehe
11:05justin_smithgrench is similar
11:05justin_smithbut maybe less hackish
11:05justin_smithyou just have one clojure process running, and use grench to get a result from it
11:05clgvcatern: whats wrong with generating the "constants.tex" - it's like the suggested apporach from #latex but without the high costs of running the clojure program on every latex compilation
11:06caternclgv: that's good too I suppose
11:06caternI actually like justin_smith's suggestion
11:06clgvtikz has a similar approach by using "externalization" as they call it
11:06caternI mean all of these are small layers around the central functionality of generating some LaTeX
11:06caternmaybe I will write a library to generate LaTeX from Clojure values
11:07justin_smithcatern: you could call it 'org mode'
11:07caternjustin_smith: :)
11:07caternjustin_smith: hey, not really though
11:07justin_smithI know
11:07clgvcatern: with the implementation of (format "\def\%s{%s}" (sanitize name) (value)) ? ;)
11:08dysfunclgv: from that paste above, i'm intuiting that in clojure 1.7 they're making the core better behaved. is that something they're trying to do?
11:08caternclgv: well, what if you have a seq you want to include, or a seq of seqs? (for some reason..)
11:08justin_smithclgv: for scalars, but what about structured types?
11:09caternmaybe it should just be part of Incanter, because I can't see much use in including a dict in LaTeX
11:09justin_smithcatern: it's just the kind of thing that org mode does - it can do both (embedding clojure code / results, generating latex)
11:10caternjustin_smith: org-mode does embedding clojure code?
11:10caternthen I have no need for this!
11:10clgvjustin_smith: he definitely needs to specify some strucutre of what is supposed to be rendered to latex ..
11:10caternjustin_smith: please, tell me more
11:10justin_smithcatern: http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html
11:11caternoh
11:11caternyes
11:11clgvdysfun: not sure to what you refer exactly
11:11caternI see that
11:11caternpretty nice
11:11justin_smith"org-babel-clojure allows Clojure code to be executed directly within embedded code blocks in Org-mode documents. These code blocks and their results can be included in an exported document." -- export options include latex
11:11dysfunis there a reliable way to get an empty version of a given collection?
11:11zerokarmaleftcatern: it's a rabbit hole, but check out https://github.com/thi-ng/geom and other repositories for org-mode+babel+clojure literate craziness
11:11caternjustin_smith: yeah, I've been writing all this in org-mode anyway :)
11:12dysfunclgv: setting warn on reflection is presumably attempting to tighten up the behaviour of the core to be a bit higher quality and eliminate performance defects. is this an intended goal for 1.7?
11:12justin_smithdysfun: ##(map empty ["a" {:a 0} [1 2 3] #{:a}])
11:12lazybot⇒ (nil {} [] #{})
11:12clojurebotTitim gan éirí ort.
11:12dysfunjustin_smith: oh brilliant, thanks!
11:12clgvdysfun: I guess it ended up there by accident
11:12justin_smithdysfun: as you see, it might not do what you want for strings, (which aren't really collections I guess)
11:13clgvdysfun: enforcing reflections warnings is not a good idea in general - that has generated a lot of noise already with some libraries where it ended up in a release by accident
11:15justin_smithcatern: haha, nice, looking at clojure-babel in more detail, they actually include an example of using incanter inside clojure inside org-mode to generate latex
11:15justin_smith~emacs
11:15clojurebotemacs is finicky to configure and often broken
11:15caternjustin_smith: yeah, I saw that, which is great
11:16caternclojurebot: hey! :(
11:16clojurebotNo entiendo
11:16clgv,(print "catern: :P")
11:16clojurebotcatern: :P
11:26caternsuch emacs bashing
11:27caternyou'll drive people to worse things
11:27caternthey'll think you're being serious!
11:27caternkeep emacs bashing to #emacs
11:28J_Arcane:( I am bombing the extra credit in the UofH Clojure course. :P
11:28BinaryResultA reminder: Disco Melee is currently hiring clojure devs https://docs.google.com/document/d/1GvnrSCUbYgbY9XdFs_DUx-0QZG2bIYT8Mbr0zdpTeew/edit?usp=sharing
11:29bacon1989they have a clojure course?
11:29bacon1989that would be awesome
11:30J_Arcanehttp://iloveponies.github.io/120-hour-epic-sax-marathon/index.html
11:36borkdudein liberator, when someone uploads a file I consider too big, what should I respond with?
11:37jonathanjall my dependency versions are hardcoded in project.clj, which is great because nothing magically updates them underneath me breaking all my code. but is there a way to find out if any of my project deps have a newer version?
11:37borkdudejonathanj lein ancient
11:37justin_smithjonathanj: lein ancient
11:37jonathanjguess that's a lein plugin i need to depend on
11:37ordnungswidrigborkdude: valid-entity-length? => false
11:39borkdudeordnungswidrig ok. I was thinking of returning a 413. I'll try valid-entity-lenght? and see what happens
11:40ordnungswidrigborkdude: liberator will return a 413 if valid-entity-length? returns false
11:40borkdudeordnungswidrig cool. I didn't see it in the decision graph, so I wondered
11:40clgv~emacs
11:40clojurebotemacs is finicky to configure and often broken
11:41ordnungswidrigborkdude: it comes after `known-content-type`
11:41borkdudeordnungswidrig you're right. I see it now. A bit blind I guess :)
11:42justin_smithborkdude: I think Control-f works in svg
11:42ordnungswidrigborkdude: well, there's always the list of decisions which is search-able. But you need to know what to search for
11:42sritchiehey all - I’m looking at shadow build and seeing something about lein run I hadn’t known
11:42borkdudejustin_smith yes, I done that, but I could not find 413. It seems in the decision graph the arrow goes to 415
11:42clgvborkdude: that monster graph might need an interactive search ;)
11:42sritchieif you provide a keyword like :project/cljs to lein run, does that fetch that entry in the project map?
11:43justin_smithborkdude: oh, OK
11:43borkdudeordnungswidrig the arrow at false goes to 415. https://clojure-liberator.github.io/liberator/assets/img/decision-graph.svg
11:43borkdudeordnungswidrig I searched for 413, that's why I could't find it :)
11:43justin_smithborkdude: I just found it under 413
11:44justin_smithhttps://clojure-liberator.github.io/liberator/assets/img/decision-graph.svg
11:44justin_smithon the left side, right under 503
11:44ordnungswidrigjustin_smith: oh, I guess that is outdated *grr*
11:44justin_smithordnungswidrig: oh, the one I linked to is outdated?
11:44ordnungswidrigoh no, that's the right one but there' a 413 left of 422 for me?!
11:45borkdudeah dude, I'm really blind today :)
11:45borkdudeordnungswidrig justin_smith you're right, sorry
11:45justin_smithyes, and under 503, or se of it :)
11:45ordnungswidrighahaa
11:45justin_smithordnungswidrig: perhaps I miscommunicated
11:46ordnungswidrigborkdude: so we're fine?
11:46borkdudeordnungswidrig absolutely.
11:46sritchieanyone know about passing :project/key args in lein?
11:46sritchieto lein run
11:47ordnungswidrig,anyone
11:47stuartsierraWhen did org-clojure get CIDER support?
11:47clojurebot#error{:cause "Unable to resolve symbol: anyone in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: anyone in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: anyone in this context", :at [...
11:47ordnungswidrigstuartsierra: CIDER support?!
11:47stuartsierrahttp://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html
11:47justin_smithsritchie: args to lein run will be the args passed to -main, and all be strings, right?
11:47sritchieexcept for this cryptic comment: https://github.com/technomancy/leiningen/blob/master/src/leiningen/run.clj#L146
11:48sritchiejustin_smith: and the examples in shadow-build have you passing :project/cljs
11:48ordnungswidrigstuartsierra: sweeeeet
11:48sritchiewhich I think grabs that entry out of project.clj
11:48stuartsierraHaven't tried it yet; I rolled my own org-clojure a while ago.
11:48sritchiejustin_smith: trying to find the piece of code that handles that though
11:48justin_smithsritchie: wow, that's a weird feature
11:48sritchieyup, undocumented as far as I ca tell
11:53borkdudeI just noticed that a method call also works in thread-first: (-> ctx :tempfile .length)
11:54justin_smithborkdude: also works with doto
11:54ordnungswidrigborkdude, justin_smith: did that change recently? I'm pretty sure that there was a time where that would not work
11:54clgvjustin_smith: but borkdude is probably interested in that value of .length ;)
11:55justin_smithclgv: yes, related fact
11:55clgvordnungswidrig: no always worked since 1.2.1
11:55Bronsaordnungswidrig: always worked afaik
11:55justin_smithordnungswidrig: I don't ever remember it not working
11:55clgvordnungswidrig: you might get problems with typehints depending on the concrete form
11:59_kardanAnyone familiar with Bidi? I'm trying to use redirects but can't get it to work https://gist.github.com/kardan/8758aa14ca8c90970bcc what am I doing wrong?
12:00sritchiejustin_smith: boom: https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/main.clj#L251
12:00ordnungswidrig_kardan: I think you must not wrap the #".*" in brackets.
12:01justin_smithsritchie: there it is. Still think it's a weird feature :)
12:01sritchieyeah, definitely
12:01sritchieespecially because you can’t nest -
12:02sritchieI was looking into this because I wanted to provide shadow with a config for each of two profiles
12:02sritchiethe fact that you can only pull top level keys is odd
12:02justin_smithsritchie: and because ideally lein shouldn't even be present at production run time
12:03sritchieyeah, the “prod” build would be more for building the production version of clojurescript
12:08_kardanordnungwidrig true, but didn't fix my issue. Thanks anyway
12:08borkdudeis is possible to get the reponse's status with Google Closure iframeIo?
12:09nullptrborkdude: you can know it failed but i don't think you can get the specific response code/status
12:10borkdudenullptr ok
12:10nullptractually -- that's just from the event
12:10nullptrlooks like it has getLastErrorCode and getLastError
12:13borkdudenullptr in the case of a 413 response, the success is still true. but I can just use the innerHTML to see if the file was too big
12:14nullptrborkdude: it looks like there's a setErrorChecker hook there so you could probably inject your check there to influence isSuccess
12:15borkdudenullptr it does not even reach the error state
12:15borkdudenullptr oh wait, sorry, my bad
12:15borkdudenullptr I'll try it
12:16anti-freezeHey everyone. Does anyone know how I add a custom if statement in selmer? I want to add an if-authenticated block
12:18anti-freezeMaybe just a function or something to check if the user is authenticated?
12:19clgvanti-freeze: cant't you just use an authenticated property?
12:19anti-freezeclgv: You mean passing it as a parameter after every render?
12:19anti-freezebefore*
12:19anti-freezeso (render-file "auth.html" {:authenticated false})
12:20clgvyeah, just include that property to your property map
12:22anti-freezeclgv: I would, but this is needed for every single render, as its in the base template. I found something in the selmer source, maybe it could help. https://github.com/yogthos/Selmer/blob/master/src/selmer/tags.clj
12:24borkdudenullptr thanks for that suggestion. works great :)
12:25clgvanti-freeze: so? there might be other properties you also need in the base template sooner or later
12:26anti-freezeclgv: I do, but passing the same thing around to every template seems a little annoying, considering I can just check that value against the session :identity key
12:26clgvanti-freeze: ah, right, I'd have a central function for rendering which takes care of such properties
12:26clgvanti-freeze: humm, a tag could be possible solution, not entirely sure
12:30noncomhow do i set charset for a post request in clj-http?
12:30noncom(for a multipart post request)
12:30anti-freezeclgv: I'll give it a shot and report back
12:45anti-freezeclgv: Still no luck. I get compiler errors
12:46anti-freezeclgv: https://www.refheap.com/98909
12:48clgvanti-freeze: I did not implement a tag myself so far...
12:49anti-freezeclgv: This is beginning to annoy me. See, I need it for base.html which is where all other templates extend from. It would be horrible if I had to pass it as a parameter with every request
12:50clgvanti-freeze: can't you implement the single render function (render-template url, prop-map) that adds the auth property to prop-map before rendering with selmer?
12:50clgvanti-freeze: pretty easy fix ;)
12:51anti-freezeclgv: Maybe. I'll give selmer another go and then I'll just do that. Not the best fix however
12:51clgvanti-freeze: why?
12:51anti-freezeclgv: I don't know. I used selmer because of its "extensibility"
12:52clgvanti-freeze: ah ok. well, read up on the docs - maybe you overlooked some info on custom tags
12:56supersymyou know what I love about Clojure? Every time I think "Hey, let's try and see if this or that works....", it actually does.
12:57supersymcontrary to my recent php experiences which were the exact opposite ... lol
12:57clgvhaha :D
13:01borkdudejust checking, but would processable? be the correct decision point to check wether an upload is an image?
13:02borkdudein liberator that is
13:02supersymerh depends I guess? sometimes client side but you mention upload, as in its on the server already?
13:02supersymah
13:04borkdudesupersym yes, I don't trust my clients ;)
13:19sritchieanyone here using shadow-build, or its live reload feature?
13:21borkdudecool library: pantomime. (-> picture :tempfile mime-type-of image?)
13:28timvisherpoll: Clojure version of 'pythonic'?
13:28timvisheri tend to say 'clojurey' but that both looks and sounds a little dumb to me (^_^)
13:28timvisher'clojury'?
13:28timvisher:\
13:29justin_smithI tend to just call it "OK" as in "that code's OK" or "that isn't actually OK"
13:29justin_smithbut perhaps there should be a clojure flavored version of that
13:29justin_smith:clojure/acceptable?
13:31Glenjamin"simple"
13:31justin_smith(inc Glenjamin)
13:31lazybot⇒ 17
13:31clgvO_o
13:32Glenjaminalthough knowing to use (next) over (rest), (seq) over (empty?) etc
13:32Glenjamini guess that's more what we're talking about
13:42sritchietomjack: hey, are you https://github.com/tomjakubowski by any chance?
13:43bendlastimvisher: I'd have to say 'idiomatic'
13:43bendlaseven though that can be used in other languages as well, it's particularly idiomatic to call something 'idiomatic' in clojure
13:44dnolensritchie: tjakubow is who you're looking for
13:44sritchiednolen: you might be interested in this “bug” I found, as it might come up -
13:44sritchiednolen: shadow-build implements live-reloading with goog.isProvided_
13:44sritchiehttps://github.com/thheller/shadow-build/blob/fe129c26d68572991ef1ccdbd1da8e4dfbdb6277/src/cljs/shadow/cljs/live_reload.cljs#L26
13:44dnolensritchie: I don't use shadow-build
13:45dnolensritchie: and I'm becoming less interested in what other tools are doing, it's too hard to follow now
13:45sritchiednolen: for sure. just wanted to thank you, since I think your patch here fixed that issue https://github.com/tomjakubowski/weasel/pull/54/files
13:45dnolensritchie: that logic also incorrect
13:46dnolensritchie: see cljs.browser.repl/bootstrap
13:46dnolenanything else is not going to work
13:46sritchiethanks, I’ll get a patch up
13:46dnolensritchie: just load that ns and call it, it's meant to be reused
13:47sritchiednolen: you mean in weasel
13:47dnolensritchie: that's right, there's already a PR for this, or comment about it
13:48dnolenhrm or I thought there was ...
13:49sritchiehttps://github.com/tomjakubowski/weasel/blob/master/src/cljs/weasel/repl.cljs
13:49sritchiednolen: looks like you handled it already
13:49sritchie5 days after that other commit I sent
13:50dnolensritchie: heh
13:50dnolensritchie: yeah cemerick has been fixing up piggieback pretty good, it should just work if you're willing to go bleeding edge
13:50timvisherall of these suggestions are generic though
13:51sritchiednolen: anyway, this “only reload required things” is a busted optimization, since you might want to redefine multimethods that never get explicitly required
13:51dnolenotherwise, wait till he announces this stuff, we're releasing a version of ClojureScript just for nREPL users
13:51timvisheras in they'd be just as applicable in any community
13:51timvisheri would always want my code to be 'simple', 'idiomatic' etc.
13:51dnolensritchie: I don't follow
13:52timvisherbut it sounds like no one has a phrase that does that :)
13:52timvisherhow can i reload a defrecord that implements a protocol at the repl?
13:52sritchiednolen: was referencing two things - 1 is that I’ve got a multimethod based system for defining client side and server side page state data. Some of the client side multimethod definitions are in cljx files that aren’t required by cljs,
13:53sritchiednolen: but their multimethod implementations are still registered under simple or advanced compilation, since they get jammed into the final loaded file
13:53cemericksritchie: piggieback 0.2.0-SNAPSHOT is looking pretty decent with the latest CLJS; just check the "installation" note in piggieback's readme
13:53sritchiednolen: in :none mode, they get ignored, so I have to explicitly require those namespaces to get the multimethod registrations
13:53sritchiednolen: 2nd pt was that shadow tries to optimize by only reloading files that have been required by some namespace: https://github.com/thheller/shadow-build/blob/fe129c26d68572991ef1ccdbd1da8e4dfbdb6277/src/cljs/shadow/cljs/live_reload.cljs#L23
13:54sritchiednolen: which 1) will always fail in :none mode if you’ve got a repl running, and 2) will cause the files containing those multimethods I mentioned above to never reload
13:54sritchiednolen: sorry, getting into details you just said you wanted to avoid :)
13:54dnolensritchie: right I don't care about this stuff at all :)
13:55dnolensritchie: to the 1st point, that's just not going to change, :simple and :none just pull everything in the src directory in which is pretty obnoxious
13:55dnolensritchie: you have to use the classpath to get customized builds which is outrageous in my opinion
13:56dnolenin the future :simple and higher will take :main to control what's in a build
13:56sritchiednolen: yup, that’s what I’m doing, and agreed
13:56sritchiednolen: psyched for the modules stuff, btw -
13:57sritchiednolen: btw - racehubhq.com launched, full client side, written in Om
13:57dnolensritchie: yeah, it's pretty awesome if you're building a big app
13:57sritchiednolen: still some rough edges. modules are important for hiding a bunch of the admin-only stuff, like the timing app
13:57dnolensritchie: 502 :(, but awesome!
13:57sritchiednolen: Om baby! nice. so much for the change I just pushed.
14:21sritchiednolen: fixed https://racehubhq.com/
14:22dnolensritchie: looks real sweet :)
14:23sritchieworking on writing up the routing stuff I built for this + sente
14:23sritchiethanks again for Om! the transition to client side’s been really fun because of it.
14:24dnolensritchie: np, glad to hear it! Looking forward to getting back to it, got some goodies planned in the near future once the ClojureScript REPL stuff is behind us.
14:27sritchiecemerick: did that piggieback issue, or tools.nrepl issue, with resetting to cljs.user every time ever get fixed?
14:28sritchieI upgraded to piggieback 0.1.5 and tools.nrepl 0.2.7, but still no dice
14:29cemericksritchie: not aware of the issue, but you should be using 0.2.0-SNAPSHOT & nREPL 0.2.10 if you're running the newest CLJS stuff
14:29sritchiehttps://github.com/tomjakubowski/weasel/issues/26
14:29sritchieyou’ve commented on the issue, I believe
14:29sritchie“latest cider on melpa” is probably the issue
14:30bendlassritchie: I had that issue, but it went away a couple of weeks ago
14:31cemericksritchie: oh, that. I think that was always a cider issue; nothing related changed in piggieback/nREPL
14:32sritchiecool
14:32cemericksritchie: in any case, 0.2.0 is basically a rewrite to support the latest CLJS REPL bits
14:32sritchienice
14:32cemerickSo any issues reported < 4 days ago are obsolete :-P
14:32sritchiecompatible w/ the latest weasel etc?
14:33cemericksritchie: should be? Works well w/ nashorn, rhino, node, brepl, and ambly. Haven't gotten a weasel report either way yet.
14:33sritchieokay, cool
14:33sritchiethanks! I’ll try the upgrade after locking down this shadow-build live reload thing
14:37dahdnolen: been thinking an osascript ClojureScript REPL backend could be fun for OS X automation
14:38dah.. or even building full blown Cocoa applications i guess
14:39dnolendah: sounds like a reasonable idea to me, mfikes has already done a ton of this work in Ambly/Shrimp
14:41dahdnolen: cool, thanks for the pointer
14:44anti-freezedah: Haha, pointers...
15:06mikerodare there any good sources out there to explain what `print-dup` is?
15:06mikerodI sort of get it.
15:06mikerodbut I just would like to read something more "official"
15:06mikerodI saw some ancient mailing list stuff where Rich briefly discussed it (no link at the moment).
15:07mikerodwhat does "dup" even stand for?
15:07mikerodduplicate I think
15:07profilis there a way to get index when using for? (for [x [1 2 3 4 5]] (prn x "is at index: " x-index))
15:07patrickgombertmikerod: my understanding is that it is for serialization
15:08mikerodpatrickgombert: yes
15:08mikerodit allows more objects to have a reader-friendly print
15:09ro_stprofil: no, you'll need to use map-indexed
15:09joegalloprofil: (for [[i x] (map-indexed vector [:a :b :c])] ...)
15:09joegallonot exactly what you wanted, but it works
15:09ro_stor do what joegallo says. nice one
15:09mikerodby reader-friendly, I mean they can be read back in and eval'ed back to life
15:10profilI'm thinking that I could change the for into a map-indexed instead..
15:10joegalloah, that's only if you absolutely *must* use for -- alternatively you could fold your for's body into the fn arg to map-indexed
15:10joegalloprofil, yes, exactly :)
15:10mikerodI guess it is just a hook to make arbitrary ways to represent data to be serialized and then read back in later - I think it requires read with eval enabled.
15:12amalloymikerod: right. also, it tends to get sorta out of date because nobody uses print-dup
15:12amalloyi know there were some cases in the past where print-dup on some kind of uncommon data structure (maybe treemap?) printed a call to a constructor that doesn't exist anymore
15:13dybaI'm reading Let Over Lambda and noticed some interesting difference between Common Lisp and Clojure when defining the nif macro:
15:13dyba(defmacro nif [expr pos zero neg] `(cond (pos? ~expr) ~pos (zero? ~expr) ~zero :else ~neg))
15:14dybaClojure expands it to: (if (clojure.core/pos? 0) "Pos" (clojure.core/cond (clojure.core/zero? 0) "Zero" :else "Neg"))
15:14dybaBut CL expands it to the result "Pos", "Zero" or "Neg"
15:14amalloydyba: no it doesn't. you are using the macroexpander in CL wrong, or defining the macro wrong
15:15dybaamalloy: perhaps I did, I used CL's macroexpand function
15:16dybaAre they different?
15:16amalloyno. but perhaps you forgot to quote the expression to expand, for example
15:16dybaHm, good catch. Let me try it again
15:18amalloydyba: also, try using macroexpand-1
15:19amalloyi'm trying it in clisp, and it looks like the macroexpander is smart enough to elide checks that it knows will be true or knows will be false
15:19amalloyso you want to expand only your own macro, not the further macro that it expands to
15:19amalloy[10]> (macroexpand-1 '(nif -1 1 2 3)) ;=> (COND ((< 0 -1) 1) ((EQUALP 0 -1) 2) (T 3))
15:19amalloywhere i basically never use CL so i don't remember if equalp is the right predicate to use or what
15:22dybaamalloy: yup it works with macroexpand-1
15:22dybamacroexpand gives me the evaluated result
15:23dybaAnd I am using a quote in front of the expression I'm passing to macroexpand
15:25amalloydyba: yeah, i was surprised to discover that = and < have uh...compiler macros, i guess, associated with the functions for them
15:25amalloyso like if you expanded '(nif x 1 2 3), you'd get the full cond tree
15:25amalloybut '(nif 0 1 2 3) it knows how to evaluate at compile time
15:27dybaamalloy: Ah, I see what you mean
15:29dybaamalloy: so what you're saying this behavior in CL suggests that = is likely built with a compiler macro?
15:29dybasaying is that*
15:29amalloywell, = is a built-in function, and appears to have a compiler macro as well
15:30amalloyin theory it could be special-cased by the macroexpander, but probably it is just a compiler macro
15:34danlentzif you are interested in CL compiler macros, there is a short presentation given my arthur lemmens floating around out there
15:34danlentzhttp://www.pentaside.org/paper/compilermacro-lemmens/compiler-macros-for-publication.txt
15:36amalloydanlentz: i understand the idea of compiler macros, but i don't know whether = uses one, or how i would confirm my expectation that it does
15:37danlentzcan’t you call (compiler-macro-function ‘=)
15:38amalloydanlentz: apparently not. but i wouldn't have known to try that; i never use CL
15:39danlentzcompiler-macros are somewhat heady stuff. I worked in CL for a number of years and pretty rarely came into contact with them.
15:40amalloydanlentz: rarely noticed coming into contact with them, anyway
15:40danlentzyes, you’re right.
15:41dybadanlentz: that presentation helped with having a better understanding of the idea of compiler macros
15:41dybathanks!
15:41danlentzreading through this paper again, the use-case of translating n-ary to binary functions is interesting.
15:42danlentzyeah, im just rereading it and thinking the same thing.
15:42amalloydanlentz: clojure has its own version of compiler macros too, mostly for the primitive math stuff
15:42danlentzarthur lemmens is really an iconic common-lisper. I spent my first year or so of CL studying his persistent object-store called Rucksack
15:43dybaI don't use CL but reading Let Over Lambda requires having some basic understanding of that language
15:43danlentzshit yeah it does
15:43dybaWhich is why I asked the question originally
15:43danlentzthat is a hard book
15:43amalloyeg, see the definition of nil?, which has in its metadata {:inline (fn [x] (list 'clojure.lang.Util/identical x nil))}
15:44dybadanlentz: you're telling me! ;) Definitely not an easy read
15:44danlentzif you look in my CL-CTRIE project I have a dlambda, plambda
15:44dybaI haven't read that chapter yet; I'm currently on ch. 3
15:44danlentzhttps://github.com/danlentz/cl-ctrie/blob/master/ctrie-lambda.lisp
15:44dybaThe once only macro
15:45dybaSweet!
15:45danlentzdyba: did you read paul graham first?
15:45dybaI'm bookmarking that and coming back to it when I get to that chapter
15:45dybadanlentz: You mean On Lisp?
15:45danlentzy
15:45dybaI'm reading that one too
15:45dybaJust got past the first chapter
15:45danlentzits good to read that first — its mostly about macros
15:46danlentzLoL is on the edge of the discovered macro universe. On Lisp covers the stuff that may come in more handy day to day.
15:47danlentzbut I love that book, awesome to see clojurians reading it!
15:50danlentzhowever, I have to warn you, anytime I show a client code with “pandoric-lambda” in it they make a scrunchy face like I just fed them lemons
15:50dybadanlentz: I'll keep that in mind. I'm reading LoL first because I have a hard copy of it. On Lisp is out of print last I checked. And it sells for hundreds of dollars on Amazon.
15:50danlentzits free
15:50dybaI downloaded the free PDF, but I still like to have the book on my hand
15:50danlentzoh
15:51dybadanlentz: lol
15:51danlentzi do understand. I print stuff out and bind it nicely with a stiff paperboard backing (cut from a heavy duty binder) and poly cover
15:51dyba(the popular lol) ;)
15:52dybaI think I will do that with On Lisp, so that I can write on the margins of the pages
15:52danlentzdyba: what I love is the pandoric-lambda from LoL though
15:53danlentzand the entire concept of “sub-lexical scope”
15:53dybawhat chapter are those topics on?
15:54danlentzdont remember offhand. the entire first part of the book builds up to pandoric-lambda
15:54dybaAh I found them
15:54danlentzthen he goes back and does other stuff like a forth interpreter
15:56danlentzI think clojure macros are quite a bit easier to work with than in common-lisp, just because the gensyms are so easy syntactically
15:57danlentzI might be slow, but it took me a couple of years to work though LoL
15:58danlentzbecause it wasnt continuous. I’d read until I was thoroughly baffled, then put the book down for 6 months and try again.
16:00dybadanlentz: "Should you experience headaches or other discomfort through the course of this book, I recommend that you immediately execute a garbage collection cycle (get some sleep), then return with a fresh and open mind"
16:00danlentzusually until I saw something in the outside world that I connected with the book and somehow made something “click” — then I’d get 10 pages further until baffled again.
16:27danlentzdyba: if you do cut and paste the code, at line 133 there is a (defun/inline …) form that is just syntactic sugar to define a function and declare it ‘inline’ all with one form.
16:28dybadanlentz: I'll keep that in mind
16:28danlentzyou would need to change that or copy the defun/inline macro: https://github.com/danlentz/cl-ctrie/blob/master/common-macro.lisp#L38
16:30danlentzthere are some other useful examples of macros in that file, if you are interested
16:30danlentzlike, you were talking about “once only”
16:31danlentzhttps://github.com/danlentz/cl-ctrie/blob/master/common-macro.lisp#L74 defines a defmacro/once macro
16:35edbondhow to get matched value from map of regexp => value? (<somefns> { #"a" 42, #"b" 99 } "bbb") ;; 99
16:36edbondpossible direction, what fns to look at?
16:36gfrederickssome could probably help
16:36gfredericks,(doc some)
16:36clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
16:36chouseror keep, depending on if you want more than one result
16:37edbondjust first result
16:37chouserand of course re-find
16:37edbondthanks
16:37edbond,(inc gfredericks)
16:37clojurebot#error{:cause "Unable to resolve symbol: gfredericks in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: gfredericks in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: gfredericks in this ...
16:37gfredericks,(def gfredericks 41)
16:37clojurebot#'sandbox/gfredericks
16:37edbond,(inc gfredericks)
16:37clojurebot42
16:37edbondnice
16:38edbond(inc gfredericks)
16:38lazybot⇒ 129
16:39danlentz,danlentz
16:39clojurebot#error{:cause "Unable to resolve symbol: danlentz in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: danlentz in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: danlentz in this context",...
16:40danlentz,(def danlentz Math/PI)
16:40clojurebot#'sandbox/danlentz
16:40gfredericks,(inc danlentz)
16:40clojurebot4.141592653589793
16:40gfredericks$google zip code 41415
16:40lazybot[41415 Rayburn Dr, Northville, MI 48168 is Recently Sold | Zillow] http://www.zillow.com/homedetails/41415-Rayburn-Dr-Northville-MI-48168/88392796_zpid/
16:41danlentzwow
16:41danlentz$google clj-uuid
16:41lazybot[danlentz/clj-uuid · GitHub] https://github.com/danlentz/clj-uuid
16:42danlentzcool!
16:46ben_vulpesyo so cider is eating print statements in my http-kit webapp :(
16:46ben_vulpeslein repl commits no such crime
16:46ben_vulpeshalp wat do
16:46danlentz,(java.util.UUID/randomUUID)
16:46clojurebot#uuid "a296e782-0372-4a7b-996d-9ef25a5437d2"
16:48danlentzben_vulpes: check other window
16:48danlentz?
16:48ben_vulpesother...window?
16:48ben_vulpescider-error?
16:48ben_vulpesnrepl-connection?
16:49ben_vulpesdanlentz:
16:50danlentzwell, there are a limited number of them, check them all
16:51danlentzi mean, what I am asking is if maybe you are doing IO on a background thread and it is directed to the console rather than cider
16:51danlentzbut ive never done anything with http-kit so that is just a stab in the dark on general principle
16:52ben_vulpesdanlentz: the only relevant buffers i have at hand are nrepl-server and cider-repl
16:52ben_vulpeswhat would be different in execution between cider via emacs and lein repl?
16:52ben_vulpesi'm way out of my depth on this one.
16:52ben_vulpesiirc i've seen this in ring as well
16:52justin_smithben_vulpes: it's an old bug
16:53justin_smithben_vulpes: cider rebinds *out* but that does not propagate to your ringer server's threads
16:53ben_vulpesaha that sounds right
16:53justin_smithben_vulpes: so any printing from them go to the initial value of *out*, which is either an *nrepl-server* buffer, or the terminal where you started up from, or whatever
16:55ben_vulpesagh fuck
16:55ben_vulpeshttps://github.com/clojure-emacs/cider/pull/818
16:56ben_vulpesdude
16:56ben_vulpescan i just use slime?
16:56ben_vulpesand mebbe nrepl?
16:56danlentzthings work like this in CL/slime as well
16:57justin_smithben_vulpes: the bug doesn't come up in inferior-lisp, if you don't mind doing things caveman style
16:57danlentzI never thought of it as a “bug"
16:57ben_vulpesyou never thought the dropping of print statements on the floor was a bug?
16:57justin_smithdanlentz: the difference is that with slime, the process buffer (default root *out*) is also the repl buffer
16:57justin_smithdanlentz: this is not the case in cider
16:58danlentzthe behaviour of special variables between/among thread I mean
16:59justin_smithyeah, that's slightly orthogonal to the UI disaster in cider
16:59justin_smithlast comment in that thread: "I submit that having the application's standard output, including log output, in a buffer separate from interactive REPL output is desireable. I would go so far as to call it a feature."
17:00justin_smiththere you have it, cider author has declared that not outputting to the cider repl buffer is a feature
17:01danlentzwell that is bizarre
17:01danlentzbut I agree with the idea of not having *out* bound to the cider-repl in all threads
17:03justin_smithI think separating output between buffers, defaulting to a buffer that never pops to the front, should be an opt-in thing
17:04justin_smithAs a naive new user, I'd rather deal with messy output cluttering a buffer, than output that I expect never being visible
17:05ben_vulpesespecially since it's such a radical divergence from how the time tested and battle hardened tools elsewhere in the lisp universe behave in my limited experience.
17:05danlentzit seems normal to me
17:05danlentzwell, the default output from the foreground should go to the repl. background threads all go to the console.
17:06danlentzi’ve been donating $10 a week to the cider project
17:06justin_smithI long ago ditched cider for inferior-lisp
17:07ben_vulpesjustin_smith: i think i'll have to hit you up for a crash course on inferior lisp here shortly
17:07danlentzi want it to get better, but it didnt happen overnight with slime either — thats for sure.
17:08ben_vulpeswhat would be the cider-y solution?
17:08justin_smithhehe, just to warn you it is seriously feature deprived. But it isn't constantly broken, and is never surprising to me.
17:08ben_vulpesi don't need much by way of features
17:08ben_vulpesi've got helm
17:08justin_smithben_vulpes: another option is monroe
17:09ben_vulpes"simple installation without any dependencies, except Emacs"
17:09ben_vulpesahahaha
17:09ben_vulpesi guess theoretically emacs could be just a single dep
17:12danlentzi think the reason is that output to the CIDER nrepl buffer is very slow. Even a modest amout of printing is going to “freeze” things up a bit.
17:13justin_smithdanlentz: do you mean the cider-nrepl (aka console) or cider repl (aka the repl)
17:13danlentzthe cider repl in my emacs window
17:14justin_smithdanlentz: the reason I ask is that the hidden console output (not a repl) is actually called *cider-nrepl* or something very close to that
17:14justin_smiththe buffer that most people never see, and they think prints that end up there never happened
17:15danlentzI gave up keeping track of what things were being called a while ago…. :)
17:15Frozenlockjustin_smith: it's really aggravating when it occurs...
17:15Frozenlock"Where is my print? I'm sure I added a print somewhere..."
17:15justin_smithFrozenlock: yes, I would disagree with the official stance and call it a bug actually.
17:17danlentzif you are doing a lot of that, might it make sense to consider a logging package, which in many cases will be much faster than printing to console and light years faster than printing to Cider repl
17:17danlentzbuffered output and so forth
17:17justin_smithdanlentz: the logger will end up printing to the console, unless you set up a log file
17:17danlentzright'
17:17danlentzi mean, just a suggestion
17:18danlentzand then tail -f the log file, I mean
17:18justin_smithdanlentz: M-x auto-revert-tail-mode
17:19FrozenlockM-x butterfly
17:21FrozenlockI used to have plenty of problems with Cider, but I don't anymore. I also don't live on the edge. I found a stable version and I stick with it (for now).
17:21danlentzy i pulled back from the edge a few months ago myself
17:21FrozenlockThe only bad thing I can think of is connecting to a remote repl with a poor connection: the autocomplete is sloooow
17:22danlentzthe edge is rather pointy these days
17:24FrozenlockI wonder if we could find a correlation between the number of issues opened at any point and the expected user experience.
17:25danlentzmy opinion is that the lack of willingness to cooperate by the SLIME developers hurt the clojure tooling (cider) and it is taking a while to draw even. But I think the result is that also cider may wind up to be the cleaner and more modern tool
17:25danlentzat some point.
17:25danlentzi miss the debugger
17:26Frozenlockdanlentz: by what I understood, slime was a horrible mess. I would ask technomancy to chip in, but I don't think he's here. :-/
17:27danlentzi probably put off working with clojure for at least a couple of years just because it was problematic to use at the same time Slime for Clojure and Slime for CL
17:27Frozenlockdanlentz: http://technomancy.us/163
17:27danlentzinteresting
17:29danlentzi think he’s not saying that the SLIME developers were actively belligerent towards the idea
17:29danlentzwhich, having watched, was my impression
17:30FrozenlockAbout the debugger https://github.com/clojure-emacs/cider/issues/694
17:31danlentzthere were actually many contributed patches to the SLIME effort that the maintainers simply threw on the floor
17:32danlentzand they made it very difficult, as he said, for any project to fork and extend
17:34danlentzI really feel like the approach they took did more to harm the CL community than slow Clojure down all that much.
17:35danlentzattila lemdvai did some awesome patches that allowed you to use SLIME basically as a text-gui interface for your own app
17:36danlentzall that was required was that a couple of hooks be added into the trunk, and the use-case of SLIME could have really expanded to provide a sorely lacking facility: any sort of common front-end interface among lisps
17:37p_ldanlentz: back in the day i always felt it had more to do with all yhe clojure patches I've seen being for a version considered outdated (but last tarballed)
17:39danlentzthat would be a good sugestion for the Cider project: customizable “inspector” that allows you to design arbitrary CRUD layout
17:40justin_smithdanlentz: hmm, what about something using GUD mode with jdb instead of the usual gdb?
17:40danlentzmight be gud
17:40danlentz:)
17:41justin_smithGUD UI example http://tuhdo.github.io/static/c-ide/gdb-many-windows.gif
17:41justin_smithone window with stack frames, another with breakpoints, another showing locals, etc.
17:41justin_smithand threads
17:42justin_smithjdb provides all of that, I wonder how well elisp could extract sensible clojure info from all of it
18:03xemdetiagdb-many-windows the best friend
18:03Lewixwhy is that clojurist don't have an awesome newsletter like gooist
18:03Lewixor rubyist
18:04amalloyLewix: you haven't written one yet
18:04justin_smithLewix: we have one, we just decided not to invite you
18:04omeval is evil!
18:04Lewixamalloy: im not a clojurist yet
18:04danlentzwhat is that lambda-love newsletter
18:04xemdetiaI mean clojure has a useful irc channel why do you need a newsletter
18:04omI have Enlive selector code (with fns) that I load from a config file.
18:04FrozenlockLewix: the #clojure channel is like the official doc and the mailing list. All in one.
18:04justin_smithLewix: we have (def newsletter) and the clojure gazette
18:04Lewixxemdetia: well to keep up to date in an efficient way? To promote clojure ?
18:05omSelectors are vectors. But at some point the fns (from enlive ns) have to be resolved.
18:05bjaif I want to a map as a JSON value for HoneySQL, do i have to override the ToSql implementation for IPersistentMap (thus giving up subqueries)?
18:05Lewixjustin_smith: i see. I'll google that
18:05justin_smithLewix: http://defnewsletter.com/ http://www.clojuregazette.com/
18:05omI thought that the eval being done in the processing ns, I could call my function in another ns without requiring enlive there too. But this is where the eval happens indeed.
18:05omso it seems, eval is really evil!
18:06justin_smithom: also, eval is also very bad for performance
18:07omjustin_smith: how would you proceed then, to have the fns is selectors being resolved?
18:08danlentzlewix: http://reborg.tumblr.com
18:08danlentzanother “clojure weekly”
18:08justin_smithom: if possible, a simple mapping (via hash map) from symbols or keywords to the functions that are valid. This also prevents the "run arbitrary code" issue, or at least improves that situation.
18:08danlentzI endorse Clojure Weekly because he mentioned me last week :)
18:09omto give an idea : https://www.refheap.com/98916
18:09omjustin_smith: this is exactly what I do
18:09Lewixdanlentz: thanks
18:09ombut I some point they have to be resolved? don't they?
18:10justin_smithom: well, if you use a hash map from symbol to function, then you don't need eval
18:10justin_smithit's a whitelist
18:10omjustin_smith: really?
18:11omjustin_smith: if I have, say, [[:table (left :table)] :> [:tr (left :tr)]] how do I get it resolve
18:11danlentzcan you use “resolve” rather than eval?
18:11omleft or enlive/left
18:12danlentzI mean, isnt a ns basically a hash map from symbol to function?
18:12omdanlentz: I don't think so, I'll try again
18:13justin_smithom: (clojure.walk/post-walk #(if (symbol? %) (get {'left enlive/left} %) %) selector)
18:13justin_smithwhere you would selectively add the valid functions to the hash map
18:13danlentzoh i see
18:13omjustin_smith: sure, but this doesn't give me a fn that I can pass to enlive: this is the problem
18:13justin_smithit's easier if the structure is more predictable, but post-walk will do the job
18:15omif you look to the few lines of code I posted, you will see remove-nodes to which I pass bunches of selectors taken from a vector
18:15justin_smithoh right, left is being called with args
18:16omthe pb being that when remove-nodes is called from another ns, the later should have enlive required
18:17justin_smithom: this is the thing I am saying is fixed by inserting the actual functions into the form.
18:17justin_smithbut I'm unfamiliar with this part of enlive
18:17justin_smithand some weird stuff is going on there
18:17justin_smithwhere clearly eval is the easy way to handle it
18:18pandeirowhat is the idiomatic way to go from record -> plain map?
18:18justin_smithpandeiro: (into {} rec)
18:18amalloypandeiro: don't define the record type to begin with is easiest
18:18omjustin_smith: thanks a lot, maybe I misunderstood what you meant with postwalk here (because I use it a lot too)
18:18amalloyi think om is trying to run user-specified code at runtime, not just do some simple lookup to plug into an already-defined function
18:19bjacan I temporarily extend-protocol something (i.e. in a thread-local way)?
18:19justin_smithamalloy: yeah, I think it's some enlive specific idiom going on too
18:19amalloyeval seems easier than trying to invent an entire interpreter for enlive selectors
18:19dnolenbja: you cannot
18:19pandeirojustin_smith: ok that works; amalloy: yeah neocons did it, not me
18:20amalloypandeiro: why do you need it to be a map anyway, if you have a record already?
18:20pandeiroamalloy: serializing it to edn
18:20omamalloy: but then how do you avoid requiring the ns where the fns are defined (in my case enlive), in the ns calling my function (not sure I am clear)?
18:21omamalloy: I guess you can't
18:21justin_smithom: what about a post-walk and resolving all symbols?
18:21amalloyyou don't. eval happens in a clean environment, usually in clojure.core or something, so if you want more names accessible you need to make them accessible in the code you're evaluating
18:21amalloyjustin_smith: and then what? you still need to eval the result
18:21ombecause eval happens at "eval" time, hence my calling it evil
18:21justin_smithamalloy: right, but then they are fully qualified
18:21omoh, right
18:22justin_smithamalloy: wouldn't fully resolving any symbols make sure eval works?
18:22amalloymeh. just (eval `(do (require [enlive.whatever :refer :all]) ~the-user-code)))
18:22omI mean I do not eval in my function, but the eval happens when my function is called, right?
18:23omoh, seriously?
18:23omthanks
18:23amalloyom: that's what i'm saying. if you want the user code to have a specific environment set up, you just change the user code to set up that environment itself
18:24omI see, thanks to both of you
18:24calhinshawI'm not sure this is the right place to ask, so let me know if it's not. I'm new to clojurescript webapps and having trouble getting routing working. I made a new luminus project with the +cljs option and added the goog.history code at http://yogthos.net/posts/2014-08-14-Routing-With-Secretary.html, but I can't get get the back button to work or get the urls i'm dispatching to display in the url bar. Does anyone have any suggest
18:24calhinshawions? Thanks.
18:24ompretty neat explanation (I did not get eval was happening in a 'clean' env)
18:27sobelso.. i'm having odd probles with floats (Float/parseFloat)
18:27sobelwhat type is a 'naked' decimal number? that may be my trouble
18:28danlentzthat is the special “exhibitionist primitive” type
18:28sobelhah. i don't know if unboxed is the right term in clojure.
18:29sobeli lack words. that makes this (and google) harder.
18:29danlentzyou have to watch out for contagion :)
18:29justin_smithsobel: float and double are unboxed, Float and Double are boxed
18:29justin_smithsobel: when the compiler gets the right hints, it can figure out when it doesn't need to box things
18:29sobeli have a vector of floats i parsed with Float/parseFloat, and when i try to filter one, it's not found. but when i filter for (Float/parseFloat "0.0943") it'sfound
18:29danlentzhttp://clojure.org/java_interop#Java%20Interop-Type%20Hints
18:30sobelaha, that settles it
18:30sobeljustin_smith: thx
18:30justin_smithsobel: with clojure 1.7, there is a *warn-on-boxed* value for the unchecked-math setting
18:30justin_smithsobel: floating point equality is your problem
18:30sobeli suppose i don't really want Float/parseFloat. what's a better way to get numeric out of string?
18:31justin_smith,(= 0.0943 (Float/parseFloat "0.0943"))
18:31clojurebotfalse
18:31justin_smithsobel: ^^ that's your issue
18:31sobeljustin_smith: yes, that was basically my isolated problem
18:31justin_smithsobel: read-string
18:31justin_smithor Double/parseDouble
18:32justin_smith,(= 0.0943 (Double/parseDouble "0.0943"))
18:32clojurebottrue
18:32justin_smithbut floating point equality is always going to be problematic
18:32sobelyeah, i'm familiar with the built-in problem on that
18:33sobelfwiw, 0.0 doesn't suffer the fp inequality issue at hand ;)
18:33justin_smithheh, I'd hope not
18:34sobelis there a simpler numeric conversion that doesn't involve eval?
18:34justin_smithsobel: parseDouble doesn't involve eval
18:34justin_smithread-string doesn't either
18:34sobele.g. untrusted sources
18:35sobelis this doc outdated? Note that read-string can execute code (controlled by *read-eval*),
18:35justin_smithparseDouble is your safest bet if you know that will be the expected type
18:35sobeland as such should be used only with trusted sources.
18:35justin_smithright
18:35justin_smithso use parseDouble
18:35justin_smithor edn/read-string
18:35danlentz,(= (float 0.0943) (Float/parseFloat "0.0943"))
18:35clojurebottrue
18:35sobelthat'll be a boxed Double right?
18:35justin_smithsobel: absolutely
18:35justin_smithboxing was not your issue here
18:36danlentz,(= 0.0943 (Double/parseDouble "0.0943"))
18:36clojurebottrue
18:36danlentzyour issue is the default representation
18:36sobelah ok
18:37justin_smithsobel: unboxed doubles can't be stand alone values, they can only be members of a double-array or arguments / return values of methods. Maybe they can be fields of some class too?
18:37justin_smithbut they aren't objects
18:37sobelthat's only a slight bit weird. i think i can digest it.
18:38justin_smithsobel: unboxed numerics exist so code can be fast
18:38justin_smithsobel: objects have overhead, sometimes we really don't want that overhead
18:38sobelmostly it's just a foible i hit on at the repl. the code that needs to care is actually ok, it's just obnoxious trying to validate it with tiny tests and hand-picked data.
18:39yotsovHello. Is there a clojurescript equivalent of environ? Any way to pass build env variables to the code?
18:40sobeljustin_smith: oh yeah, totally understood on boxing vs performance. i think my trouble was just expecting a cut & paste value to let me test my code when it was full of boxed values.
18:40justin_smithsobel: boxing was not your issue here
18:41justin_smithsobel: your issue was that 0.0943 as a literal, is a double in clojure
18:41justin_smithbut you were creating floats from strings
18:41justin_smithfloats and doubles have different resolution
18:41omamalloy: interestingly enough, doing a require in the eval raises a class not found exception
18:41justin_smithso they compare oddly
18:41amalloyom: oh sure, it needs to be quoted better
18:41justin_smithom: make sure to get your quoting right
18:41amalloymy example wasn't right
18:42amalloy(eval `(do (require ['~'enlive.whatever :refer :all]) ~the-user-code)))
18:42omwell, syntax quoting should be enough no, why dequote
18:42caternyikes
18:42caternclojure gets pretty ugly with the quoting
18:43omthanks, amalloy, justin_smith
18:43omamalloy: why is the tilde "quoted"?
18:43caternthamalloy.
18:44justin_smithcatern: sadly thjustin_smith just doesn't have the same ring to it
18:44caternthustin_smith!
18:45sobeljustin_smith: i know, and i was looking right at it, thinking eh, should be ok at least to the ten-thoundths place!
18:46sobelanywho, thanks all
18:47omamalloy: got it to work (still did not fully catch the '~')
18:47om(inc amalloy)
18:47lazybot⇒ 243
18:47amalloyom: '~' is not a compound thing, it is just a combination of ', then ~, then '
18:47sobelthis is my first commercial clojure project. being able to conveniently manipulate data is saving me numerous trips to the database. my input design seems to assume that you can't sort or merge data without sql.
18:48justin_smith(inc group-by)
18:48lazybot⇒ 1
18:48omamalloy: oh, you quote the unquote
18:48amalloyyou want to emit 'enlive.whatever, with a quote in front of it, so you start with '. then, you want to not namespace-qualify enlive.whatever, so you write ~ to leave the ` context, and ' to enter a normal quoting context
18:49caternguys
18:49caternI need to write some clojure
18:49caternit's amazing
18:49caternsome more*
18:49caternI did some trivial programming with it earlier
18:49caternand it was great
18:49omamalloy: excellent, thank you
18:49caternwhat trivial project should I do next?
18:49justin_smithjeapordy app
18:49caternwhat is clojure good at besides web apps and statistics?
18:49justin_smith(wrong kind of trivial)
18:50sobeljustin_smith: once i can write the clojure-equivalent of sql exprs involving group by, order by, rank over, partition over, and having... there will be no more utility-trips to the db :)
18:50justin_smithsobel: well, group-by alreayd works at least, it would be nice to build a lib that has all of them
18:50amalloyjustin_smith: pls, pronounce it like "gee-pordy" next time someone is talking about jeopardy
18:50justin_smithamalloy: uh, OK
18:51justin_smithmy spelling is shit
18:51amalloy(the misspelling leads to a funny-sounding pronunciation)
18:51justin_smithyes
18:51amalloyalthough i guess the right spelling should be pronounced pretty funny too, if english made any sense
18:51sobeljustin_smith: i'm new at this, but i'd hope all the basics (order by, group by, having) are available
18:51justin_smithsort-by, group-by, filter
18:51sobeli mean.. i used sort-by earlier today
18:52sobeli'd just need to figure out how to replace rank over and partition
18:52caternwhat's a good clojure library for simple geometry and drawing? Say I wanted to draw one of these: http://en.wikipedia.org/wiki/Voronoi_diagram
18:53justin_smithcatern: I'd check out analemma if svg output is acceptable
18:53caternwhat about quil?
18:54justin_smithquil is kind of weird, but sure
18:54caternweird?
18:54justin_smithquil has its own main loop thing, and does a few things in ways that are not conventional
18:54sobelSwing is always quick & dirty
18:54justin_smithit wants to be like the clojure processing
18:55jaenJust trying some macro shenanigans and I can't figure out a way to refer to a some-gensym# that's outside a ~(expr) from inside it. Any way to do that? (I need to conditionally emit code in macro that uses this gensym)
18:55amalloyjaen: you can't
18:56jaenDamn, I suspected that : X
18:56amalloyyou need to generate your own gensym by hand, if you want to use it in multiple contexts
18:56jaenamalloy: you mean like (gensym "name")?
18:57amalloy(let [x (gensym "x")] `(let [~x 1] ~(if whatever `(+ 1 ~x) `(- ~x 1))))
18:57jaenOk, thanks : )
18:57justin_smith(inc `~'amalloy)
18:57lazybot⇒ 1
18:58amalloy,`~`~`~`~1
18:58clojurebot1
18:59amalloytip: to make your code more confusing, just sprinkle some `~ into it at random
18:59amalloyit's like a 2-character identity function
18:59sobelsoaking up excess readability
19:00sobelthis language has everything, i swear
19:00sobel(pony)
19:00justin_smith,(`~`~get `~`~`~`~get `~`~`~`~`~`~`~get `~`~`~`~`~`~`~`~`~`~`~get)
19:00clojurebot#object[clojure.core$get "clojure.core$get@40007a3a"]
19:00amalloy*chuckle*
19:02sobeland today, my big milestone was making intuitive sense out of the idiom (apply map vector [[ ... ]])
19:02justin_smiththat's much more useful
19:03sobelstarting to get some opinions on how this should be learned
19:22irctc_Would like to convert [{:year "2015" :grp "foo" :name "A"} {:year "2015" :grp "foo" :name "B"} {:year "2014" :grp "bar" :name "C"} {:year "2014" :grp "bar" :name "D"}] to..
19:22irctc_ {"2015" {"foo" [{:year "2015" :grp "foo" :name "A"} {:year "2015" :grp "foo" :name "B"}]} "2014" {"bar" [{:year "2014" :grp "bar" :name "C"} {:year "2014" :grp "bar" :name "D"}]}}
19:24oddcullygroup-by?
19:24irctc_trying to use successive calls to group-by with a function signature like: (group-by-nest coll [:year :grp])
19:25justin_smithwait, where does the :grp part come in? they aren't grouped by it
19:26amalloyirctc_: http://stackoverflow.com/q/25480674/625403 looks like your question
19:26justin_smithmaybe you just want to sort by it?
19:26justin_smithirctc_: oh, now I see, never mind
19:26chouser(into {} (for [[year v2] (group-by :year v)] [year (group-by :grp v2)]))
19:27justin_smith(inc chouser)
19:27lazybot⇒ 19
19:27amalloychouser: works, but i like cgrand's version on stackoverflow better. avoids traversing the whole input multiple times
19:27irctc_amalloy: that looks like the one.. thanks.
19:28chouserthough you rebuild the root map once for every element instead.
19:29irctc_chouser: thank you. will check that out too!
19:29chouserneither is cleanly parameterized on the set of keys to be extracted. bit of a shame.
19:30hiredmanwith some work you can turn cgrand's approach in to a transformation of a reducing function, and etc etc
19:30hiredmanhttp://aphyr.github.io/tesser/tesser.core.html#var-group-by
19:30amalloychouser: it's pretty easy to do that for cgrand's, though. yours isn't obviously possible to do that with
19:31chouserwell, yes, generally if you have a solution from cgrand I'd go with that.
19:31amalloywow how has cgrand's answer been there for so many years and the parens don't even balance
19:32amalloyoh i guess it's only last year
19:34danlentzshould I just always use (defn foo ^Thing [] …) instead of (defn ^Thing foo [] …) ?
19:34hiredmanno
19:34danlentzonly primitives?
19:35hiredmanyou shouldn't do either until you've yelled at someone who can get patches in for a while
19:35danlentzin reading lein-eastwood I found out that all of my (defn ^long foo [] …) were not correct
19:35hiredmanyeah
19:35hiredmanfor primitives that is correct
19:35danlentzso that is a pisser
19:35amalloyhttps://www.refheap.com/4d7acc00d8cbdf6e67afe77c2 - cgrand's answer, parameterized for the keys to index on
19:36hiredman,(doc clojure.set/index)
19:36clojurebotHuh?
19:36hiredmanclojurebot: jerk
19:36clojurebotyou cut me deep, man.
19:36justin_smith,(require 'clojure.set)
19:36clojurebotnil
19:37justin_smith(doc clojure.set/index)
19:37clojurebot"([xrel ks]); Returns a map of the distinct values of ks in the xrel mapped to a set of the maps in xrel with the corresponding values of ks."
19:37danlentzbut (defn foo ^x.y.Thing [] ….) is correct, according to the eastwood page on :wrong-tag
19:37hiredman:/
19:37danlentzso wouldnt it be best to always just use type hints in that position and to just fully qualify them if needed?
19:37danlentzfor consistency?
19:38hiredmandanlentz: I am looking at the page for wrong tag, it says (defn foo ^x.y.Thing [] ….) is incorrect
19:39hiredmanis that what you meant?
19:39hiredmandanlentz: hilariously it was an attempt to bring consistency that left us in this state
19:40danlentzi’m kind of more bothered by this than most other rought edges ive run into
19:40danlentzi mean, this seems actually crazy
19:41amalloydanlentz: a lot of totally crazy things are explained by "historically x was true, so this crazy thing y made sense at the time"
19:41danlentz;; no warning for this since it is fully qualified
19:41danlentz(defn linklist3 ^java.util.LinkedList [coll] (java.util.LinkedList. coll))
19:42danlentzwhich one came first? putting the return type on the var?
19:42amalloyyes
19:42danlentzis the history of this written up somewhere?
19:42hiredmandanlentz: I think you are confusing two different warnings about tags there
19:43danlentzwell, two warnings but i dont think i have them confused
19:43hiredmandanlentz: eastwood may warn about them in the same linter, but the full qualified classname is an entirely distinct issue from where the tag goes
19:43danlentzno not exactly
19:43amalloyhiredman: is it?
19:43danlentzbecause if the fully qualified classname is not supplied
19:44danlentzfor meta on argument vecotr, then it will cause an error when used in another namespace
19:44amalloymy understanding is that if you put a fully-qualified classname on the arglist, it works "as intended", but an unqualified classname throws exceptions or something later
19:44irctc_amalloy: many thanks for the rewritten function on refheap!
19:44hiredmanOh of course, and that is the mess left by the attempt to unify them
19:44danlentzusing fully qualified classname as tag on the argument vector resolves the issue
19:44amalloyright
19:45danlentzit is something that at very least would be really helpful to do a better job pointing out n the official clojure docs
19:45danlentzwarn you that something unexpected is lurking
19:45justin_smiththis reminds me of the repo I made to try to disambiguate this stuff
19:46justin_smithI should work on that again soon
19:46danlentzi kind of like the dunaj syntax approach myself
19:48danlentzso, type hints on the argument vector — are they
19:49danlentzso when I type hint an argument vector to indicate return value — is that “first class” metadata? If it is not associated with a var, would it be possible to introspect back out the return value type hint of a function?
19:49danlentzi can’t get at it with (meta var) obviously
19:55qqq!hello
19:55qqq!list
19:58oskarkvHey! I just pushed this https://github.com/oskarkv/map-regexps Feel free to critique and comment about anything, it's my frist public lib
20:00dnoleninf-clojure can be made to work w/ ClojureScript, https://github.com/clojure/clojurescript/wiki/Emacs-%26-Inferior-Clojure-Interaction-Mode
20:01TEttingerthat looks handy, oskarkv
20:01dnolenwith a couple of tweaks to ClojureScript and couple of tweaks to inf-clojure could probably be made to work great
20:01oskarkvTEttinger I'm glad you think so :)
20:01danlentzoskarkv: this is interesting, nice work!
20:01oskarkvthanks
20:01TEttingerone odd quirk: {} has a meaning in textual regexps that could be useful to have an analogue to
20:02TEttinger,(re-find #"a{3}" "aardvark? aaaaaagh!")
20:02clojurebot"aaa"
20:02oskarkvYeah
20:02danlentzwhat school are you doing clojure at, if you dont mind me asking
20:02TEttingeryeah, I'm also curious
20:02gfredericksTIL inf-clojrue
20:03oskarkvRoyal institute of technology, sweden
20:03bendlasoskarkv: does it nest? like, can keys and values be regexp?
20:03TEttingerthat's a good question, bendlas, since regular text regexps don't have a concept of nested strings
20:04oskarkvbendlas No, but maybe one could make it so
20:05bendlasoskarkv, TEttinger, yeah, I think it's kind of curious to have a grammar of concatenative (regexp) over context-free (maps)
20:05TEttingeroskarkv, yeah I think if this handled more than just sequences of maps, it could be more generally useful, but already it's a fairly novel technique to what previously was an annoyance in clojure code
20:05TEttinger*to solve what
20:06bendlasoskarkv: I like that you expose run-single-step. too many parsers overlook the need for incremental parsing
20:06oskarkvRight now keys are compared with =, but it would be easy to check if the key is a fn, it could instead apply that fn as a predicate
20:06danlentzso, I could use this to specify a path grammar over a graph?
20:07oskarkvdanlentz I'm afraid I'm not sure what you mean
20:08TEttingerit could be useful to support just plain ol sequences of non-collection values.
20:08oskarkvTEttinger yes, that would probably be farily easy to do
20:09oskarkvBut for [] and {}, maybe we need new metacharacters if they are clojure literals instaed
20:10bendlasoskarkv: a non-string based DSL might also be an option, since in clojure you already have powerful data literals
20:10TEttingertrue
20:10bendlasIIRC, cgrand has done a regexp parsing dsl in clojure
20:12danlentzi dont purport to fully grok why, but I seem to recall reading on clojars that the org.clojars.oskarkv group recommended for private forks?
20:12oskarkvHm, non-string based DSL, what kind?
20:12oskarkvdanlentz oh, maybe
20:13amalloyorg.clojars.yourname is for you; use it however you want
20:13bendlasoskarkv: https://github.com/cgrand/regex
20:14danlentz“Personal groups are designed to hold things like throwaway alpha versions and forks of other projects. They’re long and ugly on purpose to encourage official releases to use canonical groups.”
20:15danlentzhttps://github.com/ato/clojars-web/wiki/Groups
20:17bendlasoskarkv: you can do that kind of dsl pretty easily in any functional language, based on applicative/monadic parsing, but I'm not entirely sure how that ties in to the notion of a vm-based model of regexps
20:18oskarkvbendlas If I understand correctly, with cgrand's lib I can make REs out of data, but then use them on text as with regular regexps?
20:19bendlasoskarkv: yes
20:19amalloybendlas: what does all this have to do with virtual machines? (which i think is what you mean by vm)
20:19oskarkvAnyway I imagined that my lib would be used to search for patterns in logs, etc
20:20danlentzstate machine
20:20danlentz?
20:20oskarkvamalloy I based my implementation on this http://swtch.com/~rsc/regexp/regexp2.html
20:21bendlasthat's what I'm not sure about, but my I guess so
20:22bendlasyou mentioned the Russ Cox paper "the virtual machine approach" and my intuition was, that this must be the alternative to doing a monadic parser
20:22danlentzrelated, have you looked at clj-rpe?
20:22bendlaserm, amalloy, oskarkv mentioned it on the gh readme
20:23oskarkvHm, I'm not sure what a monadic parser is. But the parsing step is already done by the time that VM stuff comes along
20:23oskarkv...in my lib
20:23danlentzvm = state machine, though.
20:24oskarkvYes, more or less
20:24bendlasin a monadic parser, you define a parser monad which holds you parser state, like read ahead, and then your parsers are monadic values. monadic bind usually means concatenation
20:24danlentzthis is a good article, thanks for pointing it out
20:25bendlasthen you build up your grammar with combinators
20:26bendlasoskarkv: what's the vm stuff that comes along in your parser?
20:26danlentzbendlas: your explaination reminds me of: “Wadler tries to appease critics by explaining that "a monad is a monoid in the category of endofunctors, what's the problem?"
20:27danlentzhttp://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html
20:27oskarkvbendlas the parser just parses the RE into an AST. But after that you need to make some machinery to actually use it on the input string to match stuff
20:27bendlasdanlentz: not every functional language, though ;-)
20:29bendlasdanlentz: I see your point, I guess the beauty of it is, how a really generic operation like m-bind can mean parser concatenation
20:29oskarkvbendlas so the VM stuff is like a NFA that you read about in automata theory
20:29bendlaskind of like how matrix multiplication can mean translation/rotation/scaling/shearing in one
20:32creeseCan someone comment on the advantages of macros over code generation?
20:33bendlasoskarkv: I see, so I guess in a (m-word) parser, the AST is already given by the source language but I really have to read up on some theory, to get a grasp on how an NFA maps over
20:33justin_smithcreese: macros can use the higher level facilities of the language for operating on collections, while code generation is typically limited to string munging
20:34justin_smithcreese: for example, we don't need to make any special effort to prevent adjacent symbols in a macro combining to form an erroneous third symbol
20:35oskarkvbendlas I'm not sure about monadic parsers, but I always thought that a parser parses the input text (source code, regexp, etc) into an AST, according to a given grammar. But, just as in compilers, you are not done after parsing. You have code generation left.
20:36amalloyoskarkv: a parser doesn't have to use characters as its input type. bendlas is talking about a "parser" whose input type is the maps you're trying to match
20:36creesejustin_smith: makes sense
20:37bendlasoskarkv: do you mean in this case, parsing the definition of the parser and then generating code to actually parse the input language?
20:37creesejustin_smith are macros in clojure evaluated at run-time or compiled?
20:37justin_smithcreese: compiled only
20:37bendlasamalloy: that. characters are just the sole input type for a subset of parsers
20:38justin_smithcreese: though in jvm clojure the compiler is always present at runtime, if that's really needed
20:39creeseI'm wondering how I can have a macro fed by params from a config file and not pay any penalty for that at run-time
20:40creesedoes it recompile when I change the config parameter and reload?
20:40justin_smithcreese: if the config file is available at compile time, it should just work
20:40creeseit isn't
20:40creeseit's read at run-time
20:40creesewhen the app starts
20:40justin_smithcreese: no, there is no automatic recompilation in clojure
20:40amalloycreese: you can't. how could a macro run at compile time modify your source code based on the information available in config files at runtime?
20:40justin_smithcreese: app start is compile time, if you haven't loaded all your namespaces yet
20:41justin_smithbut yeah
20:41bendlasoskarkv: so in a monadic parser, you basically try to reuse as much of you host language as possible. meaning you define the parser syntax in terms of the host syntax and then try to get the host compiler doing the parser generation for you. Then the input language can consist of a stream of characters, or whatever it is you are trying to parse.
20:41oskarkvbendlas Well in my case, I have a grammar for the REs. And I use a parser generator (once) to generate a parser for the REs. Then from the AST of a particular RE, I construct a VM that does the matching. The input map sequence does not need a parser, because they are not arranged in any special way.
20:42justin_smithcreese: also, there's nothing a macro can do that a function can't, except for syntax (including "not evaluating some arguments" as syntax here)
20:44caternargh
20:44caternargh argh
20:44caternargh
20:44caternargh
20:44caternokay, so, if I want to do something that is really comfortable in Clojure
20:44caternand I don't want to write a web app
20:44oskarkvbendlas ok, I see.
20:44caternwhat should I do?
20:44raspasov_justin_smith: yea I was always wondering, how is passing a fn1 to a fn2 for fn1 to be executed later different from a macro? (except for the syntactic nicety about it) ?
20:44justin_smithraspasov_: exactly
20:44catern(i.e. what is something else really comfortable in Clojure)
20:45catern(inb4 nothing)
20:45bendlascatern: logfile processing
20:45caternbendlas: is that a joke?
20:45justin_smithcatern: graph / data analysis.
20:45raspasov_justin_smith: I mean, yea there might be some perf overhead, but that would be the passing of a fn pointer to a fn
20:45caternjustin_smith: as in, graph algorithms?
20:45raspasov_which probably nears zero
20:46caternI could do more incanter stuff I guess
20:46justin_smithcatern: as in working on a bunch of data in a graph.
20:46caternjustin_smith: ok
20:46justin_smithso yeah, partially graph algorithms, sure
20:46caterner
20:46caternok
20:47justin_smithanything server oriented with a long uptime
20:47raspasov_justin_smith: not being a macro expect myself, I have been preferring passing a fn to a fn instead of writing a macro, I feel it makes the code easier for me to understand, and for people later on I hope
20:47bendlasoskarkv: ok and how do you tie in the once-generated RE parser into a particular VM?
20:47raspasov_justin_smith: and more composable
20:47bendlas(inc raspasov_)
20:47lazybot⇒ 1
20:47justin_smithraspasov_: yes, this is all true
20:48justin_smith(inc raspasov)
20:48lazybot⇒ 2
20:48justin_smithbendlas: lazybot doesn't know that raspasov_ and raspasov are the same person
20:48bendlasjustin_smith: yeah, that's the problem with pointer based equality ;-)
20:49justin_smithbendlas: it's string based actually, mongodb
20:49raspasov_justing_smith: thanks, I'm glad I got something right :)
20:49bendlasjustin_smith: well, all pointers are strings in memory
20:49oskarkvbendlas The parser (a function in my case) returns the AST. Then I have a function `compile-re` that takes it and returns a set of instructions for the VM. But the VM is pretty simple (just a few functions) that take those instructions and run them on the input map seq.
20:50raspasovcorrected nickname :)
20:51bendlas(inc raspasov)
20:51lazybot⇒ 3
20:51bendlasthere you go
20:52raspasovbendlas: thanks, I didn't do much :)
20:52bendlasyay for (fn [a] (fn [b] ))
20:52bendlasthat's exactly the point. I hate it, when programmers do too much to solve a simple problem
20:53raspasovbendlas: haha, that's very true
20:54raspasovall that being said, macros definitely have their place, I mean a lot of Clojure is written in it, it's just that I think you really need to be sure that the macro that you're writing has value beyond your own few namespaces, otherwise it would just be there to confuse people I feel like
20:54creesejustin_smith: thankx
20:54raspasovwritten in them*
20:54bendlasoskarkv: cool, I'll have a look at the instruction set of your VM and will definitely read the paper.. interesting stuff
20:58bendlasraspasov: sure, some of my best friends use macros ;-)
20:59bendlasjoking aside, the latest case where I needed them was, when the alternative was writing a hundred little wrapper functions, by hand, based on some documentation, where I could just generate them with a macro based on reflection
20:59raspasovbendlas: haha
21:00raspasovbendlas: yea that's a good example
21:00bendlasand boy was I glad to have them then
21:29oskarkvbendlas_mobile https://www.refheap.com/98920
21:47bendlasoskarkv: ok, that instruction sequence looks like a code generator could optimize the living hell out of it. OTOH, from just glancing, I find it kind of hard to get a grip on the various magic numbers
21:47bendlasbut I guess that's the way of things with low-level representations
21:55oskarkvbendlas optimize how? The numbers are just indices into the sequence of instructions itself
21:56oskarkvexcept for the save ones :P
21:57justin_smithoskarkv: it's like the difference between an interpreter and a compiler - the same info that you use in the form of numeric indexes, could be converted to remove a level of indirection and get put directly on the execution stack
21:59oskarkvjustin_smith yeah
22:02bendlasjustin_smith: well put
22:03oskarkvI'm not sure how I would do that. Do you know something I could read?
22:05bendlasnot sure, maybe documentation of your target byte code: x86? llvm?
22:05justin_smithoskarkv: hmm... not sure what the best resource for that would be. Probably not the asm.java docs (though this is the tool clojure uses to accomplish that task)
22:05oskarkvOr, maybe I just don't understand exactly what you mean. Converted how exactly?
22:05bendlasor yeah, jvm
22:06oskarkvOk
22:06justin_smithoskarkv: it's the concept of compilation, instead of writing code that looks up the next step, then executes it, you generate bytecode representing the series of steps, and the program just executes them one after another
22:06justin_smithyou could also convert the state machine into a function, and let clojure do the compilation part
22:07justin_smithby lifting out the variables to be args, and then putting the steps in sequence
22:07bendlaspartial evaluation might also be a worthwile avenue
22:08oskarkvAh, I see
22:08oskarkvWill have to think about it
22:22bendlasoskarkv: also, if you implemented nesting (regexes as keys/values), I suspect there were some deep insights to be had from how { and } would correspond to push and pop on the execution stack
22:24oskarkvbendlas perhaps ;)
22:25oskarkvBut right now I'm looking for some problems that people even just might solve with my lib, so that I can claim it's useful. I really need it to get this school thing done :P
22:26oskarkvOpimizing by compiling more seems fun though
22:28amalloyif you want to optimize by compiling, in a lisp it's a lot easier than generating bytecode directly with asm. you can just generate the sexprs for a function body, and then eval the function
22:28oskarkvYeah
22:29justin_smithyeah, that's what I meant by letting clojure do the compilation part
22:29bendlasyup, IMO that's the real use case for eval
22:30bendlas(apart from repl)
22:36justin_smithbendlas: speak for yourself, I find the rpl perfectly useful
22:36justin_smith(aka "cat")
22:38bendlasyeah, nothing like going from lazy-seq to transducer and back ;-)
22:39bendlasjustin_smith: maybe we should call it ripl: read-identity-print-loop
22:43bendlasjust as long as nobody starts going full circle and call it a 'disruptor'
22:44justin_smithmace of disruption, most powerful weapon against undead
22:44bendlas:-)
22:45bendlasring of fire, baby
23:58chr15mhello, this is probably a stupid question, but does anyone know how, in vim, to gather any loose closing parentheses in a block onto the end of the last line?