#clojure logs

2015-05-13

00:49hiredmanhuh, clojure 1.7 breaks my favorite trick for clojure scripting
00:49puredangerwhich is?
00:50hiredmanhttps://gist.github.com/hiredman/05befd5b39eef89b86ca#file-bench-clj-L3-L20
00:50hiredmanI'll have to fiddle with it, I am sure there is something that'll work just as well
00:52puredangerwhat's broken?
00:54hiredmannot that script, but another I have locally throws an exception with 1.7 there, not with 1.6
00:55puredangerthe classloader name lookup stuff now routes more universally through the DCL if it exists
00:55hiredmanhttps://gist.githubusercontent.com/anonymous/08f83e037ffe5ff506f6/raw/d3f7a300e593ceedde4463f4174aea62fb6b751b/gistfile1.txt
00:55hiredmanhuh
00:56puredangerhttp://dev.clojure.org/jira/browse/CLJ-979
00:56hiredmanmaybe I should update the pomegranate uberjar I use
00:57puredangerwhich version of 1.7 are you using? there was a regression like this in the first version
00:58puredangerhttp://dev.clojure.org/jira/browse/CLJ-1663 in particulra
00:58hiredmanlemme check the HEAD of master
00:58puredangerthat was fixed in alpha6
00:59hiredmanI dunno, I just have the script using whatever jar is in the target/ of my local clojure checkout
01:00puredangersounds solid :)
01:00puredangerjava -cp thatclojure.jar clojure.main -e "*clojure-version*" would tell you I think
01:00hiredmanthis is real бизнес critical stuff
01:00hiredmandeleting old dumps of clojurebot's database
03:37mnngfltg2Question about cider: suppose I have (+ 4 5) in my buffer and the cursor on the closing parenthesis. If I hit ^C^E in cider, I get 5.
03:37mnngfltg2That seems surprising to me. If I'm in lisp-interaction-mode (elisp), the same thing gives me 9.
04:08xinaumnngfltg2: you need to place the cursor behind the parenthesis
04:09xinaucause it evaluets the last expression before the cursor
04:09xinauwich would be 5
04:56vagrant-i can read a file line by line using doseq, but how do i read only the first 5 lines?
04:56hyPiRionvagrant-: loop and recur, for example
04:59hellofunki'm trying to parse some EDN in a Ring handler. what am I missing? http://stackoverflow.com/questions/30209769/unable-to-parse-out-edn-in-this-server-request
04:59crocketㅍㅁㅎㄱ뭇
04:59crocketおお
04:59crocketouch
05:34mnngfltg2xinau, yeah that's how it works but it's inconvenient if like me you use evil-mode -- plus it's different to how lisp-mode works
05:42wasamasamnngfltg2: evil actually hacks C-x C-e to behave differently
05:42wasamasamnngfltg2: this hack only works for emacs-lisp-mode though
05:42mnngfltg2wasamasa, aha!
05:42wasamasamnngfltg2: so perhaps this explains your observation
05:42mnngfltg2that's a good place to start
05:43wasamasaI guess I prefer more consistency, would be nice to be able to control these independently though
05:44wasamasathe cursor pushing happens when you're in normal state and point would be after the end of line
05:45sqdin the clj repl, is there a way to reload java code with (import), similarly to using (require 'myns :reload)?
05:47sqdalso, is there a way to debug "No matching ctor found for class" errors? i'm calling a constructor (new RRport myapplet), and i'm quite sure myself the myapplet instance is of the right class
05:50sqdok, reloading java code seems to require restarting the repl and the java code update fixed the ctor error. still would be nice to be able to reload java code in a running repl
05:58escherizeIs there a resource for doing regex that grab groups - in clojure?
05:59escherize,(use 'clojure.string)
05:59clojurebot#error {\n :cause "denied"\n :via\n [{:type java.lang.SecurityException\n :message "denied"\n :at [clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]}]\n :trace\n [[clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]\n [clojurebot.sandbox.proxy$java.lang.SecurityManager$Door$f500ea40 checkPropertyAccess nil -1]\n [java.lang.System getProperty ...
06:00mnngfltg2escherize, sure, re-matches
06:16sqdwhen i have a MyClass instance in clj, can i add a method to it that java's .getClass().getMethod() will recognise?
06:27crocketclj
06:32ddellacostawhat's the right way to specify a byte array in schema?
06:34mpenet(Class/forName "[B") maybe
06:34mpenetor (type (byte-array 0))
06:35mpenet(untested)
06:36ddellacostampenet: okay, thanks.
06:36augustlhow would you convert [3 11 8] into [3 14 22] - each item is the sum of itself and the previous number
06:36ddellacostadon't love (Class/forName "[B") but seems to work for now
06:40ddellacostaaugustl: here's one way
06:40ddellacosta&reduce #(conj %1 (+ (or (last %1) 0) %2)) [] [3 11 8])
06:40lazybot⇒ #<core$reduce clojure.core$reduce@7bed0b7a>
06:40ddellacostad'oh
06:40ddellacosta&(reduce #(conj %1 (+ (or (last %1) 0) %2)) [] [3 11 8])
06:40lazybot⇒ [3 14 22]
06:40ddellacostaaugustl: ^
06:43augustlddellacosta: ah, nice :)
06:45augustl&(reduce #(conj %1 (+ (last %1) %2)) [3] [11 8])
06:45lazybot⇒ [3 14 22]
06:45augustlwith first/rest instead of hardcoding
06:49ddellacostaaugustl: and then you could do...
06:49ddellacosta&(defn foo [c] (reduce #(conj %1 (+ (last %1) %2)) [(first c)] (rest c)))
06:49lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
06:49ddellacostawoops
06:49ddellacostawell, anyways, you get the idea I think...
06:53TEttingerwow I can't believe no one mentioned ##(reductions + [3 11 8])
06:53lazybot⇒ (3 14 22)
06:53TEttingerI love reductions
06:55TEttingeraugustl: how's the reductions answer look?
06:55ddellacostaTEttinger: I didn't know about that! Thanks.
06:55TEttingerreductions rules!
06:56ddellacostaseems clearly superior to the vanilla reduce version, basically encapsulates that semantics itself. Quite cool
06:56TEttingerit comes up often enough that you want to reduce to generate a collection, but the existing stuff is a bit clunky until you find reductions
06:56ddellacostaright, that's quite cool
07:00TEttingerif you wanted to specifically add the two most recent numbers, ##(let [coll [3 11 8 5 100 13]] (map + coll (concat [0] coll)))
07:00lazybot⇒ (3 14 19 13 105 113)
07:33bcn-florI would like to add text to the pprinted objects, but clojure.pprint/pprint takes only one argument. Is there a pprint which takes multiple arguments ? eg. (pprint "Temperature is:" x " degrees")
07:35augustlTEttinger: ah, nice
07:35augustlTEttinger: I'm actually using mori, so I don't have it, but nice to know!
07:35justin_smithbcn-flor: maybe pr-str instead of pprint?
07:36justin_smithif not, there is (with-out-str (pprint x)) wrapped in println
07:36justin_smitherr, the pr-str would also be wrapped in println
07:37justin_smith,(println "The temperature is" (pr-str {:degrees 44 :scale :ferenheit}) "degrees")
07:37clojurebotThe temperature is {:degrees 44, :scale :ferenheit} degrees\n
07:37irctc_Is there a way to divide factions with a whole component? like (/ 9 1/2 4 2/3 ).
07:38justin_smith,(+ 9 2/3)
07:38clojurebot29/3
07:38irctc_Preventing 4 numbers from being read.
07:38justin_smiththere is no input format that accepts "9 2/3" as a single input
07:41dysfunexcept with the quotes ;)
07:41justin_smithhaha
07:42hyPiRion,9 2/3
07:42clojurebot#<NumberFormatException java.lang.NumberFormatException: Invalid number: 9 2/3>
07:42hyPiRionoh well, close enough
07:42justin_smithinteresting that it wanted 9 2/3 to be one number though, rather than treating it as two numbers input
07:43justin_smiththat looks like a clojurebot thing only
07:43hyPiRionjustin_smith: return of the non-breaking space
07:43justin_smithd'oh, I should have suspected
07:43hyPiRion:p
07:44timvisheri'm trying to extend a the clojure.data.json.JSONWriter protocol to java.util.Date. i have it working at the repl but an ns unrelated to the one in which i wrote the extend form is still claiming that it can't write java.util.Date. any clues?
07:45timvisheri sort of have the impression that extending a protocol is something like monkey patching so that if i do it anywhere it's available everywhere within the same vm. no idea how accurate that is.
07:46timvisher(having never done any monkey patching in real life anyway, it seems like an apt comparison :)
07:47justin_smithyes, if you extended java.util.Date to implement the clojure.data.json.JSONWriter protocol, it should just work
07:47hyPiRiontimvisher: have you required the namespace where you extend jsonwriter to date?
07:48timvisherhyPiRion: in the ns in which i'm writing?
07:48timvisheror in the jvm
07:48timvisherrather, in the ns in which i'm getting the error
07:48hyPiRiontimvisher: yes, the ns where your error occurs
07:48clojurebotPardon?
07:49timvisherhyPiRion: ah. no i don't believe so. i don't have direct access to that ns, though.
07:49justin_smithhow could you make it load if you don't have access to it?
07:49bcn-florjustin_smith: thank you. is there way to make pprint *not* add a newline character after the printed object ?
07:50hyPiRionhm, you have to load it somehow, I think
07:50timvisherjustin_smith: it's in a dependency
07:50justin_smithbcn-flor: you could use subs to take the newline out, but that is about it I think
07:50justin_smithtimvisher: you can't require code from a dependency?
07:50timvisherso my-app → third-party-dep - ns throwing the error
07:51timvishersorry, i think i'm missing something here :)
07:51justin_smithoh, I get it
07:51timvisheri'm interpreting what hyPiRion is saying as 'require the ns in which you extend the protocol in the ns that's throwing the error'
07:51timvisheris that incorrect?
07:51justin_smithso, make sure to require your extending ns before calling the third party dep
07:51hyPiRiontimvisher: oh, right. It should be sufficient to have it loaded on the jvm, but I'm not 100% sure on that
07:52timvisherok, that's what i expected to work. i guess my ns isn't being required in the test runners then
07:52timvisherbut my assumption was valid, that so long as the extend form makes it through the repl in a particular vm, the protocol is extended for all parties involved
07:52justin_smithtimvisher: the trick is to require the code because otherwise the file never gets loaded, it's good practice to do it from where the functionality is needed, but as you demonstrate sometimes other things happen
07:53timvisher'it' being extend the protocol?
07:53justin_smithright
07:53timvisheryes
07:55justin_smithtimvisher: have you been able to make your json-writing date object work in a repl context?
07:55hyPiRionjustin_smith: he said so
07:55justin_smithhyPiRion: sorry, I missed that part
07:55timvisherjustin_smith: yes. i developed it interactively at the repl so i know it works from that context :)
07:56timvisheressentially what's happening is that in the repl my extension's working fine but running lein midje it's blowing up
07:56timvisheri haven't tried calling the code that's blowing up from the repl though, that's probably worthwhile.
07:57justin_smithor, since you are doing tests, you could directly test generating json from a date, as you did in the repl
07:58hyPiRiontimvisher: hm, did require the ns extending date in the test ns?
08:00timvisherhyPiRion: that was it. :) i had extended the protocol in an ns that wasn't required from the tests
08:00timvisher(inc hyPiRion justin_smith)
08:00lazybot⇒ 1
08:00timvisheris that variadic? :)
08:00justin_smith(identity hyPirion justin_smith)
08:00lazybothyPirion justin_smith has karma 1.
08:01timvisherit should be
08:01timvisherlol
08:01timvisher(inc hyPirion)
08:01lazybot⇒ 74
08:01timvisher(inc justin_smith)
08:01lazybot⇒ 253
08:01timvisherhahaha
08:01timvisheractually i worked at place that exclusively paired and we had some scripts written around git that would change the author name so you would sit down, change the author name to 'tim and joe' and work
08:02justin_smithhaha, nice
08:02tdammersoh god
08:03justin_smithnext you need an email server that does set theory, so that you can do union emails to go with the union commiter names
08:03timvisheri sort of like that the member 'hyPirion justin_smith' now has one point :)
08:03tdammersyou should propose adding some "security" to your git server to make sure only authorized people are allowed to commit
08:04hyPiRiontimvisher: it's sad it isn't commutative =/
08:04hyPiRion(inc justin_smith hyPiRion)
08:04lazybot⇒ 1
08:04timvishertdammers: oh it gets worse. we also all used the same email address and all pushed to the same central repo without branches
08:04timvisherbut hey! it was faster than svn so… :)
08:05timvisherjustin_smith: the union email idea would have been brilliant :)
08:05tdammersoh boy
08:05tdammersI worked at a place once were e-mail addresses were considered a scarce good
08:06tdammersyou could not get a personal e-mail address unless you had worked there for at least a year
08:06tdammersand when you did, it wasn't really personal
08:06tdammersinstead, you'd get an address bound to your role
08:06tdammersor rather, named after your role, but bound to you personally
08:07tdammersso we had support@, development@, programming@, it@, and they all belonged to programmers
08:07hyPiRionI once had an email address with an apostrophe in it (it's legal according to the spec!), but it bounced so often I didn't bother to keep it
08:07tdammerswe also had a standing order that under no circumstances was the "trash" folder to be emptied, because that's where you were supposed to keep your "archived" e-mail
08:08tdammers(in a nutshell, boss had a stupid workflow and demanded everyone else also use it, because it worked for him, so it clearly was the perfect workflow)
08:09justin_smithhyPiRion: yeah, email validators suck
08:10timvisherhas anyone else been experiencing an unusual amount of connectivity issues with freenode lately? i get disconnected once or twice a day lately.
08:11hyPiRionjustin_smith: seen http://ex-parrot.com/~pdw/Mail-RFC822-Address.html ?
08:11justin_smithtimvisher: I have been disconnected maybe twice since I got a digital ocean server about 6 months ago, I just keep my irc client running inside screen and ssh in
08:12justin_smithtimvisher: I am more likely to get disconnected randomly by ssh (especially from work), but on irc I stay connected
08:12justin_smithmonths at a time
08:12timvisherjustin_smith: yeah. i have a permanent tmux session on a server and mosh over to it. what are you using to connect?
08:13justin_smithirssi
08:13justin_smith"comments in email addresses" - I should have figured this went deeper
08:14justin_smithwow, email addresses allow parens (even nested) and they are not counted as part of the address
08:15justin_smithhow did I not notice this before
08:15oddcullyemailrepl!
08:15crocketClojure data types are simple.
08:15crocketSimplicity rules.
08:16hyPiRionjustin_smith: Somebody just had to add it, eh
08:16justin_smithcrocket: they are one of the best things about the language
08:16crocketwasamasa, Humans are clever bots.
08:16justin_smithjohn(this is allowed)@example(this is too).com
08:17wasamasacrocket: nope
08:17hyPiRionand(so (is this))@example((I do) not (know why)).com
08:17justin_smithhaha
08:17Glenjamindoes that become andsoisthis@exampleIdonotknowwhy.com ?
08:17hyPiRionGlenjamin: no, it becomes and@example.com
08:18justin_smithGlenjamin: it becomes and@example.com
08:18Glenjaminwhat
08:18justin_smiththey are comments
08:18Glenjaminthat's crazy!
08:18hyPiRionyes. yes it is.
08:18mavbozowoot! space before @ is considered to be part of a valid email address
08:18justin_smithhyPiRion: in fixed width, we made our messages line up perfectly
08:18mavbozoi check it here: http://sphinx.mythic-beasts.com/~pdw/cgi-bin/emailvalidate
08:19hyPiRionjustin_smith: great minds align their text
08:19mavbozowhat a coincidence! today i find out that one of my customer entered 'xxxx @gmail.com'
08:20mavbozoi thought that was a invalid email address
08:20justin_smithgmail does not allow me to use email addresses with comments
08:20hyPiRionWell, comments in emails give you the option to send legal clojure expressions in your address, so there's that.
08:21justin_smithbest form of communication ever
08:22justin_smithmail to: joe(apply str (map char [116 104 101 121 32 97 114 101 32 119 97 116 99 104 105 110 103]))@example.com
08:23mavbozomavbozo(remove-last-email-from-me)@mavbozo.com ;; in case someone accidentally sends unwanted message
08:24hyPiRionjustin_smith: hah, one should put a quine as a comment
08:24justin_smithindeed
08:25mavbozoor mavbozo(burn-after-read)@mavbozo.com ;; mission impossible style
08:34teI'm doing some wiring together of liberator & swagger compojure-api, is it considered bad form if your using a var value at macro expansion time ? (via var-get) - an macro example here : https://www.refheap.com/101041
08:38justin_smithte: resolve already returns a var, why not just deref it?
08:39justin_smithin fact, why even explicitly call resolve?
08:40justin_smithte: in my usage, resolve is useful when you need to use something at runtime, but it can't be available while compiling
08:40justin_smithwhich is not a constraint here at all
08:40justin_smithso I don't really understand what is being gained
08:42justin_smithwhat would break in your macro if (var-get (resolve verbs)) was replaced with verbs
08:46teInstead of using a literal list with symbols in my macro like (rest-service [get post] ... ...) i would like it to generate x number of forms based on a def list. but because of ~@ the verb parameter to the macro is not expaned. Another way it is to (eval the output of the macro without the gensym)
08:54stainhi, is it possible to get almost all the benefits of (defrecord) (e.g. IMap, toString, etc) while being able to also override toString and hashCode() as you can with deftype?
08:55stainI tried using deftype, but I'm overwhelmed with having to implement all of the things you get for free from defrecord
08:55stainperhaps there's a shortcut macro or something?
08:56dnolenstain: there is no simple way
08:57Bronsaztellman should have a library for that IIRC
08:58Glenjamini can find collection-check, i was sure he had a lib for generating collections too
08:59Bronsamaybe something in potemkin.collections but i might be wrong
09:11tejustin_smith, since I need the values from the def at expansions time to generate X number of forms - it would fail since the verbs is a symbol not a collection eg: https://www.refheap.com/101042
09:11justin_smithte: that's what ~ is for
09:12tejustin_smith, but not along with the splice @
09:12justin_smithoh, wait, OK
09:17n8dawgHi All, wondering if i've found a memory leak in loop/recur: heres the simple code to reproduce: http://pastebin.com/e6sznesX
09:25sm0kehey clojurelings
09:25hyPiRionn8dawg: with what kind of numbers do you run that with?
09:25sm0keso this new build tool boot doesnt seem to compile java eh?
09:26hellofunkcan anyone advise what i'm missing in this EDN parsing from a Ring response? http://stackoverflow.com/questions/30209769
09:26n8dawghyPiRon: anything where the cumulative size is bigger than the heap, so say set size = (* 1024 1024) and n = (* 10 1024)
09:26n8dawgthats 10GB
09:27justin_smithhellofunk: what did you intend to do to r?
09:28hyPiRionn8dawg: I did 1000 and 1e8, which failed
09:29n8dawghyPiRon: seems like loop is holding onto the head, is tht expected behaviour?
09:29justin_smithn8dawg: how do you know it's doing that?
09:30hyPiRionjustin_smith: I'm not sure how else it would manage to get out of memory this way though.
09:30hellofunkjustin_smith: at the moment I am just reading it to see if the EDN stuff has been parsed out
09:32hyPiRionn8dawg: yeah, that smells like a bug. https://www.refheap.com/101045 works just fine
09:33justin_smithhellofunk: I bet the body has already been consumed, but if not you can get it with slurp
09:34justin_smithhellofunk: I really don't know how wrap-edn-params and a put request would combine properly though
09:34justin_smithmaybe I just need coffee
09:34sm0kejustin_smith: if it had been consumed he would have got a cannot reset seek error
09:35justin_smithsm0ke: when?
09:35sm0kehellofunk: do you think the edn is proper and parsable?
09:35hyPiRionn8dawg: yep, the macroexpansion expands outside of the loop. I think this has been discussed earlier though, but I can't find any jira ticket for it right now
09:36sm0kejustin_smith: if the body had been consumed previously
09:37hellofunksm0ke: it is being sent using cljs-ajax which automatically formats into EDN
09:37justin_smithI mean previously to what
09:38sm0keso he has two middlewares, but the content type is end so wrap-params will not slurp the body
09:38hyPiRionwoah, that's a really stupid expansion
09:38sm0keedn*
09:38sm0keit is most probably being consumed by wrap-edn-params only
09:39sm0kehellofunk: could you check the request instead?
09:40sm0kei think if the middleware is sane it should add a param to req map like :edn-params
09:40stainGlenjamin: thanks -- I found https://github.com/ztellman/potemkin which might or might not help me :)
09:40sm0keah there indeed is a :edn-params but it is nil
09:41sm0kehellofunk: what is the edn?
09:43sm0kewhat ever it is, it is being parsed to nil, if you have some custom edn you probably better of writing you own middleware
09:45sm0keweird it seems to just do a `read-string` and merge with existing params https://github.com/tailrecursion/ring-edn/blob/master/src/ring/middleware/edn.clj#L26
09:45sm0keso anything should work
09:45sm0kei mean given its a map
09:45hellofunksm0ke: {:a 1 :b 2} as a test
09:45sm0keno way
09:45sm0kethat should work
09:46sm0kehellofunk: could you remove the wrap-param middleware, just to be sure
09:50justin_smithwait, is the body of a put even considered a location for params?
09:51justin_smithI'd consider it to be a document
09:51sm0ke?
09:51justin_smithit's a put request
09:51sm0kedont be old fashioned
09:51sm0kei have seen people do -d '' in a GET
09:52justin_smithsm0ke: OK, I'm just thinking of reasons this would be failing
09:52justin_smithnot being prescriptive
09:52justin_smithIOW see if changing it to post changes anything
09:52sm0keafaict there is no racism in this code https://github.com/tailrecursion/ring-edn/blob/master/src/ring/middleware/edn.clj
09:52sm0kebased on type of request
09:54hellofunksm0ke: let me try that, one moment
09:54sm0keto be honest i dont think that will make one bit difference
09:55sm0keas wrap-params looks for content-type before slurping
09:55sm0kejust getting hellofunk 's hope high here
09:56sm0kehellofunk: could you do yourself a favour an try with a curl request instead please?
09:56sm0kecurl -X PUT -H "Content-Type: application/edn" -d '{:name :barnabas}' http://localhost:8080/whatever
09:56hellofunksm0ke: so removing wrap-params made no difference. i'll try curl next. but looking at the nrepl output from println on a server has always worked.
09:57sm0kehttp://localhost:6542/ajax-example in your case
09:58hellofunksm0ke: I assume my :body in the response will just be my full request as (str r) ?
09:58sm0kefirst, what you are printing is not response but resuest
09:59puredangerClojure 1.7.0-beta3 is now available https://groups.google.com/d/msg/clojure/bCmETw2F1jY/OQfrQH_39zoJ
09:59wasamasayay
09:59sm0kerequest*
09:59ddellacostaomg was just wondering about the status of 1.7
09:59hellofunksm0ke: i meant, right now in the SO code snippet, I am not returning anythign that would be useful in a curl response
09:59n8dawghyPiRion: good catch its the macroexpansion, using loop* doesn't seem to exhibit issue
09:59sm0kehellofunk: does not matter
10:00sm0kepuredanger: nice work! +1
10:00hellofunksm0ke: well, the curl reponse looks identical to the nrepl println
10:00sm0kehellofunk: dont care about response, see the server log
10:00sm0kehellofunk: is there a :edn-params there?
10:02sm0kealso i dont really like that PUT definition , looks weird, its amazing how may type of dsl in there for route definitons
10:02sm0kei am always confused to see someones route defintions
10:02hellofunksm0ke: the nrepl response is the same with curl.
10:03hellofunksm0ke: PUT vs POST should make no difference in this
10:03sm0kehellofunk: so :edn-params is nil?
10:03hellofunksm0ke: yes
10:03sm0keI give up
10:05hellofunksm0ke: thanks all the same. when/if i figure out what the issue is, i'll update the SO question in case you are curious
10:05sm0kehellofunk: thanks bookmarked
10:07tdammerswell, fwiw, route semantics tend to differ quite a bit between websites/applications
10:07tdammersmakes sense to have different ways of specifying them
10:07sqddoes anyone have experience running clojure on an intel edison? i wonder about the performance. doing some serial, ble and http communication and simple number processing
10:07sqdmaybe also sound
10:26luxbockBronsa: using clojure.tools.analyzer.jvm/analyze-ns, for a :binding node, is it somehow possible to retrieve the non-macroexpanded forms for the value of the binding?
11:19hellofunksm0ke: justin_smith: the interesting development in this saga is a (slurp (:body r)) is empty, despite that the content-length is correct for the passed-in map
11:25justin_smithhellofunk: the body has a type that only can get read once
11:25justin_smithit's stateful
11:26justin_smithI thought it would error, but not super-surprised if it would give nil
11:27justin_smith,(require '[clojure.java.io :as io])
11:27clojurebotnil
11:27justin_smith,(def i (io/reader (.getBytes "hi")))
11:27clojurebot#'sandbox/i
11:27justin_smith,(slurp i)
11:27clojurebot"hi"
11:27justin_smith,(slurp i)
11:27clojurebot#error {\n :cause "Stream closed"\n :via\n [{:type java.io.IOException\n :message "Stream closed"\n :at [java.io.BufferedReader ensureOpen "BufferedReader.java" 115]}]\n :trace\n [[java.io.BufferedReader ensureOpen "BufferedReader.java" 115]\n [java.io.BufferedReader read "BufferedReader.java" 172]\n [clojure.core$slurp doInvoke "core.clj" 6650]\n [clojure.lang.RestFn invoke "RestFn.java" 4...
11:27justin_smiththat's what I expect...
11:28hellofunkjustin_smith: does that mean that the middleware is reading it therefore it is empty when i println it?
11:28justin_smiththat's what I would expect
11:29justin_smithin my experience the body is already read by the time it hits my handler
11:30hellofunkjustin_smith: but I took out the middleware completely and the body is still empty, despite a valid content-length that is not otherwise reflected by anything else in the request map. the content is clearly in there somewhere.
11:33clojerSubmitting a form in my Luminus app produces this error: {"type":"unknown-exception","class":"java.lang.IllegalArgumentException"}
11:33clojerIs there any way of getting more detail?
11:37justin_smiththere was no stack trace printed?
11:39clojerjustin_smith: Yes, but only "java.lang.IllegalArgumentException: Key must be integer" seems relevant
11:40clojerjustin_smith: Could do with at least a relevant file and line number
11:40justin_smithwell, the stack trace should have lots of files and line numbers
11:40sqdis there a transducer i can apply to seqs so that (nth my-transduced-seq n) is the average of (take n my-seq)?
11:41clojerjustin_smith: Yes but it all seems to point to core.clj and various middleware files.
11:41sqd(i'm actually using an async chan, but this may be easier to explain)
11:42justin_smithclojer: it should at least tell you which code of yours last touched the data before it went into clojure.core etc.
11:43justin_smithif you read closely
11:46clojerjustin_smith: Just copied the stacktrace into Vim then grep -v 'ed anything containing "core.clj", "org.eclipse" and "middleware". What's left doesn't refer to anything I've edited.
11:54justin_smithclojer: at the very least you should see the namespace that defined the handler or launched the server
12:22hellofunkcan anyone summarize like i'm in 5th grade the difference between transit and EDN and which to use when?
12:23puredangeredn is for people
12:23puredangertransit is for machines
12:23puredangertransit over json is best for browser to backend
12:23puredangerboth have extensible type systems
12:24hellofunkif using it for ajax, which would be a better format to pass between?
12:24puredangertransit has much better performance due to 1) leveraging high-perf json (or messagepack) parsers and 2) caching of values in the stream
12:24puredangerI'd use transit over json
12:25puredangerit has a "verbose" mode you can use for debugging so you can get the human-readable aspect if you need it
12:25hellofunki see
12:25puredangermore: https://groups.google.com/d/msg/clojure/9ESqyT6G5nU/2Ne9X6JBUh8J
12:25hellofunkcool thanks
12:28bensuin a ns declaration, should the order of the :import and :require clauses matter?
12:29justin_smithbensu: it shouldn't, it becomes a hash-map iirc.
12:30bensujustin_smith: thanks, I'll investigate further then.
12:30justin_smiththe idiom is to put :require before :import though
12:31puredangerit does not matter
12:32mdrogalisjustin_smith: That's great news. :)
12:34bensupuredanger justin_smith: thanks
12:57justin_smithmdrogalis: I don't have the tests running (need to figure out how to integrate it with cljs.test) but the actual functionality is there so far. Should be on my github soon.
13:06bensujustin_smith: if there are no async tests, adding cljs.test should be as simple as requiring it with #?
13:09justin_smithbensu: cljs.test is there, but it acts like the deftest forms never got run
13:09justin_smithit's weird
13:09justin_smithprobably some error on my end
13:12steffan42(println (read-line)) in an emacs cider repl fails to print this input - it accepts a stdin from the minibuffer but hangs after pressing return. I have to kill the process.
13:14steffan42Calling (read-line) a second time then prints the previous input. Ideas?
13:15justin_smithsounds like a bug in cider
13:15steffan42okay thanks
13:16noncomin cursive, how do i make it so that pressing "(" encloses the selected terms in () instead of replacing them with a "(" ?
13:20puredangerI think on mac, cmd-shift-( does that
13:21puredangeractually I guess that just encloses the next form
13:21puredangernot the selected
13:21noncompuredanger: hmm, i am on win...
13:22noncomthere is Wrap in () in Structural Editing, i have assigned Shift+9 to it, to no avail...
13:22noncomsimply does not work
13:22puredangerwell mash down some different modifiers then :)
13:22noncomah, it works as you said - encloses the next form instad of enclosing the selection
13:23noncom(that's different from how it works in ccw eclipse)
13:23puredangerI usually just make empty and slurp forms :)
13:23noncomwhat is your hotkey for slurping?
13:24noncomwill assign the same.. already got some headache on figuring out good hotkeys with cursive :)
13:24puredangerI use Cmd-Shift-K
13:24puredangerbut I think I just grabbed one of the sets that comes with Cursive to get that
13:25puredangeryeah, I use the "Mac OS X 10.5+" settings + various tweaks
13:25noncomno, nothing comes with cursive... they say "figure it out for yourself" in the getting started..
13:25noncomhmm.. somehow your setup was different...
13:26noncomah, i have the config you say
13:26puredangerno that changed a while ago - it comes with mulitple binding sets now
13:26noncomthe mac 10.5+
13:26puredangerunder (in IJ 14) Other Settings -> Clojure -> Keybindings there is a "binding set" control
13:26puredangerto install a whole set
13:27noncomgmmm (println "\n\nCORE: execute with args " args "\n\n")
13:27noncomoooops
13:27noncomhttp://joxi.ru/VrwoVvYsRGKMrX - this one
13:28noncomi just don't have it :)
13:28puredangerdon't have the set or don't have the control?
13:28noncomdon't have the sets you mention. i have them, but in the general Settings -> Keymap thing
13:28noncomwell, maybe i'll go with Emacs se tthen...
13:29noncomor Cursive..
13:29puredangerthe Cursive one is basically the same as what I have
13:29noncomalright, so i'll set this one too. had enough of this already on the few days trying to get accustomed to cursive :)
13:31noncomwhoooa! so much fun! now it maps half of the things to Meta + something, and it just does not work on win
13:31noncomalt is not meta...
13:31puredangerwell I can't help you there :)
13:32noncomyeah... btw, the whole mapping did not apply anyway.. it is reset back to NONE when i go back to the keybindings..
13:32noncomahh, no problem... it's just software :)
13:34puredangermaybe ping cfleming for that
13:41noncomoh, he is very budy right now.. i have already loaded him with lots of questions ))
13:42noncom*busy
13:44fourqWhere in the docs will I find info about the caret symbol?
13:44fourqEvaluations?
13:45TimMcfourq: Check out http://clojure.org/reader (Macro characters)
13:45fourqty
13:45ToxicFrogfourq: I generally look at "the reader" first
13:45fourqgtk
13:45ToxicFrogAnd indeed going there and looking for ^ will take you straight to the section on metadata
13:48dfletcheris there something with a similar api as get-in but to set a value? like, set it and return me a new nested map with the changed value? similar to procedural languages when you do a['foo']['bar'] = 'baz'; except more clojure-ish.
13:48Glenjamin(doc assoc-in)
13:48dfletcherty
13:48clojurebot"([m [k & ks] v]); Associates a value in a nested associative structure, where ks is a sequence of keys and v is the new value and returns a new nested structure. If any levels do not exist, hash-maps will be created."
13:48dfletcherI guessed "set-in" hehe
13:49TimMcdfletcher: There's also update-in which is more general.
14:08hellofun`justin_smith: http://stackoverflow.com/questions/30209769/unable-to-parse-out-edn-in-this-server-request/30222274#30222274
14:14sqdjvisualvm tells me fmp.web$app$fn__11124$state_machine__8430__auto____11125$fn__11127.invoke () seems to be causing trouble. does that mean that the clojure.core.async/go state machine defined in fmp.web/app is the culprit or could it be a state machine elsewhere?
14:25OscarZis there some function etc. for this: evaluate something and if its truthy, then it will be the value, otherwise null ?
14:30arohnerOscarZ: that sounds like 'if to me
14:30arohneror 'when
14:30justin_smithhellofun`: weird
14:31justin_smithhellofun`: maybe it's because wrap-edn-params is destructive
14:31amalloyOscarZ: so that function would be (fn [x] (when x x))
14:32justin_smithhellofun`: so in order to route, it passes in the request, the body is consumed by wrap-edn-params
14:32justin_smithhellofun`: by the time you do this again, there is no longer a body to consume
14:32OscarZok, but wouldnt that evaluate it twice ? i would like to avoid that if possible
14:32hellofun`justin_smith: seems totally against the functional paradigm encouraged by Ring
14:32amalloyOscarZ: alternatively, it is just like identity, except it replaces false with nil. do you really need to tell false and nil apart?
14:32amalloyno, of course not
14:32justin_smithhellofun`: which tells me that you should combine all param manipulation into one middleware, that wraps all routes that need the params
14:33amalloyfunction arguments are evaluated when they're passed into the function
14:33hellofun`justin_smith: yeah that's how I fixed it, but I'd have never thought this was the problem in a functional routing library like Ring, last thing I'd expect
14:33OscarZamalloy, oh yes that works of course..
14:34amalloy(fn [x] ({false nil) x x)) is another silly way to write it
14:34amalloyor, no, i guess that doesn't work. has to be (fn [x] ({false nil nil nil} x x))
14:34justin_smithhellofun`: I guess you could fork wrap-params, wrap-edn-params etc. with a version that creates a synthetic body after consuming the original (see for example what my groundhog lib does to recreate request bodies)
14:36OscarZamalloy, whats going on there :D
14:36amalloyOscarZ: well remember that all your function does is replace false with nil
14:36mikerodThis is interesting
14:36mikerodhttps://github.com/clojure/clojure/commits/04c59e81c4f16bfcaef2fdfd3f5bc5d887445045/src/jvm/Reader.g
14:36mikerodfirst cut at ANTLR-based Reader
14:36mikerodso this was tried earlier on
14:36amalloyso you look x up in a map, which just maps nil and false both to nil, and then if it's not there you return x instead
14:38OscarZi see.. i didnt remember map can be used like that :)
14:38OscarZcould i write a macro to make that more clean ?
14:40amalloyOscarZ: you could write a macro to make it less clean
14:40OscarZhehe ... i mean this one: (fn [x] (when x x)) ...
14:40OscarZfunction will do i guess
14:40amalloyit's just a function. defn it to be a function
14:40mikerodI read somewhere that as of clj 1.7 Symbols are no longer intern'ed. Is there a Jira related to this? Also, I never thought they were intern'ed in the first place? The Strings they refer to were interned.
14:40puredangerthat's more accurate
14:41puredangerI think I may have been sloppy in the beta3 email re that
14:41mikerodThis is relation to https://groups.google.com/forum/#!topic/clojure-dev/58fYUSIEfxg
14:41mikerodpuredanger: ok, that's fine. It just got me thinking about it more, since it differed from what I thought.
14:42puredangerkeywords are cached though, as always
14:43puredangerwe found that String.intern() was a performance bottleneck in symbol/keyword creation
14:45puredangerI think with the string de-duplication they're adding to the jvm, we'll get some of that memory tradeoff back too
14:47mikerodpuredanger: yeah, I read some about the keyword performance in some thread at one point a bit back. I know keywords need to be cached/singleton/comparable by ==, but symbols never had that contract.
14:49puredangerno
15:29bensupuredanger: beta3 worked fine
15:29puredangercool :)
15:30bensupuredanger: how many releases until it's called stable?
15:31puredangerI think we're pretty much done, hope to do an RC soon
15:33bensupuredanger: great! it really has been a seamless transition. thanks
15:51fourqwhen using :refer from a ns require it's "referring" to only those macros opposed to including the entire ns correct? https://gist.github.com/fourq/ac139f1cadc8ade5b807#file-core-cljs-L4
15:52fourqor functions not macros I thinkg
15:52fourqthink*
15:54arohnerfourq: it means you can use those fns / macros in the current ns without a qualifier
15:54arohneri.e. (put! ...) rather than (cljs.core.async/put! ...)
15:54fourqok, thanks arohner
15:54arohnerand correct, it doesn't affect other fns in core.async
15:54fourqand :refer opposed to :as?
15:54fourqas is singlular?
15:56arohner:as is shorthand for every fn in that namespace
15:56arohner(:require [cljs.core.async :as a])
15:56arohner(a/put! ...)
15:57fourqahh, ty again
15:57arohner:as only affects macros in very new versions of CLJS
15:58fourqI'm still struggling with the difference between a macro and a function tbh
15:59fourqbut then again all I had to do was search: https://newcome.wordpress.com/2012/02/12/functions-vs-macros-in-clojure/
16:11cflemingnoncom: https://cursiveclojure.com/userguide/paredit.html: "Settings→Editor→Smart Keys→Surround selection on typing quote or brace. If this option is selected, opening a balanced form will wrap the selection"
16:13cflemingnoncom: I replied to your mail, haven't heard back - did you get it?
16:20brainproxyI have a deftype with a field that is an Integer, and I'm getting warnings from case in a method on that type about it not being primitive
16:20brainproxyI can get rid of the warning by running case against (int myfield)
16:21brainproxybut is there another way?
16:30justin_smith"there has to be a better way!" (cue infomercial for haskell)
16:31meliponehello! I have a namespace question. I want to modify just a few functions in a namespace, call it A, and "inherit" all the other from another namespace, call it B. Ok, I know about :require and :use. Now, I have another namespace, call it C, from which I want to call functions from A and B without knowing which one is which. How can I do that? I tried to :require A but C does not know about B. Only A does.
16:33justin_smithmelipone: require / use are never transitive
16:33justin_smithin a given namespace, you only have those things you explicitly map to that namespace
16:33justin_smith(plus some core defaults)
16:33meliponejustin_smith: So, I can't do what I want to do?
16:34justin_smithnamespace "inheritance" isn't a thing, so I think you can't, no
16:34justin_smithI mean you can patch together something that acts like that of course, but I think it would be a hack (see vinyasa)
16:34meliponejustin_smith: jeez... I can't remember how I used to do that in Lisp
16:35justin_smithhttps://github.com/zcaudate/vinyasa
16:35meliponejustin_smith: ok, thanks, I'll look at vinyasa
17:02arohneris there an idiomatic (i..e built-in) way to convert an int from 0-255 to a byte?
17:02arohnerI'm dealing with java.io.InputStream and NIO, and InputStream helpfully returns int "bytes", and NIO needs 'real' bytes
17:03arohner(byte (- x 128)) isn't too bad
17:04arohnerhrm, that's wrong
17:05arohneralso, InputStream.read() returning ints rather than bytes is idiotic
17:07TimMcarohner: How would you have it signal end of stream?
17:07arohnerTimMc: nil?
17:08arohnerTimMc: I'm just really annoyed by the interplay between APIs that use bytes and APIs that use ints masquerading as bytes
17:08arohneralso really annoyed by signed bytes
17:22TimMcarohner: nil would mean giving up primitives
17:24arohnerTimMc: if you really care about performance, you shouldn't be casting byte->int and back. At that point, just go to full NIO land, and only operate on byte-arrays
17:28bostonaholicI'm creating a new clojure newsletter. Email me at subscribe@clojurelive.com for the latest news and tips on Clojure, ClojureScript, and Datomic.
18:52ztellmanarohner: (bit-and n 0xFF)
18:54arohnerztellman: I'm going the other way, so I'm using (byte (+ (- (bit-and 0x80 i)) (bit-and 0x7f i)))
18:54ztellmanoh, sorry
18:54arohnerztellman: I knew how to do it "by hand", I'm just grumpy that path isn't smoother :-)
18:55ztellmanarohner: hmm, I had to look up how I did it in primitive-math, but this is simpler: https://github.com/ztellman/primitive-math/blob/master/src/primitive_math.clj#L227
18:56ztellman,(byte 0xFF)
18:56clojurebot#error {\n :cause "Value out of range for byte: 255"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Value out of range for byte: 255"\n :at [clojure.lang.RT byteCast "RT.java" 1095]}]\n :trace\n [[clojure.lang.RT byteCast "RT.java" 1095]\n [sandbox$eval25 invoke "NO_SOURCE_FILE" 0]\n [clojure.lang.Compiler eval "Compiler.java" 6792]\n [clojure.lang.Compiler eval "Compiler.j...
18:56amalloyztellman: unchecked-byte ?
18:56ztellman,(unchecked-byte 0xFF)
18:56clojurebot-1
18:56ztellmanok
18:57ztellmanoh, right, I wasn't using clojure.core/byte, I was using primitive-math/byte
18:57ztellmanso yeah, that works
18:57arohneramalloy: aha! thanks
19:13cflemingI'm trying to reproduce the Compiler's method disambiguation (getMatchingParams) in Cursive
19:14cflemingI'm struggling to come up with a test case that triggers the subsumes() checks - can anyone suggest one?
19:15hiredmanis that what does the widening from int to long?
19:15cflemingIt seems to be for disambiguating similar param lists, but I'm not clear exactly what it's doing
19:16amalloyhiredman: it looks that way
19:16hiredman(and similar such things?)
19:16amalloycfleming: try class Foo {public void f(int x) {...} public void f(long x) {...}}
19:16cflemingI think it's more for boxing
19:17cflemingif (!c1.isPrimitive && c2.isPrimitive || c2.isAssignableFrom(c1))
19:18amalloycfleming: f(Integer x), f(long x)? or the other way around possibly, int/Long
19:19cflemingamalloy: I've tried that, the trick is I think have to invoke it passing short, or similar. That takes one of the code paths, but I can't provoke the other - I'll play around with it.
19:19cflemingamalloy: Yeah, I think it's to do with matching boxing/unboxing rather than type width
19:21hiredmanactually, it appears to be primarily related to the inheritence hierarchy
19:24hiredmanthe docs for the isAssignableFrom method reference 5.1.4 of the jls (but I think they mean 5.1.5, since it mentions widening ref conversions) https://docs.oracle.com/javase/specs/jls/se8/html/jls-5.html#jls-5.1.5
19:26Bronsacfleming: it should be for cases where you have like foo(Object, Number), foo(Object, Long) and you're invoking (.foo x bar ^Number baz)
19:26Bronsaor uhm probably (.foo x bar 1)
19:27cflemingBronsa: Ok, so it's for disambiguating between boxed number types? I think it must be because I can't provoke it with primitives
19:28Bronsacfleming: no, not just number types, as hiredman said it has to do with inheritance hierarchy
19:29hiredmanwell, subsumes does contain the not primitive check on one of the classes, which I forgot about
19:30cflemingBronsa: Ok, got it. So this is between Object types when one derives the other, and it's trying to match the lowest point in the hierarchy?
19:30cfleminghiredman: Yeah, there's some primitive/Object check in there too
19:30cfleminghiredman: Which I don't understand
19:30hiredmanso subsumes does appear to be trying to match primitive and reference types
19:30Bronsahiredman: that's for nil argtypes
19:31hiredmanhuh
19:31Bronsasay you have foo(int x) and foo(Integer b), (fn [a] (.foo x a)) cannot match foo(int x)
19:32BronsaI'm going from memory here, might be something slightly different a
19:33Bronsathere are a lot of weird edge cases and inconsistencies in the method matching stuff scattered between Compiler.java and Reflector.java
19:34cflemingBronsa: Tell me about it. I'm trying to come up with some test cases for the original code so that I can then test them against the code I've migrated to IntelliJ's test system, but it's proving difficult
19:34cflemingBronsa: Suggestions for edge cases very welcome :-)
19:36cflemingI'm actually considering just exhaustively testing them and comparing the results, but it's difficult because it depends on the methods available in the class you're testing.
19:36Bronsacfleming: I still haven't gotten it right for tools.analyzer.
19:36cflemingAlthough I could just generate arg/param types randomly and test those I guess.
19:37cflemingBronsa: Do you have test cases there I can look at?
19:38Bronsacfleming: no, sorry. lots of experiments at the repl but I never got to write them down
19:38cflemingBronsa: Ok, no worries. The more I think about it the more I think that just generating test cases is probably the best way to go.
19:40cflemingBronsa: Fortunately I just copied the code and ported it to IntelliJ's type system which has a fairly similar interface, so fingers crossed I get the edge cases right by default
19:44fourqCould someone help explain how this anon func is working in this case? https://gist.github.com/fourq/b739a45c817f3292b63c#file-cljs-clj-L6 I don't understand what is going to replace the %
19:45ztellmanfourq: presumably the existing list of contacts?
19:46fourqztellman I'm not sure. I'm following a tutorial from https://github.com/omcljs/om/wiki/Basic-Tutorial#dealing-with-text-input-fields
19:46fourqscroll down about 4 setions
19:46fourqI don't understand the syntax, and I've read the #() docs too.
19:47ztellmanfourq: that's equivalent to (fn [contacts] (conj contacts new-contact))
19:47ztellmandoes that make sense?
19:48fourqnot really, where is "contacts" coming from?
19:49ztellmanfourq: I haven't used Om, but I presume "data" is a map that has a :contacts key
19:49ztellmanand transact! is updating that particular key
19:50fourqyeah data is a map and :contacts is a key, but I don't understand how that makes its way into the following form and replaces %
19:51ztellman,(update {:contacts ["abc"]} :contacts #(conj % "def"))
19:51clojurebot{:contacts ["abc" "def"]}
19:51ztellmanthis takes an input, and then applies the function to a particular sub-field, and returns a modified version of the map
19:51ztellmantransact! (again, I assume) is doing the same, but then updating an internal atom
19:52ztellmandoes the update example make sense?
19:52fourqthanks ztellman. i'm going to process this a bit more.
19:52ztellmannp, these are all very reasonable questions
19:54fourqztellman ahh. I see it now. I went to the transact! doc "(transact! cursor :text (fn [_] "Changed this!"))"
19:54fourqthe last part you mentioned makes this make sense
19:58cflemingBronsa: I should be able to exhaustively test all cases using single-element arglists, right? I can't see any interactions between parameters there.
20:00Bronsacfleming: I seem to recall differences between i.e. foo(Number) foo(Long) and foo(Object, Number) foo(Object, Long) actually.
20:01cflemingBronsa: Ugh. I'll see how many cases I'm looking at for one or two element arglists then.
20:01Bronsaor, something else. but there was definitely some strange behaviour I tried to fix (and failed) that had to do with multi-element arglist
20:26irctc__Test
20:27irctc__Awesome. Large Clojure community.
20:28tahmidYep
20:30brainproxyjustin_smith: no, it was a serious question (re: case,int); I just wasn't sure whether there was a proper way to hint the expression
20:31brainproxydoing (case (int x) ...) seems to be the least expensive of various options I tried, so I can live with that of course
20:32progrockergot a rather simple conversion of a sequence
20:32progrockerhttps://gist.github.com/anonymous/38f6f285a97be27fd381
20:32progrockerunsure how to proceed
20:33progrockeri know i could build a list up in a loop but that feels wrong
20:36amalloy,(doc mapcat) ; progrocker
20:36clojurebot"([f] [f & colls]); Returns the result of applying concat to the result of applying map to f and colls. Thus function f should return a collection. Returns a transducer when no collections are provided"
20:37progrockeramalloy: oh, i was actually looking at mapcat but was unsure
20:37progrockerthanks
20:39amalloyhere you want something like (mapcat (partial drop-while #{:pair}) xs)
20:39amalloy'(mapcat (partial drop-while #{:pair}) '([:n] [:pair [:number 1] [:number 1]] [:n] [:pair [:number 2] [:number 2]] [:n]) )
20:39amalloy,(mapcat (partial drop-while #{:pair}) '([:n] [:pair [:number 1] [:number 1]] [:n] [:pair [:number 2] [:number 2]] [:n]) )
20:40clojurebot(:n [:number 1] [:number 1] :n [:number 2] ...)
20:40amalloyoh, but you wanted to keep the :n in a vector. well, it's more work then but you can write the mapper function
20:41progrockerthanks again
20:43timvisheris anyone aware of a way to do static initalization in clojure?
20:43timvisherlike java static blocks?
20:43timvisherhttp://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.7
20:46amalloytimvisher: you want to produce the same bytecode as a static initializer in java, or you want to do something like static initialization but for clojure objects?
20:47timvisheramalloy: hmm... asking for a friend. sec. :)
20:48amalloymy guess would be, you don't need anything like static initialization, because it solves a problem that doesn't really exist
20:49timvisheramalloy: i'm not even sure i fully understand your question. the idea is that he wants to have code that is run at classloader time which is compatible with aot
20:49timvisherdoes that mean producing the same byte code?
20:49amalloywhy do you want code run at class load time? it is not a very good time to run code
20:50timvisherso the other option he's aware of is to provide an `init` function that consumers of his library just know to call
20:50amalloyhm. aside from the "very", that message was all monosyllabic. not trying hard enough
20:50timvisherfor instance: `(defonce hostname (.getHostName (java.net.InetAddress/getLocalHost)))`
20:51amalloytimvisher: (def hostname (delay (.getHostName ...))) (defn get-host-name [] @hostname)
20:51timvisherso if you aot that iiuhc the localhost address is set at compile time? that wouldn't make any sense.
20:51timvisheramalloy: interesting. :)
20:52amalloybut try not to do too much of this, because the set of things that you really only want exactly one of is pretty small. remember this is basically a singleton, which is a wall-known causer of problems
20:53timvisheryeah. my friend is not being very responsive and i definitely don't understand his goal well enough :)
20:53timvisheramalloy: in general i put pretty much everything behind a function call. i haven't run into almost anything that the performance hit of just looking it up every time is really an issue.
20:53timvisherand if it is an issue, i find it by profiling and _then_ get it defined only once :)
20:54timvisheralthough i do defonce my nrepl and http servers...
21:11sobeltimvisher: when i'm helping people i make them be clear on the problem. often enough they needed support on the problem domain more than the implementation domain.
21:11timvishersobel: indeed :)
21:11sobeland more importantly, saves me getting too far down the road of assumptions while also making me appear wise
21:12sobel...which i understand is a Lisp family value
21:13timvisherso, short of more context, is the answer basically that clojure has no `(static ...)` form that does what a stic block would do in java?
21:14sobelit solves a problem clojure does not pose
21:14sobelat last, based on information available
21:17timvishergot it :)
21:18cflemingtimvisher: Right, there's no way to do that. I generally just create a Java class and put the items I want in there, and then access it from Clojure that way. However I generally want to be initialising things that are easily available from Java, which may not be your case.
21:19timvishercfleming: yeah. it seems like he has some very complex things he's trying to do which don't lend themselves directly to memoization. i have no idea though what it actually is. he doesn't want to write a java class which will call back into his clojure code just to get static blocks. :)
21:19timvisherdo midje map checkers support a get-in style?
21:19cflemingtimvisher: Sadly he's out of luck
21:20timvisheri.e. `=> (contains {:a {:b}}}`
21:25timvisherah. looks like you can nest the contains... `(fact "asthaeu" {:a {:b :c :d :c}} => (contains {:a (contains {:b identity})}))`
21:46jumblemuddleAnyone have thoughts on a new clojure user wanting to get into web game development in clojurescript? I've looked into chocolatier (a library ontop of pixi.js), but I couldn't quite get my head around the figwheel repl workflow.
23:37justin_smithhaving figwheel set up ends up making things much smoother, once it is there