#clojure log - Apr 26 2014

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

0:14 samg_: Is there documentation that specifies which collection manipulations are persistent? For example, I want to know if I can change the comparison fn of a sorted-map-by without copying the entire map.

0:17 ivan: samg_: are you worried about the map getting mutated or suboptimal performance?

0:17 samg_: I'm worried about performance. I want to make sure I use the collections in the right way.

0:18 dbasch: samg_: the right way is to not worry about it until you need to optimize

0:19 samg_: I agree with that. "Worry" is the wrong word. I want to learn about the performance characteristics of the collections library.

0:19 dbasch: samg_: all the collections are immutable by default, unless you make them transients

0:21 samg_: it’s usually pretty straightforward to change your code to use transients if you really need to

0:22 if that’s not enough, you may need to rethink your structures / algorithms

0:23 most of the time the collections won’t be your performance bottleneck

0:24 samg_: I am considering an architecture with a single mutable cell to a persistent structure, where all modification creates a new structure and updates the cell. I'd be relying on the persistence of collection modifications to avoid creating a ton of garbage.

0:24 dbasch: it would be easier with a concrete example

0:25 samg_: That's why I am interested to know which operations are persistent, and which aren't.

0:27 dbasch: samg_: in funcional land you never modify the original object. You have to assume a worst case of f(a) -> b meaning that now both a and b exist in memory

0:28 samg_: in reality a and b may share most of their structure in memory

0:28 samg_: but that of course depends on the modification

0:29 samg_: I have to assume that conj copies the entire collection?

0:29 dbasch: samg_: in theory yes, in practice no

0:29 samg_: I think I can assume that conj is a persistent modification.

0:29 If I can't, then why would I use persistent collections?

0:30 dbasch: samg_: explain what you mean by persistent

0:30 samg_: I mean http://en.wikipedia.org/wiki/Persistent_data_structure

0:31 The same language is used in the docs: http://clojure.org/data_structures

0:31 dbasch: yes, all clojure collections are persistent

0:32 samg_: see the part about collections http://clojure.org/data_structures

0:32 samg_: I read this page. I am looking for more specific information.

0:32 dbasch: samg_: you can look at the source

0:32 samg_: I will do that. Thanks.

2:10 l1x: what is the best way to pretty print a hashmap to a file?

2:18 Frozenlo`: l1x: I'd probably do something like that (spit "my-file-name" (with-out-str (clojure.pprint/pprint {:a (range 20) :b 2 :c (range 12)})))

2:18 l1x: Frozenlo`: thanks

2:19 TerranceWarrior: do you people use emacs or vim?

2:20 Frozenlo`: TerranceWarrior: I 'think' there's a majority of Emacs users.

2:21 TerranceWarrior: Frozenlo`: ok, just seeing what is in vogue.

2:22 are there any stable opengl project using clojure

2:22 ?

3:56 raj__: quit

4:35 gko: anyone using cider? does it hang a lot?

4:39 bob2: works well for me

4:47 derek_c: can core.match have a guard on all patterns together, rather than separately?

4:48 like, when you do: (match [1 2]

4:48 you can have a pattern guard like [(_ :guard #(odd? %)) (_ :guard odd?)]

4:48 but can you have a guard that works on both 1 and 2 together?

4:48 like a function that takes these two as parameters?

5:05 ticking: does anyone know if someone build a nrepl transport that uses websockets? I know that this came up on the ml once, but nobody answered on the thead.

6:42 luxbock: what interfaces does my custom type have to implement so that I can access its fields using keywords instead of regular field access?

6:50 pyrtsa: luxbock: I believe clojure.lang.ILookup is enough.

6:51 ,(:a (reify clojure.lang.ILookup (valAt [_ _] 1) (valAt [_ _ _] 2)))

6:51 clojurebot: 1

6:51 pyrtsa: ,(:a (reify clojure.lang.ILookup (valAt [_ _] 1) (valAt [_ _ _] 2)) nil)

6:51 clojurebot: 2

6:51 luxbock: thanks

7:06 clgv: luxbock: you want keyword lookup but no real map impl behind that?

7:07 luxbock: well I kind of changed my mind already, realizing it's probably a bad idea

7:09 I had written the type as a record, written a bunch of code that used keyword lookup, but then I wanted to override its toString, equals and hashCode methods

7:10 but I think s/:value/.value is more appropriate solution for my use case

7:47 hmm, why does one have to use underscores when importing namespaces, but dashes when requiring them?

7:48 clgv: luxbock: java namespace must not include dashes that's why

7:48 luxbock: alright, this was puzzling me for a while

7:49 clgv: luxbock: though for import there should be an automatic conversion in the compiler since that can also cause problems

7:56 penthief: I've lost eldoc in cider-mode and cannot work out how to get it back, any ideas?

7:57 Oh nvm, it came back (?)

8:15 clgv: nondeterministic tooling :D

9:35 ucb: can I dispatch a multimethod on a record I defined on a different namespace by any chance?

9:35 e.g. (defmethod foo other.namespace.Record [...] ...)

9:39 hrm, maybe this is failing because cyclic dependency :/

9:43 gfredericks: ucb: yes you should definitely be able to do that

9:43 ,(ns user5)

9:43 clojurebot: nil

9:43 gfredericks: ,*ns*

9:43 clojurebot: #<Namespace sandbox>

9:43 gfredericks: ,(do (ns user5) (defrecord Tom []))

9:43 clojurebot: user5.Tom

9:43 gfredericks: ,Tom

9:43 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: Tom in this context, compiling:(NO_SOURCE_PATH:0:0)>

9:43 gfredericks: ,user5.Tom

9:43 clojurebot: user5.Tom

9:43 ucb: gfredericks: I think it's because I have a cyclical dep :(

9:44 gfredericks: ,(defmulti my-multi type)

9:44 clojurebot: #'sandbox/my-multi

9:44 gfredericks: ,(defmethod my-multi user5.Tom [x] "that is a Tom")

9:44 clojurebot: #<MultiFn clojure.lang.MultiFn@1002c19>

9:44 gfredericks: ,(defmethod my-multi :default [x] "that is NOT a Tom")

9:44 clojurebot: #<MultiFn clojure.lang.MultiFn@1002c19>

9:44 gfredericks: ,(my-multi 20)

9:44 clojurebot: "that is NOT a Tom"

9:44 ucb: gfredericks: mind if I show you some code? Maybe you can help me untangle it.

9:44 gfredericks: ,(my-multi (user5/->Tom))

9:44 clojurebot: "that is a Tom"

9:44 gfredericks: ucb: sure

9:45 ucb: gfredericks: https://gist.github.com/ulises/11320338

9:46 the offending code is commented out

9:46 the issue is with Atom, not with List

9:46 gfredericks: ucb: you could move the "defmethod apply faust.types.Atom" part into the .types namespace

9:46 ucb: incidentally, if I get a repl, compile types, then uncomment apply, it compiles fine

9:46 gfredericks: if that seems reasonable

9:47 yeah doing things in the repl can mask cyclic problems sometimes

9:47 ucb: I suppose I could; I was hoping I could keep types and logic separate

9:47 gfredericks: weelllll

9:47 I think the only way to accomplish that is to put the protocol into a .protocols namespace

9:48 so .types doesn't have to depend on .eval

9:48 that kind of structure probably accomplishes the separation you want better anyhow

9:48 whilo: hi

9:48 gfredericks: whilo: hello

9:48 ucb: gfredericks: will give it a go. Thanks.

9:48 whilo: what is the status of gpl in clojure code?

9:49 in wikipedia epl and gpl are described incompatible

9:49 gfredericks: ~gpl

9:49 clojurebot: It's greek to me.

9:49 * gfredericks has no idea

9:49 gfredericks: ucb: I kind of like the idea of a separate namespace for protocols, schemas, etc

9:49 in general I mean

9:50 ucb: so you'd move ... LispVal to protocols, and keep apply in eval?

9:50 gfredericks: right

9:50 whilo: i like strong copyleft for some infrastructural software as it can be a foundation of trust for a community, but it shouldn't introduce confusion with developers

9:50 gfredericks: ucb: or you could put the defmulti in .protocols but keep the defmethod in .eval

9:50 a defmulti is kind of like a protocol anyhow

9:50 ucb: sure

9:51 gfredericks: I'm trying to think of a more general namespace name than .protocols

9:51 .abstractions :)

9:51 ucb: I also pondered whether I should make eval part of the protocol anyway

9:51 gfredericks: you mean apply?

9:51 ucb: yes, apply, sorry

9:55 grumble.

9:56 gfredericks: ,my-method

9:56 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: my-method in this context, compiling:(NO_SOURCE_PATH:0:0)>

9:57 gfredericks: ,my-multi

9:57 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: my-multi in this context, compiling:(NO_SOURCE_PATH:0:0)>

9:57 gfredericks: ,(defmethod print-method ::foo [x pw] (print-method ["This is a foo" (str x)] pw))

9:57 clojurebot: #<MultiFn clojure.lang.MultiFn@18be695>

9:58 gfredericks: ,(vary-meta {:a 42} assoc :type ::foo)

9:58 clojurebot: #<StackOverflowError java.lang.StackOverflowError>

9:59 * gfredericks doesn't quite understand that one

10:00 gfredericks: ,(str (vary-meta {:a 42} assoc :type ::foo))

10:00 clojurebot: #<StackOverflowError java.lang.StackOverflowError>

10:00 gfredericks: ,(.toString (vary-meta {:a 42} assoc :type ::foo))

10:00 clojurebot: #<StackOverflowError java.lang.StackOverflowError>

10:01 gfredericks: huh. .toString calls print-method. whaddayouknow.

10:01 Bronsa: gfredericks: that works fine in my repl

10:01 gfredericks: waat-

10:01 Bronsa: you did the defmethod above?

10:02 Bronsa: oh

10:02 duh.

10:02 gfredericks: phew

10:03 ,(defmethod print-method ::foo [x pw] (print-method ["This is a foo" (vary-meta x dissoc :type)] pw))

10:03 clojurebot: #<MultiFn clojure.lang.MultiFn@18be695>

10:03 gfredericks: ,(vary-meta {:a 42} assoc :type ::foo)

10:03 clojurebot: ["This is a foo" {:a 42}]

10:03 Bronsa: gfredericks: oh well str on hash maps defers to RT.printString

10:03 gfredericks: yep

10:04 Bronsa: which calls print which calls pr-on which calls print-method so there you have it

10:04 * gfredericks has it there

10:08 Anderkent: man, deleting data is scary

10:26 gfredericks: Anderkent: now you have me imagining some formal system for gradual deletion

10:26 pandeiro: i have a command-line program in clojure that scans the filesystem, produces a sequence of maps, serializes it with pr-str and outputs it with print. i'm having a weird problem that the last ~40 chars of the serialization end up missing from the output. anyone know why that would be? i'm guessing the process is exiting before the print finishes?

10:26 gfredericks: pandeiro: print doesn't auto flush

10:26 pandeiro: just call (flush) before you finish

10:27 pandeiro: gfredericks: ah, that's what (flush) is about

10:27 gfredericks: println does auto-flush though

10:27 pandeiro: gfredericks: ah, ok

10:27 ,(doc println)

10:27 clojurebot: "([& more]); Same as print followed by (newline)"

10:27 Anderkent: gfredericks: does println always autoflush?

10:28 gfredericks: I think so but I can't remember why

10:28 ,(doc *out*)

10:28 clojurebot: "; A java.io.Writer object representing standard output for print operations. Defaults to System/out, wrapped in an OutputStreamWriter"

10:28 Anderkent: ah

10:28 ,(doc *flush-on-newline*)

10:28 clojurebot: "; When set to true, output will be flushed whenever a newline is printed. Defaults to true."

10:28 gfredericks: ,*flush-on-newline*

10:28 clojurebot: true

10:28 gfredericks: well there you go

10:29 there's always something in clojure.core that you don't know about

10:33 pandeiro: another serialization question, what would be the equivalent to pr-str for writing to an outputstreamwriter instead of producing a string?

10:36 gfredericks: pandeiro: pr

10:36 wrapped with a binding for *out*

10:37 (binding [*out* my-output-stream-writer] (pr x))

10:37 pandeiro: gfredericks: cool, let me try that, thanks

10:43 gfredericks: so actually what i want is for a serialization that accompanies a lazy sequence's realization, item by item or chunk by chunk or whatever - is that possible?

10:44 gfredericks: pandeiro: what's this for?

10:45 pandeiro: trying to get 1TB of mp3 metadata into a form i can play with

10:45 the processing of the tags is taking >10 minutes on my machine

10:46 gfredericks: so you have a lazy seq and you want to print each thing to an output stream?

10:46 doseq would be good for that

10:47 pandeiro: gfredericks: yeah no actually i want the whole sequence serializable as edn or json

10:47 gfredericks: but pr might be lazy-friendly too

10:47 pandeiro: i just tested pr

10:47 it works, but appends a nil to the end

10:47 gfredericks: waat?

10:47 maybe that's your repl?

10:47 giving you the return value?

10:47 pandeiro: yeah, hmm, ok

10:48 * gfredericks goes away

10:58 gfredericks: pandeiro: for a very large lazy seq you have to of course be careful not to hold on to the head

11:00 jkj: "Where's Your Head At" by basement jaxx

11:00 song relates

11:00 have to give trapperkeeper a try btw.

11:01 puppetlabs has good things going on

11:04 ucb: gfredericks: unfortunately that splitting into types, protocols, and eval namespaces didn't quite work

11:04 gfredericks: perhaps I'm just being a numpty :)

11:13 gko: If I have a map like: {:a 1}, is there a better way to destructuring it than (let [[c v] (seq (first {:a 1})) ...) ???

11:13 lazybot: gko: Oh, absolutely.

11:19 ucb: gko: try (let [{:keys [a]} {:a 1}] a)

11:19 ,(let [{:keys [a]} {:a 1}] a)

11:19 clojurebot: 1

11:20 ucb: gfredericks: sadness. The only way I've found to make it compile is to have the defmethod in the types ns

11:24 gfredericks: I guess that now a reasonable compromise is to have types be a directory under which I have each type, e.g. src/faust/types/list.clj and then have each ns define the type itself and how its apply. Though that means I'll end up having something like (require [faust.types.list :refer [List]]) and faust.types.list/apply which is not entirely ugh I guess

11:27 codestorm: hi. On OS X, where do people typcaily install clojure?

11:28 oskarth: codestorm: If you have java and leiningen, Clojure will install itself in a project that requires it

12:06 crispin: hello! Im having problems calling java interop on a method on a public interface

12:06 I import the interface

12:06 but then cant access the interface methods

12:07 eg. how to call this: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/Graphics.html#getWidth()

12:08 (:import (com.badlogicgames.gdx Graphics)) imports it

12:08 in my ns

12:09 (.getWidth Graphics) => java.lang.IllegalArgumentException: No matching field found: getWidth for class java.lang.Class

12:09 Graphics seems to be a class. How do I get the Graphics interface?

12:13 (Graphics/getWidth) => java.lang.NoSuchFieldException: getWidth

12:21 tastymango: /part #clojure

12:27 TravisD: bye bye!

13:24 f0086: If I use ,clojure.java.io/resource in a repl, it returned nil

13:27 gko: ucb Problem is, the key can vary... I guess it

13:28 ucb it's a bad idea to use {:a 1 :b 2} instead of [{:code :a :value 1} {:code :b :value 2}]...

14:29 TravisD: woah, so many name changes

14:30 arrdem: iwilcox seems to be derping around today...

14:30 iwilcox: Sorry for the noise.

14:30 TravisD: lol, no problem. My fault for leaving it in my chat log

14:30 what are you up to, though?

14:30 iwilcox: Wasn't doing it for fun but in hindsight should have parted ~16 channels, changed, rejoined.

14:31 amalloy: crispin: you need an instance of the Graphics interface in order to call methods on it. ordinarily it would be passed to you, by some rendering framework or something

14:31 iwilcox: TravisD: I'm a Bitcoiner and the #bitcoin scammers absolutely love using stale nicks to impersonate people with reputation. Sadly grouped nicks don't get defended like the main nick unless used every 10w.

14:32 TravisD: iwilcox: Cool. 10w is a strange amount of time

14:34 iwilcox: TravisD: Freenode's choice. Ultimately we bitcoiners are trying to use a tool (Freenode's ircd) for something it really wasn't meant for (OTC trade); even though we have a web-of-trust, newbies don't always know to use it and scammers take advantage of that.

15:40 instilled: hey! i have three vectors of same length and would like to generate one vector as result[0] = vec[0][0] + vec[1][0] + vec[2][0]; result[1] = vec[0][1] + vec[1][1] + vec[2][1] … how can i do that in clojure?

15:42 llasram: ,(let [a [1 2 3], b [4 5 6]] (mapv + a b))

15:42 clojurebot: [5 7 9]

15:42 instilled: cheers!

15:43 thought there was an easy way!

15:46 seangrove: Such a bummer, if browsers reported screen vieport size in http request headers, could pull off some cool tricks

15:47 I suppose it'd make for some unpleasant overhead. But that and a pre-render hook with a hard-time-deadline to run a layout pass, and browser could be a sane app development platform

16:00 technomancy: seangrove: put it in the accept header?

16:02 seangrove: technomancy: Can't do that on the initial js load though

16:05 r00k: Anyone have experience running ragtime migrations on heroku? I'm trying to figure out a good way to point it to heroku's DATABASE_URL when I run `lein ragtime migrate`.

16:06 Right now it reads the database url out of my project.clj, which works locally but fails on heroku. Any recommendations on getting it to work in both places? Right now it seems like I'll need a conditional in project.clj but that feels...dirty?

16:08 technomancy: r00k: you can't use environment variables?

16:11 r00k: technomancy: That would work well when on heroku, but wouldn't that be a pain locally, needing to always have that env var set?

16:12 technomancy: usually with config you have default values

16:12 either through environ or just a simple clojure.core/or

16:12 r00k: Gotcha. That makes sense. Thanks!

16:14 technomancy: sure

16:59 Frozenlock: lein clean doesn't clean my cljx output-dir. Is there a config to do that?

17:01 AWizzArd: http://www.google.com/trends/explore#q=common%20lisp%2C%20clojure&cmpt=q

17:01 Frozenlock: Sad for common lisp

17:01 https://www.google.com/trends/explore#q=common%20lisp%2C%20clojure%2C%20emacs&cmpt=q

17:02 AWizzArd: I started CL in 2003 and did it professionally for some years. Still nice, but I prefer Clojure (clearly).

17:02 http://www.google.com/trends/explore#q=common%20lisp%2C%20clojure%2C%20emacs%20lisp&cmpt=q

17:29 technomancy: weird; google won't let you view that page without logging in

17:44 AWizzArd: technomancy: which? The trends?

17:44 I was not logged in and could see it

17:47 Frozenlock: That's weird... I added this to my project, but I still don't have the function `browser-repl` available when starting a repl. https://www.refheap.com/81140

17:52 AWizzArd: Frozenlock: do you want to have a brepl in the shell, or inside emacs?

17:52 Frozenlock: my repl is fired up inside emacs

17:52 `nrepl-jack-in'

17:53 AWizzArd: Can you build up a classic brepl in a shell?

17:53 I was stuck a few days ago and got strange error messages in the Firefox console. Forgot to do a “lein ring server” first.

17:55 Frozenlock: It somehow works. I get access to the `browser-repl' function.

18:03 Ah, I think I got it

18:03 coventry: How do I convert a javascript array to a clojurescript array?

18:04 AWizzArd: coventry: I think in CLJS they are the same.

18:04 Frozenlock: nrepl sends me to *user*, but lein repl sends me to *my-app.server* (probably because of the :main in the project)

18:04 coventry: js->clj ?

18:04 AWizzArd: Frozenlock: are there js arrays vs cljs arrays?

18:04 coventry: AWizzArd: Sorry clojurescript vector. Frozenlock: js->clj just returns the same object.

18:05 Frozenlock: AWizzArd: I don't know, I just assumed it was the case because of the question :p

18:05 AWizzArd: coventry: does (into [] the-array) work?

18:05 Bronsa: coventry: (vec the-array)

18:06 like in clojure

18:06 coventry: Oh, I was missing a level of reference. Thanks everyone.

18:07 AWizzArd: Bronsa: but it there also a way to do a conversion from JS objects to Clojure maps?

18:07 Bronsa: AWizzArd: no idea.

18:11 the-kenny: why no js->clj?

18:12 *not

18:12 AWizzArd: the-kenny: doesn’t work

18:12 it will still print something like #<Object blabla>

18:13 Frozenlock: (js->clj (clj->js {:a 1 :b ["hello" 1 2 3]})) works o_O

18:13 AWizzArd: Sometimes it works, yes.

18:14 Frozenlock: Well, what kind of object are you trying to convert? A dom element

18:14 ?

18:14 AWizzArd: I try doing it in a brepl running in a shell.

18:15 the-kenny: Well, you could use `js-keys' to get all keys and build a map from that

18:17 (let [x js/window.localStorage] (map (partial aget x) (js-keys x)))

18:18 (don't try this with plain 'js/window')

18:18 AeroNotix: has anyone done any work to get Clojure running on BEAM/

18:18 ?

18:21 AWizzArd: the-kenny: will try that

18:45 gfredericks: ucb: you ended up with one namespace for each type? I can't imagine that would be necessary

18:46 ucb: what was it that didn't work about the types/protocols/eval triad?

18:48 jwm: anyone good with subetha smtp?

18:49 I update my spool code using the repl and keep it running 24/7.. the functions I update repeat with old results still

18:49 is that because of the multithreading?

18:50 is there a way to trigger updates across all threads?

18:52 gfredericks: jwm: what does "keep it running 24/7" mean?

18:52 this is a question about code reloading?

18:52 jwm: just redefining function calls

18:52 and having them pick up across all threads

18:52 gfredericks: that definitely works across threads, the question is if those other threads are actually calling the functions

18:53 e.g., if a thread is just running in a loop/recur, that part won't get redefined

18:53 jwm: well it seems like some threads are calling old copies of the function

18:53 and some are calling the new... etc

18:53 like say if I println "hi" from my spool function but then change it to "hey"

18:53 I'll get like 10 "hi"s back and one hey

18:54 gfredericks: if the function is being used in a higher-order way, then it wouldn't see reloading

18:54 jwm: well the reloading works it just seems like other threads have cached it somehow

18:54 gfredericks: also the function is actually a method in defrecord/deftype

18:54 if*

18:55 jwm: I would think only one thread at a time would be taking an email though

18:56 gfredericks: I can't speculate any further without looking at actual code

18:57 jwm: yeah I know

18:57 its a weird issue

18:57 gfredericks: jwm: do you understand how vars work?

18:57 jwm: yes

18:57 llasram: gfredericks: Well, at least not unless you want your license revoked

18:57 jwm: my refs only get updated once

18:58 gfredericks: jwm: that's all that's going on with code reloading -- a var being redefined

18:58 amalloy: jwm: redefining a function only changes the var through which new calls dispatch; anyone with a reference to the old function will still get the old definition

18:58 jwm: its a function call that is happening from the old code and new code at the same time

18:58 yeah amalloy that is the problem

18:58 gfredericks: ,(defn add [a b] (+ a b))

18:58 clojurebot: #'sandbox/add

18:58 gfredericks: ,(def add-five (partial add 5))

18:58 clojurebot: #'sandbox/add-five

18:58 gfredericks: ,(add-five 10)

18:58 clojurebot: 15

18:58 jwm: but I am trying to figure out how to fix it without restarting the server code

18:58 gfredericks: ,(defn add [a b] (* a b))

18:58 clojurebot: #'sandbox/add

18:58 gfredericks: ,(add 5 10)

18:58 clojurebot: 50

18:59 gfredericks: ,(add-five 10)

18:59 clojurebot: 15

18:59 gfredericks: jwm: like you're looking for a one-time fix?

18:59 amalloy: jwm: your attempts to clarify don't actually touch on any points that are relevant. if you want more help, some actual specifics, preferably code, will help someone figure out what is going on

19:00 jwm: yeah so I dont have to restart the server

19:00 that is why I asked if anyone was familiar with subetha hehe

19:00 not much code is involved with it just a single class helper that calls my function with the message

19:01 gfredericks: in the future you can use vars as functions for a bit of extra indirection

19:01 but it's entirely possible that your one-time fix is not possible

19:02 does the jvm let you redefine methods yet?

19:02 somebody at work thought that was possible but I didn't think so

19:03 amalloy: gfredericks: probably via the debugger

19:05 jwm: hehe

19:05 its a funny glitch

19:07 Exception in thread \"pool-1-thread-107\" java.lang.IllegalStateException: Attempting to call unbound fn: #'bhn.core/spoolEmails\r\n\tat

19:07 so its the same thread

19:07 just repeating the calls itself 20 times in a row

19:07 weird!

19:08 I did .unbindRoot to the function it originally called and that worked

19:09 gfredericks: o_O

19:12 amalloy: i'm with you on this one, gfredericks. it's like he's asking for help on using a circular saw correctly, and then suddenly: "Oh! I stuck my arm in and now it works! Thanks guys."

19:12 gfredericks: lol

19:14 jwm: not nice :P

19:18 AWizzArd: amalloy ;-)

19:29 jwm: it seems like subetha really doesnt want you restarting the server.. it provides a stop method that doesn't reset this.started to false

19:29 and uses java's @GuardedBy("this")

19:48 looks like I'd have to restart the java ExecutorService to fully refresh the state :/

20:04 AWizzArd: the-kenny: indeed, js-keys works in my case, where js->clj is like calling identity. So, good tip, thanks.

20:06 the-kenny: You're welcome :) I actually never thought you can use it for a more general js-obj->map, I was just using it in a project to get a list of stored elements from the localStorage object

20:11 kelseygi: hey anyone know how to cancel a connection/thread in lighttable?

20:11 not stop eval

20:14 yedi: dat feeling when someone says they like the thing you made

20:25 scottj: kelseygi: there is #lighttable in case no one answers here

20:25 kelseygi: cool thank you scottj

20:29 gfredericks: $google CLJ-1410

20:29 lazybot: [HP Color LaserJet CM1415MFP Service Manual - Parts Now] http://www.partsnow.com/docs/service-manuals/hp-color-laserjet-cm1415mfp-service-manual.pdf

20:29 llasram: ha!

20:30 Maybe one of the bots should auto-link Clojure project JIRA tickets

20:30 gfredericks: now I know CLJ stands for Color LaserJet

20:40 amalloy: llasram: probably not. you know people will get into a discussion about a ticket, referring to it multiple times, and everyone will be justifiably enraged when the bot links to the same ticket 10 times

20:52 llasram: amalloy: Well, you can have a timeout before re-linking to the same ticket. That's how my team's IRC bot does it

20:52 But yeah -- probably not entirely appropriate for the breadth of this channel

20:57 Frozenlock: "To improve the look of your canvas on retina displays, declare the width and height of your canvas element as double how you want it to appear. Then style your canvas with CSS to include the original dimensions." ugh

20:58 * arrdem facepalms

21:01 gfredericks: doing an alter-var-root on an nrepl middleware requires a (fn [middleware] (fn [handler] (fn [msg] ...)))

21:02 makes me think of haskell whenever I do that

21:18 amalloy: gfredericks: (alter-var-root some-handler (constantly (constantly (constantly "not done yet")))

21:18 )

21:18 ez

21:21 gfredericks: haha

21:21 ,(def cubestantly (comp constantly constantly constantly))

21:21 clojurebot: #'sandbox/cubestantly

21:26 gfredericks: here's a weird one

21:26 run code with (println "OUT")

21:26 works fine

21:26 run code with (println "OUT" (class msg))

21:26 stack overflow

21:27 llasram: gfredericks: Maybe right at the cusp of honestly running too deep a stack?

21:27 gfredericks: oh nevermind I get stack overflow regardless

21:27 but yeah that unlikely possibility occurred to me

21:31 amalloy: llasram, gfredericks: there's no difference in the amount of stack used by those two things

21:31 since (class msg) returns before println is called, and surely uses fewer stack frames than println does

21:32 i guess println could require some more stack frames to decide how to print a class

21:33 gfredericks: println uses varargs and recur with 2 args

21:33 but a straighter impl with 1 arg

21:34 patrickod: is there a way when using korma to have relationship aliases ?

21:34 gfredericks: so...that could make a difference too

21:34 patrickod: i.e. the entity is user but the foreign key would be recipient_user for instance

21:35 gfredericks: this is still weird though, because I don't get the stack overflow if I don't print

21:35 amalloy: gfredericks: msg could be something self-referential

21:36 try setting *print-level* and *print-depth*, and using prn instead of println

21:36 gfredericks: amalloy: but even printing (class msg)

21:36 amalloy: no wait

21:36 even ignoring msg

21:36 (println "foo") overflows

21:36 (spit "foo" "bar") does not

21:37 amalloy: gfredericks: maybe you've ruined println itself in some interesting way

21:37 or *out*

21:37 gfredericks: well I did define a println in another namespace

21:37 but that *shouldn't* matter

21:37 at this point in the code

21:37 oh also prn overflows too

21:37 so that impossible explanation is not it

21:38 *out* is an interesting question

21:38 this is happening in nrepl middleware

21:38 time to try (.println System/out)

21:38 that one is okay

21:39 oh yes that makes sense actually

21:39 because now that I think harder about it this code is sometimes run from within nrepl's evaluation context

21:39 (not all the time, but sometimes)

21:39 which of course has its own *out*

21:40 which happens to call my code again :)

21:41 * gfredericks high fives amalloy while jumping in the air and spinning τ radians

21:43 amalloy: dynamic variables: global mutation that tries to make you forget about it

21:44 gfredericks: hey now it's still at least thread-local sort of

21:45 I used set! the other day for something that wasn't a compiler flag

21:47 AWizzArd: core.async: (put! c obj) vs. (go (>! c obj))

21:47 Are those basically the same? Or do they do something very different under the hood?

21:47 dnolen_: so did cider stuff showing REPL results in the minibuffer?

21:48 gfredericks: dnolen_: stuff?

21:49 if stop, then I have not noticed that (0.5.0)

21:49 oh wait repl results...

21:49 dnolen_: s/stuff/stop

21:49 gfredericks: you mean when I enter something in the repl buffer?

21:49 I would expect to see the result in the repl buffer, never the minibuffer...

21:50 I get the minibuffer when I C-x C-e in a non-repl clojure buffer

22:01 tomjack: what is the explanation of the final result in this c.c.l.nominal example? https://www.refheap.com/c42c4908a92c13d8f8ec5bfbd

22:02 I expected (), am I confused?

22:04 d'oh

22:05 I'm just an idiot

22:05 :)

22:05 (nom/hash a (nom/fresh ..)) is always true, I guess

22:06 I wanted a tie there

22:13 gfredericks: agent error handling has a doc gotcha

22:13 if you set the agent's :error-handler to (fn [e] ...)

22:13 errors will be silently dropped

22:14 due to an arity exception; but nothing directly in the agent docstring indicates this

22:14 the docstring _does_ tell you to see the docstring on set-error-handler! for details

22:14 and it does have the key detail

22:15 and you do have to be a bit sloppy to assume a particular arg signature without reading one anywhere

22:15 but that's a tricksy one to debug

22:17 ToxicFrog: Is there any way, in clojure/java regexes, to include a reference to another regex? Other than deffing that as a string, concatenating all the strings and then compiling them at runtime?

22:23 amalloy: ToxicFrog: no. regular expressions are the sworn enemy of composition

22:24 ToxicFrog: amalloy: blargh

22:24 amalloy: in fairness, if you have regular expressions so large you think your app will be more maintainable if you split them up, you're probably using them wrong anyway

22:25 ToxicFrog: I'm using them to slice MUD output.

22:25 I am fairly confident that this is the least bad approach.

22:25 xeqi: but my email regex is sooo long

22:25 amalloy: ToxicFrog: should be pretty simple to use a real parser

22:26 ToxicFrog: But it gets tiresome writing [\w'-]*[\w-] all the time instead of \{name} or whatever.

22:27 The thought of trying to derive an actual grammar for human-readable MUD output does not appeal, I have to say.

22:27 amalloy: ToxicFrog: parser combinators, man

22:27 ToxicFrog: That said, if you have a parser lib you want to recommend...

22:28 (oh yeah, and a parser for RFC1459 on the other side)

22:28 amalloy: (def action (cat name verb name))

22:28 or whatever. using fnparse, or instaparse. instaparse is really easy to use

22:29 at its least ambitious, you can use it to concat regular expressions

22:31 ToxicFrog: So what this is actually doing is using regex matching to filter the MUD traffic for certain patterns and emit IRC messages in response; everything else it basically dumps. On the other end, it listens for certain IRC messages and emits MUD messages in response.

22:37 Huh. I think instaparse is the first parsing library I've seen that pushes using the string representation over the combinators.

22:40 amalloy: well. antlr, yacc, and so on

22:40 ToxicFrog: instaparse's combinator support is actually pretty half-hearted

22:44 ToxicFrog: amalloy: none of those have combinators at all - I mean, of libraries that have both options

22:44 Usually it's hey check out all these awesome combinators we have, p.s. I guess you can use the string representation if you're a loser

22:44 amalloy: heh, sounds about right

23:31 kenrestivo: string representation sure is nice if someone has already published an ABNF for something (assuiming it's correct)

Logging service provided by n01se.net