#clojure logs

2014-12-19

02:52hydoIs there any way to make all errors and exceptions throw over nrepl/cider like you can do in sbcl + swank? ie. you get a debugger window in emacs on an error.
02:53hydoaside from starting the app through the repl. I'm writing a plugin, sadly, or I would have tried that.
02:56H4nswhat would be the idiomatic way to implement an id allocator that receives chunks of ids from an external source and makes them available, one by one, to clients which may be running concurrently? i.e. each id must be issued only once and the pool must be refilled when it is exhausted.
02:57H4nsi've thought an agent would be the owner of the pool, but what would be the best way to send the allocated ids back to the clients?
02:59stainH4ns: let me just stop you there fore a moment.. why are you receiving IDs from an external source?
03:00H4nsstain: these ids are coming from database sequences and are used as row keys.
03:01H4nsah, agent + promise seems like a nice way to go about
03:02stain,(str (java.util.UUID/randomUUID))
03:03clojurebot"8485b6bd-3831-479c-ac72-1a0f72c4840a"
03:03H4nsstain: i need to allocate the ids using the database sequence generator.
03:03stainwhy? :)
03:03H4nsstain: because i am interacting with an existing system.
03:04stainthose damned existing systems!
03:04H4nsstain: they're part of the job
03:06stainhm.. but a promise is only a single value, isn't it?
03:07stainisn't this just a queue?
03:08H4nsyes, it is just a queue with something on the other end that refills it upon exhaustion
03:10H4nsagent + promise would basically be used to implement what a queue + actor would be in a system that had queues and actors :)
03:10stainwhen I hear these things I get a strong fear for that "other end" to just not be there anymore..
03:10H4nsi thought the point of clojure was that it took away the need for fear when dealing with concurrency
03:10stainbut you said "database" :)
03:11H4nsok. agent + promise it is unless someone can suggest something more idiomatic :)
03:12stainbut they won't be chunked up in advance.. it's just a background job which return value you check later.
03:13stainprobably what you want as longa s you have something to do before you do that "check later" bit
03:13Fareagent is for mutual exclusion to db access?
03:13H4nsFare: for mutual exclusion to sequence access, to be more exact
03:14Faredoesn't the db already provide exclusion for that?
03:14stainso how do you get hold of the promise then?
03:14Faremost dbs offer that kind of service already
03:14H4nsFare: it does, but i need to cache ids in order to avoid too many db interactions.
03:14staindo you make it and then send it to the agent?
03:14H4nsstain: the client sends the promise to the agent, the agent fulfills it.
03:15Fareoh, ok, makes sense, kind of
03:15stainH4ns: yeah, that should work fine.. and you just fill a buffer-kind in a while-loop
03:15stainwithin the agent
03:15stainand throw away any wasted seqeuences on JVM exit?
03:15H4nsstain: right, no harm done by that.
03:16Fare(as in, that's clearly for interacting with legacy db rather than some more modern design.)
03:16H4nsFare: correct.
03:16H4nsFare: in fact, the problem would be the schema, not so much the db. but i inherited that.
03:17Farecan't migrate, because other clients?
03:18H4nsFare: legacy all over
03:19stainH4ns: if you are running in a servlet environment, remember a (shutdown-agents) or magic (send agent nil) to shutdown - agents are non-daemon threads and might prevent the JVM from exiting (or from your WAR to be properly redeployed)
03:20H4nsstain: right, thanks - we'll have to deal with that in our command line wrapper
03:21H4nsthen again, as we System/exit anyway, we don't really need to care :)
03:21stainhehehe
03:22stainthat legacy database might..
03:22H4nsa database that cares about such things does not deserve the name "database"
03:28amalloyhydo: you want to start your program from somewhere other than emacs, and have exceptions connect to emacs somehow and open a debugger? sounds cool, but i'm pretty sure that doesn't exist
03:33luxbockis there an equivalent to the IPrintWithWriter protocol of CLJS in regular Clojure?
03:35luxbockI have a record that contains a field so large that it clutters up my REPL when I'm exploring stuff, so I'd like to dissoc that field from the record before displaying it
03:35amalloyluxbock: you probably want print-method
03:35Empperiheads up, critical security vulnerability found from both Git and Mercurial https://github.com/blog/1938-git-client-vulnerability-announced
03:36Empperihttp://mercurial.selenic.com/wiki/WhatsNew#Mercurial_3.2.3_.282014-12-18.29
03:36luxbockamalloy: thanks
03:36H4nspromise + agent work very nicely: https://www.refheap.com/95150
03:43luxbockamalloy: can I access the regular print-method somehow, so that I can pass my record with that noisy key removed?
03:44amalloyluxbock: it's just a multimethod. call it with whatever you want
04:15TheTeapotHey, I am getting a massive error when I run `lein repl`, can anyone help?
04:15TheTeapotIt's to do with "Could not transfer artifcat org.clojure:clojure...."
04:15andyfTheTeapot: Depends on what the error is. Have you copied it into a paste somewhere?
04:16TheTeapotI'll sprunge it
04:16andyfAlso, do you have anything in your ~/.lein/profiles.clj file? Its contents may be important, too.
04:16andyfand project.clj, too
04:16TheTeapotI have no ~/.leins/profiles.clk
04:16TheTeapotI have no ~/.leins/profiles.clj*
04:17andyfShould be just ~/.lein/ not ~/.leins/ in case you checked the wrong place by accident.
04:18TheTeapotproject.clj = http://sprunge.us/dFIj
04:18TheTeapoterror = http://sprunge.us/gFei
04:18TheTeapotAny ideas about this `lein repl` error would be wicked.
04:19TheTeapotTethered to a 4G Samsung Galaxy btw
04:20andyfAre you behind some kind of web proxy perhaps?
04:20TheTeapotI don't think that I am.
04:20TheTeapotI haven't connected to any or setup ay.
04:21TheTeapotLet me try connecting to a local wifi
04:21TheTeapotbrb
04:21andyfable to reach the web site search.maven.org in a web browser?
04:21andyfthat isn't the one lein should be trying to contact, but not sure which domain name is the actual one used right now.
05:17Empperiok, wtf. Added this plugin https://github.com/montoux/lein-less and now leiningen says java.lang.RuntimeException: Unable to resolve symbol: some-> in this context
05:17EmpperiI have JDK 8, leiningen 2.5.0 and Clojure 1.6 as dependency
05:17Empperiso, wtf
05:25justin_smithEmpperi: maybe the lein-less clojure dep is somehow overriding yours?
05:25clgvEmpperi: what clojure version does "lein deps :tree" report?
05:26justin_smithalso, try ##(clojure-version)
05:26lazybot⇒ "1.7.0-alpha1"
05:28Empperilet's see
05:29Empperi[org.clojure/clojure "1.6.0"]
05:29Empperifrom lein deps :tree
05:30Empperiso like I said, wtf :)
05:49Empperitried that plugin in an empty project, same error
05:50justin_smithso you get the error instead of any kind of repl coming up or anything?
05:50Empperiit breaks on 'lein less' and if I add the hook then on 'lein <anything>'
05:50justin_smitherr, instead of compiling your css
05:51Empperiand yes, it breaks completely and refuses to work at all
05:51Empperialso emptied my ~/.lein/profiles.clj to be sure
06:21clgvEmpperi: are the other clojure.core functions/macros accessible?
06:21clgvEmpperi: if not, you might have done something similar as (in-ns 'the.ns) where the namespace was not loaded and clojure.core was not referred
06:22Empperiour clojure 1.6 project code compiles and runs just fine
06:22Empperiit's just that plugin
06:22Empperibut bbl, meeting
06:29hydoIs there any form of chant or interpretive dance that will let me get the value of an enum who's name has a dot in it? defined as Enum<LongThing.LongerThing> so I'm looking to get LongThing.LongerThing/BLAH
06:30hydoI can't come up with more combinations of . and / to try.
06:39justin_smithhydo: is it an inner class thing?
06:39clgvhydo: is that enum "LongerThing" defined inside a class called "LongThing"?
06:39clgvhydo: then it would be LongerThing$LongThing
06:39justin_smithLongThing$LongerThing
06:39clgv:P
06:40clgvjustin_smith: where are the other heads of the hydra? ;)
06:40justin_smithhaha
06:40hydo$, eh? time for reading. Thanks!
06:41clgvhydo: I fear there is not much to read
06:42clgvhydo: that's just the inner class naming convention of the Java compiler
06:42justin_smiththe vm, surely?
06:43Bronsajustin_smith: no, the jvm has no notion of inner classes
06:43justin_smithoh, interesting
06:43clgv:D
06:43Bronsafoo$bar is just a regular class. it's javac that munges foo.bar in foo$bar and gives it the semantic meaning of inner class
06:43clgvso humm - are private inner class accessible without reflection then?
06:44clgv*classes
06:47Bronsa,(class (java.util.Arrays/asList (object-array [1 2])))
06:47clojurebotjava.util.Arrays$ArrayList
06:47Bronsa,java.util.Arrays$ArrayList
06:47clojurebotjava.util.Arrays$ArrayList
06:48Bronsaclgv: ^ it's declared as private in j.u.Arrays
06:48Bronsaclgv: you just can't construct it because the constructor is private
06:48clgvBronsa: ah ok. thank you
06:49Bronsathe funny thing is that since the jvm has no notion of inner-classes, java has to add weird methods/fields to inner/outer classes in order to allow an inner classes to access the outer class private/protected fields
06:50clgvBronsa: but code in the j.u.Arrays class is allowed to use that private constructor of j.u.Arrays$ArrayList?
06:50Bronsayeah
06:50clgvwhat a mess ;)
06:52m1dnight_add-message! already refers to: #'meta-clojure.actors/add-message! in namespace: meta-clojure.api, compiling:(api.clj:1:1)
06:52m1dnight_am I interpreting this right?
06:52Bronsahow are you interpreting it? :)
06:52m1dnight_"while compiling api.clj I found a definition for add-message! but this function is already defined in meta-clojure.api
06:53clgvm1dnight_: better use :require with an alias instead of :use
06:53m1dnight_yes, I'm in the process of refactoring but this error seems odd to me :p
06:53clgvm1dnight_: plus "you told me to refer it here and I (the compiler) can only bind one of the values to that symbol, hence I choose the newest"
06:53Bronsam1dnight_: the meat of the issue is that you have (ns meta-clojure.actors) (def add-message!) (ns meta-clojure.api (:use meta-clojure.actors)) (def add-message!)
06:54m1dnight_oooh, now I get it, I think
06:54Bronsam1dnight_: i.e. add-message! is bound to meta-clojure.actors/add-message! in the namespace meta-clojure.api and you're trying to rebind it to #'meta-clojure.api/add-message!
06:54m1dnight_yes, I get it! :)
06:55m1dnight_thanks a lot guys
07:27m1dnight_fieuw, that was a big refactor :p
07:28m1dnight_from 1 1k lines file to 5 files
07:58m1dnight_hrm, if a namespace Y requires a namespace X :as f which contains function foo. an other namespace Z requires Y :as y. Then it's normal that you can call y/foo?
07:58luxbockm1dnight_: I don't think that should work
07:58Bronsam1dnight_: no
07:59m1dnight_how on earth..
07:59Bronsam1dnight_: you might have stale definitions in your namespace, tried reloading the repl?
07:59m1dnight_I'm doing "lean clean && lein run" everytime, so that should be fine
08:00m1dnight_and the crazy thing is, it actually *works*
08:00m1dnight_i'll inspect some more, brb
08:03m1dnight_hrm, my bad, I was working on an old file in emacs
08:05brainacidhello all im new to Clojure
08:07Bronsabrainacid: hi -- there's no need to present yourself every other day though
08:11brainacidBronsa, hey i feel like letting everyone know again lol
08:11brainacidi can leave
08:59brainacidhey
08:59brainacidim misunderstand this math process
08:59brainacid120 / 60 = 2
08:59brainacid110 / 60 = 1.xx
09:00brainacidmy logic is wrong here
09:00brainacid(/ 60(+ 30(* 2(* 5(+ 4 4.))))) 'min
09:00brainacidi tried
09:00brainacid(+ 30(* 2(* 5(+ 4 4(/ 60.)))))
09:00clgvbrainacid: you can eval via the bots here ##(/ 5 3)
09:00lazybot⇒ 5/3
09:00brainacidmaybe i need to learn more
09:00brainacidclgv, oh ok
09:00clgv,(/ 5.0 3)
09:00clojurebot1.6666666666666667
09:00clgv,(double (/ 5 3))
09:00clojurebot1.666666666666667
09:00brainacid,(+ 30(* 2(* 5(+ 4 4(/ 60.)))))
09:00clojurebot110.16666666666667
09:00brainacid,(+ 30(* 2(* 5(+ 4 4(/ 60.)))))
09:00clojurebot110.16666666666667
09:01brainacid,(/ 60(+ 30(* 2(* 5(+ 4 4.))))) 'min
09:01clojurebot0.5454545454545454
09:01brainacidsee thats not what i need
09:01clgvbrainacid: what is the problem? can you describe it in words?
09:01brainacid1.833
09:01brainacidyes indeed
09:02daniel`,(/ 60 (+ 30 (* 2 (* 5 (+ 4 4.)))))
09:02clojurebot0.5454545454545454
09:02machty,(+ 1 2 3 4)
09:02clojurebot10
09:02brainacid4 seconds positive contraction + 4 seconds negative resistance of 5 repetitions for 2 sets + a 30 second break after set number 1
09:02brainacidthe result is 110 seconds total time to execute both sets of 5 reps
09:03brainacidi want the result (110 s) to be in min
09:03brainacid1.83 minutes total time
09:03brainacidi love playing with this type of programming
09:03clgv,(quot 110 60)
09:03clojurebot1
09:03brainacidmuch more rewarding than assmebly and C
09:03clgvah not rounded down.
09:03brainacid. (quot 110 60.)
09:03brainacid.(quot 110 60.)
09:03daniel`,(+ 30 (* 2 (* 5 (+ 4 4))))
09:03clgv,(/ 110.0 60)
09:03clojurebot110
09:03clojurebot1.8333333333333333
09:04brainacidthaks clojurebot
09:04daniel`,(+ 30 (* 2 (* 5 (+ 4 4))))
09:04clojurebot110
09:04clgvbrainacid: the 60 is at dividend position in your expression
09:04daniel`,(/ 60 (+ 30 (* 2 (* 5 (+ 4 4)))))
09:04clojurebot6/11
09:04brainacidyes i realize that
09:04daniel`,(/ (+ 30 (* 2 (* 5 (+ 4 4)))) 60)
09:04clojurebot11/6
09:04brainacid,(+ 30(* 2(* 5(+ 4 4(/ 60.)))))
09:04clojurebot110.16666666666667
09:05brainacidthat dont help either
09:05brainacidi meant what i did da
09:05brainacidi meant what i did daniel`
09:05clgvbrainacid: (/ x y) => x/y
09:05brainacidyes clgv
09:05brainacidthanks daniel` !!!!
09:06brainacid,(/ (+ 30(* 2(* 5(+ 4 4)))60.))
09:06clojurebot0.0058823529411764705
09:06brainacidnope
09:07brainacid,(quot(+ 30(* 2(* 5(+ 4 4))))60.)
09:07clojurebot1.0
09:07daniel`brainacid: your spacing is a little unorthodox
09:08daniel`,(/ (+ 30 (* 2 (* 5 (+ 4 4))) 60.))
09:08clojurebot0.0058823529411764705
09:08brainacidthanks daniel`
09:08brainacidhate whitespace
09:08brainacidlol
09:08daniel`makes it harder to read
09:08daniel`for me, anyway
09:08brainacidhehe really, read what? this syntax is so easy women can code
09:09daniel`ok brainacid :)
09:09brainacidi can add spaces since this is a community effort daniel` i dont mind really just bein funny
09:09brainacidmmm i cant seem to crack this one
09:09brainacidmind you i started with it this morning never seen or even heard of LISP
09:09brainacidlol
09:09brainacidClojure I mean
09:10clgvbrainacid: you got one of the books? or you are going through some online material to learn clojure?
09:11brainacidlol
09:11puredangerbrainacid: sexist remarks here are not ok; it wasn't funny.
09:11brainacidclgv, i have several reference materials plenty for now
09:12brainacidpuredanger, got it. wasnt meant to have a sexist tone, im a genderless type, bi.. so lighten up its just strings of bytes and binary, i wouldnt say it in a group to offend anyone
09:12puredangerwell, it offended me.
09:12brainacidanyone forgive me puredanger
09:13brainacidi will be more aware of my humor
09:13puredangerthx
09:13brainacidno problem thanks for being honest
09:13brainacidnot here to cause issues, although i am an intense guy
09:13brainacid:)
09:16brainacid,(/ (+ 30 (* 2 (* 5 (+ 4 4 )))) 60. )
09:16clojurebot1.8333333333333333
09:16brainacidyay
09:20puredangeryou can use quot instead of / to avoid fractional return
09:20puredanger,(quot (+ 30 (* 2 (* 5 (+ 4 4 )))) 60 )
09:20clojurebot1
09:20puredangerok, maybe not in this case :)
09:25zoti've got a function that feels like it should have a simpler solution: compact (sometimes) consecutive numbers into ranges https://gist.github.com/anonymous/7765e88806e0c3fae6aa
09:25zotis there a smarter way to do this in clojure? it feels like there's some magic goo that would make it smaller and more readable. but i don't see it yet :)
09:26joegallominor tweak:
09:26joegallouse a vector internally and conj (rather than cons)
09:26joegallothen you can skip the reverse at the end
09:28clgvzot: for these cases a reduce with more "state" than just the result value would be more natural.
09:29zotjoegallo: i had been under the impression that getting last val from a vector was bad practice. not sure where that came from.
09:29zotclgv: in other words, propogating the last value at each round?
09:30clgvzot: but you'd need to do that by a loop-recur which will be pretty verbose. the transducers approach with "volatiles" would be suitable
09:30zotyeah, i was just writing loop-recur to see hwo long it is :) although i've seen the vid, i haven't played w/ transducers yet.
09:30clgvzot: e.g. see "take" in 1.7
09:36clgvzot: though you can come up with a reduce like macro for cases as this
09:37zotclgv: i don't have a clear idea of how that would look. you know of an example macro?
09:40clgvzot: I got specific ones in my private code base. I think zach tellman had something similar in one of his libraries
10:25stuartsierrazot: Calling `last` on a vector is O(n) in the size of the vector, but `pop` is O(1) and returns the last element.
10:25zotstuartsierra: perfect :)
10:33clgvstuartsierra: you mean `peek`, right?
10:34stuartsierraclgv, zot: yes, I meant `peek`, sorry
11:11donbonif_anyone knows why (and) return true?
11:12clgvdonbonif_: it is the base case for "and" and mathematically sound to do so
11:12suppilike (+) returns 0 :)
11:13donbonif_and (or) nil :)
11:14suppii wonder why not false
11:15clgvsuppi: since every recursion on and would be false if the base case return false
11:16clgvsuppi: and is "neutral" to true.
11:16clgv,(= (and (even? 2) (odd? 3)) (and (even? 2) (odd? 3) true) )
11:16clojurebottrue
11:17clgvsuppi: mathematically speaking "true" is a neutral element with respect to "and"
11:17clgvsimilar as 0 is the neutral element wrt to +
11:17donbonif_clgv: and the or and the nil?
11:18suppiclgv, i meant why does (or) returns nil instead of false
11:18clgv,(or)
11:18clojurebotnil
11:18suppinot (and) :)
11:18clgvnil aka false is neutral element wrt. "or"
11:20suppiare nil and false interchangeable?
11:21justin_smithnot totally
11:21justin_smith,(cons 1 nil)
11:21clojurebot(1)
11:21justin_smith,(cons 1 false)
11:21clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Boolean>
11:21clgvsuppi: for logical expression yes, they are both "falsey" while everything else is "truthy"
11:21moquistLookup refs work as parameters to Datomic queries, but http://docs.datomic.com/identity.html#lookup-refs says they "cannot" be used.
11:21moquistE.g., this works: (d/q '[:find ?lr ?val :in $ ?lr :where [?lr :my-attr ?val]] db [:my-attr "my-val"])
11:22moquistAre lookup refs intentionally allowed as parameters to d/q, or am I perhaps just misunderstanding something?
11:24justin_smithmoquist: does it use the [:my-attr "my-val"] in any way?
11:24moquistjustin_smith: Yes, and returns it in that form, as well.
11:28moquistI get back: #{[[:my-attr "my-val"] "my-val]}
11:28moquistWell, quoting mistake, there. But you get the idea.
11:28martinklepsch,(letfn [(beep [s] (println "beep" s))] (beep "bop")
11:28clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
11:28martinklepsch,(letfn [(beep [s] (println "beep" s))] (beep "bop"))
11:28clojurebotbeep bop\n
11:28martinklepschlearned about letfn today
11:29justin_smithmoquist: based on my reading, datomic/q will use [:my-attr "my-val"] as a data source when provided in that way, not as a query
11:30justin_smith"datomic.api/q ([query & inputs]) Executes a query against inputs. Inputs are data sources e.g. a database value retrieved from Connection.db, a list of lists, and/or rules."
11:30justin_smithso it would be using your vector as an extra rule or dataset
11:32moquistjustin_smith: Right, but the vector is being used as a lookup ref to match the only clause to the specified entity. I don't see any other way it could be working.
11:34clgvwhich "friend" workflow is commonly used for webservices (REST)? I used the interactive workflow for web applications so far
11:34moquistSo to put my question more accurately: Are lookup refs intentionally allowed as inputs to d/q, and thereby intentionally available to match the entity position in d/q clauses?
11:39stuartsierramoquist: Datomic query does not support lookup refs in the query syntax. They might happen to work as query inputs.
11:40moquist[nod] I did verify that a clause like [[:my-attr "my-val"] :my-attr ?val] was unhappy. Should I avoid using them as query inputs?
11:40stuartsierramoquist: I would recommend not using them, yes. Anything that isn't documented isn't guaranteed to remain the same.
11:41moquiststuartsierra: OK, that's the answer I was expecting. Cool.
11:41moquiststuartsierra, justin_smith: thx!
11:42stuartsierramoquist: I think `entid` will give you the entity ID from a lookup ref.
11:44moquiststuartsierra, justin_smith: http://docs.datomic.com/query.html#sec-8 shows that lookup refs are intentionally allowed as inputs for resolution in the V position. That's interesting.
11:48stuartsierramoquist: OK, then I'm wrong. :)
11:48EvanRis there an easy way to define throwables, new exceptions without gen class
11:48moquiststuartsierra: Heh. So does this imply the E position is safe, too? :)
11:49stuartsierramoquist: I think so, yes. You just can't embed a lookup ref in the query syntax (there's no need).
11:49daniel`clgv: i wrote my own, similar to interactive form but without all the redirects
11:50daniel`basically made a session 'resource', POSTing to /session beings a new one and returns the logged in user
11:50daniel`beings = creates
11:51daniel`was heavily inspired by https://github.com/marianoguerra/friend-json-workflow
11:51clgvdaniel`: is that availables as lib?
11:52moquiststuartsierra: Even cooler. :-) Do you think a small docs amendment might be good, to clarify this at http://docs.datomic.com/identity.html#lookup-refs ?
11:52daniel`clgv: yes but its pretty small, i chose to copy the relevant bits and adapt it slightly
11:52stuartsierramoquist: I'll mention it to the Datomic folks.
11:52moquiststuartsierra: thanks!
11:55EvanRdatomic information of some sort, i should probably copy this whole conversation
11:56daniel`clgv: for one thing, im using transit over json
12:30vermawhat's the recommended approach if I want to make my compojure handlers async (e.g. return a chan), I looked at ring-async, but for some reason it only handles the body and not the headers and status code etc (these still need to sent back sync-ly). HTTP-Kit looks good too, but I was wondering if there's a simpler way that people generally prefer?
12:39OscarZverma, i was going to experiment with something like that too.. im not sure if its a good idea though.. maybe someone can chime in
12:40OscarZthis is maybe related to that: http://stackoverflow.com/questions/20534833/is-it-sane-to-use-core-async-channels-to-consume-http-kits-post-results-in-cloj
12:40OscarZran into that while googling
12:53joobusverma: have you looked at aleph?
12:54joobushttps://github.com/ztellman/aleph
12:54joobusverma: ztellman lurks here if you have questions about it
13:02justin_smithverma: it would seem like you would want to return headers/status sync, and then send a websocket for async. There is a separate concept of async request handlers one the server side, which isn't neccessarily about websockets. Both aleph and httpkit do both via netty.
13:02justin_smiths/one/on
13:04llasramI know many of the old hands here are using frozen versions of the Emacs Clojure tooling, but more discussion -> feedback-solicitation on the recent clojure-mode threading macro indentation change: https://github.com/bbatsov/clojure-style-guide/pull/96
13:08hiredmanno
13:08hiredmanI refuse to be part of any that legitimizes that project
13:08llasramLegitimizes which project?
13:09hiredmanbbatsov's style guide
13:11llasramBy "legitimize" I take you to mean "participate in it as a prescriptive declaration of how Clojure code should be formatted"
13:11llasramWhich I agree with
13:11llasrambut bbatsov is maintaining clojure-mode, and is using the style guide to inform how clojure-mode acts
13:12llasramAND has claimed that he wants the style guide to reflect community standards
13:12llasramIf that's true, then it seems worth at least attempting to push in a descriptive direction, capturing the most common actual practices within the community
13:14hiredmanllasram: I don't see that
13:15llasramhiredman: Don't see which?
13:15hiredmanllasram: e.g. all the comments on the pr are "this is how everyone does it" to which the response is "I don't care how everyone does it, this is how I have decided it should be"
13:16llasramI was referring to this comment: https://github.com/clojure-emacs/clojure-mode/issues/265#issuecomment-67657754
13:17llasramHis responses on the style guide PR thread seem mostly in line with what he perceives as another instance of an established principle
13:17hiredmanhttps://github.com/bbatsov/clojure-style-guide/pull/96#issuecomment-67654611
13:17hiredman'I really don't believe that "that's how it was done so far" is the best argument, however.'
13:18hiredmandefinitely not a formalization of existing practices
13:18hiredmanjust whatever the hell bbatsov thinks is logical today
13:18llasramI think further discussion is important to establish that the consensus is against him in this case. If he doesn't agree, *then* it's clear that he isn't actually interested in consensus
13:19hiredmandealing rational with revolutionaries claiming to act for the people has not gone well historically I think
13:20llasramWell, I'm saying let's not put the cart before the horse, throw the baby out with the bathwater, etc
13:20llasramLet's try rational discussion first
13:20EvanRso if i want to use a state of some sort during my pure function body, i use an atom?
13:20llasramIn this case I do not expect the delay caused by such discussion to result in my subsequent execution :-)
13:21llasramEvanR: contradiction? If you want a pure function, all "state" should be passed in as an argument
13:21EvanReh no, its a pure function which uses internal state for its implementation
13:21justin_smithllasram: well, something can be effectively pure if no state leaks between invocations
13:22llasramAh, I see.
13:22justin_smithEvanR: unless the one function ever involves mutltiple threads, or values that persist between invocations, you can even use a java mutable array safely
13:22EvanRi saw the state monad stuff and im apprehensive about it
13:22llasramEvanR: If you can't do it functionally via e.g. recursion, then an atom is certainly the most common practice in Clojure
13:22EvanRok
13:23EvanRits possible to do it by returning updated states but its clunky
13:23EvanRor maybe not?
13:23justin_smithllasram: I think it's provable that you can do it with recursion - but an array or an atom can perform better
13:24EvanRthe atom api is convenient for describing how you are changing the state
13:24llasramAlso, Clojure 1.7 is going to have a new "volatile" type, optimized for thread-local constrained mutation
13:24justin_smith but I still say, unless the one function call leaks the state, or involves threading, an array is better because it's faster and fills the same role
13:24llasramjustin_smith: fair enough
13:24EvanRjustin_smith: like, array of one value, the state?
13:24justin_smiththere's a ztellman lib for this (you could probably derive that from first principles though)
13:25justin_smithEvanR: yeah
13:25EvanRthats some macguyver shit
13:26EvanR(wow that reference is so old now)
13:26justin_smithEvanR: the only reason to use a state instead of recursion is for something that is faster as state, and an array of one element will be faster than an atom.
13:26justin_smithsomething that is faster as state, where speed really matters* of course
13:27EvanRrecursion is easy, keeping the update states straight during multiple recursive calls is obscuring the algorithm
13:27TimMcevery.damn.lib.util.Box
13:27EvanRthats where im interested, the less and clearer code
13:29EvanRjustin_smith: also just out of curiosity, using a java array to implement a pure function should work concurrently right?
13:29hiredmanTimMc: clojure already has a clojure.lang.Box
13:29TimMcyup
13:29EvanRsince its a new java array each time
13:29EvanRnot shared
13:29hiredmanso, like, why would every util have that?
13:30justin_smithEvanR: as I said, as long as you don't leak the representation to other calls / other threads
13:30TimMchiredman: Because not every library for the JVM uses Clojure. Yet.
13:30TimMc(I was speaking more generally.)
13:31justin_smithI'd never noticed c.l.Box before, probably a better option than a one element array for that contained mutation case
13:37hiredmanllasram: I did actually start commenting on the issue, but decided I was too angry about it to type something in to an issue
13:37hiredmanhttps://gist.githubusercontent.com/hiredman/77bd4cde0d3d401f8b88/raw/40e2fdece015a625fd0fc2935a844786b4aa9b1a/gistfile1.txt
13:40llasramhiredman: Are you intending to post later when calmer?
13:40hiredmanno
13:41hiredmanthe whole situation is incredibly frustrating, why would I be calm about it?
13:41EvanRdont think about it too much when reading responses to github issues
13:41EvanRnot good for your health
13:41llasramIt's not entirely clear to me that bbatsov is how much friction he's generating. I'd hope that comments from long-standing and active members of the Clojure community would help
13:41llasrams,is how,is aware of,
13:42llasramIf they don't help and he continues to manage such critical projects in disruptive fashion, then it provides valid reasons for a fork
13:46hiredmanit should be forked now, I want to evaluate switching to https://github.com/sanel/monroe to get away from cider but I am busy and the lock to the sha has worked fine so far
13:46alandipertis it weird/bad that 1.7.0-alpha4 is the latest RELEASE as far as mavens are concerned? https://repo1.maven.org/maven2/org/clojure/clojure/maven-metadata.xml /cc puredanger
13:47puredangerno?
13:47clojurebotno is tufflax: there was a question somewhere in there, the answer
13:47puredangerclojurebot: shaddup
13:47clojurebotPardon?
13:47puredangerworse than my kids
13:48hiredmanclojurebot: clojurebot |is worse than| puredanger's kids
13:48clojurebotAck. Ack.
13:48puredangergood grief
13:48EvanR,(let [[a b] nil] a)
13:48clojurebotnil
13:48puredangeralandipert: I think the only place where this would matter is if you are including org.clojure/clojure w/o a version (which seems like a bad idea)
13:53puredangerllasram: re your volatile comments 20 m ago (was eating lunch)… I would quibble slightly re volatile that "thread-local constrained mutation" should really be "thread-confined mutation". Volatiles (being volatile) are safe to use across threads but introduce race conditions if used from multiple threads at the same time. As long as that stuff is confined to one thread at a time (possibly even a changing thread), then
13:53puredangeryou've eliminated that.
13:53llasrampuredanger: yep. A actually thought about correcting myself as soon as I'd said it, but then got distracted :-)
13:54puredangernp
13:54puredangerPedantics R Us ;)
13:58puredangerjust for the record, I like my kids a lot :)
13:58justin_smithI'm glad you clarified that you like them more than clojurebot
13:59llasramI'm actually not sure that's what just happened
13:59puredangerI do. :)
13:59llasramBy induction I'm inferring that he really *really* like's clojurebot
13:59puredangerI like clojurebot too
13:59llasramAh. puredanger isn't a consistent system. Oh well
13:59llasram;-)
13:59puredangerI'm surprised that this is news :)
14:00hiredmanI need to add worse than support to clojurebot's inference so it can infer that puredanger's kids are better than clojurebot
14:00llasramYes!
14:00EvanRletfn, a refreshing oasis in a desert of non-recursive lets ;)
14:01TEttinger2I'm trying to add back a search to clojurebot.
14:01TEttinger2,(with-open [readerurl (clojure.java.io/reader "https://duckduckgo.com/html/?q=\\panda%20site:wikipedia.org&quot;)] (pr (line-seq readerurl)))
14:01clojurebot#<SecurityException java.lang.SecurityException: denied>
14:01TEttinger2well ok
14:01TEttinger2but try that in the repl and it returns a huge seq of the wikipedia page on pandas
14:01TEttinger2but...
14:02TEttinger2(with-open [readerurl (clojure.java.io/reader "https://duckduckgo.com/html/?q=\\panda%20site:youtube.com&quot;)] (pr (line-seq readerurl)))
14:02TEttinger2would return a weird pre-redirect page
14:02TEttinger2I need to make reader follow the redirect
14:02hiredmanuse a real http client like clj-http
14:03TEttinger2i think it's already a dep
14:03hiredmanso go read the docs and use it
14:10justin_smithmonroe looks decent so far
14:17TEttinger2hiredman, same issue
14:17TEttinger2for some reason it isn't redirecting in clojure, but will in the browser
14:20hiredmanthen it isn't an http redirect, likely js, and you'll need a javascript engine
14:25expez(.loadClass cl "clojure.lang.RT") <- this fails with ClassNotFoundException, isn't this class included in the clojure jar?
14:26hiredmanloadClass is likely no the method you want
14:27hiredmanhave you read the javadoc for it? where did you get the classloader from?
14:27expezI haven't written the code that's failing, I'm trying to use alembic, which calls into classlojure which contains that failing line
14:28expezso I'm assuming I've done something stupid and neither of these libraries are at fault, for now
14:28hiredmanjust because the class is in a jar doesn't mean every classloader has access to it
14:28hiredmanso it all comes down to where cl is coming from
14:36TEttinger2hiredman, this is the javascript-less version of duckduckgo though
14:36hiredman*shrug*
14:37TEttinger2use a real don't care lib, hiredman, like libcaca
14:38vermawhy is using a promise here prefential: http://stackoverflow.com/a/20536205/73544 ?
14:38vermawe always want to block?
14:40vermawouldn't I get like free thread pooling and stuff with go blocks? and lightweight goroutines are mostly a win.
14:40vermaor is there something about promises that I don't know
14:40noonian_you can use a channel as a promise but you can have unintended consequences like blocking readers that read from the channel after its been read etc. In the future core.async will have a promise-chan which implements the desired semantics for promises like always returning the delivered value on reads
14:40vermanoonian_: nice
14:41noonian_rich hickey talks about this in his conj talk on transducers iirc
14:41vermanoonian_: hmm, will check it out
14:42vermaoh that thread is about consuming also
15:21water_bulbHi ! I'm searching web for very detailed book or tutorial for clojure new comers, programmer beginners. No success, so far. May be some of you, know ? Thanks
15:24godd2water_bulb http://www.braveclojure.com/getting-started/
15:24godd2Clojure for the Brave and True is really good
15:26water_bulbEven for me ? Who don't know that is list, touple, loops...
15:26godd2http://www.braveclojure.com/do-things/#2_7__Lists
15:26godd2It's fairly explanatory.
15:27godd2Also, you can skip the two parts about emacs if you don't use emacs. You won't miss anything about clojure.
15:28crash_epI'm having problems with Korma. I've defentity'd a few very simple tables, associated to each other with `many-to-many`. But when I write a `select` with Korma I only get back the record from the root table, not any of the joined tables.
15:28crash_epWrapping the query with `dry-run` shows the queries I would expect, and testing them at the CLI yields the records I would expect.
15:28crash_epThe joined records just don't seem to be included in the final object that korma gives me from my select call. Any ideas?
15:33bozhidarclojure-mode 4.0.1 is out
15:34bozhidarthe controversial indentation of threading forms was reverted
15:34bozhidarworld peace has been restored...
15:34llasram(inc bozhidar)
15:34lazybot⇒ 1
15:35llasramGeez
15:35bozhidarI don't usually frequent IRC, but I was pointed to http://clojure-log.n01se.net/date/2014-12-18.html#17:11
15:35bozhidarand was really disheartened by it
15:36bozhidarif you have problems with the way I manage clojure-mode and cider - please, take those issues to me (meaning their issue trackers). I don't spend that much time working on them for my personal benefit...
15:38chouserYeah, that's sad.
15:38chouserbozhidar: on the other hand, don't let that kind of talk get to you.
15:39llasramAnd now we may proceed with rational discussion and reasoned consensus
15:40bozhidarchouser: Thanks. Generally I don't, but today I got plenty of it on pretty much every front. :-)
15:40chouser:-( sorry
15:40bozhidarllasram: sure
15:41chouserFWIW, I didn't know there was controversy and am a happy cider user.
15:41kenrestivoindentation wars... just be glad you're not writing c...
15:41puredanger(inc bozhidar)
15:41lazybot⇒ 2
15:41puredangerb/c open source hard :)
15:42puredangers/open source/working with people/
15:42bozhidarI think all Clojure indentation wars should be lead here https://github.com/bbatsov/clojure-style-guide
15:43bozhidarlately I've been trying to push all major Clojure dev environments to settle on more or less the same indentation defaults
15:43bozhidarfor everyone's sake
15:43arrdempuredanger: does 1.7 ALPHA report it's *clojure-version* as 1.7 non-alpha?
15:43arrdems/'//g
15:43bozhidarkenrestivo: already did this :-)
15:44eric_normanddatomic question: I have millions of entities that are updated every hour
15:44arrdemthat would be a yes.
15:44eric_normandbut many of them don't change from one update to the next
15:45eric_normanddoes datomic store a datom each time I do an update, even if the attribute has not changed?
15:45puredangerarrdem: {:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}
15:45eric_normandif so, it means I have to do quite a bit of work to determine what has changed
15:46puredangerarrdem: the :interim flag indicates non-final release
15:46eric_normandis there a best way to do that?
15:46arrdempuredanger: mmkay. thanks.
15:46water_bulbIt would be for me better to learn first some basic programming concept and basic elements at all. But there isnt anything like that right ? Because it has to be tied with some programming language, hasn't it ?
15:46kenrestivoeric_normand: not last i checked, but it's been a year
15:46dnolen_bozhidar: I think trying to unify Clojure indentation rules this far into Clojure's existence is going to lead anywhere - there will be too much push back as you've already seen. You just need to supply knobs and leave it be.
15:47puredangerarrdem: oops, that was 1.7.0-master-SNAPSHOT! alpha4 says: {:major 1, :minor 7, :incremental 0, :qualifier "alpha4"}
15:47dnolen_s/is/isn't
15:47kenrestivoeric_normand: easy to test though, just look through the transactions and/or indexes. in fact i think i did that when i was learning datomic, to confirm the behavior, just don't remember exactly.
15:48eric_normandkenrestivo: where can I learn how to "look through the transactions"?
15:48puredangerit does not store a new value if nothing has changed
15:48arrdempuredanger: exellent that I can work with. thanks.
15:48bozhidarpuredanger: indeed :-)
15:48kenrestivoeric_normand: there's yer authoritative answer from inside of cognitect :-)
15:49puredangerDatomic stores novelty
15:49kenrestivoeric_normand: also too http://augustl.com/blog/2013/querying_datomic_for_history_of_entity/
15:49EvanRnote to self this is the datomic help channel
15:49puredanger:)
15:49puredangerthere is #datomic, but not sure it's well populated
15:49eric_normandasked there a few minutes ago with no answer
15:50kenrestivohey, it's written in clojure, nominally on topic
15:50eric_normandpuredanger: is sending millions of entities in one transaction wise?
15:50puredangerno
15:51puredangernot in that violates anything fundamental, but it's likely too chunky to be good for storage and indexing
15:51mgaareeric_normand: if you transact something that's identical to what's already there, new datoms won't be added however a new transaction entity will be created each time you do this
15:52eric_normandmgaare: thanks, that's actually just what I want
15:52puredangerusually asking on the datomic mailing list is best place to get answers about this from community or support https://groups.google.com/forum/#!forum/datomic
15:52puredangermgaare: correct
15:52mgaareeric_normand: when you transact something, part of the response (in the promise) lists all the datoms that were added
15:52puredangersorry for omitting that
15:53mgaarethat's the easiest way to see what's actually getting transacted
15:57eric_normandthanks
15:58eric_normandI guess I'll have to explicitly model an "import", which I was hoping would be taken care of by the transaction
16:00EvanRtheres capacity.html which describes hypothetical best practices for importing large amounts of data
16:01EvanRhttp://docs.datomic.com/capacity.html#data-imports
16:05tickingI was just wondering, is anybody doing robotics with clojure?
16:05arrdemgigasquid is...
16:08tickingarrdem: yeah she's doing a lot of cool stuff, but I was thnking more in the direction of "real" robotics (complex navigation, planning, expensive robots e.t.c ;D ) , which is currently pretty dominated by python and CL
16:09tickingarrdem: like you'd find in a universities robotics lab
16:09puredangerI know some local people that are using ClojureScript actually to front some standard automation protocols (can't remember the name) that are used for stuff like this
16:10bridgethillyerwater_bulb: Do you have a particular reason for starting with Clojure?
16:10puredangerthis stuff: https://en.wikipedia.org/wiki/OPC_Unified_Architecture
16:10arrdemticking: you could probably make some good headware there by taking hy or pixie and hitching a ride atop the python guys
16:10puredangercompany is http://projexsys.com/
16:11arrdemticking: but yeah all the work at UT on robotics is python :c
16:11tickingpuredanger: cool thanks
16:11tickingarrdem: yeah, does pixie interop with python though? I thought it was just written in pypy
16:12puredangerquil via processing has access to some interesting stuff too I think
16:12arrdemticking: I know there's a C FFI, but I'd be surprised if there wasn't a python one.
16:12puredangerand David McNeil did some dabbling in it http://david-mcneil.com/post/17044248397/clojure-robot-dsl
16:13arrdem#pixie-lang is the real place to ask :P
16:13puredangerand then there's the IOT crowd - Yodit Stanton etc
16:13tickingarrdem, puredanger: we're currently working on a RobotOperatingSystem library for clojure, and are quite far, so I'm starting to carefully feel if people might want to get involved :D
16:13arohnerarg. maven deps + :exclusions is ugly
16:15arohnerwhen using :pedantic? :abort in lein, and a user plugin (~/.lein/profile) pulls in a dep that gets into conflict, how can I fix that?
16:15arohnerI don't want to add an :exclusion to the user plugin, because I use it in multiple projects, and I shouldn't specify the plugin in the project deps
16:17water_bulbbridgethillyer: because for me - as a virgin programmer, should be better to get programming mindset through clojure as some functional lang, rather than python3, javascript I guess. people said, it is more enlightening, to get behavioral/thinking habits from functional. true or false ?
16:19amalloywater_bulb: clojure isn't really a great first programming language. you could read SICP (or watch the lecture series), which is a classic introductory text on programming, taught in scheme; scheme is a mostly-functional lisp, so if you wanted to transition to clojure afterwards a lot would carry over
16:20bridgethillyerwater_bulb: I’m with amalloy
16:20bridgethillyerScheme might be a better choice with the same benefits you are looking for
16:20bridgethillyerBut I wouldn’t stop you from trying Clojure if you have other good reasons for learning it
16:20puredangerRacket in particular
16:21bridgethillyerI have seen multiple people get their first exposure to programming with Clojure successfully
16:21bridgethillyerBut all of those cases involved quite a bit of handholding
16:22tickingreally, why is clojure unsuited for beginners?
16:22chouserbecause Java
16:23bridgethillyerJava, exactly
16:23bridgethillyerI personally think it’s totally fine for beginners
16:23puredangerI don't think it's *unsuited*, just that there may be gentler slopes
16:23tickingreally? but why, I though java roughly once ever two months
16:23bridgethillyerI just think Racket is so much better
16:23puredangerand I personally think Clojure is much better than say Java
16:23puredangerfor beginning
16:24mikerodif a call to java.lang.reflect.Method#invoke(Object, Object...) throws a IllegalArgumentException - but with no given reason, what might that mean?
16:25amalloymikerod: it would mean you should paste a whole stacktrace, not just an exception message :P
16:25hiredmanit means exactly that
16:25mikerodAn example of a "reason" would be: IllegalArgumentException argument type mismatch sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)
16:25amalloyticking: clojure includes a lot of features to address problems that "expert" programmers have, which are just bewildering if you haven't run into the problems they solve. something like scheme or racket has a much smaller surface area to come to grips with
16:25mikerodOk, I have a stack hah. This is 3rd party code doing some reflection
16:25hiredmanmikerod: the reason is right there in the message
16:25hiredmanargument type mismatch
16:25mikerodhard to see what is going on but a Method#invoke is failling and I noticed there was no "reason" in the stack trace
16:25hiredman^-
16:25mikerodhiredman: no
16:26mikerodhiredman: that was an example
16:26mikerodof what I want to see
16:26mikerodInstead I'm getting just the "bare" IllegalArgumentException
16:26amalloymikerod: see http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Method.html#invoke(java.lang.Object,%20java.lang.Object...) also, which lists exactly all the scenarios in which IAE might be thrown
16:26tickingyeah I agree stacktraces are the pure horror
16:26water_bulbamalloy: please may you link me that book and videos you mentioned ?
16:26mikerodamalloy: yes, but everytime I fail for those, I get a detailed reason in the stack
16:26tickingsometime I want to quit programming when I encounter a particularly horrible one
16:27mikerodamalloy: So I'm wondering if the doc string leaves out some possible other reasons it could fail
16:27mikeroddoc strings aren't *always* perfect and this is some low level impl's underneath
16:27amalloywater_bulb: http://web.mit.edu/alexmv/6.S184/sicp.pdf is the textbook
16:27hiredmanmikerod: are you sure you are looking at the root cause of the trace? the method you are calling reflectively may just throw an illegalargumentexception
16:27mikerodI'm wondering if anything with concurrency could come into play actually
16:28amalloyhttp://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001-structure-and-interpretation-of-computer-programs-spring-2005/video-lectures/ is the video lecture series from the 1980s
16:28mikerodhiredman: I am tracking down a sporadic error that doesn't seem to be deterministic
16:28mikerodit is another library using some reflection to call some Clojure anonymous functions we give it
16:28EvanRfor very beginning programmers, anything will work. including java, including c++, including php. they have the advantage of not knowing how bad these systems are.
16:28mikerodit seems to *usually* be fine for the same code and same data, but every so often it will sporadically fail
16:28hiredmanmikerod: yeah, that is likely it, what reflective method is it trying to call
16:28mikerodMostly what I have to go on is that something is wrong with the Method#invoke call sometime
16:29mikerodit is calling AFn#invoke(Object)
16:29mikerodreflectively through Method#invoke
16:29amalloymikerod: you said you had a stacktrace, right? are you going to paste it?
16:29dnolen_mikerod: it's usually helpful to gist the entire trace, someone may see something familiar
16:29hiredmanhave you looked at the source for that method?
16:29mikerodum it is a lot of details that are related to a 3rd party library using MVEL
16:29mikerodNot sure how that could be useful at this level :P
16:30mikerodI'm specifically using Drools, it is calling some anonymous Clojure functions of ours
16:30hiredmanI guess afn throws useful illegal argument exceptions at this point
16:30mikerodthe entire stack is Drools internal MVEL lib
16:30amalloyis it proprietary or something? because it's very easy to ignore stuff that isn't relevant, but very hard to guess stuff that i can't see because you think it isn't important
16:30mikerodand this error is rare
16:30dnolen_mikerod: having coded Clojure for a long time now, the I can safely say with confidence the entire trace is always useful
16:30mikeroddnolen_: I agree, but this is all Drools library, so to use the stack trace, you'd have to look at Drools source files
16:31mikerodI ahve looked at them in depth, they seem to be getting the call to Method#invoke right
16:31dnolen_mikerod: just paste the trace already :)
16:31mikerodhaha...
16:31dnolen_mikerod: otherwise nobody knows anything
16:31arrdemlol
16:31amalloymikerod: you have spent ten times as long trying to convince us we don't need it, as you would have by just pasting it
16:31chouserThat's one thing you can say for Clojure stack traces: they're better than no stack traces. :-)
16:32mikerodIt has nothing to do with Clojure, so I'd probably have to paste this trace to Drools forums. My actual question is really around any hidden reasons the java.lang.reflect.Method#invoke could throw a IllegalArgumentException other than what they have documented - specifically anything like a race condition
16:32mikerodCaused by: java.lang.IllegalArgumentException at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:1097) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMe
16:32mikerodThere is a little taste ?
16:32hiredmanmikerod: please use a pastebin
16:32amalloy~paste
16:32clojurebotpaste is https://refheap.com/
16:33dnolen_mikerod: if AFn is in there somewhere Clojure is involved somehow
16:33mikeroddnolen_: well it is failing to call the method, I'll paste it. I just doubt its usefulness. Sorry for pasting here too. I'll use the bin
16:34mikerodhttps://www.refheap.com/95170
16:35trissif I want to give some java object's the ability to have fields looked up across them would I look to protocol's to do so?
16:35trissif so which one?
16:35triss^fileds looked up across them like maps
16:36triss(i.e. (:field java-object)
16:36mikerodI will reiterate that I really am curious on java.lang.reflect.Method#invoke and if anyone has ever experienced IllegalArgumentExceptions to come from things other than what are documented in it. I thought that the stacktrace for all the known reasons I have seen IAE providing more details to what went wrong.
16:36triss(i.e. (:field java-object)
16:37mikerodtriss: I'd think you'd have to wrap them for that syntax
16:37mikerodyou could do something like "bean" on them perhaps, which uses reflection to turn them into maps
16:37mikerodlike (:field (bean my-java-obj))
16:38water_bulbwhen i will learn that sicp or lisp from your links, i will ready for clojure ? it is more lisp or java ?
16:38trisscheers mikerod
16:38llasram~lisp
16:38clojurebotlisp is the red pill
16:39water_bulb?
16:39mikerodtriss: bean will stick to stick to the java style casing though so if you had a Java bean class that had something like obj.getFirstName(), then (bean obj) would have a key :firstName
16:39llasramwater_bulb: Anyway, that depends on what you're trying to say in the above. "lisp" is either a philosophy, or some people use that word to mean "Common Lisp"
16:39kristofwater_bulb: http://www.amazon.com/Clojure-Programming-Chas-Emerick/dp/1449394701
16:40llasramClojure is a philosophy-syntax-"lisp", but is neither Common Lisp nor Java
16:40dnolen_,((fn [x] (.bar x)) (java.util.Date.))
16:40clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: bar for class java.util.Date>
16:40dnolen_mikerod: only guess is you're doing something like this ^
16:41water_bulbi'm lost then. giving up ^
16:42mikerodthe `this` argument is definitely guaranteed to be a certain type and only that type by Drools. However, it is worth me re-evaluating if I have any potential within the function call to do that.
16:42mikeroddnolen_: but don't you think if my clj function was causing the IAE I'd see some information on the clj function after the j.l.reflect.Method#invoke call?
16:43mikerodlike a part of the stack would show something from the Clojure's anonymous function class
16:43dnolen_water_bulb: after? if you mean further down the trace, yes
16:43{blake}water_bulb: It's its own thing but inclines more toward Lisp than Java. I'd say that while it uses Java, it doesn't really have much to do with Java.
16:44{blake}(Philosophically.)
16:45dnolen_water_bulb: I think Python or Racket (or Scheme w/ a book) are going to be significantly "friendlier" if you are new to programming. Clojure isn't going anywhere when you decide to give it a shot.
16:46water_bulbok thanks guy for help. meanwhile i found this. is good for me ? https://aphyr.com/posts/301-clojure-from-the-ground-up-welcome
16:46amalloyyeah, python's another solid beginner choice, although not very functional
16:46mathias__I kinda gott basics of perl quite fast
16:47justin`is there a quick way to mimic Thread/sleep in clojurescript without core.async?
16:47bridgethillyerwater_bulb: Clojure from the ground up is great
16:47{blake}water_bulb: I didn't find the books to be super helpful when starting out. That site will help a little. There are a lot of things that will help a little. But you gotta build things with Clojure to get it.
16:47bridgethillyerEither that or Clojure for the Brave and True should work
16:47amalloyjustin`: i mean, there are no threads in javascript. you have to set a timer or something
16:47amalloyyou can't block a thread
16:48justin`https://www.refheap.com/95171
16:48justin`i feel like im missing something dumb
16:48dnolen_justin`: no way to sleep
16:49dnolen_justin`: all you can do is schedule something to be called later
16:49justin`thanks guys
16:49justin_smithhow many justins can there be here, really
16:50{blake}THERE CAN BE ONLY ONE!
16:50EvanRamalloy: alert("ho ho!");
16:51jmalloywho is this amalloy fellow? i am justin malloy, well-respected fixture in this channel
16:51justin`haha
16:51{blake}Justin Time!
16:51EvanR/nick john_justin_jingleheimer
16:52godd2his name is my name too
16:53water_bulbok and last thing please. any of you use editor LightTable ?
16:55dnolen_water_bulb: if you're going to do Clojure as someone starting out, yes LT is a good thing to use
16:56water_bulbok thanks good night later
16:57EvanRlol
16:57EvanRpostpunkjustin: standing in the back?
16:57postpunkjustinEvanR: what?
16:57EvanRnothing
16:58postpunkjustinOh, it's a Justin thing
16:59postpunkjustinI sometimes flatter myself by referring to justin_smith as my co-Justin
16:59mikerodI found something about the IAE I get from java.lang.reflect.Method#invoke. I wondered why it provides no information about what went wrong. Well it is the part in the stack about sun.reflect.GeneratedMethodAccessor15. That is an optimized path for a method that has been called reflectively many times already. It doesn't report details like the method is wrong for the object tyep or the arg list types etc are wrong.
17:00justin_smithpostpunkjustin: I'll take that as a compliment (rimshot)
17:00mikerodJust to close off that question for anyone who was interested. I'm thinking now that I just have something wrong with what this reflection is callng and I'm getting bad stack trace due to JVM optimizations.
17:00mikerodI appreciate the advice and the lectures about stack traces. I'll do better with that next time. :P
17:01arrdem#clojure |is| stacktrace or why are you asking
17:02mikerodarrdem: I thought this was a special case. but there are no such things.
17:03jmalloymikerod: in fairness, this time the stacktrace ended up being pretty useless
17:03mikerod(inc jmalloy)
17:03lazybot⇒ 1
17:03jmalloybut it's not a good idea to trust the person asking for help
17:03mikerod:P
17:03mikerodyes I agree
17:03mikerodon trusting the person helping*
17:14numbertendoes core.cast actually cast values? the documentation makes it seem like it just checks whether or not the value could be cast
17:15numberten,(-> (cast Object 1) type)
17:15clojurebotjava.lang.Long
17:15jmalloynumberten: that's the only kind of casting that makes any sense in a dynamic language
17:15numbertenI see
17:15jmalloyuhhhhhhhhh, you would get that same result in java, even. ((Object)1).getClass() => Long
17:16numbertenah yea
17:16jmalloyclass, type, getClass: these all return the actual runtime type, not the type the compiler knows
17:16numberteni see
17:16justin`Hi all. Having trouble getting timeouts to work with this code: https://www.refheap.com/95172 I feel like I'm missing something dumb
17:16numbertenif I wanted to call Object's .getString on a value instead of the values own overloaded .getString, how would I do that?
17:17jmalloynumberten: do you mean toString?
17:17justin`it's waiting a second then running the whole loop instead of pausing between each iteration
17:17justin`Ah woops wrong room
17:18jmalloythere's no way to do that. the jvm's class system is designed to not do that. why would you want to do that? to get its hashcode?
17:18numbertenyeah toString sorry
17:19amalloybeing justin wasn't as cool as i expected
17:19numberteni have a big map that's being printed and I thought if it were easy, calling Object toString would be an easy way to get less verbose logging
17:22amalloyi mean, object's toString is pretty useless, right? if you want less verbose logging, and are happy with the output from Object/toString, you might be just as happy with (rand-int Integer/MAX_VALUE)
17:23numberteni'm not in control of the printing code
17:23numbertenonly what value gets passed to it
17:23amalloythen you definitely can't change how an object prints itself
17:24numbertenalright
17:25nwolfeCouldn't you pass in a custom object that implements .toString to print the original thing better?
17:26nwolfeThat seems too easy, I must be misunderstanding something :D
17:26numbertenyeah that is what I was about to do
17:26numberteni've never made custom objects in clojure before
17:27numbertenbut i guess now is a good time to learn :)
17:27nwolfeYou could write it in Java
17:27numbertenlet's not get ahead of ourselves..
17:27nwolfeHa, I thought you were saying you knew Java but not Clojure
17:28numbertennot really
17:28numberteni know some java, but I'd rather not have to code in it for this. iirc you can create new types in clojure
17:30nwolfeSure, whichever is best. I might start with a Java implementation so I can focus on the printing part without getting caught up in the Clojure-Java at the same time.
17:30numbertenyea
17:36noonianif the object you want to print differently is map-like then records seem to fit the bill pretty well
17:54dnolen_release ClojureScript 0.0-2498, added use-fixtures support
17:54dnolen_released
18:09bridgethillyerdnolen_: thanks!
18:30dnolen_bridgethillyer: np!
19:51arrdemGrimoire 0.4.0-ALPHA5 up for testing! http://next.conj.io/
19:52arrdemHTTP API also in alpha: http://next.conj.io/api/v0?op=groups
19:53andyfarrdem: Thanks for cheatsheet updates. Any reason for me to wait on publishing them?
19:54arrdemandyf: as you can see by clicking on the API url, 0.4.0 is still _very_ alpha :c
19:54arrdemandyf: should be done this weekend tho..
19:55andyfOk. If you remember, send me a msg when you want me to update
19:55arrdemwilldo.
19:56arrdemkeeping the cheatsheet up to date is high on my checklist :P
20:28imsorryHi! Has anyone written some emacs lisp to evaluate the sexp your cursor is in with CIDER?
20:28imsorryFor example, if I had (foo | arrg1 arg2 ....)
20:29imsorryand I called the function it would evaluate the (foo arg1 arg2 ...) sexp
20:29amalloyimsorry: (save-excursion (paredit-forward-up) (cider-eval-last-expression))?
20:30imsorryamalloy: oh thanks! you've helped me before as well!
20:30imsorryamalloy: you told me about autocomplete in the IRCs
20:30amalloyi mean i just made that up, there is probably some issue, but that's the general idea
20:30amalloyhah
20:31amalloyglad to see it seems to have stuck
20:36scottjimsorry: here's one you could adapt if you want it to work for cider and emacs-lisp. could probably change up-list+ to up-list since I think it has been patched now.
20:36scottjoh link http://jaderholm.com/paste/eval-parent-sexp.html
20:37imsorryscottj: thanks!
20:41amalloyscottj: what's the nil there for, in the else clause?
20:41scottjamalloy: documentation failure :)
20:43scottjeval-last-sexp (for lisp-mode) takes a non-optional arg eval-last-sexp-arg-internal, which I'm guessing gets handled by whatever P is in
20:43scottjinteractive.
20:45scottjI guess it's for not printing output to current buffer
20:45amalloyi think P is point
20:46scottjanyway, if cider-eval-last-expression is like slime, I'm guessing it diverges from the lisp-mode one in not taking an arg
20:46amalloyoh, no, it's prefix arg
20:46emaczenIs there a two-way data-binding web framework for clojure?
20:48imsorryamalloy: scottj Thanks a bunch! I got it working!
23:06xnilany folks from boston in here? i'm moving sometime in the near-to-semi-near future from rural georgia and am looking for some people to chat with in the area on clojure and other tech stuff
23:11rritochxnil: I've seen programmers from boston here but your more likely to reach them week-days.
23:12xnilthanks!