#clojure logs

2014-02-14

13:50sdegutisWow, #clojure-social is really growing quickly
13:50sdegutisPretty happening place lately.
13:51TimMcIt's like a rave in there.
13:51bbloomi'm not falling for it :-P
13:52TimMcmdeboard: I appreciate your "Chat" pun.
13:52mdeboardTimMc: Hey, thanks.
13:52mdeboardIt was like I hadn't said it at all until you observed it
13:53ddimalastlog mdeboard 5
13:53ddimaargh, haven't seen it either
13:53Raynessdegutis: I started a very unpopular clojure-offtopic channel once.
13:53RaynesNice to see someone else might be succeeding.
13:54TimMc(inc mdeboard)
13:54lazybot⇒ 4
13:54mdeboardI have points? deary me
13:55Raynes$join #clojure-social
13:55lazybotRaynes: It is not the case that you don't not unhave insufficient privileges to do this.
13:55sdegutisRaynes: it's really you succeeding, you had the idea and the guts to push it forward, all i had was timing
13:55Raynes$login
13:55sdegutis(inc Raynes)
13:55lazybotYou've been logged in.
13:55lazybot⇒ 42
13:55Raynes$join #clojure-social
13:55Raynes$botsnack
13:55lazybotRaynes: Thanks! Om nom nom!!
13:56amalloyRaynes: i mentioned #clojure-casual. that was yours, right?
13:56sdegutisthanks Raynes
13:56Raynesamalloy: Yes.
13:56RaynesI mean
13:56RaynesI think I made that channel.
13:56RaynesI can't honestly remember.
13:58ddimasuddenly, silence :)
14:00sdegutisIs there a good pretty-print library that prints things how they usually look in emacs? i.e. maps have each key-value pairs on their own lines, biggish lists/vectors are one line per element, etc
14:00amalloysdegutis: how they look in emacs? like as source code, or as repl output?
14:01sdegutisAs source code.
14:01michaniskinsdegutis: have you tried (clojure.pprint/write your-form :dispatch clojure.pprint/code-dispatch)
14:01amalloythere's basically just clojure.pprint, and i think bbloom's...what is it, fipp?
14:01sdegutisclojure.pprint/pprint doesn't print maps this way, and FIPP doesn't print them as ideally either
14:01sdegutismichaniskin: hmmm
14:02amalloyin fairness, i don't write maps that way as source code *either*
14:02sdegutisI asked bbloom about fipp here: https://github.com/slagyr/speclj/issues/45
14:02sdegutisBut I didn't get far with his last suggestion.
14:02bbloomsdegutis: you just want a naive indenter, right?
14:02bbloomie not a pretty printer
14:03sdegutisActually yeah that's probably a better description.
14:03bbloomyou can write one of those brain dead easily
14:04sdegutisHmm maybe I will... maybe I will.
14:04bbloomyou can also write an alternative backend for fipp's pretty "documents" that operates on the operation stream
14:04bbloomnot that that buys you much, since the code to produce and serialize the documents is like ~150 lines
14:05sdegutisHmm
14:05sdegutisThanks
14:12simardwould ClojureScript + node.js make a proper, safe sandbox ?
14:13Raynesselinux makes a proper, safe sandboxz.
14:14pbostromindentation question for the channel: https://gist.github.com/pbostrom/9006986 do you prefer baz1 or baz2?
14:14pbostromI think I prefer baz1, but that's not the default for clojure-mode
14:15pbostromsorry, I prefer baz2, but that's not the default
14:15danneuindent all the args the same
14:15bbloompbostrom: both need a linebreak before arg3
14:15gfredericksI just saw #{some? if-some when-some} for the first time
14:16justin_smithbaz1, because baz2 looks like (some-thing-arg2) is a body rather than a second argbument, which is misleading
14:16danneubaz2 is generally reserved for forms where the first few args are special. like (GET "/" []\n)
14:16devngfredericks: wait what
14:16gfredericksthey seem to go along with some-> in having to do with non-nilness
14:16gfrederickswhich is interesting because clojure.core/some seems to be about traditional truthiness instead
14:16gfredericks,(some identity [nil false true])
14:16clojurebottrue
14:17gfredericksdevn: new in 1.6
14:17sdegutissimard: probably, that's how Lighttable works
14:17devngfredericks: interesting
14:17gfredericks,(map some? [true false nil])
14:17clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: some? in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:17devn,*clojure-version*
14:17clojurebot{:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"}
14:17gfredericksI guess it's quite recent
14:17gfredericksI was just reading alex's email
14:17devnyeah i just pulled it up as well
14:17cemerickpbostrom: you can make clojure-mode indent like baz
14:18Bronsagfredericks: landed today
14:18Bronsahttps://github.com/clojure/clojure/commit/762db740f12690e668dbfb636ce5ef0a378190ee
14:19gfredericksit's like the word "namespace"
14:19pbostromcemerick: I've seen that, just wondering why it's not the default, the reason I bring it up is I noticed that David Nolen's Om tutorials use baz2 indentation
14:19BronsaI think that if-some and when-some are terrible names for how they actually behave
14:19BronsaI'd think if-some would behave like if-not rather than like if-let
14:20cemerickpbostrom: formatting is a bikeshed almost like no other
14:21gfredericksBronsa: oh that hadn't even occured to me; weird
14:21cemerickI personally think anything other than always-2-spaces isn't worth the PITA and inconsistencies across projects, but...
14:21danneupbostrom: those dom forms are indented like baz2 because they have a "body"
14:21Bronsagfredericks: if-some-let would have been a terrible name aswell, but at least not a wrong one :/
14:22gfrederickswe need a highly-configurable auto-formatter, where the configurability is applied to each project
14:22gfredericksBronsa: clojure is a fascinating mix of eyebrow raising and useful
14:22cemerickgfredericks: insanity
14:22gfrederickscemerick: for which sort of reason?
14:23cemerickgfredericks: it's just not important. Stuff like gofmt is exactly the right approach.
14:23dnolen_anything other than baz2 is an abomination
14:23dnolen_:)
14:24cemerickConsistency is really important to maximizing readability. If things shift around on a per-project basis, or formatting depends on stuff only known at runtime, it's a trail of tears.
14:24danneutoo soon
14:24cemerickdanneu: ?
14:25aperiodicdoes anyone know how to yank text that fireplace has echoed to the command line area below the status line?
14:25cemerickSee, this entire conversation simply wouldn't exist if cljfmt existed. :-)
14:25michaniskincemerick: why not just make it?
14:26cemerickmichaniskin: Yeah, I just had that thought, and dismissed it 2s later. I burn enough time on shit like that already. ;-)
14:26danneu'just', they said
14:26pbostromI think I'm going to have to side with baz2 going forward, whitespace is our most valuable resource and must be conserved
14:26michaniskinyup, this is my point
14:27hyPiRionwhat is baz2, for the uninformed?
14:27cemerick*someone* will — maybe paired with one of the linters going around these days — and baz2 will be the way things get formatted, since it's the only option without a runtime around
14:27danneupbostrom: i think it's misleading when a plain ol function call places unnecessary emphasis on its first argument. (+ 1 2 3)
14:28danneuAlso, it's jarring when you only indent some of the args
14:28cemerickhyPiRion: an example out of a paste; always-2-spaces when indenting, nothing special for macros, etc
14:28pbostromhyPiRion: always 2 space indent: https://gist.github.com/pbostrom/9006986
14:29michaniskinemacs already does the job for me
14:30sdegutis(inc emacs)
14:30lazybot⇒ 2
14:31hyPiRionso like https://www.refheap.com/38782 ?
14:31hyPiRionOr is it just for parens?
14:32pbostromjust for parens
14:32cemerickhyPiRion: https://github.com/clojure-emacs/clojure-mode/commit/38dded9c19e50769ad3070350257a6e501460ce8
14:32michaniskinalso my bicycle is of a strange shape and size
14:32michaniskinso when we design this shed we need to take that into account
14:34hyPiRionand this is for consistency?
14:34michaniskinwe may also want to store a bikeshed in our bikeshed someday, so we should make something sufficiently general to suppor that
14:34simardRaynes: what is the status of Clojail ?
14:34devnBikeshedCallbackUtilsBikeshed
14:35sdegutisWhat's the status on clojuredocs.org for 1.5.1?
14:35Raynessimard: It's still maintained.
14:35devnBikeshedCallbackUtilsBikeshedComparatorPool
14:35TimMcmichaniskin: I think the trim should be painted a different color from the siding.
14:35TimMcNone of that foolish consistency for me, thank you.
14:35devnConfigurationInvocationIdentifierBikeshedPoolComparator
14:36cemerickhyPiRion: yeah, my motivations are consistency, non-reliance on runtime info, and not taking a beating when using long fn-position symbols
14:36cemerickesp. long hosty field/method names
14:39pbostromanyway, sorry to start a bikeshedding discussion; I guess I've just had more experience with long names making the code look like crap than not being able to distinguish the sigificance of args
14:40bbloompbostrom: so use more namespaces and shorter names in each namespace :-)
14:40bbloomif you have a very long function name, that's a hint that you need to simplify your program
14:40bbloomoften (not always) anyway
14:41bblooms
14:41dnolen_pbostrom: most Clojure code that uses standard Emacs clojure-mode indentation is fugly. That's my problem with it :)
14:42dnolen_cemerick: I didn't know that indentation feature existed, thanks - I've been this manually for a while now
14:42dnolen_been doing
14:43pbostromdnolen_: I tend to agree, I mostly just wanted some validation that I wasn't crazy :)
14:45cemerickdnolen_: yeah, it was one of the first things I did upon starting to use emacs. Shame it's not in the README anymore. :-|
14:45cemerickdnolen_: *manually*? :-O
14:45dnolen_cemerick: yep, labor of love
14:49sdegutisIs there a better idiom for this? (if-let [x (get-x)] (if (:enabled x) x)))
14:49hyPiRionhttps://www.refheap.com/38831 <- and the OCD-programmers screamed out in pain.
14:49dnolen_sdegutis: is that the if-some that landed in 1.6?
14:50dnolen_isn't
14:50sdegutisNever heard of it.
14:50sdegutisIs 1.6 out now?
14:50llasramhyPiRion: AAAHHH FIX IT
14:50sdegutisre dnolen_
14:51llasramsdegutis: beta1 is out as of like an hour ago
14:51sdegutisnice
14:51llasramKeep with the times, man
14:51sdegutislol, 43 mins late to the party
14:52llasramI'll already switched all my production code and redeployed
14:52sdegutisTo /all/ the nodes!?
14:52llasram(kidding, if there was any doubt)
14:52sdegutis:P
14:52abpsdegutis: dnolen_: nope that would only do an explicit nil-check on x
14:52sdegutisOops, sorry for the off-topic banter.
14:53sdegutisWill keep it in #clojure-social.
14:53amalloy(let [x (get-x)] (and x (:enabled x) x))? seems kinda silly though
14:53bbloomomg. unsigned-bit-shift-right finally made it!? w00t lol
14:53TimMcHaha, really?
14:54sdegutisamalloy: Agreed.
14:54amalloybbloom: there's a lot of cool stuff going into 1.6
14:54TimMclies, no way
14:54sdegutisWait a minute.
14:54coventryIf I :cljs/quit from an austin repl, should I expect it to start again with (cemerick.austin.repls/cljs-repl repl-env)?
14:54sdegutis(let [x (get-x)] (and (:enabled x) x))
14:54cemerickcoventry: No.
14:54bbloomamalloy: i'm looking at the changelist. want to point out some of your favorites?
14:54sdegutisThat should work fine.
14:54amalloysdegutis: well, that might call (:enabled false), and i can't remember if that works or breaks
14:55sdegutisHmm good point.
14:55amalloy&(:enabled false)
14:55lazybot⇒ nil
14:55sdegutis,(:enabled false)
14:55clojurebotnil
14:55abphey cemerick, do you have any idea what needs to be done for austin to support :optimizations :none or should it already?
14:55sdegutisFinally clojurebot and lazybot agree on something!
14:56cemerickabp: There's a closed issue on that topic. It doesn't.
14:56amalloybbloom: http://dev.clojure.org/jira/browse/CLJ-908 https://github.com/clojure/clojure/commit/0b73494c3c855e54b1da591eeb687f24f608f346 http://dev.clojure.org/jira/browse/CLJ-1200 http://dev.clojure.org/jira/browse/CLJ-1175 are my favorites
14:56amalloyand http://dev.clojure.org/jira/browse/CLJ-1184 is a funny one
14:56abpcemerick: oh sorry to bother you
14:56cemerickabp: no worries :-)
14:57TimMcamalloy: Aw, that last one was fun.
14:57TimMcI'll miss it
14:57bbloomcool
14:57sdegutisWait, defrecord and deftype was marked as "alpha" in Clojure 1.5.x?
14:58llasramWere you using them in production code? Geez man
14:58cemerickabp: see https://github.com/cemerick/austin/pull/45 and https://github.com/cemerick/austin/issues/43
14:58carkthat's living on the edge
14:58cemerickabp: and more discussion on :none here https://github.com/cemerick/clojurescript.test/issues/37
14:59cemerickI don't really see much use in supporting :none
14:59pjstadigsdegutis: you're clojure card will be revoked momentarily
14:59pjstadigahhhh
14:59pjstadigyour
14:59cemerickat least in the tools I use / maintain
14:59pjstadigmy grammar card has been revoked
14:59llasramheh
14:59coventrycemerick: I love austin, but to use it I need to restart my jvm repl a lot. If I leave an austin repl open for a while and come back to it, it's often the case that it hangs on my next entry. I can kill the thread with C-c C-b and :cljs/quit but restarting, even with a new repl-env, usually doesn't work: Further commands just hang. Is there any way I can figure out where it's hanging and why?
14:59TimMc,*clojure-version*
14:59clojurebot{:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"}
14:59TimMc&*clojure-version*
15:00lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}
15:00cemerickcoventry: any chance you're using cider with ac-nrepl?
15:00amalloyTimMc: lazybot likes it in the past
15:00Rayneslazybot's owners are too lazy to upgrade.
15:00pjstadig1.4 is my favorite vintage
15:00carkdoes lazybot use records ?
15:00Raynesmuhoo: eagerbot
15:01muhoolike a puppy
15:01Raynescark: What would it use records for?
15:01carki don't know
15:01coventrycemerick: Nope.
15:02amalloyRaynes: we could use records just to make technomancy mad
15:02muhoook, pet peeve time. i've long since gotten tired of unreadable spew in nrepl-emacs eval output, but my hack around that is miserablet
15:02Raynesmuhoo: nrepl-emacs?
15:02RaynesYou mean cider?
15:02dnolen_cemerick: not supporting :none + :source-map seems like a bad idea to me, but I'm not maintaining clojurescript.test either
15:02cemerickcoventry: ok, nm then. You're not the first to report hangs, but I don't really have a theory on what might cause it.
15:02muhooi basically wrap (->> dostuff (urepl/massive-spew "/tmp/foo.edn")) and then auto-revert /tmp/foo.edn
15:02muhooRaynes: i refuse to accept its new name :-P
15:03coventryIs there any way to get a traceback when you kil a thread with C-c C-b?
15:03muhoobut there are many things that suck about that hack. has someone already come up with a better one?
15:03carkhum while talking about testing and clojurescript ...how does one go about testing async code in clojurescript ?
15:03coventrycemerick: OK, thanks.
15:04muhooalso, last i looked at the cider code, it seemed.... not as solid as nrepl, so i'm sticking with old nrepl for now
15:04cemerickdnolen_: the trouble is various tools need to be pointed at a file to evaluate; :none just sprays stuff into a folder.
15:05dnolen_cemerick: for some definition of "spray". Everything gets written out based on namespaces.
15:05muhoowhere massive-spew is clojure prettyprint with depth and length bound to massive numbers
15:06muhooanwyay, i'll get out of the way and let the cljs guys get on with fixing austin for now instead :-)
15:06amalloymuhoo: slime/swank for life
15:06muhooamalloy: i fear it.
15:07cemerickdnolen_: Right, but, e.g. cljs.test needs to feed paths to e.g. node, phantomjs, etc. I'd need to find all of the deps and linearize them; just running :whitespace or whatever is effectively that already.
15:07amalloywell, i wouldn't advise actually switching to slime/swank
15:08dnolen_cemerick: of course, I'm not saying it's not convenient, and certainly making :none work in CLJS was a pain in the butt - but it's provides the only truly accurate source mapping. Seems important when your tests go wrong is all.
15:09cemerickmuhoo: I have a strict smokey-the-bear policy on 'fixing austin': "Only YOU can fix Austin!" :-P
15:09cemerickdnolen_: can you expand on "truly accurate"?
15:09cemericks/expand/unpack
15:10dnolen_cemerick: :none doesn't require source map merging
15:10abpdnolen_: so performance wise it's not much of a difference?
15:10cemerickFWIW, the only times I've used source maps have been with :whitespace *shrug* Maybe I got lucky.
15:10dnolen_cemerick: anything required me to write some gymnastic code to take two source maps and produce one.
15:11cemerickdnolen_: OK, I'll keep that in mind.
15:12cemerickIf it bites me, I'll dig in more, but I'll be looking for a patch from an interested party until then.
15:13abpdnolen_: ok just read the ticket on clojurescipt.test nvm
15:16lgs32awhat is your usual clojurescript/emacs setup. can I already eval things that they are reflected in the browser like lighttable offers?
15:16abplgs32a: not as 'easy', but yes: https://github.com/cemerick/austin/tree/master/browser-connected-repl-sample
15:19lgs32aabp: great that seems to have improved a lot since the last time
15:20bbloomhttp://stackoverflow.com/questions/13065166/c11-tagged-tuple lol
15:20bbloomcraz.
15:22stuartsierra"Fairly easy to throw something together …" followed by 50 lines of template code.
15:22abpstuartsierra: about what i was to say :)
15:23bbloomstuartsierra: most entertaining, that code includes the implementation of a persistent array list!
15:24gtrakand people complain about parentheses
15:24abpgtrak: i think those aren't c++ programmers, at least they wouldn't admit it in the same sentence :)
15:24bbloomthat answer is basically the definition of greenspun's tenth rule
15:25gtrakyea, C++ people would say lisp is slow, it'll never work.
15:25sdegutisI love how we're more on-topic here now that the noisy chatter is in #clojure-social
15:25sdegutislgs32a: I just use paredit in emacs mostly.
15:25abpgtrak: lol, right
15:26sdegutislgs32a: With nREPL to eval things in my buffers. That's basically all.
15:27sdegutisI know CIDER deprecates nREPL but I don't like upgrading my emacs setup, it works just fine the way it is, and I already know all the current bugs and how to work around them, I don't want to learn that for new ones.
15:27sdegutisI mean nrepl.el
15:28lgs32asdegutils: I am heaviliy using emacs myself. which cljs setup are using, austin as well?
15:28gtraksdegutis: I fixed the M-. on protocols bug, maybe that'll put you over the edge. :-)
15:28abpsdegutis: well, i upgraded by now and it works very well, but then i don't know what bugs you mean
15:28sdegutisI don't use goto-definition, I gave up on that long ago, I just use sd/git-grep
15:29sdegutissd/git-grep = https://gist.github.com/sdegutis/9008529
15:29gtraki don't know what that means, and I have projects that don't use git
15:29sdegutisI've never heard of that.
15:30llasramProjects that don't use git?
15:30llasramIs that legal?
15:30llasram~guards
15:30clojurebotSEIZE HIM!
15:34yazirianSheesh. Next it'll be projects written in not-emacs.
15:34gtrakyazirian: I wish :-)
15:35pjstadigyazirian: don't joke like that
15:35lgs32aabp: thank you again, I am now evaling cljs in the nRepl buffer :)
15:35muhoo*sigh* so nobody has come up with anything for pretty-printing [nrepl|cider] eval output?
15:36gtrakmuhoo: sounds like a great middleware
15:36muhoowith syntax highlighting, etc? please, don't make me write elisp.
15:37RaynesI hate the "NEVER UPGRADE!" attitude :(
15:37gtrakhrm.. well, clojure-mode already has that, you could open up a buffer that contains the formatted code, and it would highlight for you.
15:37cemericklgs, abp: If you just want to run CLJS in a browser, then you can use the `exec` REPL with :exec-cmds ["google-chrome"] (or whatever exec strings will launch a browser on your system)
15:37muhoogtrak: that's what i do, and it's a pretty miserable hak
15:37gtrakthat would be the elisp part.
15:37gtrakthe middleware would be to simply run 'pprint' on the backend.
15:37gtrakso we don't have to reinvent it in elisp
15:38gtrakI've heard talk of refactoring tools as middleware, too.
15:38gtrakmaybe they can all work together on code forms somehow
15:38lgs32acemeric: thanks
15:39abplgs32a: np, glad you can work
15:39muhoogtrak: i guess i'll have to grok the inner plumbing of nrepl|cider and figure out how to call clojure code from inside elisp, on the results coming back from the clojure process, before displaying it in the buffer (i.e. to pretty-print it) then from there i can run clojure-mode on the buffer to highlight... feels like it'll be ugly.
15:40gtrakmuhoo: I've been writing some minimal elisp along the way to cljs auto-completion, if it's something I can tackle myself, I'd do it.
15:40TimMcmuhoo: Bug gfredericks about writing his data structure visualizer.
15:40muhoogtrak: hmm, got anything up on github? maybe i can read it and get some clues
15:40gtrakfirst step would be a cider issue, I can show you what I got, yea.
15:41muhooTimMc: thx, will do
15:41gtrakmuhoo: check out https://github.com/clojure-emacs/cider/commit/56dc504a38333e4b7c8b9cf3ee639b3b800fcb5e and https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/info.clj
15:42gtrakmaking it a real op would mean we can avoid building a string to eval in straight elisp, and it's portable.
15:42gtrakto light-table, ccw or whatever
15:44gtrakthe more advanced elisp stuff is still over my head for now
15:44gtrakbut bbatsov's offered to help
15:46muhoogtrak: wow, nice. i have to understand the nrepl protocol more.
15:47muhooalso you're doing some advanced gymnastics on the ns meta AFAICT, have to think about that more too
15:48gtrakmuhoo: ah, that's because the vars are what have file/line meta, not the ns itself, so I grab the first. I stole it from somewhere else.
15:55dnolen_abp: source maps + anything other than :none is going to be relatively slow.
16:16effydoes the tutorial for pedestal still exist somewhere, i seem to have 404 on github for the provided link in the readme.md
16:26ToBeReplacedWhat is an example showing the difference between "when-some" and "when-let"?
16:26amalloy(when-some [x false] x)?
16:26amalloyshould return false, where a when-let would have returned nil
16:27ToBeReplacedamalloy: thanks, yeah, when-some/if-some are for nilness checks, if-some/if-let for truthiness checks
16:38RMacyman I hate emacs.
16:38RMacyoops wrong chan
16:39michaniskinawkwarddd
16:39michaniskinhahaha
16:39RMacy;-)
16:41effy /tcpnuke RMacy
16:41effyarf :(
16:42RMacyjus trollin
16:43effyremember when "nuke" was actually a thing on irc ? :)
16:46sdegutisi do not.
16:59sdegutisi love how quite #clojure is right now
16:59sdegutis*quiet
17:00sdegutis<3
17:01amalloyhuh, i'm surprised to see http://dev.clojure.org/jira/browse/CLJ-1179 was declined
17:01amalloymakes distnict? a time bomb in like every use case that exists
17:01RaynesYikes.
17:03amalloyquick, everyone open a new ticket for this issue. he's bound to not notice one of them
17:04fowlslegsHey all! Would anyone care to look at my second Clojure program of any significant size? It deconstructs words in terms of morphemes. It is not yet complete, as the comment at the top of the file explains, but it has enough components to test. If anyone would care to provide feedback and suggestions on the parts that are done or could help me with the part that isn't I would very much appreciate that. Here it is: https://github.com/fowlsleg
17:04bbloomamalloy: hm, seems weird that he would decline it unless there was a reason... i wonder... does it not make sense as a monoid for some reason?
17:04hyPiRionamalloy: http://dev.clojure.org/jira/browse/JDBC-31 is one of the cases where it blew up
17:04amalloybbloom: it's not a monoid at all
17:04amalloyit's just a function for which zero args makes sense
17:05ToBeReplacedwhen is (apply distinct? coll) a good idea?
17:05bbloomamalloy: ah, right, it's not built from a binary operation at all
17:06ToBeReplacedi guess i'd rather see (distinct-elements? coll) and (distinct? x & more)
17:06amalloyToBeReplaced: whenever you want to see if the elements of a collection are all distinct?
17:07ToBeReplacedamalloy: yeah i mean... feels like that's an input-sanitization problem usually, right?
17:07michaniskinfowlslegs: do you know that you can put docstrings into defn like this: https://github.com/tailrecursion/boot.core/blob/master/src/tailrecursion/boot/core.clj#L154
17:07bbloommaybe it's just undefined what it means for [] to be distinct? i mean, i guess it kinda makes sense to be true
17:07ToBeReplacedi guess i'm struggling to see how often "sequential and distinct" is a requirement
17:08amalloybbloom: it's obviously true. a collection is distinct if no two elements are equal, and no disproof exists for an empty collection
17:08amalloyjust like ##(every? even? []) is true because there's no odd element in that list
17:08lazybot⇒ true
17:09bbloomamalloy: ok, that makes sense to me. i'm just trying to think it through
17:09michaniskinavoiding spurious arity exceptions is always a good idea
17:09bbloom*shrug* would be interesting to see rich's comment
17:09michaniskin(+) for instance
17:09amalloymichaniskin: well, that one's even more correct, because of the monoids bbloom mentioned
17:10bbloomdo those crazy category theorist folks have a word for non-monoidal variadic operations?
17:10alandipertunsound
17:10amalloythey probably call it a function
17:10bbloomsurely they couldn't use such a simple word :-P
17:12bbloomsurely there must be some parallelization of distinct? that is interesting to math folks...
17:12amalloyi mean, from the theoretical-math standpoint, i think a function is just a relation between A and B, where A is a set of "input" lists. a variadic function is one where all elements of A aren't the same length
17:13ToBeReplacedbbloom: how could there be?
17:13hyPiRionA variadic function is just sugar for a function taking a list, at least as last parameter
17:13bbloomToBeReplaced: dunno, but i'm interesting now :-P
17:14michaniskindistinct? is implemented as loop/recur
17:14ToBeReplacedi'm wondering if "distinct?" was/is a bad idea -- maybe we should be doing something like (every-pair not= coll)
17:15hyPiRionToBeReplaced: Yeah, let's go from O(n log n) to O(n²)
17:15bbloomhyPiRion: i think he means successive pairs
17:15ToBeReplacedhyPiRion: yeah clearly not every-pair... idk what term to use
17:15hyPiRionbbloom: well, that's not going to work as expected tehn?
17:16bbloomhyPiRion: only works on sorted inputs
17:16michaniskinand it returns nil when coll is empty
17:16hyPiRionyeah, that could work, but only if they could be sorted in the first place
17:17fowlslegsmichaniskin: yes, I have seen that. I used ^{:doc "documentation"} in case I wanted to add other var metadata.
17:17bblooms/interesting/interested/ # heh, i must have sounded like an ego maniac
17:19ToBeReplacedbbloom: i can imagine things like (relatively-prime x & more) being implemented in terms of a (some-kind-of-pair-i-don't-know-the-name-of #(= (gcd %1 %2) 1) coll)
17:20ToBeReplacedthat would be inefficient for other reasons... maybe there's no other check that's worthwhile than equality
17:20muhooam i missing something obvious on how to use instaparse for recursive parsing? i.e. a structure "AxyzBCCABCCCABfgCCABC" where the structure of the finished record is [:A :B :Cs] i want the C's concatenated into one record, and the xyz's and fg's are garbage i want filtered out first?
17:20ToBeReplacedso maybe distinct? does make a lot of sense having the comparison tied to the "pairing"
17:22hyPiRionSo distinct? is essentially "there's no i, j, i != j such that x[i] = x[j]"?
17:22hyPiRionThen it makes sense to add in the empty set again. *shrug*
17:25bbloom*shrug* no idea, i feel like at a community we should get a few "huh? can you explain it like i'm 5?" tokens for the BDFL.... sometimes we might learn something, other times he might go "oh, no, you're right"
17:26bbloomthen we can link to that whenever these questions come up
17:26michaniskin(:refer-clojure :exclude [distinct?]) works fine too
17:31ToBeReplacedis (apply distinct? coll) frequently faster than (= (count (into #{} coll)) (count coll))?
17:31ToBeReplacedseems like checking count should be faster for true values, slower on some falses -- maybe that's better for sanitization uses (and are there other uses?)
17:33hyPiRionWell, I dunno
17:33michaniskinin cljs you might want to avoid creating sets like that unnecessarily because of GC issues
17:33dnolen_ToBeReplaced: you could of course look at the source of distinct, it's fail fast
17:34dnolen_er distinct?, and it uses a set
17:35michaniskinhm yeah it does
17:36dnolen_michaniskin: sets are just wrappers around array maps at small sizes, so I don't think they have GC issues significantly different from array maps.
17:37dnolen_at small sizes, and at large sizes they just wrap persistent hash maps
17:38ToBeReplaceddnolen_: yeah, so it's fail-fast, so if the duplicate is found early in the seq, it returns faster. if it's found later, you would have been better off just converting to a set first so you don't have to create the intermediate sets
17:42hyPiRionYou could probably squeeze out a bit more perf. by making the set transient, but last time I tried that I got issues with the `contains?` function.
17:42hyPiRionyeah, http://dev.clojure.org/jira/browse/CLJ-700 <-
17:43ToBeReplacedi guess the perf discussion doesn't belong in the discussion about the vararg distinct? anyway... if anyone had a performance need there they could deal with it themselves i'm sure
17:44ToBeReplacedi'm just stepping back and wondering if it should have been (distinct? x y & more) or maybe (distinct? coll) or maybe even (distinct? coll :fail-fast true)
17:45michaniskinthe contains? test is interesting, vs (let [xs* (conj xs x)] (if (= xs xs*) false (recur xs* etc)))
17:46hyPiRionToBeReplaced: Why would you want fail-fast set to false to begin with?
17:46ToBeReplacedhyPiRion: wouldn't need it with contains? on transients, as you've indicated
17:53amalloyToBeReplaced: that into #{}/count solution is a *lot* slower than (apply distinct? (repeat 1))
17:54amalloyand i doubt that there's any input at all where it's faster
17:54ToBeReplacedamalloy: same speed as (apply distinct? (range)) ;)
17:54ToBeReplacedamalloy: (range 10000) it should be much faster
17:55amalloyno way. both of them end up building a 10k-element set, of course. distinct? returns true immediately thereafter, whereas your count solution walks over the input seq again to count it
17:55amalloy&(time (apply distinct? (range 100000)))
17:55lazybot⇒ "Elapsed time: 212.566351 msecs" true
17:56amalloy&(time ((fn [xs] (= (count (set xs)) (count xs))) (range 100000)))
17:56lazybot⇒ "Elapsed time: 265.760353 msecs" true
17:56hyPiRionamalloy: The difference is mainly in transient usage. Count is constant on sets.
17:56amalloyhyPiRion: but not on seqs
17:57amalloyhe's counting the input seq again after already walking it once
17:57hyPiRionoh, right.
17:58ToBeReplacedamalloy: on that exact test you just did i still see a diff after jvm warmup, i think the intermediate sets might dominate the extra walk, but it's a moot point
17:58amalloyand transients support .contains, so if using transients were really a substantial speedup, distinct? could use them
17:58ToBeReplacedamalloy: distinct? is better nearly always now (possibly always), and it would be even saucier with transients
17:59hyPiRionamalloy: http://dev.clojure.org/jira/browse/CLJ-700
17:59amalloyso then the count/count solution is never any better
17:59ToBeReplacedamalloy: agreed
18:00amalloyhyPiRion: contains? doesn't work, because it's for persistent collections. but .contains does
18:00amalloyITransientSet/contains
18:02amalloyit used to be broken for empty transient collections, but that got fixed ni 1.5 iirc
18:07ToBeReplacedi show a 17% speedup using transients
18:07ToBeReplaced(defn distinct2? [x y & more] (if (not= x y) (loop [s (transient #{x y}) [x & etc :as xs] more] (if xs (if (.contains ^clojure.lang.ITransientSet s x) false (recur (conj! s x) etc)) true)) false))
18:08ToBeReplaced17% on (range 100000), at least
18:09bbloomToBeReplaced: try it 10,000 times on a 10 item collection
18:09hyPiRionhehe
18:10ToBeReplaced(time (dotimes [_ 100000] (apply distinct2? (range 10)))) "Elapsed time: 914.680138 msecs"
18:10ToBeReplaced(time (dotimes [_ 100000] (apply distinct? (range 10)))) "Elapsed time: 996.225312 msecs"
18:10amalloysure, totally believable. improvements to distinct? would be lovely. and i like that version. just don't "improve" it by using count :)
18:11xuserthe :gen-class that is added when doing 'lein new app proj' is not needed for lein run right?
18:12amalloyincidentally, i realized something interesting just now: ##(apply distinct? (list* 1 2 (lazy-seq (throw (Exception. "Why did you even evaluate this?")))))
18:12technomancyxuser: that's right
18:12lazybotjava.lang.Exception: Why did you even evaluate this?
18:12muhoolol lazybot
18:13muhoomy guess is: repl eager evaluation?
18:13amalloymuhoo: nah
18:13xusertechnomancy: is it there in case you want invoke the app with java instead of lein?
18:13amalloyit's because (let [[x & args] [1]] args) is guaranteed to return nil, rather than ()
18:14technomancyxuser: yeah, exactly. though it's really only strictly required for `java -jar ...`
18:14ToBeReplacedbbloom: slightly faster over (repeatedly 10 #(rand-int 10)) as well
18:14technomancyxuser: you can use `java -cp myjar.jar clojure.main -m my.ns` without any AOT
18:14hyPiRionamalloy: I thought it was because it had to, you know, go over the whole list to check for distinctness.
18:14bbloomToBeReplaced: okiedokie, then submit a patch or something
18:14amalloyhyPiRion: of course not, we already had that discussion: ##(apply distinct? (repeat 1))
18:14lazybot⇒ false
18:15hyPiRionamalloy: I mean, considering 1 != 2, it has to check later values.
18:15amalloyoh. haha, okay, i did get that part wrong
18:15amalloybut if you switch to 1 and 1 it's still thrown
18:15hyPiRionright
18:15xusertechnomancy: got it, thanks
18:15muhoo,(doc distinct?)
18:15clojurebot"([x] [x y] [x y & more]); Returns true if no two of the arguments are ="
18:15technomancyxuser: np
18:16muhoodocs don't say it's eager, but makes sense it would have to be
18:16ToBeReplacedbbloom: won't be me, no CA, but seems like an easy patch for anyone looking to start contributing!
18:19ben-ocan someone tell me what this means in clojure #^Somename?
18:20dnolen_ben-o: old type hint style
18:20ben-oso is there a new way- i.e. is it just ^
18:21dnolen_ben-o: yep
18:21ben-odnolen_: cool- thanks!
18:26sdegutisI totally agree that if-some, some? and when-some should be renamed to use "exists"
18:26sdegutisor 'exist' etc
18:26dnolen_sdegutis: nobody seem to realize this ship already sailed
18:27dnolen_some-> and some->>
18:27sdegutisYes I understand that's your point, I just disagree.
18:27sdegutisThere's still hope.
18:27sdegutisThat battle may be lost, but the war isn't over.
18:27DomKMdnolen_: some-> and some->> are both variadic. They operate over a group of things
18:28DomKMdnolen_: I'd say the ship is pulling out of harbor but if this patch lands then it will fully sailed ;)
18:31seangroveYeah, a bit frustrating to see the overloading of `some`, feels akward and unnecessary
18:31abpsdegutis: DomKM: dnolen_: probably the some/nil relationship should be cleared in the docs once and for all. Thats around the corner and in certain heads since 1.5.
18:31hyPiRionDomKM: huh, no? It operates on a single instance, short-circuiting the remaining thread forms if it is nil.
18:31seangroveThat said, Hickey doesn't seem like the type to rush a decision like this into core, so I'm sure he (and the others) have given it plenty of thought
18:32abpand if <anyone> would like to search for the when->/some-> mailing list explanations/irc discussions from a while ago, i tried earlier but didn't find them to calm this discussion down :)
18:33DomKMhyPiRion: I might be misreading the docs (or they could be incorrect) but it looks like it tests for not-nil for the result each threaded form, not just the initial expression
18:34hyPiRionDomKM: yeah, but it's on a single instance only. It's not checking whether there is a value in a collection which is nil
18:37hyPiRion(some-> a b c d) is equivalent with (if (some? a) (let [b# (b a)] (if (some? b#) ...
18:39DomKMhyPiRion: I realize they don't operate on colls, I meant that they operate on many...things (language fails me here). They do assemble them into a single form but it doesn't change the fact that they are meant to operate on a group. The real inconsistency between some and some-> is that the former tests for logical truth while the latter tests for not-nil.
18:43hyPiRionDomKM: yeah, the inconsistency I agree with. But the "operate on a group" part for `some->` is related to the `->` part of the macro, not the `some` part.
18:44hyPiRionFor me, the "issue" here is `some`, which probably should've been named something altogether in the first place
18:44hyPiRion*something else
18:55amalloyyeah, the name `some` is perfect for a function which does almost-but-not-quite what `some` does
18:56amalloyit would be great if (some even? [1 3 5 8]) returned 8
18:57gwsyeah when i first started out i was reaching for `any`
19:03seangroveToday we attempt to go from Om 1.4 => 4.0
19:03seangroveLet's see how it goes
19:10seangroveHrme, looks like maybe the behavior of :refer changed in clojurecsript 2156
19:12seangrovednolen_: Any changes around :refer in ns declarations?
19:16seangroveLooks like LT has the same problems with 2156: https://groups.google.com/forum/#!topic/light-table-discussion/ODw8JD-T_Ns
19:19dnolen_seangrove: not that I'm aware of
19:20seangrovednolen_: Pulling in master to see if I can trace down why the analyzer thinks the definitions are missing
19:28seangroveUhg, can't remember how to get my projuect to use my local copy of clojurescript
19:29dnolen_seangrove: you need to clojurescript on :source-paths that's it
19:29dnolen_"need to put"
19:31dnolen_seangrove: I'm curious how to recreate, I've seen some spurious warnings, but not what's been described in that post
19:31seangrovednolen_: It's the first thing that came up in the upgrade to om 4.0, changing the clojurescript version. Will try to track it down
19:32dnolen_seangrove: thanks
19:33abpseangrove: what you been snarky? :)
19:34abpseangrove: or are you continously mistyping oms version-nrs, would be even better.
19:35seangroveabp: Well, we're currently on 1.4, and it's stable enough for us, so sure, I consider it spiritually equivalent to 4.0 ;)
19:38abpseangrove: so it's been stable enough to not even consider leading zeros as a reality? :) Thats quite amazing
19:39seangroveabp: Probably unlikely for everyone, but it was spiritually very similar to what we were about to build out ourselves anyway, and miles above what we were using right beforehand
19:40abpseangrove: dnolen_ quite believable but being snarky now, its probably time for a changelog on cljs :x
19:41seangroveabp: I could get behind that. There's one that goes out on the ml, not sure if it's in the repo as well
19:41abpseangrove: dnolen_ is doing/creating quite unbelievable things all the time :) and i thank him whoelheartedly all the time
19:43abpseangrove: yeah but theres no changelog and condensing all the time in mind whats allready there is quite hard even if following closeely
19:56seangrovednolen_: Strangely enough, it's introduced by this commit: https://github.com/clojure/clojurescript/commit/b8cf302b1500e88e0602e72fa6aec6f7328a1a00
19:59dnolen_seangrove: yes, that's for sure, though that does catch a lot of errors that were being missed before.
20:00dnolen_seangrove: the issue is deeper and that's what I'd like to resolve.
20:10Morgawrmm.. I just got a nice server I can use to play around with clojure and pedestal, I don't know much about pedestal itself but I wanted to run the web server as port 80 but that only works if I'm root
20:10Morgawrand I don't want to run it as root, what's the proper way of doing it?
20:11technomancyMorgawr: you typically put nginx in front of it
20:12Morgawrtechnomancy: I'm not too familiar with nginx either (I'm a newb with web dev), I've only used a bit of apache.. if I get this right, I just tell nginx to reroute all the traffic from port 80 to my pedestal service?
20:12technomancypretty much
20:13Morgawrah okay, thanks
20:13MorgawrI'll check a man page or something to see how to do it ;)
20:13seangroveMorgawr: Might be nice to start out with Heroku first
20:13technomancyoh right; there is that too
20:13technomancyalmost forgot
20:13technomancyTry my product!
20:13seangroveAnd then switch to something nicer when you're more experienced because the Clojure build servers in the back of technomancy's van are burning out
20:13Morgawrseangrove: isn't heroku just a cloud host service thingy?
20:14MorgawrI mean, I already have a few servers here and there, I do mostly sysadm stuff (not much with web-related frontend) so I'm not a total newb
20:14seangroveMorgawr: Yes...?
20:14seangroveIf you want to play with Clojure and not sysadmin stuff, then use Heroku to start out with
20:14MorgawrI have a free server I can play around with so I'm just trying to host a couple of clojure services and play with pedestal
20:14technomancyheroku doesn't really help with the "I just got a new server and I need something cool to use it for" problem =D
20:14Morgawrseangrove: nah, it's fun :P
20:14seangroveMorgawr: But then again, hosting it on your own server isn't too bad
20:15Morgawrtechnomancy: exactly! haha
20:15Morgawrpretty much I just want to use this server cause it's been lying around for months idle
20:15Morgawrpoor thing :(
20:15technomancyfwiw I would start with a basic ring app instead though
20:15technomancypedestal doesn't strike me as a great introduction to web programming
20:16Morgawrprobably :P
20:17danneuI would use Heroku just because I need to look up the boilerplate for /etc/nginx/sites_available/mysite.com
20:17danneuwouldnt*
20:17danneui'll gist mine
20:18danneuMorgawr: http://www.reddit.com/r/Clojure/comments/1mrsmx/whats_the_common_way_to_use_ring/ccciqhx
20:21Morgawrdanneu: great, thanks!
20:21Morgawrfor now I wrote my simple nginx script and it redirects properly, I'll check that thread out though
20:21Morgawrthank you guys :)
20:24danneuSpeaking of pedestal, http://pedestal.io seems to just redirect to the github repo now
20:25Morgawryeah, not sure what happened :D
20:25MorgawrD:
20:26dnolen_danneu: Morgawr: I think the pedestal team is more or less giving up on pedestal app and re-assessing how pedestal should be architected given immutable data friendly client rendering layers like React.
20:26danneuthat's cool news
20:26danneuor rather i look forward to see what happens
20:27Morgawrah, nice
20:27danneuMorgawr: have you ever used clojure for web dev before?
20:27Morgawrjust small stuff
20:28MorgawrI'm using clojure for game development, so the whole web-related world is a bit unfamiliar (yet fascinating) to me
20:30seangroveI think I am *fundamentally* misunderstanding this concept https://news.ycombinator.com/item?id=7241638
20:31dnolen_seangrove: groan
20:32bbloomseangrove: i hate this idea that dynamic typing makes it harder to reason about programs.... as if that were inherit
20:32bbloomseangrove: crappy type systems (both static AND dynamic) are what makes it harder to reason about programs
20:32technomancybbloom: what
20:32bbloomcase in point: see javascript's terrible type system
20:33technomancyremoving invariants which are guaranteed to hold for any state of a given program has no negative effect on how easy it is to reason about that program's execution?
20:34technomancykinda seems axiomatic to me
20:35seangrovednolen_: It would be pretty nice to be able to set logging categories for the cljs compiler, so I can see all the of the ns analyses, the file loading, etc. selectively
20:35bbloomtechnomancy: that's no what i'm saying
20:36bbloomtechnomancy: 1) compare reasoning about ruby programs vs reasoning about clojure programs. clearly it is easier to reason about types sensibly in clojure
20:36technomancybbloom: ah, you're arguing that the difference in magnitude between "good dynamic" and "good static" is much smaller than that between "bad dynamic" and "good dynamic"?
20:36danneuMorgawr: what's the next thing you want to play/experiment with
20:37bbloomtechnomancy: close enough to the point i'm making that we'll go with that
20:37Morgawrdanneu: the future! :P
20:38Morgawrnah, I think for the moment I'll experiment with my bed cause it's 2:33am and I'm a bit tired but who knows.. :P
20:38Morgawrnight guys, thanks for the help
20:38bbloomtechnomancy: was going to add 2) there is a difference between difficulty of reasoning and burden of reasoning
20:38danneuMorgawr: https://github.com/swannodette/om-sync is pretty cool
20:39technomancybbloom: as in it may be difficult to reason about certain factors, but not necessarily the factors that affect day-to-day problems?
20:39technomancysounds ... reasonable
20:39technomancy( •_•) ( -_-)~⌐■-■ (⌐■_■)>
20:43danneui'll take "bad dynamic" over "bad mutable" though
20:44bbloomdanneu: i think bad dynamic basically simply means mutable :-P
20:44danneuexactly
20:44bbloomdanneu: or i guess bad dynamic must be highly mutable
20:44bbloomheh
20:45danneui've never really worked with a static typing system outside of superficial exposure to languages like Java. core.typed has been my first serious effort.
20:48logic_progis there a function which atkes (1) a map, and (2) a set, and only takes the elements of map whose key is in the set?
20:49bbloom(doc select-keys)
20:49clojurebot"([map keyseq]); Returns a map containing only those entries in map whose key is in keys"
20:49logic_prog,(select-keys {:a 1 :b 2} #{:a})
20:49clojurebot{:a 1}
20:49logic_prog(inc bbloom)
20:49lazybot⇒ 27
20:49logic_progwhat? that is too high
20:49logic_prog(dec bbloom) ;; taxes
20:49lazybot⇒ 26
20:50logic_prog(inc bbloom)
20:50lazybot⇒ 27
20:50logic_prog,(select-keys {:a 1 :b 2} [:a])
20:50clojurebot{:a 1}
20:53logic_progfor is a "long-form" of map. Is there a "long-form" of filter ?
20:53logic_progi.e. something like (for-filter [i lst] (... pred on i ...))
20:53bbloomlogic_prog: for has :when syntax, use in conjunction with into
20:54logic_progbbloom: that works; thanks!
20:55AmnesiousFunesI noticed that Clojure/Clojurescript keywords can include chevrons; is that a relatively recent change or a well-established rule?
20:56bbloomAmnesiousFunes: do you mean inside the keywords? or before them? if the later, you're seeing metadata
20:56bbloomAmnesiousFunes: http://clojure.org/metadata
20:56AmnesiousFunesbbloom: Inside
20:56AmnesiousFunesas in :valid->keyword
20:56bbloom,:that^true
20:56clojurebot:that
20:57bbloomAmnesiousFunes: oh, those symbols
20:57bbloomi thought you meant ^
20:57AmnesiousFunesSorry, lapsus on my side, yes.
20:57bbloom< and > have been since the very beginning
20:57bbloomconsider:
20:57bbloom,(< 5 10)
20:57clojurebottrue
20:57bbloomkeywords are (for the most part) just colon prefixed symbols
20:58AmnesiousFunesThanks.
20:58seangrovednolen_: Bizarre. It seems like the ns that're being required are put last in the compilation list...
20:59dnolen_seangrove: shouldn't matter, dependencies are *analyzed* first
20:59dnolen_seangrove: to me this looks like an analysis bug
20:59seangrovednolen_: Yes, sorry, I meant they're showing up last in the analysis stage
21:00seangroveLet me make sure I'm on the latest before I go further and confirm
21:00dnolen_seangrove: k that's weird, but probably a simple issue somewhere
21:04logic_progI'm trying, in cljs, to use http://clojuredocs.org/clojure_core/clojure.set/difference by doing (:require [cljs.set]) ... but apparently I don't have cljs.set
21:04logic_progis clojure.set available in cljs ?
21:05logic_proghttps://github.com/clojure/clojurescript/blob/master/src/cljs/clojure/set.cljs
21:05logic_proghmm, maybe I should include clojure.set, even from cljs land
21:12dnolen_logic_prog: the namespace is clojure.set
21:12akurilin2Hey guys, anybody aware of a "within range" function already in the default libs for testing if a floating point number is "close enough"?
21:12logic_progdnolen_: yeah. Is this by intention or a mistake?
21:12dnolen_logic_prog: by intention as far as I know
21:13dnolen_logic_prog: most of the clojure.foo namespaces predate my involvement in the project
21:13logic_progdnolen_: This appears inconsistent to me. Am I misunderstanding something ? i.e. clojure.core.async -> cljs.core.async
21:13dnolen_logic_prog: it's not consistent, but it's also not going to change
21:13logic_progdnolen_: okay, nothing else to discuss :-) // thanks for clarifying it
21:19iorekzHello, how would you not repeat (get-data) here ?
21:19iorekz(go (loop [res (<! (get-data))] (when (:success res) (timeout) (recur (<! (get-data))))))
21:23danneuiorekz: i do. but what's (timeout) for?
21:23danneuperhaps you mean (<! (timeout 1000))
21:23iorekzI cut for simplicity but it's (<! (timeout 5000))
21:24iorekzin my case
21:24danneualso, (go (loop ...)) can be just (async/go-loop [res ...] ...)
21:24iorekzho ok
21:24iorekzthanks
21:25iorekzand for the rest you would (let [repeat #(get-data)] before
21:26iorekzor there is another control form im missing
21:26danneunot sure what you mean
21:26danneualso, easier to post code about:blank
21:26danneuhttps://www.refheap.com/
21:31iorekzok
21:31iorekzhere it is danneu https://www.refheap.com/9d49ef7480e6461263981b1c6
21:31iorekzso back to my original question : how not to repeat get-data
21:34seangrovednolen_: So can namespaces be analyzed in any order, or should analyzing a ns declaration cause a recursive analysis of all :required/:used namespaces?
21:34noonianiorekz: i don't think you can if get-data only ever puts a single value on the channel it returns, if it returns a channel that will continue to get values you could bind res outside the go-loop and just take from res as you recur
21:34dnolen_seangrove: currently there's logic there such that dependencies are analyzed before analyzing the file under consideration.
21:35seangroveIt looks like it's just analyzing the namespaces in alphabetical order, regardless of dependency chains
21:36seangrovednolen_: Here's a bit of output from compiling our code base https://www.refheap.com/c646454876371f2b254850ba3
21:36seangroveAnd the change to (defmethod parse 'ns...)
21:37seangroveDoes that look sane? Trying to prune branches here
21:37seangrove(almost all of the namespaces :require zensight.client.utils)
21:38dnolen_seangrove: look at line 1127, that's what analyzes the deps first
21:38dnolen_seangrove: also perhaps check-uses is broken?
21:38dnolen_line 1130
21:39iorekznoonian: I see, thanks
21:40noonianno problem
21:41seangrovednolen_: check-uses seems right, env doesn't have the libs loaded under [::namespaces lib]
21:41dnolen_seangrove: but check-deps should handle that case
21:41seangroveanalyze-deps does a check with (io/resource relpath), and that seems to generally return false though
21:42seangrovednolen_: That's where the warning is coming from
21:42dnolen_seangrove: (io/resource relpath) sounds like the source of the problem then.
21:42dnolen_just need to determine why that isn't working
21:45seangrovednolen_: Maybe. I'm grasping at straws, I'll come back around to it tomorrow.
21:45dnolen_seangrove: if (io/resource relpath) is returning false, something is definitely wrong
21:46dnolen_seangrove: that should only fail w/ non CLJS libs
21:49seangrovednolen_: Maybe it's the relpath that's being generated, and the way we have our files named
21:51dnolen_seangrove: yes would be nice to determine what's going on - let me know - again I haven't encountered these issues with 2156 myself.
21:52seangrovednolen_: We have a file in src/cljs/useful.cljs with the ns (zensight.client.useful), and a lein cljsbuild source-paths of ["src/cljs"], maybe that's the underlying cause here?
21:52dnolen_seangrove: not going to work
21:52dnolen_need to follow classpath conventions
21:52seangroveCrazy, it's worked up until now
21:53seangroveLet me see if there's a quick way to test it
21:53dnolen_seangrove: only by pure luck
21:53seangrovednolen_: Willing to believe it
21:53dnolen_seangrove: not documented behavior at all
21:53seangrovednolen_: Warnings could be far gentler though
21:53dnolen_seangrove: the problem is CLJS has a bad compilation strategy
21:53dnolen_it just finds all .cljs files under a directory
21:54dnolen_instead of looking at main namespace and following dependencies
21:54dnolen_there's already a ticket for this and it's the future
21:54dnolen_I would like to deprecate the current behavior
21:55seangrovednolen_: That sounds right to me. What would be the right namespace for src/cljs/useful.cljs, (ns cljs.useful) ?
21:57dnolen_seangrove: the convention is identical to CLJ
21:57dnolen_src/cljs/zensight/client/useful.cljs
21:58seangroveOk, let me try that (I stuffed it alongside our clj code)
22:01seangrovednolen_: Yeup, that did it. Seems like the compiler turned much more sensitive to the correct path conventions. Totally reasonable, would be 1.) good to document it now 2.) better to warn or throw an error when the ns declaration of a file doesn't match the expectation.
22:01seangroveThat was horrific.
22:01seangrovednolen_: Is #2 easy enough to do? If so, I'll make a patch tomorrow
22:02dnolen_seangrove: #2 is possible but we should only do this if it's a ClojureScript file, the location of goog Closure doesn't follow the classpath conventino
22:02dnolen_convention
22:03seangrovehmmm... Alright, I'll take a look at it tomorrow. Would love to see that throw an error to prevent unexpected behavior. Good to enforce a little discipline
22:03dnolen_seangrove: I've tried something like this before, there are subtleties that need to be checked so I didn't do it myself.
22:04seangroveThe subtleties being js vs cljs source? Otherwise the cljs ns declaration should be predictable
22:07dnolen_seangrove: we need to consider non cljs files is all
22:07dnolen_seangrove: http://dev.clojure.org/jira/browse/CLJS-615
22:07dnolen_this ticket is close to have a comprehensive patch for these problems.
22:08dnolen_but I point out the issues in the last comment.
22:09seangrovednolen_: Great, looks like a great patch to check out. I'll see if I can get it over the line
22:16seangrovednolen_: What was om/bind deprecated in favor of?
22:21seangroveNevermind, I'll just take that stuff out, not really necessary
22:24dnolen_seangrove: om/bind is just not needed anymore
22:24dnolen_seangrove: it was there because of om/read and that's gone
22:25seangrovednolen_: Ok, just updating to the latest Om, want to make sure I'm giving a talk on 0.4.0 and not 0.1.4
22:31insamniacearthquake?
22:31insamniacanyone else feel that?
22:33insamniacawkward
22:36TEttingerinsamniac, what country/state?
22:36TEttingerin US the USGS has a good reporting service
22:36insamniacAugusta, GA
22:36TEttingernot the masters!
22:36insamniacFunny that I'm from California though
22:39danneuFor years, my forum has been hit by the admins of a "competing" forum where they PM my users with an advertisement for their forum.
22:39danneuAll that time i was using vBulletin. But i rewrote my forum in Clojure and can do whatever I want to stop it.
22:40danneuMy first idea is to just hide all PMs that contain their link or a unique sentence in their boilerplate so they think they are actually sending PMs
22:41TEttingerinsamniac: it's more likely it's either a very small earthquake that is very close, or some kind of other ground event like a sinkhole. sweet dreams! http://earthquake.usgs.gov/earthquakes/map/
22:42TEttingerdanneu, or change their link
22:43TEttingerto a link to the rickroll video or something relatively harmless
22:44danneuOn vBulletin, we would just add links to the censored words list which was an awful solution
22:44danneuThere are infinite url shorteners
22:49TEttingeryou can however follow the link in your forum
22:52danneuYeah, that's Phase 2
22:54jph-danneu, or disallow new users from posting links until the account has reached a certain age or certain post count
22:55danneuoh yeah, they actually just post text links.
22:55danneuwhich makes phase2 too hard
22:55jph-so google.com vs http://google.com ?
22:55TEttingerlink detection?
22:56jph-heck make PMs restricted until account has minimum age/post count
22:57danneuyeah, turns out they are persistent
22:57danneuthey take that kind of stuff as a challenge or something.
22:58danneuat least by hiding PMs they'll think they're killin it and hopefully won't notice that they're not actually showing up
22:58jph-add in captcha
22:58jph-oh yeh
22:58danneujph-: theyre humans
22:58danneuthey're probably the website's admins
22:58jph-what is that called when you let them post but the post is actually hidden?
22:58jph-shadowbanning?
22:58TEttingeryou could be smart about it and detect when enough links redirect to the same place
22:58danneushadowbanning? hellbanning?
22:59jph-have you done anything re matching account with IPs?
23:00danneuyeah, i had that on vbulletin (every post's IP is intersected with all IPs used by banned users) but now i'll be able to shadowban them
23:01TEttingerI would just build up a DB of links posted, if any match known spammer sites, block them
23:02TEttinger(apply str (take 1000 (slurp "http://bit.ly/1c8bTuG&quot;))) will follow the link (here, to the docs for a clojure game lib)
23:02danneui guess i'd need to eat false positives for tht
23:02TEttingeryou can rewrite the history
23:05TEttingerI'm kinda curious what these annoying sorts think they'll gain from PMing users and telling them to come to their forum
23:06danneuThey've been at it for years https://www.google.com/search?q=coloholics+spam
23:21right1does anyone know of problems with ring's text handling
23:21right1i have some japanese characters that are getting turned into question marks
23:23jph-right1, google search for ring unicode turn up any hits?
23:24right1clojuredocs for ring say it shouldget set to utf-8
23:24right1i tried adding a :charset "UTF-8" to my response map
23:25right1http://www.evernote.com/shard/s385/sh/9006ba2b-5390-4509-944e-e7c8a8ae54db/40ee51bbadf26c072c617725f98cd2eb
23:26TEttingerright1, are you on windows by any chance?
23:26right1ember app on left, spit output json from cheshire on right (before it goes to the response map)
23:26right1yes, i am on windows and i use japanese locale
23:26right1oh, speaking of which, i have an amusing video related to that
23:26TEttingerI wonder if something's going through an ANSI-encoded terminal
23:27right1may be
23:27right1i ran some of this data through rails and it destroyed my strings
23:27right1went from 漢字 to ??%%%%@$$$%?:??
23:27lazybotright1: What are you, crazy? Of course not!
23:27right1http://www.youtube.com/watch?v=0okmEqTKiDY
23:28TEttingeroh maybe
23:28TEttingercheck the lower right of that screenshot
23:28TEttingerANSI as UTF-8
23:28right1oh
23:29right1i changed the encoding on notepad++ to just UTF-8 and the japanese is fine
23:29right1ill have to try running this on my mac sometime
23:31TEttingerright1, so it works now?
23:31right1no, not at all
23:31right1inthe application it is very broken
23:32TEttingerwhat's the encoding of the webpage you took that screenshot of?
23:33right1oh i just looked in my network tool and i have latin-1 coming back
23:33right1...
23:33TEttingeryou can set that in the HTML, right?
23:34right1oh... i can't add a :charset to the response map, i have to append charset to content type's value directly in the header
23:35right1http://www.evernote.com/shard/s385/sh/6038d8db-4100-4398-ad06-9c9e170056a1/813d1df6a8bcf995705ff356bf4431f1
23:35right1well, now i know...
23:35`cbpdoes anyone know where did percent-encode go in ring 1.2
23:36TEttingerlooks like it works now, right1, that's good
23:36`cbpthere's no ring.util.codec ns anymore
23:36right1thx
23:37TEttingerhttps://github.com/ring-clojure/ring-codec/blob/1.0.0/src/ring/util/codec.clj#L31
23:37TEttingerit's in ring-codec, `cbp, which seems split off
23:37TEttingernp right1
23:37`cbpthanks TEttinger
23:37TEttingernp `cbp
23:46logic_prog,(select {:a 1 :b 2 :c 3} #{:a :b})
23:46clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: select in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:48RaynesThe select is a lie.
23:49logic_progis this channel logged?
23:49logic_progbbloom told me how to select a list of elements from a map, i.e. (magic-func map list-of-keys)
23:49logic_progbut, being a dumbass, I forgot the function name
23:51logic_proginc(bbloom)
23:51logic_prog(inc bbloom)
23:51lazybot⇒ 28
23:51logic_progbbloom: pls help again with (... {:a 1 :b 2 :c 3} [:a :b]) ==> {;a 1 :b 2}
23:52`cbpman not a single percentage encode matches the silly twitter api one
23:54jph-logic_prog, i believe there's a channel log that is available online
23:54jph-search for #clojure
23:55logic_progselect-keys !
23:55logic_prog(inc jph-)
23:55lazybot⇒ 1
23:55logic_proghttp://clojure-log.n01se.net/ in case anyone is curious
23:55jph-,(select-keys {:a 1 :b 2} [:a])
23:55clojurebot{:a 1}
23:55amalloyalso http://logs.lazybot.org/irc.freenode.net, logic_prog
23:56logic_proghmm, looks like lazybot only cares about clojure
23:56logic_prog(inc lazybot)
23:56lazybot⇒ 21
23:56logic_prog(inc amalloy)
23:56lazybot⇒ 84
23:56logic_progwhoa
23:57amalloyhey, my karma is exactly four times lazybot's. nicely managed, logic_prog
23:57amalloy(inc logic_prog)
23:57lazybot⇒ 3
23:58logic_progwe should move to a world where instead of (inc ... )
23:58logic_progwe tip with dogecoins :-)
23:59logic_progit'd make us half-a-$0.01 -illionaires
23:59`cbpI will tip those who have no private functions on their open sources
23:59amalloyi would rather lose all my karma than receive any dogecoins