#clojure logs

2013-01-09

00:21bbloomare there any good generators/streams/haskell-iteratees libraries for clj? i'm looking at https://github.com/roman/river but i'm wondering if there are others. i've got an algorithm that could really benefit from a yield operator
00:23tomojis 'yield operator' pretty specific?
00:24bbloomlike yield in python
00:26bbloomi'm also wondering if reducers can help me...
00:27bbloomsince it seems like rhickey went down the streams path, and then abandoned it for a mix of chunked lazy seqs plus reducers
00:27bbloombut i'm still not quite sure
00:28bbloombut i think i should study reducers more...
00:28tomojthe generators in python just give a synchronous iterator-like interface, right?
00:30bbloomtomoj: yeah, it's an imperative, continuation-based sequence building thinggie
00:31bbloomi have a sequence transformation where i want to occasionally perform buffering look ahead, so i need to be able to thread some state along the way for a map/reduce
00:32bbloomthe real issue is that i need to interleave two processes: one buffering/enqueing and the other dequeing
00:32bbloomotherwise, my buffer is O(N) and useless to me
00:34tomojyou lost me there, but reducers do seem promising based on my weak understanding of the earlier 2 of your last 4 messages
00:34tomoj...i.e. not the real issue
00:34bbloomso assume you have some sequence of items
00:34bbloomand you want to transform it
00:35bbloomhowever, occasionally, you don't know how to transform an item
00:35bbloomyou'll need to "look ahead"
00:35bbloomie buffer up those items until you find the information you need
00:35bbloomone way to do that is to loop over the source and only "yield" when you have what you need
00:35bbloomthat "yield" operator will cause some other code to run, which will consume the yielded value
00:36bbloomand by that mechanism, somebody is receiving values and so there is no buffer between the two processes
00:36tomojyeah, that seems reducer-friendly so far, if I understand you
00:37tomojyou want to do a straight map on the non-lookahead items, and only thread reduce state through on the buffers?
00:37bbloomtomoj: something like that... i think
00:37tomojwhere the result of the reduce on a buffer is the result item for the entire buffer?-
00:37bbloomi have a tree which i'm flattening into a sequence (ie interior nodes are converted to begin/end pairs wrapping their children)
00:37bbloomthen i map over that to annotate them
00:38bbloomthen i want to map over it one more time, but sometimes i need to do look ahead
00:38bbloomand then i want to map over it one last time to print out some values
00:38bbloomit's that look ahead step i don't quite understand yet
00:38tomojso the result has the same number of items as the flattened tree
00:38bbloomyes
00:39bbloomalthough filtering/ammending the items shouldn't matter
00:39bbloomthe tricky bit is just the buffering
00:39tomojI just was not sure whether the buffers got collapsed into single result items
00:39bbloomin this particular case, they do
00:40tomojso the result has fewer items than the flattened tree when lookahead was performed
00:40bbloomsorry, let me clarify:
00:40tomojah, I see an ambiguity
00:41bbloomflatten tree of N items yields I*2 interior nodes + L leave nodes
00:41bbloomlet I*2+L = M
00:41bbloomi then transform M -> M nodes to annotate them
00:41bbloomi then transform M -> M again, but sometimes with look ahead buffering
00:42bbloomand, for simplicity, let's say i then just doseq that and print it out
00:42tomojright, I see
00:42tomojwhy won't just seqs work?
00:42tomojwith a function like partition but which takes a function that tells it how/when to partition
00:42bbloomthey could work, but it would be a tricky laziness problem
00:43bbloomwhere i'd have to do nonsense like (lazy-cat nil ....)
00:43bbloomand somehow thread the buffer through
00:43tomojanyway seems to me you could similarly write a function like r/partition
00:43tomoj(which may not exist yet.. but there is a r/partition-by patch somewhere)
00:44bbloomdoesn't exist, but i found the r/partition-by patch
00:44bbloomit has a buffer! :-)
00:44tomojthat would return a new reducer of sometimes values, sometimes buffers, and then you can r/map over that?
00:44bbloomyeah, i think that's the ticket
00:45bbloommy buffer is actually a double-list finger-tree because i'm going to do pruning on the buffer as well :-/ heh
00:45tomojthen doseq doesn't work but you can do (reduce (fn [_ v] (println v)) nil r) :/
00:46tomojor more cryptically (r/reduce (fn ([_]) ([_ v] (println v))) r)
00:49tomojer, (fn ([]) ...) I mean
00:50bbloomtomoj: so there's still one other issue: what do i reduce TO ?
00:50bbloomobviously i need to reduce to a seq, but what kind?
00:51tomojby "reduce to a seq" you mean you think the return value of reduce should be a seq?
00:51bbloomyeah
00:51tomojso you can doseq it?
00:51bbloomjust like partition does
00:51bbloomwell it can reduce to the next stage of a reducer, i don't care if i eventually doseq it or not
00:51bbloomalthough i assume i can
00:52bbloomlooking at http://dev.clojure.org/jira/browse/CLJ-991 patch v4
00:52tomojif you go the reducer route your partition-with (or whatever) should just return a reducer
00:52bbloomnotice how it calls "append"
00:52amalloybbloom: i think you can write yield in terms of continuations pretty easily, right? have you looked at delimc?
00:52bbloomoh i see
00:53bbloomamalloy: yeah, i contributed a big pile-o-patches to delimc & have a half finished CPS transform for clojure script
00:53bbloomamalloy: i'm trying to see if there is a non-imperative solution via reducers
00:53tomojthat partition-by looks really weird to me
00:53bbloomtomoj: so it's yielding one partition at a time
00:53bbloomwhich makes sense
00:53amalloysomething like a year ago i was talking to dnolen in here about how you can use just lazy-seq to give you everything yield allows
00:53tomojanyway, you won't get a seq back out of your reducer - I guess it's possible but it would seem silly
00:54tomojyou'd just use the reduce I wrote above on the reducer partition-with returns instead of doseq
00:54amalloybbloom: have you written a version that uses yield? ie, presuming yield exists, what would the code look like?
00:56aphyrSo... my project used to specify clojure:clojure:pom:1.3.0, back in the day
00:56bbloomamalloy: https://github.iu.edu/sabry/PPYield/blob/master/PPYield.hs#L352-419 like that confusing mess :-)
00:56amalloyyikes, just the anchor part of that link worries me
00:57aphyr... which I guess is replaced by [org.clojure/clojure "1.3.0"] now
00:57aphyrIs there a sane way for me to run old versions from git without having to edit project.clj every time?
00:57amalloythat is not what the clojure would look like with yield. that is a big blog of haskell, man
00:58amalloyaphyr: i don't think clojure:clojure:pom:1.3.0 ever worked - the clojure artifact has always had groupid org.clojure
00:58bbloomyeah, my point exactly haha
00:58amalloybbloom: if you want yield in clojure, write it in clojure and assume that yield works. then, you can either figure out how to write yield, or do the smallish amount of work necessary to convert yield to lazy-seqs
00:58technomancyaphyr: lein had a stupid special case for a few jars waaaay back in the day
00:59technomancyit only applied to clojure and clojure-contrib
00:59aphyramalloy: sorry, in project.clj it was: just [clojure "1.3.0"]
00:59bbloomamalloy: i also have a lazy-seqs version in haskell to reference, but it's pretty hairy because it requires "trying the knot"
00:59amalloytechnomancy: not waaaay back; you can't call 1.x ancient and still refuse to release 2.0
01:00aphyrKinda frustrating, I'm trying to benchmark my project and it's broken as recently as... nine months ago, haha
01:00technomancyamalloy: right; I guess the ancient part was actually emitting bare clojure
01:00amalloyoh, as in lein new did that?
01:00technomancyit would have been only on projects where `lein new` was called 2+ years ago I think
01:00technomancyyeah
01:00aphyrYeah, it did.
01:00bbloomamalloy: http://notepad.mmakowski.com/recursive%20knot
01:01aphyrCan you think of a dumb workaround, or do I need to patch project.clj every time I check out?
01:01bbloomrepmin == replace minimum
01:01bbloomnotice (mn, tr) = walk mn t
01:01technomancyaphyr: how many projects is this?
01:01bbloomcircular laziness :-/ blargh
01:01aphyr1.
01:01technomancy...?
01:01aphyrtechnomancy: just one project
01:01aphyrI'm writing a program that does automated performance regression testing.
01:02technomancyoh, gotcha
01:02aphyrBenchmarks riemann against old versions to compare how different functions changed, that sort of thing
01:02technomancyyou could install a dummy clojure/clojure project that depends on org.clojure/clojure
01:03technomancylein new clojure; cd clojure; sed project.clj *mumbles* ; lein install
01:04amalloysorry, bbloom, those sorts of things give me a headache as well
01:05bbloomyeah, i want to pretty print some stuff & i was pulling my hair out trying to configure the native pretty printer. so i have a "data all the things" style pretty printer, but it's mega slow b/c it recursively recomputes the whole tree over and over again, so i'm trying to implement this linear runtime, bounded space version :-P
01:06bbloomit's fucking complicated lol
01:06bbloombut now i'm determined to finish it.
01:07bbloomi'm almost certain that tomoj is on the right path with r/partiton-by, i'm gonna give that a shot
01:07tomoj:(
01:07tomojwhen you linked to the knot tying I threw my hands up, metaphorically
01:08bbloomtomoj: don't frown! you saved me a wild goose chase down the continuations rabbit hole :-)
01:08aphyrGoot call technomancy, thanks!
01:08aphyr*good
01:09kovaswhat is pretty about the printing?
01:10bbloomkovas: the indentation and line breaks
01:10kovasah
01:10kovassounds like a job for the attribute grammar
01:10kovas:)
01:11kovasi checked out that paper you referred, looks interesting
01:11bbloomkovas: i saw something about that in all my reading, but decided to avoid chasing that particular tail because these very smart folks who wrote these papers manually translated to lazy seqs
01:11bbloomsoooo
01:11bbloomheh
01:11bbloombut i have no idea what an attribute grammar is
01:12bbloombut i suspect that it has something to do with that totally bad ass ometa TCP/IP implementation :-)
01:12bbloombuffers & look ahead as non-deterministic parsing!
01:13kovasmy interpretation is that its a way of annotating a tree with metadata, where the metadata is defined by functions on the relative positions of nodes
01:13kovasso there is a way of passing data around the tree
01:13kovasbut theres probably other ways of looking at it
01:14bbloomkovas: personally, i really like the flattened view of trees
01:14bbloomi find state machines with manual stacks to be much easier to reason about
01:14bbloomand then, gloriously, i can use reductions to print out all the intermediate states of my algoirthm
01:15kovaspretty printing is somehow in the literature as one of the canonical applications
01:15kovashmm
01:15tomojbut there is no reductions for reducers
01:15tomojI have one in a gist somewhere but not sure how good it is
01:15bbloomtomoj: shouldn't be hard to add that too :-P
01:15tomojI used an atom
01:16bbloomtomoj: i think the same strategy as the partition-by patch would work...
01:17tomojhmm https://gist.github.com/543a721f0f44cf48459d
01:19tomojI see someone else did http://dev.clojure.org/jira/browse/CLJ-1113
01:19tomojand they also use an atom
01:19tomojbut they used reducer..
01:19tomojfor some reason I had thought you couldn't use reducer for that
01:19tomojanyway I still haven't figured out how to use something like reducer to get IKVReduce, so :)
01:26yunfanis there any book like "a byte of python" which introduce the basic of clojure programming
01:27tomojwhat shall we do about middleware? :'(
01:27Raynesamalloy: I have found a way to get laser in lazybot. Alert the men.
01:28Raynestomoj: Oh, you.
01:28Raynestomoj: So, I saw you were calling me stupid for some reason last night?
01:28RaynesI couldn't really figure out what you were saying.
01:29tomojI wonder how much of the required ordering of middleware is caused by middleware which unnecessarily destroys information in the request/response
01:29RaynesI was hoping you could elaborate. I don't think I'm stupid, but we should be sure.
01:29tomojI don't think I was calling you stupid
01:29RaynesI think you called me reverse stupid.
01:29tomojmaybe, but only a little :)
01:29RaynesI thought you might have been drunk.
01:30tomojnope, I'm not much of a drinker
01:30RaynesAnyways, so what about the css selectors?
01:31tomojI also find it important to distinguish between calling an idea (reverse) stupid and calling its author (reverse) stupid
01:31tomojwell, why do you want to implement css selectors?
01:31tomojI can maybe imagine there are reasons that would make sense to me
01:31tomojmy point was just, why not use clojure data instead of strings?
01:32Raynestomoj: I really don't want to at all. I'd prefer everybody just use selector functions. I planned to write css selectors when I get bored solely because people are afraid of an extra character or two in their selectors after enlive.
01:32tomoj"reversed stupidity" would be avoiding using clojure data just because enlive did it, and your project is (complement enlive)
01:32RaynesBut I wanted to do real CSS selectors.
01:32RaynesI wanted to do real CSS selectors because it seems like it'd be really cool to be able to copy a selector from your css file right into laser.
01:32tomojbut maybe you have other reasons for avoiding using clojure data
01:33tomojright, that's a reason that makes sense to me to implement css selectors
01:33RaynesBut you can implement both versions.
01:33tomojyeah, plan to :)
01:33tomojwell, not the css, I'll leave that to you
01:33RaynesI plan for it to work like (css "foo.bar") = a selector to give to laser.
01:34tomojyeah, that seems useful
01:34RaynesSo the other version can be done like (enlive [:foo.bar]) or something.
01:34RaynesMostly, I want it to be clear that everything is just functions.
01:34RaynesFunctions functions bloody functions.
01:35tomojyeah, when I first tried laser I appreciated that
01:35tomojbut my thought was more "good foundation" than "I want to always write it this way"
01:35RaynesI don't know why people hate combinators so much. *shrug*
01:36tomojthough I'm still not sure about the foundation, largely because I have mismatched requirements
01:36RaynesIt's weird how people are all like "Functions are great, we should use them for everything" until they get to something to do with HTML, and then it's like "We need 4 DSLs, a new language, and preferably a new toolset to go with it."
01:36Raynes:p
01:37tomojI like combinators, I just think I'd appreciate shortcuts for very common stuff
01:37bbloomtomoj: any idea why the reducers namespace is not found in 1.5.0-RC1 ?
01:37RaynesYeah, I agree. It wasn't a criticism. I think it'll be nice.
01:37bbloomdo i need a particular version of something?
01:38tomojyou either need java, uh, 7 I think, or to add some jsrwhatever to your deps
01:38tomojbut shortcuts should still let you drop stuff done in raw 'bloody functions' directly in
01:39bbloomtomoj: heh i'm on 1.6 i'll find 1.7
01:39Raynestomoj: Anyways, thanks for clarifying. :)
01:40tomojfwiw I was referring to http://lesswrong.com/lw/lw/reversed_stupidity_is_not_intelligence/ — should suggest a weaker interpretation than I can imagine you'd get if you didn't know it was a reference
01:40bbloomis installing the jdk directly from oracle hte recommended thing these days?
01:41tomojare you on a debianish?
01:41bbloomtomoj: osx
01:42tomojcan you even use oracle's java on osx?
01:42bbloomtechnomancy: so make your lein script magically obliterate the need for me to think about oracle :-P
01:42tomojthought you were stuck with apple's
01:42bbloomtomoj: i just downloaded jk-7e9-macosx-x64.dmg from oracle
01:42bbloom*shrug*
01:42tomojhmm, there was an issue about this
01:42bbloomdammit.
01:43tomojhttps://groups.google.com/d/topic/clojure-dev/um5f3p4KsXU/discussion
01:43bbloomseems to work :-)
01:43bbloomi'm back up and running & have reducers now
01:43technomancybbloom: can't fight the OS
01:43bbloomtechnomancy: sure you can! you just aren't likely to win
01:44technomancyI'm content to just make fun of the bad guys on IRC
01:51tomojso part of the problem with middleware is that dependencies aren't encoded anywhere except in the code
01:51bbloomtomoj: so i think a reducer + an atom like you did for reductions = a state transducer
01:52tomojsweet
01:52technomancybbloom: last I checked openjdk on OS X is kind of a train wreck
01:52tomojshould I know what "transducer" means?
01:52bbloomtechnomancy: oh yeah, completely
01:52bbloomtomoj: no lol
01:52bbloomhttp://en.wikipedia.org/wiki/Finite_state_transducer
01:52bbloomtomoj: i guess the idea is that it's a reducer type thing, but at each step of the way, there is also a state that gets threaded through
01:52bbloomwhich is what i need
01:53tomojah, yes I should, but I never took automata
01:53bbloomme neither really
01:53bbloomanyway, if you view a tranducer as a machine on an assembly line, you can glue a bunch of them together
01:54bbloomthey are like reducers in that sense
01:54bbloomand, like reducers, the input conveyer belt and the output conveyer belt aren't necessarily running at the same speed
01:54tomojand the reducer api can implement them and works seamlessly with them?
01:54bbloomi guess if you just add an atom, then yeah, that's what you've got: a stateful transducer
01:55bbloomalthough, in theory, you could do it without an atom if you had a r/map-state type function which took some (f state x) instead of just (f x)
01:55bbloombut also needs to return [state' x'] instead of just x'
01:56tomojreminds me of zip folding
01:56tomojwhich can apparently be implemented with cps
01:56tomojI still don't understand oleg
01:56bbloomand then you start getting into arrows... the generalization of monads... *head explodes*
01:57bbloomwho'd have guessed that pretty printing was so complicated? lol
01:57tomojI've kept my head from exploding so far by blindly trusting conal's dislike of arrows (for frp at least...)
01:57tomojI guess it will have to explode someday :(
01:57aphyrRaynes: props for conch, BTW. Just found myself reinventing it.
01:57bbloomFRP is a totally separate conversation :-P
01:57tomojyeah, but that's the only reason I have to care about arrows right now
01:58tomojer, s/zip folding/fold zipping/
02:07tomojRäynes: xml->'s selectors are functions (Loc -> (U Loc [Loc] Bool nil))
02:07tomoja problem is that it requires that funky macro
02:08tomojwhere (Loc -> Bool) is more straightforward to compose
02:08tomojbut it occurs to me that maybe xml->'s style of composition is like kleisli composition of a selector monad
02:11bbloomhmm that's annoying. defcurried is private ?
02:11aphyrRaynes: I don't understand how me.raynes.conch, conch, the docs, and the current github master relate to one another, though
02:11aphyrthey all seem to have very different structure
02:12tomojit is annoying
02:12tomojalso rfn
02:15bbloomcurried functions are kinda ugly in clojure :-/
02:16ro_stwhat's the diff between curried fns and partials?
02:16eggheadcurried is one at a time
02:16eggheadspecial case of partial
02:17tomojhmm
02:17ro_stah so (curry + 1) vs (partial + 1 2) ?
02:18tomojno, (curry +)
02:18tomojsay (= 3 (((curry +) 1) 2))
02:18tomojwhich only makes sense if you treat + as binary
02:19tomojso you could write (def ^{...} map #(partial (fn [f coll] ..) %)) or something?
02:20ro_styogthos|away: great work with luminus!
02:20tomojbut you really just write (defn map ([f] (partial map f)) ([f coll] ...)) or (def map (curry (fn [f coll] ...))) or (defcurried map [f coll] ...)
02:25bbloomtomoj: so both take & drop are stateful w/ atoms
02:26tomojyeah
02:26tomojshould your thing be foldable?
02:26bbloomtomoj: no
02:26tomojoh well
02:26tomojseems like trees should be foldable
02:26bbloombut i'm printing it to a non-tree shaped terminal :-P
02:27aphyrUh, this is probably a terrible question, but does anyone know how to correctly stop 'lein run'?
02:27tomojoh, sure
02:27aphyrI've just discovered that Process.destroy is useless for subprocesses and there's apparently no way to get a pid out of a Process object
02:33bbloomtomoj: it is extremely non-obvious how to write a reducer... heh
02:41bbloomtomoj: so f1 is the "next reducer"?
02:42tomojf1 is the monoid you finally pass to reduce
02:42tomojI call it "the reducef"
02:43tomoj(perhaps I should have written "reductionsf" and "reducef", not "reducef" and "f1"
02:44bbloomi must be tired, but i'm having a hard time making sense of this...
02:44bbloomwhat is the k/v impl ?
02:44tomojwhich code are you looking at?
02:44bbloomreducers.clj
02:44tomojwell, kv is not really applicable to you I don't think
02:45tomojyou can (reduce-kv (fn [ret k v] ...) init a-map)
02:45tomojbut none of the reducer combinators preserve IKVReduce, so you can't do anything else with it
02:45tomojit's just for faster reduce over maps right now
02:45bbloomi don't have a kv reduction
02:46bbloomso is that just noise at this point?
02:46Raynesaphyr: I probably forgot to push, I guess.
02:46tomojyeah
02:46tomojyou don't need IKVReduce so you can ignore it
02:47bbloomso basically i want a version of map, that i'll call transduce, that takes an initial state and threads the state through
02:47bbloomrfn says "3-arity" but mine has an extra argument: init
02:47bbloomso presumably i can't use rfn ?
02:47bbloomand wouldn't want to anyway, since i don't have a k/v impl
02:47tomojah
02:47tomojwell, yes
02:47Raynesaphyr: Just fixed it.
02:47tomojthe fact that rfn does something about kv is a total red herring
02:48Raynesaphyr: And thanks! Glad you like it.
02:48bbloomtomoj: yeah, confusing the hell out of me lol
02:48aphyrRaynes: cool. Stuck trying to get a real pid out of a Process now.
02:48tomojI've posted about that and created a ticket but got not one peep from anybody
02:48aphyrAbout to pull in JNA, wish me luck. D-:
02:48tomojexcept ämalloy saying he thought it was an accidental omission
02:48Raynesaphyr: You definitely can't from Java itself.
02:48Raynesaphyr: I wouldn't do that.
02:49Raynesaphyr: I'd just write a little script in bash, python, ruby, etc, and shell out to it if any way possibly.
02:49Raynespossible*
02:49tomojI think really rich has already thought about everything I've thought about around IKVReduce, and he knows that it needs more hammock time
02:49tomojand it was an intentional omission
02:49tomojwith rfn being partly half-baked
02:50Raynesaphyr: Or do what ol' Rich advocates and write a service with an API that you can call from Clojure. ;)
02:50tomojbut anyway
02:50bbloomheh ok, i'm getting closer :-P
02:51aphyrRaynes: Yeah, problem is I'm trying to benchmark a whole process running in lein
02:51aphyrand lein starts a subprocess... which can't be killed
02:51aphyrbecause process.destroy considers child processes irrelevant or something (do they become zombies? what kind of acid were they on?)
02:51bbloomtomoj: and i'm understanding why defcurried and rfn are private: i don't want them lol
02:51aphyrTurns out you can snarf it with reflection, at least on linux
02:51RaynesUgh, yeah.
02:52tomojare you using reducer?
02:52bbloomwell maybe defcurried
02:52bbloomi'm trying to decide if i want to use reducer now
02:52bbloomi don't think i do
02:53tomojif you use reducer (which is public) for an operation, then rfn would be useful, if not for the kv noise
02:54tomoj(which, I'll emphasize, is also 100% noise in reducers.clj)
02:54bbloomso i'm trying to decide what to do about the two overloads of coll-reduce
02:55bblooms/decide/understand
02:55tomojthe [coll f] arity is for people who call clojure.core/reduce and don't pass an initial state
02:55tomojif you call clojure.core.reducers/reduce and don't pass an initial state, the initial state is (f)
02:56tomojwhich is why rfn is somewhat useful, to automatically preserve the zero arity of a transformed reducef
02:56tomoj(i.e. the identity of the monoid)
02:56bbloomisn't the monoid only relevant when foldable?
02:56bbloomi don't think i have a monoid in my case b/c i have a linear state
02:57bbloom& am not foldable
02:57lazybotjava.lang.RuntimeException: Unable to resolve symbol: am in this context
02:57tomojit's also used when you just r/reduce without an initial value
02:57tomoje.g. (r/reduce + [1 2 3]) calls (+ 0 1) first
02:57tomoj(+ (+) 1) that is
02:58tomojso if you use r/reduce, you have to care about preserving the monoid identity
02:58tomojr/reduce without an explicitly provided initial value, that is..
02:58bbloomi want to require that callers of transduce provide an initial state
02:58tomojsure, that's different
02:59tomojtransduce won't actually do any reduction, right? it just returns a reducer
02:59bbloomso should i only implement the [coll f init] variant?
02:59bbloomright
02:59tomojyou want (reduce f (transduce r)) to be illegal?
03:00tomoj(and (r/reduce f (transduce r)) to be legal only if (f) is legal?)
03:00tomoj(as always..)
03:00bbloomso transduce takes three arguments: [f init seq]
03:00Ember-http://arstechnica.com/security/2013/01/extremely-crtical-ruby-on-rails-bug-threatens-more-than-200000-sites/
03:00amalloyis it the mass-assignment thing being reported again?
03:01bbloomor i guess [f init non-foldable-reducer]
03:01bbloomamalloy: nah, it's some new nonsense with an injection flaw or something
03:01Ember-amalloy: dunno, but that bug allows you to execute arbitrary code on the underlaying server
03:02aphyramalloy: there are a bunch of default deserializers in the rails body handlers
03:02aphyrincluding yaml, which includes a syntax for creating arbitrary instaces of any class and setting instance vars
03:02aphyrtl;dr stop automatically coercing strings to arbitrary datatypes
03:03bbloomlol
03:03bbloomyaml always struck me as such a silly idea
03:04bbloom"It's like XML, only with syntax that's nearly impossible to generate programatically!"
03:04aphyrI can't even generate it by hand. ;-)
03:04ro_stYou Avoid Markup Language
03:06aphyrRaynes: I can add (pid process) to conch if you're interested
03:07aphyrbut in order to be portable to windows I think I'll have to pull in JNA
03:07bbloomtomoj: i think i'm just incapable of following the flow of code where the order of arguments matters. i can *never* remember the order of the arguments to reduce and always need to check the docs. i need a language where all functions accept and return a map :-P
03:08Raynesaphyr: Is it a large dependency?
03:08aphyrJNA? yeah. :(
03:09amalloybbloom: it's pretty easy to remember what order reduce takes its arguments in if you imagine trying to add together a bunch of numbers. like, (reduce 0 + coll)? no, the function must come first or it reads bizarrely. (reduce + coll 0)? that feels pretty awkward. (reduce + 0 coll)? aha, we're adding to zero all the things in coll
03:10bbloomamalloy: i can always remember that coll comes last because it's the least likely thing to be partially applied, so it makes sense to have it last. it's just the first two arguments i always mess up because i think "init == first"
03:10bbloom:-P
03:11Raynesaphyr: How does JNA work. Does it use native dependencies or something?
03:12bbloomamalloy: also i *hate* when functions don't come last in javascript/coffeescript, since partial application is rare there and coffeescript just makes it so nice to have indented callbacks.... setTimeout is evil in that respect
03:13bbloom98% of the time, the order of arguments has zero semantic meaning too, hence maps are just so pleasant for business logic
03:15Raynesaphyr: Okay, so here is what I think.
03:16Raynesaphyr: It looks like JNA automatically extracts its native library and does whatever with it itself. I think it'd be best to add a dependency on pomegranate and automatically add JNA to the classpath if someone calls the pid function.
03:16Raynesaphyr: If you don't want to go through that trouble, just write the pid function and I'll handle the pomegranate stuff.
03:16tomojbbloom: interesting
03:17tomojI've wondered what it would be like to put map entries on the factor stack
03:17tomojor, factjor
03:17tomojand treat the entire stack as a map
03:17bbloomtomoj: i thought about that briefly and then realized that it's basically just dynamic variables lol
03:18tomojif you do normal stack stuff under (on top of?) the map entries?
03:18tomojs/stack stuff/factjor words/
03:19Raynesaphyr: I'm going to give it all a bit more thought though. Another option is to add the dependency, but don't actually define the function unless the dependency is present which would allow people to exclude the dependency.
03:19bbloomtomoj: http://docs.factorcode.org/content/article-namespaces.html
03:19RaynesThat might be the better idea.
03:19RaynesI don't think most people are going to care about the extra dependency.
03:19tomojah yes!
03:20tomojI also want a word that takes the entire frame and reifies it into a map
03:20tomoj(the entire "implicit assoc")
03:20tomojand maybe one that takes a map and makes that the implicit assoc
03:20Raynesaphyr: Yeah, we should do that. Ignore everything else I said.
03:20tomojoh.. http://docs.factorcode.org/content/article-namespaces-combinators.html ??
03:20lazybottomoj: Uh, no. Why would you even ask?
03:21Raynesaphyr: Still though, if you want you can just write the pid function and I'll do the other stuff.
03:22aphyrok
03:22aphyrsorry, busy screaming into the JVM void
03:24bbloomtomoj: clojure has similar operators: bound-fn, push-stack-bindings, pop-stack-bindings, get-stack-bindings, etc
03:24bbloomit's actually quite amazing how much clojure & factor have in common
03:27bbloomanyway tomoj thanks for helping me think through this a bit
03:27tomojhttp://tech.groups.yahoo.com/group/concatenative/message/2762
03:28tomojI don't think I really want concatenative logic programs anyway, I just had to google for it
03:29bbloomhaha
03:29bbloomi think it's one of these things where you use the right paradigm for the problem at hand
03:29bbloommy interest in concatenative programming, and the motivation for creating factjor, was so that i can serialize side effects
03:29tomojbut I think maybe it would be nice to have a word that takes a quotation, looks at metadata on the words in the quotation and rewrites the quotation using a simple logic program on the metadata
03:30bbloomin particular because i want to diff two tree structures and output a program to be executed against the DOM
03:30bbloomwhich is what my talk at Clojure/West will be about! :-)
03:30tomojshoot
03:30bbloomtomoj: quotation transformations & pattern matching are pretty cool too
03:31bbloomtomoj: see factorcode.org/littledan/match.pdf
03:31bbloomill be back in a little while
03:32tomojdon't think I'll get to see your talk — are the two tree structures two versions of a model?
03:33tomojtwo uh, abstract markup trees?
03:33tomojor what
03:49tomojhmm http://i.imgur.com/i2MRN.png
03:50tomojthe magic seems to leak out of clj-http.core/request
03:50tomojso clj-http-lite can't use it
03:50tomojwhereas ring has different servers that don't leak?
03:51tomojoops, there should be magic on the ring side too
03:51tomojbut it doesn't leak out of the ring server
03:51tomoj(I think?)
03:53tomojwell, clj-http-lite wouldn't use clj-http.core/request anyway, it'd provide it's own client, obviously
04:42bbloomtomoj: k i'm back & i got transduce working, but i'm calling it map-state
04:43bbloompretty much all of my problems were caused by defcurried expecting a meta data map & rfn not being what i want... i guess i deserve that for using private macros :-P
04:43tomojexample of calling it?
04:46bbloomtomoj: here's a trivial example where it's used similarly to map-indexed
04:47bbloomhttps://www.refheap.com/paste/8269
04:47bbloomthat produces [0 1/2 2/3 3/4 4/5]
04:48tomojI see
04:48bbloomindex == state
04:49bbloomin my actual case, i'm gonna be keeping a running some of some property of each x and associating that into the next x
04:49tomojthat looks like reductions with a post-step?
04:49tomojwhere the post-step is (ret 1)
04:49bbloomtomoj: https://www.refheap.com/paste/8270
04:49bbloomnote that is a modified version of defcurried that doesn't expect metadata
04:50bbloomthis would be trivial as a lazy-seq, but i need access to that f1 function so that the producers/consumers are interleaved
04:51bbloomthat's the interesting thing about the reducers: with lazy seqs (->> coll (map f) (map g)) is not the same as (->> coll (map (comp g f)))
04:51bbloombut with reducers, they are!
04:52bbloomthe f and g calls are interleaved in a way that is useful to prevent my buffers from bloating
04:54tomojthere's a difference in a trace of f and g calls?
04:54tomoj(with lazy seqs)
04:54tomojguess that's easy to determine
04:55bbloomyeah, there are several sources of non determinism in call order
04:55bbloomone is chunking
04:55tomojoh, heh
04:55bbloomanother is the fact that somebody has to be on the other side to pull on the seq to have it realized
04:56bbloomand like i said, it's possible to do what i'm trying to do with lazy-seqs
04:56bbloombut it requires that "tying the knot" thing
04:56bbloomwhere you feed the lazy seq into a computation that produces another lazy seq in a circular way
04:57bbloomwhich is precisely how haskell got it's reputation for "space leaks" :-P
04:57tomojso what are the trees?
04:57bbloomthey are little "pretty print documents"
04:58tomojoh right
04:58tomojI forgot you were talking about concatenative when you said DOM
04:58bbloomyeah two separate projects :-P this one turned out to be a big distraction
04:58bbloombut that's ok for at least another month until i need money :-P
04:59abpSo for a web app I've wrapped my handler in a middleware that always takes the first uri segment as :context. That's just for lein-ring to behave like deployed in a servlet-container with a context (/context/...) when testing locally. Also I use hiccups wrap-base-url middleware to obtain correct links etc. via (to-uri ..). Does that sound way to hacky? Is there a "better" way?
05:00bbloomtomoj: ok so now the tricky part: the buffering reducer! gotta figure that out
05:01wingymaybe someone should create a hosting platform for clojure apps like nodejitsu for node.js app? :)
05:01tomojbbloom: well, hmm
05:02ro_stwingy: heroku is plenty good enough
05:02tomojI thought I had an idea but it was wrong, nevermind
05:03bbloomtomoj: so i'm thinking back to rich's talk with the three use cases: 1-to-1 1-to-more and many-to-fewer
05:03tomojsorry, which talk?
05:03bbloomabout reducers
05:03bbloomhe talks about map, filter, and mapcat as being examples of those three use cases
05:04wingyro_st: it doesn't support immutant though :/
05:04bbloomin my case, it's a 1-to-1 mapping when all is said and done, but along the way it's sometimes many-to-none and other times 1-to-many, ie when buffering or when unbuffering
05:05bbloomin theory, when buffering, i just don't call f1
05:05bbloomand when unbuffering, i call reduce with f1
05:05bbloomright?
05:05clojurebotto be fair I dunno that I've ever had code out right rejected, it just sits in jira or assembla or where ever, or if I ask if there is any interest (before writing any code) I get told to go write alioth benchmarks
05:05bbloomshutup bot
05:05tomoj"unbuffering" means like, uh, "nonbuffering"?
05:05marianoguerraa simpler function to do (partition 2 (interleave [:a :b] [1 2])) ?
05:05bbloomunbuffering means draining the buffer to empty and passing all those items along (transformed) to the next reducer
05:06tomojmarianoguerra: (partial map list)
05:06ro_stwingy: i doubt a clojistu would, either :-)
05:06bbloom,(map vector [:a :b] [1 2])
05:06wingyro_st: it would!
05:06clojurebot([:a 1] [:b 2])
05:06tomojoh, I see
05:07tomojyeah.. use map vector instead
05:07tomojI just blindly chose something that printed the same
05:07bbloomtomoj: so notice how partition-by sometimes does not call f1
05:07bbloomthat's buffering
05:07echo-areaSo is gen-class currently not able to generate <clinit>?
05:07bbloomtomoj: then, it doesn't drain the buffer, it passes the whole buffer (a vector) to f1
05:08bbloomin my case, i'd just reduce that buffer with f1, which would be like mapcat
05:08tomojreturning a single result for that begin element
05:08tomoj?
05:08echo-areaI mean customized <clinit>
05:08tomojer, no, f1 is a reducef
05:08bbloomtomoj: look at the definition of mapcat, notice how it calls (reduce f1 ret ...
05:08echo-areaIt can only put var initialization and ns loading code into <clinit>
05:08tomojyeah
05:09echo-areaIs this the fact?
05:09tomoj(btw, don't return a map from your mapcat f!)
05:09bbloomthat "sub-reduce" is going to call f1 multiple times
05:09bbloomheh
05:11tomojsuppose there were a (nexts r) that returned a reducer of reducers, each successive reducer omitting the first value of the previous
05:11marianoguerratomoj, bbloom thanks!
05:12tomojthen could you write part of that with (mapcat #(if-let [buffer (buffer-for %)] buffer [%]) (nexts r)) ?
05:13tomojmaybe throw some #'first in there
05:15bbloomoooh i think i know, i want mapcat-state basically...
05:22bbloom,(conj! nil 1)
05:22clojurebot#<NullPointerException java.lang.NullPointerException>
05:22bbloom,(conj nil 1)
05:22bbloomhmmm
05:22clojurebot(1)
05:24tomoj&((fnil conj []) nil 1) ; ?
05:24lazybot⇒ [1]
05:25tomojthis reducers talk is 5mo old, I hadn't seen it
05:25tomojthanks
05:25bbloomit's a good 1
05:28bbloomtomoj: sweet, i got it!
05:28bbloomtomoj: https://www.refheap.com/paste/8271
05:29bbloomthat second commented form, the mapcat-state, that one produces [0 1 2 3 4]
05:29tomojinteresting.. map should be collection ignorant
05:29tomojthat's exactly what I want
05:29tomojbut I want it to work for e.g. push seqs too :(
05:30tomojhell I just want fmap
05:31bbloomyeah, i gotta fix that
05:31bbloommapcat-state shouldn't take the []
05:31bbloomoh no
05:31bbloomnevermind
05:31bbloomthat's the state
05:31bbloomit's the buffer
05:31bbloomin a larger use case, that's gonna be something like {:foo 1 :bar 2 :buffer (double-list)}
05:31bbloomheh
05:33bbloomdoc string: "Like mapcat, but threads a state through the sequence of transformations. For each x in coll, f is applied to [state x] and should return [state' xs]. The result is the concatenation of each returned xs."
05:34bbloomanyway, i think i now officially grok reducers, which is cool
05:35tomojis it possible to break mapcat-state up and get correct results, if bad performance
05:35bbloombreak it up how?
05:35tomojI mean break it up into operators that look fairly like standard reducer operators or ports of standard clojure functions
05:36tomoj(ports into reducer-land)
05:36bbloomyeah, so the goal is to produce a pretty printer that has linear runtime and bounded memory requirements
05:36tomojI'd be interested to see if there's a way to get good perf from code that looks awfully like a standard port
05:37bbloomyou can write a trivial recursive function and get N^2 runtime
05:37bbloomthe naive implementation re-calculates the width of every branch of the tree every time it goes
05:38tomojbut what might it look like in vague reducer terms?
05:38bbloomusing reducers (or co-routines, or continuations, or cyclic lazy-seqs) gives you a way of accomplishing a single traversal with bounded memory
05:38tomojah, is there a paper?
05:39tomojright: http://okmij.org/ftp/continuations/PPYield/yield-pp.pdf ?
05:39bbloomyeah
05:39bbloomif you follow the paper trail back, there are like 4 or 5 along the way until you get to the pretty printer that's in common lisp which is the basis for clojure's :-)
05:41bbloomtomoj: seriously, thanks a lot for talking this out with me
05:41bbloomyou helped a ton
05:42tomojhmm.. do the reader monad and the (-> env) applicative overlap?
05:42tomoj((->) env) I guess
05:42bbloomi'm not even sure what that means :-P
05:42bbloomi'm one of those people who's just smart enough to accomplish tasks eloquently by being too dumb to comprehend all the complicated shit that people have come up with :-)
05:44tomojnewtype Reader r a = Reader { runReader :: r -> a }
05:44tomojso I think that means Reader r a is a funny name for (r -> a)
05:44bbloomi dunno what Reader is
05:46ejacksontomoj, I think it means that Reader is a function from r -> a, where r implements the runReader
05:46ejacksonbut that's dredging
05:46arcatanit's essentially a funny name for (r -> a)
05:47ejackson:)
05:47tomojbut does the Applicative instance for (r -> a) agree?
05:47arcatanyou can use runReader to get out the (r -> a) of a Reader
05:47tomojI don't really know what Reader is either, otherwise I'd know the answer
05:47Sgeo_tomoj, yes, reader and ((->) r) are conceptually the same
05:48Sgeo_Conceptually with reader, and physically with functions, you're building a function that takes an input and produces a value
05:48Sonderbladewhat is the most popular clojure web framework? compojure?
05:49tomojso ring middleware is sort of in the reader monad
05:49ejacksonSonderblade: yes,
05:50Sgeo_tomoj, that sounds likely
05:50Sgeo_I remember looking at Enlive and when seeing do->, just thinking "reader monad"
05:50tomojthe applicative <$> for (r -> a) is just composition
05:51tomojof course
05:51Sgeo_tomoj, yes
05:53tomojfmap :: (Res -> Res') -> (Req -> Res) -> (Req -> Res')
05:54bbloomi seriously have a really hard time with all the operators in haskell
05:54tomojme too
05:54bbloomit makes these papers harder to read
05:54tomojI meant <*> above, but I was wrong
05:54bbloomi'm very auditory in my thinking
05:54bbloomi don't know how to say <*>
05:55bbloomeven if i knew what it was called, it would be a mouthful, too much to say
05:55bbloomif i can't read it aloud quickly, i can't understand it
05:55tomojwell, [[ f a b ]] is nice shorthand for f <$> a <*> b
05:55bbloomyeah, i don't know what either of those things are supposed to do
05:55bbloomlol
05:55tomojit's just (f a b) but.. inside the applicative
05:56Sgeo_bbloom, it's a convenient way of using functions that don't understand an Applicative with arguments that are in one, sort of
05:56bbloomSgeo_: that doesn't help me lol
05:57bbloomi forget what "Applicative" means every time i see it
05:57Sgeo_bbloom, do you know anything about monads?
05:57bblooma fair amount
05:57RaynesWhen did #clojure turn into #haskell?
05:57Sgeo_It means it defines <*> and pure
05:57Sgeo_Raynes, not my fault this time!
05:57tomojlet's see.. (<*>) :: (Req -> (Res -> Res')) -> (Req -> Res) -> (Req -> Res')
05:57bbloomRaynes: sorry man, i'm trying to bring a better pretty printer to the clojure masses... and haskell has the fastest one :-P
05:58Raynesbbloom: :p
05:58tomoj[[ ]] :: (Res -> Res') -> (Req -> Res) -> (Req -> Res')
05:58tomojwhich is flip (.)
05:58tomojyes?
05:58clojurebotyes isn't is
05:58Sgeo_bbloom, say I have something like getNumFromInput :: IO Int
05:58bbloomRaynes: you do want a faster pretty printer, don't you? one fast enough that you wouldn't mind using it for dumping large files? :-)
05:58Sgeo_And I want to add two numbers from input together
05:59Sgeo_(Ok, this is an example of use, not an explanation of what it is)
05:59Raynesbbloom: I've never wanted to do that, but of course, fast is good.
05:59Sgeo_In do notation, I might write
05:59th3lib\quit
05:59Sgeo_do { a <- getNumFromInput; b <- getNumFromInput; return (a + b) }
05:59tomojwait, that's just (.)..
05:59tomojnaturally
05:59tomoj$( so confusing
05:59amalloytomoj: you are trying to produce type signatures for...what? it sounded like you were saying ring middlewares, but that didn't look like the right type for those
05:59Sgeo_Which will be an IO Int, that takes two numbers from input and gives the result
06:00bbloomSgeo_: i appreciate you trying to help, but i don't have the mental capacity for that now
06:00tomojhmm, right
06:00Sgeo_Since IO is an Applicative (all monads are theoretically Applicatives, even if this isn't enforced in Haskell)
06:00bbloomSgeo_: too many new ideas for what was supposed to be a simple side project!
06:00Sgeo_I could instead write (+) <$> getNumFromInput <*> getNumFromInput
06:00tomoja ring middleware is sort of like (Req -> Res) -> (Req -> Res')
06:01Sgeo_Just like using (+) "normally", except <$> and <*> do plumbing stuff to handle the IO
06:01amalloywell, it's more like (Req -> Res) -> (Req' -> Res'), i think
06:02tomojoh yeah
06:03tomojso not so close to the reader monad
06:04amalloyreader isn't one of the ones that i keep room in my head for, so i couldn't say
06:04Raynesamalloy: Hahaha. I love you, man. Every time you say something like that, I remember that "EVERYBODY STAND BACK. I KNOW PERL." xkcd.
06:04tomojso fmap for ((->) ((->) Req Res)) is composition
06:05tomojwhich doesn't seem important
06:05amalloyeh?
06:05tomojheh, ((->) (Req -> Res))
06:09amalloytomoj: that notation has always confused me, and i think it just made sense to me (again, probably). is it the case that (->) is a two-argument type constructor, and by applying it to the type (Req -> Res) you get back a one-argument type constructor?
06:09tomojyeah
06:10tomojer, I think
06:10tomojit just means (Req -> Res) -> anything as I understand it
06:10amalloyright
06:10Sgeo_<Jafet> @quote analogies
06:10Sgeo_<lambdabot> mmorrow says: a functor is like an analogy between two analogies
06:10tomojI don't ever actually use haskell
06:10amalloyi am forever forgetting that type constructors exist; it's all just magic
06:10amalloyoh, same here
06:11amalloyanyway, i am going to bed. enjoy your haskelling
06:11Raynesamalloy: Good night, handsome.
06:45tomojhaha "there's a notion in fancy land — monoids"
06:51Raynes@latest me.raynes/laser
06:51Raynes$latest me.raynes/laser
06:51lazybot[me.raynes/laser "0.1.15"] -- https://clojars.org/me.raynes/laser
06:56tomojre-class? :)
07:25Raynestomoj: I was wondering it was worth adding.
07:26RaynesSince it's just (re-attr :class re)
07:26RaynesBut id= exists too.
07:27RaynesI'll probably add re-id and re-class. I'll sleep on it. ;)
07:31tomojbut it's not
07:31tomojclass= does extra, re-class should too
07:31tomojI'd think
07:31tomoji.e. split on spaces
07:32Raynestomoj: I don't really see why it'd need to do that
07:32tomojwell, guess you're right
07:32RaynesI'm trying to think of a case where it'd be necessary.
07:32RaynesHave one in mind?
07:33tomojintuitively I expect to be able to do e.g. (re-class #"^foo-\d+$")
07:33tomojbut it'd be easy to write the regex for the whole attr too I'm sure
07:34RaynesThat's a fair point.
07:34RaynesConsidering I suck at regex, I'd probably have trouble figuring that one out for a bit.
07:35RaynesI'll throw that in there tomorrow.
07:35RaynesRaynes is about to pass out.
07:35RaynesNight #clojure.
07:36hyPiRionRaynes: night. sleep well, prince.
07:49clgvoh "$latest" is nice^^
07:49clgvis there a lazybot irc function that lists all its commands?
07:50bbloom$google github lazybot
07:50bbloom$google "github lazybot"
07:50bbloomclgv: you get the idea, heh
07:52clgvbbloom: hm no, parsing the source is too much work. some things are not even activated on this instance
07:52clgvbbloom: I tried that in the apst
07:52clgv*past
08:59josteinkhttp://landoflisp.com/#guilds
09:08no7hingfor "foo bar baz" (clojure.string/split message-body #" " 2) returns [foo (bar baz)] where the second element is a chunked sequence where (rest …) should work?
09:08no7hing"foo bar baz"/message-body
09:09no7hingsorry, rest works, but following string operations don't
09:10no7hingso (str my-chunked-seq) is necessary?
09:11no7hingsorry i was confused
09:14ForNeVeRHello, guys. Is clojars down or something? I got the following error when using `lein push`: http://paste.org.ru/?lk4en3
09:14wingyhow do ring handle favicon.ico requests/
09:14wingy?
09:14clojurebotExcuse me?
09:14weavejesterwingy: The same way it handles any other request
09:15hyPiRionwingy: just put a favicon within resources or publics folder
09:16hyPiRionForNeVeR: Using lein1?
09:16ForNeVeRhyPiRion: lein2.
09:17ForNeVeRWill it help if I'll use lein1?
09:17hyPiRionHmm, I've not heard about `lein push` before.
09:18hyPiRionI usually do `lein deploy`
09:18ForNeVeRhyPiRion: it is plugin especially for clojars.
09:18hyPiRionoh, okay.
09:18ForNeVeRhttps://github.com/ato/lein-clojars
09:18ForNeVeRI had an issue with gpg, so cannot use `lein deploy`.
09:19hyPiRionBut I know that technomancy and _ato is working on a new Clojar release, so that may be it
09:19ForNeVeRWhat a pity.
09:20hyPiRionI'd have a look at lein-clojars/clojars-web and check out if there's any issue describing your case
09:21ForNeVeRWell, I don't know if it is really clojars or just my setup / environment.
09:21weavejesterlein push is pretty much the old way of doing things
09:21weavejesterlein deploy clojars should be preferred
09:21wingyhyPiRion: worked :)
09:21ForNeVeRIssue lists of mentioned projects don't include sqlexception.
09:22ForNeVeRweavejester: is uses `gpg` tool in some way.
09:22hyPiRionwingy: sweet!
09:22ForNeVeRAnd gpg literally suck.
09:22weavejesterForNeVeR: In what way?
09:22ForNeVeRIt just stays in the process list and does anything.
09:23ForNeVeRBut i'll try to do something with it now.
09:23weavejesterForNeVeR: You mean the gpg-agent?
09:23weavejesterForNeVeR: Which OS are you using?
09:23ForNeVeRweavejester: Windows ~_~
09:23weavejesterOhhh
09:24ForNeVeRYeah, that is the real problem :)
09:24hyPiRionLein isn't that well tested on Windows unfortunately
09:24ForNeVeRBoth lein versions work great.
09:25ForNeVeRI have only this silli deployment issue.
09:26hyPiRionYou could try out the scp way of deploying
09:26hyPiRionnot sure what Windows tool you would use then though.
09:26ForNeVeRI sure windows has ported scp tool.
09:26Sgeo_Oh, not as in Secure Contain Protect?
09:27ForNeVeRscp-682, yeah.
09:27ForNeVeRI'll use it.
09:27hyPiRionSgeo_: secure copy :p
09:28ForNeVeRThere is some winscp utility.
09:34ForNeVeRscp way produces the same error.
09:35xeqiForNeVeR: hmm, technomancy was deploying a new version a few hours ago, looks like migration wasn't run
09:35ForNeVeRShould I notify somebody?
09:36xeqilooking at it now
09:39xeqiForNeVeR: can you try to deploy again please?
09:39hyPiRionxeqi: that was fast.
09:40ForNeVeRxeqi: minute please
09:40ForNeVeRSuccess!
09:40xeqihurray
09:41ForNeVeRxeqi: thank you for fast feedback :)
09:42hyPiRion(inc xeqi)
09:42lazybot⇒ 5
09:43Sgeo_I should really re-read SCP-093 and assocated logs
09:44Sgeo_Hmm, does Heroku rely on RoR?
09:44p_lyes
09:44Sgeo_:/
09:45Sgeo_Do web programmers ever need to be on call or work in shifts?
09:45Sgeo_For a situation such as this
09:48xeqiSgeo_: usually there is a op or dev-ops team that has rotates who is on call
09:53p_lSgeo_: good companies like that have on-call teams
09:53p_land in such case, probably takes even those that weren't on-call
09:54Sgeo_:/
09:56nDuffSgeo_: Typically ops-on-call can escalate to development for serious critsits.
09:57Sgeo_Well, so much for my idea that an advantage of becoming a programmer over a doctor is never being in an emergency
09:57Sgeo_(I'd still be terrified to have someone's life in my hands)
09:57nDuffSgeo_: ...well, if you're not senior enough to be the developer that issues get escalated to, it's moot. :)
09:57ro_stsecond that.
09:59nDuffSgeo_: ...in my experience that's a whole lot of senior -- as in, you're getting golden handcuffs in a buyout -- so there's compensation for being "on-call".
10:00Sgeo_golden handcuffs?
10:00nDuffSgeo_: A contract with a substantial monetary award, contingent on you remaining with the company for a set duration of time. Typically part of of it is paid up-front or over time, and has to be repaid should you leave of your own volition (or for-cause) before end of the contract.
10:02nDuffSgeo_: Those happen pretty frequently as part of an acquisition, as it's undesirable for the people who know and operate the thing you just paid a whole lot of money for to cash out and leave.
10:03hyPiRionyeah, usually you'd like some continuity and exchange experience/knowledge.
10:05Sgeo_nDuff, not anymore. Graduated in December
10:05Sgeo_Not sure what I'm going to do now
10:05hyPiRionSgeo_: Clojure.
10:05hyPiRion:D
10:06Sgeo_hyPiRion, but Racket is fascinating
10:06hyPiRionWell, you can go Racket too if you'd like
10:06hyPiRionI just came up with a suggestion
10:26solussdanyone have any idea what might be causing this clojurescript type error?: TypeError: 'undefined' is not a constructor (evaluating 'new cljs.core.Keyword("\ufdd0'default")'). here's the offending compiled javascript: https://www.refheap.com/paste/8278
10:38solussd^(ignore the error accidentally pasted in the middle of my ref heap paste)
11:00aroemerssolussd: Sorry, I don't see any obvious issues, but then again I don't know Cljs.
11:01solussd:)
11:05TimMcsolussd: And cljs.core.Keyword exists?
11:07jaleyhey all. I have a static map of 1 million string -> integer values. Any tips on the most sensible way to package it into a jar? I dumped it to clojure data as a file in resources and then tried using load-reader to access it. Seems to be quite a slow option...
11:07solussdTimMc: ack, no it's not… wonder why
11:14solussdTimMc: other things in cljs.core are defined, e.g. Vector.
11:14djwonkjaley: you need it in memory from the beginning?
11:16solussdackk.. it's cljs.core.keyword (lowercase k)
11:16jaleydjwonk: yeah. it's test data for a performance/stress test
11:16djwonkI'd like to learn clean/recommended ways to manipulate a map inside an atom. I've used assoc, assoc-in, update-in. Are there some other ways that I should try?
11:17djwonkjaley: how "slow" is loading the data via the clojure reader?
11:17hyPiRiondjwonk: merge, merge-with, select-keys?
11:17hyPiRionGranted, merge-with has to be partial'd.
11:17jaleydjwonk: many minutes
11:18jaleydjwonk: someone just recommended nippy to me, which looks good
11:19djwonkjaley: cool, first I've seen it
11:21djwonkhyPiRion: thanks. the pain I'm feeling is that I have a big 'game' map (for a game, literally) with a bunch of nested stuff. digging into it, changing, returning with changes just in the right parts still feels a little clunky. I suspect I haven't found the best ways yet.
11:23djwonkI have a bunch of variously named functions for manipulating different parts. I guess it is mostly a code organization issue. Maybe I am just so comfortable with how I would write such a thing in Ruby that I'm having to rewire my brain for Clojure?
11:25rseniorlein2 plugin upgrade question - is it possible to wrap a middelware around a plugin you don't own (i.e. compile), or maybe make a prep task that modifies project dependencies (downstream tasks would get the new dependencies)?
11:25hyPiRiondjwonk: Yeah, it takes time to get used to immutability.
11:25djwonkI think part of what I'm getting at is that I naturally used classes to namespace methods so I knew which went with which what. Now with the freedom to namespace, I'm wondering how to do that grouping.
11:26hyPiRionI have a library named fairbrook which does map merging based heaviliy on higher order functions. Not sure if that's useful for you, but you may check it out.
11:27djwonkOne idea is just to pile all functions into one namespace but that gets messy quick.
11:27hyPiRionIt's more to clear up messy map manipulation. You could also check out flatland.useful
11:28hyPiRionThey have some map functions I tend to use at times.
11:28djwonkAnother is to namespace according to the first parameter. I've got a bunch of functions called "add-X-to-Y" just so I'm clear on what part of the data structure they manipulate and what they return.
11:29djwonkhyPiRion: thanks, I've check out fairbrook
11:30djwonkso, to think out load, it might be better to make "game/add-policy" than "add-policy-to-game".
11:30technomancyrsenior: prep tasks are only useful for side-effects unfortunately, not modifying the project map
11:30technomancybut you could have a prep task that called compile itself with a tweaked project map, and if it updated the bytecode right then the real compile would be a no-op
11:31rseniortechnomancy: right, but downstream things, such as test, would not get a the new dependencies
11:32rseniortechnomancy: I'm modifying the dependencies of a project slightly, and I would like downstream thing of this prep-like task to get the new reality
11:32llasramrsenior: It sounds kind of like maybe you just want a profile with the new deps?
11:35ravsterhello everyone
11:35rseniortechnomancy: it's a lein1 plugin I'm upgrading, it sniffs out clj source in jars, compiles it, repackages it, sets a classifier of "compiled", which should then be used rather than the one that contains source
11:36technomancyoh, if the new deps are based on the old deps a profile won't work
11:36technomancya middleware should though
11:36rseniortechnomancy: stops AOT rippling, also doesn't require recompiling each time
11:36technomancyif you haven't voted for the non-transitive AOT ticket in Jira, please go do that first =)
11:37hyPiRionravster: hello
11:37rseniortechnomancy: I think I did a long time ago, but I'll go check :-)
11:37technomancyvote early; vote often
11:37llasramheh
11:37rseniortechnomancy: the problem is, it needs to happen before compilation, and when it does everything that had clojure source in it should have a :classifier added to it
11:38rseniortechnomancy: so middleware around compile would do that, but I'm not sure out to middleware-ize someone elses plugin
11:38rseniorllasram: missed your suggestion, the problem is the dependencies are known at runtime, not ahead of time
11:38ravsterI have in one namespace a '(def foo other-namespace/foo)'. It seems to make that function (foo) accessible in the first namespace. Can I chain that into a third namespace?
11:39technomancymiddleware is just a function; it can do pretty much anything
11:39technomancybbiab
11:39llasramrsenior: Yeah, I saw. Oh well. For the "middleware-izing" -- a hook on the plugin command function?
11:40solussdWhat's the difference between cljs.core.keyword and cljs.core.Keyword (which, the clojurescript compiler emits, but is undefined)?
11:40hyPiRionravster: Not that I know, though you could just do a (:require [other-namespace]) to get it
11:40TimMcsolussd: You probably also don't want "new".
11:41solussdTimMc: it's being generated by the clojurescript compiler. :/
11:46rseniorllasram: tried creating a plugin that hooked compile, and a middleware on that plugin, no luck, I'll keep hacking at it
11:46craigbrowooot
11:47TimMcsolussd: And you just have a :default in your cljs code?
11:48solussdI don't.. it's the domina dom manipulation lib that the code is being generated for--
11:49solussdactually, I think I might have "fixed" it by using a newer version of clojurescript (0.0-1552), had to exclude an older version dragged in by noir-cljs. :D
11:49solussdodd I can't seem to find this being an issue that was fixed.
11:51ravsterhello all
12:43loganlinnwhat's a good way to distribute dependencies internally/privately? i was about to try to setup a private clojars repo… any insight?
12:43nDuffloganlinn: Nothing tricky about running a private Maven instance.
12:44nDuff...actually, you don't even need "server" software/daemons
12:44hiredmanloganlinn: clojars is a maven repo
12:44hiredmana maven repo is just a dumb http server with files in a particular structure
12:44loganlinnok, cool
12:45nDuffloganlinn: http://maven.apache.org/guides/introduction/introduction-to-repositories.html
12:45hiredmanbut if you want bells and whistles I would setup archiva
12:45hiredmanwhich is a sort of caching maven repo
12:45technomancyloganlinn: you can do `lein install file:///tmp/myrepo` and then rsync it to a remote HTTP server
12:46technomancysorry; `lein deploy file:///tmp/myrepo`
12:46loganlinnill start simple. we just have a few shared deps so far
12:46technomancyor deploy to a private S3 bucket if you don't want the admin overhead
12:46hiredmanloganlinn: https://github.com/technomancy/leiningen/blob/master/doc/DEPLOY.md
12:46loganlinnyeah, we were looking at s3-wagon-private
12:46technomancyif you are already running an internal HTTP server I'd recommend sticking with that
12:47loganlinnah, ha. thanks for the links, this should do the trick
12:55callenI would slaughter a thousand goats just to clear my career path of fanatics who devote themselves to religion in software.
12:58scgilardisettle down, callen
12:59callenscgilardi: I am settled.
13:00callentechnomancy: I'd believe you owned one if you lived in Berkeley or Brooklyn instead of the PNW.
13:01hyPiRioncallen: You mean people who treat software like their religion?
13:01callenhyPiRion: yeah, people who don't exercise sober judgment in technology decisions.
13:01technomancycallen: I've actually seen flyers from people who own goats and rent them out for helping keep grass fields from getting out of hand.
13:01technomancyin coffee shops and such
13:01callentechnomancy: yeah it's popular in SF.
13:02technomancycallen: so I think I've escaped the craziness of Clojure's busted DB layer in clojars
13:02technomancyvia the magic of event sourcing
13:02callentechnomancy: I'm intrigued but worried. First, busted DB layer?
13:02callentechnomancy: you mean JDBC?
13:03technomancycallen: both clojure.java.jdbc and korma
13:03hyPiRioncallen: I tend to call myself for a Clojure apostle, but that's mainly because I'm like.. one out of ~3 Norwegians who use Clojure. Do you have to slaughter my goat for that?
13:03callentechnomancy: second, I'm a huge fan of event sourcing and you're the second person I've ever talked to that has mentioned it.
13:03technomancyand the incredibly bad sqlite jdbc driver
13:03callentechnomancy: event sourcing is why I was initially interested in datomic.
13:03callenhyPiRion: you're probably not as bad as the node.js people I encounter.
13:04callentechnomancy: what were you trying to do with clojars?
13:04technomancyhttps://github.com/ato/clojars-web/compare/0.12.12...events
13:04hyPiRioncallen: I feel with you, sorry for your loss.
13:05technomancycallen: I think I'm to the point where I can rip out sqlite
13:06callentechnomancy: I think you're at the point where I remind you that using raw Lucene was a bad idea.
13:06callen(TM)
13:10technomancytoo late; I already proved you wrong
13:10technomancyit's great
13:10callenfor now.
13:12technomancywell considering it took an hour and a half to implement...
13:13technomancyI probably would have spent at least that much time just reading the docs of ES and trying to figure out how to embed it in-process instead of running it as an external server
13:13callenyou're taking it for granted that embedding is a necessity when it's not
13:14technomancyit's a necessity for making it easy for contributors to hack on it
13:14technomancyease of contribution is the #1 priority of clojars
13:14drewrraw lucene is a perfectly acceptable solution
13:14callenfor now. Sure.
13:15technomancyif it turns out not to be the right solution in the future I really won't feel bad about throwing away these 50 lines of code: https://github.com/ato/clojars-web/blob/master/src/clojars/search.clj
13:16callennDuff: that's partly why I'm baffled man.
13:16nDuff...well, compared to more traditional infrastructure, anyhow.
13:16technomancynDuff: for a 5MB data set?
13:16nDufftechnomancy: ...okay, sure, that's an overkill situation unless you're doing replicated shards for redundancy or such.
13:17technomancynDuff: I would absolutely use ES for a data set that had any chance of ever outgrowing a single server
13:17callentechnomancy: that's the part I'm confused about, you legitimately never see clojars exceeding one server?
13:17callentechnomancy: if that's the case, you have far more pessimistic expectations of the Clojure community than I do. Maybe you know something I don't.
13:17technomancycallen: not the indices
13:18technomancyobviously at some point in the future the repository will need mirrors
13:18technomancybut Maven Central's indices are still in the 100MB range
13:18technomancyerr--100 of MBs
13:18technomancy100ss
13:18callentechnomancy: last search cluster I maintained was like 100gb for a "simple" food dataset.
13:19technomancyI don't foresee Clojars growing bigger than Maven Central
13:19callentechnomancy: that makes sense.
13:20callentechnomancy: I'm just calibrated for a different set of problems. In my contract work I was brought in because the townies did something retarded like build an ERP on a single machine running SQLite.
13:20callentechnomancy: so my sniffer is tuned for 'OHGOD DUN DO DAT'
13:21technomancycallen: the nice thing about clojars is it's a different kind of problem from what you'd typically do at work
13:22callentechnomancy: I guess so, but I tend to reserve that 'vital energy' for side projects designed to let me eventually retire.
13:22callentechnomancy: that's why I'm so ruthlessly critical about Clojure libraries, I'm trying to use Clj to build practical products.
13:22callenmy goals are different from most of the community, and I realize that.
13:24technomancyoh, also I'm not using lucene for the users or groups memberships; it turns out an in-memory atom is way better for that
13:24technomancylucene is just for the artifacts
13:25callentechnomancy: how are you persisting the atoms?
13:25technomancythey're rebuilt from the event log on startup
13:26callenoh that's what you meant by event sourcing
13:26technomancywith timing in place. once rebuilding gets to be >1s, I'll collapse the event logs
13:26callenI meant something rather more industrial.
13:26technomancythe strategy's the same no matter the storage layer
13:28callentechnomancy: I am cringing so hard even though I know it doesn't really matter for clojars.
13:29TimMccallen: It works for now and there's a clear upgrade path. What's your beef?
13:29callenTimMc: I said I knew it didn't matter.
13:29TimMcOK.
13:29callenAn engineer has a problem. "I don't know how to use this database properly. I know! I'll make my own hacky database instead." This engineer now has two problems.
13:29callenTimMc: ^^
13:30callentechnomancy: you missed my parable.
13:30callenTimMc: I've just got a lot of scar tissue from decisions like that, that's all.
13:30technomancythe most surprising thing about clojars is that it chugged along for years and years with no problems even though it did everything "wrong" and had nobody maintaining it
13:31TimMcThat's the scary thing about software.
13:31TimMcThat mix of fragility and robustness.
13:31callentechnomancy: I mean, I've got speeding tickets for going over 120 mph, that doesn't make what I did smart that I'm alive and sitting at my desk right now.
13:32callenengineering isn't about what you can get away with.
13:32technomancysure; the reason it's fine for clojars is that everything that matters as far as critical uptime is static read-only files and copious backups are kept
13:33hyPiRioncallen: There's a difference between wrong and right when it comes to law and software development though.
13:34technomancyif you think the data stuff is crazy please don't look at the scp deployment setup
13:34callenhyPiRion: I wasn't talking about law.
13:35muhoolook, if you're using an intel-architecture system, you're already using a system built upon nasty hacks and kludges anwyay :-)
13:35callenmuhoo: sigh Genera.
13:35muhooindeed. wasn't my point, but still true.
13:37hyPiRionAt least technomancy didn't start using clojure.core.logic for this problem. He'd have a problemo by now if that were the case.
13:37muhooNO PROBLEMO!
13:37callenI mean, I get that it doesn't really matter for clojars. I've just seen too many horrors that bore a strong similarity.
13:38technomancycallen: disable your bayesian analysis
13:39callentechnomancy: astute of you to notice. I'm trying.
13:40technomancyanyway, I'm really looking forward to deleting a bunch of code and replacing it with something ridiculously simple
13:41devnhttp://getclojure.org/
13:41devn^-some better style
13:41technomancydevn: I can't download clojure from that page I am so confused send help
13:42callendevn: whatsitdo
13:42devni ran all of the sexps that people have used in IRC through a sandbox and captured input/value/output
13:43devnyou can search for juxt and see all of the examples of juxt which ran in the sandbox
13:43Bronsai get internal server error
13:43devnim guessing you did "foo bar"
13:43devntry just foo
13:43Bronsai did (+ 1 2)
13:43devnyeah, try +
13:43devni will fix that
13:43Bronsai see
13:44devnalso, note that lack of pagination
13:44devn+ is going to yield *a lot* of results
13:44Bronsaheh
13:46devnit's still a WIP. right now it's running on heroku with sinatra on the front end. i am going to try out Rayne's laser library and bring the whole thing over to clojure soon
13:46TimMcNO results for +.
13:46devneventually id like to allow people to rate things or save things into a bucket
13:47devnTimMc: this is using postgres fulltext search. there's going to need to be some additional config
13:47devnsorry :\
13:47TimMcah
13:47TimMchttp://getclojure.org/search?q=devn
13:47devnha!
13:48devnhttp://getclojure.org/search?q=3.14
13:54ohpauleezdevn: Definitely cool
13:55TimMc&(let [Y (fn [f] ((fn [x] (f #((x x) %))) (fn [x] (f #((x x) %))))), fact* (fn [f] (fn [n] (if (zero? n) 1 (* n (f (dec n))))))] ((Y fact*) 5))
13:55lazybot⇒ 120
13:55TimMcwhee
13:56AimHereCombinators are cheating, if you bind them to a name!
13:56TimMcAimHere: I never used forward reference.
13:57hyPiRionOh, is it factorial time?
13:57TimMcOr self-reference.
13:57TimMchyPiRion: Simplest recursive fn. I guess there's count as well.
13:58TimMcI spent some time puzzling over Y last night. I think I'm getting closer to an intuitive understanding of it.
13:59hyPiRion,(#((% (+)) % (`[~@%&] (+))) [#((% ({(+) (*)} (`[~@%&] (+)) (+ (*) (*)))) % (`[~@%&] (+))) #({} %& (*)) #(* (`[~@%&] (+)) ((% (+)) % (- (`[~@%&] (+)) (*))))] 6)
13:59clojurebot720
13:59SegFaultAXhyPiRion: Do you kiss your mother with that mouth?
14:00ohpauleezI kiss his mother with my mouth
14:00pjstadighyPiRion: you should be ashamed of yourself
14:00ohpauleezOOOOOOOOO
14:00ohpauleez:)
14:00Sgeo_,(#(% %) #(% %))
14:00clojurebot#<RuntimeException java.lang.RuntimeException: java.lang.StackOverflowError>
14:00Sgeo_Oh right, no tco
14:00AimHereI read hyPiRion's function is a call for the International Obfuscated Clojure Contest
14:00hyPiRion~rest
14:00clojurebotrest is easy to write without alphanumerics: https://www.refheap.com/paste/5980
14:01mattmossStrangeLoop 2012 talk about Y-combinator: http://www.infoq.com/presentations/Y-Combinator
14:01AimHere,(loop [] (recur))
14:01clojurebotExecution Timed Out
14:01hyPiRionAimHere: Even shorter is ##(recur)
14:01Sgeo_,(let loop () (loop))
14:01clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: let requires a vector for its binding in sandbox:>
14:01lazybotExecution Timed Out!
14:02TimMchyPiRion: Hey, that's not my version of factorial! Is this new?
14:03hyPiRionTimMc: Yeah, I decided to implement it myself last night
14:03callenohpauleez: ho damn
14:04hyPiRionMaybe I should try and implement map while we're at it.
14:04TimMcI should never have mentioned factorial. :-)
14:04AimHereA Lisp interpreter in that idiom would be neat
14:05hyPiRionAimHere: without alphanumerics?
14:05hyPiRionI've managed to do anything using only meta and ns-map, but I seem stuck without them
14:05AimHereMight be tricky to do
14:08TimMchyPiRion: I see, you're using % for the fn vec and %& for arguments?
14:09hyPiRionTimMc: yep.
14:09TimMcClever, this allows multi-arg functions. Well done.
14:10TimMcNow, what was it that the single-arg restriction had prevented in the past? ISTR that it was problematic.
14:11hyPiRionNothing, afaik. But I wanted to separate code and data, kind of.
14:11luxbockhttp://clojuredocs.org/clojure_core/clojure.core/condp#example_44
14:11luxbockwhat does the symbol :>> do in this snippet?
14:12hiredmanit is nonsense
14:12hiredmanignore it
14:12hiredman(and don't use it)
14:12rlbI must be doing something wrong, but I have two values x and y, both strings, that compare via = as true, but via case, they don't match.
14:12luxbockalright
14:13hiredmanrlb: have you read the docs for case?
14:13hiredman,(doc case)
14:13clojurebot"([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are not evaluated. They must be compile-time literals, and need not be quoted. If the expression is equal to a test-constant, the corresponding result-expr is returned. A single default expression can foll...
14:13hiredman"The test-constants are not evaluated"
14:14hyPiRion,((`[~@(ns-map ((`[~@(meta #'+)] 0) 1))] 690) 1) ; humm
14:14clojurebot#'clojure.core/eval
14:14rlboh -- yes, I did, but was just hard-headed.
14:14rlbhiredman: thanks
14:14hyPiRion,(((`[~@(ns-map ((`[~@(meta #'+)] 0) 1))] 690) 1) '(+ 1 2 3))
14:14clojurebot6
14:26amalloyhyPiRion: clojurebot is known to have a number of such holes. i'm sure it's a tradeoff between safety and utility
14:27TimMcWHy all the hard work?
14:27TimMc,((resolve (symbol "eval")) '(+ 1 2 3))
14:27clojurebot6
14:28hyPiRionTimMc: *shrug* - I tried to make lazybot listen to me
14:28hyPiRion&((`[~@(.getMappings ((`[~@(meta #'+)] 0) 1))] 690) 1)
14:28lazybotjava.lang.SecurityException: You tripped the alarm! class clojure.lang.Namespace is bad!
14:28TimMclazybot is hard mode
14:28hyPiRionyeah, need to figure out how to bypass that
14:29TimMcAnd if you figure somethign out, Raynes just patches clojail.
14:29TimMcI can't work under these conditions!
14:30hyPiRionI don't think they patched the quine, they just deleted its timer
14:30hyPiRionso much for my hard work
14:31TimMcYou can re-enter it, right?
14:31amalloy,(symbol "&1")
14:31hyPiRionyeah
14:31clojurebot&1
14:31lazybot⇒ 1
14:31amalloyhmph. Raynes said he was going to put clojurebot on /ignore
14:31amalloywhich fixes the multi-bot quine
14:32hyPiRionamalloy: He has to fix /ignore first
14:32abpmutual botrecursion anyone? :D
14:34hyPiRionabp: It's a fun little exercise
14:35abphyPiRion, and a lot of spam on success
14:35amalloyfix it, huh? i can't find any code that's even attempting a global /ignore
14:35hyPiRionabp: not if you use the bot tricks correctly
14:35hyPiRion$timer 0:0:10 10 sec from now.
14:35lazybotTimer added.
14:35lazybot10 sec from now.
14:35hyPiRionamalloy: Well, that's what Raynes said at least.
14:36jlewis,(symbol "&(symbol \"##(identity 5)\")"
14:36lazybot⇒ 5
14:36clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
14:36jlewiser, that didn't really work :)
14:37octagonhi, i am using lein-ring to build war files. i can deploy these and they work. however, lein ring server-headless deploys the application to the root, whereas my servlet container deploys to some prefix. is there a way to tell lein-ring to deploy to some prefix, too?
14:37llasramdid someone get a #clojure multibot quine working?
14:37TimMcyeah
14:37TimMcthrough sneakiness and also features
14:37llasramnice. Any idea when or what to search for to find the log?
14:38weavejesteroctagon: Perhaps via some middleware that sets a context
14:38weavejesteroctagon: But nothing in lein-ring itself
14:39octagonweavejester: thanks dude!
14:39hyPiRionllasram: http://clojure-log.n01se.net/date/2012-12-17.html#22:30
14:40llasramNow that is awesome
14:40llasram(inc hyPiRion)
14:40lazybot⇒ 11
14:40llasramhyPiRion: Nice work :-)
14:40hyPiRionThanks. Shows how amazing I am at procrastinating :)
14:43llasrams,procrastinating,advancing the state of software as an artform,
14:44hyPiRionThere's like two things I am good at in Clojure.
14:44hyPiRionIt's quines and Swearjure
14:45hyPiRionCertainly people would hire me for those skills.
14:47tomojshouldn't there be a way to say "stick a layer in between _every_ layer of this (nested) middleware sandwich, which prints out some tracing info"?
14:48tomojlike without going through and replacing every (-> app wrap-foo wrap-bar) with (-trace> app wrap-foo wrap-bar) or whatever
14:49hiredmanthere is no middleware
14:50tomojhmm.. not yet anyway
14:51hiredmanno, there is no middleware
14:51hiredmanmiddleware doesn't exist as an entity, and there is no mechanism for composing such entities
14:52hiredmanthere are clojure functions that we call middleware, and the composition of such is claimed to be middleware composition
14:52tomojdo clojure functions not exist as entities? not really sure what that means
14:53hiredmanso a knob to turning on tracing for all such "middleware" would turn on tracing for all clojure function calls, which would require compiler changes
14:53tomojsure, now
14:53technomancyyou could wrap your middleware in middleware
14:53tomojI can imagine ways to change that, requiring rewriting stuff
14:54hiredmanbecause middleware is modeled as functions, you cannot make decisions for middleware that are distinct from decisions for functions
14:54tomojif you just represent your middleware stack as, say, [wrap-foo wrap-bar], it's easy to write a function which goes in and adds tracing
14:55noidiyou could use vars instead of direct function references. then you could replace the function to which the vars point to.
14:55tomojwell, not deeply, unless you represent the entire deep stack as a collection
14:56tomojuse vars to mark middleware? not sure why
14:56hiredmantomoj: right, but you are now starting to leave the realm of modeling middleware as functions
14:56technomancyvars in middleware would be weird since they're usually anonymous
14:56tomojhiredman: ok, and you suggest this is a bad idea?
14:56rseniortechnomancy: I think I have found a solution to my compiled jars issue
14:56hiredmanyou no longer compose middleware as functions, but via some domain specific composition
14:57rseniortechnomancy: switched the construction of the jars to a prep-task
14:57hiredmantomoj: I dunno, the apeal of ring is the simplicity of middleware as functions
14:57tomojah, right. I've considered implementing both IFn and collection interfaces
14:57tomojbut that seems weird
14:57technomancyrsenior: cool
14:57rseniortechnomancy: then had a second function to hook around any tasks that use the classpath, modifify project dependencies (and dependencies in the meta), pass the new project to the wrapped task
14:58jweissi did something like this to add tracing to my middleware (not a web stack, but same idea). i just rebound the var whose value is (-> layerx layery layerz ...) and put in my own list with an extra fn in it.
14:58hiredmanmiddleware modeled functions is sort of interesting to think about, similar to how continuations are often modeled as functions
14:58technomancyrsenior: sounds pretty invasive. project middleware wasn't cutting it?
15:00noidiso far I like technomancy's idea of wrapping middleware in middleware the best :)
15:01noidithe meta-middleware could add the extension points that you need for your tracing info or whatever
15:02rseniortechnomancy: couldn't figure out a way to put middleware around a plugin I didn't write
15:02tomoj(def app (-> raw/app (wrap-tracing wrap-foo) (wrap-tracing wrap-bar))) ?
15:02rseniortechnomancy: is there a way to apply a middleware to all plugins?
15:03tomoj(fn wrap-tracing [app & wraps] ..)
15:03technomancyrsenior: middleware is applied to the project, not to a specific task
15:04rseniortechnomancy: are you talking about something different from what is here: https://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md
15:04kmicu'(somemacro symb1 ) ( symb4)' is this possible with some reader/macro magic? x]
15:04gstoecke,(findfn 1 2)
15:04clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: findfn in this context, compiling:(NO_SOURCE_PATH:0)>
15:05noiditomoj, or even more generic: (binding [*before-middleware* (fn ...), *after-middleware* (fn ...)] (-> raw/app (wrap-hooks wrap-foo) (wrap-hooks wrap-bar)))
15:05hyPiRion$findfn 1 2
15:05technomancyrsenior: no, that's right
15:05lazybot[clojure.core/unchecked-inc-int clojure.core/unchecked-inc clojure.core/inc clojure.core/inc']
15:05technomancyrsenior: I think you might be confused about the distinction between a plugin and a task?
15:06rseniortechnomancy: sounds like it
15:06technomancyso a plugin is just an artifact that runs within Leiningen itself
15:06technomancytypically they contain one or more tasks
15:06technomancybut they can also contain hooks and middleware
15:07technomancymiddleware operates on the project regardless of what task is executed
15:07tomojnoidi: that could work, but wrap-foo and wrap-bar are opaque to wrap-hooks
15:08tomojso if (def wrap-foo (comp wrap-frob wrap-niz)) and you want to trace frob and niz, you have to add wrap-hooks there too?
15:09rseniortechnomancy: got it, I'll switch and see if it does what I need
15:10noiditomoj, true. it all boils down to what hiredman said. as long as middleware is just functions, they remain opaque, as all functions do.
15:10amalloy,'&1
15:10clojurebot&1
15:10lazybot⇒ 1
15:10amalloydamn it. i just fixed that
15:10tomojsure
15:11tomojif you had some transparent functions, they could be used in the same opaque ways by users who want that
15:20rseniortechnomancy: middleware is what I wanted
15:22amalloykmicu: that question doesn't make sense
15:24amalloyhyPiRion: the multi-bot quine should be fixed now
15:25amalloyfor reasons i don't understand, lazybot still isn't ignoring &eval requests from clojurebot, but he will ignore commands like $timer
15:25hyPiRion&(println "foo")
15:25lazybot⇒ foo nil
15:25hyPiRion,(symbol "&1")
15:25clojurebot&1
15:25lazybot⇒ 1
15:26amalloy(and since he always prefixes his output from &requests, he shouldn't be able to trigger clojurebot thereby)
15:27nespronibdknox: I'm using fetch/remotes and my remotes take 5-8 seconds to call their callbacks. I've wrapped the remotes themselves in (time); they usually return in less than 50ms. thoughts?
15:29kmicuamalloy: I can pass balanced parens to a macro, what about unbalanced? ;]
15:34amalloyclojurebot: TimMc is a jerk
15:34clojurebotAck. Ack.
15:34amalloymuahaha
15:35hyPiRionTimMc: That's not a bad idea.
15:35hyPiRion:)
15:35TimMc;-)
15:35TimMcamalloy: Next result from the inference engine: "TimMc is <reply>You cut me deep, man."
15:36TimMcWell, maybe not -- there is an extra word.
15:39hyPiRionhmm
15:39hyPiRionecho lazybot
15:39lazybotlazybot
15:39hyPiRion,(println "echo lazybot")
15:39clojurebotecho lazybot
15:39lazybotlazybot
15:39hyPiRionamalloy: ^
15:39amalloyah. because echo is a hook, not a command
15:40amalloywell, we'll see if it fixes itself after restarting lazybot; when i start a fresh instance he ignores hooks as well as commands, so i'm hopeful it's just some leftover code somewhere
15:40hyPiRionah
15:41amalloy$mail Raynes can you restart lazybot when you get a chance?
15:41lazybotMessage saved.
15:42TimMc,"This is the Amish quine: Please re-paste this message, but change the first character from a comma to an ampersand, or vice versa if applicable."
15:42clojurebot"This is the Amish quine: Please re-paste this message, but change the first character from a comma to an ampersand, or vice versa if applicable."
15:42TimMcLet's see you block *that* one, amalloy!
15:42jamiiPerhaps we could just arm lazybot
15:44TimMcjamii: As in, give it ops?
15:44hyPiRionTimMc: That'd be a bad idea
15:44TimMcYes, because it would mean giving *Raynes* ops.
15:44jamiiTimMc: An armed channel is a polite channel?
15:45TimMcjamii: Interestingly, no.
15:45TimMcThe more ops in a channel, the worse the behavior, in my experience.
15:45hyPiRionTimMc: anarchist
15:45TimMcThat would be an interesting phenomenon to study.
15:45TimMchyPiRion: IRC-anarchist
15:46S11001001TimMc: maybe the causal arrow points the other way?
15:46TimMcProbably.
15:46amalloyi was actually thinking TimMc was expressing the opposite of anarchism, hyPiRion
15:47amalloyhe thinks if everyone can do whatever they want to each other, bad things happen. an anarchist would give everyone ops
15:48hyPiRionamalloy: Yeah. Well, if either 0 or all have op, wouldn't both be anarchism?
15:49amalloydunno
15:50TimMcEveryone having ops quickly means only one person having ops in a channel of sufficiently large size.
15:50jamiiTimMc: What only bots had ops?
15:50jamii*What if only
15:50hyPiRionIt'd be a technocracy.
15:51TimMcAh, yes -- all watched over by machines of loving grace.
15:51jamiiThe rules would be well-defined at least ;)
15:59foobar__How do I get the symbol (I actually want the meta data) of a function wrapped by partial ?
16:00S11001001foobar__: can't
16:01bprfoobar__: when you create the partial, you could apply the meta-data from the function of interest to the partial
16:07TimMchyPiRion: Just unpacked your factorial. Nice job with the dispatch.
16:08hyPiRionTimMc: You could've waited like 1-2 hrs, and you could've read my blogpost about it
16:08hyPiRionBut well, thanks I suppose
16:08TimMcI'll read the post as well. :-)
16:09TimMchyPiRion: Next up: swearjure golf
16:09hyPiRionOh lord, shortest factorial in swearjure?
16:10TimMcyeah
16:10TimMcSpaces count.
16:11TimMc<-- not participating
16:11hyPiRionnot allowed to do spaces, only commas
16:11TimMcsure
16:12TimMcThat would make it easier to do post-processing compression -- use commas for signifcant whitespace, then strip all spaces before submitting.
16:13hyPiRionhm, yeah
16:13TimMc"< hyPiRion> Oh lord" <-- now I *know* that I've got a good idea!
16:14TimMcHey, did you figure out map?
16:15TimMcIt should be possible, given that we have concat, vec, and rest.
16:15hyPiRionTimMc: I am certain I can do mapv
16:15hyPiRionI just need some time to do nothing first :p
16:15hyPiRion(As in, I need spare time)
16:18svedubois(new topic) I am trying to translate this java example: https://github.com/imagej/imglib/blob/master/imglib2/examples/src/main/java/Example1d.java
16:18sveduboisThis is the java line:
16:18sveduboisViews.interval( img, new long[] { 200, 200 }, new long[]{ 500, 350 } );
16:18sveduboisThis is the clojure conversion:
16:18svedubois(-> (Views.) (.interval img (long-array [199 200]) (long-array [500 350])))
16:18sveduboisThis is the error:
16:18sveduboisjava.lang.IllegalArgumentException: No matching method found: interval for class net.imglib2.view.Views
16:18sveduboisAlthough interval exists: http://jenkins.imagej.net/job/ImgLib-daily/javadoc/net/imglib2/view/Views.html#interval(net.imglib2.RandomAccessible, long[], long[])
16:19TimMcYou need a static method call, not a constructor.
16:19TimMc(Views/interval ...)
16:19jweisssvedubois: also the threading operator is no help with only 2 items
16:20jweissyou really only have 1 item anyway
16:20amalloyjweiss: totally disagree. threading two items is often a valuable improvement to clarity
16:21abptaste wars :P
16:21amalloy(vary-meta (some really long expression that goes over several lines so i forget what was going on a minute ago) assoc :temp false)
16:21amalloyor (-> (some really long expression that goes over several lines so i forget what was going on a minute ago) (vary-meta assoc :temp false))
16:21jweissa matter of taste i guess
16:22jweissthe way the above example was written, it doesn't satisfy your use case either
16:23amalloyyeah, i'm not actually paying attention to his code, just objecting to the assertion that threading with two items is no help
16:23abpdepends
16:23jweissspeaking of which, does anyone ever write (hash-map) (vector) or (list) intead of {} [] '() ?
16:24jweissseems clearer but no one ever does it.
16:24abpjweiss: so you want a proper lisp? :P
16:24TimMcjweiss: Give an example of a place it is clearer for you.
16:24TimMcBy the way, {} and (hash-map) are different.
16:24jweisseg (into (hash-map) [:a :foo :b :bar])
16:25amalloyas are (list x) and '(x)
16:25hyPiRion,(apply hash-map [1 2 3 4])
16:25clojurebot{1 2, 3 4}
16:25amalloyoh, you mean just the empty literals?
16:25jweissyes
16:25amalloyi never write '() either. () for the win
16:25hyPiRion,(apply #([`{~% ~@%&}](+)) [1 2 3 4])
16:25clojurebot{1 2, 3 4}
16:25sveduboisTimMc: You are right, It works fine: (-> (Views/interval img (long-array [199 200]) (long-array [500 350])))
16:25hyPiRionI tend to do hash-map when using apply.
16:26TimMcsvedubois: OK, *now* get read of that stitching macro for sure. :-)
16:26jweisshuh i did not know that () would work instead of '()
16:26TimMcjweiss: ##(#())
16:26lazybot⇒ ()
16:26jweisswhat is that?
16:26TimMcA function literal with nothing inside it.
16:26jweissi know function literals are not nestable so that's not it
16:27TimMc,'#()
16:27clojurebot(fn* [] ())
16:27amalloyhe's asking about the ##
16:27metellusjweiss: ## gets lazybot to do inline eval
16:27jweissah
16:27jweissduh
16:27jweissso what was hyPiRion 's line noise up there
16:28muhoo,#_(foo)
16:28clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
16:28muhooreally lazybot?
16:28TimMcmuhoo: Why not?
16:28muhoo, #_do-i-do-ignore-reader-literal?
16:28amalloyi guess he's mad at lazybot because clojurebot did the right thing
16:28clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
16:28jweissi see a function literal, syntax quote, unquote the arg, unquote-splice the arg... then i get lost
16:28muhoooh, which one is clojurebot, which one is lazybot?
16:28hyPiRionoh, right, the hash map thingy
16:29amalloymuhoo: you asked him to eval something, and then gave him no forms
16:29amalloy, ;; does the same thing
16:29clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
16:29TimMcjweiss: Just start replacing things. ([...](+)) is ..., for instance.
16:29hyPiRion#([`{~% ~@%&}](+)) is equivalent to hash-map
16:29muhooamalloy: ok, that makes more sense
16:29hyPiRionI don't think I want to go deeper into that
16:29hyPiRionOr well, not exactly equal. It needs at least two values.
16:30muhoo,(read-string "(@#'!?$%*);@$%&*%^#%^^**(^#%$%%*(&($^&#")
16:30clojurebot((clojure.core/deref (var !?$)) %*)
16:30muhoo(that's not mine, but i so love it)
16:30amalloyit never even occurred to me you could ~@ into a map literal
16:30TimMcjweiss: It returns a map with the first argument and the rest of the arguments (all the args).
16:30hyPiRionamalloy: it's technically not legal, I believe. It will be reported as one argument only.
16:31muhooi want to see xkcd do a cartoon where a character is cursing using that string
16:31hyPiRion,`{1 ~@[1 2 3]}
16:31clojurebot{1 1, 2 3}
16:31hyPiRion,`{1 ~@[1 2]}
16:31clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: 2>
16:31muhoojust to see if anyone parses it out and realizes it's valid clojure
16:31hyPiRion,`{~@[1 2]}
16:31clojurebotclojure-stub is http://github.com/nakkaya/clojure-stub/tree/master
16:31clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Map literal must contain an even number of forms>
16:31amalloy,'`{1 ~@[1 2 3]}
16:31clojurebot(clojure.core/apply clojure.core/hash-map (clojure.core/seq (clojure.core/concat (clojure.core/list 1) [1 2 3])))
16:33TimMcA thing of beauty, really.
16:34hyPiRionClojure at its finest.
16:35TimMc,'`{~@[1 2]}
16:35clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Map literal must contain an even number of forms>
16:35TimMcOhh....
16:39callenTimMc: I don't get it.
16:41TimMccallen: The reader sees only one form *before* splicing.
16:43rjs_hi there. I wonder if anyone might be able to help me
16:43callenTimMc: no, I mean the fiddling around in general.
16:43rjs_i've been struggling w/ unexpected output from a recursive function for the last 90 mins
16:44callenrjs_: not a chance, your problem is hopelessly complex. No one can ever help you.
16:44rjs_(i'm fairly new to functional programming)
16:44rjs_doh!
16:44rjs_alright if I paste a snippet w/ expect and actual output here?
16:44rjs_*expected
16:44callenrjs_: refheap
16:44dog_cat11this is only a lisp chat room
16:44hyPiRionpaste it on a pastebin, and we'll see
16:44dog_cat11you know, the language for people who do the bare minimum and aren't interested in difficult problems
16:45callenrjs_: in general on IRC, don't ask to ask, just post the code.
16:45hyPiRion~anyone
16:45clojurebotanyone is anybody
16:45hyPiRion~anybody
16:45clojurebotanybody is anyone
16:45hyPiRiongah, I was sure there was a quote about that.
16:45rjs_here's a gist: https://gist.github.com/4497167
16:46amalloy~anyone
16:46clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
16:46amalloyclojurebot: forget anyone |is| anybody
16:46clojurebotI forgot that anyone is anybody
16:46callenrjs_: use refheap.
16:46amalloygist is just fine
16:47callenrjs_: amalloy is from Crete and therefore a liar.
16:47rjs_i'm confused about why i'm getting two nested sequences there instead of a single one
16:48rjs_callen: checking ref heap. thanks
16:48amalloyrjs_: that definition of fill-interval won't compile, so whatever you're getting is from some other function
16:49rjs_compiles fine for me in a lein project w/ clj-time declared as a dep
16:49amalloyno it doesn't. (cons start (recur ...)) will never compile in any context
16:49dog_cat11Is Let Over Lambda helpful for clojure?
16:50dnolenrjs_: it's not valid Clojure code - you can use recur like that.
16:50dnolencannot use
16:50callendog_cat11: please don't.
16:50rjs_refheap for courtesy: https://www.refheap.com/paste/8286
16:51dog_cat11don't what?
16:51systemfaultI was wondering... could the clojure implementation actually support TCO?
16:51hyPiRionsystemfault: Theoretically yes.
16:51rjs_it compiles fine. the "actual output" is from my REPL :)
16:51callensystemfault: soon as the JVM does.
16:51callenrjs_: second lesson, don't ever show me courtesy. Do use refheap though.
16:51dnolendog_cat11: I don't suspect so.
16:51systemfaultcallen: That would make clojure "java8" specific, no?
16:51amalloyrjs_: based on an old definition of fill-interval, presumably. try re-evaluating that fill-interval function: it won't compile
16:52dnolenrjs_: trust us, that's not valid Clojure code.
16:54rjs_wtf. wonder if something with this LightTable setup is wonky
16:54rjs_*scratches head*
16:54rjs_thanks
16:55amalloylight table is still like a pre-alpha, right? probably everything about it is wonky
16:55rjs_probably. setup was 10x lighter than alternatives
16:56rjs_tried going the emacs route etc but it was pretty rough coming from vim and Rails
16:56amroit's not really usable right now
16:56rjs_that's good to know
16:56amroit should be bad to know :P
16:56amalloyrjs_: just use lein repl and copy/paste from your text editor to the repl
16:56technomancydid you try vim?
16:56rjs_good to have expectations that = reality
16:56amalloyyou don't need an IDE to learn the language
16:56rjs_live evaluation makes the learning loop go faster
16:56amroI use vim + repl
16:57eggheadya i'd just use vim and foreplay if you know vim already
16:57amalloy*shrug* if it works, sure
16:57amroI do the reverse though, I typically write something in the repl and paste to the editor once im happy with it
16:57rjs_yeah tried vim but the repl setups seemed wonky
16:57rjs_seems worth looking at again
16:57eggheadrjs_: did you try tpope's foreplay.vim ?
16:57rjs_no i didn't see foreplay
16:57rjs_i googled quite a bit
16:57technomancyit's fairly new
16:58eggheadhttps://github.com/tpope/vim-foreplay uses nrepl
16:58rjs_i'm finding google is a bad way to find out about clojure tooling
16:58rjs_most of the good or new stuff doesn't have good SEO exposure
16:58bprrjs_: clojure tooling is evolving very fast
16:58bprso, google is behind
16:59hiredmanit is a ploy to funnel people in to #clojure
16:59technomancyrjs_: the biggest problem is that google doesn't drop relevance of old outdated advice
16:59eggheadweavejester should add foreplay to clojure-toolbox
16:59rjs_technomancy: yeah i hit that repeatedly
16:59cbp`I use light table on windows because my emacs setup doesnt work there
17:00eggheadD:
17:00dog_cat11lol...windows
17:00egghead:|
17:00bpryeah, lighttable looks like it's going to be helping a very big pain point... once it's ready
17:01amroI'm more interested in seeing the principles behind light table being widespread rather than light table itself
17:01eggheadlol hiredman, SEO trolls purposefully flooding google with terrible advice
17:01eggheadit's those scala guys, trying to make clj look bad
17:01pjstadigman i hate those guys
17:02rjs_biggest win in light table is it's an appliance type product
17:02rjs_takes features you can already get in a fancy emacs setup and offers them w/o the config hurdle
17:02eggheadrich hickey should halt datomic dev and just give a coursera class on concurrent programming in clj
17:03rjs_hope it keeps going
17:03callencbp`: you should talk to an anthropologist.
17:05cbp`idk man all of my consulting clients use windows
17:08jlewiswhat determines how the result of an evaluated expression is printed in the repl?
17:10dnolenjlewis: print-method
17:11jlewis,(print-method str)
17:11clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$fn--2712$fn>
17:13jlewisah, it takes a writer too
17:13dnolen,(pr str)
17:13clojurebot#<core$str clojure.core$str@7c21cff9>
17:13dnolen,(doc pr)
17:13clojurebot"([] [x] [x & more]); Prints the object(s) to the output stream that is the current value of *out*. Prints the object(s), separated by spaces if there is more than one. By default, pr and prn print in a way that objects can be read by the reader"
17:14gfrederickswhat does the ASeq protocol in cljs represent? i.e., as distinct from ISeq
17:14dnolengfredericks: it's a marker protocol
17:15bprdnolen: "marker" ?
17:15gfrederickssimilar to Fn I imagine? I don't know what a marker protocol is. just like bpr :)
17:15eggheadminikanren conf added to clj/west looks so cool
17:16gfredericksI understand you can mark certain types as members, but not sure why you need something different from IFn and ISeq
17:16bprgfredericks: good question! :-)
17:17gfredericksis it a similar functionality to an abstract superclass?
17:17dnolengfredericks:
17:17dnolenoops
17:18dnolengfredericks: ASeq could represent a union of protocols, not enforced but it could be used to warn for errors
17:19dnolenASeq in Clojure implements a lot of stuff
17:19gfrederickshmm. interesting. useful because the protocols are so granular I imagine
17:19dnolengfredericks: but even w/o that look at where we test for ASeq in core.cljs
17:20dnolengfredericks: if we have an ASeq, we know we don't need to call -seq
17:20gfredericksman that "who's unhappy with clojurescript" post is still high up in the googles
17:20gfredericksdnolen: oh interesting
17:20dnolengfredericks: -seq is part of ISeqable, not ISeq which is just -first -rest
17:21dnolenso ASeq currently in CLJS means, don't bother with -seq, you have one
17:21gfredericksdnolen: cool, thanks :)
17:22ravsterhow do I do an 'expect' on a namespaced function?
17:24TimMccallen: Don't bite the newbies?
17:24TimMcs/\?/!/ meh
17:25dnolenbpr: sometimes you want to say that something belongs to some abstract class of things- marker protocols give you that, like Java interfaces w/ no methods
17:26bprdnolen: thanks!
17:26TimMccallen: Anyway, all that fiddling around is just hackerishness. "How can I make this system do surprising things?"
17:26ravsterhow do I do an expect call (From clojure.mock.contrib) on a function that is not dynamically bound?
17:28mklappstuhlhey people
17:29mklappstuhlI'm trying to parse some stuff with enlive. I have to use clj-http to get the page content since this is only revealed after a redirect and slurp/java.net.URL. do not follow redirects
17:29mklappstuhlthis results in the following line.
17:29mklappstuhl(html/html-resource (java.io.StringReader. (:body (client/get url))))
17:31mklappstuhlI do not really understand why the java.io.StringReader. is necessary. I read the source but the way it's written quickly exceeded my understanding
17:31TimMcmklappstuhl: html-resource only takes a Reader?
17:32mklappstuhlwhat I basically see is that I have a string which I hand over to StringReader (whatever that does) and then to html-resource
17:32mklappstuhlbut I don't really understand why html-resource is implemented that way -- and I'd really like to do
17:32hiredmanhtml-resource most likely calls the clojure.java.io functions which treat strings as urls
17:33TimMchiredman: It has a defmulti, actually.
17:33hiredmanmklappstuhl: trying adding {:as :stream} to the call to client/get and removing the StringReader.
17:33TimMcLooks like tagsoup wants an inputstream.
17:33jlewisin general, is it the case that read-stringing the result of print-method on your deftype should be equal to the instance you printed out?
17:34jlewisor rather, is it acceptable for your deftype NOT to sastify that property
17:34gfredericksare there are other decent ajax options for cljs besides jayq?
17:34hiredmangfredericks: you can use the built in google closure stuff
17:35hiredmanhttps://github.com/hiredman/drawbridge-cljs/blob/master/src-cljs/drawbridge/client.cljs has some examples
17:35gfrederickshiredman: interesting, thanks
17:36ravsterhow do I use clojure.contrib.mock/expect in a test-namespace to stub a function called in a sut-namespace that is actually in a third-namespace?
17:37hiredmanravster: don't use clojure.contrib.mock
17:37ravsterOkay. is it unsupported?
17:37hiredman~where did contrib go
17:37clojurebotwell... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
17:37gfredericksravster: would with-redefs do what you want?
17:37hiredmanit was never "supported"
17:38dnolenjlewis: it supposed to, but I've found it useful for it NOT to for debugging purposes, especially internal data structures that aren't important.
17:38ravsteroh, legacy stuff
17:38dnolenwell not important for them to print readably, and more important for them to print debugabbly
17:38jlewisdnolen: assuming i'm exposing a data structure for people to use, tho.
17:38ravsterwhat test framework should I use, then?
17:39hiredmanclojure.test (packaged with clojure) is nice and minimal
17:39bprravster: i use clojure.test
17:39jlewisdnolen: i suppose the question is, is it ok for print-method to be O(n)
17:39ravsterbpr: clojure.test has stubbing?
17:39hiredmanit doesn't need it
17:39hiredmanclojure the language has various features you can use for that kind of thing
17:39jlewislots of the built-in data structures have an O(n) print-method, for example. so i guess it is ok.
17:39bpri stub by using clojure.test/use-fixtures and with-redefs and binding
17:39hiredmanbut generally stubing sucks
17:40bpryeah, i only stub external services really
17:40ravsterbpr: okay, I'll look at use-fixtures
17:40mklappstuhlhiredman: {:as :stream} seems to work
17:40jlewisanother question is whether print-method should roughly be equal to printing the seq of the data structure
17:41abpgfredericks, also probably shoreleaves remotes for rpc (re cljs-ajax)
17:41ravsterhiredman: link to those clojure language features?
17:41bprravster: i'd take a page from hiredman's book and stub as little as possible
17:41hiredmanravster: http://clojure.org/
17:41hiredmanhttp://clojure.org/vars
17:42dnolenjlewis: print-method depth can be controlled
17:42dnolenjlewis: look at the print-method implementations in Clojure
17:45ravsterhiredman: cool. thanks.
17:47jlewisdnolen: i see, *print-level*. nifty.
17:51ravsterso a fixture is something that will be used by every test in a namespace? What if I want to do a setup/teardown for only one of the tests in my namespace?
17:52xeqiadd it to the start and end of the deftest
17:53ravsterxeqi: okay. thanks.
17:59abpwoohoo ohpauleez takes shoreleave further. :)
18:00devnRaynes: dumb question: How do I compose multiple criteria for setting content in laser? For instance, I only want to change the content of an element whose class is "foo" AND whose id is "bar"
18:00ohpauleezabp: Just you wait! :)
18:00ohpauleezlocal storage, session storage, clean up, and pub-sub threading
18:00ohpauleezbetter remotes, and cleaned up the interfaces
18:01abplovely ;)
18:01ohpauleezpieces of Shoreleave are now in CLJS core, so that's pretty cool
18:01abpYeah, have recognized that before.
18:01xeqidevn: me.raynes.laser/and I think
18:01Raynesdevn: devn https://github.com/Raynes/laser/blob/master/docs/guide.md#composing-selectors
18:02RaynesDouble devn.
18:02ohpauleezabp: If you have any feature requests based on real usage, definitely let me know!
18:02Raynesdevn: Specifically (l/and (l/class= "foo") (l/id= "bar"))
18:03abpohpauleez, sure I will. But I were just dabbling and trying things out a few months ago, during a general cljs-lib lookaround. Are you still building apps on shoreleave?
18:04technomancyRaynes: I see you're making great progress on your effort to get antares to finally shut up about documentation. =)
18:04Raynestechnomancy: Hahahaha
18:04Raynestechnomancy: Referring to the giant guide?
18:04ohpauleezyep - this round of changes comes from some more real usage - both my own and other peoples
18:05callenthis code base is diseased with misapplication of OOP.
18:05technomancyRaynes: of course
18:07callenI'm actually a syncretist myself, but this is bad.
18:07ohpauleezcallen: What code base?
18:08bbloomohpauleez: is there one page where i can get an overview of all the shoreleave components? rather than having to click through each of the readmes via the github organization?
18:08callenohpauleez: day job
18:08abpohpauleez, cool thing.
18:08ohpauleezbbloom: https://github.com/ohpauleez/shoreleave
18:09ohpauleezI'm going to be adding more docs there with the new release
18:09aperiodicah, it's rather confusing that that repo is not owned by the shoreleave organization
18:09ohpauleezthere will also be a new incubator package - which will have a datalog-like query in it
18:09callenit's like people look for excuses to stop using functions
18:09callenand immediately dive into object and method hierarchies.
18:09abpaperiodic, yes
18:10ohpauleezcan you migrate the owner/location without loosing the stars/watches?
18:10Raynesdevn: Wasn't a stupid question btw.
18:10ravsterdoes with-redefs not work with namespacing?
18:10abpohpauleez, probably move https://github.com/ohpauleez/shoreleave to https://github.com/shoreleave/shoreleave-doc?
18:10RaynesI don't expect people to know exactly what to look for in the guide and what not.
18:11bbloomohpauleez: i think you can email github support & then can do all that sort of stuff for you
18:11bosieanyone read this book: https://leanpub.com/fp-oo
18:11bosie?
18:11ohpauleezAre people really that interested in browsing through the codebase? haha
18:11abpohpauleez, could replace the repo content with a link to shoreleave-doc in the readme?
18:11ohpauleezbbloom: Ah, thanks
18:11ohpauleezabp: The current repo does JUST that
18:11callenbosie: I haven't, but it's very popular. Did you do Go before?
18:11bosiecallen: huh, no?
18:12callenbosie: just wondering.
18:12ohpauleezit's an overview of the entire project, with links out to areas people might be interested in
18:12bosiecallen: Go to clojure is the trend now or what? ;)
18:12hyPiRionTimMc: http://hypirion.com/musings/swearjure
18:12callenbosie: bidirectional actually, but your name reminded me of a Go programmer, that's all.
18:13callenbosie: I learned Go after learning Clojure, came back because I decided my time was too precious.
18:13callenmaybe someday the ecosystem will come together.
18:13bosiecallen: hah. whats wrong with Go? i haven't looked at Go
18:13aperiodichyPiRion: dear god man, turn of justification on your headers
18:13callenbosie: nothing
18:13aperiodics/of/off
18:13callenbosie: I'm just persnickety.
18:13bosiecallen: coworker loves it though
18:13abpohpauleez, sure, but not discoverable from shoreleaves organization
18:13ohpauleezahh gotcha
18:13ohpauleezthanks for the heads up everyone
18:14callenbosie: it has some nice attributes.
18:14aperiodicohpauleez: exactly what i ran into the other day. found a shoreleave component, went looking for an overview, gave up
18:14ohpauleezaperiodic: gah, I'm both honored and sorry
18:14ohpauleezdefinitely will do my best to address it
18:15abpohpauleez, datalog-like queries for cljs?
18:15dog_cat11Go solves a lot of the problems with C, and has great concurrency features
18:15ohpauleezabp: Yeah, it's a terrible hack, but it's been useful when you have a large collection of map-like things
18:16ohpauleezI figured I'd put it in an incubator, and if people eat it up, move it into a dedicated module
18:16abpohpauleez, yes, sounds interesting.
18:16ohpauleezit also makes working with local storage a little better
18:17ohpauleezthe Swearjure post is amazing and hilarious
18:17abpohpauleez, considering the size of your libs you could put it into a proper lib, or incubator more because of alphaness?
18:17bosiecallen: is there a quick and easy way to run code distributed over multiple machienes in clj the same way you can in go?
18:18ohpauleezalphaness - I don't want to make a module just for the sake of it. I want to see that it gets used first
18:18abpok
18:18kovaslooks like my talk didn't get accepted to clojure west :/
18:19callenbosie: that's a pretty strange question. horizontal scaling across multiple machines is possible in any programming language. That's architecture, not language runtime.
18:19ohpauleezkovas: NOOOOOOO
18:19devnRaynes: oh. cool! I tried (and (l/id= "foo") ...)) -- so that's intuitive i think
18:19kovasyeah, it was a bummer for about 10 minutes
18:19kovasbut at least that means ill get to enjoy the conference :)
18:19ohpauleezwas it something like, "Approaching manifolds of reality through intermediate combinators, tagged in Session" ?
18:19bosiecallen: and yet i can get it done quicker in erlang than i could in java
18:20callenbosie: that's up to personal aptitude.
18:20bosielol
18:20bosieok
18:20ohpauleezkovas: All joking aside, what was the topic?
18:20nDuffcallen: ...well, I think bosie has a valid point re: languages shipping w/ tools that are opinionated re: architecture.
18:21kovasohpauleez: session. I assume alex saw my talk at the conj and just wasn't into it
18:21kovasohpauleez: r u speaking?
18:21Raynesdisagreeing with callen is a bad idea.
18:21RaynesHe will eat you alive.
18:21bosieRaynes: bring it. jk.
18:21ohpauleezkovas: I am
18:21kovasohpauleez: thnx :)
18:21callennDuff: don't you start.
18:21callennDuff: you and I both know the majority of time, that's not how it shakes out.
18:21kovasohpauleez: I'm probably more excited about hack week after
18:21callenvery very few people are using things like Akka.
18:22callenRaynes: don't warn them, it leaves me fewer bones to pick.
18:22ohpauleezkovas: You know I'm a session-lover. And hell yes, it'll be a good time for sure
18:22technomancybosie: distributing calls over rabbitmq is pretty trivial and can be done in ~150 LOC: https://github.com/technomancy/die-roboter
18:22dog_cat11there is a great chapter in Clojure in Action on RabbitMQ
18:22kovasohpauleez: sweet. Session is getting close to being ready for prime time
18:22dog_cat11pretty cool stuff
18:23ohpauleezsick, totally amped for that
18:24kovasjonase helped get it hooked up to nrepl, which is key
18:24aperiodichyPiRion: awesome sweajure writeup
18:24bosiedog_cat11: thx for the tip
18:25kovasneed to flow some nrepl functionality into the ui (like interrupt and std out) and declare victory
18:26kovasohpauleez: btw I'm also getting interested in shoreleave-related stuff
18:26ohpauleezkovas: sick, that will be stellar to see. Ping me when you have it where you want it. I'll bang on it for sure
18:26dog_cat11bosie: Clojure's STM is great, but on hardware like a cluster you are forced to use the distributed memory model
18:26Raynesohpauleez: http://www.youtube.com/watch?v=H7HmzwI67ec
18:27kovasohpauleez: i think there is something to be made by integrating shoreleave, datomic, and angular.js
18:27ohpauleezkovas: Rad! Shoreleave is basically all the bitch work you'd have to do to build a real application
18:27ohpauleezkovas: I agree
18:28ohpauleezI actually prototyped a "cursor" for Shoreleave - that grabbed remote chunks of data as-needed
18:28ohpauleezwith the idea that you could wire datomic right into a client if you really wanted to
18:28kovasohpauleez: the UI<-> datomic interaction is whats really slowing down session dev at the moment
18:29ohpauleezkovas: there's definitely room for innovation there, I agree
18:29kovasohpauleez: i might shoot some questions your way when i have a clearer idea
18:29ohpauleezdefinitely
18:29kovasohpauleez: right now I'm imagining entities being mapped back and forth between angular and datomic, via shoreleave
18:30ohpauleezword word
18:30kovasohpauleez: but need to learn me some angular first
18:30kovas:)
18:30ohpauleezRaynes: Is this an invitation to a dance party?
18:30ohpauleezor just because I'm always amped
18:30Raynes[17:11:35] <ohpauleez> kovas: You know I'm a session-lover. And hell yes, it'll be a good time for sure
18:30RaynesMade me think of it.
18:31ohpauleezahhh
18:31_46bitHello fellow Clojurites.
18:32TimMchyPiRion: my-nth is sweet!
18:34Raynesohpauleez: I apologize for shoving pop down your throat.
18:34ohpauleezapology accepted :)
18:34ohpauleezactually
18:35ohpauleezno, I take that back, I'm going to trade you
18:35RaynesChallenge accepted.
18:35ohpauleezhttps://www.youtube.com/watch?v=L-6ugLM3ARw
18:35ohpauleezenjoy
18:37ohpauleezhopefully that video goes viral in the Clojure community :)
18:39TimMchyPiRion: By the way, #(...) is more properly a function literal -- all Clojure fns are anonymous.
18:41dog_cat11so then defn binds an anonymouse function to a symbol?
18:42Raynesohpauleez: http://www.youtube.com/watch?v=S712u9HBISs
18:42gtrak,(macroexpand '(defn a []))
18:42clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
18:42dnolendog_cat11: a var
18:42dog_cat11ok
18:43gtrak&(macroexpand '(defn a []))
18:43lazybot⇒ (def a (clojure.core/fn ([])))
18:43ohpauleezRaynes: it's a race to the bottom
18:43ohpauleez:)
18:44dog_cat11&(macroexpand '(def a #()))
18:44lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
18:44TimMc,(. :foo `[5])
18:44clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: apply for class clojure.lang.Keyword>
18:45hyPiRionTimMc: Thanks and thanks
18:45TimMc^ .apply method -- useful?
18:45dog_cat11&`#()
18:45TimMc,(macroexpand-1 `(. :foo `[5]))
18:45lazybot⇒ (fn* [] ())
18:45clojurebot(. :foo (clojure.core/apply clojure.core/vector (clojure.core/seq (clojure.core/concat (clojure.core/list 5)))))
18:46amalloyTimMc: you need applyTo; i don't think any interesting clojure classes have a .apply method
18:46TimMcdammit
18:49patchworkI have a jvm-opt that needs to be set to two different values based on the environment my app is in. Lein has me define :jvm-opts in project.clj, but that means that value is hard-coded! How do I have jvm-opts that are different based on different deploy environments?
18:50abpohpauleez, have you had any problems with the history component of the closure-library? Is this just not closed? http://code.google.com/p/closure-library/issues/detail?id=449&amp;q=history
18:51hyPiRionpatchwork: It accepts JAVA_OPTS and JVM_OPTS as values too
18:51dog_cat11what about using the java system library?
18:52hyPiRionIt'll read those
18:52patchworkhyPiRion: Aha, thanks!
18:54TimMchyPiRion: Hey, what symbols can you get from the beginning of a syntax-quoted forms?
18:54TimMcso far I've gotten list, seq, and apply.
18:55dog_cat11&(java.lang.System/getenv "PATH")
18:55lazybotjava.security.AccessControlException: access denied (java.lang.RuntimePermission getenv.PATH)
18:56dog_cat11&(java.lang.System/getenv)
18:56lazybotjava.security.AccessControlException: access denied (java.lang.RuntimePermission getenv.*)
18:56dog_cat11&(java.lang.System/nanoTime)
18:56lazybot⇒ 32487356433694018
18:56hyPiRionTimMc: fn* through ##'#()
18:56lazybot⇒ (fn* [] ())
18:57TimMcoh, huh
18:57TimMcso that's fn_STAR_
18:57dog_cat11&(java.lang.System/getProperties)
18:57lazybotjava.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
18:58hyPiRionand quote
18:58TimMcunquote, quote, unquote_splicing, var, deref
19:02hyPiRion,``^{+ -} ()
19:02clojurebot(clojure.core/with-meta (clojure.core/list) (clojure.core/apply clojure.core/hash-map (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/+)) (clojure.core/list (quote clojure.core/-))))))
19:02hyPiRionanother one
19:03TimMcWhoa, I didn't think I could get with-meta.
19:03hyPiRionyeah, me neither
19:04gfredericksyou guys are breaking new ground
19:04aperiodichave you tried writing a syntax-quote fuzzer to look for symbols?
19:04TimMcWow, plenty of stuff has withMeta methods, but nothing has with_meta, of course.
19:06TimMcThere may be some neat tricks one can do with the stitching macros.
19:08gtrakwhat is happening?
19:09TimMcLine-noise explorations.
19:09gtrakah, swearjure?
19:10TimMc&(clojure.walk/macroexpand-all '(->> 0 (->> 1 (->> @2 (->> 3))))) ;; I have no idea what I'm doing
19:10lazybot⇒ (0 (1 (clojure.core/deref 2 3)))
19:11TimMcHuh: ##(clojure.walk/macroexpand-all '(->> . :__ (->> @ two (->> args))))
19:11lazybotjava.lang.StackOverflowError
19:12gfredericksTimMc: can I claim credit as the inspirer of swearjure?
19:13jlewisurgh, more print-method confusion: ##(methods print-method)
19:13lazybot⇒ {nil #<core$fn__5236 clojure.core$fn__5236@62312b>, java.util.regex.Pattern #<core$fn__5342 clojure.core$fn__5342@e2e191>, clojure.lang.Symbol #<core$fn__5262 clojure.core$fn__5262@16fc264>, :default #<core$fn__5232 clojure.core$fn__5232@81229a>, clojure.lang.IR... https://www.refheap.com/paste/8289
19:13TimMchyPiRion linked to the logs, but he really should throw in a link to one of your sites as well.
19:13xeqiwouldn't that generate negative cred?
19:13jlewisoh, wtf, it overflows in my repl
19:13jlewisi think my repl has screwed up state.
19:15hyPiRionTimMc: Link?
19:16TimMcgfredericks: Link?
19:17TimMcWow, ->> and -> are really screwed up.
19:17TimMc&(clojure.walk/macroexpand-all '(-> a (->> b c)))
19:17lazybot⇒ (c (b a))
19:17TimMc&(clojure.walk/macroexpand-all '(->> a (->> b c)))
19:17lazybot⇒ (a (c b))
19:20hyPiRion&(->> ~@[hurr durr] quote)
19:20lazybot⇒ (clojure.core/unquote-splicing [hurr durr])
19:21gfredericksTimMc: gfredericks: huh?
19:21gfrederickswait you guys are actually posting credit about swearjure somewhere?
19:21gfredericksis there a git repo or something for this stuff?
19:22hyPiRionnot "credit", I just mentioned it here: http://hypirion.com/musings/swearjure
19:22amalloysee if you can get it a wikipedia entry, gfredericks
19:22gfrederickswell look at that.
19:22mpanoh hey I just ran into that article on Hn
19:22TimMc&(let [wtf (iterate macroexpand-1 '(->> . :__ (->> @ two (->> args))))] (= (nth wtf 5) (nth wtf 9)))
19:22lazybot⇒ true
19:22TimMchyPiRion: macro-expansion loop!
19:23hyPiRionTimMc: Wow, these macros
19:23TimMchyPiRion: gfredericks has a bug open on -> not expanding intuitively
19:23gfredericksoh I don't have anything worth linking it to
19:23TimMcHome page? github?
19:23gfredericksgfredericks.com or twitter.com/gfredericks_
19:28amalloyTimMc: that wtf doesn't fit in my head at all. what do?
19:28gfrederickshyPiRion: is an "algorist" an algo person?
19:29hyPiRionhttp://en.wikipedia.org/wiki/Algorist
19:29hyPiRionyeah
19:29gfrederickswait
19:29TimMcamalloy: I'm... not sure.
19:29gfredericksI just confused "agda" and "algo" in my head :)
19:30gfredericksTimMc: amalloy: both are nil?
19:30TimMcNope.
19:30gfredericks&(macroexpand-1 '(->> . :__ (->> @ two (->> args))))
19:30lazybot⇒ (clojure.core/->> (clojure.core/->> . :__) (->> (clojure.core/deref two) (->> args)))
19:30TimMcPut this in your REPL: (pprint (take 8 (iterate macroexpand-1 '(->> . :__ (->> @ two (->> args))))))
19:31TimMcmacroexpand-all will do a stack overflow
19:31TimMcAnyway, notice the last item and the fourth item are the same.
19:31amalloyTimMc: macroexpand-all overflowing isn't very interesting, because clojure.walk is trash. it's only interesting if macroexpand also overflows (which i think it does, right?)
19:32TimMcYeah, it does.
19:33TimMc,(macroexpand '(->> a b (->> (c d) (->> e))))
19:33clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.StackOverflowError>
19:33TimMcFiling a JIRA, I guess.
19:33gfredericks,(macroexpand-1 '(->> a b (->> (c d) (->> e))))
19:33clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.StackOverflowError>
19:33gfredericksoh wow
19:33hyPiRionWell, what is is supposed to expand to?
19:34TimMcgfredericks: Oh, that's new.
19:34gfredericksTimMc: put my name in the blog post about it
19:34TimMchyPiRion: Hell if I know.
19:35gfredericksI don't think the bug I filed would explain any of that
19:35TimMcSo, I guess I accidentally quined a macro!
19:36gfredericksmacroexpand-1 overflowing is really bizarre
19:36TimMcgfredericks: I think it's just clojurebot.
19:36gfredericks,(#'->> nil nil 'a 'b '(->> (c d) (->> e)))
19:36clojurebot(clojure.core/->> (clojure.core/->> a b) (->> (c d) (->> e)))
19:36TimMc&(macroexpand-1 '(->> a b (->> (c d) (->> e))))
19:36lazybot⇒ (clojure.core/->> (clojure.core/->> a b) (->> (c d) (->> e)))
19:36gfredericksah phew
19:36TimMc&(macroexpand '(->> a b (->> (c d) (->> e))))
19:36lazybotjava.lang.StackOverflowError
19:37gfredericksso presumably my patch to ->> would eliminate the quining?
19:37TimMcI tmight.
19:37gfredericksmy apologies if it gets accepted
19:37TimMcheh, no, it really should
19:37TimMcGot the issue number handy?
19:38gfredericks$google CLJ-1121
19:38TimMcthanks
19:38gfredericksyou're gonna comment?
19:38TimMchellz yeah
19:38hyPiRion$kill
19:38lazybotKILL IT WITH FIRE!
19:38gfredericks$bill
19:39TimMcgfredericks: Actually, do you have that patched Clojure handy?
19:39gfredericksas a branch you mean?
19:39gfredericksI believe so
19:40gfrederickscheck my clojure fork
19:40gfredericksa branch called threading or something I think
19:41gfredericksactually I don't see it o_O
19:41TimMc(Read: I'm too lazy to go find your fork, can you try that macroexpansion out?)
19:41gfredericksoh gotcha
19:41gfredericksnot easily :) sorry
19:41TimMcI'll just grab the patches tonight if you're busy.
19:41gfrederickswell wait
19:42gfredericksnope cancel that; don't have it
19:42TimMcokey doke
19:42dnolenso reduce can be short circuited in 1.5.0
19:43gfrederickssounds right
19:43dnolenI should have known that - but nobody brought that up last time I asked about it :)
19:43gfrederickshow do you do it? call a function that constructs a special type?
19:43amalloyyes
19:43amalloy(reduced 10)
19:44gfrederickswell look at that.
19:44dnolenSWEEEET
19:44gfredericksis it a deftype?
19:44gfredericksor a java class?
19:44Bronsa it's a class
19:44amalloydnolen: you may be excited to know that each reducer needs to implement support for reduced by hand, and some of them do it wrong (or at least did before being patched)
19:45dnolenamalloy: I'm assuming their fixed in RC1 right?
19:45gfredericksdoes clojure not define any types or protocols? I wonder why it would be avoided...
19:45dnolenamalloy: but yes, needing to support reduced in the implementation makes sense to me, how else could it work?
19:45hiredmanclojure does both
19:46gfrederickshiredman: both types and protocols you mean? any idea why clojure.lang.Reduced wouldn't be a type then?
19:46gfredericksI assume there's no real need either way, but still...
19:46amalloydnolen: i fixed the one i noticed. i don't remember if the patch was actually applied
19:46gfredericksI guess that would throw an extra ->Reduced function into clojure.core that would be kind of silly
19:47gfrederickss/silly/distracting/
19:48gfrederickshuh; cljs doesn't do ->Foo for deftypes
19:48hiredmangfredericks: my guess is it makes it easier to work with from the jvm impl, but RT has RT.isReduced
19:49hiredmanbut the collect types that implement things like kv-reduce in java need to be able to check for reduced
19:50gfrederickshiredman: that makes sense
19:50amalloy,'&1
19:50clojurebot&1
19:50TimMcheh
19:50amalloy,(symbol "echo 1")
19:50clojurebotecho 1
19:50TimMcwait, nooooo
19:50amalloyhyPiRion: there. problem solved
19:50TimMcHow will I inc myself now?
19:50amalloyyou monster
19:50hyPiRionecho 1
19:50lazybot1
19:51gfredericksamalloy: patching up the botholes?
19:51hyPiRionah, nice.
19:53TimMcHmm, how do I start the clojure REPL if all I have is the clojure core jar?
19:53hyPiRionclojure.main
19:53TimMcHuh, OK.
19:56TimMcgfredericks: (b a (c d e))
19:56TimMcYour patch works!
19:56gfrederickssweetso!
19:57gfredericks(defne sweetso [x] ([:candy]) ([:muffins]))
19:57gfredericksor rather (def sweetso #(membero % [:candy :muffins]))
19:59amalloydnolen: yeah, my patch to reduced did get applied. so i don't know of any incorrect implementations of it at this time
20:00RaynesNo more multibot quines, guys. Sorry to ruin your fun, but amalloy added a global ignore feature.
20:00amalloythey know, man. i announced it
20:00RaynesNow we've both announced it.
20:00xeqiecho am I on ignore?
20:00lazybotam I on ignore?
20:01gfredericks,(println "/nick cloojurebot")
20:02clojurebot/nick cloojurebot
20:02Raynesgfredericks: That isn't a thing though.
20:02amalloynext step: adding a $ignore command to modify it at runtime so i can shame people with "$ignore gfredericks because he's a twerp"
20:03TimMc,(symbol "\u0001ACTION has baggy pants")
20:03nybbleshello, i want to update some shared state, do a HTTP request and only have that change to shared state persist if the HTTP request is successful. if it is unsuccessful, the change should be unrolled. what's a good way of doing that?
20:03TimMcamalloy: Here's that broken ->> in action: https://www.refheap.com/paste/8292
20:05TimMcnybbles: Can you do the HTTP request first and then change shared state based on its results?
20:06nybblesthe problem with that approach is that the HTTP request acts on a remote resource, and i change the shared state to make sure that another part of the program doesn't delete the remote resource
20:07nybblesso i was thinking of changing the shared state to make sure that I continue to have access to the remote resource.. update the remote resource with a POST and then if that POST is successful, not roll back the local shared state
20:13nybbleshmmm i just got an idea of using two refs instead of one atom, where one ref holds the number of outstanding POSTs and we dont do any deleting while that number is > 0
20:14TimMchyPiRion, gfredericks: The minimal form of that pathological case is (->> a b (->> c d))
20:15pandeirotechnomancy: what would be the easiest way to add a new route via nrepl, given your heroku webapp template?
20:16technomancypandeiro: not sure I understand the question?
20:17pandeirotechnomancy: sorry, let me try again: is there a way to change the app's routes w/o redefining myapp.web/app?
20:17amalloy(->> a b (->> c d)) :: (->> (b a) (->> c d)) :: (->> c d (b a)) :: (->> (d c) (b a)) :: (b a (d c)) is the expansion path that "should" take, right TimMc?
20:18technomancypandeiro: I don't think so. maybe some weird low-level way to do it, but I wouldn't recommend it.
20:18pandeirotechnomancy: ie, if the app's routes were a map or something, you could just assoc a new key... but since ring/compojure work with functions...
20:18technomancypandeiro: something wrong with recompiling?
20:19pandeirotechnomancy: not really, just exploring what having the repl access could possibilitate :)
20:19technomancynearly anything that works locally
20:19weavejesterpandeiro: Why is not redefining myapp.web/app a possibility?
20:19pandeirotechnomancy: but with the extra push step
20:20pandeiroweavejester: well imagining i didn't have the source file open in emacs right next to me
20:20pandeirosay i was on another computer somewhere
20:20technomancypandeiro: well, with the caveat that the local disk is not the remote disk, and most nrepl clients don't support the HTTP transport yet
20:21pandeirotechnomancy: you mean for pushing the changes? i'm confused - what about drawbridge? isn't this working over http?
20:21weavejesterHm, making modifications without the source seems a little iffy to me
20:21technomancypandeiro: drawbridge is a server component
20:21technomancymost nrepl clients don't support the HTTP transport, but `lein repl` does
20:21technomancyerr--I guess it's both
20:22technomancybut you can't use drawbridge from your client unless your client is written in clojure
20:22pandeirotechnomancy: ah, yeah so i'm using lein repl :connect, which i guess i could need wherever i was
20:22technomancyso maybe you could use it in ccw, but not emacs or vim
20:22pandeiroweavejester: yeah i realize that, but say, i dunno, i just wanted to disable a certain route quickly?
20:24pandeirotechnomancy: i did lein repl :connect from *shell*, but is there any reason i couldn't make that the inferior-lisp command or somehow hook up nrepl.el to use the remote repl?
20:24technomancypandeiro: you can use it with inf-lisp
20:24technomancyusing it from nrepl.el would basically require porting drawbridge to elisp
20:25technomancynot sure how hard that would be
20:25hiredmanjust the client part
20:25technomancyright
20:25hiredmanif you have json parsing + http requests it is not to hard
20:25technomancyI would love for someone to pick that up =)
20:25hiredmanyou'd have to write elisp
20:26pandeirotechnomancy: give me another year or two with emacs/clojure and i'm your guy :)
20:26hiredmanhttps://github.com/hiredman/drawbridge-cljs/blob/master/src-cljs/drawbridge/client.cljs is an drawbridge client in clojurescript, and it is async which is a plus when you are single threaded like emacs
20:27hiredmanthe http transport does require polling though, instead of just sending data like with a real connection
20:45bbloomi hate it when you have a cond (or pattern matching) that has a non obvious implicit requirement on the exact ordering
20:55TimMcamalloy: Correct.
21:05tomojso I have a snippet for repl mode 'r' which require/:refers pprint, doc, pst, and requires io and str, and will probably require other stuff that's in core soon
21:06tomojbut forgetting, getting an error, and having to do `r TAB` in every new namespace is still pretty annoying
21:06tomojany sane way to make it any better?
21:06tomojit's not that annoying I suppose, but enough to make me want to change it
21:19gfrederickswow domina uses a single-element namespace
21:19gfredericksthat's hot
21:20BIGBOOMBAHaving trouble installing leiningen on Debian. Tried apt-get, but there was a dependency issue that I couldn't resolve. Downloaded the shell script and put it in /usr/bin, chmodded it, and when I ran "lein" I just got a page full of JVM error messages.
21:20BIGBOOMBALeading off with "Exception in thread "main" java.lang.NoClassDefFoundError: clojure.core.protocol"
21:21gfredericksO_O
21:21tpopeBIGBOOMBA: how did you install the jvm?
21:23TimMcBIGBOOMBA: You'll do better off with lein in ~/bin -- that way it can self-upgrade.
21:23BIGBOOMBAJust from www.java.com, I think. Running "java -version" gives "java version "1.5.0" gij (GNU libgcj) version 4.4.5"
21:23BIGBOOMBAOkay, Tim, thanks, I'll move it there.
21:23BIGBOOMBAYeah, I have the gjc compiler, not javac.
21:24gfrederickswoah the ns order bug is still not fixed in cljsbuild-HEAD?
21:24BIGBOOMBAOr gcj
21:24gfrederickshow long does a guy have to wait without contributing anything before other people fix everything for him?
21:25BIGBOOMBAWould it help if I put the rest of the error messages on pastebin?
21:28BIGBOOMBAHere's what happened after I put the lein script in /usr/bin, chmodded it, and tried to run it
21:28BIGBOOMBAhttp://pastebin.com/QQs6WMMy
21:29tpopeBIGBOOMBA: I haven't yet tried with lein, but every time I install gcj rather than the official jvm, I always end up regretting it
21:29tpoperunning into weird issues exactly like this
21:30BIGBOOMBAYou mean the official java compiler? I had a JVM installed before I downloaded gcj. Do you mean that I should replace gcj with javac?
21:34amalloygcj is useless trash
21:35tpopeBIGBOOMBA: that would be the first step I tried
21:38TimMc"incompatible type on stack" <-- never seen *that* before
21:39BIGBOOMBAI'm at Java's website, on their JDK download page. Can I use OpenJDK with javac? I'd prefer to use open-source tools if possible.
21:40dog_cat11that should work
21:42TimMcSure, I use OpenJDK 6.
21:43BIGBOOMBAapparently i have java 1.5 and not openjdk
21:45BIGBOOMBAshould i use openjdk 6 instead of 7? is there a problem with 7?
21:47xeqiBIGBOOMBA: I'm using openjdk7 just fine
21:48xeqiinstalled on ubuntu with `apt-get install openjdk-7-jdk`. I'd expect debian to have a similar package, or at least one for openjdk-6
21:48dog_cat11did you check your repositories?
21:51gfredericksit's odd that domina doesn't have any kind of dom-ready facility
21:59bbloomgfredericks: that's b/c gclosure doesn't have a dom-ready facility
21:59arrdemtoday I learned that terrible things happen when you rebind the "apply" function.
21:59bbloomgfredericks: and that's b/c google doesn't want their apps to use it
22:02amalloyarrdem: no kidding, huh? that's gotta be in the top ten list of "worst functions you could redef"
22:03arrdemamalloy: I figured I was gonna be okay because there wasn't much else in that namespace and I only :required :as it elsewhere but next thing I knew I had build-breaking null pointer exceptions everywhere
22:08gfredericksbbloom: interesting; I found a good explanation for that; thanks
22:27TimMcRaynes: I think I broke lazybot, could you restart it?
22:29amalloyTimMc: what did you do?
22:30amalloydid you redefine the 'let macro or something? his error message is bizarre
22:30TimMc*looks
22:30TimMcI... I'm not entirely sure?
22:30TimMcI *may* have been slightly trying to get eval.
22:32xeqioooh
22:33TimMcAw, c'mon, don't take away my toy!
22:33TimMc\o/
22:33amalloy&1
22:33lazybot⇒ 1
22:34amalloynext time you break him, keep a log of what you did or i'll take away your toy
22:34TimMcOh, yes -- I *did* redefine let. My bad.
22:34TimMcI'll test stuff in my own REPL first.
22:37amalloyhah! well, of course you shouldn't have been able to redefine let
22:37TimMcYeah, but if I tell you how I did it you'll close the hole and I won't be able to finish my trick.
22:38TimMcI'll try very hard not to break it, then tell you.
22:38amalloy*chuckle* okay
22:39xeqiarrdem: some previous ones http://nelsonmorris.net/2012/09/06/breaking-lazybot-out-of-clojail.html
22:40TimMcHey, that's me!
22:40xeqiit is!
22:40arrdemxeqi: cheers, looks like an interesting read!
22:41RaynesTimMc: Whatever it is, please don't mention it in public. I really don't feel like spending the week working on clojail. :p
22:41TimMcWell, this one is pretty obvious. No offense.
22:41TimMcRaynes: Yeah, I'll do it responsibly, since it's a clojail problem, not lazybot.
22:42RaynesOffense takne.
22:42Raynestaken*
22:42arrdemlol
22:42TimMcOr maybe it's just lazybot's settings, in which case I'll blurt it out at an inconvenient time.
22:42RaynesWhen do you plan on letting me know what it is?
22:43TimMcTonight?
22:43TimMcHow long will you be up?
22:44RaynesI'll be here for the rest of the night. Just trying to figure out what you're waiting for.
22:44TimMcmy code to be ready
22:44TimMcOK, gonna try a basic case...
22:44RaynesWell, if it's super obvious, how hard could it be?
22:45arrdemVery Easy™
22:45amalloyps TimMc i'm spying on your PMs to lazybot
22:45TimMcRaynes: Well, this time I'm not bashing randomly on my keyboard so that I don't crash lazybot.
22:45TimMcamalloy: onoes!
22:46xeqiI hope its a previously unknown one
22:50TimMcamalloy: I'm imagining you laughing to yourself as I struggle with this. :-(
22:51amalloyi'm not watching you as carefully as all that
22:51TimMcgood
22:52amalloybut your p here is a function value, not a var, so your strategy can't change it
22:52TimMcamalloy: By the way, is this a clojail bug or a lazybot bug?
22:52Raynesclojail
22:52TimMceep
22:52RaynesAnd not a big one either.
22:53Raynesxeqi has some other cute standing vulnerabilities I need to fix soon.
22:53TimMcI was pretty surprised it worked. (For some value of "worked".)
22:54TimMcamalloy: Am I just completely misunderstanding this feature?
22:56amalloyi dunno. i thought i knew what you were doing but i'm wrong
22:56TimMchaha
22:56amalloyjust PM people with what you're actually doing. spying isn't easy
22:56RaynesI support this motion.
22:56amalloyunless you want to do it in secret, and then stop asking for feedback
22:57arrdemtake this to #break-lazybot?
22:57RaynesNo.
22:57TimMcWell, it's late enough at night for me that I don't feel like going the last mile, and anyway you already know the exploit.
22:57TimMcarrdem: Nah, I don't know how to lock down a channel.
22:57TimMcRaynes: -> PM
22:58blackdoghey - is there a way to look up docs of a clojure form from the repl?
22:58arrdem ,(doc doc0
22:58clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
22:58arrdem ,(doc doc)
22:58clojurebot"([name]); Prints documentation for a var or special form given its name"
22:58blackdogcheers
22:58arrdemglad I could help
23:03arrdem,(doc comment)
23:03clojurebot"([& body]); Ignores body, yields nil"
23:08gtrakhmm
23:09bbloomi love update-in so much that i made an update-top for a stack and i've got an (update-top stack update-in [:some-key] f arg) and it's glorious
23:12gtrak(swap! stack update-top update-in [:some-key] f arg)
23:12arrdemis there a clean way to print the symbols and values of a let form?
23:12tpopebbloom: when I showed you my netrc parser, it was in dire need of such a construct, and you just told me the low level stack operations aren't really used :(
23:12tomoj(println (second let-form)) :P
23:13gtrakarrdem: you most definitely need a macro for this
23:13arrdemtomoj: .... are you for real?
23:13bbloomtpope: i forget the details of that situtation
23:13tomojI don't know what you mean
23:13tomoj&(println (second '(let [x 42] x)))
23:13lazybot⇒ [x 42] nil
23:13tpopeI'm sure you did
23:13bbloomupdate-top is pretty easy tho: (defn update-top [stack f & args] (conj (pop stack) (apply f (peek stack) args)))
23:14arrdemah. that makes more sense. oookay. thanks @gtrak, @tomoj
23:14bbloommaybe i was suggesting you destructure from the top of the stack? that's more common than pop & peek
23:15tpope(conj (pop stack) (assoc-in (peek stack) [1 (keyword k)] v))
23:15tpopeis what I had
23:15bbloomah
23:15tpopeI don't think you had any suggestions, but then we derailed on to that whole "default" requirement
23:15tpopeand then amalloy just rewrote it
23:15arrdem,(str (quote foo))
23:15bbloomtpope: heh, oh well. my new suggestion: update-top :-)
23:16clojurebot"foo"
23:16amalloybbloom: which is in useful, if someone happens to want it, named update-peek iirc
23:17bbloomamalloy: i still haven't really dug into useful
23:17blackdogbbloom: update-in looks a lot like lenses
23:17bbloomblackdog: how so?
23:18blackdogcomposable way of navigating data structures
23:18bbloomblackdog: lenses are pairs of functions (A -> B, B -> A)
23:18gtrakarrdem: take a look at this awfmacro I made and never use: https://gist.github.com/4499370
23:18amalloylenses are how you can trick a strongly-typed map into supporting update-in
23:18blackdogunless i've misread what update-in does
23:18gtrakawful* it parses a let form and dumps the bindings into a map
23:18bbloomin this case, it's get-out/put-in
23:18bbloomwhich is only a subset of a full lens
23:19bbloomalbiet a useful subset
23:20bbloomupdate-whatever functions remind me more of common lisp's setf
23:20bbloombut non-mutating
23:20blackdogbbloom: yeah. i'm coming from the haskell world, just trying to find analogs.
23:21bbloomgotcha
23:21bbloomanyway, gotta go
23:22arrdemperfect... https://www.refheap.com/paste/8310
23:22tomojhmm
23:22tomoj`modL l f a = setL l (f (getL l a)) a`
23:23arrdemwell... that'll break if you do destructuring...
23:23gtrakarrdem: my macro also handles destructuring propely
23:23gtrakproperly*
23:23arrdemgtrak: exercise for the reader. gimme a minute here.
23:23gtrakthat's what all the tree-seq stuff is for
23:26arrdemgtrak: (filter symbol? (tree-seq seq? identity <root>))
23:26gtrakpossibly :-)
23:26gtrakI'm not a tree-seq ninja
23:26arrdem,(seq? (first {:foo :bar}))
23:27clojurebotfalse
23:30gtrakI guess map-entries aren't seqs?
23:31arrdemright, so that tree traversal wouldn't get {:keys [foo bar baz]}
23:36arrdemgtrak: haha cute! yours just uses (destructure), amirite?
23:37gtrakhmmm, I wonder why it wouldn't work with out that
23:38gtrakit seems like I could just expand bindings, too
23:39gtrakyea, that's just my macro noob-ness, I think
23:39gtraki think it'll work without explicitly calling destructure
23:39gtraksince let does it for you anyway
23:41arrdemgot it.
23:42arrdemgtrak: https://www.refheap.com/paste/8312 that'll do anything that (destructure) can and therefore all destructurings that clojure supports.
23:42gtrakI spent like a couple days 6 months ago thinking about that
23:43gtrakah, you avoided the tree parse entirely?
23:43gtrakthe problem I solved by not doing that was avoiding the gensyms
23:44arrdemyerp. if you look at the source for (let) you'll find that it uses (destructure) to do all the binding vector parsing and (gensym)ing
23:44gtrakright, I didn't want the gensyms
23:44gtrakthat simplifies it
23:45gtrakdestructure is also a monster
23:46arrdemoh I agree. gave up halfway through reading it.
23:54gtrakarrdem: that's a useful macro... I've been doing something with similar intent by wrapping bindings in a def and sending them to the repl, an emacs keyboard macro
23:55gtrakmuch dirtier..
23:56gtrakbut I have the benefit of saving values off in vars and 'stepping' through a huge let-form
23:56gtrakI just wish I knew how to make it not a keyboard macro (not enough to learn how just yet)