#clojure logs

2014-04-11

00:43amalloyreloading the protocol
00:43amalloy(i mean, not really, but it would have symptoms that would make you think that's what happened, akhudek)
00:44akhudekamalloy: it turned out to be a slightly more subtle error with some custom nippy serialization routines :-/
00:44akhudekthanks though
01:37quizdr'sup fellas long time no SEE
02:04jdeisenbergclojure newbie here: is loop/recur more "morally pure" than (for [x (range 1 n)] ...)
02:04jdeisenbergin terms of functional programming, that is.
02:04maxthoursiejdeisenberg: no
02:05maxthoursiejdeisenberg: aim for readability
02:05maxthoursiejdeisenberg: if it's enough with for, go with it
02:05maxthoursiejdeisenberg: if it would do with map, use that instead
02:06maxthoursiejdeisenberg: and wrap it in a function with a good name if it gets hairy
02:08jdeisenbergThank you. I'm also aiming for a lot of small functions rather than large complex ones.
02:12jdeisenbergOK; thanks again!
02:12maxthoursieyou're welcome
05:46myguidingstarhi all, is there a naming convention for prototype functions that create an other function?
06:06noidino
06:07noidie.g. partial, fnil, comp, and some-fn all return new functions
06:54dublindanHey everyone, I want to repeat each element in a vector twice ([1 2] -> [1 1 2 2] etc). I can do this with something like (apply concat (map (juxt identity identity) input-seq)). Is there a better way?
06:55dublindanok, just remembered mapcat :) (mapcat (juxt identity identity) input-seq)
06:57clgvdublindan: that's good. alternative: (mapcat (partial repeat 2) input-seq)
06:58noidianother way: (mapcat vector input-seq input-seq)
06:59dublindanAh, perfect, thanks :)
06:59clgv(defn multiply [n input-seq] (mapcat (partial repeat n) input-seq)) :D
06:59dublindanThat gives me a few alternatives to ponder :P
07:00dublindanclgv: nice generalised solution, thanks
07:01clgvnp
07:02clgv,(count (mapcat repeat (range))) ; still countably infinite :D
07:02clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
07:02clgvnot refering to the count function of course ;)
07:40mercwithamoutho_O
07:50mercwithamouthhorizonal tabs/views aren't possible yet in light table are they?
08:57scape_i have added my uberjar to a java project and when I go to import intellij autocompletes the path I'm looking for, but when compiling it says my package does not exist
08:58mikerodI'm curious, why does a type created via `defrecord` (i.e. `emit-defrecord`) implement a non-caching variety of #hashCode and #hasheq?
08:58mikerodI was hoping/expected that they would follow the hashing mechanism of APersistentMap impl of #hashCode and #hasheq
09:00mikerodI know #hasheq for a defrecord-type takes into account the `type-hash` so that the type has a part of the resulting value, however, in the #hashCode impl for the defrecord-type, it seems to just impl the #mapHash, effectively skipping the caching mechanism of the internal _hasheq field.
09:01mikerodSo I'm just trying to wrap my head around the motivation for this. I think cached hashCode on defrecord-types would be a desirable feature.
09:06Anderkentso this is a long shot, but I read an article discussing OOP design based on a game with archers, cavalry, horse archers that nicely demonstrated increasing complexity... can't find it now :/
09:06mdrogalisCan't say I've seen it, Anderkent. :|
09:07tbaldridgeAnderkent: I remember an article stating how StarCraft 1 almost didn't ship due to crappy OOP design.
09:07mikerodAnderkent: sounds interesting, give me a link and I'll read through it :P
09:24scape_i have added my uberjar to a java project and when I go to import intellij autocompletes the path I'm looking for, but when compiling it says my package does not exist
09:31sm0kehello, i want to have a route in compojure which can set a urlpatten into a variable, how do i do that?
09:31sm0keso i we used to have urlparam in jax-rs, something like that
09:31sm0keugh
09:34jcidahohi, playing with clojure.jvm.tools.analyzer. I've noticed that when I call analyze-form-in-ns, it actually evaluates/executes the form I give it
09:34jcidahois this by design or is there a way to prohibit evaluation?
09:36tbaldridgejcidaho: are you quoting the input form?
09:41jcidahono
09:43jcidahotbaldridge: I basically have some code as a string, and I'm doing edn/read-string on it, then passing it into analyze-form-in-ns
09:44tbaldridgeokay, that's odd then
09:52jcidahotbaldridge: I.e. calling (foo "(reset! a {:b :c})") against http://pastebin.com/RQLQMiTJ actually resets the atom a
09:54jcidahoAm I doing something wrong there?
09:59bodie_is it possible to run a cider REPL such that it's aware of identifiers defined in the project source?
09:59bodie_i.e. I have two windows open, one in the main file, the other is a Cider nREPL
09:59bodie_connected to Lein repl
09:59bodie_... that's probably obvious..
10:00bodie_let's say I want to test my new function "foo"
10:00bodie_why can't I just save my file, and say (foo) in the repl?
10:00bodie_or... what would be necessary in order to do that?
10:01clgvbodie_: you can just send the "foo" definition to the repl via a shortcut
10:01bodie_I figured that out, but let's say it depends on other stuff from the project
10:02bodie_can I simply (use <project main namespace>) in the repl?
10:02clgvusually there is a shortcut that sends the whole file to the repl
10:02bodie_hmm
10:02bodie_ok
10:03bodie_why can't I just (use foo.bar)
10:03bodie_assuming the ns declaration in the main is (ns foo.bar <...>)
10:03clgvbodie_: you'd nee to specify :reload or :reload-all and that will work
10:04bodie_so like (use foo.bar :reload-all) ?
10:04clgvalmost. (use 'foo.bar :reload-all)
10:05bodie_I see. works for me :D thanks much clgv!
10:06clgvbodie_: afair there might be inconsistencies when in more complicated setups. therefore the library tools.namespace was written to do a proper reload. just in case you experience problems
10:08bodie_I see. thanks :) all my "Choose this answer" are belong to you!
10:32gfrederickssemvar clojure-style: ZERO.MAJOR.MINOR
10:33gfrederickssemver*?
10:33jcidahoAnyone have an idea of how to safely use jvm.tools.analyzer? I've found calling (foo "(reset! a {:b :c})") against http://pastebin.com/RQLQMiTJ actually resets the atom a
10:34gfredericksjcidaho: avoiding top-level side effects is pretty useful in general
10:37jcidahoSo you can run the analyzer against code strings that when evaled may have side effects?
10:37jcidahoI just want to analyze code without actually executing it
10:37jcidaho*so you can't*
10:39gfredericksI don't know for sure; can you wrap your code in a function before analyzing?
10:54oskarthI've defined and sourced environment variables in .bashrc, but when I do (System/getenv) in my (restarted) repl I don't see it. What's wrong?
10:56mpenetoskarth: did you do "source ~/.bashrc" ?
10:56oskarthmpenet: yes
10:56oskarthfresh terminal and echo $foo works. Running a fresh repl in emacs using nrepl-jack-in
10:57jconnollyi'm guessing because lein is a non-interactive shell script?
10:58oskarthjconnolly: what does that mean and what do I have to do to get it to read envs correctly?
10:58mpenetyou need to use something like https://github.com/purcell/exec-path-from-shell I think
10:59oskarthusing emacs from the terminal if that makes a difference
10:59mpenetI do, and I don't have your issue, hopefully this fixes this
10:59mpenetah
11:00mpenettry to echo the var from eshell, just to see the result, but I guess this is related
11:00oskarthI restarted emacs and now it works :)
11:00Anderken1>restarted emacs
11:00Anderken1blasphemy!
11:00oskarthhaha
11:00Anderken1:P
11:01oskarthso just restarting nrepl doesn't do it. But I'm sure there's a way update it in emacs?
11:02oskarthcould use setenv and do it twice as a hack I guess
11:03mpenetor source from eshell maybe
11:03jcidahogfredericks: good idea I'll do that
11:03jcidahojust would've thought you could analyze without running
11:03oskarthmpenet: that's where I did it the first time :/
11:04`szx,(clojure.set/union #{1 2} (take 1 #{1 2 3}))
11:04clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.set>
11:04`szxhmm
11:04`szx##(clojure.set/union #{1 2} (take 1 #{1 2 3}))
11:04lazybot⇒ #{1 2}
11:04oskarthmaybe nrepl inherits directly from emacs session? so it's not affected by shell session
11:04`szx##(clojure.set/union #{} (take 1 #{1 2 3}))
11:04lazybot⇒ (1)
11:04`szxam i the only one who find this strange?
11:05gfredericksjcidaho: there are two analyzer libs -- jvm.tools.analyzer uses the builtin compiler's analyzer, and tools.analyzer.jvm uses the separate tools.analyzer lib. the latter might be easier to work with; it's worth checking out at least
11:06gfredericks`szx: you're calling a set function with a seq, so anything strange is hard to complain about
11:06gfredericksbut this seems to make sense to me in any case; you end up conj'ing 1 onto the first set in both cases
11:06jcidahogfredericks: will do cheers
11:06`szxgfredericks: yeah, i was pleasantly surprised when i found out it worked - if it's not consistent then it just shouldn't, no?
11:07gfredericks`szx: well what you're doing is presumably dependent on the seq ordering of #{1 2 3} which is a shady thing; but in an awful lot of cases clojure does not check for bad input
11:07gfredericksso what you're observing is pretty consistent with the rest of clojure.core
11:08`szxgfredericks: so you would consider that a undocumented/unsupported scenario
11:08gfredericksdefinitely
11:08gfredericks,(doc clojure.set/union)
11:08clojurebotexcusez-moi
11:08gfredericks&(doc clojure.set/union)
11:08lazybot⇒ "([] [s1] [s1 s2] [s1 s2 & sets]); Return a set that is the union of the input sets"
11:09gfredericks^ it expects args to be sets
11:09gfredericks(into some-set some-collection) might be what you actually want?
11:10`szxwell, i just needed to take a number of items (don't care which) from one set and add them to another
11:11gfredericks(into some-set (take n other-set)) is good then
11:12`szxhmm, cool
11:12`szxis there any advantage to s/union over into then?
11:13gfredericksknowing the current codebase I'd say s/union is probably slower
11:13Anderkent`szx: union will decide which set is larger and put the smaller into larger
11:14Anderkentwhich is faster than larger into smaller
11:14`szxgot it
11:14gfredericksthough into uses transients
11:14`szxprobably not that important for the set sizes i'm working with
11:14Anderkentright, i guess for sets of similar size into will be faster
11:15gfrederickssomeday clojure.core/set will use transients too
11:15hyPiRiongfredericks: you are quite the optimistic one :p
11:16gfredericksI already patched it
11:16hyPiRionoh hurray
11:16gfredericksso in about a year
11:17hyPiRiongfredericks: how long ago did you send in the patch?
11:17gfredericksa month or so ago
11:17gfrederickstoo late for 1.6
11:17gfredericksif it's not in 1.7 I'll be mildly grumpy
11:19gfrederickshyPiRion: are you competing for oldest patch?
11:19hyPiRiongfredericks: In fact no =(
11:20hyPiRiongfredericks: but if you want to win you should vote up CLJ-1134
11:20gfredericksI've never once used cl-format
11:22hyPiRionbut how can you not? It makes stuff so readable. https://github.com/hyPiRion/snigilbot/blob/675c04e1fec0af762565e719a2bb08bf4c7c4e81/src/snigil/io_utils.clj#L62-L66 for example
11:22llasram*snork*
11:22ambrosebsgfredericks: where is set transient patch?
11:22seancorfieldhyPiRion: I think that page has been corrupted - there's a bunch of line noise near the bottom :)
11:23gfrederickshyPiRion: I'm not even going to follow that link
11:23hyPiRion(inc seancorfield)
11:23lazybot⇒ 12
11:24gfredericksambrosebs: http://dev.clojure.org/jira/browse/CLJ-1384
11:29ambrosebsgfredericks: can you post your benchmark code?
11:29bbloomhyPiRion: eery time i see a cl format string, i think it must be a joke
11:29bbloomlike, there's no way that does anything
11:29bbloomthat's just somebody holding shift and banging on the top row of their keyboard
11:29gfredericksambrosebs: hrm
11:30seangrovebbloom: It's an impressive DSL
11:30gfredericksambrosebs: I'm sure it was a one-liner
11:30bbloomseangrove: i'm sure it is, but i rather code to it's AST :-P
11:30seangroveThe fact that I can recursively destructure maps to roman numerals interposed with the pluralized version of .....
11:31gfredericksambrosebs: oh I found it!
11:31seangrovebbloom: It's impressively write-only, from my experience
11:31seangroveBut then again, long time CLispers say it's fine, so what do I know
11:31gfrederickshttp://upload.gfredericks.com/ambrose.clj
11:31bbloomseangrove: one of these days i need to really take a crack at the extensibility part of fipp
11:31hyPiRionbbloom: haha, it's really powerful, but it's important to not go overboard
11:31bbloomseangrove: i'll add roman numerials support to a numbered list element
11:32bbloomjust for you guys
11:32gfredericksbbloom: I've been meaning to write an email to clojure-dev about global extension points; I think fipp is more flexible in that regard?
11:32seangrovebbloom: Get it working well in cljs first ;)
11:32gfrederickscompared to print-method or cheshire
11:33bbloomseangrove: i'm taking the long route to CLJS support...
11:33bbloomgfredericks: global extension points is something that clojure is merely better than average at
11:33bbloomneeds an "obviously how this should work" idea
11:33gfredericksbbloom: it falls down when composing libraries though
11:33bbloomyes
11:34gfredericksand I don't know a workaround at the moment besides forking the extendable libraries or something
11:34seangrovebbloom: Outsourcing it, or rebuilding the entire computing infrastructure from the ground up until cljs support just 'falls out'
11:34seangrove?
11:34bbloomseangrove: you clearly know the answer to that one, lol
11:35bbloombut yeah, my plan is to provide a JS backend for eclj sooner rather than later, which will be much more pleasant than cljsx or any feature-expressions like idea
11:37bbloomi have this crazy idea that i'll be able to "compile" a fipp function to generate an efficient non-pretty print function
11:37bbloomamong my many other crazy ideas :-)
11:37clojurebotCool story bro.
11:37seangroveI was wondering about that
11:38bbloomi'm tired of doing things 10 times for various performance/functinality targets
11:56ambrosebsbbloom: I like that David still remembers you recommending React to him (latest Cognicast)
11:57bbloomambrosebs: i appreciate the recognition, but at this point, Om is all his baby, he's done a ton of work on it :-)
11:58hyPiRionambrosebs: He did it at the thoughtbot podcast as well
11:59hyPiRionhttp://podcasts.thoughtbot.com/giantrobots/93 ← there
11:59ambrosebsbbloom: I just find it funny that he didn't really look at React until later, but still remembers your mention (or so I understand)
11:59ambrosebsanother one of bbloom's crazy ideas
11:59ambrosebs:)
12:00bbloomambrosebs: i bugged him about it for months, no way he could have forgotten ;-)
12:00ambrosebsahaha
12:00ambrosebsyep sounds right
12:02bbloomhow do i get on these fancy pants podcasts? :-P
12:03hiredmanI imagine you need some fancy pants
12:03winkwhich react I might ask?
12:03hyPiRionwink: FB's react
12:03hiredmanclojurebot: pants |are| overrated
12:03clojurebotAck. Ack.
12:03winkhyPiRion: ah thx.
12:04technomancyhiredman: it *is* friday
12:04hyPiRionbbloom: Hmm, you never been on the Cognicast? I thought you had
12:04bbloomnope
12:04winkhyPiRion: https://www.youtube.com/watch?v=kfVsfOSbJY0 ? :)
12:04hiredmantechnomancy: right, it isn't even dress for success monday
12:05winkI thought it was "pizza and beer" monday :(
12:05hyPiRionwink: I think that one was for technomancy, amirite?
12:06winkhyPiRion: you stressed friday
12:06winkoops sorry
12:06winkhyPiRion: you are right!
12:06technomancyno-pants friday, everyone[1]!
12:06wink> I do find it strange that an SSL vulnerability that has existed for 2 yrs is brought to the world the same week that WindowsXP support stops, along with microsoft Essentials support… I think this elaborate marketing genius might be brought to you by our good friends at Microsoft
12:06technomancy[1] - everyone who works from home
12:06winkI like that guy
12:07Anderkenttechnomancy: isn't every day no-pants friday if you work from home?
12:07winktechnomancy: I have to disappoint you, home office days do include pants over her
12:07technomancyAnderkent: sure; Friday is just the ancient tradition
12:07Anderkent>pants over her
12:09tim__Anderkent: I assume that's a typo for "here", otherwise that's a quite creepy comment...
12:10winkdon't judge me by my misspellings :(
12:10winkand I don't get why it would be creepy instead of totally nonsensical
12:10hyPiRionover her what?
12:10winkis "pants over someone" a thing?
12:11hyPiRionOh right
12:11hyPiRionwink: pants also means "to pant", with may be a bit creepy
12:11hyPiRionlike breathing
12:12justin_smithpants can also mean "crazy" or "messed up"
12:12justin_smithso you could be pants over someone
12:12winkhyPiRion: true, but that sounds grammatically weird :P
12:12winkjustin_smith: ah thanks
12:12jcidahogfredericks: thanks about early - I switched analyzer lib and got the behavour I expected
12:12hyPiRionwink: sure thing, it sounds really strange :p
12:15solidus_going over how clojures stm works - can't i get a transaction stuck in a livelock if it is constantly interrupted?
12:15hyPiRionsolidus_: it will throw an exception after some limit
12:16solidus_interesting, this really limits the scope of what you can do in dosync
12:17hyPiRionsolidus_: happens very infrequently though. I think it manages to avoid starvation and "livelocks", so I'm not sure when it will actually throw
12:18justin_smithsolidus_: if the system has the kind of throughput where that happens, you should probably be using a contiguous ringbuffer instead of persistent objects anyway
12:18justin_smithor at least some kind of queue
12:19hyPiRionjustin_smith: or an agent?
12:19justin_smithwell, maybe there is a space in between performance wise, I was describing the kind of stuff they use for hft
12:19justin_smithwhich is where you would get massive throughput and livelocks
12:20justin_smith*massive attempted throughput
12:22hyPiRionQ: Imagine I've found a way to speed up some part of clojure.core significantly. How would I go forward showing that it actually is faster, and how likely would it be that it will be accepted?
12:22justin_smithhave you signed the whatchamacallit?
12:22AnderkenthyPiRion: make up benchmarks, that's what everyone does to show their approach is faster! /s
12:23technomancystu seems to really like the debian benchmarks
12:23technomancyalioth or whatever
12:26jonasendnolen_: I've been looking at cljs multimethod performance. Seems like getting rid of apply in both (apply dispatch-fn args) and (apply target-fn args) might result in a big perf boost. Is this something worth pursuing or do you have better suggestions at making multimethods faster?
12:27gfredericksambrosebs: I'm curious what the purpose of adding the second benchmark was -- just getting a second data point? or is there a difference I missed?
12:29ambrosebsgfredericks: second data point. Shall edit.
12:29gfredericksk cool
12:30hyPiRiontechnomancy: so the benchmarks game?
12:31technomancyI guess; maybe
12:31gfredericksambrosebs: ha you got alex's attention
12:31technomancyI'm not someone who has had a lot of luck getting patches applied, so don't listen to me
12:32hyPiRiontechnomancy: Guess that makes two of us
12:33gfredericksare we still talking about pants? patching pants with holes in them?
12:33gfredericksdo I need to get stu's approval to fix my pants?
12:33Anderkentonly on no pants friday
12:33Anderkentotherwise you interacting with pants might trigger alerts
12:34Anderkentdo you even have write access to the pant repository?
12:34hyPiRiongfredericks: problem with pants is that good ones generally only have two branches
12:34hyPiRionactually one branch
12:35Anderkenteh? it's clearly development and staging branching off master
12:35hyPiRionor two? Now I'm confused.
12:35gfredericksclojurebot: bbloom is a pantsologist
12:35clojurebotOk.
12:35dnolen_jonasen: that sounds like an awesome first step!
12:35bbloomdammit.
12:35bbloomgfredericks: now i need to write a talk about pants
12:35hyPiRionbbloom: looking forward to that
12:35gfredericksthat was my goal
12:35hyPiRion(inc gfredericks)
12:35lazybot⇒ 48
12:36dnolen_jonasen: patch welcome, would be nice to see some numbers. But yeah getting rid of apply should be a decent boost.
12:36ambrosebsgfredericks: ha :)
12:36tbaldridgednolen_: have you seen a problem with CLJS where the compiler tries to treat a macro like a function?
12:36gfredericksbbloom: pants look like a tree under the normal orientation
12:36bbloomgfredericks: they've even got a zipper!
12:37tbaldridgednolen_: as in it emits a macro.call instead of running macroexpand?
12:37dnolen_tbaldridge: no, that only happens if it can't find the macro, or you didn't namespace your macro properly.
12:37dnolen_tbaldridge: writing macros in CLJS generally means fully qualifying everything, since macro symbol resolution is in Clojure *not* ClojureScript
12:37hyPiRionbbloom: Those zippers are hard to use though. Only up and down are implemented
12:38dnolen_huge source of lameness - hopefully to be addressed w/ tools.analyzer switch
12:38gfredericksI bet whoever wrote that backtick lib could adapt it to make cljs macros easier
12:38tbaldridgednolen_: this might be related, but is it possible to have this work in cljs? (ns foo (:require-macros [foo]))
12:38bbloomgfredericks: i've already told dnolen to feel free to copy/paste it in to the cljs source
12:39dnolen_tbaldridge: hmm, never tried something like that before.
12:39tbaldridgeSeems like that might trip up the compiler, (two files with the same name, one .clj, the other .cljs)
12:39tbaldridgeyeah, I was afraid of that.
12:39dnolen_bbloom: rather have it solved in the analyzer since that's where we're going.
12:39bbloomdnolen_: it's a reader feature
12:39gfredericksshould it be?
12:39dnolen_tbaldridge: no that shouldn't matter
12:40dnolen_tbaldridge: that's how :include-macros and :require-macros works
12:40gfrederickshaving the reader dependent on *ns* is pretty weird
12:40bbloomgfredericks: agreed, but it's also true of ::
12:40jonasendnolen_: I'll see what I can do. Is there any point in implementing IFn's (-invoke ..) methods. I seem to recall that you once said that IFn is basically a lie in CLJS
12:40gfredericksbbloom: oh that's a lot tricksier to fix
12:40bbloomgfredericks: sadly, there is no runtime representation of :: keywords
12:40dnolen_jonasen: IFn works now
12:41dnolen_jonasen: I think you just need to tag ^not-native
12:41dnolen_and it will do a direct dispatch to the right arity
12:41jonasendnolen_: cool. MM doesnt use them so that could be a first step
12:41dnolen_bbloom: ah right
12:41dnolen_jonasen: definitely, that would be a giant boost
13:03coventryHeh, "UnsupportedLookAndFeelException"
13:06justin_smithcoventry: as opposed to the "YouCanLookButNotTouchException"
13:10justin_smithhyPiRion: you will find punk generalizes the pants zipper http://bit.ly/1kdHPkW
13:15hyPiRionheh
13:20jonasendnolen_: it's looking good. The multimethods benchmark dropped from 248msecs to 23msecs :)
13:20bbloomjonasen: nice.
13:20dnolen_jonasen: excellent
13:32justin_smithI'm looking for resources / info comparing pig and clojure-hadoop (or even using them together)
13:33justin_smithhttp://techblog.netflix.com/2014/01/introducing-pigpen-map-reduce-for.html extra info about pigpen would be especially interesting
13:35hiredmanjustin_smith: to muddy the waters further parkour (clojure hadoop library) is pretty nice
13:35justin_smithcool! thanks
13:36tbaldridgejustin_smith: did you see the ClojureWest talk?
13:36justin_smithno, I will look for that too
13:37tbaldridgejustin_smith: https://www.youtube.com/watch?v=drzMkklC05U&amp;list=PLZdCLR02grLp__wRg5OTavVj4wefg69hM
13:37hiredmanI had never done use hadoop before, but after 1.5 to 2 days futzing with parkour and elastic map reduce I had it cranky and getting the data I needed
13:37justin_smithtbaldridge: the cascalog one?
13:37tbaldridgejustin_smith: No, that's pigpen from NetFlix.
13:38llasramhiredman: Oh, hey! Glad you had a good experience.
13:38tbaldridgejustin_smith: Rich was ranting about how nice pigpen's "just pure clojure" approach was. No datalog, etc. Just seq like functions that happen to work as Hadoop jobs
13:38hiredmanllasram: me too :)
13:38llasramhiredman: LMK if you ran into any rough edges. I'm looking to improve the documentation and interfaces a bit
13:38justin_smithtbaldridge: yeah, that does sound very good
13:40hiredmanllasram: a lot of the rough edges were emr, not parkour, I had sort of test runs going locally using parkour real quick, but getting on emr, and figuring out how to feed inputs and where to read outputs, etc was a pain
13:40llasramjustin_smith, tbaldridge: Honestly, my mind kind of rebels at such enthusiasm for a system which compiles a Clojure-like language to Pig. Unless I've misunderstood it
13:41justin_smithis there a demo project that uses the aws open datasets? that seems like a nice way to introduce stuff and show it working with a low barrier to entry
13:42justin_smithmaybe that's something I could do as an exercise
13:42llasramhiredman: Ah, yeah. There's a lot of tribal knowledge of The Hadoop Way which is not always made sufficiently explicit
13:43llasramjustin_smith: Oh, noticed your original question. Parkour is somewhat philosophically similar to clojure-hadoop, but is up-to-date, more complete, and more Clojure-ish
13:44justin_smithcool
13:44llasramjustin_smith: And I've got a blog post on working interactively w/ it on an Amazon public dataset: http://blog.platypope.org/2014/2/8/interactive-hadoop-with-parkour/
13:44justin_smiththis is definitely a great start, maybe I can try to sum it up in a blog post or something as I get started, thanks abain all
13:44justin_smith*again
13:51TravisDWould you guys mind dumping your twitter usernames so that I can make a list and follow you all?
13:53technomancyTravisD: it would be cool to just assume IRC nicks map to twitter usernames, build up a graph, and do some kind of follower analysis on it to weed out false positives.
13:53llasramoooh
13:54bbloomit's times like these that i wish for a nebulous tuple store of "shit the world wants the rest of the world to know"
13:54bbloomi just wanna datalog query the internet
13:54technomancybbloom: you don't use wikipedia for that?
13:54TravisDtechnomancy: Hehe, sounds like a fun project. Could probably even detect some usernames that were slightly different, by looking at the follower graph and comparing based on hamming distance or something
13:54pjstadigprobably better to just seed with a couple of good clojure twitterers and then find a clique through follower analysis
13:54technomancyhttps://en.wikipedia.org/wiki/List_of_Clojure_Users_on_Twitter
13:54hiredmanbbloom: so, like, freebase?
13:54bbloomtechnomancy: i tried, but the association between my IRC & twitter handles was deemed "not noteworthy"
13:54pjstadigbbloom: rdf
13:55pjstadigsemantic web!
13:55hyPiRionTravisD: and possibly by interactions on IRC channels
13:55TravisDhehe yeah
13:55bbloomhiredman: pjstadig: eh, freebase & rdf are cool, but not quite there yet
13:55TravisDthere's also the IRC interactions graph, which is weighted by frequency or something!
13:55TravisDhyPiRion: ^
13:55hyPiRionmhm
13:56hyPiRionperhaps also mine github, facebook, G+ and so on while you're at it
13:56justin_smithtechnomancy: [this may not meet the notability guidelines] [citation needed]
13:57TravisDThis is starting to sound like one of those new fangled social networking data mining research projects
13:57hiredmanfoaf it up in here
13:59bbloomlicensing question for you guys: what's the right protocol if i want to copy paste individual or groups of functions in to my code?
14:00bbloomi don't want assign copyright to all the code to rich hickey... at least not yet....but i want to properly preserve copyrights/notices/etc
14:00justin_smithbbloom: what licenses?
14:00bbloomsorry, i'm copy/pasting out of clojure.core :-)
14:00bbloomtaking a handful of functions, making small edits to some, replacing others, using some wholesale
14:02amalloybbloom: https://www.eclipse.org/legal/eplfaq.php#SRCREDIST might be relevant?
14:02bbloomamalloy: yeah, saw that, but i'm not sure what that means practically
14:03amalloycopyright doesn't matter much for your case, i think, because rich has "given you" a license
14:04justin_smithI think: you have the right to copy it and redistribute as part of epl code, but if someone steals it from your version, Hickey is the one with copyright who has the right to take legal action?
14:04bbloomi know i *can* use it, but i'm not sure *how*. specifically, do i just put a EPL notice in my code and say "some portions of this code copyright Rich Hickey, the rest copyright Brandon Bloom" ?
14:06arav93Hi, does anyone know why ArityException occurs?
14:06technomancybbloom: © 200x-2014 Rich Hickey, Brandon Bloom should be fine
14:06ToxicFrogarav93: read the rest of the error message?
14:06ToxicFrogUsually it means you called a function with the wrong number of arguments.
14:07bbloomtechnomancy: isn't that ambiguous though? that implies to me joint copyright, rather than different parts having individual rights holders
14:07ToxicFrog,(let [f (fn [] 0)] (f 1))
14:07clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox/eval25/f--26>
14:07arav93Yes, that's what happened.
14:08arav93I'm trying to work on parse-timestamp in clojure,instant namespace.
14:08arav93I'm not able to get it to work.
14:08gfredericksclojure.org/lisps is slightly outdated
14:09gfredericksI forget where you're supposed to whine about those pages
14:09hiredmanthe internet
14:09sqldierarav93: you've got to figure out how many args to pass - no getting around it
14:09ToxicFrogarav93: 'not able to get it to work' as in....?
14:10arav93I read the code and it requires 10 args.
14:10arav93I passed it , still it refuses to work.
14:10justin_smitharav93: have you tried using clojure.repl/doc to see the argument signature? or looked at the source?
14:10stuartsierragfredericks: email to clojure-dev
14:10amalloygfredericks: i think you're supposed to be able to ask someone to give you edit permissions, and then you fix it
14:10technomancybbloom: the new file is a single derivative work of the old afaik
14:10gfredericksstuartsierra: cool thanks
14:10bbloomtechnomancy: meaning that i become the rights holder of that file?
14:10bbloomtechnomancy: or it stays rich?
14:11technomancybbloom: there isn't one rights holder
14:12bbloomtechnomancy: *shrug* ok i don't understand this super well, but i'll assume that a friendly notice will do & it's unlikely rich et al will sue me
14:12bbloom:-)
14:12justin_smitharav93: it has two args
14:12zanestechnomancy: Do you still use lein difftest?
14:12arav93Two args?
14:12justin_smitharav93: it is defined oddly in that it is an fn inside a let, rather than a defn
14:12zanesOr is there some new hotness I should switch to?
14:12hiredmangross
14:13justin_smitharav93: from the source (fn [new-instant ^CharSequence cs] <- that is the fn that gets bound to parse-timestamp
14:13justin_smithtwo args
14:14arav93Ok, but how would I call it?
14:14justin_smiththe second arg should be a string that the re can parse
14:14justin_smith(that one called timestamp in the let)
14:15justin_smiththe first arg is a function you provide that will be passed in the parsed result
14:15justin_smithtry "vec" first to see what comes back, I'd say
14:15justin_smitherr, I mean vector
14:15arav93vec?
14:16justin_smithor list
14:16justin_smithif you pass in list as the first arg, it will give you a list of all the things it would pass to your function
14:16justin_smiththen you can define the function you would really want to pass in
14:16technomancybbloom: it's really only relevant if you want to change the license or go after infringers
14:17technomancyzanes: I use it a bit, yeah
14:17aciniglioUsing core.async, is there an idiomatic way to apply a function to a channel, but not care about the order? (if for example the operation can sometimes take a long time)
14:18bbloomtechnomancy: my only concern is that i'm likely to develop some library code that will live in the same repository, but be entirely independent of the clojure bits, so i want to retain all rights/etc on those parts.
14:18justin_smith,(do (require '[clojure.instant :as i]) (i/parse-timestamp list "1977")) ; arav93
14:18acinigliosomething like (defn mymap [f in] (let [out (chan)] (go (while true (let [m (<! in)] (go (>! out (f m)))))) out))
14:18clojurebot(1977 1 1 0 0 ...)
14:19aciniglioUsing core.async/map< yields a channel that preserves order, so it will block the channel
14:19justin_smitharav93: look at the list that comes out, and based on that write the timestamp generator function you would want to pass in
14:19bbloomtechnomancy: https://github.com/brandonbloom/eclj#license seems like that should cover it
14:19justin_smitharav93: or just use list or vector as your new-instant function, and then pull out the fields you want as you need them
14:20hiredmanaciniglio: if your function is potential blocking (read takes a long time) maybe use thread instead of go
14:21arav93thanks justin_smith
14:21justin_smithnp
14:23jonasendnolen_: does -invoke support varargs?
14:23acinigliohiredman: yeah, thats a good point (defn mymap [f in] (let [out (chan)] (go (while true (let [m (<! in)] (thread (>!! out (f m)))))) out))
14:25aciniglioIs there a better name for what that operation is doing? Maybe apply?
14:27hiredmanaciniglio: I've fiddling with https://gist.github.com/hiredman/10489794 which basically composes a bunch of mapcat style functions and channels for you
14:30acinigliohiredman: nice! that makes a lot of sense
14:39ambrosebsBronsa: can you start a change log for tools.analyzer?
14:41hiredmanaciniglio: it is not ideal yet, it needs some kind of limiting of the number of tasks then are spun up, not just a limit on the number of tasks in channels between stages
14:42hiredmaner, items in the channels
14:43gfrederickscould you pipeline a bunch of operations by just interleaving calls to seque and map?
14:43hiredmanseque is super gross and sequence based, but I don't really care about ordering
14:45gfredericksgrossness level: super
14:46gfredericks,(->> (range 100000) (map inc) (reduce +))
14:46clojurebot5000050000
14:46gfredericks,(->> (range 100000) (map inc) (seque) (reduce +))
14:46clojurebotExecution Timed Out
14:46gfrederickshiredman: I'll take that as a "yes" ;-)
14:47gfredericksoh wait
14:47gfredericksmy question was interpreted in context wasn't it
14:47gfrederickssorry I didn't realize you guys were talking about something related :P
14:47hiredmanhuh?
14:47gfredericksyou were talking about channels and such
14:47amalloygfredericks: seque is a funny one. try (dorun (seque (range))) in your repl
14:48gfredericksamalloy: I tried it! where are the jokes!
14:48amalloygfredericks: give it a couple minutes. you'll run out of memory
14:48gfredericksoh that's a good joke
14:49amalloyand what's taking up all your memory won't be the integers from 0 to infinity!
14:49gfredericksthat *does* sound super gross
14:49amalloyit'll be lambdas that the agent inside seque is planning to run eventually
14:49hiredmanblech
14:49gfrederickswtf
14:50gfredericksI can't even imagine why that might be the case
14:50hiredman< hiredman> seque is super gross
14:50gfrederickswhy does it even use an agent?
14:50hiredmanI think it predates futures?
14:50gfredericksis there a cleaner way to write this function?
14:50amalloygfredericks: each time you take an item from a seque, it sends the agent an action to refill-if-necessary
14:51gfredericksoh and the agent is still busy filling it the first time?
14:51amalloyeach refill-if-necessary task refills as much as it can, so if you're consuming faster than you're producing, that first task goes forever
14:51amalloyright
14:52amalloyflatland/useful has two alternate implementations of seque: https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L289-L363 - neither is perfect, but they make different tradeoffs
14:52amalloyactually i think the second one, seque*, is what's in core now; my patch for that got accepted
14:53amalloyanyway i gotta go to lunch, now that i've confirmed hiredman's allegation that seque is gross
14:53gfrederickshey thamks
14:54hiredmanand even if it wasn't gross, it is based on seqs, which are linear, which may as well be unstructured data for parallel processing
14:55hiredmanO(n) will eat your parallelism
14:55gfredericksthe case I'm in is sort of inherently linear
14:55gfredericksintested in*
14:56gfredericksreading paged data from a remote server
14:56hiredmanah
14:56gfredericksand I was just interested in ensuring that the reading didn't stop while I'm writing stuff elsewhere
14:58hiredmanI suppose that would match seque's api well
15:04hiredmangfredericks: if the api let you ask for a list of page ids (which would be smaller and require less parsing then a singe page in theory) and then you can ask for each page via id, it is now random access instead of linear, so you can parallelize it all (but of course it is most likely sorted data, and an api you don't ahve control of, so foo)
15:12gfrederickswhen I type 1000 in emacs, autocomplete mode suggests 1000, 10000, 100000, and 1000000
15:13gfrederickshiredman: it's a gray area actually; the page ids are apparently easy to infer, but I think formally they're supposed to be opaque and you can only get the next one
15:14gfrederickswould be interesting if the next-page-id comes early in the response...
15:14hiredmangfredericks: or on a head request
15:15gfredericksyeah; I could imagine it blowing up if we requested in parallel though
15:15gfredericksit blows up under virtually every other circumstance
15:15hiredmanheh
15:26jonasendnolen_: is this a bug in cljs: https://www.refheap.com/75049
15:27dnolen_jonasen: IFn doesn't support rest args
15:27dnolen_er protocol fns rather
15:28jonasendnolen_: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L1050
15:28dnolen_jonasen: that's a horrible hack which should not be used a reference for anything
15:28dnolen_like String.prototype modification before it
15:28dnolen_it's not supported
15:29jonasendnolen_: heh. understood
15:41bbloomBronsa: does tools.reader offer a convenient for-form-in-file helper function?
16:05miseria"disfruto como pasajero de la capsula terrestre, los ranchos viejos de paris o roma no son mas lindos que los que veo aqui" bienvenidos: http://castroruben.com *temo_a_un_ser_sin_rival*
16:06jonasendnolen_: http://dev.clojure.org/jira/browse/CLJS-795
16:08Bronsabbloom: not sure what you mean about for-from-in-file
16:08bbloomfor-form-in-file rather
16:08Bronsaright, typo
16:08bbloomi want a lazy seq of forms until eof
16:09bbloomi'm doing loop/recur right now
16:09Bronsaoh, no there's no helper for that
16:09bbloomBronsa: unused parameter recursive? on this line: https://github.com/clojure/tools.reader/blob/0503239d5ca433756147689726f936e29eecbef7/src/main/clojure/clojure/tools/reader.clj#L731
16:09Bronsabbloom: yeah I know it's for compatibility with c.c/read
16:10bbloomok
16:10Bronsarecursive? is a no-op in c.c/read too
16:10bbloomblargh haha
16:15bbloomBronsa: what's the correct procedure to create a indexing/pushback/input-stream reader for a source file?
16:16bbloom(-> stream input-stream-reader (indexing-push-back-reader 1 path))
16:16amalloybbloom: the unused "recursive?" is for "compatibility" with common lisp's read, by the way
16:16bbloom^^ that doesn't seem to work, gives me: No implementation of method: :unread
16:16bbloomamalloy: weee software archeology
16:17Bronsabbloom: indexing-push-backp-reader expects a pushback reader of sorts
16:17BronsaI should probably update the docstring
16:17bbloomBronsa: yeah, these doc strings don't tell me much
16:17bbloomBronsa: what's the point of the "1" if it's not going to create a buffer for me?
16:18Bronsabbloom: replace input-stream-reader with input-stream-push-back-reader and it should work
16:18Bronsabbloom: the ctor functions fallback to a string-reader, otherwise they just assume you did the right thing
16:19bbloomBronsa: ok. *seems* to work
16:19Bronsaso if you give the function a string, it's going to create a string-push-back-reader with a 1-sized buffer
16:19bbloomi get an error from my code now, so that's a start ;-)
16:19bbloomthanks for the help. i'll let you know how it goes
16:20Bronsabbloom: yeah sorry again for the confusion. I've been meaning to "fix" that situation for some time but never found the time. I'm opening a ticket for that so I won't forget
16:20bbloomstill easier to use than LispReader :-)
16:26dnolen_jonasen: looks good, all tests pass I presume?
16:28jonasendnolen_: yes, but I have only V8 installed. I also tried it on some personal projects and it seems to work
16:29dnolen_jonasen: k will give it a spin later.
16:30dnolen_jonasen: thanks much!
16:33ivanhow do I annotate something as a primitive byte array to fix a reflection warning?
16:34Bronsaivan "B];" IIRC
16:34Bronsa,(class (byte-array 0))
16:34clojurebot[B
16:34Bronsaoh well, that
16:34Bronsa"[B"
16:35llasramivan: ^bytes
16:35llasram(in most places)
16:35ivanaha, thanks
16:35llasramBronsa: Unless you want to deprecate that?
16:35jonasendnolen_: dispatching is much faster according to my tests. Before the changes multimethods was ~10x slower than ordinary functions and now it's more like 3x. So hopefully everything works fine and we can start using multimethods in more places
16:36Bronsallasram: are you talking about recursive?
16:37llasramBronsa: I remember there was some discussion of valid values for `:tag` metadata
16:37Bronsaah ok
16:37llasramRight now JVM Clojure handles the symbols bytes, ints, etc specially
16:37llasramWasn't sure if you were supporting that in CinC
16:37Bronsaright
16:38Bronsallasram: I am
16:38llasramcool
16:38Bronsallasram: the only thing tools.analyzer.jvm doesn't support is things that cannot resolve to a class
16:38dnolen_jonasen: in my tests it was more like 120X slower :)
16:38Bronsait allows for class/symbol/string
16:38llasramOhhhhh, got it. So bytes resolves to [B etc
16:38Bronsayeah
16:39jonasendnolen_: ok. that's weird
16:40jonasendnolen_: or did you mean multimethods in general (and not with my patch applied)?
16:40Bronsallasram: Rich still has to give his opinion on that so if he says that it's ok to allow arbitrary values in :tag I will make t.a.j support that
16:40Bronsallasram: but tbh I'm hoping that's not his position.
16:41dnolen_jonasen: oops actually I think you're right, running w/ your patch applied, yeah they were 10X slower, and now they are comparable to Clojure
16:41dnolen_jonasen: excellent work
16:41jonasendnolen_: thanks
16:42Bronsallasram: clojure's handling of :tag is really inconsistent right now btw
16:42llasramBronsa: Oh, totes. Inconsistent and confusing
16:43Bronsasometimes thing get resolved, sometimes not. sometimes wrong tag throws, sometimes it doesn't and there's no clear way to tell what will happen other than trying to do it
17:00blake__(/ x y) where x and y are integers...I'm using (/ x (* y 1.0)) to get a real--idiomatic? acceptable?
17:01akhudekblake__: use (double y) instead
17:01gfredericks,(double 7/6)
17:01clojurebot1.166666666666667
17:02gfredericks^ can just do it to the answer too
17:02blake__akhudek, gfredericks: thanks
17:02akhudekgfredericks: yes, but then you are doing math with rationals which is probably slower
17:06gfredericksakhudek: that is true
17:10blake__Given fn[x], the difference between calling "(fn new-x)" vs. "(recur new-x)"...does the recur use tail-recursion?
17:11pbostromdnolen_: quick Om style question, you mentioned on the ml that components should probably take callbacks over channels, would the callback just be passed in as part of the :state map (like a channel would)?
17:15dnolen_pbostrom: depends, if the callbacks are not stateful in some way you can do it via :opts
17:15dnolen_pbostrom: if they are state yes, :state works
17:15dnolen_s/state/stateful
17:21pbostromdnolen_: thx
17:21gfredericksblake__: yep
17:26coventryAre differences between cljs and clj on core functions and clojure data structures bugs? (get-in {:a [0]} [:a nil]) returns nil in clj, 0 in cljs.
17:27gfredericks,(get [0] nil)
17:27clojurebotnil
17:27gfredericks(get [42] nil) returns 42 in cljs
17:28gfredericks(get [1 2 3] nil) returns 1
17:28coventryI'll file an issue, anyway, in case it's unknown behavior.
17:28gfredericksI'd say that's a bug unless there's some crazy perf reason it's wired up that way
17:29amalloys/unless/even if/, right?
17:30gfredericksamalloy: I meant if it was intentional
17:30amalloyright, right. i'm arguing it can be a bug even if it was intentional
17:30coventrygfredericks: what version did you check with? I'm on r2156.
17:30amalloyjust by dint of sheer wrongness
17:30gfrederickscoventry: himera.herokuapp.com
17:31gfredericksamalloy: you and your values of right and wrong
17:31coventryoh, nice.
17:31blake__gfredericks: thanks
17:31dbasch_if I have a multimethod that needs to do something for :a, something else for :b, and the same thing for :c, :d, or :e, how do write the method for :c, :d and :e?
17:31gfredericksamalloy: fine if you get this then I get integers and ratios
17:32blake__If I'm getting a stack overflow from java.util.Random.nextdouble, that's just a coincidence, right? =P It's my own app causing the problem, and Random.java is just by chance where it is when it runs out of stack.
17:32gfredericksdbasch_: if you use namespaced keywords you can use inheritance
17:32amalloyblake__: yes
17:33gfredericksdbasch_: otherwise I think you'd extract it into a helper, or somehow encode that information in your dispatch function
17:33dbasch_gfredericks: thanks
17:35blake__amalloy: thanks
17:52bbloomi seriously just wrote @@#'
17:52bbloom*sigh*
17:52Bronsaew
17:52bbloomdereferencing an atom in a private var
17:53coventrythree-star programmer.
17:53bmabeyperljure!
17:54gfredericks,(->> (nth (iterate atom 42) 10000) (iterate deref) (drop 10000) (first))
17:55clojurebot42
17:57bbloomcoventry: when all else fails, add more indirections
17:57bbloom... or remove them
17:57bbloomi don't know any more
18:00justin_smithgtrak: about that stack overflow thread, check this out:
18:00justin_smith,(reduce #(if (> %2 10) (reduced %) (+ % %2)) (range))
18:00clojurebot55
18:01gtrakwait wat?
18:01gtrakearly exit?
18:01justin_smithyup
18:02nickmbaileyre
18:02nickmbaileyoops, ignore me
18:02gtrakahh, reduced is new in 1.5, no wonder I missed it :-)
18:02gtrakthat's good to know
18:03justin_smith,(reduced 42) ; for some reason this amuses me
18:03clojurebot#<Reduced@c9a375: 42>
18:04gtrakhitchhiker's?
18:04justin_smithwell the amusing part is that reduced works on its own, but yeah
18:04justin_smith42 is like numerical foo
18:05gfredericks,(reduced 1 2)
18:06clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/reduced>
18:06blake__reduced...for testing?
18:06gfrederickssome reduces like to quit early
18:06blake__on Fridays? don't we all?
18:07justin_smithblake__: it makes reduce more powerful when it can short circuit, of course
18:07gfredericksyou could use it to implement find-first
18:07gfrederickswith less object allocation in a lot of cases
18:08justin_smithindeed
18:08gtrakyea, I mean that's how I'd explain reduce to folks. reification of a loop into data... gain things like reductions, fork/join, lose some control, that's the tradeoffs.
18:08blake__oh...so...if you can get the answer without going over the whole collection?
18:08gfredericks,(defn find-first [pred coll] (reduce #(if (pred %2) (reduced %2)) nil coll))
18:08clojurebot#'sandbox/find-first
18:08justin_smithblake__: exactly
18:08blake__sweet
18:08gfredericks,(find-first even? [1 3 5 6 7])
18:08clojurebot6
18:08gtrakthere's no technical reason why it couldn't exit early :-), so I'm glad.
18:09gfredericks,(defn find-first-with-index [pred coll] (reduce #(if (pred %2) (reduced [%1 %2]) (inc %1)) 0 coll))
18:09clojurebot#'sandbox/find-first-with-index
18:09gfredericks,(find-first-with-index even? [1 3 5 6 7])
18:09clojurebot[3 6]
18:09gfredericks,(find-first-with-index even? #{1 3 5 6 7})
18:09clojurebot[2 6]
18:09gfrederickshaha
18:10llasram,(find-first-with-index even? [1 3 5 7])
18:10bbloom,(macroexpand '(fn f []))
18:10clojurebot4
18:10clojurebot(fn* f ([]))
18:10bbloom,(macroexpand '(defn f []))
18:10clojurebot(def f (clojure.core/fn ([])))
18:10bbloomgrumble grumble.
18:10bbloomstupid defn
18:10bbloomnot passing the name along
18:10tuftanyone know why clojure doesn't overload the inequality operators?
18:10tuft(functions)
18:10gfredericksoverload?
18:10gfredericksoh for non-numeric comparisons?
18:11tuftyeah
18:11blake__gfredericks: Not sure I get that second one, with the set?
18:11gfredericksblake__: it's just treating it as a sequential thing anyways
18:11tuftComparables would be nice -- same for min/max, etc.
18:11justin_smith,(map identity (into #{} (range 10))) ; blake__:
18:11clojurebot(0 7 1 4 6 ...)
18:11gfrederickstuft: I've wanted this lately too
18:12justin_smithiow sets are not ordered
18:12gfredericksI literally wrote my own max just yesterday
18:12gfrederickstuft: should I go make a library?
18:13blake__justin_smith: Oh! OK. So it converts and...well, you shouldn't be using index and sets anyway....
18:13tuftcould be handy -- generic versions of certain core functions like this
18:13Bronsabbloom: there's a very good reason why defn doesn't pass the name
18:13justin_smithblake__: right
18:13bbloomBronsa: which is?
18:14weavejestergfredericks: medley has "least" and "greatest" which are like min and max for comparables.
18:15Bronsabbloom: if it expanded to e.g. (def a (fn* a ([..] ..))) and you use `a` inside the fn definition, you'll use the local a rather than going through the Var
18:15cbphow do i tell lein repl to use clojure 1.6
18:15blake__The right collection for the job.
18:15technomancycbp: outside a project you mean?
18:15Bronsabbloom: that might break redefinition in some cases
18:15cbptechnomancy: yeah
18:15bbloomBronsa: yeah, i guess that makes sense...
18:15technomancycbp: need to run from git for that
18:16cbptechnomancy: ah
18:16cbpthanks
18:16gfredericksweavejester: this otherwise has a lot of overlap with prismatic/plumbing
18:16gfrederickshadn't seen it before
18:16justin_smithwould a :dependencies vector in .lein/profiles.clj not do it?
18:16Bronsabbloom: there was a good example where this behaviour is problematic but I can't remember it :/
18:16bbloomBronsa: but that only really matters if you capture the fn
18:16technomancyjustin_smith: no, because clojure is already loaded by the time that's processed
18:16bbloomBronsa: and in that case, i think you *don't* want redefinition
18:16weavejestergfredericks: Ah, I hadn't seen plumbing before
18:16Bronsanow I remember the example
18:17gfredericksweavejester: it's got kind of a weird focus but I've been using it at work
18:17Bronsabbloom: (defn x [] ..) where the body of x contains a recursion
18:17Bronsaand suppose you want to (def x (memoize x))
18:17gfredericksweavejester: I just pushed update and mapply into it :)
18:17gfredericksweavejester: for some reason I feel like using 2 util libs would be chaos but I don't know why exactly
18:18S3thc0nWhat do you guys prefer (practically and theoretically): The threading macros (a.k.a. pipelining) vs destructuring (by let)? Both alter the code organization to match the program flow in order of appearance.
18:18bbloomBronsa: i think it's worse the way it is now: you do something like (def fog (comp f g)) and if f is recursive, now fog is a broken hybrid
18:19justin_smithS3thc0n: horses for courses - if it is linear thread, if values come up repeatedly and not just linear stepwise let bindings
18:19gfredericksthey do different things well; threading macros support more general operations; destructuring can do lots of things at once
18:19weavejestergfredericks: The graph focus in plumbing is a bit curious
18:19weavejesterS3thc0n: It honestly depends on the situation
18:19gfredericksweavejester: yeah that's part of what I meant by weird focus
18:19bbloomBronsa: i mean if you redefine f after defining fog
18:19amalloyS3thc0n: do you prefer company or food? they're not things you can have a preference between, because they're so different
18:20bbloomcemerick: does nrepl have some kind of logging mode i can turn on?
18:20bbloomcemerick: i want to see all messages/responses
18:21cemerickbbloom: no; I've written the same logging middleware 5 times without putting it anywhere :-/
18:21S3thc0nFair enough. Although it does seem to me like both are generally used to change the order to be (not necessarily my opinion) more intuitive (which is what I'm interested in). Thanks for your thoughts on that.
18:21justin_smithbbloom: what about a man in the middle type snooping / logging process in front of the nrepl port? or even wireshark
18:21technomancybbloom: I think it's in `lein help sample`
18:22technomancyoh, doesn't log responses though
18:22bbloomcemerick: with tpope's help, i've managed to get fireplace to interop smoothly between .clj and .eclj files, but sometimes fireplace chokes on the nrepl response
18:22bbloomjustin_smith: not a bad idea
18:22cemerickbbloom: (.eclj is?)
18:23bbloomcemerick: it's clojure + bonus features :-)
18:23bbloomwell, no bonus features
18:23bbloomyet
18:23bbloombut soon
18:25Bronsabbloom: oh yeah, that doesn't really look right, I didn't think about that
18:28Bronsabbloom: looks like it used to expand to (def x (fn x [])) http://dev.clojure.org/jira/browse/CLJ-809
18:29bbloomBronsa: seems like it sucks both ways, but i understand why it was changed
18:36gfredericksbbloom: cemerick: I was wanting some logging middleware recently too; but when you're developing middleware, logging can be subtle
18:36gfrederickslike you'd want to do before and after or something
18:37gfredericksI've started thinking I want a session-multiplexer middleware
18:37gfredericksto support things like backgrounding long-running-evals after they've started
18:38gtrakoh damn, company-mode
18:38gfredericksmy emacs does not have company-mode
18:38gtraki just got it from melpa, playing with it.
18:39gtraksupposed to support the cider backend already
18:40gfrederickspresumably better than autocomplete-mode?
18:40gtrakso far, yea.
18:40gtrakI disabled ac-nrepl for the cljs stuff, but this might work out of the box.
18:41gtrakbbatsov seemed vehement about it, anyway :-)
18:41gtrakas just a better project overall
18:59FrozenlockWhat does #clojure use for testing ring app nowadays? Kerodon?
19:01justin_smithFrozenlock: I write handlers that can be tested by passing in the appropriate map, and sometimes my groundhog middleware to record requests for later testing
19:02justin_smithFrozenlock: I had not seen kerodon, looks cool for more elaborate testing
19:03Frozenlockjustin_smith: I see. I'm too lazy to make my requests by hands! :-p
19:04justin_smithhttps://github.com/noisesmith/groundhog groundhog records requests as you make them, and can output them to a file or whatever
19:04justin_smithso there is no making by hand needed
19:06xeqiFrozenlock: unfortuantly I haven't seen anyone build much else in the ring testing area
19:06xeqithere is recording like groundhog, or full stack with clj-webdriver
19:10bbloomcemerick: you wanna copy/paste me that middleware you got? :-)
19:11justin_smithI am happy to just do recording and reusing those maps, since I like my handlers to be functions of input to output with any state being carried by / pointed to by the request
19:12justin_smith(also I haven't had to do many state heavy webapps thank god, or otherwise I would be looking for something like kerodon for sure)
19:12FrozenlockYeah, I guess I was just looking for something of higher level (I already test all my underlying functions). Say, something that would let me know if I messed up my auth with friend, but without have a friend map hardcoded in it.
19:13blake__OK, I'm trying to optimize a routine. It's based on my understanding of Knuth's minmax routine for cracking mastermind codes.
19:14blake__I did a refheap: https://www.refheap.com/75126 The last five lines are the ones taking so long.
19:15blake__Basically, you check all guesses against all possible remaining codes to find the least number of codes eliminated by any guess (and also the most).
19:16blake__Your next guess is based on those that have the highest result for "least possible number of codes eliminated".
19:17amalloyblake__: well, rand-pattern should be (repeatedly number #(rand-nth colors)). doesn't address performance at all, of course, but you do have a question about that too
19:18blake__So, the first time around, with six colors and four codes, it's 1296x1296. This takes a minute. The next one brings it down to 1296x256 (typically). But it's that first 1,679,616 checks that really slow things down. =P
19:19blake__amalloy: Hah. I'm not even using that. I rewrote it later as "rand-code" and "(vec (repeatedly number #(rand-nth colors)))". So I guess I worked that out.
19:19blake__(It's the small signs of progress that keep me going. That, and it's my job. =P)
19:20blake__amalloy: Oh, lol, you even said "repeatedly number..." Missed that.
19:30Frozenlockxeqi: Is there something wrong with asking kerodon to follow a link of the type "/some-line"? I get an error (not found), but I can clearly see the link in the enlive parsed document.
19:30Frozenlock(-> (session server/app) (visit "/") (follow "/login")) ;;;; IllegalArgumentException link could not be found with selector "/login" kerodon.impl/not-found
19:31xeqiFrozenlock: it searches by id or link text, not the pointed to url
19:31xeqiwell, css selector I think
19:31FrozenlockOh!
19:31FrozenlockNo wonder then
19:31xeqiFrozenlock: think of kerodon as only doing what a user would do
19:32xeqiand there are most likely missing features, I haven't touched it in quite awhile and would happily pass kerodon off to another person if they wanted to maintain it
19:33Frozenlockxeqi: last commit 3 months ago... ain't so bad ;-)
19:33xeqiI think someone else did that, and glenjammin merged it
19:34xeqiso much to do, so little time
19:34FrozenlockI'll let you know if I'm interested. But it's quite literally the first time I try it.
19:35xeqihaha, didn't mean it quite that way :p
19:43bbloom,(. foo bar)
19:43clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:0:0)>
19:43bbloom,`(. foo bar)
19:43clojurebot(. sandbox/foo sandbox/bar)
19:43bbloom,`(.bar foo)
19:43clojurebot(.bar sandbox/foo)
19:44bbloom:-/ parsing dot forms in syntax quote is busted apparently
19:44llasramhmmmm -- I'm not sure how it could work that would be better though
19:45bbloom,(macroexpand '(defmethod foo :bar [args] code))
19:45clojurebot(. foo clojure.core/addMethod :bar (clojure.core/fn [args] code))
19:45bbloomllasram: clearly that's not right ^^ heh
19:45llasramHa
19:45bbloomthat's apparently just how it works...
19:45llasramWell, does `.` ignore the namespace on the method symbol?
19:45bbloom,(eval `(. "abc" (endsWith "c")))
19:46clojurebottrue
19:46bbloom,`(. "abc" (endsWith "c"))
19:46clojurebot(. "abc" (sandbox/endsWith "c"))
19:46bbloomyeah seems like it
19:46bbloomcrazy
19:46llasramA bit odd, but make sense if you squint your eyes and tilt your head a few degrees
19:46llasramOh, wait, that's just these polarized sunglasses
19:47bbloomheh
20:00amalloybbloom: it turns out that if you don't ignore the namespace part, it's a huge hassle to write any interop macros
20:05cemerickbbloom: lost in time, AFAIK. Thus the :-/
20:30jdeisenbergHello. In one terminal I have a core.clj file open in a text editor; in another terminal window I have leiningen repl running. I make a change to core.clj, and would like to re-compile without having to quit repl, compile, and re-enter repl.
20:31jdeisenbergI have tried (set! *compile-path* "./src/polygon") then (compile 'core) but it gives me "could not locate...core.clj on classpath: clojure.lang.RT.load
20:32justin_smithjdeisenberg: is core the full name of the ns? or is it polygon.core?
20:32hiredmanjdeisenberg: compile is almost certainly not what you want at all
20:33justin_smithoh yeah, good point
20:33hiredmanlike, basically, there is a 2% chance that compile is what you want
20:33hiredmanjdeisenberg: just copy and paste the code in to the repl
20:33justin_smith(require 'your.ns :reload)
20:33justin_smithor that
20:33jdeisenbergUm, let me check the namespace, justin_smith
20:33hiredmanjdeisenberg: the are editors/setups that give you short guts that basically do that
20:34hiredmanshort cuts
20:34jdeisenbergns is polygon.core
20:34justin_smithjdeisenberg: compile would only compile it, I don't know that it would load the new def
20:34justin_smithyou want to evaluate the new def, or require with :reload
20:34hiredmanI would recommend forgetting that compile exists
20:34jdeisenbergjustin_smith: It was a natural thought (being a clueless newbie)
20:35hiredmanyou will never call it yourself
20:35jdeisenbergAt the risk of starting a theological war, I'm using vi to edit.
20:35danielszmulewiczHow do I return the value of a var only if it exists? (without throwing an exception)?
20:36hiredmanjdeisenberg: I don't use vi myself, but my understand is there are some pretty good vi tools for clojreu these days, maybe bbloom or tpope would know more
20:36justin_smithjdeisenberg: fireplace is popular if you want to integrate the repl into your editor, but saving the file and doing a require with reload will do the job too - or even just copy pasting a def into the repl window
20:36hiredmandanielszmulewicz: resolve + deref
20:36danielszmulewicz(inc hiredman)
20:36lazybot⇒ 41
20:36danielszmulewiczhiredman: thanks
20:38bbloomjdeisenberg: use fireplace. it rocks
20:38jdeisenbergjustin_smith: Thank you!
20:38justin_smithnp
20:40blake__hmmm "ClassCastException clojure.lang.Cons cannot be cast to java.lang.Number clojure.lang.Numbers.isZero (Numbers.java:90)
20:40blake__"
20:40amalloy&(zero? (range))
20:40lazybotjava.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to java.lang.Number
20:40hyPiRion,(zero? (cons -1 (range)))
20:40clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to java.lang.Number>
20:41Platzis cider still the go-to mode for clojure on emacs?
20:41blake__,(zero? (cons -1 (range)))
20:41clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to java.lang.Number>
20:41llambdai have an om question: what's the best way to condense this kind of pattern? --> https://gist.github.com/maxcountryman/0f9296ce9306824674ed
20:41blake__,(zero? (cons '(-1) (range)))
20:41clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to java.lang.Number>
20:42amalloyllambda: you want repeatedly, not repeat
20:42llambdathat doesn't work either
20:42amalloy(repeatedly 4 (fn [] (apply dom/div ... (repeatedly 4 (fn [] (dom/div ...))))))
20:43llambdaamalloy: it doesn't output anything when i do that
20:43amalloyi mean, i don't know anything about om, but that is how you reduce duplication in this code
20:43llambdayeah it doesn't seem to work with om
20:46amalloyllambda: i don't really believe that. it's just how functions work. so what is the code that you think is "when i do that"
20:47`szxllambda: is it possible you're forgetting apply?
20:47llambda`szx: nope
20:47`szxoh sorry, didn't see that
20:49hyPiRionllambda: not repeat, but repeatedly
20:49llambdayes, using repeatedly, it doesn't work
20:50amalloythe funny thing is, repeat might actually work fine - i don't know if om needs these things to be distinct objects
20:50llambdaboth repeat and repeatedly yield this: <span data-reactid=".0.0.$cljs$lang$protocol_mask$partition0$:0">32374988</span>
20:50amalloyllambda: again, i suggest you paste the code of yours that's producing that output
20:51llambdasure
20:51hiredmanbecause dom has these functions/macros for generating the shadow dom stuff instead of data structures
20:52amalloyhiredman: i'm not sure what behavior your "because" is explaining
20:53hiredmanamalloy: the serialized javascript constructor name in the string instead of the sane behaviour
20:54llambdaamalloy: https://gist.github.com/maxcountryman/0f9296ce9306824674ed#file-grid-again-clj
20:55amalloyright, you're missing an apply on the first dom/div
20:55amalloyyou want to call div with four arguments, not with one argument which is a four-element sequence
20:55llambdaamalloy: that doesn't work
20:56llambda(apply dom/div <rest> doesn't work at all
20:56hyPiRionso it's a macro then
20:56`szxllambda: https://www.refheap.com/75157
20:56hiredmanom generates macros and functions with the same names for the tags
20:56amalloywhat does your namespace form look like? a quick look at om suggested to me that it generates both macro and function versions of div, etc
20:57llambdaamalloy: [om.dom :as dom :include-macros true]
20:57`szxllambda: try it out, works fine here
20:57llambda`szx: i did, it doesn't work here
20:57`szxstrange
20:58llambdayou probabyl aren't using macros?
20:58amalloyi guess i don't know enough cljs to diagnose the problem - it sounds like you've only got the macro versions of these tag functions in your ns, but you need to use the function one
20:58llambda`szx: what are you requiring from om?
20:58`szx (:require [om.core :as om :include-macros true]
20:58`szx [om.dom :as dom :include-macros true])
20:58llambdawhat version of om are you using?
20:58`szx0.5.3
20:59llambdaoh i have 0.5.0
20:59llambdaseems like a longshot but
21:00hyPiRionbugfixes, bugfixes
21:01llambdawell it seems to work now...
21:02llambdathanks everyone!
21:02llambdanext time i'll try updating first i guess heh
21:04`szxlein-ancient is your friend :)
21:05gfredericksreiddraper: I feel like just reporting the :seed is a little too coarse
21:06gfrederickssince one seed is used to generate many trials
21:06reiddrapergfredericks: i'm about to head out the door, but am curious to hear the rest
21:06gfredericksI'll make a ticket
21:07reiddraperty
21:10beamsohow do i associate a map to a transient map?
21:10gfredericksbeamso: I'm not sure what that means
21:11hyPiRionbeamso: convert a map to a transient one, you mean?
21:12beamsoi want to (def config (transient {})), then use clojure.edn/read-string to read in properties in edn format from a file, then associate those properties back to config
21:13gfredericksbeamso: that's not a good way to use transients
21:13gfrederickswhy not (def config (clojure.edn/read-string ...))?
21:13beamsoafter asking the question i think i should be using an atom
21:13beamsoi've no idea what the config filename is in advance
21:13gfredericksyeah an atom is definitely a better alternative than a transient
21:14hyPiRionbeamso: use (def config (delay (clojure.edn/read-string ...)))
21:14hyPiRionunless the file is dynamic
21:14gfrederickshe said it is
21:14hyPiRionyes, I see that now. Then I'd use a promise, actually.
21:14beamsothe filename is dynamic, not necessarily the file
21:15hyPiRionyeah, I meant filename
21:19akurilinAny of you folks here familiar with clj-pdf? I can't seem to figure out how to stuff multiple objects into one container obj. e.g. I want a cell to contain 3 paragraph objects, which I know should be possible by looking at the java library
21:20beamsousing promise/deliver made execution hang.
21:20akurilinbut it seems like the clj wrapper wants 1 thing
21:20akurilintechnically I can go ahead and just use a table inside of the cell, but I'm trying to figure out if that's the prescribed route
21:20beamsodid you put the 3 paragraph objects into a vector?
21:21akurilinYeah if I do that it only uses the last one
21:21akurilinactually nvm it doesn't support that, I forgot how I got that that conclucsion
21:22akurilinif you DON'T, then it uses the last paragraph
21:22akurilinif you do, it throw an exception
21:35Frozenlockxeqi: is it me, or `kerodon.test/has' doesn't cause the test to fail as `is' would?
21:38xeqiFrozenlock: you'll need to be a bit more specific there
21:41Frozenlockxeqi: nvm, I see it's doing the thing as `is' in the repl. Somehow, when I do `lein test' it just ignores it. Must be my config.
22:09gunsgfredericks: ooh, what kind of test.check utilities are those?
22:09gunsI'm writing a concurrent property test right now, and it's a real head twister
22:10gfredericksguns: not sure
22:10gfredericksI'd been considering collecting some things together for running slow/flaky tests
22:10gfredericksnot sure if that applies to what you're doing
22:10gfredericksbut I have a big pile of generator utilities too
22:10gunsI'm really new to this, and I love the idea
22:10gfredericksI figured test.chuck was a good name for a dumping ground
22:11gunsI see. I'll keep a look out.
22:11gfredericksHeck I'll make it right now.
22:11gunsI got excited by the Erlang QuickCheck guy's wizard powers
22:11gunsJohn Hughes
22:11gfredericksright
22:16gfrederickshttps://github.com/fredericksgary/test.chuck
22:16gfredericksI need a logo of chuck
22:17guns
22:17amalloygfredericks: http://robmason.org/projects/the-rules-of-manliness-according-to-chuck-norris/images/5.jpg
22:17justin_smithgfredericks: you should have a test.chuck.testa namespace for mocking data
22:17amalloyeasy choice
22:17gfredericksI'm not sure how that didn't occur to me.
22:18llasramBecause he's a bizarro racist?
22:18gfredericksoh snap he probably is isn't he
22:18gfredericksquick I need a better chuck
22:18gfredericksa liberal progressive chuck
22:19llasramhttp://en.wikipedia.org/wiki/Groundhog
22:19amalloygfredericks: chuck taylor?
22:20llasramHow many tests would a test.chuck chuck if a tech.chuck would chuck tests?
22:20justin_smithhttp://i.imgur.com/lioMEJA.jpg
22:20justin_smithchucky from child's play?
22:22gfredericksI'll go with ye olde land beaver
22:22xeqigfredericks: http://jeffvrabel.files.wordpress.com/2012/07/chuck_e_cheese.gif
22:23gfredericks:)
22:28gfredericksThe photo has a line through it but so does leiningen's; mine just looks worse.
22:29gfredericksand so it is that I created a 5-segment namespace O_o
22:32gfredericksuh oh my test.chuck code uses the gen/for macro that hasn't been merged yet
22:32gfredericksnobody use this yet
22:40gfredericksgs
23:28ToBeReplacedhow come people use routing libraries (eg. compojure) for http dispatch instead of multimethods?
23:29justin_smithToBeReplaced: good question
23:29ToBeReplacedi can see a good argument for pedestal's version of routing since it is mostly data, but i don't see the same benefit for compojure
23:29justin_smithwe made polaris because we wanted routes defined from a db, and reverse routing
23:31amalloywhat value would multimethods bring to http routing? it doesn't sound like fun at all
23:31xeqiI'd imagine the dispatch function to be complex
23:31ToBeReplacedjustin_smith: thanks i'll take a look... i'm out of touch with clojure-on-the-web; i like that the routing table is data/exportable
23:32ToBeReplacedamalloy: (defmulti http-response :request-method), (defmulti get-response :request-uri), (defmethod http-response :get [req] (get-response req)), etc.
23:33ToBeReplacedseems nice to me; lets you define the pipeline you follow to dispatch... easier to do things like separate off "what content type will this return?" from "what data will this return?", etc.
23:34ToBeReplacedand you get all of the benefits of pluggability
23:35amalloythat's like super-fragile and special-case. now everything you want to do with ring has to live in a top-level var, which is your multimethod. how do you wrap just half of your routes in authentication middleware?
23:36amalloyand if you want the same behavior for PUT /xyz and POST /xyz, you have to define it twice separately, in apparently-different places
23:36xeqiwildcard paths and proper ordering seem fun
23:38ToBeReplacedamalloy: hmm... top-level var commentary doesn't seem any different than compojure's solution, though i do see what you mean how at some point you'll have to break off and do routing via functions to manipulate at runtime
23:39amalloyToBeReplaced: consider: (def app (routes (GET "/foo" [] (ok)) (wrap-authentication (GET /bar [] (print-username)))))
23:39amalloyhow can you possibly write an equivalent of that?
23:40ToBeReplacedi don't know what that does
23:40amalloyneither do i, i just made it up
23:40amalloythe point is to replicate the wrapping of the middleware around just one route
23:40ToBeReplacedwrap-auth seems broken by design? authentication via middleware feels like a bad idea?
23:40amalloyokay, so wrap-json, whatever
23:41amalloy(a lot of people disagree with you about auth, but that's not the point)
23:41ToBeReplacedoh, that's easy, isn't it? isn't that the same thing as injecting a new defmulti?
23:41ToBeReplacedyeah, i know... some months ago i complained about it, but knew i wasn't going to put in the work to try to do it a different way (a la pedestal), so i quieted myself
23:42ToBeReplacedex. (wrap-head) is defined in my example above
23:42ToBeReplacedalthough it's better, actually... because now you don't have to evaluate a request first (and then set body to nil)
23:43ToBeReplacedwhich is a good example of a common complaint i have -- i don't have a mechanism to easily, for example, separate what content type will be returned vs what the content is
23:45ToBeReplacedthe put/post comment isn't fair either fwiw... solution would be (defmulti put-response :put [req] (post-response req))... one-liner
23:45ToBeReplacedthere's definitely some ickyness there though, b/c it's not data... so if you couldn't be consistent site-wide, complex dispatch paths would get very hard