#clojure log - Dec 19 2014

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

2:52 hydo: Is 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.

2:53 aside from starting the app through the repl. I'm writing a plugin, sadly, or I would have tried that.

2:56 H4ns: what 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.

2:57 i'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?

2:59 stain: H4ns: let me just stop you there fore a moment.. why are you receiving IDs from an external source?

3:00 H4ns: stain: these ids are coming from database sequences and are used as row keys.

3:01 ah, agent + promise seems like a nice way to go about

3:02 stain: ,(str (java.util.UUID/randomUUID))

3:03 clojurebot: "8485b6bd-3831-479c-ac72-1a0f72c4840a"

3:03 H4ns: stain: i need to allocate the ids using the database sequence generator.

3:03 stain: why? :)

3:03 H4ns: stain: because i am interacting with an existing system.

3:04 stain: those damned existing systems!

3:04 H4ns: stain: they're part of the job

3:06 stain: hm.. but a promise is only a single value, isn't it?

3:07 isn't this just a queue?

3:08 H4ns: yes, it is just a queue with something on the other end that refills it upon exhaustion

3:10 agent + promise would basically be used to implement what a queue + actor would be in a system that had queues and actors :)

3:10 stain: when I hear these things I get a strong fear for that "other end" to just not be there anymore..

3:10 H4ns: i thought the point of clojure was that it took away the need for fear when dealing with concurrency

3:10 stain: but you said "database" :)

3:11 H4ns: ok. agent + promise it is unless someone can suggest something more idiomatic :)

3:12 stain: but they won't be chunked up in advance.. it's just a background job which return value you check later.

3:13 probably what you want as longa s you have something to do before you do that "check later" bit

3:13 Fare: agent is for mutual exclusion to db access?

3:13 H4ns: Fare: for mutual exclusion to sequence access, to be more exact

3:14 Fare: doesn't the db already provide exclusion for that?

3:14 stain: so how do you get hold of the promise then?

3:14 Fare: most dbs offer that kind of service already

3:14 H4ns: Fare: it does, but i need to cache ids in order to avoid too many db interactions.

3:14 stain: do you make it and then send it to the agent?

3:14 H4ns: stain: the client sends the promise to the agent, the agent fulfills it.

3:15 Fare: oh, ok, makes sense, kind of

3:15 stain: H4ns: yeah, that should work fine.. and you just fill a buffer-kind in a while-loop

3:15 within the agent

3:15 and throw away any wasted seqeuences on JVM exit?

3:15 H4ns: stain: right, no harm done by that.

3:16 Fare: (as in, that's clearly for interacting with legacy db rather than some more modern design.)

3:16 H4ns: Fare: correct.

3:16 Fare: in fact, the problem would be the schema, not so much the db. but i inherited that.

3:17 Fare: can't migrate, because other clients?

3:18 H4ns: Fare: legacy all over

3:19 stain: H4ns: 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)

3:20 H4ns: stain: right, thanks - we'll have to deal with that in our command line wrapper

3:21 then again, as we System/exit anyway, we don't really need to care :)

3:21 stain: hehehe

3:22 that legacy database might..

3:22 H4ns: a database that cares about such things does not deserve the name "database"

3:28 amalloy: hydo: 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

3:33 luxbock: is there an equivalent to the IPrintWithWriter protocol of CLJS in regular Clojure?

3:35 I 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

3:35 amalloy: luxbock: you probably want print-method

3:35 Empperi: heads up, critical security vulnerability found from both Git and Mercurial https://github.com/blog/1938-git-client-vulnerability-announced

3:36 http://mercurial.selenic.com/wiki/WhatsNew#Mercurial_3.2.3_.282014-12-18.29

3:36 luxbock: amalloy: thanks

3:36 H4ns: promise + agent work very nicely: https://www.refheap.com/95150

3:43 luxbock: amalloy: can I access the regular print-method somehow, so that I can pass my record with that noisy key removed?

3:44 amalloy: luxbock: it's just a multimethod. call it with whatever you want

4:15 TheTeapot: Hey, I am getting a massive error when I run `lein repl`, can anyone help?

4:15 It's to do with "Could not transfer artifcat org.clojure:clojure...."

4:15 andyf: TheTeapot: Depends on what the error is. Have you copied it into a paste somewhere?

4:16 TheTeapot: I'll sprunge it

4:16 andyf: Also, do you have anything in your ~/.lein/profiles.clj file? Its contents may be important, too.

4:16 and project.clj, too

4:16 TheTeapot: I have no ~/.leins/profiles.clk

4:16 I have no ~/.leins/profiles.clj*

4:17 andyf: Should be just ~/.lein/ not ~/.leins/ in case you checked the wrong place by accident.

4:18 TheTeapot: project.clj = http://sprunge.us/dFIj

4:18 error = http://sprunge.us/gFei

4:18 Any ideas about this `lein repl` error would be wicked.

4:19 Tethered to a 4G Samsung Galaxy btw

4:20 andyf: Are you behind some kind of web proxy perhaps?

4:20 TheTeapot: I don't think that I am.

4:20 I haven't connected to any or setup ay.

4:21 Let me try connecting to a local wifi

4:21 brb

4:21 andyf: able to reach the web site search.maven.org in a web browser?

4:21 that isn't the one lein should be trying to contact, but not sure which domain name is the actual one used right now.

5:17 Empperi: ok, 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

5:17 I have JDK 8, leiningen 2.5.0 and Clojure 1.6 as dependency

5:17 so, wtf

5:25 justin_smith: Empperi: maybe the lein-less clojure dep is somehow overriding yours?

5:25 clgv: Empperi: what clojure version does "lein deps :tree" report?

5:26 justin_smith: also, try ##(clojure-version)

5:26 lazybot: ⇒ "1.7.0-alpha1"

5:28 Empperi: let's see

5:29 [org.clojure/clojure "1.6.0"]

5:29 from lein deps :tree

5:30 so like I said, wtf :)

5:49 tried that plugin in an empty project, same error

5:50 justin_smith: so you get the error instead of any kind of repl coming up or anything?

5:50 Empperi: it breaks on 'lein less' and if I add the hook then on 'lein <anything>'

5:50 justin_smith: err, instead of compiling your css

5:51 Empperi: and yes, it breaks completely and refuses to work at all

5:51 also emptied my ~/.lein/profiles.clj to be sure

6:21 clgv: Empperi: are the other clojure.core functions/macros accessible?

6:21 Empperi: 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

6:22 Empperi: our clojure 1.6 project code compiles and runs just fine

6:22 it's just that plugin

6:22 but bbl, meeting

6:29 hydo: Is 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

6:30 I can't come up with more combinations of . and / to try.

6:39 justin_smith: hydo: is it an inner class thing?

6:39 clgv: hydo: is that enum "LongerThing" defined inside a class called "LongThing"?

6:39 hydo: then it would be LongerThing$LongThing

6:39 justin_smith: LongThing$LongerThing

6:39 clgv: :P

6:40 justin_smith: where are the other heads of the hydra? ;)

6:40 justin_smith: haha

6:40 hydo: $, eh? time for reading. Thanks!

6:41 clgv: hydo: I fear there is not much to read

6:42 hydo: that's just the inner class naming convention of the Java compiler

6:42 justin_smith: the vm, surely?

6:43 Bronsa: justin_smith: no, the jvm has no notion of inner classes

6:43 justin_smith: oh, interesting

6:43 clgv: :D

6:43 Bronsa: foo$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

6:43 clgv: so humm - are private inner class accessible without reflection then?

6:44 *classes

6:47 Bronsa: ,(class (java.util.Arrays/asList (object-array [1 2])))

6:47 clojurebot: java.util.Arrays$ArrayList

6:47 Bronsa: ,java.util.Arrays$ArrayList

6:47 clojurebot: java.util.Arrays$ArrayList

6:48 Bronsa: clgv: ^ it's declared as private in j.u.Arrays

6:48 clgv: you just can't construct it because the constructor is private

6:48 clgv: Bronsa: ah ok. thank you

6:49 Bronsa: the 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

6:50 clgv: Bronsa: but code in the j.u.Arrays class is allowed to use that private constructor of j.u.Arrays$ArrayList?

6:50 Bronsa: yeah

6:50 clgv: what a mess ;)

6:52 m1dnight_: add-message! already refers to: #'meta-clojure.actors/add-message! in namespace: meta-clojure.api, compiling:(api.clj:1:1)

6:52 am I interpreting this right?

6:52 Bronsa: how are you interpreting it? :)

6:52 m1dnight_: "while compiling api.clj I found a definition for add-message! but this function is already defined in meta-clojure.api

6:53 clgv: m1dnight_: better use :require with an alias instead of :use

6:53 m1dnight_: yes, I'm in the process of refactoring but this error seems odd to me :p

6:53 clgv: m1dnight_: 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"

6:53 Bronsa: m1dnight_: 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!)

6:54 m1dnight_: oooh, now I get it, I think

6:54 Bronsa: m1dnight_: 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!

6:54 m1dnight_: yes, I get it! :)

6:55 thanks a lot guys

7:27 fieuw, that was a big refactor :p

7:28 from 1 1k lines file to 5 files

7:58 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?

7:58 luxbock: m1dnight_: I don't think that should work

7:58 Bronsa: m1dnight_: no

7:59 m1dnight_: how on earth..

7:59 Bronsa: m1dnight_: you might have stale definitions in your namespace, tried reloading the repl?

7:59 m1dnight_: I'm doing "lean clean && lein run" everytime, so that should be fine

8:00 and the crazy thing is, it actually *works*

8:00 i'll inspect some more, brb

8:03 hrm, my bad, I was working on an old file in emacs

8:05 brainacid: hello all im new to Clojure

8:07 Bronsa: brainacid: hi -- there's no need to present yourself every other day though

8:11 brainacid: Bronsa, hey i feel like letting everyone know again lol

8:11 i can leave

8:59 hey

8:59 im misunderstand this math process

8:59 120 / 60 = 2

8:59 110 / 60 = 1.xx

9:00 my logic is wrong here

9:00 (/ 60(+ 30(* 2(* 5(+ 4 4.))))) 'min

9:00 i tried

9:00 (+ 30(* 2(* 5(+ 4 4(/ 60.)))))

9:00 clgv: brainacid: you can eval via the bots here ##(/ 5 3)

9:00 lazybot: ⇒ 5/3

9:00 brainacid: maybe i need to learn more

9:00 clgv, oh ok

9:00 clgv: ,(/ 5.0 3)

9:00 clojurebot: 1.6666666666666667

9:00 clgv: ,(double (/ 5 3))

9:00 clojurebot: 1.666666666666667

9:00 brainacid: ,(+ 30(* 2(* 5(+ 4 4(/ 60.)))))

9:00 clojurebot: 110.16666666666667

9:00 brainacid: ,(+ 30(* 2(* 5(+ 4 4(/ 60.)))))

9:00 clojurebot: 110.16666666666667

9:01 brainacid: ,(/ 60(+ 30(* 2(* 5(+ 4 4.))))) 'min

9:01 clojurebot: 0.5454545454545454

9:01 brainacid: see thats not what i need

9:01 clgv: brainacid: what is the problem? can you describe it in words?

9:01 brainacid: 1.833

9:01 yes indeed

9:02 daniel`: ,(/ 60 (+ 30 (* 2 (* 5 (+ 4 4.)))))

9:02 clojurebot: 0.5454545454545454

9:02 machty: ,(+ 1 2 3 4)

9:02 clojurebot: 10

9:02 brainacid: 4 seconds positive contraction + 4 seconds negative resistance of 5 repetitions for 2 sets + a 30 second break after set number 1

9:02 the result is 110 seconds total time to execute both sets of 5 reps

9:03 i want the result (110 s) to be in min

9:03 1.83 minutes total time

9:03 i love playing with this type of programming

9:03 clgv: ,(quot 110 60)

9:03 clojurebot: 1

9:03 brainacid: much more rewarding than assmebly and C

9:03 clgv: ah not rounded down.

9:03 brainacid: . (quot 110 60.)

9:03 .(quot 110 60.)

9:03 daniel`: ,(+ 30 (* 2 (* 5 (+ 4 4))))

9:03 clgv: ,(/ 110.0 60)

9:03 clojurebot: 110

9:03 1.8333333333333333

9:04 brainacid: thaks clojurebot

9:04 daniel`: ,(+ 30 (* 2 (* 5 (+ 4 4))))

9:04 clojurebot: 110

9:04 clgv: brainacid: the 60 is at dividend position in your expression

9:04 daniel`: ,(/ 60 (+ 30 (* 2 (* 5 (+ 4 4)))))

9:04 clojurebot: 6/11

9:04 brainacid: yes i realize that

9:04 daniel`: ,(/ (+ 30 (* 2 (* 5 (+ 4 4)))) 60)

9:04 clojurebot: 11/6

9:04 brainacid: ,(+ 30(* 2(* 5(+ 4 4(/ 60.)))))

9:04 clojurebot: 110.16666666666667

9:05 brainacid: that dont help either

9:05 i meant what i did da

9:05 i meant what i did daniel`

9:05 clgv: brainacid: (/ x y) => x/y

9:05 brainacid: yes clgv

9:05 thanks daniel` !!!!

9:06 ,(/ (+ 30(* 2(* 5(+ 4 4)))60.))

9:06 clojurebot: 0.0058823529411764705

9:06 brainacid: nope

9:07 ,(quot(+ 30(* 2(* 5(+ 4 4))))60.)

9:07 clojurebot: 1.0

9:07 daniel`: brainacid: your spacing is a little unorthodox

9:08 ,(/ (+ 30 (* 2 (* 5 (+ 4 4))) 60.))

9:08 clojurebot: 0.0058823529411764705

9:08 brainacid: thanks daniel`

9:08 hate whitespace

9:08 lol

9:08 daniel`: makes it harder to read

9:08 for me, anyway

9:08 brainacid: hehe really, read what? this syntax is so easy women can code

9:09 daniel`: ok brainacid :)

9:09 brainacid: i can add spaces since this is a community effort daniel` i dont mind really just bein funny

9:09 mmm i cant seem to crack this one

9:09 mind you i started with it this morning never seen or even heard of LISP

9:09 lol

9:09 Clojure I mean

9:10 clgv: brainacid: you got one of the books? or you are going through some online material to learn clojure?

9:10 * brainacid doesnt want to bother anyone

9:10 * brainacid goes back to reading

9:11 * brainacid coded some assembly so his trial and error approach might rub off the wrong way

9:11 brainacid: lol

9:11 puredanger: brainacid: sexist remarks here are not ok; it wasn't funny.

9:11 brainacid: clgv, i have several reference materials plenty for now

9:12 puredanger, 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

9:12 puredanger: well, it offended me.

9:12 brainacid: anyone forgive me puredanger

9:13 i will be more aware of my humor

9:13 puredanger: thx

9:13 brainacid: no problem thanks for being honest

9:13 not here to cause issues, although i am an intense guy

9:13 :)

9:16 ,(/ (+ 30 (* 2 (* 5 (+ 4 4 )))) 60. )

9:16 clojurebot: 1.8333333333333333

9:16 brainacid: yay

9:20 puredanger: you can use quot instead of / to avoid fractional return

9:20 ,(quot (+ 30 (* 2 (* 5 (+ 4 4 )))) 60 )

9:20 clojurebot: 1

9:20 puredanger: ok, maybe not in this case :)

9:25 zot: i'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

9:25 is 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 :)

9:26 joegallo: minor tweak:

9:26 use a vector internally and conj (rather than cons)

9:26 then you can skip the reverse at the end

9:28 clgv: zot: for these cases a reduce with more "state" than just the result value would be more natural.

9:29 zot: joegallo: i had been under the impression that getting last val from a vector was bad practice. not sure where that came from.

9:29 clgv: in other words, propogating the last value at each round?

9:30 clgv: zot: but you'd need to do that by a loop-recur which will be pretty verbose. the transducers approach with "volatiles" would be suitable

9:30 zot: yeah, 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.

9:30 clgv: zot: e.g. see "take" in 1.7

9:36 zot: though you can come up with a reduce like macro for cases as this

9:37 zot: clgv: i don't have a clear idea of how that would look. you know of an example macro?

9:40 clgv: zot: I got specific ones in my private code base. I think zach tellman had something similar in one of his libraries

10:25 stuartsierra: zot: 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:25 zot: stuartsierra: perfect :)

10:33 clgv: stuartsierra: you mean `peek`, right?

10:34 stuartsierra: clgv, zot: yes, I meant `peek`, sorry

11:11 donbonif_: anyone knows why (and) return true?

11:12 clgv: donbonif_: it is the base case for "and" and mathematically sound to do so

11:12 suppi: like (+) returns 0 :)

11:13 donbonif_: and (or) nil :)

11:14 suppi: i wonder why not false

11:15 clgv: suppi: since every recursion on and would be false if the base case return false

11:16 suppi: and is "neutral" to true.

11:16 ,(= (and (even? 2) (odd? 3)) (and (even? 2) (odd? 3) true) )

11:16 clojurebot: true

11:17 clgv: suppi: mathematically speaking "true" is a neutral element with respect to "and"

11:17 similar as 0 is the neutral element wrt to +

11:17 donbonif_: clgv: and the or and the nil?

11:18 suppi: clgv, i meant why does (or) returns nil instead of false

11:18 clgv: ,(or)

11:18 clojurebot: nil

11:18 suppi: not (and) :)

11:18 clgv: nil aka false is neutral element wrt. "or"

11:20 suppi: are nil and false interchangeable?

11:21 justin_smith: not totally

11:21 ,(cons 1 nil)

11:21 clojurebot: (1)

11:21 justin_smith: ,(cons 1 false)

11:21 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Boolean>

11:21 clgv: suppi: for logical expression yes, they are both "falsey" while everything else is "truthy"

11:21 moquist: Lookup refs work as parameters to Datomic queries, but http://docs.datomic.com/identity.html#lookup-refs says they "cannot" be used.

11:21 E.g., this works: (d/q '[:find ?lr ?val :in $ ?lr :where [?lr :my-attr ?val]] db [:my-attr "my-val"])

11:22 Are lookup refs intentionally allowed as parameters to d/q, or am I perhaps just misunderstanding something?

11:24 justin_smith: moquist: does it use the [:my-attr "my-val"] in any way?

11:24 moquist: justin_smith: Yes, and returns it in that form, as well.

11:28 I get back: #{[[:my-attr "my-val"] "my-val]}

11:28 Well, quoting mistake, there. But you get the idea.

11:28 martinklepsch: ,(letfn [(beep [s] (println "beep" s))] (beep "bop")

11:28 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

11:28 martinklepsch: ,(letfn [(beep [s] (println "beep" s))] (beep "bop"))

11:28 clojurebot: beep bop\n

11:28 martinklepsch: learned about letfn today

11:29 justin_smith: moquist: 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:30 "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:30 so it would be using your vector as an extra rule or dataset

11:32 moquist: justin_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:34 clgv: which "friend" workflow is commonly used for webservices (REST)? I used the interactive workflow for web applications so far

11:34 moquist: So 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:39 stuartsierra: moquist: Datomic query does not support lookup refs in the query syntax. They might happen to work as query inputs.

11:40 moquist: [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:40 stuartsierra: moquist: I would recommend not using them, yes. Anything that isn't documented isn't guaranteed to remain the same.

11:41 moquist: stuartsierra: OK, that's the answer I was expecting. Cool.

11:41 stuartsierra, justin_smith: thx!

11:42 stuartsierra: moquist: I think `entid` will give you the entity ID from a lookup ref.

11:44 moquist: stuartsierra, 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:48 stuartsierra: moquist: OK, then I'm wrong. :)

11:48 EvanR: is there an easy way to define throwables, new exceptions without gen class

11:48 moquist: stuartsierra: Heh. So does this imply the E position is safe, too? :)

11:49 stuartsierra: moquist: I think so, yes. You just can't embed a lookup ref in the query syntax (there's no need).

11:49 daniel`: clgv: i wrote my own, similar to interactive form but without all the redirects

11:50 basically made a session 'resource', POSTing to /session beings a new one and returns the logged in user

11:50 beings = creates

11:51 was heavily inspired by https://github.com/marianoguerra/friend-json-workflow

11:51 clgv: daniel`: is that availables as lib?

11:52 moquist: stuartsierra: 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:52 daniel`: clgv: yes but its pretty small, i chose to copy the relevant bits and adapt it slightly

11:52 stuartsierra: moquist: I'll mention it to the Datomic folks.

11:52 moquist: stuartsierra: thanks!

11:55 EvanR: datomic information of some sort, i should probably copy this whole conversation

11:56 daniel`: clgv: for one thing, im using transit over json

12:30 verma: what'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:39 OscarZ: verma, 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:40 this 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:40 ran into that while googling

12:53 joobus: verma: have you looked at aleph?

12:54 https://github.com/ztellman/aleph

12:54 verma: ztellman lurks here if you have questions about it

13:02 justin_smith: verma: 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:02 s/one/on

13:04 llasram: I 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:08 hiredman: no

13:08 I refuse to be part of any that legitimizes that project

13:08 llasram: Legitimizes which project?

13:09 hiredman: bbatsov's style guide

13:11 llasram: By "legitimize" I take you to mean "participate in it as a prescriptive declaration of how Clojure code should be formatted"

13:11 Which I agree with

13:11 but bbatsov is maintaining clojure-mode, and is using the style guide to inform how clojure-mode acts

13:12 AND has claimed that he wants the style guide to reflect community standards

13:12 If 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:14 hiredman: llasram: I don't see that

13:15 llasram: hiredman: Don't see which?

13:15 hiredman: llasram: 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:16 llasram: I was referring to this comment: https://github.com/clojure-emacs/clojure-mode/issues/265#issuecomment-67657754

13:17 His responses on the style guide PR thread seem mostly in line with what he perceives as another instance of an established principle

13:17 hiredman: https://github.com/bbatsov/clojure-style-guide/pull/96#issuecomment-67654611

13:17 'I really don't believe that "that's how it was done so far" is the best argument, however.'

13:18 definitely not a formalization of existing practices

13:18 just whatever the hell bbatsov thinks is logical today

13:18 llasram: I 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:19 hiredman: dealing rational with revolutionaries claiming to act for the people has not gone well historically I think

13:20 llasram: Well, I'm saying let's not put the cart before the horse, throw the baby out with the bathwater, etc

13:20 Let's try rational discussion first

13:20 EvanR: so if i want to use a state of some sort during my pure function body, i use an atom?

13:20 llasram: In this case I do not expect the delay caused by such discussion to result in my subsequent execution :-)

13:21 EvanR: contradiction? If you want a pure function, all "state" should be passed in as an argument

13:21 EvanR: eh no, its a pure function which uses internal state for its implementation

13:21 justin_smith: llasram: well, something can be effectively pure if no state leaks between invocations

13:22 llasram: Ah, I see.

13:22 justin_smith: EvanR: unless the one function ever involves mutltiple threads, or values that persist between invocations, you can even use a java mutable array safely

13:22 EvanR: i saw the state monad stuff and im apprehensive about it

13:22 llasram: EvanR: If you can't do it functionally via e.g. recursion, then an atom is certainly the most common practice in Clojure

13:22 EvanR: ok

13:23 its possible to do it by returning updated states but its clunky

13:23 or maybe not?

13:23 justin_smith: llasram: I think it's provable that you can do it with recursion - but an array or an atom can perform better

13:24 EvanR: the atom api is convenient for describing how you are changing the state

13:24 llasram: Also, Clojure 1.7 is going to have a new "volatile" type, optimized for thread-local constrained mutation

13:24 justin_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:24 llasram: justin_smith: fair enough

13:24 EvanR: justin_smith: like, array of one value, the state?

13:24 justin_smith: there's a ztellman lib for this (you could probably derive that from first principles though)

13:25 EvanR: yeah

13:25 EvanR: thats some macguyver shit

13:26 (wow that reference is so old now)

13:26 justin_smith: EvanR: 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:26 something that is faster as state, where speed really matters* of course

13:27 EvanR: recursion is easy, keeping the update states straight during multiple recursive calls is obscuring the algorithm

13:27 TimMc: every.damn.lib.util.Box

13:27 EvanR: thats where im interested, the less and clearer code

13:29 justin_smith: also just out of curiosity, using a java array to implement a pure function should work concurrently right?

13:29 hiredman: TimMc: clojure already has a clojure.lang.Box

13:29 TimMc: yup

13:29 EvanR: since its a new java array each time

13:29 not shared

13:29 hiredman: so, like, why would every util have that?

13:30 justin_smith: EvanR: as I said, as long as you don't leak the representation to other calls / other threads

13:30 TimMc: hiredman: Because not every library for the JVM uses Clojure. Yet.

13:30 (I was speaking more generally.)

13:31 justin_smith: I'd never noticed c.l.Box before, probably a better option than a one element array for that contained mutation case

13:37 hiredman: llasram: I did actually start commenting on the issue, but decided I was too angry about it to type something in to an issue

13:37 https://gist.githubusercontent.com/hiredman/77bd4cde0d3d401f8b88/raw/40e2fdece015a625fd0fc2935a844786b4aa9b1a/gistfile1.txt

13:40 llasram: hiredman: Are you intending to post later when calmer?

13:40 hiredman: no

13:41 the whole situation is incredibly frustrating, why would I be calm about it?

13:41 EvanR: dont think about it too much when reading responses to github issues

13:41 not good for your health

13:41 llasram: It'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:41 s,is how,is aware of,

13:42 If they don't help and he continues to manage such critical projects in disruptive fashion, then it provides valid reasons for a fork

13:46 hiredman: it 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:46 alandipert: is 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:47 puredanger: no?

13:47 clojurebot: no is tufflax: there was a question somewhere in there, the answer

13:47 puredanger: clojurebot: shaddup

13:47 clojurebot: Pardon?

13:47 puredanger: worse than my kids

13:48 hiredman: clojurebot: clojurebot |is worse than| puredanger's kids

13:48 clojurebot: Ack. Ack.

13:48 puredanger: good grief

13:48 EvanR: ,(let [[a b] nil] a)

13:48 clojurebot: nil

13:48 puredanger: alandipert: 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:53 llasram: 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:53 you've eliminated that.

13:53 llasram: puredanger: yep. A actually thought about correcting myself as soon as I'd said it, but then got distracted :-)

13:54 puredanger: np

13:54 Pedantics R Us ;)

13:58 just for the record, I like my kids a lot :)

13:58 justin_smith: I'm glad you clarified that you like them more than clojurebot

13:59 llasram: I'm actually not sure that's what just happened

13:59 puredanger: I do. :)

13:59 llasram: By induction I'm inferring that he really *really* like's clojurebot

13:59 puredanger: I like clojurebot too

13:59 llasram: Ah. puredanger isn't a consistent system. Oh well

13:59 ;-)

13:59 puredanger: I'm surprised that this is news :)

14:00 hiredman: I need to add worse than support to clojurebot's inference so it can infer that puredanger's kids are better than clojurebot

14:00 llasram: Yes!

14:00 EvanR: letfn, a refreshing oasis in a desert of non-recursive lets ;)

14:01 TEttinger2: I'm trying to add back a search to clojurebot.

14:01 ,(with-open [readerurl (clojure.java.io/reader "https://duckduckgo.com/html/?q=\panda%20site:wikipedia.org")] (pr (line-seq readerurl)))

14:01 clojurebot: #<SecurityException java.lang.SecurityException: denied>

14:01 TEttinger2: well ok

14:01 but try that in the repl and it returns a huge seq of the wikipedia page on pandas

14:01 but...

14:02 (with-open [readerurl (clojure.java.io/reader "https://duckduckgo.com/html/?q=\panda%20site:youtube.com")] (pr (line-seq readerurl)))

14:02 would return a weird pre-redirect page

14:02 I need to make reader follow the redirect

14:02 hiredman: use a real http client like clj-http

14:03 TEttinger2: i think it's already a dep

14:03 hiredman: so go read the docs and use it

14:10 justin_smith: monroe looks decent so far

14:17 TEttinger2: hiredman, same issue

14:17 for some reason it isn't redirecting in clojure, but will in the browser

14:20 hiredman: then it isn't an http redirect, likely js, and you'll need a javascript engine

14:25 expez: (.loadClass cl "clojure.lang.RT") <- this fails with ClassNotFoundException, isn't this class included in the clojure jar?

14:26 hiredman: loadClass is likely no the method you want

14:27 have you read the javadoc for it? where did you get the classloader from?

14:27 expez: I haven't written the code that's failing, I'm trying to use alembic, which calls into classlojure which contains that failing line

14:28 so I'm assuming I've done something stupid and neither of these libraries are at fault, for now

14:28 hiredman: just because the class is in a jar doesn't mean every classloader has access to it

14:28 so it all comes down to where cl is coming from

14:36 TEttinger2: hiredman, this is the javascript-less version of duckduckgo though

14:36 hiredman: *shrug*

14:37 TEttinger2: use a real don't care lib, hiredman, like libcaca

14:38 verma: why is using a promise here prefential: http://stackoverflow.com/a/20536205/73544 ?

14:38 we always want to block?

14:40 wouldn't I get like free thread pooling and stuff with go blocks? and lightweight goroutines are mostly a win.

14:40 or is there something about promises that I don't know

14:40 noonian_: 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:40 verma: noonian_: nice

14:41 noonian_: rich hickey talks about this in his conj talk on transducers iirc

14:41 verma: noonian_: hmm, will check it out

14:42 oh that thread is about consuming also

15:21 water_bulb: Hi ! 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:24 godd2: water_bulb http://www.braveclojure.com/getting-started/

15:24 Clojure for the Brave and True is really good

15:26 water_bulb: Even for me ? Who don't know that is list, touple, loops...

15:26 godd2: http://www.braveclojure.com/do-things/#2_7__Lists

15:26 It's fairly explanatory.

15:27 Also, you can skip the two parts about emacs if you don't use emacs. You won't miss anything about clojure.

15:28 crash_ep: I'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:28 Wrapping the query with `dry-run` shows the queries I would expect, and testing them at the CLI yields the records I would expect.

15:28 The joined records just don't seem to be included in the final object that korma gives me from my select call. Any ideas?

15:33 bozhidar: clojure-mode 4.0.1 is out

15:34 the controversial indentation of threading forms was reverted

15:34 world peace has been restored...

15:34 llasram: (inc bozhidar)

15:34 lazybot: ⇒ 1

15:35 llasram: Geez

15:35 bozhidar: I don't usually frequent IRC, but I was pointed to http://clojure-log.n01se.net/date/2014-12-18.html#17:11

15:35 and was really disheartened by it

15:36 if 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:38 chouser: Yeah, that's sad.

15:38 bozhidar: on the other hand, don't let that kind of talk get to you.

15:39 llasram: And now we may proceed with rational discussion and reasoned consensus

15:40 bozhidar: chouser: Thanks. Generally I don't, but today I got plenty of it on pretty much every front. :-)

15:40 chouser: :-( sorry

15:40 bozhidar: llasram: sure

15:41 chouser: FWIW, I didn't know there was controversy and am a happy cider user.

15:41 kenrestivo: indentation wars... just be glad you're not writing c...

15:41 puredanger: (inc bozhidar)

15:41 lazybot: ⇒ 2

15:41 puredanger: b/c open source hard :)

15:42 s/open source/working with people/

15:42 bozhidar: I think all Clojure indentation wars should be lead here https://github.com/bbatsov/clojure-style-guide

15:43 lately I've been trying to push all major Clojure dev environments to settle on more or less the same indentation defaults

15:43 for everyone's sake

15:43 arrdem: puredanger: does 1.7 ALPHA report it's *clojure-version* as 1.7 non-alpha?

15:43 s/'//g

15:43 bozhidar: kenrestivo: already did this :-)

15:44 eric_normand: datomic question: I have millions of entities that are updated every hour

15:44 arrdem: that would be a yes.

15:44 eric_normand: but many of them don't change from one update to the next

15:45 does datomic store a datom each time I do an update, even if the attribute has not changed?

15:45 puredanger: arrdem: {:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}

15:45 eric_normand: if so, it means I have to do quite a bit of work to determine what has changed

15:46 puredanger: arrdem: the :interim flag indicates non-final release

15:46 eric_normand: is there a best way to do that?

15:46 arrdem: puredanger: mmkay. thanks.

15:46 water_bulb: It 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:46 kenrestivo: eric_normand: not last i checked, but it's been a year

15:46 dnolen_: 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:47 puredanger: arrdem: oops, that was 1.7.0-master-SNAPSHOT! alpha4 says: {:major 1, :minor 7, :incremental 0, :qualifier "alpha4"}

15:47 dnolen_: s/is/isn't

15:47 kenrestivo: eric_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:48 eric_normand: kenrestivo: where can I learn how to "look through the transactions"?

15:48 puredanger: it does not store a new value if nothing has changed

15:48 arrdem: puredanger: exellent that I can work with. thanks.

15:48 bozhidar: puredanger: indeed :-)

15:48 kenrestivo: eric_normand: there's yer authoritative answer from inside of cognitect :-)

15:49 puredanger: Datomic stores novelty

15:49 kenrestivo: eric_normand: also too http://augustl.com/blog/2013/querying_datomic_for_history_of_entity/

15:49 EvanR: note to self this is the datomic help channel

15:49 puredanger: :)

15:49 there is #datomic, but not sure it's well populated

15:49 eric_normand: asked there a few minutes ago with no answer

15:50 kenrestivo: hey, it's written in clojure, nominally on topic

15:50 eric_normand: puredanger: is sending millions of entities in one transaction wise?

15:50 puredanger: no

15:51 not in that violates anything fundamental, but it's likely too chunky to be good for storage and indexing

15:51 mgaare: eric_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:52 eric_normand: mgaare: thanks, that's actually just what I want

15:52 puredanger: usually 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:52 mgaare: correct

15:52 mgaare: eric_normand: when you transact something, part of the response (in the promise) lists all the datoms that were added

15:52 puredanger: sorry for omitting that

15:53 mgaare: that's the easiest way to see what's actually getting transacted

15:57 eric_normand: thanks

15:58 I guess I'll have to explicitly model an "import", which I was hoping would be taken care of by the transaction

16:00 EvanR: theres capacity.html which describes hypothetical best practices for importing large amounts of data

16:01 http://docs.datomic.com/capacity.html#data-imports

16:05 ticking: I was just wondering, is anybody doing robotics with clojure?

16:05 arrdem: gigasquid is...

16:08 ticking: arrdem: 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:09 arrdem: like you'd find in a universities robotics lab

16:09 puredanger: I 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:10 bridgethillyer: water_bulb: Do you have a particular reason for starting with Clojure?

16:10 puredanger: this stuff: https://en.wikipedia.org/wiki/OPC_Unified_Architecture

16:10 arrdem: ticking: you could probably make some good headware there by taking hy or pixie and hitching a ride atop the python guys

16:10 puredanger: company is http://projexsys.com/

16:11 arrdem: ticking: but yeah all the work at UT on robotics is python :c

16:11 ticking: puredanger: cool thanks

16:11 arrdem: yeah, does pixie interop with python though? I thought it was just written in pypy

16:12 puredanger: quil via processing has access to some interesting stuff too I think

16:12 arrdem: ticking: I know there's a C FFI, but I'd be surprised if there wasn't a python one.

16:12 puredanger: and David McNeil did some dabbling in it http://david-mcneil.com/post/17044248397/clojure-robot-dsl

16:13 arrdem: #pixie-lang is the real place to ask :P

16:13 puredanger: and then there's the IOT crowd - Yodit Stanton etc

16:13 ticking: arrdem, 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:13 arohner: arg. maven deps + :exclusions is ugly

16:15 when 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:15 I 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:17 water_bulb: bridgethillyer: 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:19 amalloy: water_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:20 bridgethillyer: water_bulb: I’m with amalloy

16:20 Scheme might be a better choice with the same benefits you are looking for

16:20 But I wouldn’t stop you from trying Clojure if you have other good reasons for learning it

16:20 puredanger: Racket in particular

16:21 bridgethillyer: I have seen multiple people get their first exposure to programming with Clojure successfully

16:21 But all of those cases involved quite a bit of handholding

16:22 ticking: really, why is clojure unsuited for beginners?

16:22 chouser: because Java

16:23 bridgethillyer: Java, exactly

16:23 I personally think it’s totally fine for beginners

16:23 puredanger: I don't think it's *unsuited*, just that there may be gentler slopes

16:23 ticking: really? but why, I though java roughly once ever two months

16:23 bridgethillyer: I just think Racket is so much better

16:23 puredanger: and I personally think Clojure is much better than say Java

16:23 for beginning

16:24 mikerod: if a call to java.lang.reflect.Method#invoke(Object, Object...) throws a IllegalArgumentException - but with no given reason, what might that mean?

16:25 amalloy: mikerod: it would mean you should paste a whole stacktrace, not just an exception message :P

16:25 hiredman: it means exactly that

16:25 mikerod: An example of a "reason" would be: IllegalArgumentException argument type mismatch sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)

16:25 amalloy: ticking: 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:25 mikerod: Ok, I have a stack hah. This is 3rd party code doing some reflection

16:25 hiredman: mikerod: the reason is right there in the message

16:25 argument type mismatch

16:25 mikerod: hard to see what is going on but a Method#invoke is failling and I noticed there was no "reason" in the stack trace

16:25 hiredman: ^-

16:25 mikerod: hiredman: no

16:26 hiredman: that was an example

16:26 of what I want to see

16:26 Instead I'm getting just the "bare" IllegalArgumentException

16:26 amalloy: mikerod: 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:26 ticking: yeah I agree stacktraces are the pure horror

16:26 water_bulb: amalloy: please may you link me that book and videos you mentioned ?

16:26 mikerod: amalloy: yes, but everytime I fail for those, I get a detailed reason in the stack

16:26 ticking: sometime I want to quit programming when I encounter a particularly horrible one

16:27 mikerod: amalloy: So I'm wondering if the doc string leaves out some possible other reasons it could fail

16:27 doc strings aren't *always* perfect and this is some low level impl's underneath

16:27 amalloy: water_bulb: http://web.mit.edu/alexmv/6.S184/sicp.pdf is the textbook

16:27 hiredman: mikerod: 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:27 mikerod: I'm wondering if anything with concurrency could come into play actually

16:28 amalloy: http://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:28 mikerod: hiredman: I am tracking down a sporadic error that doesn't seem to be deterministic

16:28 it is another library using some reflection to call some Clojure anonymous functions we give it

16:28 EvanR: for 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:28 mikerod: it seems to *usually* be fine for the same code and same data, but every so often it will sporadically fail

16:28 hiredman: mikerod: yeah, that is likely it, what reflective method is it trying to call

16:28 mikerod: Mostly what I have to go on is that something is wrong with the Method#invoke call sometime

16:29 it is calling AFn#invoke(Object)

16:29 reflectively through Method#invoke

16:29 amalloy: mikerod: you said you had a stacktrace, right? are you going to paste it?

16:29 dnolen_: mikerod: it's usually helpful to gist the entire trace, someone may see something familiar

16:29 hiredman: have you looked at the source for that method?

16:29 mikerod: um it is a lot of details that are related to a 3rd party library using MVEL

16:29 Not sure how that could be useful at this level :P

16:30 I'm specifically using Drools, it is calling some anonymous Clojure functions of ours

16:30 hiredman: I guess afn throws useful illegal argument exceptions at this point

16:30 mikerod: the entire stack is Drools internal MVEL lib

16:30 amalloy: is 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:30 mikerod: and this error is rare

16:30 dnolen_: mikerod: having coded Clojure for a long time now, the I can safely say with confidence the entire trace is always useful

16:30 mikerod: dnolen_: I agree, but this is all Drools library, so to use the stack trace, you'd have to look at Drools source files

16:31 I ahve looked at them in depth, they seem to be getting the call to Method#invoke right

16:31 dnolen_: mikerod: just paste the trace already :)

16:31 mikerod: haha...

16:31 dnolen_: mikerod: otherwise nobody knows anything

16:31 arrdem: lol

16:31 amalloy: mikerod: 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:31 chouser: That's one thing you can say for Clojure stack traces: they're better than no stack traces. :-)

16:32 mikerod: It 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:32 Caused 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:32 There is a little taste ?

16:32 hiredman: mikerod: please use a pastebin

16:32 amalloy: ~paste

16:32 clojurebot: paste is https://refheap.com/

16:33 dnolen_: mikerod: if AFn is in there somewhere Clojure is involved somehow

16:33 mikerod: dnolen_: 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:34 https://www.refheap.com/95170

16:35 triss: if 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:35 if so which one?

16:35 ^fileds looked up across them like maps

16:36 (i.e. (:field java-object)

16:36 mikerod: I 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:36 triss: (i.e. (:field java-object)

16:37 mikerod: triss: I'd think you'd have to wrap them for that syntax

16:37 you could do something like "bean" on them perhaps, which uses reflection to turn them into maps

16:37 like (:field (bean my-java-obj))

16:38 water_bulb: when i will learn that sicp or lisp from your links, i will ready for clojure ? it is more lisp or java ?

16:38 triss: cheers mikerod

16:38 llasram: ~lisp

16:38 clojurebot: lisp is the red pill

16:39 water_bulb: ?

16:39 mikerod: triss: 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:39 llasram: water_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:39 kristof: water_bulb: http://www.amazon.com/Clojure-Programming-Chas-Emerick/dp/1449394701

16:40 llasram: Clojure is a philosophy-syntax-"lisp", but is neither Common Lisp nor Java

16:40 dnolen_: ,((fn [x] (.bar x)) (java.util.Date.))

16:40 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: bar for class java.util.Date>

16:40 dnolen_: mikerod: only guess is you're doing something like this ^

16:41 water_bulb: i'm lost then. giving up ^

16:42 mikerod: the `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:42 dnolen_: 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:43 like a part of the stack would show something from the Clojure's anonymous function class

16:43 dnolen_: 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 (Philosophically.)

16:45 dnolen_: 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:46 water_bulb: ok thanks guy for help. meanwhile i found this. is good for me ? https://aphyr.com/posts/301-clojure-from-the-ground-up-welcome

16:46 amalloy: yeah, python's another solid beginner choice, although not very functional

16:46 mathias__: I kinda gott basics of perl quite fast

16:47 justin`: is there a quick way to mimic Thread/sleep in clojurescript without core.async?

16:47 bridgethillyer: water_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:47 bridgethillyer: Either that or Clojure for the Brave and True should work

16:47 amalloy: justin`: i mean, there are no threads in javascript. you have to set a timer or something

16:47 you can't block a thread

16:48 justin`: https://www.refheap.com/95171

16:48 i feel like im missing something dumb

16:48 dnolen_: justin`: no way to sleep

16:49 justin`: all you can do is schedule something to be called later

16:49 justin`: thanks guys

16:49 justin_smith: how many justins can there be here, really

16:50 {blake}: THERE CAN BE ONLY ONE!

16:50 EvanR: amalloy: alert("ho ho!");

16:51 jmalloy: who is this amalloy fellow? i am justin malloy, well-respected fixture in this channel

16:51 justin`: haha

16:51 {blake}: Justin Time!

16:51 EvanR: /nick john_justin_jingleheimer

16:52 godd2: his name is my name too

16:53 water_bulb: ok and last thing please. any of you use editor LightTable ?

16:55 dnolen_: water_bulb: if you're going to do Clojure as someone starting out, yes LT is a good thing to use

16:56 water_bulb: ok thanks good night later

16:57 EvanR: lol

16:57 postpunkjustin: standing in the back?

16:57 postpunkjustin: EvanR: what?

16:57 EvanR: nothing

16:58 postpunkjustin: Oh, it's a Justin thing

16:59 I sometimes flatter myself by referring to justin_smith as my co-Justin

16:59 mikerod: I 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:00 justin_smith: postpunkjustin: I'll take that as a compliment (rimshot)

17:00 mikerod: Just 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:00 I appreciate the advice and the lectures about stack traces. I'll do better with that next time. :P

17:01 arrdem: #clojure |is| stacktrace or why are you asking

17:02 mikerod: arrdem: I thought this was a special case. but there are no such things.

17:03 jmalloy: mikerod: in fairness, this time the stacktrace ended up being pretty useless

17:03 mikerod: (inc jmalloy)

17:03 lazybot: ⇒ 1

17:03 jmalloy: but it's not a good idea to trust the person asking for help

17:03 mikerod: :P

17:03 yes I agree

17:03 on trusting the person helping*

17:14 numberten: does core.cast actually cast values? the documentation makes it seem like it just checks whether or not the value could be cast

17:15 ,(-> (cast Object 1) type)

17:15 clojurebot: java.lang.Long

17:15 jmalloy: numberten: that's the only kind of casting that makes any sense in a dynamic language

17:15 numberten: I see

17:15 jmalloy: uhhhhhhhhh, you would get that same result in java, even. ((Object)1).getClass() => Long

17:16 numberten: ah yea

17:16 jmalloy: class, type, getClass: these all return the actual runtime type, not the type the compiler knows

17:16 numberten: i see

17:16 justin`: 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:16 numberten: if I wanted to call Object's .getString on a value instead of the values own overloaded .getString, how would I do that?

17:17 jmalloy: numberten: do you mean toString?

17:17 justin`: it's waiting a second then running the whole loop instead of pausing between each iteration

17:17 Ah woops wrong room

17:18 jmalloy: there'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:18 numberten: yeah toString sorry

17:19 amalloy: being justin wasn't as cool as i expected

17:19 numberten: i 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:22 amalloy: i 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:23 numberten: i'm not in control of the printing code

17:23 only what value gets passed to it

17:23 amalloy: then you definitely can't change how an object prints itself

17:24 numberten: alright

17:25 nwolfe: Couldn't you pass in a custom object that implements .toString to print the original thing better?

17:26 That seems too easy, I must be misunderstanding something :D

17:26 numberten: yeah that is what I was about to do

17:26 i've never made custom objects in clojure before

17:27 but i guess now is a good time to learn :)

17:27 nwolfe: You could write it in Java

17:27 numberten: let's not get ahead of ourselves..

17:27 nwolfe: Ha, I thought you were saying you knew Java but not Clojure

17:28 numberten: not really

17:28 i know some java, but I'd rather not have to code in it for this. iirc you can create new types in clojure

17:30 nwolfe: Sure, 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:30 numberten: yea

17:36 noonian: if the object you want to print differently is map-like then records seem to fit the bill pretty well

17:54 dnolen_: release ClojureScript 0.0-2498, added use-fixtures support

17:54 released

18:09 bridgethillyer: dnolen_: thanks!

18:30 dnolen_: bridgethillyer: np!

19:51 arrdem: Grimoire 0.4.0-ALPHA5 up for testing! http://next.conj.io/

19:52 HTTP API also in alpha: http://next.conj.io/api/v0?op=groups

19:53 andyf: arrdem: Thanks for cheatsheet updates. Any reason for me to wait on publishing them?

19:54 arrdem: andyf: as you can see by clicking on the API url, 0.4.0 is still _very_ alpha :c

19:54 andyf: should be done this weekend tho..

19:55 andyf: Ok. If you remember, send me a msg when you want me to update

19:55 arrdem: willdo.

19:56 keeping the cheatsheet up to date is high on my checklist :P

20:28 imsorry: Hi! Has anyone written some emacs lisp to evaluate the sexp your cursor is in with CIDER?

20:28 For example, if I had (foo | arrg1 arg2 ....)

20:29 and I called the function it would evaluate the (foo arg1 arg2 ...) sexp

20:29 amalloy: imsorry: (save-excursion (paredit-forward-up) (cider-eval-last-expression))?

20:30 imsorry: amalloy: oh thanks! you've helped me before as well!

20:30 amalloy: you told me about autocomplete in the IRCs

20:30 amalloy: i mean i just made that up, there is probably some issue, but that's the general idea

20:30 hah

20:31 glad to see it seems to have stuck

20:36 scottj: imsorry: 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:36 oh link http://jaderholm.com/paste/eval-parent-sexp.html

20:37 imsorry: scottj: thanks!

20:41 amalloy: scottj: what's the nil there for, in the else clause?

20:41 scottj: amalloy: documentation failure :)

20:43 eval-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:43 interactive.

20:45 I guess it's for not printing output to current buffer

20:45 amalloy: i think P is point

20:46 scottj: anyway, if cider-eval-last-expression is like slime, I'm guessing it diverges from the lisp-mode one in not taking an arg

20:46 amalloy: oh, no, it's prefix arg

20:46 emaczen: Is there a two-way data-binding web framework for clojure?

20:48 imsorry: amalloy: scottj Thanks a bunch! I got it working!

23:06 xnil: any 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:11 rritoch: xnil: I've seen programmers from boston here but your more likely to reach them week-days.

23:12 xnil: thanks!

Logging service provided by n01se.net