2012-12-31
| 00:09 | dcb | given two sets of maps, what is the best way to union the sets, but only on a subset of the keys of the maps, i.e., only compare maps for equality on a subset of their keys? |
| 00:28 | tomoj | dcb: you want a seq out? |
| 00:29 | dcb | tomoj: no, the union of the sets, which should be a set. I think I'm going to have to use either core.logic or a datomic query for this. |
| 00:30 | tomoj | that doesn't make sense to me |
| 00:30 | tomoj | call it (fn projected-union [ks & maps]) |
| 00:31 | tomoj | what should (projected-union [:foo :bar] #{{:foo 1 :bar 2 :baz 3}} #{{:foo 1 :bar 2 :baz 4}}) be? |
| 00:31 | technomancy | muhoo: if you replace the :repl profile with a profile that doesn't have nrepl then there's no way for it to work |
| 00:31 | tomoj | #{{:foo 1 :bar 2}} ? |
| 00:31 | dcb | tomoj: hmm right I see what you mean. |
| 00:32 | tomoj | you can't have a set with some modified notion of equality |
| 00:32 | tomoj | I guess you could make maps with a modified notion of equality, but that would almost certainly be a bad idea |
| 00:35 | dcb | tomoj: hmm. you are definitely right, what I originally said doesn't make any sense. I can picture what I mean relationally (like sql), but I'm having trouble putting it in words. I'll ask again if I come up with something more concrete |
| 00:45 | muhoo | technomancy: don't the profiles merge? |
| 00:47 | muhoo | anyway, i beat on it brutally for the last 2 hours, and got it to work, so yay. |
| 00:48 | technomancy | muhoo: additional profiles you specify will be merged |
| 00:49 | technomancy | but if you add one with the same name it shadows the built-in one |
| 00:50 | muhoo | specify? |
| 00:50 | technomancy | otherwise you could never use a different version of nrepl from the one Leiningen uses |
| 00:50 | muhoo | oh, isn't there a ^#merge meta? |
| 00:50 | technomancy | there's ^:replace and ^:displace |
| 00:50 | technomancy | but that only gets applied if there's a conflict inside profile values, not if you shadow a profile |
| 00:51 | muhoo | so maybe i should ask a different question. what profile should i use to have stuff load just when running a repl? |
| 00:51 | muhoo | should i even have a :repl profile, or am i using it not for its intended purpose? |
| 00:52 | muhoo | thanks for answering on a holiday weekend, and apologies if i'm just trying to do something stupid. |
| 00:53 | technomancy | well, there's an open ticket for making this more obvious |
| 00:53 | technomancy | it's a bit opaque currently |
| 00:53 | technomancy | is there stuff you want in the repl but not in other development contexts like tests? |
| 00:54 | muhoo | like, dependencies |
| 00:54 | muhoo | example: i have a bunch of tools i use in the repl, my own stuff, and stuff like handy |
| 00:54 | muhoo | but i do not want those to be transitive dependencies in a released or deployed project, i.e. to a webserver |
| 00:54 | technomancy | gotcha; sure |
| 00:55 | technomancy | typically those would go in the :user profile |
| 00:55 | muhoo | i tried that, and there was some problem with it, i'm not sure i remember what |
| 00:55 | technomancy | that's applied in all projects by default except for when you do jars/uberjars or when running with-profile to pick different profiles |
| 00:55 | muhoo | ok, well then maybe i was in fact misusing the :repl profile. will try :user. thanks! |
| 00:58 | muhoo | :user works, problem solved. thanks again! |
| 01:02 | wingy | clj fucking rocks |
| 01:06 | callen | wingy: you need to eat Indian food. 4rlz. |
| 01:07 | wingy | yeah i will |
| 01:07 | wingy | a lot of meat! |
| 01:07 | callen | meat is gooooood |
| 01:07 | callen | wingy: I made curry chicken last night after I got hungry :P |
| 01:07 | wingy | i have a box full of chicken now .. good for programming long night |
| 01:08 | callen | I'm starving, have a sandwich on the way. |
| 01:12 | wingy | u can just take the mc to castro |
| 01:14 | callen | wingy: nah, food's already otw. |
| 01:15 | callen | plus I'm too grouchy to put up with the cold. |
| 01:22 | frozenlock | I'm having some difficulties with the cljs repl and Chrome extensions... Is there something in how clojure.browser.repl is written that prohibits the REPL from being used as an extension? |
| 01:23 | frozenlock | Every tests I've done works perfecly (alerts, dom manipulations...), but the REPL just won't start: "Uncaught TypeError: Cannot read property 'Af' of undefined " (I guess Af is from the google compiler) |
| 01:33 | Raynes | tomoj: Just rewrote adjacent-to, descendant-of, and child-of in terms of a new generalized function. I added complex enough tests for all of these that I'm pretty sure this one actually works. ;) |
| 01:33 | Raynes | (descendant-of worked before since I told you it worked, but it has been rewritten and now the other functions take arbitrary args too) |
| 01:34 | tomoj | tomoj's tenth rule: Any sufficiently complicated Clojure program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Datomic :P |
| 01:34 | brainproxy | tomoj: :D |
| 01:34 | Raynes | tomoj: You should take a look at the new implementations. I like how it turned out. |
| 01:35 | Raynes | Assuming you care at all. Totally fine if you don't. :p |
| 01:35 | Raynes | But you're the only other person who cares about laser since brehaut isn't here, so I have to be all excited about new things to *someone*. |
| 01:38 | tomoj | it's cool. that's good for me, it means you'll wait till I'm around and tell me when to `git pull` |
| 01:41 | alexbaranosky | is there a way to explicitly indicate which versions of Clojure yor library supports? |
| 01:42 | alexbaranosky | Raynes: make sense to me |
| 01:42 | tomoj | providing lein multi profiles for those versions is pretty explicit to people who read your project.clj, but I guess you want an error if people use the wrong version or something? |
| 01:43 | tomoj | is lein multi outmoded? |
| 01:43 | alexbaranosky | Raynes: if I can find at least one other person that's excited about what I'm doing, in addition to myself, then that is a good day :) |
| 01:44 | alexbaranosky | tomoj: that'd be ideal, but I don't think that exists |
| 01:44 | alexbaranosky | tomoj: lein-multi is out-moded for lein2, but since I mostly still use lein1, I use lein-multi on a ton of projects |
| 01:45 | tomoj | is the reason why (constantly true) vs (fn [result _] result) explainable in a paragraph? |
| 01:45 | Raynes | alexbaranosky: Don't know if he is excited, but he was using it, so close enough. |
| 01:46 | alexbaranosky | tomoj: you mean why use one over the other? |
| 01:46 | tomoj | I mean in laser's descendant-of/adjacent-to/child-of |
| 01:46 | alexbaranosky | tomoj: use constantly true is nice, because it will accept any arg count |
| 01:46 | alexbaranosky | oh I see :) |
| 01:51 | Raynes | tomoj: It's the 'continue?' function. In descendant-of, you want to continue walking up the tree and checking the selector as long as the selector isn't matched and there are still higher nodes in the tree. In the other two functions, you want to stop the first time a selector doesn't match. |
| 01:51 | Raynes | The 'loc' argument might never be necessary, but I added it in case I or anyone else every has some god awful reason for needing it in a similar selector. |
| 01:52 | Raynes | (the loc argument being the one that I used _ for, since it isn't used) |
| 01:52 | Raynes | I was envisioning more complex stopping rules. |
| 01:53 | Raynes | I'll have to implement more selectors to see what I really need there. |
| 01:53 | Raynes | I'll update the docstring on select-walk to explain the arguments. |
| 01:53 | Raynes | (later) |
| 01:56 | tomoj | https://www.refheap.com/paste/09d197a26c467b5a1a891ed5a |
| 01:56 | tomoj | is that right? |
| 01:58 | Raynes | tomoj: Looks right. |
| 01:59 | Raynes | tomoj: You're a confusing man. You used 'Seq Selector' and 'Selector...' both to indicate 'sequence of selectors' |
| 01:59 | Raynes | I got all cross-eyed for a minute. |
| 02:00 | callen | Raynes: he's making everyone go cross-eyed so that nobody can stop him with their poor vision during the world takeover. |
| 02:00 | Raynes | tomoj: Your Haskell-fu is weak. It should have been [Selector] |
| 02:01 | Raynes | On both counts. |
| 02:01 | tomoj | sure, it's a pidgin |
| 02:01 | tomoj | I started typing `Maybe (U Loc (Seq Loc))` here |
| 02:01 | Raynes | Hahaha |
| 02:02 | tomoj | some clojureisms need to be introduced (like ...), and I prefer to stick closer to clojure types |
| 02:02 | tomoj | I guess it would be convenient to have [Selector] denote the type of seqs of selectors |
| 02:03 | tomoj | I also write stuff like `<Bool, Loc> -> Bool` for (fn [result loc] result') :/ |
| 02:03 | tomoj | need to just learn typed clojure's syntax |
| 02:04 | tomoj | actually I kind of like `[Selector]` for vectors of selectors |
| 02:06 | tomoj | Raynes: I meant ... to mean that the function is variadic |
| 02:09 | tomoj | seems odd for lzip/next to do (= :end (loc 1)) |
| 02:09 | tomoj | which is zip/end? |
| 02:10 | Raynes | tomoj: I did not write that one. I copied it from tinsel. |
| 02:10 | tomoj | ah |
| 02:10 | Raynes | So I never saw it. |
| 02:12 | tomoj | what does select do when the loc passed is not the leftmost descendant of its root node? |
| 02:14 | Raynes | tomoj: It kills kittens, probably. |
| 02:14 | tomoj | I tried that when I experimentally made select return Seq Loc |
| 02:15 | Raynes | In all seriousness, it walks post-order, so it'll walk backwards. |
| 02:15 | Raynes | If you start with the top and you walk backwards, you end up in space or some shit. |
| 02:15 | Raynes | There is no actual reason for select to walk post-order, fwiw. I was just so used to doing it by then that it's what my fingers spit out. |
| 02:16 | Raynes | But I added a 'zip' function that you can use to get a thingy from a hickory node/collection of nodes to pass to it or fragment. |
| 02:16 | Raynes | Or document, I guess. |
| 02:33 | tomoj | Raynes: this is more like what I meant https://www.refheap.com/paste/f11c0cf95cb10a330c573a680 |
| 02:34 | Raynes | tomoj: I'm not sure I get what you're trying to communicate. :p |
| 02:34 | Raynes | Oh. |
| 02:35 | tomoj | I just don't understand why it returns Baz |
| 02:35 | Raynes | You're asking |
| 02:35 | Raynes | Okay. |
| 02:35 | Raynes | Give me one moment to process. |
| 02:35 | Raynes | tomoj: is z/next clojure.zip/next? |
| 02:36 | callen | Raynes: you can't look at the ns? |
| 02:36 | callen | oh, you can't |
| 02:36 | callen | derp. |
| 02:36 | tomoj | yeah, it's clojure.zip |
| 02:36 | Raynes | callen: I can not, since he did not put it in the paste. |
| 02:36 | callen | Raynes: yes. |
| 02:36 | Raynes | tomoj: Well, you're starting at the left-most descendant of the root and then trying to move on to the next node but there is no next node. You've hit the bottom, sir. |
| 02:36 | Raynes | So all your next calls are just returning the same thing. |
| 02:37 | tomoj | that does not appear to be the case |
| 02:37 | Raynes | What is the loc that parse gives you? |
| 02:37 | tomoj | the head |
| 02:38 | Raynes | Oh, okay. |
| 02:38 | Raynes | tomoj: In that case, you're walking from the head down to a baz, right? |
| 02:38 | tomoj | https://www.refheap.com/paste/d0d0e06ef322027dd9b597aa3 |
| 02:39 | tomoj | my walk with z/next ends at (first (l/select loc (l/element= :section))) (as the equality in the first refheap shows), which is the section with h2 "Bar" |
| 02:40 | tomoj | then I select (element= :h2) from that loc and get the "Baz" h2 |
| 02:41 | Raynes | tomoj: Well, all select does is walk with lzip/next regardless of what loc you give it. |
| 02:41 | Raynes | So it just walks normally starting from the loc you give it. |
| 02:43 | Raynes | tomoj: Does that answer your question? |
| 02:44 | tomoj | probably, I'm still processing |
| 02:44 | tomoj | I took out the whitespace to make it easier to see what the walk was doing, and the answer changed |
| 02:44 | tomoj | of course.. |
| 02:44 | Raynes | Oh yeah, whitespace is a bitch when you're walking with zip/next. |
| 02:45 | Raynes | It preserves whitespace in textual nodes, so you get that in there. |
| 02:47 | Raynes | tomoj: I've got to take off. If you have any other questions, ping me with them and I'll respond asap. |
| 02:47 | tomoj | well, my questions aren't urgent |
| 02:51 | tomoj | so you have to cut off the top of the tree to do further selects |
| 03:06 | tomoj | I see, if you take the leftmost descendant of the bar section, the loc of the text "Bar", and select h2 from there, you get both h2's |
| 03:06 | tomoj | because it selects from everything after |
| 03:06 | tomoj | if you don't take the leftmost descendant, you just skipped over part of the tree |
| 03:08 | tomoj | have you used xml->? |
| 03:08 | dbushenko | is ckirkendal around here? |
| 03:20 | tomoj | hmm |
| 03:21 | tomoj | oh! |
| 03:21 | tomoj | I was struggling with how :: is hard to read |
| 03:21 | tomoj | with day-of-datomic style .dtm schemas |
| 03:22 | tomoj | {:requires [:some/schema] :tx [...]} |
| 03:22 | tomoj | I realized you could just do {:requires [:some/schema :as s] :tx [{:db/ident :s/foo ...} ...]} |
| 03:23 | tomoj | and just write some function to go resolve the aliases |
| 03:40 | Raynes | tomoj: I have not used xml-> |
| 03:40 | Raynes | Or, well, I have. |
| 03:41 | Raynes | But not really 'used' it for anything. |
| 03:48 | tomoj | it's a preorder walk, (fn descendants [loc]) returns a lazy seq of a locs in preorder. so you do (xml-> loc descendants (class= "foo")). a selector is a function that takes a loc and returns either a loc, seq of locs, or nil |
| 03:49 | tomoj | (there is no class= there but it'd be easy to write..) |
| 03:49 | tomoj | wait, I'm wrong |
| 03:49 | tomoj | selectors can return booleans |
| 03:49 | tomoj | and attr= does so, just like yours |
| 03:50 | tomoj | but the args to xml-> can also return locs or seqs of locs |
| 03:50 | tomoj | if so, the remaining selectors are run starting from {that,those} loc{,s} |
| 03:51 | tomoj | being able to mix selectors and movement seems simpler to me, but it could be I'm just more familiar with data.zip |
| 03:53 | tomoj | and then when you select/move down to a loc or some locs, you still have access to the entire document, and you can perform further select/movement in those subtrees or other subtrees |
| 04:00 | Raynes | It seems pretty unsimple to me. |
| 04:02 | Raynes | tomoj: Could you show me an example of this, or something? |
| 04:04 | Raynes | tomoj: I think I see what you mean. You likely want a clojure.data.zip.xml but for html. |
| 04:05 | Raynes | Laser's select just builds on what is already there in the templating stuff, similar to enlive. |
| 04:06 | Raynes | Deviating much from that = a new library. |
| 04:06 | tomoj | does enlive do postorder? |
| 04:06 | Raynes | *shrug* |
| 04:06 | tomoj | I guess I could try it, I don't understand the code at all.. |
| 04:06 | tomoj | wonder if you have to cut off the tree to continue selecting, as well |
| 04:06 | Raynes | I'm pretty sure enlive's select works exactly the same as mine. |
| 04:08 | Raynes | tomoj: Have you showed me what you're trying to do yet? I don't really have any context in my head for the tree cutting off stuff and what not. |
| 04:09 | Sgeo | http://pastie.org/5601436 |
| 04:09 | tomoj | the refheap earlier showed pretty much what I was trying to do I think, with the two sections |
| 04:10 | Sgeo | Raynes, will refheap ever get Racket syntax hilighting? |
| 04:10 | Raynes | Sgeo: It doesn't have it? |
| 04:10 | Raynes | tomoj: So... you're trying to select the h2 elements? |
| 04:10 | Sgeo | It has Scheme, but not Racket |
| 04:11 | Raynes | Sgeo: Why won't Scheme work? |
| 04:12 | Raynes | Sgeo: There is apparently a racket lexer in pygments. If it isn't on there, it's merely an oversight. |
| 04:12 | Sgeo | You know what would be awesome: If it actually ran Racket to determine the actual colorings |
| 04:12 | Sgeo | So that it wouldn't be just for the Scheme-y Racket languages |
| 04:13 | Raynes | Yeah, whatever pygments does. |
| 04:13 | tomoj | I have a document zipper. and a selector that matches some node inside it, foo. now I want to select foo, then maybe inspect its attributes, save it away in a local, whatever. then I want to select inside foo's descendants with some other selectors. laser can do this, but in order to do the second select, you have to call zip/node on foo, cutting off the rest of the tree above foo (then laser/zip) |
| 04:13 | tomoj | so when you select foo's descendants, you can't navigate back up and inspect anything above foo |
| 04:14 | Raynes | Sgeo: https://bitbucket.org/birkenfeld/pygments-main/src/f6d0af39cb770bb38020107f0f3c6b2d8d5f40a9/pygments/lexers/functional.py?at=default#cl-24 |
| 04:15 | Sgeo | Bah, if I posted #lang planet dyoo/bf code, it wouldn't colorize that properly |
| 04:16 | Raynes | tomoj: Why do you have to call node on foo? |
| 04:16 | tomoj | well, laser/select does that |
| 04:17 | Raynes | Gotcha |
| 04:17 | Raynes | Could have a version that returns locations. |
| 04:17 | tomoj | if you don't (just remove the call to zip/node from select, call this select-locs), then the trouble is that selecting on the leftmost descendant a loc returning by select-locs isn't restricted to the originally selected subtree |
| 04:18 | tomoj | er, s/a loc returning/of a loc returned/ |
| 04:18 | tomoj | so in my example, if you select-locs to the bar section, then select h2 from there, you get both the bar and baz h2's |
| 04:19 | tomoj | (select h2 from the leftmost descendant of the bar section, I mean) |
| 04:19 | Raynes | tomoj: So, a select-loc that does pre-order would help? |
| 04:20 | tomoj | maybe a fix could be to have laser/zip use zipper? to act as lzip/leftmost-descendant on zippers |
| 04:21 | tomoj | and then somehow make the walk stop in the right place? |
| 04:21 | tomoj | I'm not sure you need to switch to pre-order to get that |
| 04:22 | Raynes | Seems like that'd be more complicated than just doing a pre-order walk. |
| 04:23 | Raynes | I don't think there is any real reason to do a post-order walk in select. It is necessary in document and fragment to prevent scanning over elements you inject into the tree and what not. This problem doesn't exist in select, because you're just scanning. |
| 04:23 | Raynes | Which is why I was asking if it'd help. |
| 04:23 | tomoj | I see |
| 04:23 | Raynes | If I'm not following, smack me. |
| 04:23 | tomoj | maybe it would |
| 04:25 | Raynes | You're trying to walk the tree, select a bit, do something with it, and then select on that bit but it doesn't quite work because it doesn't walk from there down, but instead walks upwards through the whole tree. Right? |
| 04:25 | Raynes | Also, I've just discovered I hate talking about zippers. |
| 04:25 | Raynes | They're so hard to think about. |
| 04:26 | tomoj | it seems to walk through everything to the clojure.zip/next of the loc I first select, if I take leftmost descendant |
| 04:26 | tomoj | if I don't, it jumps to the clojure.zip/right |
| 04:26 | tomoj | the latter makes sense to me |
| 04:26 | tomoj | I haven't thought enough about the former yet |
| 04:28 | tomoj | why don't document/fragment/etc just call leftmost descendant? |
| 04:28 | Raynes | No particular reason, I guess. |
| 04:29 | tomoj | laser/zip could be hickory-zip on nodes, the identity on zippers, and also work on seqs of zippers/nodes ? |
| 04:30 | Raynes | I think so, yes. |
| 04:30 | Raynes | Is this related to what we were just talking about? |
| 04:30 | tomoj | yes, because I want to use that without it calling leftmost descendant, if select were preorder |
| 04:31 | Raynes | Oh, yeah, if I made select preorder I'd definitely do some rejiggering. |
| 04:32 | Raynes | fragment and document can call leftmost-descendant afaict. |
| 04:32 | Raynes | I'll play with that tomorrow night. |
| 04:33 | nbeloglazov | Is it possible to use jars in lein that are not in repo (remote or local), local jars. I had about 5 jars that aren't in any repo and I don't want to manually install all of them to local repo. |
| 04:35 | tomoj | hope I'm not keeping you - I'll still be thinking about this for a while tonight, but can save all my thoughts for later |
| 04:44 | Raynes | tomoj: Nah, I'm just messing around. |
| 05:41 | Ralt | how do I place a breakpoint in nrepl? |
| 06:46 | alexbaranosky | man, that is a giant pile of pull requests for Korma, what have I gotten myself into :D |
| 06:53 | borkdude | alexbaranosky just reject a bunch of them, because of your opinion as benevolent dictator? |
| 06:58 | alexbaranosky | borkdude I will in due time <evil/benevolent laugh> |
| 07:18 | tomoj | lol is .lein-classpath a secret? |
| 07:19 | tomoj | oh, it doesn't do what I thought |
| 07:26 | malcolm | does anyone know if there's an 'unparse' capability in Parsley - ie. to render the original string from a parsed representation of it.? |
| 07:35 | malcolm | (in answer to my own question, I don't think there is - but it's easy enough to create a custom version for a specific grammar using multimethods) |
| 08:11 | tomoj | how should as-> be indented? |
| 08:12 | callen | Raynes: threatening people on twitter? tsk tsk. |
| 08:12 | callen | yogthos: cljs. |
| 08:13 | yogthos | callen: heyah |
| 08:13 | yogthos | callen: what about cljs? :) |
| 08:13 | callen | yogthos: needs a template extension. |
| 08:13 | callen | yogthos: I'm futzing around with lein-cljsbuild right now. |
| 08:13 | yogthos | callen: ah that's a good idea |
| 08:14 | callen | yogthos: also Raynes is pimping Luminus on his twitter. |
| 08:14 | yogthos | awesome :P |
| 08:14 | yogthos | callen: http://yogthos.net/blog/32-ClojureScript+Adventures |
| 08:14 | yogthos | callen: things I figured out about cljs so far :) |
| 08:15 | yogthos | callen: btw you have a chance to look at the new setup for the template, is it more of what you were thinking? |
| 08:15 | callen | not yet, was too busy in cljs-land. I can take a look at it after I write a quick PR for lein-cljsbuild. |
| 08:16 | yogthos | callen: yeah that'll be cool |
| 08:16 | yogthos | callen: what did you fix up in lein-cljsbuild? :) |
| 08:16 | malcolm | PR = pull request, not press release, right? |
| 08:17 | yogthos | malcolm: yup |
| 08:19 | callen | yogthos: nothing, just clarifying some documentation. |
| 08:19 | callen | yogthos: you know how I am. |
| 08:19 | yogthos | callen: that's pretty handy too :) |
| 08:22 | cemerick | tomoj: https://twitter.com/cemerick/status/279165823438954496 :-P |
| 08:24 | callen | cemerick: is it bothersome because people will nitpick over contributed code? |
| 08:24 | tomoj | yeah yeah |
| 08:25 | cemerick | callen: what, other indentation schemes? None can be applied statically. |
| 08:26 | cemerick | The thread linked there has the fuller discussion. |
| 08:26 | cemerick | Welcome, all, to the cemerick flamewar hour! :-P |
| 08:26 | callen | cemerick: I know of the thread, I'm just trying to determine the impetus behind this. |
| 08:26 | tomoj | if someone has something to stick in init.el for always-2-spaces, I would try it |
| 08:26 | callen | I just use the default clojure-mode indentation. |
| 08:27 | cemerick | callen: being able to automatically format code without worrying about macros vs. special forms vs. fns vs. whatever other runtime-only considerations might apply in a particular scheme. |
| 08:28 | callen | cemerick: is the varied indentation designed to express intent as to the type of the data? |
| 08:28 | tomoj | hmm, why not 'always prior arg' ? |
| 08:29 | cemerick | The only thing I can see as being a reasonable exception are ns forms. |
| 08:29 | cemerick | callen: I'm not sure I've ever seen a principled argument for the variability. |
| 08:29 | cemerick | tomoj: and have indentation determined by the length of one's fn names in each fn position? |
| 08:30 | tomoj | yes |
| 08:30 | cemerick | or interop method names |
| 08:30 | callen | cemerick: I just constructed one. Enjoy. |
| 08:30 | tomoj | unless you newline after the fn |
| 08:30 | Ralt | hm, people, in Common Lisp, I can use the `break` function, it breaks at some point in the debugger (with slime) and allows me to inspect some variables and stuff. A breakpoint in a debugger, that is. Is there a way to have this kind of stuff with emacs/nrepl? |
| 08:30 | callen | Ralt: https://github.com/pallet/ritz |
| 08:31 | Ralt | yay! |
| 08:31 | Ralt | thanks :) |
| 08:31 | callen | Ralt: hi, I'm a former CL'er too. |
| 08:31 | cemerick | tomoj: that incentivizes people to use shortest-possible fn names, is brutal w.r.t. buffer width otherwise, and produces more irregularity in formatted code than any other option. |
| 08:31 | Ralt | callen: hi :-) |
| 08:31 | cemerick | Probably a net loss for readability. |
| 08:32 | callen | I never had an opinion before, but the status quo sounds good to me. |
| 08:32 | cemerick | callen: formatting variability is never related to the nature of data, only the nature of the thing in fn position (macro, fn, special form, etc) |
| 08:32 | tomoj | it is brutal wrt buffer width, unless you break up the code a bit more |
| 08:32 | Ralt | I have to say, I liked CL parens-only. Clojure is somehow less pretty than CL about this ([], {}, etc). But the ecosystem is just way better. |
| 08:32 | callen | cemerick: still conveys information about the code. |
| 08:33 | tomoj | (or newline before the first arg..) |
| 08:33 | callen | Ralt: I like the varied syntax better myself. |
| 08:33 | Ralt | heh, syntax is a matter of opinions btw :P |
| 08:34 | cemerick | callen: Not sure if it's useful information. Also, it requires a runtime to format code, cannot be applied consistently across projects, etc. |
| 08:34 | cemerick | Again, all things I pointed out in the linked thread. |
| 08:35 | Chousuke | well, clojure's syntax gives you more options options when you're writing macros |
| 08:36 | tomoj | I guess you may be right |
| 08:36 | callen | cemerick: that makes sense. |
| 08:36 | Chousuke | you can use the different data structures for different purposes |
| 08:36 | tomoj | the style guide says prior-arg helps readability so I thought it did |
| 08:36 | Ralt | hm? not sure why |
| 08:36 | tomoj | but trying it out a tiny bit I'm not sure |
| 08:38 | tomoj | I don't think I really care whether it can be applied statically |
| 08:39 | tomoj | giving up automatic indentation when you don't have the code loaded seems not much worse to me than giving up arglist hinting or completion when you don't have the code loaded |
| 08:39 | cemerick | tomoj: I have no data. But insofar as regularity in published text is generally accepted as good w.r.t. readability (e.g. columnation, justification, etc), I presume the same applies to code. |
| 08:40 | tomoj | the irregularity of always-2-spaces is that the first arg is not vertically aligned with the remaining args |
| 08:42 | tomoj | (unless you newline after the fn? do you do 2 spaces there or 0?) |
| 08:43 | tomoj | s/0/1/ |
| 08:44 | cemerick | 2 |
| 08:44 | cemerick | Looks like I'm not consistent w.r.t. newlining after the fn or not |
| 08:46 | tomoj | never much liked the former, but I don't like the latter any better: https://www.refheap.com/paste/c530dd4c1469b1bb5f7dff26a . not very common anyway |
| 08:47 | cemerick | 1-space seems Just Wrong™ in any circumstance. :-) |
| 08:47 | tomoj | vectors? |
| 08:47 | cemerick | no, no, only ever talking about lists in this whole conversation |
| 08:48 | Ralt | emacs has always chosen the right indentation for me. Never had to even think about it |
| 08:48 | cemerick | set, vector, map formatting is regular and standard and easy |
| 08:48 | tomoj | and one "1-space" means there is a space in the same column as the opening paren? |
| 08:48 | tomoj | s/one // |
| 08:49 | cemerick | right |
| 08:49 | cemerick | In the end, I'd rather hew to context-free rules divorced from taste |
| 08:49 | tomoj | small example https://www.refheap.com/paste/b22b32c8f9136dc25ec92f478 |
| 08:50 | tomoj | prior-arg with-open is a bitch |
| 08:50 | tomoj | there's probably worse out there |
| 08:50 | cemerick | Yeah. My code has always looked like the former. |
| 08:50 | tomoj | guess I'll side with you for now :) |
| 08:51 | cemerick | Man, prior arg indenting for let is *really* unpleasant |
| 08:51 | cemerick | My eye assumes that anything even close to column where the binding vector starts is a binding |
| 08:52 | tomoj | ah, indeed |
| 08:52 | cemerick | e.g. "what, the second example is let-binding `if`?!" |
| 08:52 | cemerick | I'm sure warty examples can be found for either option. |
| 08:54 | Ralt | how can I run the -main function from nrepl? |
| 08:54 | Ralt | just (-main) crashes, when I'm in the namespace |
| 08:56 | Ralt | namely, I want to run noir from within the nrepl (and not through lein run) so that nrepl-ritz can handle the exceptions himself. |
| 08:58 | tomoj | crashes? |
| 08:59 | Ralt | hm, it doesn't anymore. the server isn't started either though. |
| 09:00 | Ralt | oh well. Looking into that... |
| 09:05 | Ralt | got it back: unable to resolve symbol -main... |
| 09:05 | tomoj | you're in the wrong ns, or you didn't load it |
| 09:05 | tomoj | you didn't just do (in-ns 'whatever), did you? |
| 09:05 | Ralt | my, I'm gonna get scolded. |
| 09:05 | tomoj | nor just (ns 'whatever) in the repl? you need to load the file |
| 09:06 | Ralt | hahaha, ok |
| 09:06 | Ralt | with (load "~/path/to/file") ? |
| 09:06 | Ralt | googling :) |
| 09:06 | tomoj | you have nrepl.el? |
| 09:07 | tomoj | if not, (require 'whatever) |
| 09:07 | tomoj | for src/foo/bar.clj, (require 'foo.bar) |
| 09:07 | Ralt | thanks |
| 09:07 | Ralt | google told me to use nrepl-load-file |
| 09:07 | Ralt | but it doesn't look like it's working |
| 09:07 | tomoj | ('whatever is a bad example - don't make namespaces with only one segment) |
| 09:08 | tomoj | that should work I'd think, but I haven't switched to nrepl yet, so dunno. good luck :/ |
| 09:08 | Ralt | k, thanks :) |
| 09:08 | tomoj | only thing I think to suggest is to be sure that, if the file says (ns foo.bar), it's in src/foo/bar.clj |
| 09:09 | Ralt | is there a way to see the classpath used? |
| 09:09 | tomoj | unless you overrode the :source-paths |
| 09:09 | Ralt | I'm having some FileNotFound exceptions, trying to find out why |
| 09:09 | Ralt | I didn't |
| 09:09 | tomoj | `lein classpath`, or sometimes when I'm paranoid or in a repl, (System/getProperty "java.class.path") |
| 09:09 | Ralt | oh... wait |
| 09:10 | Ralt | my namespace is my-website.server |
| 09:10 | Ralt | in src/my-website/server.clj |
| 09:10 | Ralt | but it's looking for my_website/server.clj |
| 09:10 | tomoj | yeah.. :/ |
| 09:10 | tomoj | &(munge 'my-website.server) |
| 09:10 | lazybot | ⇒ my_website.server |
| 09:11 | tomoj | (munge '&k) |
| 09:11 | tomoj | oops |
| 09:11 | Ralt | ha. |
| 09:11 | chouser | some jvms can't deal with dashes in class names, so we get to convert dashes to underscores when we hit the file system. |
| 09:11 | Ralt | using nrepl-load-file doesn't seem to work either |
| 09:12 | Ralt | nrepl-load-file itself doesn't throw any error -- looks like the file is correctly loaded |
| 09:12 | Ralt | but when using in-ns + (-main), still the same error. |
| 09:13 | Ralt | chouser: heh, I haven't seen this information anywhere :p |
| 09:14 | Ralt | oh well... I'm too lazy to deal with this right now. And I spent way to much time on it already. |
| 09:15 | Ralt | I'm sure the error is quite stupid, but what's wrong in those 5 lines of code? https://github.com/Ralt/web-account-clojure/blob/master/src/my_website/views/welcome.clj#L25 |
| 09:15 | tomoj | http://clojure.org/libs |
| 09:15 | Ralt | the destructuring part doesn't seem to go well. |
| 09:17 | Ralt | tomoj: thanks :) |
| 09:17 | tomoj | I dunno defpage, but {:as data} looks wrong |
| 09:17 | tomoj | [data]? |
| 09:17 | clojurebot | ,(let [testar (fn [x y] (cond (= (reduce + (filter odd? (range 0 x))) y) (str y " is a")) )] (testar 11 25)) |
| 09:18 | Ralt | oh, that's a function? |
| 09:18 | tomoj | I dunno, but {:as data} never makes sense |
| 09:19 | Ralt | tomoj: tbh, I took the example from here http://www.webnoir.org/tutorials/forms/ |
| 09:19 | chouser | Ralt: you're not using the latest beta of Clojure 1.5 are you? |
| 09:19 | Ralt | (it doesn't use the data symbol, but well.) |
| 09:19 | Ralt | chouser: not AFAIK |
| 09:19 | tomoj | oh, I guess it could make sense |
| 09:19 | chouser | & (clojure-version) |
| 09:19 | lazybot | ⇒ "1.4.0" |
| 09:20 | tomoj | no. nevermind |
| 09:20 | Ralt | yeah, no, using 1.4.0 |
| 09:20 | chouser | Ralt: I came in late. Do you have an exception message? A stack trace? |
| 09:21 | Ralt | yep. Let me get this back up. |
| 09:21 | Ralt | http://localhost:8080 |
| 09:21 | Ralt | oh wai--- :P |
| 09:21 | Ralt | j/k, I get this error: nth not supported on this type: PersistentArrayMap |
| 09:21 | Ralt | line 26/25 in the stack trace |
| 09:22 | chouser | ah, of course |
| 09:22 | Ralt | I knew it! stupid error? |
| 09:22 | chouser | by saying {:as data} you're binding the local 'data' to a map |
| 09:23 | chouser | then on line 26 you're destructuring data as if it were sequential |
| 09:23 | chouser | so on line 26 you might want something like [{:keys [my-salary her-salary total]} data] instead |
| 09:23 | Ralt | oh, got it |
| 09:23 | Ralt | thanks, trying that |
| 09:25 | Ralt | but wait, this works? |
| 09:25 | Ralt | I mean. It's like a statement. |
| 09:26 | tomoj | does '{:as data} ever do something different than 'data ? |
| 09:26 | tomoj | I mean, other than erroring for some values |
| 09:27 | chouser | tomoj: Yes. I've was mistaken about that for a long time myself. |
| 09:27 | tomoj | &(let [{:as foo} '(:foo 3)] foo) |
| 09:27 | Ralt | man, my classpaths are broken... |
| 09:27 | lazybot | ⇒ {:foo 3} |
| 09:27 | tomoj | &(let [{:as foo} [:foo 3]] foo) |
| 09:27 | lazybot | ⇒ [:foo 3] |
| 09:27 | tomoj | ..interesting |
| 09:27 | chouser | whoa |
| 09:27 | tomoj | ah, it's already associative |
| 09:28 | chouser | ah! |
| 09:28 | chouser | hehe. ok. |
| 09:28 | tomoj | I tried a vector first, threw me off |
| 09:28 | Ralt | &(let [foo [:foo 3]] foo) |
| 09:28 | lazybot | ⇒ [:foo 3] |
| 09:28 | tomoj | &(let [{0 foo 1 bar :as baz} [1 2 3]] [foo bar baz]) |
| 09:28 | lazybot | java.lang.Exception: Unsupported binding form: 0 |
| 09:29 | tomoj | uh, you know what I mean |
| 09:29 | chouser | yeah, backwards. :-) |
| 09:32 | Ralt | eff it, I'm giving up. |
| 09:32 | chouser | same error? |
| 09:32 | Ralt | nrepl-ritz-jack-in doesn't even start up anymore |
| 09:32 | Ralt | no, it can't find my files anymore... |
| 09:33 | Ralt | so... I'm going to take a break. :) |
| 09:34 | Ralt | can't find my files = (require) not working anymore, when they worked just fine an hour ago. So I'll take a break, come back and start everything back up. After some git reset. |
| 09:46 | allsystemsarego | Hi all, how can I run a .clj program without leiningen? I couldn't figure this one out just by googling |
| 09:47 | chouser | without leiningen means you get to fetch your dependencies and set your classpath yourself. You really want to do that? |
| 09:49 | allsystemsarego | chouser, yes, I want to understand the inner workings before I start using leiningen |
| 09:51 | chouser | allsystemsarego: Here's how to get a repl without lein: http://clojure.org/getting_started |
| 10:06 | Ralt | alright! |
| 10:07 | Ralt | got the thing working https://github.com/Ralt/web-account-clojure/blob/master/src/my_website/views/welcome.clj |
| 10:07 | Ralt | but it does look ugly :-) |
| 10:07 | Ralt | well, at least I got some concepts straight |
| 10:07 | Ralt | that's the fun of having plenty of errors: you learn :-) |
| 10:09 | Ralt | alright, let's see how I can get cleaner code now... |
| 10:31 | tomoj | wow, (and (= x y) (not (= (into {} x) (into {} y)))) |
| 10:31 | tomoj | x and y are datomic entities |
| 10:31 | tomoj | :/ |
| 10:38 | tomoj | &(let [x [[1 2]] y '((1 2))] (= (into {} x) (into {} y))) |
| 10:38 | lazybot | java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry |
| 10:47 | bpr | tomoj: yeah, datomic is great isn't it? |
| 10:47 | bpr | tomoj: oh i misread your statment lol |
| 11:11 | IceD^ | probably silly question - I want to apply sideeffects on original state of the atom after atom update |
| 11:12 | IceD^ | example: (def foo (atom [1 2 3])) (swap! foo pop) |
| 11:13 | IceD^ | and I want it to println popped value (so I need original value to find out what to print) |
| 11:13 | TimMc | IceD^: Have you looked at watchers? |
| 11:14 | IceD^ | ehm? |
| 11:15 | IceD^ | agents? |
| 11:17 | TimMc | IceD^: http://clojuredocs.org/clojure_core/clojure.core/add-watch |
| 11:19 | IceD^ | it'll add some complexity to my simple code |
| 11:19 | IceD^ | trying to avoid |
| 11:19 | TimMc | It may not be appropriate. |
| 11:19 | IceD^ | well, I can replace vector by set actually |
| 11:19 | TimMc | IceD^: Perhaps what you want is a ref. |
| 11:20 | IceD^ | ok - add-watch - considered. how ref would help me? |
| 11:21 | Ember- | IceD^: with refs you can use STM? |
| 11:22 | Ember- | and dosync |
| 11:22 | TimMc | &(let [foo (ref [1 2 3])] (println (dosync (let [top (peek @foo)] (alter foo pop) top))) (println @foo)) |
| 11:22 | lazybot | ⇒ 3 [1 2] nil |
| 11:22 | IceD^ | make sense. too tired |
| 11:22 | Ember- | STM == transactions |
| 11:22 | Ember- | thus you can do everything in a single transaction |
| 11:22 | Ember- | thus what you are asking is possible if I understood correctly |
| 11:23 | Ember- | thus TimMc's comment about refs is correct |
| 11:23 | Ember- | but that's enough of clojure for now, it's new year's eve |
| 11:23 | IceD^ | atoms are stm as well |
| 11:23 | TimMc | Nope. |
| 11:23 | Ember- | happy new year everyone! |
| 11:23 | Ember- | and no, atoms are not STM |
| 11:23 | TimMc | IceD^: Atoms are uncoordinated. |
| 11:23 | IceD^ | I know |
| 11:23 | Ember- | but now, new year is waiting :) -> |
| 11:23 | TimMc | Ember-: NZ? |
| 11:24 | Ember- | Finland |
| 11:24 | Ember- | 18:14 here |
| 11:24 | TimMc | Oh, I see. |
| 11:24 | Ember- | guests are arriving soon :) |
| 11:24 | TimMc | New Year *party* is waiting. |
| 11:24 | TimMc | Have fun! |
| 11:54 | Sgeo | Is yogthos someone who comes here regularly? |
| 11:54 | citizenparker | Anyone had luck in using lein uberjar with an alternate main argument? I've been trying lein uberjar NAMESPACE with seemingly no luck |
| 11:57 | dnolen | now you can use core.logic for theoretical computer science! :) http://github.com/clojure/core.logic/commit/b46b8c077360095c72eaa00a6a4aa843dc9136ff |
| 11:57 | pepijndevos | dnolen, I seem to remember a POS tagger in core.logic, but I can't find it. Any ideas? |
| 11:57 | dnolen | pepijndevos: hmm, don't recall |
| 11:58 | TimMc | Sgeo: According to my chalogs, more or less. |
| 11:58 | TimMc | *chatlogs |
| 11:59 | pepijndevos | dnolen, what makes core.logic suitable for computer science now? |
| 11:59 | dnolen | Sgeo: Racklog doesn't do Constraint Logic Programming as far as I know. |
| 12:05 | pepijndevos | hm, some nominal binding stuff... very... theoretical. |
| 12:07 | pepijndevos | dnolen, do you think it would be easy to do POS in core.logic? I've been thinking about a system similar to wolframalpha. |
| 12:11 | dnolen | pepijndevos: nominal logic programming lets you reason about abstract syntax, it's very theoretical but very cool. |
| 12:12 | pepijndevos | :) |
| 12:12 | dnolen | Sgeo: Prolog is just a very specific kind of constraint logic programming (unification as the only constraint) + search |
| 12:12 | dnolen | pepijndevos: POS tagger http://skillsmatter.com/podcast/scala/building-the-web-of-data-with-clojure |
| 12:12 | dnolen | pepijndevos: and yes you can do that stuff |
| 12:15 | pepijndevos | dnolen, awesome. I'm ging to keep it simple, with a set of nouns based on the data and some other sentence structures coupled to types of results. |
| 12:21 | Sgeo | Can someone please explain to me if the Clojure page on Facebook uses some kind of algorithm or if it's actually human-curated? |
| 12:23 | terom | I didn't even know that Clojure has a FB page. |
| 12:24 | weavejester | A quick question: is anyone using Ring with Clojure 1.2? |
| 12:30 | TimMc | weavejester: Thinking of removing 1.2 support? |
| 12:32 | weavejester | TimMc: Yep. I'm going to release Ring 1.2 in Janurary, but I was wondering if I should update to Clojure 1.3 to take advantage of the new tools.namespace versions, which are 1.3 and above. |
| 12:38 | Sgeo | I don't know how calling a Racket function that uses keywords would work, though :( |
| 13:30 | svedubois | How I can translate this java line to clojure? |
| 13:30 | svedubois | Image image = subtractimagefilter.execute(image1, image2); |
| 13:35 | svedubois | I suppose is: (-> (new subtractimagefilter)(.execute image1 image2)) |
| 13:40 | Sgeo | svedubois, new would correspond to new in Java |
| 13:41 | Sgeo | Is subtractimagefilter a class or a variable? |
| 13:42 | svedubois | class |
| 13:43 | ToxicFrog | In that case, isn't subtractimagefilter.execute a static method? |
| 13:43 | ToxicFrog | In which case it would just be (subtractimagefilter/execute image1 image2) |
| 13:52 | svedubois | @ToxicFrog: It is not a static method |
| 13:54 | amalloy | svedubois: in that case you're trying to translate java that doesn't work into clojure that does |
| 13:54 | ToxicFrog | svedubois: then how can you call it without an instance of subtractimagefilter to call it on? |
| 13:57 | frozenlo` | Ahhh I hate myself! Spent hours trying to get a REPL working in a chrome extension, only to discover this http://www.mail-archive.com/clojure@googlegroups.com/msg58069.html |
| 13:57 | frozenlo` | Should have used my google-fu before anything else. |
| 14:04 | ppppaul | happy new clojure |
| 14:32 | arrdem | has anyone worked with nested maps using clojure.zip? |
| 14:34 | amalloy | clojurebot: zippers |are| probably not what you want, unless you're already sure you want them: they're great for modifying maps (for certain kinds of access patterns), but usually just get-in and update-in are easier. |
| 14:34 | clojurebot | Ok. |
| 14:35 | amalloy | hiredman: any chance we can get clojurebot to recognize some kind of inline analogue to ~? it'd be convenient to say something like: "arrdem: ~~anyone" |
| 14:39 | arrdem | heh. No, sadly zippers seem to be the best tool for the job here as I'm working with arbitrary ASTs. |
| 14:40 | callen | arrdem: sadly? |
| 14:41 | arrdem | callen: ^sarcasm sadly because it means I have to go learn something new |
| 14:42 | callen | arrdem: zippers are one of those things that are good to know in general because they up your game and give you a new toy to work with. |
| 14:42 | callen | arrdem: so uh, cheer up. |
| 14:42 | callen | arrdem: http://www.youtube.com/watch?v=6c4DJX2Xr3k |
| 14:44 | arrdem | callen: ooh thanks. I was looking for that, good talk. |
| 14:44 | svedubois | I would like to create a destructuring function with different parameters to use different visual effects. I have paste my question here with the code |
| 14:44 | svedubois | https://www.refheap.com/paste/7982 |
| 14:45 | callen | arrdem: does a better job of explaining the "why?" of zippers than other resources I've seen. |
| 14:46 | arrdem | svedubois: looks like you're gonna have to do some argument parsing of your own here. |
| 14:46 | arrdem | I don't think that you're gonna get away just with destructuring. |
| 14:56 | amalloy | you'll also need a general approach that works: the import-inside-defn is nonsense, and 'new is a special form; you can't pass a variable to it |
| 15:00 | aaelony | i have a function that creates a line-seq from a file in an s3 bucket… if the file is too large though, it runs out of memory :( … want to do this in a lazy manner if possible so large files work too… https://www.refheap.com/paste/7983 |
| 15:01 | aaelony | has anyone done this? |
| 15:01 | amalloy | this code doesn't run out of memory. only if you are consuming it in a non-lazy way would that be a problem |
| 15:01 | aaelony | hmm |
| 15:01 | amalloy | well, maybe that's not true |
| 15:02 | amalloy | io/reader on a stream might conceivably slurp it, although i doubt it |
| 15:02 | aaelony | maybe BufferedReader would be better/ |
| 15:02 | aaelony | ? |
| 15:02 | amalloy | io/reader makes a bufferedreader |
| 15:03 | aaelony | if I take say 5000 at a time, in my case, it works |
| 15:03 | aaelony | but would be nice if it were a true line-seq |
| 15:03 | amalloy | huh? it is one. if taking 5000 from it works, then it is lazy, and the nonlaziness of your consuming code is the problem |
| 15:05 | tomoj | are clojure namespaces really in their own little namespace-namespace? |
| 15:05 | aaelony | ok, so i need to repeatedly consume it in chunks? |
| 15:06 | amalloy | i don't know, man. this line-seq will work like a seq in every way, so long as you don't close the input stream before you're done reading |
| 15:07 | tomoj | I mean, e.g. 'aws.sdk.s3 ? I guess it's not that likely to cause conflicts outside of clojure since other languages seem to mostly respect the reverse-domain convention. I'm tempted to go for a 'project-name.core ns, because everyone else is doing it, but.. |
| 15:07 | aaelony | well, closing the input stream is another thorn bug. if it is too large a chunk, I get "Unexpected end of ZLIB input stream" |
| 15:09 | technomancy | tomoj: .core is kind of lame |
| 15:09 | tomoj | aaelony: which stream are you closing? |
| 15:09 | technomancy | if your project name is already segmented, use that instead |
| 15:09 | technomancy | slam.hound |
| 15:09 | tomoj | sure, mine's not |
| 15:09 | tomoj | unless I call it dee.zee |
| 15:09 | tomoj | which would be fine if it means I get to nab :dee/keywords too |
| 15:10 | technomancy | taking the name of an existing service like aws or s3 is in poor taste though |
| 15:10 | aaelony | tomoj: I'm open to changing it, currently it uses (java.util.zip.GZIPInputStream.) io/reader line-seq) … https://www.refheap.com/paste/7983 |
| 15:11 | aaelony | I'm using https://github.com/weavejester/clj-aws-s3, perhaps improperly... |
| 15:11 | tomoj | aaelony: but which stream are you closing? or you're saying just walking through the entire seq produces that error when line-seq tries to close it? |
| 15:12 | tomoj | aaelony: this _may_ be relevant to your interests https://www.refheap.com/paste/bc1e79fa78a0998f516bee34d (emphasis suggests that I'm not sure) |
| 15:13 | amalloy | tomoj: line-seq never tries to close its reader |
| 15:13 | tomoj | oh, I think I see what your problem is - you're closing the stream before finishing? |
| 15:13 | tomoj | right, the reader just closes automatically when it's done? |
| 15:13 | amalloy | no |
| 15:13 | aaelony | tomoj: I'll study your link. I'm not sure what stream I'm using. I'm simply consuming the line-seq via a pmap call. If the line-seq is too big, I get an out of memory error. If I take 5000 at a time and repeat, no errors |
| 15:13 | amalloy | the reader is not closed unless you do it yourself |
| 15:13 | aaelony | maybe I need a with-open in there somehow |
| 15:14 | amalloy | also: just checked the source of line-seq. can't believe it eagerly consumes the first line even if you never seq it |
| 15:14 | aaelony | I'm trying to understand it better, I'm not making eager/lazy claims, but something causes mem issues when it gets large |
| 15:15 | tomoj | :dee.zee/foo I guess. OK. thanks tëchnomancy. seems even more presumptuous but weee |
| 15:15 | amalloy | you're probably hanging onto the head of the sequence somewhere, aaelony |
| 15:15 | aaelony | suppose it is lazy, how can I consume it lazily and avoid mem issues? |
| 15:15 | tomoj | are any lines really really big? :) |
| 15:15 | aaelony | no lines are really big |
| 15:16 | aaelony | what's the best way to avoid hanging onto the head |
| 15:16 | aaelony | ? |
| 15:17 | tomoj | as soon as you create the line-seq, (doseq [line it] ...) or (reduce f init it), or.. anything else that doesn't hold the head :) |
| 15:17 | amalloy | don't keep a reference to it in one place, while you process it in another. eg, don't do: (let [lines (line-seq ...)] (doseq [line lines] ...) (do something else with lines)) |
| 15:17 | aaelony | ah! that's pretty much what I am doing! |
| 15:17 | aaelony | how can I *not* do that? |
| 15:17 | amalloy | type in different code which is not that. too general a question to be answered |
| 15:18 | aaelony | one example? |
| 15:18 | tomoj | (doseq [line (-> .... line-seq)] ...) does not hold the head |
| 15:18 | aaelony | thanks, I'll try that |
| 15:19 | bja | is creating a binding with let considered an acceptable way of getting a "tee" for a sequence? i.e. (fn [r] (let [x r] (flatten (list x r))) (range 10)) => ((0 1 2 3 4 5 6 7 8 9) (0 1 2 3 4 5 6 7 8 9)) |
| 15:19 | tomoj | if you give the line-seq a name, then look at the lexical scope of that name - where throughout your code could you refer to it? |
| 15:19 | tomoj | you will be leaking memory in all of that code |
| 15:19 | aaelony | I've actually seen many places stating "not to hold onto the head" but never seen examples of how not too.. |
| 15:20 | tomoj | (maybe what I just said is too pessimistic because of locals clearing?) |
| 15:20 | aaelony | tomoj: that is helpful, thx |
| 15:20 | amalloy | tomoj: correct, too pessimistic |
| 15:21 | xeqi | bja: just use r in both places ##((fn [r] (list r r)) (range 10)) |
| 15:21 | lazybot | ⇒ ((0 1 2 3 4 5 6 7 8 9) (0 1 2 3 4 5 6 7 8 9)) |
| 15:22 | amalloy | or, at any rate, more pessimistic than necessary. it's never possible to be too pessimistic, when working with computers |
| 15:22 | arrdem | ooh lazybot'll pick out ##(inc 5) |
| 15:22 | lazybot | ⇒ 6 |
| 15:23 | tomoj | so it's actually, what, "the places where you actually do refer to it, plus some places where you could and where clearing didn't help"? |
| 15:23 | tomoj | or just "the places where you actually do refer to it"? |
| 15:25 | amalloy | i don't think any statement so simple can be right all the time |
| 15:25 | amalloy | most of the time, i'd say "the places where you refer to it after starting to consume the sequence" |
| 15:25 | tomoj | well, I'm just wondering where clearing occurs I guess |
| 15:26 | tomoj | it's "pervasive", but that doesn't mean it will always clear a local in a scope in which you don't refer to that local, right |
| 15:26 | tomoj | so you have to worry about all the scopes where you obviously hold, plus the ones where clearing may be failing? |
| 15:26 | amalloy | uhhh |
| 15:26 | amalloy | i don't understand the question |
| 15:27 | tomoj | nevermind, I guess I can fairly easily just write some tests |
| 15:27 | amalloy | what is an example of "a scope in which you don't refer to the local" |
| 15:28 | tomoj | (let [lines (line-seq ...)] (trampoline (fn foo [] (println "blah") foo))) |
| 15:28 | amalloy | anyway, in general locals are cleared the last time you refer to them. so in (let [x 1] (let [y 2] (+ x y))), the x is set to nil before the addition is performed, as soon as its value is gotten |
| 15:29 | tomoj | maybe my example is trivially OK? |
| 15:29 | amalloy | probably |
| 15:29 | amalloy | i always find it entertaining to look at the disassembly for such functions |
| 15:30 | aaelony | in my case, i was definitely holding onto the head. changing that now, thanks, guys :) |
| 15:31 | aaelony | it was something like: (def x (pull-first-sample-data-from-s3 my-bucket)) |
| 15:32 | aaelony | i wonder if (def x (partial pull-first-sample-data-from-s3 my-bucket))) is just as egregious |
| 15:32 | tomoj | it's nice in chrome to be able to track references through the profiler |
| 15:32 | tomoj | wonder if you can do similarly for the jvm |
| 15:33 | tomoj | debugging clojurescript like that in chrome you would have wound up at a reference from x (..of course there is no line-seq there) |
| 15:46 | TimMc | technomancy: lein should reject new projects whose names begin with "clj-". :-/ |
| 15:49 | weavejester | In retrospect I wish I had named clj-aws-s3 differently... |
| 15:50 | weavejester | But I have no problem with clj-time and clj-http |
| 15:51 | amalloy | TimMc: new lein plugin? clj-picky-naming |
| 15:51 | thorwil | clj-no |
| 15:54 | TimMc | amalloy: Needs more jure. |
| 15:54 | amalloy | clj-badname-abjure |
| 15:55 | xeqi | jury-clj |
| 15:57 | arrdem | is there a gg=G equivalent for emacs? |
| 15:57 | hiredman | weavejester: clj-aws-s3 is not very punny |
| 15:58 | hiredman | but I am surprised how often I have to explain the props3t pun |
| 15:58 | aperiodic | (in case you don't know that much vim, arrdem wants to know how to reformat the entire buffer) |
| 15:58 | weavejester | hiredman: I have a lot of repos. Not all of them can be puns :) |
| 15:58 | arrdem | (inc aperiodic) |
| 15:58 | jkkramer | I thought about naming a lib cljwkhtmltopdf the other day |
| 15:58 | lazybot | ⇒ 6 |
| 15:58 | TimMc | j3 |
| 15:58 | jkkramer | for maximum acronym density |
| 16:00 | tmciver | arrdem: C-M-\ reformats region. |
| 16:00 | xeqi | C-x h C-M-\ |
| 16:01 | arrdem | tmciver: thanks |
| 16:08 | uvtc | TimMc: maybe also ones ending in "-clj" |
| 16:08 | uvtc | ? |
| 16:08 | TimMc | yep |
| 16:08 | mabes | arrdem: FWIW, evil-mode does great vim emulation in emacs |
| 16:08 | arrdem | callen: just implemeted a BST with zippers. this is a cool library! |
| 16:09 | uvtc | Though I'm still waiting to find buried-treajure. |
| 16:09 | arrdem | mabes: so I've heard. |
| 16:10 | arrdem | and given how I'm reflexively reaching for <esc> half the time I may resort to it. |
| 16:10 | Raynes | arrdem: Don't *resort* to it. It's perfectly fine to use it. I was an Emacs user that tried Vim and went back to Emacs with evil-mode simply because I enjoy modal editing and text objects. |
| 16:11 | Raynes | It isn't just a way for vim users moving to Emacs to cheat. :p |
| 16:11 | Raynes | It's just a nice way to do things. |
| 16:13 | amalloy | every time i hear Raynes go on about how amazing text objects are, i feel like emacs must be a Blub that i'm trapped in, not realizing i'm missing something clever |
| 16:14 | Raynes | heh |
| 16:15 | arrdem | you guys... it's a joy to hang out here and get good advice from library contributors. |
| 16:15 | TimMc | amalloy: I don't know what you're on about, text functions are clearly the pinnacle of editing. |
| 16:15 | Raynes | amalloy: I mostly just like being able to type '=ab' and have it reindent the form I'm in. |
| 16:15 | amalloy | M-q, son |
| 16:16 | tmciver | amalloy: awesome. Didn't know about that. |
| 16:17 | Raynes | amalloy: Yeah, but it's a general thing. You can do other things with it. |
| 16:17 | Raynes | amalloy: Like, dab = delete current sexp, cib = delete all text in current sexp and go back to insert mode so you can fill it back in. |
| 16:18 | Raynes | Works in strings and what not as well. |
| 16:18 | Raynes | But yeah, most of it likely have regular Emacs counterparts. |
| 16:18 | TimMc | Raynes: uuddlrlrba |
| 16:18 | amalloy | tmciver: when i see someone hitting tab,down,tab,down,tab,down...to reindent a function, i feel like...i can't find the comic i'm thinking of, but it's someone watching, incredibly frustrated, as an old person types "google.com" into the google search bar |
| 16:19 | TimMc | amalloy: I'm sure technomancy can find it. |
| 16:19 | amalloy | good point. i'm only an apprentice in this art |
| 16:20 | tmciver | amalloy: and I feel old having been typing 'C-x h M-C-\' all this time. |
| 16:20 | Raynes | amalloy: I still do that sometimes and then realize I'm an idiot half way through. |
| 16:20 | amalloy | tmciver: well that reindents the whole file |
| 16:21 | amalloy | i feel very meta, searching google for "searching google for google" |
| 16:21 | tmciver | amalloy: yup, but I've been doing that because I didn't realize I could do it with defn granularity. |
| 16:23 | amalloy | ah, http://i.imgur.com/6ETb4.gif is what i was thinking of |
| 16:26 | Raynes | amalloy: http://stackoverflow.com/questions/14105546/why-can-i-not-access-my-leiningen-dependencies-with-clojure-code/14106115 |
| 16:26 | Raynes | amalloy: Does :include actually work? O.o |
| 16:26 | amalloy | yeah, i think refer has include/exclude |
| 16:26 | Raynes | Interesting. |
| 16:26 | Raynes | Also, syntax quoted. Hah. |
| 16:31 | bmaddy | I'm using crate to create dom nodes in cljs. Does anyone know of a good way to put raw html in there? I'd like to do something like this: (crate/html [:div "<span>foo</span>"]) |
| 16:33 | bmaddy | Oh, the problem is that crate seems to escape the html, so I get < in there. |
| 16:43 | gfredericks | hmmm; I feel like that used to work for me |
| 16:43 | gfredericks | maybe the escapement is a recent change; but I'd expect recourse for your use case |
| 16:43 | gfredericks | like a (raw ...) |
| 16:45 | tomoj | technomancy: so if I made a ns slam.keys, am I stepping on you? I'm not really asking whether you plan to use that ns, but whether you've effectively claimed slam.* by creating slam.hound |
| 17:01 | TimMc | slam.dunk |
| 17:02 | Raynes | TimMc: crowed.goes.wild |
| 17:02 | Raynes | crowd, even |
| 17:04 | tomoj | &(namespace 'foo/foo/foo) |
| 17:04 | lazybot | ⇒ "foo/foo" |
| 17:10 | tomoj | would it be so bad to have ::f/foo read to :f/foo when it doesn't resolve? |
| 17:11 | TimMc | yeah |
| 17:11 | TimMc | A bit too much magic. |
| 17:11 | tomoj | I can see it being bad if you forgot to alias and now you have this weird keyword you didn't expect instead of an error |
| 17:12 | gfredericks | ,:f/foo |
| 17:12 | clojurebot | :f/foo |
| 17:12 | tomoj | how about if you have to (binding [*allow-unresolvable-keywords* true] ...) |
| 17:12 | gfredericks | oh right |
| 17:12 | amalloy | tomoj: that's not possible |
| 17:12 | tomoj | why not? |
| 17:13 | gfredericks | amalloy: could enable it for explicit calls to the reader? |
| 17:13 | amalloy | oh sure, if you were using the reader manually, which i guess you would be |
| 17:14 | tomoj | yeah, the use case is say you're trying to read a .clj file which uses :: |
| 17:14 | tomoj | actually there you could maybe just only read the ns decl if you e.g. modified slam.hound |
| 17:14 | arrdem | herm... I'm getting an "equal arity" exception using destructuring for the argument cases [x [y z]], [x [y]]. How should I be doing this? |
| 17:15 | tomoj | I was thinking of .edn files which have only one form, and that form tells you how to resolve the :: contained in it |
| 17:16 | tomoj | so the first time you read you just want to ignore any :: errors |
| 17:17 | bbloom | tomoj: should as Bronsa about it |
| 17:17 | bbloom | ask* |
| 17:17 | bbloom | him and i were talking about dynamic vars to control namespace alises |
| 17:18 | bbloom | maybe there could be a dynamic var that resolves a keyword.. (defn ^:dynamic resolve-keyword [qualified? namespace name] ...) |
| 17:18 | tomoj | like a data reader |
| 17:19 | bbloom | yeah |
| 17:19 | tomoj | I've considered #k :alias/foo or something |
| 17:19 | tomoj | but that's two too many characters :P |
| 17:20 | tomoj | and you lose the qualified? distinction unless you have two tags |
| 17:21 | tomoj | I guess the tag would only be used for qualified |
| 17:22 | tomoj | :: breaks slamhound, naturally I suppose |
| 17:22 | bbloom | tomoj: double colon isn't part of edn apparently :-P |
| 17:23 | tomoj | makes sense I suppose |
| 17:23 | tomoj | I was thinking just use one colon and do manual resolution, but #db/fn etc make that inconvenient - need to bind special data readers which do the resolution before proxying to the original reader |
| 17:24 | tufflax | About vim-foreplay: "With Leiningen 2, it connects automatically based on target/repl-port, otherwise it's just a :Connect away." I don't really get this. I'm using lein 1.7. What do I need to do to use nrepl with foreplay? |
| 17:24 | tomoj | ..or I'll claim dz.* and use :dz/foo |
| 17:24 | amalloy | tpope: a user is in need! |
| 17:24 | tufflax | :p |
| 17:24 | arrdem | lol |
| 17:24 | amalloy | although, tufflax: upgrade to 2.x. 1.x is pretty ancient |
| 17:25 | citizenparker | ragtime |
| 17:25 | tufflax | amalloy, yeah maybe that's a good idea |
| 17:25 | TimMc | amalloy: "ancient" |
| 17:25 | amalloy | despite there still (i think?) not being a 2.0 |
| 17:25 | citizenparker | Ignore that last comment, please. =) |
| 17:27 | arrdem | amalloy: correct. we're still on 2.0.0-PREVIEWs |
| 17:27 | amalloy | callen: there's no need for smug/holy wars in here. vim is perfectly usable, and people have emacs questions all the time |
| 17:28 | callen | amalloy: I'm actually a dual-user, although my actual coding happens in Emacs. Won't pass up an opportunity to pick on a minority though. :) |
| 17:28 | tomoj | datomic and codeq make it look not so bad by using :db/fn, :tx/commit, :repo/uri, etc |
| 17:29 | callen | are there any CMSs or blog engines in Clojure yet? (not static site generators) |
| 17:29 | tomoj | :com.datomic.codeq.repo/uri |
| 17:29 | tomoj | :'( |
| 17:29 | arrdem | callen: ... I built one off of ibdknox's Noir-blog |
| 17:30 | callen | arrdem: sounds like I'd better make a post-noir one. |
| 17:30 | arrdem | callen: yeah. my blog (the abovementioned hack) is still 1.2.2 Noir. |
| 17:31 | arrdem | should fix that. |
| 17:32 | callen | arrdem: well it'll give me a good way to shake out the new changes to Luminus anyway. |
| 17:32 | tomoj | on one hand I feel like this is a minor problem, since it's just convenience. on the other, it seems like the utility of namespaced keywords (especially in the context of datomic, where a conflict is a big fucking problem) are diminished by people naturally going for convenience anyway |
| 17:33 | tufflax | If I do :Doc reverse in vim-foreplay, I get an error. But, how do I copy that error? :p Can I see that thing that foreplay brings up as a buffer? |
| 17:33 | arrdem | callen: lemme know if/when you get such a post-noir CMS booting... I confess to having gotten lost in Ring when I tried to do a new post-noir site in the last 72 |
| 17:34 | callen | arrdem: fair warning, I'll be meddling with some weird shit. Good news is, I've actually spent a decent chunk of my professional life implementing CMSs. |
| 17:35 | callen | so this is fully within my specialties, haha. |
| 17:35 | tomoj | sure, I can use a separate db when I clobber :repo/uri in my own project. ?! |
| 17:35 | arrdem | haha. no worries, I just want to read through a full ring site. who knows, I could learn something else new XD |
| 17:36 | yogthos | callen: yeah this is a good plan, making a site will help figure out how to move the template forward ;) |
| 17:38 | tufflax | Hm, "Unsupported escape character: \U" what's \U? And why do I get that error in vim? :P |
| 17:38 | tufflax | (Clojure reader says it) |
| 17:39 | amalloy | &(read-string "\Usdfsdf") |
| 17:39 | lazybot | java.lang.RuntimeException: Unsupported escape character: \U |
| 17:40 | tufflax | yeah but what is \U? I guess my vim put's it into the string that's sent off for evaluation or something |
| 17:40 | tufflax | s/put's/puts |
| 17:41 | ToxicFrog | Unicode? \U1234 for codepoint 0x1234, maybe? |
| 17:41 | amalloy | well, that's supposed to be \u |
| 17:41 | chouser | Unescape for a regex? |
| 17:41 | amalloy | eh? |
| 17:41 | callen | yogthos: are you simply permanently around like I am or do you have a flag set for luminus? |
| 17:42 | amalloy | is that \Q and \U? i thought it was \Q and...something else, like |
| 17:42 | yogthos | callen: haha just happened to look in and saw you guys talking about it :) |
| 17:42 | yogthos | callen: I just leave the client on in the background now |
| 17:43 | chouser | amalloy: you're right, I'm wrong. It's \Q and \E |
| 17:43 | yogthos | callen: btw finally figured out how I want to go about the templating business, without overlaps |
| 17:43 | amalloy | whew. you had me convinced, because i couldn't think what the other one was |
| 17:43 | yogthos | callen: I think stuff like +bootstrap will simply add the extra files, but then I'll have these site templates, where it's a batteries included business |
| 17:43 | amalloy | i was like...\R? that doesn't make any sense except in that r is after q |
| 17:44 | yogthos | callen: it could have users, authentication, common stuff like that and leverage bootstrap and whatever for it |
| 17:44 | yogthos | callen: then if you just want the js/css or database definition you can grab those and then roll your own thing easily |
| 17:45 | callen | yogthos: sounds promising. If you don't already, you might want to consider having a persistent IRC session. They're incredibly useful. |
| 17:45 | callen | particularly because it means having a /lastlog worth a damn. |
| 17:46 | yogthos | callen: yeah I should set that up :) |
| 17:46 | callen | yogthos: I've been a permanent resident of GNU Screen for a decade, myself. It takes 1 minute to get rolling. |
| 17:46 | callen | I use that with mosh for the actual connection. |
| 17:46 | yogthos | callen: yeah screen is pretty awesome |
| 17:46 | callen | I don't use screen in the 1,001 ways some other users seem to, but it serves a very real need. |
| 17:47 | yogthos | it's very handy indeed |
| 17:48 | arrdem | er... I just managed to make my EMACS core.clj buffer r/o. halp? |
| 17:49 | arrdem | C-x C-q. got it. |
| 17:51 | callen | Hate that shortcut. |
| 17:55 | arrdem | C-x C-l is the one that's killing me, 'cause I'm trying to C-c C-l to reload my core.clj |
| 17:59 | Raynes | yogthos: Note that that latest release is apparently not promoted because clojars is lying and saying it isn't signed. https://clojars.org/lib-noir |
| 18:00 | tpope | tufflax: still in need? |
| 18:00 | Raynes | I can't fix it until technomancy sees what I said in #leiningen. |
| 18:00 | yogthos | Raynes: ok cool thanks for the heads up |
| 18:00 | Raynes | Is yogthos your clojars username? |
| 18:00 | yogthos | yup :) |
| 18:01 | yogthos | same tag everywhere makes it easy :) |
| 18:01 | Raynes | yogthos: You can release now. Just make sure you sign releases (or use lein deploy clojars). |
| 18:01 | yogthos | Raynes: sure let me try |
| 18:02 | Raynes | yogthos: Well, there isn't anything to release. |
| 18:02 | Raynes | :p |
| 18:02 | callen | Myself and another managed to bug abaranosky into fixing the release tagging/clojars for Korma. |
| 18:02 | callen | so if that's been bothering you as much it has me, it'll be fixed soon. |
| 18:02 | yogthos | Raynes: yeah good point :) |
| 18:02 | Raynes | I already released that new stuff, it just didn't get promoted because clojars is a liar. |
| 18:02 | callen | I think he's a little overwhelmed at the moment though. He should've checked the pull requests before accepting responsibility :P |
| 18:02 | yogthos | lol |
| 18:03 | Raynes | yogthos: Anyways, in the future, feel free to release whenever you want as long as we've reviewed changes together. Obviously we'd want to talk about releasing any major versions increments or anything. |
| 18:03 | Raynes | O |
| 18:03 | yogthos | Raynes: yeah that sounds like a plan, I definitely want a second pair of eyes for anything I release :) |
| 18:03 | yogthos | Raynes: I'm exceptional at missing stuff :P |
| 18:03 | Raynes | I am pretty wild with third segment version increments. |
| 18:04 | Raynes | I release a new version of laser every 10 seconds when I add something new or change something small. :p |
| 18:04 | Raynes | Of course that'll slow down when it is more complete and stable, but still. |
| 18:04 | yogthos | Raynes: haha that's how I usually do it :) |
| 18:05 | yogthos | Raynes: I actually ran out of pre 1.0 versions on my pdf lib that way before it was mostly bug free :) |
| 18:05 | yogthos | went with a x.x.x scheme and just kept releasing :P |
| 18:05 | Raynes | Much to callen's chagrin, I rarely tag releases. |
| 18:06 | Raynes | I actually wrote a leiningen plugin for doing it too, so I'm just a lazy asshole. |
| 18:06 | yogthos | lol if it can be automated it's computers job! :P |
| 18:06 | yogthos | lazy programmers are best programmers :P |
| 18:06 | Raynes | yogthos: I'm so happy to be working with you on lib-noir. <3 |
| 18:06 | callen | I concur. |
| 18:07 | callen | Raynes: there isn't much that isn't to my chagrin. |
| 18:07 | yogthos | Raynes: yeah I'm having a blast, it's a lot more fun than doing solo projects |
| 18:07 | yogthos | Raynes: and we seem to have a really good thing going :) |
| 18:09 | yogthos | Raynes: oh btw I'm squeezing a lot of juice out of newnew with multimethods :) https://github.com/yogthos/luminus-template/blob/master/src/leiningen/new/luminus.clj |
| 18:10 | Raynes | Wow, that's all pretty cool. |
| 18:10 | yogthos | I think I finally found a fairly legit use for them :) |
| 18:10 | tufflax | tpope, yes. When I run for example :Doc reverse without an nrepl, I get the error java.lang.RuntimeException: Unsupported escape character: \U (from the clojure reader) and when I have connected, the nrepl says "user=> Exception in thread "nREPL-worker-1" java.lang.NullPointerException". I'm on Windows btw. |
| 18:10 | tpope | tufflax: I was wondering when I'd get my first windows user |
| 18:11 | tufflax | :p |
| 18:12 | tpope | I'm unsurprised it didn't work, but the \U failure in particular is ... odd |
| 18:12 | tufflax | Hm yeah, I have no ideas myself :p |
| 18:12 | callen | Raynes: it merited the cleverness, I saw the infernal pit of despair the templating was headed for |
| 18:12 | tpope | guess I'll need to boot up the old vm |
| 18:12 | yogthos | Raynes: I should add a template for laser next :) |
| 18:13 | callen | Raynes: that's why I backed off after making some quick fixes, I wanted to muse about it. |
| 18:13 | gfredericks | "I wish I could see something that clojure did that was really fundamentally different than what I could do with C++ and templates." |
| 18:13 | tpope | tufflax: if you do cqp1<CR>, does that fail too? both ways |
| 18:14 | yogthos | yeah I think the main limitation is that templating is done by file, so you can't share a common file between multiple templates and add to it |
| 18:14 | yogthos | but that kind of a template would be a whole different kind of animal |
| 18:14 | Raynes | callen: What are we talking about? |
| 18:15 | yogthos | Raynes: we tried to get clever and have a progressively built template, like you make a base site and then you slap bootstrap on top and then db |
| 18:15 | callen | ^^ that. |
| 18:15 | yogthos | Raynes: but then you run into these cases that 2 templates have the same file and both need different stuff in it |
| 18:15 | Raynes | It's really just hard to build something that will be perfect for everyone. |
| 18:16 | callen | Raynes: yes/no, it depends on how you look at the problem. |
| 18:16 | yogthos | my compromise now is to not have anything overlapping and then provide top level templates which provide more functionality |
| 18:16 | callen | Raynes: package management is a mostly solved problem, for all practical purposes. |
| 18:16 | Ember- | Happy New Year everyone! |
| 18:16 | tufflax | tpope, yes in the same way |
| 18:16 | Ember- | it's been 2013 for one hour here now |
| 18:16 | yogthos | still got 6 hours to go here :) |
| 18:17 | tufflax | ...as :Doc |
| 18:17 | callen | Ember-: с новом годом! |
| 18:17 | Ember- | callen: Finland, GMT+2 during winter, GMT+3 during summer |
| 18:17 | callen | Ember-: sorry, I've been learning your enemy's tongue. |
| 18:17 | Raynes | callen: For fun, here is where someone completely rewrote lein-newnew https://github.com/Raynes/lein-newnew/pull/54 |
| 18:17 | yogthos | haha |
| 18:18 | Ember- | callen: swedish? |
| 18:18 | Ember- | or russian |
| 18:18 | Raynes | I haven't merged it because I haven't had time to look it over and understand it, and I really don't want to break everyone's templates. |
| 18:18 | Ember- | they are both our fierce adversaries! |
| 18:18 | callen | Ember-: I just spat Russian at you. |
| 18:18 | yogthos | well that was new year in russian :) |
| 18:18 | Ember- | callen: ah, my bad. I just saw ? |
| 18:18 | yogthos | mostly correct :P |
| 18:18 | Ember- | it's due to the fact that my client doesn't speak UTF-8 for now |
| 18:18 | callen | yogthos: is was perfectly correct so I thought :( |
| 18:18 | Ember- | it will change soon though, changing my server soon |
| 18:19 | Ember- | and when I do that I also upgrade stuff like that |
| 18:19 | bmaddy | gfredericks: in case you were interested, it looks like others were having that same crate/escaping issue that I was: https://github.com/ibdknox/crate/issues/12. |
| 18:19 | yogthos | callen: would be с Новым годом |
| 18:19 | yogthos | callen: one letter off :P |
| 18:19 | callen | so close. |
| 18:19 | Raynes | yogthos, callen: I would welcome any changes you guys would like to make to the existing templating stuff that would be backwards compatible and we could probably get it in before the final release of lein 2. I think we'd have to wait until the next major version of lein for backwards incompatible changes, or we'd have to require that people add the updated plugin on the top of the old one (you've seen the "Did you just tell me to go fuck myself?" |
| 18:19 | Raynes | comic). |
| 18:19 | callen | yogthos: Вы русский? |
| 18:20 | yogthos | callen: yup |
| 18:20 | Ember- | I'm sensing an evil russian yogthos |
| 18:20 | yogthos | Ember-: :) |
| 18:20 | Ember- | I'm sending our Winter War Veterans to smite you! |
| 18:20 | callen | yogthos: Я счастлив! I'm learning because I love Russians and Russian culture. |
| 18:20 | Ember- | fortunately for you, most of them are dead and the rest are holding canes while walking |
| 18:20 | tpope | tufflax: can you open a github issue? I can't get into it this very second |
| 18:20 | yogthos | better not send this guy :P http://en.wikipedia.org/wiki/Simo_H%C3%A4yh%C3%A4 |
| 18:21 | Ember- | hehe, that one is a one tough son of a bitch |
| 18:21 | yogthos | callen: I still speak fluently, but my writing proficiency leaves a lot to be desired :P |
| 18:21 | yogthos | Ember-: yeah that's pretty impressive ;) |
| 18:22 | Ember- | same military rank during the war as mine currently |
| 18:22 | tufflax | tpope, ok |
| 18:22 | Ember- | although, corporal is soooo misleading |
| 18:22 | Ember- | sergeant would be more accurate in many ways |
| 18:22 | callen | Ember-: you serve in the finnish military? |
| 18:22 | Ember- | I served, like 95% of Finnish males |
| 18:22 | Ember- | mandatory military service for 6 months to one year |
| 18:22 | yogthos | Raynes: I'm going to keep playing around and building stuff around it for now, and we'll see if anything generic enough to merge in falls out of it :) |
| 18:23 | Ember- | I served for a year |
| 18:23 | callen | Ember-: makes sense, given such a land-hungry neighbor next door. |
| 18:23 | Ember- | yeah, that's the main reason :P |
| 18:23 | yogthos | hehe |
| 18:23 | Ember- | we have an army of 500 000 men |
| 18:23 | callen | Raynes: I tend to be of the same mindset. I don't eagerly reify things into libraries/genericisms until it comes naturally. |
| 18:23 | Ember- | sure, not as many working at the military |
| 18:24 | callen | Ember-: I didn't know your country even had that many people. |
| 18:24 | Ember- | but when we call the reservers, we get those 500k at the borders etc |
| 18:24 | Ember- | 5.3 million currently I think |
| 18:24 | Ember- | or maybe 5.4, dunno |
| 18:25 | Ember- | I know few russian guys who live in Finland currently |
| 18:25 | Ember- | all of them are superbly great guys |
| 18:25 | Ember- | but of course they are - they live in Finland |
| 18:25 | Ember- | rest of the russian people are jerks |
| 18:25 | Ember- | ;P |
| 18:25 | yogthos | haha that's why I moved, jk :) |
| 18:25 | Ember- | where do you live then |
| 18:25 | Ember- | ? |
| 18:26 | yogthos | Toronto, Canad |
| 18:26 | yogthos | a |
| 18:26 | Ember- | ah, cool |
| 18:26 | Raynes | Under your bed. |
| 18:26 | yogthos | ROFL! |
| 18:26 | Ember- | not as cool as Finland |
| 18:26 | Ember- | but cool still ;P |
| 18:26 | yogthos | actually it's one of the milder places in canada |
| 18:26 | yogthos | cause we have the lake next to us |
| 18:26 | Ember- | yeah, it's +2C here in Helsinki currently |
| 18:26 | yogthos | about the same here |
| 18:26 | Ember- | unusually warm new year's eve |
| 18:27 | yogthos | when I lived in new brunswick we got serious winters there |
| 18:27 | Ember- | but we've had unusually cold december |
| 18:27 | yogthos | I think currently it's 40cm snow :) |
| 18:27 | Ember- | we have over 70cm here |
| 18:27 | Ember- | in Helsinki |
| 18:27 | yogthos | epic snow |
| 18:27 | Ember- | if it hasn't melted today that much (which I seriously doubt) |
| 18:28 | Ember- | ah, I once thought I'd go abroad |
| 18:28 | Ember- | after all, I'm educated, have an educated wife and speak english pretty much fluently |
| 18:28 | Ember- | but alas, here I am |
| 18:28 | Ember- | :) |
| 18:28 | yogthos | I moved around quite a bit, now I'm getting lazy :) |
| 18:29 | Ember- | I'm making pretty good money currently, sure I'd make more in US but then again, living expenses are also WAY more there |
| 18:29 | tpope | |
| 18:29 | Ember- | so no financial needs to move |
| 18:29 | yogthos | I did like like living in europe though, I was in prague for about 3 years that was fun |
| 18:29 | Ember- | prague is nice |
| 18:29 | tpope | I don't know how or why I sent that blank line |
| 18:29 | Ember- | I've only lived in Finland, but my brother lived 3 years in UK |
| 18:30 | yogthos | how'd he like it? I've heard very mixed reviews |
| 18:30 | Ember- | well, exactly that |
| 18:30 | Ember- | he loved some things and *hated* many others |
| 18:30 | Ember- | like the overly bureacratic society |
| 18:31 | Ember- | like, in order to get a pay check you need a bank account. Ok, that's reasonable enough |
| 18:31 | Ember- | but in order to get a bank account you need a gas bill |
| 18:31 | Ember- | ??? |
| 18:31 | lazybot | Ember-: How could that be wrong? |
| 18:31 | Ember- | wtf |
| 18:31 | Ember- | you needed a gas bill to prove that you are living in UK |
| 18:31 | yogthos | that's kind random |
| 18:31 | yogthos | kinda even |
| 18:31 | Ember- | what if you happened to live in an apartment which wasn't using any gas? |
| 18:32 | Ember- | well, my bro was living in one using gas, so no problem there but still |
| 18:32 | callen | it's a good thing Germans have a fetish for privacy. |
| 18:32 | callen | Otherwise they'd be like the UK |
| 18:32 | Ember- | it took 3 months until he got single pay check due to the fact that the gas company sent bills once in three months... |
| 18:32 | yogthos | germany is on the list of countries I'd move to :) |
| 18:32 | Ember- | how insane is that? |
| 18:33 | Ember- | and soooo many other things which are just *wierd* in UK |
| 18:33 | yogthos | yeah that's epic, I guess douglas adams wasn't exaggerating about that :) |
| 18:33 | yogthos | he even made a game on the subject :) http://en.wikipedia.org/wiki/Bureaucracy_(video_game) |
| 18:33 | Ember- | but then again, many things are way better than in Finland |
| 18:33 | Ember- | but in the end, he wanted to come back |
| 18:34 | callen | Ember-: what was better? |
| 18:34 | callen | about the UK > Finland, that is. |
| 18:34 | Raynes | yogthos: Figured out the issue and got the release promoted. |
| 18:34 | Ember- | bigger country, bigger possibilities |
| 18:34 | oskarth | *joining in* how is prague compared to say, berlin? |
| 18:34 | yogthos | Raynes: what was it? |
| 18:34 | Raynes | yogthos: I had to add my public pgp key to my profile. |
| 18:34 | Raynes | On clojars. |
| 18:35 | yogthos | oskarth: haven't been to berlin, but vienna was nicer in my opinion |
| 18:35 | yogthos | Raynes: ahh |
| 18:35 | Ember- | oh, vienna |
| 18:35 | Raynes | And apparently you have to hit a 'promote' button. |
| 18:35 | Ember- | *that* is a city I'd like to live in |
| 18:35 | callen | Ember-: I really love being an American. |
| 18:35 | Raynes | So I guess it didn't need to be promoted yet anyways. |
| 18:35 | Raynes | *shrug* |
| 18:35 | yogthos | Raynes: I should keep that in mind next time I release stuff |
| 18:35 | Raynes | I don't know how any of this clojars crap works these days. |
| 18:35 | oskarth | yogthos: vienna was nicer than prague? how were they different? (been to vienna but not prague) |
| 18:35 | Ember- | callen: my only visit to US was in the JFK while flying to Mexico |
| 18:35 | callen | Ember-: Biiiiig country, wide selection of cultures to indulge in. Lots of career opportunities. |
| 18:35 | callen | Ember-: you should take a vacation here at some point. |
| 18:36 | Ember- | your rule of having to check in to your country even when you are just in transit is just STUPID |
| 18:36 | Ember- | wtf, really |
| 18:36 | Ember- | WTF |
| 18:36 | callen | Ember-: terrorism stuff, we don't like it either. |
| 18:36 | Ember- | we had to queue in passport line for like 2 hours |
| 18:36 | callen | Ember-: we're all very grumpy about our TSA. |
| 18:36 | Ember- | and almost missed our flight |
| 18:36 | yogthos | oskarth: I thought vienna felt more grand, cleaner, just overall seemed like a really cool city, can't really put it to any specific thing |
| 18:36 | oskarth | i see |
| 18:36 | Ember- | but I do want to visit US for real |
| 18:37 | yogthos | oskarth: that said I still think prague is pretty nice overall |
| 18:37 | Ember- | my friend had a smoke in NY just for the reason he had to be in that friggin' queue for t2h |
| 18:37 | oskarth | (from stockholm, currently in nyc but have to go back, thinking about moving to berlin or prague or something similar) |
| 18:37 | oskarth | yogthos: cheap I imagine? how is the internet / "expat" community? |
| 18:38 | Ember- | prague is cheap considering "western" standards |
| 18:38 | yogthos | oskarth: definitely cheaper, but I was there almost 10 years ago so kind of outdated info wise |
| 18:38 | yogthos | and I gotta run here guys, dinner calls :) |
| 18:38 | oskarth | I see, thanks anyway :) |
| 18:39 | Ember- | but if you're living in there, then your paycheck is according to local expenses |
| 18:39 | Ember- | naturally |
| 18:39 | callen | yogthos: cheers. |
| 18:39 | oskarth | Ember-: true, but... remote work |
| 18:39 | Ember- | yogthos: and beers |
| 18:39 | callen | Ember-: unless you'r---what oskarth said. |
| 18:39 | yogthos | callen: probably gonna be back soon anyways... Ember-: and definitely beers :P |
| 18:39 | yogthos | cheers all |
| 18:39 | oskarth | cheers |
| 18:39 | Ember- | ah, I think I need to head for bed soon |
| 18:39 | Ember- | my wife is already brushing her teeth |
| 18:40 | Ember- | it's 1:30 here |
| 18:40 | Ember- | have huge amount of beer, whisky, wine, mexican tequila and stuff |
| 18:40 | Ember- | but a wise man does not open any of those at this hour when our guests have left :P |
| 18:41 | Ember- | I bid you farewell for the night and wish you all a very pleasant new year! |
| 18:42 | Ember- | it's 2013 folks, the year Clojure will break through and kick some major ass! |
| 18:42 | Ember- | :P |
| 18:42 | callen | Ember-: cheers. |
| 18:42 | Ember- | night -> |
| 18:43 | Frozenlock | Ember-: Isn't clojure already kicking asses? :P |
| 18:44 | callen | Frozenlock: depends on your expectations. It's serving a lot of startups well. Some people want to see it go mainstream. I'm ambivalent myself. I care about the onboarding experience of noobies, but I don't care to cater to corporate interests. |
| 18:47 | arrdem | well, I've been clojuring since July and that onboarding experience is pretty well covered :) |
| 18:49 | svedubois | Is it possible to write this in other way, without repeating image? |
| 18:49 | svedubois | (.getWidth image) |
| 18:49 | svedubois | (.getHeight image) |
| 18:49 | svedubois | (.getDepth image) |
| 18:49 | arrdem | (doto image (.getWidth) (.getHeight) (.getDepth)) |
| 18:49 | Frozenlock | will doto return a seq? |
| 18:50 | arrdem | neg. |
| 18:50 | arrdem | map would be inappropriate... |
| 18:50 | arrdem | herm. |
| 18:50 | arrdem | Frozenlock: speak o great one. |
| 18:50 | Frozenlock | for? |
| 18:50 | clojurebot | for is not used enough |
| 18:50 | arrdem | ,(doc for) |
| 18:50 | clojurebot | "([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], ... |
| 18:51 | svedubois | arrdem the output it is not the same |
| 18:51 | oskarth | ,(doc doto) |
| 18:51 | clojurebot | "([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))" |
| 18:52 | arrdem | svedubois: correct. I'm n00bing over here ignore me. |
| 18:55 | svedubois | Whith (.getWidth image) I obtain a number |
| 18:56 | svedubois | But with (doto image (.getWidth) (.getHeight) (.getDepth)) I obtain the information about image (all the information, not only the numbers of ...) |
| 18:58 | arrdem | svedubois: Okay. doto evaluates the argument forms eagerly for side-effects, then returns the first argument, a (presumably modified) object. |
| 18:58 | amalloy | java methods aren't first-class, so that's not easy to do |
| 18:59 | amalloy | you could do something like (for [f [(memfn getWidth) (memfn getHeight) (memfn getDepth)]] (f image)), but...really that's more work, not less |
| 19:00 | svedubois | amalloy it works with "for" |
| 19:01 | callen | arrdem: hence the nomenclature...doto. |
| 19:01 | arrdem | callen: right. I was attempting to explain for svedubois's benifit since he seemed to have missed the ,doc fest. |
| 19:01 | callen | arrdem: I know, I was making an amused note. :) |
| 19:02 | arrdem | XP yay being wrong in channel! |
| 19:09 | arrdem | amalloy: herm... so what'd I do wrong here? https://www.refheap.com/paste/7987 |
| 19:09 | amalloy | well try macroexpanding it and see |
| 19:10 | amalloy | though i suppose this might be messed up enough that it refuses to macroexpand |
| 19:10 | arrdem | hehe when I macroexpand (fnmap 1 [toString]) I get a load of gensyms from the (for) that's pretty unreadable. |
| 19:11 | amalloy | well, macroexpand-1 |
| 19:12 | arrdem | yeah... the -1 isn't right at all. foo. |
| 19:12 | amalloy | the main problem is your #() lambda is totally wrong |
| 19:12 | amalloy | everything else is mostly fine, although not the way i'd write it |
| 19:14 | amalloy | try calling #(quote (memfn %)) on a symbol and see what you get out. poke on that until it does what you want, and then the macro will work |
| 19:15 | arrdem | would you approach this via the for, or would your gut be to generate (list (.foo a) (.bar a) (.baz a)...)? |
| 19:15 | amalloy | i suppose either one is fine |
| 19:15 | ravster | hello everyone |
| 19:15 | callen | ravster: hi! |
| 19:15 | amalloy | well, i certainly wouldn't generate (.foo a) |
| 19:16 | amalloy | but (. a foo) would be fine |
| 19:16 | ravster | is there a command I can use in nrepl.el that will allow me to call the previous output? |
| 19:26 | scottj | ravster: other than M-p in the repl? (just guessing, haven't used nrepl.el) |
| 19:26 | gtrak | try *1 |
| 19:28 | gtrak | http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/*1 |
| 19:35 | ravster | sweet, *1 is awesome. thanks gtrak |
| 19:36 | callen | man I can really wile away the hours when I read. Anybody in here read a good book lately? This seems like a good crowd to ask, although I have plenty in my queue. |
| 19:37 | gtrak | taken a look at the clojure bookshelf yet? |
| 19:37 | callen | gtrak: actually, I was one of the first people to ask Hickey to enumerate his recommended books. |
| 19:37 | callen | gtrak: so yes, I've taken a look. I was hoping for something more unrelated yet appropriate. |
| 19:38 | gtrak | fogus put out a reading list recently, blogs and papers and things |
| 19:39 | callen | Saw that too. Still looking for something a little more out there. |
| 19:39 | callen | I'd be willing to make an aggressive guess at the intersection between Fogus and dnolen's reading lists. |
| 19:47 | gfredericks | in the future will pre/postcondition assertion errors have ex-data? :/ |
| 19:48 | arrdem | amalloy: okay. this works but comments https://www.refheap.com/paste/7988 |
| 19:48 | gtrak | and risk breaking all the the code that relies on them?! :-) |
| 19:49 | gtrak | arrdem: map map is a lot like map comp |
| 19:49 | gfredericks | gtrak: :'( |
| 19:49 | gfredericks | hopefully core.contracts will... |
| 19:51 | arrdem | gtrak: that's cute! thanks XP |
| 19:52 | amalloy | arrdem: well, of course it's not terribly easy to read. more importantly you are multiply-evaluating the input object: try (fnmap (do (println "computing...") 10) [toString hashCode]), for example |
| 19:52 | gtrak | gfredericks: oo I didn't know that existed! I wonder if he's thought about introspection? That sort of thing would be useful to me at this very moment. |
| 19:52 | amalloy | i would address both of those problems by writing it as https://www.refheap.com/paste/7989 |
| 19:53 | dcb | arrdem: not sure if your looking for suggestions, but (apply vector (map ...)) can be replaced with mapv |
| 19:54 | arrdem | ~@ ? |
| 19:54 | clojurebot | @ is splicing unquote |
| 19:54 | amalloy | i just had a funny idea. instead of ##(let [sym (gensym 'obj)] sym), i suppose i could write ##(let [sym '`obj#] sym), couldn't i? |
| 19:54 | lazybot | (let [sym (gensym (quote obj))] sym) ⇒ obj126350 |
| 19:54 | lazybot | (let [sym (quote (quote obj__126339_... ⇒ (quote obj__126339__auto__) |
| 19:54 | amalloy | &(let [sym `obj#] sym), i guess |
| 19:54 | lazybot | ⇒ obj__126371__auto__ |
| 19:55 | arrdem | ~~@ |
| 19:55 | clojurebot | I forgot that ~paste is gist.github.com |
| 19:55 | gtrak | clojurebot: what are you talking about? |
| 19:55 | clojurebot | Huh? |
| 19:55 | arrdem | clojurebot lies like a rug |
| 19:58 | arrdem | amalloy: so the ~@ unquotes the for, but how is it splicing the quoted dot? |
| 19:59 | rlb | fwiw, I just tried lib-noir using the lein plugin mentioned here (http://yogthos.net/blog/33-Moving+to+Compojure), and "lein ring server" throws an exception (though it still works): "No X11 DISPLAY variable was set, but this program performed an operation which requires it". In this case, the message is accurate (it is running headless), and the server still works. |
| 19:59 | amalloy | splicing the quoted dot? |
| 20:00 | weavejester | rlb: You can set :ring {:open-browser? false} in your project.clj file |
| 20:00 | gtrak | rlb: I would guess it's the code that starts a browser |
| 20:00 | weavejester | rlb: Or run lein ring server-headless |
| 20:00 | weavejester | Which will probably become lein ring server :headless in some future version |
| 20:01 | rlb | ahh, ok, thanks |
| 20:01 | arrdem | amalloy: nvm got it. cute! I didn't know about ~@. |
| 20:02 | arrdem | amalloy, gtrak dcb thank you for entertaining this asside. |
| 20:07 | technomancy | it throws an exception when it can't open a browser? =\ |
| 20:10 | gtrak | weavejester: got a question for you, how do I separate the args-binding to the capturing of route definitions? It's sometimes annoying when things fall-through, like a route def "/:id" not matching "/3/5" |
| 20:11 | weavejester | gtrak: I'm not sure I completely understand you. Do you want to change how keywords match? |
| 20:11 | gtrak | In this case, I would want the handler to throw an exception or something instead of falling through and returning nil. |
| 20:12 | weavejester | gtrak: e.g. (GET ["/:id" :id #".*"] [id] …) |
| 20:12 | weavejester | gtrak: Throw an exception? Why would you want to do that? |
| 20:13 | gtrak | To know that anything under a certain path is being handled by the relevant handler, to escape the 'some', I guess. |
| 20:14 | weavejester | How would you determine the difference between a route that doesn't match, and a route that should generate an exception? |
| 20:15 | weavejester | And I'm not sure an exception is the right solution. |
| 20:15 | gtrak | exception is more a stand-in for arbitrary code for the sake of example. I would want to ensure a route matches things, to prevent other routes from matching. |
| 20:16 | callen | gtrak: you realize that what you're asking for is highly ambiguous, yes? |
| 20:16 | callen | gtrak: you can match partial versions of the routes and throw your own exceptions. I'm a little dubious of trying to inject some tricky behavior somewhere in-between simply matching a route and returning 404. |
| 20:17 | gtrak | inject isn't what I'm looking for, decouple, rather |
| 20:17 | gtrak | I will try to grok that regex syntax, it might work for me |
| 20:17 | callen | gtrak: you could add middleware that handled this |
| 20:18 | weavejester | If the routes have a common prefix, you could group them together and add a 404 for if the prefix doesn't match |
| 20:18 | weavejester | The regex syntax just gives you the ability to change the way route parameters match |
| 20:19 | weavejester | So: (GET ["/user/:id" :id #"[0-9]+"] …) |
| 20:19 | weavejester | Would match /user/1 and /user/9 but not /user/foo |
| 20:25 | gtrak | the way I've been doing it thus far is by just using wildcards, is there a function or something I can call to parse params out of a string once I've done that? I' |
| 20:25 | gtrak | I'm staring at clout/core.clj and it seems to be all bound up in the CompiledRoute record |
| 20:28 | gtrak | for example, I'd want to write something that takes a Uri-encoded string as a param, if it has a slash in it, I'd like to kick back an error, but keep that logic within the same handler. |
| 20:30 | gtrak | * is pretty ok, but I'm wondering if there's a better way to deliberately prevent control-flow at that point. |
| 20:32 | weavejester | gtrak: That's kinda beyond the scope of clout. It just matches routes; it doesn't determine whether a part of a route is correct |
| 20:32 | weavejester | But you can generate an exception within the route itself |
| 20:32 | weavejester | Or pass it to a function with preconditions. |
| 20:37 | gtrak | hmm, yes, wrapping it in something might do the trick, I could possibly create wrappers around the compojure verb macros to steal the matching logic. |
| 20:37 | gtrak | it's just so darn convenient, I want to use it for everything :-) |
| 20:37 | weavejester | gtrak: Be careful you don't resort to macros too soon. You can do a lot with functions. |
| 20:38 | weavejester | Also, exceptions are for exceptional circumstances. I'm not sure errors in input data count. You may want to return the correct response status code instead. |
| 20:40 | gtrak | this is more relevant for development, like preconditions, and that's how I mean to use it |
| 20:40 | gtrak | be able to say things like, any input that matches x.. needs to be handled by this handler now, not any other. |
| 20:41 | weavejester | gtrak: You might be making your routes too "fat" |
| 20:41 | weavejester | In my view, routes are there to match URIs, and to filter data from the request |
| 20:42 | gtrak | they are quite fat, but it seems avoiding it makes it worse so far. |
| 20:42 | weavejester | If you did something like... |
| 20:42 | weavejester | (GET "/:id" [id] (get-id id)) |
| 20:42 | weavejester | (defn get-id [id] {:pre …} ...) |
| 20:44 | gtrak | Right, like I said, in my example, that whole thing will be skipped if there's a slash in the URI, unless I did a wildcard. The checks should be on the outside of the route, ensuring that it never returns nil if it's really supposed to match a path. |
| 20:44 | weavejester | Well… that sounds like an unusual use-case. Usually if you give a web server a bad path, it's a 404. |
| 20:45 | weavejester | Throwing an exception if there's something wrong with the path sounds a bit wrong. |
| 20:46 | gtrak | hmm, maybe wrong in the http sense. |
| 20:51 | gtrak | in our case, it would return a 500 by our default exception handler middleware, which is better than the information provided by nil. Upon seeing it, we could decide what to do. As of now, I have to speculate what happened and insert print statements where I think things might have gone wrong. |
| 20:57 | Raynes | We almost made it to 8000 pastes by years end in central time. |
| 20:57 | Raynes | We are 9 refheap pastes away, guys. |
| 20:57 | Raynes | Quick, find shit to paste. |
| 20:57 | gtrak | of course I agree that in the end-product, the user should never see that error, it should be handled tastefully, but given how much variance there is in implementation over http, I'm not sure saying that '404 is the right response' is always applicable. |
| 20:58 | gtrak | Raynes: your server says Jan 1 already! |
| 20:58 | Raynes | It lies! |
| 20:58 | Raynes | That is peculiar. It should be PST... |
| 20:59 | amalloy | Raynes: are you still on heroku? |
| 20:59 | Raynes | Oh. Duh. |
| 20:59 | Raynes | I'm returded. |
| 21:00 | Raynes | I should outsource my time. |
| 21:00 | Raynes | To crisis. |
| 21:00 | Raynes | Anyways, too late now. |
| 21:00 | Raynes | Didn't make it to 8k, technically. |
| 21:00 | tomoj | hmm, but it's jan 1 in neither central nor pacific |
| 21:00 | tomoj | UTC? |
| 21:00 | Raynes | *shrug* |
| 21:01 | tpope | heroku config:set TZ=America/Los_Angeles |
| 21:01 | tomoj | M-x refheap-paste-region-private |
| 21:01 | tomoj | C-u 1001 C-x C-z |
| 21:01 | tomoj | uh |
| 21:02 | tomoj | C-x z I mean |
| 21:02 | Raynes | Yeah, don't do that. |
| 21:02 | tomoj | :D |
| 21:02 | Raynes | Isn't worth it. |
| 21:03 | Raynes | penumbra:refheap raynes$ heroku run date +%Z |
| 21:03 | Raynes | Running `date +%Z` attached to terminal... up, run.1905 |
| 21:03 | Raynes | UTC |
| 21:03 | callen | is there a more reliable non-Amazon alternative to Heroku out there? |
| 21:03 | Raynes | tomoj: ^ |
| 21:03 | Raynes | callen: Openshift maybe? |
| 21:03 | callen | Raynes: because I have to confess, even though dev-ops is one of my knacks in my day job, I don't like doing it for side projects if I can avoid it. |
| 21:04 | callen | maybe pallet could change my mind, but I'd rather reserve my willpower for code. |
| 21:04 | Raynes | openshift is less easy than Heroku to set up. |
| 21:04 | Raynes | But it might be better. |
| 21:04 | callen | the issue with openshift is that it's no different than my own dev-ops stuff |
| 21:04 | callen | the effort to integrate it and amortized efficiency would be identical to me doing my own typical stuff. |
| 21:05 | tomoj | what do you bind to refheap-paste-*? |
| 21:13 | hyPiRion | Happy new year from all of Europe :) |
| 21:19 | cemerick | callen: you can deploy source repos via elastic beanstalk these days, too |
| 21:20 | tomoj | I despise js that automatically selects all every time I click in a textarea |
| 21:20 | p_l | seconded |
| 21:20 | p_l | it plays hell with Xselection |
| 21:22 | tpope | yes |
| 21:22 | tpope | bitbucket can go fuck itself |
| 21:22 | cemerick | Raynes: are you shoving off of heroku for refheap? |
| 21:23 | cemerick | tpope: ? |
| 21:23 | cemerick | Whoa, synchronicity. |
| 21:24 | tpope | cemerick: the way it autoselects the repo url makes it impossible to copy to the primary selection on linux |
| 21:25 | cemerick | Please tell me there's a tertiary selection. That'll end 2012 nicely. |
| 21:26 | tpope | all I know of is primary and clipboard |
| 21:26 | tpope | but X11 is a beast |
| 21:27 | p_l | I think there was third one ;) |
| 21:27 | tpope | cemerick: hey, I was trying to figure out if there was an elegant way to get a backtrace out of an nrepl connection |
| 21:27 | callen | cemerick: staying the hell away from amazon was one of the prime motivators, sadly. |
| 21:28 | tpope | cemerick: I mean more elegant than evaling (.getStackTrace *e) (which will clobber the user's *1) |
| 21:30 | cemerick | p_l, tpope: yup, there's a tertiary selection |
| 21:30 | cemerick | essentially unused, afaict |
| 21:31 | cemerick | tpope: I'll go see how ccw does it, can't remember |
| 21:31 | mpan | in general, are most clojure libraries implicitly clojure-jre only? |
| 21:31 | mpan | erm, clojure-jvm, rather |
| 21:31 | tomoj | tpope: impossible? I usually can manage to click at one end and drag all the way across, although with some difficulty |
| 21:32 | p_l | mpan: I think most that are "pragmatic" and not just language specific libs |
| 21:32 | tpope | tomoj: then you are a more persistent man than I |
| 21:32 | tpope | let me try |
| 21:32 | tomoj | bitbucket actually seems better than most |
| 21:32 | mpan | p_l: thanks |
| 21:32 | tomoj | it seems to only auto select all on focus |
| 21:33 | cemerick | tpope: nope, ccw uses .printStackTrace / pst |
| 21:33 | tpope | tomoj: about one in 6 attempts I can get most of it, but it still fails to copy |
| 21:34 | cemerick | There's a TODO in the code to add some default middleware to support getting all of *e's data |
| 21:34 | tpope | cemerick: I saw that :) |
| 21:34 | tpope | if it helps I can open an issue and add some +1 emoji |
| 21:35 | cemerick | sure, feel free |
| 21:35 | cemerick | even better if you write (or convince someone else) to write the middleware ;-) |
| 21:35 | cemerick | It'll have to happen at some point. There's just too much value to be had in getting useful error data. |
| 21:35 | cemerick | stack traces are shite |
| 21:35 | cemerick | callen: why are you down on aws? |
| 21:37 | callen | cemerick: it doesn't align with my priorities and I find the irrational exuberance distasteful in a career track that should favor sober decision making more prominently. |
| 21:37 | callen | cemerick: it has its purpose. I'm not irrationally opposed to using it. I've various AWS services quite a bit. |
| 21:37 | tpope | cemerick: is there an easy way to get an nrepl server booted within the nrepl source itself, so that I might play around with it? |
| 21:38 | cemerick | callen: Fair. I'm all for more capable competition; I keep waiting and waiting, though. |
| 21:39 | cemerick | tpope: Sure, you can start a new server while editable nREPL sources are on your classpath without a problem. |
| 21:39 | callen | cemerick: I wouldn't expect something identical to AWS to arise and I'm not 100% convinced the non-EC2 parts of the service are an especially good idea. |
| 21:39 | tpope | okay, was just wondering if there was a convenient shortcut for it |
| 21:39 | callen | I'd expect their business model to get picked apart by specialties like VPS SSD providers, Heroku-alikes, etc. |
| 21:40 | callen | not by another full-house provider. Especially since Rackspace is persistently incompetent. |
| 21:40 | cemerick | tpope: I'm open to suggestions. Short of cloning the repo and starting an initial REPL for your actual interactions, it's as easy as starting any other nREPL server. |
| 21:40 | cemerick | I'm open to suggestions, of course. |
| 21:41 | tufflax | Vim users: How do you debug clojure code? This looks nice in emacs http://vimeo.com/15462015 is there something similar for vim? |
| 21:42 | cemerick | callen: Yeah, I figured the same would happen as well...but even, what, 6 years out, there's not even a credible S3 competitor around. |
| 21:42 | tpope | cemerick: well I was thinking there might be a maven task equivalent to lein repl. No idea if that's the sort of thing people might do with maven |
| 21:42 | mpan | tufflax: I'm also interested in options for debugging that aren't emacs or eclipse |
| 21:42 | callen | cemerick: I don't know about that. Riak + bitcask and a simple API wrapper == S3 |
| 21:42 | cemerick | tpope: oh, I see what you mean |
| 21:42 | mpan | tufflax: I've been looking at https://github.com/GeorgeJahad/cdt but I'm not sure how I feel about it |
| 21:43 | mpan | I just really wish there were a standalone graphical stepping debugger |
| 21:43 | cemerick | tpope: that's not really going to help you hack on nrepl though |
| 21:43 | cemerick | callen: well, that's Riak CS, which is interesting in its own right, but definitely not a service. |
| 21:43 | tpope | cemerick: well if that maven task happened to be available inside the tools.nrepl project (and it used the local sources), it would, right? |
| 21:44 | mpan | tufflax: like, it should be possible to use standalone, but even then I dunno how I feel about it |
| 21:44 | tpope | cemerick: I wasn't talking general purpose. I was talking a specific one-off for this use case |
| 21:44 | tufflax | I tried cdt once... the only thing i remember is that i wasn't satisfied :P |
| 21:44 | tpope | cemerick: but if you haven't needed it, then I presumably won't either |
| 21:45 | tufflax | I mean just cdt |
| 21:45 | cemerick | tpope: right, just hacking on nREPL? My workflow is to start one nREPL, connect to it, hack hack hack, load, see what happens |
| 21:45 | tufflax | cdt is what that guy in the video is using in emacs |
| 21:45 | callen | cemerick: part of the problem is that programmers evaluate everything on the basis of cost and nobody can really compete with Amazon's capacity save for Google. |
| 21:45 | mpan | yea that's what I was thinking of trying, but just historically, I haven't been too comfortable with interactive command-line debuggers |
| 21:45 | callen | cemerick: I don't even find S3 to be all that compelling to begin with. |
| 21:46 | tpope | cemerick: then I will try the same |
| 21:46 | cemerick | callen: except aws is extraordinarily expensive...? |
| 21:46 | callen | cemerick: I was referring primarily to EC2 |
| 21:46 | mpan | tufflax: if you find something I'd be interested in hearing about it too |
| 21:46 | tufflax | mpan: sure |
| 21:46 | callen | cemerick: S3 is the most price-competitive service they have. |
| 21:46 | tufflax | same here :P |
| 21:47 | cemerick | S3 is *super* expensive, compared to just about anything else |
| 21:47 | callen | you said nothing competed with it, what alternative are you thinking of? |
| 21:47 | mpan | also, I heard some people say they were using just regular java debuggers connected to a jvm with a repl inside |
| 21:47 | mpan | but I can't find specific instructions on that; maybe I'm googling the wrong keywords |
| 21:48 | cemerick | callen: rackspace, rack-and-stack, whatever else there is |
| 21:48 | cemerick | nothing competes with it w.r.t.: it works, it's easy, and it doesn't break |
| 21:48 | tufflax | mpan: How is the debugger in eclipse/ccw? |
| 21:48 | mpan | tufflax: overall ccw feels a lot like eclipse for java dev |
| 21:48 | callen | when I described it as price competitive, I wasn't comparing it to self-hosting. |
| 21:49 | mpan | but eclipse in general gives me performance related issues sometimes |
| 21:49 | callen | mpan: use Emacs. |
| 21:49 | tufflax | mpan: I've never used it. I was only thinking of the debugger |
| 21:49 | cemerick | I use ccw 24/7 FWIW. I'm biased, but I like it. |
| 21:50 | mpan | the debugger in ccw feels a lot like the eclipse debugger for regular java |
| 21:50 | cemerick | mpan: it is! |
| 21:50 | mpan | and I was already familiar with that from school so I was ok with it |
| 21:50 | mpan | cemerick: wait, there's no layer of magic in between? |
| 21:50 | cemerick | zero |
| 21:50 | tufflax | I'll have to try it. Emacs or ccw is gonna have to become my debugger I think |
| 21:50 | cemerick | Which is why clojure collections aren't displayed super-nicely yet. |
| 21:51 | mpan | they're just toString()'d, right? but even that's kinda nice |
| 21:51 | mpan | callen: I've been trying to learn occasionally |
| 21:51 | callen | mpan: my advice? keep it simple. Failing that, you can learn from my dotfiles. |
| 21:51 | callen | my dotfiles repo is pretty shake-n-bake as far as it goes. |
| 21:52 | cemerick | callen: Wow, s3 is now *cheaper* than Rackspace cloud files. |
| 21:52 | cemerick | At some point, that wasn't true IIRC. |
| 21:52 | mpan | I've just honestly been a mouse-and-graphics person all my life |
| 21:52 | callen | cemerick: spend some time on HN, they'll crow for 24 hours straight everytime Amazon does a price-drop. |
| 21:52 | tomoj | cljs spoils me. IDeref isn't a protocol on the jvm! |
| 21:52 | callen | mpan: seems a good time to break that habit, get with the unix and lisp traditions of yore. :) |
| 21:52 | cemerick | callen: I try not to. :-) |
| 21:53 | callen | cemerick: you're a wiser man than I. |
| 21:53 | cemerick | Doesn't mean I'm immune, of course. |
| 21:53 | tomoj | I wanted @conn for (datomic.api/db conn) and thought "hurray for protocols" :( |
| 21:53 | muhoo | s3 is the cheapest storage i've been able to find in about 3 years now. |
| 21:53 | muhoo | i think i pay pennies a month |
| 21:54 | mpan | callen: where are your dotfiles? are you a different name on github, if that's what you were referring to? |
| 21:54 | callen | mpan: http://github.com/bitemyapp/dotfiles/ |
| 21:54 | cemerick | muhoo: there was a chart a couple of years ago that was contra that, but clearly that's changed |
| 21:54 | callen | mpan: about 400,000 lines of Emacs Lisp. You only need to care about 20 or so of them. |
| 21:54 | muhoo | Raynes: btw, and speaking of selection, refheap doesn't like tablets too well, not sure why |
| 21:54 | mpan | ah thanks! |
| 21:54 | muhoo | on android at least, you need to long-click in order to paste. refheap seems to eat the long click |
| 21:55 | muhoo | long-touch, not long click, there ain't no clicks. |
| 21:56 | mpan | callen: wait, how much of your .emacs.d/ was manually vs automatically generated? |
| 21:56 | tomoj | wonder why we haven't started turning more interfaces into protocols? waiting for c-in-c? |
| 21:57 | callen | mpan: it's mostly manually curated, but I most certainly did not write but a very small fraction of it. |
| 21:57 | callen | only one or two packages are automatically integrated. |
| 21:57 | callen | I still resent package.el |
| 21:57 | gfredericks | tomoj: weird how cljs makes clj look all cruddy |
| 21:57 | mpan | should I be worried about learning curve here? |
| 21:58 | tomoj | cljs has different crud :) |
| 21:59 | callen | mpan: not if you keep it simple like I advised. There are a ton of tutorials out there. |
| 22:00 | mpan | all right; thank you |
| 22:10 | Raynes | And on this New Years evening, I give you the big wet ball we live on: https://pbs.twimg.com/media/A_fRA-1CMAAjOEz.jpg:large |
| 22:18 | cemerick | Raynes: A worthy pairing to that: https://en.wikipedia.org/wiki/Pale_Blue_Dot |
| 22:19 | Raynes | cemerick: It's kind of sad that you can still see earth from that distance. It's like "Come the hell on, how do I get my bloody spacecraft where I want it to go before I die!?!?!" |
| 22:20 | cemerick | heh |
| 22:20 | Raynes | It must haunt scientists that they have such a limited range of vision with no hope of ever seeing anything more. |
| 22:20 | gfredericks | through fictional technology of course! |
| 22:20 | cemerick | Raynes: of course, we can see planets in other star systems from here. |
| 22:20 | Raynes | cemerick: It haunts me and I'm not even a scientist. |
| 22:20 | Raynes | Yes, but it isn't good enough. We only see our galaxy. |
| 22:21 | cemerick | Raynes: I have a story for you |
| 22:21 | Raynes | I bet it is depressing. |
| 22:21 | gfredericks | cemerick: frustrating to only be able to look at anything from one angle? |
| 22:22 | cemerick | Raynes: hardly. http://filer.case.edu/dts8/thelastq.htm |
| 22:22 | cemerick | gfredericks: frustrating? |
| 22:24 | gfredericks | cemerick: like spending 30 years in a room not allowed to move from your chair |
| 22:24 | gfredericks | totally unable to get up and look at something from another angle |
| 22:24 | tmciver | cemerick: thanks for the link. Going on the kindle. |
| 22:25 | cemerick | gfredericks: man, that sounds like what I've done! :-P |
| 22:26 | gfredericks | cemerick -- the astronomer of his own room |
| 22:28 | gfredericks | &(sort (range)) |
| 22:31 | gfredericks | I'm not sure magit does a good job replacing `git add -p` |
| 22:42 | tomoj | how not? |
| 22:42 | tomoj | the only problem I have with that part of magit is when the hunks don't come out like I like |
| 22:43 | gfredericks | tomoj: instead of hitting single keys I do a bunch of scrolling and tabsing |
| 22:43 | gfredericks | gotta go find the next thing of interest instead of it being automatically presented to me |
| 22:47 | tomoj | you already know n, p, ^, M-n, M-p, 4, and M-4? |
| 22:48 | tomoj | oh, I see |
| 22:48 | gfredericks | nope. this is why I come here to complain about these things |
| 22:48 | gfredericks | I usually learn something helpful :) |
| 22:49 | tomoj | well, those may help some. the navigation for basics, 4 (while focused on, say, Unstaged changes:, or M-4 anywhere) to show everything so that you don't have to tab open the diffs |
| 22:49 | tomoj | but you don't get add -p's thing where you mark certain files as interesting |
| 22:49 | gfredericks | that's a feature I haven't heard of |
| 22:49 | tomoj | I mean git add -i |
| 22:50 | gfredericks | ooh |
| 22:50 | gfredericks | I've never tried that |
| 22:54 | tomoj | it's silly that if you don't have all the unstaged diffs expanded and you stage in one, point may end up after the staged changes |
| 23:01 | gfredericks | it's silly that I can't think of a better way to write laws than to elect a few hundred lawyers to negotiate with each other in whatever manner they see fit. |
| 23:02 | tomoj | indeed |
| 23:04 | Raynes | cemerick: Hah. |
| 23:04 | Raynes | cemerick: The computer is God. Nice. |
| 23:11 | cemerick | Raynes: or, god is life, etc |
| 23:12 | cemerick | there's a lot of meta-allegories to be sussed out |
| 23:41 | mpan | i'm kind of getting mixed signals from google about what is the current standard setup for clojure in emacs |
| 23:42 | mpan | the top few search results flat out say there's newer stuff than what they were recommending at the time |
| 23:42 | mpan | would the current recommendation be clojure-mode, nrepl.el, and ritz? |
| 23:44 | mpan | well and a few random experiments with trying to learn it since, I guess |
| 23:44 | gfredericks | woah man if I had learned emacs in high school I would have spent a lot less of my life programming in notepad |
| 23:44 | Frozenlock | they showed you emacs in HS? |
| 23:44 | Frozenlock | I must have children to be able to send them there. |
| 23:44 | mpan | well, the only key sequences they taught us were ^x^f , ^x^s , and ^x^c |
| 23:45 | mpan | not sure that counts as learning emacs tbh |
| 23:45 | Frozenlock | well they showed you the application, even if they didn't show you how to use it. |
| 23:46 | Frozenlock | Anyway learning how to use emacs is a life-long job |
| 23:47 | mpan | bleh, real life interruptions |