2012-07-25
| 00:10 | emezeske | Apparently (pr ...) in clojurescript is pretty slow, especially in older browsers. Are there any tricks to make that faster (e.g. undocumented options, etc)? |
| 00:14 | dnolen | emezeske: not that I'm aware of. printing is slow - but I haven't looked closely at why. |
| 00:15 | dnolen | emezeske: I'm assuming your serializing something? |
| 00:15 | emezeske | dnolen: Yeah, just a big map of maps |
| 00:15 | emezeske | dnolen: I've been using pr-str/read-string for serialization, and it's been fine up until now, when I tried to serialize something a bit larger |
| 00:16 | emezeske | dnolen: Confusingly, it looks like the reader is substantially faster... |
| 00:16 | dnolen | emezeske: serialization is very slow in CLJS, pr variants & the reader need a lot of optimization work. |
| 00:16 | emezeske | dnolen: Okay, thanks! I just wanted to make sure there weren't any easy outs before I dug in deeper |
| 00:16 | dnolen | emezeske: I did some basic optimization work on the reader. never looked closely at printing. |
| 00:18 | emezeske | dnolen: I might end up looking at optimizing the print stuff. |
| 00:24 | dnolen | emezeske: printing is elegantly written around lazy sequences. I can't imagine that be any good for performance. |
| 01:07 | amalloy | dnolen: i may start stealing that out of context. "X is elegant: I can't imagine it being any good performance-wise" |
| 02:11 | emezeske | Warning to anyone using Vim with paredit.vim: the wikipedia.vim plugin annihilates performance for editing clj files for some reason. For the last 6 months, I just thought that paredit.vim was slow. Little did I know, it was wikipedia.vim the whole time, somehow leaking its slowness everywhere. |
| 02:18 | gert | "leaking its slowness everywhere" <- quote of the day |
| 02:22 | emezeske | Woo! I should drink and IRC more |
| 02:26 | gert | that is good advice for anything in life. |
| 02:36 | emezeske | gert: /agree |
| 02:49 | ambrosebs | Type inference anyone? https://gist.github.com/3174648 :) |
| 02:50 | noidi_ | ambrosebs, congrats! |
| 02:52 | noidi | you're well on your way to solving clojure's "indecipherable error messages" problem |
| 02:53 | ambrosebs | noidi: thanks :) |
| 02:54 | ambrosebs | noidi: Now I just need to somehow communicate to an IDE which exact form to highlight :) |
| 02:55 | ambrosebs | Which could be a bit tricky with macroexpansion... |
| 03:01 | djcoin | ambrosebs: i just saw *now* your "typed-clojure" project on github. Do you think it will be possible to add type (for safety, optimization, etc.) to Clojure ? |
| 03:01 | ambrosebs | djcoin: Right now it's for safety. |
| 03:02 | ambrosebs | The plan is to make a completely optional type checker, probably part of contrib |
| 03:02 | ambrosebs | I can get surprisingly accurate results, so I'm confident it will work. |
| 03:04 | djcoin | ambrosebs: awesome :) |
| 03:05 | ambrosebs | The optimizing will come later. |
| 03:05 | djcoin | I hope there won't be too much problem/limitation. I guess it might not be obvious at all to do this kind of stuff |
| 03:05 | djcoin | Yeah, safety is way more important. |
| 03:05 | ambrosebs | There are several hurdles. |
| 03:05 | ambrosebs | Typing "assoc" is a pretty big one |
| 03:06 | ambrosebs | The "rest arguments in pairs" is problematic |
| 03:06 | ambrosebs | Also "comp" is just crazy. |
| 03:06 | ambrosebs | Multimethods will be interesting. |
| 03:08 | djcoin | Ok |
| 03:09 | ambrosebs | djcoin: If you're interested, I summarise stuff in my proposal. |
| 03:09 | ambrosebs | And lit review |
| 03:10 | djcoin | Unfortunately I'm not a strong type's theorist but type is really important to me |
| 03:11 | djcoin | ambrosebs: I guess you may have checked typed-racket ? |
| 03:11 | ambrosebs | djcoin: Yes it is almost entirely based (copied) from typed-racket |
| 03:11 | djcoin | Oh, all right :) |
| 03:12 | ambrosebs | The big differences are interop, multimethods, heterogeneous map types |
| 03:13 | ambrosebs | ie. types for ad-hoc objects like {:op :if :expr {:number 1} ...} |
| 03:13 | djcoin | ambrosebs: that typed-racket implement but that will be hard on clojure ? |
| 03:13 | ambrosebs | No, typed-racket does not have any of these features |
| 03:14 | djcoin | Oh, all right |
| 03:14 | djcoin | I just heard of it - did not dig far |
| 03:14 | ambrosebs | djcoin: I have not tackled multimethods, but the other two are going well. |
| 03:14 | ro_st | -curious- what flavour of clj are you discussing? |
| 03:15 | ambrosebs | CLJ |
| 03:15 | ambrosebs | It will be simple to convert to CLJS |
| 03:15 | ambrosebs | Probably CLJ-CLR too. |
| 03:15 | ro_st | ah, so you're discussing a library then. which one? |
| 03:15 | ambrosebs | typed-clojure |
| 03:15 | ro_st | aha! |
| 03:16 | ambrosebs | djcoin: the main innovation of typed-clojure is nil-safe interop with Java. |
| 03:16 | djcoin | ambrosebs: thanks for your explanations :) |
| 03:17 | ambrosebs | Without option types. |
| 03:17 | ambrosebs | Still yet to be proved. |
| 04:02 | djcoin | ambrosebs: I know that my question may be irrelevant but how do you see Clojure vs (typed-)Racket ? The JVM and the java libs around are pretty interesting - otherwise I guess I would have try to dig rather in racket |
| 04:04 | ambrosebs | djcoin: In general? The Racket ecosystem is amazing. But the language is bloated. |
| 04:04 | ambrosebs | Comparing to Clojure, which is an unfair comparison I guess. |
| 04:05 | ambrosebs | Clojure has the data structures, and they're super easy to use. |
| 04:05 | djcoin | ambrosebs: by language you mean racket itself or the (quality, etc.) language beneath it ? |
| 04:05 | ambrosebs | djcoin: I was referring to the data structure ops. |
| 04:05 | ambrosebs | Clojure has first + rest |
| 04:06 | ambrosebs | and the seq abstraction |
| 04:06 | ambrosebs | Racket is a lot messier IMO |
| 04:06 | ambrosebs | Racket seems to be a fine language. Just seems a bit more of a chore to write in than Clojure for me. |
| 04:07 | ambrosebs | I'm heavily(!) biased of course. |
| 04:07 | ambrosebs | Go to #racket and ask them :) |
| 04:07 | djcoin | :) |
| 04:07 | djcoin | I already ask them once - about immutability and such |
| 04:08 | ambrosebs | Yes, that is one area that Clojure is much more consistent about. |
| 04:08 | djcoin | Did not get/remember much however. |
| 04:08 | djcoin | But I felt like the language was cleaner |
| 04:09 | djcoin | I'm not advanced enought to see what are the JVM and java libs environments limitations (despite their tremendous advantages) |
| 04:10 | ambrosebs | Hmm. Well methods aren't first class objects. |
| 04:10 | ambrosebs | But that's syntax. |
| 04:10 | ambrosebs | Error messages are bad. |
| 04:12 | ambrosebs | But if you want interop, it doesn't really get much better (without static typing). |
| 04:12 | ambrosebs | Scala generics are Java generics for example. |
| 04:49 | ro_st | is there a library i can use in both clj and cljs for xml munging - not DOM, xml |
| 05:45 | wingy | how do i access the property of a js object in cljs? |
| 05:45 | ro_st | (.property object-ref) |
| 05:46 | ro_st | eg |
| 05:46 | ro_st | (.log js/console "foo") |
| 05:47 | wingy | im trying this one: (.name (js-obj "name" "foo")) |
| 05:47 | wingy | in http://himera.herokuapp.com/index.html |
| 05:47 | wingy | but it doesn't work |
| 05:48 | ro_st | buggered if i know :) |
| 05:49 | wingy | what? |
| 05:49 | clojurebot | What is seq |
| 05:49 | wingy | who? |
| 05:52 | ro_st | i've not had to do this myself, yet |
| 05:52 | wingy | hm |
| 05:53 | wingy | anyone knows how to do this? |
| 05:54 | wingy | i c |
| 05:54 | wingy | (.-name (js-obj "name" "foo")) |
| 05:54 | wingy | the doc says (.-property target-object -property) |
| 05:54 | wingy | what does the last one mean? |
| 05:55 | ro_st | a default? |
| 05:58 | wingy | what does -property mean? |
| 05:58 | wingy | could someone give an example? |
| 05:58 | rbarraud | Dagnabbit, there is no Kindle edition of The Joy Of Clojure on Amazon Kindle Store |
| 05:59 | rbarraud | Manning want $45 for the print book, Amazon has it for $26 ... eBook in 3 formats from Manning $35, Amazon doesn't have a (hopefully cheaper) alternative :( |
| 05:59 | _nmmn | well there is pdf version |
| 05:59 | rbarraud | on Amazon? |
| 06:00 | _nmmn | maybe not |
| 06:00 | _nmmn | http://manning.com/fogus/ |
| 06:00 | rbarraud | or just as part of the 3-format eBook bundle on the Manning site? |
| 06:00 | _nmmn | yeah |
| 06:00 | _nmmn | had no problems reading it on my kindle fire =] |
| 06:01 | rbarraud | ah good to hear |
| 06:01 | rbarraud | well i am gonna bite the bullet and buy the bundle i guess c:) |
| 06:01 | rbarraud | seeing $44 vs $26 for pbook makes Manning's prices look a tad inflated though :-/ |
| 06:02 | _nmmn | true, it could be way cheaper, i mean, it should! |
| 06:02 | rbarraud | have u read the Halloway book also? "Programming CLojure" |
| 06:02 | rbarraud | how do you think they compare? |
| 06:02 | _nmmn | i have it in queue, not yeat |
| 06:02 | _nmmn | *yet |
| 06:02 | rbarraud | there's also the Apress and Oreilly ones .... anyone have any comparative thoughts on them? |
| 06:02 | _nmmn | im now crunching "little schemer" |
| 06:02 | rbarraud | heheh |
| 06:02 | rbarraud | that's a goodie |
| 06:03 | rbarraud | i have the 3 of them in that series |
| 06:03 | _nmmn | and there is other one on scheme |
| 06:03 | _nmmn | ah cool =] |
| 06:03 | rbarraud | really only ~1/4 into the first one though |
| 06:03 | _nmmn | "seasoned schemer" |
| 06:03 | rbarraud | IIRC there are Little, Seasoned and Reasoned :) |
| 06:04 | _nmmn | i see, havent heard about reasoned =] |
| 06:04 | rbarraud | looks like i may have misplaced the 3rd |
| 06:04 | rbarraud | or i am confused or didnt buy it - or both :) |
| 06:06 | _nmmn | well i conviced my workplace to get em =] they seems to be reasonable regarding educating/learning/material |
| 06:16 | Leonidas | rbarraud: reasoned exists, but it is more about, well, logical reasoning, read kanren |
| 06:16 | mytrile | Hey, guys. How can I try 1.5.0-master-SNAPSHOT ? |
| 06:16 | mytrile | This is in my project.clj :dependencies [[org.clojure/clojure "1.5.0-master-SNAPSHOT"]] |
| 06:30 | ro_st | is it possible to select multiple selectors at once with enlive? |
| 06:30 | ro_st | kinda like jquery's $('#one, #two') |
| 06:31 | ro_st | ah, use a set |
| 06:40 | rainerschuster | if two lists, the first one is a record read from a csv and the second describing the converter functions. How do I combine the two lists, so that the functions from list 2 are called to the arguemnts of list 1 pairwise |
| 06:44 | clgv | rainerschuster: e.g. (map #(%2 %1) list1 list2) |
| 07:06 | michaelr525 | hello |
| 07:26 | ro_st | are the rules for using - and _ in filenames and namespaces different for clojurescript? |
| 07:27 | ro_st | ie, if i use - in a namespace name, i must use _ in the filename isntead |
| 07:27 | ro_st | instead |
| 07:29 | cshell_ | no idea, ro_st :( |
| 07:29 | ro_st | it is consistent. i incorrectly named a cljs .clj |
| 07:41 | djcoin | Are their any good lib around for setting up an e-commerce site ? |
| 07:41 | ro_st | i don't think the open source ecosystem for clojure is quite there yet |
| 07:41 | ro_st | php? ruby? sure |
| 07:43 | _nmmn | i dont think clojure should compete on that market |
| 07:43 | ro_st | agreed |
| 07:43 | ro_st | it's a bad reason to write a lot of bad code :-) |
| 07:43 | _nmmn | ;] |
| 07:44 | ro_st | and anyway, stuff like spreecommerce is great |
| 07:44 | _nmmn | well some backend stuff for e-commerce written on clojure would make sense, but rest... |
| 07:44 | djcoin | Why would Clojure not be a good fit at this ? |
| 07:44 | ro_st | it's not that it wouldn't be a good fit. by all means, spend a year building one. |
| 07:45 | ro_st | or you could grab spreecommerce and be selling shit by the end of the week |
| 07:45 | _nmmn | it just wouldnt outgrow competition, think, hosting, available clojure developers, etc etc... |
| 07:46 | ro_st | and it's a massive undertaking |
| 07:46 | ro_st | especially if you want to do a good job |
| 07:46 | ro_st | perhaps in 5-10 years when clojure has taken over the world |
| 07:47 | ro_st | but not right now :-) |
| 07:47 | _nmmn | hehe =] |
| 07:47 | djcoin | lol, it seems you went a bit too far from my question. I just was asking this because I was planning to use CLojure for my next project and it involves a bit of e-commerce features |
| 07:48 | ro_st | well, what do you mean when you say e-commerce? |
| 07:48 | _nmmn | i see no problem doing it, i thought you meant more "full featured open source e-commerce framework" |
| 07:48 | ro_st | to me, it means cart + orders + payment integrations + backend to manage inventory, orders, store cms. |
| 07:49 | ro_st | that's no trivial amount of work |
| 07:49 | djcoin | I mean Choosing products, putting it in a caert, payments process etc. |
| 07:49 | ro_st | you asked for a library |
| 07:49 | ro_st | therefore i assumed you wanted a general purpose framework |
| 07:50 | ro_st | you can roll your own that matches your exact requirements quite easily. but then you're doing everything yourself. e-commerce is a mature space, now |
| 07:50 | djcoin | Well I'm not into e-commerce so I don't really know all the components etc. |
| 07:50 | djcoin | Yep |
| 07:51 | djcoin | payment stuff would be enought |
| 07:51 | ro_st | affiliate marketing tracking, coupons, analytics up to your neck, all the security concerns, etc |
| 07:51 | ro_st | i honestly think you'd be better served using a 3rd party turnkey system |
| 07:52 | ro_st | unless you have a burning desire to do this in clojure for no reason other than to do it in clojure |
| 07:52 | duck1123 | clojure would be an interesting system for something like that though, just be prepared to do a lot of work |
| 07:52 | antares_ | e-commerce has a lot of parts to it, for some Clojure makes a lot of sense, for others something like Spree (http://spreecommerce.com/) is a much more pragmatic choice today. |
| 07:52 | ro_st | if you're selling products (as opposed to say just a single once-off payment for a single thing), then users have come to expect quite a bit from the site doing the selling |
| 07:53 | ro_st | clojure'd be great for moving data around on the back, especially at scale |
| 07:54 | djcoin | Yep |
| 07:54 | djcoin | (+ I don't like/know ruby much :troll: :) ) |
| 07:54 | ro_st | but if you just want to sell stuff, you'd be far better served by shopify.com or spree |
| 07:54 | ro_st | spree is rails based but you don't have to touch the code to use it |
| 07:55 | ro_st | </sermon> |
| 07:55 | djcoin | Sure - but as a developer it is a pity to not be able to understand one of your key business component |
| 07:55 | djcoin | But why not |
| 07:55 | djcoin | THanks for your advice |
| 07:56 | duck1123 | So, in the interest of "no top-level atoms," If you had a java factory method, something that takes a long time to init and should only be called once, where would store that. Just a top-level var or is there some better way? |
| 07:57 | duck1123 | I currently have it in a var, but I want to revisit the decision before I move this out into it's own lib |
| 07:58 | ro_st | djcoin: i'm pretty sure that linux is a key business component of yours. do you understand it? hardware drivers? hardware itself? |
| 07:58 | antares_ | duck1123: an init function + a var and defonce |
| 07:58 | ro_st | i'm saying that e-commerce has gotten to the point where it's another layer beneath your application, rather than a part of it |
| 07:58 | ro_st | like databases or email |
| 07:58 | ro_st | it's solved. it works |
| 07:59 | djcoin | ro_st: yep - so i guess this stuff is really flexible |
| 07:59 | ro_st | rather spend your precious finite energy and time on something interesting |
| 07:59 | djcoin | cause I won't customize kernel driveres myself |
| 07:59 | duck1123 | antares_: a defonce inside the init? |
| 07:59 | ro_st | exactly |
| 08:00 | antares_ | duck1123: yes, and init can be called from -main |
| 08:01 | duck1123 | makes sense. I think I'll try that |
| 08:24 | stain | modprobe ecommerce |
| 08:28 | djcoin | x) |
| 08:47 | ro_st | yay managed to abstract xml wrangling away from the common clj/cljs code |
| 08:47 | ro_st | actually pretty easy to do in cljs, using goog.dom.xml |
| 08:49 | gtrak | is it easy to wrap jax-rs calls in a clojure jetty thing? |
| 08:50 | gtrak | a pre-existing jax-rs implementation, rather? |
| 08:52 | ro_st | jax-rs? wossat |
| 08:52 | gtrak | standardized REST annotations for java |
| 08:53 | gtrak | I guess i have to hook it up as servlet or something |
| 08:53 | ro_st | ah |
| 08:53 | ro_st | yeah probably |
| 08:53 | gtrak | silly java |
| 09:02 | wastrel | <3 |
| 09:12 | gtrak | anyone know how to wrap a servlet as a ring handler? |
| 09:12 | gtrak | (the opposite of what is usually done)? |
| 09:18 | wingy | anyone knows if it's possible to have a vector as a value in datomic? |
| 09:20 | jonasen | wingy: Vectors are not supported |
| 09:20 | wingy | jonasen: ok |
| 09:20 | wingy | problematic |
| 09:22 | jonasen | wingy: multi-valued attributes are supported (i.e. sets) |
| 09:22 | wingy | i c |
| 09:22 | wingy | that's what i really want i guess |
| 09:37 | ro_st | what's the simplest way to render a static html page with ring/compojure? |
| 09:38 | wmealing | slurp it, return it |
| 09:39 | wmealing | i havn't used ring or compojure |
| 09:39 | wmealing | but thats how i'd do it in noir |
| 09:39 | ro_st | simple enough |
| 09:40 | ro_st | just realised i have to inject one paltry dynamic value, so enlive it is |
| 09:40 | mikem | wmealing: a friendly hello! |
| 09:40 | wmealing | hi hi ! |
| 09:40 | mikem | will you be joining us at the meetup tomorrow? ;-) |
| 09:40 | wmealing | imagine meeting you here :) |
| 09:41 | wmealing | mikem, sadly.. i'm far away and can't fly there in time |
| 09:41 | wmealing | is there a clojure talk ? |
| 09:42 | wmealing | mikem, btw totally should have pimped lein harder in the talks .. |
| 09:42 | mikem | that's understandable. it's part 2 of a talk on agda, an insantely-strongly typed language for proofs |
| 09:42 | wmealing | who is giving that ? |
| 09:46 | juhu_chapa | Hi all! How do I pass a class to a method in clojure? i.e. foo(Class clazz) |
| 09:47 | Wild_Cat | juhu_chapa: Use the class directly. |
| 09:47 | mikem | wmealing: a chap named Gergo Erdi |
| 09:47 | wmealing | (function Class) ? |
| 09:47 | Wild_Cat | ,(str Integer) |
| 09:47 | clojurebot | "class java.lang.Integer" |
| 09:48 | mikem | wmealing: anyway I gotta run. catch you later |
| 09:48 | wmealing | later mate. |
| 09:49 | juhu_chapa | thanks to all! |
| 09:49 | gtrak | can you live-update dependencies in lein2 yet? |
| 09:50 | antares_ | gtrak: what do you mean by live-update? |
| 09:50 | gtrak | add a new one and have it come into the classpath during a swank session |
| 09:50 | antares_ | no, I don't think so |
| 09:50 | antares_ | it is something that should be supported by lein-swank |
| 09:58 | ro_st | how do i ensure that lein ring server will reload changes to source files? |
| 10:04 | wmealing | test ? |
| 10:05 | ro_st | well, it's not doing so at the moment. how do i make it do so? or am i mistaken in thinking that it supports this |
| 10:18 | clgv | ro_st: you might check how noir does it. with noir you would use "lein run" so the code in -main must be indirectly responsible |
| 10:20 | ro_st | ah, that makes sense |
| 10:20 | ro_st | thanks for the tip. i'll check it out. |
| 10:21 | ro_st | btw, enlive/enfocus is a fantastic way to do markup templating. really enjoying it |
| 10:36 | gtrak | ugh, does anyone else's emacs crash on autocomplete sometimes? |
| 10:45 | Cheiron | Hi, how to add elements to a vector inside doseq ? http://pastie.org/4330455 |
| 10:45 | llasram | Cheiron: You don't |
| 10:46 | llasram | Cheiron: More helpfully, you probably want `reduce` instead |
| 10:46 | Cheiron | i need to collect elements issued by (items-generator) |
| 10:46 | llasram | gtrak: Actually... no. I'm honestly having a difficult time remembering the last time Emacs crashed on me |
| 10:47 | gtrak | llasram: hmm... it seems to be a regular thing for me on ubuntu snapshots, I could try starting over |
| 10:47 | wingy | ro_st: what project are you working on? |
| 10:47 | clgv | Cheiron: use (into [] (items-generator)) |
| 10:47 | ro_st | wingy: v2 of www.cognician.com |
| 10:48 | ro_st | v1 is flex/air -puke- |
| 10:48 | Cheiron | then (items-generator) is going to be called twice, once for into and once for doseq |
| 10:48 | nDuff | Cheiron: Not if you store the sequence once. |
| 10:48 | nDuff | Cheiron: (let [items (items-generator)] ...) |
| 10:48 | ro_st | v1.5 is google closure javascript, now abandoned at 10kloc. rewrote about 80% of it in clojurescript in about 2 weeks. 1.5kloc. |
| 10:49 | clgv | Cheiron: or simply (vec (items-generator)) - you have to remove the doseq. doseq is only for side effects |
| 10:49 | nDuff | Cheiron: ...that will cache the sequence coming from the generator, so you can doseq over it once for your intended side effect ("send item to other function"), and concatenate it to the vector the usual/natural way. |
| 10:50 | nDuff | clgv: I gather that Cheiron _does_ intend some side effects, according to the comments in that code, but just shouldn't be trying to do the concatenation an the same time. |
| 10:50 | duck11231 | Cheiron: if you combine doall and for, you get something like doseq, but it'll collect the returns |
| 10:50 | wingy | ro_st: cool |
| 10:51 | Cheiron | too many techniques .. what to choose? |
| 10:52 | clgv | Cheiron: the simplest^^ |
| 10:53 | semperos | Cheiron: I think the bottom line is, doseq is *only* for side-effects |
| 10:53 | clgv | Cheiron: how about (let [v (vec (items-generator))] (doseq [e v] (side-effect e)) v) ? |
| 10:55 | clgv | Cheiron: (reduce #(conj %1 (side-effect %2)) [] (items-generator)) would work as well if the side-effect fn returns the parameter at the end |
| 10:55 | Cheiron | you are scaring me xD |
| 10:56 | semperos | the more you practice with reduce, the less scary it becomes :) |
| 10:56 | nDuff | Cheiron: We don't know the details of _why_ you want to do what you're asking about, either; without context, there's a good chance that all our suggestions are suboptimal. |
| 10:56 | ro_st | reduce is actually quite simple. you just have to write a couple |
| 10:57 | pjstadig | clgv: for that matter (into [] (map side-effect (items-generator))) |
| 10:57 | pjstadig | whenever you see (reduce conj ...) think (into ...) |
| 10:58 | Cheiron | i'm coding storm topology, i want to emit items one by one to another bolt, and then I want to emit the vector that contains the items to another bolt :) |
| 10:58 | pjstadig | or i do anyway |
| 10:59 | llasram | gtrak: Ah. I'm still on emacs 23. I was planning on switching now that there are official Debian emacs 24 packages... |
| 10:59 | gtrak | hmm |
| 10:59 | wingy | ro_st: lol |
| 10:59 | wingy | ro_st: i like Adobe's Illustrator though |
| 10:59 | nDuff | Cheiron: (let [your-seq (items-generator)] (map emit-item your-seq) (vec your-seq)) |
| 10:59 | nDuff | ...err, not that. |
| 11:00 | ro_st | wingy: um? |
| 11:00 | nDuff | needs a doall around the map |
| 11:00 | nDuff | otherwise it's lazy and doesn't get executed... but the point is that you don't even need a doseq. |
| 11:00 | wingy | ro_st: is it for your company? |
| 11:00 | pjstadig | and if you're using seqs for side-effects you might need to worry about chunking |
| 11:00 | wingy | Adobe is doing flex/air i guess |
| 11:00 | pjstadig | if items-generator generates a chunked seq it will be realized in chunks of 32 instead of one at a time |
| 11:09 | duck11231 | is there a built in unchunker yet? I have a "lazier" function in my code, just wondering if I can replace it yet |
| 11:11 | duck11231 | ro_st: cognician seems pretty neat. I'll have to play with it a bit more later |
| 11:13 | ro_st | hey cool. v1 sucks quite a bit, now, but the concept is there |
| 11:14 | ro_st | it's been in production for about 18months. i've been furiously working on V2 in google closure javascript, and wanting to hari-kiri myself all the way because of how painful it is |
| 11:14 | ro_st | thanks to clj+cljs, that bus has stopped :-) |
| 11:17 | ro_st | we were going to use rails on the backend but i just couldn't bring myself to do it. then clojurebook.com landed |
| 11:17 | duck11231 | So were you doing it in Google Closure before you discovered Clojure, or did cljs influence that decision? |
| 11:17 | ro_st | the former |
| 11:18 | ro_st | because i wanted great js performance. C2 has to run on mobile and desktop |
| 11:19 | eduard | help, lein run results in this: http://pastie.org/private/bk8zpftlhz116vefoh2g9w |
| 11:19 | ro_st | the closure compiler produces seriously tiny js |
| 11:19 | eduard | java.lang.RuntimeException: EOF while reading, starting at line 1 |
| 11:21 | wingy | what do you guys think about http://opalang.org/ |
| 11:23 | wingy | it's quite impossible for hackers to get your frontend code once it has gone through advanced compilation with closure compiler? |
| 11:24 | ro_st | they can pretty print it and try to make sense of it |
| 11:24 | nDuff | wingy: It's about equivalent to any other kind of obfuscated decompilation process. |
| 11:24 | ro_st | but they'd probably have much better luck just re-coding it based on using the app |
| 11:24 | wingy | ro_st: yeah so i've thought |
| 11:24 | clgv | "opalang running on node.js" *shivers* |
| 11:25 | ro_st | let's be honest, the value isn't in the code, it's in the code + the ecosystem around it |
| 11:25 | wingy | ro_st: you are talking about opalang or the compilation? |
| 11:25 | ro_st | the compilation |
| 11:26 | wingy | ro_st: indeed |
| 11:26 | nDuff | ro_st: ${deity}, but it's hard to get management to realize that some times. |
| 11:26 | solussd | opinion solicitation: do authorization checks in a Noir webapp belong in the view or in the model? If in the model I'm planning on creating auth "contexts" using a dynamic var that the model can check for to filter results. thoughts? |
| 11:27 | ro_st | is that some sort of emoticon my client can't render? :-) |
| 11:27 | wingy | ro_st: im not worried about they will read the code and copy it .. but that they find some security flaws |
| 11:27 | wingy | and exploit them |
| 11:27 | nDuff | wingy: They can do that without reading the source. |
| 11:27 | ro_st | solussd: both, i should think. model to verify access and link user, view to control what's presented |
| 11:27 | duck11231 | ro_st: your irc client is an atheist |
| 11:28 | ro_st | no wonder we get along so well |
| 11:28 | ro_st | -grin- |
| 11:28 | wingy | nDuff: analyzing the in and out data? |
| 11:28 | nDuff | *nod* |
| 11:28 | nDuff | Easiest place to attack are the entry/exit points. Trivial to modify HTTP requests on their way out and responses on their way in. |
| 11:29 | wingy | yeah |
| 11:39 | duck11231 | So would source map support be bad for javascript security (through obscurity) |
| 11:41 | wingy | cljs is so nice |
| 11:41 | nDuff | duck1123: Indeed. |
| 11:42 | wingy | what is the best way to contribute to clj/cljs as a big company? |
| 11:44 | samaaron | is it possible to specify method param names whilst using gen-class or gen-interface using metadata? |
| 11:44 | nDuff | wingy: Getting your developers permission (and paperwork) to contribute upstream, at a minimum. Hiring Relevance for training/support/whatnot wouldn't hurt, either. |
| 11:44 | Cheiron | it is me again :) how to morph this naive code into idiomatic clj code? forgive my ignorance http://pastie.org/4330790 |
| 11:44 | Cheiron | i'm still learning |
| 11:45 | wingy | nDuff: how is hiring Relevance helping clj? |
| 11:45 | nDuff | wingy: Look at who they employ. |
| 11:45 | nDuff | wingy: ...hint: http://clojure.com/about.html |
| 11:46 | wingy | cool |
| 11:47 | wingy | is Relevance behind datomic as well? |
| 11:47 | nDuff | *nod* |
| 11:48 | wingy | are you at Relevance? |
| 11:48 | nDuff | No. |
| 11:48 | wingy | Relevance is quite cool |
| 11:49 | duck11231 | they seem like they would be an awesome company to work for |
| 11:49 | wingy | definitely hiring Relevance for expertise help when the time has come |
| 11:53 | llasram | Cheiron: What are you trying to achieve? |
| 11:54 | Cheiron | the code i posted is obviously a mapping from imperative style |
| 11:54 | clgv | Cheiron: you can do that shorter via `:let` within doseq |
| 11:55 | Cheiron | i want to code in idiomatic clojure functional way |
| 11:55 | clgv | Cheiron: your `let` doesnt do anything in its body? |
| 11:56 | Cheiron | it does but i didn't include it , i want to add new-col to a vector defined earlier |
| 11:57 | Cheiron | same issue we talked about earlier |
| 11:57 | Cheiron | but i noted there is a doseq with a doseq, obviously not a good code |
| 12:01 | jbarrios | hmm, given a list of keywords and a hash, what's the idiomatic way of checking that every keyword in the list is a key in the hash? |
| 12:01 | llasram | Cheiron: And like before, `doseq` just flat out won't let you build up a vector |
| 12:01 | llasram | Cheiron: In your example, which is the value you want to emit immediately, and which is what you're trying to build into a vector? |
| 12:02 | clgv | Cheiron: you could write it like that https://www.refheap.com/paste/3779 |
| 12:03 | clgv | Cheiron: that still doesnt address returning the vector though. just rewriten your nested doseq with interleaved let |
| 12:03 | antoineB | hello, i would like a for like function that let me do println? |
| 12:04 | Cheiron | clgv: i will post what i'm trying to do. |
| 12:05 | duck11231 | antoineB: doseq, unless you want the result, then doall+for |
| 12:06 | semperos | is there an idiom for using Clojure records with core.logic? when I do unification with them, I end up with "downgraded" Clojure maps instead of my original records |
| 12:07 | antoineB | duck11231: thanks |
| 12:07 | duck11231 | doall will force a lazy seq and return it, dorun will just force the seq |
| 12:08 | duck11231 | doseq is like dorun+for |
| 12:08 | semperos | jbarrios: (every? #(contains? your-hash %) list-o-keywords) |
| 12:08 | semperos | ,(every? #(contains? {:foo "abc" :bar "def"} %) [:foo :bar]) |
| 12:08 | clojurebot | true |
| 12:08 | semperos | ,(every? #(contains? {:foo "abc"} %) [:foo :bar]) |
| 12:08 | clojurebot | false |
| 12:09 | jbarrios | semperos: thanks :) I came up with something similar. |
| 12:09 | semperos | nice |
| 12:09 | jbarrios | semperos: but I had to rethink it because I need to report which keys are missing |
| 12:09 | semperos | reduce sounds good for that |
| 12:10 | duck11231 | or validateur |
| 12:11 | Cheiron | clgv: kindly have a look http://pastie.org/4330899 |
| 12:11 | pbostrom | jbarrios: you can also convert the list and keys to sets and use intersection and difference |
| 12:16 | clgv | Cheiron: couldnt do much with the `bolt` function: https://www.refheap.com/paste/3780 |
| 12:17 | Cheiron | send-task send tasks one by one to a topic, send-tasks sends the vector of tasks to another topic |
| 12:21 | duck11231 | Cheiron: how about this? https://www.refheap.com/paste/3781 |
| 12:22 | Cheiron | clgv: duck11231: wow, both are neat! |
| 12:23 | clgv | duck11231: but send-task has to return the task then |
| 12:23 | clgv | you can skip the `doall` because of `(into [])` |
| 12:24 | duck11231 | fine, then just add task at the end of the for loop |
| 12:24 | clgv | or that ^^ |
| 12:24 | duck11231 | clgv: right, he probably doesn't actually need it to be a vector anyway though |
| 12:24 | Cheiron | just one more thing (i'm sorry) . customize function has two parameters (defn customize [item object]) |
| 12:25 | Cheiron | what to change in (mapcat #(->> % customize :sheets (map task-factory)) (:items object)) |
| 12:25 | Cheiron | for customize function since it takes two paramters? |
| 12:26 | clgv | #(->> % customize :sheets (map (fn [i] (task-factory i, object)))) |
| 12:27 | duck11231 | (partial customize item) or (fn [item] (customize item object)) ;; since you can't nest #() |
| 12:27 | duck11231 | is % item or object? |
| 12:28 | jweiss | will lpetit's suggestion actually work (to define your own print-method multimethod): https://groups.google.com/forum/?fromgroups#!topic/clojure/7yg07Fk3uuw |
| 12:28 | jweiss | seems to me that pprint will always dispatch to clojure.core/print-method no matter what else you add. |
| 12:28 | Cheiron | thank you all for the great help, i will try those right now |
| 12:36 | pandeiro | in lein-newnew is there a way to spit out a file without doing (render "foo.clj" data), for when the file is just being copied, not interpolated with data? |
| 12:40 | pandeiro | ah found it in the docstring for renderer, nice |
| 12:50 | SegFault1X|work2 | Good morning. |
| 13:02 | dnolen | emezeske: ping |
| 13:12 | emezeske | dnolen: pong |
| 13:14 | dnolen | emezeske: I made a ticket for the pr issue. It looks pretty simple - port over the approach from core_print.clj |
| 13:14 | dnolen | emezeske: no lazy seqs - loop / recur |
| 13:15 | emezeske | dnolen: ah, cool |
| 13:15 | emezeske | dnolen: I was looking at that a bit last night |
| 13:15 | ibdknox | dnolen: how'd your class go? :) |
| 13:16 | dnolen | ibdknox: it went well! light table works great - didn't really run into any issues. |
| 13:16 | emezeske | dnolen: I was kind of thinking that passing the StringBuffer down through the -pr-str calls would be the most efficient thing to do |
| 13:16 | ibdknox | dnolen: awesome :D |
| 13:16 | dnolen | emezeske: that's basically what core_print.clj does with the Writer. |
| 13:17 | emezeske | dnolen: cool, makes sense. I did a bit of profiling, and the concats seemed to dominate runtime |
| 13:17 | dnolen | emezeske: yep |
| 13:18 | dnolen | emezeske: serialization in CLJS should be blazing fast IMO. Ideally should not be so far away from JSON encode/decode |
| 13:18 | emezeske | dnolen: I agree -- one of the big bonuses for me, making a webapp, is easily shooting forms back and forth between the clj server and cljs client |
| 13:19 | emezeske | dnolen: Which has worked great for me so far, until a) I decided to support IE8 and b) my datastructure got a bit bigger |
| 13:19 | emezeske | dnolen: I'm pretty certain that the non-lazy StringBuffer approach will make things perfectly usable speed-wise |
| 13:20 | dnolen | emezeske: for sure. |
| 13:20 | dnolen | emezeske: if I get a patch I'll apply it quickly. I'm sure a lot of people are feeling the pain of this one. kovasb has mentioned it several times ;) |
| 13:21 | emezeske | dnolen: I might be able to work on that tonight |
| 13:21 | emezeske | dnolen: It seems like it really shouldn't be much work |
| 13:23 | emezeske | dnolen: I can't seem to find the "is it fast" page that had all the benchmarks. I wonder if pr-str is on there? |
| 13:27 | dnolen | emezeske: it is not, read-string is I believe. We should add pr-str benchmark. |
| 13:34 | clopamine | question: using eclipse+ccw(lein2): how to have "myjavalib.java " in the same leiningen-project as clj-files? I've tried something, but java classes don't compile. any help is appreciated? |
| 13:42 | clopamine | There has got to be a way to have one leiningen 2-project first compile all java-files and then doing the normal clojure-things, who can use those compiled java-classes... I just haven't found the instructions |
| 13:44 | hxiao | clopamine: java-source-paths in project.clj |
| 13:45 | hxiao | http://stackoverflow.com/questions/5432163/java-and-clojure-with-leiningen |
| 13:46 | clopamine | hxiao: I tried to play a little with that, but it's not working for me... maybe some example would help |
| 13:46 | hxiao | I have a project where I have my java classes in the java directory |
| 13:46 | hxiao | so in my project.clj I have this line |
| 13:46 | hxiao | :java-source-paths ["java"] |
| 13:47 | clopamine | ok thanks... where do the class-files go? |
| 13:48 | hxiao | In target/classes |
| 13:50 | clopamine | you have package-directories under "java" or java-files straight at root? |
| 13:50 | hxiao | package directories |
| 13:50 | hxiao | just like a normal maven project |
| 13:52 | hxiao | the class files under target/classes will also show up with package directories |
| 13:54 | clopamine | hmm... build does nothing about that for me... I am using "leiningen"-project in eclipse+ccw ... do I need to set up some more lines in project.clj? |
| 13:55 | clopamine | Only classes I get are some clojure-generated in "classes"-dir |
| 13:55 | hxiao | which version of leiningen are you using |
| 13:56 | hxiao | and i'd try building on the command line too just to see what happens |
| 13:57 | clopamine | the version that comes with counterclockwise 2.0.0 I guess... however I don't have access to lein or lein2 in my shell (newly installed linux) |
| 13:58 | hxiao | hmm |
| 13:59 | clopamine | The command has to be somewhere, not just in my "bin"-path |
| 14:00 | hxiao | what do you mean? don't you just add the script to your path and self-install if necessary? |
| 14:01 | clopamine | That's what I did last time, yes. But this time I just installed ccw-plugin to eclipse and it "installed" leiningen |
| 14:01 | hxiao | huh ... and what does ccw do when you build it? lein install? uberjar? |
| 14:02 | clopamine | would not like to have to versions so my first option is to find the command and add symlink or something to my bin |
| 14:02 | clopamine | it complies clj files |
| 14:03 | clopamine | no uberjar, just ahead of time things I guess... project works fine without build |
| 14:04 | clopamine | but you may be right, and this eclipse only approach is not mature yet, and I better get my hands dirty with the command line version |
| 14:07 | clopamine | hxiao: anyway thanks for trying to help, appreciate it. |
| 14:07 | hxiao | np |
| 14:07 | hxiao | just doing lein compile won't work, so that's probably what's happening |
| 14:08 | clopamine | what is missing... some kind of "lein javac java-stuff?" |
| 14:09 | hxiao | yeah, lein javac |
| 14:10 | hxiao | actually, i thought lein compile did a lein javac as long as you had the source paths specified |
| 14:10 | hxiao | so i must be talking out of my rear end ... i never used ccw so it's hard for me to help |
| 14:12 | clopamine | heh, well it seems that ccw:s support for lein2 in "stable"-version is about on emonth old... they may have all kinds of bugs |
| 14:15 | cemerick | clopamine: I've been using it since the start; been solid as a rock. |
| 14:15 | cemerick | I'd actually recommend using the beta channel, as the code completion work that's been going in there lately has been stellar. |
| 14:17 | cemerick | But, it'll take years before any IDE or editor's Leiningen support will supplant using lein on the command line. |
| 14:17 | antares_ | more likely leiningen itself will develop into a good IDE |
| 14:17 | clopamine | ok thanks, I just don't know how to do that, yet :) I really don't have any kind of feeling of mastery yet... I'll try to find the command and use it from command line (at least when it's needed) |
| 14:19 | cemerick | antares_: goodness, why? |
| 14:20 | antares_ | cemerick: I am kidding, I am pretty sure lein is pretty feature complete by now :) |
| 14:20 | cemerick | whew ;-) |
| 14:20 | antares_ | but it does take IDEs forever to develop and mature |
| 14:22 | jrheard | hi folks: clojure noob here, working through `clojure programming` and starting off with a few project euler problems. |
| 14:22 | jrheard | long story short: i want http://richhickey.github.com/clojure-contrib/math-api.html#clojure.contrib.math/abs , i see that clojure-contrib has been broken up |
| 14:22 | lazybot | Nooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/math-api.html#clojure.contrib.math/abs and try to stop linking to rich's repo. |
| 14:22 | jrheard | gladly! |
| 14:22 | antares_ | stupid lazybot :) |
| 14:23 | jrheard | and so anyway i see it's moved to https://github.com/clojure/math.numeric-tower |
| 14:23 | jrheard | and i cannot for the life of me figure out how to get that library and use it in my project. |
| 14:23 | antares_ | jrheard: http://dev.clojure.org/display/doc/Clojure+Contrib |
| 14:23 | jrheard | sure |
| 14:23 | jrheard | that's how i found the numeric-tower link; but how do i tell leiningen what i want? |
| 14:24 | jrheard | i want to tell it: get me the numeric-tower library |
| 14:24 | jrheard | make it available to my code |
| 14:24 | jrheard | and my google-fu has failed me thus far in figuring out how the hell to do that |
| 14:24 | antares_ | jrheard: you need to depend on org.clojure/math.numeric-tower |
| 14:24 | jrheard | sweet. |
| 14:24 | jrheard | was there any way i could have figured that out myself? some doc page i didn't find? |
| 14:24 | antares_ | for clojure "contrib" it is org.clojure/[library name] |
| 14:24 | jrheard | also how do i know what version to tell it? |
| 14:25 | antares_ | jrheard: for contribut specifically, you can just search search.maven.org |
| 14:25 | jrheard | <3 |
| 14:25 | antares_ | most of 3rd party libraries are on clojars.org |
| 14:25 | jrheard | that makes sense, i was wondering why clojars wasn't turning up any contrib stuff |
| 14:25 | jrheard | didn't know about the maven url |
| 14:25 | jrheard | ah i see it now |
| 14:25 | jrheard | http://search.maven.org/#search%7Cga%7C1%7Cnumeric-tower |
| 14:25 | antares_ | finally, decent projects with documentation (like clojurewerkz.org) mention dependency lines in the getting started guide or something like that |
| 14:25 | jrheard | antares_: you are the best. |
| 14:26 | jrheard | thanks so much :) |
| 14:26 | antares_ | jrheard: this is not the only repository where artifacts can be released. There is also oss.sonatype.org |
| 14:26 | antares_ | jrheard: if you want something from sonatype, you need to add it to the :repositories list like so: https://github.com/michaelklishin/monger/blob/master/project.clj#L53-58 |
| 14:27 | jrheard | interesting |
| 14:27 | jrheard | once i do that lein search will also scan sonatype? |
| 14:27 | antares_ | that's about it, it is very unlikely that any OSS Clojure libraries are released to a repo other than clojars, Maven Central or sonatype |
| 14:27 | jrheard | sweet |
| 14:28 | antares_ | jrheard: supposedly, lein search needs some improvement (assuming you use lein2, which I'd highly recommend) |
| 14:28 | jrheard | i've got whatever `brew install lein` gave me |
| 14:28 | antares_ | that's almost certainly 1.7 |
| 14:28 | antares_ | it's ok for now |
| 14:28 | jrheard | cool |
| 14:28 | antares_ | or you can easily install lein2, see leiningen.org |
| 14:28 | jrheard | will do |
| 14:29 | antares_ | just download 1 script, put it on PATH and run ./lein self-install |
| 14:29 | jrheard | rad |
| 14:29 | hxiao | lol i had no idea lazybot did that |
| 14:29 | hxiao | warned people about contrib |
| 14:29 | jrheard | http://richhickey.github.com/foo |
| 14:29 | lazybot | Nooooo, that's so out of date! Please see instead http://clojure.github.com/foo and try to stop linking to rich's repo. |
| 14:29 | hxiao | haha |
| 14:30 | llasram | (inc lazybot) |
| 14:30 | lazybot | ⇒ 7 |
| 14:30 | clopamine | cemerick: I can't find the lein-command that ccw installed... do you have any idea in how much trouble will I be if I "script self-install" another copy of it in my ̃/bin ? |
| 14:30 | jrheard | seriously though +1 to "try to stop linking to rich's repo" - turns up on the top of google results every single time |
| 14:30 | jrheard | anyway thanks again antares_! |
| 14:30 | antares_ | jrheard: you are welcome |
| 14:31 | cemerick | clopamine: The ccw lein support is self-contained; it doesn't install a `lein` script for use on the command line. |
| 14:31 | hxiao | clopamine: if you don't have lein available right now in your command line you should be in any type of trouble |
| 14:31 | hxiao | well there you go |
| 14:31 | hxiao | shouldn't* |
| 14:32 | clopamine | both: ok thanks. I will get the real deal then |
| 14:35 | clopamine | hey, before I do this workaround, should I report this kind of problem with ccw-lein somewhere? |
| 14:36 | clopamine | (problem meaning that it may be possible, but not out of the box, or easily findable) |
| 14:38 | antares_ | clopamine: CCW or leiningen mailing lists are good candidates to report usability complaints |
| 14:39 | clopamine | antares_: ok will put a todo-task to figure out how to use those mailing lists |
| 14:41 | jrheard | antares_: one more question - https://gist.github.com/26b053138d8cd7945a30 has my project.clj and a small bash session; `lein repl` doesn't complain about the .clj file but it didn't seem to go out and grab the library, and i can't seem to :require it |
| 14:41 | jrheard | i could just write my own dang #'abs function but i'd love to figure out how to use libraries |
| 14:42 | antares_ | jrheard: it is clojure.math.numeric-tower |
| 14:43 | antares_ | I think all new contrib libraries use clojure.* namespaces |
| 14:43 | jrheard | hm, the :require line still blows up in the same way |
| 14:43 | jrheard | or did i get the project.clj line wrong? |
| 14:43 | antares_ | jrheard: in the repl you need to use (require …) |
| 14:43 | antares_ | the function |
| 14:43 | jrheard | blorg, same behavior |
| 14:43 | antares_ | not the (ns …) macro arguments that use :keywords |
| 14:43 | jrheard | oh that makes sense though |
| 14:43 | jrheard | i was wondering about that distinction |
| 14:44 | antares_ | (require '[clojure.math.numeric-tower :as math]) |
| 14:44 | jrheard | okay, now we're getting somewhere - java.io.FileNotFoundException: Could not locate clojure/math/numeric_tower__init.class or clojure/math/numeric_tower.clj on classpath: (NO_SOURCE_FILE:0) |
| 14:44 | jrheard | so quoting it suppressed evaluation so the require function got the actual symbol, i think i followed that |
| 14:45 | antares_ | jrheard: lein should have downloaded dependencies, can it be that you had the repl open before you added the dependency? |
| 14:45 | antares_ | you can always run lein deps on your own |
| 14:45 | jrheard | nope, i keep restarting it |
| 14:45 | jrheard | i'll try lein deps |
| 14:46 | jrheard | ah! it couldn't find my project.clj because i was running it from one directory away. fantastic! the require call works, everything is good, i'll stop bugging you :) thanks again! |
| 14:46 | antares_ | any command should trigger dependency check first |
| 14:47 | ikg | komy +1 |
| 14:47 | antares_ | jrheard: by the way, feel free to bump clojure to 1.4.0 |
| 14:47 | jrheard | will do |
| 14:59 | clopamine | hxiao: yep, one "lein javac" did the trick |
| 14:59 | hxiao | hooray |
| 15:03 | solussd | does anyone know if and what version Monger supports DBRefs ? |
| 15:06 | a|i | which clojure web framework works well on appengine? |
| 15:06 | ro_st | a|i: this talk might interest you http://www.infoq.com/presentations/Clojure-in-the-Clouds |
| 15:09 | a|i | ro_st: thanks, what I want to know is, if there is any clojure web framework which actually supports appengine's datastore. |
| 15:09 | ro_st | https://github.com/smartrevolution/clj-gae-datastore |
| 15:10 | ro_st | web frameworks don't deal with databases |
| 15:10 | ro_st | they deal with http, routing, and templating, mostly |
| 15:10 | a|i | ro_st: last commit: 11 months ago :( |
| 15:11 | ro_st | i suggest doing some reading |
| 15:11 | ro_st | you should be able to find something that works well |
| 15:11 | a|i | thanks. |
| 15:12 | locojay1 | hi how can i do a jquery $(this) with jayq when inside a delegated function. (js* "this") will not give me a jq selector |
| 15:18 | antares_ | solussd: Monger partially supports dbrefs |
| 15:18 | antares_ | solussd: it will load existing dbrefs and represent them in a way that you can @deref |
| 15:18 | antares_ | but that's it |
| 15:18 | antares_ | and as far as I know, DBRefs are not supported by all clients and are semi-deprecated |
| 15:18 | antares_ | so we did not add any other support for them so far |
| 15:18 | pbostrom | locojay1: (this-as x (-> ($ x) (...))) |
| 15:20 | locojay1 | thanks was thinking of using jQuery constructor on elem (js * "this") |
| 15:20 | acagle | Just upgraded nrepl.el to 0.1.2 and now nrepl-jack-in never returns the REPL. Are there any new requirements for using nrepl in Emacs? I can't find anything on the github site for nrepl.el |
| 15:24 | locojay1 | pbostrom don't understand your code lets say i have (jq/delegate "#id tbody" "tr" :click (fn [] (<need to get tr element in jq form>))) i gess (js/jQquery (js * "this")) should do it |
| 15:26 | duck1123-work | locojay: there's a fn (macro?) called this-as that'll take a symbol that you bind "this" to. (this-as my-reference-to-this ...) |
| 15:26 | locojay1 | ah thanks |
| 15:27 | pbostrom | locojay1: (jq/delegate ... :click (fn [] (this-as thing-clicked (-> ($ thing-clicked) (some-jq-function) (some-other-jq-fn)))) |
| 15:28 | locojay1 | pbostrom : thanks got it |
| 15:30 | gfredericks | duck1123-work: if it's used the way you showed it'd have to be a macro |
| 15:31 | duck1123-work | gfredericks: that's what I figured, but then again, js is funny sometimes |
| 15:33 | duck1123-work | Does clojurescript support the Closure annotations? I got some errors the other day when I tried to compile my cljs as advanced and the docs I found stated that I needed to mark my fn as a constructor |
| 15:40 | ro_st | dnolen told me that it doesn't |
| 15:40 | ro_st | back when i first asked |
| 15:42 | dnolen | ro_st: duck1123-work: patch welcome |
| 15:43 | ro_st | as a test, i stripped out all the jsdocs from my gclosure codebase |
| 15:43 | ro_st | the size difference between the two advanced mode js files was < 1% |
| 15:43 | dnolen | duck1123-work: not for annotations in general but something for the constructor case if this is a real issue. |
| 15:44 | duck1123-work | I'll have to see if I can make a reproducable test case when I get home. |
| 15:46 | gfredericks | &(nth (iterate list ()) 2000) |
| 15:46 | lazybot | java.lang.StackOverflowError |
| 15:47 | gfredericks | &(-> (iterate list ()) (nth 2000) flatten count) |
| 15:47 | lazybot | ⇒ 0 |
| 15:52 | gfredericks | (shuffle (range 100)) |
| 16:04 | rainerschuster | how can i make this function automatically close the reader after the lazy-seq, which read-csv returns, is consumed? |
| 16:04 | rainerschuster | (defn load-csv [filename] |
| 16:04 | rainerschuster | (let [in-file (io/reader filename)] |
| 16:04 | rainerschuster | (csv/read-csv in-file :separator \tab))) |
| 16:05 | antares_ | rainerschuster: http://clojuredocs.org/clojure_core/clojure.core/with-open |
| 16:06 | rainerschuster | if i use with-open the reader is close imediately and I'm not able to do something usefull what is returned from load-csv |
| 16:06 | amalloy | rainerschuster: that's an immensely hard problem that clojure doesn't try to solve |
| 16:07 | amalloy | you need to do your processing of load-csv from inside the with-open block, rather than returning it outside |
| 16:07 | rainerschuster | but thats what i'm used to ... |
| 16:07 | rainerschuster | im interested in solving the problem from the outside |
| 16:07 | rainerschuster | i know how to do it in c#, python or f# ... |
| 16:08 | amalloy | it's easy enough to close the reader when the entire seq is consumed. but what if you do a (take 10) of the seq? then it never gets consumed, and never closed |
| 16:08 | rainerschuster | yes indeed! |
| 16:08 | rainerschuster | thats what the GC does for me in other languages |
| 16:09 | amalloy | so go do it in c# or python or f#, then. they're all just as wrong, if they pretend that you can rely on garbage collection to close resources for you |
| 16:09 | rainerschuster | :) |
| 16:09 | amalloy | see http://blogs.msdn.com/b/oldnewthing/archive/2010/08/09/10047586.aspx if you're interested in the philosophy of gc |
| 16:10 | rainerschuster | so your proposal is to fix data.csv to be able to take a filename and automatically creating and closing the reader? |
| 16:11 | rainerschuster | i do understand that i have to do it from the inside. i thought there is some macro trickery thats already done |
| 16:12 | antares_ | rainerschuster: making data.csv support your case would be the best |
| 16:18 | emezeske | rainerschuster: In what language does the GC close resources such as files for you? |
| 16:18 | Wild_Cat | emezeske: in Python (CPython anyway) it does. I think it does in Java too, but I could be wrong, |
| 16:18 | emezeske | rainerschuster: I thought that doing that was generally a bad idea, as you don't know when the GC will collect, etc |
| 16:19 | emezeske | Wild_Cat: You should never rely on that though, right? What if you open tons of files, and the GC doesn't run? |
| 16:19 | rainerschuster | (emezeske): yes. and I was wrong. I've used the very same pattern in F# before http://fssnip.net/3T |
| 16:19 | Wild_Cat | emezeske: it's less an issue in Python because the GC is only a last-resort thing -- most of the time the refcounter closes the file the instant you lose the last reference to it. |
| 16:19 | Wild_Cat | it is however, bad practice to rely on that |
| 16:20 | Wild_Cat | the right way to use files in Python is "with open("foo") as my_file: # do stuff" |
| 16:20 | rainerschuster | in pyton I'm using with too, but there i've got generators i can use and yield |
| 16:20 | Wild_Cat | (the file is guaranteed to be closed when exiting the with block, even with an error) |
| 16:20 | alvin-x | When i'm dealing with tiny files (f.ex., loading a property file or .xsd from the classpath), I copy it to a byte array (ByteArrayInput/OutputStream) and close the original stream/reader asap. |
| 16:20 | emezeske | Yes, with is the right way in python |
| 16:21 | rainerschuster | so with-open is the right one in java. |
| 16:21 | emezeske | Right, but with laziness things are much more complicated, a la amalloy's notes |
| 16:21 | amalloy | emezeske: the same should be true of python's generators |
| 16:21 | rainerschuster | so i've to extend data.csv in order to support the case where I only want to specify the filename |
| 16:22 | emezeske | amalloy: Definitely |
| 16:22 | emezeske | amalloy: Leave the with block, while keeping a reference to a generator that has a reference to the open file, and boom |
| 16:22 | rainerschuster | read-lines from contrib is the right pattern |
| 16:23 | amalloy | no, read-lines is disastrous, which is why it didn't get promoted to clojure.java.io |
| 16:23 | amalloy | it has exactly the same problem with GC and resource handles |
| 16:24 | rainerschuster | so how can i create a function where I only serve in a filename and want to retun a lazy-seq? |
| 16:24 | rainerschuster | i don't |
| 16:25 | rainerschuster | i've to always be aware of the resources and how to read them |
| 16:25 | rainerschuster | so how can i abstract the knowledge ot the readersources away? |
| 16:27 | antoineB | i am wondering if it is possible with ring to send response when i want? (a response wich is not responding to a request) |
| 16:27 | amalloy | (defn read-safely [filename f] (with-open [r (reader filename)] (f (line-seq r)))) works if you don't allow f to be lazy. you have to force eager evaluation to happen inside the dynamic scope of with-open |
| 16:27 | dnolen | rainerschuster: open problem, http://dev.clojure.org/display/design/Resource+Scopes |
| 16:27 | rainerschuster | so thats the point that anoys me |
| 16:28 | amalloy | unlucky, mate. sounds like clojure is reminding you that sloppily-written resource handling causes incorrect programs |
| 16:28 | emezeske | rainerschuster: How is it supposed to magically know that you are done with the lazy sequence? |
| 16:29 | Raynes | amalloy: Hurr hurr you said mate. |
| 16:29 | amalloy | /ignore Raynes |
| 16:30 | rainerschuster | I've allready realized what you suggested. |
| 16:30 | Raynes | You'd never. |
| 16:32 | rainerschuster | (dnolen): thx for the hint |
| 16:34 | duck1123-work | If I have a "provided" dependency, should uberjar skip that dep? |
| 16:36 | rainerschuster | so your suggestion is to a) eager consume the file or b) open the reader from toplevel with-open (like it's allready done) |
| 16:37 | rainerschuster | i'm fine with that solution. thx for advice |
| 16:40 | rainerschuster | in order to use data.csv on the repl i allways have to doall? |
| 16:53 | duck1123-work | gtrak: It tooks some time to get around to it, but I finally managed to use your code to inject a swank server into my tomcat instance. Thanks |
| 16:54 | gtrak | duck1123-work: nice |
| 16:54 | gtrak | I thought it was a closed-source app though, did you have to do anything special? |
| 16:54 | duck1123-work | No, I just set it up as a listener |
| 16:54 | gtrak | ah, cool |
| 16:55 | duck1123-work | of course, now I am able to reference the classes that are part of the application, but not the addon classes that I'm developing |
| 17:07 | semperos | dnolen: if I'm doing unification on Clojure records, what gets bound to the 'q' of my run* call is not my original records, but rather the "downgraded" Clojure map version of my records that unify; is there some idiom for doing unification against record instances? |
| 17:11 | gtrak | duck1123-work: yea, you could do some classloader tricks I suppose |
| 17:11 | dnolen | semperos: you need to implement unification for your defrecord |
| 17:12 | semperos | dnolen: alrighty; any examples lying around, or a good place in core.logic's source to see exactly what I need to implement? |
| 17:12 | dnolen | semperos: look at the core.logic wiki for the Datomic example - the example explains how to extend unification |
| 17:12 | semperos | dnolen: great, thank you :) |
| 17:13 | semperos | building an LP-based version of my clj-webdriver library for testing/exploration |
| 17:13 | dnolen | semperos: let me know if you run into issues, core.logic extends IPersistentMap, that may be ambiguous ... if so open a ticket and I can consider some solutions. |
| 17:13 | semperos | dnolen: I didn't know where to start, you've solved that |
| 17:14 | semperos | any issues I encounter are more likely my error/misunderstanding |
| 17:15 | dnolen | semperos: I mean just I'm not sure if concrete take precendence over interfaces when it comes to extend-type - I'm afraid you might get different results at different times because of this. |
| 17:15 | dnolen | concrete type I mean. |
| 17:15 | semperos | gotcha |
| 17:16 | dnolen | semperos: are you unifying records w/ records? |
| 17:16 | semperos | in the mean time, I've tweaked my own clj-webdriver API to deal gracefully with PersistenArrayMap's in addition to my custom defrecord, which may or may not be a good idea by itself |
| 17:17 | semperos | yes |
| 17:17 | semperos | I can give a simple example |
| 17:20 | semperos | dnolen: https://gist.github.com/3178729 |
| 17:20 | semperos | there's a bunch of state that's not included in that gist, but the idea is hopefully clear |
| 17:21 | semperos | the "elements" returned by wd/find-elements are Element records |
| 17:21 | semperos | but in what gets bound to q, the "an-el" becomes a regular map, albeit with all the entries that Element records need to function properly |
| 17:21 | semperos | looks like that Datomic example is just what I need |
| 17:22 | semperos | the repo for this is here: https://github.com/semperos/webdriver-logic |
| 17:24 | dnolen | semperos: this look really cool |
| 17:24 | dnolen | looks |
| 17:24 | semperos | I'm really liking it :) |
| 17:24 | semperos | the last example on my README is the first step towards doing things you can't do with raw CSS/XPath queries, so I see lots of potential |
| 17:25 | semperos | but I'm still in LP preschool, learning-wise |
| 17:26 | dnolen | semperos: yes, this looks really awesome. Definitely excited to see where this goes! |
| 17:26 | semperos | dnolen: appreciate it, and thanks for the help |
| 17:27 | dnolen | semperos: planning on doing a big doc push soon - will probably start keeping track of really sweet *practical* projects like this. |
| 17:27 | semperos | sweet |
| 17:28 | semperos | encoding functional web tests using LP, esp. for apps with complex client-side state, permissions, workflows, etc., seems like a natural win |
| 17:28 | duck1123-work | so is webdriver logic good for testing, or do you see other things for it? |
| 17:29 | semperos | testing is one side of it, since clj-webdriver, like Selenium-WebDriver, has an eye towards web testing |
| 17:29 | semperos | but webdriver-logic isn't good for too much at the moment, as I only have a couple relations :) |
| 17:29 | duck1123-work | I currently use clj-webdriver from Cucumber. wondering if I should give this a try |
| 17:30 | semperos | you're welcome to check it out and contribute ideas/code, but I wouldn't try using it for too much |
| 17:31 | dnolen | semperos: sure, but a very neat approach, I'm assuming this actually addresses some pain points w/ the traditional approach? |
| 17:31 | semperos | it's in pre-pre-alpha |
| 17:31 | semperos | dnolen: I've frankly yet to see a "traditional" approach that doesn't break down into lots of manual testing |
| 17:32 | dnolen | semperos: hmm, I wonder if constraints could come into play here ... |
| 17:32 | semperos | I'm doing poor-man's constraints |
| 17:32 | duck1123-work | did the new webdriver update htmlunit? I've been getting an error lately. I saw the announcement, just haven't gotten around to testing |
| 17:33 | semperos | with pluggable XPath queries for the parts of my relations that provide "all elements" on the page, for example |
| 17:33 | semperos | also building out simple relations using Enlive to parse the page source, instead of relying solely on clj-webdriver, because querying the DOM via WebDriver can be dog-slow |
| 17:33 | semperos | using just Enlive for relations, when you don't want to then do something with the page elements that unify, is orders of magnitude faster |
| 17:34 | semperos | duck1123-work: I need to add htmlunit to my own set of tetsts |
| 17:34 | semperos | I actually only run each release against firefox and chrome, at this point, passing the browser compatibility buck upstream to a certain extent |
| 17:34 | semperos | clj-webdriver doesn't do anything that should break compatibility, I'll put it that way |
| 17:34 | craigbro | oh man |
| 17:34 | craigbro | running into compojure routing issuee |
| 17:34 | craigbro | I am url encoding paths as pat of the url |
| 17:35 | dnolen | semperos: I'm pretty deep in core.logic work so I probably can't take a deeper look any time soon - but feel free to ask questions anytime. Seems promising. |
| 17:35 | craigbro | /paths/%5CWINDOWS%5Cwhatever.exe |
| 17:35 | semperos | dnolen: I think deep in core.logic is where everyone wants you :) |
| 17:35 | semperos | but I'll ask if I hit major road blocks |
| 17:36 | craigbro | oh well, dinner and then debugging |
| 17:36 | semperos | duck1123-work: send a message on the Google Group or file an issue if HTMLUnit isn't working for you |
| 17:36 | semperos | gotta scoot, later folks |
| 17:36 | duck1123-work | yeah, let me get home and give it a try. if it's still hapening, I'll file something |
| 17:54 | solussd | technomancy: when I try to run anything with a freshly pulled down lein2 I get this stacktrace: https://www.refheap.com/paste/3790 have hunches? |
| 17:58 | mister_zombie | Hey, I have a quick question, what's the weapon of choice for scalable web services in Clojureland? |
| 18:01 | brehaut | well web services are typically built on top of ring et al, but you'll have to bring the scalability yourself. thats not a feature of a library |
| 18:04 | brehaut | depending on your service requirements though you might want to just build on compojure or you might want something more specific like bishop or clothesline |
| 18:06 | mister_zombie | I may be poking it up to several hundred million times a day and I need a really tight response time |
| 18:06 | TimMc | mister_zombie: I hope it clusters well. |
| 18:06 | brehaut | scalability is a feature of your application architecture, not of libraries, languages or frameworks |
| 18:07 | mister_zombie | I know, but some things may make my going easier or harder. |
| 18:07 | TimMc | Wait... ##(/ 1e8 24 60 60) |
| 18:07 | lazybot | ⇒ 1157.4074074074074 |
| 18:07 | TimMc | So you need millisecond average response time? |
| 18:08 | mister_zombie | Ideally. |
| 18:08 | mister_zombie | Quickest response time possible. |
| 18:09 | mister_zombie | I'm looking at clojure because as far as concurrency is concerned, there's gonna be tons of that, and it looks very helpful for that. |
| 18:12 | mister_zombie | And I'd like not to be caught in this http://www.kegel.com/c10k.html |
| 18:13 | craigbro | mister_zombie: I thinkin the end your show stoppers are gonna be with the java web servers |
| 18:13 | craigbro | mister_zombie: in terms of the bottom range of your latency |
| 18:14 | brehaut | mister_zombie: http://www.colinsteele.org/post/27929539434/60-000-growth-in-7-months-using-clojure-and-aws |
| 18:14 | craigbro | mister_zombie: as far as architecting the rest of the service to get cached data as close to the end user as possible, there are plenty of tools for that depending on your service |
| 18:14 | mister_zombie | I'm aware I won't go lower than several tens of millis, but that's fine |
| 18:16 | craigbro | brehaut: oh man, that URL makes me cringe 8) |
| 18:17 | craigbro | brehaut: not in what they did, but thinking about how I am going to shoehorn this dataset into something similiar |
| 18:17 | brehaut | craigbro: i blame tumblr :P |
| 18:18 | craigbro | brehaut: the baking the non-relational views is a fine approach IMO |
| 18:19 | craigbro | brehaut: I much prefer architecture driven by performance and understanding of what your real bottlenecks are VS. ideological notion of correct "architecture" |
| 18:19 | brehaut | yeah i dont see the point in building something according to some pie in the sky notion of what is 'fast' |
| 18:20 | brehaut | build it right, make it good, make it fast |
| 18:20 | brehaut | and dont expect magic from tools |
| 18:20 | craigbro | brehaut: and don't try and get it right until you have built it a few times 8^) |
| 18:20 | brehaut | ha |
| 18:20 | craigbro | brehaut: if one of your first couple tries works, good on you, but don't get too far ahead of yourself 8) |
| 18:21 | a|i | how fast is clojure.xml comparing to other jvm xml paresers? |
| 18:21 | craigbro | aji: I use java xml parsers |
| 18:22 | craigbro | a|i: oh, I thought you were garlic |
| 18:22 | mister_zombie | :P I'm not expecting magic, really, I understand that the most likely stuff to be slow is my own. I'm just also aware that there are some tools more fit to some things than others. |
| 18:22 | craigbro | mister_zombie: wasn't referring to you 8^) More like referring to my previous selfs 8^) |
| 18:22 | brehaut | ajl: clojure's xml libs are simple and convinient by they are not comprehensive. no NS support for instance |
| 18:22 | a|i | craigbro: why java xml? |
| 18:23 | craigbro | a|i: well, in my case, I needed to transform XML/HTML coming in one side, and going out the other |
| 18:23 | craigbro | a|i: I used jsoup for that |
| 18:24 | mister_zombie | craigbro: Yeah, but I do feel like i've lived that in the past too XD |
| 18:24 | craigbro | a|i: clojure is java, it's just picking the write java library for what you want to do. There are several out there, and the thing about jsoup I liked is that I could define transformations on an XML document, without having to build a gigantic in memory version of it |
| 18:24 | a|i | craigbro: how about this https://gist.github.com/822769 |
| 18:24 | craigbro | a|i: I guess the point is, your questiond epends on what you want to to|optimize for |
| 18:25 | craigbro | I don't know what a VTDNav is, or how you use it |
| 18:25 | a|i | craigbro: I simply want to read xml, no write. |
| 18:25 | a|i | craigbro: vtdxml seems to be the fastest xml pareser in java. |
| 18:27 | craigbro | a|i: then use that I say |
| 18:28 | a|i | craigbro: yeah, I was just wondering if the functional nature of clojure would make parsing xml even more efficient. |
| 18:29 | craigbro | a|i: not in my experience |
| 18:29 | craigbro | a|i: in fact, I found that enline, which is an HTML/XML transofrmation toolkit, paid a big price for immutability |
| 18:29 | craigbro | a|i: why I moved to jsoup |
| 18:30 | a|i | craigbro: is there a benchmark for that? |
| 18:31 | craigbro | a|i: for what? |
| 18:32 | a|i | craigbro: jsoup vs enline |
| 18:32 | craigbro | a|i: all I know is that transforming a 40M document would kill my app's responsiveness and sometimes blow out the JVMs memory with enlive |
| 18:32 | craigbro | a|i: and with jsoup it flies |
| 18:32 | craigbro | i can tell you why that happens tho |
| 18:33 | craigbro | a|i: enlive reads a document into a data structure, transforms the structure and then spits it out |
| 18:33 | a|i | is jsoup mutable-base? |
| 18:33 | craigbro | it's java |
| 18:33 | craigbro | so yes |
| 18:34 | Raynes | Sometimes mutable is good. |
| 18:36 | TimMc | ~guards |
| 18:36 | clojurebot | SEIZE HIM! |
| 18:37 | Raynes | (.delete TimMc) |
| 18:37 | TimMc | *blip* |
| 18:37 | craigbro | I wasa purely functinal programmer myself, until I took a conj to the knee |
| 18:37 | craigbro | years of Common Lisp earned me the esteem of my coworkers, and the nickname Sir Cons Alot |
| 18:39 | craigbro | really, it's so sad that programming is hampered by ideological purity, as if we learned nothing from the last 200 years of philosophy |
| 18:39 | craigbro | even more ironic when you consider that cyberpunk was originally the "New Romantic" movement |
| 18:40 | craigbro | and the Romantics were a critique of the positivism and ideological blindering of the enlightenment |
| 18:43 | craigbro | a|i: wow, VTD looks interesting. thanks |
| 18:44 | a|i | craigbro: :) |
| 18:44 | duck1123 | craigbro: when the guards in my game say that line, lightning strikes them down. (re: to the knee) |
| 18:45 | craigbro | a|i: now, i only we could ensure in the JVM that that string representing the file was just mmap'ed |
| 18:45 | craigbro | aji: then we would have a real XML document handler 8) |
| 18:45 | a|i | craigbro: cool. |
| 18:46 | craigbro | duck1123: I only have ps3 version, so no mods for me. 8^( |
| 18:46 | a|i | I have to choose between scalaa and clojure, anyone wants to sell me clojure? |
| 18:46 | a|i | scala* |
| 18:46 | duck1123 | I run like 25 mods normally |
| 18:46 | craigbro | a|i: for what? |
| 18:47 | a|i | craigbro: a backend for a web app, mostly like a crawler. |
| 18:48 | craigbro | a|i: insufficient data |
| 18:50 | a|i | craigbro: it will do some statistical calculations on data grabbed from some external api. |
| 18:52 | craigbro | still seems a matter of tast eto me |
| 18:52 | craigbro | exploratory programming is easie rin clojure I think |
| 18:52 | craigbro | aka, not sure what you are gonna do with the information, or how to handle it |
| 18:53 | craigbro | or what algorithms to use |
| 18:53 | duck1123 | clojure has incanter, which you'll probably like |
| 18:53 | a|i | incanter? |
| 18:54 | duck1123 | http://incanter.org/ |
| 18:54 | duck1123 | not something that I get into, but still cool |
| 18:54 | a|i | wow nice, like R. is it as comprehensive? |
| 18:57 | a|i | is there an equivalent of scala pattern matching in clojure? |
| 18:57 | duck1123 | actually, now that I'm looking at this, maybe I can pitch it as a replacement for the beast we're currently using. (not total replacement) |
| 18:58 | duck1123 | I don't know scala's pattern matching, but you can work wonders with multimethods and/or the matching and logic libraries, so... yes? |
| 19:00 | a|i | well of course there is the problem of too many prents :) |
| 19:02 | duck1123 | the cool thing with clojure, is you stop thinking about parens and you just think about nested lists of code, you concern yorself with the structure, and let the editor handle the parens |
| 19:03 | gert_ | duck1123: which is why paredit is so awesome |
| 19:04 | a|i | duck1123: I'm an absolute 'noob' in clojure, just watched that 10 part video on youtube, and didn't get any of it. |
| 19:04 | a|i | which book is good for start? |
| 19:05 | duck1123 | I haven't read all the books, but Programming Clojure is a good intro |
| 19:05 | duck1123 | and then get Joy of Clojure to read when you "get it" |
| 19:05 | antares_ | clojurebook.com is what I'd recommend |
| 19:06 | duck1123 | I need to read that, I glanced at it earlier |
| 19:07 | a|i | thanks. |
| 19:07 | brehaut | clojurebook.com and JoC are both good books. JoC is perhaps a 'faster'. it covers a lot in less pages and doesnt muck about in the basics |
| 19:08 | brehaut | clojurebook.com also has some great practical chapters |
| 19:08 | a|i | is joc faster or more advanced? |
| 19:08 | Raynes | antares_: Is there a particular format you'd like my code review to be in? An email, comments in a pull request, etc |
| 19:09 | antares_ | Raynes: a gist with ``` clojure code fragments is probably the best |
| 19:10 | Raynes | antares_: I don't do gists. |
| 19:10 | antares_ | ugh, now that was stupid |
| 19:10 | Raynes | :P |
| 19:10 | antares_ | Raynes: ok, a REFHEAP of any kind would work! |
| 19:11 | Raynes | I love doing that to people. |
| 19:11 | Raynes | Making them feel bad when they ask me to gist something. |
| 19:11 | antares_ | haha |
| 19:11 | duck1123 | pastebin then |
| 19:11 | gtrak | Raynes <- hold on to your request one sec.. USE THE APP I JUST MADE |
| 19:11 | amalloy | Raynes: you should add some special setup to your IRC client for that. like, silently replace gist with refheap, or alternatively sound a huge alarm bell everytime someone says gist |
| 19:12 | amalloy | i don't know exactly what behavior you'd make, but i'm sure you get the gist of it |
| 19:12 | antares_ | clojurebot: gist |
| 19:12 | clojurebot | gist is https://refheap.com/ |
| 19:12 | Raynes | Didn't you propose I make lazybot echo gist links with refheap links with the same content? |
| 19:12 | antares_ | see, clojurebot is already corrupted :P |
| 19:12 | amalloy | haha, i probably did. that sounds like me |
| 19:15 | Raynes | antares_: My only reget is that refheap doesn't support markdown at the moment. :( |
| 19:15 | Raynes | It's on my todo list. |
| 19:23 | TimMc | amalloy: "get the refheap of it"? I'm not sure what that means. |
| 19:25 | rabidsnail | I have *warn-on-reflection* set to true, and my cpu time is dominated by clojure.lang.Reflector.getMethods, but I don't see any warnings. |
| 19:25 | rabidsnail | How is that possible? |
| 19:27 | brehaut | it only applies to the namespace its declared in |
| 19:27 | brehaut | i believe leiningen has a global flag you can set, though it will warn on all your dependancies reflection too |
| 19:27 | amalloy | brehaut: that's not a very accurate description, i think |
| 19:28 | antoineB | is there a function that take as argument a function and create an InputStream? (clojure.java.io/input-stream don't) |
| 19:28 | amalloy | if you (set! *warn-on-reflection* true) and never unset it, then it stays on for all the rest of the files it compiles after yours |
| 19:28 | antoineB | my idea was to make an infinite input stream generated by a function |
| 19:29 | rabidsnail | I was using the leiningen flag |
| 19:29 | rabidsnail | and I did get one warning at startup (from within leiningen) |
| 19:30 | rabidsnail | so at least it was working then |
| 19:30 | amalloy | rabidsnail: the warnings come only at compile time |
| 19:30 | amalloy | it doesn't print a warning every time you use reflection at runtime |
| 19:30 | rabidsnail | the warning was for NO_SOURCE_FILE |
| 19:30 | rabidsnail | I don' think that was my code |
| 19:31 | duck1123 | If it did, those warnings would get fixed quickly |
| 19:44 | a|i | is this job trends graph sane? http://thecodegeneral.wordpress.com/2012/03/04/the-big-three-jvm-languages/ |
| 19:44 | a|i | I thought groovy was dead. |
| 19:45 | antoineB | is it possible to add a local variable with proxy? |
| 19:46 | cemerick | a|i: it's a bit old, but basically right. Clojure has been on a bit of tear lately. http://www.indeed.com/jobtrends/clojure%2Cscala%2Cgroovy.html |
| 19:46 | cemerick | Groovy is *very* healthy. Easily the #2 language on the JVM. |
| 19:46 | arkx | a|i: Dead? Why? Isn't Groovy the easiest migration path for Java developers? |
| 19:46 | cemerick | (In terms of usage, of course.) |
| 19:47 | a|i | there are only 35 people on #groovy right now! |
| 19:47 | gfredericks | is there an IRC plugin for eclipse? |
| 19:48 | arkx | Heh, don't confuse IRC participation with popularity. |
| 19:48 | antoineB | so maybe IRC participation correlate with fun or capacities ? |
| 19:49 | a|i | well, it cannot be not related. |
| 19:49 | a|i | maybe the groovy people are more of enterprise type? |
| 19:49 | a|i | those people don't know what irc is. |
| 19:50 | antoineB | they are too serious for irc |
| 19:52 | antoineB | so anyone for my question, how can i store data from the context of a proxy function? |
| 19:54 | gfredericks | antoineB: so that it's accessible over repeated calls on the same object? |
| 19:54 | antoineB | yes |
| 19:55 | gfredericks | an atom in a closure should work, right? |
| 19:55 | gfredericks | (let [state (atom {})] (proxy ...)) |
| 19:55 | antoineB | maybe |
| 19:55 | gfredericks | I think if you need state an atom is the default way to get it |
| 19:58 | antoineB | thank you |
| 20:17 | antoineB | i have implemented the code but i can't have access InputStream.read |
| 20:18 | antoineB | InputStream.read is an abstract method but i get an arity error |
| 20:19 | antoineB | (.read (input-stream-fn #(identity "abcd"))) => Error |
| 20:19 | antoineB | (.read (input-stream-fn #(identity "abcd")) (byte-array 1)) => ok |
| 20:20 | antoineB | so my question is: Is abstract function can be accessed? need i use type hint (and where) to help clojure to find the good method? |
| 20:23 | gfredericks | antoineB: did you include an explicit argument for `this`? |
| 20:25 | hiredman | antoineB: you are not defining your proxy correctly |
| 20:25 | antoineB | i do like that (read [_] |
| 20:25 | hiredman | I suggest you look at using a SequenceInputstream (check the docs for java.io) instead of whatever you are doing |
| 20:26 | antoineB | http://pastebin.com/v1gqd4xg |
| 20:35 | rbarraud | Afternoon, CLojurians and Kiwis :) |
| 20:35 | rbarraud | I bought the Fogus book last night - looking fwd to getting into it :) |
| 20:36 | antoineB | bye |
| 20:41 | brehaut | hi rbarraud |
| 21:00 | gert | kia ora, brehaut, rbarraud and other kiwis |
| 21:01 | brehaut | hi gert |
| 21:05 | a|i | hmm?? https://gist.github.com/3036120 |
| 21:06 | amalloy | always good for a chuckle |
| 21:56 | xumingmingv | clojure does not support empty protocol? In java you can define a empty interface like java.io.Serializable |
| 23:27 | gert | is there a way to add documentation to deftype declarations? |
| 23:32 | shinta42 | http://pastebin.com/64dXwGyV can anyone help me fix this defrecord so it runs? |