2014-09-04
| 00:39 | ben_vulpes | i have isolated and reproduced my multipart upload nightmare! |
| 00:39 | ben_vulpes | https://github.com/survantjames/crazy_clojure_deps |
| 00:40 | ben_vulpes | xeqi: ping: i think there's some kind of conflict with kerodon and clj-http |
| 00:40 | ben_vulpes | the resolution of which is way over my head |
| 00:41 | ben_vulpes | dakrone: ping see above |
| 00:41 | ben_vulpes | i have also spammed both of your issue pages on github |
| 00:42 | ben_vulpes | and now i am clocking out as the babe has just finished the last episode of voyager and must now mourn. ttyl! |
| 00:45 | joobus | is there a functional difference between these two: (def asdf {}) and (def asdf (ref {})) |
| 00:47 | joobus | they seem to behave the same when doing key lookups... |
| 00:48 | joobus | and I assumed a {} was just a reference to begin with |
| 00:48 | arrdem | http://grimoire.arrdem.com/1.6.0/clojure.core/ref |
| 00:48 | arrdem | http://clojure.org/refs |
| 00:48 | arrdem | google is your friend |
| 00:49 | arrdem | {} is defined to be a literal map why would it be a ref |
| 00:55 | technomancy | google is your foe |
| 00:55 | technomancy | always trying to steal your private information and trick you into using G+ |
| 00:59 | Jaood | annoying as hell on android by default, you take a photo and you get something like "your photos are ready to be shared on G+" |
| 01:01 | arrdem | yeah... turned that one off right quick |
| 01:02 | joobus | re: google, found this yesterday https://imgur.com/wbjCmbt |
| 01:04 | arrdem | shrug. it's their business model, and US data ownership / "privacy" laws allow it. I don't think it's right but I'm not gonna fault them for it either. |
| 01:05 | joobus | thanks for the help tonight arrdem, night guys |
| 02:40 | huy | hi |
| 02:41 | jkj | morning |
| 02:41 | jkj | spooky..... lein with-profile uberjar does AOT but lein compile does not |
| 02:41 | jkj | should it work like that |
| 02:41 | jkj | it's just thatthe aot-compiled class is needed by the rest of the code |
| 02:53 | jkj | wonder if :dev profile skips aot or something |
| 02:58 | jkj | lein with-profile -base compile ... aot works |
| 03:41 | sm0ke | for leiningen how do i specify a merge policy for conflicting files while creating uberjar? |
| 03:41 | borkdude | jackjames I switched over to emacs-prelude now. It works ok so far. One question I have is, in emacs-live C-space space selected succeeding sexprs, but in the emacs-prelude defaults, it selects only one sexp. Do you know what to change perhaps? |
| 03:57 | sm0ke | :uberjar-merge-with seems relevant |
| 05:06 | reduced | Hi |
| 05:07 | reduced | https://gist.github.com/anonymous/59ce0b0b001252d524a1 |
| 05:07 | reduced | (for [v val1] |
| 05:07 | reduced | (println (keys v))) |
| 05:07 | reduced | what is wrong in all this |
| 05:07 | reduced | (def val1 {:x [1 2 4 5] |
| 05:07 | reduced | :y [1 1 2 3] |
| 05:07 | reduced | :z [2 1 2 3] |
| 05:07 | reduced | }) |
| 05:07 | reduced | (for [v val1] |
| 05:07 | reduced | (println (keys v))) |
| 05:29 | karls | recycle: v will be a list of (key value) |
| 05:30 | karls | whoops, they're gone |
| 08:54 | lvh | Project organization question. If I have a component with an API (let's say a protocol) and some implementations (i.e. a riak backing store, a sql backing store...) where would they live? |
| 08:55 | lvh | Right now I have e.g. myproject.store.core and myproject.store.riak. I don't know if myproject.store and myproject.store.riak would even work, or if that would be desirable |
| 08:55 | lvh | maybe it should be myproejct.store.api |
| 08:55 | tbaldridge | lvh: I tend to use .api or even .protocols and then have .impl.riak |
| 08:56 | lvh | tbaldridge: so, is that myproj.api, or myproj.store.api? I.e. do you have an api file that covers all your app's APIs? |
| 08:56 | lvh | thanks! |
| 09:21 | tbaldridge | lvh: I tend to divide by module first, then by api/impl/etc. |
| 09:21 | tbaldridge | So myproj.store.api |
| 09:21 | tbaldridge | not saying that's the perfect way, just a way |
| 09:22 | lvh | tbaldridge: yeah, no, that resonates :) thanks |
| 09:30 | yogsototh | Hi I have a http-kit server I can run with lein run, but I can't compile it; lein compile foo.server returns me a "Method code too large!" error |
| 09:30 | yogsototh | And to circumvent this the only way I found was to: |
| 09:31 | yogsototh | 1. lein clean ; 2. lein compile foo.server (broke) ; 3. lein uberjar ; and then I have a working uberjar (the compilation create a .class) |
| 09:31 | yogsototh | Is there a way to control how leiningen compile things? |
| 09:32 | yogsototh | So I could simply stop the compilation after it try to generate the first .class? |
| 09:32 | clgv | yogsototh: the error sounds like one of your clojure function uses a lot of inlining functions or huge macro expandions |
| 09:32 | clgv | *expansions |
| 09:33 | yogsototh | Yes, I am not sure, but this is certainly schema + swagger with complex schema |
| 09:33 | yogsototh | if I use less routes, all work fine |
| 09:34 | yogsototh | I only have 6 routes thought. |
| 09:34 | clgv | maybe you can delegate all routes directly to individual functions? |
| 09:35 | yogsototh | I really don't know how to do that. Actually I use a macro provided by swagger to generate the right api. |
| 09:37 | clgv | yogsototh: I'd reread there docs and in case it's still not clear why it fails and how to use it right, you should report an issue |
| 09:39 | yogsototh | Yes thank you. I'll try to find a way. In the worst case, I'll look into the code ;-) |
| 09:40 | djcoin | I don't want to start a flamewar, but Would you recommend using Emacs over IntelliJ w/ Cursive ? |
| 09:40 | djcoin | (or the other way around) |
| 09:40 | catern | yes |
| 09:41 | djcoin | (and yeah sorry, what would be the benefits of one vs the other?) |
| 09:41 | djcoin | IntelliJ seems pretty capable, index stuff and may be easier, no? |
| 09:42 | catern | if you're familiar with IntelliJ I guess you can use it |
| 09:42 | cfleming | I'm biased since I develop Cursive, but I think it's a pretty nice environment now |
| 09:42 | cfleming | In a lot of ways it's more sophisticated than Emacs, in some ways it's still catching up |
| 09:42 | cfleming | But I'd say it's definitely easier to get started with |
| 09:43 | teslanick | I had trouble getting cursive+intellij12+clojurescript to work properly, but I'll admit that I didn't fight with it for very long. |
| 09:43 | catern | djcoin: there you go. you've got to be a Cursive developer to say Cursive is a pretty nice environment :P |
| 09:43 | cfleming | teslanick: when was that? |
| 09:43 | teslanick | Couple weeks ago |
| 09:43 | puredanger | here's a video about getting started with Cursive and ClojureScript from tbaldridge https://tbaldridge.pivotshare.com/media/cursive-and-clojurescript/12952/feature |
| 09:44 | cfleming | Hmm, that should have been ok, I'd be interested to know the problems you had |
| 09:44 | cfleming | puredanger: Nice, I hadn't seen his cljs one |
| 09:44 | puredanger | I think he posted it last night :) |
| 09:44 | teslanick | cfleming: I can give it another whack over lunch and let you know |
| 09:44 | catern | djcoin: personally I think Emacs is just way better in general. so if you're looking for a place to develop software in general, I'd suggest Emacs and using it for Clojure incidentally; but if you're just looking to use Clojure only, it's a toss-up |
| 09:44 | cfleming | puredanger: That would explain it then :-) |
| 09:45 | puredanger | a number of people at Cognitect have switched from Emacs to Cursive as their daily tool |
| 09:45 | tbaldridge | I stopped using emacs when cider decided to start hanging my box when I printed 2000 lines. |
| 09:45 | catern | tbaldridge: and started using an IDE that will start hanging your box all the time? :) |
| 09:46 | cfleming | catern: Have you used IntelliJ? |
| 09:46 | catern | cfleming: in passing |
| 09:46 | tbaldridge | catern: never had it hang my box, and an IDE written in a modern language is a joy. GPU accelerated UIs and multicore indexing means the IDE just screams. |
| 09:47 | cfleming | tbaldridge: I've got to admit even I was surprised that speed was a major benefit of Cursive for you - it's good to hear, though. |
| 09:47 | tbaldridge | catern: don't confuse InteliJ with Eclipse, the latter is a pile of junk, in my experience. |
| 09:47 | djcoin | lol |
| 09:47 | djcoin | :) |
| 09:48 | djcoin | That's pretty harsh! |
| 09:48 | tbaldridge | cfleming: yeah, the syntax highlighter could be a tad faster I think, it boggs down when loading clojure/core.clj but that's about 7000 loc these days. |
| 09:48 | tbaldridge | For normal clojure stuff it's super fast. |
| 09:48 | mavbozo | tbaldridge: wow |
| 09:49 | puredanger | I use Eclipse pretty regularly, but mostly for the Java parts of Clojure |
| 09:49 | cfleming | Yeah, clojure.core is always a bit of an issue for Cursive, it's just so big |
| 09:49 | tbaldridge | cfleming: to be fair it also boggs down in Compiler.java, but that's 10k loc :-) |
| 09:49 | TimMc | clojure.core bogs down my browser |
| 09:49 | cfleming | And having it spread over various files with load-file pretty much sucks too |
| 09:50 | cfleming | tbaldridge: Heh, yeah, there's only so much you can do with some of those files :) |
| 09:50 | tbaldridge | puredanger: interesting, I noticed clojure/clojure includes Intelij project files, any reason for using Eclipse? |
| 09:51 | puredanger | I've used it since before 1.0 and it's comfortable for me |
| 09:51 | tbaldridge | fair enough |
| 09:51 | puredanger | Rich uses Intellij for it |
| 09:51 | tbaldridge | puredanger: that's why I use it, Rich always knows best |
| 09:51 | tbaldridge | :-P |
| 09:52 | mavbozo | puredanger: what is rich's pc specs? |
| 09:52 | puredanger | mavbozo: macbook pro |
| 09:52 | mavbozo | puredanger: 16GB of RAM? |
| 09:53 | catern | it's java developer madness to want to go back to an IDE when your language has great support for non-IDEs |
| 09:53 | puredanger | mavbozo: dunno |
| 09:53 | catern | has superior support, that is |
| 09:54 | tbaldridge | catern: nah, it's just a question of how much you want to hander a soldering iron ;-) |
| 09:54 | puredanger | cfleming: I've taken a couple stabs at using Cursive but the keybinding stuff wore me out. Is there any way to better package a set of keybindings to start with? I don't even care what they are necessarily. |
| 09:54 | teslanick | catern: I don't understand, care to elaborate your position? |
| 09:54 | tbaldridge | s/hander/handler |
| 09:54 | fairuz | Hi guys. I tried to use nginx-clojure. Got it running. Accessing localhost:8080 shows the nginx default html page. But when I go to localhost:8080/clojure, there's an error saying classdefnotfound: clojure. How do I fix this? Apart from starting nginx, what else should I do? Thanks :) |
| 09:55 | mavbozo | puredanger: so, rich rarely use emacs for developing clojure then? |
| 09:55 | mpenet | so apparently arguing about editors is still a thing |
| 09:55 | cfleming | puredanger: Yeah, I really need to fix that - since v13 there's a new API I can use to make Clojure-specific actions specific to Clojure files, but I still can't create bindings based on the keymap the user has configured. |
| 09:55 | puredanger | mavbozo: he uses aquamacs I think. <shudder> |
| 09:56 | cfleming | puredanger: So short answer - it'll get better soon, but still not as nice as I'd like. |
| 09:56 | puredanger | cfleming: I'm really talking about the case of a user that is coming to Intellij/Cursive fresh and just wants a reasonable setup |
| 09:56 | catern | teslanick: IDEs are heavy, language-specific, slow, overcomplicated, difficult to customize, don't have console support, often die, have proprietary components, etc. etc. etc. |
| 09:57 | cfleming | catern: That's why real men use textedit |
| 09:57 | teslanick | I meant the other side of it: "when your language has [superior[ support for non-IDEs" |
| 09:57 | tbaldridge | catern: can be true, except when stuff like cider makes my emacs just as slow, overcomplicated and difficult to use. I want something that just works, and Cursive hit that sweet-spot for me. |
| 09:57 | puredanger | I think we're fortunate to have many good tool options for clojure and there is a good tool for everyone |
| 09:57 | cfleming | puredanger: Yeah, I know that pretty much sucks right now. One thing I'm considering is having some sort of popup when the user first installs to offer a choice of keybindings |
| 09:58 | ohpauleez | +1 - the tooling is very amazing |
| 09:58 | catern | teslanick: well on the whole, I'd guess the Emacs support is better than Cursive or... whatever for Eclipse |
| 09:58 | ohpauleez | across the board (generally speaking) |
| 09:58 | puredanger | cfleming: I would be happy for that. |
| 09:58 | cfleming | puredanger: i.e. emacs-like, or one based on the OSX keymap, etc |
| 09:58 | catern | tbaldridge: shrug. I don't see such slowness, overcomplication, or difficulty |
| 09:59 | fairuz | oh nvm. |
| 09:59 | cfleming | puredanger: The Jetbrains guys don't go much for those sorts of popups but I'm starting to think it's the only way |
| 09:59 | cfleming | puredanger: There aren't many plugins that need as many keyboard shortcuts as Cursive does |
| 10:00 | mavbozo | a friend of mind, after spending a week to customize his intellij to be just like his emacs, found out that his 4 GB i3 macbook air cannot handle intellij smoothly |
| 10:00 | puredanger | cfleming: I'm happy to have a manual step to load a set of keybindings too - I just want that as one step, not setting each individually |
| 10:00 | mavbozo | so, intellij is quite good for clojure but be sure your pc is powerful |
| 10:01 | cfleming | puredanger: Yeah, I hear that. Another option would be just to distribute some exported keymaps that people can import - still not a very nice user experience, but at least it's just one step. |
| 10:01 | catern | oh also you should feel deep revulsion and sickness at the thought of using a Java IDE to develop in Lisp |
| 10:01 | mavbozo | based on puredanger answer, macbookpro is powerful enough for rich |
| 10:02 | puredanger | catern: even one written in Java? :) |
| 10:02 | cfleming | MBP works fine for IntelliJ, it's what I use |
| 10:02 | rweir | mbp with 16gb of ram handles intellij fine - my company buys jillions of them for that very purpose |
| 10:02 | catern | puredanger: abstraction! |
| 10:02 | cfleming | I have 4 projects open at any one time, 8GB RAM handles it easily |
| 10:03 | cfleming | Cursive is a pretty big project, it's using around 120M right now |
| 10:03 | mdeboard | intellij |
| 10:03 | cfleming | I give IntelliJ 1G, it handles 4 large projects ok with that |
| 10:05 | cfleming | puredanger: I'll let you know when the keymaps thing is better |
| 10:05 | puredanger | cfleming: no worries :) thx. |
| 10:06 | dnolen_ | djcoin: after 7 years I'm tired of Clojure/Emacs, Intellij Cursive rocks - at this point I would recommend w/o question to people who want to try Clojure w/o hassle |
| 10:06 | ToxicFrog | I used IntelliJ for Clojure for a while, but I don't think I used Cursive, but some other clojure plugin. |
| 10:06 | ToxicFrog | Eventually ditched it in favour of Sublime Text. |
| 10:06 | dowwie | dnolen_ you try vim? |
| 10:07 | tbaldridge | ToxicFrog: LaClojure, I think. That's how I got started |
| 10:07 | cfleming | ToxicFrog: That was probably La Clojure |
| 10:07 | dnolen_ | dowwie: I've tried pretty much everything, but I used Emacs still for many other things |
| 10:07 | djcoin | dnolen_: alright, thanks a lot. I tried Emacs in the past, then switched to Vim, and now as I'm planning to dive more into Clojure was thinking about going straight to Intellij which seems nice. Thanks :) |
| 10:07 | dnolen_ | s/I use |
| 10:07 | tbaldridge | ToxicFrog: then I moved to whatever netbeans had, then to vim, then emacs, then back to Intellij |
| 10:08 | ToxicFrog | cfleming, tbaldridge: Yes! That's the one! |
| 10:08 | lvh | tbaldridge: I was wondering what that thing in the core.async videos (the for-pay ones) is; Intellij? |
| 10:08 | tbaldridge | yes |
| 10:08 | mavbozo | dnolen_: isn't Lighttable good enough for newbies? |
| 10:08 | ToxicFrog | I liked intellij but found it had way too much overhead (both resource and cognitive). |
| 10:08 | dnolen_ | mavbozo: Light Table is good for newcomers but I found it frustrating for actual work |
| 10:09 | cfleming | ToxicFrog: Yeah, they haven't updated La Clojure for a long time now, it's unofficially deprecated in favour of Cursive |
| 10:09 | ToxicFrog | cfleming: yeah, I think I switched to ST before Cursive came out. |
| 10:09 | dnolen_ | Cursive provides just good experience as LT w the exception of in editor eval of CLJS |
| 10:09 | dnolen_ | for newcomers |
| 10:10 | cfleming | ToxicFrog: ST is actually meant to be pretty nice for Clojure these days |
| 10:10 | cfleming | dnolen_: Yeah, I need to get a CLJS REPL going for Cursive |
| 10:10 | dnolen_ | cfleming: ST drives me insane for Clojure dev :) |
| 10:11 | dnolen_ | whack REPL, horrible namespace switching and inferior paredit (all these things things still seem to be true) |
| 10:11 | puredanger | I think Nightcode is a pretty good basic editor experience too |
| 10:11 | lvh | awesome thing that doesn't "click" until you actually use it: multimethods |
| 10:11 | dnolen_ | I watched the Clojure Unity people use it |
| 10:11 | dnolen_ | do not want |
| 10:11 | lvh | I'm sprinkling some multimethod all over everything and it's just so awesome |
| 10:11 | ToxicFrog | cfleming: I've found it so, but I also suspect I'm not really using ST to its full potential in many ways |
| 10:11 | ToxicFrog | E.g. I don't use paredit or the REPL |
| 10:11 | cfleming | dnolen_: I'll take your word for it, I've never used it. I tend to use it for my non-dev work but no more than that. That's a nasty list of non-features though :-) |
| 10:12 | dnolen_ | cfleming: it's a fine text editor, but I really want something *better* than Emacs for Clojure |
| 10:12 | cfleming | dnolen_: Well, soon you'll be able to extract methods with Cursive, instead of doing it by hand like some sort of base animal :) |
| 10:13 | clgv | If I get the following expception I should see some :tag metadata containing a primitve type somewhere in the macroexpansion, right? Exception: "Can't type hint a local with a primitive initializer" |
| 10:13 | clgv | I used tools.macro to get the expansion |
| 10:13 | clgv | and *print-meta* true |
| 10:15 | TimMc | lvh: Careful, multimethods make code reloading a bit of a nightmare. |
| 10:15 | TimMc | clojure.tools.namespace or whatever might help, though... |
| 10:15 | dnolen_ | cfleming: my main Cursive pet peeves (they might exist) - pretty printed stepping macroexpand, macros that create bindings |
| 10:15 | tbaldridge | clgv: yeah, I'd like to fix that at some point as it even throws an error if the two tags match |
| 10:15 | lvh | TimMc: Why's that? The new defs don't override the old ones? |
| 10:15 | dnolen_ | cfleming: indentation is also a bummer for me - I nearly always prefer 2 space indent |
| 10:16 | TimMc | lvh: I don't remember the details at this point, sorry. |
| 10:16 | clgv | tbaldridge: damn, I got this when changing a previously working macro :( |
| 10:16 | lvh | TimMc: Ah. Thanks anyway for the heads up :) |
| 10:16 | dnolen_ | cfleming: the Emacs like indentation rules just results in crazy looking code |
| 10:17 | clgv | so I did not find any primitive tags, what can I look for to find the reason? |
| 10:17 | TimMc | lvh: I *think* just running defmethod again won't replace the definition. |
| 10:17 | cfleming | dnolen_: Yeah, the first is planned (I need to improve the formatting code a bit), it'll be interactive - i.e. expand next step, and highlight what just got expanded |
| 10:17 | cfleming | dnolen_: optionally pretty print gensyms and hide FQNs too |
| 10:17 | tbaldridge | clgv: not seing the code, I don't know. I always got this error when trying to type-hint a let symbol that was already inferred from the binding of the let. |
| 10:18 | ephemeron | dnolen_: Which indentation rules? |
| 10:18 | clgv | tbaldridge: yeah that's what I thought the exception meant, as well |
| 10:18 | cfleming | dnolen_: the second is tougher, it'll be fixed with an extension API which I'm working towards |
| 10:18 | clgv | so going to check all :tag bindings |
| 10:18 | dnolen_ | ephemeron: the always align fn argument rule, it's an abomination for any function with more than 3-4 letters |
| 10:19 | cfleming | dnolen_: when you talk about the Emacs indentation rules, you mean in Cursive? |
| 10:19 | martinklepsch | I wrote a post about s3 direct upload using core.async and transducers: http://www.martinklepsch.org/posts/using-coreasync-and-transducers-for-direct-s3-upload.html — would be interested in any feedback :) |
| 10:19 | dnolen_ | cfleming: yes Cursive does the same thing |
| 10:19 | dnolen_ | I want a knob for it |
| 10:19 | cfleming | dnolen_: Ok, what would you rather it did? |
| 10:19 | dnolen_ | I've disabled it in Emacs |
| 10:19 | dnolen_ | cfleming: always two space indent |
| 10:19 | dnolen_ | except for obvious stuff like literals, binding forms |
| 10:21 | ephemeron | It seems reasonable to provide an alternative to vertical alignment, I agree. |
| 10:22 | mdrogalis | dnolen_: Yeah, concur. I've worked with people who use Cursive, and I see all sorts of non-standard whitespace formatting. |
| 10:22 | cfleming | dnolen_: Ah, I see - yeah a lot of people have asked for that. I'll get it in there soon. You want the default to be like Only Indent is in Cursive right now, right? |
| 10:22 | cfleming | mdrogalis: Anything in particular jump out at you? It should pretty much format like Emacs now, which is the de-facto standard. |
| 10:23 | mdrogalis | cfleming: I have to admit that I don't use cursive, I just work with a few who do. I think they somehow got the editor to format in a really weird manner. |
| 10:23 | mdrogalis | cfleming: So in short, maybe there's nothing to fix. :P Heh. |
| 10:24 | cfleming | mdrogalis: That's my favourite sort of bug report :) |
| 10:24 | tbaldridge | mdrogalis: cfleming: I finally got it working after messing with the indent settings for about an hour. The defaults are a bit odd. So yea, the first attempt by a newbie will produce some odd looking code. |
| 10:24 | clgv | tbaldridge: it would be great to get the name of the offending binding... as with other clojure compiler errors where details are missing ;) |
| 10:26 | cfleming | tbaldridge: Interesting, I thought the defaults were fairly sane these days. Do you remember what you changed? |
| 10:26 | hugod | what are people's biggest complaints with cider? |
| 10:27 | lvh | How do I spell "take everything from this channel, dump it on that channel over there, and block/park until it closes?" |
| 10:27 | cbp | cider is like a box of chocolates |
| 10:28 | cbp | you neer know what youre gonna get |
| 10:31 | hugod | cbp: is that caused by running from snapshots and melpa builds? |
| 10:33 | clgv | that's a thing I always wondered. are there stable builds for e.g. cider? |
| 10:33 | lvh | I have a bunch of expressions that eval to channels that give some items and then close; I'd like to evaluate them in order, waiting until one is done before doing the next one, and collecting all the itmes (in order, on a chan). Here's what I came up with: https://gist.github.com/lvh/a78a817ae19e141cd529 |
| 10:33 | lvh | I don't know if that's a good way to spell it. |
| 10:33 | cbp | hugod: of course |
| 10:34 | lvh | (i know that code waits for each sub-part to be done before publishing all of the individual results) |
| 10:34 | hugod | clgv,cbp: there is a 0.7.0 stable release |
| 10:34 | lvh | I guess I want pipe & "park until this thing closes"? |
| 10:36 | clgv | hugod: ah ok so you can jump manually from release to release? |
| 10:37 | hugod | clgv: yes - the 0.7.0 emacs lisp code is in the melpa stable repository |
| 10:39 | mavbozo | clgv: i used cider from melpa before but found it breaks often, so now i use melpa-stable |
| 10:43 | clgv | hugod: ah ok. thanks for the information. my emacs experience is pretty limited ;) |
| 10:46 | TimMc | ++ for mimicking the Emacs de facto standard here |
| 10:46 | TimMc | whoops, was in scrollback-land |
| 10:51 | borkdude | ,(+1 2 3) |
| 10:51 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn> |
| 10:51 | borkdude | ,(+ 1 2 3) |
| 10:51 | clojurebot | 6 |
| 10:52 | borkdude | $(+ 1 2 3) |
| 10:52 | borkdude | &(+ 1 2 3) |
| 10:52 | hyPiRion | lazybot is dead |
| 10:52 | tbaldridge | borkdude: what are you trying to do? |
| 10:52 | borkdude | tbaldridge I was showing my colleague how #clojure evaluates exprs |
| 10:52 | borkdude | tbaldridge but I forgot some of the characters |
| 10:54 | TimMc | borkdude: There's also ##(+ 1 2 3) if the expression starts with a paren |
| 10:54 | TimMc | and if lazybot weren't dead |
| 10:59 | clgv | hyPiRion: does he get an update eventually? :P |
| 11:01 | hyPiRion | Raynes, amalloy_: lazybot is dead. |
| 11:04 | mdeboard | long live lazybot! |
| 11:04 | dnolen_ | cfleming: I don't really care about default just want the knob - are you saying it's already possible? |
| 11:05 | borkdude | is it possible to start lein cljsbuild auto with cursive? (just trying it out now) |
| 11:09 | borkdude | of course I can run it externally |
| 11:16 | cbp | ~java |
| 11:16 | clojurebot | ☕ |
| 11:16 | cbp | o_O |
| 11:16 | mdeboard | hey |
| 11:16 | mdeboard | good job emacs |
| 11:16 | mdeboard | you rendered whatever the hell that character is |
| 11:16 | mdeboard | apparently some kind of unicode thing |
| 11:16 | cbp | not for me :-o |
| 11:17 | hugod | cfleming: in what ways is cursive more sophisticated than cider? |
| 11:17 | mdeboard | cbp: Are you using rcirc/ |
| 11:17 | cbp | name: HOT BEVERAGE |
| 11:17 | cbp | I'm using erc |
| 11:17 | mdeboard | Oh, you're one of those |
| 11:18 | mdeboard | one of THOSE people |
| 11:22 | lvh | hm; has anyone written regexes-over-arbitrary-values yet? |
| 11:22 | lvh | I want to express something like "this thing is a sequence of these elements, then these five elements in any order, then these three elements, then..." |
| 11:23 | trptcolin | lvh: like https://github.com/jclaggett/seqex |
| 11:23 | lvh | I guess maybe I can write that as take |
| 11:23 | lvh | oooooo |
| 11:23 | lvh | trptcolin: Thank you :) |
| 11:23 | trptcolin | or or https://github.com/cgrand/seqexp |
| 11:33 | TimMc | lvh: I recall encountering some Java library that did that, maybe 3-5 years ago. |
| 11:34 | TimMc | It was in use by an NLP project, probably to recognize certain grammatical constructions. |
| 12:08 | jtackett | Hey guys, I’m looking for a way to get around the heroku request time out issue |
| 12:08 | jtackett | I have a long running process that I need to display on the next page upon request |
| 12:14 | rweir | prolly want the heroku scheduler thing? |
| 12:16 | Jumblemuddle | How would I go about creating a program that can interact directly with an external monitor? (Think Ms-Powerpoint) |
| 12:17 | klyed2 | jtackett: never used heroku, but you might want to have a self-rescheduling task, and your page load auto-refreshes until the task flags itself as completed |
| 12:18 | jtackett | that’s a good idea |
| 12:18 | jtackett | how do you have the page auto-refresh? |
| 12:18 | klyed2 | jtackett: javascript or look up refresh meta tag for html |
| 12:19 | rweir | Jumblemuddle, pretty sure powerpoint doesn't do that |
| 12:20 | rweir | Jumblemuddle, you'd have to look at whatever GUI toolkit you used's multiple monitor support |
| 12:22 | Jumblemuddle | rweir: Hmm, I guess I hadn't thought about it much. I suppose it just creates a window and resizes it to the monitor? If so, it would be very different on linux. I wonder if xorg would allow for 2 x-session, where 1 first one would control the 2nd? |
| 12:22 | rweir | that sounds like a really weird way to show two windows |
| 12:22 | Jumblemuddle | (I'm attempting to create a presentation program in clojure) |
| 12:22 | Jumblemuddle | Ya, it does feel like a hack. |
| 12:23 | Jumblemuddle | Although, having it just be an extended monitor, makes me feel ocd. |
| 12:23 | dbasch | jumblemuddle: this is not really a clojure question, it’s more about Swing or whatever you’re using like rweir said. See for example: http://stackoverflow.com/questions/4627553/java-show-jframe-in-a-specific-screen-in-dual-monitor-configuration |
| 12:24 | Jumblemuddle | Ya, I was hoping there would be some fancy clojure library for it. However, I can see how it wouldn't be clojure specific. Thanks for the help! |
| 12:26 | dbasch | jumblemuddle: you may want to ask here: https://groups.google.com/forum/#!forum/seesaw-clj |
| 12:27 | Jumblemuddle | Interesting, thanks. |
| 12:33 | upwardindex | ,(byte (.byteValue 128)) |
| 12:33 | clojurebot | -128 |
| 12:33 | upwardindex | Why does this throw ArrayIndexOutOfBoundsException on my machine? |
| 12:39 | trptcolin | are you using it as an index? i don't think either Long.byteValue or clojure.core/byte can throw that exception |
| 12:39 | upwardindex | trptcolin: I’m simply writing in the repl what I wrote here but without the comma |
| 12:40 | upwardindex | I get “ArrayIndexOutOfBoundsException java.lang.Byte.valueOf (Byte.java:101)” as an answer |
| 12:43 | trptcolin | upwardindex: want to link a gist w/ details? stack trace, clj/java versions, etc? |
| 12:43 | klyed2 | upwardindex: possible a function/macro is defined? |
| 12:44 | dbasch | upwardindex: what version of clojure? |
| 12:44 | upwardindex | dbasch: 1.5.1, I’ll put up a gist with all info as suggested by trptcolin |
| 12:46 | thesaskwatch | hi .. most of the sql generation libraries/db cliients seem to use globally bound database var, is this idiomatic clojure? |
| 12:47 | mpenet | no not really |
| 12:48 | thesaskwatch | it doesn't sound very safe to me, that's why I find it weird |
| 12:48 | mpenet | most sql clients don't do that, ex clojure.java.jdbc |
| 12:49 | mpenet | Korma does, but I am not sure it's in good shape these days |
| 12:49 | trptcolin | see http://blog.clojurewerkz.org/blog/2014/04/26/major-breaking-public-api-changes-coming-in-our-projects/ |
| 12:50 | thesaskwatch | mpenet: yes, that's the main client, but it's only a wrapper over jdbc .. I don't see sql generation there beyond simple cases |
| 12:50 | mpenet | there are a few lib dedicated to that I think |
| 12:51 | thesaskwatch | trptcolin: I agree with this point of view, that's why I'm asking |
| 12:52 | mpenet | see under "sql abstraction": http://www.clojure-toolbox.com/ |
| 12:54 | thesaskwatch | mpenet: thanks |
| 12:55 | mdrogalis | thesaskwatch: FWIW, HoneySQL is my choice of SQL lib these days. |
| 12:56 | thesaskwatch | mdrogalis: readme says updates are not implemented |
| 12:56 | thesaskwatch | mdrogalis: though https://github.com/jkk/honeysql/issues/7#issuecomment-52526575 |
| 12:57 | mpenet | mdrogalis: but HoneySQL only support select I think |
| 12:57 | mdrogalis | thesaskwatch: They actually are implemented, but not documented. |
| 12:57 | mdrogalis | I have an issue open to add it to the README |
| 12:58 | thesaskwatch | mdrogalis: ok, I'll dive into it. But do I understand it correctly that it generates sql string that I can later send to clojure jdbc? |
| 13:02 | thesaskwatch | ok, this example makes sense https://github.com/sorribas/clj-blog/blob/9678eb4ff06e8c9f1ea01b42bc008b9cbefd365e/src/clj_blog/db.clj |
| 13:04 | mdrogalis | thesaskwatch: Correct. |
| 13:12 | danneu | i think it's much easier to just use jdbc directly |
| 13:13 | danneu | though i wish the driver allowed positional parameters "WHERE id = $1 AND x = $2" instead of "WHERE id = ? AND x = ?" |
| 13:15 | csd_ | Is it possible to do an equivalent of macro-expand for a function? I'm trying to figure out how to solve http://www.4clojure.com/problem/158 |
| 13:20 | danneu | speaking of clojurewerkz apis, i wonder why they choose style A over style B https://www.refheap.com/89801 |
| 13:22 | danneu | by going with style A, it's now nontrivial to modify the options programmatically (associng into map). |
| 13:22 | danneu | korma vs honeysql is another example |
| 13:27 | mikerod | I posed the question yesterday as to why Clojure cannot provide type inference in a situation like: (doseq [my-thing (.getThings ^ThingHolder holder)] (.doThingMethod my-thing)) |
| 13:27 | mikerod | Where: ThingHolder#getThings returns Collection<Thing> |
| 13:27 | mikerod | and: Thing#doThingMethod is an instance method |
| 13:27 | llasram | csd_: I see the analogy you're trying to draw, but not really... |
| 13:27 | mikerod | To keep reflection away, I have to: (doseq [my-thing (.getThings ^ThingHolder holder)] (.doThingMethod ^Thing my-thing)) |
| 13:27 | technomancy | mikerod: it may be that doseq calls seq rather than using the array directly? |
| 13:28 | mikerod | technomancy: Well, I dug into Compiler some. It "sort of" has to do with Java type-erasure it seems. |
| 13:28 | csd_ | llasram: my other thought is to use eval + reduce, to wrap the args successively around the decurryed function |
| 13:28 | mikerod | but when I dug down that route a bit more, it is still possible to find the parameterized type information in the class files |
| 13:28 | technomancy | mikerod: I suspect it could be done but just wasn't deemed worth the effort at the time |
| 13:28 | mikerod | technomancy: yes, I think it'd be very difficult |
| 13:29 | mikerod | In a general sort of sense |
| 13:29 | mikerod | However, when dealing with a reasonable amount of Java interop - it does get a bit frustrating/verbose if you are wanting to avoid reflection |
| 13:29 | technomancy | you could write a type-preserving-doseq I bet |
| 13:29 | technomancy | but doing it in the general case would be tricky |
| 13:30 | mikerod | Newer people to Clojure always assume that the type info will be inferred in this sort of case, since the information is "available" |
| 13:31 | technomancy | "It's Java; it's not supposed to be easy." |
| 13:31 | mikerod | technomancy: exactly, for `doseq` it shouldn't be too hard. but down at the compiler inference level for like Compiler$InstanceMethodExpr#getJavaClass level - looks hard |
| 13:31 | csd_ | llasram: doing eval + reduce works but it seems like there has to be a better way |
| 13:32 | csd_ | also 4clojure blocks eval evidently... |
| 13:33 | mikerod | Then again, there are heterogenous seqs you could create as well, so then it doesn't even make sense to try to auto-hint some of them for their Java interop. I just found this topic interesting and now I can see why the inference doesn't work. |
| 13:33 | mikerod | technomancy: "It's Java; it's not supposed to be easy." - I'll remember this advice and use it in response to anyone new who sees this lack of inference to be a weakness. :P |
| 13:35 | mikerod | it is still less verbose typing than Java would require overall though, so I guess it isn't really a weakness. I just say use `(set! *warn-on-reflection* true)` when you develop. |
| 13:35 | llasram | csd_: Well, you definitely don't need `eval`, but `reduce` is on the right track :-) |
| 13:35 | llasram | s/the/a/ |
| 13:36 | technomancy | mikerod: just because not all seqs are homogeneous doesn't mean they shouldn't be hinted for cases when you know they are |
| 13:37 | mikerod | technomancy: yes, but I'd imagine that would get ugly with something like (doseq [o (concat (.getThings x) (.getSomethingElses y))] <...>) |
| 13:37 | csd_ | llasram: just got it :) tricky |
| 13:37 | mikerod | if the compiler was attempting to type hint the o |
| 13:38 | technomancy | mikerod: seems completely reasonable to just leave the hints off in complicated situations |
| 13:38 | technomancy | at least for a first pass |
| 13:38 | mikerod | technomancy: yes, that's what I was thinking |
| 13:39 | mikerod | if there is a "union of types" inferred for a seq, then just stop auto-inference |
| 13:39 | llasram | csd_: (partial partial #(reduce deliver %&)), right? |
| 13:39 | llasram | j/k |
| 13:40 | csd_ | that went over my head but i did reduce #(%1 %2) f n |
| 13:40 | csd_ | where f was the function chain and n was the vector of numbers |
| 13:40 | llasram | csd_: Yeah, good job. For obfuscation purposes, `deliver` acts like `#(%1 %2)` :-) |
| 13:41 | csd_ | never seen that before |
| 13:41 | llasram | I do sometimes wish for a real `funcall` in the language... Not often, but |
| 13:42 | bja | is there a handy function for showing the source of a namespace when I'm in my repo? |
| 13:42 | bja | repl? |
| 13:47 | jtackett | bja: if you require the ns and name it something, then you’ll always now |
| 13:47 | jtackett | (require namespace.util :as nameOfns) |
| 13:47 | trptcolin | bja: that would be pretty cool. but i think something like (println (slurp (clojure.java.io/resource "clojure/string.clj"))) is the best you have |
| 13:47 | trptcolin | keeping in mind that the source of an ns may be spread across files |
| 13:48 | jtackett | oh you mean where it is in your directory |
| 13:48 | jtackett | nvm |
| 13:48 | bja | trptcolin, understood. I'm just trying to figure out why lein classpath and lein deps :tree seem to be lying to me |
| 13:48 | trptcolin | plugins? |
| 13:48 | arrdem | llasram: what would funcall do for you? |
| 13:48 | technomancy | same thing it does in every language |
| 13:48 | technomancy | try to take over the world! |
| 13:48 | llasram | (inc technomancy) |
| 13:48 | llasram | heh |
| 13:49 | arrdem | wow... Raynes and Lazybot both MIA... |
| 13:49 | danneu | i understand that a macro captures lexical scope at definition. like if you redefine `if`, then a macro with `(if ...) will expand to (my.ns/if ...). But what if you don't export your `if` redefinition? |
| 13:49 | llasram | arrdem: Do you mean "when would it be useful"? |
| 13:50 | arrdem | llasram: essentially. |
| 13:50 | trptcolin | danneu: that sounds like not a macro feature - more of a syntax-quote feature |
| 13:50 | bja | ... |
| 13:50 | bja | (-> "ring/util/codec.clj" clojure.java.io/resource slurp println) shows me assoc-conj in the source code |
| 13:51 | bja | yet (require '[ring.util.codec :refer [assoc-conj]]) fails |
| 13:51 | llasram | arrdem: when you have a collection of arbitrary functions you want to call in a non-`apply` fashion |
| 13:51 | llasram | It doesn't happen often, and #(%) or #(apply %1 %&) works fine, but the actual name "funcall" would (IMHO) be clearer |
| 13:52 | trptcolin | bje: got any deps that are uberjarred up and including different versions of ring.util.codec? |
| 13:52 | bja | I don't think so, and I've actually :exclusions [ring] out of just about everything else |
| 13:52 | trptcolin | those can be tricky |
| 13:53 | bja | maybe there is something that has a dependency somewhere |
| 13:53 | trptcolin | that wouldn't help for uberjarred libs |
| 13:53 | bja | but I don't understand why require would find a different thing on the classpath than clojure.java.io/resource |
| 13:58 | danneu | anybody know of a js markdown lib and a clj/java markdown lib that are compatible enough? |
| 13:59 | MagBo | Hey, beautiful people! lein is so painfully slow I wonder if there is a way to run it as a server? |
| 13:59 | trptcolin | bja: .class files come first |
| 13:59 | trptcolin | in the lookup order of require |
| 13:59 | danneu | MagBo: what are you trying to do |
| 14:00 | MagBo | danneu: building projects on a slow network. |
| 14:00 | MagBo | I'm not even sure what's the bottleneck — JRE bootstrapping or network :) |
| 14:01 | danneu | MagBo: the only time i use lein during dev is when im booting nrepl and booting the webapp server (lein ring server-headless) |
| 14:01 | technomancy | MagBo: there are a few options here https://github.com/technomancy/leiningen/wiki/Faster |
| 14:02 | MagBo | <3 I'm sorry that I didn't read the docs |
| 14:02 | MagBo | Thank you so much. |
| 14:02 | danneu | oh, https://github.com/yogthos/markdown-clj comes with the compiled js. <3 u yogthos |
| 14:03 | technomancy | MagBo: well in this case it's the wiki, not the official docs, so it's a bit more obscure |
| 14:04 | csd_ | Why are vectors not considered seqs |
| 14:05 | technomancy | seqs are O(n) |
| 14:05 | technomancy | I mean, lots of reasons, including that |
| 14:06 | csd_ | doesnt it satisfy ISeq though |
| 14:08 | MagBo | technomancy: btw, can I msg you w/ offtopic? I'm curious about how and if you're using Erlang. :-) |
| 14:08 | technomancy | MagBo: sure |
| 14:09 | llasram | csd_: I'd argue "just because they aren't implemented that way" |
| 14:09 | technomancy | you can get a seq from a vector, but that doesn't mean they're the same tihng |
| 14:10 | llasram | technomancy: Sure, but |
| 14:10 | llasram | I can't off the top of my head think of why vectors don't directly implement `ISeq` |
| 14:10 | llasram | Clojure separates `Seqable` from `ISeq` so you can `seq` things which don't directly implement `ISeq`, but e.g. lists do the latter |
| 14:10 | Bronsa | llasram: it might be implementation defined but I associate ISeq with conj=cons |
| 14:11 | Bronsa | i.e. I'd expect conj to behave like cons on a seq |
| 14:12 | llasram | Oh, interesting. Yeah, otherwise I'm not sure how you'd get the current behavior of `(cons x (seq a-vector))` |
| 14:12 | llasram | Er |
| 14:12 | llasram | You know what I meant |
| 14:12 | llasram | (conj (seq a-vector) x), but actually my previous attempt shows exactly how you'd get that :-) |
| 14:35 | stompyj | its interesting how both clojure and data related hn posts get upvotes, but fewer comments |
| 14:36 | bja | fwiw, it was the 0.9.2-incubating store-core that got me |
| 15:09 | shiranaihito | what's the right way to :require several namespaces that share a common "prefix"? |
| 15:09 | shiranaihito | something like [some.thing other1 other2] doesn |
| 15:09 | shiranaihito | .. 't seem to work :p |
| 15:12 | llasram | shiranaihito: (:require [some.thing.other1] [some.thing.other2]), or |
| 15:12 | shiranaihito | mmm |
| 15:12 | llasram | shiranaihito: (:require [some.thing (other1 :as other1) (other2 :as other2)]) |
| 15:12 | shiranaihito | (:require [clojure.contrib sql sql.tests]) <-- this is the kind of way i've tried.. but it doesn't seem to work |
| 15:12 | shiranaihito | i must be missing something here :p |
| 15:13 | llasram | (doc require) |
| 15:13 | clojurebot | "([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly. Libs A 'lib' is a named set of resources in classpath whose contents define a library of |
| 15:14 | shiranaihito | yep.. but that doesn't really tell us much about how to use it in practice :p .. in fact, this is a common problem with the Clojure docs |
| 15:14 | llasram | shiranaihito: Actually, what you were trying to do should work fine |
| 15:14 | llasram | ,(require '[clojure.core protocols reducers]) |
| 15:14 | clojurebot | #<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/core/reducers__init.class or clojure/core/reducers.clj on classpath: > |
| 15:14 | llasram | Thanks, clojurebot |
| 15:14 | shiranaihito | :P |
| 15:15 | shiranaihito | when do i need to quote a vec in :require.. ? |
| 15:15 | shiranaihito | i've been getting by without quoting :p |
| 15:16 | llasram | shiranaihito: The entire body of your `ns` form is processed quoted, so you don't need to quote anything inside it yourself |
| 15:16 | shiranaihito | ok, cool :p |
| 15:16 | shiranaihito | hm |
| 15:16 | llasram | shiranaihito: But `require` is a function, so you need to quote symbols you pass to it |
| 15:16 | llasram | ,(require '[clojure set data]) |
| 15:16 | clojurebot | nil |
| 15:16 | llasram | There we go |
| 15:16 | shiranaihito | well.. this isn't working: https://www.refheap.com/89811 |
| 15:17 | shiranaihito | (the last line in particular) |
| 15:17 | llasram | What exception do you get? |
| 15:17 | shiranaihito | "java.lang.RuntimeException: No such var: user/schema" .. but "schema" does exist there |
| 15:17 | shiranaihito | and Cursive doesn't think "user" gets imported |
| 15:18 | llasram | Ohhhhhhhhh |
| 15:18 | llasram | There's a specific problem with namespaces named "user" |
| 15:18 | shiranaihito | :D |
| 15:18 | shiranaihito | wtf :p |
| 15:18 | llasram | Work-around -- don't use the token 'user' as the component of a namespace |
| 15:18 | shiranaihito | well this is .. sad? :p |
| 15:19 | shiranaihito | feels like something hacky is going on |
| 15:19 | shiranaihito | at least it works when directly referenced |
| 15:19 | llasram | shiranaihito: It should only be a problem if you use `user` an an alias, like (:require [whatever.path.user :as user]) |
| 15:20 | shiranaihito | this works though: [c2d.module.user :as user] |
| 15:20 | llasram | It works there, but will probably explode elsewhere |
| 15:20 | shiranaihito | huh? |
| 15:20 | shiranaihito | how long has this been a problem and why isn't it fixed? |
| 15:22 | shiranaihito | well, i don't want to call it anything other than "user" because i'm dealing with.. *users*, and i want the singular form.. :o |
| 15:22 | llasram | I think a few reasons... It's probably mostly/only a REPL issue, and maybe specifically a REPLy issue |
| 15:22 | llasram | Here's some discussion: https://github.com/technomancy/leiningen/issues/1619#issuecomment-51144655 |
| 15:22 | llasram | And Clojure has a feature where it auto-loads a namespace named just 'user', so I think people avoid using 'user' to refer to anything else |
| 15:23 | shiranaihito | luckily i don't really care about the REPL :) |
| 15:23 | stompyj | not sure reserved keywords are hacky |
| 15:23 | shiranaihito | it's not like it's a reserved keyword in the language |
| 15:23 | technomancy | clojure allows too much ambiguity here |
| 15:24 | technomancy | you have an unfortunate overlap between the alias and an existing namespace |
| 15:24 | technomancy | you would probably get something similar if you required something :as clojure.set |
| 15:25 | shiranaihito | well, how about naming the built-in "user" as "_user" or something.. to let people have their own namespace called "user" without problems? |
| 15:25 | stompyj | right, but you drop into a repl |
| 15:25 | stompyj | you need a ns right? |
| 15:25 | technomancy | shiranaihito: sounds reasonable to me, but you're unlikely to convince rich |
| 15:25 | shiranaihito | i just want to be able to name my namespaces the way i want to :P and now i want "user" :) i don't think it's unreasonable of me :p |
| 15:26 | technomancy | also that's a breaking backwards-incompatible change, technically |
| 15:26 | stompyj | so we change user to _user |
| 15:26 | octe | would a try-catch make any differences for return values for a function? |
| 15:26 | stompyj | then someone wants to use _user |
| 15:26 | technomancy | the whole point of namespaces are really to be unique and not conflict with each other, so... |
| 15:26 | stompyj | then what? :) |
| 15:26 | shiranaihito | where's the default "user" ns used anyway? |
| 15:26 | octe | returning a value from the try part |
| 15:26 | octe | with no exception thrown |
| 15:27 | shiranaihito | technomancy: yes.. i'm perfectly fine with that rule *for namespaces i've created* .. but not fine with Clojure preventing me from using a specific, *extremely* common concept as a namespace's name |
| 15:28 | shiranaihito | how many apps don't have "users"? :p |
| 15:28 | technomancy | yeah, I didn't pick the name, but that ship has sailed |
| 15:28 | stompyj | shiranaihito: I hear what you’re saying,but this kind of game can be played ad finitium |
| 15:29 | stompyj | sometimes you just have to make a decision and frustrate 1 out of 10000 users |
| 15:29 | shiranaihito | sure, the ship has sailed, but that's got nothing to do with whether this is a problem or not :) .. you were just suggesting i should "make my namespaces unique" .. and that's what i'm planning to do, but wouldn't expect Clojure to get in the way there :) |
| 15:29 | stompyj | you could fork clojure, and change it |
| 15:29 | shiranaihito | :P |
| 15:29 | stompyj | who knows, you could be the next Rich :D |
| 15:29 | shiranaihito | i doubt that :p |
| 15:29 | shiranaihito | but alright.. i guess i'll manage, as long as it works when directly referenced |
| 15:30 | technomancy | I am sympathetic but skeptical that much can be done about it. |
| 15:30 | shiranaihito | yep |
| 15:31 | stompyj | same, I was sort of teasing you |
| 15:31 | stompyj | but I’m sympathetic too |
| 15:31 | shiranaihito | well, i'd guesstimate that it couldn't be *too* difficult to "fix" this |
| 15:31 | stompyj | but as you know, naming is always difficult |
| 15:32 | shiranaihito | is the "user" namespace mostly just used within the REPL? |
| 15:33 | technomancy | shiranaihito: it's also used to hack into the clojure boot process |
| 15:33 | technomancy | since clojure has undocumented behaviour of automatically loading user.clj if it's found on the classpath |
| 15:33 | shiranaihito | that doesn't sound like a common task either :p |
| 15:33 | technomancy | I think component uses it? |
| 15:33 | technomancy | or some wrapper around component, maybe |
| 15:34 | shiranaihito | i'm not familiar with "component", but that's alright |
| 15:34 | shiranaihito | oh well |
| 15:39 | hiredman | component does not |
| 15:40 | hiredman | jig does crazy things like that, so maybe it does that |
| 15:41 | stuartsierra | 'component' doesn't do anything with user.clj. My `reloaded` template includes user.clj stuff. |
| 15:42 | stuartsierra | I've been thinking of replacing it with something like `dev.clj` instead. |
| 15:46 | arrdem | rasmusto: ping |
| 15:46 | justin_smith | arrdem: saw that tweet, and realized my deadline is in good shape and I could get back on IRC again :P |
| 15:47 | arrdem | justin_smith: :P thanks |
| 15:47 | arrdem | cc puredanger |
| 15:47 | puredanger | eh? |
| 15:47 | arrdem | puredanger: thanks I'll bug him |
| 15:53 | shiranaihito | arrdem: how disheartened should i be about Vars' performance? :) |
| 15:53 | arrdem | shiranaihito: don't worry about it. |
| 15:53 | shiranaihito | :p |
| 15:53 | shiranaihito | i saw Oxcart on HN today |
| 15:53 | shiranaihito | sounds good |
| 15:53 | arrdem | oh ffs the project's dead and _now_ it makes HN again? |
| 15:53 | dgaffney | Sup folks! I'm pretty green to clojure and am playing with an API project. I'm wondering how, in the route function on line 14 of this gist, I would be able to leverage the collection and action to serve as a namespace and function, respectively, with the params passed through to that function - I come from ruby, so in that case I would just do something like collection.classify.constantize.send(action, params), but this ain't ruby, so, I du |
| 15:53 | dgaffney | nno how to do this yet - thoughts? (GIST: https://gist.github.com/DGaffney/665be9368f2798493233) |
| 15:54 | shiranaihito | arrdem: dead? :x |
| 15:54 | shiranaihito | well, i'm not sure how i ended up looking at Oxcart |
| 15:54 | shiranaihito | but you've called it quits? |
| 15:55 | arrdem | shiranaihito: http://arrdem.com/2014/08/05/of_oxen,_carts_and_ordering/ |
| 15:56 | arrdem | shiranaihito: issue is that clojure was designed to be a dynamic language and is a limiting/complicating substrate for building a static compiler. the performance gain was kinda minimal (< 25%) and I didn't finish the real low profile build target before GSoC ended and I went back to school. |
| 15:56 | justin_smith | dgaffney: I would pass the handler function to call as an argument to respond |
| 15:56 | shiranaihito | arrdem: i wouldn't call 25% minimal |
| 15:57 | amalloy | arrdem: fundimental =~ s/i/a/ |
| 15:57 | justin_smith | so instead of ["user" "create" params] pass [user-controller/create params] |
| 15:57 | justin_smith | where user-controller/create does the action you desire |
| 15:57 | arrdem | amalloy: in the post? |
| 15:57 | amalloy | yeah |
| 15:57 | arrdem | meh |
| 15:57 | dgaffney | mm - i see hot it is justin_smith |
| 15:58 | dgaffney | thanks! |
| 15:58 | justin_smith | dgaffney: typically I have a "controller ns" (like user-controller) for each endpoint, and then define handlers for various parameters or subroutes there |
| 15:58 | arrdem | git commit -m "amalloy sees all my flaws" |
| 15:58 | dgaffney | rgr! |
| 15:59 | amalloy | clojurebot: amalloy |sees| all your flaws |
| 15:59 | clojurebot | A nod, you know, is as good as a wink to a blind horse. |
| 15:59 | shiranaihito | arrdem: so like.. that's it then.. no performance improvements for Clojure on the horizon? :) |
| 15:59 | arrdem | shiranaihito: 1.7.0 is projected to have Rich's blessed implementation of static linking, which is rumored to achieve a 10%-15% speedup on par with Oxcart's performance on "normal" (non-benchmark) programs. |
| 16:00 | shiranaihito | oh? sounds good |
| 16:00 | shiranaihito | but that's not related to Vars? |
| 16:00 | justin_smith | dgaffney: in your case, "respond" could disappear altogether (replaced by directly calling the handler wanted for the route), or it could remain as a place where middleware is applied (though you can also apply all the middleware to the route itself) |
| 16:00 | TimMc | Ooh, are we editing blog posts? |
| 16:00 | shiranaihito | roughly how much worse is Clojure's performance compared to Java btw? |
| 16:00 | shiranaihito | (me is still a noob :p) |
| 16:01 | arrdem | shiranaihito: vars are just a binding structure used to achieve dynamic linking and to simplify the compiler. the performance overhead is actually kinda minimal and the interactive development benifits are huge. |
| 16:02 | llasram | shiranaihito: It depends on how you write your code. You can generally achieve exactly the same speed as Java, but usually not with the most idiomatic Clojure |
| 16:02 | dgaffney | justin_smith: I think I'll do something like (respond user-controller/create params) and leave that middleware as a general one - it'll probably just json it anyways. |
| 16:02 | llasram | shiranaihito: In practice you almost always trade the former for the latter (and the associated increase in expressiveness and flexibility)) |
| 16:02 | stompyj | shiranaihito: the way I like ot think about it is, out of the box, its probably the fastest dynamic language you’ll find |
| 16:02 | shiranaihito | arrdem: well.. "dynamic linking" goes over my head :P and i'm still confused about you calling the "< 25%" improvement "minimal" :) |
| 16:03 | justin_smith | shiranaihito: the difference in clojure vs. java runtime performance really depends heavily on what the bottlenecks of your task are - clojure tends to be bad for numerics or CPU-bound tasks, but if your main concerns are keeping threads in sync as you work on pervasively concurrent tasks it can be much closer to java in performance |
| 16:03 | dgaffney | now, here's the other question justin_smith - these four controllers are going to be remarkably similar - what do clojure humans call the practice known as modules in ruby? |
| 16:03 | dgaffney | I guess its just another namespace and you call out to the namespace from user-controller? |
| 16:03 | shiranaihito | llasram: alright.. well, what's the most common performance detriment in idiomatic Clojure? |
| 16:03 | dgaffney | (This clojure thing is winning me over finally, I think) |
| 16:03 | justin_smith | dgaffney: I will often make a higher order function that outputs my controllers in such a case |
| 16:04 | justin_smith | ie. from some code I was just editing now (def culture-detail "construct the culture commentary action" (commentary :culture-detail :culture-detail :culture-filter)) |
| 16:04 | shiranaihito | dgaffney: i'm still new to Clojure too, but convinced that it's the best environment overall :) |
| 16:04 | shiranaihito | well.. relatively new |
| 16:04 | justin_smith | dgaffney: the above returns a new request handler, parameterized on those keywords |
| 16:04 | shiranaihito | stompyj: you're probably right about that |
| 16:04 | dgaffney | cool cool |
| 16:05 | llasram | shiranaihito: I'd guess either extra allocations or lost JIT opportunities via additional layers layers of indirection. Hard to know for sure, and also not worth worrying about |
| 16:05 | justin_smith | dgaffney: where commentary gathers some data from the db and renders a request, and those keys help it find the right data and do the right actions to it |
| 16:05 | dgaffney | alright, I may buzz back in but that helps me get past this block for now! |
| 16:05 | dgaffney | nice - thanks man! |
| 16:05 | stompyj | shiranaihito: I ported one of our data api services from ruby to clojure |
| 16:05 | stompyj | and went from 6 aws boxes to one |
| 16:05 | stompyj | reduced LOC by 20% |
| 16:05 | shiranaihito | llasram: altight.. well, today i was worrying about whether Clojure functions tend to get inlined by the JVM :) |
| 16:05 | stompyj | and tests by 50% |
| 16:05 | shiranaihito | but i guess they do |
| 16:05 | shiranaihito | stompyj: oh? nice :) |
| 16:06 | dgaffney | ooh! One more question. Say I want sub folders in my src/project-name folder - any weirdness there, or can I just make the folder? |
| 16:06 | stuartsierra | Biggest (and easiest-to-fix) performance problem in Clojure programs is reflective Java method calls. |
| 16:06 | dgaffney | i.e. does that sub folder structure have to be mirrored in the code somehow? |
| 16:06 | dnolen_ | justin_smith: most of your statements about Clojure numerics or perf are not accurate - it's really more of question of whether you want to write lower-level code directly in Clojure or not. |
| 16:06 | TimMc | dgaffney: It has to match the namespaces. |
| 16:06 | allenj12 | does anyone know if there is a nth equivalent for the vector type in core.matrix |
| 16:06 | justin_smith | dgaffney: a nested set of folders and a nested set of namespaces should follow one another in structure |
| 16:07 | TimMc | dgaffney: foo.bar-baz.quux lives in src/foo/bar_baz/quux.clj (note the underscore and hyphen) |
| 16:07 | dnolen_ | shiranaihito: there is an optimizable subset of Clojure for people that need it - in some cases it's simpler to just write Java - in other macro code generation is a net win |
| 16:07 | dgaffney | so if we were to throw those controllers, it could look like.. uhh... controllers.user/create? |
| 16:07 | shiranaihito | stuartsierra: so i'm fine if i just "type" function parameters? .. there was something about Leiningen, i think, that helps find the reflective calls.. ? |
| 16:07 | justin_smith | dgaffney: right |
| 16:07 | allenj12 | when i try nth on a vector type in core.matrix it says nth not supported |
| 16:07 | dgaffney | great. Whats the deal with underscore/hyphen? Just 'cause? |
| 16:08 | justin_smith | allenj12: nth is for linear time lookup, why do that to an associative datatype? |
| 16:08 | llasram | justin_smith: Hmmm, not true |
| 16:08 | TimMc | Java doesn't like hyphens in package names, but Clojure prefers it to underscores in names. |
| 16:08 | stompyj | shiranaihito: I left the JVM in disgust and anger about 14 years ago, resolved never to come back, but last year clojure brought me back :) |
| 16:08 | dgaffney | rgr - thanks TimMc |
| 16:08 | technomancy | dgaffney: "just cause" basically yeah |
| 16:08 | technomancy | it's dumb |
| 16:09 | TimMc | (where "doesn't like" = blows up, and "prefers" refers to idioms, not compilation considerations) |
| 16:09 | dgaffney | I'm of the belief that every language being used will eventually have some just 'cause reasons - no biggie! |
| 16:09 | amalloy | justin_smith: nth is O(1) on vectors |
| 16:09 | shiranaihito | stompyj: why so angry? :P .. btw, Java 1.8 is pretty sweet anyway :) |
| 16:09 | allenj12 | justin_smith: o wow im silly should be using .get shouldnt i be |
| 16:09 | hiredman | allenj12: there are, core matrix has specialized functions for 1d and 2d matrices and a general function for more |
| 16:09 | hiredman | allenj12: but I forget what they are, so check the docs |
| 16:09 | stuartsierra | shiranaihito: `lein check` |
| 16:09 | amalloy | stuartsierra: reflection is so easy to fix i'd almost rather say boxed numbers are a bigger performance problem, because i spend hours tracking those down when i care about performance of course, reflection costs much more if left unfixed, but it's easy to fix |
| 16:10 | shiranaihito | ah, thanks |
| 16:10 | stuartsierra | Or `(set! *warn-on-reflection* true)` in the REPL |
| 16:10 | stuartsierra | Then reload. |
| 16:10 | stompyj | shiranaihito: I’m sure java is 1000x better now. Java when it was at 1.1 / 1.2 was a different beast I think :) |
| 16:10 | stompyj | applets were still a thing, and EJBs were the only option for server side stuuff |
| 16:10 | TimMc | stompyj: I came back around 1.5 and was all "WTF is this generics stuff?" |
| 16:10 | amalloy | there's also a flag you can put in project.clj to make it always activate warn-on-reflection |
| 16:11 | amalloy | :warn-on-reflection true |
| 16:11 | hiredman | allenj12: mget is the function you want |
| 16:11 | amalloy | oh, but that's deprecated, so instead you're supposed to say :global-vars {*warn-on-reflection* true} |
| 16:11 | allenj12 | hiredman: ahh kk, |
| 16:11 | stompyj | TimMc: hahahaha, yeah, since my Cloversion(tm) I’ve been checking out Java again |
| 16:13 | TimMc | ™ |
| 16:35 | allenj12 | anyone here use gorrila? im trying to plot two sets of points and a line and its not really coming out right.. not scaled correctly or something |
| 16:41 | SagiCZ1 | allenj12: whats gorrila? |
| 16:42 | allenj12 | SagiCZ1: its pretty cool for like practicing machine learning stuff, its like ipythonnotebook if you know that.. its an editor in your browser that has multiple cells for editing and a nice plotting library |
| 16:42 | amalloy | today, on "Weird things programmers say": "What is gorilla" |
| 16:42 | justin_smith | (inc amalloy) |
| 16:42 | amalloy | lazybot is super-lazy today |
| 16:43 | justin_smith | may not even be on line |
| 16:44 | {blake_} | Brain and brain! What is brain?! |
| 16:47 | justin_smith | 🎶 what is love? 🎶 |
| 17:04 | hiredman | ugh |
| 17:05 | SagiCZ1 | allenj12: cool thanks :) |
| 17:08 | puredanger | I can't believe no one has yet said Wot Gorilla? https://www.youtube.com/watch?v=wootFX07sX0 |
| 17:15 | borkdude | jackjames thanks for recommending emacs prelude, today I switched over |
| 17:16 | razum2um1 | justin_smith: hey! i made this: https://github.com/razum2um/aprint |
| 17:16 | jackjames | borkdude, don't think it was me, because i don't know what that is |
| 17:16 | borkdude | lol ok |
| 17:17 | borkdude | whoever it was then |
| 17:17 | serjeem___ | Is there a generally accepted way to build/document the apis for libraries in clojure? |
| 17:18 | serjeem___ | i'd love something like haddock for the documentation. i'm leaning towards potemkin's import-vars for exposing the api |
| 17:19 | razum2um1 | justin_smith: readabilyty matters, isn't it? |
| 17:19 | justin_smith | serjeem___: one thing that helps is defining a schema for the input / output of the "exposed" functions |
| 17:20 | justin_smith | https://github.com/Prismatic/schema |
| 17:20 | serjeem___ | oh yeah, absolutely |
| 17:21 | justin_smith | there is also autodoc http://tomfaulhaber.github.io/autodoc/ |
| 17:21 | serjeem___ | i'm more concerned with just the namespace layout of the package |
| 17:21 | justin_smith | and codox https://github.com/weavejester/codox |
| 17:22 | serjeem___ | those look great! |
| 17:22 | serjeem___ | thanks :) |
| 17:25 | allenj12 | can someone tell me why this is happening |
| 17:25 | allenj12 | https://www.refheap.com/89817 |
| 17:26 | tac_ | is # length? |
| 17:26 | tac_ | ,#'(1 2 3) |
| 17:26 | clojurebot | #<CompilerException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0:0)> |
| 17:26 | justin_smith | allenj12: split with returns all items for which the pred is true, followed by all items afterward |
| 17:26 | tac_ | guess not |
| 17:27 | justin_smith | allenj12: maybe you want < as your condition |
| 17:27 | allenj12 | justin_smith: it should have a non empty list either way |
| 17:27 | justin_smith | tac #() is a shortcut to create an anonymous function |
| 17:27 | justin_smith | allenj12: absolutely not - the first item returns false, so the first list is empty |
| 17:27 | aperiodic | tac_: it's the reader's macro dispatch character: http://clojure.org/reader (see the bullect labeled "Dispatch (#)") |
| 17:27 | allenj12 | justin_smith: oooo |
| 17:28 | allenj12 | justin_smith: is there a a function that does [(truthy) (falsey)] |
| 17:28 | justin_smith | complement inverts the truth value of a predicate |
| 17:28 | justin_smith | ,(filter (complement even?) (range)) |
| 17:28 | clojurebot | (1 3 5 7 9 ...) |
| 17:29 | hiredman | allenj12: group-by |
| 17:29 | justin_smith | ahh, yeah, that's probably what he's looking for |
| 17:29 | allenj12 | perfect! thanks guys, gonna go eat now |
| 17:31 | hfaafb | partition-by is probably closer |
| 17:31 | hfaafb | v0v |
| 17:31 | hiredman | it depends |
| 17:31 | hfaafb | ah nevermind thats contiguous |
| 17:32 | hiredman | yeah |
| 17:36 | SagiCZ1 | can anyone remind me how the deep map destructuring works? |
| 17:36 | SagiCZ1 | (let [<insert_magic> {:a {:x "deep"} :b 0}] ..) ==> "deep" |
| 17:38 | justin_smith | ,(let [{{x :x} :a} {:a {:x "deep"} :b 0}] x) |
| 17:38 | clojurebot | "deep" |
| 17:38 | SagiCZ1 | thank you |
| 17:38 | SagiCZ1 | (inc justin_smith) |
| 17:38 | lazybot | ⇒ 72 |
| 17:38 | justin_smith | note how symmetrical the destructuring and the map are |
| 17:40 | SagiCZ1 | yep.. nice |
| 17:40 | SagiCZ1 | thats how i can remember it |
| 17:41 | jozi9 | hi |
| 17:42 | danneu | Where is the ring middleware that's responsible for parsing :request-method from <input type="hidden" name="_method" value="PUT">? |
| 17:43 | danneu | my only middleware is compojure.handler/site so i'm surprised it parses it at all |
| 17:43 | hiredman | the name on that is _method, why would it end up as the value in a map for :request-method? |
| 17:43 | hiredman | :request-method in the top level ring map is the http verb for the request |
| 17:44 | hiredman | site adds in a bunch of other middleware that parses and keywordizes stuff |
| 17:44 | danneu | hiredman: yeah, i'm trying to figure out which one does it http://weavejester.github.io/compojure/compojure.handler.html#var-site |
| 17:45 | justin_smith | danneu: your request should have a :request-method key, this is part of ring rather than the middleware I think |
| 17:45 | hiredman | danneu: what makes you think any part does? |
| 17:45 | justin_smith | danneu: since the server has to handle a request differently based on method |
| 17:45 | hiredman | danneu: https://github.com/ring-clojure/ring/blob/master/SPEC#L62-L65 |
| 17:46 | justin_smith | danneu: ie. for a GET, my server has the key / val :request-method / :get in the request map |
| 17:46 | hiredman | danneu: to begin with turning a field with a name _method in to a map value under :request-method is pretty nonsensical |
| 17:46 | danneu | sure, but <form method="put"> isn't going to send a put request |
| 17:47 | justin_smith | hiredman: but some frameworks make a pseudo-method that way |
| 17:48 | hiredman | danneu: so you are looking for a middleware that emulates put requests for forms? |
| 17:49 | danneu | pretty much all frameworks have that middleware |
| 17:50 | hiredman | so are you looking for that middleware to use it, or are you seeing that behaviour and trying to figure out where it comes from? |
| 17:50 | danneu | hiredman: the issue is that is <input name="_method" value="put"> seems to work out of the box, so i'm trying to find the source to see what it expects the override header to be sinc x-method-override doesn't seem to work |
| 17:50 | danneu | in other words, im trying to send an ajax PUT |
| 17:52 | gfredericks | seancorfield: does a new query option (:timeout) for calling .setQueryTimeout on a prepared statement sound like a reasonable addition? |
| 17:52 | hiredman | so you are trying to send an ajax put? |
| 17:52 | seancorfield | gfredericks: sounds a bit edge case-y... |
| 17:53 | danneu | hiredman: yeah. here's an example of how you'd implement the middleware (https://github.com/myfreeweb/ringfinger/blob/master/corefinger/src/main/clojure/corefinger/middleware.clj#L47-L53) - i'm just trying to see if ring has it |
| 17:53 | seancorfield | why not construct the PreparedStatement yourself (and set such options) and pass that into query or execute! |
| 17:53 | seancorfield | Do people really set query timeouts as a matter of course?? |
| 17:53 | lazybot | seancorfield: Definitely not. |
| 17:54 | hiredman | danneu: so you don't really care about the form field at all, you care about this x-method-override header? |
| 17:54 | amalloy | good guess as always, lazybot |
| 17:54 | danneu | hiredman: yeah, but the logical start of my journey would be to track down where the middleware that handles the form field is defined |
| 17:54 | danneu | and i can't even find that so far |
| 17:55 | hiredman | danneu: but you don't really care about x-method-override right? you just want to send a PUT request via ajax? |
| 17:56 | danneu | hiredman: yeah. $.ajax supports GET or POST so for every other framework ive used, the ajax analogue of name=_method' |
| 17:57 | danneu | is that x-method-override header |
| 17:58 | hiredman | danneu: I am pretty sure jquery's ajax stuff lets you do puts |
| 17:58 | gfredericks | seancorfield: I have no idea how common it is; I think there's a lot of duplicate logic involved in creating the prepared statement yourself |
| 17:58 | danneu | hiredman: "Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers. |
| 17:58 | danneu | http://api.jquery.com/jquery.ajax/ |
| 17:59 | gfredericks | seancorfield: what about a generic mechanism for supplying a function to bash on the prepared statement prior to executing the query? |
| 18:01 | danneu | hiredman: https://github.com/weavejester/compojure/blob/e6681da00d6c65231a35130a1dcc4a8c7a1bae7e/src/compojure/core.clj#L14-L22 Oh, so compojure itself does it and it only supports _method in :form-params |
| 18:01 | danneu | seems like ring-core needs a wrap-method-override middleware |
| 18:02 | amalloy | gfredericks: that sorta exists, right? you can call prepare-statement yourself, modify it, and then pass it to query or whatever |
| 18:02 | gfredericks | amalloy: I might be missing something, let me check |
| 18:03 | amalloy | you don't have to do a *ton* of repeated work like preparing the whole thing with raw jdbc; a lot of the stuff in prepare-statement is still useful to you |
| 18:05 | gfredericks | there's some logic around where the connection comes from and whether the connection gets closed in the case of non-transactional use |
| 18:05 | gfredericks | and passing a prepared statement directly to query bypasses that logic |
| 18:06 | amalloy | reiddraper: is there a way to lazily sample a generator, rather than providing a number up front? alternatively, is there a reason that would be a bad idea? |
| 18:06 | hiredman | the connection handling stuff for the non-deprecated bits of jdbc seem to be terrible |
| 18:07 | gfredericks | this stuff here: https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L788-796 |
| 18:07 | gfredericks | amalloy: shouldn't be a bad idea |
| 18:08 | gfredericks | amalloy: it's already lazy it looks like |
| 18:08 | gfredericks | so (gen/sample g Long/MAX_VALUE) if you want :) |
| 18:10 | gfredericks | amalloy: I think it was intended just for repl usage, so an infinite lazy seq isn't an obvious feature |
| 18:10 | amalloy | gfredericks: sure, infinite+lazy is not a good default |
| 18:10 | hiredman | I had this app where I created one derby connection at start up, and everything just used that, and I would randomly get errors because I was using query results or whatever after some resource had been cleaned up, and I was using the new api |
| 18:11 | hiredman | so there was no with-connection or anything to for the seq in side of, and of course the connection was never closed, so who the hell knows what was going on |
| 18:12 | hiredman | I ended up just switching to creating a new connection every operation, because the app is just recording my music listening habits |
| 18:12 | hiredman | but, the lesson is clear, use the deprecated java.jdbc interface |
| 18:12 | hiredman | the new stuff is terrible |
| 18:12 | gfredericks | you can get away with crazy stuff in personal projects; I have an atom that pretty-prints ~1mb to a file every time somebody swaps it |
| 18:13 | gfredericks | hiredman: the new api has something similar to with-connection; it just expects that you're passing it around explicitly |
| 18:13 | seancorfield | gfredericks: so if prepare-statement accepted :timeout you'd be set - you could do (query {:timeout ...} sql params) and it would pass through and work the way you wanted |
| 18:13 | gfredericks | seancorfield: right |
| 18:14 | gfredericks | oh wait |
| 18:14 | gfredericks | no |
| 18:14 | seancorfield | ok, i thought you were asking for changes to query :) |
| 18:14 | gfredericks | I mean |
| 18:14 | gfredericks | yes |
| 18:14 | seancorfield | if the first arg to query is a map, it is passed as named args to prepare-statement internally |
| 18:14 | gfredericks | it is in prepare-statement that the change would go |
| 18:14 | seancorfield | so it's prepare-statement that needs to support :timeout, not query |
| 18:14 | seancorfield | ok |
| 18:14 | hiredman | gfredericks: I was! |
| 18:15 | gfredericks | hiredman: you think the API is a bad idea or the impl is bugg? |
| 18:15 | gfredericks | buggy* |
| 18:15 | hiredman | gfredericks: dunno |
| 18:15 | seancorfield | well (query db-spec options sql params) i think |
| 18:15 | gfredericks | hiredman: okay I'll assume your "lesson is clear" comment was casual then |
| 18:16 | gfredericks | seancorfield: yeah I was assuming there was some way to add options like that |
| 18:16 | seancorfield | it would probably be a good idea for execute! to support an initial map of options argument and treat it the same way |
| 18:16 | hiredman | gfredericks: the whole thing needs to scrapped and rewritten to return things that implement CollReduce instead of seqs anyway |
| 18:16 | hiredman | gfredericks: buggy or a bad api, either way, better not to use it |
| 18:18 | reiddraper | amalloy: gen/sample-seq |
| 18:18 | gfredericks | I've been using it in production for a while without serious issues |
| 18:19 | seancorfield | tell you what gfredericks, create a ticket as a placeholder for expanding options to prepare-statement - I can add :timeout specifically and some keyword arg that takes a function to manipulate the PreparedStatement if you want, and I'll also work on expanding execute! to accept a map of options and pass it through |
| 18:19 | seancorfield | hiredman: I saw your ticket about supporting reducers / transducers... good idea... |
| 18:20 | reiddraper | amalloy: sample is just built with (take n (sample-seq foo)) |
| 18:21 | gfredericks | seancorfield: personally I don't need both :timeout and the manipulation function, just either one |
| 18:21 | seancorfield | as for whether the API is "terrible" or buggy, it's used successfully in production code by a lot of people and a variety of databases |
| 18:22 | seancorfield | patches are welcome for improvements at any time |
| 18:23 | gfredericks | hiredman: I got JDBC-100 |
| 18:23 | gfredericks | (inc seancorfield) ;; for java.jdbc |
| 18:23 | lazybot | ⇒ 14 |
| 18:25 | seancorfield | thanx gfredericks |
| 18:26 | hiredman | seancorfield: sure, and I understand as a maintainer it is frustrating when someone says things don't work without pinpointing what it is because you are completely willing to fix things |
| 18:26 | seancorfield | :) I counted to ten and didn't get angry |
| 18:27 | seancorfield | but, yeah, the idea of creating something more fluent leveraging transducers etc sounds appealing |
| 18:28 | seancorfield | the new API came about because the community wanted it (and so did Clojure/core) and I have to say I'm finding it much easier to work with than the old one... but JDBC is a fussy beast and finding a really clean way to work with it is always a struggle |
| 18:28 | hiredman | maybe I will switch back to a single connection and see if I can track this down |
| 18:29 | seancorfield | I'm curious, hiredman, how do you feel about SQL DSLs in general? (since that seems like a more composable way to go with reducers/transducers but adding a DSL to java.jdbc was rejected by the community and Clojure/core) |
| 18:29 | seancorfield | hiredman: and of course it may also be a quirk of Derby that doesn't show up in MySQL etc (which, heaven knows, has plenty of its own quirks) |
| 18:30 | seancorfield | fwiw, at world singles, we create a pooled datasource (using c3p0) and pass that to every query / execute! / etc and let it do the with-open thing and it seems rock solid |
| 18:31 | cflemin__ | Hi all, does lazybot occasionally forget to archive this channel? |
| 18:31 | hiredman | seancorfield: well, I am not wild about them when I come across them in projects, but I have dabbled a little myself in creating them |
| 18:32 | cfleming | Yesterday's archives are only there till 17:54 |
| 18:32 | dbasch | cfleming: it probably crashed |
| 18:32 | hiredman | seancorfield: I think returning something that implements CollReduce would be orthogonal to how you write the sql |
| 18:32 | cfleming | dbasch: arg |
| 18:33 | cfleming | Ok, thanks |
| 18:33 | seancorfield | hmm, maybe I'll spend some time experimenting with it over the weekend (wife's away so I'll be bored), although I have some documentation to finish for another OSS project I maintain which is higher priority |
| 18:33 | hiredman | we use c3p0 at work too |
| 18:33 | seancorfield | hiredman: will you be at Strange Loop? |
| 18:33 | hiredman | no |
| 18:33 | hiredman | :/ |
| 18:34 | seancorfield | bummer. I was going to suggest we got together for an hour to brainstorm some CollReduce ideas for the API. If you have any suggestions, feel free to add to JDBC-99 |
| 18:35 | hiredman | sure |
| 19:00 | turbofail | you know what'd be really nice? if ranges had a coll-reduce implementation that didn't require materializing a sequence |
| 19:05 | hiredman | there is a jira issue for that |
| 19:05 | hiredman | (and several patches?) |
| 19:06 | amalloy | yes, i wrote it |
| 19:06 | amalloy | rich didn't like any of the versions |
| 19:07 | amalloy | my conclusion is that trying to make reducers also act like lazy sequences is just doomed to fail: you want either a reducer or a seq, and you can't have both |
| 19:11 | turbofail | yeah i can see the issues with that |
| 19:11 | turbofail | still it'd be nice to just be able to reduce over a large range of numbers relatively quickly |
| 19:17 | turbofail | though on further inspection, my experimental RangeColl implementing CollReduce really isn't that much faster |
| 19:22 | amalloy | turbofail: ranges are already chunked, so it's not too slow |
| 19:23 | amalloy | where you actually get some noticeable improvement is if you implement CollFold as well |
| 19:24 | turbofail | ah |
| 19:38 | hiredman | I imagine it also makes a difference if you have a more complex transformation to get rid of intermediate seqs |
| 19:38 | hiredman | instead of just jumping right to reduce with + (which I assume is how everyone benchmarks these things) |
| 19:57 | danielcompton | cfleming: do you have any update on Cursive in IntelliJ 14? Colin T said there's been quite a few API breakages |
| 19:58 | talios | lotso-changes, an IJ-14 build would be lovely tho |
| 19:58 | cfleming | danielcompton: I'm afraid that's pretty much the state of the update. I know a lot of people want this but maintaining a new branch against an unstable API is a lot of work for me. |
| 19:59 | danielcompton | cfleming: has the IntelliJ 14 API not stabilised yet? |
| 19:59 | cfleming | I'm already maintaining 3 (12, 13, 13.1) |
| 19:59 | danielcompton | ouch |
| 19:59 | cfleming | danielcompton: not sure, I haven't looked at it. The issue is that for every release I have to merge all the changes to all the branches and adapt the code. So even if it's relatively stable now it's still more work. |
| 20:00 | cfleming | danielcompton: I figure the longer I can put it off the more stable it will be :-) |
| 20:00 | danielcompton | cfleming: right, are there many people using 12 or 13.1? |
| 20:00 | danielcompton | I mean 12 and 13 |
| 20:01 | cfleming | danielcompton: yeah, there are. |
| 20:02 | danielcompton | darn |
| 20:03 | cfleming | Current stats from the latest version: V12: 507 V13: 775 V13.1: 3434 |
| 20:04 | cfleming | danielcompton: so mostly v13.1, but significant users of earlier versions. |
| 20:05 | danielcompton | Interesting... making compatibility decisions is never fun |
| 20:05 | danielcompton | Although deleting the code afterwards can be |
| 20:06 | cfleming | danielcompton: no, it's not. I'd like to maintain support for older versions since in a lot of corporate settings upgrading is non-trivial (machines are built out automatically using vagrant or the like, and so on) |
| 20:07 | cfleming | danielcompton: I asked on the mailing list a while ago why people hadn't upgraded from 13 to 13.1, and many people just can't |
| 20:07 | danielcompton | cfleming: right. I don't have much experience with that kind of environment, but it makes sense you'd want to support |
| 20:07 | danielcompton | them |
| 20:07 | cfleming | danielcompton: eventually I can probably maintain older versions of Cursive against older versions of IntelliJ, but right now there's only one version so it's merging for me. |
| 20:07 | talios | cfleming - did any say WHY they can't go to 13.1? that wasn't that major a change... |
| 20:09 | talios | cfleming - is the project structures as a cursive-core with each intellij version bridging into core, or just a monolithic project? ( I suppose the IntelliJ AST is quite deeply woven tho.. 0 |
| 20:09 | cfleming | talios: Yeah, partly it was just that a lot of people hadn't gotten around to it, but at least one large client builds all their dev workstations using Vagrant, so devs can't pick their own versions. It's already a pain for them that they have to upgrade Cursive every month or so. |
| 20:10 | danielcompton | cfleming: that's why you have an enterprise version |
| 20:10 | cfleming | talios: It's a monolithic project. It's too hard to break out since the API changes are often not at the top (extension) layer but deep in the details. Or both. |
| 20:11 | cfleming | danielcompton: Hehe, right - I'm tempted! |
| 20:13 | Shayanjm | ping arrdem |
| 20:13 | TimMc | cfleming: Bless you for maintaining compatibility with multiple version. |
| 20:15 | TimMc | especially with apps, which are hella harder to do that with because you have to keep switching context... |
| 20:15 | cfleming | TimMc: Thanks! It's definitely a reasonable amount of work. |
| 20:20 | cfleming | TimMc: Users of older versions tend to suffer more bugs since I can't test as extensively on them, I have to rely more on crowdtesting :-) |
| 20:26 | Bronsa | s |
| 20:44 | danielcompton | What's the recommended way of preventing sensitive information from a record being printed? When I went to add multimethods for print dup and the other one whose name I forget, I found it quite difficult |
| 20:45 | danielcompton | There were quite a few private vars and functions I needed to get at to copy the standard impl for a record |
| 20:46 | hiredman | danielcompton: if someone can call println on your record, why wouldn't they be able to call (println (seq yourrecord)) ? |
| 20:47 | danielcompton | hiredman: I'm trying to prevent a Java Keystore password from showing up in stack traces when the record is dumped |
| 20:47 | hiredman | danielcompton: ah |
| 20:47 | danielcompton | We're using component and if any of the components fail to start then it prints the component map |
| 20:48 | TimMc | yikes |
| 20:48 | danielcompton | Great for debugging, not so great for operational security |
| 20:48 | hiredman | *shrug* dunno, I've never had that set of circumstances |
| 20:48 | hiredman | you could use a deftype instead of defrecord |
| 20:48 | danielcompton | hiredman: do they work with component? |
| 20:48 | hiredman | sure |
| 20:49 | danielcompton | we ended up storing the file path to the password on disk. It's only used once on startup so we just slurp it |
| 20:49 | hiredman | component uses a protocol which a deftype can implement (and the protocol is actually just the default, you can swap it out for multimethods, etc) |
| 20:49 | TimMc | danielcompton: I would make a feature request on component (perhaps with patch) to have whitelisting of things to print (or other customizations. |
| 20:51 | danielcompton | TimMc: it doesn't really seem like a component level problem to me? Could a component alter the print stack trace behaviour? The record could be printed in other contexts too. |
| 21:01 | TimMc | danielcompton: Including program state in the stack trace sure sounded component-specific. |
| 21:02 | TimMc | In general there really isn't a way of systematically ensuring that bits of information don't get printed unless you use a pretty cool type system or something. |
| 21:06 | danielcompton | TimMc: You can override the print multimethods, except that a lot of the useful things you need are private |
| 21:59 | fairuz | Hi guys. I use nginx-clojure as the web server for my clojure web apps. Do I need to generate jar for my web app and put it inside nginx each time I modify something? Or is there anything I can do to just point the source of my web app to nginx-clojure? Thanks |
| 22:15 | justin_smith | fairuz: I don't think many people here use the nginx-clojure plugin to run clojure webapps |
| 22:16 | hiredman | it looks insane |
| 22:16 | hiredman | loading the jvm as a shared library in to nginx |
| 22:18 | fairuz | justin_smith: hiredman: oh ok. What's the web server people usually use? I;m just starting clojure, so trying to catch up on the components needed. |
| 22:18 | justin_smith | fairuz: http-kit standalone, deploy as an uberjar, run with java -jar, then put an nginx reverse proxy in front |
| 22:18 | justin_smith | that's my best bet, at least |
| 22:18 | hiredman | it really depends, I use jetty with various webservers (including nginx) as a reverse proxy in front of it |
| 22:20 | fairuz | oh ok |
| 22:20 | fairuz | I will try out http-kit then |
| 22:21 | seanaway | Just in case there are Reagent users here who aren't in #clojurescript - is there a mailing list (or IRC channel) for Reagent? |
| 22:22 | hiredman | fairuz: I wouldn't bother |
| 22:23 | fairuz | hiredman: with http-kit? |
| 22:24 | hiredman | fairuz: yeah, jetty is very standard, ring comes with a nice jetty adapter, etc |
| 22:24 | seanaway | does jetty support web sockets these days? |
| 22:25 | fairuz | hiredman: I saw lein comes with Ring jetty adapter. This is enough I suppose? |
| 22:25 | hiredman | fairuz: lein doesn't come with anything |
| 22:25 | hiredman | fairuz: lein is a build tool |
| 22:26 | hiredman | fairuz: ring is a specification of a way to model web requests in clojure, it does have a jetty adapter |
| 22:26 | justin_smith | fairuz: you may think of the jetty adaptor that comes with lein-ring |
| 22:26 | justin_smith | fairuz: but one can use ring without the lein-ring plugin |
| 22:28 | fairuz | justin_smith: hiredman: I'm confused now. So it's either I use lein to start a ring server for me. Or I can just ditch lein and put ring as a dependencies for my project, and just start my app from there? |
| 22:28 | justin_smith | fairuz: lein-ring is a plugin that you can use. Ring is a library that runs a web server, that can be run with or without lein-ring |
| 22:29 | justin_smith | for the former, it uses a jetty adaptor if none is provided by you |
| 22:29 | justin_smith | for ring without lein ring, I think you'll need to provide some server that ring can use |
| 22:30 | justin_smith | at runtime, you can either create an app container and deploy an uberwar, or create a standalone (using a built-in container like jetty, or a standalone server like http-kit) |
| 22:31 | hiredman | fairuz: there is a lein plugin that will run a ring app using jetty, but it is strictly a developement thing and you should not use that to run your actual app |
| 22:31 | fairuz | ah ok |
| 22:32 | hiredman | you can package you app as a war file using the same lein plugin which you can deploy to any servlet container (most java webservers) |
| 22:32 | fairuz | hiredman: noted |
| 22:32 | hiredman | you can also add jetty as a depdency then run launch it yourself from within your app |
| 22:33 | hiredman | or use jetty-runner to run the war file as a standalone kind of thing |
| 22:33 | fairuz | But the easiest will be using lein uberjars and just start the standalone jar? (I suppose there's a built-in jetty in there) |
| 22:33 | justin_smith | fairuz: there can be, if you set it up right |
| 22:33 | ddellacosta | hello #clojure |
| 22:34 | ddellacosta | I seek your assistance with getting checkouts working |
| 22:35 | justin_smith | fairuz: but part of why I like http-kit (aside from the websockets and performance) is that instead of launching a container, that then wraps your app, you create the server process as a part of your app |
| 22:35 | ddellacosta | which is to say, I have no idea why it is not working for me. I've got a checkouts dir, installed the lib first, symlinked in the checkouts dir, the versions in project.clj in main project match, etc. |
| 22:35 | ddellacosta | but no dice. |
| 22:35 | justin_smith | ddellacosta: any reason to use a checkout instead of the much simpler "lein install" of the work in progress? |
| 22:35 | hiredman | easiest is hard to quantify, I like jetty-runner and a war file, that is my well traveled rut |
| 22:36 | ddellacosta | justin_smith: that's all I've been doing, and I'm tired of it; I'm running lein install every ten minutes, restarting repl, restarting web app...etc. etc. |
| 22:36 | ddellacosta | justin_smith: I'd love to see my changes get picked up right away. |
| 22:36 | justin_smith | ddellacosta: OK, good luck |
| 22:36 | ddellacosta | justin_smith: I take it you haven't had much luck getting checkouts working either. :-( |
| 22:37 | justin_smith | yeah, I gave up pretty early, because I found lein install reliable |
| 22:37 | ddellacosta | yeah, it is that, I'll concede |
| 22:37 | ddellacosta | just time-consuming. *sigh* |
| 22:37 | justin_smith | ddellacosta: maybe someone else here can tell you exactly how to make checkouts work reliably though :) |
| 22:38 | ddellacosta | c'mon, that was a straightforward hint people ^ |
| 22:39 | justin_smith | perhaps I need to make some sort of unjustified and overstated false claim about how checkouts work, so that the person who knows how to use them will righteously contradicts me |
| 22:39 | ddellacosta | justin_smith: that give me a chuckle. :-) |
| 22:40 | ddellacosta | "actually, checkouts are completely broken unless your dependent projects are all AOT compiled, everyone knows that" |
| 22:40 | justin_smith | without the quotation marks, that may have even worked |
| 22:40 | ddellacosta | heh |
| 22:43 | justin_smith | ddellacosta: I assume you are using require :reload after updating the checked out namespace definitions? |
| 22:43 | ddellacosta | yeah. :-/ |
| 22:44 | dgaffney | Hey everyone! Here's hopefully a question that can get answered easily - what's the simplest way to convert a java.util.Date. to a string that looks like "2014-09-04"? |
| 22:44 | justin_smith | and lein classpath is showing the checkout dirs, and not some jars? |
| 22:44 | ddellacosta | justin_smith: yeah, good question, let me try that |
| 22:45 | ddellacosta | dgaffney: well, it requires installing another lib, but clj-time provides simple ways to do that. https://github.com/clj-time/clj-time |
| 22:45 | justin_smith | ,(subs (pr-str (java.util.Date.)) 7 17) ; dgaffney here's a hack way to do it |
| 22:45 | clojurebot | "2014-09-05" |
| 22:45 | justin_smith | dgaffney: probably better to use a proper Formatter |
| 22:46 | fairuz | thanks justin_smith, hiredman for the inputs :) |
| 22:46 | dgaffney | justin_smith: Thanks - I know that there's a good way to do it, but I want something quick and dirty, as this is the only date as of this time, and shockingly, I don't think it's going to need a whole bunch of that type of stuff in the project. |
| 22:47 | dgaffney | After day one of clojure, it's a super awesome language that lends itself to clean writing, but then I'll turn a corner where I'm like "but but string interpolation" and just have to get used to this way. I like it though! |
| 22:47 | dgaffney | v. v. simple. |
| 22:47 | justin_smith | ,(pr-str (java.util.Date.)) ; dgaffney: just so we are clear on what that is doing |
| 22:47 | clojurebot | "#inst \"2014-09-05T02:46:48.354-00:00\"" |
| 22:47 | dgaffney | mm |
| 22:48 | dgaffney | is string joining not just (join "cat" "dog") |
| 22:48 | dgaffney | ? |
| 22:48 | ddellacosta | &(str "cat" "dog") |
| 22:48 | lazybot | ⇒ "catdog" |
| 22:49 | ddellacosta | dgaffney: join will let you interpolate something |
| 22:49 | justin_smith | ,(clojure.string/join ", " ["cat" "dog" "fish" "ebola"]) |
| 22:49 | clojurebot | "cat, dog, fish, ebola" |
| 22:49 | dgaffney | alright. And with *vars* in there do you wrap a let binding or just slam it in the list? |
| 22:49 | ddellacosta | &(clojure.string/join "-" ["cat" "dog"]) |
| 22:49 | lazybot | ⇒ "cat-dog" |
| 22:49 | ddellacosta | jinx |
| 22:49 | dgaffney | hah! |
| 22:49 | justin_smith | dgaffney: there is format |
| 22:50 | justin_smith | ,(format "%dof%d" 7 9) |
| 22:50 | clojurebot | "7of9" |
| 22:50 | ddellacosta | ,(println "test") |
| 22:50 | clojurebot | eval service is offline |
| 22:50 | dgaffney | ahh nice |
| 22:50 | dgaffney | alright, I got the gist |
| 22:50 | dgaffney | now its off to write this thing that writes out GEXF files |
| 22:51 | dgaffney | this, but in clojure: https://gist.github.com/DGaffney/25d879da9982d8273113 |
| 22:51 | dgaffney | weee. |
| 22:57 | justin_smith | ,(apply format "%1tY-%1td-%1tm" (repeat 3 (java.util.Date.))) ; dgaffney: one liner, no extra libs needed |
| 22:57 | clojurebot | "2014-05-09" |
| 22:57 | justin_smith | dgaffney: you can look up the javadoc for java.util.Formatter for more options |
| 22:58 | fairuz | justin_smith: Just got http-kit running. Looks good. Thanks |
| 22:58 | justin_smith | dgaffney: oh, I had day and month switched, but that should be trivial to sort out :) |
| 22:58 | justin_smith | fairuz: cool, yeah it's not too hard |
| 22:59 | fairuz | justin_smith: The only hard thing is to familiarize myself with clojure syntax itself |
| 22:59 | fairuz | :) |
| 22:59 | justin_smith | eventually, you will miss it when forced to use Algol family languages |
| 23:01 | justin_smith | dgaffney: and please please please use the formatter option if the other option is using that subs hack above :) |
| 23:43 | munderwo | Im trying to start a clojurescript browser based repl following the instructions here https://github.com/clojure/clojurescript/wiki/The-REPL-and-Evaluation-Environments |
| 23:46 | munderwo | but I get a No such namespace: cljs.repl.browser at line 1 src/indifference/core.cljs |
| 23:47 | Licenser | munderwo I fought with the same goal last week :( |
| 23:47 | munderwo | anybody go any ideas what might have changed from when the instructions were written and now? |
| 23:47 | munderwo | awsome! did you work it out? |
| 23:48 | Licenser | I gave up :P |
| 23:48 | munderwo | ahh bugger.. |
| 23:48 | Licenser | took me two days to get something semy working by glueing together 6 different things then I apearently changed something and everything blew up again and I simply surrendered to my incompetence |
| 23:49 | munderwo | i’ve had it working before…. maybe I was using austin |
| 23:49 | munderwo | hmm.. how have you gone using interop with node libs? |
| 23:55 | ddellacosta | argh, we really need better docs for CLJS |
| 23:55 | ddellacosta | munderwo, Licenser: have you checked out Austin? https://github.com/cemerick/austin |
| 23:56 | ddellacosta | munderwo: ah, I see you mentioned that. Yeah, use Austin. |
| 23:56 | Licenser | ddellacosta that I hand't |
| 23:56 | ddellacosta | Licenser: you're not incompetent, the getting-started docs really need some work. |
| 23:56 | Licenser | thanks ddellacosta |
| 23:56 | munderwo | yeah I think I got it working with Austin a little while ago.. now just gotta get it working at that. |
| 23:56 | Licenser | ddellacosta you only say taht because you don't know me :P |
| 23:56 | ddellacosta | Licenser: haha...well, let's just say, I know for sure that we need better docs for getting started in ClojureScript. |
| 23:56 | Licenser | :) |
| 23:57 | ddellacosta | Licenser, munderwo: also take a look at dnolen's posts for some good getting started stuff, if you haven't already: http://swannodette.github.io/ In particular, http://swannodette.github.io/2013/10/27/the-essence-of-clojurescript/ |
| 23:57 | ddellacosta | not repl related specifically |
| 23:57 | munderwo | ddellacosta: the clojurescript repl docs look really nice and clear. But the code is wrong in them AFAICT |
| 23:57 | munderwo | those are good pointers thanks! |
| 23:58 | ddellacosta | munderwo: np |
| 23:58 | Licenser | ddellacosta the starting wasn't so hard but getting emacs + repl + the rest to work nicely was a nightmare |