#clojure logs

2013-07-22

12:13seangrov`gfredericks: Is your fork of Korma with postgress array support merged into the main repo now?
12:17seangrov`It does not appear to be
12:17gfredericksseangrov`: was that for reading or writing arrays?
12:17seangrov`Not sure, looking at https://github.com/korma/Korma/commit/9546daf722d5b51e6e248a708b29366db30418f7
12:18seangrov`Maybe it's in, but it's been moved around a bit in master
12:19gfredericksseangrov`: okay that's for writing
12:19gfredericksand I don't know any more than you do about its status in the main branch; I'm actually surprised to see it in the official repo at all
12:19gfredericksI feel like I would have been hesitant to propose db-specific changes like that
12:20seangrov`gfredericks: It being in the official repo is what prompted me to ask
12:20seangrov`Looking to see if Korma has support for Postgres arrays, so I don't have to do create a join table
12:20seangrov`Maybe it's in incubator
12:21seangrov`Korma works very well, but the fact that it's basically been abandoned brings a tear to my eye
12:21gfredericksseangrov`: reading arrays can be done via java.jdbc customization
12:21gfredericksbut writing has to be supported in korma I believe
12:22seangrov`Well, back to basic joins it is then
12:22gfredericks(inc chouser)
12:22lazybot⇒ 12
12:23gfredericksseangrov`: we've been using my fork in production for ~6 months now, so feel free to try that
12:23@chouserI hope I did that right.
12:23seangrov`(inc chouser)
12:23lazybot⇒ 13
12:23technomancychouser: don't let it trouble your conscience
12:24@chousertechnomancy: thanks for the push.
12:25seangrov`gfredericks: I think I'm running a local checkouts version too
12:25seangrov`Maybe I'll take a stab at updating korma a bit post-cljs-sourcemaps/prototypes
12:26`cbp`callen: I think I'll just create a new project since it's a full rewrite pretty much. What should I call it?
12:30seangrov`gfredericks: Looks like the postgres modifications are pretty small, what are the jdbc customizations for reading postgres arrays?
12:37noncom,(into {} (partition 2 [1 2 3 4 ]))
12:37clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry>
12:38noncomWHY??
12:38lazybotnoncom: What are you, crazy? Of course not!
12:38clojurebotWhy is startup slow is busy compiling the `for` macroexpansion
12:38noncombut this works:
12:38noncom,(into {} (mapv #(into [] %) (partition 2 [1 2 3 4 ])))
12:38clojurebot{1 2, 3 4}
12:38noncom?
12:41`cbp,(into {} [[:a 1]])
12:41clojurebot{:a 1}
12:41`cbp,(into {} [:a 1])
12:41clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword>
12:41Anderkentnoncom: into takes a sequence of map entries or 2 element vectors. Partition returns a sequence of lists, these are not recognized as mapentries
12:41chouserHm, well, into basically just call conj.
12:41chouser,(conj {} (list 1 2))
12:41clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry>
12:42Anderkent(basically it expects its input to be what you get from (seq a-map)
12:42chouserI'm just confused as to why the exception says Long instead of List
12:43chouserBut that's probably not noncom's question.
12:43arrdemchouser: yeah I'm weirded out by that too...
12:44Anderkentchouser: because conj can take a map
12:44Anderkent,(conj {} {1 2 3 4})
12:44clojurebot{3 4, 1 2}
12:44Anderkentor rather
12:44Anderkent,(conj {} (seq {1 2 3 4}))
12:44clojurebot{3 4, 1 2}
12:44technomancyisn't conj taking a map widely regarded as a weird and unfortunate quirk?
12:44Anderkentso it looks at the arg, sees it's a list, tries to interpret it as a list of map entries, and fails to cast long to it
12:44chouserwhoa, conj can take a sequence of mapentries?
12:45Anderkenttechnomancy: yeah I'd agree. Still, that's *why* the exception says long
12:45arrdem(ink Anderkent) ;; good breakdown
12:45chouserI need to hang out here more. I'd learn things.
12:45Anderkentarrdem: consider me inked
12:45arrdem(inc Anderkent) ;; try that again...
12:45clojurebotarrdem is awesome
12:45lazybot⇒ 2
12:45Anderkent:D
12:46seangrov`chouser: were you able to give ops to technomancy so he can preside over the learning in your absence?
12:46arrdemI can break 400 APM for you but no spelling
12:46chouserseangrov`: working on it
12:46seangrov`Cool stuff
12:48bbloomchouser: see also https://groups.google.com/d/topic/clojure-dev/NR3qA2mudZA/discussion
12:48bbloomchouser: in general, clojure has some oddities around sequences born from maps
12:50chouserbbloom: I actually read that thread. :-)
12:52bbloomseems somewhat vestigial from pre-protocols days. type predicates and casts baked in pretty low level
12:54chouserwell, protocols in Clojure are still built on top of almost everything else, so using them in these low-level places isn't a convenient option
12:57ziltiIs it possible to create multimethods with more than one argument? It seems like I can't do that
12:57Anderkentzilti: yes, it should 'just work'. what error are you getting?
12:57ziltiI get an ArityException
12:58ziltiI wrote defmulti with a dispatch-fn with two args and defmethod for that which takes two args as well, and no matter what arity I use it never works.
12:58Anderkentzilti: I guess the only tricky bit is that your dispatch function must have the same arity as the methods
12:58Anderkenthuh
12:59Anderkentcan you post that to refheap or somewhere?
12:59ziltiWell I tried this now: (defmulti multi (fn [one two] 1))
12:59zilti (defmethod multi 1 [one two] (println one two))
12:59zilti
13:00arrdemzilti: somewhere isn't chan :|
13:00arrdem*please
13:00Anderkentand you're calling it as (multi 1 2) ? Works for me
13:00ziltiWell it was supposed to be on one line :(
13:01ziltiFor me it doesn't. Do I have to "reset" the repl first?
13:01Anderkentzilti: what clojure version?
13:01zilti1.5.1
13:01Anderkentif you defined the dispatch function before then you should try a different name
13:01Anderkentredefining multimethods does not really work
13:02Anderkent(see http://stackoverflow.com/questions/9368533/reloading-multimethods-via-slime )
13:02ziltiOk... Yes, I now restarted the REPL and it works
13:02Anderkentyeah if try to redef the defmulti (i.e. change dispatch function) you'll be sad. It's a pain.
13:04callenucb: was it the CMS thing http://github.com/bitemyapp/neubite ?
13:04callenucb: just be aware that I'm putting out something updated soon.
13:05callen`cbp: good question. Selmer?
13:20seangrov`callen: You go to the clojure meetups here? I've missed the last few on account they're in San Mateo, but would like to get to the next one
13:20seangrov`Also, we started the cljs meetup, but have yet to run a meetup
13:21aaelonysilly question as I investigate cljs a little. I have lein cljsbuild auto running and I can see changes in the browser, but I miss being able to evaluate expressions in emacs in a repl like manner. Is there a way to get that working as it would with nrepl via emacs?
13:21seangrov`I think it's time we did, what with core.async, source maps, dommy, etc. etc.
13:21seangrov`aaelony: piggieback
13:21seangrov`It'll be a bit of a pain to setup, but it's marvelous once it's going
13:21aaelonyseangrov`: thanks, I'll google it
13:22seangrov`aaelony: That's another piece of work from cemerick on his quest to make the world a better place
13:22dark_elementnoncom finally figured out repl-listen
13:23aaelonyseangrov`: amen, bow, and hat-tip to cemerick !!
13:24eggheadhey, is there any simple way to get lein cljsbuild to use a cljs from my classpath instead?
13:24eggheadI want to use the latest to get it working with core.async but it keeps pulling in 1806 instead
13:24seangrov`egghead: use source-paths
13:25seangrov`egghead: https://www.refheap.com/8863ea58efe4b4e87bf63c708
13:25seangrov`Hrm, looks like I took clojurescript out of there
13:25seangrov`But same idea
13:26eggheadseangrov`: so the only way to do it is to have a complete checkout of the cljs project?
13:26callenseangrov`: not lately, I went to one of Corfield's to teach people Emacs with my dotfiles repo. Not much else.
13:27callenI probably should.
13:27upwardindexLooking for a way to have communication between my cljs and my clj with less pain than manual xhr, any recommendations?
13:27eggheadI can't just say for instance that [org.clojure/clojurescript "0.0-1844"] is one of my deps and have cljsbuild pick that one up?
13:27seangrov`Need to find a place to hold the cljs meetup
13:27seangrov`egghead: Maybe? I seem to recall that working
13:29`cbpcallen: Selmer it is then
13:32callen`cbp: brand of guitar Django used in his later years.
13:32`cbpkk
13:32BufferUnderpant1Hmmm… I'm having some odd issue with clostasche
13:33callenseangrov`: don't.
13:33BufferUnderpant1java.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil
13:33BufferUnderpant1For a file that gets slurped just fine
13:33eggheadhm, looks like it's still using 1806, c'est la vie
13:34BufferUnderpant1(file path)
13:35hexa_Hi all, if I wanted to create a map with keys and values taken by applying a function to another map element what would be a good way ? First tought was something like : (map #({:test (inc %) :test2 (inc %)}) [1 2 3]) but this tells me i'm passing 0 args to PersistentArray ?...
13:36seangrov`egghead: The source-paths method is pretty simple
13:37seangrov`Just create a 'yaks' folder, git clone the cljs repo into it, set the entry, and you won't have to touch it again
13:37eggheadya, I'm messing around with that now
13:37eggheadgiving me errors about data.json not on a the classpath :3
13:38`cbphexa_: use fn not a function literal
13:39`cbphexa_: you could also do ##(zipmap [:test1 :test2 :test3] (map inc [1 2 3]))
13:39lazybot⇒ {:test3 4, :test2 3, :test1 2}
13:39silasdavisin compojure how can I define a set of routes that I can mount relative to some base URL
13:40hexa_`cbp, what with an fn literal what would it look like ? map #(fn [element] {:test (inc element) }) ?
13:41silasdavissuppose I have (GET '/some-entity/foo' resource) in my routes and I want to achieve the same effect as if I had (GET '/some-base/some-entity/foo' resource)
13:41silasdavisfor example
13:41eggheadhuh, so this clojurescript project has external deps from clojure core but doesn't specify them?
13:42eggheadhttps://github.com/clojure/data.json https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/source_map.clj#L4
13:42jkkramersilasdavis: compojure.core/context
13:42`cbphexa_: remove the '#'. Although i'm not sure what you want exactly, maybe give me an input => output example?
13:43silasdavisjkkramer, thanks
13:44hexa_`cbp, I'm just tryng to create a map with the result of a function as keys like for all files in dir get me a map with Name , Path etc...
13:45silasdavishexa_, yeah the # function syntax has an implicit evaluation of the contained form I think you could write something like #(constantly { ... }) as an alternative, but fn is probably better
13:46eggheadhmm, looks like maybe core.async is just incompatible with the cljs advanced optimization
13:46seangrov`egghead: did you include org.clojure/data.json as a dep in your project.clj?
13:46eggheadusing the latest cljs checkout
13:46eggheadsad day
13:46hexa_silasdavis, (map (fn [ele %] {:test (inc ele)}) [1 2 3]) not quite right I guess ?
13:46eggheadseangrov`: yah I added it, a bit annoying that I had to :p
13:47eggheadwhile core.async works well without optimizations, when I do advanced it throws
13:47silasdavis(map (fn [ele] {:test (inc ele)}) [1 2 3])
13:48eggheadhas anyone else tried to do advanced compilation with core.async ?
13:48hexa_silasdavis, haa right right thehe thx ! :)
13:48silasdavishexa_, (map (fn [ele] {:test (inc ele)}) [1 2 3])
13:48hexa_`cbp, thx too :)
13:50callencemerick: I've definitely met some Ruby programmers that were muppets.
13:52dnolencemerick: pong
13:53eggheaddnolen: have you messed w/ advanced compilation on cljs/core.async ?
13:53eggheadcode that works fine with :whitespace blows up with :advanced
13:54dnolenegghead: never encountered a problem myself but do you have a minimal case?
13:55eggheaddnolen: ah if you have done it successfully it's probably a problem in a dep or something
13:56eggheadthanks, i'll start digging more, if it persists I'll get you a minimal project showing it
13:56eggheadalso, what are you guys using for cljs testing?
13:56eggheadI was messing around with https://github.com/cemerick/clojurescript.test but it looks like it's broken for the current version of cljs
13:58seangrov`dnolen: When you get a chance, would appreciate some guidance on this source-map https://gist.github.com/sgrove/6050286
13:58seangrov`Working for fn params (variadic and non-variadic) and let bindings
14:14eggheadah okay, the collission was using the shoreleave library with core.async
14:14eggheadnow to figure out how to get my tests working again :)
14:16ucbcallen: yeah; thanks
14:17eggheadso are there any good cljs test libs that work with modern cljs?
14:18seangrov`egghead: cljs.test is the only one I've had work well at all
14:24dnolenegghead: talk to cemerick about clojurescript.test, I'm sure it's a simple fix
14:24cemerickegghead: what's the error you're getting?
14:25dnolenseangrov`: yes that looks good to me
14:27dark_elementHow can i write update! around set! in clojurescript
14:28eggheadcemerick: it was actually an error with source maps not being able to be generated, now it's just the set-print-fn! warning
14:28callen`cbp: talk to yogthos.
14:28callenyogthos: talk to `cbp.
14:28dark_elementI am trying to create utility functions using set!
14:29cemerickegghead: ah, ok; yeah, that was a shim put in before set-print-fn! was in core. It's irritating, but still useful for people not aggressively tracking cljs head.
14:29dark_elementbut i am getting Assert failed: Can't set! local var or non-mutable field
14:29bbloomdark_element: set! is a special form, so you could only really usefully wrap it w/ a macro
14:29dark_elementbbloom ah! ok
14:29cemerickIt'll go away at some point.
14:29bbloomdark_element: but you probably shouldn't be doing that unless you know what you're doing :-P
14:29dnolendark_element: you can't set! locals vars nor non mutable fields
14:30bbloomdark_element: if you're coming from a scheme or common lisp background & looking for a way to do something like setq or whatever, you probably should *not do that*
14:30dark_elementdnolen bbloom i am trying to create something like this https://www.refheap.com/16809
14:30bbloomdark_element: use an atom
14:31eggheaddnolen: I'm sure you're way too busy for this but just wanted you to be aware: cljs 1844 w/ source maps enabled: https://www.refheap.com/16810
14:31eggheadgoes away when I don't tell the compiler to make me a source map
14:31dark_elementbbloom i need to change javascript objects.
14:31bbloomdark_element: OH
14:31eggheadprobably an edge case of doing something that doesn't map well or some similar funny biz
14:31bbloomdark_element: use aset and aget instead of set!
14:32bbloomaset and aget are basically the object["syntax"] in javascript
14:32bbloomthey are functions, and so can be sensibly wrapped
14:32bbloomand will work correctly on json etc w/o being squashed by advanced mode's name compression
14:32dark_elementbbloom ok
14:33dnolenegghead: hmm, yeah if you can create minimal project that demonstrates the issue, open a CLJS ticket with a link, or just with a description of the steps.
14:34bbloomdark_element: presumably you could create aget-in, aset-in!, and aupdate-in! which would work similar to get-in, assoc-in, and update-in
14:34bbloomthen you wouldn't need to code all the inc! and dec! and all those individual functions
14:35dark_elementbbloom that was my next question!
14:35dnolenbbloom: aset and aget are already variadic
14:35bbloomdnolen: glorious. did not know that
14:35bbloomhaven't had a need for it yet
14:35bbloomdark_element: well there you go. done for you :-P
14:36dark_elementdnolen great! checking
14:36dark_elementdnolen bbloom thanks!
14:38magnarsJust released my first clojar: catenate. It's a Ring middleware to serve concatenated static files with cache buster URLs in production. Comments are welcome. :) https://github.com/magnars/catenate
14:50dark_elementdnolen it works. created update-in wrapping around it.
14:52callen`cbp: https://github.com/yogthos/Selmer/
14:54konrHow can I check whether something is a function?
14:54llasramLike this? ##(fn? identity)
14:54lazybot⇒ true
14:54konryeah! thanks
14:55bbloomsee also: ##(doc ifn?)
14:55lazybot⇒ "([x]); Returns true if x implements IFn. Note that many data structures (e.g. sets and maps) implement IFn"
14:56clj_newb_234is rich hikey's clojure.core.async talk available online?
14:57bbloomnot yet, i don't think
14:57clj_newb_234this is a crime against humanity
14:57HolyJak:)
15:00atyzHey guys, Is there string interpolation in clojure? I've found core.incubator but I'm not sure if that will be around for long as the impression I get is that it's a testing ground
15:01bbloomthe str function is variadic, which is close enough
15:01atyzHmm ok
15:01atyzThanks
15:01bbloom(str "compare to " language " and you won't miss interpolation")
15:02OneFourSevenWhat's the difference between parenscript for Common Lisp and Clojurescript?
15:02bbloomOneFourSeven: they are completely different languages
15:02atyzbbloom: I know - just would have made my life a little easier for a second
15:02`cbpcallen: Should I clone that? I already had my project made but no commits yet
15:03`cbpI was also picturing tags to work a bit differently
15:04`cbpyogthos: hi
15:05dnolenOneFourSeven: far as I know parenscript isn't really a stand alone language
15:06dnolenOneFourSeven: ClojureScript is an implementation of Clojure
15:07nDuffHrm.
15:08nDuffduck1123: how do you get hiccup to emit namespace declarations? When I use {:xmlns/jk "http://tomcat.apache.org&quot;}, it just emits jk="http://tomcat.apache.org&quot;
15:09duck1123nDuff: https://github.com/duck1123/jiksnu/blob/master/src/jiksnu/model/webfinger.clj#L24
15:09duck1123use strings
15:10callen`cbp: just talk to yogthos. Sync up with him. He wants to work with you on it.
15:11`cbpok
15:11pandeirowhat is the proper way to bring core.async into a cljs project?
15:11dnolenpandeiro: you need to run lein install on your system or include a reference to the sonatype staging maven repo
15:12nDuffduck1123: ahh; thanks.
15:12duck1123nDuff: Not the prettiest, but it did the trick and saved me fron hunting for a better solution
15:13pandeirodnolen: it's one lib for both hosts, right? git clone <async> && cd <async> && lein install ?
15:13pandeirodnolen: thanks for the explanatory post btw, very cool
15:13nDuffduck1123: yup. Works for me too, though I'm currently cloning hiccup to see about submitting a patch to make things less ugly.
15:15dnolenpandeiro: yes that works, np
15:16`cbpyogthos: lmk when you're available
15:27duck1123nDuff: Also, you cna use :xmlns:jk like in https://github.com/duck1123/jiksnu/blob/master/src/jiksnu/views/site_views.clj#L33
15:27seangrov`bbloom: Roughly how long after Rich receives the CA until the contributors page is updated and I can join the clojure-dev ml/edit the confluence wiki?
15:28bbloomseangrov`: i don't recall
15:28seangrov`Alright, just wondering if there's a implicit understanding of his habits
15:29bbloomthere's definitely somebody much better equipped than me to answer that question
15:29nDuffduck1123: Oh! That's not so bad, then. Thanks!
15:29bbloomnot sure who it would be tho :-P
15:29seangrov`bbloom: I'll just check through the channel handles alphabetically
15:29bblooma wise plan, i'm sure
15:30seangrov`Anyway, not the biggest deal, just eager to get the changes submitted before it gets too big
15:30kovasseangrov`: my understandind is that the CA goes to relevance
15:30kovas(thats what the address is)
15:30seangrov`kovas: I sent mine to the address listed on http://clojure.org/contributing
15:30kovasyeah, thats relevance
15:31kovasand then someone there takes care of it
15:31seangrov`Heh, good stuff
15:31kovasi don't think it will be sitting on a desk for a long time
15:31kovasbut there might be a weekly batch or something
15:31seangrov`Awesome, thanks
15:31seangrov`Oh, I'm listed now!
15:32seangrov`I guess it was processed already, wow
15:42squidzwhy arent clojurescript objects treated as json objects?
15:42squidzor the other way around
15:44arrdemso where does the ^:integer wind up in &(read-string "^:integer 'foo")
15:46amalloyarrdem: (set! *print-meta* true) and see
15:46arrdemamalloy: is that not just (meta) ?
15:46amalloyhuh?
15:47chronnols
15:47lazybotlib lost+found selinux src tmp
15:47arrdemlewl
15:47chronnooops, wrong window
15:49akurilinAnybody seen weavejester around in the past few days?
15:49arrdemamalloy: I don't follow. you're saying that (with-bindigs [*print-meta* true] (pr ^:integer 'foo)) should show that metadata, but if I query the symbol via (meta) it won't show?
15:49xeqi$seen weavejester
15:49lazybotweavejester was last seen quitting 3 days and 21 hours ago.
15:49hyPiRionhey, whene did lazybot get back up?
15:50amalloyi'm not saying that. i'm saying if you print the value with *print-meta* set to true, you will see exactly where all the metadata is; calling meta is another plausible approach, which you brought up yourself
15:51amalloywould work in this case, since the meta is on the topmost object, but if it were nested inside somewhere you wouldn't see it
15:52arrdemhum... I follow but I'm not succeeding in printing any metadata in my repl.
15:53dnolensquidz: not sure what you mean
15:55amalloyarrdem: (pr ^:integer 'foo) is very different from (pr (read-string "^:integer 'foo")))
15:55amalloythe second case is read as data, while the first is evaluated as code
15:57arrdemamalloy: ah. I have the latter behaving, I guess my question is why in the first case is {:integer true} not (meta foo).
15:57arrdemoh wait it's (meta (quote foo))
15:57yogthoscbp what's your github id? :)
15:57yogthos`cbp: what's your github id? :)
15:57`cbpyogthos: cesarbp
15:59yogthos`cbp: ok you should be in :) https://github.com/yogthos/Selmer
15:59yogthos`cbp: not much there yet, I'll check the stuff I've been experimenting with when I get home though
16:00yogthoscheck in even :)
16:00`cbpyogthos: I had a small parser + filters implemented so far
16:01`cbpyogthos: Maybe we can talk more when you're available
16:01yogthos`cbp: yeah I started on parser, but it's pretty early stages
16:01yogthos`cbp: can chat a bit now if you've got time
16:02nDuff...there was a bug report against nrepl-ac.el for that, but I'm running a much newer version than where it was supposedly fixed/closed
16:02ivanhttps://github.com/kingtim/nrepl.el/issues/315
16:02squidzdnolen: I just wanted to see what the reason we always have to use clj->js and js->clj is
16:03squidzdnolen: may be a silly question
16:03nDuffivan: not sure if that's it -- I'm seeing large runs of subsequent newlines, typically 10-20 or so, rather than one every K or therebouts.
16:03ivannDuff: try commenting out that line anyway
16:04konrsquidz: a clojure hash cannot be mapped to a js object, for example, because this can have both a method 'foo' and a field 'foo'
16:05ivanjs objects can have a foo method and a foo property?
16:05konrivan: that's why we need .-foo and .foo
16:06ivanunless I'm having a serious brain malfunction I think you are mistaken about js
16:06squidzwhy dont we just map to one of them or both?
16:07dnolensquidz: ok, yeah I don't really see how it could work any other way - ES 6 Proxies could simplify this issue
16:07gfredericksconsarnit that seangrov fellah left; does anybody know him? is he on twitter?
16:08dnolengfredericks: sgrove on twitter
16:08gfredericksdnolen: excellent thanks
16:08ivankonr: maybe I misunderstood, I thought you were saying they can have both at the same time
16:09nDuffivan: it's not that the same thing can be both, but you don't know if it should be called or accessed as a property
16:09ivanright
16:11akurilinbtw that "where was x last seen?" feature of lazybot is amazing
16:11akurilinkudos to whoever made that.
16:13nDuffivan: Seems to be resolved, though the codepath I've been seeing it through is somewhat sporadic (smells like it's related to what the autocompletion plugin is/isn't doing), so I don't have certainty around that yet. Thanks.
16:14akurilingithub etiquette question: is it very impolite to file an issue again someone's repo if you suspect it might have an issue, but you're not really sure? Is emailing the owner preferable?
16:14callenakurilin: just file the issue.
16:14ivangithub issues are the new email, man
16:14technomancyakurilin: I would say personal email is not appropriate for bug reports unless it's listed in the readme or something
16:15callenakurilin: but you should totally call technomancy on his cell phone whenever you have a problem with Leiningen.
16:15technomancyissues are easy to close and leave a public paper trail for posterity
16:15callen^^ yep.
16:15akurilinOk thanks, til.
16:15technomancyjoke's on you; I get no reception here
16:17Raynesakurilin: That would be me, sir.
16:17callentechnomancy: does Heroku use wikis? If so, which ones?
16:17callentechnomancy: if not, how is documentation handled?
16:17akurilinRaynes, thumbs up, love it :)
16:18hyPiRion(inc Raynes)
16:18lazybot⇒ 33
16:18technomancycallen: internally or for public-facing stuff?
16:19RayneshyPiRion: amalloy tells me that Gaiman is going to write more Sandman this fall.
16:19callentechnomancy: internally
16:19callenRaynes: don't tease me.
16:19hyPiRionRaynes: oh, that's awesome
16:20callenI'm already suffering under the yoke of Eliezer Yudkowsky
16:21technomancycallen: a few use github wikis, but most use a doc/ dir full of .md files
16:21fikuszwhy nrepl btw? what's wrong with slime?
16:21amalloyhyPiRion: i heard him say so on ttbook, if you are interested in verifying it yourself
16:21callennot this again :|
16:21fikuszI always get confused when switching between cl and clojure projects...
16:22hyPiRionamalloy: no thanks, I'll just believe you and complain to you when he doesn't write more Sandman.
16:22amalloyhyPiRion: just file a github issue, please
16:22technomancyfikusz: the slime protocol isn't documented and changes approximately whenever they feel like it
16:22hyPiRionamalloy: alright, will do later
16:23technomancyso there's really no way to support it without locking to an old version, and thus making it basically impossible to hack on both cl and clojure anyway
16:23fikusztechnomancy: I understand, is there an easy way of making the emacs interface compatible? (basically I mean the keybindings...)
16:23technomancyfikusz: define-key?
16:24fikusztechnomancy: also repl shortcuts, like the comma
16:24technomancythe comma stuff isn't implemented in nrepl
16:25fikusztechnomancy: okay, thanks for the info!
16:26technomancysure
16:26futilethanks
16:26fikusztechnomancy: btw, the wikipedia page for slime (http://en.wikipedia.org/wiki/SLIME) lists lots of languages which use slime
16:27futiletechnomancy: so I was going to rename test2 to test-ease, but something tells me that's not a good idea
16:27fikusztechnomancy: even Ruby and GNU R
16:27fikusztechnomancy: well also Clojure apparently :)
16:27TimMcfutile: That sounds like a project the Ruby community would produce.
16:27technomancyfikusz: what's not shown is how broken each individual implementation is
16:27futileTimMc: whoa so it does
16:28futileI really hate that I was part of the Ruby community
16:28technomancyfikusz: it's not that hard to make it work with a specific snapshot, but continued stable support over time is very difficult
16:28futileIt was an accident, really!
16:28TimMcWell, now that it's "no longer cool
16:28TimMc", maybe it will get nicer.
16:28futileWait, who says its no longer cool?
16:28fikusztechnomancy: ok, thanks again
16:29TimMcSome interblog or another, I dunno.
16:29technomancyplus the nrepl protocol is just a better design
16:29futileTimMc: well this Ruby guy tells me otherwise http://rosiesaysblog.files.wordpress.com/2012/04/brogrammer.png
16:30TimMcOnly one popped collar, I call fake.
16:30fikusztechnomancy: are there any resources for people coming from slime? It must be where most people come from...
16:31winkhow do I escape a variable in replace? i.e. something like (let [x "foo"] (clojure.string/replace "foobar" #^x "z")) <- the x
16:31technomancyfikusz: the only difference I can think of is C-c M-n to change namespaces since they're not called packages in clojure
16:31futileI'm so disillusioned by programmers.
16:31bbloomwink: your syntax is bad there
16:31bbloom`#^x "z"
16:32bbloom,#^x "z"
16:32clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Metadata can only be applied to IMetas>
16:32bbloomthe ^ applies metadata
16:32bbloom,#"^x z"
16:32clojurebot#"^x z"
16:32winkbbloom: it's a literal #"^foo"
16:32fikusztechnomancy: well and debugging, inspection, the threading features
16:32technomancyfikusz: oh yeah, that stuff is mostly handled by ritz
16:33bbloomwink: you want to construct a regex from strings?
16:33fikusztechnomancy: ritz?
16:33bbloomyou can call the java RegExp constructor
16:33technomancyfikusz: the nrepl debugger library
16:33winkhm. thanks. uglier but doable, yeah
16:34bbloomwink: use ##(doc re-pattern)
16:34lazybot⇒ "([s]); Returns an instance of java.util.regex.Pattern, for use, e.g. in re-matcher."
16:34fikusztechnomancy: well ritz still seems to have a swank server
16:35technomancyfikusz: it has both
16:36fikusztechnomancy: I think I'll try it, just for good measure :)
16:36nDuffivan: ...had that happen again w/ the patch applied.
16:36futileAs Puddleglum would put it, "This time next week, I probably won't have a job, I shouldn't wonder."
16:41futileWhat do you all think of this crazy idea? Instead of setting attributes by maps with keywords as keys, you update attributes by function.
16:41hyPiRionupdate-in, you mean?
16:41futileSo instead of (merge (new-widget) {:price 1 :quantity 10}), you would do (-> (new-widget) (set-price 1) (set-quantity 10))
16:42futileI really mean basically adding some verbosity to your business logic in the name of typo-safety.
16:43futileI've been bitten by the names of keys being slight different in some places in my app, and legitimately typing it one way here and another way there, but sometimes mixing them up.
16:43pandeirois it possible to hook a clojurescript repl up to any arbitrary webpage?
16:43arrdempandeiro: I believe not
16:43arrdempandeiro: clojurescript is not self hosting
16:43TimMcpandeiro: You could probably do it with an intercepting proxy.
16:43justin_smithfutile: you could use defrecord for that while you are at it (defining fields that are callable to return a modified version of the record) and gain some runtime efficiency as well
16:43technomancyfutile: racket does that with structs. it means you have to multiply cross-module references. not a fan personally, but there's nothing outright wrong with it.
16:44futilejustin_smith: oh that doesnt sound half-bad
16:44dnolenpandeiro: no you need to setup the repl communication channel
16:44pandeiroif i have a precompiled cljs.js, include that, start the repl process and then do clojure.browser.repl.connect() ?
16:44futiletechnomancy: phoo
16:44futilejustin_smith: unfortunately defrecord isnt compatible with Hyperion
16:44futile(nothing is)
16:44dnolenpandeiro: could probably do something via the Chrome debugging protocol, but somebody would need to work on that
16:45hyPiRionIn my case, the biggest issues with development isn't typos.
16:45futileoh goodness no, not the biggest by far.
16:45futilewhat's yours?
16:45hyPiRionProper system design.
16:45futileOh good, then we're in agreement.
16:45futileThat's my first biggest issue.
16:46futileMy second biggest is the wrong libraries being extracted too early.
16:46futileAnd now they're hard-coded into the app.
16:46futileforever.
16:46futileBut those aren't battles I can win. So I have to find some morale boost in the small victories.
16:46pandeirodnolen: ever looked at https://github.com/skeeto/skewer-mode ?
16:47dnolenpandeiro: nope
16:48dnolenpandeiro: I find JS live REPL tools considerably less useful in practice because people tend to hide their code in closures because they don't have modules / nameespaces
16:49bbloomdnolen: pandeiro: i wrote about why JS (and most non-lisp) REPLs suck: http://www.brandonbloom.name/blog/2012/12/21/the-nodejs-repl-is-broken/
16:49pandeirodnolen: true but while we wait for lighttable to have emacs bindings and a terminal console, there's that...
16:49pandeirobbloom: cool i will check that out
16:50pandeiroi just find that i prefer typing in emacs than the chrome devtools console
16:50pandeiro(if setting it up is as frictionless as C-S-i)
17:01pandeirodnolen: TimMc: actually the method i described above does work, apparently
17:01pandeiroit just wasn't working on Github b/c of its Content Security Policy not letting scripts from localhost be executed
17:02TimMcOh, does it use JSONP for communication?
17:03pandeiroit uses some black magic from the goog.net package
17:03isaacbwI keep writing code and it keeps just working
17:03isaacbwthis is a weird feeling
17:03ToxicFrogHee
17:04futileisaacbw: how are you able to do that!?
17:04isaacbwfunctionaaal prograaaaaaaaaamiiiiiiiiiing whee
17:04technomancyfutile: fizzbuzz
17:04futilewth??!?!?
17:04pandeirogoog.net.xpc.CrossPageChannel
17:06pandeirovery neat to be able to eval cljs on any non-github page :) ... since i could never figure out where to begin fixing himera... and browser extensions can't use eval anyway...
17:06futilethis day is too much.
17:08futileprogramming is easy. but in real life, programming is hard.
17:08futileoh crap, im complaining gain. oops.
17:08futile*a
17:13pandeirowhen did cljs get clj->js?
17:14futileffffff
17:14seangrovepandeiro: Sounds like a question for codeq
17:15seangroveWish someone ran some kind of service you could query for these questions :P
17:15dnolenpandeiro: been around since about Clojure/West
17:15pandeiroseangrove: don't look at me ;P
17:15aeykwhy does (apply + (range 1 1000 3)) work but (apply + (range 1 1000 3) (range 1 1000 5)) doesnt?
17:15pandeirodnolen: you were against it i remember...
17:16seangrovepandeiro: wei_ and I wrote Jida to be able to ask these kinds of questions, but it needs a backend server for the workers to run, and we let the server die
17:16seangroveI should reload it... maybe next weekend
17:17amalloyaeyk: because only the last argument to apply is "unpacked"
17:17amalloyone reasonable change would be (apply + (concat (range ...) (range ...)))
17:18pandeiroseangrove: i wouldn't even know how to query that...
17:18aeykamalloy: so i just have to call apply twice then to do that?
17:18seangrovepandeiro: With codeq, it's just datalog. Pretty simple
17:19pandeiroi don't think i ever saw the presentation on codeq
17:19dnolenpandeiro: true, but I also hadn't seen a solution that covered the associative type cases in a good extensible way.
17:19pandeiro"just datalog" :/
17:19pandeiro:)
17:19seangroveWell, I find it easier than SQL most of the time...
17:21gfredericksseangrove: I tweeted you the watsit
17:23seangrovewow, very simple. Nicely done gfredericks
17:40gilbertw1seangrove: Hey, I just updated that clojurescript macro I was talking to you about on Friday, asynchronize. I just implemented the dual channels per callback (one for success, and one for failure), I also have it now throwing an exception containing the err result when the callback is invoked with an error
17:40gilbertw1seangrove: Do you think that an exception is an idiomatic way to handle this in clojure?
17:41gilbertw1seangrove: I'm pretty used to scala, and in this case the idiomatic way to handle this scenario would be to use the Either monad containing a left or right for failure or result
17:42seangrovegilbertw1: Yeah, that seems reasonable if it's an exceptional thing
17:43seangroveNot sure what the code looks like with that though - is everything in a try/catch block?
17:43seangroveDoes try/catch work with core.async?
17:43gilbertw1yep
17:44gilbertw1this is what it'd look like to use it: http://d.pr/i/1TTv
17:46gilbertw1it's my understanding with nodejs that the err callback is reserved for exceptional cases.....I think it fits semantically
17:46seangrovegilbertw1: What if I wanted to try/catch each of those individual defs?
17:46gilbertw1it'd behave as expected
17:46seangroveVery nice
17:47gilbertw1every callback statement is handled independently in place
17:47seangroveAnd the err there is the value given to the generated callback?
17:47gilbertw1yea
17:47seangroveWow, pretty cool
17:47seangroveWhy def inside of a defn though?
17:47gilbertw1http://d.pr/i/EnqQ
17:47seangroveI don't suppose that could be a let?
17:48gilbertw1absolutely, that example I actually used when I was showing that to a nodejs guy here at work
17:49gilbertw1figured i'd make it look as much like js as possible
17:50seangrovegilbertw1: Could I see an example defn with a few nested lets, and a few try/catches?
17:50gilbertw1in that link I basically use alts! to select from the fail or success channel.....when I receive a value I see which channel it came from, if success return value, if fail then I throw the err returned
17:50gilbertw1sure
17:53dnolenseangrove: gilbertw1: try/catch is actually broken at the moment for CLJS core.async, waiting for tbaldrige to take a look
17:55gilbertw1interesting....I'll have to double check my error scenarios. Maybe the one inside the go block wasn't working
17:57dnolengilbertw1: it may work w/ earlier versions of CLJS, but definitely doesn't work w/ more recent ones
18:04gilbertw1yep, it's not working.....I had a bad test case set up for that
18:05gilbertw1seangrove: theoretically though, if try catch blocks within go blocks in core.async are working, then the macro should work correctly as well :)
18:05seangroveKeywords are not functions in ruby
18:05gilbertw1they should be
18:06seangrovegilbertw1: Looking forward to it, that's a pretty awesome macro actually
18:06gilbertw1thanks!
18:07seangroveCurious to see inter-fn composability with it, but for the single-fn case, looks good
18:07akurilinIn clojure.jdbc, is there a straightforward way to start a transaction, perform a bunch of jdbc operations, and then commit the transaction at the end?
18:07chordanything new?
18:08akurilinOh, I think the (db-transaction) macro is meant to take in a body of code into it and then basically hijack whatever jdbc operations you do inside.
18:09wei_is there a way to destructure the request map inside the compojure route? i.e. is there a more compact way to write https://www.refheap.com/16813
18:10clj_newb_2345is the UI library used by lightttable
18:10clj_newb_2345useable / available to use outside of lighttable?
18:12seangrovewei_: Says here that it can be a full clojure destructuring form https://github.com/weavejester/compojure/wiki/Routes-In-Detail
18:14nDuffHmm.
18:23sandoverclj_newb_2345: do you mean node-webkit, the framework that's used?
18:24wei_seangrove: thanks, I couldn't use the vector shortcut for route params in that case. came up with this, which is a bit shorter https://www.refheap.com/16813
18:26seangrovewei_: Not too bad. Why not capture it all in request as in the first example, and then destructure in the let using {keys [...]} request?
18:29wei_how would that differ from the first example? it'd be ideal to have something like this, but compojure doesn't support that https://www.refheap.com/16813
18:30wei_the goal was to avoid the extra let, if possible
18:33mirari_Hello. I'm new to Clojure. Using Intellij Idea; trying to compile (println "Hello World") gets me IOException file not found from the clojure compiler. Any hints?
18:33mirari_Standard install, new project etc.
18:42squidzmirari_: sounds like it may not be finding clojure. Have you tried another IDE? Intellij isn't normally used
18:43squidzmaybe eclipse with the counterclockwise plugin
18:43mirari_squidz I can run it from the commandline, must be an intellij idea problem. What is the recommended IDE (besides Emacs I guess ;)
18:43squidzeclipse with the 'counterclockwise' pluin is as close to Intellij
18:44squidzhttp://dev.clojure.org/display/doc/Getting+Started+with+Eclipse+and+Counterclockwise
18:46sandoverfor just starting out (sans emacs skillz), i still think clooj is pretty good
18:48squidzmirari_: lighttable looks really cool, but I'm not sure what it takes to get up and going
18:48turbopapeHi all,
18:49turbopapeStill playing around with emacs / nrepl
18:49turbopapeBut I noticed when I start a "lein repl" session over my project
18:49turbopapeI get java class names auto completion
18:49turbopapebut not in emacs (I am connecting to this very session )
18:49turbopapeAny Idea why ?
18:50turbopapeI get completion for clojure stuff (ac-nrepl seems to be ok...)
18:50turbopapeThanks :)
18:51gtraklight table's pretty easy to get going, you just point it at a leiningen project
19:07augustljust blogged about using ZeroMQ instead of HTTP for internal services, using Clojure. http://augustl.com/blog/2013/zeromq_instead_of_http/ :)
19:08technomancyaugustl: do you use the native drivers or the pure-java ones?
19:09augustltechnomancy: I use the native ones for now, mostly because the pure-java ones uses TCP for inproc and that's kind of annoying..
19:09technomancyaugustl: that is pretty badass that you can use compojure for that kind of thing
19:09winkaugustl: have you heard about mongrel2? :)
19:09augustlwink: only heard about, actually, not sure what it's all about
19:09augustltechnomancy: yeah it's lovely
19:09technomancy"Wow, you made it this far! Or perhaps you just skimmed and got to this part. I'm proud of you either way." eerily prescient
19:10augustlhah
19:10winkaugustl: conceptually it's like "wsgi done with zmq" - so the webserver talks to the workers/backends via zmq
19:10augustlwink: interesting. Does it actually use ZeromQ?
19:11winkaugustl: yeah. someone even wrote a ring adapter back then https://github.com/mikejs/ring/tree/master/ring-mongrel2-adapter/
19:11winkaugustl: sadly it's been kind of stalling for a year
19:12augustlwell, why use mongrel when you can use ZeroMQ. Props to Zed for being years ahead of the curve again though. (Implying using ZeroMQ is the curve.. :P)
19:13technomancyso I know zmq isn't built around a broker model, but in practice wouldn't you end up implementing that on top of zmq anyway?
19:13technomancylike... I don't want all my clients to have to keep a listing of all other peer nodes up-to-date; I just want to send off a job and get a result back
19:13bbloom_technomancy: yes, it's extremely common to implement broker-like systems w/ 0mq
19:13bbloom_technomancy: in fact, 0mq calls such things "devices"
19:14bbloom_and the 0mq guide discusses many well considered patterns for types of devices, including classical brokers
19:14augustltechnomancy: yeah, in my article you could easily have a DEALER/ROUTER pair on a separate server instead of only on the server itself
19:14winkaugustl: yep, valid criticism :) the idea sounds ace but in practice there's not so much gain over using what's tried and tested (basically fastcgi)
19:14augustlyou can also do fan outs and pub/sub and what not, though
19:14technomancyI guess I can think of a few isolated cases where I'd appreciate the lower-level access, but for everything I've actually used in real-life the amqp model is a better match
19:15callentechnomancy: http://www.zeromq.org/whitepapers:brokerless
19:15winkre: zeromq: pieter hintjens' blog has a lot of interesting stuff
19:15callentechnomancy: they talk about it at length.
19:15bbloom_technomancy: my experience has been the opposite
19:15callenbbloom_: but you're weird and atypical.
19:15bbloom_true story.
19:15bbloom_the important thing isn't whether or not you use a broker
19:15bbloom_the important thing is you PUT YOUR SHIT ON A QUEUE
19:15augustltechnomancy: for me using ZeroMQ was mostly about practicalities. I only had a single server, and I couldn't find a library for rabbitmq/amqp where I didn't have to manually reconnect on startup if broker is down, etc etc
19:15callenbbloom_: I don't mean to dismiss your experience by saying you're weird, but I'm going to have to dismiss your experience.
19:15bbloom_once you have serialize/deserialize & asynchronousy, you can swap out the queue/broker/whatever w/ relative ease
19:16winkone does not simply put shit in queue
19:16augustland I didn't have to manually if-test for the "request id" on the responses ;) REQ/REP is slightly more native to ZeroMQ than RabbitMQ
19:16technomancyforcing every node to keep track of its peers sounds like a lot of work that you just get for free with rabbit
19:16winkit depends a little how you're used to work with queues.
19:16technomancyand you have to push rabbit hell of hard before it's a bottleneck
19:17bbloom_technomancy: fixed topologies are really easy to create. if you don't need absurdly high levels of uptime & whatnot, you can just parameterize your app w/ some fixed endpoints and connect to them at startup
19:18winkit wasn't exactly lightning fast in ubuntu 10.04 times though
19:18bbloom_considering how many apps run with like 1 to 10 servers at "web scale" the fixed topology approach is often far preferable thanks to it's simplicity
19:19technomancybbloom_: I'd much rather design around disposable nodes
19:19winkbut your broker isa SPOF then
19:20technomancywink: rabbit has HA options
19:20winktechnomancy: see above, 1-10 nodes :) but I agree
19:20technomancyit'd be a good fit for building a dynamo-like system on top of though
19:21bbloom_*shrug* at crazy scale, disposable nodes are the way to go. but one thing that bothers me a lot about the hacker-news armchair architect crowd is this idea that scale is hard & that it's important and all that crap
19:21technomancyit's just that most systems don't need to be dynamo themselves; they can sit on an existing dynamo implementation
19:21bbloom_running a few services on a few reasonably reliable boxes is MUCH EASIER
19:21bbloom_http://highscalability.com/blog/2011/3/3/stack-overflow-architecture-update-now-at-95-million-page-vi.html
19:21bbloom_that's a pretty good case study
19:22bbloom_~20 servers
19:22clojurebotPardon?
19:22nDuffbbloom_: *shrug*. Some of that is second-system-effect from people who designed without any eye to scalability and found themselves up a creek.
19:22bbloom_in a fixed configuration
19:22technomancynothing I've read about 0mq looks easier than rabbit
19:22technomancyeasier than sockets, sure
19:22technomancybut it always ends up looking like a ton of work
19:23bbloom_technomancy: i think 0mq is SIMPLER and rabbit is EASIER. however, in this case, i wouldn't give a shit if you choose easier, since *having a queue is the important part* :-P
19:23winkbbloom_: unless it's MSMQ
19:24bbloom_lol or oracle's AQ thing
19:24bbloom_holy hell, what a nightmare
19:24bbloom_also worth considering it HornetMQ, which is used inside Datomic. Apparently it's really good, but java-centric
19:25winkMSMQ has one fun part. you can install it even on xp and it works out of the box with vb.net/c#
19:25winkbut you're in for a surprise if you want to interface any *ix-system
19:25technomancyinsist on magic erlang scaling powers for your queue #lifehacks
19:25bbloom_wink: i wouldn't be surprised in the slightest
19:25winkbbloom_: hey, officially it has a SOAP api :P
19:26winkthat we didn't managed to talk to...
19:28callentechnomancy: I've broken RabbitMQ before. a lot.
19:28callentechnomancy: I'm still not sympathetic to the "lets pretend brokers aren't really useful!" camp.
19:29technomancycallen: right; I've had a few problems with it, but I still trust it more than something I would cobble together myself
19:29callentechnomancy: mos def.
19:31technomancymaybe I'm just biased from the way the packaging around the 0mq native dependencies used to be a big headache
19:31winkaugustl: after reading all of it, the only "mhm" part for me is the "no manual connection management" - I think your example with localhost defeats that a little.
19:31technomancycould be!
19:33augustlwink: hmm, by connection management I mean initial reconnects and in-flight reconnects. That could probably be clearer
19:33augustlwink: thanks for reading btw :) Spent way to long writing this blog post..
19:33winkaugustl: I'm a huge fan of zeromq, just waiting for the killer use case :P
19:33winkas in: need to solve a real problem
19:34winksomething mongrel2 failed :(
19:34augustland it's not really management - it's just connecting and then done.
19:34squidzreading article now
19:34winkstill I'm not seeing a huge difference of "keeping a list of connections" here and via http. just a little more explicit state
19:35winkor I'm thinking of the wrong use cases
19:36augustlwink: the main difference for HTTP is that HTTP can only do sequential req/rep over a single connection
19:36augustlwink: zeromq can do them concurrently over a single connection
19:37winkaugustl: true, but that's not connection management, os it?
19:37augustlno, and the connection management stuff that ZeroMQ does is certainly possible with HTTP (local queuing, etc)
19:44lynaghkdakrone: ping
19:47seangroveI know the answer to this is going to be disappointment, but with korma.incubator, is there a way to pull a column from the join table in a many-to-many?
19:47seangroveI should probably just figure out how to port the sql query to korma manually
19:50callenyogthos|away: remind me to show you a keen example of why I am persnickety about 12-factor.
19:56yedidoes forloop.counter exist in clabango
19:58yedidoesn't look like it, rough
19:58billybob_anybody have experience with webscrapers?
19:59justin_smithbillybob_: like extracting data from webpages?
19:59billybob_yeah
19:59justin_smithI use enlive/html-resource to turn it into a clojure data structure
19:59justin_smiththen manipulate it
20:00justin_smiththen run it through #(apply (str enlive/emit* %)) before sending the result to the frontend
20:00yedidoes anyone know of a good method for doing: [1 2 3 4 5 6 7 8 9 10] => [[1 2 3] [4 5 6] [7 8 9] [10]]
20:00justin_smith,(partition-all 3 (range 11))
20:00clojurebot((0 1 2) (3 4 5) (6 7 8) (9 10))
20:01justin_smitherr almost!
20:01justin_smith,(partition-all 3 (map inc (range 10)))
20:01clojurebot((1 2 3) (4 5 6) (7 8 9) (10))
20:02justin_smithbillybob_: mind you this is for a client that owns both web pages, I do not advocate stealing content
20:04billybob_justin_smith: so, if I'm trying to build a front end for a legacy web app, and it'd require logging in, navigating three pages deep, clicking buttons, etc...
20:04billybob_My client owns both sites as well
20:04callenaugustl: no.
20:05billybob_justin_smith: So would it be better to use enlive (and friends)... or run a browser automation tool, like clj-webdriver
20:05justin_smithbillybob_: you can use clj-http to get the cookie for login
20:05justin_smithunless there are features that totally break without javascript
20:06billybob_yea, there are javascript dependent features, some hover balloons with content I need
20:06justin_smithwe use scraping to show "featured stories" from their wordpress site (grabbing the teaser, the top image, etc.) and this way it automatically updates when their content on the wordpress site updates
20:07justin_smithregarding browser driving, I have never had to do something like that
20:07futileFun design question.
20:07futileI'm designing a function like (add-item-to-cart! cart item)
20:07justin_smithbut I still recommend using the enlive methods once you have the html itself, unless you need the whole path
20:08gfrederickssay there are a pair of methods
20:08gfredericksfoo(Runnable r) and foo(Callable c)
20:08gfrederickscan I pass a fn and somehow specify which method I want to call?
20:08futileIt's got to be reduce-able, so I can get the updated cart back every time, like (let [cart (reduce add-item-to-cart! cart items)] ...)
20:08futileBut it also has to return error(s) that occurred when adding to cart somehow.
20:08futileIdeas?
20:09augustlcallen: wut? :)
20:10futileOne idea is to store :errors on the cart, and just conj onto it when necessary. But that clutters the domain model, since it's not really a cart error, it's really an add-to-cart error.
20:10futileAnother idea is to seed reduce with {:cart some-cart :errors []} and let the function expect/return this instead. But that's more wordy and ugly.
20:11justin_smithfutile: what about a cart like {:contents [] :errors []} or maybe [{:purchaser ... :item ... :errors [...]} ...]
20:11gfredericksseems it emits a type hint warning...
20:11gfredericksbut can't figure out how to hint correctly
20:11`cbpfutile: use vectors or maps to return multiple values and then destructure
20:11futile`cbp: i.e. idea #2?
20:11futilejustin_smith: i.e. idea #1?
20:12futileJust clarifying to make sure I understand you guys right.
20:13futile`cbp: it seems strange to have (defn add-item-to-cart! [[cart errors] item] ...) because its expecting you to input an errors arg when you really only want it on return.
20:13futilejustin_smith: My gut tells me handling errors from actions should be kept separate from the domain model.
20:14`cbpfutile: there's nothing wrong with adding initial values such as nil when you reduce a collection
20:14justin_smithfutile: should errors follow the customer / cart in future access?
20:14billybob_anyone know of any good webscraping tutorials that involve logging into a site and actually crawling from one page to another, using links found in the page, etc...?
20:15futilejustin_smith: nope, only for showing as the response to this action.
20:15futile`cbp: your nick is hard to autocomplete :P
20:15justin_smithfutile: then the errors belong in the response to the request, in parallel with the cart
20:16justin_smiththough you can have one function that returns a cart and any/all errors
20:16futile`cbp: but still... (reduce add-item-to-cart! [cart []] items)
20:16justin_smithin parallel
20:16callenaugustl: ZMQ instead of HTTP as a default internal API? no.
20:16futilejustin_smith: so, just hide this ugliness inside another function, and pretend it isn't there? :)
20:17justin_smithfutile: no, redefine add-to-cart as being a function in two simultaneous domains - the domain of the cart data model and the domain of customer interaction
20:17justin_smiththe final cart goes in the former, the errors go in the latter (and finally get reported etc.)
20:18augustlcallen: ok :)
20:18`cbpfutile: Then avoid having to handle 2 values at once if you don't like the ugliness :P
20:18callen`cbp: plz talk to yogthos :)
20:19`cbpcallen: I have, has something happened?
20:20gfredericksHow to avoid this reflection warning? https://gist.github.com/fredericksgary/6058783
20:20callen`cbp: oh, no, just checking :)
20:20yogthos`cbp: not as far as I know :)
20:20futileWell I don't know what approach seems best. But none seem perfect.
20:20callengfredericks: that's pretty impressive actually.
20:21futileNormally I wouldn't care, I would just get depressed and move on, pretending like nothing happened.
20:21futileBut this is Clojure, not Ruby or Python.
20:21futileI've grown to expect that I can express my intentions perfectly in this language.
20:21gfrederickscallen: check out the comment I just posted
20:21justin_smithfutile: that only works if your intentions map to the domain
20:21`cbpfutile: design is hard, spend more time on it
20:21gfredericksgoing to dinner, but I'll check back for responses
20:21justin_smiththe domain has one operation with results in two conceptual areas, that must be accomodated
20:22`cbpkeep things as simple as possible and clojure will work for you
20:22augustlgfredericks: perhaps generics...? Since it's Callable<T> and you just give it Callable. Wild guess tbh..
20:23justin_smithif you were taking square roots, no amount of design would prevent needing a representation of imaginary numbers
20:23justin_smith*arbitrary square roots
20:24brehautaugustl, gfredericks: but generics are erased at compile time and dont exist outside of Java the language
20:24augustlbrehaut: ah, good to know. I should read a book about the jvm or something..
20:25brehautaugustl: i cant remember who made did the presentation, but theres one out there about the myths that java provides that dont actually exist in the jvm
20:25brehautaugustl: i would recommend it as a good starting point
20:25brehautaugustl: generics and checked exceptions are the two big obvious ones
20:34futileI, on the other hand,
20:34futilehttp://bit.ly/162iGAi
20:38futileI think the real problem is that I'm trying to make this function fit reduce, instead of looking for alternative ways to add multiples while returning the updated immutable cart.
20:38futileThat's the age-old problem, you get an implementation detail in your head, and suddenly you shape everything else around it, which is all backwards.
20:39meoblast001hi
20:39meoblast001why does this not have any results? http://pastebin.com/R2FfV3iH
20:44futileOkay, immutability in Clojure is hard.
20:47futileMaybe the real problem is that I'm combining validation with action. Maybe I should have (can-add-item-to-cart?) be separate from (add-item-to-cart!)
20:47seangrovefutile: Almost certainly
20:47futileYeah. That actually works much nicer.
20:49Raynesfutile: I like to make my programs all be one big function.
20:49callenI conflate those all the time. lol.
20:50futileThen I can do (map can-add-to-cart? items), filter out the ones that actually can be added, and then just (reduce add-to-cart! valid-items)
20:50technomancyRaynes: speaking of which ... http://software-lab.de/skaro.pil
20:50futileRaynes: in Perl, right?
20:50Raynescallen: I think you mean 'complect': http://da.gd/0LR17
20:50technomancysomeone was golfing skaro and got it way down in picolisp, but only because he collapsed it into a single function
20:51Raynesfutile: Why do you need to map before you filter?
20:51futileRaynes: probably don't.
20:51futileRaynes: good point, thanks.
20:51Raynes(filter identity (map can-add-to-cart? items)) if you're into that sort of thing, but...
20:51Raynes:p
20:51futileNO
20:51futileNEVER DO THAT>
20:51futile(remove nil? (map ... items))
20:52RaynesEh?
20:52futileOh sorry for blacking out there.
20:52RaynesIf your function has a question mark at the end of it, it should never return anything other than true or false, making identity a sound choice.
20:52futileI meant to say, I hate "filter identity" in terms of readability.
20:52futileIt's usually much more correct to type (remove nil? ...)
20:53RaynesI like to read it as "Take all of those who have a sound understanding of themselves …"
20:53futileOr (remove false? ...)
20:53DeranderRaynes: ++
20:54futileBut look, I'm not here to change you and you're not here to change me. We're all really just here for the free money anyway, right? So let's boogey.
20:54futileor something
20:54RaynesI'm here to change you, sir.
20:54RaynesYou will conform.
20:54futileOkay.
20:54Deranderit's the arockalypse. get ready for the rockening.
20:54futileI'll change anything but my religion, cuz wutevz
20:55Deranderfutile: you'll change your mind when the rockture comes 'round
20:55technomancythere was a discussion ages ago about making filter use identity as its default predicate
20:56technomancyI don't think it'll ever happen (partly because jira and partly because an optional first arg is vaguely sketchy) but it's an interesting idea
20:56futiletechnomancy: me no likey
20:56futilethat is, if my opinion counts for a vote
20:56futileand if this is a democracy
20:57technomancy~laugh
20:57clojurebotha ha
20:57callentechnomancy: I wouldn't want it.
20:59futileIs it really true that open source is mostly a social thing and not a technical thing?
20:59futileThat might explain why I suck at it.
21:00technomancythat was supposed to be a mad cackle
21:01technomancykind of a weak laugh, clojurebot
21:01futiletechnomancy: why I oughta
21:01futilefix that bot for you.
21:01technomancyclojurebot may be beyond repair
21:01futileOh right. Not enough Ruby.
21:02futileI realized why I like Clojure so much more than most other languages I've used in my "professional" career.
21:02futileIt's because it's mostly context-free.
21:02Raynesfutile: You should go submit a pull request to Elixir to rename it to liquid.
21:02futileAlmost nothing is automatic or implicit.
21:02futileRaynes: if only I had the money to
21:06technomancyfutile: the magic of referential transparency
21:06futilehuh?!?
21:06futileman you guys so craaazeh
21:07futiletechnomancy: oh yeah, that.
21:07futileYeah, I hate referential opacity.
21:07futileThat kind of opacity is best served 0.0
21:08futileAlso clojure.core being sane helps.
21:08futileSeems like Matz kinda had the right idea.. at some point
21:09futileIt just.. doesn't work
21:12futiletechnomancy: thanks for teaching me how to say it better: test2's goal is referential transparency
21:13futileThat's why I think it should be named "test-ease"
21:13futileAnd yes, I'll continue with that joke until someone acknowledges it with hearty laughter.
21:14justin_smithmeoblast001: that is kind of weird, it should work I think
21:14meoblast001i found it's wrong
21:14meoblast001i should use (re-seq)
21:15meoblast001what i was using finds what to break it on
21:15meoblast001i was looking for what the segments should match
21:15justin_smithahh, so you throw away every match of #".{1,80}"
21:15justin_smithof course
22:53OneFourSevenIn Emacs, how do I change the default nrepl buffer? I have two repls open because of Clojure and Clojurescript and I want a way to change which one code is evaluated in
23:06akurilinWhat is the fundamental difference between with-bindings and with-redefs?
23:09bbloom_akurilin: with-redefs is not thread safe
23:09bbloom_akurilin: redefs just set & then later setback the vars
23:09squidzdoesy anybody know why my anonymous function in line 11 doesn't seem to be executing? it's javascript
23:10bbloom_akurilin: with-bindings, however, maintains a thread-local STACK of values & pushes/pops from that stack
23:10bbloom_so with bindings, you can capture the stack of bindings too with bound-fn, etc
23:10bbloom_dynamic vars are a bit heavier weight than normal "static" vars, which are themselves slightly heavier weight than say java statics
23:11akurilinbbloom_, got it, that's helpful, thank you.
23:14squidzare anonymous functions runnable from clojurescript let forms?
23:14bbloom_squidz: i'm not really sure what you're asking… but why don't you try it?
23:15squidzI am and it's not working but I cant debug my way out of it
23:16bbloom_squidz: gist a minimal reproduction at the repl
23:18ChongLihmmm
23:18ChongLilein-ring doesn't seem to want to auto-reload my code?
23:18ChongLiI'm running it with lein ring server-headless
23:18ChongLianyone else have this issue?
23:23ChongLiahh nevermind
23:23squidzbbloom_: line 11 is the problem https://www.refheap.com/16844
23:23ChongLiit only works with server
23:23ChongLinot server-headless
23:23ChongLi:)
23:26bbloom_squidz: what error do you get?
23:27squidzI dont get any error. but that line 10 produces dom elements like expected.
23:28squidzand when I try to console out in the anonymous function nothing happens
23:28bbloom_squidz: then i assume your function isn't getting called
23:28bbloom_you've got a bug, not cljs
23:29squidzhm but I wouldnt know why it's not getting called
23:29squidzthe previous line properly creates the rows var which the next line depends on
23:29bbloom_does the selectAll "td" return any values?
23:30bbloom_what does data do when it's given a function?
23:30bbloom_how does it know if it got a function? does it check typeof or whatever? if you give it a different function, like (.-log js/console), does it work?
23:30squidzit works kind of like map
23:31ChongLihmmm
23:31ChongLiso lein-ring is reloading now
23:31ChongLibut it doesn't reload an enlive template properly
23:31bbloom_you're gonna need to debug it :-P
23:31ChongLiis there some kind of hook I can use for this?
23:32ChongLiit only reloads correctly when I save a clj source file
23:32squidzhmm this bug's tricky
23:34squidzbbloom_: I pasted the javascript that gets created https://www.refheap.com/16844
23:35bbloom_minus the confusing lack of parens around that "scope" function, that looks fine to me
23:36squidzbelow I pasted the javascript that i am trying to produce, that is javascript that works https://www.refheap.com/16844
23:37bbloom_the compiler output looks correct to me
23:37squidzits not even letting me console.out though from the within the anonymous function
23:38bbloom_squidz: what do you mean "not letting". do you mean it's NOT BEING CALLED? or do you mean you're getting a compiler error
23:39squidzits not being called
23:39squidzI am getting absolutely no erros
23:40bbloom_squidz: you have a bug that is 100% unrelated to clojurescript
23:40bbloom_the compiler output is correct
23:41squidzit okay it must be in the library i'm using I will dig deeper into it when I'm not so sleepy. Thanks for the help anyways