#clojure logs

2012-07-25

00:10emezeskeApparently (pr ...) in clojurescript is pretty slow, especially in older browsers. Are there any tricks to make that faster (e.g. undocumented options, etc)?
00:14dnolenemezeske: not that I'm aware of. printing is slow - but I haven't looked closely at why.
00:15dnolenemezeske: I'm assuming your serializing something?
00:15emezeskednolen: Yeah, just a big map of maps
00:15emezeskednolen: 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:16emezeskednolen: Confusingly, it looks like the reader is substantially faster...
00:16dnolenemezeske: serialization is very slow in CLJS, pr variants & the reader need a lot of optimization work.
00:16emezeskednolen: Okay, thanks! I just wanted to make sure there weren't any easy outs before I dug in deeper
00:16dnolenemezeske: I did some basic optimization work on the reader. never looked closely at printing.
00:18emezeskednolen: I might end up looking at optimizing the print stuff.
00:24dnolenemezeske: printing is elegantly written around lazy sequences. I can't imagine that be any good for performance.
01:07amalloydnolen: i may start stealing that out of context. "X is elegant: I can't imagine it being any good performance-wise"
02:11emezeskeWarning 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:18gert"leaking its slowness everywhere" <- quote of the day
02:22emezeskeWoo! I should drink and IRC more
02:26gertthat is good advice for anything in life.
02:36emezeskegert: /agree
02:49ambrosebsType inference anyone? https://gist.github.com/3174648 :)
02:50noidi_ambrosebs, congrats!
02:52noidiyou're well on your way to solving clojure's "indecipherable error messages" problem
02:53ambrosebsnoidi: thanks :)
02:54ambrosebsnoidi: Now I just need to somehow communicate to an IDE which exact form to highlight :)
02:55ambrosebsWhich could be a bit tricky with macroexpansion...
03:01djcoinambrosebs: 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:01ambrosebsdjcoin: Right now it's for safety.
03:02ambrosebsThe plan is to make a completely optional type checker, probably part of contrib
03:02ambrosebsI can get surprisingly accurate results, so I'm confident it will work.
03:04djcoinambrosebs: awesome :)
03:05ambrosebsThe optimizing will come later.
03:05djcoinI 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:05djcoinYeah, safety is way more important.
03:05ambrosebsThere are several hurdles.
03:05ambrosebsTyping "assoc" is a pretty big one
03:06ambrosebsThe "rest arguments in pairs" is problematic
03:06ambrosebsAlso "comp" is just crazy.
03:06ambrosebsMultimethods will be interesting.
03:08djcoinOk
03:09ambrosebsdjcoin: If you're interested, I summarise stuff in my proposal.
03:09ambrosebsAnd lit review
03:10djcoinUnfortunately I'm not a strong type's theorist but type is really important to me
03:11djcoinambrosebs: I guess you may have checked typed-racket ?
03:11ambrosebsdjcoin: Yes it is almost entirely based (copied) from typed-racket
03:11djcoinOh, all right :)
03:12ambrosebsThe big differences are interop, multimethods, heterogeneous map types
03:13ambrosebsie. types for ad-hoc objects like {:op :if :expr {:number 1} ...}
03:13djcoinambrosebs: that typed-racket implement but that will be hard on clojure ?
03:13ambrosebsNo, typed-racket does not have any of these features
03:14djcoinOh, all right
03:14djcoinI just heard of it - did not dig far
03:14ambrosebsdjcoin: I have not tackled multimethods, but the other two are going well.
03:14ro_st-curious- what flavour of clj are you discussing?
03:15ambrosebsCLJ
03:15ambrosebsIt will be simple to convert to CLJS
03:15ambrosebsProbably CLJ-CLR too.
03:15ro_stah, so you're discussing a library then. which one?
03:15ambrosebstyped-clojure
03:15ro_staha!
03:16ambrosebsdjcoin: the main innovation of typed-clojure is nil-safe interop with Java.
03:16djcoinambrosebs: thanks for your explanations :)
03:17ambrosebsWithout option types.
03:17ambrosebsStill yet to be proved.
04:02djcoinambrosebs: 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:04ambrosebsdjcoin: In general? The Racket ecosystem is amazing. But the language is bloated.
04:04ambrosebsComparing to Clojure, which is an unfair comparison I guess.
04:05ambrosebsClojure has the data structures, and they're super easy to use.
04:05djcoinambrosebs: by language you mean racket itself or the (quality, etc.) language beneath it ?
04:05ambrosebsdjcoin: I was referring to the data structure ops.
04:05ambrosebsClojure has first + rest
04:06ambrosebsand the seq abstraction
04:06ambrosebsRacket is a lot messier IMO
04:06ambrosebsRacket seems to be a fine language. Just seems a bit more of a chore to write in than Clojure for me.
04:07ambrosebsI'm heavily(!) biased of course.
04:07ambrosebsGo to #racket and ask them :)
04:07djcoin:)
04:07djcoinI already ask them once - about immutability and such
04:08ambrosebsYes, that is one area that Clojure is much more consistent about.
04:08djcoinDid not get/remember much however.
04:08djcoinBut I felt like the language was cleaner
04:09djcoinI'm not advanced enought to see what are the JVM and java libs environments limitations (despite their tremendous advantages)
04:10ambrosebsHmm. Well methods aren't first class objects.
04:10ambrosebsBut that's syntax.
04:10ambrosebsError messages are bad.
04:12ambrosebsBut if you want interop, it doesn't really get much better (without static typing).
04:12ambrosebsScala generics are Java generics for example.
04:49ro_stis there a library i can use in both clj and cljs for xml munging - not DOM, xml
05:45wingyhow do i access the property of a js object in cljs?
05:45ro_st(.property object-ref)
05:46ro_steg
05:46ro_st(.log js/console "foo")
05:47wingyim trying this one: (.name (js-obj "name" "foo"))
05:47wingyin http://himera.herokuapp.com/index.html
05:47wingybut it doesn't work
05:48ro_stbuggered if i know :)
05:49wingywhat?
05:49clojurebotWhat is seq
05:49wingywho?
05:52ro_sti've not had to do this myself, yet
05:52wingyhm
05:53wingyanyone knows how to do this?
05:54wingyi c
05:54wingy(.-name (js-obj "name" "foo"))
05:54wingythe doc says (.-property target-object -property)
05:54wingywhat does the last one mean?
05:55ro_sta default?
05:58wingywhat does -property mean?
05:58wingycould someone give an example?
05:58rbarraudDagnabbit, there is no Kindle edition of The Joy Of Clojure on Amazon Kindle Store
05:59rbarraudManning 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_nmmnwell there is pdf version
05:59rbarraudon Amazon?
06:00_nmmnmaybe not
06:00_nmmnhttp://manning.com/fogus/
06:00rbarraudor just as part of the 3-format eBook bundle on the Manning site?
06:00_nmmnyeah
06:00_nmmnhad no problems reading it on my kindle fire =]
06:01rbarraudah good to hear
06:01rbarraudwell i am gonna bite the bullet and buy the bundle i guess c:)
06:01rbarraudseeing $44 vs $26 for pbook makes Manning's prices look a tad inflated though :-/
06:02_nmmntrue, it could be way cheaper, i mean, it should!
06:02rbarraudhave u read the Halloway book also? "Programming CLojure"
06:02rbarraudhow do you think they compare?
06:02_nmmni have it in queue, not yeat
06:02_nmmn*yet
06:02rbarraudthere's also the Apress and Oreilly ones .... anyone have any comparative thoughts on them?
06:02_nmmnim now crunching "little schemer"
06:02rbarraudheheh
06:02rbarraudthat's a goodie
06:03rbarraudi have the 3 of them in that series
06:03_nmmnand there is other one on scheme
06:03_nmmnah cool =]
06:03rbarraudreally only ~1/4 into the first one though
06:03_nmmn"seasoned schemer"
06:03rbarraudIIRC there are Little, Seasoned and Reasoned :)
06:04_nmmni see, havent heard about reasoned =]
06:04rbarraudlooks like i may have misplaced the 3rd
06:04rbarraudor i am confused or didnt buy it - or both :)
06:06_nmmnwell i conviced my workplace to get em =] they seems to be reasonable regarding educating/learning/material
06:16Leonidasrbarraud: reasoned exists, but it is more about, well, logical reasoning, read kanren
06:16mytrileHey, guys. How can I try 1.5.0-master-SNAPSHOT ?
06:16mytrileThis is in my project.clj :dependencies [[org.clojure/clojure "1.5.0-master-SNAPSHOT"]]
06:30ro_stis it possible to select multiple selectors at once with enlive?
06:30ro_stkinda like jquery's $('#one, #two')
06:31ro_stah, use a set
06:40rainerschusterif 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:44clgv rainerschuster: e.g. (map #(%2 %1) list1 list2)
07:06michaelr525hello
07:26ro_stare the rules for using - and _ in filenames and namespaces different for clojurescript?
07:27ro_stie, if i use - in a namespace name, i must use _ in the filename isntead
07:27ro_stinstead
07:29cshell_no idea, ro_st :(
07:29ro_stit is consistent. i incorrectly named a cljs .clj
07:41djcoinAre their any good lib around for setting up an e-commerce site ?
07:41ro_sti don't think the open source ecosystem for clojure is quite there yet
07:41ro_stphp? ruby? sure
07:43_nmmni dont think clojure should compete on that market
07:43ro_stagreed
07:43ro_stit's a bad reason to write a lot of bad code :-)
07:43_nmmn;]
07:44ro_stand anyway, stuff like spreecommerce is great
07:44_nmmnwell some backend stuff for e-commerce written on clojure would make sense, but rest...
07:44djcoinWhy would Clojure not be a good fit at this ?
07:44ro_stit's not that it wouldn't be a good fit. by all means, spend a year building one.
07:45ro_stor you could grab spreecommerce and be selling shit by the end of the week
07:45_nmmnit just wouldnt outgrow competition, think, hosting, available clojure developers, etc etc...
07:46ro_stand it's a massive undertaking
07:46ro_stespecially if you want to do a good job
07:46ro_stperhaps in 5-10 years when clojure has taken over the world
07:47ro_stbut not right now :-)
07:47_nmmnhehe =]
07:47djcoinlol, 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:48ro_stwell, what do you mean when you say e-commerce?
07:48_nmmni see no problem doing it, i thought you meant more "full featured open source e-commerce framework"
07:48ro_stto me, it means cart + orders + payment integrations + backend to manage inventory, orders, store cms.
07:49ro_stthat's no trivial amount of work
07:49djcoinI mean Choosing products, putting it in a caert, payments process etc.
07:49ro_styou asked for a library
07:49ro_sttherefore i assumed you wanted a general purpose framework
07:50ro_styou 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:50djcoinWell I'm not into e-commerce so I don't really know all the components etc.
07:50djcoinYep
07:51djcoinpayment stuff would be enought
07:51ro_staffiliate marketing tracking, coupons, analytics up to your neck, all the security concerns, etc
07:51ro_sti honestly think you'd be better served using a 3rd party turnkey system
07:52ro_stunless you have a burning desire to do this in clojure for no reason other than to do it in clojure
07:52duck1123clojure would be an interesting system for something like that though, just be prepared to do a lot of work
07:52antares_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:52ro_stif 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:53ro_stclojure'd be great for moving data around on the back, especially at scale
07:54djcoinYep
07:54djcoin(+ I don't like/know ruby much :troll: :) )
07:54ro_stbut if you just want to sell stuff, you'd be far better served by shopify.com or spree
07:54ro_stspree is rails based but you don't have to touch the code to use it
07:55ro_st</sermon>
07:55djcoinSure - but as a developer it is a pity to not be able to understand one of your key business component
07:55djcoinBut why not
07:55djcoinTHanks for your advice
07:56duck1123So, 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:57duck1123I currently have it in a var, but I want to revisit the decision before I move this out into it's own lib
07:58ro_stdjcoin: i'm pretty sure that linux is a key business component of yours. do you understand it? hardware drivers? hardware itself?
07:58antares_duck1123: an init function + a var and defonce
07:58ro_sti'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:58ro_stlike databases or email
07:58ro_stit's solved. it works
07:59djcoinro_st: yep - so i guess this stuff is really flexible
07:59ro_strather spend your precious finite energy and time on something interesting
07:59djcoincause I won't customize kernel driveres myself
07:59duck1123antares_: a defonce inside the init?
07:59ro_stexactly
08:00antares_duck1123: yes, and init can be called from -main
08:01duck1123makes sense. I think I'll try that
08:24stainmodprobe ecommerce
08:28djcoinx)
08:47ro_styay managed to abstract xml wrangling away from the common clj/cljs code
08:47ro_stactually pretty easy to do in cljs, using goog.dom.xml
08:49gtrakis it easy to wrap jax-rs calls in a clojure jetty thing?
08:50gtraka pre-existing jax-rs implementation, rather?
08:52ro_stjax-rs? wossat
08:52gtrakstandardized REST annotations for java
08:53gtrakI guess i have to hook it up as servlet or something
08:53ro_stah
08:53ro_styeah probably
08:53gtraksilly java
09:02wastrel<3
09:12gtrakanyone know how to wrap a servlet as a ring handler?
09:12gtrak(the opposite of what is usually done)?
09:18wingyanyone knows if it's possible to have a vector as a value in datomic?
09:20jonasenwingy: Vectors are not supported
09:20wingyjonasen: ok
09:20wingyproblematic
09:22jonasenwingy: multi-valued attributes are supported (i.e. sets)
09:22wingyi c
09:22wingythat's what i really want i guess
09:37ro_stwhat's the simplest way to render a static html page with ring/compojure?
09:38wmealingslurp it, return it
09:39wmealingi havn't used ring or compojure
09:39wmealingbut thats how i'd do it in noir
09:39ro_stsimple enough
09:40ro_stjust realised i have to inject one paltry dynamic value, so enlive it is
09:40mikemwmealing: a friendly hello!
09:40wmealinghi hi !
09:40mikemwill you be joining us at the meetup tomorrow? ;-)
09:40wmealingimagine meeting you here :)
09:41wmealingmikem, sadly.. i'm far away and can't fly there in time
09:41wmealingis there a clojure talk ?
09:42wmealingmikem, btw totally should have pimped lein harder in the talks ..
09:42mikemthat's understandable. it's part 2 of a talk on agda, an insantely-strongly typed language for proofs
09:42wmealingwho is giving that ?
09:46juhu_chapaHi all! How do I pass a class to a method in clojure? i.e. foo(Class clazz)
09:47Wild_Catjuhu_chapa: Use the class directly.
09:47mikemwmealing: a chap named Gergo Erdi
09:47wmealing(function Class) ?
09:47Wild_Cat,(str Integer)
09:47clojurebot"class java.lang.Integer"
09:48mikemwmealing: anyway I gotta run. catch you later
09:48wmealinglater mate.
09:49juhu_chapathanks to all!
09:49gtrakcan you live-update dependencies in lein2 yet?
09:50antares_gtrak: what do you mean by live-update?
09:50gtrakadd a new one and have it come into the classpath during a swank session
09:50antares_no, I don't think so
09:50antares_it is something that should be supported by lein-swank
09:58ro_sthow do i ensure that lein ring server will reload changes to source files?
10:04wmealingtest ?
10:05ro_stwell, 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:18clgvro_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:20ro_stah, that makes sense
10:20ro_stthanks for the tip. i'll check it out.
10:21ro_stbtw, enlive/enfocus is a fantastic way to do markup templating. really enjoying it
10:36gtrakugh, does anyone else's emacs crash on autocomplete sometimes?
10:45CheironHi, how to add elements to a vector inside doseq ? http://pastie.org/4330455
10:45llasramCheiron: You don't
10:46llasramCheiron: More helpfully, you probably want `reduce` instead
10:46Cheironi need to collect elements issued by (items-generator)
10:46llasramgtrak: Actually... no. I'm honestly having a difficult time remembering the last time Emacs crashed on me
10:47gtrakllasram: hmm... it seems to be a regular thing for me on ubuntu snapshots, I could try starting over
10:47wingyro_st: what project are you working on?
10:47clgvCheiron: use (into [] (items-generator))
10:47ro_stwingy: v2 of www.cognician.com
10:48ro_stv1 is flex/air -puke-
10:48Cheironthen (items-generator) is going to be called twice, once for into and once for doseq
10:48nDuffCheiron: Not if you store the sequence once.
10:48nDuffCheiron: (let [items (items-generator)] ...)
10:48ro_stv1.5 is google closure javascript, now abandoned at 10kloc. rewrote about 80% of it in clojurescript in about 2 weeks. 1.5kloc.
10:49clgvCheiron: or simply (vec (items-generator)) - you have to remove the doseq. doseq is only for side effects
10:49nDuffCheiron: ...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:50nDuffclgv: 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:50duck11231Cheiron: if you combine doall and for, you get something like doseq, but it'll collect the returns
10:50wingyro_st: cool
10:51Cheirontoo many techniques .. what to choose?
10:52clgvCheiron: the simplest^^
10:53semperosCheiron: I think the bottom line is, doseq is *only* for side-effects
10:53clgvCheiron: how about (let [v (vec (items-generator))] (doseq [e v] (side-effect e)) v) ?
10:55clgvCheiron: (reduce #(conj %1 (side-effect %2)) [] (items-generator)) would work as well if the side-effect fn returns the parameter at the end
10:55Cheironyou are scaring me xD
10:56semperosthe more you practice with reduce, the less scary it becomes :)
10:56nDuffCheiron: 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:56ro_streduce is actually quite simple. you just have to write a couple
10:57pjstadigclgv: for that matter (into [] (map side-effect (items-generator)))
10:57pjstadigwhenever you see (reduce conj ...) think (into ...)
10:58Cheironi'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:58pjstadigor i do anyway
10:59llasramgtrak: Ah. I'm still on emacs 23. I was planning on switching now that there are official Debian emacs 24 packages...
10:59gtrakhmm
10:59wingyro_st: lol
10:59wingyro_st: i like Adobe's Illustrator though
10:59nDuffCheiron: (let [your-seq (items-generator)] (map emit-item your-seq) (vec your-seq))
10:59nDuff...err, not that.
11:00ro_stwingy: um?
11:00nDuffneeds a doall around the map
11:00nDuffotherwise it's lazy and doesn't get executed... but the point is that you don't even need a doseq.
11:00wingyro_st: is it for your company?
11:00pjstadigand if you're using seqs for side-effects you might need to worry about chunking
11:00wingyAdobe is doing flex/air i guess
11:00pjstadigif items-generator generates a chunked seq it will be realized in chunks of 32 instead of one at a time
11:09duck11231is there a built in unchunker yet? I have a "lazier" function in my code, just wondering if I can replace it yet
11:11duck11231ro_st: cognician seems pretty neat. I'll have to play with it a bit more later
11:13ro_sthey cool. v1 sucks quite a bit, now, but the concept is there
11:14ro_stit'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:14ro_stthanks to clj+cljs, that bus has stopped :-)
11:17ro_stwe were going to use rails on the backend but i just couldn't bring myself to do it. then clojurebook.com landed
11:17duck11231So were you doing it in Google Closure before you discovered Clojure, or did cljs influence that decision?
11:17ro_stthe former
11:18ro_stbecause i wanted great js performance. C2 has to run on mobile and desktop
11:19eduardhelp, lein run results in this: http://pastie.org/private/bk8zpftlhz116vefoh2g9w
11:19ro_stthe closure compiler produces seriously tiny js
11:19eduardjava.lang.RuntimeException: EOF while reading, starting at line 1
11:21wingywhat do you guys think about http://opalang.org/
11:23wingyit's quite impossible for hackers to get your frontend code once it has gone through advanced compilation with closure compiler?
11:24ro_stthey can pretty print it and try to make sense of it
11:24nDuffwingy: It's about equivalent to any other kind of obfuscated decompilation process.
11:24ro_stbut they'd probably have much better luck just re-coding it based on using the app
11:24wingyro_st: yeah so i've thought
11:24clgv"opalang running on node.js" *shivers*
11:25ro_stlet's be honest, the value isn't in the code, it's in the code + the ecosystem around it
11:25wingyro_st: you are talking about opalang or the compilation?
11:25ro_stthe compilation
11:26wingyro_st: indeed
11:26nDuffro_st: ${deity}, but it's hard to get management to realize that some times.
11:26solussdopinion 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:27ro_stis that some sort of emoticon my client can't render? :-)
11:27wingyro_st: im not worried about they will read the code and copy it .. but that they find some security flaws
11:27wingyand exploit them
11:27nDuffwingy: They can do that without reading the source.
11:27ro_stsolussd: both, i should think. model to verify access and link user, view to control what's presented
11:27duck11231ro_st: your irc client is an atheist
11:28ro_stno wonder we get along so well
11:28ro_st-grin-
11:28wingynDuff: analyzing the in and out data?
11:28nDuff*nod*
11:28nDuffEasiest place to attack are the entry/exit points. Trivial to modify HTTP requests on their way out and responses on their way in.
11:29wingyyeah
11:39duck11231So would source map support be bad for javascript security (through obscurity)
11:41wingycljs is so nice
11:41nDuffduck1123: Indeed.
11:42wingywhat is the best way to contribute to clj/cljs as a big company?
11:44samaaronis it possible to specify method param names whilst using gen-class or gen-interface using metadata?
11:44nDuffwingy: Getting your developers permission (and paperwork) to contribute upstream, at a minimum. Hiring Relevance for training/support/whatnot wouldn't hurt, either.
11:44Cheironit is me again :) how to morph this naive code into idiomatic clj code? forgive my ignorance http://pastie.org/4330790
11:44Cheironi'm still learning
11:45wingynDuff: how is hiring Relevance helping clj?
11:45nDuffwingy: Look at who they employ.
11:45nDuffwingy: ...hint: http://clojure.com/about.html
11:46wingycool
11:47wingyis Relevance behind datomic as well?
11:47nDuff*nod*
11:48wingyare you at Relevance?
11:48nDuffNo.
11:48wingyRelevance is quite cool
11:49duck11231they seem like they would be an awesome company to work for
11:49wingydefinitely hiring Relevance for expertise help when the time has come
11:53llasramCheiron: What are you trying to achieve?
11:54Cheironthe code i posted is obviously a mapping from imperative style
11:54clgvCheiron: you can do that shorter via `:let` within doseq
11:55Cheironi want to code in idiomatic clojure functional way
11:55clgvCheiron: your `let` doesnt do anything in its body?
11:56Cheironit does but i didn't include it , i want to add new-col to a vector defined earlier
11:57Cheironsame issue we talked about earlier
11:57Cheironbut i noted there is a doseq with a doseq, obviously not a good code
12:01jbarrioshmm, 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:01llasramCheiron: And like before, `doseq` just flat out won't let you build up a vector
12:01llasramCheiron: 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:02clgvCheiron: you could write it like that https://www.refheap.com/paste/3779
12:03clgvCheiron: that still doesnt address returning the vector though. just rewriten your nested doseq with interleaved let
12:03antoineBhello, i would like a for like function that let me do println?
12:04Cheironclgv: i will post what i'm trying to do.
12:05duck11231antoineB: doseq, unless you want the result, then doall+for
12:06semperosis 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:07antoineBduck11231: thanks
12:07duck11231doall will force a lazy seq and return it, dorun will just force the seq
12:08duck11231doseq is like dorun+for
12:08semperosjbarrios: (every? #(contains? your-hash %) list-o-keywords)
12:08semperos,(every? #(contains? {:foo "abc" :bar "def"} %) [:foo :bar])
12:08clojurebottrue
12:08semperos,(every? #(contains? {:foo "abc"} %) [:foo :bar])
12:08clojurebotfalse
12:09jbarriossemperos: thanks :) I came up with something similar.
12:09semperosnice
12:09jbarriossemperos: but I had to rethink it because I need to report which keys are missing
12:09semperosreduce sounds good for that
12:10duck11231or validateur
12:11Cheironclgv: kindly have a look http://pastie.org/4330899
12:11pbostromjbarrios: you can also convert the list and keys to sets and use intersection and difference
12:16clgvCheiron: couldnt do much with the `bolt` function: https://www.refheap.com/paste/3780
12:17Cheironsend-task send tasks one by one to a topic, send-tasks sends the vector of tasks to another topic
12:21duck11231Cheiron: how about this? https://www.refheap.com/paste/3781
12:22Cheironclgv: duck11231: wow, both are neat!
12:23clgvduck11231: but send-task has to return the task then
12:23clgvyou can skip the `doall` because of `(into [])`
12:24duck11231fine, then just add task at the end of the for loop
12:24clgvor that ^^
12:24duck11231clgv: right, he probably doesn't actually need it to be a vector anyway though
12:24Cheironjust one more thing (i'm sorry) . customize function has two parameters (defn customize [item object])
12:25Cheironwhat to change in (mapcat #(->> % customize :sheets (map task-factory)) (:items object))
12:25Cheironfor customize function since it takes two paramters?
12:26clgv#(->> % customize :sheets (map (fn [i] (task-factory i, object))))
12:27duck11231(partial customize item) or (fn [item] (customize item object)) ;; since you can't nest #()
12:27duck11231is % item or object?
12:28jweisswill lpetit's suggestion actually work (to define your own print-method multimethod): https://groups.google.com/forum/?fromgroups#!topic/clojure/7yg07Fk3uuw
12:28jweissseems to me that pprint will always dispatch to clojure.core/print-method no matter what else you add.
12:28Cheironthank you all for the great help, i will try those right now
12:36pandeiroin 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:40pandeiroah found it in the docstring for renderer, nice
12:50SegFault1X|work2Good morning.
13:02dnolenemezeske: ping
13:12emezeskednolen: pong
13:14dnolenemezeske: I made a ticket for the pr issue. It looks pretty simple - port over the approach from core_print.clj
13:14dnolenemezeske: no lazy seqs - loop / recur
13:15emezeskednolen: ah, cool
13:15emezeskednolen: I was looking at that a bit last night
13:15ibdknoxdnolen: how'd your class go? :)
13:16dnolenibdknox: it went well! light table works great - didn't really run into any issues.
13:16emezeskednolen: I was kind of thinking that passing the StringBuffer down through the -pr-str calls would be the most efficient thing to do
13:16ibdknoxdnolen: awesome :D
13:16dnolenemezeske: that's basically what core_print.clj does with the Writer.
13:17emezeskednolen: cool, makes sense. I did a bit of profiling, and the concats seemed to dominate runtime
13:17dnolenemezeske: yep
13:18dnolenemezeske: serialization in CLJS should be blazing fast IMO. Ideally should not be so far away from JSON encode/decode
13:18emezeskednolen: 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:19emezeskednolen: Which has worked great for me so far, until a) I decided to support IE8 and b) my datastructure got a bit bigger
13:19emezeskednolen: I'm pretty certain that the non-lazy StringBuffer approach will make things perfectly usable speed-wise
13:20dnolenemezeske: for sure.
13:20dnolenemezeske: 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:21emezeskednolen: I might be able to work on that tonight
13:21emezeskednolen: It seems like it really shouldn't be much work
13:23emezeskednolen: 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:27dnolenemezeske: it is not, read-string is I believe. We should add pr-str benchmark.
13:34clopaminequestion: 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:42clopamineThere 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:44hxiaoclopamine: java-source-paths in project.clj
13:45hxiaohttp://stackoverflow.com/questions/5432163/java-and-clojure-with-leiningen
13:46clopaminehxiao: I tried to play a little with that, but it's not working for me... maybe some example would help
13:46hxiaoI have a project where I have my java classes in the java directory
13:46hxiaoso in my project.clj I have this line
13:46hxiao:java-source-paths ["java"]
13:47clopamineok thanks... where do the class-files go?
13:48hxiaoIn target/classes
13:50clopamineyou have package-directories under "java" or java-files straight at root?
13:50hxiaopackage directories
13:50hxiaojust like a normal maven project
13:52hxiaothe class files under target/classes will also show up with package directories
13:54clopaminehmm... 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:55clopamineOnly classes I get are some clojure-generated in "classes"-dir
13:55hxiaowhich version of leiningen are you using
13:56hxiaoand i'd try building on the command line too just to see what happens
13:57clopaminethe 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:58hxiaohmm
13:59clopamineThe command has to be somewhere, not just in my "bin"-path
14:00hxiaowhat do you mean? don't you just add the script to your path and self-install if necessary?
14:01clopamineThat's what I did last time, yes. But this time I just installed ccw-plugin to eclipse and it "installed" leiningen
14:01hxiaohuh ... and what does ccw do when you build it? lein install? uberjar?
14:02clopaminewould not like to have to versions so my first option is to find the command and add symlink or something to my bin
14:02clopamineit complies clj files
14:03clopamineno uberjar, just ahead of time things I guess... project works fine without build
14:04clopaminebut 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:07clopaminehxiao: anyway thanks for trying to help, appreciate it.
14:07hxiaonp
14:07hxiaojust doing lein compile won't work, so that's probably what's happening
14:08clopaminewhat is missing... some kind of "lein javac java-stuff?"
14:09hxiaoyeah, lein javac
14:10hxiaoactually, i thought lein compile did a lein javac as long as you had the source paths specified
14:10hxiaoso i must be talking out of my rear end ... i never used ccw so it's hard for me to help
14:12clopamineheh, 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:15cemerickclopamine: I've been using it since the start; been solid as a rock.
14:15cemerickI'd actually recommend using the beta channel, as the code completion work that's been going in there lately has been stellar.
14:17cemerickBut, it'll take years before any IDE or editor's Leiningen support will supplant using lein on the command line.
14:17antares_more likely leiningen itself will develop into a good IDE
14:17clopamineok 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:19cemerickantares_: goodness, why?
14:20antares_cemerick: I am kidding, I am pretty sure lein is pretty feature complete by now :)
14:20cemerickwhew ;-)
14:20antares_but it does take IDEs forever to develop and mature
14:22jrheardhi folks: clojure noob here, working through `clojure programming` and starting off with a few project euler problems.
14:22jrheardlong 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:22lazybotNooooo, 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:22jrheardgladly!
14:22antares_stupid lazybot :)
14:23jrheardand so anyway i see it's moved to https://github.com/clojure/math.numeric-tower
14:23jrheardand i cannot for the life of me figure out how to get that library and use it in my project.
14:23antares_jrheard: http://dev.clojure.org/display/doc/Clojure+Contrib
14:23jrheardsure
14:23jrheardthat's how i found the numeric-tower link; but how do i tell leiningen what i want?
14:24jrheardi want to tell it: get me the numeric-tower library
14:24jrheardmake it available to my code
14:24jrheardand my google-fu has failed me thus far in figuring out how the hell to do that
14:24antares_jrheard: you need to depend on org.clojure/math.numeric-tower
14:24jrheardsweet.
14:24jrheardwas there any way i could have figured that out myself? some doc page i didn't find?
14:24antares_for clojure "contrib" it is org.clojure/[library name]
14:24jrheardalso how do i know what version to tell it?
14:25antares_jrheard: for contribut specifically, you can just search search.maven.org
14:25jrheard<3
14:25antares_most of 3rd party libraries are on clojars.org
14:25jrheardthat makes sense, i was wondering why clojars wasn't turning up any contrib stuff
14:25jrhearddidn't know about the maven url
14:25jrheardah i see it now
14:25jrheardhttp://search.maven.org/#search%7Cga%7C1%7Cnumeric-tower
14:25antares_finally, decent projects with documentation (like clojurewerkz.org) mention dependency lines in the getting started guide or something like that
14:25jrheardantares_: you are the best.
14:26jrheardthanks so much :)
14:26antares_jrheard: this is not the only repository where artifacts can be released. There is also oss.sonatype.org
14:26antares_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:27jrheardinteresting
14:27jrheardonce i do that lein search will also scan sonatype?
14:27antares_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:27jrheardsweet
14:28antares_jrheard: supposedly, lein search needs some improvement (assuming you use lein2, which I'd highly recommend)
14:28jrheardi've got whatever `brew install lein` gave me
14:28antares_that's almost certainly 1.7
14:28antares_it's ok for now
14:28jrheardcool
14:28antares_or you can easily install lein2, see leiningen.org
14:28jrheardwill do
14:29antares_just download 1 script, put it on PATH and run ./lein self-install
14:29jrheardrad
14:29hxiaolol i had no idea lazybot did that
14:29hxiaowarned people about contrib
14:29jrheardhttp://richhickey.github.com/foo
14:29lazybotNooooo, that's so out of date! Please see instead http://clojure.github.com/foo and try to stop linking to rich's repo.
14:29hxiaohaha
14:30llasram(inc lazybot)
14:30lazybot⇒ 7
14:30clopaminecemerick: 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:30jrheardseriously though +1 to "try to stop linking to rich's repo" - turns up on the top of google results every single time
14:30jrheardanyway thanks again antares_!
14:30antares_jrheard: you are welcome
14:31cemerickclopamine: The ccw lein support is self-contained; it doesn't install a `lein` script for use on the command line.
14:31hxiaoclopamine: if you don't have lein available right now in your command line you should be in any type of trouble
14:31hxiaowell there you go
14:31hxiaoshouldn't*
14:32clopamineboth: ok thanks. I will get the real deal then
14:35clopaminehey, before I do this workaround, should I report this kind of problem with ccw-lein somewhere?
14:36clopamine(problem meaning that it may be possible, but not out of the box, or easily findable)
14:38antares_clopamine: CCW or leiningen mailing lists are good candidates to report usability complaints
14:39clopamineantares_: ok will put a todo-task to figure out how to use those mailing lists
14:41jrheardantares_: 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:41jrheardi could just write my own dang #'abs function but i'd love to figure out how to use libraries
14:42antares_jrheard: it is clojure.math.numeric-tower
14:43antares_I think all new contrib libraries use clojure.* namespaces
14:43jrheardhm, the :require line still blows up in the same way
14:43jrheardor did i get the project.clj line wrong?
14:43antares_jrheard: in the repl you need to use (require …)
14:43antares_the function
14:43jrheardblorg, same behavior
14:43antares_not the (ns …) macro arguments that use :keywords
14:43jrheardoh that makes sense though
14:43jrheardi was wondering about that distinction
14:44antares_(require '[clojure.math.numeric-tower :as math])
14:44jrheardokay, 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:44jrheardso quoting it suppressed evaluation so the require function got the actual symbol, i think i followed that
14:45antares_jrheard: lein should have downloaded dependencies, can it be that you had the repl open before you added the dependency?
14:45antares_you can always run lein deps on your own
14:45jrheardnope, i keep restarting it
14:45jrheardi'll try lein deps
14:46jrheardah! 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:46antares_any command should trigger dependency check first
14:47ikgkomy +1
14:47antares_jrheard: by the way, feel free to bump clojure to 1.4.0
14:47jrheardwill do
14:59clopaminehxiao: yep, one "lein javac" did the trick
14:59hxiaohooray
15:03solussddoes anyone know if and what version Monger supports DBRefs ?
15:06a|iwhich clojure web framework works well on appengine?
15:06ro_sta|i: this talk might interest you http://www.infoq.com/presentations/Clojure-in-the-Clouds
15:09a|iro_st: thanks, what I want to know is, if there is any clojure web framework which actually supports appengine's datastore.
15:09ro_sthttps://github.com/smartrevolution/clj-gae-datastore
15:10ro_stweb frameworks don't deal with databases
15:10ro_stthey deal with http, routing, and templating, mostly
15:10a|iro_st: last commit: 11 months ago :(
15:11ro_sti suggest doing some reading
15:11ro_styou should be able to find something that works well
15:11a|ithanks.
15:12locojay1hi how can i do a jquery $(this) with jayq when inside a delegated function. (js* "this") will not give me a jq selector
15:18antares_solussd: Monger partially supports dbrefs
15:18antares_solussd: it will load existing dbrefs and represent them in a way that you can @deref
15:18antares_but that's it
15:18antares_and as far as I know, DBRefs are not supported by all clients and are semi-deprecated
15:18antares_so we did not add any other support for them so far
15:18pbostromlocojay1: (this-as x (-> ($ x) (...)))
15:20locojay1thanks was thinking of using jQuery constructor on elem (js * "this")
15:20acagleJust 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:24locojay1pbostrom 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:26duck1123-worklocojay: 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:26locojay1ah thanks
15:27pbostromlocojay1: (jq/delegate ... :click (fn [] (this-as thing-clicked (-> ($ thing-clicked) (some-jq-function) (some-other-jq-fn))))
15:28locojay1pbostrom : thanks got it
15:30gfredericksduck1123-work: if it's used the way you showed it'd have to be a macro
15:31duck1123-workgfredericks: that's what I figured, but then again, js is funny sometimes
15:33duck1123-workDoes 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:40ro_stdnolen told me that it doesn't
15:40ro_stback when i first asked
15:42dnolenro_st: duck1123-work: patch welcome
15:43ro_stas a test, i stripped out all the jsdocs from my gclosure codebase
15:43ro_stthe size difference between the two advanced mode js files was < 1%
15:43dnolenduck1123-work: not for annotations in general but something for the constructor case if this is a real issue.
15:44duck1123-workI'll have to see if I can make a reproducable test case when I get home.
15:46gfredericks&(nth (iterate list ()) 2000)
15:46lazybotjava.lang.StackOverflowError
15:47gfredericks&(-> (iterate list ()) (nth 2000) flatten count)
15:47lazybot⇒ 0
15:52gfredericks(shuffle (range 100))
16:04rainerschusterhow can i make this function automatically close the reader after the lazy-seq, which read-csv returns, is consumed?
16:04rainerschuster(defn load-csv [filename]
16:04rainerschuster(let [in-file (io/reader filename)]
16:04rainerschuster(csv/read-csv in-file :separator \tab)))
16:05antares_rainerschuster: http://clojuredocs.org/clojure_core/clojure.core/with-open
16:06rainerschusterif 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:06amalloyrainerschuster: that's an immensely hard problem that clojure doesn't try to solve
16:07amalloyyou need to do your processing of load-csv from inside the with-open block, rather than returning it outside
16:07rainerschusterbut thats what i'm used to ...
16:07rainerschusterim interested in solving the problem from the outside
16:07rainerschusteri know how to do it in c#, python or f# ...
16:08amalloyit'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:08rainerschusteryes indeed!
16:08rainerschusterthats what the GC does for me in other languages
16:09amalloyso 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:09rainerschuster:)
16:09amalloysee http://blogs.msdn.com/b/oldnewthing/archive/2010/08/09/10047586.aspx if you're interested in the philosophy of gc
16:10rainerschusterso your proposal is to fix data.csv to be able to take a filename and automatically creating and closing the reader?
16:11rainerschusteri do understand that i have to do it from the inside. i thought there is some macro trickery thats already done
16:12antares_rainerschuster: making data.csv support your case would be the best
16:18emezeskerainerschuster: In what language does the GC close resources such as files for you?
16:18Wild_Catemezeske: in Python (CPython anyway) it does. I think it does in Java too, but I could be wrong,
16:18emezeskerainerschuster: I thought that doing that was generally a bad idea, as you don't know when the GC will collect, etc
16:19emezeskeWild_Cat: You should never rely on that though, right? What if you open tons of files, and the GC doesn't run?
16:19rainerschuster(emezeske): yes. and I was wrong. I've used the very same pattern in F# before http://fssnip.net/3T
16:19Wild_Catemezeske: 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:19Wild_Catit is however, bad practice to rely on that
16:20Wild_Catthe right way to use files in Python is "with open("foo") as my_file: # do stuff"
16:20rainerschusterin pyton I'm using with too, but there i've got generators i can use and yield
16:20Wild_Cat(the file is guaranteed to be closed when exiting the with block, even with an error)
16:20alvin-xWhen 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:20emezeskeYes, with is the right way in python
16:21rainerschusterso with-open is the right one in java.
16:21emezeskeRight, but with laziness things are much more complicated, a la amalloy's notes
16:21amalloyemezeske: the same should be true of python's generators
16:21rainerschusterso i've to extend data.csv in order to support the case where I only want to specify the filename
16:22emezeskeamalloy: Definitely
16:22emezeskeamalloy: Leave the with block, while keeping a reference to a generator that has a reference to the open file, and boom
16:22rainerschusterread-lines from contrib is the right pattern
16:23amalloyno, read-lines is disastrous, which is why it didn't get promoted to clojure.java.io
16:23amalloyit has exactly the same problem with GC and resource handles
16:24rainerschusterso how can i create a function where I only serve in a filename and want to retun a lazy-seq?
16:24rainerschusteri don't
16:25rainerschusteri've to always be aware of the resources and how to read them
16:25rainerschusterso how can i abstract the knowledge ot the readersources away?
16:27antoineBi am wondering if it is possible with ring to send response when i want? (a response wich is not responding to a request)
16:27amalloy(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:27dnolenrainerschuster: open problem, http://dev.clojure.org/display/design/Resource+Scopes
16:27rainerschusterso thats the point that anoys me
16:28amalloyunlucky, mate. sounds like clojure is reminding you that sloppily-written resource handling causes incorrect programs
16:28emezeskerainerschuster: How is it supposed to magically know that you are done with the lazy sequence?
16:29Raynesamalloy: Hurr hurr you said mate.
16:29amalloy/ignore Raynes
16:30rainerschusterI've allready realized what you suggested.
16:30RaynesYou'd never.
16:32rainerschuster(dnolen): thx for the hint
16:34duck1123-workIf I have a "provided" dependency, should uberjar skip that dep?
16:36rainerschusterso your suggestion is to a) eager consume the file or b) open the reader from toplevel with-open (like it's allready done)
16:37rainerschusteri'm fine with that solution. thx for advice
16:40rainerschusterin order to use data.csv on the repl i allways have to doall?
16:53duck1123-workgtrak: 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:54gtrakduck1123-work: nice
16:54gtrakI thought it was a closed-source app though, did you have to do anything special?
16:54duck1123-workNo, I just set it up as a listener
16:54gtrakah, cool
16:55duck1123-workof 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:07semperosdnolen: 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:11gtrakduck1123-work: yea, you could do some classloader tricks I suppose
17:11dnolensemperos: you need to implement unification for your defrecord
17:12semperosdnolen: alrighty; any examples lying around, or a good place in core.logic's source to see exactly what I need to implement?
17:12dnolensemperos: look at the core.logic wiki for the Datomic example - the example explains how to extend unification
17:12semperosdnolen: great, thank you :)
17:13semperosbuilding an LP-based version of my clj-webdriver library for testing/exploration
17:13dnolensemperos: 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:13semperosdnolen: I didn't know where to start, you've solved that
17:14semperosany issues I encounter are more likely my error/misunderstanding
17:15dnolensemperos: 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:15dnolenconcrete type I mean.
17:15semperosgotcha
17:16dnolensemperos: are you unifying records w/ records?
17:16semperosin 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:17semperosyes
17:17semperosI can give a simple example
17:20semperosdnolen: https://gist.github.com/3178729
17:20semperosthere's a bunch of state that's not included in that gist, but the idea is hopefully clear
17:21semperosthe "elements" returned by wd/find-elements are Element records
17:21semperosbut 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:21semperoslooks like that Datomic example is just what I need
17:22semperosthe repo for this is here: https://github.com/semperos/webdriver-logic
17:24dnolensemperos: this look really cool
17:24dnolenlooks
17:24semperosI'm really liking it :)
17:24semperosthe 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:25semperosbut I'm still in LP preschool, learning-wise
17:26dnolensemperos: yes, this looks really awesome. Definitely excited to see where this goes!
17:26semperosdnolen: appreciate it, and thanks for the help
17:27dnolensemperos: planning on doing a big doc push soon - will probably start keeping track of really sweet *practical* projects like this.
17:27semperossweet
17:28semperosencoding functional web tests using LP, esp. for apps with complex client-side state, permissions, workflows, etc., seems like a natural win
17:28duck1123-workso is webdriver logic good for testing, or do you see other things for it?
17:29semperostesting is one side of it, since clj-webdriver, like Selenium-WebDriver, has an eye towards web testing
17:29semperosbut webdriver-logic isn't good for too much at the moment, as I only have a couple relations :)
17:29duck1123-workI currently use clj-webdriver from Cucumber. wondering if I should give this a try
17:30semperosyou're welcome to check it out and contribute ideas/code, but I wouldn't try using it for too much
17:31dnolensemperos: sure, but a very neat approach, I'm assuming this actually addresses some pain points w/ the traditional approach?
17:31semperosit's in pre-pre-alpha
17:31semperosdnolen: I've frankly yet to see a "traditional" approach that doesn't break down into lots of manual testing
17:32dnolensemperos: hmm, I wonder if constraints could come into play here ...
17:32semperosI'm doing poor-man's constraints
17:32duck1123-workdid the new webdriver update htmlunit? I've been getting an error lately. I saw the announcement, just haven't gotten around to testing
17:33semperoswith pluggable XPath queries for the parts of my relations that provide "all elements" on the page, for example
17:33semperosalso 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:33semperosusing 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:34semperosduck1123-work: I need to add htmlunit to my own set of tetsts
17:34semperosI actually only run each release against firefox and chrome, at this point, passing the browser compatibility buck upstream to a certain extent
17:34semperosclj-webdriver doesn't do anything that should break compatibility, I'll put it that way
17:34craigbrooh man
17:34craigbrorunning into compojure routing issuee
17:34craigbroI am url encoding paths as pat of the url
17:35dnolensemperos: 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:35craigbro/paths/%5CWINDOWS%5Cwhatever.exe
17:35semperosdnolen: I think deep in core.logic is where everyone wants you :)
17:35semperosbut I'll ask if I hit major road blocks
17:36craigbrooh well, dinner and then debugging
17:36semperosduck1123-work: send a message on the Google Group or file an issue if HTMLUnit isn't working for you
17:36semperosgotta scoot, later folks
17:36duck1123-workyeah, let me get home and give it a try. if it's still hapening, I'll file something
17:54solussdtechnomancy: 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:58mister_zombieHey, I have a quick question, what's the weapon of choice for scalable web services in Clojureland?
18:01brehautwell 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:04brehautdepending 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:06mister_zombieI may be poking it up to several hundred million times a day and I need a really tight response time
18:06TimMcmister_zombie: I hope it clusters well.
18:06brehautscalability is a feature of your application architecture, not of libraries, languages or frameworks
18:07mister_zombieI know, but some things may make my going easier or harder.
18:07TimMcWait... ##(/ 1e8 24 60 60)
18:07lazybot⇒ 1157.4074074074074
18:07TimMcSo you need millisecond average response time?
18:08mister_zombieIdeally.
18:08mister_zombieQuickest response time possible.
18:09mister_zombieI'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:12mister_zombieAnd I'd like not to be caught in this http://www.kegel.com/c10k.html
18:13craigbromister_zombie: I thinkin the end your show stoppers are gonna be with the java web servers
18:13craigbromister_zombie: in terms of the bottom range of your latency
18:14brehautmister_zombie: http://www.colinsteele.org/post/27929539434/60-000-growth-in-7-months-using-clojure-and-aws
18:14craigbromister_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:14mister_zombieI'm aware I won't go lower than several tens of millis, but that's fine
18:16craigbrobrehaut: oh man, that URL makes me cringe 8)
18:17craigbrobrehaut: not in what they did, but thinking about how I am going to shoehorn this dataset into something similiar
18:17brehautcraigbro: i blame tumblr :P
18:18craigbrobrehaut: the baking the non-relational views is a fine approach IMO
18:19craigbrobrehaut: I much prefer architecture driven by performance and understanding of what your real bottlenecks are VS. ideological notion of correct "architecture"
18:19brehautyeah i dont see the point in building something according to some pie in the sky notion of what is 'fast'
18:20brehautbuild it right, make it good, make it fast
18:20brehautand dont expect magic from tools
18:20craigbrobrehaut: and don't try and get it right until you have built it a few times 8^)
18:20brehautha
18:20craigbrobrehaut: if one of your first couple tries works, good on you, but don't get too far ahead of yourself 8)
18:21a|ihow fast is clojure.xml comparing to other jvm xml paresers?
18:21craigbroaji: I use java xml parsers
18:22craigbroa|i: oh, I thought you were garlic
18:22mister_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:22craigbromister_zombie: wasn't referring to you 8^) More like referring to my previous selfs 8^)
18:22brehautajl: clojure's xml libs are simple and convinient by they are not comprehensive. no NS support for instance
18:22a|icraigbro: why java xml?
18:23craigbroa|i: well, in my case, I needed to transform XML/HTML coming in one side, and going out the other
18:23craigbroa|i: I used jsoup for that
18:24mister_zombiecraigbro: Yeah, but I do feel like i've lived that in the past too XD
18:24craigbroa|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:24a|icraigbro: how about this https://gist.github.com/822769
18:24craigbroa|i: I guess the point is, your questiond epends on what you want to to|optimize for
18:25craigbroI don't know what a VTDNav is, or how you use it
18:25a|icraigbro: I simply want to read xml, no write.
18:25a|icraigbro: vtdxml seems to be the fastest xml pareser in java.
18:27craigbroa|i: then use that I say
18:28a|icraigbro: yeah, I was just wondering if the functional nature of clojure would make parsing xml even more efficient.
18:29craigbroa|i: not in my experience
18:29craigbroa|i: in fact, I found that enline, which is an HTML/XML transofrmation toolkit, paid a big price for immutability
18:29craigbroa|i: why I moved to jsoup
18:30a|icraigbro: is there a benchmark for that?
18:31craigbroa|i: for what?
18:32a|icraigbro: jsoup vs enline
18:32craigbroa|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:32craigbroa|i: and with jsoup it flies
18:32craigbroi can tell you why that happens tho
18:33craigbroa|i: enlive reads a document into a data structure, transforms the structure and then spits it out
18:33a|iis jsoup mutable-base?
18:33craigbroit's java
18:33craigbroso yes
18:34RaynesSometimes mutable is good.
18:36TimMc~guards
18:36clojurebotSEIZE HIM!
18:37Raynes(.delete TimMc)
18:37TimMc*blip*
18:37craigbroI wasa purely functinal programmer myself, until I took a conj to the knee
18:37craigbroyears of Common Lisp earned me the esteem of my coworkers, and the nickname Sir Cons Alot
18:39craigbroreally, it's so sad that programming is hampered by ideological purity, as if we learned nothing from the last 200 years of philosophy
18:39craigbroeven more ironic when you consider that cyberpunk was originally the "New Romantic" movement
18:40craigbroand the Romantics were a critique of the positivism and ideological blindering of the enlightenment
18:43craigbroa|i: wow, VTD looks interesting. thanks
18:44a|icraigbro: :)
18:44duck1123craigbro: when the guards in my game say that line, lightning strikes them down. (re: to the knee)
18:45craigbroa|i: now, i only we could ensure in the JVM that that string representing the file was just mmap'ed
18:45craigbroaji: then we would have a real XML document handler 8)
18:45a|icraigbro: cool.
18:46craigbroduck1123: I only have ps3 version, so no mods for me. 8^(
18:46a|iI have to choose between scalaa and clojure, anyone wants to sell me clojure?
18:46a|iscala*
18:46duck1123I run like 25 mods normally
18:46craigbroa|i: for what?
18:47a|icraigbro: a backend for a web app, mostly like a crawler.
18:48craigbroa|i: insufficient data
18:50a|icraigbro: it will do some statistical calculations on data grabbed from some external api.
18:52craigbrostill seems a matter of tast eto me
18:52craigbroexploratory programming is easie rin clojure I think
18:52craigbroaka, not sure what you are gonna do with the information, or how to handle it
18:53craigbroor what algorithms to use
18:53duck1123clojure has incanter, which you'll probably like
18:53a|iincanter?
18:54duck1123http://incanter.org/
18:54duck1123not something that I get into, but still cool
18:54a|iwow nice, like R. is it as comprehensive?
18:57a|iis there an equivalent of scala pattern matching in clojure?
18:57duck1123actually, 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:58duck1123I don't know scala's pattern matching, but you can work wonders with multimethods and/or the matching and logic libraries, so... yes?
19:00a|iwell of course there is the problem of too many prents :)
19:02duck1123the 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:03gert_duck1123: which is why paredit is so awesome
19:04a|iduck1123: I'm an absolute 'noob' in clojure, just watched that 10 part video on youtube, and didn't get any of it.
19:04a|iwhich book is good for start?
19:05duck1123I haven't read all the books, but Programming Clojure is a good intro
19:05duck1123and then get Joy of Clojure to read when you "get it"
19:05antares_clojurebook.com is what I'd recommend
19:06duck1123I need to read that, I glanced at it earlier
19:07a|ithanks.
19:07brehautclojurebook.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:08brehautclojurebook.com also has some great practical chapters
19:08a|iis joc faster or more advanced?
19:08Raynesantares_: Is there a particular format you'd like my code review to be in? An email, comments in a pull request, etc
19:09antares_Raynes: a gist with ``` clojure code fragments is probably the best
19:10Raynesantares_: I don't do gists.
19:10antares_ugh, now that was stupid
19:10Raynes:P
19:10antares_Raynes: ok, a REFHEAP of any kind would work!
19:11RaynesI love doing that to people.
19:11RaynesMaking them feel bad when they ask me to gist something.
19:11antares_haha
19:11duck1123pastebin then
19:11gtrakRaynes <- hold on to your request one sec.. USE THE APP I JUST MADE
19:11amalloyRaynes: 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:12amalloyi don't know exactly what behavior you'd make, but i'm sure you get the gist of it
19:12antares_clojurebot: gist
19:12clojurebotgist is https://refheap.com/
19:12RaynesDidn't you propose I make lazybot echo gist links with refheap links with the same content?
19:12antares_see, clojurebot is already corrupted :P
19:12amalloyhaha, i probably did. that sounds like me
19:15Raynesantares_: My only reget is that refheap doesn't support markdown at the moment. :(
19:15RaynesIt's on my todo list.
19:23TimMcamalloy: "get the refheap of it"? I'm not sure what that means.
19:25rabidsnailI 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:25rabidsnailHow is that possible?
19:27brehautit only applies to the namespace its declared in
19:27brehauti believe leiningen has a global flag you can set, though it will warn on all your dependancies reflection too
19:27amalloybrehaut: that's not a very accurate description, i think
19:28antoineBis there a function that take as argument a function and create an InputStream? (clojure.java.io/input-stream don't)
19:28amalloyif 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:28antoineBmy idea was to make an infinite input stream generated by a function
19:29rabidsnailI was using the leiningen flag
19:29rabidsnailand I did get one warning at startup (from within leiningen)
19:30rabidsnailso at least it was working then
19:30amalloyrabidsnail: the warnings come only at compile time
19:30amalloyit doesn't print a warning every time you use reflection at runtime
19:30rabidsnailthe warning was for NO_SOURCE_FILE
19:30rabidsnailI don' think that was my code
19:31duck1123If it did, those warnings would get fixed quickly
19:44a|iis this job trends graph sane? http://thecodegeneral.wordpress.com/2012/03/04/the-big-three-jvm-languages/
19:44a|iI thought groovy was dead.
19:45antoineBis it possible to add a local variable with proxy?
19:46cemericka|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:46cemerickGroovy is *very* healthy. Easily the #2 language on the JVM.
19:46arkxa|i: Dead? Why? Isn't Groovy the easiest migration path for Java developers?
19:46cemerick(In terms of usage, of course.)
19:47a|ithere are only 35 people on #groovy right now!
19:47gfredericksis there an IRC plugin for eclipse?
19:48arkxHeh, don't confuse IRC participation with popularity.
19:48antoineBso maybe IRC participation correlate with fun or capacities ?
19:49a|iwell, it cannot be not related.
19:49a|imaybe the groovy people are more of enterprise type?
19:49a|ithose people don't know what irc is.
19:50antoineBthey are too serious for irc
19:52antoineBso anyone for my question, how can i store data from the context of a proxy function?
19:54gfredericksantoineB: so that it's accessible over repeated calls on the same object?
19:54antoineByes
19:55gfredericksan atom in a closure should work, right?
19:55gfredericks(let [state (atom {})] (proxy ...))
19:55antoineBmaybe
19:55gfredericksI think if you need state an atom is the default way to get it
19:58antoineBthank you
20:17antoineBi have implemented the code but i can't have access InputStream.read
20:18antoineBInputStream.read is an abstract method but i get an arity error
20:19antoineB(.read (input-stream-fn #(identity "abcd"))) => Error
20:19antoineB(.read (input-stream-fn #(identity "abcd")) (byte-array 1)) => ok
20:20antoineBso 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:23gfredericksantoineB: did you include an explicit argument for `this`?
20:25hiredmanantoineB: you are not defining your proxy correctly
20:25antoineBi do like that (read [_]
20:25hiredmanI suggest you look at using a SequenceInputstream (check the docs for java.io) instead of whatever you are doing
20:26antoineBhttp://pastebin.com/v1gqd4xg
20:35rbarraudAfternoon, CLojurians and Kiwis :)
20:35rbarraudI bought the Fogus book last night - looking fwd to getting into it :)
20:36antoineBbye
20:41brehauthi rbarraud
21:00gertkia ora, brehaut, rbarraud and other kiwis
21:01brehauthi gert
21:05a|ihmm?? https://gist.github.com/3036120
21:06amalloyalways good for a chuckle
21:56xumingmingvclojure does not support empty protocol? In java you can define a empty interface like java.io.Serializable
23:27gertis there a way to add documentation to deftype declarations?
23:32shinta42http://pastebin.com/64dXwGyV can anyone help me fix this defrecord so it runs?