#clojure logs

2014-04-26

00:14samg_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.
00:17ivansamg_: are you worried about the map getting mutated or suboptimal performance?
00:17samg_I'm worried about performance. I want to make sure I use the collections in the right way.
00:18dbaschsamg_: the right way is to not worry about it until you need to optimize
00:19samg_I agree with that. "Worry" is the wrong word. I want to learn about the performance characteristics of the collections library.
00:19dbaschsamg_: all the collections are immutable by default, unless you make them transients
00:21dbaschsamg_: it’s usually pretty straightforward to change your code to use transients if you really need to
00:22dbaschif that’s not enough, you may need to rethink your structures / algorithms
00:23dbaschmost of the time the collections won’t be your performance bottleneck
00:24samg_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.
00:24dbaschit would be easier with a concrete example
00:25samg_That's why I am interested to know which operations are persistent, and which aren't.
00:27dbaschsamg_: 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
00:28dbaschsamg_: in reality a and b may share most of their structure in memory
00:28dbaschsamg_: but that of course depends on the modification
00:29samg_I have to assume that conj copies the entire collection?
00:29dbaschsamg_: in theory yes, in practice no
00:29samg_I think I can assume that conj is a persistent modification.
00:29samg_If I can't, then why would I use persistent collections?
00:30dbaschsamg_: explain what you mean by persistent
00:30samg_I mean http://en.wikipedia.org/wiki/Persistent_data_structure
00:31samg_The same language is used in the docs: http://clojure.org/data_structures
00:31dbaschyes, all clojure collections are persistent
00:32dbaschsamg_: see the part about collections http://clojure.org/data_structures
00:32samg_I read this page. I am looking for more specific information.
00:32dbaschsamg_: you can look at the source
00:32samg_I will do that. Thanks.
02:10l1xwhat is the best way to pretty print a hashmap to a file?
02:18Frozenlo`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)})))
02:18l1xFrozenlo`: thanks
02:19TerranceWarriordo you people use emacs or vim?
02:20Frozenlo`TerranceWarrior: I 'think' there's a majority of Emacs users.
02:21TerranceWarriorFrozenlo`: ok, just seeing what is in vogue.
02:22TerranceWarriorare there any stable opengl project using clojure
02:22TerranceWarrior?
03:56raj__quit
04:35gkoanyone using cider? does it hang a lot?
04:39bob2works well for me
04:47derek_ccan core.match have a guard on all patterns together, rather than separately?
04:48derek_clike, when you do: (match [1 2]
04:48derek_cyou can have a pattern guard like [(_ :guard #(odd? %)) (_ :guard odd?)]
04:48derek_cbut can you have a guard that works on both 1 and 2 together?
04:48derek_clike a function that takes these two as parameters?
05:05tickingdoes 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.
06:42luxbockwhat interfaces does my custom type have to implement so that I can access its fields using keywords instead of regular field access?
06:50pyrtsaluxbock: I believe clojure.lang.ILookup is enough.
06:51pyrtsa,(:a (reify clojure.lang.ILookup (valAt [_ _] 1) (valAt [_ _ _] 2)))
06:51clojurebot1
06:51pyrtsa,(:a (reify clojure.lang.ILookup (valAt [_ _] 1) (valAt [_ _ _] 2)) nil)
06:51clojurebot2
06:51luxbockthanks
07:06clgvluxbock: you want keyword lookup but no real map impl behind that?
07:07luxbockwell I kind of changed my mind already, realizing it's probably a bad idea
07:09luxbockI 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
07:10luxbockbut I think s/:value/.value is more appropriate solution for my use case
07:47luxbockhmm, why does one have to use underscores when importing namespaces, but dashes when requiring them?
07:48clgvluxbock: java namespace must not include dashes that's why
07:48luxbockalright, this was puzzling me for a while
07:49clgvluxbock: though for import there should be an automatic conversion in the compiler since that can also cause problems
07:56penthiefI've lost eldoc in cider-mode and cannot work out how to get it back, any ideas?
07:57penthiefOh nvm, it came back (?)
08:15clgvnondeterministic tooling :D
09:35ucbcan I dispatch a multimethod on a record I defined on a different namespace by any chance?
09:35ucbe.g. (defmethod foo other.namespace.Record [...] ...)
09:39ucbhrm, maybe this is failing because cyclic dependency :/
09:43gfredericksucb: yes you should definitely be able to do that
09:43gfredericks,(ns user5)
09:43clojurebotnil
09:43gfredericks,*ns*
09:43clojurebot#<Namespace sandbox>
09:43gfredericks,(do (ns user5) (defrecord Tom []))
09:43clojurebotuser5.Tom
09:43gfredericks,Tom
09:43clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: Tom in this context, compiling:(NO_SOURCE_PATH:0:0)>
09:43gfredericks,user5.Tom
09:43clojurebotuser5.Tom
09:43ucbgfredericks: I think it's because I have a cyclical dep :(
09:44gfredericks,(defmulti my-multi type)
09:44clojurebot#'sandbox/my-multi
09:44gfredericks,(defmethod my-multi user5.Tom [x] "that is a Tom")
09:44clojurebot#<MultiFn clojure.lang.MultiFn@1002c19>
09:44gfredericks,(defmethod my-multi :default [x] "that is NOT a Tom")
09:44clojurebot#<MultiFn clojure.lang.MultiFn@1002c19>
09:44gfredericks,(my-multi 20)
09:44clojurebot"that is NOT a Tom"
09:44ucbgfredericks: mind if I show you some code? Maybe you can help me untangle it.
09:44gfredericks,(my-multi (user5/->Tom))
09:44clojurebot"that is a Tom"
09:44gfredericksucb: sure
09:45ucbgfredericks: https://gist.github.com/ulises/11320338
09:46ucbthe offending code is commented out
09:46ucbthe issue is with Atom, not with List
09:46gfredericksucb: you could move the "defmethod apply faust.types.Atom" part into the .types namespace
09:46ucbincidentally, if I get a repl, compile types, then uncomment apply, it compiles fine
09:46gfredericksif that seems reasonable
09:47gfredericksyeah doing things in the repl can mask cyclic problems sometimes
09:47ucbI suppose I could; I was hoping I could keep types and logic separate
09:47gfredericksweelllll
09:47gfredericksI think the only way to accomplish that is to put the protocol into a .protocols namespace
09:48gfredericksso .types doesn't have to depend on .eval
09:48gfredericksthat kind of structure probably accomplishes the separation you want better anyhow
09:48whilohi
09:48gfrederickswhilo: hello
09:48ucbgfredericks: will give it a go. Thanks.
09:48whilowhat is the status of gpl in clojure code?
09:49whiloin wikipedia epl and gpl are described incompatible
09:49gfredericks~gpl
09:49clojurebotIt's greek to me.
09:49gfredericksucb: I kind of like the idea of a separate namespace for protocols, schemas, etc
09:49gfredericksin general I mean
09:50ucbso you'd move ... LispVal to protocols, and keep apply in eval?
09:50gfredericksright
09:50whiloi 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
09:50gfredericksucb: or you could put the defmulti in .protocols but keep the defmethod in .eval
09:50gfredericksa defmulti is kind of like a protocol anyhow
09:50ucbsure
09:51gfredericksI'm trying to think of a more general namespace name than .protocols
09:51gfredericks.abstractions :)
09:51ucbI also pondered whether I should make eval part of the protocol anyway
09:51gfredericksyou mean apply?
09:51ucbyes, apply, sorry
09:55ucbgrumble.
09:56gfredericks,my-method
09:56clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: my-method in this context, compiling:(NO_SOURCE_PATH:0:0)>
09:57gfredericks,my-multi
09:57clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: my-multi in this context, compiling:(NO_SOURCE_PATH:0:0)>
09:57gfredericks,(defmethod print-method ::foo [x pw] (print-method ["This is a foo" (str x)] pw))
09:57clojurebot#<MultiFn clojure.lang.MultiFn@18be695>
09:58gfredericks,(vary-meta {:a 42} assoc :type ::foo)
09:58clojurebot#<StackOverflowError java.lang.StackOverflowError>
10:00gfredericks,(str (vary-meta {:a 42} assoc :type ::foo))
10:00clojurebot#<StackOverflowError java.lang.StackOverflowError>
10:00gfredericks,(.toString (vary-meta {:a 42} assoc :type ::foo))
10:00clojurebot#<StackOverflowError java.lang.StackOverflowError>
10:01gfrederickshuh. .toString calls print-method. whaddayouknow.
10:01Bronsagfredericks: that works fine in my repl
10:01gfrederickswaat-
10:01gfredericksBronsa: you did the defmethod above?
10:02Bronsaoh
10:02Bronsaduh.
10:02gfredericksphew
10:03gfredericks,(defmethod print-method ::foo [x pw] (print-method ["This is a foo" (vary-meta x dissoc :type)] pw))
10:03clojurebot#<MultiFn clojure.lang.MultiFn@18be695>
10:03gfredericks,(vary-meta {:a 42} assoc :type ::foo)
10:03clojurebot["This is a foo" {:a 42}]
10:03Bronsagfredericks: oh well str on hash maps defers to RT.printString
10:03gfredericksyep
10:04Bronsawhich calls print which calls pr-on which calls print-method so there you have it
10:08Anderkentman, deleting data is scary
10:26gfredericksAnderkent: now you have me imagining some formal system for gradual deletion
10:26pandeiroi 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:26gfrederickspandeiro: print doesn't auto flush
10:26gfrederickspandeiro: just call (flush) before you finish
10:27pandeirogfredericks: ah, that's what (flush) is about
10:27gfredericksprintln does auto-flush though
10:27pandeirogfredericks: ah, ok
10:27pandeiro,(doc println)
10:27clojurebot"([& more]); Same as print followed by (newline)"
10:27Anderkentgfredericks: does println always autoflush?
10:28gfredericksI think so but I can't remember why
10:28gfredericks,(doc *out*)
10:28clojurebot"; A java.io.Writer object representing standard output for print operations. Defaults to System/out, wrapped in an OutputStreamWriter"
10:28Anderkentah
10:28Anderkent,(doc *flush-on-newline*)
10:28clojurebot"; When set to true, output will be flushed whenever a newline is printed. Defaults to true."
10:28gfredericks,*flush-on-newline*
10:28clojurebottrue
10:28gfrederickswell there you go
10:29gfredericksthere's always something in clojure.core that you don't know about
10:33pandeiroanother serialization question, what would be the equivalent to pr-str for writing to an outputstreamwriter instead of producing a string?
10:36gfrederickspandeiro: pr
10:36gfrederickswrapped with a binding for *out*
10:37gfredericks(binding [*out* my-output-stream-writer] (pr x))
10:37pandeirogfredericks: cool, let me try that, thanks
10:43pandeirogfredericks: 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:44gfrederickspandeiro: what's this for?
10:45pandeirotrying to get 1TB of mp3 metadata into a form i can play with
10:45pandeirothe processing of the tags is taking >10 minutes on my machine
10:46gfredericksso you have a lazy seq and you want to print each thing to an output stream?
10:46gfredericksdoseq would be good for that
10:47pandeirogfredericks: yeah no actually i want the whole sequence serializable as edn or json
10:47gfredericksbut pr might be lazy-friendly too
10:47pandeiroi just tested pr
10:47pandeiroit works, but appends a nil to the end
10:47gfrederickswaat?
10:47gfredericksmaybe that's your repl?
10:47gfredericksgiving you the return value?
10:47pandeiroyeah, hmm, ok
10:58gfrederickspandeiro: for a very large lazy seq you have to of course be careful not to hold on to the head
11:00jkj"Where's Your Head At" by basement jaxx
11:00jkjsong relates
11:00jkjhave to give trapperkeeper a try btw.
11:01jkjpuppetlabs has good things going on
11:04ucbgfredericks: unfortunately that splitting into types, protocols, and eval namespaces didn't quite work
11:04ucbgfredericks: perhaps I'm just being a numpty :)
11:13gkoIf I have a map like: {:a 1}, is there a better way to destructuring it than (let [[c v] (seq (first {:a 1})) ...) ???
11:13lazybotgko: Oh, absolutely.
11:19ucbgko: try (let [{:keys [a]} {:a 1}] a)
11:19ucb,(let [{:keys [a]} {:a 1}] a)
11:19clojurebot1
11:20ucbgfredericks: sadness. The only way I've found to make it compile is to have the defmethod in the types ns
11:24ucbgfredericks: 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:27codestormhi. On OS X, where do people typcaily install clojure?
11:28oskarthcodestorm: If you have java and leiningen, Clojure will install itself in a project that requires it
12:06crispinhello! Im having problems calling java interop on a method on a public interface
12:06crispinI import the interface
12:06crispinbut then cant access the interface methods
12:07crispineg. how to call this: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/Graphics.html#getWidth()
12:08crispin(:import (com.badlogicgames.gdx Graphics)) imports it
12:08crispinin my ns
12:09crispin(.getWidth Graphics) => java.lang.IllegalArgumentException: No matching field found: getWidth for class java.lang.Class
12:09crispinGraphics seems to be a class. How do I get the Graphics interface?
12:13crispin(Graphics/getWidth) => java.lang.NoSuchFieldException: getWidth
12:21tastymango /part #clojure
12:27TravisDbye bye!
13:24f0086If I use ,clojure.java.io/resource in a repl, it returned nil
13:27gkoucb Problem is, the key can vary... I guess it
13:28gkoucb it's a bad idea to use {:a 1 :b 2} instead of [{:code :a :value 1} {:code :b :value 2}]...
14:29TravisDwoah, so many name changes
14:30arrdemiwilcox seems to be derping around today...
14:30iwilcoxSorry for the noise.
14:30TravisDlol, no problem. My fault for leaving it in my chat log
14:30TravisDwhat are you up to, though?
14:30iwilcoxWasn't doing it for fun but in hindsight should have parted ~16 channels, changed, rejoined.
14:31amalloycrispin: 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:31iwilcoxTravisD: 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:32TravisDiwilcox: Cool. 10w is a strange amount of time
14:34iwilcoxTravisD: 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:40instilledhey! 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:42llasram,(let [a [1 2 3], b [4 5 6]] (mapv + a b))
15:42clojurebot[5 7 9]
15:42instilledcheers!
15:43instilledthought there was an easy way!
15:46seangroveSuch a bummer, if browsers reported screen vieport size in http request headers, could pull off some cool tricks
15:47seangroveI 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:00technomancyseangrove: put it in the accept header?
16:02seangrovetechnomancy: Can't do that on the initial js load though
16:05r00kAnyone 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:06r00kRight 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:08technomancyr00k: you can't use environment variables?
16:11r00ktechnomancy: That would work well when on heroku, but wouldn't that be a pain locally, needing to always have that env var set?
16:12technomancyusually with config you have default values
16:12technomancyeither through environ or just a simple clojure.core/or
16:12r00kGotcha. That makes sense. Thanks!
16:14technomancysure
16:59Frozenlocklein clean doesn't clean my cljx output-dir. Is there a config to do that?
17:01AWizzArdhttp://www.google.com/trends/explore#q=common%20lisp%2C%20clojure&amp;cmpt=q
17:01FrozenlockSad for common lisp
17:01Frozenlockhttps://www.google.com/trends/explore#q=common%20lisp%2C%20clojure%2C%20emacs&amp;cmpt=q
17:02AWizzArdI started CL in 2003 and did it professionally for some years. Still nice, but I prefer Clojure (clearly).
17:02AWizzArdhttp://www.google.com/trends/explore#q=common%20lisp%2C%20clojure%2C%20emacs%20lisp&amp;cmpt=q
17:29technomancyweird; google won't let you view that page without logging in
17:44AWizzArdtechnomancy: which? The trends?
17:44AWizzArdI was not logged in and could see it
17:47FrozenlockThat'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:52AWizzArdFrozenlock: do you want to have a brepl in the shell, or inside emacs?
17:52Frozenlockmy repl is fired up inside emacs
17:52Frozenlock`nrepl-jack-in'
17:53AWizzArdCan you build up a classic brepl in a shell?
17:53AWizzArdI was stuck a few days ago and got strange error messages in the Firefox console. Forgot to do a “lein ring server” first.
17:55FrozenlockIt somehow works. I get access to the `browser-repl' function.
18:03FrozenlockAh, I think I got it
18:03coventryHow do I convert a javascript array to a clojurescript array?
18:04AWizzArdcoventry: I think in CLJS they are the same.
18:04Frozenlocknrepl sends me to *user*, but lein repl sends me to *my-app.server* (probably because of the :main in the project)
18:04Frozenlockcoventry: js->clj ?
18:04AWizzArdFrozenlock: are there js arrays vs cljs arrays?
18:04coventryAWizzArd: Sorry clojurescript vector. Frozenlock: js->clj just returns the same object.
18:05FrozenlockAWizzArd: I don't know, I just assumed it was the case because of the question :p
18:05AWizzArdcoventry: does (into [] the-array) work?
18:05Bronsacoventry: (vec the-array)
18:06Bronsalike in clojure
18:06coventryOh, I was missing a level of reference. Thanks everyone.
18:07AWizzArdBronsa: but it there also a way to do a conversion from JS objects to Clojure maps?
18:07BronsaAWizzArd: no idea.
18:11the-kennywhy no js->clj?
18:12the-kenny*not
18:12AWizzArdthe-kenny: doesn’t work
18:12AWizzArdit will still print something like #<Object blabla>
18:13Frozenlock(js->clj (clj->js {:a 1 :b ["hello" 1 2 3]})) works o_O
18:13AWizzArdSometimes it works, yes.
18:14FrozenlockWell, what kind of object are you trying to convert? A dom element
18:14Frozenlock?
18:14AWizzArdI try doing it in a brepl running in a shell.
18:15the-kennyWell, you could use `js-keys' to get all keys and build a map from that
18:17the-kenny(let [x js/window.localStorage] (map (partial aget x) (js-keys x)))
18:18the-kenny(don't try this with plain 'js/window')
18:18AeroNotixhas anyone done any work to get Clojure running on BEAM/
18:18AeroNotix?
18:21AWizzArdthe-kenny: will try that
18:45gfredericksucb: you ended up with one namespace for each type? I can't imagine that would be necessary
18:46gfredericksucb: what was it that didn't work about the types/protocols/eval triad?
18:48jwmanyone good with subetha smtp?
18:49jwmI update my spool code using the repl and keep it running 24/7.. the functions I update repeat with old results still
18:49jwmis that because of the multithreading?
18:50jwmis there a way to trigger updates across all threads?
18:52gfredericksjwm: what does "keep it running 24/7" mean?
18:52gfredericksthis is a question about code reloading?
18:52jwmjust redefining function calls
18:52jwmand having them pick up across all threads
18:52gfredericksthat definitely works across threads, the question is if those other threads are actually calling the functions
18:53gfrederickse.g., if a thread is just running in a loop/recur, that part won't get redefined
18:53jwmwell it seems like some threads are calling old copies of the function
18:53jwmand some are calling the new... etc
18:53jwmlike say if I println "hi" from my spool function but then change it to "hey"
18:53jwmI'll get like 10 "hi"s back and one hey
18:54gfredericksif the function is being used in a higher-order way, then it wouldn't see reloading
18:54jwmwell the reloading works it just seems like other threads have cached it somehow
18:54gfredericksalso the function is actually a method in defrecord/deftype
18:54gfredericksif*
18:55jwmI would think only one thread at a time would be taking an email though
18:56gfredericksI can't speculate any further without looking at actual code
18:57jwmyeah I know
18:57jwmits a weird issue
18:57gfredericksjwm: do you understand how vars work?
18:57jwmyes
18:57llasramgfredericks: Well, at least not unless you want your license revoked
18:57jwmmy refs only get updated once
18:58gfredericksjwm: that's all that's going on with code reloading -- a var being redefined
18:58amalloyjwm: 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:58jwmits a function call that is happening from the old code and new code at the same time
18:58jwmyeah amalloy that is the problem
18:58gfredericks,(defn add [a b] (+ a b))
18:58clojurebot#'sandbox/add
18:58gfredericks,(def add-five (partial add 5))
18:58clojurebot#'sandbox/add-five
18:58gfredericks,(add-five 10)
18:58clojurebot15
18:58jwmbut I am trying to figure out how to fix it without restarting the server code
18:58gfredericks,(defn add [a b] (* a b))
18:58clojurebot#'sandbox/add
18:58gfredericks,(add 5 10)
18:58clojurebot50
18:59gfredericks,(add-five 10)
18:59clojurebot15
18:59gfredericksjwm: like you're looking for a one-time fix?
18:59amalloyjwm: 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:00jwmyeah so I dont have to restart the server
19:00jwmthat is why I asked if anyone was familiar with subetha hehe
19:00jwmnot much code is involved with it just a single class helper that calls my function with the message
19:01gfredericksin the future you can use vars as functions for a bit of extra indirection
19:01gfredericksbut it's entirely possible that your one-time fix is not possible
19:02gfredericksdoes the jvm let you redefine methods yet?
19:02gfrederickssomebody at work thought that was possible but I didn't think so
19:03amalloygfredericks: probably via the debugger
19:05jwmhehe
19:05jwmits a funny glitch
19:07jwmException in thread \"pool-1-thread-107\" java.lang.IllegalStateException: Attempting to call unbound fn: #'bhn.core/spoolEmails\r\n\tat
19:07jwmso its the same thread
19:07jwmjust repeating the calls itself 20 times in a row
19:07jwmweird!
19:08jwmI did .unbindRoot to the function it originally called and that worked
19:09gfrederickso_O
19:12amalloyi'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:12gfrederickslol
19:14jwmnot nice :P
19:18AWizzArdamalloy ;-)
19:29jwmit seems like subetha really doesnt want you restarting the server.. it provides a stop method that doesn't reset this.started to false
19:29jwmand uses java's @GuardedBy("this")
19:48jwmlooks like I'd have to restart the java ExecutorService to fully refresh the state :/
20:04AWizzArdthe-kenny: indeed, js-keys works in my case, where js->clj is like calling identity. So, good tip, thanks.
20:06the-kennyYou'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:11kelseygihey anyone know how to cancel a connection/thread in lighttable?
20:11kelseyginot stop eval
20:14yedidat feeling when someone says they like the thing you made
20:25scottjkelseygi: there is #lighttable in case no one answers here
20:25kelseygicool thank you scottj
20:29gfredericks$google CLJ-1410
20:29lazybot[HP Color LaserJet CM1415MFP Service Manual - Parts Now] http://www.partsnow.com/docs/service-manuals/hp-color-laserjet-cm1415mfp-service-manual.pdf
20:29llasramha!
20:30llasramMaybe one of the bots should auto-link Clojure project JIRA tickets
20:30gfredericksnow I know CLJ stands for Color LaserJet
20:40amalloyllasram: 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:52llasramamalloy: Well, you can have a timeout before re-linking to the same ticket. That's how my team's IRC bot does it
20:52llasramBut yeah -- probably not entirely appropriate for the breadth of this channel
20:57Frozenlock"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
21:01gfredericksdoing an alter-var-root on an nrepl middleware requires a (fn [middleware] (fn [handler] (fn [msg] ...)))
21:02gfredericksmakes me think of haskell whenever I do that
21:18amalloygfredericks: (alter-var-root some-handler (constantly (constantly (constantly "not done yet")))
21:18amalloy)
21:18amalloyez
21:21gfrederickshaha
21:21gfredericks,(def cubestantly (comp constantly constantly constantly))
21:21clojurebot#'sandbox/cubestantly
21:26gfrederickshere's a weird one
21:26gfredericksrun code with (println "OUT")
21:26gfredericksworks fine
21:26gfredericksrun code with (println "OUT" (class msg))
21:26gfredericksstack overflow
21:27llasramgfredericks: Maybe right at the cusp of honestly running too deep a stack?
21:27gfredericksoh nevermind I get stack overflow regardless
21:27gfredericksbut yeah that unlikely possibility occurred to me
21:31amalloyllasram, gfredericks: there's no difference in the amount of stack used by those two things
21:31amalloysince (class msg) returns before println is called, and surely uses fewer stack frames than println does
21:32amalloyi guess println could require some more stack frames to decide how to print a class
21:33gfredericksprintln uses varargs and recur with 2 args
21:33gfredericksbut a straighter impl with 1 arg
21:34patrickodis there a way when using korma to have relationship aliases ?
21:34gfredericksso...that could make a difference too
21:34patrickodi.e. the entity is user but the foreign key would be recipient_user for instance
21:35gfredericksthis is still weird though, because I don't get the stack overflow if I don't print
21:35amalloygfredericks: msg could be something self-referential
21:36amalloytry setting *print-level* and *print-depth*, and using prn instead of println
21:36gfredericksamalloy: but even printing (class msg)
21:36gfredericksamalloy: no wait
21:36gfrederickseven ignoring msg
21:36gfredericks(println "foo") overflows
21:36gfredericks(spit "foo" "bar") does not
21:37amalloygfredericks: maybe you've ruined println itself in some interesting way
21:37amalloyor *out*
21:37gfrederickswell I did define a println in another namespace
21:37gfredericksbut that *shouldn't* matter
21:37gfredericksat this point in the code
21:37gfredericksoh also prn overflows too
21:37gfredericksso that impossible explanation is not it
21:38gfredericks*out* is an interesting question
21:38gfredericksthis is happening in nrepl middleware
21:38gfrederickstime to try (.println System/out)
21:38gfredericksthat one is okay
21:39gfredericksoh yes that makes sense actually
21:39gfredericksbecause now that I think harder about it this code is sometimes run from within nrepl's evaluation context
21:39gfredericks(not all the time, but sometimes)
21:39gfrederickswhich of course has its own *out*
21:40gfrederickswhich happens to call my code again :)
21:43amalloydynamic variables: global mutation that tries to make you forget about it
21:44gfrederickshey now it's still at least thread-local sort of
21:45gfredericksI used set! the other day for something that wasn't a compiler flag
21:47AWizzArdcore.async: (put! c obj) vs. (go (>! c obj))
21:47AWizzArdAre those basically the same? Or do they do something very different under the hood?
21:47dnolen_so did cider stuff showing REPL results in the minibuffer?
21:48gfredericksdnolen_: stuff?
21:49gfredericksif stop, then I have not noticed that (0.5.0)
21:49gfredericksoh wait repl results...
21:49dnolen_s/stuff/stop
21:49gfredericksyou mean when I enter something in the repl buffer?
21:49gfredericksI would expect to see the result in the repl buffer, never the minibuffer...
21:50gfredericksI get the minibuffer when I C-x C-e in a non-repl clojure buffer
22:01tomjackwhat is the explanation of the final result in this c.c.l.nominal example? https://www.refheap.com/c42c4908a92c13d8f8ec5bfbd
22:02tomjackI expected (), am I confused?
22:04tomjackd'oh
22:05tomjackI'm just an idiot
22:05tomjack:)
22:05tomjack(nom/hash a (nom/fresh ..)) is always true, I guess
22:06tomjackI wanted a tie there
22:13gfredericksagent error handling has a doc gotcha
22:13gfredericksif you set the agent's :error-handler to (fn [e] ...)
22:13gfrederickserrors will be silently dropped
22:14gfredericksdue to an arity exception; but nothing directly in the agent docstring indicates this
22:14gfredericksthe docstring _does_ tell you to see the docstring on set-error-handler! for details
22:14gfredericksand it does have the key detail
22:15gfredericksand you do have to be a bit sloppy to assume a particular arg signature without reading one anywhere
22:15gfredericksbut that's a tricksy one to debug
22:17ToxicFrogIs 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:23amalloyToxicFrog: no. regular expressions are the sworn enemy of composition
22:24ToxicFrogamalloy: blargh
22:24amalloyin 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:25ToxicFrogI'm using them to slice MUD output.
22:25ToxicFrogI am fairly confident that this is the least bad approach.
22:25xeqibut my email regex is sooo long
22:25amalloyToxicFrog: should be pretty simple to use a real parser
22:26ToxicFrogBut it gets tiresome writing [\w'-]*[\w-] all the time instead of \{name} or whatever.
22:27ToxicFrogThe thought of trying to derive an actual grammar for human-readable MUD output does not appeal, I have to say.
22:27amalloyToxicFrog: parser combinators, man
22:27ToxicFrogThat said, if you have a parser lib you want to recommend...
22:28ToxicFrog(oh yeah, and a parser for RFC1459 on the other side)
22:28amalloy(def action (cat name verb name))
22:28amalloyor whatever. using fnparse, or instaparse. instaparse is really easy to use
22:29amalloyat its least ambitious, you can use it to concat regular expressions
22:31ToxicFrogSo 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:37ToxicFrogHuh. I think instaparse is the first parsing library I've seen that pushes using the string representation over the combinators.
22:40amalloywell. antlr, yacc, and so on
22:40amalloyToxicFrog: instaparse's combinator support is actually pretty half-hearted
22:44ToxicFrogamalloy: none of those have combinators at all - I mean, of libraries that have both options
22:44ToxicFrogUsually 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:44amalloyheh, sounds about right
23:31kenrestivostring representation sure is nice if someone has already published an ABNF for something (assuiming it's correct)