#clojure logs

2014-03-14

00:02dnolen_noprompt: hrm interesting, will have to look at that more closely later
00:03nopromptdnolen_: cool. tl;dr it creates an object that doubles as a literal and a function which returns a literal that doubles and a function...
00:04noprompt*as function
00:18seangrove$seen bbloom
00:18lazybotbbloom was last seen quitting 3 hours and 51 minutes ago.
00:23arrdemanyone worked with influxdb and care to comemnt on it?
00:30nopromptthere *another* new db?
00:33arrdemnoprompt: this one is some weird fake nosql monster intended for time series logging
00:33arrdemnoprompt: implemented in Go apparently..
00:34chareGo sucks shit
00:34charewhy does anyone use it?
00:34jaimefthey dislike Oracle?
00:34technomancybecause rob pike
00:35seangroveDamnit, I keep adding chare to my ignore list, but erc doesn't seem to persist it across restarts
00:35chareseangrove why you hate me bro?
00:35arrdemseangrove: goddamnit neither is mine...
00:35seangroveTime to open up init.el
00:35charewhy does everyone hate me?
00:36arrdemchare: because you're a waste of valuable bandwidth and more valuable brain cells
00:38arrdemthat's better...
00:59charedo you guys agree that Clojure > Go ?
01:00jaimefdepends on what you want to do
01:00TEttingergozala: nice work on https://github.com/Gozala/wisp
01:00jaimefand if you need java
01:01jaimefchare: I would love if I could do this in clojure with threads and perform as well on 1k machines. https://github.com/ober/labrat/blob/master/collectors/Go-lang/collector.go
01:01charejaimef: why does Clojure not work for that+?
01:02jaimefcost of threads > goroutines
01:02charedoesn't clojure have lightweight threads or something?
01:02sid__Hi, can anyone suggest a way to set true in seq (false false false false) if I have a seq of index positions, eg: for (2 3) I need to get a (false false true true)
01:02jaimefchare probably. I'm just not that good enough in clojure yet to acheive the same.
01:03arrdemjaimef: please don't feed chare.
01:04arrdemjaimef: he's one of an elite group: those who managed to get themselves banned from #clojure
01:04amalloywow, i didn't know anyone used amalloy-utils, iwilcox
01:04sid__Hi, can anyone suggest a way to set true in seq (false false false false) if I have a seq of index positions, eg: for (2 3) I need to get a (false false true true)?
01:04jaimefarrdem: thanks :P
01:04amalloyi haven't used it for years; when geni hired me, i merged the parts of it i still liked into flatland/useful
01:04arrdemjaimef: /ignore is a glorious thing :D
01:04jaimefamen
01:04sid__or for (0 1 2) -> (true true true false)
01:05jaimef.oO(trollBot to alert new folks )
01:05chareI'm not a troll
01:05dsrxoff-topic: what's the name of the big block of comments at the top of an emacs mode file, with documentation + copyright info and all that
01:05dsrxahh the commentary
01:05amalloysid__: i'm sure someone will get to your question soon. in the meantime, please be patient: irc is not an instant-help hotline
01:05iwilcoxamalloy: I tried to hack something similar together myself, questioned the wisdom/approach/awkwardness of my crappy n00b code, and googled the typical keywords I thought one might use to do it. Seeing you do it was kind of validating. :)
01:06iwilcoxamalloy: But I'll be taking a closer look at -utils as a result :D
01:06amalloyiwilcox: yeah, and indeed that's one of the functions i liked enough to carry over. it's now flatland.useful.map/keyed
01:06muhoo_so many people have libraries of homegrown utiities not in the language.
01:07sid__amalloy, I did it by setting values in an array for the index and then converting it to seq, is there a better way?
01:08amalloy&((fn replace-indexed [x replace? coll] (map-indexed (fn [i v] (if (replace? i) x v)) coll)) true #{0 1 2} [false false false false])
01:08lazybot⇒ (true true true false)
01:10amalloyor if your input were a vector, you could just (reduce #(assoc % %2 x) v indices)
01:12jaimefnrepl is pretty nice on stack traces
01:22sid__amalloy, there's a difference of 0.10196800000000006 msecs in what I was doing and what you did
01:22amalloywhat. who cares
01:23amalloywrite code that looks good and reads well
01:23arrdem(inc amalloy)
01:23lazybot⇒ 90
01:23sid__but I see you used sets, converting from seq to sets will take some time itself
01:23sid__thanks anyways
01:24zspencer(inc amalloy)
01:24lazybot⇒ 91
01:24sid__(inc lazybot)
01:24lazybot⇒ 22
01:24TEttingeris that a... tenth of a millisecond difference?
01:24TEttingeris that even measurable?
01:25zspencer(inc inc)
01:25lazybot⇒ 7
01:25arrdemTEttinger: the JIT will fix that give a couple thousand passes..
01:25sid__lol, I just trying to find out the difference
01:25sid__not that I care about it
01:25sid__I was*
01:25TEttinger(dec seangrove's dare)
01:25lazybot⇒ -1
01:25trap_exitis there an easy way to check if (into {} is lazy or not lazy ) ?
01:26seangroveTEttinger: I go by the beat of different drum
01:26amalloyTEttinger: don't forget the 6e-20s difference at the bottom there
01:26arrdem,(type (into {} [[:a :b] [:b :c] [:d :e]]))
01:26clojurebotclojure.lang.PersistentArrayMap
01:26amalloytrap_exit: into is never lazy
01:26amalloymaps are also never lazy
01:26trap_exitwell, maps are not lazy, but map is lazy
01:27trap_exitI had (into {} (map ... ... )) in mind
01:27TEttingertrap_exit, you can be sure that it ISN'T lazy if you use mapv in place of map
01:27trap_exitamalloy Tettinger: interesting, thanks!
01:27trap_exithttp://clojure.github.io/clojure/clojure.core-api.html#clojure.core/mapv is new to me
01:28amalloywhaaaat. why would you mapv here
01:29trap_exitamalloy ... Tettinger
01:29seangroveamalloy: I make sure it's not lazy, before feeding it to into
01:29trap_exitround 1, fight!
01:29TEttingerI personally use it when I don't know how things would act with laziness
01:29amalloyseangrove: ???????
01:29seangroveamalloy: Sorry, sorry, just joking
01:29amalloynothing makes sense anymore, i resign
01:29trap_exitTEttinger wins
01:29amalloyTEttinger: seriously though, that's a terrible reason to use mapv
01:29trap_exitround 2
01:29trap_exitstart!
01:29TEttingerhaha ignorance takes the day!
01:29arrdem(inc ignorance)
01:29lazybot⇒ 1
01:29TEttinger:-(
01:30amalloyuse it when you *know* what you need; map is the right default. if you don't know which you need, figure it out! better to know things than paper over them
01:31trap_exitman
01:31trap_exitclojure battles not nearly as fun as mortal kombat or rap battles
01:31TEttingerI don't know everything amalloy, and I really don't have enough working memory to track the laziness behavior of every function without looking it up...
01:32amalloyyou don't need to know about every function, really. it's mostly just the data structures
01:32trap_exitI think it's basically: if it returns a list, and it's not doall, it's lazy
01:32amalloynot far off, trap_exit
01:36TEttingerone of the few things that I really dislike about clojure's standard lib is the presence of these "it's a trap" fns. flatten and now mapv? It would be nice if the docstring just said "no don't" next to them so I don't need to ask on IRC everytime
01:37zspenceror it could raise an AckbarException
01:37TEttingeryeah it could be worse
01:39arrdemM-x package-install RET amalloy-this RET
01:39TEttinger(doc flatten) ; [bad idea intensifies]
01:39clojurebot"([x]); Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence. (flatten nil) returns an empty sequence."
01:39amalloyTEttinger: mapv's not a trap
01:39arrdemTEttinger: br0 no
01:39arrdemTEttinger: I used flatten once but did not inhale...
01:39amalloyit's just used in a lot of places where it's not needed, usually for performance gains that just don't matter or because of weird ideas about laziness
01:39trap_exitthere's a standard notation of ! = mutation
01:40trap_exitI'd like something where function name had weird chard to indicate whether it's lazy
01:40amalloyit's a perfectly good function, just not one you should default to
01:40TEttingerthat's not a bad idea trap_exit
01:40arrdemflatten?
01:40arrdem~flatten
01:40trap_exit(inc TEttinger) ;; great minds think alike
01:40lazybot⇒ 15
01:40TEttingerlaziness is a really important of clojure, like the mutation behavior
01:40amalloyunlike flatten, which is truly a trap
01:40trap_exitanyone else think it's a good idea? :-)
01:41TEttingerwell it would need to be in some alternate core.clj
01:41TEttingernot like people don't do that, ztellman did it for primitive-math
01:42TEttingerpersonally I think it would be a better idea if you were starting over, and a bad idea if you weren't
01:42TEttingerbut!
01:44TEttingersomething similar could be handy for learning clojure, I am wondering about a REPL that automatically catches some special exception thrown by all evaled calls in a different core.clj that informs you of the behavior of all fns used
01:45TEttingerso you enter in this alternate repl, (map inc [1 2 3]), and it throws an exception and catches it for map's docs and inc's docs, and extra info that isn't in the docstring
01:45TEttinger(and prints that info)
01:45TEttingersomething like a doc on a macroexpand I guess?
01:50nopromptsometimes it's difficult to put what something does in to works.
01:50noprompt*words
01:51trap_exitwhat consulting rates do people command for cljs + clojure web dev ?
01:51nopromptprobably whatever they feel they're worth. :-P
01:52zspencertrap_exit: depends on how competent I am.
01:52nopromptthere's a pattern here.
01:52trap_exitis $300/hour too high?
01:52nopromptfor one person?
01:52zspencerIf I can deliver working software quickly and effectiely I'll charge up to $150/hr
01:52trap_exityeah
01:53zspencerATM, I would probably only chage like $75 for clojure
01:53nopromptzspencer: don't i work w/ you?
01:53trap_exitanyone here successfully charge $300/hour ?
01:53noprompt:-P
01:54scottjtrap_exit: those rates are for specialized knowledge (not general programming) afaict
01:54zspencerHourly rates (from my experience) top out at ~$200 unless you have incredibly specialized abilities.
01:54zspencerIf you want to get higher you have to figure out how to charge for a solution instead of for time
01:55zspencerWhich carries it's own risks
01:55scottjtrap_exit: it doesn't hurt to find out where no is though.
01:55SegFaultAXI never charge by the hour.
01:55nopromptyeah, i'd say $300 is bananas
01:55trap_exitbananas is what people feed monkeys
01:55trap_exitso it's too low right?
01:55SegFaultAXI'm not a prostitute, so hourly makes no sense when I'm freelancing.
01:55zspencerbananas are a superfood, so it's too high
01:56trap_exitSegFaultAX: yeah, that's what I also feel about charging per hour
01:56trap_exitit feels very weird as an engineer
01:56SegFaultAXI mean really, what can you possibly do in an /hour/?
01:56SegFaultAXCan't even fully get into the flow.
01:56zspencerEarn $XXX
01:56zspencer;)
01:57SegFaultAXI charge by the half-day or day.
01:57zspencerI tend to charge by the week at a certain % of capacity
01:57zspencerbut now I work full time for a real company
01:57zspencerso that's weird
01:57SegFaultAX(Not to say that being a prostitute is bad, just that it's not a sensical model for software development)
01:58nopromptdnolen_: here's the macro helper code in context: https://github.com/noprompt/garden/blob/2.0.0/src/cljx/garden/selectors.cljx#L36-L56
01:58nopromptdnolen_: feel free to comment on the commit if you have time. i'm done hacking on it today.
02:00zspencernice
02:02noprompti never do contract work because i'm too busy dicking nonsense.
02:03insamniacdon't talk about the lady like that.
02:18amalloywhat's the point of using git logs to prove your hours? they're easy to forge, and not terribly instructive anyway depending on your workflow. i'd rather commit things in logical chunks, eg by creating a patch series at the end of the day, than commit something every hour to prove i'm working
02:19trap_exitwithout using the fucktard <blink> tag, how do I show an animated "connecting" status symbol ?
02:19trap_exitsomething that tells the user "eh, something is fucked up, but this symbol is still animated, so you should feel comfort
02:24akhudektrap_exit: css animations unless you care about certain browsers
02:27trap_exitakhudek: http://www.andreaverlicchi.eu/css-3-only-spinning-loading-animation/#.UyKg-VFdUhw is impressive
02:42sid__has anyone used cache in clojure? what cache would you suggest?
02:49bob2sid__, what do you want to cache?
02:50sm0keanyone using datomic over riak?
02:51sm0kesid__: core.cache is "idiomatic" cache for clojure
02:51sm0kehttps://github.com/clojure/core.cache
02:56sid__has anyone used spyglass memcached?
02:58sid__bob2, what do you mean by what do I want to cache?
03:42mindbender1,(name nil)
03:42clojurebot#<NullPointerException java.lang.NullPointerException>
03:43mindbender1Is there a reason why name should throw on nil?
03:45ddellacostamindbender1: what do you expect it to do?
03:46mindbender1(if (or nil (string? x)) x (. ^clojure.lang.Named x (getName)))
03:47mindbender1This has been troubling me for years!
03:47mindbender1ddellacosta: ^^ what do you think?
03:48ddellacostamindbender1: er, you want to get the string from a keyword? Why not just use name?
03:49ddellacostawhy do you do (. ^clojure.lang.Named x (getName)) ?
03:49mindbender1,(clojure.repl/source name)
03:49clojurebotSource not found\n
03:50qq_an_qqno idea ,, !
03:50ddellacosta,(defn not-nil-name [x] (if-not (nil? x) (name x) x))
03:50clojurebot#'sandbox/not-nil-name
03:50mindbender1ddellacosta: that's the source for name I pasted (modified)
03:50mpenet#(some-> % name)
03:50mpenet,(some-> nil name)
03:50clojurebotnil
03:51ddellacostampenet: much nicer than mine. ^ mindbender1
03:51ddellacosta,(some-> nil name)
03:51clojurebotnil
03:51ddellacosta,(some-> :foo name)
03:51clojurebot"foo"
03:51ddellacosta,(some-> "foo" name)
03:51clojurebot"foo"
03:51ddellacosta^ mindbender1 doesn't that do what you need, quite simply?
03:52mindbender1that will mean inviting some-> wherever I need name
03:52mindbender1How computing wise is that?
03:52ddellacostamindbender1: I'm not sure I understand your point
03:53mindbender1The source should be modified
03:53ddellacostamindbender1: which is to say, I don't understand it
03:53ddellacostamindbender1: don't really agree, but I would take it to the dev list if you feel so strongly about it
03:54mindbender1ddellacosta: that's what I'm looking to do
03:54ddellacostausing some-> or just making your own custom fn is not a big deal in the least
03:54ddellacosta,(defn nname [x] (some-> x name))
03:54clojurebot#'sandbox/nname
03:54ddellacosta(nname :foo)
03:54ddellacosta(nname nil)
03:54ddellacosta,(nname :foo)
03:54clojurebot"foo"
03:54ddellacosta,(nname nil)
03:54clojurebotnil
03:55ddellacostamindbender1: but hey, go for it
03:56mindbender1how do I make something like nname globally available
03:58ddellacostamindbender1: maybe using this? https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L211 Dunno, never needed to do that
04:00mindbender1*Forms* to prepend to *every form* -- namespace would be better. Thanks anyway
04:01ddellacostamindbender1: good luck
06:33schmir#/join ethereum
07:06BartAdvis it possible to somehow obtain reference to the 'current' function? say I have add-watch handler that wants to 'remove' itself under certain circumstances
07:06clgvBartAdv: well use a defn ;)
07:07BartAdvbut I'm creating such callback locally
07:08clgvBartAdv: you can name a local function (fn myname [x] ...) but you can only use it for recursive calls afaik
07:11BartAdvdoh, silly me. remove-watch uses the key given when calling add-watch
07:11BartAdvso, problem was not there in first place, thanks anyway;)
07:12clgvBartAdv: a suicidal watch so to say? :P
07:15BartAdvyeah
08:16gfredericks,((fn f [] f))
08:16clojurebot#<sandbox$eval25$f__26 sandbox$eval25$f__26@eb38b5>
08:18tomjack:)
08:23gfredericksI'm really enjoying this `bg` macro: https://github.com/fredericksgary/repl-utils/blob/master/src/com/gfredericks/repl.clj#L98
08:25clgvgfredericks: a future with runtime duration?
08:27clgvI did some progress reporting stuff which is almost as decoupled to be a separate library. but didn't know yet whether it is of general interest
08:27gfredericksclgv: runtime duration, alerts on completion/error, and puts results in vars instead of a derefable
08:27clgvah k
08:27gfrederickswhen you eval 'bg14' it tells you how long that one has been running
08:28clgvah just saw your code above. so the name of a fn is indead a ref to it
08:29gfredericksyep
08:29gfredericksonly when you name it in that style
08:29gfredericksdefn works slightly differently
08:29clgvyep
08:29gfrederickswhich is important when you're playing with dynamic programming stuff
08:39tomjackjava.lang.RuntimeException: Unable to resolve symbol: let in this context
08:39tomjackhmmm
08:42clgvtomjack: interesting. but we can not help you without context info ;)
08:42gfredericksthat's a logical possibility; let is just a macro you can not-refer
08:43tomjackI don't think you can help me
08:43clgv,(resolve 'let)
08:43clojurebot#'clojure.core/let
08:43tomjackthis was 9 jobs in to a 11 job hadoop flow
08:43tomjackwhere each job is the same
08:44tomjackmy hypothesis is that starting a repl with a new version of the jar (probably during the 8th job) caused hadoop to get confused and load the wrong version
08:44tomjackI guess...
08:44gfredericksI don't think we can help you
08:45clgvstarting a repl within a distributed hadoop computation with a different jar version sounds odd..
08:45tomjacknot within, concurrent with
08:46tomjackI just found the exception message funny, since I feel pretty sure I didn't not-refer let..
08:56shep-werkAre there any core.async buffers that are disk-backed (and thus I could claim they are "unbounded")?
08:58clgvshep-werk: zach tellman has a lib for disk-backed queues. maybe you can combine it with core.async which allows you to specify the buffer of a channel
09:01shep-werkclgv: this look like the one you mean? https://github.com/Factual/durable-queue
09:01tomjackb
09:03stompyjCan someone PM me Rich Hickey's public email address? I have a friend who wants to get in touch with him regarding a speaking gig, but can't find his contact info anywhere
09:03stompyjIf he doesn't have a public email addy, could someone tell me how one would go about getting in touch?
09:05clgvshep-werk: yes. you probably just have to implement the protocols for buffers from clojure.core.async.impl.protocols
09:06shep-werkclgv: cool, thanks. I actually have done that once already... I wanted a LIFO buffer instead of FIFO
09:07shep-werkit was pretty easy, so that was cool
09:07gfredericksstompyj: can't you find it from the mailing lists?
09:07clgvshep-werk: yeah, that's one of the reasons why I like protocols in clojure^^
09:08stompyjgfredericks: you' think it'd be cool to just use that one? I kept hoping he'd have a public one, so he didn't think it was intrusive
09:08shep-werkclgv: downside here is that it is a durable queue... wonder what it would take to trick it into a stack :-)
09:09clgvshep-werk: oh, you want a stack here as well ...
09:09shep-werkclgv: i'm just playing around, so I don't /need/ anything :-D
09:10clgvshep-werk: to get a durable stack you'll probably have to implement it yourself analog to the durable_queue
09:11shep-werkanother thing about my particular use case is that I'm not worried about the durability aspect, just the not-bounded-by-memory
09:11shep-werkbut this is probably a great place for me to start exploring, thanks!
09:11clgvshep-werk: so dropping some of the things in the queue would be ok?
09:12shep-werkyeah
09:12shep-werkThis is all predicated from http://www.reddit.com/r/dailyprogrammer/comments/1yzlde/022614_challenge_150_intermediate_reemvoweler_1/
09:12shep-werkWhich spun up some thinking about how I could use core.async with it
09:13shep-werkand a root thing that came up was
09:13clgvwell arent there queues in core.async that just drop items when they are full?
09:13mdrogalisclgv: Yes. Sliding and dropping buffers.
09:13shep-werkI have a goroutine that takes 1 item and produces 3, and puts those 3 back into the original queue
09:13shep-werk(up to 3)
09:13shep-werkso, the # of things in the channel could get large
09:14shep-werkfor that particular problem, I think there is a bound (that I haven't computed) if you do a DFS of the possibilities
09:15shep-werkif you were to do a BFS, then the bound would be much larger
09:15shep-werkthen I started thinking about a filesystem / web crawler
09:15shep-werkwhich would make it hard to know the bounds beforehand
09:15shep-werkso you would probably fall back to at least one unbounded queue
09:16shep-werkwall-of-text over ;-)
09:16clgvshep-werk: DFS can be linear in tree depth when the options at each level can be enumerated
09:17shep-werkyup. So for the reddit problem, it would be something like (* 2 (+ (count vowels) (count consonants)))
09:18clgv*I meant the space requirement
09:18shep-werkAnd so it could have a known bound beforehand
09:18shep-werkAnd that requires the stack buffer instead
09:19clgvshep-werk: if you have information on the input size you can easily decide whether it fits in memory ;)
09:19shep-werkcertainly. But then when I started thinking about a web or directory crawl, I realized I wouldn't know the tree depth or width
09:20shep-werkso a disk-backed queue would be fine for a BFS
09:20shep-werkand the durability would also be a benefit
09:21shep-werkbut since I had also been thinking about a stack...
09:21isaacbwhow do you usually handle abstraction with clojure? Would you have several implementations in different namespaces with the same set of functions, and do a require :as ?
09:21isaacbwdepending on which one you want
09:21clgvBFS memory consumption can grow quite badly compared to an equivalent DFS
09:22shep-werkclgv: very much so :-) Sometimes you want to mix and match them - BFS for a few levels, then DFS to try and clear out your backlog
09:23shep-werkisaacbw: what kind of abstraction? My first answer would be "protocols", but it depends on what you are doing :-)
09:23clgvisaacbw: depends how you want to use them
09:23isaacbwshep-werk: like "interfaces"
09:23isaacbwI'll take a look at protocols
09:24clgvisaacbw: definitely protocols when you want something like interfaces
09:25isaacbwI'll give a concrete example. I eventually want to use HBase as my data store, but for now (local development) I just want to use MongoDB, but I want to have a common interface for interacting with my data store abstractly. E.g I want to replace my MongoDB implmentation with an HBase implementation without actually changing any of the code that calls the interface. Would protocols be the thing for that?
09:26isaacbwlooks like it from what I can see
09:28dnolen_isaacbw: protocols or multimethods both work, if you're talking to a database multimethods will probably suffice.
09:28clgvisaacbw: yeah, that's doable with protocols and deftype/defrecord (or even maps with :type metadata)
09:29clgvor what dnolen_ said ;)
09:31felherWhy do different methods get selected when I write (.select #^javafx.scene.control.SelectionModel sm (int index)) instead of (.select sm (int index)). The first one selects the select(int) method, the second one the select(Object) method, though in both cases I pass them an (int index).
09:32felherHello folks, btw :)
09:32tony_greetings
09:33tony_is this a good place for a very stuck newb to get some help?
09:34BobSchackYep what is the problem?
09:34tony_i'm trying to pass an expression into a macro as an argument
09:35tony_gettihg various "Cannot be cast" errors when I try to evalulate that expression
09:36BobSchackdo you have gitpaste / refheap of the macro and expression?
09:36philandstufffelher: it's not the best part of the interop functionality :/ see http://stackoverflow.com/questions/2722856/how-do-i-call-overloaded-java-methods-in-clojure for details
09:36tony_i am not familioar with gitpaste or refheap
09:37tony_those are the standard methods of sharing/showing code here?
09:37felherphilandstuff: okay, thank you :)
09:37BobSchackyep https://www.refheap.com is the standard I believe
09:37clgvfelher: in that case probably "sm" is known as a super class that only has the method with object?
09:39tony_refheap hates my browser (midori) I'll fire up another
09:41felherclgv: maybe someway hidden, but acording to the api documentation ( http://docs.oracle.com/javafx/2/api/javafx/scene/control/MultipleSelectionModel.html ), the superclass is SingleSelectionModel, which has both method, and has only the superclass Object, which doesn't have a select method at all. :)
09:41felher*The superclass ist SelectionModel
09:44isaacbwso is there not a clojure-specific GSoC proposal template?
09:46clgvisaacbw: I dont know. if not at least one proposal was linked on the mailing list lately. so you can have a look how that was done
09:46isaacbwah, thanks clgv
09:56tony_sorry that took so long
09:56tony_https://www.refheap.com/58362
10:01turbopape2Hi guys, I want to know something about STM and maps...
10:01tony_sorry my example expression was wrong i fixed the paste
10:02BobSchackI have a meeting now but http://aphyr.com/posts/305-clojure-from-the-ground-up-macros and http://www.braveclojure.com/writing-macros/ are good starting points for learning macros
10:02turbopape2is the transaction retried when a map is changed as a whole or only if a conflicting key/value has been altered ?
10:02tony_ok - thanks Bob
10:02turbopape2does the STM check nested structures or just the ref as a whole ?
10:03opqdonutthe value inside the ref, i.e. the whole map
10:03opqdonutat least if you're using ref-set
10:03opqdonutbut see also commute
10:04opqdonute.g. http://stackoverflow.com/questions/4999281/ref-set-vs-commute-vs-alter has an explanation
10:09turbopape2ok, thanks opqdonut
10:10tony_anyone else on newb duty? :)
10:11tony_I don't get why x does not evaluate to true at https://www.refheap.com/58362
10:12turbopape2ok I already know this, but my question was, if thread 1 was assoc'ing key1 , and in the meanwhile someone else assoc'ed key 2.... will the transaction be retried ?
10:12turbopape2I suspect yes, BTW, just wishing it was that easy :(
10:12turbopape2oh I mean it is fairly easy, ALREADY !
10:13dnolen_turbopape2: assoc'ing two different keys is commutative so not necessarily
10:14turbopape2ok, so if I use commute, when updating, it will not retry ?
10:14john2xtony_: don't wrap x in parens..
10:14john2xtony_: (if x ...)
10:15dnolen_turbopape2: yes
10:15tony_omg! awesome! thanks john2x!
10:15tony_somehow I spent several hours not figuring that out yesterday
10:15isaacbwis there a paredit command to kill a whole s-exp? I can't find one on the paredit cheat sheet
10:16turbopape2ok cool dnolen _ :)
10:16tomjackisaacbw: no, kill-sexp
10:16tomjackbuilt in
10:17tomjackC-M-k
10:17isaacbwoh, neato thanks
10:28turbopape2oh yeah, with commute that makes sense. Thank you guys !
10:55sverihi, I have a problem that I meet relatively often, I have a list of maps ({:data "foo" :id "first"} {:data "bar" :id "another_id"}) and I have a expected_map like this {:first "foo" :another_id "bar"} and I want to check that each of the values of the expected_map happens to be exactly once in a map of the list of maps. Is there a general solution to this in clojure? or do I have to bruteforce it?
10:56gfrederickswhat migration library am I about to choose? ragtime?
10:59clgvsveri: well bruteforce is a hard word here since you only to search in linear time. `frequencies` might help you
11:00clgvsveri: ##(let [m {:a 1 :b 2}, ms [m {:a 2, :b 4}, m {:a 5 :b 9}] ((frequencies ms) m))
11:00clgv,(let [m {:a 1 :b 2}, ms [m {:a 2, :b 4}, m {:a 5 :b 9}] ((frequencies ms) m))
11:00clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
11:01svericlgv: thank you, i gues i get the idea
11:01clgv,,(let [m {:a 1 :b 2}, ms [m {:a 2, :b 4}, m {:a 5 :b 9}]] ((frequencies ms) m))
11:01clojurebot2
11:01gfredericksit wouldn't be unreasonable for lein to throw an error if the defproject contains a duplicate key, right?
11:01clgv,,(let [m {:a 1 :b 2}, ms [m {:a 2, :b 4}, {:a 5 :b 9}]] ((frequencies ms) m))
11:01clojurebot1
11:02clgvgfredericks: maybe this leads back to the discussion about exceptions on duplicate keys in literal forms and function construction
11:03mmgif I have a (defn foo [& args]) and I'm trying to transparently wrap that with (defn bar [& args] (foo args)) how can I do that without ending up with ((args)) in foo? I guess I can macro it, but I was wondering if there was a simpler way
11:11chronnommg: (apply foo args)
11:11mmgThank you!
11:12chronnommg: np
11:14yedihey seangrove: omchaya doesn't really need tx-listen right? since all app events go through a central controller
11:14seangroveyedi: Yeah
11:14seangroveyedi: I wouldn't mind seeing a different architecture for it though that used tx-listen
11:15seangroveOr the same arch, and an explanation of what it does, why it's important, how it fits into Omchaya
11:30isaacbwokay, so what's the point of a protocol if datatypes that "implement" it don't have to implement all the functions
11:30isaacbwmaybe I'm misunderstanding this
11:31isaacbwI guess protocols are useful for routing the call to the right data type?
11:31isaacbwlike a lightweight multimethod that only matches on type?
11:34shep-werkisaacbw: that's more or less the mental model I use
11:35llasramPlus the ability to `reify` protocols, creating special-purpose/context-specific anonymous implementations of a protocol
11:35gtrakprotocols are adhoc type-polymorphism
11:35cbpisaacbw: the point of protocols is to be a better interface
11:35cbpavoid the expression problem and be faster than multimethods
11:36shep-werkthe ability to not implement methods doesn't bother me... but I also like programming in fairly dynamic languages like Ruby
11:36isaacbwI'm having trouble understanding why you would want to allow a data type to not implement the whole protocol
11:37gtrakif you know the details of how it'll be used and you're being lazy :-)
11:37isaacbwmeh
11:37isaacbwsounds like a "let developers break things at runtime" kind of thing
11:37gtraknever been a problem in practice for us
11:38gtrakthe error messages are relatively obvious
11:38isaacbwI guess I won't worry about it then
11:38shep-werkyeah, your unit tests for that type will smoke it out right quick
11:38cbpsounds like a dynamic language slogan
11:39isaacbwanyone here actually use ClojureScript for their front end apps? I'm worried about the amount of boilerplate that comes with it
11:39gtrakwhat it will protect you from is extending a non-existent method.
11:39cbpI use clojurescript, I have no idea what you meean about boilerplate :-o
11:40isaacbwI'm also worried about how V8/Spidermonkey's GCs handle purely functional data structures
11:40isaacbwcbp: just seems like there's a lot of foundational code that comes along, even with simple programs
11:41shep-werkisaacbw: you dont mean boilerplate that the programmer writes?
11:41shep-werkjust the "standard library" ?
11:41cbpisaacbw: the closure compiler is pretty darn good at removing dead code
11:41isaacbwno, I meant generated boilerplate
11:41isaacbwcbp: maybe I'll give it another go
11:41cbpalso gzipped the size of your apps is comparable to something like jquary + angular or whatever
11:42isaacbwoh, okay then
11:42isaacbwI wrote a purely functional red black tree in vanilla javascript. That was "fun"
11:42gtrakgenerated boilerplate is a non-problem, we also have source maps if you're not comfortable looking at the output, but haven't tried them yet.
11:42isaacbwcouldn't figure out balanced deletion though
11:42cbppersistent data structures also seem to work pretty damn fine
11:42gtrakload time is insignificant.. code size goes down with advanced mode.
11:42cbplook at Om for an example of that
11:43isaacbwcbp: I do have a problem with saying persistent data structures. Technically they are, I suppose, but what schools teach is usually everything *up* to purely functional
11:43isaacbwI guess Rich Hickey says persistent though, so I'll get over it :P
11:44seangrovednolen_ bbloom Either of you coming to the cljs meetup on the 27th?
11:44gtrakit's hard to remeber what persistent means, the things that persist are the complexity bounds of the mutable alternatives :-)
11:44bbloomseangrove: i'm flying back to NY at that time
11:44isaacbwalso,
11:44seangroveAh, bummer
11:45isaacbwone last thing and I'll get back to work: is there a good reason proper tail calls aren't implemented other than that it would a PITA to implement the transformations?
11:45gtrakcan't do it without affecting java interop
11:45isaacbwah, okay
11:45isaacbwmakes sense
11:45nopromptdnolen_: did you get a chance to look at that macro code?
11:46cbpI think there might be a library that gives tco
11:46cbpmaybe something of bbloom i can't remember
11:46gtrakit was cfrisz
11:46isaacbwgtrak: I've heard the excuse that the JVM doesn't support them, but there's no reason that Clojure couldn't do the transformations itself. But interop definitely makes sense
11:46Amnesiou_What is a good, performant way to dedupe a sequence? Would just applying a hash-set do?
11:46gtrakhttps://github.com/cjfrisz/clojure-tco
11:47isaacbwwe're not getting TCO in Java 8 are we?
11:47isaacbwmaybe just lambda
11:47isaacbw?
11:47isaacbw(as far as cool new features go)
11:47gtrakI heard the old apple jvm did it.
11:48Amnesiou_(To answer my own question: "distinct" is much more performant.)
11:48isaacbwas someone relatively new to Clojure (as in, I haven't had time to discover the warts), it seems like tail calls are the one big feature that would make Clojure the perfect language
11:48seangroveisaacbw: It comes with Nashorn, which is more interesting for me
11:48seangroveisaacbw: Use recur?
11:49seangroveIt's nice to have it verified by the compiler anyway
11:49gtrakisaacbw: lazy seqs are a great alternative most of the time.
11:49dnolen_seangrove: I'll be returning that day so I won't be able to make it.
11:49isaacbwI know, but I'm used to scheme and not having to be explicit seangrove
11:49dnolen_noprompt: haven't had a chance yet no
11:49cbpI think removing nil would make it perfect :-P
11:49isaacbwseangrove: a JS engine *shipping* with Java?
11:49isaacbwhrm
11:49isaacbwI left #Node.js after some politics
11:49isaacbwwould be nice to see someone come up with an alternative to its asynchronicity model
11:49dnolen_isaacbw: Nashorn has been in the works for a while now, it's pretty impressive stuff
11:50gtrakcljs on node.jar?
11:50nopromptdnolen_: cool, maybe bbloom might take a look at it?
11:51dnolen_gtrak: definitely https://avatar-js.java.net/
11:51gfredericksdoes vim-fireplace have C-c C-k?
11:51gtrakneat :-)
11:52isaacbwhow does "nlp-commons" sound for this jdbc-like NLP abstraction layer
11:52isaacbwor would CommonNLP be better
11:52isaacbwor maybe contrib.nlp ;)
11:52bbloomnoprompt: what am i looking at?
11:52nopromptbbloom: a macro
11:52bbloom?
11:53nopromptbbloom: or at least the base of one https://github.com/noprompt/garden/blob/2.0.0/src/cljx/garden/selectors.cljx#L36-L56
11:53elfenlaidgfredericks, maybe :%Eval
11:53nopromptbbloom: you can look at the examples below it to see how it works
11:54bbloomnoprompt: why am i looking at this? did you have a particular question?
11:56nopromptbbloom: i'm curious there's a better way.
11:56noprompt*if there's
11:56shep-werkisaacbw, gtrak: the IBM JVM also does (some) TCO
11:57bbloomnoprompt: i'd have to study a lot more than that one macro to grok what's going on :-P
11:58nopromptbbloom: the examples don't help. :-/
11:59nopromptbbloom: basically do-selector-fn create the code for a function which takes a single argument and returns a reified instance that satisfies IFn and ICssSelector
11:59nopromptwhen you invoke the instance it returns the same thing.
11:59nopromptonly when you call p/selector on it does it give you the string representation.
12:00bbloomand ICssSelector is essentially your AST node class?
12:00nopromptbbloom: no it's just a protocol
12:00nopromptbut i suppose you could think of it that way
12:00gfrederickselfenlaid: cool thanks!
12:00bbloomnoprompt: yeah, but do you have a tree of them that is recursively printed in to a css selector string, yes?
12:01bbloom(i think of *everything* that way :-P)
12:01nopromptno trees in this instance.
12:01elfenlaidgfredericks, you may also read this post http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118 kind of awesome :)
12:02bbloomnoprompt: i'm sorry, i'm working on some other stuff right now so i can't dig in at the moment
12:05nopromptbbloom: no worries. :-)
12:06isaacbwso I like the name "nlp commons" but I'm worried that people will think it's something that it's not
12:13nopromptis there a name for this pattern: (fn x [a] (fn y [b] (fn z [c] (x c))))
12:14pyrtsaCurrying? Making a partially applied function?
12:15nopromptit's not totally though because z just ends up returning x
12:15pyrtsaOh, wait, was calling the (x c) in the end part of the question?
12:15nopromptyes
12:15cbp`a closure? :P
12:16RaynesCurrying isn't just partial application.
12:16Rayneshttps://en.wikipedia.org/wiki/Currying
12:17clgvRaynes: yeah, it also makes food delicious
12:17RaynesYes.
12:17RaynesI remember when Chris Granger made those jokes before I had actually ever had indian food.
12:17RaynesWhich is approximately the only curry I've had.
12:17clgv:D
12:19Pupnikhow could you live a life without curry!
12:20RaynesRural Alabama :(
12:21pyrtsanoprompt: Recursion is the best name I could come up so far. :P
12:21seangroveRaynes: But you're in LA now, right? No more excuses. Go grab soem Japanese curry today ;)
12:21RaynesBut think of the pizza
12:22seangroveRaynes: Compelling argument.
12:22nightfly...and Vietnamese curry, and Thai curry
12:22clgvwe have a "currywurst" buffet in our canteen every second friday
12:23isaacbwcan someone explain why it's [com.novemberain/monger "1.7.0"]. What does the / mean?
12:23clgvisaacbw: separation of group/artifact
12:24isaacbwso when I just do [compojure "1.1.6"], what's going on?
12:24isaacbwno group?
12:25TimMcisaacbw: I think that means compojure/compojure
12:26isaacbwhuh, are these packages on on maven central?
12:26justin_smithmany are on clojars
12:26isaacbwoh right
12:26justin_smithwhich is a clojure centric repo, from technomancy who also wrote leiningen
12:26isaacbwI used to know all this stuff, like a year ago
12:26isaacbwtoo much time with JavaScript
12:28technomancyactually I didn't make clojars
12:30justin_smithoh, I thought it was your deal
12:31technomancyxeqi has been doing most of the maintenance recently
12:32isaacbwhmm, why does clojure-mode default to 1 space indentation? Is there a way to change that to two?
12:32technomancyisaacbw: it's two for most forms
12:32technomancywell for most macro forms
12:32isaacbwtechnomancy: I'm trying to use hiccup, and it's doing one for vectors within vectors
12:33isaacbwand one for (html\n...
12:33technomancyotherwise it just aligns with the previous arg
12:33isaacbwI added html to the indent list with 2, but I don't think I can do the same thing for lists
12:33isaacbwer, with 0
12:34technomancyvectors shouldn't introduce any new indentation rules
12:34isaacbwI don't really want 2 space indentation on vectors all the time, just within the (html ) form
12:34technomancyit shouldn't be two for vectors; that's just for function calls
12:35isaacbwyea, but in the case of hiccup it looks a bit more readable with two
12:35isaacbwIn my opinion
12:35technomancyyou mean indenting data like it's function calls?
12:35isaacbwjust in this special case, yea
12:36technomancyno idea
12:36isaacbwor maybe I should juse use something aside from hiccup that actually *does* use function calls
12:37isaacbwinstead of trying to mangle the indentation rules
12:38jjroI've aleph http-server, and I would like to use it with lein ring server, so that I get automatical updates to class files, when I'm editing: https://gist.github.com/jrosti/9551391
12:39jjrousing ring-handler with lein ring does not work
12:39jjronor the approach in gist
12:39jjroapparently there is something that I do not understand
12:40isaacbwhow about instead of setting a static number in define-clojure-indent, I set (n-1) where n is the total number of arguments
12:41isaacbw(unrelated to my previous indentation question)
12:41technomancypersonally I really hate it when people change indentation rules
12:41llasramsrsly
12:41llasramIt's so trivial
12:42technomancybecause it means you're creating your own little world, and every other contirbutor is going to create inconsistencies
12:42isaacbwI see
12:45jjroor, is it not possible to use aleph http-server with lein ring plugin?
12:46isaacbwtechnomancy: I don't know, I just like the idea of a DSL that looks at least somewhat like html
12:47isaacbwthough I guess I don't have to do the crazy indentation n-1 thing to get what I want
12:47justin_smithisaacbw: you could make a custom file type, meant to be read by clojure, with its own mode / rules.
12:47gunsisaacbw: https://github.com/guns/vim-clojure-static/issues/13
12:48gunsisaacbw: A discussion I had about this very topic
12:48isaacbwhold on, so the default indentation for a function call is 1 space, if there are no arguments on the same line as the function symbol, right?
12:48isaacbwoh neat guns, I'll read through
12:48technomancyisaacbw: it's more li
12:48technomancy*like zero columns of indentation
12:49technomancyjust aligned to the function instead of the paren
12:49isaacbwalright
12:49isaacbwis there a reason for that? Or do you just assume that most people will have one argument per line including the first line?
12:50technomancyI would guess it's because if you're adding a line break before any args it's because you are having trouble keeping it under 80 cols?
12:50technomancybut these rules were decided upon before I was even born
12:51isaacbwyea I remember this stuff from CL :P
12:51isaacbwI thought maybe clojure would be a little different
12:51technomancyat least there are no brace placement wars
12:51gunsOTBS
12:52isaacbwye olde lispers should have thought about html DSLs! geez
12:53technomancythey were too busy complaining about how SGML is just a crap sexpr syntax
12:54technomancyhard to find fault with that
12:55isaacbwwas sgml around before paren s-exprs?
12:56technomancyI don't think so
12:56justin_smith"SGML descended from IBM's Generalized Markup Language (GML), which Charles Goldfarb, Edward Mosher, and Raymond Lorie developed in the 1960s."
12:56justin_smithclose I guess? but still newer
12:56justin_smithhttp://en.wikipedia.org/wiki/Standard_Generalized_Markup_Language
12:57justin_smithaha! GML were the initials of the three authors as well, funny
12:57justin_smithhttp://en.wikipedia.org/wiki/IBM_Generalized_Markup_Language like a mashup of keywords, css, and html to my first glance, funny
12:58justin_smithit's cool that we still use all the same tag names
13:10pepijndevosI use compojure with the site handler, which ads params middleware, yet my I get emptyness for a result
13:10pepijndevoshttps://github.com/weavejester/compojure/blob/master/src/compojure/handler.clj#L28
13:10technomancyllasram: have you done much with forth?
13:11pepijndevoshttps://www.refheap.com/58527
13:13sdegutisnoprompt: do you have a way to do {:margin "0 auto"} more conveniently in Gaerdun?
13:13llasramtechnomancy: I wrote a Forth implementation (for the Z-machine), most of it in Forth, but that's about it
13:14nopromptsdegutis: {:margin [[0 :auto]]}
13:14llasramtechnomancy: I did go a little further than most people -- got it passing this (admittedly tiny) ANS Forth test suite I found, and running someone else's Forth Tetris implementation
13:15technomancyllasram: saw your name on a comment on this post about implementing itsy forth
13:15technomancycool
13:15sdegutisnoprompt: neat, I didn't think of using inner-vectors for that
13:15technomancyllasram: been playing with the idea of doing my keyboard firmware in forth
13:16technomancykinda shocked by the fact that there's only one forth on avr that I could find, and it messes with the bootloader
13:16rasmustonkro over usb?
13:16nopromptsdegutis: [[]] <-- space separated list, [] <-- comma separated list
13:16llasramtechnomancy: Oh, neat. That could be pretty cool
13:16llasramtechnomancy: Why does it mess with the boot loader?
13:17nopromptsdegutis: [[1 2] [3 4]] => 1 2, 3 4
13:17technomancyrasmusto: only going up to 6; I don't really care about gaming
13:17isaacbwhow do you collect a lazy sequence into a list?
13:17sdegutisnoprompt: one trick I've done with manual CSS was doing "margin: 0 auto; margin-left: 10px;". The benefit is that you can specify one-off adjustments without having to modify the two-dim default. But it's not possible by default in Gaerdun because maps are unordered.
13:17technomancyllasram: it's not designed for use on arduinos specifically
13:17rasmustotechnomancy: how about keyboard-as-an-instrument? gotta do chords :)
13:17nopromptsdegutis: you can just use two maps in that case and place one above the other.
13:18technomancyrasmusto: well... with modifiers you can do 10 keys
13:18sdegutisnoprompt: I think it'd be cool to add a feature that lets you specify both a default value and some overrides, maybe like {:margin [[0 :auto] {:left "40px"}]}
13:18gunsrasmusto: There was a comment on HN that claimed that nkro over usb can be larger than 6 if you simply declare that in your device profile (and your hardware supports it)? Do you know if this is true?
13:18technomancyand I only *have* ten fingers
13:18nopromptsdegutis: there's no "one map rule"
13:18technomancyso it seems OK unless you are designing a device for extraterrestrials or mutants
13:18sdegutisnoprompt: true but it's nice to keep related rules in the same place.
13:18rasmustoguns: I don't. I just use one of those usb->ps2 adapters
13:19nopromptsdegutis: i typically group everything in to layout, typography, and theme.
13:19gunsrasmusto: Just seems like the kind of knowledge that has become cargo culted, but the truth is in plain sight
13:19clojurebot'Sea, mhuise.
13:19nopromptsdegutis: layout = positioning, dimensions, display, typography = strictly font stuff, theme = everything else
13:20sdegutisnoprompt: sounds like a good idea, but I'm not that pro at CSS yet :/
13:20nopromptsdegutis: it just takes discipline, :)
13:20justin_smithtechnomancy: if you mash your face on the keyboard, I bet you can hit more than ten keys at once
13:20justin_smithdon't forget the useful face-mash potential you could open up!
13:20nopromptsdegutis: i use defstyles to group all those things together, and defrule to abstract common selectors
13:21technomancyjustin_smith: ten keys is already 23% of the total number on this board to begin with
13:21sdegutisi see thank you sir for your time
13:22technomancyllasram: do you know of any good resources on implementing forth with a limited level of C knowledge?
13:22justin_smithor, what if I want to do keyboard-to-midi input to play cecil taylor songs? http://www.youtube.com/watch?v=EstPgi4eMe4
13:22technomancy"Just enough C to get you to the point where you don't need it any more" is what I'm looking for I guess
13:23llasramtechnomancy: Well, most of the Forth resources I looked at start with assembly, so... :-)
13:23technomancyheh, oh right
13:23llasramWhere does the C come in?
13:23llasramOh, ok
13:23technomancyjust trying to bootstrap with minimal effort
13:23technomancymaybe if I don't already know C it'd be quicker to bone up on AVR assembly
13:24technomancyit's supposed to be a decent instruction set
13:24llasramProbably, because that's probably how you'll want to write the primitives you can't/don't want to write in Forth
13:24llasramAre you planning to write from scratch, or port an existing Forth?
13:24technomancyprobably start from scratch
13:25justin_smithand forth has good assembly interop, so you could bootstrap up functionality in a repl on the running forth system if you have a serial into it
13:25technomancyI don't intend it to be a general purpose impl
13:25TimMctechnomancy: Hardware macros allow you to have more than 10 keypresses simultaneously.
13:25technomancyjust enough to get my keyboard firmware running
13:25TimMcbut I feel like that's still excessive
13:25llasramCool. Then yeah -- I think doing the AVR assembly is the way to go
13:25llasramIs there an emulator available?
13:25technomancygood question
13:26technomancyif so it's not in apt
13:26sdegutisnoprompt: and thank you for writing Gaerdun
13:26sdegutisit is nice software
13:27technomancyoh, there's a simulator
13:27llasramAhhh
13:27llasramLess hardcore than Forthing directly to the hardware, but probably easier :-)
13:28technomancyespecially if I want to actually use my keyboard while writing it
13:28llasramYeeeeah
13:28llasramChicken, meet egg
13:29justin_smithwoah, bootstrapping keyboard
13:29justin_smithstart with two working keys, slowly build that up to fully working
13:29technomancybahaha
13:29justin_smith(one key plus mearured timings?)
13:29isaacbwdoes anyone have an idea for a nicer way to write this? https://gist.github.com/isaacbw/9552599
13:30isaacbw(let alone the fact that it won't do exactly what I want, I'm not realizing
13:30isaacbw*now
13:30rasmustoguns: for some reason this video cracked me up: http://www.youtube.com/watch?v=jMjczjhelWM
13:30isaacbwbut in terms of the code itself and what it does
13:31llasramisaacbw: You call `apply str` where `str/join` might be appropriate, and call `str/join` where `str` would be more appropriate
13:31llasramAlso, you probably want to require `clojure.string :as str`
13:33gfredericks`clojure.string :as ring`
13:33llasramlolololol
13:33llasramI don't know why I found that so funny
13:33llasramBut I just frightened my co-workers
13:34llasram(inc gfredericks)
13:34lazybot⇒ 42
13:34seangroveIt's like js.evil
13:36TimMcseangrove: clj.evil would have more alter-var-root
13:36seangroveErr, evil.js
13:36TimMcjs.evil is evil.js's evil twin
13:36seangroveTimMc: The idea was to prevent hot-linking js I believe. It would randomly change global defs
13:36seangrovealert => eval, + => -, etc. But it wouldn't be consistent about it
13:36TimMc*nod*
13:37seangroveReally very lovely, thinking about it
13:38seangroveSomeone should write a polyfilly for evil.js - normalize behavior even when a script with it is loaded
13:39TimMcYou'd have to work pretty hard to get ahold of the original native fns.
13:42isaacbwcan put-clojure-indent take something like *either* 1 or 0?
13:43llasramisaacbw: So, what are you trying to do?
13:44isaacbwI'm experimenting with a little html dsl that looks like: (div { attributes }
13:44isaacbw(div { attributes }
13:44isaacbw (div ...
13:45isaacbwbut I want the indentation to still work if { attributes } is omitted
13:45gunsrasmusto: very face mash friendly
13:45_tim__Hi, is there an easy way to print a ratio as a floating point using format? doesn't need to be very accurate, just to help me debug.
13:45isaacbwmaybe I shouldn't be doing what I'm doing...
13:45llasramMaybe :-)
13:48justin_smith,(format "%f" (double (/ 1 7))); _tim__: there is always this
13:48clojurebot"0.142857"
13:50justin_smithor %g if you need more digits of course
13:51_tim__justin_smith: thanks, is that first converting to a double or casting?
13:51justin_smithI don't think casting exists in clojure? it is a conversion
13:51justin_smithI don't think a ratio would cleanly cast to double
13:51_tim__justing_smith: thanks
13:59boreHello
14:00boreI have a beginners question. Is it possible to partially apply a macro? This doesn't even sound right, but it would be useful in my case
14:00justin_smith,(apply str (map char [104 101 108 108 111]))
14:00clojurebot"hello"
14:00justin_smithno, it is not possible, but you could fake it depending on your needs
14:01borehow could I fake it? is there a general approach?
14:01justin_smith#(or % :default) is one example
14:02justin_smithwait, that's weird - #(and :default %)
14:02justin_smithslightly less weird
14:02justin_smithn/m that's still messed up - what are you trying to do?
14:02borethis is cool but not what I want
14:03boreso I have a macro that wraps a carmine (redis) call and it has a signature of [db body]
14:03boresomething like (defmacro wcar [db body] .....
14:04borenow in any given namespace I alway want db to be the same value
14:04justin_smitha pattern for that is a new function with closure over db
14:04boreso I would ideally like to fix the first argument
14:05borehow would this new function help?
14:05justin_smithis it body or & body?
14:05justin_smithfor the latter you need another macro, otherwise you could maybe use a function
14:05boreit's actuall & body
14:05boreit's actually & body
14:05justin_smithright, so macros cause the need for more macros
14:06justin_smith(defmacro wcardb [& body] `(wcar db ~@body)) ; assuming db is bound in the same namespace
14:06justin_smiththere may be a smarter way to do that
14:07boreI have one like that, but when I caught myself repeating this pattern I thought there might be a more elegant way
14:07justin_smith*is bound, or will be bound by the time the code the macro expands to is invoked
14:07justin_smithmacros beget macros, the other solution is not to use a macro
14:07justin_smith(in the first place - a non macro version of wcar)
14:08borealright so I didn't have a stupid approach
14:08justin_smithI don't think so - maybe someone else has a better suggestion
14:08boreI am not sure how to do that, but I'll have a nose around - it's all still quite new to me
14:09boreI need to delay execution of form passed to wcar
14:09boreso I guess I'm stuck with macros then...
14:09justin_smithan alternative is to require a lambda as argument
14:10dnolen_bore: I would step back and honestly rethink your approach. Just have all functions take db as an explicit parameter. If you think you macros something is wrong. macros are always the very last thing to think about, and usually you realize you probably don't need them.
14:10justin_smith(inc dnolen_)
14:10lazybot⇒ 1
14:10justin_smith(inc dnolen)
14:10lazybot⇒ 14
14:12TimMcdnolen_: Got a core.logic question for you. How hard do you think it would be to add interval logic such that the answer would be min/max floats for each of the variables?
14:12dnolen_TimMc: CLP(R) needs it's own kind of solver
14:12boreI am quite new to the language, so I followed carmine libaray instructions to use a macro, but I agree - getting more familiar with the clojure would definetly help in the long run
14:12dnolen_bore: ugh
14:14justin_smiththat's what I meant by the macros beget macros thing - you could check out the source of the macro you are using, maybe there is an underlying function you can use
14:14justin_smithif it's well designed there will be
14:14TimMcdnolen_: Aaron Brooks hacked up something with finite domains that emits all possible discrete solutions, and I could mine that for min/max values -- but it feels like there should be a native solution.
14:14TimMcThen again, I've never used core.logic. :-P
14:14justin_smithbore: there is a macro, clojure.repl/source that shows you the source of a macro or function when possible
14:15TimMcThis is for the Clojure version of https://github.com/timmc/sourdough, so it is obviously very important.
14:15dnolen_TimMc: but did you really mean floats?
14:15TimMcYep.
14:15borethanks for tips I'll try to sort something out
14:15TimMcdnolen_: Well... float intervals, specifically.
14:15dnolen_TimMc: yeah when I was looking at this stuff, FD and R really seemed fundamentally different - but I also never really dug into R
14:16TimMcThere's another problem here, which is that the numbers can be seriously fuzzy.
14:16TimMc200 + 200 = 380 sometimes
14:16TimMcI guess that's true for floats in general, though.
14:16dnolen_TimMc: oh k, right - so yeah intervals would be an extension to CLP(R)
14:17dnolen_http://www.ofai.at/cgi-bin/tr-online?number+93-19
14:17dnolen_haven't looked at this stuff enough to know how much of the interval stuff could be hijacked for this
14:17TimMcThanks, I'll follow that up!
14:18TimMcI *may* be able to do this without a general logic engine, though.
14:25edwHas anyone here deployed a Clojure app as an uberjar (because you needed to build from private deps) on Heroku?
14:26justin_smithis that even possible?
14:26edwjustin_smith: I would like it to be possible...
14:26technomancysure, uberjars with private deps should work fine
14:28justin_smithtechnomancy: all the docs I find mention uploading source and having heroku do the building - how does one use precompiled objects on heroku?
14:28edwtechnomancy: What I mean is that I'd like to build the uberjar locally, so I don't need to deal with the s3-wagon thing...
14:29edwjustin_smith: What you said.
14:29technomancyedw: oh, I see. you could use the inline buildpack if you don't mind committing the uberjar to git
14:29technomancyhttps://github.com/kr/heroku-buildpack-inline
14:29loliveiraany LightTable user?
14:29technomancykinda dumb that you have to set a separate buildpack for that, but whatever
14:30edwtechnomancy: I assumed that I'd be committing to doing that. I could just commit to a non-master branch and deploy that...
14:31technomancypushes to non-master don't actually trigger a deploy though
14:32technomancyyour heroku git repo would just be a dummy repo that wouldn't be related to your primary source repo
14:33stuartsierraAny last comments on the new G.Closure library release? https://groups.google.com/d/topic/clojurescript/cYKt6dI4Q7A/discussion
14:33clojurebotNo entiendo
14:33stuartsierraI'll make the final release to Maven Central today unless someone reports a problem.
14:35technomancyedw: actually the null buildpack would make more sense for what you describe https://github.com/ryandotsmith/null-buildpack
14:38edwtechnomancy: Thanks. All check both out.
14:56asthasrHey guys. What's the canonical way to have a side-effect (like logging) inside a threading macro?
14:56asthasrFor example, (->> x fn fn2 fn3 (log some-message) fn4 fn5)
14:56asthasror is this just massively terrible
14:57technomancyasthasr: doto works with ->
14:59asthasrtechnomancy: Ah, didn't know about doto. Thanks
15:00amalloyasthasr: combining doto and -> is like magic
15:01amalloyyou can even do it in both "directions": (doto (Person.) (.setName "steve") (-> (.getFriends) (doto (.add mike) (.add jane))))
15:05ztellmanamalloy: I can never understand what the hell is going on when you do that
15:06technomancyhttp://p.hagelb.org/alternate.gif
15:06asthasramalloy: I have confusion. Messing around with doto in the repl, why doesn't (doto 3 (+ 5) (* 9)) return 72?
15:07amalloybecause doto is for side effects
15:07asthasrahh, so ultimately it will just return the original
15:07asthasrderp
15:07asthasri'm dumb
15:07amalloyevaluating 3+5 doesn't change what 3 is
15:07technomancy(doto 'some.ns require in-ns) is my favourite
15:08amalloyyes, i like that one too, technomancy. unashamed to have stolen it
15:08technomancyabomination or handy shortcut? you decide!
15:08amalloyi remember being confused as to why (require 'some.ns) suddenly started returning nil - i was so used to using the doto version and getting 'some.ns returned
15:08turbopapehi guys , I use inside a dosync several send-offs to the same agent, like dosync ( let [....] (send-off db-agent (fn [_] write-to-db-1) ) (send-off db-agent (fn [_] write-to-db-1) ) ... )
15:09turbopapebut it seems that sometimes some agents jsut don't do the work...
15:09turbopapeany idea on how to investigate ?
15:10justin_smithare you checking agent-error?
15:11turbopape2yep. nothing in it ...
15:11sdegutisamalloy: fwiw i agree with ztellman
15:11justin_smithso they are just not running?
15:11turbopape2I think it has to do with the change of state ...
15:11sdegutis... this time
15:11turbopape2some of them are , the others not
15:12turbopape2I mean, I think I don't get the agent hold after change of state thing, i think...
15:12turbopape2Will it be okay to use only one agent and put the treatment as a do block inside onlye one send-off ?
15:13turbopape2how would you do it guys ?
15:17amalloysdegutis: if there's a coding style that is expressive but you find hard to read, you should try using it for a while - the enforced practice helps broaden your mind. i can't remember the specifics anymore, but there was something like that i wanted to practice, and now i use it so often i apparently can't remember what it was
15:26AmandaCHey, anybody in here have experience with gloss? I’m trying to parse a data structure that has fixed-length strings, but null-pads them to fit that length, I’d rather not have the nulls in the resulting data, but I’m not really sure how to specify the thing to not have them. :s
15:27seangrovetechnomancy: Have you gotten around to fixing namespaces to make them less mutation-based monstrosities?
15:27amalloyAmandaC: you can specify a gloss codec that includes the nulls, and then (compile-frame codec (fn pre-encode [s] (...add some nulls...)) (fn post-decode [s] (...remove the nulls...)))
15:28AmandaCamalloy: ah, so there’s no way to do it using the default gloss.core/string codec?
15:28amalloyprobably not, i dunno
15:29amalloythere's no need to make *everything* a primitive, when there are so many ways to layer stuff on top of the primitives
15:34technomancyseangrove: lunch
15:34technomancyand no, I only rant about things on IRC in hopes that someone else will fix it these days
15:35technomancyit's my new MO
15:35seangrovetechnomancy: Ah, so that's how we can recognize you if you pop up under a different nick
15:37stuartsierraIs it still the case that ClojureScript cannot catch non-Object errors?
15:39dnolen_stuartsierra: catch :default
15:39stuartsierradnolen_: got it, thanks.
15:39dnolen_stuartsierra: also remembered a few other new things, specify/specify!/clone
15:40dnolen_(specify foo ...) is like reify, but calls clone on foo and then mutates it to add methods
15:40dnolen_desugars into
15:40dnolen_(specify! (clone foo) ...)
15:41stuartsierradnolen_: OK. What's `clone`?
15:41dnolen_stuartsierra: clone just calls -clone protocol method, ICloneable
15:41dnolen_stuartsierra: it just returns a clone, like meta does, but doesn't change anything
15:42stuartsierradnolen_: You mean `clone` gives you a new instance of a data structure which is equal to the one you passed in?
15:43dnolen_stuartsierra: yep equiv, not JS equals
15:43stuartsierraOK
15:44stuartsierraIs `clone` a deep-copy then?
15:45dnolen_stuartsierra: semantically yes like meta. But really all implementation just call the constructor again with current fields
15:45dnolen_stuartsierra: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L677
15:46noprompt$seen Raynes
15:46lazybotRaynes was last seen talking on ##eleventhbit 1 hour and 15 minutes ago.
15:46dnolen_stuartsierra: http://github.com/clojure/clojurescript/blob/master/test/cljs/cljs/core_test.cljs#L2068 demonstrate specify, and clarifies the equality bits
15:47stuartsierradnolen_: Is "IWoz" a deliberate Steve Wozniack reference?
15:47seangroveCreepy, cross-channel tracking of Raynes
15:47dnolen_stuartsierra: haha no
15:49stuartsierraLooking at the implementation, it seems pretty clear that `clone` is *not* a deep copy.
15:49sdegutis_Wait, Clojure has a deep-copy?
15:51dnolen_stuartsierra: but it doesn't need to be in precisely the same way meta doesn't need to be
15:52dnolen_stuartsierra: note that transients don't support for the obvious reasons
15:52dnolen_stuartsierra: er, I've mean with-meta this whole time of course
15:53stuartsierraOK
15:54stuartsierradnolen_: Are there docs for `specify!` more recent than http://dev.clojure.org/display/design/specify+i.e.+reify+for+instances ?
15:54dnolen_stuartsierra: not really, those docs are more ambitious wrt to optimizations than what is present in the current implementation
15:55dnolen_stuartsierra: the highlevel stuff does apply
15:55stuartsierraOK cool
15:56stuartsierradnolen_: Thanks!
15:57dnolen_stuartsierra: np
15:57AmandaCHrm, stupid question. I’ve got a function that needs a few intermediate values. How can I make these values not leak to the global context? Or is the idea that I’m supposed to chain them all together into one giant expression?
15:57stuartsierradnolen_: And congrats on the KT Coders training announcement too
15:57dnolen_stuartsierra: thanks!
15:59amalloyAmandaC: use a let?
16:00AmandaCamalloy: hrm
16:01scape_definitely sounds like a place for let
16:01amalloyyour question implies that you were considering using def for your intermediate values - it's *never* (with exceptions for experts only) right to def something inside a function
16:01AmandaCI see.
16:02AmandaCYeah, I am using def inside the function, this is the code, to be precise: http://amanda.darkdna.net/p/25c9b
16:02scape_,(let [x 1, y 2] (prn x))
16:02amalloythat's the purpose let serves
16:02clojurebot1\n
16:02amalloyhey, nice-looking paste site. <3 dark themes
16:04llasramAmandaC: Do you come from scheme?
16:04AmandaCllasram: nope, actually. I’m coming from no-lisp-experience. :P
16:04amalloyAmandaC: https://www.refheap.com/31483d5e44072050fa310b865 would be one reasonably standard way to rewrite that
16:04llasramAmandaC: Clojure `def` is explicitly global -- what it does is create a var (if necessary) and intern it into the current global namespace
16:05llasramAmandaC: Oh, ok. Scheme def-equiv is lexicaly-scoped, which leads some astray
16:05AmandaCI was considering it like a normal variable set. :p
16:05AmandaCamalloy: hrm, that looks a rather bit nicer, yes/
16:05AmandaCthanks.
16:06scape_yea for some reason def is the first thing that shows up when learning clojure, but really it should come later to reduce confusion
16:06amalloyAmandaC: note that you never use src, and you use a variable named bitmap that doesn't seem to exist
16:07AmandaCWhoops
16:07AmandaCYeah, src is used in making bitmap
16:09dnolen_AmandaC: some what of a sidenote, but variable assignment as found in most other languages just doesn't exist in ClojureScript
16:09dnolen_AmandaC: er meant Clojure there
16:09AmandaCHeh, I got the meaning. and yeah, I’m discovering that now. :p
16:10amalloyAmandaC: just for funsies, note that https://www.refheap.com/4f1c1b5c5cfc334a54cad3d26 would be a way to do it all as one big expression, as you mentioned
16:10scape_AmandaC: i like that paste page you have, did you design this or is it a library?
16:10AmandaCscape_: the hi lighting is a library, the CSS I made myself. p
16:11cbpneat
16:11AmandaCthe hi lighting is done by the Pygments python library, which I use to generate a static-html page, the CSS is to mirror the Vim inkpot theme which I used heavily back in my vim days
16:12scape_cool
16:12amalloyllasram: you asked that already?
16:12amalloyoh sorry, i was scrolled back
16:12amalloylol
16:13amalloyAmandaC: are you aware of import? it would save you typing out the package names inline, where they just clutter things
16:15AmandaCamalloy: well, I have to import the java classes, but I’m not really sure what I’d do to shorten them from there?
16:15llasramamalloy, IRC time-traveler!
16:15scape_lol
16:15scape_you import or require it and give it a short hand for the namespace
16:16amalloyAmandaC: https://www.refheap.com/bd51be6e4aa2ec9d9e8eb202f
16:17AmandaCoh, huh
16:17amalloyyou don't actually have to import java classes to use them - they're always available
16:17amalloyimport just lets you not mention the package name
16:17AmandaCAh
16:17AmandaCThat’d make the code much cleaner, I though I had to import them to use them. :p
16:17AmandaCI already have the import statements.
16:18scape_:)
16:21AmandaCOh yes, that’s definitely much cleaner. :D
16:24srrubyI'm registering for Clojure/West. Anyone have a discount code? Thanks, John
16:40stuartsierraIs `:print-input-delimiter` still a valid build option in ClojureScript?
16:48gfredericksis there a solid jruby <-> clojure data translator lib somewhere?
16:49gfrederickszweikopf looks promising
16:53dnolen_stuartsierra: whoa what is that?
16:53DomKM_gfredericks: I used zweikopf for this https://github.com/DomKM/whois.clj. It works well.
16:53dnolen_stuartsierra: and yes it is
16:53stuartsierradnolen_: More important question: is it still relevant given source maps?
16:54dnolen_stuartsierra: I just don't know what that does
16:55stuartsierradnolen_: OK
17:13stuartsierraFYI, it's a G.Closure compiler thing to insert comments between concatenated files. https://developers.google.com/closure/compiler/docs/api-ref
17:14BartAdv(def s (atom "")) <- how can I do instance? checks on the wrapped value?
17:14BartAdvhm, I can deref, alright
17:15edwtechnomancy: ping
17:18edwtechnomancy: unping
17:19seangrovetechnomancy: reping
17:26stuartsierraI have released G.Closure library 0.0-20140226-71326067 for sync to Maven Central.
17:30dnolen_stuartsierra: excellent
17:32stuartsierraAnd now I have a script to build it directly from the Git source, so we don't have to wait for Google to make a versioned release.
17:37tbaldridgenice! there's some sweet async stuff in the new versions
17:37tbaldridgethings that I think can replace the dispatcher in core.async
17:38dnolen_tbaldridge: yep that's what I was thinking
17:39dnolen_tbaldridge: I think you probably want to retain the custom queue'ing logic for setTimeout people but otherwise yes
18:30[swift]_what's the best book for new clojure users nowadays?
18:33justin_smiththe clojure programming o'reilly book is decent
18:35[swift]_justin_smith: sounds good. i'll give it a shot
18:44FatsDTWhat is the fastest way to determine the latest stable version of a package?
18:45jcsimsFatsDT: something like lein-ancient? https://github.com/xsc/lein-ancient
18:46FatsDT"./lein search $packagename" gives me many versions
18:46FatsDTI usually end up visiting the github pages for every package to figure out the version. That can't be the right way to do it.
18:48AmandaCFatsDT: just go for the highest one? :p
18:50shep-homeSo, am I missing a clean way of getting a lazy seq out of a core.asyn channel?
18:56shep-homelike, I have some code, but I guess I'd expect there to be one in core.async itself.
18:56shep-homeBut there may be a good reason I'm overlooking
18:56justin_smithhttps://gist.github.com/gerritjvv/7230860 this may be relevant?
18:57shep-homejustin_smith: yeah, that's what im doing (just one chan for me though, so it's a touch simpler)
18:57arohnershep-home: what semantics are you expecting when there is no data in the channel? Taking is stateful, which kind of conflicts w/ laziness
19:01shep-homearohner: if there's nothing, I'd be ok with blocking. That seems plausible - a seq based on IO could have pauses too
19:02arohnerI'm just pointing out that those decisions have to be made somewhere, and it's a tradeoff
19:03arohnerso the library probably doesn't support it already, just because it's hard to make something that works for everyone
19:05shep-homearohner: valid point
19:06shep-homearohner: onto-chan does exist though
19:06shep-homedoes it not have the same tradeoffs?
19:07shep-homealso spool and to-chan
19:22BartAdvhm, is it possible to set reference value without invoking watchers?
19:27justin_smithcan you just make the watcher more specific?
19:27justin_smithor is it that you are worried the watcher would not get called?
19:28BartAdvno, my watcher is updating the GUI textbox, and now, if I wanted to do two-way binding, the TextChanged event could reset the refeence value, but that would invoke watcher that would again alter the textbox value and...
19:29justin_smithyou could paramaterize the data with who last touched it and make sure the gui sets that key, and also checks it
19:30justin_smithwhich may mean promoting the data to a map with a :value key, or some such
19:31BartAdvor maybe using some meta?
19:31BartAdvok, I will think about it, thanks
19:31justin_smithyeah, you could alter the meta I guess
19:31justin_smithbut while the data is atomic, I don't know if the metadata is?
19:31justin_smith(synchronized, whatever...)
20:20gfredericksis it better to test the defproject macro by using eval in leiningen-core's tests, or by using a test project in the leiningen-proper tests?
20:21dnolen_a workaround for using cool JS libs with closure advanced compilation even if they don't provide externs - http://swannodette.github.io/2014/03/14/externs-got-you-down/
21:04mr-foobarhow do you create an edn data structure with tagged literals ?
21:21gfredericksmr-foobar: it's not quite clear what that means; could you describe why you're trying to do that?
21:27technomancygfredericks: use a test project
21:27gfrederickstechnomancy: damn I guessed wrong
21:27mr-foobargfredericks: I am reading an edn string from ajax -- #foo/bar [1 2 3] -- converting it to clojure ds. I have made some changes and now I want to serialize it back to edn.
21:28gfrederickstechnomancy: do you know what would cause `bin/lein test` to exit quickly with no output?
21:28gfredericksthis is after changing defproject
21:29gfredericksmr-foobar: I've only accomplished that by extending print-method for a custom type
21:29gfredericksmr-foobar: or :type metadata
21:29technomancygfredericks: "because bootstrapping" might be the best I can offer with available data
21:29technomancyand my battery is about to cut out
21:29jonheep
21:30gfredericksmr-foobar: here's an example: https://github.com/hiredman/bytes/blob/master/src/com/thelastcitadel/bytes.clj
21:30gfrederickstechnomancy: thanks :)
21:30technomancygfredericks: can help later if you open an issue
21:31gfredericksroger
21:31technomancyor a pull request with a big "NOT READY" description
21:32`szx_i'm struggling with what seems to be a pretty common problem people encounter when building a game in clojure, i.e. updating nested state
21:32`szx_e.g. https://groups.google.com/forum/#!msg/clojure/kWylqe4e3-Y/i_-Q0BlkgMUJ
21:35`szx_in my case i have a world map representing trains that move on tracks that looks like this: {:lines [{:path [list of coords] :trains [{train1..}{train2...}]} {:path... }] }
21:36`szx_i'm trying to figure out a good way to, for example, on click, find the closest train and update it
21:36`szx_finding it easy, e.g. using mapcat but then i lose my "reference" to the train and can't update it
21:36`szx_i keep wanting to have some kind of id/pointer (ugh) but it doesn't seem like the right solution
21:38`szx_anyway, any advice would be appreciated
21:41amalloyi don't really understand how you would use mapcat to find a particular train, `szx_. i have to go, so i can't answer your particular question, but if you can provide a more concrete example, someone else will have a better chance than with the current poorly-defined question
21:42`szx_i meant i use mapcat to find all the trains in all lines, then iterate as usual
21:42`szx_amalloy_: using reduce, for example
21:43AmandaC`szx_: did you see that LightTable programmer’s explanation on that one game-dev strategy?
21:43AmandaCSeemed interesting. I’d probably try it out if I didn’t vow to never touch direct game programming again. :p
21:43`szx_AmandaC: i'm not sure, link?
21:44`szx_AmandaC: are you talking about one of chris granger's posts?
21:44AmandaC`szx_: it was mentioned in somewhat-depth on the ClojureTV YouTube channel’s conj talks. Not sure what year, though
21:45`szx_AmandaC: i'll try to find it, thanks for the lead
21:46`szx_http://www.chris-granger.com/2012/12/11/anatomy-of-a-knockout/ was it this one?
21:46AmandaCThat seems to expand on it, but yeah, that’s what it’s referencing, that game design thingy
21:49`szx_well he uses ids which is an approach i considered but it still feels a little clumsy when you add nested structures to the equation
21:51`szx_in my case i don't even have an id, it's really just the index of the line/train within their vector
21:51`szx_which feels even more awkward
21:55muhoohuh, i had no problem cheating by making an externs just by taking the library and stripping out all the code, just leaving the function declarations, boom, instant externs
21:56muhoowhich is what that post basically says, doh
22:00tmciver`szx_: not sure exactly what your problem is but update-in is what you'd use to update a nested structure.
22:01`szx_tmciver: right, but i first have to find the right thing to update
22:01`szx_tmciver: i don't know what i'm going to update until i've iterated through all entities
22:05`szx_tmciver: for example, how would you find the entity (train) closest to the current mouse position and make a change to it?
22:06tmciver`szx_: hmm, maybe something like (update-in your-data-map [:lines :trains] f) where f would take the vector of trains and return a new vector with the closest one updated.
22:07`szx_tmciver: but it's the closest one across all lines
22:10`szx_tmciver: f only "sees" some of the trains (the ones on that line)
22:10tmciver`szx_: I think you'd have to do some 'pre-processing' to figure out what the update-in key vector was supposed to be. e.g., [:lines 3 :trains 2]. You'd have to have some functions that determined that you needed line 3 and train 2.
22:11`szx_tmciver: right, that's the direction i was going in, but then i end up with code that looks like this:
22:11`szx_(map-indexed #(map-indexed (partial vector %1) (:trains %2)) (:lines @world))
22:15`szx_i just feel like there's a better way, but maybe there isn't.
22:19tmciverNot sure what a better way would be but I prefer to be explicit so I would probably write a function that was something like 'keys-to-closest-train' that you could then use as input to update-in.
22:20`szx_well... nested atoms but that's a big no no
22:20tmciver`szx_: also, AmandaC might have been talking about this talk: http://www.chris-granger.com/2013/01/24/the-ide-as-data/
22:23`szx_tmciver: thanks, i'll take a look
22:25AmandaCtmciver: yeah the video in the top line of that post is what I saw
22:53gfrederickswhere do the 500 pages w/ stacktraces that I normally see in compojure apps come from?
22:54michaniskinwell, a mommy and a daddy love each other very much, and then a stork comes…
22:55michaniskinsorry, disregard me
22:55pdkhuge stacktraces are the product of framework orgies
22:55pdk50 software frameworks stacked on top of each other makes for extremely deep call chains
22:58amalloygfredericks: i think it might even be ring
22:58amalloypdk: you misread the question
22:59amalloyhe's not asking why they're 500 pages long, he's asking who's responsible for rendering a stacktrace as a 500 error
22:59pdkohh
22:59pdkhttp 500
23:00gfredericksamalloy: the jetty adapter isn't doing it
23:00gfredericksI don't see any obvious namespaces in ring.middleware.*
23:01muhooi simply do not want to make a mental picture of a "framework orgy"
23:02muhooall kinds of people's opinionatated and brittle models of the world, getting ugly in a dimly-lit room
23:03amalloygfredericks: https://github.com/mmcgrana/ring/blob/6b8d49196a1d4dd254e7905d63c19c7f5729439d/ring-devel/src/ring/middleware/stacktrace.clj
23:03muhooabstractions that don't fit together at all... ok that's enough.
23:06gfredericksamalloy: ah ha; ring-devel; cool thanks
23:06amalloygfredericks: fwiw, i found that by searching within the ring github repo for "try"
23:08gfrederickshaha
23:08gfredericksclever
23:22eraserhdDoes core.logic not already have a goal for an arbitrary sequence of any length?
23:29amalloyeraserhd: i don't see one
23:29felixfloresI'm trying to work through the Reasoned Schemer book, and in one of examples they use `pair?
23:30felixfloresis this not defined in core.logic?
23:31eraserhdfelixflores: hrmm..
23:32amalloyit's a little unpleasant to write, because of nil/(), but i think something like (defn seqo [x] (conde [(emptyo x)] [(nilo x)] [(fresh [a d] (conso a d x))]))
23:32felixfloresit says unable to resolve symbol: pair?
23:32amalloyyou might only need one of those two clauses, i'm not really sure
23:32amalloyfelixflores: that's probably the scheme primitive to test if something is a cons cell
23:33eraserhdamalloy: Why account for nil?
23:34eraserhd,(require 'clojure.core.logic)
23:34clojurebot#<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/core/logic__init.class or clojure/core/logic.clj on classpath: >
23:34amalloybecause you can cons onto it to get a non-empty collection
23:34felixfloresthe funny thing is in https://github.com/candera/reasoned-schemer/blob/master/src/reasoned_schemer/chapter2.clj, they use it
23:34felixfloreswithout defining it
23:35amalloywell i did just say, felixflores, that it's a scheme primitive
23:35amalloyclojure programs use functions like 'first without defining them, because they're part of the language
23:35amalloyoh, but that's clojure
23:36amalloythey're importing it from other code they wrote: https://github.com/candera/reasoned-schemer/blob/master/src/reasoned_schemer/core.clj
23:36eraserhdfelixflores: You can probably define it like this: (defn pair? [x] (= clojure.core.logic.LCons (class x)))
23:39felixfloresah! thanks amalloy
23:39felixfloreshow could have I missed that
23:56danielszmulewiczI'm trying use org.clojure/core.memoize (the fogus library), but I get an exception No such var: cache/through
23:56danielszmulewiczI saw it came up before