#clojure log - Mar 14 2014

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:02 dnolen_: noprompt: hrm interesting, will have to look at that more closely later

0:03 noprompt: dnolen_: cool. tl;dr it creates an object that doubles as a literal and a function which returns a literal that doubles and a function...

0:04 *as function

0:18 seangrove: $seen bbloom

0:18 lazybot: bbloom was last seen quitting 3 hours and 51 minutes ago.

0:23 arrdem: anyone worked with influxdb and care to comemnt on it?

0:30 noprompt: there *another* new db?

0:30 * noprompt can't type as usual

0:33 arrdem: noprompt: this one is some weird fake nosql monster intended for time series logging

0:33 noprompt: implemented in Go apparently..

0:34 chare: Go sucks shit

0:34 why does anyone use it?

0:34 jaimef: they dislike Oracle?

0:34 technomancy: because rob pike

0:35 seangrove: Damnit, I keep adding chare to my ignore list, but erc doesn't seem to persist it across restarts

0:35 chare: seangrove why you hate me bro?

0:35 arrdem: seangrove: goddamnit neither is mine...

0:35 seangrove: Time to open up init.el

0:35 * arrdem commits a change to ~/.emacs.d/conf/

0:35 chare: why does everyone hate me?

0:36 arrdem: chare: because you're a waste of valuable bandwidth and more valuable brain cells

0:38 that's better...

0:59 chare: do you guys agree that Clojure > Go ?

1:00 jaimef: depends on what you want to do

1:00 TEttinger: gozala: nice work on https://github.com/Gozala/wisp

1:00 jaimef: and if you need java

1:01 chare: 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

1:01 chare: jaimef: why does Clojure not work for that+?

1:02 jaimef: cost of threads > goroutines

1:02 chare: doesn't clojure have lightweight threads or something?

1:02 sid__: 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)

1:02 jaimef: chare probably. I'm just not that good enough in clojure yet to acheive the same.

1:03 arrdem: jaimef: please don't feed chare.

1:04 jaimef: he's one of an elite group: those who managed to get themselves banned from #clojure

1:04 amalloy: wow, i didn't know anyone used amalloy-utils, iwilcox

1:04 sid__: 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)?

1:04 jaimef: arrdem: thanks :P

1:04 amalloy: i haven't used it for years; when geni hired me, i merged the parts of it i still liked into flatland/useful

1:04 arrdem: jaimef: /ignore is a glorious thing :D

1:04 jaimef: amen

1:04 sid__: or for (0 1 2) -> (true true true false)

1:05 jaimef: .oO(trollBot to alert new folks )

1:05 chare: I'm not a troll

1:05 dsrx: off-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

1:05 ahh the commentary

1:05 amalloy: sid__: i'm sure someone will get to your question soon. in the meantime, please be patient: irc is not an instant-help hotline

1:05 iwilcox: amalloy: 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. :)

1:06 amalloy: But I'll be taking a closer look at -utils as a result :D

1:06 amalloy: iwilcox: yeah, and indeed that's one of the functions i liked enough to carry over. it's now flatland.useful.map/keyed

1:06 muhoo_: so many people have libraries of homegrown utiities not in the language.

1:07 sid__: amalloy, I did it by setting values in an array for the index and then converting it to seq, is there a better way?

1:08 amalloy: &((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])

1:08 lazybot: ⇒ (true true true false)

1:10 amalloy: or if your input were a vector, you could just (reduce #(assoc % %2 x) v indices)

1:12 jaimef: nrepl is pretty nice on stack traces

1:22 sid__: amalloy, there's a difference of 0.10196800000000006 msecs in what I was doing and what you did

1:22 amalloy: what. who cares

1:23 write code that looks good and reads well

1:23 arrdem: (inc amalloy)

1:23 lazybot: ⇒ 90

1:23 sid__: but I see you used sets, converting from seq to sets will take some time itself

1:23 thanks anyways

1:24 zspencer: (inc amalloy)

1:24 lazybot: ⇒ 91

1:24 sid__: (inc lazybot)

1:24 lazybot: ⇒ 22

1:24 TEttinger: is that a... tenth of a millisecond difference?

1:24 is that even measurable?

1:25 zspencer: (inc inc)

1:25 lazybot: ⇒ 7

1:25 arrdem: TEttinger: the JIT will fix that give a couple thousand passes..

1:25 sid__: lol, I just trying to find out the difference

1:25 * seangrove considers darign a (dec amalloy) for the thrill of it

1:25 sid__: not that I care about it

1:25 I was*

1:25 TEttinger: (dec seangrove's dare)

1:25 lazybot: ⇒ -1

1:25 trap_exit: is there an easy way to check if (into {} is lazy or not lazy ) ?

1:26 seangrove: TEttinger: I go by the beat of different drum

1:26 amalloy: TEttinger: don't forget the 6e-20s difference at the bottom there

1:26 arrdem: ,(type (into {} [[:a :b] [:b :c] [:d :e]]))

1:26 clojurebot: clojure.lang.PersistentArrayMap

1:26 amalloy: trap_exit: into is never lazy

1:26 maps are also never lazy

1:26 trap_exit: well, maps are not lazy, but map is lazy

1:27 I had (into {} (map ... ... )) in mind

1:27 TEttinger: trap_exit, you can be sure that it ISN'T lazy if you use mapv in place of map

1:27 trap_exit: amalloy Tettinger: interesting, thanks!

1:27 http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/mapv is new to me

1:28 amalloy: whaaaat. why would you mapv here

1:29 trap_exit: amalloy ... Tettinger

1:29 seangrove: amalloy: I make sure it's not lazy, before feeding it to into

1:29 trap_exit: round 1, fight!

1:29 TEttinger: I personally use it when I don't know how things would act with laziness

1:29 amalloy: seangrove: ???????

1:29 seangrove: amalloy: Sorry, sorry, just joking

1:29 amalloy: nothing makes sense anymore, i resign

1:29 * seangrove in no way expected for that to sound serious at all

1:29 trap_exit: TEttinger wins

1:29 amalloy: TEttinger: seriously though, that's a terrible reason to use mapv

1:29 trap_exit: round 2

1:29 start!

1:29 TEttinger: haha ignorance takes the day!

1:29 arrdem: (inc ignorance)

1:29 lazybot: ⇒ 1

1:29 TEttinger: :-(

1:30 amalloy: use 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

1:31 trap_exit: man

1:31 clojure battles not nearly as fun as mortal kombat or rap battles

1:31 TEttinger: I 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...

1:32 amalloy: you don't need to know about every function, really. it's mostly just the data structures

1:32 trap_exit: I think it's basically: if it returns a list, and it's not doall, it's lazy

1:32 amalloy: not far off, trap_exit

1:36 TEttinger: one 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

1:37 zspencer: or it could raise an AckbarException

1:37 TEttinger: yeah it could be worse

1:39 arrdem: M-x package-install RET amalloy-this RET

1:39 TEttinger: (doc flatten) ; [bad idea intensifies]

1:39 clojurebot: "([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."

1:39 amalloy: TEttinger: mapv's not a trap

1:39 arrdem: TEttinger: br0 no

1:39 TEttinger: I used flatten once but did not inhale...

1:39 amalloy: it'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

1:39 trap_exit: there's a standard notation of ! = mutation

1:40 I'd like something where function name had weird chard to indicate whether it's lazy

1:40 amalloy: it's a perfectly good function, just not one you should default to

1:40 TEttinger: that's not a bad idea trap_exit

1:40 arrdem: flatten?

1:40 ~flatten

1:40 trap_exit: (inc TEttinger) ;; great minds think alike

1:40 lazybot: ⇒ 15

1:40 TEttinger: laziness is a really important of clojure, like the mutation behavior

1:40 amalloy: unlike flatten, which is truly a trap

1:40 trap_exit: anyone else think it's a good idea? :-)

1:41 TEttinger: well it would need to be in some alternate core.clj

1:41 not like people don't do that, ztellman did it for primitive-math

1:42 personally I think it would be a better idea if you were starting over, and a bad idea if you weren't

1:42 but!

1:44 something 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

1:45 so 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

1:45 (and prints that info)

1:45 something like a doc on a macroexpand I guess?

1:50 noprompt: sometimes it's difficult to put what something does in to works.

1:50 *words

1:51 trap_exit: what consulting rates do people command for cljs + clojure web dev ?

1:51 noprompt: probably whatever they feel they're worth. :-P

1:52 zspencer: trap_exit: depends on how competent I am.

1:52 noprompt: there's a pattern here.

1:52 trap_exit: is $300/hour too high?

1:52 noprompt: for one person?

1:52 zspencer: If I can deliver working software quickly and effectiely I'll charge up to $150/hr

1:52 trap_exit: yeah

1:53 zspencer: ATM, I would probably only chage like $75 for clojure

1:53 noprompt: zspencer: don't i work w/ you?

1:53 trap_exit: anyone here successfully charge $300/hour ?

1:53 noprompt: :-P

1:54 scottj: trap_exit: those rates are for specialized knowledge (not general programming) afaict

1:54 zspencer: Hourly rates (from my experience) top out at ~$200 unless you have incredibly specialized abilities.

1:54 If you want to get higher you have to figure out how to charge for a solution instead of for time

1:55 Which carries it's own risks

1:55 scottj: trap_exit: it doesn't hurt to find out where no is though.

1:55 SegFaultAX: I never charge by the hour.

1:55 noprompt: yeah, i'd say $300 is bananas

1:55 trap_exit: bananas is what people feed monkeys

1:55 so it's too low right?

1:55 SegFaultAX: I'm not a prostitute, so hourly makes no sense when I'm freelancing.

1:55 zspencer: bananas are a superfood, so it's too high

1:56 trap_exit: SegFaultAX: yeah, that's what I also feel about charging per hour

1:56 it feels very weird as an engineer

1:56 SegFaultAX: I mean really, what can you possibly do in an /hour/?

1:56 Can't even fully get into the flow.

1:56 zspencer: Earn $XXX

1:56 ;)

1:57 SegFaultAX: I charge by the half-day or day.

1:57 zspencer: I tend to charge by the week at a certain % of capacity

1:57 but now I work full time for a real company

1:57 so that's weird

1:57 SegFaultAX: (Not to say that being a prostitute is bad, just that it's not a sensical model for software development)

1:58 noprompt: dnolen_: here's the macro helper code in context: https://github.com/noprompt/garden/blob/2.0.0/src/cljx/garden/selectors.cljx#L36-L56

1:58 dnolen_: feel free to comment on the commit if you have time. i'm done hacking on it today.

2:00 * arrdem charges by hours and serves git logs and org mode clock in clock outs to prove it

2:00 zspencer: nice

2:02 noprompt: i never do contract work because i'm too busy dicking nonsense.

2:03 insamniac: don't talk about the lady like that.

2:18 amalloy: what'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

2:19 trap_exit: without using the fucktard <blink> tag, how do I show an animated "connecting" status symbol ?

2:19 something that tells the user "eh, something is fucked up, but this symbol is still animated, so you should feel comfort

2:24 akhudek: trap_exit: css animations unless you care about certain browsers

2:27 trap_exit: akhudek: http://www.andreaverlicchi.eu/css-3-only-spinning-loading-animation/#.UyKg-VFdUhw is impressive

2:42 sid__: has anyone used cache in clojure? what cache would you suggest?

2:49 bob2: sid__, what do you want to cache?

2:50 sm0ke: anyone using datomic over riak?

2:51 sid__: core.cache is "idiomatic" cache for clojure

2:51 https://github.com/clojure/core.cache

2:56 sid__: has anyone used spyglass memcached?

2:58 bob2, what do you mean by what do I want to cache?

3:42 mindbender1: ,(name nil)

3:42 clojurebot: #<NullPointerException java.lang.NullPointerException>

3:43 mindbender1: Is there a reason why name should throw on nil?

3:45 ddellacosta: mindbender1: what do you expect it to do?

3:46 mindbender1: (if (or nil (string? x)) x (. ^clojure.lang.Named x (getName)))

3:47 This has been troubling me for years!

3:47 ddellacosta: ^^ what do you think?

3:48 ddellacosta: mindbender1: er, you want to get the string from a keyword? Why not just use name?

3:49 why do you do (. ^clojure.lang.Named x (getName)) ?

3:49 mindbender1: ,(clojure.repl/source name)

3:49 clojurebot: Source not found\n

3:50 qq_an_qq: no idea ,, !

3:50 ddellacosta: ,(defn not-nil-name [x] (if-not (nil? x) (name x) x))

3:50 clojurebot: #'sandbox/not-nil-name

3:50 mindbender1: ddellacosta: that's the source for name I pasted (modified)

3:50 mpenet: #(some-> % name)

3:50 ,(some-> nil name)

3:50 clojurebot: nil

3:51 ddellacosta: mpenet: much nicer than mine. ^ mindbender1

3:51 ,(some-> nil name)

3:51 clojurebot: nil

3:51 ddellacosta: ,(some-> :foo name)

3:51 clojurebot: "foo"

3:51 ddellacosta: ,(some-> "foo" name)

3:51 clojurebot: "foo"

3:51 ddellacosta: ^ mindbender1 doesn't that do what you need, quite simply?

3:52 mindbender1: that will mean inviting some-> wherever I need name

3:52 How computing wise is that?

3:52 ddellacosta: mindbender1: I'm not sure I understand your point

3:53 mindbender1: The source should be modified

3:53 ddellacosta: mindbender1: which is to say, I don't understand it

3:53 mindbender1: don't really agree, but I would take it to the dev list if you feel so strongly about it

3:54 mindbender1: ddellacosta: that's what I'm looking to do

3:54 ddellacosta: using some-> or just making your own custom fn is not a big deal in the least

3:54 ,(defn nname [x] (some-> x name))

3:54 clojurebot: #'sandbox/nname

3:54 ddellacosta: (nname :foo)

3:54 (nname nil)

3:54 ,(nname :foo)

3:54 clojurebot: "foo"

3:54 ddellacosta: ,(nname nil)

3:54 clojurebot: nil

3:55 ddellacosta: mindbender1: but hey, go for it

3:56 mindbender1: how do I make something like nname globally available

3:58 ddellacosta: mindbender1: maybe using this? https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L211 Dunno, never needed to do that

4:00 mindbender1: *Forms* to prepend to *every form* -- namespace would be better. Thanks anyway

4:01 ddellacosta: mindbender1: good luck

6:33 schmir: #/join ethereum

7:06 BartAdv: is it possible to somehow obtain reference to the 'current' function? say I have add-watch handler that wants to 'remove' itself under certain circumstances

7:06 clgv: BartAdv: well use a defn ;)

7:07 BartAdv: but I'm creating such callback locally

7:08 clgv: BartAdv: you can name a local function (fn myname [x] ...) but you can only use it for recursive calls afaik

7:11 BartAdv: doh, silly me. remove-watch uses the key given when calling add-watch

7:11 so, problem was not there in first place, thanks anyway;)

7:12 clgv: BartAdv: a suicidal watch so to say? :P

7:15 BartAdv: yeah

8:16 gfredericks: ,((fn f [] f))

8:16 clojurebot: #<sandbox$eval25$f__26 sandbox$eval25$f__26@eb38b5>

8:18 tomjack: :)

8:23 gfredericks: I'm really enjoying this `bg` macro: https://github.com/fredericksgary/repl-utils/blob/master/src/com/gfredericks/repl.clj#L98

8:25 clgv: gfredericks: a future with runtime duration?

8:27 I 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

8:27 gfredericks: clgv: runtime duration, alerts on completion/error, and puts results in vars instead of a derefable

8:27 clgv: ah k

8:27 gfredericks: when you eval 'bg14' it tells you how long that one has been running

8:28 * gfredericks used single-quote in two different ways there

8:28 clgv: ah just saw your code above. so the name of a fn is indead a ref to it

8:29 gfredericks: yep

8:29 only when you name it in that style

8:29 defn works slightly differently

8:29 clgv: yep

8:29 gfredericks: which is important when you're playing with dynamic programming stuff

8:39 tomjack: java.lang.RuntimeException: Unable to resolve symbol: let in this context

8:39 hmmm

8:42 clgv: tomjack: interesting. but we can not help you without context info ;)

8:42 gfredericks: that's a logical possibility; let is just a macro you can not-refer

8:43 tomjack: I don't think you can help me

8:43 clgv: ,(resolve 'let)

8:43 clojurebot: #'clojure.core/let

8:43 tomjack: this was 9 jobs in to a 11 job hadoop flow

8:43 where each job is the same

8:44 my 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

8:44 I guess...

8:44 gfredericks: I don't think we can help you

8:45 clgv: starting a repl within a distributed hadoop computation with a different jar version sounds odd..

8:45 tomjack: not within, concurrent with

8:46 I just found the exception message funny, since I feel pretty sure I didn't not-refer let..

8:56 shep-werk: Are there any core.async buffers that are disk-backed (and thus I could claim they are "unbounded")?

8:58 clgv: shep-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

9:01 shep-werk: clgv: this look like the one you mean? https://github.com/Factual/durable-queue

9:01 tomjack: b

9:03 stompyj: Can 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

9:03 If he doesn't have a public email addy, could someone tell me how one would go about getting in touch?

9:05 clgv: shep-werk: yes. you probably just have to implement the protocols for buffers from clojure.core.async.impl.protocols

9:06 shep-werk: clgv: cool, thanks. I actually have done that once already... I wanted a LIFO buffer instead of FIFO

9:07 it was pretty easy, so that was cool

9:07 gfredericks: stompyj: can't you find it from the mailing lists?

9:07 clgv: shep-werk: yeah, that's one of the reasons why I like protocols in clojure^^

9:08 stompyj: gfredericks: 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

9:08 shep-werk: clgv: downside here is that it is a durable queue... wonder what it would take to trick it into a stack :-)

9:09 clgv: shep-werk: oh, you want a stack here as well ...

9:09 shep-werk: clgv: i'm just playing around, so I don't /need/ anything :-D

9:10 clgv: shep-werk: to get a durable stack you'll probably have to implement it yourself analog to the durable_queue

9:11 shep-werk: another thing about my particular use case is that I'm not worried about the durability aspect, just the not-bounded-by-memory

9:11 but this is probably a great place for me to start exploring, thanks!

9:11 clgv: shep-werk: so dropping some of the things in the queue would be ok?

9:12 shep-werk: yeah

9:12 This is all predicated from http://www.reddit.com/r/dailyprogrammer/comments/1yzlde/022614_challenge_150_intermediate_reemvoweler_1/

9:12 Which spun up some thinking about how I could use core.async with it

9:13 and a root thing that came up was

9:13 clgv: well arent there queues in core.async that just drop items when they are full?

9:13 mdrogalis: clgv: Yes. Sliding and dropping buffers.

9:13 shep-werk: I have a goroutine that takes 1 item and produces 3, and puts those 3 back into the original queue

9:13 (up to 3)

9:13 so, the # of things in the channel could get large

9:14 for that particular problem, I think there is a bound (that I haven't computed) if you do a DFS of the possibilities

9:15 if you were to do a BFS, then the bound would be much larger

9:15 then I started thinking about a filesystem / web crawler

9:15 which would make it hard to know the bounds beforehand

9:15 so you would probably fall back to at least one unbounded queue

9:16 wall-of-text over ;-)

9:16 clgv: shep-werk: DFS can be linear in tree depth when the options at each level can be enumerated

9:17 shep-werk: yup. So for the reddit problem, it would be something like (* 2 (+ (count vowels) (count consonants)))

9:18 clgv: *I meant the space requirement

9:18 shep-werk: And so it could have a known bound beforehand

9:18 And that requires the stack buffer instead

9:19 clgv: shep-werk: if you have information on the input size you can easily decide whether it fits in memory ;)

9:19 shep-werk: certainly. But then when I started thinking about a web or directory crawl, I realized I wouldn't know the tree depth or width

9:20 so a disk-backed queue would be fine for a BFS

9:20 and the durability would also be a benefit

9:21 but since I had also been thinking about a stack...

9:21 isaacbw: how 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 ?

9:21 depending on which one you want

9:21 clgv: BFS memory consumption can grow quite badly compared to an equivalent DFS

9:22 shep-werk: clgv: 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

9:23 isaacbw: what kind of abstraction? My first answer would be "protocols", but it depends on what you are doing :-)

9:23 clgv: isaacbw: depends how you want to use them

9:23 isaacbw: shep-werk: like "interfaces"

9:23 I'll take a look at protocols

9:24 clgv: isaacbw: definitely protocols when you want something like interfaces

9:25 isaacbw: I'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?

9:26 looks like it from what I can see

9:28 dnolen_: isaacbw: protocols or multimethods both work, if you're talking to a database multimethods will probably suffice.

9:28 clgv: isaacbw: yeah, that's doable with protocols and deftype/defrecord (or even maps with :type metadata)

9:29 or what dnolen_ said ;)

9:31 felher: Why 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).

9:32 Hello folks, btw :)

9:32 tony_: greetings

9:33 is this a good place for a very stuck newb to get some help?

9:34 BobSchack: Yep what is the problem?

9:34 tony_: i'm trying to pass an expression into a macro as an argument

9:35 gettihg various "Cannot be cast" errors when I try to evalulate that expression

9:36 BobSchack: do you have gitpaste / refheap of the macro and expression?

9:36 philandstuff: felher: 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

9:36 tony_: i am not familioar with gitpaste or refheap

9:37 those are the standard methods of sharing/showing code here?

9:37 felher: philandstuff: okay, thank you :)

9:37 BobSchack: yep https://www.refheap.com is the standard I believe

9:37 clgv: felher: in that case probably "sm" is known as a super class that only has the method with object?

9:39 tony_: refheap hates my browser (midori) I'll fire up another

9:41 felher: clgv: 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. :)

9:41 *The superclass ist SelectionModel

9:44 isaacbw: so is there not a clojure-specific GSoC proposal template?

9:46 clgv: isaacbw: 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

9:46 isaacbw: ah, thanks clgv

9:56 tony_: sorry that took so long

9:56 https://www.refheap.com/58362

10:01 turbopape2: Hi guys, I want to know something about STM and maps...

10:01 tony_: sorry my example expression was wrong i fixed the paste

10:02 BobSchack: I 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:02 turbopape2: is the transaction retried when a map is changed as a whole or only if a conflicting key/value has been altered ?

10:02 tony_: ok - thanks Bob

10:02 turbopape2: does the STM check nested structures or just the ref as a whole ?

10:03 opqdonut: the value inside the ref, i.e. the whole map

10:03 at least if you're using ref-set

10:03 but see also commute

10:04 e.g. http://stackoverflow.com/questions/4999281/ref-set-vs-commute-vs-alter has an explanation

10:09 turbopape2: ok, thanks opqdonut

10:10 tony_: anyone else on newb duty? :)

10:11 I don't get why x does not evaluate to true at https://www.refheap.com/58362

10:12 turbopape2: ok 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:12 I suspect yes, BTW, just wishing it was that easy :(

10:12 oh I mean it is fairly easy, ALREADY !

10:13 dnolen_: turbopape2: assoc'ing two different keys is commutative so not necessarily

10:14 turbopape2: ok, so if I use commute, when updating, it will not retry ?

10:14 john2x: tony_: don't wrap x in parens..

10:14 tony_: (if x ...)

10:15 dnolen_: turbopape2: yes

10:15 tony_: omg! awesome! thanks john2x!

10:15 somehow I spent several hours not figuring that out yesterday

10:15 isaacbw: is there a paredit command to kill a whole s-exp? I can't find one on the paredit cheat sheet

10:16 turbopape2: ok cool dnolen _ :)

10:16 tomjack: isaacbw: no, kill-sexp

10:16 built in

10:17 C-M-k

10:17 isaacbw: oh, neato thanks

10:28 turbopape2: oh yeah, with commute that makes sense. Thank you guys !

10:55 sveri: hi, 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:56 gfredericks: what migration library am I about to choose? ragtime?

10:59 clgv: sveri: well bruteforce is a hard word here since you only to search in linear time. `frequencies` might help you

11:00 sveri: ##(let [m {:a 1 :b 2}, ms [m {:a 2, :b 4}, m {:a 5 :b 9}] ((frequencies ms) m))

11:00 ,(let [m {:a 1 :b 2}, ms [m {:a 2, :b 4}, m {:a 5 :b 9}] ((frequencies ms) m))

11:00 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

11:01 sveri: clgv: thank you, i gues i get the idea

11:01 clgv: ,,(let [m {:a 1 :b 2}, ms [m {:a 2, :b 4}, m {:a 5 :b 9}]] ((frequencies ms) m))

11:01 clojurebot: 2

11:01 gfredericks: it wouldn't be unreasonable for lein to throw an error if the defproject contains a duplicate key, right?

11:01 clgv: ,,(let [m {:a 1 :b 2}, ms [m {:a 2, :b 4}, {:a 5 :b 9}]] ((frequencies ms) m))

11:01 clojurebot: 1

11:02 clgv: gfredericks: maybe this leads back to the discussion about exceptions on duplicate keys in literal forms and function construction

11:03 mmg: if 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:11 chronno: mmg: (apply foo args)

11:11 mmg: Thank you!

11:12 chronno: mmg: np

11:14 yedi: hey seangrove: omchaya doesn't really need tx-listen right? since all app events go through a central controller

11:14 seangrove: yedi: Yeah

11:14 yedi: I wouldn't mind seeing a different architecture for it though that used tx-listen

11:15 Or the same arch, and an explanation of what it does, why it's important, how it fits into Omchaya

11:30 isaacbw: okay, so what's the point of a protocol if datatypes that "implement" it don't have to implement all the functions

11:30 maybe I'm misunderstanding this

11:31 I guess protocols are useful for routing the call to the right data type?

11:31 like a lightweight multimethod that only matches on type?

11:34 shep-werk: isaacbw: that's more or less the mental model I use

11:35 llasram: Plus the ability to `reify` protocols, creating special-purpose/context-specific anonymous implementations of a protocol

11:35 gtrak: protocols are adhoc type-polymorphism

11:35 cbp: isaacbw: the point of protocols is to be a better interface

11:35 avoid the expression problem and be faster than multimethods

11:36 shep-werk: the ability to not implement methods doesn't bother me... but I also like programming in fairly dynamic languages like Ruby

11:36 isaacbw: I'm having trouble understanding why you would want to allow a data type to not implement the whole protocol

11:37 gtrak: if you know the details of how it'll be used and you're being lazy :-)

11:37 isaacbw: meh

11:37 sounds like a "let developers break things at runtime" kind of thing

11:37 gtrak: never been a problem in practice for us

11:38 the error messages are relatively obvious

11:38 isaacbw: I guess I won't worry about it then

11:38 shep-werk: yeah, your unit tests for that type will smoke it out right quick

11:38 cbp: sounds like a dynamic language slogan

11:39 isaacbw: anyone here actually use ClojureScript for their front end apps? I'm worried about the amount of boilerplate that comes with it

11:39 gtrak: what it will protect you from is extending a non-existent method.

11:39 cbp: I use clojurescript, I have no idea what you meean about boilerplate :-o

11:40 isaacbw: I'm also worried about how V8/Spidermonkey's GCs handle purely functional data structures

11:40 cbp: just seems like there's a lot of foundational code that comes along, even with simple programs

11:41 shep-werk: isaacbw: you dont mean boilerplate that the programmer writes?

11:41 just the "standard library" ?

11:41 cbp: isaacbw: the closure compiler is pretty darn good at removing dead code

11:41 isaacbw: no, I meant generated boilerplate

11:41 cbp: maybe I'll give it another go

11:41 cbp: also gzipped the size of your apps is comparable to something like jquary + angular or whatever

11:42 isaacbw: oh, okay then

11:42 I wrote a purely functional red black tree in vanilla javascript. That was "fun"

11:42 gtrak: generated 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:42 isaacbw: couldn't figure out balanced deletion though

11:42 cbp: persistent data structures also seem to work pretty damn fine

11:42 gtrak: load time is insignificant.. code size goes down with advanced mode.

11:42 cbp: look at Om for an example of that

11:43 isaacbw: cbp: 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:43 I guess Rich Hickey says persistent though, so I'll get over it :P

11:44 seangrove: dnolen_ bbloom Either of you coming to the cljs meetup on the 27th?

11:44 gtrak: it's hard to remeber what persistent means, the things that persist are the complexity bounds of the mutable alternatives :-)

11:44 bbloom: seangrove: i'm flying back to NY at that time

11:44 isaacbw: also,

11:44 seangrove: Ah, bummer

11:45 isaacbw: one 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:45 gtrak: can't do it without affecting java interop

11:45 isaacbw: ah, okay

11:45 makes sense

11:45 noprompt: dnolen_: did you get a chance to look at that macro code?

11:46 cbp: I think there might be a library that gives tco

11:46 maybe something of bbloom i can't remember

11:46 gtrak: it was cfrisz

11:46 isaacbw: gtrak: 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:46 Amnesiou_: What is a good, performant way to dedupe a sequence? Would just applying a hash-set do?

11:46 gtrak: https://github.com/cjfrisz/clojure-tco

11:47 isaacbw: we're not getting TCO in Java 8 are we?

11:47 maybe just lambda

11:47 ?

11:47 (as far as cool new features go)

11:47 gtrak: I heard the old apple jvm did it.

11:48 Amnesiou_: (To answer my own question: "distinct" is much more performant.)

11:48 isaacbw: as 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:48 seangrove: isaacbw: It comes with Nashorn, which is more interesting for me

11:48 isaacbw: Use recur?

11:49 It's nice to have it verified by the compiler anyway

11:49 gtrak: isaacbw: lazy seqs are a great alternative most of the time.

11:49 dnolen_: seangrove: I'll be returning that day so I won't be able to make it.

11:49 isaacbw: I know, but I'm used to scheme and not having to be explicit seangrove

11:49 dnolen_: noprompt: haven't had a chance yet no

11:49 cbp: I think removing nil would make it perfect :-P

11:49 isaacbw: seangrove: a JS engine *shipping* with Java?

11:49 hrm

11:49 I left #Node.js after some politics

11:49 would be nice to see someone come up with an alternative to its asynchronicity model

11:49 dnolen_: isaacbw: Nashorn has been in the works for a while now, it's pretty impressive stuff

11:50 gtrak: cljs on node.jar?

11:50 noprompt: dnolen_: cool, maybe bbloom might take a look at it?

11:51 dnolen_: gtrak: definitely https://avatar-js.java.net/

11:51 gfredericks: does vim-fireplace have C-c C-k?

11:51 gtrak: neat :-)

11:52 isaacbw: how does "nlp-commons" sound for this jdbc-like NLP abstraction layer

11:52 or would CommonNLP be better

11:52 or maybe contrib.nlp ;)

11:52 bbloom: noprompt: what am i looking at?

11:52 noprompt: bbloom: a macro

11:52 bbloom: ?

11:53 noprompt: bbloom: or at least the base of one https://github.com/noprompt/garden/blob/2.0.0/src/cljx/garden/selectors.cljx#L36-L56

11:53 elfenlaid: gfredericks, maybe :%Eval

11:53 noprompt: bbloom: you can look at the examples below it to see how it works

11:54 bbloom: noprompt: why am i looking at this? did you have a particular question?

11:56 noprompt: bbloom: i'm curious there's a better way.

11:56 *if there's

11:56 shep-werk: isaacbw, gtrak: the IBM JVM also does (some) TCO

11:57 bbloom: noprompt: i'd have to study a lot more than that one macro to grok what's going on :-P

11:58 noprompt: bbloom: the examples don't help. :-/

11:59 bbloom: 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:59 when you invoke the instance it returns the same thing.

11:59 only when you call p/selector on it does it give you the string representation.

12:00 bbloom: and ICssSelector is essentially your AST node class?

12:00 noprompt: bbloom: no it's just a protocol

12:00 but i suppose you could think of it that way

12:00 gfredericks: elfenlaid: cool thanks!

12:00 bbloom: noprompt: yeah, but do you have a tree of them that is recursively printed in to a css selector string, yes?

12:01 (i think of *everything* that way :-P)

12:01 noprompt: no trees in this instance.

12:01 elfenlaid: gfredericks, 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:02 bbloom: noprompt: i'm sorry, i'm working on some other stuff right now so i can't dig in at the moment

12:05 noprompt: bbloom: no worries. :-)

12:06 isaacbw: so I like the name "nlp commons" but I'm worried that people will think it's something that it's not

12:13 noprompt: is there a name for this pattern: (fn x [a] (fn y [b] (fn z [c] (x c))))

12:14 pyrtsa: Currying? Making a partially applied function?

12:15 noprompt: it's not totally though because z just ends up returning x

12:15 pyrtsa: Oh, wait, was calling the (x c) in the end part of the question?

12:15 noprompt: yes

12:15 cbp`: a closure? :P

12:16 Raynes: Currying isn't just partial application.

12:16 https://en.wikipedia.org/wiki/Currying

12:17 clgv: Raynes: yeah, it also makes food delicious

12:17 Raynes: Yes.

12:17 I remember when Chris Granger made those jokes before I had actually ever had indian food.

12:17 Which is approximately the only curry I've had.

12:17 clgv: :D

12:19 Pupnik: how could you live a life without curry!

12:20 Raynes: Rural Alabama :(

12:21 pyrtsa: noprompt: Recursion is the best name I could come up so far. :P

12:21 seangrove: Raynes: But you're in LA now, right? No more excuses. Go grab soem Japanese curry today ;)

12:21 Raynes: But think of the pizza

12:22 seangrove: Raynes: Compelling argument.

12:22 * seangrove wonders, "Won't *someone* think of the pizza?!?

12:22 nightfly: ...and Vietnamese curry, and Thai curry

12:22 clgv: we have a "currywurst" buffet in our canteen every second friday

12:23 isaacbw: can someone explain why it's [com.novemberain/monger "1.7.0"]. What does the / mean?

12:23 clgv: isaacbw: separation of group/artifact

12:24 isaacbw: so when I just do [compojure "1.1.6"], what's going on?

12:24 no group?

12:25 TimMc: isaacbw: I think that means compojure/compojure

12:26 isaacbw: huh, are these packages on on maven central?

12:26 justin_smith: many are on clojars

12:26 isaacbw: oh right

12:26 justin_smith: which is a clojure centric repo, from technomancy who also wrote leiningen

12:26 isaacbw: I used to know all this stuff, like a year ago

12:26 too much time with JavaScript

12:28 technomancy: actually I didn't make clojars

12:30 justin_smith: oh, I thought it was your deal

12:31 technomancy: xeqi has been doing most of the maintenance recently

12:32 isaacbw: hmm, why does clojure-mode default to 1 space indentation? Is there a way to change that to two?

12:32 technomancy: isaacbw: it's two for most forms

12:32 well for most macro forms

12:32 isaacbw: technomancy: I'm trying to use hiccup, and it's doing one for vectors within vectors

12:33 and one for (html\n...

12:33 technomancy: otherwise it just aligns with the previous arg

12:33 isaacbw: I added html to the indent list with 2, but I don't think I can do the same thing for lists

12:33 er, with 0

12:34 technomancy: vectors shouldn't introduce any new indentation rules

12:34 isaacbw: I don't really want 2 space indentation on vectors all the time, just within the (html ) form

12:34 technomancy: it shouldn't be two for vectors; that's just for function calls

12:35 isaacbw: yea, but in the case of hiccup it looks a bit more readable with two

12:35 In my opinion

12:35 technomancy: you mean indenting data like it's function calls?

12:35 isaacbw: just in this special case, yea

12:36 technomancy: no idea

12:36 isaacbw: or maybe I should juse use something aside from hiccup that actually *does* use function calls

12:37 instead of trying to mangle the indentation rules

12:38 jjro: I'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:39 using ring-handler with lein ring does not work

12:39 nor the approach in gist

12:39 apparently there is something that I do not understand

12:40 isaacbw: how about instead of setting a static number in define-clojure-indent, I set (n-1) where n is the total number of arguments

12:41 (unrelated to my previous indentation question)

12:41 technomancy: personally I really hate it when people change indentation rules

12:41 llasram: srsly

12:41 It's so trivial

12:42 technomancy: because it means you're creating your own little world, and every other contirbutor is going to create inconsistencies

12:42 isaacbw: I see

12:45 jjro: or, is it not possible to use aleph http-server with lein ring plugin?

12:46 isaacbw: technomancy: I don't know, I just like the idea of a DSL that looks at least somewhat like html

12:47 though I guess I don't have to do the crazy indentation n-1 thing to get what I want

12:47 justin_smith: isaacbw: you could make a custom file type, meant to be read by clojure, with its own mode / rules.

12:47 guns: isaacbw: https://github.com/guns/vim-clojure-static/issues/13

12:48 isaacbw: A discussion I had about this very topic

12:48 isaacbw: hold 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:48 oh neat guns, I'll read through

12:48 technomancy: isaacbw: it's more li

12:48 *like zero columns of indentation

12:49 just aligned to the function instead of the paren

12:49 isaacbw: alright

12:49 is there a reason for that? Or do you just assume that most people will have one argument per line including the first line?

12:50 technomancy: I 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:50 but these rules were decided upon before I was even born

12:51 isaacbw: yea I remember this stuff from CL :P

12:51 I thought maybe clojure would be a little different

12:51 technomancy: at least there are no brace placement wars

12:51 guns: OTBS

12:52 isaacbw: ye olde lispers should have thought about html DSLs! geez

12:53 technomancy: they were too busy complaining about how SGML is just a crap sexpr syntax

12:54 hard to find fault with that

12:55 isaacbw: was sgml around before paren s-exprs?

12:56 technomancy: I don't think so

12:56 justin_smith: "SGML descended from IBM's Generalized Markup Language (GML), which Charles Goldfarb, Edward Mosher, and Raymond Lorie developed in the 1960s."

12:56 close I guess? but still newer

12:56 http://en.wikipedia.org/wiki/Standard_Generalized_Markup_Language

12:57 aha! GML were the initials of the three authors as well, funny

12:57 http://en.wikipedia.org/wiki/IBM_Generalized_Markup_Language like a mashup of keywords, css, and html to my first glance, funny

12:58 it's cool that we still use all the same tag names

13:10 pepijndevos: I use compojure with the site handler, which ads params middleware, yet my I get emptyness for a result

13:10 https://github.com/weavejester/compojure/blob/master/src/compojure/handler.clj#L28

13:10 technomancy: llasram: have you done much with forth?

13:11 pepijndevos: https://www.refheap.com/58527

13:13 sdegutis: noprompt: do you have a way to do {:margin "0 auto"} more conveniently in Gaerdun?

13:13 llasram: technomancy: I wrote a Forth implementation (for the Z-machine), most of it in Forth, but that's about it

13:14 noprompt: sdegutis: {:margin [[0 :auto]]}

13:14 llasram: technomancy: 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:15 technomancy: llasram: saw your name on a comment on this post about implementing itsy forth

13:15 cool

13:15 sdegutis: noprompt: neat, I didn't think of using inner-vectors for that

13:15 technomancy: llasram: been playing with the idea of doing my keyboard firmware in forth

13:16 kinda shocked by the fact that there's only one forth on avr that I could find, and it messes with the bootloader

13:16 rasmusto: nkro over usb?

13:16 noprompt: sdegutis: [[]] <-- space separated list, [] <-- comma separated list

13:16 llasram: technomancy: Oh, neat. That could be pretty cool

13:16 technomancy: Why does it mess with the boot loader?

13:17 noprompt: sdegutis: [[1 2] [3 4]] => 1 2, 3 4

13:17 technomancy: rasmusto: only going up to 6; I don't really care about gaming

13:17 isaacbw: how do you collect a lazy sequence into a list?

13:17 sdegutis: noprompt: 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:17 technomancy: llasram: it's not designed for use on arduinos specifically

13:17 rasmusto: technomancy: how about keyboard-as-an-instrument? gotta do chords :)

13:17 noprompt: sdegutis: you can just use two maps in that case and place one above the other.

13:18 technomancy: rasmusto: well... with modifiers you can do 10 keys

13:18 sdegutis: noprompt: 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:18 guns: rasmusto: 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:18 technomancy: and I only *have* ten fingers

13:18 noprompt: sdegutis: there's no "one map rule"

13:18 technomancy: so it seems OK unless you are designing a device for extraterrestrials or mutants

13:18 sdegutis: noprompt: true but it's nice to keep related rules in the same place.

13:18 rasmusto: guns: I don't. I just use one of those usb->ps2 adapters

13:19 noprompt: sdegutis: i typically group everything in to layout, typography, and theme.

13:19 guns: rasmusto: Just seems like the kind of knowledge that has become cargo culted, but the truth is in plain sight

13:19 clojurebot: 'Sea, mhuise.

13:19 noprompt: sdegutis: layout = positioning, dimensions, display, typography = strictly font stuff, theme = everything else

13:20 sdegutis: noprompt: sounds like a good idea, but I'm not that pro at CSS yet :/

13:20 noprompt: sdegutis: it just takes discipline, :)

13:20 justin_smith: technomancy: if you mash your face on the keyboard, I bet you can hit more than ten keys at once

13:20 don't forget the useful face-mash potential you could open up!

13:20 noprompt: sdegutis: i use defstyles to group all those things together, and defrule to abstract common selectors

13:21 technomancy: justin_smith: ten keys is already 23% of the total number on this board to begin with

13:21 sdegutis: i see thank you sir for your time

13:22 technomancy: llasram: do you know of any good resources on implementing forth with a limited level of C knowledge?

13:22 justin_smith: or, what if I want to do keyboard-to-midi input to play cecil taylor songs? http://www.youtube.com/watch?v=EstPgi4eMe4

13:22 technomancy: "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:23 llasram: technomancy: Well, most of the Forth resources I looked at start with assembly, so... :-)

13:23 technomancy: heh, oh right

13:23 llasram: Where does the C come in?

13:23 Oh, ok

13:23 technomancy: just trying to bootstrap with minimal effort

13:23 maybe if I don't already know C it'd be quicker to bone up on AVR assembly

13:24 it's supposed to be a decent instruction set

13:24 llasram: Probably, because that's probably how you'll want to write the primitives you can't/don't want to write in Forth

13:24 Are you planning to write from scratch, or port an existing Forth?

13:24 technomancy: probably start from scratch

13:25 justin_smith: and 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:25 technomancy: I don't intend it to be a general purpose impl

13:25 TimMc: technomancy: Hardware macros allow you to have more than 10 keypresses simultaneously.

13:25 technomancy: just enough to get my keyboard firmware running

13:25 TimMc: but I feel like that's still excessive

13:25 llasram: Cool. Then yeah -- I think doing the AVR assembly is the way to go

13:25 Is there an emulator available?

13:25 technomancy: good question

13:26 if so it's not in apt

13:26 sdegutis: noprompt: and thank you for writing Gaerdun

13:26 it is nice software

13:27 technomancy: oh, there's a simulator

13:27 llasram: Ahhh

13:27 Less hardcore than Forthing directly to the hardware, but probably easier :-)

13:28 technomancy: especially if I want to actually use my keyboard while writing it

13:28 llasram: Yeeeeah

13:28 Chicken, meet egg

13:29 justin_smith: woah, bootstrapping keyboard

13:29 start with two working keys, slowly build that up to fully working

13:29 technomancy: bahaha

13:29 justin_smith: (one key plus mearured timings?)

13:29 isaacbw: does anyone have an idea for a nicer way to write this? https://gist.github.com/isaacbw/9552599

13:30 (let alone the fact that it won't do exactly what I want, I'm not realizing

13:30 *now

13:30 rasmusto: guns: for some reason this video cracked me up: http://www.youtube.com/watch?v=jMjczjhelWM

13:30 isaacbw: but in terms of the code itself and what it does

13:31 llasram: isaacbw: You call `apply str` where `str/join` might be appropriate, and call `str/join` where `str` would be more appropriate

13:31 Also, you probably want to require `clojure.string :as str`

13:33 gfredericks: `clojure.string :as ring`

13:33 llasram: lolololol

13:33 I don't know why I found that so funny

13:33 But I just frightened my co-workers

13:34 (inc gfredericks)

13:34 lazybot: ⇒ 42

13:34 seangrove: It's like js.evil

13:36 TimMc: seangrove: clj.evil would have more alter-var-root

13:36 seangrove: Err, evil.js

13:36 TimMc: js.evil is evil.js's evil twin

13:36 seangrove: TimMc: The idea was to prevent hot-linking js I believe. It would randomly change global defs

13:36 alert => eval, + => -, etc. But it wouldn't be consistent about it

13:36 TimMc: *nod*

13:37 seangrove: Really very lovely, thinking about it

13:38 Someone should write a polyfilly for evil.js - normalize behavior even when a script with it is loaded

13:39 TimMc: You'd have to work pretty hard to get ahold of the original native fns.

13:42 isaacbw: can put-clojure-indent take something like *either* 1 or 0?

13:43 llasram: isaacbw: So, what are you trying to do?

13:44 isaacbw: I'm experimenting with a little html dsl that looks like: (div { attributes }

13:44 (div { attributes }

13:44 (div ...

13:45 but I want the indentation to still work if { attributes } is omitted

13:45 guns: rasmusto: 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:45 isaacbw: maybe I shouldn't be doing what I'm doing...

13:45 llasram: Maybe :-)

13:48 justin_smith: ,(format "%f" (double (/ 1 7))); _tim__: there is always this

13:48 clojurebot: "0.142857"

13:50 justin_smith: or %g if you need more digits of course

13:51 _tim__: justin_smith: thanks, is that first converting to a double or casting?

13:51 justin_smith: I don't think casting exists in clojure? it is a conversion

13:51 I don't think a ratio would cleanly cast to double

13:51 _tim__: justing_smith: thanks

13:59 bore: Hello

14:00 I 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:00 justin_smith: ,(apply str (map char [104 101 108 108 111]))

14:00 clojurebot: "hello"

14:00 justin_smith: no, it is not possible, but you could fake it depending on your needs

14:01 bore: how could I fake it? is there a general approach?

14:01 justin_smith: #(or % :default) is one example

14:02 wait, that's weird - #(and :default %)

14:02 slightly less weird

14:02 n/m that's still messed up - what are you trying to do?

14:02 bore: this is cool but not what I want

14:03 so I have a macro that wraps a carmine (redis) call and it has a signature of [db body]

14:03 something like (defmacro wcar [db body] .....

14:04 now in any given namespace I alway want db to be the same value

14:04 justin_smith: a pattern for that is a new function with closure over db

14:04 bore: so I would ideally like to fix the first argument

14:05 how would this new function help?

14:05 justin_smith: is it body or & body?

14:05 for the latter you need another macro, otherwise you could maybe use a function

14:05 bore: it's actuall & body

14:05 it's actually & body

14:05 justin_smith: right, so macros cause the need for more macros

14:06 (defmacro wcardb [& body] `(wcar db ~@body)) ; assuming db is bound in the same namespace

14:06 there may be a smarter way to do that

14:07 bore: I have one like that, but when I caught myself repeating this pattern I thought there might be a more elegant way

14:07 justin_smith: *is bound, or will be bound by the time the code the macro expands to is invoked

14:07 macros beget macros, the other solution is not to use a macro

14:07 (in the first place - a non macro version of wcar)

14:08 bore: alright so I didn't have a stupid approach

14:08 justin_smith: I don't think so - maybe someone else has a better suggestion

14:08 bore: I am not sure how to do that, but I'll have a nose around - it's all still quite new to me

14:09 I need to delay execution of form passed to wcar

14:09 so I guess I'm stuck with macros then...

14:09 justin_smith: an alternative is to require a lambda as argument

14:10 dnolen_: 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:10 justin_smith: (inc dnolen_)

14:10 lazybot: ⇒ 1

14:10 justin_smith: (inc dnolen)

14:10 lazybot: ⇒ 14

14:12 TimMc: dnolen_: 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:12 dnolen_: TimMc: CLP(R) needs it's own kind of solver

14:12 bore: I 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:12 dnolen_: bore: ugh

14:14 justin_smith: that'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:14 if it's well designed there will be

14:14 TimMc: dnolen_: 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:14 Then again, I've never used core.logic. :-P

14:14 justin_smith: bore: there is a macro, clojure.repl/source that shows you the source of a macro or function when possible

14:15 TimMc: This is for the Clojure version of https://github.com/timmc/sourdough, so it is obviously very important.

14:15 dnolen_: TimMc: but did you really mean floats?

14:15 TimMc: Yep.

14:15 bore: thanks for tips I'll try to sort something out

14:15 TimMc: dnolen_: Well... float intervals, specifically.

14:15 dnolen_: 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:16 TimMc: There's another problem here, which is that the numbers can be seriously fuzzy.

14:16 200 + 200 = 380 sometimes

14:16 I guess that's true for floats in general, though.

14:16 dnolen_: TimMc: oh k, right - so yeah intervals would be an extension to CLP(R)

14:17 http://www.ofai.at/cgi-bin/tr-online?number+93-19

14:17 haven't looked at this stuff enough to know how much of the interval stuff could be hijacked for this

14:17 TimMc: Thanks, I'll follow that up!

14:18 I *may* be able to do this without a general logic engine, though.

14:25 edw: Has anyone here deployed a Clojure app as an uberjar (because you needed to build from private deps) on Heroku?

14:26 justin_smith: is that even possible?

14:26 edw: justin_smith: I would like it to be possible...

14:26 technomancy: sure, uberjars with private deps should work fine

14:28 justin_smith: technomancy: all the docs I find mention uploading source and having heroku do the building - how does one use precompiled objects on heroku?

14:28 edw: technomancy: 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:29 justin_smith: What you said.

14:29 technomancy: edw: oh, I see. you could use the inline buildpack if you don't mind committing the uberjar to git

14:29 https://github.com/kr/heroku-buildpack-inline

14:29 loliveira: any LightTable user?

14:29 technomancy: kinda dumb that you have to set a separate buildpack for that, but whatever

14:30 edw: technomancy: I assumed that I'd be committing to doing that. I could just commit to a non-master branch and deploy that...

14:31 technomancy: pushes to non-master don't actually trigger a deploy though

14:32 your heroku git repo would just be a dummy repo that wouldn't be related to your primary source repo

14:33 stuartsierra: Any last comments on the new G.Closure library release? https://groups.google.com/d/topic/clojurescript/cYKt6dI4Q7A/discussion

14:33 clojurebot: No entiendo

14:33 stuartsierra: I'll make the final release to Maven Central today unless someone reports a problem.

14:35 technomancy: edw: actually the null buildpack would make more sense for what you describe https://github.com/ryandotsmith/null-buildpack

14:38 edw: technomancy: Thanks. All check both out.

14:56 asthasr: Hey guys. What's the canonical way to have a side-effect (like logging) inside a threading macro?

14:56 For example, (->> x fn fn2 fn3 (log some-message) fn4 fn5)

14:56 or is this just massively terrible

14:57 technomancy: asthasr: doto works with ->

14:59 asthasr: technomancy: Ah, didn't know about doto. Thanks

15:00 amalloy: asthasr: combining doto and -> is like magic

15:01 you can even do it in both "directions": (doto (Person.) (.setName "steve") (-> (.getFriends) (doto (.add mike) (.add jane))))

15:05 ztellman: amalloy: I can never understand what the hell is going on when you do that

15:06 technomancy: http://p.hagelb.org/alternate.gif

15:06 asthasr: amalloy: I have confusion. Messing around with doto in the repl, why doesn't (doto 3 (+ 5) (* 9)) return 72?

15:07 amalloy: because doto is for side effects

15:07 asthasr: ahh, so ultimately it will just return the original

15:07 derp

15:07 i'm dumb

15:07 amalloy: evaluating 3+5 doesn't change what 3 is

15:07 technomancy: (doto 'some.ns require in-ns) is my favourite

15:08 amalloy: yes, i like that one too, technomancy. unashamed to have stolen it

15:08 technomancy: abomination or handy shortcut? you decide!

15:08 amalloy: i 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:08 turbopape: hi 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:09 but it seems that sometimes some agents jsut don't do the work...

15:09 any idea on how to investigate ?

15:10 justin_smith: are you checking agent-error?

15:11 turbopape2: yep. nothing in it ...

15:11 sdegutis: amalloy: fwiw i agree with ztellman

15:11 justin_smith: so they are just not running?

15:11 turbopape2: I think it has to do with the change of state ...

15:11 sdegutis: ... this time

15:11 turbopape2: some of them are , the others not

15:12 I mean, I think I don't get the agent hold after change of state thing, i think...

15:12 Will it be okay to use only one agent and put the treatment as a do block inside onlye one send-off ?

15:13 how would you do it guys ?

15:17 amalloy: sdegutis: 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:26 AmandaC: Hey, 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:27 seangrove: technomancy: Have you gotten around to fixing namespaces to make them less mutation-based monstrosities?

15:27 amalloy: AmandaC: 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:27 * seangrove wonders what's taking technomancy so long

15:28 AmandaC: amalloy: ah, so there’s no way to do it using the default gloss.core/string codec?

15:28 amalloy: probably not, i dunno

15:29 there's no need to make *everything* a primitive, when there are so many ways to layer stuff on top of the primitives

15:34 technomancy: seangrove: lunch

15:34 and no, I only rant about things on IRC in hopes that someone else will fix it these days

15:35 it's my new MO

15:35 seangrove: technomancy: Ah, so that's how we can recognize you if you pop up under a different nick

15:37 stuartsierra: Is it still the case that ClojureScript cannot catch non-Object errors?

15:39 dnolen_: stuartsierra: catch :default

15:39 stuartsierra: dnolen_: got it, thanks.

15:39 dnolen_: stuartsierra: also remembered a few other new things, specify/specify!/clone

15:40 (specify foo ...) is like reify, but calls clone on foo and then mutates it to add methods

15:40 desugars into

15:40 (specify! (clone foo) ...)

15:41 stuartsierra: dnolen_: OK. What's `clone`?

15:41 dnolen_: stuartsierra: clone just calls -clone protocol method, ICloneable

15:41 stuartsierra: it just returns a clone, like meta does, but doesn't change anything

15:42 stuartsierra: dnolen_: You mean `clone` gives you a new instance of a data structure which is equal to the one you passed in?

15:43 dnolen_: stuartsierra: yep equiv, not JS equals

15:43 stuartsierra: OK

15:44 Is `clone` a deep-copy then?

15:45 dnolen_: stuartsierra: semantically yes like meta. But really all implementation just call the constructor again with current fields

15:45 stuartsierra: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L677

15:46 noprompt: $seen Raynes

15:46 lazybot: Raynes was last seen talking on ##eleventhbit 1 hour and 15 minutes ago.

15:46 dnolen_: stuartsierra: http://github.com/clojure/clojurescript/blob/master/test/cljs/cljs/core_test.cljs#L2068 demonstrate specify, and clarifies the equality bits

15:47 stuartsierra: dnolen_: Is "IWoz" a deliberate Steve Wozniack reference?

15:47 seangrove: Creepy, cross-channel tracking of Raynes

15:47 dnolen_: stuartsierra: haha no

15:49 stuartsierra: Looking at the implementation, it seems pretty clear that `clone` is *not* a deep copy.

15:49 sdegutis_: Wait, Clojure has a deep-copy?

15:51 dnolen_: stuartsierra: but it doesn't need to be in precisely the same way meta doesn't need to be

15:52 stuartsierra: note that transients don't support for the obvious reasons

15:52 stuartsierra: er, I've mean with-meta this whole time of course

15:53 stuartsierra: OK

15:54 dnolen_: Are there docs for `specify!` more recent than http://dev.clojure.org/display/design/specify+i.e.+reify+for+instances ?

15:54 dnolen_: stuartsierra: not really, those docs are more ambitious wrt to optimizations than what is present in the current implementation

15:55 stuartsierra: the highlevel stuff does apply

15:55 stuartsierra: OK cool

15:56 dnolen_: Thanks!

15:57 dnolen_: stuartsierra: np

15:57 AmandaC: Hrm, 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:57 stuartsierra: dnolen_: And congrats on the KT Coders training announcement too

15:57 dnolen_: stuartsierra: thanks!

15:59 amalloy: AmandaC: use a let?

16:00 AmandaC: amalloy: hrm

16:01 scape_: definitely sounds like a place for let

16:01 amalloy: your 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:01 AmandaC: I see.

16:02 Yeah, I am using def inside the function, this is the code, to be precise: http://amanda.darkdna.net/p/25c9b

16:02 scape_: ,(let [x 1, y 2] (prn x))

16:02 amalloy: that's the purpose let serves

16:02 clojurebot: 1\n

16:02 amalloy: hey, nice-looking paste site. <3 dark themes

16:04 llasram: AmandaC: Do you come from scheme?

16:04 AmandaC: llasram: nope, actually. I’m coming from no-lisp-experience. :P

16:04 amalloy: AmandaC: https://www.refheap.com/31483d5e44072050fa310b865 would be one reasonably standard way to rewrite that

16:04 * AmandaC has programmed in plenty of other languages, this is her first one with a lisp-alike

16:04 llasram: AmandaC: Clojure `def` is explicitly global -- what it does is create a var (if necessary) and intern it into the current global namespace

16:05 AmandaC: Oh, ok. Scheme def-equiv is lexicaly-scoped, which leads some astray

16:05 AmandaC: I was considering it like a normal variable set. :p

16:05 amalloy: hrm, that looks a rather bit nicer, yes/

16:05 thanks.

16:06 * AmandaC copy-pasta

16:06 scape_: 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:06 amalloy: AmandaC: note that you never use src, and you use a variable named bitmap that doesn't seem to exist

16:07 AmandaC: Whoops

16:07 * AmandaC clicks her own paste

16:07 AmandaC: Yeah, src is used in making bitmap

16:08 * AmandaC was worried something got dropped in the copy-paste into her pastebin thingy

16:09 dnolen_: AmandaC: some what of a sidenote, but variable assignment as found in most other languages just doesn't exist in ClojureScript

16:09 AmandaC: er meant Clojure there

16:09 AmandaC: Heh, I got the meaning. and yeah, I’m discovering that now. :p

16:10 amalloy: AmandaC: 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:10 scape_: AmandaC: i like that paste page you have, did you design this or is it a library?

16:10 AmandaC: scape_: the hi lighting is a library, the CSS I made myself. p

16:11 cbp: neat

16:11 AmandaC: the 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:12 scape_: cool

16:12 amalloy: llasram: you asked that already?

16:12 oh sorry, i was scrolled back

16:12 lol

16:13 AmandaC: are you aware of import? it would save you typing out the package names inline, where they just clutter things

16:15 AmandaC: amalloy: well, I have to import the java classes, but I’m not really sure what I’d do to shorten them from there?

16:15 llasram: amalloy, IRC time-traveler!

16:15 scape_: lol

16:15 you import or require it and give it a short hand for the namespace

16:16 * AmandaC checks TFM for import

16:16 amalloy: AmandaC: https://www.refheap.com/bd51be6e4aa2ec9d9e8eb202f

16:17 AmandaC: oh, huh

16:17 amalloy: you don't actually have to import java classes to use them - they're always available

16:17 import just lets you not mention the package name

16:17 AmandaC: Ah

16:17 That’d make the code much cleaner, I though I had to import them to use them. :p

16:17 I already have the import statements.

16:18 scape_: :)

16:21 AmandaC: Oh yes, that’s definitely much cleaner. :D

16:24 srruby: I'm registering for Clojure/West. Anyone have a discount code? Thanks, John

16:40 stuartsierra: Is `:print-input-delimiter` still a valid build option in ClojureScript?

16:48 gfredericks: is there a solid jruby <-> clojure data translator lib somewhere?

16:49 zweikopf looks promising

16:53 dnolen_: stuartsierra: whoa what is that?

16:53 DomKM_: gfredericks: I used zweikopf for this https://github.com/DomKM/whois.clj. It works well.

16:53 dnolen_: stuartsierra: and yes it is

16:53 stuartsierra: dnolen_: More important question: is it still relevant given source maps?

16:54 dnolen_: stuartsierra: I just don't know what that does

16:55 stuartsierra: dnolen_: OK

17:13 FYI, it's a G.Closure compiler thing to insert comments between concatenated files. https://developers.google.com/closure/compiler/docs/api-ref

17:14 BartAdv: (def s (atom "")) <- how can I do instance? checks on the wrapped value?

17:14 hm, I can deref, alright

17:15 edw: technomancy: ping

17:18 technomancy: unping

17:19 seangrove: technomancy: reping

17:26 stuartsierra: I have released G.Closure library 0.0-20140226-71326067 for sync to Maven Central.

17:30 dnolen_: stuartsierra: excellent

17:32 stuartsierra: And 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:37 * stuartsierra writes Bash for a living

17:37 tbaldridge: nice! there's some sweet async stuff in the new versions

17:37 things that I think can replace the dispatcher in core.async

17:38 dnolen_: tbaldridge: yep that's what I was thinking

17:39 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:33 justin_smith: the clojure programming o'reilly book is decent

18:35 [swift]_: justin_smith: sounds good. i'll give it a shot

18:44 FatsDT: What is the fastest way to determine the latest stable version of a package?

18:45 jcsims: FatsDT: something like lein-ancient? https://github.com/xsc/lein-ancient

18:46 FatsDT: "./lein search $packagename" gives me many versions

18:46 I 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:48 AmandaC: FatsDT: just go for the highest one? :p

18:50 shep-home: So, am I missing a clean way of getting a lazy seq out of a core.asyn channel?

18:56 like, I have some code, but I guess I'd expect there to be one in core.async itself.

18:56 But there may be a good reason I'm overlooking

18:56 justin_smith: https://gist.github.com/gerritjvv/7230860 this may be relevant?

18:57 shep-home: justin_smith: yeah, that's what im doing (just one chan for me though, so it's a touch simpler)

18:57 arohner: shep-home: what semantics are you expecting when there is no data in the channel? Taking is stateful, which kind of conflicts w/ laziness

19:01 shep-home: arohner: if there's nothing, I'd be ok with blocking. That seems plausible - a seq based on IO could have pauses too

19:02 arohner: I'm just pointing out that those decisions have to be made somewhere, and it's a tradeoff

19:03 so the library probably doesn't support it already, just because it's hard to make something that works for everyone

19:05 shep-home: arohner: valid point

19:06 arohner: onto-chan does exist though

19:06 does it not have the same tradeoffs?

19:07 also spool and to-chan

19:22 BartAdv: hm, is it possible to set reference value without invoking watchers?

19:27 justin_smith: can you just make the watcher more specific?

19:27 or is it that you are worried the watcher would not get called?

19:28 BartAdv: no, 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:29 justin_smith: you could paramaterize the data with who last touched it and make sure the gui sets that key, and also checks it

19:30 which may mean promoting the data to a map with a :value key, or some such

19:31 BartAdv: or maybe using some meta?

19:31 ok, I will think about it, thanks

19:31 justin_smith: yeah, you could alter the meta I guess

19:31 but while the data is atomic, I don't know if the metadata is?

19:31 (synchronized, whatever...)

20:20 gfredericks: is 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:21 dnolen_: 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:04 mr-foobar: how do you create an edn data structure with tagged literals ?

21:21 gfredericks: mr-foobar: it's not quite clear what that means; could you describe why you're trying to do that?

21:27 technomancy: gfredericks: use a test project

21:27 gfredericks: technomancy: damn I guessed wrong

21:27 mr-foobar: gfredericks: 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:28 gfredericks: technomancy: do you know what would cause `bin/lein test` to exit quickly with no output?

21:28 this is after changing defproject

21:29 mr-foobar: I've only accomplished that by extending print-method for a custom type

21:29 mr-foobar: or :type metadata

21:29 technomancy: gfredericks: "because bootstrapping" might be the best I can offer with available data

21:29 and my battery is about to cut out

21:29 jonh: eep

21:30 gfredericks: mr-foobar: here's an example: https://github.com/hiredman/bytes/blob/master/src/com/thelastcitadel/bytes.clj

21:30 technomancy: thanks :)

21:30 technomancy: gfredericks: can help later if you open an issue

21:31 gfredericks: roger

21:31 technomancy: or 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 e.g. https://groups.google.com/forum/#!msg/clojure/kWylqe4e3-Y/i_-Q0BlkgMUJ

21:35 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 i'm trying to figure out a good way to, for example, on click, find the closest train and update it

21:36 finding it easy, e.g. using mapcat but then i lose my "reference" to the train and can't update it

21:36 i keep wanting to have some kind of id/pointer (ugh) but it doesn't seem like the right solution

21:38 anyway, any advice would be appreciated

21:41 amalloy: i 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 amalloy_: using reduce, for example

21:43 AmandaC: `szx_: did you see that LightTable programmer’s explanation on that one game-dev strategy?

21:43 Seemed 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 AmandaC: are you talking about one of chris granger's posts?

21:44 AmandaC: `szx_: it was mentioned in somewhat-depth on the ClojureTV YouTube channel’s conj talks. Not sure what year, though

21:45 * AmandaC can dig up the link in a minute or two, trying to arrange some bonding time with her special someone. :p

21:45 `szx_: AmandaC: i'll try to find it, thanks for the lead

21:46 http://www.chris-granger.com/2012/12/11/anatomy-of-a-knockout/ was it this one?

21:46 AmandaC: That 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 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 which feels even more awkward

21:55 muhoo: huh, 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:56 which is what that post basically says, doh

22:00 tmciver: `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 tmciver: i don't know what i'm going to update until i've iterated through all entities

22:05 tmciver: for example, how would you find the entity (train) closest to the current mouse position and make a change to it?

22:06 tmciver: `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 tmciver: f only "sees" some of the trains (the ones on that line)

22:10 tmciver: `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 (map-indexed #(map-indexed (partial vector %1) (:trains %2)) (:lines @world))

22:15 i just feel like there's a better way, but maybe there isn't.

22:19 tmciver: Not 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:20 tmciver: `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:25 AmandaC: tmciver: yeah the video in the top line of that post is what I saw

22:53 gfredericks: where do the 500 pages w/ stacktraces that I normally see in compojure apps come from?

22:54 michaniskin: well, a mommy and a daddy love each other very much, and then a stork comes…

22:55 sorry, disregard me

22:55 pdk: huge stacktraces are the product of framework orgies

22:55 50 software frameworks stacked on top of each other makes for extremely deep call chains

22:58 amalloy: gfredericks: i think it might even be ring

22:58 pdk: you misread the question

22:59 he's not asking why they're 500 pages long, he's asking who's responsible for rendering a stacktrace as a 500 error

22:59 pdk: ohh

22:59 http 500

23:00 gfredericks: amalloy: the jetty adapter isn't doing it

23:00 I don't see any obvious namespaces in ring.middleware.*

23:01 muhoo: i simply do not want to make a mental picture of a "framework orgy"

23:02 all kinds of people's opinionatated and brittle models of the world, getting ugly in a dimly-lit room

23:03 amalloy: gfredericks: https://github.com/mmcgrana/ring/blob/6b8d49196a1d4dd254e7905d63c19c7f5729439d/ring-devel/src/ring/middleware/stacktrace.clj

23:03 muhoo: abstractions that don't fit together at all... ok that's enough.

23:06 gfredericks: amalloy: ah ha; ring-devel; cool thanks

23:06 amalloy: gfredericks: fwiw, i found that by searching within the ring github repo for "try"

23:08 gfredericks: haha

23:08 clever

23:22 eraserhd: Does core.logic not already have a goal for an arbitrary sequence of any length?

23:29 amalloy: eraserhd: i don't see one

23:29 felixflores: I'm trying to work through the Reasoned Schemer book, and in one of examples they use `pair?

23:30 is this not defined in core.logic?

23:31 eraserhd: felixflores: hrmm..

23:32 amalloy: it'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:32 felixflores: it says unable to resolve symbol: pair?

23:32 amalloy: you might only need one of those two clauses, i'm not really sure

23:32 felixflores: that's probably the scheme primitive to test if something is a cons cell

23:33 eraserhd: amalloy: Why account for nil?

23:34 ,(require 'clojure.core.logic)

23:34 clojurebot: #<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/core/logic__init.class or clojure/core/logic.clj on classpath: >

23:34 amalloy: because you can cons onto it to get a non-empty collection

23:34 felixflores: the funny thing is in https://github.com/candera/reasoned-schemer/blob/master/src/reasoned_schemer/chapter2.clj, they use it

23:34 without defining it

23:35 amalloy: well i did just say, felixflores, that it's a scheme primitive

23:35 clojure programs use functions like 'first without defining them, because they're part of the language

23:35 oh, but that's clojure

23:36 they're importing it from other code they wrote: https://github.com/candera/reasoned-schemer/blob/master/src/reasoned_schemer/core.clj

23:36 eraserhd: felixflores: You can probably define it like this: (defn pair? [x] (= clojure.core.logic.LCons (class x)))

23:39 felixflores: ah! thanks amalloy

23:39 how could have I missed that

23:56 danielszmulewicz: I'm trying use org.clojure/core.memoize (the fogus library), but I get an exception No such var: cache/through

23:56 I saw it came up before

Logging service provided by n01se.net