#clojure logs

2013-11-14

00:25bitemyapp`cbp: welp. Single Drafted Faceless Void.
00:26`cbpop
00:26bitemyapp`cbp: like locking 9 helpless children in an abattoir with Freddie Krueger.
00:27`cbp:-s
00:27bitemyapp`cbp: enchantress paused the game to wait for somebody
00:27bitemyapp`cbp: so I asked, "oh, you have my ult too?"
00:27`cbplol
00:29muhoogamers
00:29muhoo:-P
00:36bitemyappmuhoo: >:)
00:43john2xhow do I check if a list of re-patterns are in a string?
00:44bitemyapp`cbp: huskar is a dick.
00:44`cbphe is really lame
00:47bitemyapp`cbp: starting to think huskar counters everything
00:49john2xman I miss dota2. any new heroes lately?
00:50bitemyappjohn2x: not so far as I know.
00:50bitemyappjohn2x: huskar is really fucking annoying lately.
00:51bitemyappwe have a serious lack of support/cc on my team to.
00:51bitemyapptoo&*
00:57biggbearlooking for a function like (reduce) but for only one argument.
00:57satshabadwhat's the rational behind suing (if (seq coll) ... ...) instead of (if (not (empty? coll)) .. ..) or something else
00:57satshabadi mean, why "cast" something to seq?
00:57satshabadis it because it works on both nil and []?
00:57bitemyapp,(empty? nil)
00:57clojurebottrue
00:58satshabadso no diff?
00:58bitemyapp,(empty? '())
00:58clojurebottrue
00:58bitemyapp,(empty? [])
00:58clojurebottrue
00:58bitemyappsatshabad: that's the idiom because it's nicer.
00:58satshabadwhich?
00:58bitemyapp(seq [])
00:59satshabadah ok
00:59satshabadnicer how?
00:59bitemyappshorter
00:59satshabadhmmm ok
00:59satshabadthanks
01:26jballancsatshabad: if you prefer the more straight-forward logic of `empty?` (I do) use it with `if-not`
01:26jballanc,(if-not (empty? []) (println "There's something there") (println "It's empty, Jim."))
01:26clojurebotIt's empty, Jim.\n
01:26bitemyappwelp. Snapchat refused a $3bn acquisition from Facebook.
01:27bitemyappClearly I should start a startup and hack on an iOS app from Venice Beach, CA
01:27satshabadif-not empty
01:27satshabadi like it!
01:27satshabadjballanc: thanks
01:27jballancthere's also when-not
01:27jballanc:)
01:29biggbearis there a version of this function? It is supposed to return (f ... (f (f (f x))) n times: (defn eat-times [n f x] (loop [i 0 y x] (if (< i n) (recur (inc i) (f y)) y)))
01:31satshabadoh oh yes
01:31satshabadum
01:33satshabadbiggbear: http://clojuredocs.org/clojure_core/1.2.0/clojure.core/iterate
01:33satshabad(nth (iterate f x) n)
01:34Apage43but but
01:34Apage43that's like, three instagrams
01:34satshabad,(nth (iterate dec 46) 12)
01:34clojurebot34
01:34biggbear<satshabad>: i was considering iterate but it constructs the whole seq and then you have to call the (nth) function.
01:34satshabadright
01:34satshabadyeah
01:35Raynes&(doc iterate)
01:35lazybot⇒ "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
01:35satshabadnot great
01:35RaynesIterate is lazy.
01:36RaynesIt only has to generate up to the element that you request.
01:36satshabadyes but it will have to generate all the ones before that right?
01:36satshabadoh wait
01:36satshabadi see
01:36satshabadsame # of function calls right?
01:36RaynesI also misunderstood a bit.
01:36RaynesMaybe.
01:37RaynesYeah.
01:37RaynesIterate should be fine, I think.
01:39bitemyappcoventry: WHOA
01:39biggbeariterate would be good for n <<MAX_NUMBER
01:39bitemyappcoventry: https://github.com/coventry/troncle are you serious about this?
01:39bitemyappcoventry: plz say yes ;_;
01:40bitemyappRaynes: makes my deftrace macros unnecessary >:)
01:42satshabadclojure is making me sad. I can't get it to multiply a 1024x1024 matrix
01:42satshabadhttps://github.com/Satshabad/Matrix-Mult-Analysis/blob/master/src/project1/core.clj
01:43satshabadwhat could I be doing wrong?
01:43satshabadall my friends with their java, multiplying 8000x8000
01:43logic_progwhat fails?
01:44satshabadit just takes too long
01:44satshabadgets stuck at 1024
01:47TEttinger8000x8000 what?
01:47satshabadoh
01:47satshabadmatrices
01:47satshabadof random numbers
01:47satshabadbetween a certain range
01:47TEttingerusing vectorz-clj or something meant for it?
01:48satshabadyes, but this is more of an exercise
01:48satshabadif I use core.matrix I can do 8000x8000
01:48satshabadbut my naive impl is waaaay worse than the naive impl in java
01:49satshabadjust wondering if I have something glaringly wrong
02:00deobaldDoes anyone have any recommendations for migration libs in Clojure? It looks like migratus, ragtime, and clj-sql-up all might be sensible tools.
02:17TEttingersatshabad, naive clojure uses pretty heavyweight objects rather than primitives by default. you can use arrays in clojure.
02:21bitemyappdeobald: migratus is my preferred solution, but it's a little pissy about the filenames/
02:23satshabadTEttinger: cool
02:23satshabadcould I still use them in the imutable style?
02:23TEttingerhowever I am having trouble as well getting a non-library way to work in under the 10 second limit of lazybot
02:24TEttingerno, arrays are mutable
02:24satshabadah yes, I read a bit about transients
02:24TEttingeryou also use different functions with them, like amap
02:24satshabadvery very cool stuff
02:25satshabadso is that what something like core.matrix is doing under the covers?
02:25satshabadbecause it looks like they still use all clojure
02:36echo-areaWhat I figured: Since macro expanded forms will be compiled and evaluated by the compiler, type hints in it shall be provided only symbols or strings, e.g. ~(with-meta 'some-symbol {:tag 'name.of.a.Class}) or ~(with-meta 'some-symbol {:tag "name.of.a.Class"}).
02:37echo-areaUsing classes, e.g. ~(with-meta 'some-symbol {:tag name.of.a.Class}), will _not_ work.
02:37echo-areaThis is a little bit unintuitive
02:38echo-areaWill it hurt if clojure.lang.Compiler.tagOf accepts class additionally?
02:44H4nsis there an established way to use precompiled dependencies in clojure projects? i would like to avoid having to recompile all third party libraries with every build that i do.
02:44deobaldbitemyapp: Thanks. :)
02:55sm0kehey guys i am using clojure.tool.logging and have i app packaged as a uberjar
02:56sm0keproblem is i am not able to configure log4j
02:56sm0kewith this log4j.properties file https://www.refheap.com/20856
02:56sm0keits like clojure doesnt pick it up everything is being logged to console
02:59bitemyappsm0ke: you should log to find out what's...oh.
02:59bitemyappsm0ke: println? ;)
03:00sm0kehmm i have everything jar and config file in same folder and i start with java -cp .:jarfile.jar ...
03:00sm0kealso i have a conf file which is being picked up properly
03:00sm0kejust the frkn log4j
03:10adiei am using ring/compojure to write a web hooks service, however when i get a request on the web hook url , the request body contains this java object :body #<HttpInput org.eclipse.jetty.server.HttpInput@75dced99>, a slurp on this reveals an empty string, however the content-length varies for different requests. How do i read from this object?
03:18bitemyappadie: you broke something
03:31amalloybitemyapp: probably not. more likely, some middleware already read the body, and since streams are stateful if he tries to read it again it's gone
04:12_adiebitemyapp: broke what?
04:14bitemyapp_adie: amalloy's suggestion is probably closer to the mark, but it's what I was obliquely referring to.
04:14bitemyapp_adie: have any idea why a stream might be your body instead of a string response?
04:15_adiebitemyapp: basically i am testing out Stripe's web hook service, they send data as JSON in the body of the request to our web hook url
04:15echo-areaWhat is the quality of Clojure-CLR? Is it as mature as Clojure on Java?
04:16jcfis there anyone familiar with cucumber-jvm who might be able to shed some light on why I can't use a particular macro in one of my step defs? https://github.com/cucumber/cucumber-jvm/issues/631
04:25brainproxyis there a earmuffs var or something I can set so that I can do println debug stuff in my macros, during a clojurescript compile?
04:26brainproxythat is, so I can spit stuff out in the same terminal where the compiler is reporting about "Successfully compiled...", etc.
04:32bitemyapparrdem: http://i.imgur.com/mZY6tYx.jpg
04:34bitemyappucb: what's a wibble?
04:34ucbif ping is to pong, the wibble is to ...
04:34bitemyapphttp://www.urbandictionary.com/define.php?term=wibble
04:35bitemyapphuh.
04:35ucbheh
04:35ucbhow's things bitemyapp?
04:35bitemyappucb: good. lots of category theory, Haskell and Clojure open source in my life lately.
04:36ucbgood.
04:36bitemyappucb: depressive black metal, yes/no?
04:36ucbalways
04:36bitemyappucb: http://www.youtube.com/watch?v=X5rDyQ_iZWI
04:36ucbsorry, "* metal" is already a 50% win for me
04:39bitemyappI work at a genetics company, I need to try this out http://i.imgur.com/Ut8IWmJ.jpg and see who gets mad.
04:39bitemyappmaybe post it in a bathroom.
04:40ucbheh
04:42amalloynot bad, bitemyapp
04:42bitemyappamalloy: uh, which part?
04:42amalloyoh, the biology joke
04:42amalloynot a huge fan of metal
04:43bitemyappamalloy: I might flip it into a "CATegory theory cat" though, since that's the only thing I'm into that is "harder" than biology.
04:45amalloymeh. there's no traditional competition between category theory and biology
04:46bitemyappamalloy: well indirectly
04:46bitemyappamalloy: it's just removed by like 4 layers of increasing hardness.
04:46bitemyappmathematicians make fun of physicists, and category theorists make fun of specialist mathematicians.
04:49echo-areaamalloy: Will it hurt if clojure.lang.Compiler.tagOf also accepts classes? With that we can use ~(with-meta 'obj {:tag name.of.Class}) instead of ~(with-meta 'obj {:tag 'name.of.Class})
04:50echo-areaOr ~(with-meta 'obj {:tag "name.of.Class"})
04:51echo-areaWhat is the corresponding of clojars for ClojureCLR?
04:53bitemyappecho-area: don't use ClojureCLR if you need support.
04:53_adiebitemyapp: got it, had to use ring middleware wrap-json-params, to get data out of the request body
04:54echo-areabitemyapp: Got it. That's a hard decision
04:56bitemyappecho-area: not really, it's quite simple. Cowboy up or make peace with the popular runtimes.
04:57echo-areabitemyapp: I have some concerns on distraction, so "cowboy up" doesn't seem an attractive choice
04:57TEttinger##(let [☃ "hey would you look at that"] ☃)
04:57lazybot⇒ "hey would you look at that"
04:58bitemyappecho-area: well then don't use an implementation all of 3 people use, 2 of whom are actually the Unabomber.
04:59TEttingerecho-area, I hear F# isn't bad at all. I'm curious why you picked ClojureCLR if you are bound to the CLR, since F# is much better-supported on that VM
05:00TEttingerof course, clojure IS a wonderful, expressive, concise, productive language.
05:01echo-areaTEttinger: I have only LISP background and am more familiar with Clojure. To be honest, I think F# is more detractive than ClojureCLR :(
05:01TEttingerthat's a good reason.
05:01bitemyappdetractive?
05:01bitemyappecho-area: you mean attractive?
05:02bitemyappecho-area: if you find F# interesting, you might be better served by Haskell or OCaml.
05:03p2147483647I'm very new to clojure, why doesn't this: (defn xs [] (cons 1 xs)) give me an infinite list when I do (xs) ?
05:03echo-areaNo, I mean detractive. I actually mean I don't have enough resource to put into debugging problems that are not directly related to my later project
05:03p2147483647wait, nevermind :D
05:03p2147483647cons 1 (xs)
05:03p2147483647and stackoverflow is fine too
05:04p2147483647I'm guessing I want a lazy seq instead
05:05bitemyappp2147483647: yes.
05:05bitemyappp2147483647: but to implement the specific thing you want...
05:05bitemyapp,(take 10 (range))
05:05clojurebot(0 1 2 3 4 ...)
05:05p2147483647actually I want an infinite list of 1s, heh
05:05p2147483647just mucking about
05:06bitemyapp,(take 10 (repeat 1))
05:06clojurebot(1 1 1 1 1 ...)
05:06echo-areaUse repeated
05:06bitemyappp2147483647: I can do this all day.
05:06echo-areaI mean repeat
05:06p2147483647haha
05:07p2147483647fair enough :)
05:07p2147483647oh, I can't do stuff that might be tail-call-optimised away, right?
05:07bitemyappp2147483647: there is no TCO in Clojure, technically
05:07ucbbitemyapp: http://www.youtube.com/watch?v=8kZMVG6N7DE
05:07bitemyappthere are explicit uses of loop/recur or lazy-seq...or let-fn
05:07ucbbitemyapp: perhaps not your taste, but still amazing music
05:07bitemyappp2147483647: https://www.refheap.com/20858 this is the source to repeat.
05:08bitemyappp2147483647: bears a striking similarity to what you tried, no?
05:08bitemyappucb: way far removed from what I listen to, but talented singer.
05:08ucbbitemyapp: cult figure as well
05:09p2147483647bitemyapp: that link doesn't seem to work for me
05:09ucbbitemyapp: figured since you sent me down depressing-lane that I'd return the favour.
05:09bitemyappucb: do white people worship him or something?
05:09ucbbitemyapp: though "depressing" is not the right term in this case.
05:09bitemyappp2147483647: http://clojuredocs.org/clojure_core/clojure.core/repeat click the + next to "Source"
05:09ucbbitemyapp: I'd go for melancholic really.
05:09ucbbitemyapp: many do.
05:09bitemyappI don't actually find DBM depressive.
05:09ucbDBM?
05:09bitemyappdepressive black metal
05:10ucboh
05:10p2147483647bitemyapp: ooh, neat. I think I can spend quite a lot of time in the docs now :)
05:10p2147483647bitemyapp: thanks very much!
05:11p2147483647and yes that's exactly what I was looking for
05:12bitemyappp2147483647: cheers :)
06:46lalilunaHello, is lein ring server supposed to reload routes as well?
07:39john2xdoes lein run foo pass "foo" to -main?
08:41loliveirahi! =) Why is enlive return only one <td>? (the page has 3).
08:41loliveira(-> (http/get "http://pt.wikipedia.org/wiki/Categoria:Bairros_da_%C3%81gua_Rasa&quot;) enlive/html-snippet (enlive/select [:table]) pprint)
08:43loliveirai forgot to extract the body from the http response.
08:43loliveirathis works: (-> (http/get "http://pt.wikipedia.org/wiki/Categoria:Bairros_da_%C3%81gua_Rasa&quot;) :body enlive/html-snippet (enlive/select [:table]) pprint)
08:44mdrogalis:)
08:46loliveirai was dealing with this bug for 30 min. I posted here and realize my mistake in 30 sec \_(ツ)_/¯
08:47danneuerry day
08:47mdrogalisAw, no brilliant Rich Hickey keynote at the Conj this year.
08:48mdrogalisUnless Harmonikit is not in fact what it sounds like.
08:49danneui now have a 3 days of experience using typed-clojure on a meddlesome project and i'm sold
08:51danneuat first, all the type-check errors are due to gaps in my own knowledge and fledgling typed-newbie ways
08:51danneubut now the type-errors that pop up are due to real type conflicts and i see the light
08:52loliveiradanneu: https://github.com/clojure/core.typed ?
08:52danneuyeah
08:54danneuclojure solves most of my painpoints from other languages, but the final pain point is that i dont remember what functions expect/return
08:54danneuis it a byte-array or a map
08:55loliveiradanneu: i liked
08:55Ember-danneu: write your functions in a way they can accept any clojure data structure and pass around those
08:55Ember-and if you really need to be specific about the type use contracts
08:56Ember-and if you *really* need to be specific about types and structure of your data structures then use typed clojure
08:56danneuEmber-: But what does that really mean? a multimethod that accepts [B vs IMap every step of the way?
08:57Ember-danneu: that depends of course
08:57Ember-and I really cannot give you any 100% correct answer
08:57danneuwell, yeah
08:57Ember-just think about functions such as first, second, rest etc
08:58Ember-which can operate on several different data structures
08:58Ember-simplicity is the key in everything :)
08:58Ember-but being simple is not necessarily easy
08:59danneusounds like a platitude to me these days
08:59danneusoon your program is spread across many namespaces and you dont get to work on it every day to keep it in your head
08:59mdrogalisDifferent layers, different techniques, people...
09:00Ember-danneu: I hope you are joking or I got you wrong
09:00Ember-surely you do use multiple namespaces?
09:02danneui'm just saying that it doesn't take long for my program to grow to the state where i need to leave myself reminders of what functions expect/return
09:02danneuso i end up with a sort of layman's type-system in comments
09:06gunsdanneu: https://github.com/Prismatic/schema provides custom defn and defrecord macros with easy to read type annotations
09:06gunsdocs say it hopes to be a superset of core.typed eventually
09:07danneuguns: yeah, schema is great - that's where i started.
09:09danneui feel like i'm converting my code comments and ad-hoc usage-example-in-the-docstring into code
09:10gunsThis year has been really great; I was interested in golang, and then core.async! Looking at Haskell for type constraints, core.typed + schema!
09:11Ember-danneu: I know what you mean. However I didn't find that too big a problem
09:11Ember-and when I found that to be a problem I used contracts
09:11danneuEmber-: oh, is contracts referring to core.contracts
09:11danneuI just googled it
09:11Ember-danneu: http://blog.fogus.me/2009/12/21/clojures-pre-and-post/
09:12danneuNow those are cool. i just started using those on this project
09:12Ember-you can specify all kinds of pre and post contracts
09:12danneui think core.typed even analyzes them
09:12Ember-you can check the type, structure of your data structure or whatever you want, it's clojure code
09:13Ember-and it's there, it's built in, no libraries needed
09:13mdrogalisPitch for Dire if you like core.contracts :)
09:14HolyJakpre and post checks unfortunately do not support custom error messages and thus it may be hard to interpret the failures but yes, they are useful
09:14danneuit's still just at runtime though
09:15danneufor context, the particular project i'm working on is at a busy intersection of java classes which is why i sought a way to clarify things once the code grew
09:17mdrogalisHolyJak: Custom precondition messages.. Hm, there's an idea.
09:18danneuguns: How do you use schema with typed.clojure? i only have superficial experience with both, but i used them for almost the exact same purpose
09:19danneuof course, core.typed has a type checker
09:19gunsdanneu: Oh, I haven't; core.typed integration is on the schema todo list
09:20gunsthat's all. I'm using schema mostly ATM
09:42klayteI'm new to clojure from python and I miss my dict comprehensions. I've been using (into {} (for [k (range 5)] [k k]) which is fine but I'm wondering if perhaps I'm creating a vector to just throw it away and there's a better way. Tips?
09:44TimMcklayte: If you havne't confirmed a performance problem, don't worry about it.
09:44carkklayte: you'll be throwing away a lot of stuff using clojure, still is fast enough in most cases
09:44TimMcIf you have, there are ways to reduce GC churn and improve speed, but they're less readable and that likely won't balance out the small perf improvement.
09:45TimMcklayte: You may also be interested in zipmap, by the way.
09:45TimMc&(let [r (range 5)] (zipmap r r))
09:45lazybot⇒ {4 4, 3 3, 2 2, 1 1, 0 0}
09:47klaytesure, still comprehensions are more flexible and I'm used them.
09:48klayteI've heard the term "structural sharing" used, would this be taking place in that example? are the cells from the vector reused by the map, how would I go about finding out?
09:49klayteI'm not chasing perf really, just interested in a better understanding of behind the scenes.
09:50TimMcNot in this case -- keys and values are stored separately in hashmaps.
09:51ohcibihi i'm using clojure.tools.trace to study a bit and I want to trace an anonymous function... how would I do that? I tried to (trace-ns) but I get a classnotfoundexception for my namespace...
09:51TimMc(There's no opportunity for sharing here because Clojure's map impls aren't strustured like association-lists.)
09:52klayteI see, I thought it was shallow trees all the way down...
09:53TimMcHmm? It is.
09:53BronsaTimMc: aren't PAMs association-lists?
09:53TimMc32-way trees representing the hash lookups.
09:53TimMcBronsa: Yeah, I suppose so, but I think klayte is working with PHMs.
09:56TimMcOh interesting, PAM interleaves keys and vals in an array: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentArrayMap.java
09:56TimMcI was expecting an array of pairs.
10:01klayteTimMc: So does structural sharing always take place between identical types only?
10:02TimMcMostly, I think? Sequences can definitely share across types.
10:03TimMcThere are several different kinds of ISeq, and all they care about is that the "rest" value is another ISeq (or null).
10:05TimMcBut vectors and maps... I think they only exhibit persistence per concrete impl, in the general case. ("Modifying" a value generally gets you back the same type, of course.)
10:15danneuklayte: http://hypirion.com/musings/understanding-persistent-vector-pt-1
10:20danneuklayte's example: (into {} (for [...] [a b])). `into` calls `transient!` on that {}, and `for` returns a lazy-seq of those vectors.
10:20danneuhow would you describe the performance or what's going on between the lazy-seq consumption and the conj! into {}?
10:22danneui suppose the lazy-seq doesn't actually change anything. might as well be one vector of vectors
10:37schmiris there a way to check if a core.async channel is closed when putting items in the channel
10:37schmir?
10:42BobSchack(.closed chan) I think
10:43danneuschmir: channel returns nil if closed
10:43danneuif you put
10:45danneuright?
10:48schmirdanneu: yes, but it also does that on a non-closed channel :)
10:50schmir(deref (.closed chan)) does work though. but it looks like I shouldn't use that...
10:54BobSchackwhy do you need to check if the channel is closed?
10:55nDuff...particularly, why do you need to check *from the writing end*?
10:56schmirBobSchack: I'd like to stop an producer by closing the channel
10:58BobSchackI believe there's funcationality for splitting channels (tap I think) so that you can have one channel's input be split into multiple channels
10:59BobSchackI'd split that channel into two channels and have a go loop check if the channel has been closed and then send a message back to the producer
11:00BobSchackhttps://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L632
11:00BobSchackis the relevant place in the code
11:03schmirthanks BobSchack. I'm probably going to use a control channel...
11:04danneuseems like there would be an easier way than to poison the producer from its own channel
11:08danneuactually that is simple
11:09danneui guess you could pass the consumer ctor into the producer ctor
11:14nDuffHmm.
11:15justin_smithwow
11:15justin_smithas in nicer than vanilla interop?
11:15nDuffjustin_smith: this isn't a favorable version of "more interesting".
11:15TimMchaha
11:15justin_smithoh
11:18seangroveInteresting is more often used as a euphemism than its sincere meaning
11:19nDuffthere are a lot of assumptions I'd made (like arrays being seq'able) that I wasn't aware fo until they broke.
11:20S11001001,(seq (to-array [1 2 3]))
11:20clojurebot(1 2 3)
11:21S11001001oh, clojurescript
11:22nDuff"Error evaluating:" (.listFiles (java.io.File. test-path)) :as "(new java.io.File(cljs.user.test_path)).listFiles()"
11:22nDufforg.mozilla.javascript.EvaluatorException: Java class "[Ljava.io.File;" has no public instance field or method named "cljs$lang$type". (cljs/core.cljs#6660)
11:23danneuI think I asked this too late in the day last night, but is there a better way to detect byte-arrays than (Class/forName "[B")?
11:23S11001001,(apropos "byte-array")
11:23clojurebot(byte-array)
11:23justin_smithis it totally insane that I am about to attempt to run a ring app on a microsoft surface?
11:23S11001001,(apropos "byte")
11:23clojurebot(aset-byte byte bytes byte-array unchecked-byte)
11:24jared314justin_smith: the tablet or the table?
11:24S11001001,(doc bytes)
11:24clojurebot"([xs]); Casts to bytes[]"
11:24justin_smithtablet
11:24jared314justin_smith: not that insane
11:24justin_smithtrying to address a windows specific bug in my lib
11:24jared314justin_smith: the table would be more insane
11:24justin_smithheh
11:25danneuS11001001: how about a surrogate for (defmulti foo class) (defmethod foo (Class/forName "[B" [bytes] ...)
11:25danneu(missing paren)
11:25S11001001eh, better to just have the predicate
11:26danneuwhat do you mean
11:27S11001001defn byte-array?, you know the rest
11:28danneuah, forgoing the multimethod
11:28TimMcnDuff: Arrays aren't seqable on rhino CLJS?
11:28Fenderhey guys, I already found lots of answers to this problem (http://stackoverflow.com/questions/1740830/java-3d-plot-library) but I feel no answer is "good enough". I am looking for a 100% interoperable library (so no JOGL) for plotting a matrix with scaling, rotation and elevation. surfaceplotter (https://code.google.com/p/surfaceplotter/) is closest but it has no doc, so either it doesn't work or I don't understand some settings. Besides, its code doesnt
11:28TimMcIs this a protocols issue?
11:29nDuffTimMc: I haven't dug in yet (need to actually implement the thing I'm trying to build; with cljs off the table, currently using Python).
11:29FenderI thought since there are the CERN matrix libs and clatrix and so on, there must be some decent 3d plotting tool for these, but I haven't found anything up to now
11:32Fender unfortunately I didn't attend computer vision either...
11:37justin_smithwhat about converting the matrix into opengl polygons?
11:38justin_smithI know that is less handy than a prerolled matrix visualizer
11:39Fenderactually I was kind of looking for a fully fledged lib to do that
11:39Fender:)
11:39FenderI doubt that there are dozens of matrix classes yet none has a nice visualizer?!
11:39justin_smithyeah, I figured
11:42Fendermaybe its even a nice freelance project
11:44Fenderthe "best lib" as mentioned above interweaves swing events with data D:
11:51TimMcalexbaranosky: workatruna.com has a malware infection -- if it's even a legit Runa website
12:36danneuHow would you type-hint (map #(.indexOf (seq "abc") %) "abacaba")
12:37danneu- to avoid reflection on `.indexOf` invocation?
12:37S11001001danneu: well, that seq call shouldn't be there
12:38TimMcWhy not?
12:38TimMcOh, nvm, String has that as well.
12:38TimMcand I was thinking of colections
12:43danneuhttps://www.refheap.com/20870
12:43danneuWithout seq, reflection just fails
12:43danneuwell, invocation fails
12:44`cbpdanneu: you can remove the seq and change % to (str %)
12:44S11001001danneu: or (char %)
12:44S11001001,(map class "ab")
12:44clojurebot(java.lang.Character java.lang.Character)
12:45S11001001danneu: also what is alphabet's type?
12:45`cbpdanneu: or typehint with ^clojure.lang.StringSeq
12:45danneuString. I see that signature is .indexOf(String)
12:46danneu(str %) worked. thanks
12:46danneui didnt think of hinting the clojure StringSeq type
12:54TimMcProbably sufficient to hint it as a List.
13:53fakedrakehello
13:53fakedrakewhat is a good library for graphs?
13:53fakedrakecontrib.graph looks fine but isnt contrib deprecated?
13:55patchworkfakedrake: I have used loom successfully
13:55mdrogalisfakedrake: Might try this. https://github.com/jgrapht/jgrapht
13:56mdrogalisI wish that website would be reindexed.
14:02fakedrakethanx guys
14:03mattreplfakedrake: I second loom. it's the best option unless you want a graph db (then I'd suggest neo4j)
14:05arrdemclojurebot: ping
14:05clojurebotPONG!
14:07egosumis anyone aware of a nice datalog -> postgresql convertor? ideally in clojure?
14:08nDuffegosum: you mean for queries? They're not exactly equally-expressive languages.
14:09nDuffegosum: ...you'd have a fair number of queries that *couldn't* be translated.
14:11egosumnDuff: yes, for queries. My understanding is there is a reasonable correspondence between DataLog and SQL
14:12mdrogalisIt's kind of like English and French. They're both collections of words to communicate something, and mostly get the same job done, but there're cases where there's no direct translation at all.
14:13nDuff(and also quite a lot of cases where a good translation is not a mechanical operation)
14:13mdrogalisYeah
14:13mdrogalisnDuff why aren't we at the Conj? :(
14:13bitemyappbecause I'm not.
14:14mdrogalisOh hello.
14:14egosumnDuff: mdrogalis: sure, the lack of recursion in vanilla SQL would mess things up. However, e.g. Postgres supports recursion in queries…
14:14nDuffmdrogalis: ...shoot; I hadn't realized what I was missing. Not a good time for me to travel, though -- burned a lot of PTO getting married, and in the middle of several real estate transactions.
14:15egosumAnd is hackable in other SQL engines, though not efficient.
14:15mdrogalisCongratulations, nDuff :)
14:15mdrogalisegosum: I remember seeing a SQL <-> Datalog app somewhereee a while ago. It was just for learning purposes.
14:15mdrogalisIt wasn't like an all-purpose translator
14:15egosumI was just wondering if someone has worked on a nice translator yet :) seems like something that would be useful. I mean, Datomic has one somehow haha
14:16bitemyappyou could translate simple queries, but it's still o_O
14:16egosummdrogalis: yeah I think I found it somewhere, but the server is down/no longer around
14:16bitemyappit's a project I've considered
14:16mdrogalisHeh, true, egosum
14:16mdrogalisIt wasn't worth your time, egosum
14:17egosumbitemyapp: Yeah, I'm considering it. I'd love something to sit over postgres and translate datalog queries to SQL for me
14:17egosumbitemyapp: would be a fun research project. I'm finding some papers related to it
14:17egosumSome older code as well
14:18egosumWould be immensely useful, for me at least
14:18bitemyappI don't totally see why
14:18bitemyappbut again, any translator couldn't be fully general, which sucks.
14:18nDuffegosum: well, if you only wanted something similar to datomic's backend (one big kvs table), that's a bit different.
14:18nDuffegosum: (than a fully general translator to realistic relational schemas)
14:19mdrogalisI'm gonna try an alternate query engine for Datomic. It will probably go terribly. But I'll do it anyway
14:19egosumnDuff: Sure, you can optimize the former considerably better. But the latter should be a possibility. Not sure which I'd prefer.
14:20egosumkvs with Datalog takes care of most of the advantages of having a RDMS anyway, so maybe simply and engine like that would work
14:20egosuman engine* but I'd need to think about. Know of one like that? (kvs & datalog on postgresql)
14:28MorgawrI'm getting a weird problem with a float buffer (java data structure)
14:28Morgawrhttps://www.refheap.com/42c2121f97518e24cea3f0ffc here's the example
14:29MorgawrIf I call (.rewind buffer) from inside the function and return the buffer, rewind doesn't work
14:29MorgawrI need to call it outside the function
14:29Morgawrdoes anyboyd know why this could be happening?
14:29MorgawrBufferUtils is just stuff from lwjgl but it doesn't matter, it creates a float buffer
14:29Morgawrhttp://docs.oracle.com/javase/7/docs/api/java/nio/FloatBuffer.html
14:31Morgawrit's really weird
14:33Morgawroh... looks like the problem is the doall
14:33Morgawrit instantly returns
14:41satshabadTrue or False? If I have *warn-on-reflection* set and it's not warning me, there is no use for type hints.
14:41ndpMorgawr: have you tried using dorun instead?
14:41nDuffsatshabad: true.
14:42satshabadwoah. OK good to know
14:42mdrogalissatshabad & nDuff: Performance?
14:42nDuffsatshabad: if you wanted actual type checking and enforcement, you could use core.typed, but hints won't do you any more good.
14:42satshabadyes
14:42nDuffmdrogalis: the performance benefit is by way of avoiding reflection.
14:42satshabadgot it
14:42nDuffmdrogalis: ...if there aren't any warnings indicating that reflection is happening...
14:42mdrogalisAh, got it.
14:43Morgawrokay nevermind sorry, I found the problem, my namespace got messed up with the repl and it was updating the source but not the loaded symbols
14:43Morgawrweird
14:43Morgawrbut yeah thanks ndp, fixed it now
14:43satshabadso like in this example: http://clojuredocs.org/clojure_core/clojure.core/amap
14:43satshabadthe reason for the type hint is that it would use refection?
14:45nDuffsatshabad: correct.
14:46satshabadnDuff: ok cool
14:50satshabadnDuff: what about this? http://dev.clojure.org/display/design/Documentation+for+1.3+Numerics
14:50satshabadthe Primitive hinting part
14:50satshabadit says hint to avoid boxing
14:50satshabadhow does that relate to reflection?
14:51nDuffsatshabad: ahh -- that's a somewhat different case (and something that only applies to newer-ish versions of the language... what, 1.3+, maybe?)
14:52satshabadhmmmm
14:52nDuffsatshabad: ...so, yes -- the hard line I gave above (reflection avoidance only) doesn't apply to primitive types.
14:52satshabadyeah it looks liek if you type hint on a function (for a numeric) and then cast the numeric before passing it to the function, you get a boost
14:52satshabadah, ok cool
14:52nDuff...eh? "cast the numeric"?
14:52satshabadsorry
14:52nDuffif you're having to cast things around, that's not helpful.
14:52satshabad(int 1)
14:53satshabadlike that
14:53nDuffjust 1
14:53satshabadthat will be taken as a primative?
14:53nDuffit can be passed to things that accept a primitive, yes.
14:54nDuff...but there are restrictions on primitive use that make it something that maybe calls for a certain amount of judiciousness.
14:54nDuff...in particular, due to the way IFn is constructed, you've got less flexibility in your calling conventions when using them.
14:54satshabadright, I wouldn't want to do that all over, maybe just in a tight loop if i needed to speed something up
14:54satshabadand being aware of what i was passing it to
14:54nDuff*nod*.
14:55nDuffIt's also easy, if uncautious, to have constant boxing/unboxing going on
14:55nDuff...which can quickly get less efficient than just leaving things boxed all the time.
14:55satshabadright. if I (int 1) and then pass it to a non type hinted func, it will unbox and then box.
15:00gfredericksshould data.fressian be available via maven yet?
15:05whilohas anybody here worked with clojure/py ?
15:06bitemyappwhilo: are you trying to get stuff done?
15:07whiloi have to work with python, but i would like to fallback on some clojure functional stuff, when i need to mangle data
15:08whilobitemyapp: i guess you mean, i shouldn't use it. i have difficulties even to find out, what is the most usable version atm.
15:13satshabadso I am profiling some clojure code and it looks like there is a crazy amount of char[]. But my code doesn't even use char[]s. It uses vectors. Do verctors allocate char[] ?
15:14amalloystrings contains char[]s
15:14satshabadhmmm, but I am not using any strings
15:14satshabadit's matrix mult code...
15:16satshabadis there any way this code could be allocating ~100,000 char[] ? https://github.com/Satshabad/Matrix-Mult-Analysis/blob/master/src/project1/core.clj
15:23satshabadhmmm, I think i was attached to the wrong process :/
15:39satshabadif my program is spending a lot of time in AFn.init() does that mean it's creating a lot of functions? or calling a lot of functions?
15:42poppingtonicHello
15:44joegallosatshabad: init() or <init>()?
15:44joegallopoppingtonic: hello
15:45satshabadjoegallo: the latter
15:45bitemyapppic.twitter.com/YmdwcBCbuv
15:45amalloywell, AFn.init() doesn't exist, so that's not surprising :P
15:45joegalloamalloy: inc ;)
15:45poppingtonicjoegallo: hey I'm having a bit of trouble with (use 'clojure.data.json), getting this exception http://refheap.com/20879
15:46amalloysatshabad: AFn.<init>() is creating a function
15:46satshabadhmmm. Would that be called when I use the # syntax as well?
15:46satshabadlike #(inc %)
15:46amalloyi'm surprised you're seeing much time there - it does very little work, and unless you create a lot of functions you never call, i'd think the time taken calling them would dominate
15:46amalloyof course
15:47amalloyalthough #(inc %) is just a bad way to write inc
15:47joegallopoppingtonic: you already have a function named pprint in your ns, and you're trying to pull in clojure.data.json, which also has one
15:47satshabadhaha, yes just an example
15:47joegalloand it's rejecting that
15:47satshabadamalloy: me as well, but I have a map in a tight loops using a # func
15:47satshabadso i suspect that might me it
15:47satshabadit's a triple loop
15:48satshabadno wait
15:48satshabaddouble
15:48amalloysatshabad: if you're attached with a profiler, why don't you just see what the backtrace says? you can tell exactly who's building AFns
15:49joegalloanyway, poppingtonic, base (use ...) statements are a bit of a no-no, you should (use something.something :only [the things you need here])
15:49poppingtonicjoegallo: using (:require '[clojure.data.json :as json]) takes care of it.
15:49joegalloor that
15:49satshabadamalloy: good idea.
15:49satshabadgot to figure out how to do that...
15:49poppingtonicjoegallo: good idea.
15:50poppingtonicis there a lazy slurp?
15:51poppingtonicheh "things clojurists say"
15:52amalloypoppingtonic: strings aren't lazy, so the answer is no. but, you probably *actually* want something else that does exist, like a reader or a line-seq
15:54gfredericksthere goes amalloy again. pointing you at *other* things that you *actually* want
15:54gfrederickslike some sort of machine-learning-driven recommendation engine
15:59concurI'm iterating over a sequence of variables with a for loop, and I want the output to include keywords of those variables
15:59concuris this possible to do?
15:59concurI know this doesn't work:
16:00concur,(for [z [x y]] (keyword 'z))
16:00clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
16:00concurobviously it shouldn't, because I'm quoting z
16:00gfredericksconcur: you'd need a macro for that
16:00concurbut as far as I can tell, there's no way to quote x and y without looping over them separately
16:00concurhmm
16:01concuror perhaps I could quote x and y in the for bindings
16:01concurand unquote in the body
16:02concur,(for [z ['x 'y]] (keyword z))
16:02clojurebot(:x :y)
16:02concuroh right, unquoting only happens in macros
16:03concurI guess I've just concluded the same thing as you
16:04TimMcWell, you can use unquoting outside of macros.
16:05concurisn't it a little dangerous though?
16:07gfredericksconcur: it just isn't relevant
16:08TimMcconcur: No, it's just a way of manipulating data structures.
16:08satshabadif I call to-array on a vector, is that a constant time operation?
16:08TimMc&`[a b ~(range 4) c d]
16:08lazybot⇒ [clojure.core/a clojure.core/b (0 1 2 3) clojure.core/c clojure.core/d]
16:08concurmy understanding of how macros are actually implemented is a little weak
16:08TimMc&`[a b ~@(range 4) c d]
16:08lazybot⇒ [clojure.core/a clojure.core/b 0 1 2 3 clojure.core/c clojure.core/d]
16:09concurdon't macros have to be executed at compile-time?
16:09TimMcconcur: A macro is just a syntax transformer; a function that turns syntax into more syntax. It is handed a wad of code and then spits out a different one.
16:09concurright
16:09gfredericksconcur: so it can see what your variable names are
16:09gfrederickswhile normal functions can't
16:09TimMcAll defmacro does is flag a fn to be run at compile time instead of at runtime.
16:10concurdo variable names actually carry over to java bytecode?
16:10TimMcIn fact, there's a hack you can use to get around that distinction.
16:10TimMc,(@#'and nil nil 1 2 3)
16:10clojurebot(clojure.core/let [and__3941__auto__ 1] (if and__3941__auto__ (clojure.core/and 2 3) and__3941__auto__))
16:11biggbearhow to run a REPL within a given name-space in eclipse. I cant do it. In the terminal i just go to the directory and run lein repl
16:12gfredericksconcur: I have no idea, but bytecode isn't really relevant for what you're trying to do
16:13TimMcconcur: Variables still have their names attached at runtime, yes.
16:13TimMcThey're first-class, in fact.
16:13TimMc&(var and)
16:13lazybot⇒ #'clojure.core/and
16:13TimMc&(meta (var and))
16:13lazybot⇒ {:macro true, :ns #<Namespace clojure.core>, :name and, :arglists ([] [x] [x & next]), :added "1.0", :doc "Evaluates exprs one at a time, from left to right. If a form\n returns logical false (nil or false), and returns that value and\n doesn't evaluate any of the ... https://www.refheap.com/20880
16:13amalloyTimMc: i think it's quite likely he means locals, not vars
16:13TimMcOh hmm, you're probably right.
16:14concuractually, I wasn't quite thinking right when I said variables
16:14concurbut you're right, locals are what I was talking about
16:14TimMcYeah, locals sort of disappear during compilation.
16:15concurhmm
16:15TimMcMacros can see their lexical environment (what locals are bound around the invocation site) but that's a pretty voodoo topic.
16:15concurwell if I did (for [z ['x 'y]] {(keyword z) (unquote z)}), would that work?
16:16TimMcWhat are you trying to do, anyway?
16:16concur,(for [z ['x 'y]] {(keyword z) (unquote z)})
16:16clojurebot#<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote>
16:16concurI'm trying to put some stuff in an incanter dataset
16:16concurand I want to use the names as the labels in the dataset
16:16gfredericksit's worth emphasizing that you don't ever need macros to make your code do something; just to make it look like something
16:17satshabadI don't understand the difference between to-array and into-array. Does anyone know?
16:17concurhmm, I never thought about that
16:17concurbtw
16:17concurhow do I address a specific person?
16:17gfredericksconcur: like this
16:18concurjust put their name and a colon?
16:18gfredericksyeah
16:18garhdezconcur: just write his name
16:18concurohh
16:18concurgfredericks: I thought it was an IRC command
16:18garhdezmost of the irc clients has autocomplete for that
16:18concurwait, did it work?
16:18concurit's still the usual color for me
16:19TimMcBut not for gfredericks, I bet.
16:19mikerodconcur: when I type it to someone, it stays the same color for me; when someone types it to me, it changes color
16:19concurI see
16:19mikerodbut this is IRC client specific I'd say
16:20concuryeah
16:20TimMcIt's not a property of the IRC protocol, as far as I know, but rather a property of basically every IRC client in existence.
16:20mikerodseems to be so
16:20TimMcconcur: You can probably use tab-complete in your client.
16:20concurTimMc, it put a comma instead of a semicolon
16:21TimMcThat works too.
16:21concurbut it did autocomplete
16:21concurok
16:21concurwell now I know
16:22TimMcconcur: So anyway, you have some locals or vars called x and y and you want to give incanter something like {:x x, :y y}, right?
16:24TimMcI would counsel you to make the mapping explicit so as not to create a tight coupling between your data format and your program's implementation.
16:25TimMcsatshabad: Looks like to-array is more limited in what it accepts, and always creates an Object[] instead of allowing you to choose a component type.
16:26amalloyfwiw, i have a macro such that (keyed [x y]) expands to {:x x, :y y}. not so useful for teeny tiny maps, but it's a cute dual to :keys destructuring
16:30satshabadTimMc: hmm interesting
16:30satshabadwhat about ints?
16:30satshabadints vs int-array vs into-array vs to-array
16:31TimMcI think the doc is pretty clear there: http://clojuredocs.org/clojure_core/clojure.core/ints
16:32TimMc(Unless you're not familiar with the concept of casting, in which case it's probably pretty opaque.)
16:32satshabadyeah, I could probably be more familiar with how that works in relation to clojure
16:33satshabadso I am trying to optimize a function that takes two vectors and maps * over each of their element pairs. If I use amap inseatd of map I have to convert the vectors to arrays first, and that seems costly
16:33satshabadis it costly?
16:33satshabadespecailly for smaller vectors
16:36gfrederickssatshabad: I'd recommend using criterium to get perf answers related to the specific thing you're doing
16:36TimMcsatshabad: First, are you aware that map can accept multiple collections?
16:36TimMc&(map * [1 2 3] [100 200 300])
16:36lazybot⇒ (100 400 900)
16:36gfredericksTimMc: I assumed that's how he was using it
16:36satshabadyes, that's how I was doing it
16:37TimMcOK, cool.
16:37TimMcgfredericks: "e"
16:37TimMchttps://en.wikipedia.org/wiki/Spivak_pronoun
16:37satshabadthis is how I'm trying to do it now
16:37satshabadhttps://www.refheap.com/20883
16:37gfredericksI might try using s/he
16:38satshabadhe is fine by me
16:38TimMcThe LambdaMOO spivak convention seems the most usable: e/em/eir.
16:38satshabadfor me of course
16:38gfredericksthen I have to start keeping track of whose gender I've verified O_O
16:38satshabadwrite a bot
16:39mtpTimMc i adore spivak pronouns
16:40gfrederickse looks like a typo
16:41nDuffgfredericks: *shrug*. Doesn't take that much usage to make it recognizable.
16:41mtpgfredericks how about 'e
16:42TimMcThen you sound British or something.
16:42mtpit's a contraction, the other way
16:42danneuI somehow ran out of permagen space while developing in emacs. How do you inspect this sort of thing to find out why? jvisualvm?
16:42nDuffgfredericks: ...arguably, just one channel regular here using them regularly would familiarize a pretty good chunk of the Clojure community.
16:42gfredericksnDuff: I'm sold
16:42nDuffdanneu: Mmm. If you're only using the default amount of permgen space, I'd bump that up pretty much reflexively.
16:43TimMcsatshabad: That ^int on lines 2 and 3 is probably a bug (or at least useless).
16:43justin_smithdanneu: running out of permgen means you need to ask for more permgen :)
16:43nDuffdanneu: Clojure generates a lot of classes, so a certain amount of permgen space is to be expected.
16:43nDuffdanneu: s/certain/large/
16:43nDuffs/space/usage/
16:43justin_smithpermgen is used by classes, which in clojure includes functions
16:43concurback!
16:43concurwas afk
16:43justin_smithespecially in a repl
16:43satshabadTimMc: right, must be left over
16:43justin_smithlots and lots of classes in clojure
16:44justin_smiththere is also an option to allow classes to be unloaded
16:44nDuffjustin_smith: does it actually require an explicit option anymore?
16:44concurI need to go to work in a few minutes
16:44concurbut I'll keep in mind what you've all said about the keywords
16:45justin_smithnDuff: I know I have gotten hosed by insufficient permgen in very recent memory
16:45justin_smithbut it could be that box had an old jvm
16:45concurit's only ever going to be used once, so maybe I should just do an explicit map
16:45danneuI've never run out of permagen before and there isn't much going on in this project, so im trying to see why
16:45concurand it's only ever going to be used on exactly 2 things
16:45danneuI think it may be core.typed
16:45concurso while making an elegant solution would give me intense pleasure
16:46concurso would finishing this assignment less than 10 days late :D
16:46concurand not getting caught up on making it perfect
16:46concurlater, all
16:46concurthanks for the help
16:49TimMcsatshabad: mapv might be faster.
16:50satshabadyeah mapv was what I was using
16:50satshabadIt feels like it's hard to swap out using vectors for arrays
16:51satshabadthey seem to either leak into other parts of the code or their is lots of time used to create them
16:59justin_smithsatshabad: its the classic problem of many interop setups - in theory you can just call to a more efficient but less featureful / safe language, but then you end up burning cycles converting from native to unsafe datatypes
17:02satshabadjustin_smith: i see
17:02satshabadI can't seem to find many good resources on this kind of thing
17:02justin_smithand back again, of course
17:02satshabadand recommendations?
17:02satshabadany*
17:03justin_smiththe general idea is to try to segregate your algorithm, make the boundaries between array-using and vector-using code explicit, and make sure it is crossed as rarely as you can get away with
17:04satshabadyeah that makes sense. So for matrix mult, I would want to accept vectors, but maybe convert to arrays right away and use those until I have a result. Then convert back.
17:04justin_smithright
17:04satshabadotherwise parts of my code will have array and part will have vector
17:05justin_smithas little conversion-churn as possible
17:05satshabadyeah that makes a lot of sense. that's why the algo was spending so much time in aclone and int-array
17:06satshabadOK, so tangentially related question: How do transients fit in with this model?
17:06satshabadas far as I can gather, use a transient when you need to speed up conj, assoc, etc. use an array when you need to _____
17:06satshabadwhy use array over transient?
17:07justin_smithtransients are just mutible versions of the same datastructure clojure uses
17:07justin_smithwhile arrays are a more simplistic structure
17:07justin_smithalso mutible
17:08satshabadhuh ok. So arrays probably perform better
17:08satshabadin simpler circumstances
17:08justin_smithright
17:08satshabadhow do I know when to use one and not the other?
17:08satshabadI guess arrays only have a limited ste of ops on them
17:08satshabadset*
17:20TimMcsatshabad: Arrays are also fixed-length.
17:38technomancyI don't think there are primitive transients?
17:59justin_smithwhat string should I hand to java.util.TimeZone/getTimeZone to get the Munich timezone?
17:59justin_smith,(java.util.TimeZone/getTimeZone "Europe/Oslo")
17:59clojurebot#<SecurityException java.lang.SecurityException: denied>
18:09justin_smithlooks like it is Europe/Berlin
18:23TimMc&(transient (vector-of :int))
18:23lazybotjava.lang.ClassCastException: clojure.core.Vec cannot be cast to clojure.lang.IEditableCollection
18:24TimMctechnomancy: Yeah, good point.
18:26amalloysatshabad: use an array when you need to interop with java code that wants an array; otherwise never use an array. like, there are exceptions to this rule, but i think they're extreme enough that if you really need to break the rule you won't care that i told you not to
18:28satshabadamalloy: Thanks
18:28satshabadmakes sense
18:37TEttingeramalloy, I'm not entirely sure that's reasonable advice for all circumstances -- admittedly I haven't tried transients on my game code, but before I switched to using hiphip and using almost entirely 1D arrays, my game was deathly slow
18:37TEttingerit still is on large maps.
18:38amalloyTEttinger: and having discovered that, you would try arrays regardless of what advice i gave you. that's my point
18:38TEttingerah right
18:39bitemyappTEttinger: game?
18:40bitemyappI'm always puzzled by people that do things like games in a language like Clojure.
18:40TEttingerI'll probably be rewriting my game again to use more "standard clojure," less "ugly hacks"
18:40TEttingerI know, I know, but I do really love clojure
18:40TEttingerI may use Unity with the new 2D stuff though
18:44bitemyappI'm a big fan of 2d games.
18:44TEttingerthat's like saying "I'm a big fan of foods"
18:45bitemyappTEttinger: well they're not that common anymore.
18:45TEttingertrue.
18:45bitemyappI believe 2d games often allow for more focused and "tight" gameplay.
18:45bitemyappNot a given, but it seems to sometimes.
18:46arrdembitemyapp: isn't that nessicarily true due to the relative difficulty of complicating gameplay while preserving any semblance of usabiltiy?
18:46TEttingeroh I'm totally not going that route. this would probably use some variant of my Big Game Data for medieval stuff
18:47bitemyapparrdem: quite possibly. I'm not an expert ludologist, I just know I end up enjoying emulators with classic games, roguelikes, and things like Super Meat Boy as much as anything else.
18:47bitemyapparrdem: part of the reason I like DotA2/MOBAs is that they're relatively focused.
18:47TEttingerLOL has 161 champions right? I am describing 200 for a tabletop game, but I've manipulated and analyzed the data using clojure
18:47bitemyappGrand Theft Auto V is like the antithesis of the sort of game I like.
18:47bitemyappTEttinger: games are unpredictable, you can't really know what "balance" looks like without data from real players.
18:47bitemyappespecially if you make things interesting via asymmetry.
18:48TEttingerI'm not trying to balance it either. in tabletop games randomness makes it very hard to notice imbalance in the short term
18:48arrdemTEttinger: what TT game are you working on? I have a toy Warmachine simulator gathering dust in ~/ somewhere
18:49TEttingerthis is the WIP doc https://dl.dropboxusercontent.com/u/11914692/DungeonVanguards/index.html
18:49TEttingerCC-BY licensed
18:50TEttingerI'll add formatting and bookmarks once I complete the base
18:51TEttingerthe data is... large. https://dl.dropboxusercontent.com/u/11914692/Dungeon%20Vanguards.xls
18:52TEttingerI edit as a spreadsheet, then paste into a text file, slurp it with clojure, and start reading it into data
18:52arrdemTEttinger: badass! I love that fish is a valid melee weapon
18:52TEttingerhaha
18:52TEttingermonty python is an inspiration for some
18:53TEttingerI've found clojure's REPL really handy for making views of sorts into the data
18:53TEttingerlike how many ranks are there in Insight, total?
18:53TEttingerit's around 75
18:53arrdemTEttinger: why is a musket less accurate than a pistol? seems silly...
18:54TEttingerheavier, I guess
18:54TEttingerit isn't rifled and is basically a double-barreled shotgun
18:54TEttingerthis is not a historically accurate game
18:54bitemyapparrdem: not silly at all, muskets are quite inaccurate.
18:54arrdembitemyapp: worse than a flintlock pistol? I think not...
18:54bitemyappoh, flintlock?
18:54bitemyappwell n/m then
18:55bitemyappI was thinking of short-recoil rifled handgun
18:55TEttingerI don't have an exact word for the equivalent firearms in real world
18:55TEttingerkeep in mind, I have like 3 kinds of polearm/spear, the real world has dozens
18:55arrdemshrug. call it a balance factor. just something that jumped out at me.
18:56arrdemTEttinger: how are you storing all this data while keeping it repl-editable?
18:56TEttingerI just reread the Tab-separated value file
18:56TEttingerit's a simple copy paste into my aptly named input.txt
18:57arrdemheheh
18:58TEttingerthe script is tiny to format the classes, and most of the other stuff borders on one-liners
18:58TEttingerhttps://dl.dropboxusercontent.com/u/11914692/class-formatter.clj I just pasted the relevant bits into the repl so I don't need to mess too much with namespaces and versioning.
19:00TEttingerbelieve me, this is unreadable, but the version before it (raw regex search/replace strings) was unmaintanable
19:02brehautwait, thats the maintainable regexp‽ O_O
19:02TEttingerlol.
19:03TEttingerinterrobang.
19:03brehautfor all your non-transaction safe predicates
19:03TEttingeryeah it needs to read about 55 columns of sometimes-blank data
19:03TEttingerso it's certainly the correct regex
19:04brehautim curious if instaparse would make it simpler
19:04TEttingerof course, it gives weird errors on badly formatted input
19:04brehaut(because you could name bits)
19:04TEttingerbut I can usually find where the errors are
19:05TEttingerthankfully? I haven't needed to edit the clojure part much at all
19:05brehautin fact, im pretty certain it would
19:06TEttingerit could probably parse the whole spreadsheet in one go.
19:06TEttingerthe question is more why
19:11concurI'm having something very strange happen in my program
19:12concurI did a little printf debugging to figure out what's happening
19:12concurwhen I run it on my laptop, it gets into a for loop
19:12concurit prints at the start of the loop
19:12concurand then never again
19:12concurwhen I run it on my school's server
19:12concurit terminates the program once it reaches the for loop
19:13concurnever printing
19:13concurand it doesn't throw any sort of exception
19:13concurit just looks like it exited normally
19:13justin_smithconcur: are you doing anything with the result of the for?
19:13justin_smithfor is lazy, if you don't use the value it produces, the code nver executes
19:13concuractually
19:13concurI'm doing it with side effects
19:13concurI probably shouldn't be using for
19:14justin_smithdoseq
19:14concurIt's supposed to save to a file each time
19:14justin_smithis it writing to the file inside for, or outside?
19:14concurinside
19:14concureach iteration is a save to a different file
19:14justin_smithit is lazy, so nothing uses the value, so it never executes
19:14justin_smithuse doseq instead
19:14concurooh
19:15justin_smithin the repl, it executes because you print the output
19:15justin_smithprinting uses the output
19:15justin_smith*uses the result
19:15concurrunning on my machine it actually got to the part where it prints "saving"
19:15concurjust now
19:15concurbut yeah, definitely should be using doseq
19:16patchworkHmm… I have a path to a jar and a file in the jar, how do I read the contents of that file?
19:17justin_smithhttp://stackoverflow.com/questions/5419125/using-java-api-from-clojure-reading-zip-file
19:18concurwell, now it's getting further
19:18concureach iteration takes 500 seconds
19:18concurso now it's a waiting game :)
19:21patchworkjustin_smith: So I have to iterate over every entry of the jar file? I was hoping to just access it at a path… maybe I will make a utility for this
19:22justin_smithI am going to look at the ZipFile interface
19:25justin_smith(.getEntry (java.util.zip.ZipFile. "/home/justin/.m2/repository/caribou/lichen/0.6.14/lichen-0.6.14.jar") "project.clj")
19:26justin_smiththat reterns a zipentry object
19:26patchworkJust found that
19:26patchworkBut then you have to get the ZipInputStream from that...
19:26patchworkAh java
19:31abpjust had fun with core.async and nio.. but that api is sick
19:31abpnios
19:32patchworkIf anyone cares: https://www.refheap.com/20889
19:33justin_smithnice, much better than what was in that SO answer
19:59Morgawrsmall trivia question, how come I can call "val" on a pair extracted from a map (which looks like a vector) but I can't just call (val [a b])? Is it because of the underlying implementation of the said vector?
19:59Morgawr,(do (map println {:a 4}) (map val {:a 3 :b 4})
19:59clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
19:59Morgawr,(do (map println {:a 4}) (map val {:a 3 :b 4}))
19:59clojurebot(3 4)
19:59Morgawr(useless println lol)
19:59Morgawr,(val [:a 3]) ; <-- this doesn't work
19:59clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry>
20:00TEttingerMorgawr: ##(map type {:a 1})
20:00lazybot⇒ (clojure.lang.MapEntry)
20:00TEttingernot actually a vector, but prints as one
20:00Morgawrahhh
20:00amalloyTEttinger: actually a vector
20:00MorgawrI guess it's a vector implemented as a MapEntry?
20:01amalloyit's an instance of IPersistentVector
20:01TEttingeroh?
20:01TEttingerah ok
20:01Morgawrinteresting, thanks
20:01amalloyit's just not the same class as [1 2]
20:01TEttingeror rather, a vector is not actually a mapentry, but mapentry inherits from vector
20:02centaurso at last we need types...
20:02Morgawrso it has come to this
20:02Morgawrthe ultimate battle between dynamic and static
20:02TEttingeryou can use first and second
20:02TEttingeron vectors and mapentries
20:02Morgawronly typed clojure can save us (!!)
20:02amalloymapentry implements vector, it doesn't inherit from it
20:02Morgawras far as I understand they are all vectors, just with different underlying implemenations... ?
20:02Morgawrimplementations*
20:08concurafter a very long wait, my program output its first plot
20:08concurand it looks good :D
20:08arrdem$seen Bronsa
20:08lazybotBronsa was last seen joining on clojure 17 minutes and 2 seconds ago.
20:09concurreplacing for with doseq did the trick
20:11justin_smithconcur: cool
20:11concuris there a simple way to change the tick marks in an incanter plot to something other than 1 for every point, or log-scale?
20:11concurI want to divide it into 10 evenly spaced ticks
20:11concurand from what I can tell, I'm going to have to do some java-level stuff
20:15bitemyapphttp://chrisdone.com/posts/twitter-problem-loeb
20:44zenoliconcur: I've found that for most customization it's necessary to grab the JFreeChart object and find the right sub-object to set properties on.
20:45zenoliYou'll probably need to call .getPlot on the chart, and then .getDomainAxis or .getRangeAxis on that for the NumberAxis.
20:45zenoliYou can then do a .setTickUnit on the axis.
20:57Bronsaarrdem: pong
20:59arrdemBronsa: ohai. didn't mean to ping you on IRC, I sent an email and then got curious if you were one of the lurkers here.
20:59Bronsaarrdem: oh, you didn't include your username in the mail, didn't know it was you
21:00Bronsaarrdem: I'm replying right now
21:00arrdemBronsa: facepalm. sorry, I keep forgetting I don't have an io@arrdem.com yet.
21:09`cbpis the conj being recorded?
21:10bitemyapp`cbp: I know Strange Loop was, so...hopefully?
21:11bitemyapp`cbp: also, DotA2?
21:11`cbp:P
21:11`cbpin an hour or so
21:37arrdemBronsa: mind if I reply in here or shall we constrain this to email?
21:38Bronsaarrdem: however you prefer
21:38arrdemBronsa: this works for me
21:39arrdemBronsa: my vision of the project was to build the AOT infrastructure you mentioned in your future work blurb.
21:41arrdemBronsa: It'd probably be a seperate project, but github.com/arrdem/toothpick would probably be a not bad place for your more general bytecode emission framework to start.
21:43Bronsaarrdem: I have looked only briefly at how `compile` works on Compiler.java, but I think that there shouldn't be any need for any additional enhancement to the analyzer for that
21:44Bronsaarrdem: take into consideration that if you want to do this, you'll need to dig into Compiler.java to make sure we're not missing something and that the .classes we'll produce will be compatible with what clojure currentle expects
21:46arrdemBronsa: yeah. That's doable I expect. My primary concern was whether there was infrastructure in c.t.analyzer or elsewhere that I'd be blocked waiting or helping on.
21:48majykThanks to the Clojure Conj the DC Metro blue line was empty tonight on my commute home. THANK YOU! This never happens.
21:48Bronsaarrdem: (also sorry, it's clojure.tools.emitter.jvm.transform not .bytecode, I can't even remember my own ns segments, duh)
21:48muhoomajyk: how is i possible that the conj kept people from commuting?
21:49majykI dunno but it's wonderful!
21:50muhooi'll be happy to get on muni to go to cljwest, if it's in fact going to be in SF as i'd heard
21:52majykanyway, I was mostly joking although the blue line was in fact for all intents and purposes empty around 6-7pm tonight and it runs right next to the venue that the Conj is being held at.
21:52bitemyappmuhoo: well that would make things rather convenient for us wouldn't it?
21:52majykanyway enough of my sarcasm...
21:53muhooi'm still obsessed with the idea of passign a datomic connection handle through a ring app stack functionally, without global state. but not sure how to do it.
21:53Bronsaarrdem: I don't think that'll be the case, but making sure there is no blocking misfeature in c.t.analyzer is of high priority to me, I'll make sure to get everything fixed/enhanced enough
21:53muhooso that test harness could take the fake memory db conn and put it into #'app somehow
21:54muhooand the real app, running simultaneously, could use something set up in a global atom, but only passed in once in the handler
21:54muhooor in the server, most likely
21:54bitemyappmuhoo: it seems pretty clear to me.
21:54muhoothe goal is to be able to (run-tests) and NOT have it use the running db, but a fake one set up in a fixture
21:55bitemyappmuhoo: acquire at the top of a handler that needs it, or in a middleware, or just memoize the acquisition function.
21:55muhooi'm digging through code of pedestal, luminus, carinou, etc, to see if someone has already done it
21:55bitemyappjust...make a decision. You don't need a global though.
21:55bitemyappI do it all the time...
21:56bitemyappmuhoo: given what I just described in terms of strategies for connection lifecycles, is there something objectionable with them or a reason you cannot implement one of them?
21:57bitemyappthere's nothing hiding in the kimono here, keep it simple.
21:58muhooi don't actually understand what you mean. what i'm hoping for is someone having written, or i have to write, somethign i can do (wrap-db-handle #'app datomic-conn-handle)
21:58muhooand then inside the app i can fish the db-handle out of the ring state wherever i need it
21:58bitemyappdon't do that :|
21:58bitemyappno.
21:58muhoowhy not?
21:58bitemyappyou don't bloody need to and singleton global database connections are net-negative contributors to your codebase.
21:59muhoothat makes no sense
21:59muhooi already have signleton global database connection. i'm trying to remove it or reduce its use
21:59bitemyappyou're using the database that makes it easier than any other to have clean connection lifecycle semantics and you're looking for a way to shit it up like every other application.
21:59bitemyappdon't use a dynamic var, it's not even thread-safe.
21:59bitemyappasync-safe*
21:59muhoo(reset! db/conn (d/connect (:datomic-uri env/env))
22:00muhooso, what, create a new connection with each request?
22:00muhooisn't that.... slow?
22:00bitemyappI gave you multiple choices
22:01bitemyapponly one of which required creating a connection-per-use
22:01muhooyou gave me a terse description and i don't understand what exactly you mean.
22:02bitemyappokay, one solution is to acquire a connection at the top of each handler
22:02muhoowhat do you mean "acquire at the top of a handler". acquire from where?
22:02bitemyappthe dependent functions that want to perform queries get the database handed to them
22:02muhooand where to put it, once it's acquired?
22:02bitemyappcreate a friggin' connection.
22:02bitemyapp(d/connect "ya-fuckin-database-yo")
22:02muhoogotcha. then store the conn where?
22:03bitemyappmuhoo: you don't!
22:03muhoothere are multiple places throughout the app that need db access.
22:03bitemyappat the top
22:03bitemyappof each handler
22:03bitemyappyou will acquire a connection before processing the request
22:03bitemyappyou can do so in a future...or not
22:03bitemyappbut you are not assigning a *place*
22:03bitemyappyou are not saving a global
22:03bitemyappyou are not creating a singleton
22:03bitemyappyou are simply instantiating the resource you need
22:03bitemyappand passing it as an argument to all functions invoked that require a db-conn or a db.
22:03muhooand how do i get it elsewhere?
22:04bitemyappdefine elsewhere
22:04bitemyappwhat is executing that cannot be traced to a handler?
22:04muhooi have a compojure route. where does it gets its db handle from?
22:04abpwhen using core.async, is it "normal" to use a close-channel one can put a value to tear down a go-block?
22:05muhoobitemyapp: i don't know a way to pass the db handle into a compojure route handler
22:05bitemyapp(defn my-route [request] (let [MY-DATABASE (d/connect "DA-DATABASE")] ...))
22:05muhooin every route?
22:05muhoothat seems really inefficient
22:06bitemyappmuhoo: don't make assertions you haven't established measurements for.
22:06bitemyappmuhoo: I provided alternatives, START WITH THE SIMPLEST THING FIRST
22:06muhoothis isn't PHP, i'm hoping not to open a db connection with each page view
22:06bitemyappmuhoo: this isn't Java, don't optimize before you've actually measured anything.
22:07bitemyappyou can wrap your connection acquisition in a pool if you want, but for now, do the simple thing first
22:07bitemyappTHEN OPTIMIZE LATER
22:07muhoowell, it appears i have no valid concerns, so i'll go fuck myself now. thanks.
22:07bitemyappmuhoo: I measured the connection time and for my use-case it wasn't worth optimizing out.
22:08bitemyappmuhoo: the point is that if you do the simple and clean thing first, it's easier to clean up/optimize/refactor later
22:08bitemyappmuhoo: if you fuck around with bullshit that doesn't matter it'll be harder to refactor when something unanticipated occurs.
22:08`cbphow does java handle streams when they get out of scope
22:08`cbpdo they get closed
22:09bitemyapp`cbp: http://stackoverflow.com/questions/2506488/java-finalize-method-call
22:09bitemyapp`cbp: http://docs.oracle.com/javase/7/docs/api/java/io/FileOutputStream.html#finalize()
22:10`cbpoh
22:10abpmuhoo: you could go for something like http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded and have the system hold a connection
22:10`cbpwell thats good
22:11bitemyappabp: That's the sort of thing I eventually aim for, but I was hoping I could convince him to do something simple first.
22:11bitemyapp`cbp: it is better to call .close() yourself though.
22:11bitemyapp`cbp: otherwise OS resources are retained until a GC pas.
22:11bitemyapppass*
22:12abpmuhoo: you could also just let the connection around all your routes because http://docs.datomic.com/clojure/#datomic.api/release
22:12bitemyapp`cbp: also, been an hour >:)
22:14abpbitemyapp: simple or messy, thats the question, having tons of d/connect in your routes isn't dry at least
22:15bitemyappabp: sure but I prefer to do the simplest thing possible that minimizes indirection before I scale up the sophistication.
22:16bitemyappabp: because if you anticipate problems from an incorrect origin, you scale for the wrong things and it becomes even harder to adapt.
22:16abpbitemyapp: when writing code i too hack away sometimes but do regular cleanup
22:16bitemyappIf simply acquiring a resource and passing it to dependent functions is going to suffice...do that.
22:16abpbitemyapp: some things are just okay, like passing a context-map as a first argument, thats not bound to break
22:17bitemyappI don't do that.
22:19swarthyI need to modify clj-http's (generate-query-params) in order to encode the URL differently than then default. I need %20 instead of + for spaces. Anyone have any hints? I think I need to modify the (wrap-query-params) middleware. I just haven't figure out how yet.
22:19`cbpbitemyapp: im fooding + dling patch t.t
22:19abpbitemyapp: why?
22:20bitemyapp`cbp: I'll get chips and salsa.
22:21bitemyappabp: generally the breakpoint for me is that I either reify each even dependent resource as a single argument, or I start heading off into monad territory.
22:21bitemyappor I write a macro.
22:21bitemyappor I make a closure.
22:21bitemyappwhat I don't do, unless it's a really good fit, is make a context-map argument. Makes sense for Ring, doesn't often make sense for the code I personally write.
22:23abpbitemyapp: what do you mean by "reify each even dependent resource as a single argument"?
22:23bitemyapp[db-conn server ...]
22:23bitemyappplain ole function arguments.
22:24bitemyappmaybe kwargs if they're sometimes not needed.
22:26abpbitemyapp: yea, that's the thing i don't like. it doesn't scale. narrowing a context along the callstack for modules and submodules works quite well and it adapts to novelty quite well
22:26bitemyappabp: it does do that.
22:27abpbitemyapp: also no positional fn-call sna-fu
22:27bitemyappabp: dynamic languages... :|
22:27abpbitemyapp: to the point where you need to adjust a bunch of signatures :/
22:30abpbitemyapp: but state-monad is interesting too when updating the context often, core.async gathers instructions for it's state machine execution plans with one. that's where I've first seen them in action ;x
22:33bitemyappabp: well, if you want to see craziness, there's always the Reverse State monad.
22:33bitemyappabp: and Control.Monad.Tardis
22:34`cbpbitemyapp: this patch is so big t.t
22:34bitemyapp`cbp: I didn't even notice a patch
22:34`cbpbitemyapp: you live in cali you silly :P
22:35bitemyapp`cbp: well I have 50 mbp internet, but seriously, I didn't even notice a patch
22:35abpbitemyapp: will look that up another time, my head hurts from coding way too long straight and I NEED to finish this damn cli-tool
22:35bitemyappabp: all good. it's a good thing to look into when you're feeling curious and energetic :)
22:36abpbitemyapp: having a hard time resisting the urge to abstract what i got and code on till done :x
22:37bitemyapp`cbp: ETA?
22:38`cbpbitemyapp: around 25-30 minutes :(
22:38bitemyapp`cbp: which in Mexico time is an hour. I'll watch an episode of Star Trek :)
23:01`cbpbitemyapp: are you reaadyy?
23:01bitemyapp`cbp: lets rooooock
23:55Happy33hi all
23:56Happy33any female wana chat 28m