2012-04-30
| 00:07 | muhoo | AOT compilation is good on heroku to reduce spin-up times. however, AOT is not good for cljs, i'm told. should i bother trying? |
| 00:20 | emezeske | muhoo: AOT compiling the cljs compiler will appear to work, but you will run into subtle problems |
| 00:20 | emezeske | muhoo: That's (partially) why I wrote lein-cljsbuild, so that I could do all the cljs compilation at dev time |
| 00:23 | Raynes | ibdknox: https://github.com/Raynes/lein-gitify |
| 00:30 | Caomai | !reset |
| 00:35 | technomancy | you can get the AST out of Ruby, it's just not part of the stable API, so it breaks during minor version bumps |
| 00:35 | technomancy | http://rubyforge.org/projects/parsetree/ |
| 00:37 | technomancy | it sounds like the reasoning is along the lines of "we value the ability to change things easily over the ability to make good tooling? |
| 00:38 | ibdknox | technomancy: interesting |
| 00:39 | Raynes | technomancy: https://github.com/Raynes/lein-gitify My answer to "plz rite git tmplat |
| 00:39 | Raynes | " |
| 00:39 | ibdknox | I saw that and didn't realize it was official |
| 00:39 | Raynes | technomancy: Do you approve? |
| 00:39 | technomancy | Raynes: this makes me think that templates should compose |
| 00:40 | technomancy | not that I have any idea how that would look, but it makes you wonder |
| 00:40 | Raynes | This makes me have no idea what you're talking about and why you want to make things even more complex than they are. |
| 00:40 | ibdknox | Raynes: that's neat |
| 00:40 | ibdknox | I do that a lot |
| 00:40 | ibdknox | and am annoyed by it |
| 00:40 | ibdknox | so well done |
| 00:40 | ibdknox | lol |
| 00:42 | Raynes | technomancy: I think I get what you're saying, but this isn't a template. |
| 00:42 | Raynes | technomancy: I thought about it more, and this couldn't really be a template. |
| 00:42 | Raynes | It is exactly what a Leiningen plugin is for. |
| 00:42 | Raynes | We could have extended existing templates to add the functionality, but that seems like overkill. |
| 00:43 | Raynes | Anyways, I'm off. We can talk more about this stuff later. |
| 00:43 | Raynes | <3 |
| 00:47 | yoklov | Hm, anybody know how javascript's `this` ends up working in a multimethod? |
| 00:47 | ibdknox | almost guaranteedly not how you'd want it to |
| 00:48 | ibdknox | you probably want to pass this in |
| 00:49 | yoklov | i'm trying to use it as an onload callback |
| 00:50 | yoklov | but… yeah. |
| 00:50 | yoklov | pretty much doesnt work how i'd like |
| 01:21 | muhoo | is there a cleaner way to do this kind of destructuring: https://refheap.com/paste/2455 ? |
| 01:22 | yoklov | why not (defn save! [{:keys [email name picture]}]) |
| 01:22 | yoklov | or (defn save! [{:keys [email name picture] :as m}]) |
| 01:22 | yoklov | but i'm tired and there might be a difference there i'm not picking up on |
| 01:29 | Raynes | muhoo: Define 'cleaner'? |
| 01:30 | Raynes | muhoo: You can do the destructuring in the argument list. |
| 01:30 | Raynes | Usually it's better to do it in a let though, like you have here. |
| 01:30 | Raynes | I don't see anything wrong with this. |
| 01:30 | yoklov | Raynes: why is it usually better to do it in a let? |
| 01:30 | Raynes | &(meta #'println) |
| 01:30 | lazybot | ⇒ {:ns #<Namespace clojure.core>, :name println, :arglists ([& more]), :added "1.0", :static true, :doc "Same as print followed by (newline)", :line 3325, :file "clojure/core.clj"} |
| 01:31 | yoklov | arglist metadata? |
| 01:31 | Raynes | yoklov: If you do it in the argument list, the :arglists keys gets that destructuring form. It makes it ugly. |
| 01:31 | yoklov | that makes sense. |
| 01:31 | Raynes | It makes API documentation cleaner. |
| 01:31 | Raynes | Unless, of course, you want to document the destructuring. Usually you don't though. |
| 01:32 | yoklov | yeah and it gets ugly after a while if you have a couple things being destructured |
| 01:32 | yoklov | tends to make the arglist huge. |
| 01:33 | yoklov | thanks, i think i'll try to do that. |
| 01:37 | muhoo | interesting, thanks |
| 02:09 | mebaran151 | does lein2 no longer make a lib directory for dependencies? |
| 02:13 | muhoo | hmm, i like this render thing in noir, but control-r resubmits the form that way |
| 02:15 | muhoo | oic, i should only be doing that upon error |
| 02:16 | raek | mebaran151: lein2 does not copy the files anymore. it uses the files from ~/.m2/ directly |
| 02:20 | jhickner | does lein-swank work with leiningen 2? |
| 02:21 | jhickner | getting a weird error: Incompatible minimum and maximum heap sizes specified |
| 02:25 | _KY_ | How do I generate all possible pairs from (1 2 3 4...)? |
| 02:25 | _KY_ | Like (1 2) (one 3) (one 4)... (2 3) (2 4)... |
| 02:26 | _KY_ | Like (1 2) (1 3) (1 4)... (2 3) (2 4)... |
| 02:26 | jhickner | (let [a '(1 2 3)] (for [x a y a] [x y])) |
| 02:27 | _KY_ | I see...=) |
| 02:28 | jhickner | (take 20 (let [a (iterate inc 1)] (for [x a y a] [x y]))) |
| 02:28 | LuminousMonkey | Nice |
| 02:29 | LuminousMonkey | Hmm actually, that last one won't work properly? |
| 02:29 | jhickner | heh, with that actually all you get is pairs of [1 to n] where n approaches infinity :) |
| 02:30 | emezeske | &(= (take 5 (range)) (take 5 (iterate inc 1))) |
| 02:30 | lazybot | ⇒ false |
| 02:31 | emezeske | &(for [x (range 1 5) y (range 1 5)] [x y]) |
| 02:31 | lazybot | ⇒ ([1 1] [1 2] [1 3] [1 4] [2 1] [2 2] [2 3] [2 4] [3 1] [3 2] [3 3] [3 4] [4 1] [4 2] [4 3] [4 4]) |
| 02:37 | _KY_ | It's funny that I posted this answer a few days ago... and I'm asking for it today |
| 02:39 | justinlilly | hi all. -- anyone have thoughts as to how these two are different? carousel-entry gets called with the same arguments, but doesn't do what its expected in the loop example but works in the for example. Any thoughts? http://pastebin.com/67PAnksL |
| 02:40 | justinlilly | hrm. nevermind. I think the difference is that the value isn't being accumulated properly. |
| 02:43 | muhoo | ibdknox: would you be open to additions to noir to make form handling more abstract and less bolierplatey? |
| 02:43 | muhoo | or do you want to keep it kind of thin? |
| 02:44 | ibdknox | muhoo: do you have an example? |
| 02:44 | muhoo | not in clojure, but in other frameworks |
| 02:45 | muhoo | like, maybe pass in a map and get back the add and edit forms |
| 02:45 | muhoo | with save/add buttons already placed and laid out |
| 02:45 | muhoo | the routing created |
| 02:45 | ibdknox | definitely sounds like a companion lib :) |
| 02:45 | muhoo | i've just done tons of copy/pasting and it seems very unclojureish to do it that way |
| 02:46 | muhoo | i'll see what i can come up with. |
| 02:46 | ibdknox | in my experience those things can't really be usefully generalized, but I don't always work with "normal" stuff :) |
| 02:47 | muhoo | i'm doing very normal stuff. :-) |
| 02:48 | ibdknox | sounds like a great thing to add to the ecosystem though :) |
| 02:48 | ibdknox | nobody likes boilerplate lol |
| 02:49 | muhoo | yeah, i mean, 100 lines of view code to handle a tiny form with 3 fields seems way too much to me, but, then again, in other languages that'd probably be several hundred lines |
| 02:53 | justinlilly | Is there an easy way to determine if you're on your first iteration in a (for) ? |
| 02:53 | justinlilly | I'm resorting to loop-recur and I'm making a mess of it all :-/ |
| 03:01 | emezeske | justinlilly: What are you trying to do? |
| 03:03 | justinlilly | emezeske: (myfn arg (if (first-iteration?) :first)) |
| 03:03 | justinlilly | so on 3 iterations: (myfn arg :first) (myfn arg) (myfn arg) |
| 03:04 | justinlilly | I finally managed to get something working, but it feels awful. |
| 03:05 | emezeske | justinlilly: Hmm, I think I'd need more context to be able to help |
| 03:05 | justinlilly | http://pastebin.com/50uZVxk9 |
| 03:06 | justinlilly | this is currently working. I was hoping to have something more akin to the for loop commented out. Any tips would be appreciated. |
| 03:07 | emezeske | justinlilly: Regarding your first comment, "some" is the right way to do that. |
| 03:07 | emezeske | justinlilly: regarding the div id, just do [:div {:id ...}, if you need to set it based on what's passed in |
| 03:07 | justinlilly | This just feels like a lot of work for what seems like (in python) for i, foo in enumerate(bar):... |
| 03:09 | emezeske | I'm looking at your loop atm |
| 03:09 | emezeske | I think what you need is map-indexed |
| 03:12 | justinlilly | Thanks. I'll play around with it :) |
| 03:14 | emezeske | Paste incoming in a sec |
| 03:15 | emezeske | justinlilly: Totally untested: http://pastebin.com/0gECfXMz |
| 03:16 | emezeske | justinlilly: Oops, there's a bug, sec |
| 03:17 | emezeske | justinlilly: There we go: http://pastebin.com/LZXwxZ44 |
| 03:20 | emezeske | haha I should have tested it: http://pastebin.com/32k0w2qF ^_^ |
| 03:20 | justinlilly | yep. :) Totally works. |
| 03:20 | justinlilly | nice to know that my "this should be easier" filter is working. Now I just need to learn my way around the stdlib. |
| 03:21 | justinlilly | so & [id] in method args makes id an optional, positional argument? |
| 03:21 | emezeske | Yeah, it's an idiomatic trick to do that. It's value will be nil if not supplied |
| 03:22 | _KY_ | Is "clojure-contrib-1.1.0.jar" needed if I did not use it explicitly? |
| 03:22 | emezeske | ~contrib |
| 03:22 | clojurebot | Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go |
| 03:22 | emezeske | _KY_: ^ |
| 03:22 | justinlilly | In python, I would probably do this as: defn carousel(cool, id="myCarousel"): .. is there a nifty way to do kwargs? |
| 03:22 | justinlilly | s/cool/coll |
| 03:23 | emezeske | justinlilly: Yeah, I think it's like [a b c & {:keys [id] :or [:id "myCarousel"]}] |
| 03:23 | emezeske | justinlilly: That might be a bit wrong, though, I don't do that too much |
| 03:24 | justinlilly | yea. doesn't look pretty. This works for me for now. Thanks for your help :) |
| 03:24 | emezeske | No problem! |
| 03:25 | emezeske | I am still a noob myself, so I try to help with the problems I can for practice |
| 03:26 | mmarczyk | anybody willing to run some cljs data structure perf tests? links in http://dev.clojure.org/jira/browse/CLJS-190?focusedCommentId=28320#comment-28320 |
| 03:33 | _KY_ | There are some large jar files in the lein directory that I don't want to upload to the repository... what can I do? |
| 03:35 | emezeske | Could you be more specific about what the "lein directory" and the "repository" are? |
| 03:38 | emezeske | _KY_: ^ |
| 03:38 | _KY_ | The project directory created by lein |
| 03:38 | _KY_ | And I want to upload the project to google code |
| 03:39 | _KY_ | But I don't want to include jars such as clojure-1.3.0.jar |
| 03:39 | LuminousMonkey | Are you using Git, Mercurial? |
| 03:39 | emezeske | So, just set the subversion ignore property? |
| 03:40 | _KY_ | Mercurial |
| 03:40 | LuminousMonkey | Create .hgignore in the directory. |
| 03:40 | _KY_ | So, later if a user checks it out, they can find the jars automatically? |
| 03:40 | _KY_ | I already did that... just worrying if the users can't run it |
| 03:41 | LuminousMonkey | lein deps should take care of getting the jars? |
| 03:41 | emezeske | IIRC you don't want to use lein, right? |
| 03:41 | LuminousMonkey | Ohhh. |
| 03:41 | _KY_ | I am using lein by default |
| 03:41 | LuminousMonkey | Geez, why not use lein? :P |
| 03:41 | emezeske | Oh, then 'lein deps' |
| 03:41 | LuminousMonkey | :) |
| 03:41 | _KY_ | Just planning to provide the option of not using it (but that will be later) |
| 03:42 | _KY_ | I see... so they'll run "lein deps" first |
| 03:42 | LuminousMonkey | Just make sure they're ignored by Mercurial and that lein deps pulls them in. |
| 03:42 | emezeske | _KY_: Look at the .gitignore file that "lein new" made for you -- you'll likely want to translate that whole thing to .hgignore (or whatever it is) |
| 03:43 | LuminousMonkey | A dirty way is to rename .gitignore to .hgignore and add a line "syntax: glob" at the top. |
| 03:43 | emezeske | _KY_: Also, "lein deps" of course assumes that you have set your :dependencies in the project.clj file appropriately |
| 03:43 | emezeske | LuminousMonkey: nice! |
| 03:43 | faust45 | hi guys |
| 03:43 | _KY_ | Great... |
| 03:44 | LuminousMonkey | emezeske: I use Mercurial. :) |
| 03:44 | faust45 | can any one suggest how i can make code reloading in runtime. notice (require 'test :reload) i try it but not working |
| 03:46 | LuminousMonkey | faust45: I don't know how to do it, trying to look. |
| 03:49 | LuminousMonkey | Could try adding :verbose to see what is going on? |
| 03:50 | faust45 | LuminousMonkey: :verbose ? which place |
| 03:51 | LuminousMonkey | (require 'test :verbose) Should print info about what it's loading in. |
| 03:51 | LuminousMonkey | So (require 'test :verbose :reload) |
| 03:51 | faust45 | not :reload ? |
| 03:51 | faust45 | ok |
| 03:51 | faust45 | thanks |
| 03:52 | LuminousMonkey | See what it's trying to load, maybe you need :reload-all instead? |
| 03:52 | LuminousMonkey | I'm new to Clojure, so I have no idea. |
| 03:54 | faust45 | LuminousMonkey: https://friendpaste.com/4OzVMOWaDnAnFhUtemklbd |
| 03:55 | LuminousMonkey | And it's not updating your functions, etc? What are you trying to do exactly? |
| 03:57 | _KY_ | "hg add" does not seem to ignore the jar files or any files I told it to ignore in .hgignore |
| 03:57 | LuminousMonkey | _KY_: Could you paste your .hgignore file? |
| 03:58 | _KY_ | http://pastebin.com/GbtB5s5A |
| 03:59 | LuminousMonkey | Line 23-24 should be clojure\lib\*.jar? |
| 04:00 | LuminousMonkey | Hmm, here's mine: http://pastebin.com/qppwYnxQ |
| 04:00 | _KY_ | I thought it would apply to all sub dirs? |
| 04:01 | LuminousMonkey | It should... I'm wondering if you have to hg add .hgignore I've never noticed if I had to before. |
| 04:02 | faust45 | LuminousMonkey: i have loop while which wiring accept socket than process http req, in beginning of while i what make (code reload). but routing handler i define object before loop while so when i change handler behavior nothing changed |
| 04:02 | _KY_ | It doesn't seem to have any effect... |
| 04:02 | LuminousMonkey | Ahh, no, it should work without being commited |
| 04:02 | _KY_ | But it "added" all the crap... |
| 04:03 | Raynes | Oh wow, hg users. Quite a rare breed in these parts. |
| 04:04 | LuminousMonkey | faust45: You will have to restart your (Jetty?) for it to pick up the changes as well... |
| 04:05 | faust45 | LuminousMonkey: i am not using Jetty. using org.apache.http |
| 04:05 | LuminousMonkey | faust45: Still the same thing I think? I might have an example somewhere... |
| 04:05 | _KY_ | If I use "hg status" it shows the unwanted files |
| 04:06 | LuminousMonkey | Raynes: I'm thinking of moving to git. :) |
| 04:06 | Raynes | I highly support this thought. |
| 04:06 | LuminousMonkey | faust45: https://gist.github.com/2495345 |
| 04:07 | faust45 | LuminousMonkey: https://friendpaste.com/4OzVMOWaDnAnFhUtemkkyZ |
| 04:07 | LuminousMonkey | faust45: That's the code I use for my webapp using jetty. I've just recently found out about the #' which causes that var to be reread on each access. You might be having a similar issue? |
| 04:08 | faust45 | LuminousMonkey: dunno |
| 04:10 | LuminousMonkey | faust45: Really out of my area now. On line 53: (.handleRequest #'http-service conn context) |
| 04:11 | faust45 | LuminousMonkey: CompilerException java.lang.RuntimeException: Unable to resolve var: http-service in this context, compiling |
| 04:13 | LuminousMonkey | faust45: Beyond me I'm sorry, when I was using the Jetty stuff, using :reload, I had to start and stop the jetty process for it to pick up the changes. |
| 04:13 | faust45 | LuminousMonkey: #' mean re tead var? |
| 04:13 | faust45 | re read |
| 04:14 | LuminousMonkey | faust45: Yeah, though, that won't work, I think you need line 48 to be rerun after your require on line 51 as well... |
| 04:15 | LuminousMonkey | faust45: Sorry, I really have no idea. |
| 04:15 | faust45 | LuminousMonkey: how i can assign var in while loop? |
| 04:17 | LuminousMonkey | faust45: Could make it an atom or something? |
| 04:18 | faust45 | LuminousMonkey: maybe but its depend on other vars in let block |
| 04:20 | faust45 | LuminousMonkey: any case thanks! |
| 04:24 | LuminousMonkey | Raynes: Makes sense to switch to Git since everyone seems to use Github. :) |
| 04:25 | LuminousMonkey | faust45: I'll take any compliment on my useless ramblings, thanks. :) |
| 04:34 | tutysra_ | hi room |
| 04:35 | tutysra_ | how do i use clojure.math.combinatorics package in my code |
| 04:36 | tutysra_ | i am getting an exception - Could not locate clojure/math/combinatorics__init.class or clojure/math/combinatorics.clj on classpath on SLIME repl, I am running clojure1.3 - this is the output from *clojure-version* - {:major 1, :minor 3, :incremental 0, :qualifier nil} |
| 04:41 | tutysra_ | i guess clojure.contrib.combinatorics was moved into clojure.math.combinatorics from version 1.3, should i have to include any separate config details in project.clj to use these functions? |
| 04:53 | tutysra_ | ok, got the solution from src (pom file) - included 0.2.2 version. thx. |
| 05:16 | mengu_ | what one must read in order to understand the fundementals of clojure? |
| 05:17 | lucian | try http://www.clojurebook.com/ |
| 05:18 | mengu_ | lucian: i'm already reading "programming clojure" |
| 05:19 | mengu_ | but then it took me some time to understand that (let [x y]) means x = y in that scope |
| 06:31 | benson | Hello Room |
| 06:55 | ssedano1 | Hi, I want to create Properties. Is clojure.java.data the best choice? |
| 06:59 | ssedano1 | or I just (def prop (doto (java.util.Properties.) (.putAll {:myKey "n"}))) |
| 08:49 | mduerksen | hmm, max-key prefers the latter argument when (k x) and (k y) are equal. is this considered an implementation detail, or can i rely on it? |
| 08:54 | fdaoud | mduerksen: if they are equal, why do you need to care which one it returns? |
| 08:56 | mduerksen | fdaoud: it matters when x and y have the same key-value, but are otherwise different, like here: ##(max-key {:timestamp 1 :value "bla"} {:timestamp 3 :value "blub"}) |
| 08:56 | lazybot | ⇒ {:timestamp 3, :value "blub"} |
| 08:56 | mduerksen | ##(max-key {:timestamp 1 :value "blub"} {:timestamp 3 :value "bla"}) |
| 08:56 | lazybot | ⇒ {:timestamp 3, :value "bla"} |
| 08:57 | mduerksen | in my case, i want to merge 2 hash-maps, the "old" one and the "new" one. and only when the "new" one has an older timestamp should the old one "win" |
| 08:59 | mduerksen | a wait, my example was of course wrong: ##(max-key {:timestamp 1 :value "bla"} {:timestamp 1 :value "blub"}) |
| 08:59 | lazybot | ⇒ {:timestamp 1, :value "blub"} |
| 08:59 | mduerksen | and ##(max-key {:timestamp 1 :value "blub"} {:timestamp 1 :value "bla"}) |
| 08:59 | lazybot | ⇒ {:timestamp 1, :value "bla"} |
| 09:01 | bhenry | #(apply merge (if (> (:timestamp %1) (:timestamp %2)) [%1 %2] [%2 %1])) |
| 09:01 | bhenry | mduerksen: hacky, but simple |
| 09:01 | mduerksen | but my question remains: i can only merge with max-key if i can be certain that max-key will *always* prefer the latter argument. otherwise i'll have to write something like bhenry just wrote |
| 09:03 | mduerksen | bhenry: i know i can write my own dedicated conflict function, but i hoped i could use the more elegant one from clojure.core. i'm inclined to do so, because merge itself has similar semantics (left-to-right), but since the doc for max-key doesn't explicitly say so (as opposed to merge), i'm not sure if its a good idea |
| 09:04 | fdaoud | mduerksen: I think you're right |
| 09:04 | mduerksen | it could break in future versions, except if the function commits itself to its current semantics with its doc |
| 09:06 | mduerksen | but i would love to write this: (merge-with (partial max-key :timestamp) old-apps new-apps) |
| 09:09 | bhenry | irc://irc.freenode.net:6667/#%23(max-key :timestamp {:timestamp 1 :value "blub"} {:timestamp 1 :value "bla"}) |
| 09:38 | dgrnbrg | hey clojurians, I just released a branch coverage analyzer for clojure |
| 09:39 | dgrnbrg | it's kind of rough around the edges, so if you give the plugin a shot and find an issue, let me know :) [lein-guzheng "0.2.3"] |
| 09:40 | mdeboard | dgrnbrg: as in test coverage? |
| 09:40 | dgrnbrg | yeah |
| 09:41 | dgrnbrg | It's a trampoline task, so you can run any other lein task under the instrumentation |
| 09:41 | dgrnbrg | Suppose you want to see the coverage report for ns foo.core |
| 09:41 | dgrnbrg | when you run all the unit tests |
| 09:41 | dgrnbrg | lein guzheng foo.core -- test |
| 09:41 | dgrnbrg | or maybe you want to see which parts of foo.core don't get executed when you run the program normally: |
| 09:42 | dgrnbrg | lein guzheng foo.core -- run |
| 09:42 | wmealing | will this work for things like midje ? |
| 09:42 | dgrnbrg | after the -- is any other lein test |
| 09:42 | dgrnbrg | the idea is that it'll work for anything |
| 09:42 | wmealing | nice |
| 09:42 | dgrnbrg | it hooks eval-in-project to reinstrument the given namespaces before running the task |
| 09:42 | dgrnbrg | and then after they finish, it prints a report |
| 09:42 | dgrnbrg | it's a work in progress, so when you find bugs, let me know |
| 09:43 | mdeboard | neat |
| 09:59 | jweiss | i'm a little confused how load-file works. "The loading functions occur in a temporary context, in which *ns* has a fresh binding. That means that, should any form have an effect on that var (e.g. `in-namespace), the effect will unwind at the completion of the load." what exactly does that mean? |
| 10:00 | jweiss | a "fresh binding" to *what*? |
| 10:00 | jweiss | a gensym'd ns, essentially? |
| 10:01 | jweiss | that just doesn't seem to be true, it seems to load the file into the current namespace. |
| 10:02 | jweiss | i guess it means it's just run in a binding form, but with the same value as the current ns? |
| 10:03 | sattvik | jweiss: I think so, i.e. (binding [*ns* *ns*] (file contents)) |
| 10:07 | _KY_ | How do I specify to "read" from standard input? |
| 10:07 | _KY_ | ie, what's the name of the stream for standard input |
| 10:07 | sattvik | _KY_: *in*, thought it can be rebound |
| 10:08 | _KY_ | It works in REPL, but in Lein, input is frozen |
| 10:09 | sattvik | _KY_: Ah, yes. I just finished dealing with that issue. Is this within an eval-in-project? |
| 10:09 | _KY_ | It's in a test |
| 10:09 | sattvik | That generally won't work. It should work if you use trampoline, i.e. 'lein trampoline test'. |
| 10:10 | _KY_ | What does trampoline do? |
| 10:11 | sattvik | It makes the task run within Leiningen rather than in a subprocess. |
| 10:11 | dgrnbrg | other way around, sattvik, iirc |
| 10:11 | dgrnbrg | trampoline runs in a subprocess, normally just runs in a new classloader |
| 10:12 | _KY_ | I see... |
| 10:14 | sattvik | Still, you may want to reconsider whether or not you want to have a test that relies on console I/O. For testing something that relies on *in*, you could use something like (with-in-str). |
| 10:16 | sattvik | dgrnbrg: You may be right; I haven't actually looked at the code. For plug-ins, it seems like I/O within in eval-in-project context seems to require sockets if no trampoline is involved. |
| 10:16 | dgrnbrg | that would make sense, since lein probably is hooking all the streams into the project |
| 10:17 | dgrnbrg | since every plugin you install can mess with those things |
| 10:39 | hcumberdale | Hi ;) |
| 10:39 | timvisher | is it expected that defrecord performs an order of magnitude worse than a hash-map unless you do the lookup many times? |
| 10:39 | timvisher | hi hcumberdale |
| 10:40 | timvisher | RE defrecord/hash-map: in terms of speed of field lookup |
| 10:40 | hcumberdale | does anyone know how amazon s3 bucket & key correspond to the url |
| 10:41 | timvisher | as far as i understood things, field lookup is supposed to be _way_ faster with a record, but i see performance gains of about double when I dotimes 1000000 but they take longer to construct, it seems, and the field lookup is slow in the beginning |
| 10:41 | hcumberdale | https://s3.amazonaws.com/<bucket>/<key> << right? |
| 10:41 | timvisher | which leads me to believe that even in the case of performance optimization, you would only want to use defrecord in low-write, high read situations |
| 10:42 | timvisher | hcumberdale: are you referring to objectid as key? |
| 10:42 | hcumberdale | yes |
| 10:43 | hcumberdale | I'm using the framework https://github.com/weavejester/clj-aws-s3 |
| 10:43 | hcumberdale | I get a map with metadata from the objects |
| 10:43 | timvisher | i think it's actually https://<bucket>.s3-website-us-east-1.amazonaws.com/<objectid> |
| 10:43 | hcumberdale | and they contain a "key" |
| 10:43 | hcumberdale | timvisher, seems it depends on where the bucket is?! |
| 10:44 | timvisher | well, it depends on what end-point you're using |
| 10:44 | timvisher | i think end-point is the right term there |
| 10:44 | timvisher | you can host the bucket at different server farms |
| 10:44 | hcumberdale | Code: NoSuchWebsiteConfiguration |
| 10:44 | hcumberdale | Only if you configure the bucket as website |
| 10:44 | timvisher | the default is us-east-1 |
| 10:44 | timvisher | ah |
| 10:44 | timvisher | that may be what i'm looking at |
| 10:44 | timvisher | :) |
| 10:44 | hcumberdale | look at the object properties |
| 10:45 | hcumberdale | https://s3.amazonaws.com/mkr_cblog/finished.jpg |
| 10:45 | hcumberdale | http:// seems to work too |
| 10:45 | timvisher | it's a shame because i was just reading about this last night but i left that book at home |
| 10:46 | timvisher | there's a section on this exact topic |
| 10:46 | hcumberdale | !google using http://s3.amazonaws.com |
| 10:47 | hcumberdale | http://s3.amazonaws.com/bucket/key << seems to be secure |
| 10:48 | timvisher | looks interesting: http://onjava.com/pub/a/onjava/2007/11/07/introduction-to-amazon-s3-with-java-and-rest.html?page=last&x-showcontent=text |
| 10:48 | timvisher | seems the bucket name can be used as a sub-domain as well |
| 10:48 | hcumberdale | I'll write a 305 header router |
| 10:48 | jsmonkey | Hi, I am totally new to clojure and want to learn it. Is there any free ebooks or very good free resources? |
| 10:48 | hcumberdale | ahhh mean 301 |
| 10:49 | timvisher | jsmonkey: http://www.4clojure.com/, http://tryclj.com/ |
| 10:50 | timvisher | oh, and, http://blog.twonegatives.com/tagged/clojure ;) |
| 10:50 | jsmonkey | timvisher: thanks! free today and tomrow so thought why not learn something totally different :) |
| 10:51 | timvisher | indeed, and now for something completely different… |
| 10:54 | nDuff | jsmonkey: if you can grok clojure enough to be effective in it in two days, I'll be very jealous. :) |
| 10:55 | jsmonkey | nDuff: since when did I write that I would be effetive in two days :) I have two days off so it is a perfect kickstart to learn a new language. |
| 10:55 | hcumberdale | yeah, it works |
| 10:56 | hcumberdale | simply generate thumbnails now and the s3 integration is ready |
| 10:56 | nDuff | *nod* -- I wish you luck. If it's something you take to enough to want to buy dead-tree material, by the way, I strongly recommend The Joy Of Clojure. |
| 11:00 | mefesto | morning everyone |
| 11:01 | mefesto | anyone know how to listen for a window load event using domina? |
| 11:01 | mefesto | (events/listen! js/window :load f) isn't working for me |
| 11:04 | fdaoud | mefesto: (children/listen! father) isn't working for me either |
| 11:04 | fdaoud | j/k :) |
| 11:05 | mefesto | fdaoud: is that a recent breakage? :) |
| 11:05 | fdaoud | mefesto: it worked well for about 1.5 years, but hasn't worked much since :) |
| 11:23 | TimMc | fdaoud: Reproduction instructions? |
| 11:23 | TimMc | Err, wait, this is a family channel. |
| 11:26 | AWizzArd | How can I do: (into (java.util.HashMap.) {"a" 1}) ? |
| 11:27 | timvisher | &(hash-map (java.util.HashMap.)) |
| 11:27 | lazybot | java.lang.IllegalArgumentException: No value supplied for key: {} |
| 11:27 | timvisher | &(hash-map (.put (java.util.HashMap.) "foo" "bar") |
| 11:27 | lazybot | java.lang.RuntimeException: EOF while reading, starting at line 1 |
| 11:28 | timvisher | &(let [t (.put (java.util.HashMap.) "foo" "bar")] (hash-map t)) |
| 11:28 | lazybot | java.lang.IllegalArgumentException: No value supplied for key: null |
| 11:28 | timvisher | AWizzArd: not sure. ;) |
| 11:29 | timvisher | &(let [t (java.util.HashMap.) t2 (.put t2 "foo" "bar")] (hash-map t)) |
| 11:29 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: t2 in this context |
| 11:29 | timvisher | &(let [t (java.util.HashMap.) t2 (.put t "foo" "bar")] (hash-map t)) |
| 11:29 | lazybot | java.lang.IllegalArgumentException: No value supplied for key: {foo=bar} |
| 11:32 | fdaoud | TimMc: http://xkcd.com/674/ |
| 11:33 | yoklov | ,(reduce #(doto %1 (.put %2)) (java.util.HashMap.) {"a" 1}) |
| 11:33 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: put for class java.util.HashMap> |
| 11:33 | yoklov | ,(reduce #(doto %1 (.put (%2 0) (%2 1)) (java.util.HashMap.) {"a" 1}) |
| 11:33 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 11:33 | yoklov | ,(reduce #(doto %1 (.put (%2 0) (%2 1))) (java.util.HashMap.) {"a" 1}) |
| 11:33 | clojurebot | #<HashMap {a=1}> |
| 11:33 | yoklov | ,(reduce #(doto %1 (.put (%2 0) (%2 1))) (java.util.HashMap.) {"a" 1 "b" 2 "c" 3}) |
| 11:33 | clojurebot | #<HashMap {b=2, c=3, a=1}> |
| 11:34 | yoklov | that seems to work |
| 11:34 | yoklov | though |
| 11:34 | yoklov | can't you do |
| 11:34 | yoklov | ,(java.util.HashMap. {"a" 1}) |
| 11:34 | clojurebot | #<HashMap {a=1}> |
| 11:35 | yoklov | ,(java.util.HashMap. {"a" 1 "b" 2 "c" 3}) |
| 11:35 | clojurebot | #<HashMap {b=2, c=3, a=1}> |
| 11:36 | TimMc | fdaoud: I had https://xkcd.com/583/ in mind, actually, but that works too. :-) |
| 11:37 | fdaoud | TimMc: lol |
| 12:06 | jtoy | is it normal/possible for namespaces to reference each other? |
| 12:07 | jtoy | i have a core namespace I want to load and it calls in other namespaces, some of the namespaces need stuff that is in core |
| 12:08 | solussd | is it possible for clojure-mode in emacs to highlight symbols in libraries I'm using? E.g. defpage in Noir |
| 12:09 | joegallo | jtoy: circularity is not allowed, you have to turn it all into a directed acyclic graph |
| 12:10 | joegallo | solussd: yes, let me find a github reference for you |
| 12:13 | joegallo | solussd: http://eschulte.me/emacs-starter-kit/starter-kit-lisp.html look for font-lock-add-keywords, under Clojure. |
| 12:13 | joegallo | that'll get you started |
| 12:13 | jtoy | joegallo: ok, thanks |
| 12:14 | jweiss | solussd: you meant telling emacs manually which new symbols to highlight, right? |
| 12:14 | jweiss | not just highlighting any symbol from libs |
| 12:17 | joegallo | it's relatively easy to have it highlight (def... ) specially, and treat it as a macro, not matter what ... is. not sure if that's in clojure-mode proper yet, these days. |
| 12:18 | joegallo | that would get you defpage automatically, of course, which is rather nice. |
| 12:20 | joegallo | mmm, doesn't look like it's in. that's unfortunate. |
| 12:23 | technomancy | joegallo: it might be in the latest from git? |
| 12:23 | technomancy | I need to get a release out; lots of new stuffs in clojure-mode |
| 12:23 | napping | can slime recognize an & body) in the argument list and indent as a macro? |
| 12:23 | joegallo | not sure, i looked for the magic from my dotfiles and didn't find it. of course, that doesn't mean you didn't do it some other way. ;) |
| 12:24 | napping | It doesn't seem to work for me, but I |
| 12:24 | technomancy | napping: yes, but then you have code that indents differently whether slime is connected or not, which is kind of gross |
| 12:24 | technomancy | napping: I mean, it can do it in CL, not yet with clojure |
| 12:24 | napping | that's about what I heard |
| 12:25 | hcumberdale | hi :) |
| 12:26 | hcumberdale | technomancy, you've also written slamhound right? |
| 12:26 | technomancy | hcumberdale: yes, though it's sadly neglected |
| 12:27 | hcumberdale | I'd some problems with it when things get complicated |
| 12:27 | technomancy | yes, unfortunately it really only works on a subset of ns forms for the time being |
| 12:27 | hcumberdale | ahhh ok! |
| 12:27 | hcumberdale | Is there another import manager |
| 12:28 | technomancy | no, but slamhound is pretty easy to hack on |
| 12:28 | technomancy | I even wrote a blog post containing a walkthrough of the codebase |
| 12:28 | hcumberdale | and is it possible to shrink the librarys to the functionality really needed? |
| 12:28 | technomancy | http://technomancy.us/148 |
| 12:30 | hcumberdale | thx |
| 12:30 | jayunit100 | how come (filter #(> 500 %) (range 0 1000)) doesnt run when I simply call (use 'simplefunc ) from the repl |
| 12:31 | jayunit100 | (but in contrast, (print "okay this is working") does .... ) |
| 12:31 | TimMc | jayunit100: How do you know it doesn't? |
| 12:32 | Raynes | TimMc: It just *feels* like it isn't running. |
| 12:33 | joegallo | You guys are a riot. :) |
| 12:33 | jayunit100 | :) |
| 12:33 | jayunit100 | I see what you mean tim |
| 12:33 | jayunit100 | the input is just being lost. |
| 12:33 | jayunit100 | forest tree thingy |
| 12:35 | jayunit100 | im so used to the repl barfing everything out for me.... i forgot that its different when its in a file. |
| 12:36 | solussd | joegallo: thanks |
| 12:43 | dnolen | lynaghk`: |
| 12:43 | dnolen | ping |
| 12:46 | technomancy | dgrnbrg: hey, did you consider having the guzheng task argument first? |
| 12:47 | technomancy | dgrnbrg: that may feel more natural since the other args can be of unknown lengths, plus then it looks a bit more like a lein test invocation: lein guzheng test my.ns.test my.other.test |
| 12:47 | technomancy | just a thought |
| 12:47 | technomancy | looking forward to trying this out =) |
| 12:48 | technomancy | though I guess the similarity to the test task may be misleading; it would look like the ns args are getting passed to the test task, which isn't the case |
| 12:48 | technomancy | so maybe that doesn't make sense |
| 12:49 | technomancy | dgrnbrg: you should take a look at the leinjacker lib though; it has compatibility functions to work across lein1 and lein2 |
| 13:01 | hcumberdale | Is there a thing like "pipe" in clojure |
| 13:01 | hcumberdale | For Output to Input Streams? |
| 13:02 | hcumberdale | I know the PipedInputStream / PipedOutputStream things,... but there must be an easy way? |
| 13:02 | joegallo | like what? |
| 13:02 | hcumberdale | ?? |
| 13:02 | lazybot | hcumberdale: Definitely not. |
| 13:03 | joegallo | maybe describe more of the problem first (also, how much data are you talking about?) |
| 13:03 | hcumberdale | Thumbnails ;) I generate them with http://code.google.com/p/thumbnailator/ |
| 13:03 | hcumberdale | It writes to an Output Stream |
| 13:03 | technomancy | leiningen has a `pump` function to take from an input stream to an output stream |
| 13:04 | hcumberdale | amazon s3 API needs an InputStream |
| 13:04 | joegallo | that sounds a lot like clojure.java.io/copy, technomancy, yes? |
| 13:04 | joegallo | hcumberdale, you can ByteArrayOutputStream to a byte array to a ByteArrayInputStream if you don't mind holding the whole object in memory |
| 13:05 | technomancy | yeah, I'm trying to remember why we didn't use copy |
| 13:05 | joegallo | you didn't want things to be automatically closed or something? |
| 13:05 | hcumberdale | If possible, yes! |
| 13:05 | hcumberdale | But copy does IN=>OUT |
| 13:05 | napping | PipedInputStream doesn't look bad if you really want a pipe pair |
| 13:06 | hcumberdale | I need OUT=>IN |
| 13:06 | technomancy | (let [#^"[C" buffer ; uuuugh gross |
| 13:06 | hcumberdale | http://stackoverflow.com/questions/1225909/most-efficient-way-to-create-inputstream-from-outputstream |
| 13:07 | technomancy | ah, c.j.io/copy doesn't flush |
| 13:07 | hcumberdale | There is a clojure example with pipes |
| 13:07 | hcumberdale | but it has no auto-close, flush,... thigns |
| 13:08 | napping | what will be writing into the output stream? |
| 13:10 | hcumberdale | (t/of url) (.size 150 150) (.outputFormat "jpg") (.toOutputStream out-stream) ) |
| 13:10 | hcumberdale | missed out beginning (-> |
| 13:13 | napping | what is t/of? |
| 13:13 | hcumberdale | http://code.google.com/p/thumbnailator/wiki/Examples |
| 13:14 | napping | If you want it in memory, asBufferedImage looks convenient |
| 13:14 | hcumberdale | maybe it does the stream handling already? |
| 13:15 | Frozenlock | If I make a standalone jar with java7 on my machine, will it work with java6? |
| 13:22 | hcumberdale | damn, the include does not work |
| 13:22 | TimMc | hcumberdale: Are you shelling out? |
| 13:22 | hcumberdale | [net.coobird/thumbnailator "0.4.1"] |
| 13:22 | hcumberdale | $ ls lib/ | grep thum |
| 13:22 | hcumberdale | thumbnailator-0.4.1.jar |
| 13:23 | TimMc | Never mind, completely misread. |
| 13:23 | hcumberdale | FileNotFoundException: Could not locate net/coobird/thumbnailator/Thumbnails__init.class ... |
| 13:23 | napping | where are you sending the data once you have it? |
| 13:23 | hcumberdale | napping amazon s3 |
| 13:24 | napping | and you can't set up an output stream that goes directly there? |
| 13:24 | hcumberdale | no, s3 api uses inputstream |
| 13:25 | napping | I've never programmed against S3 |
| 13:25 | hcumberdale | why does my require not work? |
| 13:27 | hcumberdale | It is in my classpath! |
| 13:32 | Frozenlock | I'm trying lein-bin (from https://github.com/Raynes/lein-bin). Any idea what should be the file extension for windows? |
| 13:40 | hcumberdale | I can't call a static method of an imported java class |
| 13:41 | hcumberdale | #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: of> |
| 13:41 | hcumberdale | damn! |
| 13:44 | hcumberdale | (. net.coobird.thumbnailator.Thumbnails (of (as-url "http://s3.amazonaws.com/mkr_cblog/finished.jpg"))) |
| 13:44 | hcumberdale | #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: of> |
| 13:44 | hcumberdale | both with / and . ... |
| 13:50 | antares_ | hcumberdale: is it a static method? are you sure you are passing all the necessary arguments? |
| 13:52 | hcumberdale | yes antares_ |
| 13:52 | antares_ | hcumberdale: is it a static method? |
| 13:52 | hcumberdale | yes |
| 13:52 | hcumberdale | (. net.coobird.thumbnailator.Thumbnails (of (new java.net.URL "http://s3.amazonaws.com/mkr_cblog/finished.jpg"))) |
| 13:52 | hcumberdale | the method "of" |
| 13:53 | hcumberdale | public static Builder<URL> of(URL... urls) |
| 13:53 | hcumberdale | maybe the dynamic parameter list is the problem? |
| 13:56 | antares_ | hcumberdale: yes |
| 13:56 | hcumberdale | yes, that was the problem |
| 13:56 | hcumberdale | and now,... |
| 13:56 | hcumberdale | #<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment> |
| 13:57 | antares_ | hcumberdale: it should be (net.coobird.thumbnailor.Thumbnails/of (into-array java.net.URL [(URL. "http://s3.amazonaws.com/mkr_cblog/finished.jpg")]) |
| 13:57 | hcumberdale | thx very much |
| 13:57 | antares_ | hcumberdale: that library may need Sun/Oracle JDK or something |
| 13:59 | xeqi | hcumberdale: what |
| 13:59 | xeqi | what os are you usgin? |
| 14:01 | hcumberdale | technomancy , can I set java.awt.headless=true with lein ? |
| 14:01 | muhoo | thanks for this: http://technomancy.us/148 great explanation. also "asplode", lol. |
| 14:02 | antares_ | hcumberdale: you can, :jvm-opts ["-Djava.awt.headless=true"] |
| 14:04 | hcumberdale | $ cat Procfile |
| 14:04 | hcumberdale | web: lein trampoline run -m cblog.core |
| 14:04 | hcumberdale | how to set it here? |
| 14:05 | technomancy | hcumberdale: you can export JVM_OPTS |
| 14:06 | hcumberdale | on heroku? with the procfile? |
| 14:06 | technomancy | if you want it always present, you should use :jvm-opts |
| 14:08 | nDuff | Is there a way to tell whether a class is public? I have 3rd-party library returning an instance of a private class with public members, but am only allowed to call those methods defined by public interfaces, so introspecting with (bean x) is failing; I'm trying to figure out what needs to be changed to detect that situation. |
| 14:08 | technomancy | muhoo: I had a lot of fun with that code =) |
| 14:24 | jonasen | dnolen: sorry for the mess... |
| 14:24 | ibdknox | jonasen: eh, it's not a mess, it's something that should be thought through |
| 14:24 | lynaghk | dnolen: pong. |
| 14:25 | dnolen | jonasen: haha, no mess. AST as data was just not something I'd thought about much - clearly that's what Rich wants. |
| 14:25 | dnolen | lynaghk: just pinged you to say I'm following your cljs-profile stuff, good to see real world issues you're encountered. Would be nice to see a real summary from you at some point. |
| 14:26 | lynaghk | dnolen: definitely. Performance is something I'd like to sit down and think about |
| 14:26 | jonasen | dnolen: I agree. I'm interested in getting the contents of :children corrected. If Rich want it attached to the ast that's fine by me |
| 14:26 | lynaghk | dnolen: I want to tidy up the C2 API this week and get an official 0.1.0 release out, then I'm going to go back and check out perf stuff. |
| 14:27 | dnolen | lynaghk: excellent that would be very, very helpful. |
| 14:27 | ibdknox | dnolen: I don't feel super strongly one way or the other, but right now I just see something that's unwieldy and confusing |
| 14:27 | ibdknox | dnolen: that no other AST I've ever seen has, which is only a half argument |
| 14:28 | dnolen | ibdknox: I don't feel strongly about it either - it's also hard to tell what the actual goal was considering the gaps that jonasen uncovered |
| 14:28 | ibdknox | dnolen: I agree, that's why I'm hoping rich comes in and explains why he cares about it |
| 14:29 | lynaghk | dnolen: we're working on a map visualization right now, but I'm worried we might have to drop to D3 for parts of it since D3 is still a few orders of magnitude faster in some cases. |
| 14:29 | jonasen | dnolen: ibdknox: I can put together a patch which moves back to :children, but with the problems fixed. |
| 14:30 | dnolen | lynaghk: "few order of magnitude faster" is not something I want to hear :) If we're not within one order of magnitude that's a problem. |
| 14:30 | dnolen | jonasen: just make a new patch the :children re-added, multimethods removed. |
| 14:31 | jonasen | dnolen: without the bugfixes? |
| 14:31 | dnolen | jonasen: bugfixes are good, Rich didn't mention those at all :) |
| 14:31 | lynaghk | dnolen: one of the constraining issues for C2 is that I want to keep the code idiomatic Clojure, and I just don't know a ton about optimizing JVM Clojure performance idiomatically (e.g. using arrays instead of seqs) |
| 14:33 | jtoy | so re-gsub is not part of the core? |
| 14:33 | dnolen | lynaghk: in bottlenecks - arrays, loop/recur are big wins. I haven't looked at C2 closely so I can't say much at this point. |
| 14:33 | lynaghk | dnolen: actually, loop/recur is slower than doseq |
| 14:33 | lynaghk | https://github.com/lynaghk/profile-cljs/blob/master/src/cljs/seq_test/test.cljs |
| 14:34 | dnolen | lynaghk: I doubt that but I can't say what's going on w/o seeing the generated code. |
| 14:34 | lynaghk | The "iter" library macro-expands doseq-like-loops into loop/recurs, and (on chrome) it's slower. |
| 14:37 | dnolen | lynaghk: loop/recur compiles to a while(true) loop w/ break - you're not going to get faster than that. |
| 14:37 | lynaghk | dnolen: I'll have to look into the generated code then. I'd love some faster loops = ) |
| 14:38 | dnolen | lynaghk: and all your profiling is done w/ advanced opts right? |
| 14:38 | lynaghk | dnolen: though I don't think looping is the slow part of C2's core functionality. It might be DOM stuff (D3 uses the native APIs, while C2 goes through layers of indirection. |
| 14:39 | dnolen | lynaghk: I noticed you mentioned string concatenation - that's crazy slow. |
| 14:39 | dnolen | lynaghk: I added an optimization yesterday for non-higher order call to str |
| 14:39 | lynaghk | dnolen: no. We've been forced to stay at :simple on some projects so that's what I've been doing. I'll try to find some time to turn that hodgepode repo into a more organized suite that automatically runs the different levels. |
| 14:40 | dnolen | lynaghk: yeah under :simple optimizations you're going to get punished a bit. no lambda lifting. |
| 14:40 | dnolen | lynaghk: why are you forced to use :simple? |
| 14:40 | lynaghk | dnolen: yeah, I saw that and used it this morning. I got a big performance boost from just redefining join to use the native JS array join, so it bypasses ClojureScript's str. |
| 14:40 | solussd | I'm trying to write a 'snippet' using enliven that selects the first anchor element in a <ul> with an id of "files". I'm using the selector [:ul#files :> :a] and a selector within my snippet of [:a]. I never get a match. any ideas? code here: https://gist.github.com/f12e699eefb950a43536 |
| 14:40 | Frozenlock | If anyone is interested, I've found an app to make an exe from a jar. (You still need to have java on your machine, but at least it's easier for the common windows user!) ---> http://launch4j.sourceforge.net/ |
| 14:41 | lynaghk | dnolen: right now we are using cljs-chosen on a few projects and haven't had the time to make sure it works correctly under advanced optimzations |
| 14:42 | yoklov | hm, I think there might be a bug in cljs transients |
| 14:42 | dnolen | lynaghk: I see, and you can't just provide an exports file for that? |
| 14:42 | dnolen | yoklov: quite possible, new stuff. |
| 14:42 | lynaghk | dnolen: I bet we can, we just need to find half an hour somewhere = ) |
| 14:42 | dnolen | lynaghk: heh, gotcha :) |
| 14:42 | yoklov | the definition of frequencies from clojure uses them, and breaks in cljs |
| 14:43 | dnolen | yoklov: hm, yeah file a bug |
| 14:43 | yoklov | okay, i'll find a small broken case |
| 14:44 | dnolen | lynaghk: advanced opts makes a huge difference especially on browsers that aren't Chrome. IME most browsers make you pay for deep property access. |
| 14:45 | yoklov | lynaghk: yeah, you can tell a huge difference between no opts and advanced in firefox |
| 14:45 | yoklov | you can *often |
| 14:47 | lynaghk | dnolen: I just tried checking the timeline on a redraw for the map. A single redraw triggers something like two dozen GC events (15 MB collected each time) |
| 14:47 | yonkeltron | i heard about some awesome interactive tutorials for clojure for learning the stdlib and such but can't dig them up now that i want to do them. could someone help me find them? also, i'd love to know where to look in the future so i can help myself. |
| 14:47 | technomancy | yonkeltron: probably 4clojure? |
| 14:48 | yonkeltron | perhaps... |
| 14:48 | dnolen | lynaghk: are you using master or 1011?, also w/o looking at your code I don't know what's involved in a redraw :) |
| 14:48 | technomancy | yonkeltron: or tryclj.com |
| 14:48 | lynaghk | dnolen: by redraw I mean "unify!" here: https://github.com/lynaghk/c2/blob/master/src/cljs/c2/core.cljs |
| 14:49 | lynaghk | dnolen: I'm using whatever comes with lein-cljsbuild 0.1.8. |
| 14:49 | yonkeltron | technomancy: ah. thanks, then. |
| 14:50 | technomancy | yonkeltron: also you mentioned earlier being interested in more background re: clojure vs cl; if you are in the mood to read a paper or two I recommend Out of the Tarpit and Equal Rights for Functional Objects to get a good grasp on the benefits of the functional approach |
| 14:50 | yonkeltron | technomancy: perhaps i shall do this. thank you. |
| 14:52 | dnolen | lynaghk: what fns rise up when you actually profile? |
| 14:53 | lynaghk | dnolen: bottom up profile gives 56% program, then 35ish percent for applyTo, seq, do_dispatch |
| 14:54 | dnolen | lynaghk: I think apply may be very, very, very slow it's been something I've been looking into lately. |
| 14:54 | lynaghk | dnolen: I'm not sure how I'm supposed to actually glean useful info from that stuff---I've been kicking around the idea to just make a "profiler" that wraps every form in "time", aggregates the results, and then colors your source code accordingly. |
| 14:55 | lynaghk | dnolen: function application is one of my favorites, definitely make that faster if possible = ) |
| 14:56 | dnolen | lynaghk: yes apply and rest fns are what I'm looking at. |
| 14:59 | mega_ | ibdknox: You online? |
| 14:59 | ibdknox | mega_: yeah |
| 14:59 | lynaghk | dnolen: okay, rad. I've got to run, but I'll keep you posted on the cljs-profile stuff. Any idea when a new official cljs release will be coming out? |
| 15:00 | mega_ | ibdknox: in crate theres a as-content function. would you min if i made a pull request of the code where that is a multimethod instead? |
| 15:01 | ibdknox | mega_: sounds like a reasonable thing to do :) |
| 15:01 | mega_ | ibdknox: whanted to use it for a project :P |
| 15:02 | dnolen | lynaghk: I think soon as we re-precate ObjMap and close a couple outstanding bugs. |
| 15:02 | dnolen | lynaghk: so hopefully this week? |
| 15:04 | lynaghk | dnolen: okay, sweet. |
| 15:05 | yonkeltron | assume i wanted to buy a clojure book. do i want CP (o'reilly) or PC (pragprog)? |
| 15:05 | lynaghk | dnolen: thanks for all your work on this stuff. even if some parts of the runtime are slow, cljs is still hella faster for development =) |
| 15:05 | dnolen | lynaghk: good to hear :) |
| 15:05 | aniero | yonkeltron: you want CP |
| 15:06 | yonkeltron | aniero: sounds good. i figured as much but what makes you say that? |
| 15:06 | aniero | it's more up to date, and seems better organized. more thorough introduction to the ecosystem too |
| 15:06 | yonkeltron | does it cover lein? |
| 15:06 | aniero | yep! |
| 15:06 | yonkeltron | i sort of want some input about best practices for code org and workflow |
| 15:06 | aniero | "joy" is equally good, although it's older (e.g. no lein, that i remember) |
| 15:06 | yonkeltron | obviously differs from CL |
| 15:10 | muhoo | ibdknox: so i think what i want to do with forms is make them like ring or hiccup: i want to make HTML/HTTP CRUD forms composable |
| 15:10 | ibdknox | interesting |
| 15:11 | muhoo | abstract away all the POST/GET machinery |
| 15:12 | muhoo | give it a map, including the field names, types, what kind of form it is (edit/add), the validation functions, pass in functions for it to use to read/write the db, and have it spit out defpage's, basically. |
| 15:15 | muhoo | a tually, no, have it spit out defpages for the edit page, the add page, and the POST to receive both of those, so 3 defpages |
| 15:16 | muhoo | needs a lot more hammock time still :-) |
| 15:31 | emezeske | ibdknox: Hey, did you see my jayq pull request? I basically grepped my app for "(." and added all the raw jquery calls it made. I figured if everyone did that, jayq would get fleshed out pretty quickly :) |
| 15:32 | ibdknox | emezeske: I think I merged it in already, didn't I? :) |
| 15:32 | clojurebot | excusez-moi |
| 15:32 | emezeske | ibdknox: Oh? I thought github would tell me about that. Awesome, thanks! |
| 15:33 | emezeske | ibdknox: Also, if I get around to it, would you accept a test suite (probably written against phantomjs)? |
| 15:33 | ibdknox | emezeske: that would be aweosme |
| 15:34 | emezeske | ibdknox: Okay, cool! No idea when I'll have the time/motivation, but I really want to do that |
| 15:35 | emezeske | ibdknox: If/when I get around to it, I'll probably add tests for crate as well. |
| 15:35 | ibdknox | sweet :) |
| 15:40 | yonkeltron | any os-level work done with clojure? |
| 15:41 | AimHere | Clojure's generally been targeting virtual machines and javascript so far, so no |
| 15:42 | AimHere | Maybe someone's emulated an OS or something in Clojure |
| 15:42 | yoklov | yonkeltron: the GC makes that sort of thing harder, especially given it's startup time and whatnot |
| 15:42 | yonkeltron | AimHere: i fancy the idea of an os written in lisp and i know that a CL project was in effect |
| 15:42 | yonkeltron | sadly, i think it died: http://common-lisp.net/project/movitz/ |
| 15:43 | yoklov | i'd suspect it would be hard to get fast enough |
| 15:43 | AimHere | There was always ye olde Lispe Machines |
| 15:44 | AimHere | Common Lisp is reasonably fast, I'm led to believe |
| 15:44 | yonkeltron | yes |
| 15:44 | AimHere | Something of the order of 1/2 to 1/4 the speed of C according to those TIOBE benchmarks |
| 15:45 | yonkeltron | sbcl was able to run some of my simulations in school with sufficient speed a few years ago |
| 15:45 | yonkeltron | i have never had speed issues with sbcl, actually. |
| 15:45 | yonkeltron | and things go even faster if you use declare |
| 15:46 | TimMc | yonkeltron: Have you looked at Rust? |
| 15:46 | yonkeltron | TimMc: i have not. |
| 15:46 | yonkeltron | TimMc: still having some anxiety about clojure and as yet new to the world |
| 15:47 | halgari | the other issue with a native clojure is that you either loose eval, or you have to develop your clojure compiler in such a way that it can compile code on-the-fly, and that's no easy task |
| 15:47 | yoklov | I'd imagine that the GC would cause you to have trouble supprting real time user applications, as you wouldn't really know when the GC would trigger |
| 15:47 | yonkeltron | AimHere: i had a reasonably-fast machine running a 2m scenario simulation and it did it safely in around 20 min |
| 15:48 | yonkeltron | halgari: not entirely true! consider the guestvm research done at sun |
| 15:48 | yonkeltron | yoklov: assuming stop-the-world, yes. |
| 15:48 | yoklov | thats sort of what i mean by speed. you don't have the same control as with C |
| 15:48 | yonkeltron | clojure does not do its own gc, right? |
| 15:48 | yoklov | it relies on java |
| 15:48 | yonkeltron | it lets the jvm do the needful, correct? |
| 15:48 | halgari | correct, it uses the platform's gc |
| 15:49 | AimHere | halgari, native lisps manage to compile on the fly; Is there some reason why compiling to native code is necessarily harder than compiling to all those virtual machine bytecodes that everything runs on these days? |
| 15:50 | yonkeltron | AimHere: i think that depends |
| 15:50 | halgari | Oh yes, there's a major difference between the two. |
| 15:51 | yonkeltron | halgari: go on |
| 15:51 | AimHere | That Doug Hoyte book points out that Clisp outperforms C at regexing precisely because it compiles on the fly; though I wouldn't call you a liar if you said that book told people that Common Lisp cured his AIDS |
| 15:52 | halgari | On the JVM, CLR, Python-vm the lowest common denominator is an object. So you can have bytecode that says: "PUSH 1; LOAD_METHOD toString; CALL_FUNCTION" |
| 15:52 | yonkeltron | AimHere: you mean it doesn't cure aids? |
| 15:53 | hiredman | halgari: that is just not true, the jvm has primitive non-objects |
| 15:53 | halgari | so the Vtables are actually handled by the VM. on a native implementation you have to first define what a vtable is, then figure out how to call it in an efficient way |
| 15:53 | yonkeltron | TimMc: oh the rust language stuf? |
| 15:53 | halgari | hiredman: well yes...you are correct..I oversimplified |
| 15:54 | hiredman | arrays are also technically not objects on the jvm (even though the java language makes them look like objects) |
| 15:54 | halgari | let me correct myself....objects are first-class items in CLR/Java |
| 15:56 | halgari | back to what I was originally saying, things like "is instance of" and "is subclass of" are way harder in a native runtime than they are in a VM. In the native world, you just don't have much metadata at all... |
| 15:56 | yonkeltron | TimMc: i have now read up a little bit on the rust stuff. why did you ask about it? |
| 15:56 | yonkeltron | halgari: in light of what you've said, may i ask about type erasure on the jvm? |
| 15:58 | halgari | type erasure is more a side-effect of the way generics are handled in the JVM. that sort of thing actaully doesn't extist in the CLR. |
| 15:59 | yonkeltron | halgari: which, iiuc, was why java lacked reified types (which continues, i think...) |
| 16:00 | halgari | correct |
| 16:00 | halgari | basically generics in Java are just syntactic sugar to keep you from doing something you didn't mean to |
| 16:00 | yonkeltron | i once heard odersky talk about the first version of generics and how he implemented it |
| 16:01 | yonkeltron | quite an enjoyable story involving late nights, coffee and an angry spouse |
| 16:02 | halgari | But back to native code compile, I don't think CL even supports eval in a compiled context. I've never run CL, but I rememer some doc stating that you lost a few features when compiling to native code, and eval was one of them. |
| 16:03 | yonkeltron | does anyone have familiarity with MS's singularity OS project? |
| 16:03 | yonkeltron | afaict, it was a project to boot directly into a CLR vm and then hoist everything up on top of it from there |
| 16:04 | yonkeltron | so you'd have the whole OS running on top of the vm |
| 16:04 | yonkeltron | with JIT stuff, etc. |
| 16:04 | scottj_ | ibdknox: have you found any libraries you plan to use for bundling a self-contained webkit app for the big 3 OSes? if you build one for Light Table that would make a really nice by-product. |
| 16:04 | hiredman | scottj_: javafx |
| 16:04 | ibdknox | scottj_: nothing yet. I built a very simple mac one for me to mess around with |
| 16:06 | scottj_ | hiredman: Doesn't whatever webview feature javafx has require the user to already have a webkit browser installed? |
| 16:07 | hiredman | scottj_: I dunno, I haven't seen such a requirement mentioned anywere |
| 16:07 | ibdknox | SWT definitely does |
| 16:07 | ibdknox | dunno about javafx |
| 16:10 | TimMc | yonkeltron: I mentioned Rust because I think it's the best shot right now at having a reasonable language to write kernels in. |
| 16:11 | yonkeltron | TimMc: i see. what about it, in particular? |
| 16:11 | Raynes | inb4 technomancy is all like "wtf no repl" |
| 16:11 | yonkeltron | technomancy: dude, i think i owe you a beer from like a year ago |
| 16:12 | Raynes | Everybody owes him a beer. |
| 16:12 | yonkeltron | technomancy: sorry, meant for that in #emacs |
| 16:12 | Raynes | Get in line, friend. |
| 16:12 | yonkeltron | Raynes: fair enough |
| 16:12 | ibdknox | I just sent an email to Tim O'Reilly :) |
| 16:13 | Raynes | ibdknox: You need to get Bill Gates to tweet it dude. |
| 16:13 | ibdknox | My bet is he doesn't read it... but we'll see :) |
| 16:13 | Raynes | Otherwise you're doomed. |
| 16:13 | ibdknox | haha |
| 16:13 | ibdknox | Raynes: Hi Bill, I left your company to do this thing... |
| 16:13 | Raynes | Bahaha |
| 16:14 | Raynes | "Hi Bill, wanted to see if you'd like to help support competition." |
| 16:14 | Raynes | Though I guess light table isn't competition, since C# sucks too hard for light table to be viable for it. |
| 16:14 | TimMc | yonkeltron: I actually have forgotten most of the specifics, but Dave Herman (at Mozilla) gave a pretty convincing talk on it. The optional GC stuff was pretty great. |
| 16:14 | ibdknox | actually |
| 16:14 | ibdknox | building light table for C# would be relatively straightforward |
| 16:15 | Raynes | wut |
| 16:15 | ibdknox | :) |
| 16:15 | Raynes | So Ruby is a problem, but C#... |
| 16:15 | Raynes | Mind blown. |
| 16:15 | ibdknox | Raynes: microsoft invests a lot in tools. The new language stuff called "Roselyn" is far above and beyond what exists for virtually any other language |
| 16:15 | ibdknox | Clojure doesn't need it because it's so much simpler |
| 16:17 | TimMc | ibdknox: "Microsoft invests a lot in tools." <-- I'm going to quote you out of context on that. |
| 16:17 | ibdknox | lol |
| 16:17 | yonkeltron | TimMc: awesome, thanks. i appreciate languages with non-thread concurrency options as i have always found threads a bit...um...let's say clumsy. |
| 16:18 | TimMc | Rust is still *really* young, though. :-( |
| 16:18 | TimMc | Can't be soon enough. |
| 16:18 | yonkeltron | TimMc: yeah and also mozilla |
| 16:18 | yonkeltron | TimMc: i mean, it worries me because mozilla |
| 16:18 | ibdknox | speaking of mozilla |
| 16:18 | halgari | yonkeltron: someday I'd like to look at doing what MacRuby did. They somehow compile Ruby down to the ObejctiveC runtime... |
| 16:18 | Raynes | TimMc: I was going to use Rust for something until I realized there wasn't an http client yet. |
| 16:18 | ibdknox | Eich retweeted one of the light table things the other day |
| 16:18 | Raynes | Pretty hardcore that a language can be so new it doesn't have one of those. |
| 16:19 | yonkeltron | halgari: some day. i happen to adore ruby. |
| 16:19 | yonkeltron | ibdknox: whoa! dude, huge news for you |
| 16:19 | ibdknox | Raynes: lol not sure you get much earlier than that |
| 16:19 | TimMc | Raynes: Last time I looked, they didn't have any code samples -- because they hadn't decided on syntax yet. |
| 16:19 | Raynes | TimMc: They've got a solid release now though. |
| 16:19 | yonkeltron | Raynes: yeah even dart has useful shit |
| 16:19 | Raynes | But syntax could, of course, change. |
| 16:19 | Raynes | It's a 0.1 release IIRC. |
| 16:19 | yonkeltron | Raynes: plus if you study up on dart, you get schooled by gilad bracha |
| 16:20 | Raynes | Dart is the least interesting thing I've seen in recent months. |
| 16:20 | yonkeltron | as a language? |
| 16:20 | yonkeltron | i think it has very interesting aspects, actually |
| 16:20 | yonkeltron | i think gilad's work on optional typing has gotten me thinking |
| 16:20 | yonkeltron | i appreciate some of the vm considerations like the images and language-only vm decision |
| 16:20 | Raynes | Well, it's mostly that I don't do much (any) Javascript, so I have problems with my care cup regarding replacements. |
| 16:20 | yonkeltron | also the isolate concept |
| 16:21 | technomancy | writing an OS on a platform that used UTF-16 as its internal string encoding would be a memory hog |
| 16:21 | mmarczyk | dnolen: hi |
| 16:22 | mmarczyk | dnolen: just fixed the transient bug yoklov reported a little earlier -- CLJS-219 |
| 16:22 | TimMc | technomancy: We shouldn't have to know what the internal encoding is! |
| 16:22 | yonkeltron | Raynes: linguistically, yeah vanilla braces and shit all over dart. however, the adjacent language concepts have held my attention if not my direct interest. i don't know if that distinction makes sense... |
| 16:22 | mmarczyk | dnolen: also CLJS-220 replaces frequencies with Clojure's implementation with transients (which now appears to work fine) |
| 16:22 | yonkeltron | ok i must step out for a bit |
| 16:22 | technomancy | TimMc: yeah, it would be interesting to hack hotspot to change it and find out how spectacular the failures are on various large-ish projects =) |
| 16:22 | TimMc | technomancy: I don't see why Java can't have ASCII strings, UTF-16 strings, UTF-8 strings... under the covers. |
| 16:23 | technomancy | TimMc: "good" code would continue to work everywhere, but I can bet you it wouldn't work out in practice =) |
| 16:23 | TimMc | Well, sure. Oracle refused to change j.l.String hashing because that would somehow break some things. |
| 16:23 | TimMc | Still boggles my mind a little. |
| 16:23 | technomancy | OTOH dalvik uses UTF-8 |
| 16:24 | mmarczyk | dnolen: need to dash now, but I'll be back & working on the ObjMap ticket soon |
| 16:24 | technomancy | so who knows |
| 16:24 | TimMc | Oh, ouch -- switch statements. |
| 16:24 | halgari | technomancy: well dalvik isn't really java....or is it...I guess we'll find out in a few weeks when the judges tell us the truth |
| 16:25 | technomancy | halgari: yeah, but it's able to run a surprising amount of code written in the Java Programming Language™ |
| 16:29 | muhoo | dalvic is java, but it's not the jvm, IIRC |
| 16:29 | muhoo | er dalvik |
| 16:30 | ibdknox | dnolen: his argument is that let's say he has the ast, and makes some transformations. He then wants to run another tool over it that uses children. He now has to duplicate his changes to the children nodes otherwise all of his transformations will not be taken into account |
| 16:32 | mmarczyk | oh btw, transient vector perf test if anybody wants to run it: http://jsperf.com/cljs-transient-vector |
| 16:43 | daniel | how would this Long be represented in clojure? 0x101010101017eL |
| 16:47 | AimHere | ,0x101010101017e |
| 16:47 | clojurebot | 282578800148862 |
| 16:47 | mebaran151 | I'm having trouble running trampoline tasks in lein2 on windows. Any reason why it never finds the task? |
| 16:47 | dnolen | ibdknox: heya, no I get that. I think we were talking past each other. I don't see any problems with :children + :children-keys |
| 16:48 | dnolen | mmarczyk: cool! |
| 16:48 | dnolen | mmarczyk: wow, nice nearly 3x faster on Chrome |
| 16:48 | mebaran151 | dalvik is Java the same way that Visual C++ and G++ and both C++ |
| 16:49 | jonasen | dnolen: I don't think something like :children-keys will be useful |
| 16:49 | daniel | i see, thanks AimHere |
| 16:49 | dnolen | jonasen: that was his idea not mine, but why not? |
| 16:50 | jonasen | dnolen: for most expressions there are no keys for the children |
| 16:50 | jonasen | they must be computed |
| 16:51 | jonasen | and then you're back to :children |
| 16:51 | technomancy | mebaran151: lein1 or lein2? batch file or shell script? |
| 16:51 | technomancy | |
| 16:51 | mebaran151 | lein2 batch file |
| 16:52 | dnolen | jonasen: as in keys can't be added? |
| 16:52 | technomancy | mebaran151: to debug change 'del "%TRAMPOLINE_FILE%"' in lein.bat to print out the contents of the trampoline file instead and see if the command makes sense |
| 16:52 | ibdknox | jonasen: dnolen: thinking more about the transformation then reading thing, we absolutely cannot duplicate that data |
| 16:52 | technomancy | mebaran151: actually what's the specific error? |
| 16:53 | mebaran151 | lein2 trampoline repl => trampoline repl is not a task |
| 16:53 | technomancy | oh strange, so it's treating "trampoline repl" as a single argument? |
| 16:53 | mebaran151 | looks like it now that you put it that way |
| 16:53 | technomancy | sounds like a problem with the way the batch file is parsing arguments then |
| 16:53 | dnolen | jonasen: what mean is why can't we add more keys? |
| 16:54 | mebaran151 | if I have some free time, I mighttry to create a powershell port of teh batch file; should be easier to maintain than the .bat monster |
| 16:54 | dnolen | ibdknox: people who want to transform can ignore :children, and just work via :children-keys no? |
| 16:54 | ibdknox | dnolen: the issue is downstream |
| 16:55 | jonasen | dnolen: sure we can. But I don't think it would be useful. For example, what keys would you add to :children-keys for e.g., :let |
| 16:55 | dnolen | ibdknox: ? |
| 16:55 | ibdknox | dnolen: if I transform it can no longer be reliably consumed later |
| 16:55 | technomancy | mebaran151: someone has ported it already; search the mailing list |
| 16:55 | mebaran151 | oh, neato |
| 16:55 | ibdknox | dnolen: unless I duplicate all my changes to the child nodes |
| 16:55 | ibdknox | dnolen: rather, :children nodes |
| 16:55 | technomancy | mebaran151: at the time it was determined powershell didn't have the installed user base to replace the batch file, but maybe that's changed? |
| 16:55 | technomancy | mebaran151: this was nearly two years ago |
| 16:56 | ibdknox | dnolen: example. I have a transformer that changes all the invokes of foo to foo2 |
| 16:56 | technomancy | mebaran151: it would also allow the windows side to avoid the ridiculousness of having to manually do a self-install |
| 16:56 | dnolen | jonasen: :let, :children-keys are :bes and :body |
| 16:56 | ibdknox | dnolen: I now have to propagate that change to all parents of those nodes that happen to have me as a child, because that invoke node is duplicated |
| 16:57 | ibdknox | dnolen: otherwise a tool that *just* looks at children would be working on invalid information |
| 16:58 | jonasen | dnolen: :bindings is not an expression object (there is no {:op :binding ...}) |
| 16:58 | ibdknox | dnolen: so if we really want to treat the AST as data, we cannot duplicate that information unless we mandate all transformations must modify the nodes in :children too, which is a disaster waiting to happen |
| 16:58 | dnolen | ibdknox: are you talking about interop between tools that use :children and those that don't? |
| 16:58 | ibdknox | dnolen: yes |
| 16:58 | ibdknox | dnolen: there needs to be one way here |
| 16:58 | dnolen | ibdknox: not sure about that |
| 16:58 | ibdknox | ? |
| 16:59 | mebaran151 | powershell I think is standard on Windows 7 |
| 16:59 | dnolen | ibdknox: you do your transformations and when you want it to be consumed by other tools you construct :children. |
| 16:59 | ibdknox | :( |
| 16:59 | dnolen | jonasen: I don't see the problem, we can add new keys to work around this right? |
| 16:59 | technomancy | mebaran151: yeah, the question is how long do we need to support XP users |
| 16:59 | ibdknox | dnolen: so basically we're saying composition is not something we support by default... |
| 17:00 | ibdknox | dnolen: that's against Clojure's own principle |
| 17:00 | dnolen | one second. |
| 17:00 | technomancy | mebaran151: though honestly they are going to have to do a manual download (either curl or the standalone jar) to make it work anyway, so maybe they might as well download powershell? I don't know. |
| 17:01 | mebaran151 | you wouldn't need curl from powershell I don't think (it comes with a builtin webclient) |
| 17:01 | technomancy | yeah, I meant that it would replace the need to download curl |
| 17:01 | mebaran151 | the only thing is that setting up powershell scripts to run can be a bit tedious (the permissions etc) |
| 17:02 | @rhickey | new toys pushed |
| 17:02 | @rhickey | https://github.com/clojure/clojure/commit/96e8596cfdd29a2bb245d958683ee5fc1353b87a |
| 17:02 | @rhickey | it's the start of a reduce-based library |
| 17:02 | @rhickey | map/filter etc as reduction combinators |
| 17:03 | @rhickey | when combined with the internal reduce support recently solidified, yields allocation-free pipelines |
| 17:03 | dnolen | rhickey: wow |
| 17:04 | @rhickey | an be much faster |
| 17:04 | @rhickey | can |
| 17:04 | @rhickey | than seqs |
| 17:04 | dnolen | rhickey: btw, care to share some brief thoughts on the :children issue? |
| 17:04 | pjstadig | rhickey: is the comment header correct on Reduced.java? doesn't mention EPL |
| 17:04 | @rhickey | crap |
| 17:05 | TimMc | heh |
| 17:07 | @rhickey | ok, better now with the key file :) |
| 17:07 | @rhickey | https://github.com/clojure/clojure/commit/4a22e3a44df48ea0d37dd034bc3f6cb3092117a9 |
| 17:07 | jamii | user=> (defrecord Bar [y] Foo (foo [_] (->Bar nil))) |
| 17:07 | @rhickey | so, you just require c.c.reduce :as r, then you can swap r/map etc |
| 17:07 | jamii | user.Bar |
| 17:08 | jamii | user=> (deftype Baz [y] Foo (foo [_] (->Baz nil))) |
| 17:08 | jamii | CompilerException java.lang.RuntimeException: Unable to resolve symbol: ->Baz in this context, compiling:(NO_SOURCE_PATH:17) |
| 17:08 | jamii | :( |
| 17:08 | jamii | Is there a reason this only got fixed for defrecord? |
| 17:08 | TimMc | jamii: deftype is intended to be much more bare. |
| 17:08 | @rhickey | reducer makes it easy to build these combinatos, as long as they can be defined in terms of a transformation of the next reducing fn in chain |
| 17:09 | @rhickey | when not, (e.g. flatten), you can just reify CollReduce |
| 17:09 | jamii | TimMc: I'm trying to use it to implement IPersistentSet. Which doesn't really work when you can't call the constructur |
| 17:09 | jamii | TimMc: Isn't implementing core datastructures the use-case for deftype? |
| 17:11 | @rhickey | the other key thing is the ability to terminate reduce |
| 17:11 | jamii | The original issue only mentioned defrecord (http://dev.clojure.org/jira/browse/CLJ-874), I kind of assumed that deftype was just an oversight |
| 17:12 | hiredman | rhickey: looks like manual stream fusion |
| 17:12 | @rhickey | what's manual? |
| 17:13 | hiredman | well the compiler/runtime just doesn't figure it out and insert it |
| 17:13 | hiredman | you have to use the ops from the namespace to get it |
| 17:13 | @rhickey | hiredman: patch welcome |
| 17:14 | hiredman | hey, I am not knocking it, just figuring out what it is |
| 17:15 | kovasb | looks pretty cool. is that all the functions that make sense? |
| 17:15 | kovasb | map filter remove take take-while drop flatten |
| 17:16 | dnolen | rhickey: sounds an applicable strategy for CLJS as well no? |
| 17:17 | hiredman | dnolen: you inc'ed clj-899? say it ain't so... |
| 17:17 | jamii | Is there any way for a deftype implementing IPersistentSet to call its own constructor? |
| 17:18 | technomancy | I wonder if it would be possible to make drop on lazy-seqs avoid the generation of potentially expensive values if it could be determined that they were going to be discarded. |
| 17:18 | technomancy | kind of the reverse of early-terminating a reduce |
| 17:19 | mega_ | ibdknox: still here? |
| 17:20 | TimMc | technomancy: As long as you could somehow indicate whether the value generation required shared state... |
| 17:21 | TimMc | Or I guess, split each iteration into two pieces: Generating the new cell's value, and generating state for th next iteration. |
| 17:21 | technomancy | shared? |
| 17:21 | TimMc | shared over time |
| 17:21 | TimMc | i doesnt has language |
| 17:21 | technomancy | oh, as in whether the next value is based on the value of the current element |
| 17:22 | technomancy | right; I'm thinking it would be great if pagination in a web service API could be implemented in terms of lazy seqs, but pagination would need drop to be free |
| 17:22 | technomancy | obviously for something like clojure.core/iterate it wouldn't make any sense |
| 17:23 | TimMc | technomancy: Well, if you had a seq of the squares of an incrementing counter, you'd need to run the counter forward for every iteration, but could skip the squaring. |
| 17:23 | TimMc | Maybe split it into (map #(* % %) counting) where counting is a lazy-seq that just does the counter. |
| 17:24 | TimMc | (Counting and squaring are just stand-ins here for more expensive operations.) |
| 17:24 | jamii | Ah, Foo. does work. I just misread the error message. |
| 17:27 | austinh | I'm trying to get started with Korma, but I'm getting a SQLException: "Connections could not be acquired..." Any clues to debug? |
| 17:30 | mebaran151 | technomancy: I think I found why trampoline was being parsed as one argument: the unquoting "%1" at "%1"=="trampoline" fixes stuff |
| 17:31 | @rhickey | hiredman: there are no streams to fuse, you might as well say Haskell's http://www.haskell.org/haskellwiki/Enumerator_and_iteratee are manual stream fusion - they're not |
| 17:31 | @rhickey | it is simply reduce, but now reduce has advantages in almost always being internal |
| 17:32 | @rhickey | dnolen: should work for cljs yes |
| 17:32 | dnolen | rhickey: and prim collections seems like? |
| 17:32 | @rhickey | technomancy: not sure what you mean re: drop |
| 17:33 | @rhickey | dnolen: harder since the fns need to combine, but possibly |
| 17:33 | @rhickey | this will also work swimmingly with parallel ops, I hope to get to soon - since we can then base them all off of reduce, rather than parallel this and that |
| 17:34 | @rhickey | since parallel is always eager |
| 17:34 | technomancy | rhickey: I guess it's only vaguely related to the reduced stuff, but imagine if you had a function invoked like (paginated-rest-seq "http://myapp.com/articles.json") that used standard page/offset GET parameters |
| 17:35 | @rhickey | so you want to (drop n (map expensive ...)) ? |
| 17:35 | technomancy | you'd want to be able to drop N items to get at the range you wanted, but if you used clojure.core/drop that would mean fetching and discarding everything up to N |
| 17:35 | technomancy | right; if it would be possible to prove that the elements would be discarded, you could opt out of calling the expensive fn |
| 17:36 | daniel | im trying to do this little bit of java in clojure: databaseIndex = (int)((bbBlockers * magicNumberRook[C3]) >>> rookMagicShifts[C3]) |
| 17:36 | daniel | im getting an integer overflow when i * my two 64 bit longs |
| 17:36 | TimMc | technomancy: As opposed to (map page-for (drop n (page-numbers))) |
| 17:36 | technomancy | not sure it would be possible to propagate that discard bit outside the trivial case of calling drop directly; haven't thought through whether dynamic binding would work for that |
| 17:36 | @rhickey | technomancy: well, the new stuff does exactly that |
| 17:37 | technomancy | rhickey: oh, no kidding? I missed that. |
| 17:37 | technomancy | I thought it only went the other direction |
| 17:37 | @rhickey | basically the reducing fns form a chain, so drop goes first and simply counts |
| 17:37 | technomancy | slick |
| 17:38 | @rhickey | I don't think that's possible with seqs |
| 17:38 | @rhickey | since there each nested thing is first realized |
| 17:38 | @rhickey | here there are no intermediates |
| 17:38 | @rhickey | not even iterators |
| 17:40 | technomancy | I was thinking it might have to be opt-in; a bit that the seq-generating function could check |
| 17:41 | @rhickey | technomancy: could you map delays? |
| 17:42 | @rhickey | then if you don't realize, no charge |
| 17:43 | Bronsa | rhickey: https://github.com/clojure/clojure/commit/96e8596cfdd29a2bb245d958683ee5fc1353b87a#L2L58 i think ret should be deref'd |
| 17:43 | @rhickey | Bronsa: no, that happens above |
| 17:43 | technomancy | yeah, but the consumer has to explicitly deref the delays |
| 17:43 | Bronsa | oh ok |
| 17:43 | @rhickey | that reduce isn't the outer reduce |
| 17:44 | @rhickey | deref on non-delays is harmless |
| 17:44 | jweiss | "Wrong number of args (-1) passed to: core$assoc" that error message appears to have a bug in it :) |
| 17:44 | Bronsa | oh i see, it gets derefed by coll-reduce |
| 17:44 | @rhickey | er, force that is |
| 17:45 | technomancy | yeah, it's not terribly onerous |
| 17:45 | hiredman | rhickey: force? |
| 17:45 | technomancy | I'd prefer something seamless though. you could always provide your own discard-aware drop function too. |
| 17:45 | @rhickey | doc force |
| 17:46 | hiredman | deref on non-derefables throws, but force on non-delays is harmless |
| 17:46 | hiredman | (doc force) |
| 17:46 | clojurebot | "([x]); If x is a Delay, returns the (possibly cached) value of its expression, else returns x" |
| 17:46 | @rhickey | technomancy: then maybe some delaying map that did the force on first |
| 17:48 | @rhickey | map could have done that had it not been also used for I/O |
| 17:49 | technomancy | if drop bound a dynamic var, map and other lazy-seq callers could just check that before calling their f, right? since drop always realizes you don't have any nasty binding/laziness complications. |
| 17:49 | @rhickey | technomancy: I'm not going to go there :) |
| 17:51 | technomancy | yeah, binding+laziness admittedly sets off alarms in my head too |
| 17:52 | @rhickey | well, have fun with the bits - termination for reduce will keep you from having to resort to loop, and we can add a few more seq ops if they make sense, probably also do -kvversions |
| 17:52 | @rhickey | then fork/join |
| 17:52 | technomancy | cool |
| 17:53 | hiredman | damn |
| 17:53 | technomancy | ah, binding would probably interact badly with chunking |
| 17:53 | technomancy | oh, he's gone |
| 17:53 | hiredman | was just going to as if rich see's this as the basis for io stuff like iteratees |
| 17:53 | technomancy | too bad; he missed me telling him he's right |
| 17:54 | technomancy | not sure if that's an argument against drop binding or chunking though |
| 17:54 | napping | how would binding work with nested drop calls? |
| 17:55 | technomancy | napping: the nested drop would be discarded, probably |
| 17:55 | technomancy | can you even have nested drop calls that aren't no-ops? |
| 17:55 | napping | like (drop 2 (drop 3 <seq>))? |
| 17:55 | dnolen | ibdknox: jonasen: well I guess that means we have to decide amongst ourselves about the :children issue :) |
| 17:56 | technomancy | napping: oh, I see. well since drop doesn't call any functions that would check the discard bit it should be a no-op? |
| 17:58 | napping | Now I really don't follow you, but anyway explicit laziness on list items sounds like a better way to go |
| 17:59 | daniel | http://www.rivalchess.com/magic-bitboards/ <- what kind of operation is the occupancy * Magic Number for rook on c3? |
| 17:59 | daniel | if i try to multiply two 64 bit longs, i get an integer overflow error |
| 17:59 | jonasen | dnolen: for me, there are no (known) issues left. I've corrected the inconsistencies I found. |
| 18:00 | mebaran151 | daniel: if the number might overflow, you might have to move to BigNum math |
| 18:00 | jonasen | :children-keys or not is a seperate issue |
| 18:00 | dnolen | jonasen: yes |
| 18:00 | mebaran151 | have you tried (* 1N my-big-long my-other-long) |
| 18:01 | hiredman | mebaran151: he most likely wants unsafe math, since he is copying java code |
| 18:01 | technomancy | mebaran151: can you submit a patch for the .bat issue? |
| 18:02 | mebaran151 | should I fork and submit a pull request? |
| 18:02 | daniel | mebaran151: that gives me value out of range for long |
| 18:03 | technomancy | sure, or a patch to the mailing list would be fine |
| 18:03 | daniel | the result i get from this operation should be another 64 bit long, it shouldnt overflow |
| 18:03 | dnolen | jonasen: ibdknox: huh I don't really see any reason why we can have :children and a children multimethod? |
| 18:03 | dnolen | can't have. |
| 18:03 | mebaran151 | I'm relatively noobish with regard to git: how do I make it make a patch? |
| 18:03 | jonasen | dnolen: I've thought about that too |
| 18:03 | ibdknox | dnolen: the only thing I care about is the duplication, the rest I think is relatively straight forward |
| 18:04 | technomancy | mebaran151: you can make the changes; do `git commit -a -m "fixed thingy"` and then do `git format-patch origin/master` to generate the patch |
| 18:05 | dnolen | jonasen: (add-children ast-node) |
| 18:06 | napping | how do you get wrapping arithmetic? |
| 18:06 | dnolen | napping: unchecked math ops. |
| 18:07 | napping | ah, I wasn't looking for a dynamic |
| 18:07 | daniel | i know what the result of the operation should be http://www.rivalchess.com/magic-bitboards/ |
| 18:07 | daniel | (magic result) |
| 18:07 | daniel | but i dont know what the operation is |
| 18:08 | mmarczyk | yoklov: hi, thanks for catching the transient bug! fix @ CLJS-219, see also CLJS-220 for transient-based frequencies |
| 18:09 | yoklov | mmarczyk: wow, thanks for the hasty response |
| 18:09 | dnolen | ibdknox: jonasen: I like the add-children idea. People can just interact w/ data and a standard way to sync a node. |
| 18:10 | mmarczyk | :-) |
| 18:10 | napping | ,(binding [*unchecked-math* true] (* 0x1000000000000000 0x10)) |
| 18:10 | clojurebot | #<ArithmeticException java.lang.ArithmeticException: integer overflow> |
| 18:11 | pjstadig | ,(unchecked-add Long/MAX_VALUE 1) |
| 18:11 | clojurebot | -9223372036854775808 |
| 18:11 | ibdknox | dnolen: sounds much better :) |
| 18:11 | pjstadig | ,(unchecked-multiply Long/MAX_VALUE Long/MAX_VALUE) |
| 18:11 | clojurebot | 1 |
| 18:11 | pjstadig | etc. |
| 18:13 | mebaran151 | technomancy: patch made, where's the mailinglist? |
| 18:13 | technomancy | mebaran151: https://groups.google.com/group/leiningen; thanks |
| 18:13 | dnolen | ibdknox: I like it. I think keeps everyone happy. |
| 18:15 | Bronsa | napping: i think that has to do with + being inlined |
| 18:16 | dnolen | napping: it's not a dynamic var - it's a compiler flag you need to set! it. |
| 18:16 | hiredman | ^- excellent modularity, fyi |
| 18:17 | daniel | can anyone see what that operation is? |
| 18:17 | napping | ,(binding [*unchecked-math* true] (eval '(* 0x10000000 0x1000000000))) |
| 18:17 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 18:17 | napping | aww |
| 18:17 | napping | but that works |
| 18:19 | mebaran151 | technomancy: posted |
| 18:20 | technomancy | mebaran151: thanks |
| 18:21 | yoklov | mmarczyk: oh, i filed that bug as CLJS-217 |
| 18:23 | mmarczyk | yoklov: oh, missed that -- thanks for the heads-up -- just posted a comment w/ pointer to CLJS-219 |
| 18:23 | yoklov | mmarczyk: awesome |
| 18:23 | goodieboy | weavejester: i'm attempting to use "lein ring uberwar" but my app is hanging, can you tell me what the uberwar task does and what it expects in my app? |
| 18:23 | aphyr | What's the idiomatic way to catch a checked exception in Clojure? |
| 18:24 | yoklov | gotta run for a bit |
| 18:24 | weavejester | goodieboy: It compiles the Clojure project into a war file with all dependencies included. Which version are you using? |
| 18:24 | mebaran151 | aphyr: (catch ExceptionClass ex (do-stuff-with-error e)) ? |
| 18:24 | napping | isn't it try? |
| 18:24 | TimMc | aphyr: (try ...) |
| 18:25 | aphyr | Referring to http://dev.clojure.org/jira/browse/CLJ-855 |
| 18:25 | goodieboy | weavejester: 0.4.5 |
| 18:25 | mebaran151 | /s/e/ex |
| 18:25 | TimMc | Oh, that lossage. |
| 18:25 | aphyr | clojure.lang.Util.RuntimeException is wrapping it. :/ |
| 18:25 | weavejester | goodieboy: Try using a later version 0.4.5 is pretty old. |
| 18:25 | goodieboy | weavejester: ok, what is the latest? |
| 18:25 | weavejester | goodieboy: 0.6.5 should work |
| 18:25 | aphyr | Looks like there was a patch to try which offers transparent unwrapping, but I guess that's not a part of 1.3? |
| 18:26 | dnolen | ibdknox: jonasen: I also don't see a problem with a dynamic var *cljs-add-children* |
| 18:26 | weavejester | goodieboy: 0.6.6 works with lein2 but has a problem with lein1 |
| 18:26 | goodieboy | weavejester: ok we're using lein1 |
| 18:26 | goodieboy | weavejester: ok will try now |
| 18:27 | ibdknox | dnolen: hm that would leave my issue still open, right? While having the function forces you to call it once you're handed a tree |
| 18:28 | dnolen | ibdknox: yeah I think you're right. We just want a standard a rep, and standard add-children method helper so it's not a hassle. |
| 18:31 | goodieboy | weavejester: does "lein ring uberwar" call the application :init function? |
| 18:32 | technomancy | goodieboy: any particular blockers for upgrading to lein2, or just haven't looked into it yet? |
| 18:32 | goodieboy | technomancy: actually, we just haven't looked into it yet. Does it require clojure 1.3? |
| 18:33 | technomancy | no, should be pretty seamless transition in most cases |
| 18:33 | goodieboy | technomancy: that's good to hear, maybe i'll try to do the upgrade |
| 18:33 | aphyr | Should I (catch RuntimeException, inspect the class of the cause? |
| 18:33 | technomancy | goodieboy: let me know if you run into any blockers; want to make sure it's seamless and well-documented for others |
| 18:33 | technomancy | clojurebot: lein upgrade guide? |
| 18:34 | clojurebot | Leiningen pronunciation is LINE-ing-en ['laɪnɪŋən] |
| 18:34 | goodieboy | technomancy: excellent, i will thanks |
| 18:34 | technomancy | there's an upgrade guide on the wiki, though clojurebot apparently doesn't remember |
| 18:34 | goodieboy | haha |
| 18:35 | mega_ | ibdknox: any probs with this patch (its small) https://github.com/megakorre/crate/commit/b332ddf9b2123bb20bd3eeb9fbcb2f8da9649e45 |
| 18:37 | ibdknox | mega_: :node should probably be :dom and that let should be a when-let now :) |
| 18:38 | weavejester | goodieboy: It will when the war is installed |
| 18:38 | goodieboy | weavejester: ok you mean in the servlet container when starting up? |
| 18:39 | weavejester | goodieboy: Right |
| 18:39 | goodieboy | weavejester: ok gotcha |
| 18:39 | daniel | can anyone see what type of operation the * is, resulting in the 'magic result'? http://www.rivalchess.com/magic-bitboards/ |
| 18:42 | mega_ | ibdknox, kk fixed |
| 18:43 | austinh | To answer my own question from earlier, (korma.config/set-delimiters "") solved my "Connections could not be acquired..." issue with postgresql. |
| 18:44 | clj_newb | Hi, is it possible to execute two conditions in a if ? Java: if(true) { a = 1; b = 1; } else { c = 1; } |
| 18:45 | Bronsa | ,(if true (do 1 2) 3) |
| 18:45 | clojurebot | 2 |
| 18:45 | clj_newb | thank you! |
| 18:46 | clj_newb | ,(if true (do (println "a") (println "b")) (println "c")) |
| 18:46 | clojurebot | a |
| 18:46 | clojurebot | b |
| 18:46 | clj_newb | cool |
| 18:51 | austinh | Actually, it wasn't (korma.config/set-delimiters ""), it was :delimiters "" in the defdb/postgres form. |
| 18:53 | sorenmacbeth | technomancy: content in resources-paths in the :dev profile shouldn't be included in an uberjar correct (lein 2 preview 3)? |
| 18:54 | technomancy | sorenmacbeth: there was a bug about dev profiles leaking through; check the issue tracker |
| 18:54 | technomancy | not sure if it affects the uberjar or just the pom |
| 18:54 | sorenmacbeth | technomancy: thanks |
| 18:56 | sorenmacbeth | technomancy: yep, there is one specifically about uberjar applying dev/user profiles: https://github.com/technomancy/leiningen/issues/537 |
| 19:01 | daniel | solved my issue with (bit-shift-right (unchecked-long (*' (bit-and rookc3ap (nth rook-occupancy-mask 21)) (nth rook-mnumbers 21))) (nth rook-mnumber-shifts 21))) |
| 19:02 | daniel | was able to autopromote to bigint and then cast back to an unchecked-long |
| 19:02 | daniel | don't know if it can be improved |
| 19:07 | sorenmacbeth | technomancy: is there a known workaround? |
| 19:07 | sorenmacbeth | (don't see one referenced in the issue) |
| 19:07 | technomancy | it may be fixed in master; I think the issue was just reopened as a reminder to do some cleanup around it |
| 19:07 | technomancy | lemme see |
| 19:08 | technomancy | sorenmacbeth: yeah, current master has some other issues surrounding pom generation and profiles, but it looks like the uberjar problem is addressed |
| 19:09 | sorenmacbeth | technomancy: ok, thanks |
| 19:09 | technomancy | (wouldn't hurt to verify manually though =) |
| 19:13 | mebaran151 | daniel: if you need the performance you might consider creating an array of say two longs and handling overflow manually |
| 19:14 | mebaran151 | though it might not be worth the effort |
| 19:17 | hiredman | ~gogurt |
| 19:17 | clojurebot | gogurt is just yogurt |
| 19:18 | technomancy | what⁈ but it's like... mobile and stuff. |
| 19:18 | technomancy | it's nearly clomoso |
| 19:18 | mebaran151 | and you don't need a spoon |
| 19:20 | aphyr | Aha, so if you add enough type hints to prevent reflection, try/catch works properly. |
| 19:20 | aphyr | Guess the reflector is what was wrapping those exceptions up. |
| 19:20 | yonkeltron | technomancy: http://www.clomoso.com/ |
| 19:20 | hiredman | aphyr: it's a known issue with 1.3, fixed in 1.4 |
| 19:21 | aphyr | Sweet. Not a huge issue, this is the first time I've hit it in a lot of code. |
| 19:22 | technomancy | yonkeltron: gogurt is mobile and sort of social (you can share it, I guess?) so that's like 2/3 |
| 19:22 | technomancy | if we can figure out how to get gogurt in the cloud I think we could have VCs all over this |
| 19:23 | yonkeltron | technomancy: also if we find some way to incorporate big data |
| 19:23 | TimMc | aphyr: Huh. Example? |
| 19:23 | yonkeltron | technomancy: like, we can process thousands of cases of gogurt in the cloud using either AWS or dynamite *and* we can do it in O(n) time! |
| 19:24 | technomancy | yonkeltron: with map/reduce it should be possible |
| 19:24 | aphyr | https://gist.github.com/2563560 |
| 19:24 | aphyr | ^-- TimMc |
| 19:24 | yonkeltron | technomancy: yeah, we'll write our own hadoop clone in like 10 lines of roflscript |
| 19:26 | kovasb | roflscript compiles to jvm bytecode right |
| 19:27 | TimMc | aphyr: I don't see the type-hinting. |
| 19:27 | aphyr | [^RiemannClient client event] |
| 19:28 | aphyr | Needed to prevent the reflector on dispatching .send() |
| 19:28 | TimMc | Ah, got it. |
| 19:28 | TimMc | I was busy looking at the try/catch. |
| 19:28 | aphyr | I'm calling it a feature, since that code needed type hints anyway, haha. |
| 19:28 | emezeske | aphyr: Spoken like a true engineer. |
| 19:40 | dnolen | mmarczyk: ping |
| 19:40 | mmarczyk | dnolen: pong |
| 19:41 | dnolen | mmarczyk: re: conversion on N updates. It shouldn't be possible to create large ObjMap outside of using the obj-map actor explicitly. |
| 19:41 | mmarczyk | dnolen: agreed on that |
| 19:41 | dnolen | mmarczyk: so conversion on N updates could work I think. |
| 19:41 | mmarczyk | dnolen: hm, except maybe through TransientObjMap -- assuming that would be its *only* purpose or there would be some flag to trigger that behaviour |
| 19:42 | mmarczyk | dnolen: that would basically mean conversion on initial size + N |
| 19:42 | mmarczyk | dnolen: if that works, we could just use (+ max-initial-size N) |
| 19:42 | mmarczyk | dnolen: hm, actually |
| 19:43 | mmarczyk | dnolen: you want to convert faster for maps which actually are updated |
| 19:43 | mmarczyk | dnolen: makes sense, I guess |
| 19:43 | dnolen | mmarczyk: I don't think TOM should ever convert, on persistent! probably should create OM that won't convert |
| 19:43 | mmarczyk | dnolen: assuming we don't want to see (count om) > 32, I'd say 16 updates? |
| 19:44 | mmarczyk | dnolen: and have the compiler emit OMs for <= 16 entries |
| 19:44 | dnolen | mmarczyk: I think sticking w/ 32 is probably best. |
| 19:44 | mmarczyk | dnolen: 32 for which constant :-) |
| 19:44 | dnolen | < 32 compiler emits OMs |
| 19:45 | dnolen | > 32 updates -> PHM |
| 19:45 | mmarczyk | dnolen: about TOM -- that's no problem to implement, but for that sort of perf-sensitive scenarios, what's the advantage over fromObject ? |
| 19:45 | dnolen | TOM & explicit OM for special cases where people care |
| 19:45 | mmarczyk | dnolen: you're not worried about the assoc perf at sizes 32-64 ? |
| 19:46 | dnolen | explicit OM & TOM use probably means updates are rare. |
| 19:46 | dnolen | explicit OM & TOM is about access heavy applications. |
| 19:46 | mmarczyk | dnolen: ok, so TOM is basically for people who would call fromObject now, but more convenient since we're doing the keys bookkeeping and taking care of the unmodifiable flagging of the OM? |
| 19:49 | mmarczyk | dnolen: so, I'd go with a convertible? flag on the OM -- there's one access per assoc at most (that's once we get to the conversion threshold), which should be no problem at all for the maps which will convert and also no problem for the maps which are hardly ever updated |
| 19:50 | dnolen | yes |
| 19:50 | mmarczyk | dnolen: should unmodifiable OMs perhaps throw on assoc of complex key? |
| 19:50 | mmarczyk | dnolen: "pour me into a hash map first, buster" or sth |
| 19:52 | mmarczyk | dnolen: also, TransientObjMap no longer strikes me as the perfect name w/ this sort of impl :-( |
| 19:52 | mmarczyk | dnolen: TransientCOWObjMap? dunno :-/ |
| 19:53 | mmarczyk | I'm not altogether certain the pure-lookup-perf-sensitive folks shouldn't just use js-obj, though. |
| 19:55 | mmarczyk | going back and forth on this. but mostly I'm bothered by those lookup perf test results -- I must be missing something really big here, but I just can't see what's different now to how things were with the first lookup test :-( |
| 19:56 | dnolen | mmarczyk: yeah, we need to look into that. |
| 19:56 | kovasb | is this ObjMap thing similar to record, but optimizing for speed rather than memory? |
| 19:56 | dnolen | mmarczyk: good point about complex key assoc ... |
| 19:56 | dnolen | mmarczyk: we should think about it some more ... |
| 19:56 | mmarczyk | dnolen: yeah, some extra hammock time is needed on this |
| 19:58 | johnfn | how can i tell if a given value v is a function? |
| 19:59 | sattvik | johnfn: fn? |
| 19:59 | mmarczyk | dnolen: perhaps we should just pick a threshold and mark it as experimental, then revisit with some real-world data? with OMs + HMs only everybody's getting uniformly poor assoc perf and I wonder how common pure simple key maps are at huge sizes... |
| 19:59 | S11001001 | johnfn: depending on your strength desire, fn? or ifn? |
| 19:59 | dnolen | mmarczyk: TOM is really a separate ticket, as is unconvertible OM |
| 19:59 | S11001001 | johnfn: try both on different values (collections et al) and see what you mean |
| 19:59 | mmarczyk | dnolen: oh, ok |
| 19:59 | johnfn | brilliant, thanks! |
| 20:00 | mmarczyk | dnolen: in that case, I'll tidy up the TOM code and post it on a new ticket |
| 20:00 | dnolen | mmarczyk: yes, lets make 32 the experimental threshold and re-precate OM, everything is we'll ponder further. |
| 20:00 | dnolen | everything else |
| 20:00 | mmarczyk | dnolen: cool |
| 20:01 | mmarczyk | dnolen: thanks for thinking about this this thoroughly, btw |
| 20:02 | mmarczyk | dnolen: so, I'll be posting that new OM-reprecating patch soonish, threshold of 32 |
| 20:02 | dnolen | mmarczyk: excellent. |
| 20:02 | mmarczyk | dnolen: incidentally, I've got some work done on a port of the new reduce goodies -- couldn't help myself |
| 20:03 | mmarczyk | kovasb: ObjMap is a copy-on-write map type backed by a JS object (+ an array holding the keys) |
| 20:04 | mmarczyk | kovasb: superb lookup performance since it's basically an object lookup; assoc performance is not great at all though, as one would expect |
| 20:05 | mmarczyk | kovasb: so there's a bit of a balancing act in trying to pick which map type to use when... see CLJS-190 |
| 20:05 | kovasb | mmarczyk: sounds useful. just wondering how it relates to the existing datastructure set |
| 20:05 | dnolen | kovasb: it's very JS specific. |
| 20:05 | mmarczyk | kovasb: it's one of the original cljs map types, the other being HashMap |
| 20:06 | kovasb | is it different from backing it with a java hash map? |
| 20:06 | kovasb | (instead of a js object) |
| 20:06 | mmarczyk | kovasb: Clojure isn't using maps backed with Java hash maps |
| 20:07 | kovasb | for the purposes of the objmap, js maps and java hash maps are equivalent? or am i missing something |
| 20:08 | mmarczyk | kovasb: on the JVM, there's just PersistentArrayMap (linear scan lookups for very small maps) and PersistentHashMap; but in CLJS we'd be missing out on the JS VMs' object lookup optimizations without a map type wrapping an object for the string-keys-only case |
| 20:09 | kovasb | mmarczyk: so you think there would be nothing to be gained to have a similar construct in jvm clojure? |
| 20:10 | kovasb | the basis of my analogy is, record also imply a definite, regular structure on the keys |
| 20:11 | kovasb | so that is not a new constraint in the space of clojure design |
| 20:11 | mmarczyk | kovasb: records are updateable in a persistent manner though |
| 20:11 | mmarczyk | kovasb: which Java maps are not |
| 20:12 | S11001001 | kovasb: moreover, java hashmaps do not exploit that structure either (though the enummaps do) |
| 20:12 | mmarczyk | kovasb: I've actually written a library to wrap the immutable Guava collections for use with Clojure's collection library -- but the wrappers won't help you with updates, you'd have to unwrap, make your own copy + modifications, wrap again |
| 20:13 | mmarczyk | kovasb: no problem for the particular use case this was meant to support, but probably no good to have this sort of thing in core |
| 20:14 | mmarczyk | kovasb: and if you just want to use Java maps in Clojure through interop -- that's already a reasonably pleasant experience -- more so than using JS objects in CLJS, since JS objects are insane (hasOwnProperty :-P) |
| 20:15 | kovasb | mmarczyk: yeah, i see your point |
| 20:21 | yonkeltron | why have vectors? |
| 20:22 | gfredericks | in clojure? at all? |
| 20:22 | yonkeltron | in clojure |
| 20:22 | yonkeltron | i actually have an appreciation for vectors |
| 20:22 | gfredericks | they do 3 things as I see it |
| 20:23 | gfredericks | 1) increase code readability by giving an alternate form to use |
| 20:23 | gfredericks | 2) allow consise data literals, especially when you want the contents evaluated |
| 20:23 | gfredericks | 3) as data structures, allow random access/update, in contrast to lists |
| 20:24 | yonkeltron | 3 makes the most sense |
| 20:24 | gfredericks | I think 3) is used the least though |
| 20:24 | yonkeltron | see my earlier appreciation for vectors |
| 20:24 | yonkeltron | really? |
| 20:24 | yonkeltron | i understand but dislike 1 |
| 20:24 | gfredericks | at least in my experience |
| 20:25 | emezeske | 4) make things a tiny bit easier for newcomers, as they don't have to understand quoting on their first day |
| 20:25 | yonkeltron | emezeske: new comers to lisp, you mean |
| 20:25 | yonkeltron | ? |
| 20:25 | emezeske | Yes |
| 20:25 | gfredericks | emezeske: 2.1? :) |
| 20:25 | emezeske | gfredericks: Heh, yeah, 2.1. :) |
| 20:26 | gfredericks | emezeske: I've used clojure for years but it was only like 2 weeks ago that I conciously realized that '((+ 1 2)) != [(+ 1 2)] |
| 20:26 | technomancy | yonkeltron: 1) is weird for a few days, but most of the objections to vectors-as-bindings are basically a re-hash of the same "whoa; parens are weird" objections the algol-family-fans raise to any lisp |
| 20:26 | gfredericks | i.e., conciously realized that that was a difference between quoted lists and vectors |
| 20:26 | emezeske | gfredericks: I hear that. |
| 20:27 | gfredericks | emezeske: I would've known the difference if you'd shown them to me of course |
| 20:27 | yonkeltron | technomancy: fair i suppose. that actually didn't freak me out too much |
| 20:27 | yonkeltron | especially not with maps! |
| 20:27 | gfredericks | but not if you'd asked "What are the differences between vectors and quoted lists?" |
| 20:27 | yonkeltron | i loved seeing map literals |
| 20:28 | technomancy | yonkeltron: the advantage of using vectors for binding in source is that it means nearly any time you see "(foo ...)" it means "call foo" |
| 20:28 | technomancy | there are very few exceptions |
| 20:28 | yonkeltron | interesting |
| 20:28 | gfredericks | technomancy: that is a good point |
| 20:28 | yonkeltron | i guess i should make a habit, then |
| 20:28 | yonkeltron | i have an inbuilt desire to pass around '(...) |
| 20:29 | gfredericks | yonkeltron: all those single-quotes! lisp is so weird! |
| 20:30 | yonkeltron | gfredericks: says the clojure fan... |
| 20:30 | kovasb | yonkeltron: unless you were born with it, it should be possible to unlearn :) |
| 20:30 | yonkeltron | kovasb: what if...um...what if you were born with it? |
| 20:30 | yonkeltron | i mean what if it was mabelline, also? |
| 20:30 | yonkeltron | but let's begin with born with it |
| 20:30 | kovasb | yonkeltron: then i would subject myself to a genetic study :) |
| 20:31 | gfredericks | perhaps his mother ate a lot of quoted lists |
| 20:31 | yonkeltron | kovasb: got it, i'll walk next door to the uni and ask if they'd like me |
| 20:31 | kovasb | yonkeltron: relationship between evolution and syntax hunger |
| 20:31 | yonkeltron | gfredericks: don't talk about my mom that way!!!! |
| 20:31 | kovasb | lol |
| 20:31 | gfredericks | "Did you just call my mother a function?" |
| 20:31 | yonkeltron | kovasb: computational biology, or, as i like to call it, a shortcut to publication for bullshit papers |
| 20:31 | mmarczyk | dnolen: first cut at IKVReduce -- http://dev.clojure.org/jira/browse/CLJS-221 |
| 20:31 | yonkeltron | gfredericks: yeah dude, and i let her map me off last night, etc. etc. |
| 20:31 | kovasb | hehe |
| 20:32 | yonkeltron | ok but vectors. |
| 20:32 | kovasb | "but he said he was side-effect free, so its ok" |
| 20:32 | yonkeltron | i got tested, i swear |
| 20:32 | yonkeltron | i can *prove* it |
| 20:32 | yonkeltron | i suppose an implied-global proof in the case of the terminology of *prove* |
| 20:33 | mmarczyk | (reduce-kv (fn [i k v] (if (> i 1000) (reduced i) (+ i k v))) 0 (apply hash-map (range 100))) now evaluates to 1011 in CLJS :-) |
| 20:33 | dnolen | mmarczyk: oooh nice :) |
| 20:33 | nDuff | *whew* |
| 20:33 | gfredericks | why does clojurescript not like my ns form? |
| 20:34 | gfredericks | (ns foo.bar (:require [baz.bang :as booze]))? |
| 20:34 | mmarczyk | dnolen: more complete port of the reduce lib forthcoming :-) |
| 20:36 | mmarczyk | dnolen: btw, do you know off the top of your head if (extend-type default IKVReduce ...slow implementation assuming coll is IMap...) is the correct way to implement a slow path default? |
| 20:37 | mmarczyk | gfredericks: really? could you paste the error message? |
| 20:38 | gfredericks | mmarczyk: oh it went away when I removed the docstring; guess cljs doesn't have ns docstrings? |
| 20:38 | mmarczyk | gfredericks: ah, I believe not |
| 20:38 | gfredericks | oh well |
| 20:38 | dnolen | mmarczyk: we should avoid extend-type default, I'm trying to get rid of that from CLJS |
| 20:39 | mmarczyk | gfredericks: introspection support for CLJS is something I'm planning to work on, so please bug me about this from time to time :-) |
| 20:39 | mmarczyk | dnolen: well here I guess it's actually not a big deal, since we control all associative types |
| 20:39 | mmarczyk | dnolen: coming to think about it. |
| 20:39 | mmarczyk | dnolen: except possibly Object, which needs its own impl anyway |
| 20:40 | yonkeltron | so i guess you don't even need clos or cousins in clojure |
| 20:42 | yonkeltron | not that you'd need it anyway if you didn't want it |
| 20:44 | gfredericks | okay so I have a crossover where I'm hoping to use shuffle, which apparently isn't present in cljs; what's the best way to supply it? If I (defn shuffle ...), wouldn't that make problems on the clojure side? |
| 20:51 | gfredericks | and what are the haps with dom libs for cljs? |
| 20:51 | gfredericks | I'm just doing something non-trivial with cljs for the first time |
| 20:51 | gfredericks | s/just// |
| 20:54 | mmarczyk | gfredericks: domina & enfocus ? |
| 20:54 | mmarczyk | gfredericks: https://github.com/levand/domina I think |
| 20:54 | mmarczyk | gfredericks: and it links to enfocus in the readme |
| 20:54 | gfredericks | mmarczyk: cool, thx |
| 20:54 | mmarczyk | gfredericks: oh, and of course ibdknox has jayq, which wraps jQuery |
| 20:54 | gfredericks | I remember those from the clj-west talk |
| 20:55 | pandeiro | gfredericks: crate as well for templating |
| 20:56 | yonkeltron | does clojurescript have any frameworks on top of it for things like MVC in the browser, etc.? |
| 20:56 | kovasb | yonkeltron: not yet, but i suspect there will be in the next month or so :) |
| 20:57 | pandeiro | clojurescript one implements a sort of MVC |
| 20:58 | kovasb | there are some partial solutions out there |
| 20:58 | kovasb | but they all have pretty big holes |
| 20:59 | pandeiro | nothing 'framework' yet yeah |
| 20:59 | yonkeltron | kovasb: details exist? |
| 20:59 | pandeiro | but already the essential libs are there imho |
| 20:59 | kovasb | yeah lemme find my rant to the mailing list :) |
| 20:59 | mmarczyk | kovasb: next month? :-) |
| 20:59 | mmarczyk | whew, done with the reprecating ObjMap patch -- at least for now |
| 21:01 | kovasb | yeah the problem with clojurescript one is that you can't have multiple copies of the same widget |
| 21:01 | kovasb | without manually engineering it for each situation like that |
| 21:01 | pandeiro | kovasb: what widget do you mean? |
| 21:02 | kovasb | pandeiro: anything for which a view is defined |
| 21:02 | mmarczyk | kovasb: which mailing list? the main ggroup? I'd like to read your rant :-) |
| 21:02 | kovasb | http://groups.google.com/group/clojure/browse_thread/thread/0291471d79972c58 |
| 21:03 | mmarczyk | thx! |
| 21:03 | kovasb | anyway, I have an alternate design I've been working on in conjunction with a larger-scale cljs app |
| 21:03 | kovasb | i suspect a few other people have their own solutions brewing |
| 21:04 | mmarczyk | ah yes, I've read that |
| 21:05 | gfredericks | are there any plans to enhance cljsbuild crossovers with that cljx project? |
| 21:07 | emezeske | gfredericks: Is there any reason cljx can't be used in cooperation with lein-cljsbuild? |
| 21:07 | emezeske | gfredericks: I might do some tighter integration at some point, but I think they can play well now (just turn off crossovers) |
| 21:07 | mmarczyk | kovasb: looking forward to seeing your solution |
| 21:08 | gfredericks | emezeske: I must not be familiar enough with either project. I'll look closer :) |
| 21:08 | gfredericks | emezeske: any tips on my crossover issue? (defining shuffle) |
| 21:08 | kovasb | mmarczyk: yeah, i look forward to help optimizing it:) |
| 21:09 | mmarczyk | kovasb: sounds great :-) |
| 21:09 | emezeske | gfredericks: sorry, crossover issue? do I need to scroll up? |
| 21:09 | gfredericks | emezeske: just not sure how to define shuffle for cljs only |
| 21:10 | emezeske | gfredericks: Oh, I see, uh, I am not sure I know how best to deal with that |
| 21:12 | gfredericks | it really doesn't come up that often? |
| 21:24 | gfredericks | hmm. lots of warnings of usage of undeclared vars within domina. is that expected? |
| 21:26 | dnolen | gfredericks: domina wasn't particular about declaration order, luke knows now |
| 21:29 | gfredericks | dnolen: okay, so it should work anyhow? |
| 21:30 | dnolen | gfredericks: domina works fine far as I know, JS doesn't care about declaration order. |
| 21:32 | gfredericks | right right. cool. thanks. |
| 21:34 | mmarczyk | dnolen: new patch ready @ CLJS-190 |
| 21:35 | dnolen | mmarczyk: I tried applying that on master, doesn't work. |
| 21:36 | dnolen | mmarczyk: oh so I need to apply 213 first? |
| 21:36 | mmarczyk | dnolen: well yeah, and CLJS-218 & 220 too :-P |
| 21:36 | mmarczyk | dnolen: BUT, 218 is a bug fix |
| 21:36 | mmarczyk | dnolen: and 220 is, I think, a good feature & copy-and-paste from Clojure |
| 21:36 | dnolen | mmarczyk: yeah I applied those. |
| 21:37 | mmarczyk | dnolen: great |
| 21:37 | dnolen | mmarczyk: doesn't Clojure have a TransientArrayMap? |
| 21:38 | dnolen | mmarczyk: sorry first time looking at 213 |
| 21:38 | davertron | anyone here familiar with quil? I'm trying to figure out where my data directory is supposed to be because create-font seems to do nothing |
| 21:38 | mmarczyk | dnolen: yeah, and that's ported too |
| 21:38 | mmarczyk | dnolen: in CLJS-213 |
| 21:39 | dnolen | mmarczyk: why no array-map fn? |
| 21:39 | mmarczyk | dnolen: oh, ObjMap turns to PHM on (transient ...) |
| 21:39 | mmarczyk | dnolen: hm, oversight |
| 21:40 | mmarczyk | dnolen: good catch, will fix in a sec |
| 21:40 | dnolen | mmarczyk: please update devnotes/corelib.org too. |
| 21:40 | ibdknox | and it hits 75% :) |
| 21:41 | dnolen | ibdknox: woot! |
| 21:41 | mmarczyk | dnolen: hm, I have the vaguest of recollections of what that file is about -- will look into it |
| 21:41 | dnolen | mmarczyk: just a .org of what's been implemented. |
| 21:41 | mmarczyk | dnolen: ok, do you mind if it's a separate patch on the 190 ticket then? |
| 21:42 | dnolen | mmarczyk: not at all, and you might as well mark the transient, persistent!, assoc!, conj! etc as being done as well. |
| 21:42 | dnolen | mmarczyk: actually don't worry about it. |
| 21:43 | dnolen | mmarczyk: just add array-map, I'll update corelib.org |
| 21:43 | mmarczyk | dnolen: cool |
| 21:47 | mmarczyk | dnolen: just noticed cljs.core/hash-map is not using transients -> http://dev.clojure.org/jira/browse/CLJS-222 |
| 21:48 | gfredericks | oh man I just put something in the dom with clojurescript |
| 21:49 | gfredericks | I am unstoppable. |
| 21:49 | emezeske | gfredericks: booyakasha! |
| 21:49 | kovasb | boomshakalaka |
| 21:50 | gfredericks | broom |
| 21:50 | kovasb | whoop there it is |
| 21:50 | dnolen | haha |
| 21:54 | mmarczyk | :-D |
| 21:54 | kovasb | its awesome that so many people are hacking on cljs |
| 21:55 | kovasb | though it will be funny if a year from now #clojure will be all cljs-lua |
| 21:55 | kovasb | people trying to get their iOS apps to work |
| 21:55 | gfredericks | oh man this is so beautiful I might cry |
| 21:56 | dnolen | gfredericks: I take it that it's the first time you've done much w/ CLJS? |
| 21:56 | kovasb | lol |
| 21:56 | mmarczyk | dnolen: posted new patches on 213 & 190 |
| 21:56 | gfredericks | dnolen: anything I really care about, yeah |
| 21:57 | mmarczyk | gfredericks: that's exactly how I felt when Rich made the CLJS announcement |
| 21:57 | gfredericks | dnolen: I've done a surprising amount with CLJS considering I haven't done anything with CLJS |
| 21:57 | mmarczyk | "WJW... I too will now be able to hack on the DOM" |
| 21:57 | mmarczyk | well, maybe that's different |
| 21:57 | mmarczyk | but possibly same kind of feeling :-P |
| 21:58 | gfredericks | I too want to slow-jam the dom. |
| 22:02 | dnolen | mmarczyk: applied to master |
| 22:02 | mmarczyk | dnolen: great! thx |
| 22:08 | mmarczyk | ok, need to take my mind off of this for a couple of hours, then I'll do the TransientObjMap thing |
| 22:08 | gfredericks | read-string is not defined? |
| 22:08 | mmarczyk | turning to reduce lib for now |
| 22:08 | gfredericks | oh sep ns for reader |
| 22:08 | gfredericks | I remember |
| 22:08 | dnolen | mmarczyk: hmm I wonder about using dynamic binding for mutable locals for kvreduce. |
| 22:08 | mmarczyk | dnolen: to be honest -- me too |
| 22:09 | alex_baranosky | what is a good IRC client that I can tell to open the same bunch of IRC channels everytime I turn it on? |
| 22:10 | emezeske | alex_baranosky: I use irssi for that. |
| 22:10 | mmarczyk | dnolen: the problem is that the inner loop needs to return a couple of things to the outer loop |
| 22:10 | emezeske | alex_baranosky: It's not for the faint of heart though :) |
| 22:10 | amalloy | alex_baranosky: if you have an always-on computer somewhere (eg a vpn), you can run znc on that |
| 22:10 | mmarczyk | dnolen: could use an array for that of course |
| 22:11 | mmarczyk | dnolen: but that's a bunch of extra allocations :-/ |
| 22:11 | amalloy | my znc server is always connected to freenode, and when i turn on my irc client i connect to znc instead of to freenode, and it "forces" my (dumb) irc client to join channels on startup |
| 22:12 | alex_baranosky | amalloy, cool idea |
| 22:13 | dnolen | mmarczyk: mmarczyk well just one allocation right? on entering kvreduce. |
| 22:13 | amalloy | this gets you other nice things like logging the irc traffic even when you don't have an IRC client turned on |
| 22:13 | mmarczyk | dnolen: one for each run of the inner loop |
| 22:14 | mmarczyk | dnolen: oh, I mean in the PersistentVector impl |
| 22:14 | dnolen | mmarczyk: yeah that's what I'm looking at. |
| 22:14 | mmarczyk | dnolen: incidentally, that impl is broken right now -- I've got a fix for one part of the problem here, working on the second part |
| 22:15 | alex_baranosky | did anyone see Rich Hickey's commit to Clojure today ? https://github.com/clojure/clojure/commit/4a22e3a44df48ea0d37dd034bc3f6cb3092117a9 |
| 22:15 | dnolen | alex_baranosky: yep |
| 22:16 | dnolen | mmarczyk: why do you need allocation inner loop? seems like you just something settable for step and init |
| 22:16 | alex_baranosky | what is the idea behind it? |
| 22:16 | dnolen | allocation in the inner loop |
| 22:16 | mmarczyk | dnolen: ohhh. gotcha. |
| 22:16 | mmarczyk | dnolen: fixing this with your approach now |
| 22:17 | mmarczyk | dnolen: I'm slightly worried about boxing |
| 22:18 | dnolen | mmarczyk: boxing of what? |
| 22:19 | mmarczyk | dnolen: boxing as in placing values in an array rather than their own variables |
| 22:20 | mmarczyk | dnolen: but actually I'm sure I don't have a particularly clear picture of the implications of that, so nvm |
| 22:20 | muhoo | ibdknox: i just sent someone to you who, from his description of the prototype he wants, needs your cljs skillz |
| 22:20 | dnolen | mmarczyk: maybe worth making a benchmark - though I'd be suprised if it made a big difference. |
| 22:21 | dnolen | alex_baranosky: rhickey said allocation free pipelines |
| 22:21 | dnolen | alex_baranosky: http://clojure-log.n01se.net/#17:02 |
| 22:21 | muhoo | ibdknox: feel free to pm me if you want to discuss |
| 22:22 | mmarczyk | dnolen: ok, I'll get it working with an array first |
| 22:22 | mmarczyk | dnolen: then maybe benchmark the binding approach too. |
| 22:22 | alex_baranosky | dnolen, I see now, I was looking at his second commit, the first one makes it clear that he's re-implementing reduce ... faster |
| 22:24 | gfredericks | what do I need to set to prn to the console? |
| 22:24 | gfredericks | (i.e., chrome console) |
| 22:25 | dnolen | gfredericks: just call (.log js/console (str ...)) |
| 22:26 | gfredericks | oh, I inferred from the error message that prn gives that I could hook it into the cljs print functions |
| 22:27 | jroes | anyone on osx know how to get the little incoming connections box that instantaneously pops up to stop happening? |
| 22:27 | jroes | usually pops up when clojure tries to listen on a port |
| 22:27 | jroes | or something clojure-related |
| 22:28 | mmarczyk | dnolen: ok, posted new patch with a working impl of -kv-reduce for PV |
| 22:28 | mmarczyk | dnolen: array based |
| 22:28 | alex_baranosky | dnolen, thanks for the link, reading through it now |
| 22:30 | dnolen | mmarczyk: excellent. |
| 22:30 | dnolen | mmarczyk: so for reduce combinators I imagine you'll make a seperate file? |
| 22:32 | mmarczyk | dnolen: yeah, that would be most convenient, though then it should probably be clearly documented that the Reduced thing is WIP |
| 22:32 | mmarczyk | dnolen: since it doesn't work with the regular reduce yet |
| 22:32 | mmarczyk | dnolen: or I could work on this ticket a bit more to make it work with reduce and then port the combinators namespace in a separate ticket |
| 22:34 | dnolen | mmarczyk: but that's true for Clojure at the moment too right? |
| 22:35 | dnolen | mmarczyk: oh, actually, no that's not true. |
| 22:36 | mmarczyk | dnolen: yeah |
| 22:37 | mmarczyk | dnolen: so, not sure whether it's same ticket or separate -- also, no preference here, it doesn't affect my workflow much :-) |
| 22:38 | dnolen | mmarczyk: lets make them separate, if only for documentation reasons. |
| 22:38 | mmarczyk | dnolen: sure |
| 22:38 | dnolen | mmarczyk: well that and I can apply kvreduce patch now. |
| 22:39 | mmarczyk | dnolen: oh great :-D |
| 22:43 | mmarczyk | dnolen: hm, apparently I missed PAM, though I could swear I had an impl earlier |
| 22:44 | mmarczyk | dnolen: will post an updated patch in a moment |
| 22:48 | mmarczyk | dnolen: done |
| 22:48 | mmarczyk | gfredericks: cool :-) |
| 22:48 | mmarczyk | gfredericks: would you consider posting it somewhere? :-) |
| 22:49 | gfredericks | oh I guess so |
| 22:50 | gfredericks | mmarczyk: https://refheap.com/paste/2482 |
| 22:50 | gfredericks | I don't know that that exact version works in clj, given the (def shuffle ...) |
| 22:52 | mmarczyk | gfredericks: I love you shuffle impl :-D |
| 22:52 | gfredericks | mmarczyk: thanks :) |
| 22:53 | amalloy | &(sort-by rand '(a b c d))? |
| 22:53 | lazybot | java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number |
| 22:53 | gfredericks | amalloy hates my shuffle impl |
| 22:53 | amalloy | even if the input is all numbers it's a terrible sort algorithm |
| 22:54 | amalloy | sorry bro |
| 22:54 | amalloy | er, terrible shuffle |
| 22:54 | gfredericks | I'm confused as to why it worked then |
| 22:54 | gfredericks | because I wasn't sorting numbers |
| 22:55 | gfredericks | where is cljs-bot when you need him? |
| 22:55 | mmarczyk | :-) |
| 22:55 | amalloy | gfredericks: i have a lazy-shuffle implementation if you want it |
| 22:55 | amalloy | in useful.seq, i think |
| 22:55 | gfredericks | amalloy: will it work in cljs? |
| 22:55 | amalloy | it should |
| 22:56 | amalloy | i mean, you'll have to copy the code, since it's not in any cljs jars |
| 22:56 | gfredericks | of course |
| 22:56 | amalloy | https://github.com/flatland/useful/blob/develop/src/useful/seq.clj#L143 |
| 22:56 | gfredericks | thx |
| 22:58 | gfredericks | amalloy: in any case I think it's a little extreme to call O(n log n) "terrible" |
| 22:58 | gfredericks | I prefer "mildly slow" |
| 22:58 | amalloy | gfredericks: no, i mean it does a terrible job of shuffling - the result is not very random |
| 22:59 | gfredericks | wth |
| 22:59 | gfredericks | why not? |
| 22:59 | amalloy | consider ##(sort-by rand [0 1 1 1 1 1 1 1]) |
| 22:59 | lazybot | ⇒ (0 1 1 1 1 1 1 1) |
| 22:59 | amalloy | the 0 will always come first, because (rand 0) is always less than (rand 1) |
| 22:59 | gfredericks | oh rand is not doing what I wanted it to |
| 23:00 | amalloy | even if you were tossing a coin at every comparison, which i assume is what you meant |
| 23:00 | gfredericks | (partial sort-by #(rand)) is apparently what I meant |
| 23:00 | amalloy | then i'm told it's still pretty bad, because sort algorithms have different goals from shuffle algorithms |
| 23:00 | gfredericks | bad in its ordering or performance? |
| 23:01 | mmarczyk | well it probably produces a non-uniform shuffle |
| 23:01 | amalloy | you wind up with stuff like "the first item in the input list is very likely to be either the first or last item in the output list" |
| 23:01 | amalloy | right |
| 23:01 | amalloy | (though the particular error case there, i just made up - i doubt it's that simple) |
| 23:01 | gfredericks | I can't see why anything like that would happen |
| 23:01 | gfredericks | we're assuming each item is associated with a random element of [0,1)? |
| 23:02 | gfredericks | &(rand) |
| 23:02 | lazybot | ⇒ 0.3245122350535715 |
| 23:02 | tmciver | What about just using ##(doc shuffle) |
| 23:02 | lazybot | ⇒ "([coll]); Return a random permutation of coll" |
| 23:02 | gfredericks | tmciver: cljs |
| 23:02 | clojurebot | Huh? |
| 23:02 | amalloy | gfredericks: but you're not associating each item with a random number *once* |
| 23:03 | tmciver | Ah, can't do it, I guess. I know nothing of cljs. |
| 23:03 | mmarczyk | http://dev.clojure.org/jira/browse/CLJS-223 |
| 23:03 | amalloy | you're changing, at random, the number it's associated with every time you compare it to something |
| 23:03 | gfredericks | amalloy: oh I thought caching the value was part of the contract |
| 23:03 | amalloy | no |
| 23:03 | mmarczyk | gfredericks: ^ support for ns docstrings -- or rather for discarding of docstrings |
| 23:03 | gfredericks | well poo poo |
| 23:03 | amalloy | mmarczyk: is there some reason he can't just write (ns ^{:doc "..."} my.ns ...)? |
| 23:03 | gfredericks | why shouldn't it cache? the fn might be expensive, and what is there to lose from it? |
| 23:04 | amalloy | *shrug* perhaps the function is cheap to compute, but expensive to store |
| 23:04 | mmarczyk | amalloy: oh sure, but (1) it's ugly, (2) it's doesn't actually work in Clojure |
| 23:05 | amalloy | if you want it cached, (map first (sort-by second (map (juxt identity sort-fn) coll))), right? |
| 23:05 | gfredericks | okay this starbucks is closing so I have to go |
| 23:05 | amalloy | aw, sad-face re (2) there |
| 23:05 | mmarczyk | (let [tag (memoize (fn [_] (rand)))] (sort-by tag ...)) |
| 23:06 | gfredericks | thanks for the enlightening discussion :) |
| 23:06 | mmarczyk | see you :-) |
| 23:09 | amalloy | mmarczyk: cute. still has problems if the list elements aren't unique, though |
| 23:09 | mmarczyk | amalloy: take-shuffled is very pretty |
| 23:09 | amalloy | i'm glad you like it! |
| 23:10 | mmarczyk | amalloy: I think I'll have an enjoyable session of reading through useful very soon :-) |
| 23:10 | amalloy | yeah, i had a lot of fun translating fisher-yates into a functional context |
| 23:11 | mmarczyk | amalloy: a, good catch |
| 23:11 | amalloy | somewhere fliebel has a blog post comparing performance of a bunch of different shuffle implementations, including mine. there are tradeoffs, of course |
| 23:11 | mmarczyk | amalloy: I'm pretty sure I've got a straightforward fisher-yates impl lying around somewhere, but can't find it |
| 23:12 | mmarczyk | amalloy: but the take-shuffled idea is nice apart from the algo |
| 23:12 | amalloy | how so? just the idea of a lazy shuffle, or...? |
| 23:13 | mmarczyk | yeah, plus implementing it on top of lazy-loop |
| 23:14 | mmarczyk | just overall pretty :-) |
| 23:14 | amalloy | heh, i implement everrrrything on top of lazy-loop. i love that macro |
| 23:14 | mmarczyk | :-) |
| 23:17 | TimMc | gfredericks: (sort-by (memoize rand) ...) Done! :-P |
| 23:17 | mmarczyk | amalloy: wow, haven't looked at useful in a pretty long while and only vaguely remembered how cool it is |
| 23:17 | TimMc | Aw, someone already pulled out memoize. |
| 23:17 | amalloy | mmarczyk: say, since you're already in there and seem to be educated on this sort of thing, would you mind looking at https://github.com/flatland/useful/blob/develop/src/useful/seq.clj#L219 for me? in particular it's hard to believe that our implementation of the 3+ collection version is the fastest way to do it, but in the context of laziness it actually does seem to be |
| 23:18 | mmarczyk | amalloy: an alternative / add-on core lib, basically |
| 23:19 | mmarczyk | amalloy: looking now |
| 23:28 | muhoo | ibdknox: oops, nevermind. in 2 weeks, i predict you'll be the ceo of the newly-funded lighttable, inc. and won't be doing iwbyp's anymore. |
| 23:29 | LuminousMonkey | What with all the narkyness some people get with Light Table anyway? It's odd. |
| 23:30 | ibdknox | muhoo: haha, yeah I'm not taking any projects right now :) |
| 23:38 | mmarczyk | amalloy: no idea if it's going to be any faster, but here's what I'd do for a multiway merge: https://gist.github.com/2564705 |
| 23:39 | amalloy | intersesting |
| 23:40 | mmarczyk | amalloy: although apparently it's buggy... oh bother |
| 23:41 | mmarczyk | amalloy: ah, fortunately it was my test that was buggy :-P |
| 23:47 | mmarczyk | amalloy: but coming to think about it, useful's version is lazy in the binary case, right? so it should be optimal in the >= 3 arg case |
| 23:47 | amalloy | right, that's why i think it works, it just seems surprising that it comes out so easily as a result of laziness |
| 23:48 | mmarczyk | yeah, however awesome one thinks that laziness is, it is more awesome still |
| 23:49 | wmealing | LuminousMonkey, re "narky", i think its jealousy. |
| 23:49 | muhoo | LuminousMonkey: wasn't snark, i was realizing i made an error |
| 23:49 | wmealing | LuminousMonkey, resistance to change, and a bit of friendly jabs. |
| 23:50 | LuminousMonkey | muhoo: No, sorry, I wasn't meaning you. It just reminded me of a post on the programming reddit I read this morning. |
| 23:51 | muhoo | damn, i dunno what to do then. what i'm being asked to do is above my skill level. |
| 23:51 | muhoo | i'm 3 months into clojure, haven't touched cljs, and now being asked to do something along the lines of what ibdknox has done. |
| 23:52 | muhoo | i have to turn this down. |
| 23:52 | LuminousMonkey | wmealing: Yeah, most of it sounds like sour grapes to me, sounds like ibdknox must be on the right track. :) |
| 23:52 | wmealing | i think of it this way |
| 23:52 | wmealing | even if he fails, he's going to try something that people havn't done before |
| 23:52 | wmealing | and we can learn from it |
| 23:52 | muhoo | it ain't gonna fail. no way. |
| 23:53 | wmealing | it may not be everyones "idealized" editor |
| 23:53 | wmealing | but what will be. |
| 23:53 | wmealing | nothing |
| 23:53 | wmealing | "its not emacs, its not vim uwuwuwuw" |
| 23:53 | LuminousMonkey | Well, I was thinking the same thing when I watched that presentation, I was thinking how cool it would be to write an IDE that does that. :) |
| 23:53 | wmealing | yup |
| 23:54 | LuminousMonkey | wmealing: Not sure about Vim, but I'm sure you could get something like that in Emacs, that's what I was considering. |
| 23:54 | LuminousMonkey | wmealing: But I lack talent. :) |
| 23:54 | wmealing | i'm a newbie emacser |
| 23:54 | muhoo | ask technomancy about trying to make major changes in emacs :-) |
| 23:54 | wmealing | emacsen |
| 23:54 | wmealing | i really only started using it for clojure |
| 23:55 | LuminousMonkey | muhoo: I wish I could just have a Clojure based Emacs. :) |
| 23:55 | ibdknox | I laugh everytime someone says "oh that could just be a (vim|emacs) plugin" |
| 23:55 | wmealing | good luck with that. |
| 23:55 | wmealing | no canvas in either, from what i can see. |
| 23:55 | ibdknox | the UI layers are 20+ years old |
| 23:56 | wmealing | getting anything changed will take multiple years. |
| 23:56 | LuminousMonkey | Well, Steve Yegge was saying that browsers, etc, were catching up with Emacs, Emacs isn't innovating enough. |
| 23:56 | wmealing | see, there was moz's bespin project |
| 23:57 | wmealing | i think its called something else now... that did some kind of IDE work in the browser. |
| 23:57 | ibdknox | they went about that the wrong way |
| 23:57 | ibdknox | cloud9 ide |
| 23:57 | ibdknox | and ACE |
| 23:57 | ibdknox | is what bespin turned into |
| 23:57 | wmealing | yeah, i couldnt follow what happened there.. |
| 23:57 | wmealing | it looked promising |
| 23:57 | ibdknox | the key isn't to compete with editors that already exist |
| 23:57 | ibdknox | you'll never win |
| 23:57 | wmealing | agree on that. |
| 23:57 | LuminousMonkey | http://steve-yegge.blogspot.com.au/2008/04/xemacs-is-dead-long-live-xemacs.html |
| 23:58 | ibdknox | emacs and vim have far too big of a headstart |
| 23:58 | LuminousMonkey | The "The bad news: the competition isn't the IDEs" part |
| 23:58 | ibdknox | the thing to do is to play a game that they can't play no matter how hard they try |
| 23:58 | LuminousMonkey | I think.. |
| 23:59 | muhoo | that's how it has always been, indeed. skate to where the puck is going, not where it's been. |