#clojure logs

2013-02-26

00:00frozenlockI.e. I want to ship a uberjar that might create its own plugins folder, not an entire m2 path.
00:01frozenlockBut again I know nothing of the java stuff, it might be impossible.
00:10frozenlockOh I like that https://github.com/cemerick/pomegranate/blob/master/src/main/clojure/cemerick/pomegranate.clj#L42
00:14frozenlockI have no idea of the implementation details, but... Main application A. Plugin B is jared with its own depencies, but without those already in application A. Then plugin B is loaded using add-classpath. Could it possibly work, or will I rip the space-time continuum?
02:32dbushenkohi all!
02:33dbushenkois there a way to reset all the memoized functions?
02:33dbushenkojust to free some memory?
02:33dbushenkoprobably I can reset the @mem, but may be there is other way?
02:35alandipertdbushenko: not that i know of but maybe https://github.com/clojure/core.cache would interest you?
02:35dbushenkoalandipert, thanks, I'll look into it
02:41dbushenkoalandipert, yes, you are right, this is more beautiful way to implement a cache. My solution is just a hack
02:51amalloyFrozenlock: you might like https://github.com/flatland/useful/blob/develop/src/flatland/useful/map.clj#L5, which is a version of your mapify that is more flexible and generates nicer code as well
03:06HolyJakHi, could anybody be so kind and tell me why, in Ring, the application method passed to run-jetty cannot be modified at runtime? Please see https://www.refheap.com/paste/11819 - after starting jetty, no changes in app-immutable (and re-loading the file in REPL) have any effect while changing external-method works just fine. I believed that in Clojure everything is dynamic and can be changed via REPL at any time but not here :-(
03:07weavejesterHolyJak: It's because the symbol is resolved before being passed to the function
03:07weavejesterHolyJak: For instance, if I (def x 1) (def y (+ x 1)) (def x 2)
03:08RaynesVars, baby.
03:08weavejesterHolyJak: Then y would be 2, and not 3, because it's redefined after, and only the current value is used when passed to a function
03:08Raynesweavejester: Isn't it the case that he can pass a var here?
03:08weavejesterRaynes: Right, I was coming to that :)
03:08Raynes:p
03:08RaynesSorry for spoiling the surprise.
03:08Raynes;)
03:09weavejesterHolyJak: But you can use a var to explicitly make it re-evaluate it each time
03:09weavejesterHolyJak: So (run-jetty (var app) {:port 8080})
03:09weavejesterHolyJak: Or for short, (run-jetty #'app {:port 8080})
03:10kastermaDoes #' have a name I can google for?
03:11HolyJakweavejester, Raynes: thanks a lot! So the function, if passed just as 'app', will be in a way "passed by value" while #'app is a pass-by-reference and thus will reflect later changes?
03:11weavejesterkasterma: "var" perhaps? (var x) = #'x
03:12amalloyvar-quote will probably get useful hits also
03:12weavejesterHolyJak: Yes, roughly speaking.
03:12pwnedkasterma: it is an anonymous function
03:12HolyJakI believed that function names are actually vars but now I see they are not - what are they then? What is it that I pass to the run-jetty function?
03:13HolyJak(I can google the answer myself if you give me the right keywords to look for :-))
03:13weavejesterHolyJak: When Clojure evaluates a function form, it resolves any symbols before passing then as arguments
03:13HolyJakI see
03:14ChongLisharp-quote
03:14weavejesterHolyJak: So if Clojure comes across (foo x), it will work out what x is before passing it to foo
03:14ChongLiI believe that's the term for it
03:14HolyJakSo whenever passign functions around, if I want to allow them to change later, I have to explicitely var them, right?
03:14amalloyChongLi: that will turn up more common-lisp hits than clojure hits
03:14ChongLiamalloy: clojure sharp-quote gives good results
03:15weavejesterHolyJak: If you're def-ing something static, yes. If you're calling a function then it's evaluated each time.
03:16pwnedsorry it is a var quote https://groups.google.com/forum/?fromgroups=#!topic/clojure/jDBAJD4nWqs
03:16kastermaweavejester amalloy pwned: thx, found some docs.
03:16weavejesterHolyJak: So… (def y (+ x 1)) is just going to have its body evaluated once, because it's a single value.
03:16HolyJakYep, I managed to understand that for values but wasn't sure how it works with functions.
03:16HolyJakThenk you folks, I love you :-)
03:17ChongLifunctions are values :)
03:17weavejesterHolyJak: But… (def f (fn [] (+ x 1))) will resolve x each time f is called.
03:17HolyJakI see
03:17alandipertRaynes: nice work on laser btw, dig it
03:17weavejesterHolyJak: So in theory you could also write (run-jetty (fn [req] (app req)) {:port 8080})
03:18weavejesterHolyJak: The anonymous function itself would only be resolved once, but "app" would be resolved each time the function is called.
03:18weavejesterHolyJak: But it's more concise to just use #'app
03:18HolyJakthank you
03:18weavejesterAh, I gotta go
03:18Raynesalandipert: o/
03:19RaynesHappy you like it, kind sir.
03:29TheBusbyanyone using s3-wagon-private repos?
03:31Raynesalandipert: If you actually use laser, let me know. So far people keep talking about how great it is but nobody has actually mentioned using it (besides me, of course).
03:31RaynesWhich is good, since it probably means people aren't having problems.
03:31RaynesOf which I had plenty during development, which is why I was at version 0.1.30 before I released 1.0.0.
03:32alandipertRaynes: sure, i hope to use it in the near term to generate poms. i'll let you know how it goes
03:32RaynesOuch, XML?
03:33RaynesI don't know how well that will work. jsoup is a validating HTML5 parser.
03:33alandipertyeah, i'm writing a thing called jitjar that looks like a maven repo but actually builds .jars dynamically off github
03:33alandipertoh
03:34RaynesWith that said, jsoup also has a non-validating version designed for XML, but the current version lacks a method I need (but the author added when I mentioned it). As soon as jsoup releases a version with that method I'll add xml support to laser.
03:34RaynesSimple XML support, at least. Probably at least on the level of enlive.
03:34alandipertthat's all i'd need
03:35Raynesalandipert: Actually, looks like he did release a new version with that change! In that case, I'll see about adding this tomorrow. Look for a new version in a couple of days, probably tomorrow night if I don't run into any significant problems.
03:36alandipertRaynes: cool!
03:44Raynesalandipert: It just occurred to me that you are up very, very late.
03:44RaynesOn a Tuesday no less.
03:44RaynesBe careful or you'll start reminding me of me.
03:45alandipertRaynes: i don't let the incidental positions of various stars interfere with my computings ;-)
03:45RaynesHaha
03:47Raynesalandipert: I didn't know you were deployed to Iraq.
03:48RaynesI didn't know any of these things, actually.
03:48RaynesCongrats on such a positive outlook.
03:48alandipertRaynes: ya
03:48alandipertRaynes: thanks
04:00ChongLialandipert: you're in Iraq right now?
04:00alandipertChongLi: ha, no, fortunately
04:01ChongLialandipert: well good luck when you do go
04:01ChongListay safe
04:01alandipertChongLi: thanks but i went/did/returned :-)
04:01ChongLioh ok :)
04:03ChongLiso Javelin seems pretty cool
04:04ChongLiwhat sort of latency does FRP like that add?
04:05alandipertnegligible, in up to pretty big browser-based systems anyway
04:05alandiperttechnically propagation time is linear with respect to the number of formulas
04:06ChongLiahh
04:06alandipert(worst case)
04:08alandipertit's good that it's fast, you get a stackoverflow and know you have a cycle almost instantly ;-)
04:08ChongLihahaha
04:08ChongLiyeah I really like this design
04:08ChongLiit seems so simple and straightforward
04:09alandipertthank you, it was a lot of work
04:09alandiperthave you had a chance to play with it?
04:09ChongLinot yet
04:09ChongLiI probably will within the next few days
04:10alandipertcool, well definitely give a shout if you have questions
04:10ChongLiso a formula cell can have side effects I presume?
04:10ChongLiis that recommended?
04:12alandipertthe idiom we're settling into is formulas for side effects are anonymous, but i'd say do whatever makes sense
04:12alandipertnothing stopping you from wiring however you want except that stackoverflow
04:12ChongLicool
04:13ChongLiit seems like I could use this to clean up some callbacks
04:13ChongLiand just focus on getting values updating
04:13ChongLiinstead of directly coupling things with callbacks
04:14alandipertyup that's the hope
04:14alandipertone conceptual difference is there is no event to "kick off" what used to be your callbacks, so w/ javelin you have to code as if there's always a base value
04:15alandipertwhich we came to realize makes total sense, since an app always has a state, even if that state is empty
04:15ChongLiyeah
04:16alandiperthad you used other FRP libs?
04:16ChongLiI toyed around with flapjax a bit
04:16ChongLiit's quite a bit more complex and somewhat confusing
04:17ChongLiit seemed like events and behaviours had a lot of overlap
04:17piranhawhat javelin needs is a library for dealing with DOM :)
04:17ChongLinah, I like that javelin is not complected
04:17ChongLiit's the Clojure way
04:18piranhaI'm building helpers for myself (well, copying them from javelin-demos.dom and modifying them), but still
04:18piranhasure, javelin should be as it is, but there should be another library
04:18alandipertwell, we're attacking the DOM thing separaetly with hlisp, an HTML syntax front for cljs
04:18piranhaso it's easier to start working with
04:19alandipertpiranha: how's it going btw?
04:19ChongLihmm
04:19piranharight, I've seen it, but... I'm a bit sceptical. :) You know, it looks like mixing code with layout again...
04:19ChongLiI googled hlisp and I'm getting a bunch of github 404s
04:19alandipertChanServ: https://github.com/tailrecursion/todoFRP/tree/master/todo/hlisp-javelin
04:19alandiperterr
04:19alandipertChongLi: https://github.com/tailrecursion/todoFRP/tree/master/todo/hlisp-javelin
04:20piranhaalandipert: well, haven't done anything proper yet, just got to setting up base stuff; but I'm giving a talk this Saturday about FRP and replaced Flapjax with Javelin there ;)
04:20ChongLiah ok
04:20alandipertpiranha: sweet!
04:20piranha'just got' == 15 minutes ago, too much work lately :(
04:20alandipertpiranha: i understand your concern, but don't worry, it will be awesome when it's done ;-)
04:20ChongLithere's a lot of weird stuff going on in the DOM and the browser in general
04:21ChongLiI've been working on getting dynamic font loading working
04:21ChongLiand it's a bit of a pain
04:21piranhaalandipert: ok, I'll wait and in the meantime will try to work it out other way :)
04:21alandipertpiranha: deal
04:21ChongLigoogle's webfont loader requiring you to stuff everything into a global variable
04:22piranhaChongLi: that's the problem with all of their APIs :\
04:23alandipertpiranha: btw if you're willing, would love to add anything you come up with to -demos
04:24piranhaalandipert: ok! :) not sure though how soon will I get something, I won't have much time during next two weeks due to travel
04:24alandipertwhenever
04:24ChongLiand to think I was taking a look at Elm for some FRP stuff
04:25piranhadid you like it?
04:25ChongLiit's a really nice language but I just can't part with clojure
04:25ChongLithe libraries and community are just too compelling
04:25piranhait felt a bit strange to me, but maybe I just don't understand something there
04:26ChongLiCLJS, as immature as it is, is way ahead of Elm and Fay
04:26alandiperti thought the elm paper was great
04:26alandipertbut yeah, all of those things seem most appealing to people in languages without existing state models
04:26alandipertand bring a lot of baggage to fill the gap
04:27ChongLiand they strip away platform power
04:27ChongLito do anything with JS in those languages you have to go through an FFI
04:28ChongLiCLJS's interop is so much nicer than that
04:28augustlanyone here happen to know if it's possible to have tomcat automatically share .jars from "lein ring uberwar" packages based on name+checksum or something? Or do I manually have to
04:28augustl.. configure this, upload the shared .jar files manually, etc?
04:29alandipertyeah i'm excited about javelin on both sides... server as input cell
04:29alandipert(or formula)
04:31ChongLiso basically any callback can be set to update an input cell, triggering the network to propagate?
04:32stainaugustl: what do you mean by 'share'?
04:32ChongLithis just seems so clean
04:32stainaugustl: you have JARs inside the WAR that you want to expose?
04:32alandipertChongLi: right
04:33augustlstain: my actual problem is that I have multiple war files that contain a .jar file (a dependency) that links into a JNI module, causing tomcat7 to fail since it can only load the jni module once. So I have to figure out how to make the multiple apps share the same .jar, so to speak, so it's only loaded once
04:34ChongLinow throw in core.logic and already CLJS seems so damn compelling
04:42alandipertChongLi, piranha : see you later! happy computing
04:43bluezenix@augustl you'll have to put that jar in the tomcat lib directory, so it's loaded on startup
04:46augustlbluezenix: tried to put the .jar file in $CATALINA_HOME/lib, no change. Removed the .jar file manually from the war files, and then it worked. So it seems I need to manually manage the dependencies that I want to be shared
04:53stainyes
04:54stainin Maven we would use <scope>provided</scope> for that if I remember correctly
04:54stainnot sure how you can inject that into Leiningen
04:55stainjust :scope "provided" I think
04:55stainit's tricky if that dependency is implied by someone else, then you would be better to try to ignore it
06:18kittylystHi. Anyone have some cycles to help me with a quick Leiningen problem?
06:21babilenAs always: Just ask your real questions. Otherwise you find yourself with an answer of "Sure!" in one hour and are none the wiser.
06:26kittylystOn latest Leiningen, running a lein new results in a project which won't lein repl properly - crashes with a ClassCastException: Exception in thread "main" java.lang.ClassCastException: clojure.tools.nrepl.server.Server cannot be cast to compile__stub.clojure.tools.nrepl.server.Server
06:26kittylystGoogle has precisely 1 hit for this, which is a page of discussion from this channel from last summer.
06:27cemerickkittylyst: how did you install lein?
06:28kittylystUpgraded from a previous version
06:29kittylystOh, and this is Clojure 1.4.0 on OpenJDK8 on Mac 10.7, FWIW
06:29cemerickbizarre; it sounds like an AOT fubar, but I'm not sure how...
06:30kittylystI'll retry this on a clean box
06:37kittylystCompletely clean install on 1.4.0, OpenJDK7, Ubuntu (only other thing I have around easily) works fine, thankfully
06:42kittylystInteresting. Back on the Mac, cleaning off lein & reinstalling doesn't produce the self-install behaviour. So there could be some fragment of an earlier install kicking around which is mucking things up somehow.
06:49kittylystResolution: One of the lein self-install jars was owned by root (must have done an lein upgrade at some point whilst root), so I think the wrong jar was getting loaded. Cleaning out self-installs & rerunning lein fixed the issue.
07:33michaelr525hey
08:19aibI just want a plain old struct - something with named members and no other functionality whatsoever. what type should I go with?
08:24dobladezaib: deftype gives you the most basic typed "struct"
08:25dobladezaib: but why not just maps?
08:26dobladezaib: for doc about deftype see http://clojure.org/datatypes
08:26aib(I never said no maps :) but my members are predefined and unvarying - think ColorRGB or Vector3
08:30aibI just want named accessors- (let [c (ColorRGB :r 255)] (.r c)) or something along those lines
08:31aibI'm new to clojure, have I mentioned that? :)
08:44aibokay, (hash-map :r 255) and (get c :r) working for now
08:46cmdrdatsaib: you can just {:r 255} - then (:r c) or (get c :r 0) (using get, you can specify a default if the :r key is not found)
08:47aibahh, more sugar! thanks
08:47cmdrdatsanother handy function is (update-in c [:r] - 10)
08:47cmdrdats,(update-in {:r 255} [:r] - 10)
08:47clojurebot{:r 245}
08:51dnolenaib: (:foo bar) is not really "sugar", keywords are actually functions.
08:51dnolencmdrdats: you can actually provide default with (:foo bar default) as well
08:51cmdrdatsdnolen: brilliant - that's good to know :D
09:29jweissin a macro-creating macro, how does one expand into ~@body?
09:39arkhis there a way to break up a regular expression #"" into multiple lines?
09:40arkhnot to be confused with a multiline match (?m)
09:42ambrosebsI've started a "Getting Started" guide to core.typed. It explains why core.typed is different from other type systems, what types are, and some details https://github.com/clojure/core.typed/wiki/Getting-started
09:42ambrosebsFeedback welcome. I'm starting on another chapter that deals with actual examples.
09:47matthavenerambrosebs: awesome
09:55dnolenambrosebs: looks like a great start!
10:14ambrosebsdnolen: thanks
10:22ambrosebsdnolen: is this not redundant in CLJS or something? (and (sequential? v) (not (nil? v)))
10:26TimMcarkh: Just hit Enter. You'll get a newline, though...
10:27jimdueyambrosebs: Awesome. I'm just getting ready to dive into TC to see what I can steal for a static analysis problem I'm working on.
10:27TimMcOn a more serious note... ##(re-pattern (str #"a" #"b")) as long as each subexpression is a valid regular expression.
10:27lazybot⇒ #"ab"
10:27dnolenambrosebs: it not, CLJS extends nil to protocols
10:27dnolenambrosebs: which I'm leaning towards purging
10:28dnolen"it is not redundant" I mean
10:28arkhTimMc: nice - str'ing them together is great, thank you
10:29ambrosebsjimduey: Sweet. I've made some good improvements since the Conj. "Single dispatch" MMs work and there's a bit of flow analysis, things like in-body assertions are understood.
10:29ambrosebsdnolen: I thought a sequential was implicitly a seqable.
10:30dnolenambrosebs: I'm using a new experimental ^not-native type-hint
10:30dnolenambrosebs: this type hint means protocols are dispatched to directly as a performance thing
10:30dnolenambrosebs: but nil is really JS null, it's a native type
10:31dnolenambrosebs: so if you use ^not-native you have to explicitly handle null
10:31dnolenambrosebs: it's a minor thing but it's just about failing faster
10:31ambrosebsOk. It doesn't seem right that nil is sequential.
10:31dnolenambrosebs: nope
10:32dnolenambrosebs: the moment nil is no longer extended to core protocols I can remove that bit of ugliness
10:32ambrosebscool
10:34dnolenzebra down to 12.5-7ms on CLJS, I think ^non-native support for function invocation might take us the rest of the way ...
10:34ambrosebsdnolen: CLJS implementation has me going back and forth as to the true role of nil. It would be nice to get rid of the confusion.
10:34dnolenunder v8 of course
10:35dnolenambrosebs: I think the nil-punning protocols were there for convenience
10:35dnolenambrosebs: but it's bad for perf and semantics are strange
10:35ambrosebsInteresting.
10:35ambrosebsWell I'm glad there's more than one reason to change it :)
10:35dnolenambrosebs: the reason is that nil is a native type, so it goes down the protocol slow path
10:36jcromartieI'm on an EC2 instance, and lein is *painfully* slow. I know I don't need it because I could push an uberjar… but this is bad
10:36ambrosebsdnolen: ok
10:36dnolenambrosebs: I think nil should be handled at the fn level - lookup, not -loookup
10:36dnolennot -lookup, I mean
10:36ambrosebsyep, and etc. for the rest of the protocols.
10:36dnolenambrosebs: which more closely matches CLJ JVM semantics as well
10:36jcromartieon my laptop, "time lein" (printing out available tasks) takes 13s
10:36jcromartie(which is kind of ridiculous in itself of course…)
10:37jcromartieon the server it's 27s
10:38jcromartie,(time (apply + (range 10e6)))
10:38clojurebot"Elapsed time: 1740.250494 msecs"\n49999995000000
10:38jcromartiehm, well clojurebot is more in line with the EC2 speed I guess
10:39jcromartie1828 on the server but 431 on my laptop
10:39jcromartieI guess little EC2 instances are just not as beefy
10:44cemerickdnolen: FYI, Thomas Heller has his CA in now (according to http://clojure.org/contributing) (re: http://dev.clojure.org/jira/browse/CLJS-466)
10:45cemerickjcromartie: this is a micro?
10:50jcromartiecemerick: I think it's a Small
10:51cemerickjcromartie: yeah, either way; horrific IO on those, thus really poor class/code loading perf.
10:52jcromartieah, thanks. good to know
10:52jcromartieso keep any file i/o asynch if possible heh
11:08jcrossley3ohpauleez: do you mind sharing a link for your talk when you have it? we like to list them on immutant.org
11:09ohpauleezjcrossley3: We typically don't record them (they're usually swarm based), but I will ping you a link to a blog post on how I got up and running
11:10ohpauleezHonestly, I was extremely pleased with both OpenShift and Immutant
11:10ohpauleezand the two together made quick work of me getting something together and out the door
11:10ohpauleezI'm more than happy to support both efforts however you need
11:10jcrossley3ohpauleez: coolio. no recording necesssary, btw. we just like to let folks know if anyone's about to speak near them. the meetup url is fine.
11:11ohpauleezCool
11:25jcidahoAnyone using clj-elasticsearch?
11:25jcidahoin the docs I can't see an example of how you actually do a search
11:31jcidahoThink I'll opt for elastisch
11:39kittylystI need a clojure lib to talk to MongoDB. Is Monger a reasonable choice?
11:42dcolishthis is very confusing behavior when i am calling a method on a class instance in a macro https://gist.github.com/dcolish/5039976
11:44Frozenlockkittylyst: Never tried monger, but I use congomondo and like it.
11:45ethanisAnyone have experience using lein cljsbuild with a local git clone of cljs? I've tried following the instructions on the wiki to the dot (https://github.com/emezeske/lein-cljsbuild/wiki/Using-a-Git-Checkout-of-the-ClojureScript-Compiler), alongside r1586, but no dice. The compiler stalls indefinitely with no visual indication of what's going wrong. Thoughts?
11:47TimMcdcolish: Your parens are messed up.
11:47TimMcYou're giving .at only one arg.
11:47ohpauleezethanis: Are you using Linux?
11:47ethanisyep!
11:47ohpauleezI knew it!
11:47dcolishTimMc: I added a ` to the (recur ... and it seemed to compile
11:47ethanisuh oh, what's wrong with openjdk now?
11:47ohpauleezthere's a weird CLJS bug, where the compiler will hang for like five minutes
11:48ohpauleezon the first build
11:48TimMcdcolish: Or rather, the parens are correct, but you're missing an arg.
11:48ohpauleeztry using `auto` and not `once`
11:48ethanisalright
11:48ohpauleezthis *JUST* happened to me two days ago
11:48ohpauleezand I didn't dig in to find the fix
11:48ohpauleezbut that seemed to work out for me
11:48TimMcdcolish: y the way, I see no reason for this to be a macro instead of a fn.
11:48TimMc*By the way
11:49dcolishTimMc: fair enough, I'm mostly playing around now
11:49ethanishmm, now I'm kind of curious about what's causing it
11:49ohpauleezethanis: I am as well
11:49TimMcdcolish: Well, sprinkling macros liberally with syntax-quotes is not going to make them work.
11:49ethaniswell, I'll heed your suggestion and see how it goes. Comforting to know someone else had this issue.
11:49ohpauleezthere are reported issues of the same situation on the internet, but like I said, I didn't dig in too deep
11:50TimMcYou've misused ~@ as well.
11:50ethanisthanks ohpauleez, ttyl #clojure
11:50ohpauleeznp, happy to give some guidance
11:51dcolishTimMc: well thats not too surprising, I really have no idea what I'm doing when it comes to macros
11:52TimMcdcolish: This is probably closer to what you want: https://gist.github.com/timmc/5040043
11:53TimMc~@ splices a sequence of forms into an enclosing form: ##(let [a (range 3)] `(:foo ~@a :bar))
11:53lazybot⇒ (:foo 0 1 2 :bar)
11:53clojurebotformat is http://github.com/tomfaulhaber/cl-format/tree/master
11:53TimMcAs opposed to just normal unquoting: ##(let [a (range 3)] `(:foo ~a :bar))
11:53lazybot⇒ (:foo (0 1 2) :bar)
11:54dcolishah then ~@ is definitely not what I wanted
11:58TimMcMacros are rarely what you want.
11:59TimMcFor instance, if you had created that as a macro, no one would be able to write #(apply write-builder foo some-args)
11:59TimMc(Umm, I don't know why I put that # in there. Ignore that.)
12:00jcromartieI added :plugins [[lein-ring "0.8.3"]] to my project.clj, but I can't run "lein ring server" etc.
12:00jcromartieI can do it locally, but not on the server
12:01TimMcjcromartie: Try `lein ring server-headless`, out of curiosity.
12:01jcromartieoh huh, I didn't fetch on the server :)
12:01dcolishTimMc: thats fair, thanks for the help. Its a lot more readable without the macro as well
12:01jcromartienever mind
12:01jcromartieI have my terminals confused
12:02TimMcMaybe it's failing when trying to launch the browser.
12:03jcromartiebut yes, the headless bit is important now
12:03jcromartieall is well
12:06TimMcI'm surprised it wasn't throwing.
12:10dribnethi, any clojurescript + sublime folks listening?
12:12rasmustois there a preferred place to put "example" (not necessarily test) code in leiningen projects? Should I use myns-examples.clj or somesuch? I currently have comment blocks in "myns.clj"
12:13S11001001~ask
12:13clojurebotPardon?
12:13S11001001~anyone
12:13clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
12:14hyPiRionrasmusto: example code? I put it in markdown files. You would usually like to have that as documentation/tutorial
12:14Foxborondribnet: well, i got some knowledge of Sublime if it helps. Not cljs tho.
12:14hyPiRionOtherwise make a new repo and create a project using it
12:15dribnetah. well i learned this past week how simple it is to make cljs sublime plugins with emmet.
12:15dribneti was pretty stoked about it and just wanted to share the news.
12:15dnolendribnet: cool!
12:16rasmustohyPiRion: ok, makes sense. What would you recommend doing with code that I used to incrementally debug what I was writing, should I convert it to test cases?
12:17hyPiRionrasmusto: Either manifest it as tests or just let it stay in a file you don't put into the repository
12:19rasmustohyPiRion: perfect, thanks.
12:21ivanhow do I unrefer things from a namespace?
12:22hyPiRionivan: deref?
12:22hyPiRion,(deref #'+)
12:22clojurebot#<core$_PLUS_ clojure.core$_PLUS_@f9bc78>
12:23ivanI mean I did (require '[clojure.pprint :refer [pp]]) and now I want to get rid of pp so that I can (def pp)
12:24ivanoh, ns-unmap
12:32seangroveIs there a way to get a 'submap' from a map, e.g. (submap {:a 10 :b 20 :c 100} [:a :c]) => {:a 10 :c 100} ?
12:33sprocIs there an existing function to shuffle/intersperse two lists? i.e., (something '(1 2 3) '(4 5 6)) ;=> '(1 4 2 5 3 6)
12:33hyPiRionsproc: ##(interpose '(1 2 3) '(4 5 6))
12:33lazybot⇒ (4 (1 2 3) 5 (1 2 3) 6)
12:33hyPiRioninterleave, rather
12:33sprocAh, thanks,.
12:33hyPiRion,(interleave '(1 2 3) '(4 5 6))
12:33clojurebot(1 4 2 5 3 ...)
12:33hyPiRionseangrove: select-keys
12:34hyPiRion,(select-keys {:a 10, :b 20, :c 100} [:a :c])
12:34clojurebot{:c 100, :a 10}
12:34seangroveAh, beautiful
12:34seangroveI wrote it out and thought there's probably something in core for it
12:34hyPiRionAnd you're right :)
12:41rasmustohyPiRion: whew, I'm no longer going insane from `git add -p` everytime I need to change something, thanks for the tips :)
12:42hyPiRionrasmusto: You're welcome :) What kind of editor are you using, by the way?
12:42rasmustohyPiRion: vim + foreplay + fugitive
12:42rasmustoer, and paredit.vim
12:43znDuffHow does paredit.vim compare to paredit.el?
12:43rasmustoznDuff: it's a subset of the features as far as I know, I haven't used emacs all that much
12:43hyPiRionah. Not sure if there's some git variant for vim, but emacs has this excellent package named magit which makes most git commands much faster to type
12:44rasmustohyPiRion: fugitive does the equivalent
12:44hyPiRionah, nice
12:50jcromartiedoes it ever make sense to use a map like {:foo {:id :foo …}} over a set like #{{:id :foo …}}
12:50jcromartiebasically use a hash map as an index
12:51jcromartieis the ID really part of the thing?
12:52palangohey, I'm trying to validate a html form with (lib-)noir.validation, I looked up most stuff from the docs but when I include the on-error function in the code I get a Unbound cannot be cast to clojure.lang.IDeref exception.
12:53palangoany idea what could cause that? sample code is here: http://pastebin.com/gBvTkYAQ
13:25FrozenlockWhat happens when 2 libraries need the same underlying library, but different versions? Are the 2 different versions packaged in the project?
13:26S11001001Frozenlock: shallowest wins, then leftmost wins
13:27antares_Elastisch 1.1.0-beta1 is released: http://blog.clojurewerkz.org/blog/2013/02/26/elastisch-1-dot-1-0-beta1-is-released/
13:30FrozenlockS11001001: Thanks!
13:44seangroveHrm, how do I use java.sql.Timestamp in clojure?
13:47seangroveDo I have to require something first?
13:48ppppauli'm in the mood for profiling
13:48ppppaulrecommendations?
13:48technomancyany windows users want to try out the new self-install in lein.bat? https://github.com/technomancy/leiningen/commit/66ed4818ec52249280c8f2ffb2221c20d32754eb
13:48technomancyno more curl/wget required
13:48jeremyheilerseangrove, You have to import it.
13:49jeremyheilerLike (ns foo.bar (:import [java.sql Timestamp]))
13:49Raynestechnomancy: So, turns out that Haskell's 40MB binaries aren't even statically linked -- that's just how big it comes out on OS X. I can get it down to 23mb by calling strip on it.
13:49jeremyheilerNotice the space between sql and Timestamp
13:49seangrovejeremyheiler: Ah, thank you
13:49arkxDoesn't it work without the space as well?
13:49technomancyRaynes: that's less daunting but still a bit of a drag
13:50frenchypseangrove: https://www.refheap.com/paste/11839
13:50arkxI mean, using a dot instead.
13:50Raynestechnomancy: Turns out you only really need to statically link on Linux, since OS X ships with the libs that Haskell dynamically links again.
13:50Raynestechnomancy: Not sure what you'd have to do in Windows.
13:50TimMctechnomancy: So this adds a dependency on Powershell? (If not using Cygwin.)
13:50technomancyTimMc: yeah
13:51technomancysomeone told me it's available everywhere except old versions of XP without a service pack installed
13:51Raynestechnomancy: Awesome on using powershell!
13:51TimMcHuh, interesting.
13:51technomancyRaynes: that's, um, some uncharacteristic enthusiasm
13:51jeremyheilerarkx, Yeah, but then you have to use its fully qualified name. If you use the space, you can just use the class name.
13:51technomancyfor a Windows feature =)
13:51TimMcWell, hear-say is good enough for me.
13:52Raynestechnomancy: It's less pathetic than relying on a user to install curl.
13:53kevinkevinhas anyone else found that exceptions generated in an agent action don't have stack traces?
13:53technomancydon't look at me; I just apply the patches, smile, and nod =)
13:55technomancyand when I say patch, I don't mean a pull request; for some reason this one was a gist
13:55actsasgeekis there a way to get lein to run with more memory? specifically lein swank? I saw something like: >JAVA_OPTS="-Xmx50g" lein swank but that doesn't seem to work...:/
13:56technomancywhich I guess is better than when Windows users just put suggested changes in issue comments
13:56hyPiRion:jvm-opts ["-Xss18m"] for instance
13:56hyPiRionactsasgeek: ^
13:56technomancyJAVA_OPTS should work too though
13:56hiredmanyou may need a G instead of a g
13:57jeremyheilerarkx, Correction, the full qualifed name can always be used. So, importing with a dot instead of the space doesn't do anything.
13:58technomancyactsasgeek: JAVA_OPTS works here; what version are you running?
13:59amalloyhiredman: naw, i always use lower-case
13:59actsasgeeklein 2
13:59actsasgeekjava 1.6.0
14:02arkhwith the following: (defn foo [s] (let [re #"\d+"] (when (re-seq re s) true))) , does clojure have to recompile the regular expression at each function call?
14:03znDuffarkh: no, it doesn't.
14:03arkhznDuff: thanks
14:05hyPiRionit's compiled at read-time
14:11actsasgeekI dunno…something is funky here. Using the above, querying the runtime yields 505.625Mb for maximum memory. If I add -Xms50g -Xmx50g, I get a "incompatible values for minimum and maximum heap size" error.
14:13Raynesactsasgeek: Try setting the maximum "-Xmx" higher than the minimum,
14:14actsasgeekRaynes: I tried that as well. and get the same error.
14:14znDuffactsasgeek: ...by the way, what's your actual available physical memory?
14:14amalloyi rather doubt you really want clojure to have 50g of heap available. that generally just ends in tears
14:15znDuff...and telling the GC to not act until that much garbage has grown up isn't great either.
14:15actsasgeek61Gb
14:16znDuffI don't suppose there's any chance you might have a 32-bit JVM?
14:17actsasgeekI don't think so. The application runs with similar settings…I just don't seem able to affect them from the command line. And the strange thing is that I can't do it on my local MBP either.
14:18znDuffWhat's your output from ''java -version''?
14:18pbostrom_technomancy: I prefer not to refer to myself as a Windows user, but my day job requires it, so I gave it a whirl: https://www.refheap.com/paste/11840
14:19actsasgeekfor the remote box, java version "1.6.0_25"
14:19znDuffactsasgeek: I'm actually interested in more of the output than just the number.
14:19actsasgeekjava version "1.6.0_25"
14:19actsasgeekJava(TM) SE Runtime Environment (build 1.6.0_25-b06)
14:19actsasgeekJava HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)
14:20znDuffHmm. No obvious warning signs there.
14:21actsasgeekso this works perfectly fine: java -Xms50g -Xmx50g Hello
14:22technomancypbostrom_: thanks; I won't tell anyone =)
14:22technomancypbostrom_: oh... yeah; I guess it won't work until 2.1.0 is released, heh
14:22technomancycan you try manually changing LEIN_VERSION to 2.0.0?
14:24actsasgeekjust setting the jvm_opts inside project.clj worked; I was hoping to avoid that (because of dev/prod differences) but oh, well. I have no idea why it won't work. thanks for your help.
14:25technomancyactsasgeek: you can put it in the :dev or :production profile in project.clj
14:26pbostrom_technomancy: same error
14:27pbostrom_I couldn't load https://leiningen.s3.amazonaws.com/downloads/leiningen-2.0.0-SNAPSHOT-standalone.jar in my browser either
14:27technomancypbostrom_: yeah, get rid of the -SNAPSHOT part
14:27pbostrom_wait, I forgot to leave off SNAPSHOT
14:27pbostrom_let me fire up Notepad.exe again
14:28technomancy(you weren't supposed to say that last part out loud)
14:28TimMcpbostrom_: Cue colored lights and techno music.
14:29Hodappblah blah blah, look at me, I'm technomancy, I think I'm superior just because I use emacs!
14:29TimMcfast zoom on your face, where the computer screen has been projected
14:29HodappTimMc :P
14:29technomancyHodapp: I got much respect for vim users =)
14:29Hodapptechnomancy: ...because they have a tough penance to complete?
14:31pbostrom_technomancy: success! what's the Notepad shortcut for nrepl-jack-in again?
14:31technomancyhehe
14:31technomancypbostrom_: thanks!
14:32seangroveIs there a way to get a list of options a java object has?
14:32pbostrom_np
14:32amalloyseangrove: i don't think there's any such thing to get a list of?
14:32seangroveclj-yaml relies on snakeyml but doesn't expose much, so I'm exploring clj/java interop here :P
14:33jeremyheilerseangrove, What do you mean by "optiosn"?
14:33jeremyheileroptions...
14:33seangroveAh, sorry
14:33seangroveMethods*
14:33seangroveI meant to type methods, but was looking at the word "options" :P
14:33seangroveThe snakeYaml docs say that their DumperOptions object has a explicitStart method, the clojure repl disagrees. I'd like to see what methods it *does* have
14:34jeremyheilerseangrove, You'll have to juse Java's reflection.
14:34antares_seangrove: http://stackoverflow.com/questions/5821286/how-can-i-get-the-methods-of-a-java-class-from-clojure
14:34seangrovejeremyheiler: Thanks, I'll look it up - haven't used it much yet
14:34seangroveantares_: Just got there, thanks
14:34brianwong(for [method (.getMethods java.awt.Frame)] method)
14:35goraciocreating web site without routing some thoughts ...http://bit.ly/128NtOD
14:37seangrovebrianwong: Very succint, thank you
14:37brianwong(for [method (.getMethods java.awt.Frame)] (.getName method))
14:37brianwonga little better
14:41xorolahi
14:42kevinkevinhas anyone else found that exceptions generated in an agent action don't have stack traces?
14:44amalloythey probably just have very short stacktraces
14:48actsasgeekI was noticing the same thing about stack traces from exceptions in atoms. I wasn't sure if it was swank that was doing it though…but I never get a stack trace from an exception in an atom. I always have to try the stuff outside of it to find problems. I could be doing something wrong, admittedly.
14:54kevinkevinamalloy: They have no stack trace at all
14:54kevinkevinactsasgeek: did you find any way around it?
14:55actsasgeekkevinkevin: no, sorry. I just sort of live with it and curse.
14:55kevinkevinactsasgeek: it is a huge pain. makes it impossible to track down errors deep in a program
14:56technomancythere's a bug in the JVM that can delete stack traces with tiered compilation enabled
14:56technomancyhttps://github.com/technomancy/leiningen/issues/1025
14:57technomancykevinkevin: ^
14:57clojurebotI don't understand.
15:00actsasgeekinteresting. why does specifying jvm-opts [] fix it? Wouldn't the defaults be merged into it?
15:01kevinkevintechnomancy: thanks for the info
15:01technomancyactsasgeek: yeah; hrm. that is incorrect. :jvm-opts ["-XX:TieredStopAtLevel=1"] is a better fix.
15:01technomancyI'll update the ticket
15:01technomancykevinkevin: not sure if that's the problem you're seeing, but it sounds familiar
15:02kevinkevintechnomancy: it looks like it is, actually
15:02actsasgeekyeah, thanks.
15:02kevinkevinran without lein and the stacktraces are there
15:03technomancytiered compilation gives a huge speed boost to startup, but apparently it's not perfect yet
15:04TimMcA whole mess of issues around it, yeah?
15:04TimMcI feel like I've heard of maybe 3 different problems it causes in just this past week.
15:06technomancymaybe I missed something? this is the only problem I'm aware of, other than it not being as fast as it could be in 2.0.0.
15:09milos_cohagensorry for off topic q, but.. :) is there a emacs lisp fn to switch to the last visited buffer without prompting me? i want to call 'switch-to-buffer non-interactively
15:12amalloymilos_cohagen: try #emacs
15:13RaynesNot that it's so offtopic that nobody wants to answer it, just that #emacs is more likely to actually have the answer.
15:13milos_cohagenya u guys r right, i'm a bit of newb to irc and this group is only one i visited so far
15:14antares_milos_cohagen: I use https://gist.github.com/michaelklishin/62710c5622e84951c916, seems to do what you need?
15:15brehautmilos_cohagen: have a look at what C-x left and C-x right are bound to?
15:15brehaut(no idea if thats default, or starter kit default)
15:15milos_cohagenantares: tyvm, works perfect
15:16milos_cohagenbrehaut: works too, ty guys
15:17amalloybrehaut: must be a real default, since i have it too
15:18brehautcool
15:22FrozenlockMoving from protocols to multimethods... Is there a way to deal with `nil'?
15:23FrozenlockMy multi dispatch based on the class
15:23brehautFrozenlock: you can implement a protocol for nil
15:24milos_cohagenclojure q now.. i'm editing a clojure file in a lein proj w/emacs+nrepl.. i eval a fn in current file, get an error, the err comes from a fn defined in other ns, so my workflow is: switch buffer to the other ns, call 'nrepl-set-ns, modify fn, eval fn, switch back to prev buffer, call 'nrepl-set-ns, call the original fn to see if it works without err, if err repeat workflow.. so my q is: is there a better workflow?
15:24Frozenlockbrehaut: So multi for everything, but a protocol for nil?
15:25znDuffmilos_cohagen: If you eval anything with C-x C-e, it's always done in the current ns, so you can put your test statements inside of a comment in your files and eval them, removing the need to do the nrepl-set-ns.
15:25brehautFrozenlock: oh right, my bad
15:25brehautFrozenlock: got it backwards
15:25Frozenlock:p
15:25brehaut,(class nil)
15:25clojurebotnil
15:25brehautFrozenlock: i
15:25znDuffmilos_cohagen: ...also, you might consider recompiling the whole file (C-c C-k) rather than just evaling the piece you change, if there are other things depending on the code you're modifying which could be broken by your changes.
15:25brehaut'd just use nil as the class by the looks of that
15:26FrozenlockI tried that, but I got an error...
15:26Frozenlock(defmethod my-method nil nil)
15:26brehautFrozenlock: what is your defmulti line?
15:27Frozenlock(defmulti my-method class)
15:27Frozenlock(defmulti my-method #(if % (class %) :nil)) could do it perhaps...
15:27brehautFrozenlock: no, class should be fine
15:28brehautFrozenlock: shouldnt you have an arg list in there somewhere? (defmethod my-method nil [] nil) ?
15:28FrozenlockOh right!
15:28brehautblerk not [], [_]
15:29Frozenlockbrehaut: and now it works :)
15:29FrozenlockThanks you so much
15:29brehautFrozenlock: o/
15:29Frozenlock\o
15:29FrozenlockI was sure it was a multi-related problem
15:30brehautFrozenlock: its not a very clear error it gives you
15:30FrozenlockThe best kind of error: java.lang.NullPointerException
15:30brehautFrozenlock: if you get the full stacktrace it does tell you its coming from the method parser though
15:31maiohm JVM_OPTS=-d32 and Clojure startup time is few seconds faster. are there any other tricks to make it even faster? :)
15:40thorwilcould a java.lang.NullPointerException at a (korma.core/defentity comment ...) be due to comment already being defined by clojure.core?
15:41znDuffdefentity is a macro, right?
15:42antares_thorwil: yes, you can use :refer-clojure :exclude [comment] to avoid that. comment returns nil.
15:42znDuffSo we don't know what code that actually expands to without actually using macroexpand. It certainly could expand to something where comment's preexisting definition could be a problem (in which case the approach given above will avoid it)
15:43thorwilyes, a macro
15:46thorwilhappens way too often that i stumble over vars not being defined and stuff like that, when i get back to work (with a lein immutant run)
15:47thorwil(:refer-clojure :exclude [comment]) did fix it, thanks antares_
15:48qizwizhaving trouble finding this. What's the best way to trace through the source in emacs once you've issed "lein run"?
15:48qizwizI found an example web app on github that I can't actually tell if it's doing anything
15:50qizwizthis is the app if anyone's interested: https://github.com/santervo/cardealer-demo
15:50rabbit_airstrikeqizwiz: run the app in the background or in a screen?
15:50clizzini'm working on a web app that i'd like to use clojure for, but that has to integrate with some java silliness (guice modules, if you know about that). it seems like i need to expose my clojure code as a class that acts like a java servlet. does anyone have a good example of this?
15:51rabbit_airstrikeor you're looking for some kind of verbose mode for this webapp?
15:52brehautclizzin: theres a ring adapter for that
15:52brehauthttps://github.com/ring-clojure/ring/tree/master/ring-servlet
15:53qizwizI ran it from a terminal
15:54augustlhmm, clout (the route parser in compojure) seems to unescape escaped URIs, why does it do that? /foo/test%20me with a route "/foo/:my-thing" sets :route-params -> :my-thing to "test me", not "test%20me"
15:55augustlclout seems to do a decode on all "path segments", i.e. everything between a /, which essentially causes data loss (i no longer know what the original URL looked like)
15:56clizzinbrehaut: oh cool! didn't see that in any of the ring docs. will give it a shot. thanks!
15:56brehautclizzin: its mentioned in the primary ring readme ;)
15:58rabbit_airstrikeqizwiz: possibly an unfilled mongodb dependency?
15:58rabbit_airstrikedo you have mongodb installed and running for the example app?
16:00TimMcaugustl: I'm pretty sure that's as designed.
16:00augustlTimMc: I wonder why, it's annoying :)
16:00TimMc%20 is an encoding for transport
16:01TimMcAs a string in memory, you really want " " instead of "%20".
16:01augustl%20 is the actual value of the URL, not just for transport
16:01augustl..imo
16:02augustlis "/foo/" and "/foo%2f" the same URL?
16:02brehautan accident of early browser location UIs
16:02brehautim with TimMc; i think they are
16:02augustlcan I safely do a request to %2ffoo instead of /foo in all situations?
16:03SegFaultAXaugustl: Why would you use / within a path segment? It has special meaning inside of URIs.
16:03rabbit_airstrikeqizwiz: after I installed and started mongodb, that example web-app you linked to works fine
16:03augustlSegFaultAX: is that relevant to the discussion? :)
16:03TimMcaugustl: / might be a special case.
16:04SegFaultAXaugustl: Yes, it is. Because / is a special case in the URI standards.
16:04augustlSegFaultAX: does escaped charcters have any meaning?
16:04SegFaultAXaugustl: They're a transport encoding as TimMc said.
16:05augustlso I can't have any value I want in my URL?
16:05augustleven if I escape it?
16:05TimMcEmpirically, http://www.google.com%2F breaks.
16:05amalloy%2F is required to behave differently from / in path segments
16:06brehautamalloy: by spec or by historical accident of filesystem based webservers?
16:06augustlthe actual issue is that I'm writing a proxy, with a clout match like "/proxy*", and I pass (get-in req [:route-params :*]) to the proxy. But clout unescapes it so I get an invalid URL (containing a literal / instead of %2f, for example)
16:06amalloybrehaut: by spec
16:07amalloyi can't imagine i would say "required" and mean "typically this is what happens"
16:07Raynesohpauleez: Were the dude working on Clojure stuff for leapmotion?
16:07augustlso I have to manually fetch the actual escaped uri from the request and extract the relevant part (the part after /proxy)
16:07ohpauleezRaynes: I am
16:07Raynesohpauleez: Have you seen https://getmyo.com/
16:07ohpauleezRaynes: I have not, looking now
16:08Raynesohpauleez: It's pretty amazing.
16:08augustlamalloy, SegFaultAX, TimMc: so is the conclusion that an URI can't contain arbitrary values, such as slashes, even when escaped?
16:08augustlor is it a clout specific issue?
16:08amalloyof course it can. that's exactly what %2f is for: letting you put / into a uri without interpreting it as a path separator
16:09SegFaultAXaugustl: I was only pointing out that it's confusing to use / as part of a path segment because it has special meaning in URIs.
16:09ohpauleezRaynes: It'll be interesting to see if that actually holds up - if they can make it as accurate as depicted in the video
16:09SegFaultAXaugustl: (And you run into problems like you're having because of it)
16:09augustlYou called it a "transport encoding", sounded very serious :)
16:10augustlSegFaultAX: it's clout that's at fault here, it seems
16:10amalloyfor example, for URLs like http://my/server/redirect/google.com%2fhome or whatever similar stuff
16:10Raynesohpauleez: I almost bet it'll be more accurate than leapmotion.
16:10augustlyet another example of erronous handling of URL encoding..
16:11ohpauleezRaynes: I don't know about that - the leap motion uses three IR beams, supporting mm accuracy, with 100 frames of data a second, for a 8ft x 8ft x 8 ft cube
16:11Raynesohpauleez: Yeah, but even it isn't that accurate, given videos I've seen. It's extremely shaky, isn't it?
16:12RaynesAnyways, this uses your damn muscle movement. It's the logical step below hacking into your brain and interpreting your thoughts. I'm pretty optimistic about it.
16:13rabbit_airstrikeanyone have any experience monitoring periodic at-at jobs?
16:13ohpauleezany sensor has jitter - there is no hardware or SDK smoothing at the moment, but it's not hard to implement or ignore. The jitter is not a problem in real-work use.
16:13nopromptyeah that looks pretty cool
16:13ohpauleezRaynes: Oh no, I think it totally looks cool
16:13augustlI posted an issue in the issue tracker of Clout, let's see what happens
16:13augustlwould make sense to have an API like :route-params and :raw-route-params, or something like that.
16:13bbloomgenerally, you need to tune your smoothing to the use case
16:14ohpauleezI just have no knowledge about the accuracy of muscle detection // bio-electrical signaling
16:14bbloomfor a really simple example, the little thumbsticks on video game controllers often have "dead zones" where, over time, they get loose, so the software ignores small dX or dY values
16:14ohpauleezbbloom: Right, which is why they've refrained from adding general smoothing
16:14bbloombut you can have a square dead zone, or a circular one, for two simple examples
16:17nopromptis pmap an example of concurrency or parallelism?
16:18bbloomnoprompt: yes.
16:18ohpauleezhaha
16:18nopromptbbloom: both?
16:18noprompti'm trying to understand the distinction
16:18bbloomnoprompt: it depends on whether or not you have two or more CPU cores
16:19nopromptbbloom: ah, ok
16:19bbloomif you have 1 CPU core, threads execute concurrently
16:19bbloomif you have two CPU cores, then they execute in parallel
16:19ohpauleeznoprompt: sort of both - it's not true data parallelism (you're not operating on all pieces of the data at once), but it is a parallel operation, so you're doing more than one thing at the same time (concurrency)
16:20bbloomohpauleez: discussion of "data parallelism" deeply confuses the issue
16:20ohpauleezand as bbloom said, it's all built on top of threads, which if you have a SMP OS and multiple cores, you get true concurrency
16:20nopromptgotcha
16:20ohpauleezbbloom: I disagree - avoiding it is misleading :)
16:21ohpauleezespecially given its name
16:21bbloomohpauleez: when data is parallel, it just means that it is capable of being processed concurrently
16:21ohpauleezno
16:21ohpauleezTHAT'S the problem
16:21ohpauleezdata parallelism is operating on individual items (usually used to imply ALL of the items) at once
16:22ohpauleezis pmap task parallel? Certainly not
16:22ohpauleezis it data parallel, sort of
16:22ohpauleezis it concurrent, Yes*
16:22ohpauleez* assuming you have more than one core
16:22bbloomtask vs data parallel is orthogonal to concurrent vs parallel execution
16:22ohpauleezor else you just have thread and context concurrency
16:23ohpauleezbbloom: The question wasn't about execution
16:23ohpauleezit was about concurrency or parallelism
16:23noprompti love this place
16:23ohpauleezand the latter comes in multiple forms
16:24bbloomhe asked specifically about concurrency vs parallelism
16:24ohpauleezavoiding these terms isn't going to make them go away
16:24ohpauleezright, so let's be honest with him
16:24ohpauleezI feel we both were
16:24bbloomohpauleez: i'm not avoiding them, i'm separating the discussion into two topics
16:24bbloomyou can discuss them together and how they effect each other
16:24bbloombut he asked about concurrency, which has to do with execution
16:25ohpauleeznoprompt: Do you feel like you've better understood how things are running?
16:25ohpauleezwhen you use pmap
16:25noprompta little bit, but let me make sure i understand the big picture here
16:25ohpauleezok
16:25ohpauleezfire away
16:26nopromptone second
16:28nopromptconcurrency is operating on the same piece of data at the same time
16:29bbloomno
16:29nopromptok
16:29arohnerman I really wish lein had << included
16:29SegFaultAXnoprompt: I think you've confused the problem by asking about pmap specifically. Maybe your question should be "what's the difference between concurrency and parallelism?"
16:29bbloomlet's say you have two processes
16:29antares_ohpauleez: hey
16:30bbloomand by process, i don't mean computer process, i mean like the more abstract notion of some sequence of events
16:30ohpauleezantares_: Hey man
16:30nopromptSegFaultAX: yes, lets assume i had asked that question instead
16:30bbloomnoprompt: imagine those processes have a start-time and an end-time
16:30nopromptk
16:30antares_ohpauleez: do you know if there any improvements on the electronic CA submissions front?
16:30bbloomconcurrency happens when those two time-spans overlap
16:30bbloomie Process A starts, then B starts before A finishes
16:31ohpauleezantares_: As far as I'm aware, you can email us a scan of a CA and we can mail it on your behalf
16:31antares_ohpauleez: or any "official links" to http://clojure-doc.org?
16:31SegFaultAXnoprompt: But not necessarily running /at the exact same time/. Just with overlapping timelines.
16:31bbloomSegFaultAX: right
16:31antares_ohpauleez: email who? and why wasn't this announced?
16:31ohpauleezantares_: until there is some infrastructure in place to handle scans
16:31nopromptah, ok, i think that's what was tripping me up in my thinking
16:31bbloomnoprompt: you might have two projects due for work, so you take turns working on both of them a little bit at a time
16:32bbloomyou're working on two projects *concurrently*
16:32bbloomhowever, if you could clone yourself and work on both projects concurrently, one each
16:32bbloomthen you (and your clone) are working in parallel!
16:32antares_ohpauleez: but does that mean that scans are legally acceptable and Clojure/core now accepts them, it's just a matter of automation?
16:32nopromptso operations in parallel, they would necessarily have the same starting time (but maybe not the same ending time)?
16:32SegFaultAXnoprompt: If you were to graph their timelines, it might look like |A-start ... |A-pause |B-start ... |B-pause |A-resume ... |A-finish |B-resume ... |B-finish
16:32ohpauleezantares_: It hasn't been totally settled yet, people are working on it. And you can make a post on the Clojure ML about the link and someone with access to the site content repo can add it to the docs page
16:32SegFaultAXnoprompt: If you could imagine such an execution timeline.
16:33nopromptSegFaultAX: i can somewhat visualize that
16:33bbloomif, at any given time T, there are two or more processes that have started, but have not yet finished, then they are concurrent
16:33bbloomif at any given time T, there are two or more processes that are *at that precise instant* both executing, then they are parallel
16:33ohpauleezantares_: The scans still need to be printed out, stamped, and mailed - for the time being. There's still a hold up on direct scan acceptance right now
16:34bbloomparallelism implies concurrency
16:34bbloomconcurrency does not imply parallelism
16:34SegFaultAXbbloom: Well said.
16:34antares_ohpauleez: oh well, that's already good news
16:34antares_ohpauleez: so you think we should start a discussion on the ML about having a link to clojure-doc.org from clojure.org?
16:35bbloomnoprompt: with us so far?
16:35SegFaultAXnoprompt: The other issue of task vs. data parallelism is orthogonal to the above-described execution strategy.
16:35bbloomSegFaultAX: yes, i was going there next. just to pleez ohpauleez :-)
16:35SegFaultAXbbloom: Hah, ok I'll let you finish it then :)
16:35nopromptbbloom: yes, i think that last bit clarified it
16:35ohpauleezbbloom: :)
16:35ohpauleezthank you'
16:35bbloomok, soooo data & task parallel ism
16:36ohpauleezSUPER easy
16:36ohpauleezmay I field this one?
16:36SegFaultAXohpauleez: For someone new to concurrent programming, task/data parallelism just muddies the waters with additional terminology.
16:36ohpauleezSegFaultAX: Really?
16:36bbloomI agree
16:36ohpauleezhow so
16:36SegFaultAXohpauleez: I think so, yes.
16:36ohpauleezwhat?!?!
16:36bbloomit overloads the word "parallel"
16:36ohpauleezhaha I can't believe I'm the odd one here
16:37bbloomit really should be "task vs data CONCURRENCY" :-P
16:37nopromptbbloom: so in the concurrency part, two processes may have started but are not necessarily both executing at the same time?
16:37bbloomnoprompt: right
16:37nopromptparallelism is a special case of concurency?
16:37SegFaultAXnoprompt: Precisely!
16:37bbloomnoprompt: yup
16:37ohpauleezyes
16:37ohpauleezand here's the difference
16:37SegFaultAXnoprompt: Where two or more processes can execute /at the exact same time/
16:37bbloomhere's another example:
16:38bbloomlet's say you're preparing dinner for your family and you're plating the food. you are the only person plating and you only have one serving spoon
16:38noprompti just felt my mind expand a little :)
16:38nopromptlove that feeling
16:38bbloomif you put the mashed potatoes on everyone's plates
16:38bbloomthen you put the peas on everyone's plates
16:38bbloomyou're plating concurrently
16:38bbloomif you're sister decides to help you, brings a second spoon
16:38bbloomand she starts plating people's peas while you plate the mashed potatoes
16:39bbloomthen you are plating in parallel
16:39nopromptright because plating the potatoes and plating the peas are two separate processes but they're not happening at the same time
16:39SegFaultAXohpauleez: I guess my argument is just that concurrency and parallelism are already abstract enough without introducing the specific execution strategy for each thread of execution (system thread or otherwise)
16:39ohpauleezSegFaultAX: Is there one task you're applying to lots of data (data parallelism), or is there one set of data your applying lots of different tasks to (task parallelism)
16:39bbloomnoprompt: you got it
16:39bbloomso now task vs data
16:39ohpauleezAre you potentially doing more than one thing at the same time? (concurrency)
16:39bbloomserving potatoes and serving peas are two tasks
16:39antares_ohpauleez: sorry to interrupt a very interesting concurrency/parallelism discussion but have you seen my Q about starting a discussion about moving clojure-doc.org to docs.clojure.org?
16:40SegFaultAXohpauleez: Task parallelism doesn't imply operating on the same data across multiple tasks.
16:40SegFaultAXohpauleez: You can have different tasks operating on different data, for example.
16:40bbloombut you're spoon can carry many peas at once
16:40nopromptno i understand the part prior about starting A, stoping A, starting B, ...
16:40antares_ohpauleez: also, since I don't have access to clojure-dev, I am curious how much attention that will get from decision makers
16:40noprompts/no/now
16:40bbloomthat's sorta like "data parallelism" where you the same (or very similar) operation to a whole bunch of units of data of the same class all at once
16:40ohpauleezantares_: I'd definitely just hit up the Clojure ML - that'll have the most eyes on it
16:41bbloomthere is a distinction between task parallelism and data parallelism not because they are inherently different in any way, but because they offer distinct and interesting concurrency strategies
16:41ohpauleezbbloom: YES! Good point
16:41clojurebotyes! and the hack is to do (->> blah #(foo % bar)), or use swiss-arrows
16:42SegFaultAXbbloom: I think the better analogy for that might be mashing the potatoes. Having 1 thread mashing the entire pot vs. sub dividing the pot and having multiple mashers going.
16:42bbloomSegFaultAX: heh, i think the food example breaks down for task v data
16:42ohpauleezI agree
16:42SegFaultAXAww, I thought that was a good example!
16:42SegFaultAX(The mashing bit)
16:42bbloomit's as awkward as mine :-)
16:43SegFaultAXFor task parallelism you could have 1 task adding salt to the taters, one adding butter, another milk, etc.
16:43antares_ohpauleez: ok, thank you
16:43SegFaultAX... No? Ok, I'm hungry now.
16:43bbloommmm mashed potatoes
16:43Bronsalol
16:43ohpauleezSegFaultAX: Salt is a good example actually
16:43cemerickBodil: did I see you talking about porting clojure.test to cljs a few days ago?
16:44SegFaultAXohpauleez: I was trying to make it work.
16:45SegFaultAXbbloom: I feel like you should capture this discussion into a blog post.
16:45SegFaultAXbbloom: You could probably use your kitchen analogy if you clean up the inconsistencies.
16:45nopromptso i guess the question left in my mind, is how do you ensure that each plate is never plated twice? or would you never run in to that problem?
16:46ohpauleezAre you handling more than one thing at the same time? (Concurrency) Are you *actually* doing multiple things at the same time? (parallelism) Are you doing the same operation, in parallel across a set of data? (data parallelism) Are you doing lots of different tasks across a single piece of data? (task parallelism)*
16:46ohpauleezYou could also being doing lots of tasks on lots of small pieces of different data - also task parallelism
16:46SegFaultAXnoprompt: Usually there is some other process coordinating the task.
16:46ohpauleezbut that case is rarely considered
16:46nopromptwould that be the parent process?
16:46bbloomSegFaultAX: it takes me forever to write blog posts.... & i feel like this is a well covered subject :-P will save my writing time for unique things
16:47bbloomnoprompt: how do you and your sister keep from plating the same plate twice?
16:47bbloomnoprompt: you communicate
16:47bbloomnoprompt: either verbally
16:47SegFaultAXbbloom: Hah, well it's on the table if you change your mind. (See what I did there?)
16:47bbloomor via looking at the plates themselves
16:47ohpauleezthis is a pretty solid analogy
16:47nopromptbbloom: you should consider writing this up, yes. you've definitely helped clear up my confusion.
16:48ohpauleezI use classrooms, classes, a school, and chalk boards usually
16:48nopromptSegFaultAX: you as well, thank you
16:48SegFaultAX(inc bbloom)
16:48lazybot⇒ 6
16:48bbloomheh, ok... i'll add it to the queue of posts to be written
16:48SegFaultAX(inc ohpauleez)
16:48lazybot⇒ 1
16:48ohpauleezYes!
16:48ohpauleezONE!
16:48ohpauleez:)
16:48bbloomi currently have 38 drafts lol
16:48bbloommost of the time, i write enough of an outline that i have some epiphany myself & then loose interest in the blost post
16:48bbloomlol typo: blost. i've invented a new word
16:49ohpauleeznoprompt: For completeness, I'll give you another analogy that's common in papers and books
16:49bbloomweb log -> blog ;; blog post -> blost
16:49bbloomi also have a good analogy regarding resource contention that involves ordering drinks at a bar :-)
16:49nopromptoff topic, but every time i'm in this room i feel inspired to return to college
16:50jcromartienoprompt: hah
16:50bbloomnoprompt: meh, you don't need college. just start a paper-reading club :-P
16:50SegFaultAXWhat's the term for comparisons of the form "foo is to bar as spam is to eggs"?
16:50ohpauleezLots of students attend a school, and they all need to learn. The school has a master chalkboard that all the students see when they enter - the board is FULL of math problems to solve
16:50amalloySegFaultAX: analogy
16:50bbloomheh.
16:50bbloomyes.
16:50SegFaultAXamalloy: I thought there was s epcial name.
16:51jcromartiehow can I test if every value in a collection is unique?
16:51nopromptbbloom: yes, i've heard similar view points. i never finished my compsci education because i got bored.
16:51jcromartieI am doing (defn unique? [coll] (= (count coll) (count (set coll))))
16:51ohpauleezso the students one by one take a problem to do, and head to a classroom. Each classroom holds 6 students. And they begin working. They use the chalkboard in the classroom to share work, ideas, and communicate.
16:51jcromartieis that reasonable?
16:51bbloomjcromartie: seems reasonable to me
16:51SegFaultAXamalloy: Well now I feel like a dumbass.
16:51amalloy&(doc distinct?)
16:51lazybot⇒ "([x] [x y] [x y & more]); Returns true if no two of the arguments are ="
16:51ohpauleezas the students finish their work and solve their problems, the head back to the main school chalkboard, write their answer, and head home
16:52nopromptohpauleez: i like that analogy as well, however it lacks the mashed potatoes
16:52noprompt:)
16:52ohpauleez:)
16:52bbloomjcromartie: yeah, you can apply distinct?
16:52jcromartieah
16:52bbloomIMHO, there is severe lacking of mashed potatoes in computer science
16:53bbloomfuck peas tho. they pretty much only exist to make your cream sauces have some fancy green bits in them
16:54nopromptbbloom: i plan to start reading more papers soon, along with implementing your red marker technique
16:54jcromartiethen a better name would be all-distinct?
16:54bbloomnoprompt: it's a solid approach :-)
16:54nopromptmy gf and are splitting up so, yeah, more time for that
16:54brehautbbloom: also to create pea puree for master chef challenges
16:54gfredericksso clojure.java.jdbc/transaction -- should it rollback on arbitrary throwables rather than just Exceptions?
16:54ohpauleeznoprompt: The students use the main chalkboard to make sure no one takes the same problem, and that all the answers get written down somewhere. The classrooms allow students to work in little batches, communicating efficiently with each other (imagine the alternative - screaming in an gym full of all the students) The problems are solved in parallel because all the students are working at the same time.
16:54nopromptbrehaut: the python discussion did not go as well, or as bad, as i had thought it would
16:55brehautnoprompt: just 'meh' ?
16:55nopromptohpauleez: very nice
16:55jcromartieohpauleez: is this a real school, or is it a contrived concurrency problem?
16:55ohpauleeznoprompt: And that's "exactly" how a GPU works
16:56ohpauleezglobal memory (the school chalkboard), local memory (the classroom chalkboard), private memory (the students paper)
16:56ohpauleezand the classrooms are Processing Units
16:56nopromptbrehaut: he coped out with the whole "every language has it's warts" bit i've heard time and time again from folks who get scured of learning an lang like cli or hs
16:56ohpauleezjcromartie: Just an example
16:56noprompts/cli/clj
16:57brehautre:blackboards http://en.wikipedia.org/wiki/Tuple_space
16:57jcromartieI thought maybe you worked for an efficient collaborative school
16:57brehautnoprompt: tis both right and a cop out for sure
16:57nopromptbrehaut: in short he doesn't want to use clojure because he doesn't think there's a significant gain
16:57SegFaultAXamalloy: I guess I was thinking of the form "A : B :: C : D" which is called Aristotelian format, eg the format used on SAT's.
16:58brehautnoprompt: thats the blub paradox in action
16:58nopromptbrehaut: but since he's unwilling to even consider the language...
16:58brehautnoprompt: tbh thats what i would expect from some who described as a 'Hardcore X user'
16:59jcromartieif you ever meed a self-described "PHP guy", run
16:59jcromartiejust run
16:59nopromptbrehaut: indeed
16:59ohpauleezok, so now noprompt, do you feel like you've got it?
16:59nopromptjcromartie: plenty of those people in my town, sad to say i can't convince that php is shit pancake either
16:59ohpauleeztwo and half examples, a handful of terms
17:00brehautjcromartie: that applies to most martyrs ;)
17:00TimMc$google php fractal bad design
17:00lazybot[PHP: a fractal of bad design - fuzzy notepad] http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/
17:00nopromptjcromartie: my favorite response from PHP debs when you tell them it's an ass language: "well it pays my bills"
17:00noprompts/debs/devs fucking autocorrect
17:00brehautclojurebot: php is http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/
17:00clojurebotAlles klar
17:00ohpauleeznoprompt: Tell them to honestly read: http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/
17:01ohpauleezdamn you brehaut and clojurebot
17:01ohpauleezhaha
17:01jcromartieTo be honest, PHP is where I got started in web dev, though. It took a while to un-learn it.
17:01nopromptohpauleez: i also like the double clawed hammer post
17:01brehautnoprompt: thats the only reason to use PHP. totally legit reason.
17:01jcromartiebut that was like, high school
17:01ohpauleezSelling crack can pay the bills too
17:01TimMcnoprompt: THat's the one, actually.
17:01ivanthat page brings out the dunning-kruger in the PHP developer: "why do you care about these things?"
17:01bbloomi've also heard "facebook uses it"
17:01bbloom*argh*
17:01ohpauleezbut I don't sell crack
17:02ohpauleezbbloom: That's the worst
17:02bbloomi generally respond "and they deeply regret it"
17:02ohpauleezI get violent when I hear that
17:02bbloomhaha
17:02nopromptsomeone needs to give php the coffeescipt treatment or something
17:02ohpauleezhaha
17:02TimMchttp://phpsadness.com/ is pretty good too.
17:02ivanthere are languages that compile to PHP
17:02nopromptthat url is priceless
17:03nopromptsad to say i've turned down contract work purely because it was php
17:03TimMcTHat's very understandable.
17:03hashbang1bbloom: yeah, i love that argument. they also had to write hiphop just to keep it usable
17:03hyPiRionthat was for performance reasons though
17:03TimMcnoprompt: "Sad to say, I've turned down construction jobs because I would have been required to use rocks and floss."
17:04bbloomhashbang1: from what i'm told, PHP can be safely described as Facebook's server side templating language
17:04bbloomsince everything else has become a hodge podge of internal services
17:04brehautohpauleez, TimMc: Marco Arment (instapaper, and formerly tumblr) is a PHP user who both read that fractal article and acknowledged it to be a pile of ass, and continues to use it.
17:04bbloombrehaut: yeah, there is something to be said for "gets the fucking job done"
17:04ivanhttp://scriptor.github.com/pharen/
17:05TimMcPHP is very effective for getting the first few pages done. (If you don't mind exploits and stuff...)
17:05brehautbbloom: i certainly cant argue with his results
17:05brehautim trying to find marco talking about the article, but it might have been on a podcast
17:05hyPiRionThere's a difference between "getting stuff done" and "dying because of complexity due to bad design" though
17:06Apage43some time ago I wrote -waaaay- too much PHP. (Which incidentally is great if you want to break PHP sites, because you learn all the mistakes in a first-hand way)
17:06jcromartiethis is what's wrong with PHP http://php.net/quickref.php
17:06Apage43nowadays I can't really "think in PHP" enough to read PHP code well
17:07bbloomhyPiRion: yeah, which is why i feel that Rails has 100% replaced every PHP use case of value with exactly one exception: brain dead deployment
17:07bbloomjcromartie: lol yeah, cmd+f is quick!
17:07bbloom:-P
17:08noprompti've noticed that the guys that use the "get the job done" argument have a hard time recognizing the complexity point of view
17:08jcromartiefrom what I can gather, there are ~4600 PHP functions in a single global namespace
17:08bbloomit's simply chaos theory & evolution
17:08brehautbbloom: rails etc have a side disadvantage there; PHP basically dictates a lifecycle model, but with rails etc you have to take some responsibility for those decisions
17:09bbloombrehaut: yeah, hence the exception for it
17:09brehautnoprompt: thats the blub paradox in action again
17:09jcromartiepeople complain about clojure.core's admittedly massive 580 vars
17:09pochoMy REPL in counterclockwise prints out "NullPointerException clojure.lang.Numbers.ops (Numbers.java:942)" How do I get better information.
17:09bbloombut the bottom line is that software is *really fucking complex* and, yet, survival of the fittest plus iteration == successful software
17:09bbloomit also equals tons of crap software
17:09jcromartiepocho: (pst)
17:10jcromartie(print stack trace)
17:10pochothanks
17:10bbloomjcromartie: i wonder if there is a way to get a count of builtins in Mathematica....
17:11nopromptit's all just a great big pile of hacks.
17:11jcromartiebbloom "over 3000"
17:11jcromartiehttp://reference.wolfram.com/mathematica/guide/AlphabeticalListing.html
17:11bbloomheh
17:11bbloommadness.
17:12bbloomi've been really enjoying playing with mathematica tho
17:12nopromptin all fairness though, php wasn't originally purposed to do the things it does now, as we all know
17:12bbloomi kinda wish i had a symbolic prepositional order logic available to my clojure code :-)
17:12jcromartieabout 3500
17:12hyPiRionIt's not really madness to have many functions in the same namespace though.
17:13noprompthyPiRion: i tend to agree
17:13hyPiRionWell, not necessarily at least.
17:13noprompthyPiRion: all though i try to avoid that in my own
17:13bbloomhyPiRion: only because they've done a good job of disambiguating with long names
17:13noprompts/all though/although ughh cannot type today
17:13jcromartiethe thing that might have saved PHP's reputation would have been avoiding the single global namespace
17:13bbloomhyPiRion: but also b/c they take the point of view that there is ONE set of semantics
17:14nopromptjcromartie: that and separating the templating
17:14jcromartienoprompt: but that was the whole appeal
17:14nopromptjcromartie: it's funny how you can stick arbitrary html right in the middle of a class definition
17:14jcromartienoprompt: one file, everything in one place
17:14bbloomjcromartie: Length[Names[]] returns 25,418
17:15jcromartiebbloom: dear god… but are those all documented?
17:15TimMc,(count (ns-publics 'clojure.core))
17:15clojurebot593
17:15ivanis it reasonable to feed all REPL output through pprint or fipp to avoid O(N^2) Emacs word-wrapping speeds, or are there even more problems with pprint/fipp?
17:15jcromartie,*clojure-version*
17:15clojurebot{:major 1, :minor 5, :incremental 0, :qualifier "RC6"}
17:15jcromartiehm
17:15bbloomjcromartie: well many (most?) of them are just names for symbols
17:15gfredericks(sql/transaction (insert-records ...) (assert false)) commits the transaction
17:15jcromartieI'm on 1.4
17:15TimMc&[(clojure-version) (count (ns-publics 'clojure.core))]
17:15lazybotjava.lang.SecurityException: You tripped the alarm! ns-publics is bad!
17:16TimMcD-:
17:16bbloomFullForm[First[Names[]]] is "\[FormalA\]"
17:16jcromartiegfredericks: that's a problem, eh
17:16gfredericksjcromartie: yeah it's screwed me up a couple times already
17:16bbloomor \[FormalA] rather
17:16jcromartiegfredericks: oh, I know why! because assert doesn't produce an Exception, it's an Error
17:16jcromartiea silly distinction
17:16jcromartiebut I've basically stopped using assert for that reason
17:16gfredericksjcromartie: yep
17:17bbloomjcromartie: just catch Throwable :-)
17:17gfredericksjcromartie: in my case it was an OOM exception
17:17gfredericksbbloom: we have to patch java.jdbc to do that
17:17jcromartiebbloom: the problem is that other libraries already don't "just catch Throwable" and they need to be fixed
17:17jcromartiein fact, it's time for some pull requests
17:17gfredericksI'm filing a jira ticket right now
17:18bbloomi hope in clojure 1.6 we can get catch to be rebranded as an interop form & then move to the non-type-switching semantics of javascript
17:18bbloomjavascript has `catch (e) {` instead of `catch (Exception e) {`
17:18nopromptsomeone mentioned clojure-docs is moving?
17:20bbloomnoprompt: there is now http://clojure-doc.org/ too
17:20bbloomannoyingly similarly named
17:21nopromptwell that's helpful
17:21jcromartieoh look bootstrap
17:21rasmustojcromartie: haha, I was going to mention that
17:22nopromptjcromartie: don't even get me start.
17:22technomancybootstrap: boring, but at least it's not ugly
17:22jcromartieyeah, most clients have never seen a web app that looks half as good as Bootstrap, so it's useful
17:22noprompttechnomancy: it's superior to the user agent stylesheet that's for sure.
17:22danielglauserbbloom: noprompt: I believe the long term plan is to develop clojure-doc.org to the point where it encompasses clojuredocs.org then replace it
17:22jcromartiebut I ALWAYS ALWAYS ALWAYS run into near-insurmountable conflicts
17:23technomancyI'm sure they wouldn't turn down a pull request with a nice custom design
17:23nopromptbootstrap is especially nice though for developers who have no design sense
17:23brehauttechnomancy: on the other hand, you'd want to be sure it was what they considered a nice custom design before you commited the many hours it would take to actually do it
17:24TimMc"What do you mean you don't like yellow on pink?"
17:24technomancy<blink>
17:24rasmustoI have a q: why doesn't (into {}) work on seqs of seqs, does the length of each item need to be known to ensure it's 2?
17:25brehautTimMc: orange on yellow. its the way of the future
17:25TimMctechnomancy: C'mon, that's not even standards compliant, is it? #doc-view-langs-body li {
17:25TimMcblah
17:25TimMc... text-decoration: blink is what you want
17:27technomancythe wave of the future
17:28brehautwait really, its 'wave' not 'way'?
17:28clizzinis it possible for leiningen to run my application with a certain set of command-line arguments (aliased using :aliases in project.clj), but then also expose a repl server to connect to?
17:29technomancybrehaut: http://cn1.kaboodle.com/hi/img/a/0/0/c/2/AAAACvH3OhUAAAAAAAwpCA.jpg?v=1156771677000
17:30brehauttechnomancy: lol
17:30rasmustotechnomancy: that hash @_@
17:30technomancyclizzin: you can start an nrepl server from within your -main defn, or you could try something with lein-pdo
17:32clizzintechnomancy: my main class has to be java (for sad sad reasons), so starting an nrepl server within is probably not an option. i'll check out lein-pdo. the use case is to start the app, then connect to it so i can recompile code just like in my usual clojure dev process, hopefully pdo can help with that
17:32gfrederickshttp://dev.clojure.org/jira/browse/JDBC-47
17:33brehautclizzin: http://skillsmatter.com/podcast/scala/impromptu-rich-hickey-lightning-talk
17:33clizzinbrehaut: ?
17:34Bodilcemerick: I was looking into producing a test framework for Cljs, at least - not a straight port of clojure.test.
17:34brehautclizzin: rich hickey shows how to make java code that wraps up clojure code for when you need a java class as the front end of an api
17:34clizzinbrehaut: gotcha. thanks!
17:35Bodilcemerick: Btw, I had a go at porting cljs-noderepl to Phantom, but Phantom's API is just too inadequate at this point...
17:36nopromptwill the clojure-doc apps ever be written in clojure?
17:36clizzinbrehaut: ahhh, but there's more to the java craziness than just the fact that it's java. i have to code against a framework that always relies on a certain class to be the main class, and then it loads a bunch of modules to run actual interesting code. kind of cool, but makes it difficult to just 'stick something in the main function' — even arbitrary java code would be awkward to add, not just clojure code
17:36technomancynoprompt: as soon as someone volunteers to write the HTML frontend for it
17:37technomancythe JSON API is already written in clojure
17:37noprompttechnomancy: what do you mean by "HTML frontend"?
17:38technomancynoprompt: a user interface which serves up HTML?
17:39nopromptwait, i'm confused. which one are we talking about? clojure-doc or clojure-docs?
17:39technomancyoh, I mean clojuredocs
17:39technomancyclojure-doc.org right now is just static HTML; doing that in Clojure would be silly
17:39noprompttechnomancy: that makes sense
17:40noprompttechnomancy: so which is the project that needs help?
17:41technomancyclojuredocs.org can move off rails if someone writes an HTML frontend
17:41cemerickBodil: I started poking at it a bit last night; I think there might be a way to reuse the phantom REPL without getting tied in knots re: return types, etc.
17:45Bodilcemerick: I got as far as something speaking the cljs-noderepl protocol (essentially JSON) using a straight eval, but I couldn't get the processes talking to each other, so I gave up. fwiw, here's the Phantom side code: https://www.refheap.com/paste/11849
17:46noprompttechnomancy: so if i'm understanding this correctly, it's just writing flat html?
17:47cemerickBodil: Thanks; I'll see if I can cook something up. I can't cope with rhino anymore, can't reasonably use JDK8, and need a DOM. So... :-)
17:47hiredmancemerick: just like you needed a pom?
17:47hiredman*zing*
17:48cemerickhey-o!
17:50noprompttechnomancy: i guess i'd be happy to help. has anyone started on it?
17:50technomancynoprompt: not the HTML part; dakrone was looking for volunteers last I checked
17:50Bodilcemerick: Worst case, there's always Node and https://github.com/tmpvar/jsdom
17:51nopromptsure i could spare a few hours a week to help if it can move the needle forward.
17:52bbloomdnolen: i finally think i have a strong enough foundational understanding of logic to really dig into core.logic... i've been reading wikipedia for like 3 days, heh
17:52cemerickBodil: Perhaps. I'm blissfully ignorant of node, and hope to stay that way. Plus, I figure between phantomjs and figuring out whatever XUL madness will be needed for headless moz, I can have some confidence that test results actually correspond to users' browsers, etc.
17:54dnolenbbloom: hehe, it's not clear to me just how much understanding of first order logic helps understanding a Prolog-like system
17:54bbloomdnolen: it's mostly terminology, historical context, motivation, etc
17:55Bodilcemerick: Well... having done a fair bit of JS-on-QtWebkit dev, I wouldn't trust Phantom to correspond to Chrome or Safari, but at least it'd be much closer than jsdom's emulation. Also, it can generate screenshots. :)
17:55dnolenbbloom: yes, my grasp of that stuff is still pretty poor. Art of Prolog is a good resource as far as that goes it seems
17:56bbloomdnolen: as discussed: i'm interested in predicate dispatch, but i think it should have an underlying a predicate logic sublanguage... mainly b/c i'm gonna want slightly different syntax and semantics than a more general predicate dispatch system
17:57bbloomi saw that there is such a thing in the minikaren paper & that there is an impl on core.logic, but i'm not to that level of understanding yet :-)
17:57bbloomdnolen: also, relations make me want binary operators instead of prefix notation :-/
17:59clizzinhmm lein-pdo doesn't do what i want because the repl and app run as separate processes :( cc technomancy, brehaut fyi
17:59dnolenbbloom: you saw a predicate dispatch ref in the miniKanren paper? I don't recall that.
17:59bbloomdnolen: no, predicate logic
17:59bbloomdnolen: https://github.com/namin/leanTAP
17:59dnolenbbloom: oops, heh yes
17:59technomancyclizzin: oh yeah; hm. maybe start a repl, then do `lein run` using :eval-in :nrepl, but that requires using lein master
18:03cemerickBodil: anything to keep me out of the browser variation funhouse as much as possible :-)
18:17dnolenhopefully closing in on zero-overhead invocation for non-native IFn types http://github.com/clojure/clojurescript/commit/9e360428682659f8882ad0e9e0ba804f7a509d32
18:17dnolenfor CLJS
18:17ohpauleezdnolen: wooo!
18:17dnolenohpauleez: we can't fix generic code over course, code that accepts JS fns
18:18ohpauleezsure
18:18dnolenohpauleez: but it does mean if you know you're only going to use CLJS fns (which you can specify w/ the ^non-native type-hint), you won't pay.
18:18ohpauleezdnolen: This is really great stuff
18:21dnolenthis also means that deftypes / records that implement IFn could be significantly faster when using ClojureScript data structures as functions.
18:21dnolenif that's in place then more inference in the compiler could really pay off.
18:22nopromptare there any serious design flaws in clojure (looking for an honest answer, not trolling, etc)?
18:23ohpauleeznoprompt: with regards to what?
18:23brehautnoprompt: depends who you ask ;)
18:23brehautnoprompt: ask a haskell and scala guy, and they'll point to the lack of a static type system
18:23TimMcHuh, https://wiki.theory.org/YourLanguageSucks doesn't have a Clojure entry.
18:24brehautTimMc: php has quite a short list
18:24nopromptbrehaut: ohpauleez: i'm thinking in the context of our discussion on php
18:24TimMcnoprompt: Off the top of my head, macros that emit references to private vars in their namespace will cause compile errors.
18:25brehautquirky reloading behaviour for multis and protocols
18:25ohpauleeznoprompt: After seeing how CLJS was implemented (after the creation/addition of protocols), one might argue that Clojure's implementation could be "better"
18:25TimMcThere's some JVM-based shittiness around hashing of numeric types.
18:25brehautand anything multiple classloaders related
18:26bbloomohpauleez: agreed. we need protocols for the core abstractions on the JVM
18:26dnolenthere's lots to complain about Clojure - which as they saying goes - means people actually use it
18:26ohpauleeznoprompt: Exceptions are a mess and the community is still figuring out how to best tackle that. There are two types of naming for Clojure functions. Two words separated with a dash (Common Lisp style) and two words smashed together (Clojure/Python/Ruby style)
18:26bbloomnoprompt: they primitives (do, let, loop, recur, etc) should have been namespaced!
18:27ohpauleezif the function is found in common lisp, it uses a dash in Clojure, otherwise it doesn't
18:28bbloomohpauleez: *shrug* it took me a while, but i've finally gotten over extreme naming consistency, particularly for builtins and other things you use *a lot*
18:28ohpauleezAll of that said, Clojure (and especially CLJS) fix a lot of issues and inconsistencies with their platforms
18:28bbloomi disagree w/ paul graham about short names always being better, but for shit you use ALL THE TIME, i'm A-OK with it
18:28ohpauleezbbloom: Oh totally, I have no issue with it at all
18:28nopromptbbloom: of the same mind
18:28brehautrealized?
18:28brehaut,(realized? (iterate 1 inc))
18:28clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPending>
18:29TimMcnoprompt: You can try wading through very old tickets on JIRA if you want to find some more.
18:29bbloomi also kinda like how .javaismsMakeThemselvesKnown WithObvious. MarkingsOf/SORTS
18:29ohpauleezI don't care much about names - we all have auto-complete, we all have an interactive environment, docs are easy to get through
18:29nopromptohpauleez: +1
18:29TimMcI still don't use autocomplete with Clojure.
18:29TimMcI really should.
18:29bbloomthe different-ness makes me less likely to eliminate java-isms for the sake of eliminating java-isms. if they were closer, i'd be annoyed about that last 10% :-)
18:30bbloomi haven't used auto complete for *anything* in nearly 5 years
18:30ohpauleezTimMc: most certainly
18:30brehautbbloom: i agree with that
18:30ohpauleezbbloom: Not even ctrl-n?
18:30noprompti'm still in the "honeymoon" phase of using clojure so i haven't bumped in to some of these issues
18:31bbloomohpauleez: extremely rarely.... i only ever use it when i have mispelled something 4 times & i want to preemptively spell check myself
18:31ohpauleeznoprompt: There's a talk by Chas Emerick about "Clojure Sucks and why you'll love it anyway
18:31ohpauleez"
18:31ohpauleezbbloom: You're potentially a faster typer than me, and don't make as many spelling mistakes :)
18:32nopromptmy stress level is usually pretty low while using clojure, but if i'm going to have discussions with programmers about why X language has a bad design, in fairness i feel i should be able to point out clojure flaws as well
18:32bbloomohpauleez: i switched to vim full time roughly around the same time that i switched to mac roughly around the same time i switched to a kensis contoured keyboard roughly around the same time i learned to touch type roughly around the time i gave up on auto complete :-)
18:32noprompti've been using a plugin called "you complete me" for vim that has been very nice
18:33brehautnoprompt: amusingly, some of the flaws are in things that you just couldnt do in other languages
18:33amalloyi wonder if i could get my pen to tab-complete for the rare occasions i can't use a keyboard
18:33bbloomi find auto complete & other as-you-type UI/UX to be distracting. i'd much prefer all that stuff be delayed until i stop typing for a second or two
18:34TimMcOh, auto-complete vs. tab-complete... good point. The latter is good, the former sucks.
18:34ohpauleeznoprompt: I'm not sure who said it - but there's a quote, "Most languages focus on getting the smaller consistencies right - like function naming - and miss on tackling the larger, harder issues. Clojure focused on solving the larger, harder issues - like concurrency - and didn't favor naming consistency as much
18:34nopromptbbloom: the color scheme i use keeps that distraction at a minimum
18:35ohpauleezbbloom: I never do -as-I-type, I think it's super distracting too - but I use ctrl-n, ctrl-o
18:35nopromptbbloom: but i can see how it could get distracting
18:35nopromptohpauleez: i don't like having to hit more than one button at a time if i can avoid it
18:35brehautnoprompt: theres certainly nothing in clojure like wtf did python do to scoping rules :P
18:35nopromptohpauleez: which is why i've failed at emacs so many times
18:36noprompti'm jealous of emacs though
18:36nopromptwell, some parts of it anyway
18:36bbloomnoprompt: sometimes i wish i could disable syntax highlighting for the line i'm currently editing
18:36nopromptbrehaut: that's sort of what i was looking for
18:36bbloomb/c if i mistype a builtin or something & the syntax highlighting doesn't show up right, i fix the typo and then FORGET WHAT I WAS FUCKING TYPING
18:36nopromptbbloom: i think you might be able to do that
18:37bbloommy thought process is exceedingly fragile sometimes :-P
18:37nopromptbbloom: you may have to tweak the highlighting rule for cursorline which i *think* you can
18:38bbloomnoprompt: eh, i avoid VimL as much as i can :-P
18:38nopromptbbloom: yes it's disgusting
18:38bbloomi just assume tpope knows what's best for me
18:38nopromptbbloom: still working on it https://github.com/noprompt/lite-brite/blob/master/colors/lite-brite.vim
18:41nopromptbbloom: this should do it :hi CursorLine guibg=NONE guifg=#ffffff
18:41nopromptthen use :set cursorline
18:42nopromptobviously if you use vim in the terminal you'll need need to set ctermfg and ctermbg respectively
18:42bbloomnoprompt: you assume i use a dark terminal :-P i don't heh
18:42nopromptbbloom: sure, that's just the basic idea
18:42bbloomnoprompt: i know, thx
18:42nopromptbbloom: do you know your terminal bg color?
18:42bbloomwhite.
18:42bbloom:-P
18:43nopromptbbloom: well that one's easy then!
18:43noprompt:hi CursorLine ctermbg=15 ctermfg=0
18:43nopromptyou could toss that in your .vimrc should work out if you don't switch your theme
18:44bbloomthx i'll try it out a bit later
18:44nopromptbbloom: i like to think i know a bit about color scheming in vim :)
18:45nopromptdoug crock ford had a neat concept about context sensitive highlighting
18:45nopromptscoped highlighting
18:45nopromptnot sure how you could pull that off in vim though
18:47nopromptbbloom: do you use vimclojure?
18:47bbloomno, tpope/vim-foreplay
18:48nopromptdoes that one let you start a repl inside vim?
18:49bbloomnoprompt: it lets you evaluate forms & stores an evaluation log a-la the macro log, but there is no terminal emulation or anything like that
18:49nopromptdarn
18:49bbloomnoprompt: nah, i prefer it this way
18:50bbloomcmd+tab lets me get to a real repl running in the same JVM anyway
18:50nopromptmaybe i'll give it another shot
18:50noprompti really like vimclojure but there are a few things that annoy me about it
18:50nopromptthe biggest one being the way it seems to fuck up copy/paste
18:51ivanhttp://userscripts.org/scripts/review/108797 javadoc sanity restored
18:52nopromptwhat's the doc style for clojure?
18:54RaynesTwo quotes and text between them.
18:55nopromptRaynes: nice :)
18:55bbloom"This is a string that is useful and not redundant and doesn't treat me like a 5 year old, but still helps me in a meaningful way"
18:56nopromptso clojure doesn't have a javadoc equivalent?
18:56nopromptor yardoc or whatever
18:56bbloom##(doc doc)
18:56lazybot⇒ "Macro ([s]); "
18:56technomancynoprompt: you can generate HTML documentation, but it's not nearly as useful
18:56bbloom(doc doc)
18:56clojurebot"([name]); Prints documentation for a var or special form given its name"
18:57bbloom(doc source)
18:57technomancysince you have everything available in the repl
18:57Rayneshttps://github.com/weavejester/codox, https://github.com/tomfaulhaber/autodoc, https://github.com/fogus/marginalia
18:57bbloom(doc source) ; i said dammti!
18:57Raynes&(doc clojure.repl/doc)
18:57lazybot⇒ "Macro ([name]); Prints documentation for a var or special form given its name"
18:57Raynesbbloom: lrn2clj
18:57hiredman,source
18:57clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.repl/source, compiling:(NO_SOURCE_PATH:0:0)>
18:57hiredman,(doc source)
18:57clojurebot"([n]); Prints the source code for the given symbol, if it can find it. This requires that the symbol resolve to a Var defined in a namespace for which the .clj is in the classpath. Example: (source filter)"
18:57bbloomRaynes: i can't read or write
18:57hiredmanhmmm
18:58Raynesbbloom: I can teach you.
19:00nopromptmarginalia looks nice
19:03TimMctechnomancy: (doc ...) is useful if you already know what you want.
19:03TimMcHTML docs are good for getting an overview.
19:03bbloomTimMc: overviews are good for overviews
19:04bbloomTimMc: by that i mean prose & exposition
19:04bbloomTimMc: if you need a reference, use doc or look at the source :-)
19:04amalloybbloom: your (doc source) attempts were failing because you had inserted a U+007F character before the ( character
19:04bbloomamalloy: how the hell did i do that?
19:04amalloy*shrug*
19:04bbloomthat's what? a delete?
19:05amalloyyes
19:05bbloom(doc inc)
19:05clojurebot"([x]); Returns a number one greater than num. Does not auto-promote longs, will throw on overflow. See also: inc'"
19:05bbloom(doc inc)
19:05clojurebot"([x]); Returns a number one greater than num. Does not auto-promote longs, will throw on overflow. See also: inc'"
19:05bbloom(doc inc)
19:05clojurebot"([x]); Returns a number one greater than num. Does not auto-promote longs, will throw on overflow. See also: inc'"
19:05bbloomyeah, i can't repro that
19:06muhoohttp://clojure-doc.org/ is 504?
19:06SegFaultAXmuhoo: clojuredocs.org?
19:07SegFaultAXclojure-doc.org works for me. http://www.downforeveryoneorjustme.com/clojure-doc.org
19:15nopromptanyone going to clojure west?
19:15patchworkAlright, for json: cheshire or data.json?
19:16bbloomnoprompt: lots of smart folks! sign up
19:16technomancycheshire
19:16patchworkpros/cons?
19:16nopromptpatchwork: i like data.json
19:16nopromptpatchwork: but haven't used the other
19:16brehautpatchwork: from memory cheshire is really fast
19:16technomancycheshire uses jackson, which has seen a lot more use. plus its maintainer is super-responsive
19:16technomancyand you don't have to use jira to contribute
19:16nopromptbbloom: went to w3conf last week. it was fun, but not exactly mind expanding.
19:17patchworkI definitely need speed, thanks guys! Cheshire it is
19:17nopromptbbloom: clojure west looks like the ticket.
19:17bbloomnoprompt: i'm not much of a conference or meetups sort of guy, but everyone i meet involved with clojure is awesome
19:17bbloomi'm speaking at clojure/west too :-)
19:17FrozenlockWould `(into #{} ...) be the idiomatic way of getting a coll without duplicates?
19:17nopromptbbloom: in that case i'm sold, ha!
19:17bbloomFrozenlock: ##(set [1 1 2 3 3])
19:17lazybot⇒ #{1 2 3}
19:17brehaut,(distinct [1 1 2 3 4 4)
19:17clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
19:18brehaut,(distinct [1 1 2 3 4 4])
19:18clojurebot(1 2 3 4)
19:18bbloomhowever:
19:18bbloom,(distinct [1 2 1 2])
19:18clojurebot(1 2)
19:18bbloomoh nevermind
19:18bbloomset vs seq
19:18bbloomi thought distinct only worked on sorted data, my bad
19:18brehautFrozenlock: it depends if you need the resulting collection to hang about and have more potential duplicates added to it
19:20FrozenlockAh! Can't believe I forgot about `distinct'.
19:20FrozenlockNo this should be created and used as is.
19:20FrozenlockHowever if I use a set, I could reduce it...
19:21brehautFrozenlock, bbloom: distinct uses a set underneath, so i guess only use distinct if you need to maintain ordering or handle an infinite stream?
19:21bbloombrehaut: well, if it's an infinite stream, you better hope it's elements are of a finite domain :-)
19:22brehautbbloom: indeed :)
19:22bbloomi use sets a lot in clojure
19:22bbloomi quite like them
19:22brehautlikewise; sets are great to have
19:23brehauti was always surprised it took dotnet so long to get a real set collection
19:24rabbit_airstrikeAs a Portland resident, I'm looking forward to clojure/west :)
19:24bbloombrehaut: i just checked MSDN. holy hell! 4.0? for ISet? seriously!? wow
19:24brehauti know! bananas eh
19:25bbloombrehaut: well apparently HashSet<T> was in 3.5
19:25brehautthats really not much better
19:26bbloombrehaut: oh, you know why.... IList has a Contains function
19:26bbloomthere was like UniqueList or something that was really a set
19:26brehautbbloom: roffles
19:27brehautbbloom: and everyone else just faked it with a map<T,Bool>
19:27bbloomyeah, interfaces are vastly inferior compared to type classes aka protocols aka golang interfaces aka ad hoc polymorphism aka not broken abstraction model
19:27brehautdefinately
19:28bbloomi really like the idea that the fundamental defition of a collection is reducibility, instead of traversability
19:28brehautim a bit torn about whether i prefer typeclasses or protocols. the former is way more expressive, but it lets some really squirrel resolution occur
19:28bbloombrehaut: more expressive in what way?
19:29bbloom(side note: i have written more ReadOnlyCollection wrappers than I care to admit)
19:29brehautbbloom: haskell lets you write some remarkably complex abstract types for typeclasses; two abstract types with different implementations of the same typeclass can exist for the same concrete type
19:30bbloombrehaut: oh yeah, but that's pretty much just delegation. you can write a macro to do that :-P
19:32brehautbbloom: oh sure, you can fake it out (pretty much like typeclasses do anyway) but the fundamental restriction of protocols to act on a single type (that isnt abstracted over other types) makes it much easier to reason about
19:34brehaut(where 'fake' wrt it comes to macros is not really that fake)
19:55tyler_foo is to function as (foo) is to what?
19:55bbloomtyler_: a function invocation
19:55bbloomtyler_: or a "call site"
19:55tyler_bbloom: thnx
19:55bbloomtyler_: or "function application"
19:56tyler_i like functional application
19:56tyler_kinda rolls off the tongue
19:56tyler_s/functional/function/
19:56bbloomusage of those terms tends to vary on context & connotation
19:57Oddmancall site reminds me of call centers
19:58brehautbbloom: ive not heard call site used outside of talking about language implementations.
19:59bbloombrehaut: *shrug* "call site" is useful for explicitly differentiating from declaration sites :-)
19:59brehautsure. i was just curious if it was more general than i realised
20:00dnolenhrm
20:00dnolenI take it most CLJS users find it convenient that CLJS fns are regular JS fns \cc ibdknox
20:01bbloomdnolen: as opposed to objects with an invoke method?
20:01dnolenbbloom: yeah
20:02dnolenbbloom: I think any optimization I might have in mind are foiled by RestFns
20:02bbloomdnolen: it's definitely convenient to be able to pass a function to 3rd party code without having to marshall it
20:02nopromptdnolen: yes i like that
20:02bbloomdnolen: basically any code that hooks dom events is gonna be in that boat
20:02dnolenbbloom: yep
20:03dnolenso I'm not sure if we can actually optimize CLJS fns because of the rest argument case
20:03nopromptdnolen: my biggest gripe is (array) vs [] (js-obj) vs {}, however it's not a that big of a deal
20:04nopromptdnolen: i'm sure that design is intentional and with good reason
20:04noprompti have no problem using clj->js
20:04bbloomnoprompt: javascript arrays and objects are mutable, clojurescript vectors and maps are not
20:04dnolennoprompt: by design
20:04hiredmandnolen: can't you do something like what AFn does?
20:05hiredmanmaybe you already do, I am not up to date
20:06nopromptthe cljs code tends to look a little awkward with things like angularjs
20:06dnolenhiredman: yeah we could could build a proper AFn/IFn/RestFn type/protocol, which is what I had in mind. The problem is you can't pass that to JS libs.
20:06nopromptin a way i feel like that's what stateful code actually looks like - ugly
20:06hiredmangenerate a generic function that dispatches to function$arity and for known native cljs functions call function$arity directly?
20:07dnolenhiredman: yeah we already do something like that, the issue is in the case of (reduce f ...)
20:07dnolenwe don't know if f is native or not
20:07dnolenso we can't optimize it
20:07dnolenassume we know it's *not* native
20:08dnolenwe still don't know if it's rest fn or not
20:08dnolenwe could provide a RestFn type but then, RestFns can't interop w/ JS
20:09hiredmanhmmm
20:10hiredmanand you cannot cover every possible arity there hmmm
20:10dnolenhiredman: yeah
20:10dnolenit really boils down to interop w/ JS. If we tossed that out, we could do this easily w/ prototypal inheritance to avoid code explosion.
20:12ibdknoxdnolen: I'd have to think about it, but my suspicion is that such a change would kill virtually all the code that is out there right now. haha
20:12dnolenibdknox: haha
20:12bbloomdnolen: i dunno much about RestFn in Clojure
20:12dnolenibdknox: yeah
20:16ibdknoxdnolen: how big of a difference do you think it would really make?
20:16bbloomdnolen: are all usages of `arguments` inherently slow?
20:16Raynesibdknox: I was complaining about you earlier.
20:16ibdknoxRaynes: sounds legit. :p
20:18ibdknoxRaynes: what's up?
20:18Raynesibdknox: You named some functions in noir's validation library with question marks at the end but they didn't return booleans.
20:18RaynesI personally think you're the devil.
20:18ibdknoxah
20:19ibdknoxlol
20:19ibdknoxdoes everyone do that?
20:19bbloomi don't think i've ever succeeded in using `some without first trying `some?
20:21dnolenbbloom: arguments is slow, ~1.5-2X hit depending on engine
20:22dnolenibdknox: probably ~1.5-2X depending on engine? My spidey sense says the current situtation affects inlining
20:23bbloomdnolen: so you want dispatch to always go to the arity-named overload, which you think prototypical inheritence can help you by simulating AFn's invoke overloads and subclasses?
20:24dnolenbbloom: yes go directly in the case of ^not-native - no testing
20:24dnolenbbloom: non rest-fns are easy arity to dispatch is clear - only rest fns are tricky
20:25hiredmanobviously the answer is to make clojurescript a lisp-3, one namespace for clojurescript functions, one for clojurescript values, and one for javascript
20:25dnolenhiredman: heh
20:26bbloomdnolen: so RestFn has one subclass that is never instantiated (from what i can tell)
20:27bbloomand RestFn is only ever instantiated by WithMeta
20:27bbloomwithMeta, rather
20:27bbloomoh, and by the 'list function in core
20:28bbloomeither way, i don't think the concrete type is strictly necessary.... so what exactly do you need them for?
20:28dnolenibdknox: to be honest this change probaby won't make a big difference to most code - mostly core.cljs implementation and few places in codebases where perf is critical (cljs.reader, core.logic, stuff like that)
20:29dnolenbbloom: to avoid code duplication.
20:29bbloomdnolen: existing duplication? or new duplication to be introduced by an optimization?
20:29dnolenbbloom: to avoid duplication if we introduced the optimization.
20:30amalloy&(instance? clojure.lang.RestFn swap!)
20:30lazybot⇒ true
20:30amalloybbloom: any function that accepts varargs is a RestFn
20:30bbloomamalloy: hm, interesting... i can't tell where that happens... maybe in the generated byte code by the compiler?
20:30amalloyyes, i think so
20:31bbloomaahhh, yes ok, i see now
20:31bbloomit's used via getType at some point
20:31bbloomthanks
20:31bbloomi thought it was just a helper class for the sake of Java code
20:31dnolenhrm, I wonder if we could detect interop and auto-marshal CLJS fns?
20:32dnolenwe could taint js/foo and external libs ...
20:32bbloomdnolen: i thought that too, but you can't b/c you would need full type inference
20:32bbloom(defn foo [x] (js/bar x))
20:32bbloomyou'd need to marshall all args
20:33frenchypin clojure.java.jdbc, when using connection pooling, am i supposed to use (sql/with-connection (db/db-connection) ..)?
20:33frenchypand in that case , is the connection returned to the pool or actually closed ?
20:33dnolenbbloom: but it's obvious there that we need to wrap x
20:33hiredmanfrenchyp: clojure.java.jdbc doesn't have connection pooling
20:33bbloomdnolen: what if x is a number?
20:34bbloomdnolen: or a string?
20:34dnolenbbloom: do what cljs.core._truth does, test it
20:34frenchyphiredman: I am referring to http://clojure.github.com/java.jdbc/doc/clojure/java/jdbc/ConnectionPooling.html
20:34hiredmanfrenchyp: if you use something like c3p0 then you connect to c3p0 just like you connect to a database
20:34dnolenbbloom: it's a CLJS fn, wrap it
20:34bbloomdnolen: then you're paying a test cost for every arg for interop calls
20:34bbloomand you need interop to perform well
20:34bbloomso there can't be any calling over head
20:35bbloomalso, how are you going to call functions in clojurescript returned from javascript?
20:35dnolenbbloom: CLJS fns pass to JS are already slow if multiple arity or variadic
20:35bbloomyeah, but you're going to break or slow interop for all other cases by adding arg tests
20:35frenchyphiredman: k thanks
20:37dnolenbbloom: arg tests happen once, you pay for exactly one property lookup
20:37dnolenper arg
20:38dnolenbbloom: not saying we should do this, but probably worth investigating in a branch, w/ interop benchmarks
20:40dnolenbbloom: hrm but you are right. the inference sounds complicated.
20:41dnolenif not impossible :)
20:44bbloomdnolen: :-)
20:44bbloomgotta run
21:19dog_cat11why does lein sometimes go into "repley.eval-mode.nreple" ns instead of the project my pwd is in?
21:23nopromptdnolen: is there another way to do property access in cljs aside from (.-prop o)
21:25ivanhttp://blog.headius.com/2012/11/refining-ruby.html Ruby gets an insane version of protocols?
21:26alandipertnoprompt: (aget o "prop")
21:26nopromptalandipert: ah, thanks
21:27nopromptjust what i was looking for
21:27dog_cat11nvm, it was because of an error compiling one of my files
21:32dnolennoprompt: but note that's really only for interop
21:35nopromptdnolen: i'm trying to eliminate some duplication in my angularjs code and (set! (.-prop $scope) …) is becoming a bit unweildy
21:37nopromptdnolen: if you need to set several properties at once is there a better route to go?
21:37dnolennoprompt: I don't know angular.js so I can't provide much insight. Don't forget a lot tedious boilerplate can often be eliminated via a simple macro.
21:37amalloynoprompt: so figure out what's being unnecessarily repeated, and write a macro that does the unnecessary parts for you
21:43nopromptdnolen: amalloy: good call, i haven't ventured in cljs macros
21:45dnolennoprompt: sadly it's a bit tricky if you're not used to macros in CLJ, but if you've got that under you belt - it's pretty convenient
21:45noprompti'm thinking i may need to use anamorphic macros
21:45nopromptyeah i love macros in clj
21:46noprompti've never written anamorphic ones, so i was trying to avoid doing that
21:46noprompteven though i think in the case of angulajs it might make sense
21:47nopromptdnolen: what should i watch out for with cljs?
21:48dnolennoprompt: heh, lots of stuff. but keep asking questions here and on Clojure/ClojureScript mailing list and you should be OK.
21:48nopromptsure thing :)
21:48dnolennoprompt: O'Reilly book looked pretty as well - though lein-cljsbuild info may be out of date now.
21:48dnolenpretty good I mean
21:49aibis there a version of case which works with non-compile-time literals, e.g. a static field?
21:49dnolenaib: no
21:49nopromptdnolen: yeah i've got that one, but i'm thinking i may sign up for the cljs class at clojure west to round out everything
21:49dnolennoprompt: yeah that'll be good. Relevance is doing a lot of CLJS it sounds like.
21:53piranhaalandipert: are you by any chance here? :)
21:53alandipertpiranha: of course dude
21:54nopromptdnolen: oh man, i think i should have been considering macros a little sooner. just cleaned up several lines.
21:54dnolennoprompt: it's pretty slick :)
21:54alandipertnoprompt: only one little expression in your program needs to not be a macro so it will run, otherwise you can write all macros and it rules :-)
21:55piranhaalandipert: haha, cool. :) I have a code like this: http://paste.in.ua/8055/ - and log is not executed on swap! - what is wrong here?
21:55dnolennoprompt: imagine my excited when I realized core.match could work in ClojureScript by changing 10 lines of code.
21:55dnolenexcitement
21:56dnolenthe bits of tools.macro I've tried also works just fine w/ CLJS which is pretty cool.
21:56alandipertpiranha: hm. advanced mode compile?
21:57piranhaalandipert: nope, I'll post my project.clj, just a second
21:57nopromptit's probably over my head at this point, but i'd love to get an understanding of how the macros are compiled to js
21:57alandipertpiranha: cool. i take it the log on line 9 prints the right thing?
21:57piranhait does
21:57piranhaalandipert: if you want, I can put whole code on github, so you can see it yourself
21:58dnolennoprompt: it's not very complicated. Macro just get expanded until there's nothing left to do, then that code is passed to the compiler.
21:58alandipertpiranha: i can run it here myself no problem, 1 sec
21:58piranhaalandipert: it actually prints stuff first time as well, when I create a new cell, but not on swap!
21:58dnolennoprompt: pretty much how it works on Clojure JVM
22:00nopromptdnolen: that's fascinating. it just seems like something so powerful would be more complex.
22:00alandipertpiranha: so, you need to quote the map :-)
22:00alandipertpiranha: if you don't, it gets "lifted" to a formula
22:00piranhaalandipert: ah!
22:00dnolennoprompt: beauty of lisp!
22:00nopromptdnolen: i'll say.
22:00piranhaalandipert: I was wondering why do you quote a map in your code, but forgot to ask and then forgot to quote myself
22:01dnolennoprompt: while a lot of the macros in CLJS are complex and ugly, I fear how nasty the compiler would be w/o them.
22:01piranhaalandipert: maybe it should be mentioned in readme somehow :)
22:01alandipertpiranha: yeah, otherwise it turns into the formula of (cell (hash-map x y etc..))
22:01alandipertpiranha: it is but it's not very prominent
22:01brehautout of curiosity is there a fixed point combinator in clojure ?
22:01dnolennoprompt: actual CLJS compiler is still less < 1000 lines of code.
22:01piranhaalandipert: yeah, I just searched and it's hard to grasp :)
22:01brehaut(not Y )
22:02alandipertpiranha: i'll add a map example to the Input Cell section since that's pretty common
22:02amalloybrehaut: none built in, but of course you can write it
22:03nopromptdnolen: really? that's incredible. i mean a 1000 lines of lisp is nothing to sneeze at, but wow.
22:03piranhaalandipert: thanks :)
22:03nopromptdnolen: never would have guessed. i need to take a look at it. compilers are neat.
22:03dnolennoprompt: yep, ~1000 lines of analyzer, ~1000 lines of compiler, ~1000 lines of macros
22:04nopromptdnolen: so wait, core.match, what's that for again?
22:04piranhaalandipert: hm, I quoted it and still no luck: (cell (.log js/console (clj->js 'world))) - or should I quote whole expression?
22:04dnolennoprompt: pattern matching a la Racket, OCaml, Haskell, Scala
22:04alandipertpiranha: (def world (cell '{:stuff :test}))
22:04piranhaah %)
22:04piranhaalandipert: thanks, it works! :)
22:05nopromptdnolen: ok, now i'm really excited.
22:05alandipertpiranha: sweeeet
22:05alandipert!
22:05nopromptwhy i never used irc in the passed...
22:05noprompts/passed/past
22:06Frozenlocknoprompt: IRC is a forgotten gem
22:06nopromptthis room alone has been like a knowledge christmas.
22:07nopromptdnolen: thanks for all the info!
22:07dnolennoprompt: np
22:07noprompt*giddy*
22:16alandipertpiranha: added a couple more examples: https://github.com/tailrecursion/javelin/blob/master/README.md#input-cells-and-formula-cells
22:18piranhaalandipert: thanks!
22:19piranhaah, makes sense :)
22:28nopromptdnolen: so macro expansion for cljs happens at compile time?
22:28noprompts/so/does
22:29dnolennoprompt: yes, only compile time macros, no runtime macros
22:29dnolenfor now
22:30nopromptso cool
22:30nopromptwell, that's it for me today. gotta run.
22:31nopromptthanks everyone!
22:31alandipertthat dude was cool
22:50dcolishif i have two functions which are of pretty much the same form, like these https://gist.github.com/dcolish/5044900, is that the point where a macro might make sense?
22:52xeqianyone submitting to lambdajam? http://lambdajam.com/cfp/
22:53RaynesWhere do I have to jam the lambda?
22:53amalloydcolish: that looks like just a reduce
22:53alandipertdcolish: i'd probably pass in a function representing the difference. for me anyway, not macro-level yet
22:54xeqiRaynes: in a bot
22:54RaynesSounds painful, xeqi.
22:54dcolishamalloy: could you elaborate? i dont quite follow
22:54alandipertdcolish: +1 what amalloy said, and your reduce function is what's different between them
22:55amalloybusy atm. someone elaborate for me
22:55dcolishi mean i know what a reduce does, i just dont see how it is an example of one
22:55dcolishkk
22:56Rayneslol
22:56dcolishhmm, maybe i'm thinking of reduce in a completely different way
22:57alandipertdcolish: https://www.refheap.com/paste/11862
22:57alandipertdcolish: untested but i'm guessing that's what amalloy has in mind?
22:58dnolenhm
22:59dnolenI think I may have a solution to at least optimizing non-variadic ClojureScript fns
22:59dnolen^not-native + -invoke
23:04piranhaalandipert: how do I merge one cell into another? :) (cell (swap! world assoc-in [:form] form-cell)) complains :)
23:06alandipertpiranha: (cell (assoc-in world [:form] form-cell)) should do it
23:06alandipertpiranha: formula cell of the merge
23:06piranhaoh, ok
23:07alandipertpiranha: you should really only ever swap input cells
23:07piranhaalandipert: well, idea is that 'world' is an input cell...
23:07alandipertpiranha: i see, hm
23:08piranhaand form is a cell I get from a form inputs, and I wanted to put everything in world back
23:08alandipertpiranha: well, you could do (swap! world assoc-in [:form] @form-cell) of course, but then you leave FRP land
23:08piranhaindeed!
23:08piranhaand it won't update on form-cell changes :)
23:08piranhawhich is what I want, of course :)
23:09alandipertpiranha: maybe what's updating form-cell should actually be updating world?
23:09piranhawell... this means I should pass world inside of something instead of returning a cell from a form
23:09piranhaand returning a cell with values seems to be more natural to me, honestly - this way form has no idea how data is used
23:10piranhait just returns data and doesn't care what's next
23:10octagonhallo
23:10alandipertpiranha: octagon is micha and collaborator in FRP heresy
23:10piranhaalandipert: (cell (assoc-in world [:form] formC)) doesn't seem to be working
23:10piranhaah cool :)
23:12alandipertpiranha: perhaps you could paste codes?
23:12piranhaI could, but it's a bit dirty :)) anyway, just a second
23:15piranhaalandipert: here is the initialization: https://github.com/piranha/pairword/blob/master/src/pairwords/game.cljs#L18
23:16piranhaand here are templates: https://github.com/piranha/pairword/blob/master/src/pairwords/tempjave.cljs#L24
23:17alandipertpiranha: reading, thanks
23:17piranhaI'm sorry for the amount of commented code there, it's just for a friend who is tracking loosely what's going on there
23:18octagonpiranha: have you seen this: https://github.com/lynaghk/todoFRP/blob/master/todo/hlisp-javelin/src/include/index.cljs
23:18alandipertoctagon: i tried to indoctrinate him already
23:20piranhaoctagon: yeah, but I'm wary of do='' notation in html files, to be honest :)
23:20piranhait's a bit similar to onclick and knockout.js, and I don't like both of them :))
23:20octagonpiranha: yeah that may not be what you want, but the thing i linked is the FRP underpinnings
23:21octagonpiranha: the structure is the base "world" cell, and then there are a number of functions that mutate that
23:21alandipertpiranha: so world is kind of a dependency of form? maybe it makes sense to arrange them that way
23:22octagonpiranha: the state mutating functions are called when the user manipulates the interface, meaning lick on something, submit a form, etc
23:22alandipertpiranha: where world is a formula cell backed by n form cells
23:22octagons/lick/click/
23:23octagonpiranha: the main idea there being that DOM elements are I/O devices only; no data is stored there
23:23piranhaalandipert: hmm... maybe I just should not join them, in the end - I just liked the idea of having big hashmap with whole world inside of it, i.e. all the data I have
23:24alandipertpiranha: that's definitely the way to do it i think
23:24piranhaand then on click somebody just moves data around inside of this world, not touching other pieces of data
23:24alandipertpiranha: and a set of functions to transition the world from one state to the next, when events happen
23:24piranhaaha... but I could have form and world in separate cells
23:24alandipertpiranha: and then a bunch of event-agnostic IO formulas that effect DOM stuff when the world value changes
23:25piranhaindeed, but then how do I get values from form into my world without my form knowing full path? :)
23:25piranhaI could pass world and partial path, of course, but that seems a bit backwards
23:25octagonpiranha: i think it's useful to have cells backing form elements, so you don't have to store data in the dom form
23:26piranhaoctagon: well I do have it :)
23:26piranhait's :form in my world
23:26piranhabut then I want to merge form data back into world
23:26piranhaI could, of course, pass a world, but this seems like passing a pointer to structure in C
23:27piranhaif I understand correctly, the hard thing here is to determine in cell macro who is dependency here?
23:29octagonpiranha: is line 56 the one you're referring to? in game.cljs
23:29piranhaoctagon: sorry, that part of code is not used right now - it's from days of flapjax :)
23:29piranhaoctagon: the only function used is init-jave, line 18
23:30octagonah ok
23:30piranhaI should've removed all the useless stuff :\
23:30alandipertpiranha: did you check out input-to in dom.cljs? i avoid an intermediate cell with it
23:30piranhaoctagon: line 24 passes data to form
23:30piranhaalandipert: aha, I'm using it to populate form cell :)
23:30alandipertpiranha: aim it at world and your troubles are over
23:30alandipert;-)
23:31rabbit_airstrikeworking through 4clojure to brush up on some stuff, and it occurred to me that these interactive "learn through exercise" sites could be a bit more tree-structured
23:31rabbit_airstrikeadd user options to queue exercises in a breadth-first or depth-first search
23:32alandipertpiranha: what you're trying to do reminds me of how one might use switchE in f.j.
23:32piranhaalandipert: indeed! but then my form processor will know path of data in world cell. For a small app like this it's not a problem, really, and I could do that, but I'm just trying to get structure properly (at least that's how I see it, which could be wrong, of course)
23:32alandipertpiranha: where you can make things that are backed by either B.changes or E's... but we don't really have that in javelin
23:33piranhathat's true...
23:33piranhabut conceptually feeding data from one cell to another doesn't seem wrong to me
23:33alandipertpiranha: it's the way to go, the problem is just the direction you're going
23:34octagonpiranha: line 27 looks like it should work. what does line 28 show in the console log when you run it?
23:34alandipertpiranha: intermediate input cells that are event targets can't really be composed with other formula cells
23:34piranhaoctagon: it shows that formC is updated
23:35piranhaoctagon: so if I put anything in input, this log is executed, but then log on line 22 is not...
23:35piranhaalandipert: and if I want to feed data from one cell to another, this another cell becomes a formula cell?
23:36octagonpiranha: this is interesting, i have to think about this
23:36Rayneslein midje
23:36RaynesDamn it.
23:36alandipertpiranha: right, that's the (current) definition of a formula cell
23:37octagonpiranha: have you tried something like (cell (#(assoc-in world [:form] %) formC))?
23:37piranhahm, not yet, one moment
23:37octagonpiranha: no, that's nonsense, sorry
23:38piranhaoctagon: maybe (cell (#(swap! world assoc-in [:form] %) formC))?
23:38octagonpiranha: (cell (#(swap! world update-in [:form] %) formC))
23:38octagonindeed
23:38piranha:)
23:38piranhait works! :)
23:38piranhahooray!
23:39octagonpiranha: so what was happening there i think was that when you have a formula cell
23:39piranhaso indeed, if I mask world behind function, it has no problem determining what to do
23:39octagonpiranha: the arguments are "unboxed"
23:39piranhaaha
23:39octagonlike if they're cells they get derefed
23:39octagonso the function never sees the actual cell
23:39piranhaand so the cell is not updated
23:39octagonjust the contents
23:39piranhasure
23:39piranhamakes sense
23:40piranhait's the same as with quotation of hashmap, when you give it to cell
23:40piranhafor cell to see whole thing it should be a 'primitive', so to say
23:40piranhaoctagon: alandipert: thanks! :)
23:40octagonyes, that was a tradeoff, we convert {:foo "bar"} to (hash-map :foo "bar") and then lift that
23:41piranhathat's not a problem once one understands the concept
23:45octagonpiranha: it might be interesting to try (cell (swap! '(cell world) update-in [:form] formC))
23:45piranhaone moment
23:46alandipertoctagon: wouldn't just 'world do the trick there?
23:46piranhaoctagon: it works
23:46piranhaalandipert: one moment
23:47piranhaalandipert: Uncaught Error: No protocol method IWatchable.-notify-watches defined for type object: {:state :entering-players, :players []}
23:47alandipertah ok
23:47octagonalandipert: well it will deref world then, which we don't want
23:47piranhawhat's better then, '(cell world), or an anonymous function?
23:48octagonpiranha: does '(cell world) work?
23:48piranhaoctagon: it does :)
23:48octagonpiranha: sweet! i like that one :)
23:48piranhaok :)
23:48alandipertoctagon: cleaner than cfn imo
23:49octagonpiranha: wrapping in anon fn means that none of the things in the fn can be reactive
23:49dog_cat11~({:a 1} :a)
23:49clojurebotOne idea I had was to parameterise Keyword with the key it looks up. :a is of (Keyword :a). But that has other issues.
23:49dog_cat11?({:a 1} :a)
23:49octagonlike in the '(cell world) case, update-in could be a reactive thing too, or :form
23:49alandipert&123
23:49lazybot⇒ 123
23:49dog_cat11&({:a 1} :a)
23:49lazybot⇒ 1
23:49piranhaoctagon: aha, I see
23:50AtKaaZ,(partial Integer/parseInt "1")
23:50clojurebot#<CompilerException java.lang.RuntimeException: Unable to find static field: parseInt in class java.lang.Integer, compiling:(NO_SOURCE_PATH:0:0)>
23:50AtKaaZany other way? except anon functions
23:50dog_cat11&(do (def h2 {"a" 1 "b" 2})(let[{:keys[a b]} h2] b))
23:50lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
23:50dog_cat11wtf
23:50dog_cat11is there anyway to use destructing on hashes with string keys?
23:50AtKaaZ:strs ?
23:51dnolenoptimization is not as broad as I would like but it does seems to jive well with protocols since they don't support the variadic case either - http://github.com/clojure/clojurescript/commit/a84c8aca59205bc6aa809cbb9996034c6f0de188
23:51alandipert&(let [{:strs [foo]} {"foo" 123}] foo)
23:51lazybot⇒ 123
23:51AtKaaZwhy is partial not supporting java interop functions?
23:52alandipertAtKaaZ: java methods are not clj functions
23:52dog_cat11thanks alandipert
23:52AtKaaZalandipert: ok that makes sense
23:53alandipertoctagon: have you done any reactive-stuff-in-op-position yet?
23:53octagonalandipert: only just to check that it works, so far
23:53alandipertoctagon: same, feels like real ultimate power tho
23:54alandipertoctagon: like have a cycling fn
23:56octagonalandipert: thing-looper is the only case so far, that i can think of where i actually use that
23:56octagonbut that's more of a curried function, i guess