2013-11-14
| 00:25 | bitemyapp | `cbp: welp. Single Drafted Faceless Void. |
| 00:26 | `cbp | op |
| 00:26 | bitemyapp | `cbp: like locking 9 helpless children in an abattoir with Freddie Krueger. |
| 00:27 | `cbp | :-s |
| 00:27 | bitemyapp | `cbp: enchantress paused the game to wait for somebody |
| 00:27 | bitemyapp | `cbp: so I asked, "oh, you have my ult too?" |
| 00:27 | `cbp | lol |
| 00:29 | muhoo | gamers |
| 00:29 | muhoo | :-P |
| 00:36 | bitemyapp | muhoo: >:) |
| 00:43 | john2x | how do I check if a list of re-patterns are in a string? |
| 00:44 | bitemyapp | `cbp: huskar is a dick. |
| 00:44 | `cbp | he is really lame |
| 00:47 | bitemyapp | `cbp: starting to think huskar counters everything |
| 00:49 | john2x | man I miss dota2. any new heroes lately? |
| 00:50 | bitemyapp | john2x: not so far as I know. |
| 00:50 | bitemyapp | john2x: huskar is really fucking annoying lately. |
| 00:51 | bitemyapp | we have a serious lack of support/cc on my team to. |
| 00:51 | bitemyapp | too&* |
| 00:57 | biggbear | looking for a function like (reduce) but for only one argument. |
| 00:57 | satshabad | what's the rational behind suing (if (seq coll) ... ...) instead of (if (not (empty? coll)) .. ..) or something else |
| 00:57 | satshabad | i mean, why "cast" something to seq? |
| 00:57 | satshabad | is it because it works on both nil and []? |
| 00:57 | bitemyapp | ,(empty? nil) |
| 00:57 | clojurebot | true |
| 00:58 | satshabad | so no diff? |
| 00:58 | bitemyapp | ,(empty? '()) |
| 00:58 | clojurebot | true |
| 00:58 | bitemyapp | ,(empty? []) |
| 00:58 | clojurebot | true |
| 00:58 | bitemyapp | satshabad: that's the idiom because it's nicer. |
| 00:58 | satshabad | which? |
| 00:58 | bitemyapp | (seq []) |
| 00:59 | satshabad | ah ok |
| 00:59 | satshabad | nicer how? |
| 00:59 | bitemyapp | shorter |
| 00:59 | satshabad | hmmm ok |
| 00:59 | satshabad | thanks |
| 01:26 | jballanc | satshabad: if you prefer the more straight-forward logic of `empty?` (I do) use it with `if-not` |
| 01:26 | jballanc | ,(if-not (empty? []) (println "There's something there") (println "It's empty, Jim.")) |
| 01:26 | clojurebot | It's empty, Jim.\n |
| 01:26 | bitemyapp | welp. Snapchat refused a $3bn acquisition from Facebook. |
| 01:27 | bitemyapp | Clearly I should start a startup and hack on an iOS app from Venice Beach, CA |
| 01:27 | satshabad | if-not empty |
| 01:27 | satshabad | i like it! |
| 01:27 | satshabad | jballanc: thanks |
| 01:27 | jballanc | there's also when-not |
| 01:27 | jballanc | :) |
| 01:29 | biggbear | is 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:31 | satshabad | oh oh yes |
| 01:31 | satshabad | um |
| 01:33 | satshabad | biggbear: http://clojuredocs.org/clojure_core/1.2.0/clojure.core/iterate |
| 01:33 | satshabad | (nth (iterate f x) n) |
| 01:34 | Apage43 | but but |
| 01:34 | Apage43 | that's like, three instagrams |
| 01:34 | satshabad | ,(nth (iterate dec 46) 12) |
| 01:34 | clojurebot | 34 |
| 01:34 | biggbear | <satshabad>: i was considering iterate but it constructs the whole seq and then you have to call the (nth) function. |
| 01:34 | satshabad | right |
| 01:34 | satshabad | yeah |
| 01:35 | Raynes | &(doc iterate) |
| 01:35 | lazybot | ⇒ "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects" |
| 01:35 | satshabad | not great |
| 01:35 | Raynes | Iterate is lazy. |
| 01:36 | Raynes | It only has to generate up to the element that you request. |
| 01:36 | satshabad | yes but it will have to generate all the ones before that right? |
| 01:36 | satshabad | oh wait |
| 01:36 | satshabad | i see |
| 01:36 | satshabad | same # of function calls right? |
| 01:36 | Raynes | I also misunderstood a bit. |
| 01:36 | Raynes | Maybe. |
| 01:37 | Raynes | Yeah. |
| 01:37 | Raynes | Iterate should be fine, I think. |
| 01:39 | bitemyapp | coventry: WHOA |
| 01:39 | biggbear | iterate would be good for n <<MAX_NUMBER |
| 01:39 | bitemyapp | coventry: https://github.com/coventry/troncle are you serious about this? |
| 01:39 | bitemyapp | coventry: plz say yes ;_; |
| 01:40 | bitemyapp | Raynes: makes my deftrace macros unnecessary >:) |
| 01:42 | satshabad | clojure is making me sad. I can't get it to multiply a 1024x1024 matrix |
| 01:42 | satshabad | https://github.com/Satshabad/Matrix-Mult-Analysis/blob/master/src/project1/core.clj |
| 01:43 | satshabad | what could I be doing wrong? |
| 01:43 | satshabad | all my friends with their java, multiplying 8000x8000 |
| 01:43 | logic_prog | what fails? |
| 01:44 | satshabad | it just takes too long |
| 01:44 | satshabad | gets stuck at 1024 |
| 01:47 | TEttinger | 8000x8000 what? |
| 01:47 | satshabad | oh |
| 01:47 | satshabad | matrices |
| 01:47 | satshabad | of random numbers |
| 01:47 | satshabad | between a certain range |
| 01:47 | TEttinger | using vectorz-clj or something meant for it? |
| 01:48 | satshabad | yes, but this is more of an exercise |
| 01:48 | satshabad | if I use core.matrix I can do 8000x8000 |
| 01:48 | satshabad | but my naive impl is waaaay worse than the naive impl in java |
| 01:49 | satshabad | just wondering if I have something glaringly wrong |
| 02:00 | deobald | Does anyone have any recommendations for migration libs in Clojure? It looks like migratus, ragtime, and clj-sql-up all might be sensible tools. |
| 02:17 | TEttinger | satshabad, naive clojure uses pretty heavyweight objects rather than primitives by default. you can use arrays in clojure. |
| 02:21 | bitemyapp | deobald: migratus is my preferred solution, but it's a little pissy about the filenames/ |
| 02:23 | satshabad | TEttinger: cool |
| 02:23 | satshabad | could I still use them in the imutable style? |
| 02:23 | TEttinger | however I am having trouble as well getting a non-library way to work in under the 10 second limit of lazybot |
| 02:24 | TEttinger | no, arrays are mutable |
| 02:24 | satshabad | ah yes, I read a bit about transients |
| 02:24 | TEttinger | you also use different functions with them, like amap |
| 02:24 | satshabad | very very cool stuff |
| 02:25 | satshabad | so is that what something like core.matrix is doing under the covers? |
| 02:25 | satshabad | because it looks like they still use all clojure |
| 02:36 | echo-area | What 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:37 | echo-area | Using classes, e.g. ~(with-meta 'some-symbol {:tag name.of.a.Class}), will _not_ work. |
| 02:37 | echo-area | This is a little bit unintuitive |
| 02:38 | echo-area | Will it hurt if clojure.lang.Compiler.tagOf accepts class additionally? |
| 02:44 | H4ns | is 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:44 | deobald | bitemyapp: Thanks. :) |
| 02:55 | sm0ke | hey guys i am using clojure.tool.logging and have i app packaged as a uberjar |
| 02:56 | sm0ke | problem is i am not able to configure log4j |
| 02:56 | sm0ke | with this log4j.properties file https://www.refheap.com/20856 |
| 02:56 | sm0ke | its like clojure doesnt pick it up everything is being logged to console |
| 02:59 | bitemyapp | sm0ke: you should log to find out what's...oh. |
| 02:59 | bitemyapp | sm0ke: println? ;) |
| 03:00 | sm0ke | hmm i have everything jar and config file in same folder and i start with java -cp .:jarfile.jar ... |
| 03:00 | sm0ke | also i have a conf file which is being picked up properly |
| 03:00 | sm0ke | just the frkn log4j |
| 03:10 | adie | i 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:18 | bitemyapp | adie: you broke something |
| 03:31 | amalloy | bitemyapp: 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 | _adie | bitemyapp: broke what? |
| 04:14 | bitemyapp | _adie: amalloy's suggestion is probably closer to the mark, but it's what I was obliquely referring to. |
| 04:14 | bitemyapp | _adie: have any idea why a stream might be your body instead of a string response? |
| 04:15 | _adie | bitemyapp: 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:15 | echo-area | What is the quality of Clojure-CLR? Is it as mature as Clojure on Java? |
| 04:16 | jcf | is 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:25 | brainproxy | is 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:26 | brainproxy | that is, so I can spit stuff out in the same terminal where the compiler is reporting about "Successfully compiled...", etc. |
| 04:32 | bitemyapp | arrdem: http://i.imgur.com/mZY6tYx.jpg |
| 04:34 | bitemyapp | ucb: what's a wibble? |
| 04:34 | ucb | if ping is to pong, the wibble is to ... |
| 04:34 | bitemyapp | http://www.urbandictionary.com/define.php?term=wibble |
| 04:35 | bitemyapp | huh. |
| 04:35 | ucb | heh |
| 04:35 | ucb | how's things bitemyapp? |
| 04:35 | bitemyapp | ucb: good. lots of category theory, Haskell and Clojure open source in my life lately. |
| 04:36 | ucb | good. |
| 04:36 | bitemyapp | ucb: depressive black metal, yes/no? |
| 04:36 | ucb | always |
| 04:36 | bitemyapp | ucb: http://www.youtube.com/watch?v=X5rDyQ_iZWI |
| 04:36 | ucb | sorry, "* metal" is already a 50% win for me |
| 04:39 | bitemyapp | I work at a genetics company, I need to try this out http://i.imgur.com/Ut8IWmJ.jpg and see who gets mad. |
| 04:39 | bitemyapp | maybe post it in a bathroom. |
| 04:40 | ucb | heh |
| 04:42 | amalloy | not bad, bitemyapp |
| 04:42 | bitemyapp | amalloy: uh, which part? |
| 04:42 | amalloy | oh, the biology joke |
| 04:42 | amalloy | not a huge fan of metal |
| 04:43 | bitemyapp | amalloy: 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:45 | amalloy | meh. there's no traditional competition between category theory and biology |
| 04:46 | bitemyapp | amalloy: well indirectly |
| 04:46 | bitemyapp | amalloy: it's just removed by like 4 layers of increasing hardness. |
| 04:46 | bitemyapp | mathematicians make fun of physicists, and category theorists make fun of specialist mathematicians. |
| 04:49 | echo-area | amalloy: 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:50 | echo-area | Or ~(with-meta 'obj {:tag "name.of.Class"}) |
| 04:51 | echo-area | What is the corresponding of clojars for ClojureCLR? |
| 04:53 | bitemyapp | echo-area: don't use ClojureCLR if you need support. |
| 04:53 | _adie | bitemyapp: got it, had to use ring middleware wrap-json-params, to get data out of the request body |
| 04:54 | echo-area | bitemyapp: Got it. That's a hard decision |
| 04:56 | bitemyapp | echo-area: not really, it's quite simple. Cowboy up or make peace with the popular runtimes. |
| 04:57 | echo-area | bitemyapp: I have some concerns on distraction, so "cowboy up" doesn't seem an attractive choice |
| 04:57 | TEttinger | ##(let [☃ "hey would you look at that"] ☃) |
| 04:57 | lazybot | ⇒ "hey would you look at that" |
| 04:58 | bitemyapp | echo-area: well then don't use an implementation all of 3 people use, 2 of whom are actually the Unabomber. |
| 04:59 | TEttinger | echo-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:00 | TEttinger | of course, clojure IS a wonderful, expressive, concise, productive language. |
| 05:01 | echo-area | TEttinger: I have only LISP background and am more familiar with Clojure. To be honest, I think F# is more detractive than ClojureCLR :( |
| 05:01 | TEttinger | that's a good reason. |
| 05:01 | bitemyapp | detractive? |
| 05:01 | bitemyapp | echo-area: you mean attractive? |
| 05:02 | bitemyapp | echo-area: if you find F# interesting, you might be better served by Haskell or OCaml. |
| 05:03 | p2147483647 | I'm very new to clojure, why doesn't this: (defn xs [] (cons 1 xs)) give me an infinite list when I do (xs) ? |
| 05:03 | echo-area | No, 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:03 | p2147483647 | wait, nevermind :D |
| 05:03 | p2147483647 | cons 1 (xs) |
| 05:03 | p2147483647 | and stackoverflow is fine too |
| 05:04 | p2147483647 | I'm guessing I want a lazy seq instead |
| 05:05 | bitemyapp | p2147483647: yes. |
| 05:05 | bitemyapp | p2147483647: but to implement the specific thing you want... |
| 05:05 | bitemyapp | ,(take 10 (range)) |
| 05:05 | clojurebot | (0 1 2 3 4 ...) |
| 05:05 | p2147483647 | actually I want an infinite list of 1s, heh |
| 05:05 | p2147483647 | just mucking about |
| 05:06 | bitemyapp | ,(take 10 (repeat 1)) |
| 05:06 | clojurebot | (1 1 1 1 1 ...) |
| 05:06 | echo-area | Use repeated |
| 05:06 | bitemyapp | p2147483647: I can do this all day. |
| 05:06 | echo-area | I mean repeat |
| 05:06 | p2147483647 | haha |
| 05:07 | p2147483647 | fair enough :) |
| 05:07 | p2147483647 | oh, I can't do stuff that might be tail-call-optimised away, right? |
| 05:07 | bitemyapp | p2147483647: there is no TCO in Clojure, technically |
| 05:07 | ucb | bitemyapp: http://www.youtube.com/watch?v=8kZMVG6N7DE |
| 05:07 | bitemyapp | there are explicit uses of loop/recur or lazy-seq...or let-fn |
| 05:07 | ucb | bitemyapp: perhaps not your taste, but still amazing music |
| 05:07 | bitemyapp | p2147483647: https://www.refheap.com/20858 this is the source to repeat. |
| 05:08 | bitemyapp | p2147483647: bears a striking similarity to what you tried, no? |
| 05:08 | bitemyapp | ucb: way far removed from what I listen to, but talented singer. |
| 05:08 | ucb | bitemyapp: cult figure as well |
| 05:09 | p2147483647 | bitemyapp: that link doesn't seem to work for me |
| 05:09 | ucb | bitemyapp: figured since you sent me down depressing-lane that I'd return the favour. |
| 05:09 | bitemyapp | ucb: do white people worship him or something? |
| 05:09 | ucb | bitemyapp: though "depressing" is not the right term in this case. |
| 05:09 | bitemyapp | p2147483647: http://clojuredocs.org/clojure_core/clojure.core/repeat click the + next to "Source" |
| 05:09 | ucb | bitemyapp: I'd go for melancholic really. |
| 05:09 | ucb | bitemyapp: many do. |
| 05:09 | bitemyapp | I don't actually find DBM depressive. |
| 05:09 | ucb | DBM? |
| 05:09 | bitemyapp | depressive black metal |
| 05:10 | ucb | oh |
| 05:10 | p2147483647 | bitemyapp: ooh, neat. I think I can spend quite a lot of time in the docs now :) |
| 05:10 | p2147483647 | bitemyapp: thanks very much! |
| 05:11 | p2147483647 | and yes that's exactly what I was looking for |
| 05:12 | bitemyapp | p2147483647: cheers :) |
| 06:46 | laliluna | Hello, is lein ring server supposed to reload routes as well? |
| 07:39 | john2x | does lein run foo pass "foo" to -main? |
| 08:41 | loliveira | hi! =) Why is enlive return only one <td>? (the page has 3). |
| 08:41 | loliveira | (-> (http/get "http://pt.wikipedia.org/wiki/Categoria:Bairros_da_%C3%81gua_Rasa") enlive/html-snippet (enlive/select [:table]) pprint) |
| 08:43 | loliveira | i forgot to extract the body from the http response. |
| 08:43 | loliveira | this works: (-> (http/get "http://pt.wikipedia.org/wiki/Categoria:Bairros_da_%C3%81gua_Rasa") :body enlive/html-snippet (enlive/select [:table]) pprint) |
| 08:44 | mdrogalis | :) |
| 08:46 | loliveira | i was dealing with this bug for 30 min. I posted here and realize my mistake in 30 sec \_(ツ)_/¯ |
| 08:47 | danneu | erry day |
| 08:47 | mdrogalis | Aw, no brilliant Rich Hickey keynote at the Conj this year. |
| 08:48 | mdrogalis | Unless Harmonikit is not in fact what it sounds like. |
| 08:49 | danneu | i now have a 3 days of experience using typed-clojure on a meddlesome project and i'm sold |
| 08:51 | danneu | at first, all the type-check errors are due to gaps in my own knowledge and fledgling typed-newbie ways |
| 08:51 | danneu | but now the type-errors that pop up are due to real type conflicts and i see the light |
| 08:52 | loliveira | danneu: https://github.com/clojure/core.typed ? |
| 08:52 | danneu | yeah |
| 08:54 | danneu | clojure solves most of my painpoints from other languages, but the final pain point is that i dont remember what functions expect/return |
| 08:54 | danneu | is it a byte-array or a map |
| 08:55 | loliveira | danneu: i liked |
| 08:55 | Ember- | danneu: write your functions in a way they can accept any clojure data structure and pass around those |
| 08:55 | Ember- | and if you really need to be specific about the type use contracts |
| 08:56 | Ember- | and if you *really* need to be specific about types and structure of your data structures then use typed clojure |
| 08:56 | danneu | Ember-: But what does that really mean? a multimethod that accepts [B vs IMap every step of the way? |
| 08:57 | Ember- | danneu: that depends of course |
| 08:57 | Ember- | and I really cannot give you any 100% correct answer |
| 08:57 | danneu | well, yeah |
| 08:57 | Ember- | just think about functions such as first, second, rest etc |
| 08:58 | Ember- | which can operate on several different data structures |
| 08:58 | Ember- | simplicity is the key in everything :) |
| 08:58 | Ember- | but being simple is not necessarily easy |
| 08:59 | danneu | sounds like a platitude to me these days |
| 08:59 | danneu | soon your program is spread across many namespaces and you dont get to work on it every day to keep it in your head |
| 08:59 | mdrogalis | Different layers, different techniques, people... |
| 09:00 | Ember- | danneu: I hope you are joking or I got you wrong |
| 09:00 | Ember- | surely you do use multiple namespaces? |
| 09:02 | danneu | i'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:02 | danneu | so i end up with a sort of layman's type-system in comments |
| 09:06 | guns | danneu: https://github.com/Prismatic/schema provides custom defn and defrecord macros with easy to read type annotations |
| 09:06 | guns | docs say it hopes to be a superset of core.typed eventually |
| 09:07 | danneu | guns: yeah, schema is great - that's where i started. |
| 09:09 | danneu | i feel like i'm converting my code comments and ad-hoc usage-example-in-the-docstring into code |
| 09:10 | guns | This year has been really great; I was interested in golang, and then core.async! Looking at Haskell for type constraints, core.typed + schema! |
| 09:11 | Ember- | danneu: I know what you mean. However I didn't find that too big a problem |
| 09:11 | Ember- | and when I found that to be a problem I used contracts |
| 09:11 | danneu | Ember-: oh, is contracts referring to core.contracts |
| 09:11 | danneu | I just googled it |
| 09:11 | Ember- | danneu: http://blog.fogus.me/2009/12/21/clojures-pre-and-post/ |
| 09:12 | danneu | Now those are cool. i just started using those on this project |
| 09:12 | Ember- | you can specify all kinds of pre and post contracts |
| 09:12 | danneu | i think core.typed even analyzes them |
| 09:12 | Ember- | you can check the type, structure of your data structure or whatever you want, it's clojure code |
| 09:13 | Ember- | and it's there, it's built in, no libraries needed |
| 09:13 | mdrogalis | Pitch for Dire if you like core.contracts :) |
| 09:14 | HolyJak | pre 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:14 | danneu | it's still just at runtime though |
| 09:15 | danneu | for 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:17 | mdrogalis | HolyJak: Custom precondition messages.. Hm, there's an idea. |
| 09:18 | danneu | guns: 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:19 | danneu | of course, core.typed has a type checker |
| 09:19 | guns | danneu: Oh, I haven't; core.typed integration is on the schema todo list |
| 09:20 | guns | that's all. I'm using schema mostly ATM |
| 09:42 | klayte | I'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:44 | TimMc | klayte: If you havne't confirmed a performance problem, don't worry about it. |
| 09:44 | cark | klayte: you'll be throwing away a lot of stuff using clojure, still is fast enough in most cases |
| 09:44 | TimMc | If 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:45 | TimMc | klayte: You may also be interested in zipmap, by the way. |
| 09:45 | TimMc | &(let [r (range 5)] (zipmap r r)) |
| 09:45 | lazybot | ⇒ {4 4, 3 3, 2 2, 1 1, 0 0} |
| 09:47 | klayte | sure, still comprehensions are more flexible and I'm used them. |
| 09:48 | klayte | I'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:49 | klayte | I'm not chasing perf really, just interested in a better understanding of behind the scenes. |
| 09:50 | TimMc | Not in this case -- keys and values are stored separately in hashmaps. |
| 09:51 | ohcibi | hi 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:51 | TimMc | (There's no opportunity for sharing here because Clojure's map impls aren't strustured like association-lists.) |
| 09:52 | klayte | I see, I thought it was shallow trees all the way down... |
| 09:53 | TimMc | Hmm? It is. |
| 09:53 | Bronsa | TimMc: aren't PAMs association-lists? |
| 09:53 | TimMc | 32-way trees representing the hash lookups. |
| 09:53 | TimMc | Bronsa: Yeah, I suppose so, but I think klayte is working with PHMs. |
| 09:56 | TimMc | Oh interesting, PAM interleaves keys and vals in an array: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentArrayMap.java |
| 09:56 | TimMc | I was expecting an array of pairs. |
| 10:01 | klayte | TimMc: So does structural sharing always take place between identical types only? |
| 10:02 | TimMc | Mostly, I think? Sequences can definitely share across types. |
| 10:03 | TimMc | There are several different kinds of ISeq, and all they care about is that the "rest" value is another ISeq (or null). |
| 10:05 | TimMc | But 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:15 | danneu | klayte: http://hypirion.com/musings/understanding-persistent-vector-pt-1 |
| 10:20 | danneu | klayte's example: (into {} (for [...] [a b])). `into` calls `transient!` on that {}, and `for` returns a lazy-seq of those vectors. |
| 10:20 | danneu | how would you describe the performance or what's going on between the lazy-seq consumption and the conj! into {}? |
| 10:22 | danneu | i suppose the lazy-seq doesn't actually change anything. might as well be one vector of vectors |
| 10:37 | schmir | is there a way to check if a core.async channel is closed when putting items in the channel |
| 10:37 | schmir | ? |
| 10:42 | BobSchack | (.closed chan) I think |
| 10:43 | danneu | schmir: channel returns nil if closed |
| 10:43 | danneu | if you put |
| 10:45 | danneu | right? |
| 10:48 | schmir | danneu: yes, but it also does that on a non-closed channel :) |
| 10:50 | schmir | (deref (.closed chan)) does work though. but it looks like I shouldn't use that... |
| 10:54 | BobSchack | why do you need to check if the channel is closed? |
| 10:55 | nDuff | ...particularly, why do you need to check *from the writing end*? |
| 10:56 | schmir | BobSchack: I'd like to stop an producer by closing the channel |
| 10:58 | BobSchack | I 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:59 | BobSchack | I'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:00 | BobSchack | https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L632 |
| 11:00 | BobSchack | is the relevant place in the code |
| 11:03 | schmir | thanks BobSchack. I'm probably going to use a control channel... |
| 11:04 | danneu | seems like there would be an easier way than to poison the producer from its own channel |
| 11:08 | danneu | actually that is simple |
| 11:09 | danneu | i guess you could pass the consumer ctor into the producer ctor |
| 11:14 | nDuff | Hmm. |
| 11:15 | justin_smith | wow |
| 11:15 | justin_smith | as in nicer than vanilla interop? |
| 11:15 | nDuff | justin_smith: this isn't a favorable version of "more interesting". |
| 11:15 | TimMc | haha |
| 11:15 | justin_smith | oh |
| 11:18 | seangrove | Interesting is more often used as a euphemism than its sincere meaning |
| 11:19 | nDuff | there are a lot of assumptions I'd made (like arrays being seq'able) that I wasn't aware fo until they broke. |
| 11:20 | S11001001 | ,(seq (to-array [1 2 3])) |
| 11:20 | clojurebot | (1 2 3) |
| 11:21 | S11001001 | oh, clojurescript |
| 11:22 | nDuff | "Error evaluating:" (.listFiles (java.io.File. test-path)) :as "(new java.io.File(cljs.user.test_path)).listFiles()" |
| 11:22 | nDuff | org.mozilla.javascript.EvaluatorException: Java class "[Ljava.io.File;" has no public instance field or method named "cljs$lang$type". (cljs/core.cljs#6660) |
| 11:23 | danneu | I 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:23 | S11001001 | ,(apropos "byte-array") |
| 11:23 | clojurebot | (byte-array) |
| 11:23 | justin_smith | is it totally insane that I am about to attempt to run a ring app on a microsoft surface? |
| 11:23 | S11001001 | ,(apropos "byte") |
| 11:23 | clojurebot | (aset-byte byte bytes byte-array unchecked-byte) |
| 11:24 | jared314 | justin_smith: the tablet or the table? |
| 11:24 | S11001001 | ,(doc bytes) |
| 11:24 | clojurebot | "([xs]); Casts to bytes[]" |
| 11:24 | justin_smith | tablet |
| 11:24 | jared314 | justin_smith: not that insane |
| 11:24 | justin_smith | trying to address a windows specific bug in my lib |
| 11:24 | jared314 | justin_smith: the table would be more insane |
| 11:24 | justin_smith | heh |
| 11:25 | danneu | S11001001: how about a surrogate for (defmulti foo class) (defmethod foo (Class/forName "[B" [bytes] ...) |
| 11:25 | danneu | (missing paren) |
| 11:25 | S11001001 | eh, better to just have the predicate |
| 11:26 | danneu | what do you mean |
| 11:27 | S11001001 | defn byte-array?, you know the rest |
| 11:28 | danneu | ah, forgoing the multimethod |
| 11:28 | TimMc | nDuff: Arrays aren't seqable on rhino CLJS? |
| 11:28 | Fender | hey 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:28 | TimMc | Is this a protocols issue? |
| 11:29 | nDuff | TimMc: 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:29 | Fender | I 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:32 | Fender | unfortunately I didn't attend computer vision either... |
| 11:37 | justin_smith | what about converting the matrix into opengl polygons? |
| 11:38 | justin_smith | I know that is less handy than a prerolled matrix visualizer |
| 11:39 | Fender | actually I was kind of looking for a fully fledged lib to do that |
| 11:39 | Fender | :) |
| 11:39 | Fender | I doubt that there are dozens of matrix classes yet none has a nice visualizer?! |
| 11:39 | justin_smith | yeah, I figured |
| 11:42 | Fender | maybe its even a nice freelance project |
| 11:44 | Fender | the "best lib" as mentioned above interweaves swing events with data D: |
| 11:51 | TimMc | alexbaranosky: workatruna.com has a malware infection -- if it's even a legit Runa website |
| 12:36 | danneu | How would you type-hint (map #(.indexOf (seq "abc") %) "abacaba") |
| 12:37 | danneu | - to avoid reflection on `.indexOf` invocation? |
| 12:37 | S11001001 | danneu: well, that seq call shouldn't be there |
| 12:38 | TimMc | Why not? |
| 12:38 | TimMc | Oh, nvm, String has that as well. |
| 12:38 | TimMc | and I was thinking of colections |
| 12:43 | danneu | https://www.refheap.com/20870 |
| 12:43 | danneu | Without seq, reflection just fails |
| 12:43 | danneu | well, invocation fails |
| 12:44 | `cbp | danneu: you can remove the seq and change % to (str %) |
| 12:44 | S11001001 | danneu: or (char %) |
| 12:44 | S11001001 | ,(map class "ab") |
| 12:44 | clojurebot | (java.lang.Character java.lang.Character) |
| 12:45 | S11001001 | danneu: also what is alphabet's type? |
| 12:45 | `cbp | danneu: or typehint with ^clojure.lang.StringSeq |
| 12:45 | danneu | String. I see that signature is .indexOf(String) |
| 12:46 | danneu | (str %) worked. thanks |
| 12:46 | danneu | i didnt think of hinting the clojure StringSeq type |
| 12:54 | TimMc | Probably sufficient to hint it as a List. |
| 13:53 | fakedrake | hello |
| 13:53 | fakedrake | what is a good library for graphs? |
| 13:53 | fakedrake | contrib.graph looks fine but isnt contrib deprecated? |
| 13:55 | patchwork | fakedrake: I have used loom successfully |
| 13:55 | mdrogalis | fakedrake: Might try this. https://github.com/jgrapht/jgrapht |
| 13:56 | mdrogalis | I wish that website would be reindexed. |
| 14:02 | fakedrake | thanx guys |
| 14:03 | mattrepl | fakedrake: I second loom. it's the best option unless you want a graph db (then I'd suggest neo4j) |
| 14:05 | arrdem | clojurebot: ping |
| 14:05 | clojurebot | PONG! |
| 14:07 | egosum | is anyone aware of a nice datalog -> postgresql convertor? ideally in clojure? |
| 14:08 | nDuff | egosum: you mean for queries? They're not exactly equally-expressive languages. |
| 14:09 | nDuff | egosum: ...you'd have a fair number of queries that *couldn't* be translated. |
| 14:11 | egosum | nDuff: yes, for queries. My understanding is there is a reasonable correspondence between DataLog and SQL |
| 14:12 | mdrogalis | It'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:13 | nDuff | (and also quite a lot of cases where a good translation is not a mechanical operation) |
| 14:13 | mdrogalis | Yeah |
| 14:13 | mdrogalis | nDuff why aren't we at the Conj? :( |
| 14:13 | bitemyapp | because I'm not. |
| 14:14 | mdrogalis | Oh hello. |
| 14:14 | egosum | nDuff: mdrogalis: sure, the lack of recursion in vanilla SQL would mess things up. However, e.g. Postgres supports recursion in queries… |
| 14:14 | nDuff | mdrogalis: ...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:15 | egosum | And is hackable in other SQL engines, though not efficient. |
| 14:15 | mdrogalis | Congratulations, nDuff :) |
| 14:15 | mdrogalis | egosum: I remember seeing a SQL <-> Datalog app somewhereee a while ago. It was just for learning purposes. |
| 14:15 | mdrogalis | It wasn't like an all-purpose translator |
| 14:15 | egosum | I 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:16 | bitemyapp | you could translate simple queries, but it's still o_O |
| 14:16 | egosum | mdrogalis: yeah I think I found it somewhere, but the server is down/no longer around |
| 14:16 | bitemyapp | it's a project I've considered |
| 14:16 | mdrogalis | Heh, true, egosum |
| 14:16 | mdrogalis | It wasn't worth your time, egosum |
| 14:17 | egosum | bitemyapp: Yeah, I'm considering it. I'd love something to sit over postgres and translate datalog queries to SQL for me |
| 14:17 | egosum | bitemyapp: would be a fun research project. I'm finding some papers related to it |
| 14:17 | egosum | Some older code as well |
| 14:18 | egosum | Would be immensely useful, for me at least |
| 14:18 | bitemyapp | I don't totally see why |
| 14:18 | bitemyapp | but again, any translator couldn't be fully general, which sucks. |
| 14:18 | nDuff | egosum: well, if you only wanted something similar to datomic's backend (one big kvs table), that's a bit different. |
| 14:18 | nDuff | egosum: (than a fully general translator to realistic relational schemas) |
| 14:19 | mdrogalis | I'm gonna try an alternate query engine for Datomic. It will probably go terribly. But I'll do it anyway |
| 14:19 | egosum | nDuff: Sure, you can optimize the former considerably better. But the latter should be a possibility. Not sure which I'd prefer. |
| 14:20 | egosum | kvs with Datalog takes care of most of the advantages of having a RDMS anyway, so maybe simply and engine like that would work |
| 14:20 | egosum | an engine* but I'd need to think about. Know of one like that? (kvs & datalog on postgresql) |
| 14:28 | Morgawr | I'm getting a weird problem with a float buffer (java data structure) |
| 14:28 | Morgawr | https://www.refheap.com/42c2121f97518e24cea3f0ffc here's the example |
| 14:29 | Morgawr | If I call (.rewind buffer) from inside the function and return the buffer, rewind doesn't work |
| 14:29 | Morgawr | I need to call it outside the function |
| 14:29 | Morgawr | does anyboyd know why this could be happening? |
| 14:29 | Morgawr | BufferUtils is just stuff from lwjgl but it doesn't matter, it creates a float buffer |
| 14:29 | Morgawr | http://docs.oracle.com/javase/7/docs/api/java/nio/FloatBuffer.html |
| 14:31 | Morgawr | it's really weird |
| 14:33 | Morgawr | oh... looks like the problem is the doall |
| 14:33 | Morgawr | it instantly returns |
| 14:41 | satshabad | True or False? If I have *warn-on-reflection* set and it's not warning me, there is no use for type hints. |
| 14:41 | ndp | Morgawr: have you tried using dorun instead? |
| 14:41 | nDuff | satshabad: true. |
| 14:42 | satshabad | woah. OK good to know |
| 14:42 | mdrogalis | satshabad & nDuff: Performance? |
| 14:42 | nDuff | satshabad: if you wanted actual type checking and enforcement, you could use core.typed, but hints won't do you any more good. |
| 14:42 | satshabad | yes |
| 14:42 | nDuff | mdrogalis: the performance benefit is by way of avoiding reflection. |
| 14:42 | satshabad | got it |
| 14:42 | nDuff | mdrogalis: ...if there aren't any warnings indicating that reflection is happening... |
| 14:42 | mdrogalis | Ah, got it. |
| 14:43 | Morgawr | okay 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:43 | Morgawr | weird |
| 14:43 | Morgawr | but yeah thanks ndp, fixed it now |
| 14:43 | satshabad | so like in this example: http://clojuredocs.org/clojure_core/clojure.core/amap |
| 14:43 | satshabad | the reason for the type hint is that it would use refection? |
| 14:45 | nDuff | satshabad: correct. |
| 14:46 | satshabad | nDuff: ok cool |
| 14:50 | satshabad | nDuff: what about this? http://dev.clojure.org/display/design/Documentation+for+1.3+Numerics |
| 14:50 | satshabad | the Primitive hinting part |
| 14:50 | satshabad | it says hint to avoid boxing |
| 14:50 | satshabad | how does that relate to reflection? |
| 14:51 | nDuff | satshabad: ahh -- that's a somewhat different case (and something that only applies to newer-ish versions of the language... what, 1.3+, maybe?) |
| 14:52 | satshabad | hmmmm |
| 14:52 | nDuff | satshabad: ...so, yes -- the hard line I gave above (reflection avoidance only) doesn't apply to primitive types. |
| 14:52 | satshabad | yeah 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:52 | satshabad | ah, ok cool |
| 14:52 | nDuff | ...eh? "cast the numeric"? |
| 14:52 | satshabad | sorry |
| 14:52 | nDuff | if you're having to cast things around, that's not helpful. |
| 14:52 | satshabad | (int 1) |
| 14:53 | satshabad | like that |
| 14:53 | nDuff | just 1 |
| 14:53 | satshabad | that will be taken as a primative? |
| 14:53 | nDuff | it can be passed to things that accept a primitive, yes. |
| 14:54 | nDuff | ...but there are restrictions on primitive use that make it something that maybe calls for a certain amount of judiciousness. |
| 14:54 | nDuff | ...in particular, due to the way IFn is constructed, you've got less flexibility in your calling conventions when using them. |
| 14:54 | satshabad | right, I wouldn't want to do that all over, maybe just in a tight loop if i needed to speed something up |
| 14:54 | satshabad | and being aware of what i was passing it to |
| 14:54 | nDuff | *nod*. |
| 14:55 | nDuff | It's also easy, if uncautious, to have constant boxing/unboxing going on |
| 14:55 | nDuff | ...which can quickly get less efficient than just leaving things boxed all the time. |
| 14:55 | satshabad | right. if I (int 1) and then pass it to a non type hinted func, it will unbox and then box. |
| 15:00 | gfredericks | should data.fressian be available via maven yet? |
| 15:05 | whilo | has anybody here worked with clojure/py ? |
| 15:06 | bitemyapp | whilo: are you trying to get stuff done? |
| 15:07 | whilo | i have to work with python, but i would like to fallback on some clojure functional stuff, when i need to mangle data |
| 15:08 | whilo | bitemyapp: i guess you mean, i shouldn't use it. i have difficulties even to find out, what is the most usable version atm. |
| 15:13 | satshabad | so 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:14 | amalloy | strings contains char[]s |
| 15:14 | satshabad | hmmm, but I am not using any strings |
| 15:14 | satshabad | it's matrix mult code... |
| 15:16 | satshabad | is 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:23 | satshabad | hmmm, I think i was attached to the wrong process :/ |
| 15:39 | satshabad | if 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:42 | poppingtonic | Hello |
| 15:44 | joegallo | satshabad: init() or <init>()? |
| 15:44 | joegallo | poppingtonic: hello |
| 15:45 | satshabad | joegallo: the latter |
| 15:45 | bitemyapp | pic.twitter.com/YmdwcBCbuv |
| 15:45 | amalloy | well, AFn.init() doesn't exist, so that's not surprising :P |
| 15:45 | joegallo | amalloy: inc ;) |
| 15:45 | poppingtonic | joegallo: hey I'm having a bit of trouble with (use 'clojure.data.json), getting this exception http://refheap.com/20879 |
| 15:46 | amalloy | satshabad: AFn.<init>() is creating a function |
| 15:46 | satshabad | hmmm. Would that be called when I use the # syntax as well? |
| 15:46 | satshabad | like #(inc %) |
| 15:46 | amalloy | i'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:46 | amalloy | of course |
| 15:47 | amalloy | although #(inc %) is just a bad way to write inc |
| 15:47 | joegallo | poppingtonic: 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:47 | satshabad | haha, yes just an example |
| 15:47 | joegallo | and it's rejecting that |
| 15:47 | satshabad | amalloy: me as well, but I have a map in a tight loops using a # func |
| 15:47 | satshabad | so i suspect that might me it |
| 15:47 | satshabad | it's a triple loop |
| 15:48 | satshabad | no wait |
| 15:48 | satshabad | double |
| 15:48 | amalloy | satshabad: 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:49 | joegallo | anyway, poppingtonic, base (use ...) statements are a bit of a no-no, you should (use something.something :only [the things you need here]) |
| 15:49 | poppingtonic | joegallo: using (:require '[clojure.data.json :as json]) takes care of it. |
| 15:49 | joegallo | or that |
| 15:49 | satshabad | amalloy: good idea. |
| 15:49 | satshabad | got to figure out how to do that... |
| 15:49 | poppingtonic | joegallo: good idea. |
| 15:50 | poppingtonic | is there a lazy slurp? |
| 15:51 | poppingtonic | heh "things clojurists say" |
| 15:52 | amalloy | poppingtonic: 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:54 | gfredericks | there goes amalloy again. pointing you at *other* things that you *actually* want |
| 15:54 | gfredericks | like some sort of machine-learning-driven recommendation engine |
| 15:59 | concur | I'm iterating over a sequence of variables with a for loop, and I want the output to include keywords of those variables |
| 15:59 | concur | is this possible to do? |
| 15:59 | concur | I know this doesn't work: |
| 16:00 | concur | ,(for [z [x y]] (keyword 'z)) |
| 16:00 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 16:00 | concur | obviously it shouldn't, because I'm quoting z |
| 16:00 | gfredericks | concur: you'd need a macro for that |
| 16:00 | concur | but as far as I can tell, there's no way to quote x and y without looping over them separately |
| 16:00 | concur | hmm |
| 16:01 | concur | or perhaps I could quote x and y in the for bindings |
| 16:01 | concur | and unquote in the body |
| 16:02 | concur | ,(for [z ['x 'y]] (keyword z)) |
| 16:02 | clojurebot | (:x :y) |
| 16:02 | concur | oh right, unquoting only happens in macros |
| 16:03 | concur | I guess I've just concluded the same thing as you |
| 16:04 | TimMc | Well, you can use unquoting outside of macros. |
| 16:05 | concur | isn't it a little dangerous though? |
| 16:07 | gfredericks | concur: it just isn't relevant |
| 16:08 | TimMc | concur: No, it's just a way of manipulating data structures. |
| 16:08 | satshabad | if I call to-array on a vector, is that a constant time operation? |
| 16:08 | TimMc | &`[a b ~(range 4) c d] |
| 16:08 | lazybot | ⇒ [clojure.core/a clojure.core/b (0 1 2 3) clojure.core/c clojure.core/d] |
| 16:08 | concur | my understanding of how macros are actually implemented is a little weak |
| 16:08 | TimMc | &`[a b ~@(range 4) c d] |
| 16:08 | lazybot | ⇒ [clojure.core/a clojure.core/b 0 1 2 3 clojure.core/c clojure.core/d] |
| 16:09 | concur | don't macros have to be executed at compile-time? |
| 16:09 | TimMc | concur: 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:09 | concur | right |
| 16:09 | gfredericks | concur: so it can see what your variable names are |
| 16:09 | gfredericks | while normal functions can't |
| 16:09 | TimMc | All defmacro does is flag a fn to be run at compile time instead of at runtime. |
| 16:10 | concur | do variable names actually carry over to java bytecode? |
| 16:10 | TimMc | In fact, there's a hack you can use to get around that distinction. |
| 16:10 | TimMc | ,(@#'and nil nil 1 2 3) |
| 16:10 | clojurebot | (clojure.core/let [and__3941__auto__ 1] (if and__3941__auto__ (clojure.core/and 2 3) and__3941__auto__)) |
| 16:11 | biggbear | how 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:12 | gfredericks | concur: I have no idea, but bytecode isn't really relevant for what you're trying to do |
| 16:13 | TimMc | concur: Variables still have their names attached at runtime, yes. |
| 16:13 | TimMc | They're first-class, in fact. |
| 16:13 | TimMc | &(var and) |
| 16:13 | lazybot | ⇒ #'clojure.core/and |
| 16:13 | TimMc | &(meta (var and)) |
| 16:13 | lazybot | ⇒ {: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:13 | amalloy | TimMc: i think it's quite likely he means locals, not vars |
| 16:13 | TimMc | Oh hmm, you're probably right. |
| 16:14 | concur | actually, I wasn't quite thinking right when I said variables |
| 16:14 | concur | but you're right, locals are what I was talking about |
| 16:14 | TimMc | Yeah, locals sort of disappear during compilation. |
| 16:15 | concur | hmm |
| 16:15 | TimMc | Macros can see their lexical environment (what locals are bound around the invocation site) but that's a pretty voodoo topic. |
| 16:15 | concur | well if I did (for [z ['x 'y]] {(keyword z) (unquote z)}), would that work? |
| 16:16 | TimMc | What are you trying to do, anyway? |
| 16:16 | concur | ,(for [z ['x 'y]] {(keyword z) (unquote z)}) |
| 16:16 | clojurebot | #<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote> |
| 16:16 | concur | I'm trying to put some stuff in an incanter dataset |
| 16:16 | concur | and I want to use the names as the labels in the dataset |
| 16:16 | gfredericks | it's worth emphasizing that you don't ever need macros to make your code do something; just to make it look like something |
| 16:17 | satshabad | I don't understand the difference between to-array and into-array. Does anyone know? |
| 16:17 | concur | hmm, I never thought about that |
| 16:17 | concur | btw |
| 16:17 | concur | how do I address a specific person? |
| 16:17 | gfredericks | concur: like this |
| 16:18 | concur | just put their name and a colon? |
| 16:18 | gfredericks | yeah |
| 16:18 | garhdez | concur: just write his name |
| 16:18 | concur | ohh |
| 16:18 | concur | gfredericks: I thought it was an IRC command |
| 16:18 | garhdez | most of the irc clients has autocomplete for that |
| 16:18 | concur | wait, did it work? |
| 16:18 | concur | it's still the usual color for me |
| 16:19 | TimMc | But not for gfredericks, I bet. |
| 16:19 | mikerod | concur: when I type it to someone, it stays the same color for me; when someone types it to me, it changes color |
| 16:19 | concur | I see |
| 16:19 | mikerod | but this is IRC client specific I'd say |
| 16:20 | concur | yeah |
| 16:20 | TimMc | It'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:20 | mikerod | seems to be so |
| 16:20 | TimMc | concur: You can probably use tab-complete in your client. |
| 16:20 | concur | TimMc, it put a comma instead of a semicolon |
| 16:21 | TimMc | That works too. |
| 16:21 | concur | but it did autocomplete |
| 16:21 | concur | ok |
| 16:21 | concur | well now I know |
| 16:22 | TimMc | concur: 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:24 | TimMc | I 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:25 | TimMc | satshabad: 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:26 | amalloy | fwiw, 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:30 | satshabad | TimMc: hmm interesting |
| 16:30 | satshabad | what about ints? |
| 16:30 | satshabad | ints vs int-array vs into-array vs to-array |
| 16:31 | TimMc | I think the doc is pretty clear there: http://clojuredocs.org/clojure_core/clojure.core/ints |
| 16:32 | TimMc | (Unless you're not familiar with the concept of casting, in which case it's probably pretty opaque.) |
| 16:32 | satshabad | yeah, I could probably be more familiar with how that works in relation to clojure |
| 16:33 | satshabad | so 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:33 | satshabad | is it costly? |
| 16:33 | satshabad | especailly for smaller vectors |
| 16:36 | gfredericks | satshabad: I'd recommend using criterium to get perf answers related to the specific thing you're doing |
| 16:36 | TimMc | satshabad: First, are you aware that map can accept multiple collections? |
| 16:36 | TimMc | &(map * [1 2 3] [100 200 300]) |
| 16:36 | lazybot | ⇒ (100 400 900) |
| 16:36 | gfredericks | TimMc: I assumed that's how he was using it |
| 16:36 | satshabad | yes, that's how I was doing it |
| 16:37 | TimMc | OK, cool. |
| 16:37 | TimMc | gfredericks: "e" |
| 16:37 | TimMc | https://en.wikipedia.org/wiki/Spivak_pronoun |
| 16:37 | satshabad | this is how I'm trying to do it now |
| 16:37 | satshabad | https://www.refheap.com/20883 |
| 16:37 | gfredericks | I might try using s/he |
| 16:38 | satshabad | he is fine by me |
| 16:38 | TimMc | The LambdaMOO spivak convention seems the most usable: e/em/eir. |
| 16:38 | satshabad | for me of course |
| 16:38 | gfredericks | then I have to start keeping track of whose gender I've verified O_O |
| 16:38 | satshabad | write a bot |
| 16:39 | mtp | TimMc i adore spivak pronouns |
| 16:40 | gfredericks | e looks like a typo |
| 16:41 | nDuff | gfredericks: *shrug*. Doesn't take that much usage to make it recognizable. |
| 16:41 | mtp | gfredericks how about 'e |
| 16:42 | TimMc | Then you sound British or something. |
| 16:42 | mtp | it's a contraction, the other way |
| 16:42 | danneu | I somehow ran out of permagen space while developing in emacs. How do you inspect this sort of thing to find out why? jvisualvm? |
| 16:42 | nDuff | gfredericks: ...arguably, just one channel regular here using them regularly would familiarize a pretty good chunk of the Clojure community. |
| 16:42 | gfredericks | nDuff: I'm sold |
| 16:42 | nDuff | danneu: Mmm. If you're only using the default amount of permgen space, I'd bump that up pretty much reflexively. |
| 16:43 | TimMc | satshabad: That ^int on lines 2 and 3 is probably a bug (or at least useless). |
| 16:43 | justin_smith | danneu: running out of permgen means you need to ask for more permgen :) |
| 16:43 | nDuff | danneu: Clojure generates a lot of classes, so a certain amount of permgen space is to be expected. |
| 16:43 | nDuff | danneu: s/certain/large/ |
| 16:43 | nDuff | s/space/usage/ |
| 16:43 | justin_smith | permgen is used by classes, which in clojure includes functions |
| 16:43 | concur | back! |
| 16:43 | concur | was afk |
| 16:43 | justin_smith | especially in a repl |
| 16:43 | satshabad | TimMc: right, must be left over |
| 16:43 | justin_smith | lots and lots of classes in clojure |
| 16:44 | justin_smith | there is also an option to allow classes to be unloaded |
| 16:44 | nDuff | justin_smith: does it actually require an explicit option anymore? |
| 16:44 | concur | I need to go to work in a few minutes |
| 16:44 | concur | but I'll keep in mind what you've all said about the keywords |
| 16:45 | justin_smith | nDuff: I know I have gotten hosed by insufficient permgen in very recent memory |
| 16:45 | justin_smith | but it could be that box had an old jvm |
| 16:45 | concur | it's only ever going to be used once, so maybe I should just do an explicit map |
| 16:45 | danneu | I've never run out of permagen before and there isn't much going on in this project, so im trying to see why |
| 16:45 | concur | and it's only ever going to be used on exactly 2 things |
| 16:45 | danneu | I think it may be core.typed |
| 16:45 | concur | so while making an elegant solution would give me intense pleasure |
| 16:46 | concur | so would finishing this assignment less than 10 days late :D |
| 16:46 | concur | and not getting caught up on making it perfect |
| 16:46 | concur | later, all |
| 16:46 | concur | thanks for the help |
| 16:49 | TimMc | satshabad: mapv might be faster. |
| 16:50 | satshabad | yeah mapv was what I was using |
| 16:50 | satshabad | It feels like it's hard to swap out using vectors for arrays |
| 16:51 | satshabad | they seem to either leak into other parts of the code or their is lots of time used to create them |
| 16:59 | justin_smith | satshabad: 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:02 | satshabad | justin_smith: i see |
| 17:02 | satshabad | I can't seem to find many good resources on this kind of thing |
| 17:02 | justin_smith | and back again, of course |
| 17:02 | satshabad | and recommendations? |
| 17:02 | satshabad | any* |
| 17:03 | justin_smith | the 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:04 | satshabad | yeah 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:04 | justin_smith | right |
| 17:04 | satshabad | otherwise parts of my code will have array and part will have vector |
| 17:05 | justin_smith | as little conversion-churn as possible |
| 17:05 | satshabad | yeah that makes a lot of sense. that's why the algo was spending so much time in aclone and int-array |
| 17:06 | satshabad | OK, so tangentially related question: How do transients fit in with this model? |
| 17:06 | satshabad | as 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:06 | satshabad | why use array over transient? |
| 17:07 | justin_smith | transients are just mutible versions of the same datastructure clojure uses |
| 17:07 | justin_smith | while arrays are a more simplistic structure |
| 17:07 | justin_smith | also mutible |
| 17:08 | satshabad | huh ok. So arrays probably perform better |
| 17:08 | satshabad | in simpler circumstances |
| 17:08 | justin_smith | right |
| 17:08 | satshabad | how do I know when to use one and not the other? |
| 17:08 | satshabad | I guess arrays only have a limited ste of ops on them |
| 17:08 | satshabad | set* |
| 17:20 | TimMc | satshabad: Arrays are also fixed-length. |
| 17:38 | technomancy | I don't think there are primitive transients? |
| 17:59 | justin_smith | what string should I hand to java.util.TimeZone/getTimeZone to get the Munich timezone? |
| 17:59 | justin_smith | ,(java.util.TimeZone/getTimeZone "Europe/Oslo") |
| 17:59 | clojurebot | #<SecurityException java.lang.SecurityException: denied> |
| 18:09 | justin_smith | looks like it is Europe/Berlin |
| 18:23 | TimMc | &(transient (vector-of :int)) |
| 18:23 | lazybot | java.lang.ClassCastException: clojure.core.Vec cannot be cast to clojure.lang.IEditableCollection |
| 18:24 | TimMc | technomancy: Yeah, good point. |
| 18:26 | amalloy | satshabad: 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:28 | satshabad | amalloy: Thanks |
| 18:28 | satshabad | makes sense |
| 18:37 | TEttinger | amalloy, 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:37 | TEttinger | it still is on large maps. |
| 18:38 | amalloy | TEttinger: and having discovered that, you would try arrays regardless of what advice i gave you. that's my point |
| 18:38 | TEttinger | ah right |
| 18:39 | bitemyapp | TEttinger: game? |
| 18:40 | bitemyapp | I'm always puzzled by people that do things like games in a language like Clojure. |
| 18:40 | TEttinger | I'll probably be rewriting my game again to use more "standard clojure," less "ugly hacks" |
| 18:40 | TEttinger | I know, I know, but I do really love clojure |
| 18:40 | TEttinger | I may use Unity with the new 2D stuff though |
| 18:44 | bitemyapp | I'm a big fan of 2d games. |
| 18:44 | TEttinger | that's like saying "I'm a big fan of foods" |
| 18:45 | bitemyapp | TEttinger: well they're not that common anymore. |
| 18:45 | TEttinger | true. |
| 18:45 | bitemyapp | I believe 2d games often allow for more focused and "tight" gameplay. |
| 18:45 | bitemyapp | Not a given, but it seems to sometimes. |
| 18:46 | arrdem | bitemyapp: isn't that nessicarily true due to the relative difficulty of complicating gameplay while preserving any semblance of usabiltiy? |
| 18:46 | TEttinger | oh I'm totally not going that route. this would probably use some variant of my Big Game Data for medieval stuff |
| 18:47 | bitemyapp | arrdem: 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:47 | bitemyapp | arrdem: part of the reason I like DotA2/MOBAs is that they're relatively focused. |
| 18:47 | TEttinger | LOL has 161 champions right? I am describing 200 for a tabletop game, but I've manipulated and analyzed the data using clojure |
| 18:47 | bitemyapp | Grand Theft Auto V is like the antithesis of the sort of game I like. |
| 18:47 | bitemyapp | TEttinger: games are unpredictable, you can't really know what "balance" looks like without data from real players. |
| 18:47 | bitemyapp | especially if you make things interesting via asymmetry. |
| 18:48 | TEttinger | I'm not trying to balance it either. in tabletop games randomness makes it very hard to notice imbalance in the short term |
| 18:48 | arrdem | TEttinger: what TT game are you working on? I have a toy Warmachine simulator gathering dust in ~/ somewhere |
| 18:49 | TEttinger | this is the WIP doc https://dl.dropboxusercontent.com/u/11914692/DungeonVanguards/index.html |
| 18:49 | TEttinger | CC-BY licensed |
| 18:50 | TEttinger | I'll add formatting and bookmarks once I complete the base |
| 18:51 | TEttinger | the data is... large. https://dl.dropboxusercontent.com/u/11914692/Dungeon%20Vanguards.xls |
| 18:52 | TEttinger | I edit as a spreadsheet, then paste into a text file, slurp it with clojure, and start reading it into data |
| 18:52 | arrdem | TEttinger: badass! I love that fish is a valid melee weapon |
| 18:52 | TEttinger | haha |
| 18:52 | TEttinger | monty python is an inspiration for some |
| 18:53 | TEttinger | I've found clojure's REPL really handy for making views of sorts into the data |
| 18:53 | TEttinger | like how many ranks are there in Insight, total? |
| 18:53 | TEttinger | it's around 75 |
| 18:53 | arrdem | TEttinger: why is a musket less accurate than a pistol? seems silly... |
| 18:54 | TEttinger | heavier, I guess |
| 18:54 | TEttinger | it isn't rifled and is basically a double-barreled shotgun |
| 18:54 | TEttinger | this is not a historically accurate game |
| 18:54 | bitemyapp | arrdem: not silly at all, muskets are quite inaccurate. |
| 18:54 | arrdem | bitemyapp: worse than a flintlock pistol? I think not... |
| 18:54 | bitemyapp | oh, flintlock? |
| 18:54 | bitemyapp | well n/m then |
| 18:55 | bitemyapp | I was thinking of short-recoil rifled handgun |
| 18:55 | TEttinger | I don't have an exact word for the equivalent firearms in real world |
| 18:55 | TEttinger | keep in mind, I have like 3 kinds of polearm/spear, the real world has dozens |
| 18:55 | arrdem | shrug. call it a balance factor. just something that jumped out at me. |
| 18:56 | arrdem | TEttinger: how are you storing all this data while keeping it repl-editable? |
| 18:56 | TEttinger | I just reread the Tab-separated value file |
| 18:56 | TEttinger | it's a simple copy paste into my aptly named input.txt |
| 18:57 | arrdem | heheh |
| 18:58 | TEttinger | the script is tiny to format the classes, and most of the other stuff borders on one-liners |
| 18:58 | TEttinger | https://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:00 | TEttinger | believe me, this is unreadable, but the version before it (raw regex search/replace strings) was unmaintanable |
| 19:02 | brehaut | wait, thats the maintainable regexp‽ O_O |
| 19:02 | TEttinger | lol. |
| 19:03 | TEttinger | interrobang. |
| 19:03 | brehaut | for all your non-transaction safe predicates |
| 19:03 | TEttinger | yeah it needs to read about 55 columns of sometimes-blank data |
| 19:03 | TEttinger | so it's certainly the correct regex |
| 19:04 | brehaut | im curious if instaparse would make it simpler |
| 19:04 | TEttinger | of course, it gives weird errors on badly formatted input |
| 19:04 | brehaut | (because you could name bits) |
| 19:04 | TEttinger | but I can usually find where the errors are |
| 19:05 | TEttinger | thankfully? I haven't needed to edit the clojure part much at all |
| 19:05 | brehaut | in fact, im pretty certain it would |
| 19:06 | TEttinger | it could probably parse the whole spreadsheet in one go. |
| 19:06 | TEttinger | the question is more why |
| 19:11 | concur | I'm having something very strange happen in my program |
| 19:12 | concur | I did a little printf debugging to figure out what's happening |
| 19:12 | concur | when I run it on my laptop, it gets into a for loop |
| 19:12 | concur | it prints at the start of the loop |
| 19:12 | concur | and then never again |
| 19:12 | concur | when I run it on my school's server |
| 19:12 | concur | it terminates the program once it reaches the for loop |
| 19:13 | concur | never printing |
| 19:13 | concur | and it doesn't throw any sort of exception |
| 19:13 | concur | it just looks like it exited normally |
| 19:13 | justin_smith | concur: are you doing anything with the result of the for? |
| 19:13 | justin_smith | for is lazy, if you don't use the value it produces, the code nver executes |
| 19:13 | concur | actually |
| 19:13 | concur | I'm doing it with side effects |
| 19:13 | concur | I probably shouldn't be using for |
| 19:14 | justin_smith | doseq |
| 19:14 | concur | It's supposed to save to a file each time |
| 19:14 | justin_smith | is it writing to the file inside for, or outside? |
| 19:14 | concur | inside |
| 19:14 | concur | each iteration is a save to a different file |
| 19:14 | justin_smith | it is lazy, so nothing uses the value, so it never executes |
| 19:14 | justin_smith | use doseq instead |
| 19:14 | concur | ooh |
| 19:15 | justin_smith | in the repl, it executes because you print the output |
| 19:15 | justin_smith | printing uses the output |
| 19:15 | justin_smith | *uses the result |
| 19:15 | concur | running on my machine it actually got to the part where it prints "saving" |
| 19:15 | concur | just now |
| 19:15 | concur | but yeah, definitely should be using doseq |
| 19:16 | patchwork | Hmm… I have a path to a jar and a file in the jar, how do I read the contents of that file? |
| 19:17 | justin_smith | http://stackoverflow.com/questions/5419125/using-java-api-from-clojure-reading-zip-file |
| 19:18 | concur | well, now it's getting further |
| 19:18 | concur | each iteration takes 500 seconds |
| 19:18 | concur | so now it's a waiting game :) |
| 19:21 | patchwork | justin_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:22 | justin_smith | I am going to look at the ZipFile interface |
| 19:25 | justin_smith | (.getEntry (java.util.zip.ZipFile. "/home/justin/.m2/repository/caribou/lichen/0.6.14/lichen-0.6.14.jar") "project.clj") |
| 19:26 | justin_smith | that reterns a zipentry object |
| 19:26 | patchwork | Just found that |
| 19:26 | patchwork | But then you have to get the ZipInputStream from that... |
| 19:26 | patchwork | Ah java |
| 19:31 | abp | just had fun with core.async and nio.. but that api is sick |
| 19:31 | abp | nios |
| 19:32 | patchwork | If anyone cares: https://www.refheap.com/20889 |
| 19:33 | justin_smith | nice, much better than what was in that SO answer |
| 19:59 | Morgawr | small 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:59 | Morgawr | ,(do (map println {:a 4}) (map val {:a 3 :b 4}) |
| 19:59 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 19:59 | Morgawr | ,(do (map println {:a 4}) (map val {:a 3 :b 4})) |
| 19:59 | clojurebot | (3 4) |
| 19:59 | Morgawr | (useless println lol) |
| 19:59 | Morgawr | ,(val [:a 3]) ; <-- this doesn't work |
| 19:59 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry> |
| 20:00 | TEttinger | Morgawr: ##(map type {:a 1}) |
| 20:00 | lazybot | ⇒ (clojure.lang.MapEntry) |
| 20:00 | TEttinger | not actually a vector, but prints as one |
| 20:00 | Morgawr | ahhh |
| 20:00 | amalloy | TEttinger: actually a vector |
| 20:00 | Morgawr | I guess it's a vector implemented as a MapEntry? |
| 20:01 | amalloy | it's an instance of IPersistentVector |
| 20:01 | TEttinger | oh? |
| 20:01 | TEttinger | ah ok |
| 20:01 | Morgawr | interesting, thanks |
| 20:01 | amalloy | it's just not the same class as [1 2] |
| 20:01 | TEttinger | or rather, a vector is not actually a mapentry, but mapentry inherits from vector |
| 20:02 | centaur | so at last we need types... |
| 20:02 | Morgawr | so it has come to this |
| 20:02 | Morgawr | the ultimate battle between dynamic and static |
| 20:02 | TEttinger | you can use first and second |
| 20:02 | TEttinger | on vectors and mapentries |
| 20:02 | Morgawr | only typed clojure can save us (!!) |
| 20:02 | amalloy | mapentry implements vector, it doesn't inherit from it |
| 20:02 | Morgawr | as far as I understand they are all vectors, just with different underlying implemenations... ? |
| 20:02 | Morgawr | implementations* |
| 20:08 | concur | after a very long wait, my program output its first plot |
| 20:08 | concur | and it looks good :D |
| 20:08 | arrdem | $seen Bronsa |
| 20:08 | lazybot | Bronsa was last seen joining on clojure 17 minutes and 2 seconds ago. |
| 20:09 | concur | replacing for with doseq did the trick |
| 20:11 | justin_smith | concur: cool |
| 20:11 | concur | is 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:11 | concur | I want to divide it into 10 evenly spaced ticks |
| 20:11 | concur | and from what I can tell, I'm going to have to do some java-level stuff |
| 20:15 | bitemyapp | http://chrisdone.com/posts/twitter-problem-loeb |
| 20:44 | zenoli | concur: 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:45 | zenoli | You'll probably need to call .getPlot on the chart, and then .getDomainAxis or .getRangeAxis on that for the NumberAxis. |
| 20:45 | zenoli | You can then do a .setTickUnit on the axis. |
| 20:57 | Bronsa | arrdem: pong |
| 20:59 | arrdem | Bronsa: 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:59 | Bronsa | arrdem: oh, you didn't include your username in the mail, didn't know it was you |
| 21:00 | Bronsa | arrdem: I'm replying right now |
| 21:00 | arrdem | Bronsa: facepalm. sorry, I keep forgetting I don't have an io@arrdem.com yet. |
| 21:09 | `cbp | is the conj being recorded? |
| 21:10 | bitemyapp | `cbp: I know Strange Loop was, so...hopefully? |
| 21:11 | bitemyapp | `cbp: also, DotA2? |
| 21:11 | `cbp | :P |
| 21:11 | `cbp | in an hour or so |
| 21:37 | arrdem | Bronsa: mind if I reply in here or shall we constrain this to email? |
| 21:38 | Bronsa | arrdem: however you prefer |
| 21:38 | arrdem | Bronsa: this works for me |
| 21:39 | arrdem | Bronsa: my vision of the project was to build the AOT infrastructure you mentioned in your future work blurb. |
| 21:41 | arrdem | Bronsa: 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:43 | Bronsa | arrdem: 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:44 | Bronsa | arrdem: 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:46 | arrdem | Bronsa: 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:48 | majyk | Thanks to the Clojure Conj the DC Metro blue line was empty tonight on my commute home. THANK YOU! This never happens. |
| 21:48 | Bronsa | arrdem: (also sorry, it's clojure.tools.emitter.jvm.transform not .bytecode, I can't even remember my own ns segments, duh) |
| 21:48 | muhoo | majyk: how is i possible that the conj kept people from commuting? |
| 21:49 | majyk | I dunno but it's wonderful! |
| 21:50 | muhoo | i'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:52 | majyk | anyway, 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:52 | bitemyapp | muhoo: well that would make things rather convenient for us wouldn't it? |
| 21:52 | majyk | anyway enough of my sarcasm... |
| 21:53 | muhoo | i'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:53 | Bronsa | arrdem: 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:53 | muhoo | so that test harness could take the fake memory db conn and put it into #'app somehow |
| 21:54 | muhoo | and the real app, running simultaneously, could use something set up in a global atom, but only passed in once in the handler |
| 21:54 | muhoo | or in the server, most likely |
| 21:54 | bitemyapp | muhoo: it seems pretty clear to me. |
| 21:54 | muhoo | the 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:55 | bitemyapp | muhoo: acquire at the top of a handler that needs it, or in a middleware, or just memoize the acquisition function. |
| 21:55 | muhoo | i'm digging through code of pedestal, luminus, carinou, etc, to see if someone has already done it |
| 21:55 | bitemyapp | just...make a decision. You don't need a global though. |
| 21:55 | bitemyapp | I do it all the time... |
| 21:56 | bitemyapp | muhoo: 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:57 | bitemyapp | there's nothing hiding in the kimono here, keep it simple. |
| 21:58 | muhoo | i 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:58 | muhoo | and then inside the app i can fish the db-handle out of the ring state wherever i need it |
| 21:58 | bitemyapp | don't do that :| |
| 21:58 | bitemyapp | no. |
| 21:58 | muhoo | why not? |
| 21:58 | bitemyapp | you don't bloody need to and singleton global database connections are net-negative contributors to your codebase. |
| 21:59 | muhoo | that makes no sense |
| 21:59 | muhoo | i already have signleton global database connection. i'm trying to remove it or reduce its use |
| 21:59 | bitemyapp | you'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:59 | bitemyapp | don't use a dynamic var, it's not even thread-safe. |
| 21:59 | bitemyapp | async-safe* |
| 21:59 | muhoo | (reset! db/conn (d/connect (:datomic-uri env/env)) |
| 22:00 | muhoo | so, what, create a new connection with each request? |
| 22:00 | muhoo | isn't that.... slow? |
| 22:00 | bitemyapp | I gave you multiple choices |
| 22:01 | bitemyapp | only one of which required creating a connection-per-use |
| 22:01 | muhoo | you gave me a terse description and i don't understand what exactly you mean. |
| 22:02 | bitemyapp | okay, one solution is to acquire a connection at the top of each handler |
| 22:02 | muhoo | what do you mean "acquire at the top of a handler". acquire from where? |
| 22:02 | bitemyapp | the dependent functions that want to perform queries get the database handed to them |
| 22:02 | muhoo | and where to put it, once it's acquired? |
| 22:02 | bitemyapp | create a friggin' connection. |
| 22:02 | bitemyapp | (d/connect "ya-fuckin-database-yo") |
| 22:02 | muhoo | gotcha. then store the conn where? |
| 22:03 | bitemyapp | muhoo: you don't! |
| 22:03 | muhoo | there are multiple places throughout the app that need db access. |
| 22:03 | bitemyapp | at the top |
| 22:03 | bitemyapp | of each handler |
| 22:03 | bitemyapp | you will acquire a connection before processing the request |
| 22:03 | bitemyapp | you can do so in a future...or not |
| 22:03 | bitemyapp | but you are not assigning a *place* |
| 22:03 | bitemyapp | you are not saving a global |
| 22:03 | bitemyapp | you are not creating a singleton |
| 22:03 | bitemyapp | you are simply instantiating the resource you need |
| 22:03 | bitemyapp | and passing it as an argument to all functions invoked that require a db-conn or a db. |
| 22:03 | muhoo | and how do i get it elsewhere? |
| 22:04 | bitemyapp | define elsewhere |
| 22:04 | bitemyapp | what is executing that cannot be traced to a handler? |
| 22:04 | muhoo | i have a compojure route. where does it gets its db handle from? |
| 22:04 | abp | when using core.async, is it "normal" to use a close-channel one can put a value to tear down a go-block? |
| 22:05 | muhoo | bitemyapp: i don't know a way to pass the db handle into a compojure route handler |
| 22:05 | bitemyapp | (defn my-route [request] (let [MY-DATABASE (d/connect "DA-DATABASE")] ...)) |
| 22:05 | muhoo | in every route? |
| 22:05 | muhoo | that seems really inefficient |
| 22:06 | bitemyapp | muhoo: don't make assertions you haven't established measurements for. |
| 22:06 | bitemyapp | muhoo: I provided alternatives, START WITH THE SIMPLEST THING FIRST |
| 22:06 | muhoo | this isn't PHP, i'm hoping not to open a db connection with each page view |
| 22:06 | bitemyapp | muhoo: this isn't Java, don't optimize before you've actually measured anything. |
| 22:07 | bitemyapp | you can wrap your connection acquisition in a pool if you want, but for now, do the simple thing first |
| 22:07 | bitemyapp | THEN OPTIMIZE LATER |
| 22:07 | muhoo | well, it appears i have no valid concerns, so i'll go fuck myself now. thanks. |
| 22:07 | bitemyapp | muhoo: I measured the connection time and for my use-case it wasn't worth optimizing out. |
| 22:08 | bitemyapp | muhoo: the point is that if you do the simple and clean thing first, it's easier to clean up/optimize/refactor later |
| 22:08 | bitemyapp | muhoo: if you fuck around with bullshit that doesn't matter it'll be harder to refactor when something unanticipated occurs. |
| 22:08 | `cbp | how does java handle streams when they get out of scope |
| 22:08 | `cbp | do they get closed |
| 22:09 | bitemyapp | `cbp: http://stackoverflow.com/questions/2506488/java-finalize-method-call |
| 22:09 | bitemyapp | `cbp: http://docs.oracle.com/javase/7/docs/api/java/io/FileOutputStream.html#finalize() |
| 22:10 | `cbp | oh |
| 22:10 | abp | muhoo: 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 | `cbp | well thats good |
| 22:11 | bitemyapp | abp: That's the sort of thing I eventually aim for, but I was hoping I could convince him to do something simple first. |
| 22:11 | bitemyapp | `cbp: it is better to call .close() yourself though. |
| 22:11 | bitemyapp | `cbp: otherwise OS resources are retained until a GC pas. |
| 22:11 | bitemyapp | pass* |
| 22:12 | abp | muhoo: you could also just let the connection around all your routes because http://docs.datomic.com/clojure/#datomic.api/release |
| 22:12 | bitemyapp | `cbp: also, been an hour >:) |
| 22:14 | abp | bitemyapp: simple or messy, thats the question, having tons of d/connect in your routes isn't dry at least |
| 22:15 | bitemyapp | abp: sure but I prefer to do the simplest thing possible that minimizes indirection before I scale up the sophistication. |
| 22:16 | bitemyapp | abp: because if you anticipate problems from an incorrect origin, you scale for the wrong things and it becomes even harder to adapt. |
| 22:16 | abp | bitemyapp: when writing code i too hack away sometimes but do regular cleanup |
| 22:16 | bitemyapp | If simply acquiring a resource and passing it to dependent functions is going to suffice...do that. |
| 22:16 | abp | bitemyapp: some things are just okay, like passing a context-map as a first argument, thats not bound to break |
| 22:17 | bitemyapp | I don't do that. |
| 22:19 | swarthy | I 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 | `cbp | bitemyapp: im fooding + dling patch t.t |
| 22:19 | abp | bitemyapp: why? |
| 22:20 | bitemyapp | `cbp: I'll get chips and salsa. |
| 22:21 | bitemyapp | abp: 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:21 | bitemyapp | or I write a macro. |
| 22:21 | bitemyapp | or I make a closure. |
| 22:21 | bitemyapp | what 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:23 | abp | bitemyapp: what do you mean by "reify each even dependent resource as a single argument"? |
| 22:23 | bitemyapp | [db-conn server ...] |
| 22:23 | bitemyapp | plain ole function arguments. |
| 22:24 | bitemyapp | maybe kwargs if they're sometimes not needed. |
| 22:26 | abp | bitemyapp: 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:26 | bitemyapp | abp: it does do that. |
| 22:27 | abp | bitemyapp: also no positional fn-call sna-fu |
| 22:27 | bitemyapp | abp: dynamic languages... :| |
| 22:27 | abp | bitemyapp: to the point where you need to adjust a bunch of signatures :/ |
| 22:30 | abp | bitemyapp: 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:33 | bitemyapp | abp: well, if you want to see craziness, there's always the Reverse State monad. |
| 22:33 | bitemyapp | abp: and Control.Monad.Tardis |
| 22:34 | `cbp | bitemyapp: this patch is so big t.t |
| 22:34 | bitemyapp | `cbp: I didn't even notice a patch |
| 22:34 | `cbp | bitemyapp: you live in cali you silly :P |
| 22:35 | bitemyapp | `cbp: well I have 50 mbp internet, but seriously, I didn't even notice a patch |
| 22:35 | abp | bitemyapp: 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:35 | bitemyapp | abp: all good. it's a good thing to look into when you're feeling curious and energetic :) |
| 22:36 | abp | bitemyapp: having a hard time resisting the urge to abstract what i got and code on till done :x |
| 22:37 | bitemyapp | `cbp: ETA? |
| 22:38 | `cbp | bitemyapp: around 25-30 minutes :( |
| 22:38 | bitemyapp | `cbp: which in Mexico time is an hour. I'll watch an episode of Star Trek :) |
| 23:01 | `cbp | bitemyapp: are you reaadyy? |
| 23:01 | bitemyapp | `cbp: lets rooooock |
| 23:55 | Happy33 | hi all |
| 23:56 | Happy33 | any female wana chat 28m |