#clojure logs

2014-04-16

00:00amalloy&(doc promise)
00:00lazybot⇒ "([]); Alpha - subject to change. Returns a promise object that can be read with deref/@, and set, once only, with deliver. Calls to deref/@ prior to delivery will block, unless the variant of deref with timeout is used. All subsequent derefs will return the same del... https://www.refheap.com/76684
00:01amalloyplus, i mean, you have all of java.util.concurrent at your fingertips if you want it
00:01amalloyderek_c: ^
00:03derek_camalloy: how does promise solve the problem?
00:04amalloyyou give the thread a promise to block on, and deliver to it when you're "done"
00:05derek_camalloy: hmm I don't think that's what I'm trying to do... I described my problem in more details here: http://stackoverflow.com/questions/23098575/how-do-you-block-a-thread-until-a-condition-becomes-true
00:05derek_cI know I can just use java.concurrent, but there has to be a Clojure way
00:06beamso,(doc deliver)
00:06clojurebot"([promise val]); Delivers the supplied value to the promise, releasing any pending derefs. A subsequent call to deliver on a promise will have no effect."
00:06amalloyrich encourages you to use j.u.c if it contains a solution to your problem. there aren't wrappers around that stuff because it's already good
00:07amalloyderek_c: also, you said "condition", which is like a real thing in concurrent programming, distinct from "some condition is true"
00:09derek_camalloy: ok... but maybe there is a way to do without condition variables. I'm really just trying to solve a simple concurrency probelm
00:09derek_chere: http://upl.io/czj5ag
00:10derek_cI'm modeling each sim as a thread, and the bathroom is the shared resource
00:11derek_cand each sim starts in one of two initial states: either it wants to wash hands, or it wants to use the toilet
00:11derek_cand it exits after it finishes what it wanted to do
00:14gunsInterestingly, you could probably solve this problem with a channel with custom buffer implementation
00:15gunshand washer = 1, toilet user = MAX_VALUE
00:17gunsderek_c: (a fixed buffer of course)
00:18derek_cguns: channel is not a Clojure primitive though?
00:19amalloywait, isn't this just a reader/writer lock?
00:19gunsderek_c: you would need a custom implementation that read an object's "size"
00:19guns*buffer implementation
00:19derek_cguns: there are lots of ways to solve this problem if we model the bathroom as another separate thread that accepts requests from sims
00:19derek_camalloy: yes, it is
00:20beamsomodelling it as a thread seems like overkill
00:20amalloylike, in clojure if you need a reader/writer lock, you use http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.html
00:20gunsderek_c: I thought you wanted something "clojurey"
00:20amalloywhy would you reinvent such a wheel, when really smart people already have it for you
00:21derek_camalloy: I wouldn't if I was writing a real application... I was just wondering if this problem is solvable with the Clojure primitives, like vars, refs, atoms, and agents
00:21derek_cso seems like it's at least not *easily* solvable
00:21amalloywell, none of those really like blocking
00:21amalloybut that's what promises are for
00:22derek_camalloy: I see
00:22amalloyi dunno, maybe i'm wrong about promises
00:22derek_cok thanks guys
00:56xsynCan I ask a stupid question about frequencies
00:56xsynI do a frequencies on a dataset I have and it returns pretty much what I expect
00:57xsynexcept when I do a (vals (frequencies data)) I get the response of a single val which is equivalent to all the frequencies added
00:58xsynand if I do a (keys (frequencies data)) I get (" ")
00:59gunsxsyn: have some sample data?
01:00xsynnevermind
01:00xsynI found it
01:00xsynit was a typo :/
02:35gko_What are *code-conversion-work*-xxxxx buffers? they pop up from time to time when I open a file...
02:35gko_wrong channel, sorry
02:47yediman... learning simple devops stuff sucks
02:48ivanit might be because every devops tool is not good
03:01sdegutisGood morning.
03:01sdegutisAnyone awake?
03:11dissipatetools.logging vs. timbre
03:11dissipatehmm
03:11dissipatetools.logging looks pretty disappointing. i don't feel like slogging through log4j's documentation.
03:15derek_cdoes anyone know if the coroutines created by core.async.go get mapped into actual threads or not?
03:16derek_cor do they just run in the same thread, like in Python and JS?
03:16systemfaultYou should watch the nice video on them
03:22amalloyderek_c: well, they run literally in javascript, in cljs. so definitely not multiple threads in that case
03:23amalloyon the jvm, i'm not sure
03:52Frozenlock, (clojure.core/read-string (str {:a #"regexp"}))
03:52clojurebot{:a #"regexp"}
03:53Frozenlock, (clojure.edn/read-string (str {:a #"regexp"}))
03:53clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.edn>
03:53Frozenlock, (require 'clojure.edn)
03:53clojurebot#<SecurityException java.lang.SecurityException: denied>
03:53Frozenlock-_-
03:53FrozenlockAnyhow, my point was, it doesn't work. Any idea why?
03:54FrozenlockSeems I can't read a regexp with the edn/read-string
03:54amalloyFrozenlock: are regular expressions defined as part of the edn spec?
03:55FrozenlockEh, doesn't look like it https://github.com/edn-format/edn
03:55amalloyso...
03:56FrozenlockSo I'll have to use core/read-string
03:56FrozenlockAnd hope not to be #'ed
03:56Frozenlock:-p
03:56maxthoursiebut you could define your own reader macros for edn, couldn't you?
03:57FrozenlockLast time I used core/read-string, the safest way was with *read-eval* to false. Is there any new practice?
03:58maxthoursieno, I confused that with tagged elements
04:00maxthoursieFrozenlock: related https://github.com/edn-format/edn/issues/26
04:00maxthoursieI guess the portability issue is the reason
04:00FrozenlockYeah, regexes are weird beasts for clojure
04:01maxthoursiewe'll, even outside clojure
04:01maxthoursiethat's the point, I guess, edn is made to be useful outside clojure
04:01maxthoursiea regexp wouldn't
04:02FrozenlockPerhaps, but in clojure I can feel it often... you can't check them for equality either.
04:02Frozenlock(And thus are unusable as key in a map)
04:03trap_exitare there builtin functions for arraybuffer -> string and string -> arraybuffer in clojurescript ?
04:03maxthoursieDidn't know that
04:03FrozenlockI've been spoiled by being able to use everything as a key :p
04:03Frozenlock, (= #"." #".")
04:03clojurebotfalse
04:06trap_exitargh
04:06clojurebotNo entiendo
04:06trap_exitbhow do I get arraybuffer/string translation ? :-)
04:06maxthoursieI think someone had a lib for that
04:57maxthoursieso internet says turning of *read-eval* is not enough. What other things could cause side effects?
05:00maxthoursiefound a relevant link: http://grokbase.com/t/gg/clojure/132bt7kyzx/ann-never-use-clojure-core-read-or-read-string-for-reading-untrusted-data/132cdm08r4#132cdm08r4
05:02Frozenlockmaxthoursie: As far as I understand, read-string with *read-eval* to false is 'safe-but-cant-guarantee-it-wont-bite-you-in-the-ass' :-/
05:02FrozenlockAt least since 1.5.0
05:02maxthoursieFrozenlock: that's what I gather too
05:03maxthoursiebut I'm failing to see the difference
05:03maxthoursieclojure should use the edn reader
05:04FrozenlockBut the edn reader can't read everything...
05:09FrozenlockAnother EDN case that's driving me crazy: keywords starting with a number. In clojure it's not a problem. However, because it's not in the EDN spec, cljs doesn't support it. :-(
05:10ambrosebs,:1a
05:10clojurebot:1a
05:10Frozenlockambrosebs: it works fine in Clojure
05:10yotsovBronsa: hello, question regarding tools.emitter.jvm. I see it currently depends on ASM. Are there plans to remove this dependency (impression I got from one talk), or is ASM there to stay?
05:11ambrosebsFrozenlock: Clojure does almost no error checking. Unsurprising.
05:12FrozenlockAre you saying it shouldn't work?
05:12ambrosebsFrozenlock: I'm saying just because it compiles doesn't mean that much.
05:45Frozenlockxeqi: shouldn't `form-and-button' also accept a :button element? https://github.com/xeqi/kerodon/blob/master/src/kerodon/impl.clj#L47
05:46Frozenlock(I might be wrong, but I usually use a :button with type :submit, rather than a :input)
06:19petronwhy is my Top K quickselect implementation error'ing out on some inputs? https://www.refheap.com/76711
06:22irctcHello some body tell me how i am create the testing data base in clojure
06:26irctc Hello some body tell me how i am create the testing data base in clojure
06:29clgv,(meta #'some-fn)
06:29clojurebot{:ns #<Namespace clojure.core>, :name some-fn, :added "1.3", :file "clojure/core.clj", :column 1, ...}
06:29clgv1.3 for real?
06:30Averellpetron: your partitioning only works for sorted coll
06:36arav93Hi, I need some help with clojure.instant
06:37pyrtsaJust ask the question.
06:40arav93Could someone tell me how parse-timestamp works in clojure.instant
06:43llasramIn what sense?
06:46pyrtsaarav93: Did you read the source already? https://github.com/clojure/clojure/blob/master/src/clj/clojure/instant.clj#L48-L118
06:47arav93I read it but I'm unable to get it working.
06:50pyrtsaarav93: How about using one of https://github.com/clojure/clojure/blob/master/src/clj/clojure/instant.clj#L271-L288 ?
06:51arav93pyrtsa: I do not understand how
06:52Frozenlock,(clojure.instant/read-instant-timestamp "1985-04-12T23:20:50.52Z")
06:52clojurebot#<SecurityException java.lang.SecurityException: denied>
06:52Frozenlocko_O
06:52pyrtsa(clojure.instant/read-instant-date "2014-04-16T12:34:56+01:00")
06:52pyrtsa,(clojure.instant/read-instant-date "2014-04-16T12:34:56+01:00")
06:52clojurebot#<SecurityException java.lang.SecurityException: denied>
06:53FrozenlockDangerous dates are dangerous
06:53pyrtsa,#inst "2014-04-16T12:34:56+01:00"
06:53clojurebot#<SecurityException java.lang.SecurityException: denied>
06:53pyrtsaarav93: If it's user input, pass in a string. If you've got a literal string in source code, just use `#inst "..."`.
06:54pyrtsa(...and let the Clojure reader do the conversion for you.)
06:56arav93pyrtsa: Could you explain a lil better?
06:58pyrtsaFor user input, something like (let [t (clojure.instant/read-instant-xxx s)] ...), for literals, (let [t #inst "2014-04-16T00:00:00.000+00:00"] ...)
06:59pyrtsa...where xxx depends on which type of result you want (java.util.Date / java.sql.Timestamp / java.util.GregorianCalendar).
06:59pyrtsaAnd s was a string, of course.
07:16agarman@Frozenlock - what's up?
07:16FrozenlockI -JUST- spoke about how regex can't be equal in Clojure. Yet, I wondered why one of my tests was failing.
07:16FrozenlockTurns out there was a regex in the map
07:18AimHereWhen some people find an inappropriate regular expression in their code, they bang their head on the keyboard. Now they have *two* regular expressions in their code.
07:19Frozenlock,(= {:a 1 :b #"surprise"} {:a 1 :b #"surprise"})
07:19clojurebotfalse
07:33katoxFrozenlock: that's deliberate?
07:36Frozenlockkatox: It was deemed somewhat irrelevant http://dev.clojure.org/jira/browse/CLJ-1182
07:38katoxhm, yeah regarding this as two regexps are equal when they accept the same language is a bit complicated requirement ;)
07:39katoxs/when/iff
07:45persesif i want to write a function which take str and separator, and split it at separator, (defn gsplit [str separator] (clojure.string/split string #separator)) , is this right?
07:46perses>(defn gsplit [str separator] (clojure.string/split str #separator)
07:46perses> (defn gsplit [str separator] (clojure.string/split str #separator)
07:46perses,(defn gsplit [str separator] (clojure.string/split str #separator)
07:46clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
07:46perses,(defn gsplit [str separator] (clojure.string/split str #separator))
07:46clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
07:47agarman, (fn gsplit [s sep] (clojure.string/split s sep))
07:47clojurebot#<sandbox$eval69$gsplit__70 sandbox$eval69$gsplit__70@1ebd60d>
07:47vijaykiran,(clojure.string/split "test,5,-,stuff-more" #"-")
07:47clojurebot["test,5," ",stuff" "more"]
07:47agarman, (gsplit "foo:bar" ":")
07:47clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: gsplit in this context, compiling:(NO_SOURCE_PATH:0:0)>
07:47vijaykiran,(clojure.string/split "test,5,-,stuff-more" #",")
07:47clojurebot["test" "5" "-" "stuff-more"]
07:48agarman, (doc clojure.string/split)
07:48clojurebot"([s re] [s re limit]); Splits string on a regular expression. Optional argument limit is the maximum number of splits. Not lazy. Returns vector of the splits."
07:48arav93Hi, I did (clojure.instant/read-instant-timestamp "1985-04-12T23:20:50.52Z") and I got #inst "1985-04-12T23:20:50.520000000-00:00" How do I pass this to parse-timestamp?
07:50katox, (class (clojure.instant/read-instant-timestamp "1985-04-12T23:20:50.52Z"))
07:50clojurebot#<SecurityException java.lang.SecurityException: denied>
07:51katox;) nvm, should be java.sql.Timestamp, why another parse?
07:52arav93I'm trying to work clojure.instant ns.
07:57katox,(source clojure.instant/read-instant-timestamp)
07:57clojurebotSource not found\n
07:58katoxhmm, ok https://github.com/clojure/clojure/blob/5e9ad16e11aad1228ca3d1b0a9c3b52ccd602dbc/src/clj/clojure/instant.clj#L283
08:01arav93I did not understand much by reading through this , katox
08:03katoxarav93: not sure what are you asking about but that snippet shows that a Timestamp object is constructed first in a function that is returned to parse a sequence
08:03katoxarav93: that fn can be called by a reader that you setup
08:10persesi have a very large file and i want to read line by line, and then process line then do the next line, what is the best way to do this?
08:11Anderkentperses: (with-open [rdr (clojure.java.io/reader "/my/file")] (for [line (line-seq rdr)] (do-stuff-to line)))
08:11persesAnderkent: is this the efficient way to do this?
08:11Anderkentoh, might have to wrap the for in doall
08:12Anderkentyes, line-seq is lazy
08:14persesAnderkent: so what should it be?
08:14perses(with-open [rdr (clojure.java.io/reader "/my/file")] (doall (for [line (line-seq rdr)] (do-stuff-to line)))) ?
08:14Anderkentyeah
08:14Anderkentwell. Depends if you need the results of do-stuff-to-line
08:14Anderkentor if you only care about side effects
08:15Anderkentdoall if you need the results, dorun if you only need side effects
08:15clgvperses: you could also "slurp" the file and use clojure.string/split on it
08:15Anderkentclgv: see 'very large' above
08:15clgvAnderkent: ah ok. didnt see that
08:15persesthanks guys
08:15AnderkentI'm reading 'very large' as gigabytes though, perses if it's just a couple megs just slurp it :)
08:16clgvgigabytes? terrabytes! ;)
08:25perses,(get (list 1 2 3) 0)
08:25clojurebotnil
08:25perses,(get [1 2 3] 0)
08:25clojurebot1
08:25Anderkent,(nth (list 1 2 3) 0)
08:25clojurebot1
08:25perses,(0 (list 1 2 3))
08:25clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
08:26persesi guess if get is polymorphic function will be very good, but why isn't?
08:26persesso get can work for list or vector or map
08:26Anderkentget is for getting a value from a structure that can be indexed
08:26Anderkentlike a map or a vector
08:26Anderkentnth is for getting the nth value from a sequence
08:28persesso nth for list is more efficient than get for vector?
08:29Anderkentno, get for a vector is more efficient than nth; but you cant 'get' from a list, because you can not index a list
08:29Anderkenta list only lets you get the first element, or get all other elements
08:30jcromartieI see very little performance difference between get and nth for a vector
08:32Anderkentright, it might check if the collection is indexed or not, if it does then there's not much difference
08:32Anderkentif it doesn't and behaves like `last`, then it's o(n) rather than o(1)
08:33jcromartie,(dotimes [_ 10] (let [n 1e6, v (vec (range n))] (time (dotimes [_ n] (get v (rand-int n))))))
08:33clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
08:33jcromartieoh fine be like that
08:33Anderkenthah
08:33Anderkenthttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L761
08:33Anderkentit does check
08:34jcromartie,(let [n 1e6, v (vec (range n))] (dotimes [_ 10] (time (dotimes [_ n] (nth v (rand-int n))))))
08:34clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
08:34jcromartie,(let [n 1e5, v (vec (range n))] (dotimes [_ 10] (time (dotimes [_ n] (nth v (rand-int n))))))
08:34clojurebot"Elapsed time: 57.234936 msecs"\n"Elapsed time: 22.612508 msecs"\n"Elapsed time: 22.719057 msecs"\n"Elapsed time: 20.353758 msecs"\n"Elapsed time: 20.465892 msecs"\n"Elapsed time: 19.734251 msecs"\n"Elapsed time: 24.6308 msecs"\n"Elapsed time: 21.561721 msecs"\n"Elapsed time: 20.138097 msecs"\n"Elapsed time: 19.321783 msecs"\n
08:34jcromartie,(let [n 1e5, v (vec (range n))] (dotimes [_ 10] (time (dotimes [_ n] (get v (rand-int n))))))
08:34clojurebot"Elapsed time: 28.693759 msecs"\n"Elapsed time: 30.672505 msecs"\n"Elapsed time: 23.772632 msecs"\n"Elapsed time: 22.376006 msecs"\n"Elapsed time: 22.670438 msecs"\n"Elapsed time: 21.908001 msecs"\n"Elapsed time: 22.869125 msecs"\n"Elapsed time: 22.611847 msecs"\n"Elapsed time: 22.509958 msecs"\n"Elapsed time: 21.313093 msecs"\n
08:34jcromartieso nth is actually faster in that case
08:35Anderkent#reliablebenchmarks
08:38jcromartieAnderkent: you mean that benchmark is not good?
08:38jcromartieor is good?
08:38jcromartiemy sarcasm detector is not working
08:41te,`unquote
08:41clojurebotclojure.core/unquote
08:41Anderkentrunning something 10 times is not a good benchmark, no; at least not good enough to pick up on a 1msec difference :P
08:41teSomeone talking about profiling?
08:43teGet an evaluation license for YourKit -- add this to your project.clj (assuming you're on OSX) :jvm-opts ["-agentpath:/Applications/YourKit_Java_Profiler_2013_build_13074.app/bin/mac/libyjpagent.jnilib"]
08:43testep 2: ...
08:43testep 3: profit.
08:44FrozenlockAssuming OSX is a thing now? The Apple invasion continues...
08:44Anderkentit's more of a 'hey I'll paste my path here fix it up if you're on linux/windows'
08:44jcromartieAnderkent: running it 1 million/100K times, 10 times...
08:44tebeard*
08:44Anderkentalso I'd guess like 40-70% people here are on macs
08:45Anderkenta neck bear would be a sight to behold
08:45jcromartiemy job gives me a mac, I bought a thinkpad
08:45xsynwhen life gives you lemons
08:45tethey'
08:45tethey're both fine.
08:46tethe tightness of apple's hardware + software is tough to beat
08:46perses,(replace "please i prefer ruby", #"ruby" "clojure")
08:46clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/replace>
08:46jcromartiethe $3K MacBook Pro has an amazing screen, and an amazing battery… but the $400 Craigslist thinkpad beats it in CPU performance
08:46tethinkpad, try as it might, still can't hold a candle to my battery life
08:46jcromartienope
08:46perses,(clojure.string/replace "please i prefer ruby", #"ruby" "clojure")
08:46clojurebot"please i prefer clojure"
08:47tefun little thing to try: implement all of clojure.string using no java
08:47te(direct interop i mean)
08:47Anderkent(defmacro dot [& body] (. ~@body)) - not direct interop anymore?
08:47teboo
08:48Anderkent:P
08:48te./kickban Anderkent your macros are no good here
08:48te\o/
08:49teso, claypoole -- you guys ever use it?
08:49teor gals, or fish, etc.
08:50persesif i have ("Clojure" "is" "fun") how can i replace fun with another thing?
08:51te,(replace {"fun" "radical"} '("clojure" "is" "fun"))
08:51clojurebot("clojure" "is" "radical")
08:51sohalthi, I just stumbled across reduce1 in merge-with and wondered how it differs from "normal" reduce, but couldn't find the source or documentation via (source reduce1) or (doc reduce1). Could anybody enlighten me on this one?
08:53dnolen_sohalt: it's private, just look at the source if you're curious
08:53agarmanhttp://www.clodoc.org/doc/clojure.core/reduce1
08:53tesohalt: is this helpful? https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/protocols.clj
08:53sohaltthanks. I wonder why my quick google search didn't turn that up for me.
08:54teagarman: because google juice for clojuredocs is still riding high
08:54teim going to build a really great core.async LOIC to DoS it if it stays up much longer
08:54agarmanlol
08:54perses,(if nil "fasle" "true")
08:54clojurebot"true"
08:55teseriously, i don't know how you can have something as high in the rankings, as important as it turns out to be to newcomers as a result, and not ever bother to update it
08:55tehasn't there been some clojuredocs rewrite in the works for like 2 years now?
08:55Anderkenti think there was some drama involved
08:56tereally?
08:56tei never saw anything about that.
08:56Anderkentdon't really know, didn't follow it, just my impression from when i heard about it like a year ago
08:57tei take back what i was saying
08:57telooks like it saw a string of commits 3 months ago
08:57teclj-rewrite in progress apparently
08:57tehappy to see that.
08:58tenow, if people could just quit writing alternative documentation websites and find a way to share the same domain...
08:59sohaltAlso while I'm at it: Why is the (when (some identity maps) … in merge-with required? Wouldn't a simple (when maps … do aswell?
08:59gfredericksmy favorite documentation strategy is fingerhut's project
08:59teexplaining to people: "nonono, you want to use clojure-DOC.org, not clojureDOCS.org.
08:59tesuch a bummer
08:59gfredericksI haven't seen anybody else care about it though
08:59tegfredericks: wait, what now?
09:00gfrederickste: it's a clojure project with alternative docs, and it adds them to the built-in vars at runtime so your repl docs are all customized
09:00teoh, yeah, i remember that -- have never used it personally
09:00gfredericksme neither; I just love the concept
09:01teI put http://getclojure.org out there -- would be nice to fix it up. there are a ton of cool examples in there, which, with some curation, could be used by andy's thingamajig
09:01gfredericksalso it seems easier to generate a fancy website from docstrings than vice versa
09:01te<-devn
09:01gfredericksit could even be richer info than just docstrings
09:01teid like to add ratings to it, but i just haven't spent the time
09:01gfrederickse.g., separating brief refresher-style docs from full intros
09:02tegfredericks: yeah, i want to run clojure.tools.analyze across every single thing in getclojure.org
09:02gfrederickslists of related vars...
09:02teand capture a ton of meta
09:02teand yes, that. something like the clojure atlas ontology, mixed with examples
09:02teit would be a clear winner by default
09:04gfredericksandy said he has so far not gotten a single PR on that project
09:04gfredericksnaturally I made a firm commitment to intend to work on it
09:05teandy has done so damn much for the community -- i know many people have, but sometimes i wish we had more of a community thing around recognizing people
09:05tethrow them a balloon party or something
09:05gfredericksI did not realize until clojure/west that andy was not affiliated with cognitect
09:05tesend them cookies. whatever it is. it'd be nice to show more appreciation all around for people
09:06tegfredericks: he's surely not the only one, if you look at the 1.6 contributors list
09:06telots of people, lots of patches, lots of time, lots of effort
09:06gfrederickshe's a lot more prominent than a lot of the people on that list though
09:06tebut he's been doing it for a lot longer, and a lot harder than most
09:06teyeah, agreed
09:06gfredericksor at least one of the people on that list :)
09:07tegfredericks: want to throw $100 into a pot for an amazon gift card for andy?
09:07teill match you
09:07gfrederickswould gittip work for this?
09:07tenot sure
09:08teheh, and then tbaldridge shows up and makes me feel guilty about just doing it for andy
09:08sohalt:D
09:08tewe need to make a list and get a clojure tip going
09:08teonce a month, someone gets recognized for their commitment
09:09tesomething like that
09:09gfredericksfor some reason when tbaldridge "showed up" I imagined him swooping down from the rafters...? no idea what that thought was about
09:10jcromartiewith a knife in his teeth
09:10gfredericksI guess "bird" is a sub-rearrangement of "baldridge"
09:10tei think it'd be nice to just highlight work people have been doing. there are a lot of people who aren't as public who have done a ton for the community for years
09:10tei want to get nakkaya to a US clojure conference, for example
09:11tewe need to fund that guy. he has had a prolific clojure blog since 2009 i think
09:11tei think he's in turkey
09:13gfredericksgittip seems to only support regular donations? kind of weird...
09:19te*shrug*
09:20tewhat's the right way to set up a little fund for this kind of thing?
09:21tegfredericks: ^
09:22gfrederickste: no idea; that's what I was speculating about wrt gittip
09:22teim just going to set up a little site with stripe
09:22teand then people can trust me or not
09:22Anderkentfund as in how you could get money from other people, or how could you easily send the money?
09:22drbobbeatygfredericks: You can do it in PayPal, if that doesn’t offend
09:23Anderkentisnt stripe us-only?
09:23gfredericksdrbobbeaty: good point
09:24Anderkenti was thinking bitcoin, because paypal tends to dislike people sending donations
09:24Anderkentwould suck to get your account locked :)
09:25drbobbeatyAnderkent: I think if you set it up with them as a Donation “destination”, then they get it. I’ve done this for charitable contributions for a Church Missions trip for my daughter. It’s really not all that hard, and they seem to be understanding of the nature of giving.
09:25teAnderkent: I was thinking anything except bitcoin, because bitcoin.
09:26teI feel like it has turned into a really long and elaborate troll.
09:26drbobbeatyte: but the motivation is pure, and honest.
09:27tethere is a PR problem, not to mention there are a lot of people who were on the sidelines a couple years ago, and with all of the drama everyone is constantly hearing about it, they're still standing there watching
09:27Anderkentdepends if you follow the drama or not; i feel like as long as you stay away from the obvious scams (exchanges, drug markets, blah blah), it's cool for everyday usage
09:27teso for donations it seems like a bad idea
09:28tebecause i bet less than 20% of the clojure community actually has bitcoins
09:28gfredericksI wouldn't know how to make use of bitcoin if somebody wanted to send me some
09:28te^-case in point
09:29gfredericksthat doesn't mean it's difficult; I just haven't looked into it; I wouldn't be surprised if it was difficult though
09:29tedogecoin is frankly more useful to me because if i were paid with it, i wouldnt feel obligated to figure out a way to actually redeem it, because it's mostly worthless
09:29teit's like getting a gold star
09:30Anderkentte: well, that depends on the amounts, doesn't it? 100$ in dogecoin is the same as 100$ in bitcoin
09:30tei like gold stars more than i like obligations
09:30teAnderkent: yeah sure, probably a bad example: i'll put it like this: I'd rather be sent food stamps than bitcoin.
09:31Anderkentgfredericks: running the risk of going too deeply offtopic, you get a mobile wallet app, scan a bar code at the shop, and press 'accept charge'
09:31Anderkentassuming you find a shop that supports bitcoin that has something you want, of course :) I tend to spend in a couple pubs in london
09:33gfredericksgotta find some good London pubs around Chicago
09:34jcromartiete: if you can exchange dogecoin for something, then it has value no?
09:35temeh, i didn't mean to make this a referendum on crypto currency
09:36tei dropped in a couple years ago and bought some BTC at 2$, watched it climb, crash, climb, crash, climb, sold and made my money back
09:36tei found the whole thing to be a PITA
09:36tei just dont see it being useful for regular people
09:37teit's like PGP.
09:37jcromartieanybody here using Cursive regularly?
09:38guest234245te: Pelle B. is writing a clojure wrapper https://github.com/pelle/bitcljoin
09:38jcromartieguest234245: bringing it back on topic beautifully :)
09:39guest234245take that and make something useful ... for the regular folk
09:39jcromartieClojure… regular folk… ?
09:39gfredericksmaking crypto useful for regular folk is apparently impossible?
09:39guest234245sometimes overlap
09:41guest234245if anyone knows other crypto / clojure projects, please share
09:42guest234245* crypto currency
09:42tegfredericks: i respect what keybase is trying to do
09:43tei know developers who don't know how to send a damned PGP email
09:43jcromartieI have a testing dilemma
09:44tejcromartie: do tell
09:44jcromartieI have a Clojure web app, but its whole job is to coordinate a bunch of external services.
09:44jcromartieKayako, JIRA, Stash, Confluence, and more...
09:44teget your spinning animation ready :)
09:44jcromartieyeah really
09:45tewhat's your question?
09:45tealso, i mentioned this earlier, but claypoole is really fantastic
09:45teit might not be a fit for you, but maybe it is...
09:45jcromartiewell, so right now I have a bunch of integration tests written in Rspec that are totally black box
09:45jcromartieand run against real installations of these services
09:46jcromartiewith a test setup script that goes out and prepares the whole testing environment
09:46jcromartieit's insane
09:46jcromartieit takes forever
09:46teyeesh
09:46Anderkentit does sound insane
09:46jcromartieand only one person can use it at a time
09:46tejcromartie: you want a stubbed service
09:46terecord responses and test against those
09:47tekeep your integration tests for the big "seriously, make sure it works before we deploy"
09:47tebut stub the rest of those responses out
09:47jcromartieI guess I could stub the service responses before running the specs
09:48tethen people can run it locally
09:49jcromartieI tried this https://github.com/fredericksgary/vcr-clj
09:49jcromartiebut it blew up in my face
09:49llasramOh geez. Will your insurance pay for the reconstructive surgery ?
09:49jcromartiebut I think that was just the clj-http recording
09:49jcromartieif I mocked my API functions themselves… that should do it
09:50Anderkentjcromartie: what I did a while ago (but only mocking one web service) was mock my api wrapper for 90% of the code, then when testing the api wrapper mock clj-http
09:51jcromartiebut one problem is the service state
09:51jcromartielike, testing the creation of things
09:51Anderkenti.e. (provided (clj-http/get "http://the-webservice/blah/foo&quot;) => {:status 500 :body "foobarzip"}))
09:51Anderkentwell, yeah
09:51jcromartietesting that they don't exist before, then they are created, then it should exist
09:51Anderkentwiat, are you testing your wrapper
09:51Anderkentor the app that you're delegating to
09:52jcromartietesting the app that coordinates all of these services
09:52Anderkentright, so you want to test that it tells the other service to create something if it's told it doesn't exist, right? Not that it's actually created when told.
09:53jcromartiewell part of the integration test is that the thing is actually created
09:54gfredericksjcromartie: let me know if there's a specific issue with vcr-clj
09:56gfredericksjcromartie: if the args/return are not serializable via pr/read I think that would cause it to not work
09:56gfredericksthat fact should probably be better documented
09:59jcromartiegfredericks: so, for a given var and cassette, it doesn't handle the result of multiple calls to functions with side effects?
09:59gfredericksjcromartie: calling something multiple times should work
10:00gfredericksit will play back the return values in order
10:00jcromartiehm, ok
10:04hlprmnkynothing germane to add except “omg there’s a vcr-clj now hooray”
10:07gfrederickshlprmnky: I wrote it maybe two years ago
10:07gfredericksI'm just not a marketing person
10:08jcromartiehm, whatever version comes up with "lein try" doesn't seem to work when recording stateful vars
10:08jcromartiemust be old or something
10:08gfrederickswhat's a stateful var?
10:08gfredericksI can't imagine an old version not supporting multiple calls to something
10:10jcromartiewell, this didn't work: (with-cassette :foo [{:var #'foo}] (foo) (foo) (foo))
10:10jcromartieit didn't record any calls to (foo)
10:10Morgawris there a function in clojure that groups vectors together? like (f [1 2 3] [4 5 6] [7 8 9]) -> [[1 4 7] [2 5 8] [3 6 9]] ?
10:10jcromartiebut with 0.3.3 it works
10:10gfredericksjcromartie: this is the vcr-clj.core namespace?
10:10gfredericksMorgawr: vector would do that
10:11clgvMorgawr: (apply mapv vector ...)
10:11clgv,(apply mapv vector [1 2 3] [4 5 6] [7 8 9])
10:11clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
10:11clgv,(mapv vector [1 2 3] [4 5 6] [7 8 9])
10:11clojurebot[[1 4 7] [2 5 8] [3 6 9]]
10:11jcromartiegfredericks: yeah, vcr-clj.core/with-cassette
10:11gfredericksoh I didn't see the transposition
10:11Morgawrclgv: thanks!
10:12Morgawralso thanks gfredericks for replying anyway )
10:12jcromartieanyway I blame lein try :)
10:12clgvMorgawr: apply when you get a list instead of single vectors ^^
10:12Morgawrclgv: yeah, thanks
10:13jcromartieah, I was using "lein try vcr-clj" and not "lein try com.gfredericks/vcr-clj"
10:13gfredericksyeah somebody else has a same-name project
10:14gfredericksand your example works for me on the alpha version (which only differs from 0.3.3 in the http namespace)
10:14jcromartieyeah
10:14jcromartieI think it's just someone pushed a really old version to clojars
10:14jcromartieopen source problems :)
10:14gfredericksoh that might have been me by accident before namespacing the mvn artifact
10:15gfredericksdamn leiningen's defaults
10:15Anderkentno, https://github.com/ifesdjeen/vcr-clj - looks like a different thing
10:15Anderkentand it defines the vcr-clj/vcr-clj artifact, which is what lein try vcr-clj would grab
10:15Anderkent(well, unless it was never deployed)
10:15gfredericksI'll crack open the vcr-clj/vcr-clj jar and see if it looks like my handwriting
10:16Anderkentgfredericks: https://clojars.org/vcr-clj it does
10:16Anderkent0.0.2
10:16gfredericksyeah that one is mine
10:17gfredericksjust super old since I didn't keep deploying to that
10:17gfredericksif clojars had a way to mark things as bad I'd do that
10:17Anderkenthm, you don't like the default group name?
10:23gfredericksno
10:23gfredericksI just had a build break the other day because of people using default group names
10:24jcromartiebut default group names are nice and sterile… when people use their own names then it adds an uncomfortable personal dynamic to the project dependencies
10:24jcromartiemanagers don't like that
10:24Anderkentgfredericks: can you elaborate on the build break?
10:24jcromartie"who the hell is this gfredericks guy? can I trust him?"
10:24jcromartie(I'm kidding)
10:25jcromartie(except not… we've had customers that were uncomfortable with open source attributions to individual authors)
10:27Anderkenti dunno I don't see how it makes any difference
10:28gfredericksAnderkent: I'll find the irc log
10:30gfredericksAnderkent: http://clojure-log.n01se.net/date/2014-04-14.html#15:37
10:30gfredericksit ended with technomancy claiming there's no need for internal libraries
10:31Anderkentright, okay, for anything non-public (mostly my forks of someones public lib tho) i'd still use my group name
10:31gfredericksyep I would've too
10:33clgv$latest seesaw
10:33lazybot[seesaw "1.4.4"] -- https://clojars.org/seesaw
10:33clgvawesome
10:33Anderkentwell, it seems you use it for everything now, which kinda implies you would. But I still think it's really not needed 90% of the time
10:34gfredericksI don't want builds breaking 10% of the time :P
10:37Anderkenteh, guess I'm not being clear. Builds don't break if you only use default group name for public artifacts (unless clojars breaks, in which case your build breaks anyway). I agree private artifacts should be in a private namespace, but 90% of the time making your artifact public is fine. The builds should never break
10:38gfredericksit's also kind of pretentious to pick a low-entropy generic name and assume your library will be the most prominent one by that name for decades to come
10:38gfrederickswhich leiningen encourages you to do before you've even written any code
10:39FrozenlockI've always wondered why...
10:39FrozenlockThe clojars/lein tutorial clearly explain how to use a group name, but by default you have your nice, clean, short project name.
10:40gfredericksthe alternative is to pick a default that won't work
10:40gfredericksmore amusing perhaps would be a uuid group name
10:40gfredericks,(symbol (str "fixme-" (rand-int 100000000)) "my-project")
10:40clojurebotfixme-85755338/my-project
10:41Anderkentwell, you're trading the first lib with that name having it easier, or every lib with that name having the crappy experience
10:42Anderkenti don't see how the future libs with the same name are any better if my libs has a group name, unless they just swipe the default group name
10:42gfredericksthis also assumes clojars is the only OSS repo
10:44FrozenlockUUID all the namespaces!
10:44Anderkentisn't clojars the only repo where the group-name = artifact-name thing is common?
10:44gfrederickshard to evaluate the tendencies of not-yet-existing repos
10:44jcromartieI think it's a Clojure thing in general
10:45jcromartieFrozenlock: I like it
10:45gfredericks"It's okay as long as nobody else does it."
10:45Anderkentit's not a problem until it's a problem and then we'll blame the people who broke it
10:46jcromartieorg.8CDFB3A4-EE85-41BA-AB44-178B7CEB95E7.604141BA-4519-4FF3-AED7-AA795F73A709/D8CCABC0-EAB5-4549-BF8A-69189E1525BA
10:46Frozenlockjcromartie: magnificent
10:46gfredericksI think I've already put more effort into complaining about this than it deserves; it only cost me an hour
10:47gtrakwe should just use URIs for namespaces and forget projects.
10:48gtrakchanging maven can't be that hard..
10:50gtrakor an rdf based build :-)
10:50Anderkentmaybe we should just number projects
10:52clgvAnderkent: with characters like A, B, C, C++, D, ...? :P
10:52AnderkentI was thinking just a central service that would spit out an integer that will become your project name
10:52gtrakthe problem is we have two namespaces, the classes and the maven one. We're a lisp-1.
10:53clgvsingle point of failure hooorray! :D
10:53tebahaha jcromartie
10:53teneeds more sha512
10:53clgvAnderkent: you could just use the timestamp in milliseconds - how likely is it that someone else created a project in the same millisecond? ;)
10:58technomancygfredericks: re: marking as bad on clojars: you can just deploy a new version with :description "don't use this" or something
10:59technomancywe can do manual deletions, but we try to save that only for cases where sensitive data has been deployed
11:01technomancyand for the record, I don't condone the use of everyday nouns like vcr as unqualified project names
11:02AimHereVCR is still an everyday noun? I thought that was some exotic rune that only old greybeards had heard of, like BetaMax and Geocities
11:04jcromartieyeah, there are programmers working today who have never handled a tape cassette
11:05jcromartie"why do Windows drive letters start with C:\"
11:05gfrederickstechnomancy: your approach is lesser known literary characters?
11:06gfredericksjcromartie: does that have something to do with tape cassettes?
11:06Anderkentorg.clojars.jaceklach/'that one crow from norse mythology'
11:06gfredericksor did you just mean people forgot about A:\ and B:\?
11:07jcromartiegfredericks: what I'm trying to say is "kids these days!"
11:07seangrovejcromartie: Having used Windows XP for 5 minutes yesterday for something, I'd shorten that question down to "Why do windows?"
11:07gtrakha, B:, when's the last time you used that one?
11:08gtrakthere's a window of about 10 years where people knew what a: and c: meant but might not have known b:
11:08Anderkentgtrak: not that long ago, because you can now map abitrary drives to b: :)
11:08gfredericksI don't think I personally ever used a B:\ but when I was <8yo I remember my grandfather having one
11:08gfredericksI don't recall ever seeing it used though
11:09gtrakAnderkent: my gut recoils at the thought, but my mind knows I don't give a crap because I've been using linux for 14 years.
11:09gtrakand we have chroot
11:10jcromartieI used A: and B:
11:10Anderkenti had lots of 'fun' playing with the windows registry a couple years ago when I messed up a reinstall and it wasn't picking up the drives in the right order.
11:15jcromartienow raise your hand if you ever used an 8" floppy drive :)
11:16AnderkentI remember having an 8'' floppy drive but don't think I've personally used it
11:16gfredericksnow you guys are trolling the kids by making things up
11:16gfredericksstop pretending computers were ever big. it's a silly fable.
11:16hlshipMy first experience with a disk drive was a large (12"?) removable hard disk platter for a Burroughs B800
11:17hlshipDad's accounting computer, circa 1978
11:17hlshipI called it "HAL"
11:18technomancyhttp://p.hagelb.org/ibm-pc.png
11:19locks"After all, your son's still wearing that tie"
11:19locksis he though
11:22Anderkentyou could go some pretty dark places with that quote
11:24instilledhey! is there a way in clojure jdbc to apply a fn to column names for updates and inserts, e.g to transform a key from 'some-col' to 'some_col' (as e.g. sqlkorma does it) or do I have to do the mapping before hand?
11:25joegallohttp://clojure.github.io/clojure/clojure.set-api.html#clojure.set/rename-keys is a useful thing
11:25joegallobut that would be outside clojure.java.jdbc...
11:26benmossthat is a pretty hot fn
11:26instilledok. that's perfectly fine… was just making sure i haven't overlooked something already available in clojure.jdbc...
11:26instilledthanks!
11:27joegalloactually, i think you can use the 'entities' functionality for that
11:27joegalloif you want something inside clojure.java.jdbc. but i'm not positive, this is just from 2 minutes poking about.
11:28instilledi was hoping to find any example in the source (or test source) but failed to see how to properly use it...
11:28joegallosee more here: http://clojure-doc.org/articles/ecosystem/java_jdbc/using_sql.html#clojure-identifiers-and-sql-entities
11:28joegallo(still not sure this is what you want, but it seems promising)
11:29instilledthat's it. cheers. from the link above (j/query db-spec ["SELECT * FROM mixedTable"]
11:29instilled :identifiers #(.replace % \_ \-))
11:30joegalloyup, bingo
11:30instilledcheers a lot!
11:38joegalloinstilled: you're entirely welcome
11:54perseshow can i convert (((1 2) (3 4)) ((12 13) (0 1))), to ([1 2] [3 4] [12 13] [0 1]) ?
11:55gtrakapply concat map vec
11:55perses,(->> (((1 2) (3 4)) ((12 13) (0 1))) (concat map vec))
11:55clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
11:55gtrak,(apply concat (map vec '(((1 2) (3 4)) ((12 13) (0 1)))))
11:55clojurebot((1 2) (3 4) (12 13) (0 1))
11:55perses,(->> (((1 2) (3 4)) ((12 13) (0 1))) (concat map vec))
11:55clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
11:55gtrakerr whoops, something like that :-)
11:56coventryvector, maybe
11:56perses,(->> (((1 2) (3 4)) ((12 13) (0 1))) (concat map vector))
11:56clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
11:56perses,(->> '(((1 2) (3 4)) ((12 13) (0 1))) (concat map vector))
11:56clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$map>
11:57perses,(apply concat (map vec '(((1 2) (3 4)) ((12 13) (0 1)))))
11:57clojurebot((1 2) (3 4) (12 13) (0 1))
11:57perses,(apply concat (map vector '(((1 2) (3 4)) ((12 13) (0 1)))))
11:57clojurebot(((1 2) (3 4)) ((12 13) (0 1)))
11:57perses,(apply concat (map vec '(((1 2) (3 4)) ((12 13) (0 1)))))
11:57clojurebot((1 2) (3 4) (12 13) (0 1))
11:57gtrakah, map vec apply concat :-)
11:58gtrak,(map vec (apply concat '(((1 2) (3 4)) ((12 13) (0 1)))))
11:58clojurebot([1 2] [3 4] [12 13] [0 1])
11:58gtrakI was thinking in thread-macros
12:00llasramI prefer: ##(mapcat (partial map vec) '(((1 2) (3 4)) ((12 13) (0 1))))
12:00lazybot⇒ ([1 2] [3 4] [12 13] [0 1])
12:00llasramWhich I think came up yesterday? But maybe perses didn't like that answer
12:00gtrak(partial map .. ) always feels funny
12:00justin_smith#(map vec %)
12:01llasramgtrak: Then you aren't doing it enough :-)
12:01gtrakjustin_smith: but that creates a new class!
12:01justin_smithAt compile time. And it runs faster than partial.
12:01gtrakthat's just the args-unpacking
12:02gtrakslippery slope to bloatware!
12:08gtrakllasram: just seems to me there ought to be a better way. weird wart, was looking at a nested versions of that yesterday with update-in.
12:09llasramgtrak: If you find the better way, please do let me know :-)
12:10justin_smithhttps://www.refheap.com/76754 <- surprising benchmark
12:10justin_smithgtrak's version is much faster
12:10gtrakI'd expect it to be
12:10justin_smithwell, OK, surprising to me
12:10gtrakwell, mine's totally lazy
12:11gtrakhmm.. so is the mapcat one thoguh
12:11justin_smithI think it's the nested map elimination that does it
12:11justin_smithbut that is still a very big difference
12:11llasramjustin_smith: Now try it with reducers :-)
12:12justin_smithllasram: I have not used them, can you give me a reducers version?
12:12llasramHmm, does criterium force evaluation of lazy results?
12:13gtrakwrap em in a doall
12:13llasramI think the way mapcat works will force evaluation of one step
12:13justin_smithllasram: yeah, definitely does
12:13llasramkk
12:14llasramjustin_smith: (require '[clojure.core.reducers :as r]) then use r/map and r/mapcat. And I think can use r/foldcat instead of concat
12:14justin_smithllasram: wait - it may not force it, I will double check
12:14justin_smithllasram: cool, thanks
12:15llasram(actually `r/foldcat` <-> `apply contact`)
12:16llasramOR maybe not
12:16llasramBLOOP
12:16llasramSo ignore the foldcat -- I never use it because `cat` requires input to be Counted for some reason
12:16llasramOh, and need to force realization by (into [] ...) or such the result
12:17llasramSo actually, lots of differences
12:17justin_smithllasram: oh, all the reducers stuff needs forced?
12:17llasramYes. It otherwise just lazily accumulates a reducer chain
12:17justin_smithcriterium is good, but it is the only thing that makes me feel like my cpu is way too weak
12:20jebberjeb,(+ 1 2)
12:20clojurebot3
12:20jebberjeb,('foo 'bar 'baz)
12:20clojurebotbaz
12:20jebberjebwt!
12:20justin_smith,(get 'bar 'foo) ; jebberjeb
12:20clojurebotnil
12:20justin_smith,(get 'bar 'foo 'baz) ; jebberjeb
12:20clojurebotbaz
12:21justin_smitha symbol in called position acts as get on its first arg
12:21justin_smithwith second arg being the last arg to get, the default result
12:22jebberjebjustin_smith: many thanks
12:22justin_smith,(doc get)
12:22clojurebot"([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present."
12:22justin_smith,('foo '{foo 0 bar 1}) ; intended actual usage
12:22clojurebot0
12:48guest234245yogthos: trying to use cljs-ajax and when I issue a POST its showing up on the other side as an OPTIONS request.
12:48guest234245not sure what I'm missing..
12:49blake__Why does "iterate inc 5" give "5 6 7..." but "iterate + 5" give "5 5 5..."?
12:50jcromartieblake__: because (+ 5) returns 5
12:50joegallo(inc (inc (inc 5) --> 8
12:50joegallo(+ (+ (+ 5))) -> 5...
12:51blake__jcromartie, joegallo: Thanks.
12:52technomancyclojurebot: dsls |are| intimidating and frightening https://secure.flickr.com/photos/technomancy/1884002248
12:52clojurebotOk.
12:54sdegutisHas anyone experienced any issues using Clojure in dwm?
12:54llasramThe X window manager?
12:54sdegutisYeah.
12:55llasramOk. What sorts of issues? (I mean, I'm not -- just having a hard time thinking of what sorts of issues could occur)
12:55sdegutisNever mind I forgot to try rebooting.
12:56sdegutisSorry, I should have tried that first.
13:01blake__technomancy: "DSLs solve all the things!" -- Ruby
13:02bbloomblake__: more like OOP-EDSL all the things!
13:05blake__bbloom: 'deed.
13:08sdegutisOh wait a minute, how is that upside-down now?
13:16justin_smithgtrak: llasram: https://www.refheap.com/76761 updated benchmarks, I was wrong, criterium was not forcing the laziness
13:16justin_smiththat explains the surprising performance difference
13:18llasramjustin_smith: That's good to know
13:39michaniskinwhich libraries are good for making SOAP clients in clojure?
13:39Anderkentwell, there's clj-soap
13:39Anderkenti don't know of any other one
13:40mdrogalisnecessary-evil
13:41mdrogalismichaniskin: https://github.com/brehaut/necessary-evil
13:41lockslove the name already
13:41Anderkentisn't that xml-rpc rather than soap?
13:41michaniskinhaha the name is looking good
13:42justin_smith(inc brehaut) ; for that awesome name
13:42lazybot⇒ 23
13:44michaniskini think of SOAP and XML-RPC as "especially heinous", like in law and order svu
13:45michaniskinok thanks!
13:53seangroveStructural sharing in edn? That sound like a thing?
13:54bbloomseangrove: not in a textual representation...
13:54seangroveBecause large persistent data structures with a lot of shared structures (app state history) is nice nice in memory, but then serializing to send around is not nice
13:55seangrovebbloom: I want to polish my history player to store the app state at every transition, but that's going to make sending reports to the server prohibitively large
13:55justin_smithseangrove: also it is bad for multithreading
13:56bbloomseangrove: maybe fressian covers this?
13:56michaniskinseangrove: gzip
13:56seangroveThis is in the browser, I should have mentioned
13:57bbloommichaniskin: gzip is too late in the pipeline
13:57bbloommichaniskin: you might have to generate and zip tons of stuff, only to get a tiny result at the end
13:57michaniskinbbloom: it's the pragmatic approach, not the fancy approach
13:58bbloommichaniskin: i mean, he can try it, but it's likely that he has too much sharing such that it will hang his UI at the frequency he wants to run it
13:58michaniskini'd invent a new way to serialize only if standard compression doesn't work
14:00bbloomamusingly, XML has this feature, not that anybody ever uses it
14:02seangrovebbloom: I believe coventry said python's pickle format can do something similar
14:06bbloomseangrove: yeah, most object serialization libraries have no choice but to support object identity
14:12seangrovebbloom: For eclj, effects are programmable from the top-level, but are the automatically identifiable/taggable/queryable from the language itself?
14:12seangroveFor example, I'd like to slim my time-travelling debugger down, and just have it set a dynamic variable to mock any side-effects and play the message
14:13bbloomseangrove: i'm working on the design of that right now. example: https://github.com/brandonbloom/eclj/blob/master/src/eclj/interpret/meta.eclj#L145-L166
14:13seangroveAre you expecting to add some meta-data to a var/function/something so I can ask if it's side-effecting?
14:13bbloomseangrove: no. that's a *static* effect system, like "throws" in java
14:14bbloomit would be hypothetically possible to abstract-interpret some code & see an approximation of what effects it may have
14:14bbloombut i'm pretty far from that
14:14bbloomlikely to do type-checking via abstract-interpretation first
14:16seangroveOk, I'm just realizing that the separation of state-transition and side-effecting as a pattern is really useful for us, specifically for things like deterministic reconstruction, but it's something that would fit better at the language level
14:16bbloomseangrove: you can approximate a real programmable effect system using OOP techniques
14:16seangroveSomething like Eff/Elm/etc. representing effects as values
14:16bbloomseangrove: Om already does this
14:17bbloombasically protocols + dynamic vars == crappy effect system
14:17bbloomin the case of your app, you have that cast! effect, you can simply implement that as an operation on some dynamic var
14:18seangroveIntersting point
14:18bbloom(defn cast! [msg] (-cast! *eff* msg))
14:19seangroveI'll meditate on that
14:19bbloomseangrove: also ask dnolen_ how he intercepts state w/ the om protocols
14:20seangroveI definitely think time-travelling debuggers are a possibility in cljs now. Probably not even a ton of work, just more than it ideally would be
14:21bbloomseangrove: yeah, Elm has a JS monad essentially
14:21bbloomwhich is somewhat akin to my "env" in eclj
14:21bbloombeing able to intercept all side effects is a fundamental feature of a next gen language -- hence my quest to add them to clj :-)
14:21seangrovebbloom: Makes me all kinds of excited :)
14:22dnolen_seangrove: doing a time traveling debugger specifically for Om would be pretty simple
14:22amalloyseangrove: the common-lisp printer does support structural sharing in printed representations, with stuff like (xs #1=(1 2 3 . #1#)), as the printed representation of (cons 'xs (cycle '(1 2 3)))
14:22amalloyer, i guess (list 'xs (cycle '(1 2 3)))
14:22bbloomamalloy: yeah but edn doens't have such a facility :-(
14:23amalloybbloom: yeah, i'm not saying you can do it in edn. but you said "not in a textual representation", which could have been misinterpreted
14:23bbloomamalloy: ah, you're right, sorry
14:23bbloomamalloy: what CL does is basically read-time letrec :-P
14:24amalloythat's an interesting way of putting it. i guess you're right
14:31TravisDDoes light table have a standard REPL in addition to the instarepl?
14:32TravisDAlso, are there any plugins for light table that emulate emacs key bindings?
14:32amalloyi think if you want light table to use a standard repl and emacs keybindings, you maybe just want to run emacs instead?
14:33blake__Sanity check, please: I'm trying to understand lazy-seq, but I came across a situation where my REPL gave me an error for one piece of code, then worked later for the same piece of code. The output is here:
14:33blake__https://www.refheap.com/76767
14:34TravisDamalloy: Hehe, that's a fair point. I've got a strange obsession with new editors. Always looking for something that I might like more than emacs
14:34TravisDamalloy: it's a great way to waste time
14:34seangroveTravisD: I'm sure it has both, yes
14:34Anderkentblake__: well you get an error when you call it on ii rather than (ii 1) ?
14:34seangroveTravisD: ctrl+space repl
14:35blake__Anderkent: Thank you! I was =not= seeing that!
14:35seangroveAnd our very own ibdknox has seen fit to provide https://github.com/LightTable/Emacs
14:35Jaoodamalloy: wouldn't customizing lighttable live via clojure a la emacs a good reason?
14:35Jaood:)
14:35xsynwhat's the difference between ~ and ~@
14:35justin_smith,`(~@[1 2 3])
14:35clojurebot(1 2 3)
14:36justin_smith,`(~[1 2 3])
14:36clojurebot([1 2 3])
14:36justin_smiththat's the difference
14:36xsynthank you very much
14:36justin_smithnp
14:36TravisDseangrove: Cool, thanks :) When I do ctrl + space repl, I only see instarepl
14:37seangroveHrm...
14:37seangroveOne of my siblings uses emacs before they switch to emacs, that's the limit of my exposure so far
14:38justin_smithis your sibling in a time paradox?
14:38TravisDheh
14:39Jaoodsurely he meant LT somewhere there
14:39seangroveErm, LT before using emacs
14:39Jaood:)
14:39amalloy(inc justin_smith)
14:39lazybot⇒ 34
14:39seangroveTravisD: I think it's supposed to be the 'console', but it doesn't show up for me
14:40seangroveit is a mystery
14:41seangrovewow, this instarepl is definitely very cool though.
14:41technomancyhttp://p.hagelb.org/mystery.gif you mean?
14:42seangroveAnd thus, I have a gif-bot with no programming.
14:42hyPiRion~mystery
14:42clojurebotmystery is http://p.hagelb.org/mystery.gif
14:42seangroveAh, damn
14:42seangroveThought I was clever
14:42TravisDI don't understand the meaning of the gif
14:42technomancy=P
14:42AnderkentTravisD: are you saying it's a mystery?
14:42seangrove(inc Anderkent)
14:42lazybot⇒ 11
14:43TravisDAnderkent: Haha :)
14:57maxthoursieI want autotest for clojure.test
14:57maxthoursieis there something like that?
14:57maxthoursiethat is something that runs my test when code is changed
14:58rlinehanmaxthoursie: I've been using lein test-refresh. it's worked pretty well so far. https://github.com/jakemcc/lein-test-refresh
15:00gtrakRaynes: I'd like to search lazybot log dumps, technically hard? Maybe lucene's too big, I'd be fine building something for myself that polls for new logs and dl's/indexes those.
15:01maxthoursierlinehan: that was exactely what I was looking for, thanks!
15:02gtrakgoogle was pretty ineffective at helping me find something earlier
15:02gtrakmaybe that could be made better, not sure.
15:02justin_smithgtrak: http://i.imgur.com/D2Hh0sn.png
15:02gtrakhaha
15:11Rosnecis there a way to display the current recursion point?
15:12RosnecI'm trying to recur, and it's telling me it's expecting 0 args when really there should be 1
15:12Rosnecthe only thing I can think of is that lazy-seq is creating a recursion point
15:13seangrovebbloom: https://www.youtube.com/user/PapersWeLove
15:13seangroveAre they holding the video hostage?
15:13Rosnecbasically, the chain of functions is like (fn [x] (let ... (if-not ... (cons ... (lazy-seq (recur y))))))
15:13maxthoursieis there a literal for ints?
15:13bbloomseangrove: you'd have to ask zeeshanlakhani
15:14bbloomRosnec: lazy-seq does create a recur point
15:14bbloomRosnec: b/c the body of the lazy seq is a delayed function
15:14seangrovezeeshanlakhani: I'll send you some Korean snacks if you get it posted by this weekend
15:14Rosnecbloom: aha
15:15Rosnecif I use lazy-seq, is there really any need to use recur, then?
15:15Rosnecit won't consume the stack, right?
15:15bbloomRosnec: you don't need recur here though, b/c by the time your deferred function runs, it will be on another stack
15:15bbloomRosnec: you got it
15:15Rosnecok, got it
15:15bbloomRosnec: just call the fn by name
15:15Rosnecyup
15:15RosnecI was doing that before
15:15Rosnecwhen I thought "why don't I use recur instead?"
15:15Rosnecthat's why
15:21gfredericksusing recur with lazy-seq will not even work I don't think
15:21gfredericksat best it'll do something totally unexpected
15:25bbloomBronsa: when is metadata evaluated normally on forms?
15:26gfredericks,(meta #'int)
15:26clojurebot{:ns #<Namespace clojure.core>, :name int, :file "clojure/core.clj", :column 1, :line 841, ...}
15:26gfredericks,(-> #'int meta :tag)
15:26clojurebotnil
15:26gfredericks,(-> #'str meta :tag)
15:26clojurebotjava.lang.String
15:26gfredericks,(-> #'str meta :tag type)
15:26clojurebotjava.lang.Class
15:27gfrederickssometimes apparently :)
15:27bbloom,^{:x (prn 1)} [(prn 2)]
15:27clojurebot2\n1\n[nil]
15:27bbloom,(meta ^{:x (pr 1)} [(pr 2)])
15:27clojurebot21{:x nil}
15:28bbloomi'm pretty sure that evaluation order isn't intentional
15:28bbloomshouldn't matter in most cases, but that seems totally backwards to me
15:28bbloomit's b/c it compiles to a with-meta call
15:28bbloom(doc with-meta)
15:28clojurebot"([obj m]); Returns an object of the same type and value as obj, with map m as its metadata."
15:28bbloomnote the arg order
15:30gfredericksdoes that apply to not-data-structures too?
15:30gfredericks,^{:x (pr 1)} (pr 2)
15:30bbloom,(binding [*print-meta* true] (prn '^{:x (pr 1)} [(pr 2)]))
15:30clojurebot2
15:30clojurebot^{:x (pr 1)} [(pr 2)]\n
15:31gfredericks^ didn't eval the meta at all
15:31bbloomyeah, that's what i expected
15:31bbloomhence why i asked Bronsa to know if he knew some other weird edge cases
15:31bbloomat this point, he's the expert on weird evaluator edge cases
15:32Rosnecbefore I go and write this myself, is there a function like partition that can guarantee that the last partition has size < n? So if the size = n, it appends () to the seq?
15:32bbloomRosnec: maybe you mean partition-all ?
15:32Rosnecdoesn't that make sure the last partition has size n?
15:32derek_ccan you define a var in a let form?
15:32Bronsabbloom: sorry Icc was afk
15:32derek_cI mean, you can define an atom like (let [a (atom 3)])
15:32derek_chow about var?
15:33Bronsabbloom: it's evaluated before the expression when applied to non-quoted data literals
15:33bbloomBronsa: really? example?
15:33Rosnecoh, wait a minute, partition cuts off the extra terms?
15:33Bronsabbloom: sorry, I meant *after*
15:33RosnecI've been using the wrong function this whole time!!
15:34bbloomBronsa: haha ok yeah, makes more sense
15:34RosnecI had the two confused
15:34Bronsabbloom: not evalauted when the literal is not evaluated (quoted, arg to a macro)
15:34Rosnecbut now I need something that's sort of the opposite of partition
15:34Rosnecpartition-all keeps everything
15:34bbloomBronsa: ok, i think that's what i understood from the experimenting above :-) thanks
15:34Rosnecpartition cuts off the last seq if it's smaller than n
15:34Bronsabbloom: the only gotcha I can think of is that read-time metadata on lists is not evaluated
15:35Bronsa,^{:foo (println "foo")} (identity 1)
15:35clojurebot1
15:35bbloomwhoa.
15:35RosnecI need something that adds an extra empty seq if the last seq is exactly of size n
15:35bbloomok this is why i ask you these things lol
15:35bbloomBronsa: any idea why that is?
15:35Bronsabbloom: no idea if that's a bug or if that's intended
15:35bbloom,^{:foo (println "foo")} 1
15:35clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Metadata can only be applied to IMetas>
15:35bbloom,^{:foo (println "foo")} (reify)
15:35clojurebotfoo\n#<sandbox$eval285$reify__286 sandbox$eval285$reify__286@7108a1>
15:36bbloomBronsa: i had punted on metadata in eclj's parser, but now i need it :-P
15:37Bronsayeah, it's quite useful
15:37bbloomBronsa: well i had it on vars, so it got me pretty far
15:40dnolen_Bronsa: so it easy to detect the presence of recur w/ tools.analyzer?
15:40dnolen_Bronsa: I did a horrible thing in core.match where I just flatten the search and search for a symbol because tools.analyzer didn't exist 3 (4?) years ago
15:40dnolen_"flatten the tree of forms"
15:41dnolen_would like to replace and fix with something more sane
15:41Bronsadnolen_: quite easy, see https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/passes/jvm/annotate_loops.clj
15:45gfredericksdnolen_: Bronsa: do you guys think it's reasonable for advanced macros to depend on the analyzer? i.e., in the future will we have hundreds of calls to the analyzer via a handful of different libs when compiling our code?
15:46gfredericks(I don't know of a serious downside to this, just wanted to make sure it was okay to use it this way)
15:49dnolen_Bronsa: huh so -check-recur will do it
15:50dnolen_gfredericks: given how ad-hoc more advanced macros become I welcome our new tools.analyzer overlords
15:50Bronsagfredericks: I believe cljs already does this, and when/if core.async moves to tools.analyzer that will be another one that does it. I think it's unlikely that it will be a wide-spread practice but definitely useful for the more powerful ones
15:51BronsaBTW, check this
15:51gfredericksI was discussing a test.check macro with reiddraper that could be smarter w/ analyzer
15:51Bronsa,(defmacro x [] (println "foo"))
15:51clojurebot#'sandbox/x
15:51Bronsa, (fn [] (loop [y 1] (x) (recur (Integer. 1))))
15:51clojurebotfoo\nfoo\n#<sandbox$eval52$fn__53 sandbox$eval52$fn__53@15268b>
15:51Bronsa:/
15:51gfredericksIt's time for another episode of "WTF Clojure with Bronsa"
15:52bbloomBronsa: looking at compiler.java, it seems like the definite list is: map set vector fn reify ()
15:52Bronsaloop invalidation in Compiler.java potentially makes the code macroexpand more than once
15:53bbloomBronsa: it's funny how rewriting clojure in clojure makes clojure's flaws so much more apparent
15:53Bronsabbloom: oh yeah, forgot about ()
15:53bbloomsmaller code == less place for bugs to hide
15:53llasramwow
15:54Bronsabbloom: it's mostly really-edge-cases, it's not always that you find macros side-effecting at macroexpansion time
15:54justin_smithbbloom: how is your project related to CinC btw? https://github.com/cosmin/clojure-in-clojure
15:54bbloomBronsa: the order of meta/value evaluation is totally edge-casey, but as i discovered evaluated vs not evaluated is a big difference ;-)
15:55bbloomBronsa: some code in core builds quote forms and evals them, like arglists :-/
15:55bbloomjustin_smith: it's totally unrelated
15:55Bronsabbloom: arglists isn't really evaluated
15:55Bronsathe compiler just takes the second element
15:55bbloomBronsa: but the metadata on def is, which means arglists gets evaluated as an item in a map
15:55gvickersHey when defining mutlimethods, dispatch is decided based on the function on defmethod returning true correct?
15:56Bronsabbloom: welllll
15:56bbloomBronsa: if you don't eval metadata on def, then you get an arg list of the form '(quote ...)
15:56bbloomfrom defn
15:56bbloomjustin_smith: Bronsa (et al?) are doing the "official"-ish clojure-in-clojure
15:56Bronsabbloom: the compiler takes the arglists info before evaluating any of the metadata IIRC
15:56bbloomjustin_smith: he's trying to make a production caliber clojure impl. i'm doing experimentation w/ something much crazier
15:56bbloomBronsa: not what i discovered :-P
15:57Bronsalet me check
15:57justin_smithbbloom: cool
15:57bbloomBronsa: https://github.com/brandonbloom/eclj/blob/master/src/eclj/interpret/meta.eclj#L213-L225
15:57bbloomjustin_smith: my work wouldn't be possible w/ Bronsa's either
15:58bbloomBronsa: thanks for all your help, direct and indirect, btw :-)
15:58Bronsabbloom: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L519
15:58gtrakthe arglists created by the cljs analyzer also contain a spurious quote.
15:59Bronsabbloom: so when the Var is interned, the Var has the unevaluated metadata + arglists with the 'quote removed
15:59Bronsabbloom: when the Def gets evaluated, all the meta with the original arglists is evaluated
16:00bbloomBronsa: *sigh* really?
16:00bbloomthat's just plain insane.
16:00Bronsabbloom: you have no idea how much pain that caused me.
16:00bbloomBronsa: where was the pain?
16:00clojurebotGabh mo leithscéal?
16:01derek_cdid 1.6 intro any breaking changes?
16:01derek_c*introduce*
16:03Bronsabbloom: weird things happen when you try to analzye ztellman libs and metadata evaluation varies slightly from how Compiler.java does.
16:03bbloomBronsa: lol
16:03bbloomBronsa: ok, well, i'm going to write this down... and then forget about it
16:03ztellmanBronsa: example?
16:03bbloomb/c ztellman's libs are totally not target eclj code :-P
16:04ztellmanit's not an intentional divergence, I'd guess
16:04bbloomi may update the goals in the eclj readme to say "makes ztellman's crazy projects obsolete, such that he must write newer even crazier things"
16:04Bronsaztellman: https://github.com/ztellman/potemkin/pull/20 :P I
16:04ztellmanaha
16:05ztellmanok, merged
16:05Bronsawell that was fast
16:05ztellmanwell, I had meant to merge it days ago
16:05ztellmanI thought I already did
16:05ztellmanI need a daily email from Github of outstanding issues on my projects
16:05bbloomztellman: i implemented the "alias" thing
16:06ztellmanbbloom: cool, link?
16:06bbloomworks a treat: https://github.com/brandonbloom/eclj/blob/master/src/eclj/env.clj#L35 and https://github.com/brandonbloom/eclj/blob/master/src/eclj/ns.clj#L10
16:06ztellmanha, that works
16:07bbloomztellman: w00t first class environments!
16:07ztellmancan I do fexprs in eclj?
16:07bbloomztellman: there's no fexpr API, but there will be eventually
16:07ztellmanok, yeah, there will be some crazier things, then
16:08martinklepschjustin_smith, amalloy, thanks to your advice a few days ago I was able to parse this huge xml file w/o saving it in seperate files first — thanks a lot!
16:08justin_smithmartinklepsch: awesome, glad it worked
16:08justin_smithwhat was the dtd fix?
16:08bbloomztellman: i have a working metacircular interpreter modulo a few bugs. it's pretty slow, but partial evaluation & lifting the interpreter in to a compiler is planned :-)
16:09bbloomztellman: i look forward to what you wind up doing with "jit macros"
16:09gtrakbbloom: is eclj the thing that's going to make core.async introspection happen?
16:09martinklepschjustin_smith, the best workaround is actually to just change the path to the dtd before parsing, which will also change paths for other deps like mathml
16:09ztellmanbbloom: ha, I'm more interested in having embeddable Clojure with first-class everything than performance
16:10bbloomztellman: yeah, performance is a side effect of wanting to be able to write an embeddable clojure-in-clojure run on other platforms besides the jvm
16:10bbloomztellman: gotta write a compiler to get it to run elsewhere
16:11bbloomgtrak: there would likely be like an eclj.async b/c eclj is capable of dynamic transforms, not just lexical ones
16:11bbloomgtrak: so you'll (eventually) be able to do higher order operations within go blocks, for example
16:11gtrakahhh
16:12bbloomgtrak: but that's a long way off
16:12ztellmanthe scope of the core.async transforms is pretty non-intuitive
16:12ztellmanit closed over a mutable deftype field and just held onto the value when the goroutine started, rather than throwing an error
16:12ztellmantook me *ages* to debug it
16:13bbloomztellman: you should see some of the insanity i've encoutnered working on eclj
16:13bbloomztellman: you think clojure's stack traces suck?
16:13ztellmanhaha
16:13bbloomalthough being able to fipp.edn/pprint an env is pretty sweet
16:13ztellmanyeah, I don't claim it's the craziest, just that the goroutine's boundaries unceremoniously at a function, and de-mutabilizing deftype fields, etc.
16:14ztellmanI was surprised how hard it was to reason about
16:15bbloomztellman: the de-mutabilizing is probably a metadata bug
16:15ztellmanbbloom: oh, definitely
16:15ztellmananyway, now I have a working compatibility shim, so I don't have to worry about core.async anymore: https://github.com/ztellman/manifold/blob/master/src/manifold/stream/async.clj
16:16bbloomztellman: surely tbaldridge will have that fixed in a jiffy ;-)
16:16gfredericksthere's not even a wikipedia article on f-expressions, how can they possibly exist?
16:16bbloomgtrak: https://en.wikipedia.org/wiki/Fexpr
16:16gfredericksgtrak: false alarm
16:16bbloomgfredericks: gtrak: yeah whoops sorry
16:17bbloomtab completion failure
16:17llasramclojurebot: gtrak is a false alarm
16:17clojurebotAlles klar
16:17gtrakthat's ok, I like reading these things :-)
16:17ztellman"Fexpr" sounds like some minor Norse deity
16:17bbloomztellman: assuming your familiar with fexprs, are you also familiar with racket's "syntax objects"?
16:17gtrakFexpr is a great band name.
16:17ztellmanbbloom: only minimally familiar with fexprs, not at all with syntax objects
16:18blake__Fexpr and Conj stole Mjolnir!
16:18bbloomztellman: in short, a syntax object is just a shallow AST node: it bundles a form with an env
16:18justin_smithblake__: lol
16:18VfeAnyone ever use .setInterval js interlop with cljs and had it work? I’m trying the most simple example I can (ns example.main) (.setInterval js/window (js/alert “hi” 1000)) and it never alerts more than once. Pure JS works as expected.
16:18bbloomztellman: in eclj, i don't do recursive analysis, i just do a shallow "parse" and map->Syntax on that...
16:19ztellmanbbloom: presumably someone else can do recursive analysis, right?
16:19martinklepschjustin_smith, now it all takes 20sec instead of 5minutes, success!
16:19bbloomztellman: the evaluator does the recursion
16:19justin_smithmartinklepsch: nice
16:19ztellmanbbloom: and that's pluggable?
16:19bbloomwhich means that you don't need feature expressions or any of that nonsense, if you don't go down a code path that uses some undefined value, it won't be an error...
16:19bbloomit *will* be
16:20bbloomztellman: right now, it's a multimethod
16:20ztellmangotcha
16:20bbloombut it will let you intercept it
16:20alewan fexpr is like a macro except the return is also not evaled?
16:20ztellmanintercept based on AST node type, environment, or both?
16:20bbloomalew: it's a first-class runtime macro that doesn't not explicitly evaluate, yes
16:21bbloomztellman: plan is that eval will be an open predicate dispatch function
16:22bbloomanyway, the biggest issue w/ fexpr's a la Kernel is operand capture: if you had (defn call [f x] (f x)) and you pass that (call quote 1) you get out x, not 1
16:22bbloomhowever, my plan is to parse children to syntax before running the fexpr, so you'd get (quote #Syntax{:form x :env {x 1 ...}})
16:23bbloommeaning that operand capture could only happen if you explicitly extract the :form from the fexpr arg
16:23bbloomotherwise, it works the same
16:24pbostromVfe: shouldn't that be (.setInterval js/window #(js/alert “hi”) 1000)
16:26Vfepbostrom: Thanks, that works. Never seen that in any of the web examples though O.o
16:27justin_smithVfe: in your version, the return value of js/alert is the thing you are passing as the function to call
16:28justin_smith(as opposed to a function that will call js/alert)
16:29VfeI gotcha, that makes sense.
16:31edwThis is a very un-value-oriented programming question, but is there a simple way to serialize a Clojure map, maintaining the identity of shared structure?
16:31edwAnd deserialize it, of course...
16:34gfredericksthe wat
16:34justin_smithedw: so a map with mutable things in it?
16:36justin_smithedw: I guess you could hack something together with an ObjectOutputStream
16:37gfredericksedw: are you talking about serializing references to jvm objects? and then dereferencing them back to the original jvm objects after deserialization? or just about maintaining the redundancy in an object graph?
16:37TimMcedw: I believe Java serialization will maintain the object graph.
16:38gtrakwonder how many folks have tried to java-serialize edn.
16:38justin_smithI am sure it is possible, but it seems kind of pointless
16:39gtrakwell, the cljs compiler analyzer data is way too big for print-dup, but fits in memory just fine due to structural-sharing.
16:40justin_smithahh, a point!
16:40justin_smithwww.pointerpointer.com
16:43edwTimMc: Ah, thanks for the tip. I just did some testing, and while duplicating equivalent objects will grow my memory use on deserialization, DISTINCT consideres this objects equivalent, so I may put "use Java serialization" in a TODO.
16:47jpfuentes2anyone here ever use clj-ssh and see auth errors?
16:53amalloyedw: clojure collections all implement Serializable, so you should be able to just use an ObjectOutputStream and be done
16:55hugodjpfuentes2: what short of auth errors?
16:55jpfuentes2USERAUTH fail
16:55jpfuentes2but all my args are right, and I know I can ssh into the host
16:55michaniskini'm using clj-soap to make requests to a SOAP service. one of the API functions has optional arguments but i don't see a way of indicating which argument is which in the clj-soap client call. is this possible?
16:55jpfuentes2:ssh {:username "root"
16:55jpfuentes2 :private-key-path "~/.ssh/id_rsa"
16:55jpfuentes2 :strict-host-key-checking false
16:55jpfuentes2 }
16:56hugodjpfuentes2: anything in the server logs?
16:56justin_smithjpfuentes2: are you sure that it interpolates "~" ? try expanding the path
16:56hugodyes, ~ is a shell thing
16:57jpfuentes2i tried that : (
16:57jpfuentes2when i'm running this with `lein test` a Java window pops up really quickly and disappears too
16:57jpfuentes2Apr 16 20:54:10 n1 sshd[1712]: Received disconnect from 172.20.20.1: 3: com.jcraft.jsch.JSchException: USERAUTH fail [preauth]
16:58hugodclj-ssh also logs the equivalent of ssh -vv on the client
16:59edwjustin_smith: No, nothing mutable. Just a lot of shared structure. A lot of keys with the same compound value. The difference between deserializing with out preserved vs preserved structure could be 5:1 or greater.
16:59edwamalloy: Thanks.
16:59jpfuentes2i need to hook that up, or is that in the exception message ?
17:02hugodjpfuentes2: via java logging
17:03jpfuentes2thanks
17:03jpfuentes2any idea on why a Java window pops up when I'm trying this?
17:04hugodit uses jna, and jna loads (but doesn't use) jwt
17:04justin_smithmaybe it is trying to use the OS keychain?
17:04hugodit uses the system ssh-agent
17:05justin_smithwhich probably needs access to the Desktop system
17:05justin_smithwhich requires the silly window, I bet
17:05hugodit uses jna to get access to the socket
17:05jpfuentes2gotcha
17:06hugodyou can run it with -Djava.awt.headless=true without any problems
17:06hugodI obviously meant awt, rather than jwt
17:07justin_smithhugod: ahh, yeah, that makes much more sense :)
17:07hugodif anyone knows how to use jna without it loading awt, then I'm all ears
17:08jpfuentes2interesting ...
17:09jpfuentes2it's as if it doesn't like RSA keys?
17:09jpfuentes2i just generated a test DSA pair and put it on server
17:09jpfuentes2looks like it worked
17:09hugodI use rsa keys all the time with it
17:10hugoddoes your rsa key have a passphrase?
17:11hugodif so it needs to be in the ssh-agent
17:12jpfuentes2no, it doesn't
17:13hugodis it particularly large? I think there was a 4096bit limitation from memory
17:14jpfuentes21.7K
17:14hugodthat's the filesize I take it, rather than the number of bits in the key
17:14jpfuentes2yep
17:15hugodshould be fine
17:15jpfuentes2well, i'll just go w/ this new pair for now
17:15jpfuentes2thank you for your help : )
17:16hugodnp, let me know if you find the issue
17:36arav93I tried (clojure.instant/read-instant-date "2014-04-16T12:34:56+01:00")
17:36arav93and I got #inst "2014-04-16T12:34:56+01:00"
17:37arav93I'm not sure what is the data type of the output.
17:37amalloyarav93: (class x) will tell you, for any x, what type x is
17:38arav93stuartsierra: Could you explain how parse-timestamp works. i haven't been able to check it out.
17:38arav93amalloy: Thanks!
17:39stuartsierraarav93: It's a java.util.Date
17:39arav93I understood that part, stuartsierra
17:42stuartsierraarav93: Then I don't understand your question, I'm sorry.
17:42gfredericksdata literals are super confusing for people who encounter them without an introduction
17:43gfredericksmostly the fact that they aren't tied to particular types; which is of course half of the point
17:43technomancy"wait you can have a space in between two things without a pair of delimiters wtf"
17:43technomancywhere "two things" actually means one thing?
17:43gfredericksman paredit is never going to figure that out
17:44alandipertalso #{1 1} demonstrates that they add evaluation semantics
17:45justin_smithgfredericks: and emacs will never syntax highlight usages of #_ properly either
17:45gfrederickstechnomancy: let's start having formalized language feature factions within the community; the technomancy faction will hate records/protocols/data-readers and love multimethods
17:46arav93stuartsierra: Correct me if I'm wrong. To get the required result, I have to pass a 'java.util.Date' and I'd get the required result?
17:46technomancygfredericks: can't me make it more general and just love reloading and interactive development?
17:47martinklepschI'm bulk inserting things into Elasticsearch and would like to know how long this takes. When I wrap the call in a (time ) call it prints 350msec which isn't right — how would I go about doing something like this?
17:47justin_smitharav93: didn't we discuss parse-timestamp recently? wasn't your main interest how to annotate it for core.typed?
17:48arav93justin_smith: Yes. There were some unresolved issues.
17:48justin_smithmartinklepsch: you could manually record the timestamps with ##(.getTime (java.util.Date.)) and manually calculate the ms
17:48lazybot⇒ 1397684730098
17:49stuartsierraarav93: Sorry, I still don't understand what you're asking.
17:49martinklepschjustin_smith that sounds... elegant!
17:49martinklepsch:D
17:50justin_smithmartinklepsch: not that I have any idea why time would be returning a bad result
17:50justin_smithbut .getTime from a Date should be reliable
17:53justin_smithmartinklepsch: maybe some other thread is doing the work, and time is only checking the round trip time of spawning that thread and returning?
17:54martinklepschjustin_smith, I'm eval'ing in lighttable, will try repl
17:54martinklepschnot using futures or anything though
17:54justin_smithmy suspicion is the underlying lib may be using a thread
17:54justin_smithwho knows though (could check the source of course)
17:56martinklepschjustin_smith, yeah, that would make sense indeed
17:56systemfaultHmm, macros are often said to be a selling point for any LISP… how often do you guys use macros in clojure?
17:57justin_smithuse: constantly write: very very rarely
17:58technomancythey're very useful for selling lisp.
17:58systemfaultOkay, I looked at a core.async video like 2 months ago… it’s written using macros, right?
17:58justin_smithright
17:58pdkwhat in clojure doesn't involve macros
17:58justin_smithso is "or", "and", "if", "defn"...
17:59systemfaultWhat is a good case for writing a macro? Anything that cannot be done using normal functions? (I’m a beginner)
17:59Bronsajustin_smith: if is actually a special form
17:59justin_smithif you need to change the evaluation rules
17:59justin_smithfair enough
18:00justin_smith,(filter (comp :macro meta second) (ns-publics 'clojure.core))
18:00clojurebot([when-first #'clojure.core/when-first] [cond->> #'clojure.core/cond->>] [gen-class #'clojure.core/gen-class] [while #'clojure.core/while] [import #'clojure.core/import] ...)
18:00justin_smithin your own repl that will list all macros in clojure.core
18:01justin_smith76 out of 591 public definitions in my version
18:01systemfaultNot that bad then
18:01systemfaultThis is like 13%
18:02Raynessystemfault: What you want, almost always regardless of what it is, can be done with functions, just less pretty. That less pretty but functional sample should be the foundation upon which you build your macros to make things prettier.
18:03justin_smithBest practice is to always use a function, unless the thing you need can only be a macro. Do play with them to figure out what they do, just don't expect to actually need them in real code that often.
18:03systemfaultSo no need to become a macro god, I get it :)
18:03technomancyclojure.core is not intended to be representative of good style for user-level code
18:05systemfaultThen… one last question. Any thought about core.typed? (types are attractive to me in most languages but do I want them in clojure?)
18:09JaoodRaynes: are you saying one should write the code first using functions and then (if you feel like or need it) rewrite it using macros to make it prettier?
18:14TimMcJaood: Where "prettier" means "not unbearably redundant", yeah.
18:16justin_smithdon't forget evaluation semantics - if you need short circuiting, rearranging before eval, or structural manipulation of your args, it's gotta be a macro
18:17martinklepschwhats the way to switch to a custom namespace in the repl?
18:17justin_smithmartinklepsch: pre-existing or creating a new one?
18:17martinklepschexisting
18:18justin_smith(doc in-ns)
18:18justin_smith,(doc in-ns)
18:18clojurebot"([name]); Sets *ns* to the namespace named by the symbol, creating it if needed."
18:18martinklepschthought in-ns should do it but nothing defined in there
18:18clojurebot"([name]); Sets *ns* to the namespace named by the symbol, creating it if needed."
18:18martinklepschhm
18:18martinklepschthen I must be too stupid
18:19justin_smith,(do (in-ns 'foo) ::bar)
18:19clojurebot:sandbox/bar
18:19justin_smitherm...
18:19TimMcheh, nice try
18:19TimMc::bar is expanded when that form is read
18:19justin_smith,::bar
18:19clojurebot:sandbox/bar
18:19justin_smithahh
18:20TimMc,(do (in-ns 'foo) *ns*)
18:20clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: *ns* in this context, compiling:(NO_SOURCE_PATH:0:0)>
18:20amalloymartinklepsch: when you use ns (or in-ns) to go into a namespace, it is empty
18:20justin_smith,(do (in-ns 'foo) clojure.core/*ns*)
18:20clojurebot#<Namespace foo>
18:20amalloyif you want to load a namespace from a source file, you need to use require
18:20justin_smithamalloy: he said it was pre-existing
18:21TimMcOh yep.
18:21amalloyjustin_smith: you and he didn't understand each other
18:21justin_smithoh, yeah, maybe not yet loaded
18:21justin_smithgot it
18:21justin_smithto me "pre-existing" implied "required from a file already"
18:23arrdemBetter names for a "math with units" library than arrdem/units? :P
18:26justin_smithdon't name it clunitsjure
18:27arrdemI _think_ I have better taste than that. Should probably check.
18:28justin_smithif you want something less obvious: measures
18:28Morgawrmm.. I have a defrecord in a namespace and I require'd the namespace in another file and use (MyDefinedRecord. parameters) and it doesn't work
18:28danneuIf I have a collection of points: [{:latitude 18, :longitude: -8, :score 42}, ...], does anyone know of the sort of algorithm that can "filter points with the highest score within 5km"?
18:28justin_smithmaybe
18:28Morgawrrecords don't go out of their namespace?
18:28gtrakmeajure
18:28justin_smithouch
18:28arrdemmy brain...
18:28martinklepschamalloy, justin_smith, to me pre-existing meant that it's defined somwhere :D
18:28justin_smithin your clojure runtime or in the abstract wider universe?
18:28arrdemgtrak: that's so painful I may just use it..
18:29Bronsa+1 for meajure
18:29arrdem3/3 Clojure hax0rz hate the name. Meajure it is.
18:29gtrakmy 2 cents :-)
18:29arrdemtechnomancy: ^ you see this. you see it.
18:29amalloyMorgawr: records don't live in a namespace; they're java classes
18:29amalloyyou have to import them like any other java class
18:29Morgawrah
18:29MorgawrI see
18:30Morgawrdidn't know that, thanks
18:30technomancyarrdem: better be sufficiently hilarious
18:31gtrakor mehjure
18:31arrdemmeajure is actually pretty good... most of this is gonna be math on financial units anyway rather than metric/imperial.
18:32amalloyarrdem: there are a number of unit-of-measure libs out there already. have you decided they're all no good?
18:33arrdemamalloy: I only found one, and it targets Clojure 1.2
18:33arrdemamalloy: so... yes.
18:33amalloyhttps://github.com/martintrojer/frinj/blob/master/project.clj
18:33amalloyand there's nothing wrong with targeting 1.2, if it still works fine on 1.5 or whatever
18:34arrdemthat lib used all sorts of stuff from Contrib that doesn't exist anymore.
18:34amalloyhttps://github.com/fogus/minderbinder/blob/master/project.clj
18:35justin_smithbut these don't have a nice web2.0 friendly name like meajure
18:36arrdemjustin_smith: shush you. I'll take a reasonable lib by someone I trust.
18:36arrdembesides. that name is kinda evil..
18:36arrdem(inc amalloy)
18:36lazybot⇒ 99
18:36arrdem$karma technomancy
18:36lazybottechnomancy has karma 105.
18:37justin_smith(reduce max (all-karma))
18:38jaimefcan you guys stop spamming /r/lisp? k/thanks :P
18:38arrdemjaimef: but we have the better lisp...
18:39justin_smithhttp://www.reddit.com/r/lisp I see very little clojure content there
18:39justin_smithis the problem that it shows up at all?
18:40arrdemjustin_smith: yes. that subreddit insists that it's the CL subreddit, not the *lisp subreddit.
18:40arrdemjustin_smith: Clojure stuff gets downvoted agressively
18:40arrdemcomplete with the usual Symbolics fetish..
18:44arrdemamalloy: thanks for the links... looks like neither is a fit for my use case tho.
18:46arrdemIf I was doing math with fixed conversion rates, minderbinder is perfect. Unfortunately the nature of the task is floating conversion rates (currencies).
18:47amalloyi mean, if /r/lisp wants to be a common-lisp community, and their sidebar suggests they do, why would you post clojure stuff there? it's just rude. like, sure, they got a too-general name, but that's just too bad
18:47justin_smitharrdem: in that case, something like "standard" could be a good name
18:47amalloyarrdem: isn't that one of the use-cases frinj says it's great for?
18:47justin_smithfiat, specie...
18:49arrdemamalloy: reading..
18:49arrdem;; A big plastic bottle of really bad vodka?
18:49arrdemthings I never expected to see in source code..
18:50justin_smitharrdem: https://github.com/martintrojer/frinj/blob/master/src/frinj/feeds.clj
18:51arrdemjustin_smith: oh damn.
18:51arrdemstill uses a global atom tho :P
18:51amalloyhttps://github.com/martintrojer/frinj/blob/master/src/frinj/feeds.clj#L23-L24 - augh just today i gave a class on why this is an evil race condition
18:51justin_smitharrdem: that's fair grounds for a fork with optional rename
18:52arrdemamalloy: yaaay dosync!
18:52amalloyarrdem: no, just a less-bad swap! function
18:52amalloy(swap! feed-pool #(or % (...)))
18:52arrdemamalloy: right.
18:52justin_smiththen you can even leave out the when-not, yeah
18:53amalloyone of my slides was like "you think you need a ref and dosync, but really you just need to be more careful with your dang atoms"
18:53justin_smithamalloy: at a university? workshop?
18:53amalloyjustin_smith: for other factual engineers
18:53justin_smithcool
18:53arrdemamalloy: is there a good rule of thumb for when to dosync? it's not a corner of the language I've trodden before, and I tend to just abuse swap! functions.
18:54amalloyarrdem: rule of thumb: don't
18:54llasramamalloy: Oh, are you at Factual now?
18:54amalloylike, refs are cool. but you never need them. i've used like five
18:54arrdemamalloy: I like that rule!
18:54amalloyonce a year
18:54llasramI've still never used one
18:54amalloyllasram: yeah, for about two months now
18:54llasramI should study amalloy's uses of them :-)
18:54llasramamalloy: Cool!
18:54arrdemI only saw one last week... and promptly submitted a PR that got rid of it :P
18:54llasramhaha
18:55justin_smithamalloy: so do you use an atom of a map instead of separate refs that need to stay syncronized?
18:55amalloywhen possible, yeah
18:55amalloy(and it usually is)
18:56amalloyllasram: let me know if you find them. i don't know how to search for it
18:57arrdemhum... well I can't use frinj's feed structure directly due to API lags.. but I can just add-unit! myself.
18:57llasramamalloy: I'll just clone all your repos and grep for '(ref ' :-)
18:57justin_smithI saw a blog where a guy was talking about the poor MP performance of swap! with deep structures, and I imagined that synchronizing only on the set of refs you use would be less likely to lock things up than all the threads fighting over a big map they all want to modify
18:57justin_smithI'll see if I can dig it up
18:58amalloyjustin_smith: for sure that's true, if you're doing something expensive to distinct subsets of a large structure
18:59amalloyone amusing trick you can do is, instead of storing the actual value in the atom, store a delay of the value
18:59justin_smithoh nice, tricky
18:59amalloythen the work you do while swapping is very small, and then the deref does the work whenever
18:59amalloybut that makes reading not-cheap, which rich frowns on
19:00amalloy(because when N people deref a delay at once, N-1 of them block)
19:00TimMcI don't understand this trick you're talking about.
19:01hiredmanamalloy: and is that way even once the value is realized
19:01justin_smithTimMc: the expensive calculation is not done while the swap! locks the object
19:01TimMcit makes me think of https://gist.github.com/samn/5843422
19:01amalloyhiredman: sure, although it's a pretty short locking window in that case
19:02TimMcjustin_smith: Oh, swap in a delay that will perform the work at that node?
19:02TimMc...interesting.
19:02justin_smithTimMc: that's what I assumed amalloy meant, yeah
19:02justin_smithsimilar in spirit to using a lazy seq I guess
19:04amalloyi used that trick in https://github.com/amalloy/hermes/blob/master/src/flatland/hermes/queue.clj, to keep a buffer of "all the things that have happened in the last N minutes", where both reading and writing are expected to clean out stale events. i'm not sure anymore whether it was really a good thing to do, but it's an example
19:05gtrakmaybe I should just join the http-kit party
19:05gtrakanyone have anything bad to say about it?
19:06gtrakjust using jetty b/c lazy
19:06justin_smithit can break ring apps that assume the whole processing of the request happens in a single thread; IMHO that just means the ring app was broken though
19:06justin_smithhttp-kit is good
19:07gtrakah yea, I wouldn't want to rely on that.
19:07bhaumanloving websockets in http-kit
19:07justin_smithand the performance is great
19:07justin_smithand not needing a container on production
19:08gtrakthe jetty ones seem to work.. but I noticed sente lets you define it as a ring-handler, whereas the jetty websocket server is further down.
19:11arrdemyaay my halfbaked units work. closeenough.jpg
19:12amalloyarrdem: the lisp motto
19:13arrdemamalloy: :D
19:16petronhmm, can't figure out why my Clojure implementation of the Top K quickselect algorithm is error'ing out for certain inputs: https://www.refheap.com/76711
19:17amalloytoo many parens on line 11
19:17arrdemamalloy: 14 I think you mean..
19:17amalloyhar har
19:18amalloyhe asked why it doesn't work, not why it's stylistically a little unpleasant
19:18kennethhey all, macro question
19:18arrdemno... 11 doesn't close the cond block..
19:19kennethsay i have a macro like this: (defmacro def-react-class [ name & args ] `(def ~name (.createClass React ~@args)))
19:19amalloyarrdem: read line 11 more carefully. particularly the test (ie, leftmost part)
19:19amalloycompare it to line 9
19:19arrdemamalloy: herp derp. gotcha.
19:19arrdemamalloy: good eye.
19:20Jaoodarrdem: don't you dare challenge amalloy !
19:20kennethinstead of just splicing in the args i'd like to transform them in a more complex way, how might i do that?
19:20arrdemJaood: http://arrdem.com/i/really.gif
19:20amalloy(.createClass React ~@(whatever args))
19:21kennethand whatever would just be a function that is called with the args
19:21Jaoodarrdem: ;)
19:21jarjar_primeHey there :-)
19:21amalloybut srsly, also really consider not writing a def* macro. just make the macro expand to (.createClass React whatever), and then someone can def it if they want
19:21justin_smithkenneth: write a function that takes a sequence representing the macro's input, and outputs the sequence that the macro should produce
19:21justin_smithkenneth: then call said function in the macro
19:21Jaooddo you all have like emacs shortcuts for pasting gifs on irc? :)
19:21jarjar_primeis there a way to (or) a lazy-seq?
19:21amalloy&(doc any?)
19:21jarjar_primeso I can filter on them?
19:21lazybotjava.lang.RuntimeException: Unable to resolve var: any? in this context
19:22amalloyer, i guess we just have ##(doc some)
19:22lazybot⇒ "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
19:22arrdemJaood: tech is believed to have his own keybind tools... I just remember what images I have in my collection :P
19:22jarjar_prime(or (map #(namespace-prefix %) (string/split namespaces #","))) <-- that's kind of what i'm attempting
19:22amalloyjarjar_prime: what do you imagine that returning?
19:23jarjar_primeI want to feed that into a (filter), so I would like it to return true
19:23justin_smitharrdem: technomancy designs custom keyboards with dedicated gif-pasting keys, optimized for most pleasant possible keyfeel and click sound when sending the perfect gif
19:23amalloyjarjar_prime: i think you mean ##(doc some)
19:23lazybot⇒ "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
19:23amalloy(some namespace-prefix (s/split namespaces #","))
19:23arrdemjustin_smith: you forgot that he's writing a forth implementation therefor so he can optimize the pasting in hardware..
19:24Jaoodmarcopolo`: marco
19:24jarjar_primeah ok sweet, let me give that a try
19:28jarjar_primeamalloy: great (some) works :-)
19:28jarjar_prime (some #(.startsWith (name keywd) %)
19:28jarjar_prime (map #(namespace-prefix %) (string/split namespaces #",")))
19:29justin_smithjarjar_prime: you could eliminate the map call by putting the namespace-prefix call into the some predicate
19:29Morgawrwhat do you guys think is the best way of handling a tree data structure in clojure?
19:29Morgawrmore specifically, an octree
19:30justin_smithjarjar_prime: or I guess you are doing that because you actually want to return the result of namespace-prefix
19:30justin_smithMorgawr: how much garbage are you OK with creating, and how fast does it need to be?
19:31amalloyby the way, justin_smith, you asked about where my class was. it's for factual, but it's not proprietary: the slides are at https://github.com/amalloy/clojure-concurrency-class, along with the code examples. original outline (which served a little bit like speaker notes)
19:31akhudekhow do you pass closure compiler options with cljsbuild? Specifically, —debug
19:31justin_smithMorgawr: for doing some geometry stuff I found a quad-tree made of maps / vectors was fine, but in real time 3d rendering you may want to use something lower level
19:31justin_smithamalloy: cool, thanks for sharing
19:31MorgawrI'd need as fast as possible but it has to be pure Clojure (no java stuff)
19:31MorgawrI don't mind allocating extra memory/garbage
19:32MorgawrI was thinking of doing maps of maps
19:32Morgawrwith vectors of children
19:32justin_smithso it's not like you will be creating a new octree for each frame at 60fps or something
19:32Morgawrlike { :key val, :children [ { :key val :children [] } { :key val :children [] }] } or something like this
19:32Morgawrjustin_smith: I don't have soft (or hard) realtime needs, if that's what you're asking
19:33justin_smithMorgawr: yeah, that sounds about right - and there are other options with similar semantics if that is too slow
19:33MorgawrI'll try with this, thanks
19:33justin_smithof course you will be using update-in / get-in extensively :)
19:34Morgawryeah
19:34justin_smithyou can promote from map to defrecord easily if you see perf issues without changing the rest of the code (besides the generation code)
19:35Morgawryeah I think I will use a defrecord anyway
19:35justin_smithalso if children is of a specific fixed maximum size, you could flatten it into the record for an extra boost
19:36amalloyjustin_smith: that's not necessarily an improvement
19:36Morgawrchilren is of max size of 8
19:36Morgawrcause it's an octtree
19:36Morgawrwhat do you mean flatten it into the record?
19:37justin_smithamalloy: oh no? it removes a level of indirection and replaces a vector lookup with a record lookup, both should be wins, right?
19:37Morgawryou mean having something like { :keys val 0 child0 1 child1 2 child2 ... ... } ?
19:37Morgawrinstead of { :keys val :children [] } ?
19:37justin_smithMorgawr: exactly
19:37amalloyjustin_smith: (MyRec. new-value old-children) is a lot cheaper than (MyRec. new-value (:child1 old-rec) (:child2 old-rec) ...)
19:38amalloyMorgawr: i recommend just using a map instead of a defrecord. but if you really want to use a defrecord, i definitely recommend not doing the thing justin_smith just suggested about flattening
19:38justin_smithahh
19:38Morgawryeah I don't like the flattening thing because of what you said about incremental upgrades
19:38amalloynot just because of performance but because it's disgusting
19:38Morgawrbut why do you recommend using a normal map intead of a defrecod?
19:38Morgawrdefrecord*
19:38amalloybecause that's the default. you need a good reason to use a record instead
19:39arrdemcan someone explain this? not something I've seen before. https://github.com/fogus/minderbinder/blob/master/src/data_readers.clj
19:39justin_smithamalloy: why not just use assoc to create the new record rather than using the constructor?
19:39amalloyjustin_smith: doesn't matter, it has to do the same amount of work
19:39justin_smithahh
19:39Morgawramalloy: isn't the advantage of a record that it has a fixed structure and is implemented as a java class so it has better performance when not used in a generic setting?
19:40amalloyhttp://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/
19:40Morgawrin this case all my elements/subtrees are going to have the exact amount of elements
19:40petronamalloy, I don't see any paren-related syntax problems for my top-k fn.
19:40justin_smithpetron: you are wrapping a number in parens
19:40amalloyMorgawr: the point is you haven't done it with a map yet. you don't know if you need the performance. don't give up the flexibility of maps until you know you need records
19:40justin_smithon line 11
19:41amalloyonce you do know that, it's an easy change to use records instead
19:41petronahhhhh
19:41petronthx justin_smith
19:41justin_smithamalloy: it's a well known data structure, I doubt it will change as he works on it
19:41petrontypo from an old do clause
19:41petronthx for spotting that
19:41Morgawramalloy: I'm looking for the best performance (I'm doing a case study on performance comparisons with some algorithms in java and clojure) and I already know I need an octree
19:42Morgawrand it's well-defined data structure
19:42Morgawrit's not something that I'll need to change and maintain
19:42Morgawrand afaik records behave exactly like maps, you can add new key/value pairs and they won't care
19:42amalloywell, they behave mostly like maps
19:42justin_smithMorgawr: that just creates a map under the hood
19:43amalloyyou can't dissoc, you can't have missing keys
19:43Morgawrjustin_smith: it's still a record as far as I know, just with added fields
19:43Morgawramalloy: yeah
19:43amalloyyou can't call them as functions
19:44amalloyif your goal is to compare performance, it's reasonable to aim for high performance. but records aren't *that* much faster, really. try it out and decide for yourself
19:44Morgawrah, I didn't know about them not being callable as functions
19:44Morgawrneat
20:06justin_smithmaybe deftype would perform better than defrecord (easy enough to find out I guess)
20:08petronjustin_smith, the syntax is good now, but I'm getting bad results :\
20:09akhudekhmm, source maps is trying to tell me that the problem I’m having with advanced compilation is in the closure string library
20:09akhudekthat doesn’t sound right
20:09justin_smithpetron: maybe that calls for breaking it down into smaller functions and ensuring that each does what you expect?
20:10arrdemamalloy: having done a preliminary google, do you know of multimethod math in Clojure? seems like something obvious someone else's done before..
20:10beamsomultimethod math?
20:11amalloynumeric-tower probably has it
20:11amalloywhich i think used to be generic-math
20:11arrdemyeah I found the old generic-math..
20:12justin_smithhttps://github.com/clojure/math.numeric-tower/blob/master/src/main/clojure/clojure/math/numeric_tower.clj#L103
20:12justin_smithit uses a protocol
20:12arrdemthanks justin_smith. I knew I'd seen something like this around before.
20:13justin_smithit's a smaller ns than I expected
20:14arrdemit's also kinda all it takes to put Clojure math on par with "normal" Lisp math :facepalm:
20:14Pate_thx, justin_smith I think my partition-by predicate is buggy
20:17ToBeReplacedarrdem: see algo.generic
20:17arrdemToBeReplaced: THANK YOU
20:17arrdem(inc ToBeReplaced)
20:17lazybot⇒ 2
20:18jergasonfriends, i'm struggling with moving to a functional style.
20:18ToBeReplacedha, i didn't know i had ever been inc'd in the first place
20:18jergasoni find myself using let everywhere to make local variables, and it feels icky
20:18arrdemToBeReplaced: :P I can remember most of the standard library... the contribs just clutter my head :(
20:18jergasonare there some general strategies to avoid doing imperative programming via lets in clojure?
20:18jergasondoes this even make my sense?
20:18jergason*sense
20:18justin_smithjergason: but local bindings is the only reason to use let, and let is the main way to make local bindings
20:18Pate_justin_smith, fixed! partition-by doesn't work the way I thought it did.
20:19jergasonyeah, i just feel like i'm abusing local bindings
20:19justin_smithwell I guess it does sequencing too
20:19arrdemso why is that algo.generic when we have numeric-tower..
20:19justin_smithabusing them?
20:20justin_smithif you need to do multiple things in a specific order, and know all their return values, let is just fine for that
20:20scottjjergason: if you want more specific help, share a snippet of code and people can give feedback
20:20justin_smithand even if you ignore some return values (using _ on the lsh), that's still OK
20:20justin_smith*lhs
20:20jergasoni shall do this
20:20arrdem(inc ToBeReplaced) ;; have some more karma. exactly what I was trying to remember.
20:20lazybot⇒ 3
20:20jergasonlemme make it work first
20:23ToBeReplacedarrdem: it looks like the protocol in numeric-tower is meant for internal implementation of just those methods that need to be dispatched over primitives
20:23ToBeReplacedi certainly wouldn't extend them... i'd use algo-generic for algebraic props
20:24scottjjergason: btw, rich uses a lot of let bindings IMO, see for example codeq.
20:25scottjso you're in good company :)
20:25arrdemToBeReplaced: yeah. I'm just gonna work off of algo
20:25arrdemseriously tho... I knew that such a thing existed. I'm not insane! yay!
20:35arrdemtechnomancy: is lein supposed to load "user.clj" before it does anything?
20:37technomancyarrdem: yeah, that's outside its control
20:37technomancyclojure does that; no way to turn it off or anything even if we wanted to
20:37arrdem:sadpanda:
20:37arrdemokay thanks. didn't know that.
20:40Frozenlocktechnomancy: might I ask more info about this? https://github.com/ato/clojars-web/pull/203#issuecomment-40665321
20:40FrozenlockWhere do you put this code?
20:40technomancyFrozenlock: that's just from the dotfiles for my browser
20:41technomancygotta head out for dinner; bbiab
20:41arrdemTIL tech is a konqueror user.
20:41technomancydude
20:41technomancynot konqueror
20:41technomancyconkeror
20:42TEttingerthe XULrunner based keyboard driven browser, conkeror
20:43arrdemman... I may just switch browsers for webjumps.
20:43arrdemcrud
20:58akhudekhow I wish for this right now https://code.google.com/p/closure-compiler/wiki/FAQ#My_code_broke_when_using_advanced_optimizations!_How_do_I_figure
21:30xeqiFrozenlock: yep, I didn't use <button>s initially, and hadn't gotten back around to fixing it
21:31Frozenlockxeqi: Ok, so I'm not crazy :)
21:32FrozenlockI sent you a pull request, for the tiny tiny change.
21:32xeqiI wouldn't go that far
21:42arrdemwhere would you guys suggest starting on wrapping this? https://github.com/pusher/pusher-java-client
21:43arrdemI'm a little thrown by the anon class instantiation, and how to duplicate it.
21:56dissipatein order to use tools.logging do you have to have log4j or another java based logger installed?
22:07llasramdissipate: In your deps, yeah
22:27amalloyarrdem: you want reify
22:42dissipateamalloy, what is the most light weight logging utility to get up and running quickly?
22:45amalloywhy are you asking me? if it's a general question and not a continuation of a conversation we've been having, ask the channel
22:46dissipatewhat is the most light weight 'batteries included' logging utility?
22:46gfredericksare those contradictory requirements?
22:49dissipategfredericks, i don't want to mess with log4j or any of the other complicated ones
22:49nightflyrsyslog
22:50dissipatenightfly, any experience with this one? https://github.com/pjlegato/onelog
22:53ddellacostadissipate: clojure.tools.logging works just fine
23:02dissipateddellacosta, i guess i'll use that with just the default log4j config file
23:02dissipateddellacosta, but i don't understand why tools.logging is so heavy
23:02ddellacostadissipate: what do you mean, heavy?
23:03dissipateddellacosta, log4j is crazy. it has a 200 page manual that goes with it.
23:04ddellacostadissipate: what does that have to do with tools.logging?
23:04dissipateddellacosta, it uses log4j
23:04ddellacostadissipate: use timbre if you want to pretend you are not using java
23:05ddellacostadissipate: it's significantly "heavier" though, in terms of Clojure codebase
23:06dissipateddellacosta, onelog it is for me then. i just want to log to stdout
23:36ToBeReplaceddissipate: i don't know what was going on before... clojure.tools.logging is solid, and will use whatever logging backend is in your path... if you don't have one, it will use java.util.logging, which will go to stdout by default
23:39dissipateToBeReplaced, ah, i did not realize that. thanks for the info.
23:41dissipateToBeReplaced, you wouldn't happen to know a good scheduling library other than the ones listed here? http://www.clojure-toolbox.com/ something lightweight
23:45ToBeReplacedunfortunately there are no good scheduling libraries anywhere ;)
23:46ToBeReplaceddissipate: it depends what you are looking for... i don't think there are any viable alternatives to Quartz or Cronacle for the enterprise, but i haven't looked recently
23:47ToBeReplacednothing wrong with ScheduledThreadPoolExecutor if you're talking "do this once a minute" type of stuff
23:48amalloy~java.util.concurrent
23:48clojurebotjava.util.concurrent is "When I find myself in times of trouble / Prof. Doug Lea comes to me / Coding lines of wisdom / j.u.c."
23:48dissipateToBeReplaced, i'm not really interested in scheduling something for the future or doing some cron-like schedule. my use case is scheduling something right away based on a message from a queue. i just want to be able to keep track of the running task, and start/stop/pause it