2013-11-28
| 00:00 | bbloom | ignoring readline support, debugging features, etc, a repl can do 3 IO things: read form, print text, and print values |
| 00:00 | bbloom | i'm only interested in print |
| 00:00 | bbloom | (println ...) is like emitting text |
| 00:01 | bbloom | in theory i could have (emit :content-type "plain/text" ...) |
| 00:01 | bbloom | or emit-jpg or whatever |
| 00:01 | technomancy | right |
| 00:01 | justin_smith | what about prn / print / display |
| 00:01 | technomancy | so nrepl handlers can already emit response maps of arbitrary contents |
| 00:01 | bbloom | sure |
| 00:02 | bbloom | anyway, i need this long weekend badly b/c my brain is fried, so i'm mostly just wasting both of our time here. sorry. in anycase, i'd propose for eval/print sort of things a two-function API: |
| 00:03 | bbloom | (f (g "image/jpeg" ...)) |
| 00:03 | bbloom | where g wraps some thing in a magic type that middleware knows to render with that mimetype |
| 00:03 | bbloom | and f takes a pre-wrapped thing and emits it like printed text would be emitted |
| 00:04 | bbloom | anything more sophisticated than that won't give me the control i want to trust the thing & belongs out of the core of it :-P |
| 00:04 | bbloom | if that makes anysense |
| 00:04 | technomancy | aha; gotcha, to bridge the gap between eval land and the nrepl tooling which knows about the transport/communication |
| 00:04 | technomancy | that makes sense, but it's a totally different use case from what I've been considering so far |
| 00:04 | technomancy | I'll give it some thought |
| 00:05 | bbloom | it's acceptable for g-wrapped things to be printed special if returned from an eval |
| 00:05 | bbloom | but ONLY g-wrapped things... again from core |
| 00:05 | bbloom | if somebody wants to install some insane thing that does arbitrary fucking with their return values fine |
| 00:05 | bbloom | but not me :-P |
| 00:06 | bbloom | i want to opt-in to "ok fine, you can display THIS particular jpeg as a jpeg, instead of the standard toString" |
| 00:06 | technomancy | that would be analogous to an HTML-generating function attaching some kind of hinting to its response to tell the ring handler to add some kind of caching directive to the headers or something |
| 00:06 | bbloom | yeah, but i don't want that |
| 00:06 | bbloom | no metadata |
| 00:06 | bbloom | no fancy tricks w/ different data types |
| 00:06 | bbloom | just a single quoting construct |
| 00:07 | bbloom | (deftype NReplContent [mime-type x]) |
| 00:07 | technomancy | hiredman suggested sending tagged literals all the way back to the client, but we currently don't require clients to implement a reader, so that's a lot to ask |
| 00:07 | bbloom | that's it |
| 00:07 | bbloom | er i guess |
| 00:07 | technomancy | yeah, makes sense |
| 00:07 | bbloom | (deftype Content [mime-type bytes]) |
| 00:07 | bbloom | and you'll probably already need some system for mime-type => serialization-function |
| 00:08 | bbloom | i just want explicit representation |
| 00:08 | bbloom | at least absent some much more sophisticated system a la mathematica's "forms" that you'll never be able to build nor standardized |
| 00:09 | bbloom | don't get cute & i'll love this feature :-P |
| 00:09 | technomancy | heh nice |
| 00:09 | bbloom | thanks for putting up with my incoherent rant that took a while to find it's point. i'm going to bed now. |
| 00:09 | technomancy | well I did get to meet tpope at the conj and he said he'd take a look |
| 00:09 | technomancy | cheers |
| 00:09 | justin_smith | so we currently have print-dup and print-method that return strings with different rules for constructing them - what about a third method that returned an arbitrary tagged rich type? then we can use some extension of the same logic / rules that currently decide between print-dup and print-method |
| 00:10 | justin_smith | s/method/multi |
| 00:11 | technomancy | seems eminently reasonable |
| 00:12 | technomancy | I kinda feel like getting the client/server bits nailed down first since everything else rests on top of that |
| 00:12 | technomancy | but if you want to take a swing at it =) |
| 00:12 | justin_smith | hah |
| 00:12 | justin_smith | I'll consider it |
| 00:12 | technomancy | starting to think there's enough meat here for a clojurewest talk |
| 00:13 | bitemyapp | oh man, I should go to clojurewest since I failed to go to the conj. |
| 00:14 | technomancy | come see me speak! (maybe) |
| 00:14 | justin_smith | I failed to come to the last c/w and it was in my own damn city |
| 00:14 | justin_smith | I have no excuse this year |
| 00:15 | bitemyapp | justin_smith: pretty sure c/w is in my city this year. |
| 00:15 | bitemyapp | s'posed to be SF innit? |
| 00:19 | justin_smith | clojurewest.org still mentions the portland event |
| 00:19 | justin_smith | I really don't know |
| 00:24 | arrdem | bitemyapp: gaming PC get |
| 00:28 | technomancy | justin_smith: they said at the conj it would be SF =( |
| 00:29 | justin_smith | you consider that sad news? |
| 00:32 | Raynes | PARSE ERROR |
| 00:34 | jared314 | Raynes: that is quite an entrance. I'll have to use that some time |
| 00:34 | akurilin | Howdy. Have people heard much of Clojuratica in the past few years? Is the project dead? |
| 00:34 | technomancy | justin_smith: well if it has to be in california, SF is fine |
| 00:34 | technomancy | but portland is the best place in the world for conferences |
| 00:35 | justin_smith | agreed, I like being able to walk to conferences |
| 00:35 | justin_smith | and sleep at home |
| 00:35 | Raynes | technomancy: Are you a Portlandia fan? |
| 00:35 | technomancy | Raynes: I haven't seen the show |
| 00:35 | Raynes | o_o |
| 00:35 | technomancy | it's just ... a cool city |
| 00:35 | justin_smith | they actually filmed one of the portlandia sketches in my office |
| 00:35 | technomancy | seattle's kid brother |
| 00:35 | justin_smith | the one with "pitchfork kids" |
| 00:36 | technomancy | unrelated note: I heard BSD described as "the Canada of Linux" the other day and it was perfect; the best thing I heard all week. |
| 00:37 | technomancy | Raynes: I don't really watch anything but doctor who |
| 00:37 | justin_smith | http://www.youtube.com/watch?v=6eOnnIi6O5E |
| 00:38 | justin_smith | err... that didn't show the part in my office actually |
| 00:39 | bitemyapp | arrdem: WHOA |
| 00:39 | bitemyapp | arrdem: up for some practice/2s? |
| 00:40 | bitemyapp | arrdem: http://i.imgur.com/DWnJplv.gif |
| 00:40 | arrdem | bitemyapp: already playing br0 |
| 00:40 | bitemyapp | arrdem: goddammit, catch you next game then. |
| 00:44 | noprompt | ah, the Emacs spiral. |
| 00:44 | justin_smith | noprompt: it is literally endless |
| 00:44 | noprompt | technomancy: i uninstalled esk. the learning process begins. |
| 00:44 | bitemyapp | noprompt: esk? |
| 00:45 | arrdem | emacs starter kit |
| 00:45 | noprompt | bitemyapp: emacs starter kit. |
| 00:45 | bitemyapp | noprompt: oh good. |
| 00:46 | noprompt | i wanted to try out cider but i didn't know how to remove the old nrepl dependencies apparently because i was getting strange errors. |
| 00:46 | noprompt | so i decided to nuke everything in elpa. |
| 00:47 | noprompt | now i need helpa. lolpa. |
| 00:48 | noprompt | one thing i miss is the switch-to-buffer behavior. |
| 00:48 | technomancy | noprompt: start here https://github.com/technomancy/better-defaults |
| 00:48 | bitemyapp | I wouldn't advocate the use of cider specifically... |
| 00:48 | technomancy | this is like the bare minimum to keep you sane |
| 00:48 | justin_smith | yeah, that should get you back iswitchb, if that is what you miss |
| 00:48 | noprompt | bitemyapp: does it suck? |
| 00:48 | arrdem | it works... |
| 00:48 | arrdem | but isn't quite stable |
| 00:49 | arrdem | supposeldy |
| 00:49 | arrdem | I have't had problems with it yet |
| 00:49 | bitemyapp | noprompt: it's unstable. use nrepl for now. |
| 00:49 | justin_smith | noprompt: for switch to buffer behavior do you mean the completions visible with C-x b? |
| 00:49 | bitemyapp | noprompt: look at my dotfiles repo if you need ideas for what to add. |
| 00:49 | justin_smith | that is iswitchb |
| 00:49 | technomancy | I finally upgraded to cider, but only so I could add features to it |
| 00:49 | bitemyapp | justin_smith: iswitchb is heavenly. |
| 00:49 | bitemyapp | can't live without it. |
| 00:49 | noprompt | technomancy: bingo. |
| 00:49 | technomancy | justin_smith: he's talking about ido |
| 00:49 | justin_smith | ahh |
| 00:49 | technomancy | which is a superset of iswitchb technically |
| 00:49 | justin_smith | well ido is just iswitchb on find file |
| 00:50 | justin_smith | and a few other things |
| 00:50 | justin_smith | yeah |
| 00:50 | justin_smith | he mentioned switching buffers, I was looking for the most conservative match :) |
| 00:58 | noprompt | one thing i'd really like is a smart tab and for emacs to not autobreak long lines for me. |
| 00:58 | noprompt | *two things |
| 00:58 | justin_smith | what is a smart tab? |
| 00:59 | noprompt | justin_smith: one that autocompletes when it can or otherwise "insert fucking spaces." |
| 00:59 | justin_smith | also, M-x toggle-truncate-lines |
| 00:59 | justin_smith | noprompt: that is alt-tab by default |
| 00:59 | justin_smith | or m-/ for more heuristic guessing |
| 00:59 | noprompt | justin_smith: that's not the answer. the answer i'm looking for is how to turn that shit off. |
| 01:00 | justin_smith | toggle is what I said |
| 01:00 | justin_smith | a toggle |
| 01:00 | noprompt | justin_smith: oh oh, wait no that's not what i was talking about. what you're talking about is fine. |
| 01:01 | noprompt | what i'm talking about is when i type a long line and hit enter, emacs tries to get all fancy and break the line at x number of characters etc. |
| 01:01 | justin_smith | you mean it is actually making new lines, not just wrapping? |
| 01:01 | noprompt | for docstrings and comments this is desirable. |
| 01:01 | noprompt | justin_smith: yes, that. |
| 01:01 | justin_smith | noprompt: I think that is part of paredit, it is called electric-return iirc |
| 01:02 | noprompt | justin_smith: js2-mode and html-mode both do this and it drives me nuts. |
| 01:03 | noprompt | technomancy: i hear ya. |
| 01:04 | justin_smith | the problem is window managers all decided to steal the alt-tab combo |
| 01:04 | noprompt | for all i know the solution could be (setq jiggle-pop-bibble nil) but i have no way of knowing what i'm looking for. |
| 01:04 | justin_smith | noprompt: maybe it is auto-fill-mode you need to turn off |
| 01:05 | justin_smith | it is not a default, so it will be somewhere in your config explicitly |
| 01:05 | justin_smith | fill or electric will likely be somewhere in the name |
| 01:05 | noprompt | justin_smith: thankyou. this is a good start. |
| 01:06 | justin_smith | see if M-: (auto-fill-mode 0) |
| 01:06 | justin_smith | turns off the bad behavior |
| 01:06 | justin_smith | if so, put that in your .emacs, or delete the thing that turns auto fill on |
| 01:07 | noprompt | well, i'll be. |
| 01:09 | noprompt | justin_smith: you sir are today's winner. |
| 01:09 | justin_smith | was it auto-fill? |
| 01:09 | noprompt | looks like it was. |
| 01:10 | justin_smith | I had discounted the possibility at first, because I have only ever turned that on for plain text |
| 01:10 | justin_smith | I figured it was for paragraph formatting |
| 01:14 | noprompt | it's nice for comments. if i could turn that on soley for breaking long lines in comments that'd be a win. |
| 01:14 | noprompt | personally, i think it's kind of annoying when someone writes a 200 character long comment. |
| 01:14 | justin_smith | M-q fills the block your cursor is inside |
| 01:14 | clojurebot | Ok. |
| 01:14 | justin_smith | does what you want inside comments |
| 01:15 | technomancy | noprompt: there's a way to turn it on in comments only iirc |
| 01:15 | noprompt | technomancy: i'll google it. |
| 01:15 | noprompt | justin_smith: fyi, i use evil-mode. |
| 01:15 | justin_smith | I don't mind having to occassionally hit m-q inside a commnt block, as luddite as that sounds |
| 01:15 | justin_smith | oh, so you don't get the normal shortcuts |
| 01:16 | justin_smith | the command is called fill-paragraph |
| 01:16 | noprompt | justin_smith: no. for example M-x is done with keychord as m+x |
| 01:16 | noprompt | err sorry ,+x |
| 01:17 | justin_smith | if you do M-x describe-function fill-paragraph it will tell you any keybinding you have for it |
| 01:17 | justin_smith | or +x or whatever |
| 01:17 | noprompt | ah good deal |
| 01:17 | justin_smith | yeah, describe-function, apropos, describe-key |
| 01:17 | justin_smith | all your friends as a learner |
| 01:18 | justin_smith | oh, and apropos-documentation |
| 01:18 | justin_smith | apropos-variable is good too |
| 01:19 | noprompt | nice. |
| 01:22 | noprompt | just realized i've been programming with Andale Mono for over a month. |
| 01:23 | justin_smith | at first I thought that was a disease |
| 01:23 | justin_smith | a relation of the regular mononucleosis |
| 01:23 | justin_smith | aka mono |
| 01:24 | emaphis | I thought it was a brand of cheese. |
| 01:24 | majyk | OMG that's funny! |
| 01:24 | justin_smith | clearly it is a contageous variety of cheese, spread by kissing |
| 01:24 | emaphis | Ewww! |
| 01:25 | `cbp | it means go monkey! in spanish |
| 01:26 | justin_smith | not to be confused with andale arriba |
| 01:27 | justin_smith | which is a monospace programming typeface designed for usage by spanish speaking mice |
| 01:27 | emaphis | lol |
| 02:10 | d11wtq | Is there any sort of convention in Clojure to group the defn-'s at the top or bottom of the namespace? |
| 02:13 | andyf | d11wtq: You mean specifically the defn's for functions that you want to be private? I have not seen any pattern there -- what I have usually seen is that defn-'s go wherever the author would put them if they were regular defn's. |
| 02:14 | andyf | d11wtq: Putting them all at the bottom would be inconvenient, since they could not be called by public functions in the namespace unless you declare'd them earlier. |
| 02:15 | d11wtq | andyf: yeah, for non-public defn-'s. Good point about the need to declare them! |
| 02:15 | d11wtq | In other languages I'd tend to keep the "private" stuff in the least visible place, at the bottom of the file. |
| 02:16 | andyf | d11wtq: You can do that if you prefer, as long as you declare what is needed, e.g. at the top. |
| 02:16 | hiredman | I would recommend against making anything private at all |
| 02:16 | d11wtq | andyf: yeah, thanks. I'll go with the flow and stick with convention! |
| 02:17 | d11wtq | hiredman: I generally agree with that, although sometimes it's just useful to guide people who are reading the code so they know what's intended to be used and what's likely to change. |
| 02:20 | hiredman | private things have only ever been a thorn in my side, mocking me in an opensource project where I can see the source, see what I need, and I could just use it and it would be fine, but someone decided to make it private |
| 02:21 | d11wtq | can't disagree with that :) |
| 02:22 | bitemyapp | private vars should've never been added to the language. |
| 02:22 | bitemyapp | they lead to either #' or dependency vendoring. |
| 02:22 | bitemyapp | Sucks. |
| 02:22 | arrdem | bitemyapp: I almost forgot, happy thanksgiving! |
| 02:22 | arrdem | (same goes for the rest of yall) |
| 02:22 | bitemyapp | arrdem: Happy thanksgiving to you too! |
| 02:23 | arrdem | 'night |
| 02:23 | bitemyapp | g'night |
| 02:23 | ddellacosta | what am I forgetting to do such that my new extern, defined in a file with other externs which are already working, isn't getting picked up? I've cleaned my clojurescript and re-compiled...confused. |
| 02:23 | ddellacosta | 'night arrdem, happy thanksgiving! |
| 02:23 | bitemyapp | ddellacosta: I mean, it's not like all of us benefit from Thanksgiving beyond having a day off work. |
| 02:23 | bitemyapp | I'm just going to drinking tea and coding tomorrow. |
| 02:23 | bitemyapp | going to be* |
| 02:24 | ddellacosta | bitemyapp: yeah, I'm not even taking a day off. Although can't blame my bosses, I'm sure they would have given it to me if I'd asked. I just don't have any reason to do so. |
| 02:24 | bitemyapp | ddellacosta: what's the biggest holiday of the year in Japan? |
| 02:25 | ddellacosta | anyone have any tips for getting externs picked up? I feel like I'm forgetting something obvious, since it is such a simple thing. |
| 02:25 | ddellacosta | bitemyapp: hmm, probably either Obon or the New Year |
| 02:25 | ddellacosta | bitemyapp: I guess New Year's day is probably the biggest one. |
| 02:26 | bitemyapp | ddellacosta: is it in your :provides vector? |
| 02:27 | ddellacosta | bitemyapp: haha, what is that? I don't have that but other externs are definitely picked up. |
| 02:28 | bitemyapp | oh, I thought maybe you had to re-expose it like you setup the namespaces for javascript modules. |
| 02:28 | bitemyapp | I don't do much, if any, CLJS I'm afraid. Sorry! |
| 02:28 | ddellacosta | bitemyapp: no worries! Thanks for giving it a shot. Anything is helpful at this point. |
| 02:38 | rurumate | is it correct that clojure cannot auto-determine order of compilation when using using a gen-classed class within in the same project? |
| 02:38 | rurumate | what I do is, I determine order of compilation manually using :aot in project.clj but that is tedious |
| 02:39 | bitemyapp | that is tedious. |
| 02:39 | rurumate | so I do :aot [ns.that.generates.javaclass ns.that.uses.generated.javaclass] in that order |
| 02:41 | bitemyapp | rurumate: :aot :all dinna work? |
| 02:41 | rurumate | no |
| 02:41 | bitemyapp | nuts. |
| 02:41 | rurumate | lemme try again though.. |
| 02:42 | bitemyapp | rurumate: yeah I think you just have to specify the AOT order. Sorry :( |
| 02:43 | rurumate | bitemyapp: yes it fails with :aot, pity |
| 02:43 | rurumate | with :aot :all I mean |
| 02:43 | bitemyapp | you'll just have to be specific for now I guess. |
| 02:43 | rurumate | it seems like something the compiler might learn some day |
| 02:44 | bitemyapp | well you could hack it up, it'd just be a bad idea. |
| 02:44 | rurumate | also auto-resolving circular dependencies between namespaces would be a nice feature |
| 02:44 | bitemyapp | maybe a pre-task that overrides/provides the AOT vector based on inference. |
| 02:44 | bitemyapp | I don't think allowing circular dependencies is a good idea anyway. |
| 02:44 | rurumate | why not? |
| 02:44 | bitemyapp | you can and should break stuff like that out into a tree. |
| 02:45 | bitemyapp | / DAG |
| 03:07 | ddellacosta | bitemyapp: the answer to my problem before was, btw, that I was not including the JavaScript I had written the extern for in my HTML. /facepalm |
| 03:07 | bitemyapp | ddellacosta: welp. |
| 03:07 | bitemyapp | ddellacosta: thanks for sharing the original problem. |
| 03:08 | bitemyapp | ddellacosta: I should celebrate thanksgiving by launching a wiki. |
| 03:08 | ddellacosta | bitemyapp: there ya go. :-) You can set it up so Clojurebot will give it as the answer to any questions that have been asked before... |
| 03:08 | ddellacosta | bitemyapp: seriously though, we do need some kind of FAQ for Clojure |
| 03:08 | ddellacosta | Clojure/Script |
| 03:19 | bitemyapp | krisajenkins: US Fact: On my last visit, I *could not* buy a tuna sandwich. Kept getting chicken. In the end, I had to pronounce tuna with a silent 'ch'. |
| 04:32 | ered | https://news.ycombinator.com/item?id=6812499 |
| 04:32 | ered | did you guys see this on HN today? |
| 04:34 | bitemyapp | ered: of course, I was trolling Church on Twitter. |
| 04:34 | ered | hah, fair enough |
| 04:35 | bitemyapp | ered: I was correcting the mutable "placeness" description of core.async |
| 04:39 | bitemyapp | technomancy: I found something really cool. |
| 05:04 | d11wtq | How does one find things that used to be in contrib? I'm looking for where clojure.contrib.mock would live today. |
| 05:05 | xeqi | ~contrib |
| 05:05 | clojurebot | Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go |
| 05:07 | d11wtq | I've seen that page, but clojure.contrib.mock is nowhere to be seen. |
| 05:08 | d11wtq | I might actually want something else. I basically want to be able to say: if foo/some-func is invoked with args [x y z] then return 42. |
| 05:08 | d11wtq | For stubbing out a network-calling function in tests. |
| 05:08 | d11wtq | With midje. |
| 05:11 | d11wtq | I'll just go with robert.hooke and do it by hand for now. |
| 05:11 | noprompt | bitemyapp: check out this wank book http://www.math.mcgill.ca/triples/Barr-Wells-ctcs.pdf |
| 05:12 | noprompt | Category Theory for Computer Scientists! |
| 05:12 | noprompt | my only hope is that it doesn't suck as had as Logic and Discreet Matematics For Computer Scientists. |
| 05:13 | noprompt | which by the way, if you want to learn about logic or math, go get fucking logic or math book for god's sake. |
| 05:14 | noprompt | one for mathemeticians. |
| 05:19 | robewald | hi, is there a function to compare a nested datastructure for submaps? The easy case for testing submaps is (= sub (select-keys super (keys sub))). But that doesn't work for nested maps. |
| 05:19 | jballanc | d11wtq: does "provided" not work for you? |
| 05:22 | d11wtq | jballanc: I'm not sure what that is. Third day learning clojure :) |
| 05:22 | noprompt | robewald: can you provide a bit more context? |
| 05:23 | d11wtq | jballanc: Oh, I just found it in the midje wiki. |
| 05:23 | jballanc | yeah, the wiki is a good resource...take some time to digest it all :) |
| 05:23 | noprompt | d11wtq: welcome to clojure! |
| 05:25 | d11wtq | noprompt: thanks. Liking it so far. Having done (guile) scheme and CLISP, Clojure is elegant. |
| 05:25 | robewald | noprompt: well. I have a vector of maps containg other vectors of maps. But in the "super" map there are more keys than I am interested in. So for testing I want to have a predicate that checks whether the stucture of the vectors is equal but ignores the keys of the various maps that are not present in the "sub" map. If that makes the problem clear at all... I could go recursively through all the vectors checking map? and go from |
| 05:25 | robewald | there. It is just a bunch of work that might be in a library. |
| 05:27 | d11wtq | Reader macros would be nice, although the things I'd want to implement in Common Lisp are already implemented in Clojure anyway (e.g. decent regex syntax). |
| 05:28 | noprompt | robewald: so you have something like [{? []} {? []}]? |
| 05:28 | noprompt | [{? [{?? }]} ..] |
| 05:28 | bitemyapp | (inc robert.hooke) |
| 05:28 | lazybot | ⇒ 1 |
| 05:30 | robewald | I guess. What i want is (= [{:a "f"} {:b "b"}] [{:a "f" :c "c"} {:b "b"}]) => true |
| 05:30 | robewald | where [{:a "f"} {:b "b"}] is the "sub"map |
| 05:31 | robewald | and the whole thing recursively nested :) |
| 05:31 | jballanc | robewald: recursion is your friend, I think...something like: |
| 05:31 | jballanc | ,(letfn [(comp-map [ma mb] (reduce (fn [a [k v]] (and a (if (and (map? v) (map? (mb k))) (comp-map v (mb k)) (= v (mb k))))) true ma))] (comp-map {:a {:b 2 :c 3}} {:a {:b 2 :c 3}})) |
| 05:31 | clojurebot | true |
| 05:32 | jballanc | :) |
| 05:32 | noprompt | ,(doc comp-map) |
| 05:32 | clojurebot | It's greek to me. |
| 05:33 | robewald | I know. I was wondering whether there is a library function for that. Because I think this stuff is really basic. |
| 05:33 | noprompt | oh whoops, letfn. |
| 05:35 | jballanc | a bit easier to read: https://gist.github.com/jballanc/7690023 |
| 05:35 | robewald | ,(letfn [(comp-map [ma mb] (reduce (fn [a [k v]] (and a (if (and |
| 05:35 | robewald | (map? v) (map? (mb k))) (comp-map v (mb k)) (= v (mb k))))) true |
| 05:35 | robewald | ma))] (comp-map [{:b 2 :c 3} {:b 2}])) |
| 05:35 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 05:35 | jballanc | robewald: basic, but there are a million *small* variations on semantics that means it's probably just easier to implement yourself |
| 05:36 | noprompt | so basically you just want to know if there are some key-value pairs in the vector of maps that are equal? |
| 05:37 | robewald | jballanc: I guess. |
| 05:38 | jballanc | for example, my solution only handles maps nested in maps |
| 05:38 | jballanc | but you said you want maps nested in vectors nested in maps...so you'll have to alter what I wrote |
| 05:38 | robewald | noprompt: yes, and the keys that are not in the "sub"map I don't care about. |
| 05:38 | jballanc | (an exercise left for the reader ;-) ) |
| 05:39 | robewald | jballanc: yes I know. And it is a bit of work because AFAIK you cannot just override the map comparison and everything else is as before. You have to handle all the cases again. |
| 05:40 | noprompt | robewald: sounds like you could use sets then if i'm not misunderstanding the problem. |
| 05:41 | jballanc | yup...depending on the number of cases you want to handle, you might consider using cond(p) and/or case |
| 05:41 | noprompt | ,(set {:b "b" :c "f"}) |
| 05:41 | clojurebot | #{[:b "b"] [:c "f"]} |
| 05:41 | robewald | noprompt: i cannot, because I care about the values associated with the keys being equal. |
| 05:41 | robewald | oh |
| 05:41 | noprompt | robewald: intersection |
| 05:42 | robewald | right |
| 05:42 | robewald | didn't think of it like that. |
| 05:42 | robewald | that might work |
| 05:42 | robewald | thanks |
| 05:42 | noprompt | robewald: defintely explore the clojure.set ns if you haven't already. it's certainly powerful. |
| 05:43 | bitemyapp | http://clojurewiki.com/ |
| 05:43 | noprompt | bitemyapp: nice work! |
| 05:43 | robewald | I have, but I didn't consider the *entries* as sets, only the keys... |
| 05:44 | bitemyapp | noprompt: it's git based, if I add a git user for somebody, they can push changes from their text editor! |
| 05:44 | Apage43 | hot diggity haskell |
| 05:44 | bitemyapp | Apage43: sssshhhhhh |
| 05:45 | robewald | jballanc: I wonder whether there are easier ways in clojure to add these small variations. |
| 05:45 | noprompt | robewald: the way i tend to think of hash-maps is a set of key-value pairs. |
| 05:46 | Apage43 | i've used pandoc a good bit, its handy to know that's in there |
| 05:47 | noprompt | robewald: that being said, one way to see which key value pairs are equal between two hash-maps would be to use `set` on each of the maps and perform an intersection. |
| 05:48 | noprompt | bitemyapp: that sounds pretty rad. |
| 05:48 | robewald | noprompt: not quite (clojure.set/union (set {:a "a" :b "b"}) (set {:a "b"})) |
| 05:48 | robewald | ,(clojure.set/union (set {:a "a" :b "b"}) (set |
| 05:48 | robewald | {:a "b"})) |
| 05:48 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 05:48 | robewald | I don't know how to use clojurebot |
| 05:49 | robewald | ,(clojure.set/union (set {:a "a" :b "b"}) (set {:a "b"})) |
| 05:49 | clojurebot | #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.set> |
| 05:49 | robewald | anyway that evals to #{[:b "b"] [:a "a"] [:a "b"]} |
| 05:49 | Apage43 | oh neat, same guy as pandoc |
| 05:49 | robewald | which is not a hashmap |
| 05:49 | noprompt | robewald: why are you using union? |
| 05:51 | robewald | noprompt: just to illustrate that you may create a set of map-entries that are not a map. That is why i don't think of hashmaps as a set of entries. |
| 05:51 | robewald | But your point is valid for this problem and I will try |
| 05:52 | noprompt | ,(s/intersection (set {:a "b" :b "f"}) (set {:a "c" :b "f"})) |
| 05:52 | clojurebot | #<CompilerException java.lang.RuntimeException: No such namespace: s, compiling:(NO_SOURCE_PATH:0:0)> |
| 05:52 | noprompt | (clojure.set/intersection (set {:a "b" :b "f"}) (set {:a "c" :b "f"})) |
| 05:52 | noprompt | ,(clojure.set/intersection (set {:a "b" :b "f"}) (set {:a "c" :b "f"})) |
| 05:52 | clojurebot | #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.set> |
| 05:52 | noprompt | :| |
| 05:52 | noprompt | whatever anyway that should respond with: #{[:b "f"]} |
| 05:53 | robewald | right |
| 05:53 | robewald | actually I would need to test for subset? |
| 05:54 | noprompt | (reduce set/intersection (map set [{:a "b" :b "f"} {:a "c" :b "f"}])) |
| 05:55 | bitemyapp | noprompt: haha, pro. |
| 05:55 | bitemyapp | (inc noprompt) |
| 05:55 | lazybot | ⇒ 1 |
| 05:55 | bitemyapp | I was wondering to myself if there wasn't a better way. |
| 05:56 | bitemyapp | Apage43: I actually got really lucky, only searched for Haskell-based wikis after I failed to get MediaWiki running. |
| 05:56 | bitemyapp | Apage43: uninstalled apache, php, mysql, and mediawiki, got gitit running in a jiffy. Turned out to be more of what I wanted anyway :) |
| 05:57 | poppingtonic | hi |
| 05:58 | noprompt | poppingtonic: hi |
| 05:59 | poppingtonic | noprompt: does anyone here work with Weka? I'm wondering how to connect the library with my leiningen project. |
| 05:59 | Apage43 | yeah it looks like a nice thing |
| 05:59 | Apage43 | mediawiki is a bit of a pain, but just about any significantly large php thing is |
| 05:59 | noprompt | poppingtonic: as if i'm the president of #clojure. flattering. |
| 05:59 | poppingtonic | hihi |
| 06:01 | noprompt | poppingtonic: in all seriousness, my guess is there probably are. ML, not SML, is popular topic in the clojure world or so it would seem. |
| 06:02 | poppingtonic | I guess I should just stick around until the hive wakes up, then :) |
| 06:02 | bitemyapp | Apage43: the way Apache and PHP are crammed up each others asses drives me nuts. |
| 06:02 | bitemyapp | Apage43: I'd rather just fire up a server bound to localhost and proxy the fucker with nginx. |
| 06:02 | bitemyapp | poppingtonic: I'm only awake because 1. I'm crazy 2. I'm getting a wiki rolling |
| 06:02 | Apage43 | but but LAMP stack man |
| 06:02 | Apage43 | so 2003 |
| 06:03 | Apage43 | i'm awake because someone decided it was poignant movie night |
| 06:04 | noprompt | poppingtonic: americans will be busy with thanksgiving and black friday for the next two days; it's not certain what the #clojure channel will look like. |
| 06:06 | noprompt | you know come to think of it, i don't recall seeing any portrayals of white men breaking bread with the former natives of this country the past few thanksgivings. |
| 06:06 | poppingtonic | noprompt: ah, yeah. Food comas and everything. I'm happy for them, the turkey-eaters. |
| 06:07 | bitemyapp | I'm not eating turkey :( |
| 06:07 | noprompt | bitemyapp: i'm up because i'm on a really fucked up sleep cycle. |
| 06:07 | bitemyapp | noprompt: me too! |
| 06:07 | bitemyapp | I decided to make it constructive :) |
| 06:08 | poppingtonic | noprompt, bitemyapp So am I. It's 14:10 and I just woke up, slept at 6AM. |
| 06:08 | bitemyapp | 0311 in our realm. |
| 06:09 | bitemyapp | yeah I'm satisfied, I'm going to start reading and prepping for sleep now. |
| 06:09 | bitemyapp | noprompt: write something in the wiki! :) |
| 06:09 | noprompt | god i love 24hr time. thank you so much rational people. |
| 06:09 | noprompt | bitemyapp: i know, i'll post a George Carlin quote! |
| 06:10 | noprompt | j/k |
| 06:10 | poppingtonic | I'm pretty sure there's a movie in there somewhere, that someone's just afraid of making. Better call Tarantino! |
| 06:11 | noprompt | poppingtonic: he's the last person to call. |
| 06:11 | noprompt | seriously if i had an actual list of people i would call in the event i needed to call someone from a list, his name would be at the bottom. |
| 06:12 | poppingtonic | that bad, huh? |
| 06:13 | noprompt | i'll call myley cyrus before i call tarantino. |
| 06:13 | noprompt | then i'll put them on three way. |
| 06:13 | noprompt | and hang up. |
| 06:14 | noprompt | poppingtonic: teach your machines that. |
| 06:14 | sm0ke | noprompt: leave mylry cyrus ALONE!! |
| 06:14 | bitemyapp | sm0ke: sshhh with the pop culture plz |
| 06:17 | noprompt | bitemyapp: you know how i said i wrote that app that lets me browse ~/.m2? |
| 06:17 | noprompt | well, i just realized there's probably some code in there i could pull out into a lein plugin if it doesn't already exist. |
| 06:19 | noprompt | lein describe (or something like that) - Display information about a project's dependencies. |
| 06:19 | noprompt | ie. display dependency description's, git info etc. |
| 06:19 | bitemyapp | noprompt: hrm, not a bad idea. |
| 06:19 | noprompt | does something like that exist? |
| 06:20 | noprompt | cause all that meta is sitting in the pom.xml files generally. |
| 06:21 | noprompt | bitemyapp: how can i publish something to the wiki? (serious) |
| 06:21 | bitemyapp | noprompt: create an account yo |
| 06:21 | bitemyapp | noprompt: top right |
| 06:22 | noprompt | bitemyapp: if i get one spam email, you're done. :P |
| 06:23 | yedi | do i need to wrap these while loops in go blocks? https://gist.github.com/yedi/c7f54429df6dc39bb5fc#file-gistfile1-txt-L6 |
| 06:23 | bitemyapp | Aha, three users now :) |
| 06:23 | noprompt | bitemyapp: is the css open source? |
| 06:23 | bitemyapp | yippee. |
| 06:23 | yedi | i'm dealing with an issue where my channels are getting closed and im not sure why |
| 06:23 | bitemyapp | noprompt: uhm, it's an unmodified gitit install right now. there's a custom.css file that I haven't changed. |
| 06:23 | bitemyapp | noprompt: the only thing I've changed is swapping out the logo.png |
| 06:24 | noprompt | yedi: hmmm |
| 06:28 | noprompt | yedi: well one thing i think you can do is change [socket (<! (ws/connect ...)) ... to just [socket (ws/connect ...) ... and move the let above the first (go |
| 06:28 | bitemyapp | the wiki is now being backed up as well. |
| 06:29 | noprompt | it looks like you want to execute code in the go block whenever the connection arrives. |
| 06:29 | noprompt | so my assumption is that socket is bound to a channel right? |
| 06:32 | noprompt | yedi: i'm guess it's because of the (<! (ws/connect ...)) part. |
| 06:33 | sm0ke | hey guys, is there anyway lein repl can detect my changes in a namespace and load entire file automatically? |
| 06:34 | sm0ke | i would be running lein repl from a project |
| 06:34 | noprompt | yedi: maybe what you wanna do is (let [{:keys [in out]} (<! socket)] and use alt! on in/clicks |
| 06:37 | yedi | ill try it |
| 06:38 | sm0ke | it would be better if it only reloads changed forms but anything will do |
| 06:38 | sm0ke | does this happens automatically for emacs users using cider? |
| 06:40 | noprompt | yedi: i'm taking a shot in the dark here. :-) does the channel returned by ws/connect close! after it receives the connection? |
| 06:40 | noprompt | or rather once the connection event takes place? |
| 06:41 | yedi | https://github.com/loganlinn/cljs-websockets-async/blob/master/src/cljs_websockets_async/core.cljs |
| 06:42 | noprompt | i'm guessing it might and that {:in (chan) :out (chan)} are open. but if (<! socket) is closed the whole go block will park. |
| 06:42 | noprompt | yeah, it looks like they're closing that channel once the connection is established. https://github.com/loganlinn/cljs-websockets-async/blob/master/src/cljs_websockets_async/core.cljs#L22 |
| 06:43 | poppingtonic | noprompt: what about one where you find out the latest version of a leiningen project? like `lein project latest`? Rather than searching clojars all the time... |
| 06:43 | noprompt | poppingtonic: i think lein anchient does that. |
| 06:43 | poppingtonic | which is what I usually do |
| 06:44 | noprompt | poppingtonic: but the meta data about dependencies can be useful. |
| 06:44 | CookedGryphon | and i made an emacs plugin which will automatically type out the dependency vector with the latest version in your buffer |
| 06:44 | CookedGryphon | and offers you the option of adding it to your running repl |
| 06:44 | CookedGryphon | (uses lein-ancient in the background) |
| 06:44 | noprompt | i'm thinking of situations where someone is new to a code base and wants to know what dependecies are used for. |
| 06:44 | poppingtonic | CookedGryphon: nrepl.el or cider? |
| 06:45 | noprompt | that way they can get an idea at a glance w/o having to google/search github. |
| 06:45 | poppingtonic | noprompt: aren't they handled automatically when one runs lein deps? |
| 06:45 | CookedGryphon | I'm still nrepl, I've been meaning to update it to cider, but wasn't sure how many people were on it already |
| 06:45 | CookedGryphon | i'm using emacs live which is still on nrepl |
| 06:45 | poppingtonic | so am I... |
| 06:45 | noprompt | most of the libs pulled down from clojars have a lot of that information sitting in the pom.xml file. |
| 06:46 | poppingtonic | CookedGryphon: strange choice, considering your language choice... |
| 06:46 | CookedGryphon | poppingtonic: ?? what do you mean? |
| 06:47 | yedi | noprompt: why would the entire go block part just because socket is closed? the init fn only takes! from socket once |
| 06:48 | noprompt | poppingtonic: here's what i'm saying. suppose i clone some project and there's a dependency on [jayq "x.x.x"]. when i run lein describe-dependencies i should see something like: jayq - A jQuery wrapper for ClojureScript. (https://github.com/ibdknox/jayq) |
| 06:48 | poppingtonic | Clojure has maybe .2% of all programmers hooked, yet you're worried about cider not having that many users among clojurists. If I had to guess, it's probably just inertia. |
| 06:49 | poppingtonic | noprompt: ok that's awesome. want! |
| 06:49 | poppingtonic | CookedGryphon: ^^ |
| 06:50 | CookedGryphon | noprompt: If that's stuff that's in the pom, you could probably extend lein-ancient to do that |
| 06:50 | CookedGryphon | which would work on maven and friends too |
| 06:52 | noprompt_ | well erc decided to take a dump. |
| 06:52 | noprompt_ | poppingtonic: did you get my description? |
| 06:54 | poppingtonic | noprompt:yeah you were very clear. I think it does fill a need. |
| 06:54 | cYmen_ | I just read this ( https://www.refheap.com/2464e1cf9678fe26ea275322e ) somewhere. Could somebody interpret what the author might be trying to say for me? |
| 06:54 | noprompt | poppingtonic: the information would be pretty printed, etc. |
| 06:55 | justin_smith | poppingtonic: emacs has poor dependency isolation, compiled elisp gets used in the compilation of another lib that depends on it, and you get weird bugs eventually with major lib changes that require rebuilding all your packages. So I am waiting until cider is 100% verified production ready, and then dumping all my clojure related packages and rebuilding with a cider stack. I am probably not the only one. |
| 06:55 | noprompt | is there something better than erc for emacs? |
| 06:56 | justin_smith | noprompt: not in my experience. what extensions do you have turned on? my setup seems pretty stable |
| 06:57 | noprompt | justin_smith: no extensions. but it seems to lock up and crash. could be something else. |
| 06:57 | justin_smith | I mean what erc extensions |
| 06:57 | noprompt | justin_smith: none extensions. |
| 06:57 | noprompt | justin_smith: just the default out of the box erc. |
| 06:57 | justin_smith | what about optional behaviors turned on? |
| 06:57 | justin_smith | oh, ok |
| 06:59 | noprompt | it's probably just bad luck. |
| 06:59 | justin_smith | what are the symptoms? |
| 07:00 | bitemyapp | justin_smith: hey, look: http://clojurewiki.com/ |
| 07:01 | justin_smith | who is hosting it? |
| 07:01 | bitemyapp | justin_smith: moi |
| 07:01 | justin_smith | cool |
| 07:01 | bitemyapp | justin_smith: finally got my fucking wiki. |
| 07:02 | noprompt | justin_smith: i'm not sure. at first blush i might say evil-mode and accidentally prefixing an insert with 99 by mistake. however, the second time it locked up right after i ran erc and logged in. :( |
| 07:02 | noprompt | bitemyapp: this should be ported to that http://www.clojure-toolbox.com/ |
| 07:03 | bitemyapp | noprompt: psh, on it: http://clojurewiki.com/Libraries |
| 07:03 | noprompt | bitemyapp: that'd be the idea. ;) |
| 07:04 | noprompt | bitemyapp: oh nice. did you write a script to parse/dump the markdown? |
| 07:04 | bitemyapp | noprompt: no, this is by hand yo. |
| 07:04 | bitemyapp | noprompt: http://clojurewiki.com/_activity diary of a madman |
| 07:05 | noprompt | bitemyapp: boo! you had a chance to use ruby + nokogiri and blew it. |
| 07:05 | bitemyapp | like I want to use Ruby. |
| 07:06 | noprompt | bitemyapp: true. doesn't enlive do something like that. let you query html and get data out of nodes? |
| 07:07 | bitemyapp | yeh |
| 07:07 | justin_smith | enlive has saved my ass when clients want certain data included as a "feed" from another page, but we need to inject styling or truncate some content |
| 07:08 | bitemyapp | noprompt: I'm doing it by hand partly because I explicitly want to remove some content from clojure-toolbox. |
| 07:08 | justin_smith | another page I do not control, that is |
| 07:08 | bitemyapp | there are some libraries that are abandoned/broken or just plain bad. |
| 07:08 | noprompt | bitemyapp: i'll remove CSSGen and Gaka for you. :P |
| 07:09 | bitemyapp | justin_smith: I'm not even sure what that would entail. |
| 07:09 | justin_smith | I kid because I love |
| 07:10 | noprompt | actually, i'm not trying to be a douce here but cssgen hasn't been touched in two years and one of Gaka's last commit messages is "Update to clojure 1.4.0" |
| 07:10 | ben_m | Anyone know why nREPL quits after I close Quil sketches? |
| 07:11 | bitemyapp | sm0ke: already in the wiki now. |
| 07:11 | CookedGryphon | :on-close :dispose |
| 07:11 | sm0ke | bitemyapp: what wiki? |
| 07:11 | bitemyapp | noprompt: k, I'll kill 'em. |
| 07:11 | CookedGryphon | ben_m: the default behaviour on closing a jframe is system.exit |
| 07:11 | justin_smith | noprompt: sometimes something is simple enough that it is just done, that doesn't make it stop being useful |
| 07:11 | justin_smith | now if they have multiple unaddressed issues on their repo on the other hand |
| 07:12 | sm0ke | i also found https://github.com/paraseba/lein-reload, but it doesnt seems to be working |
| 07:12 | noprompt | justin_smith: this is certainly true. |
| 07:12 | bitemyapp | justin_smith: I'm willing to believe that, but people should just be directed to Garden. |
| 07:12 | bitemyapp | if I want to emphasize a particular library, I'll put a "Recommended" next to it in future. |
| 07:13 | noprompt | justin_smith: garden does have open issues, some of which are not really issues, other's like this one: https://github.com/noprompt/garden/issues/23 are pretty much a crap shoot. |
| 07:13 | CookedGryphon | ben_m: at least that's a thing I remember being an issue, can't remember the exact details now I've said it |
| 07:14 | noprompt | the issues on garden right now are mainly feature oriented. |
| 07:14 | ben_m | CookedGryphon, yeah that makes sense, it doesn't work though and on-close isn't an option if I (doc sketch) |
| 07:14 | CookedGryphon | ben_m: and you're using defsketch and not putting it in something else? |
| 07:14 | justin_smith | well garden hasn't seen a change in master in two years from what I see |
| 07:15 | noprompt | say wut? |
| 07:15 | justin_smith | err |
| 07:15 | justin_smith | wait, don't mind me |
| 07:15 | justin_smith | need my coffee |
| 07:15 | justin_smith | I was looking at cssgen |
| 07:15 | noprompt | justin_smith: the version was bumped 9 days ago. haha! |
| 07:15 | ben_m | CookedGryphon, I was using sketch instead of defsketch. Works now :D |
| 07:15 | CookedGryphon | ben_m: oh, odd, were you making your own frame? |
| 07:16 | noprompt | lol |
| 07:16 | CookedGryphon | ben_m: I would recommend finding out what was wrong and going back to sketch, defsketch is bad for many reasons |
| 07:16 | noprompt | justin_smith: everyone has those moments. :) |
| 07:16 | ben_m | No, just using sketch, I assumed it was just defsketch without giving it a name. |
| 07:16 | justin_smith | it would be cool if the list of libs mentioned the time since last activity on github |
| 07:16 | CookedGryphon | including things like opening windows when you're trying to package a jar or run tests! |
| 07:16 | noprompt | justin_smith: i thought you just said that wasn't technically relevant. |
| 07:17 | justin_smith | noprompt: I was devil's advocating |
| 07:17 | justin_smith | not sure how I feel :) |
| 07:17 | noprompt | justin_smith: oh, hoho, i see! :P |
| 07:17 | justin_smith | or maybe more thinking out loud |
| 07:17 | justin_smith | socratic method to find the truth! |
| 07:17 | CookedGryphon | ben_m: it's quite easy to stick the sketch in a swing window yourself, maybe using seesaw |
| 07:17 | noprompt | justin_smith: although i dislike the metric, i tend to agree it can be useful at times. |
| 07:17 | CookedGryphon | ben_m: then if you wanted to add other ui too... |
| 07:18 | CookedGryphon | ben_m: ah, so the difference is, defsketch actually does defapplet under the hood |
| 07:18 | ben_m | Which seems to be the same thing |
| 07:18 | CookedGryphon | in fact it seems to be an exact alias |
| 07:18 | justin_smith | now a reddit style karma system for libs |
| 07:18 | ben_m | Yeah. |
| 07:18 | ben_m | I'm currently investigating source too. |
| 07:18 | justin_smith | where each user could upvote / downvote a lib |
| 07:18 | noprompt | oh gawd. |
| 07:19 | CookedGryphon | ben_m: the :target option might be interesting to you too |
| 07:19 | CookedGryphon | :frame :perm-frame or :none |
| 07:19 | justin_smith | but then of course we would see "karma whore" libs, that include kitten pics and in jokes to get pushed to the top |
| 07:19 | CookedGryphon | I use none when embedding some graphics in another bigger ui |
| 07:19 | ben_m | I'm just calling functions from nrepl |
| 07:20 | ben_m | Still very much in the exploring phase |
| 07:22 | sm0ke | aha finally found https://github.com/pyronicide/lein-autoreload |
| 07:22 | noprompt | bitemyapp: "there is no substitute for using criterium in benchmarking. Proper." |
| 07:22 | rkz | can anyone spot the problem with my 'throttle' function here? http://cljsfiddle.net/fiddle/r4vi.cljsfiddle123 |
| 07:22 | rkz | maybe i'm misunderstanding core.async |
| 07:22 | rkz | i'm trying to throttle mouse events |
| 07:23 | CookedGryphon | rkz: why do you have a sliding buffer? |
| 07:23 | CookedGryphon | of 1... |
| 07:23 | CookedGryphon | isn't that just the same as not having a buffer? |
| 07:23 | bitemyapp | noprompt: yes. |
| 07:24 | bitemyapp | noprompt: nothing there is untrue. |
| 07:24 | bitemyapp | noprompt: I need to sleep, plz add things |
| 07:24 | rkz | CookedGryphon: I don't want it to block |
| 07:24 | CookedGryphon | it won't... that's the point of core.async |
| 07:24 | rkz | CookedGryphon: just throw away all events between 1st one and recieved while blocking for timeout |
| 07:24 | rkz | inside the go block it will |
| 07:25 | rkz | i dont want to recieve 1 mouse event every 5 seconds |
| 07:25 | rkz | i want to recieve 1 mouse event ignore all of them for 5 seconds and recieve the next one |
| 07:29 | bitemyapp | I'm off to sleep 5realz now. Goodnight all. |
| 07:29 | noprompt | bitemyapp: night buddy. |
| 07:30 | sm0ke | is robert.hooke available for every lein plugin? |
| 07:32 | noprompt | rkz: wait (>! to-throttle)? |
| 07:33 | CookedGryphon | rkz: you could share a timeout... |
| 07:34 | rkz | noprompt: bloking put onto a sliding-buffer channel of size 1, then blocking read from timeout channel of msesc |
| 07:34 | rkz | (>! to-throttle) shouldn't block and immediately wait on the timeout |
| 07:34 | noprompt | rkz: yeah but you're not putting anything on the channel. |
| 07:35 | rkz | i see |
| 07:35 | rkz | yeah |
| 07:35 | rkz | im just returning (chan) basically |
| 07:35 | rkz | whoops |
| 07:35 | yedi | what happens when you put! to a closed channel? |
| 07:36 | noprompt | yedi: http://clojure.github.io/core.async/#clojure.core.async/put! |
| 07:36 | noprompt | "Will throw if closed." |
| 07:36 | yedi | is there a way to check if a channel is closed |
| 07:37 | noprompt | yedi: you know i was wondering the same thing the other day. |
| 07:37 | drguildo | is anybody here using nrepl.el on windows? |
| 07:38 | yedi | i guess i'll just have to wrap my puts in try/catches |
| 07:38 | rkz | noprompt: i think this fixes what you're pointing out http://cljsfiddle.net/fiddle/r4vi.cljsfiddle123 |
| 07:38 | noprompt | rkz: fyi https://github.com/swannodette/swannodette.github.com/blob/master/code/blog/src/blog/utils/reactive.cljs#L239-L277 |
| 07:41 | ben_m | CookedGryphon, if you're curious still, closing the sketch is actually fine, pressing Escape is what causes nREPL to close. |
| 07:42 | ben_m | I guess that might be some hardcoded part of processing or something like that. |
| 07:42 | drguildo | if not, what's the most popular clojure development environment on windows because i've found a problem with nrepl.el that's kind of a deal breaker |
| 07:44 | noprompt | drguildo: doesn't counterclockwise work on windows? |
| 07:45 | noprompt | drguildo: https://code.google.com/p/counterclockwise/ |
| 07:45 | drguildo | noprompt, as far as i know. i really need a good development environment, especially for something like clojure with it's simple syntax and type system. |
| 07:46 | drguildo | erm, i don't mean it has a simple type system, just that with something like scala the type system helps you more by default |
| 07:47 | noprompt | drguildo: most of the folks here use Emacs. but you might wanna look at counterclockwise. also i think SublimeText now has some good plugins to get a repl etc rolling. LightTable should also work. |
| 07:49 | noprompt | drguildo: oh. i'm not sure about that. clojure's a dynamic language (aka unityped). |
| 07:50 | noprompt | drguildo: how much help an IDE will be able to give you about the correctness of your program is really hard to say. there's core.typed for static type checking though but that's outside of the scope of what you're asking for i think. |
| 07:52 | drguildo | well i was thinking more along the lines of manipulating s-expressions |
| 07:52 | drguildo | i'm a beginner and my brain isn't good at parsing them yet |
| 07:52 | drguildo | so i need all the help i can get from my tools |
| 07:53 | noprompt | drguildo: Emacs' paredit excels at that. i believe similar facilities are available for LightTable and SublimeText. |
| 07:54 | drguildo | i'm having trouble with emacs + nrepl.el, it seems windows cannot kill child processes automatically so each time i nrepl-quit i'm left with an orphaned jvm instance |
| 07:54 | noprompt | drguildo: you might also want to look into something like rainbow-delimiters or rainbow-parentheses which will highlight matching delimiters using alternating colors depending on nesting. |
| 07:54 | drguildo | lighttable has a problem with recursion causing it to bug out sometimes which makes it unresponsive. not the program itself but the magic instarepl stuff. |
| 07:54 | noprompt | drguildo: you may want to try simply running lein repl somewhere and then connecting to it from emacs vs using something like nrepl-jack-in. |
| 07:55 | drguildo | so that's a no go as well |
| 07:55 | noprompt | drguildo: yes, i've seen that happen. |
| 07:55 | drguildo | hrmm yeah, maybe. |
| 07:55 | noprompt | drguildo: typically that's how i do it. i seldom use nrepl-jack-in unless i'm being supremely lazy. |
| 07:55 | drguildo | i'm already using rainbow-delimiters, it's great. |
| 07:56 | noprompt | drguildo: paredit-mode is probably the next thing you'll want to look in to. |
| 07:57 | noprompt | drguildo: if you're fluent with paredit-mode and have you're nrepl working properly, you're pretty much set. everything else is icing on the cake. :) |
| 07:58 | noprompt | drguildo: i hope that's helpful to you. |
| 07:59 | noprompt | drguildo: i suppose if all else failed you could run a linux VM. :P |
| 08:03 | justin_smith | drguildo: you can run (System/exit 0) in a repl to kill its vm |
| 08:05 | drguildo | noprompt, thanks |
| 08:06 | noprompt | drguildo: sure thing. |
| 08:06 | noprompt | holy cow it's 0509. |
| 08:06 | noprompt | well that's my cue to sleep. |
| 08:06 | drguildo | apparently windows has no way of automatically killing a parent processes children |
| 08:07 | drguildo | which is what's causing the orphaned java.exe |
| 08:07 | drguildo | there must be a way around it though |
| 08:08 | drguildo | surely windows isn't that shit... right? |
| 08:11 | justin_smith | drguildo: as long as your agents are shut down, System/exit will shut down the vm |
| 08:12 | justin_smith | though I guess it would be annoying to have to remember to do that before exiting the editor |
| 08:13 | justin_smith | (and this is where as an emacs user with 32 gigs of ram I think "exit the editor, when does anyone ever do that?") |
| 08:13 | drguildo | i have the mentality where if there's a problem like this it really bugs me and i feel compelled to find a "proper" solution to it |
| 08:13 | drguildo | i have 16gb so memory isn't an issue either |
| 08:14 | justin_smith | if you want "proper" behavior, it is odd that you would use Windows |
| 08:14 | justin_smith | Windows has some great things, propriety isn't one of them |
| 08:14 | rkz | surprised I havent heard of this before though, must be plenty of people using windows |
| 08:14 | rkz | doing clojure |
| 08:14 | drguildo | i came to the conclusion a long time ago that there are no good operating systems, unix, linux and windows are all bad in their own special ways |
| 08:14 | justin_smith | I think a plurality are osx or linux users |
| 08:15 | justin_smith | wait, you've used a proper unix? I didn't think anyone used a licensed unix any more on a desktop |
| 08:15 | drguildo | but i don't want to argue about operating systems |
| 08:16 | drguildo | i've used freebsd and openbsd |
| 08:16 | drguildo | i used linux exclusively for years |
| 08:16 | justin_smith | those aren't unix any more than linux is |
| 08:16 | justin_smith | none are licensed as unix |
| 08:17 | drguildo | why does being licensed matter? |
| 08:17 | justin_smith | that's what makes something a unix |
| 08:17 | drguildo | if you say so |
| 08:17 | justin_smith | unix is a trademark |
| 08:17 | justin_smith | it's a certification |
| 08:18 | justin_smith | if you are going to differentiate unix vs. linux, bsd is not in the unix category |
| 08:18 | drguildo | if you say so |
| 08:19 | justin_smith | http://en.wikipedia.org/wiki/Unix#Branding |
| 08:19 | justin_smith | *bsd and linux are legally not allowed to use the unix name |
| 08:19 | justin_smith | it is a trademark and a certification |
| 08:20 | drguildo | cool |
| 08:24 | dsrx | i think people tend to not differntiate *BSD and UNIX so much because the BSDs are direct descendents of AT&T UNIX |
| 08:28 | justin_smith | anyway, I should apologize, the whole unix pedantery is irrelevant here |
| 08:28 | justin_smith | as is my opinion of anything about windows being "proper" |
| 08:29 | justin_smith | I think the proper thing is if a program starts a jvm that you wouldn't use after its exit, it should safely shutdown said vm |
| 08:30 | justin_smith | drguildo: are you seeing this phenomenon with emacs / nrepl on windows? |
| 08:30 | drguildo | yeah |
| 08:32 | justin_smith | if there is an nrepl.el command that shuts down all jacked-in repls, you could add that to kill-emacs-hook |
| 08:32 | justin_smith | any function added to kill-emacs-hook will get run if emacs is exited in a normal way |
| 08:33 | drguildo | the problem is nrepl.el spawns a java.exe process which has a java.exe child but when the parent is killed it doesn't kill the child |
| 08:33 | drguildo | either explicitly or automatically (windows doesn't kill children when the parent is killed) |
| 08:33 | drguildo | i don't know why java.exe even has the child to begin with but i'd like to |
| 08:33 | justin_smith | OK, so what we need is a command that sends a message to each open repl owned by emacs, and tells it to exit |
| 08:34 | justin_smith | sounds like something that could be done in four or five lines of elisp, if it is not in nrepl already |
| 08:35 | justin_smith | the tricky thing I guess is the owned by emacs vs. connected to and should stay running distinction |
| 08:35 | drguildo | https://github.com/clojure-emacs/cider/issues/390 |
| 08:35 | justin_smith | for example I use emacs to host a repl inside a server - just because I quit emacs does not mean I want that server to shut down |
| 08:35 | justin_smith | s/host/connect-to |
| 08:36 | justin_smith | OK, that's helpful |
| 08:36 | justin_smith | (that link) |
| 08:37 | justin_smith | I think an elisp command that sends (System/exit 0) to be evaluated by a child repl would fix that issue |
| 08:37 | justin_smith | heh, and now I see you say the same thing there |
| 08:38 | drguildo | :-) |
| 08:39 | drguildo | the problem is ultimately with windows but the chances of getting that fixed are practically 0 |
| 08:39 | justin_smith | right |
| 08:39 | justin_smith | thus my snark about propriety and windows :) |
| 08:40 | drguildo | but maybe there could be some kind of workaround implemented in emacs's delete-process |
| 08:40 | drguildo | but i don't know enough about windows system programming to have any ideas |
| 08:40 | justin_smith | but the point of the jvm is to smooth over such things, so why not rely on the jvm (by telling it nicely to exit) rather than the os (by depending on shutdown behaviors specific to sane operating systems) |
| 08:40 | drguildo | i've looked around and there are no obvious/easy ways of find a processes children |
| 08:40 | drguildo | true |
| 08:41 | WWWest1 | hi all |
| 08:41 | justin_smith | I mean if everyone had a sane OS, we wouldn't need the jvm now would we |
| 08:41 | drguildo | it could also be seen as a problem in java.exe because it should really be killing it's child when it gets the signal to exit |
| 08:41 | dsrx | does the jvm run on templeos? |
| 08:42 | justin_smith | LOLOL |
| 08:42 | WWWest1 | is there something special to do to get :advanced compilation working when targeting node? |
| 08:42 | justin_smith | dsrx: speaking of sane os's |
| 08:42 | WWWest1 | my project compiles but dies with has no method 'zb' when I run it |
| 08:42 | drguildo | templeos has ascended beyond the need for virtual machines |
| 08:43 | makkalot | hi, is someone using austin, ? |
| 08:43 | WWWest1 | do the modules I use through node/require need to be declared as extern libs or something? |
| 08:45 | justin_smith | woah, cleaning up browser windows I see that OSX paid for unix certification |
| 08:46 | drguildo | is templeos a unix? |
| 08:46 | francis_wolke | It's rather annoying that all library sources are stored in .jar files, as this prevents me from r-grepping the libraries that I use - is there an solution to this I'm simply oblivious to? There __are__ solutions, ( http://stackoverflow.com/questions/1342894/find-a-class-somewhere-inside-dozens-of-jar-files ) but I'm asking anyway because it seems likely that someone has had this issue before and solved it. |
| 08:47 | justin_smith | francis_wolke: if you know which ones you want to search, jars are zip files |
| 08:47 | clojurebot | It's greek to me. |
| 08:47 | justin_smith | you can unzip them |
| 08:49 | justin_smith | you could do something like: for i in $(lein classpath | grep jar); do mkdir $(basename $i .jar); cd $(basename $i .jar); unizp $i; done |
| 08:49 | justin_smith | that is not complete, but close to what would do it |
| 08:52 | francis_wolke | justin_smith: Adknowledged. |
| 08:54 | justin_smith | I just experimented with emacs archive mode - it lets you open and edit jars without extracting them, but does not allow search rgrep style |
| 08:54 | justin_smith | francis_wolke: agreed that this is an annoying issue btw |
| 08:54 | francis_wolke | justin_smith: Yep. I walked down that path too. |
| 08:54 | francis_wolke | justin_smith: Elisp hacking time I suppose. *sigh* |
| 08:54 | justin_smith | definitely an option :) |
| 08:55 | justin_smith | M-x jar-occur |
| 08:55 | justin_smith | would be sweet |
| 09:04 | CookedGryphon | Or, get cloc 0.1.0 and do lein cloc |
| 09:05 | CookedGryphon | my colleague wrote it, it scans all the jars on your classpath and source folder, running codox over them building documentation for every namespace sorted by library |
| 09:05 | CookedGryphon | and indexing them to be lucene searchable |
| 09:05 | justin_smith | CookedGryphon: if people use doc strings, that seems like it would work |
| 09:05 | henryw374 | codeq could help here. u need a script to pull all src of all deps into a codeq instance - which i dont have btw. then query away |
| 09:05 | CookedGryphon | indeed, which they should. It searches on the function name too |
| 09:06 | justin_smith | CookedGryphon: I have coworkers who see doc strings as irrelevant decoration, so the only way to figure the namespace out is to read the whole god damned source file |
| 09:07 | justin_smith | grumble grumble |
| 09:07 | CookedGryphon | justin_smith: marginalia might be better for you then |
| 09:07 | justin_smith | yeah |
| 09:07 | justin_smith | or hs-mode in emacs |
| 09:07 | justin_smith | which comes out to the same thing if you don't have doc strings :) |
| 09:08 | justin_smith | now I am dreaming of a variant of hs that hides everything but the doc string... |
| 09:08 | justin_smith | that would be sweet |
| 09:09 | CookedGryphon | focus-mode - you can only see the source of one thing at a time |
| 09:09 | CookedGryphon | if you find yourself needing to look at two, you haven't named/documented it sufficiently |
| 09:09 | CookedGryphon | fix that then continue |
| 09:09 | justin_smith | that is how I use hideshow basically |
| 09:10 | justin_smith | collapse all, expand one at a time |
| 09:10 | justin_smith | but my main collaborator has an "abstract all the things" philosophy, such that his code is not readable that way |
| 09:11 | justin_smith | common conversation him: "why use flet, and not just put it in its own defn?" me: "why make a top level defn that will only be used in one place?" |
| 09:12 | justin_smith | I am more likely to repeat small things, he is more likely to have definition-spaghetti |
| 09:13 | CookedGryphon | it's not spaghetti if it does one well defined small thing and doesn't have tendrils |
| 09:13 | justin_smith | CookedGryphon: spaghetti as in you cannot figure out what this thing is doing without recursively following 5 or more definitions spread throughout the file |
| 09:13 | justin_smith | each one is small |
| 09:14 | CookedGryphon | so that's badly named |
| 09:14 | justin_smith | and too abstract to have an intuitively meaningful name |
| 09:14 | CookedGryphon | yeah, you need to be able to name it |
| 09:14 | justin_smith | right, they are weird hard to name things he is abstracting out |
| 09:15 | justin_smith | https://github.com/caribou/caribou-core/blob/master/src/caribou/model.clj#L111 |
| 09:15 | justin_smith | for example |
| 09:16 | justin_smith | screen after screen of weird little definitions |
| 09:16 | CookedGryphon | i don't even understand the docstring on the top level function there though :P |
| 09:16 | CookedGryphon | but yeah i see your point |
| 09:17 | CookedGryphon | if you're having to do lots of funny little custom transformations like that... it makes me wonder whether the underlying data structure is actually to blame |
| 09:17 | justin_smith | and notice that splinter-order is only ever called once in the entire codebase! |
| 09:17 | justin_smith | why even make that a function :( |
| 09:17 | CookedGryphon | (disclaimer, that opinion is entirely based on these few lines) |
| 09:18 | justin_smith | it's more like he has a write-only brain for algorithms sometimes |
| 09:18 | justin_smith | don't get me wrong, he is brilliant, and it is solely thanks to him that caribou does what it does so well - but working on his code can be maddening |
| 09:18 | justin_smith | OK, done griping about my best friend now :) |
| 09:20 | justin_smith | CookedGryphon: actually the data structures are pretty straightforward, though the impedence mismatch between sql and clojure maps can be a bit sticky sometimes |
| 09:38 | justin_smith | for a while I used sets as a shorthand for testing for any of multiple equalities (set membership) |
| 09:38 | justin_smith | (defn is [& things] (let [preds (map #(fn [x] (= x %)) things)] (apply some-fn preds))) |
| 09:38 | justin_smith | compared to the equivalent set used as a predicat, the average time is 1.48 microseconds |
| 09:38 | justin_smith | as opposed to 100 nanoseconds |
| 09:39 | justin_smith | which is how many orders of magnitude? wow |
| 09:40 | justin_smith | err wait |
| 09:41 | justin_smith | I got the order of micro and nano mixed up |
| 09:48 | xeqi | dnolen: does form-seq (really form-seq*) cause a rebinding everytime a value is realized from the resulting lazy-seq? |
| 09:48 | xeqi | I thought it did, but perhaps I missunderstand lazy-seq recursion w/ dynamic vars |
| 09:55 | nonuby | compojure depends on clojure 1.3.0 https://github.com/weavejester/compojure/blob/master/project.clj so what happens when i bring compojure into my new project that is according to my project.clj on 1.5.1? |
| 09:57 | CookedGryphon | nonuby: I *believe* it'll default to the latest version and assume back compatibility. Which in this case is a correct assumption, so you'll be fine |
| 09:57 | justin_smith | nonuby: it should still work, you may want to use an :exclusions clause in your dependencies so that you don't accidentally get the wrong clojure version |
| 09:57 | justin_smith | with a recent library, I actually left out the clojure dependency, because I assume nobody using it would not be using clojure |
| 09:58 | justin_smith | I wonder if that is bad form |
| 09:58 | CookedGryphon | justin_smith: if nothing else it documents which version you had in mind when you wrote it. I would say it was bad form |
| 09:58 | CookedGryphon | clojure is a funny one though, because it is really very stable and back compatible |
| 09:58 | nonuby | clj-http lists in dev dependencies rather than deps |
| 10:00 | justin_smith | CookedGryphon: the library is miniscule, it is really just a dependency injection of avout as a state coordinator into a caribou app (replacing an atom caribou used with an avout distributed atom) |
| 10:01 | justin_smith | my reason for doing this is so often I have gotten a wrong clojure version (or wrong foo version) indirectly through some random lib |
| 10:01 | CookedGryphon | tell you what we need... immutable libraries |
| 10:02 | CookedGryphon | and when you compile code, it closes over the versions of the libraries you use |
| 10:02 | CookedGryphon | then instead of jars, have some git-like construct |
| 10:02 | justin_smith | not really compatible with the clojure classloader |
| 10:02 | CookedGryphon | to give you immutable library versions |
| 10:02 | dnolen | xeqi: it does because it calls re-form, which will rebind |
| 10:02 | dnolen | xeqi: lazy sequences and binding do not compose |
| 10:02 | dnolen | xeqi: you always have to capture before you start |
| 10:02 | justin_smith | CookedGryphon: unless we had a new ns with every library version |
| 10:02 | dnolen | s/re-form/read-form |
| 10:03 | xeqi | dnolen: I meant on current master |
| 10:03 | dnolen | xeqi: the behavior is correct and master and incorrect in your patch |
| 10:03 | dnolen | s/and/in |
| 10:05 | CookedGryphon | justin_smith: not necessarily... the build/packaging tool could manage that |
| 10:05 | dnolen | xeqi: oops actually, master is wrong too :) |
| 10:06 | dnolen | xeqi: actually it's not ... *cljs-ns* and *alias-map* is correct because those might change during reading |
| 10:06 | justin_smith | CookedGryphon: so how is it handled when two versions of clojure are relied on? |
| 10:06 | dnolen | xeqi: I mean master is right for those |
| 10:07 | dnolen | xeqi: and data-readers is also right - because we need to bind that based on what it was when we started |
| 10:07 | dnolen | xeqi: so yeah master is correct here |
| 10:07 | xeqi | dnolen: heh, I'm good with the changes proposed (as mentioned in my latest comment). Just was really curious about behaviour difference |
| 10:08 | dnolen | xeqi: so what was the dec thing in compiler.clj all about? |
| 10:08 | dnolen | gotta run, bbiab |
| 10:16 | ohcibi | hi, is there an equivalent for this: http://clojuredocs.org/clojure_core/clojure.core/vector for sequences? i found sequence but it just takes a coll as single argument and turns it into a seq.. |
| 10:16 | `cbp | ohcibi: no, you construct seqs "by hand" |
| 10:17 | `cbp | Assuming that's what you meant by sequences |
| 10:17 | `cbp | sequences are actually a superset that includes vectors, lists, seqs, etc |
| 10:18 | ohcibi | `cbp: yes but I need a function like vector that takes many arguments and creates a sequence from it to pass to map, so I wonder why there is no function like vector |
| 10:18 | justin_smith | seq does not create a sequence, it creates a "cursor" on a sequence |
| 10:18 | justin_smith | the overhead is pretty low, it is a convenience so you can check the first / rest etc. and iterate on it |
| 10:19 | justin_smith | ohcibi: map turns an argument into a sequence |
| 10:19 | clgv | o:O |
| 10:19 | clgv | o_O |
| 10:19 | justin_smith | ohcibi: the input to map can be any collection that can be treated as a sequence |
| 10:20 | ohcibi | justin_smith: i need a function that takes many arguments and returns a sequence from them... |
| 10:20 | ohcibi | like vector does |
| 10:20 | justin_smith | vector is a sequential |
| 10:20 | justin_smith | sequence is not a type |
| 10:20 | clgv | ohcibi: why not use vector? |
| 10:20 | justin_smith | it describes many types |
| 10:20 | justin_smith | you could use vector, list, hell if you don't care about the order you could use set |
| 10:21 | justin_smith | *hash-set |
| 10:22 | justin_smith | or if you prefer you could use a java array or List |
| 10:22 | justin_smith | map will iterate over any of them by using a seq |
| 10:23 | TEttinger | a function that takes many arguments and creates a sequence from it to pass to map: ##((fn [& args] (map inc args)) 1 2 3 4 5) |
| 10:23 | lazybot | ⇒ (2 3 4 5 6) |
| 10:23 | justin_smith | that's another way to do it, sure :) |
| 10:23 | ohcibi | ah... indeed I confused "sequence" with list |
| 10:23 | TEttinger | I just meant the many args thing |
| 10:23 | justin_smith | ((fn [& args] args) 1 2 3 4 5) |
| 10:23 | justin_smith | ,((fn [& args] args) 1 2 3 4 5) |
| 10:23 | clojurebot | (1 2 3 4 5) |
| 10:24 | clgv | ohcibi: if the current answers dont suffice for you just provide concrete examples for the input and output |
| 10:24 | ohcibi | clgv: no no, its just that I confused sequence with list, so there was no way to give proper answers 8-) |
| 10:24 | TEttinger | I wonder... |
| 10:25 | justin_smith | ,(class ((fn [& args] args) 1 2 3 4 5)) |
| 10:25 | clojurebot | clojure.lang.ArraySeq |
| 10:25 | justin_smith | ,(class (list 1 2 3 4 5)) |
| 10:25 | clojurebot | clojure.lang.PersistentList |
| 10:26 | justin_smith | ,(class (reduce conj () [1 2 3 4 5])) |
| 10:26 | clojurebot | clojure.lang.PersistentList |
| 10:26 | TEttinger | ,(map first (java.util.TreeMap. (sorted-map :a 1 :b 2))) |
| 10:26 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.util.TreeMap$Entry> |
| 10:26 | xeqi | dnolen: (dec column) was meant to be a seperate patch. yet another instance of 0 vs 1 indexing difference between tools.reader and sourcemaps |
| 10:26 | TEttinger | so it can map over java types cool |
| 10:27 | justin_smith | ,(map identity (java.util.TreeMap. (sorted-map :a 1 :b 2))) |
| 10:27 | clojurebot | (#<Entry :a=1> #<Entry :b=2>) |
| 10:28 | justin_smith | ,(map identity "hello") |
| 10:28 | clojurebot | (\h \e \l \l \o) |
| 10:28 | justin_smith | :) |
| 10:29 | justin_smith | though map on a string is usually a pretty bad idea |
| 10:29 | justin_smith | it totally works |
| 10:29 | TEttinger | it is totally not a bad idea if you need character manipulating |
| 10:29 | TEttinger | it just uh... shouldn't be needed... |
| 10:30 | justin_smith | depends on if you care about memory usage / execution time |
| 10:30 | justin_smith | sticking string ops on strings makes a big difference |
| 10:30 | TEttinger | lazy seqs vs. strings though...? |
| 10:31 | justin_smith | (says the guy who made the mistake of ubiquitously using seq ops on strings in a webapp and felt the pain) |
| 10:31 | TEttinger | heh. |
| 10:32 | justin_smith | a sequence from a string, compared to a string, will likely use at least 4 times the space, not to mention the difference in search and alteration time |
| 10:32 | justin_smith | 4 times the size is hazy and from memory.. let me see if I can get more accurate |
| 10:35 | justin_smith | ,[Character/SIZE (count (.getBytes "a"))] |
| 10:35 | clojurebot | [16 1] |
| 10:35 | TEttinger | ,[(count (.getBytes "a")) (count (.getBytes \a))] |
| 10:35 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: getBytes for class java.lang.Character> |
| 10:36 | justin_smith | so a primitive character is 2 times the size |
| 10:36 | justin_smith | \a is not a collection |
| 10:36 | justin_smith | looking for the size of the class |
| 10:36 | TEttinger | also an array might be different? |
| 10:36 | justin_smith | which is different from char |
| 10:36 | justin_smith | yes, array vs. seq |
| 10:36 | justin_smith | because an array is unboxed |
| 10:37 | justin_smith | so if you used a char-array, that would be smaller than a seq of character objects by a significant margin |
| 10:37 | justin_smith | and both are larger than a string of equivalent contents |
| 10:37 | justin_smith | and then you have the optimized string ops, as compared to the ops on collections that are more general and have to be more cautious |
| 10:42 | justin_smith | TEttinger: comparison of seq vs. string ops http://sprunge.us/TTNK |
| 10:42 | justin_smith | a simple one, but informative |
| 10:43 | TEttinger | woah! |
| 10:44 | justin_smith | yeah, the differnce is pretty big. Though to be fair, you would only construct that seq once and convert the seq back to string in actual practice, you would need a more realistic example for that |
| 10:45 | TEttinger | I do wonder if it would make sense to use java strings as a basis for specialized data. I'm almost certain my crappy game's map could be represented with unicode... |
| 10:45 | justin_smith | or you could use an array if it is a performance bottleneck |
| 10:45 | justin_smith | I guess with string you get the advantage it is still immutible |
| 10:45 | TEttinger | I am. but it uses a ton of memory now |
| 10:46 | justin_smith | an array of what type? |
| 10:46 | TEttinger | ,(count (.getBytes "╬")) |
| 10:46 | clojurebot | 3 |
| 10:47 | justin_smith | also, you could consider a sparse map |
| 10:47 | `cbp | I always used .toCharArray for codejam stuff :-) |
| 10:47 | lnostdal | SegFaultAX: from the chat yesterday (if you recall) this was the problem for me: https://github.com/clojure-emacs/cider/issues/408#issuecomment-29471701 |
| 10:47 | TEttinger | I actually kinda did a sparse map in C# for some of this |
| 10:47 | TEttinger | then later rewrote in clojure |
| 10:48 | justin_smith | TEttinger: for example I have been playing with quad trees for representing some rectangle packing stuff, and the advantage of only needing storage for occupied space is nice |
| 10:48 | justin_smith | also makes iterating easier |
| 10:49 | justin_smith | I guess in 3d they ubiquitously use octrees |
| 10:49 | justin_smith | same concept |
| 10:49 | TEttinger | I think now I'm using ^doubles arrays. not sure if that boxes or not? |
| 10:50 | justin_smith | ^doubles should be unboxed |
| 10:50 | justin_smith | you could use jvisualvm and compare the memory used by the object to the count to know for sure :) |
| 10:50 | justin_smith | jvisualvm is really helpful for investigating this stuff |
| 10:50 | clgv | TEttinger: the values in the ^doubles array are primitiv |
| 10:50 | justin_smith | alongside criterium |
| 10:51 | clgv | TEttinger: there is also `vector-of` for primitives |
| 10:52 | TEttinger | I have never been able to figure out visualvm |
| 10:53 | `cbp | you can also compile to .class then decompile into java with something like jd-gui :) |
| 10:53 | TEttinger | then probably it has something to do with either logic code (which uses large vectors for each creature), or more likely the rendering is poorly done |
| 10:54 | justin_smith | the difference in storage space used between a sequence of char and a string is 3/2 + (housekeeping data of sequence)/8 |
| 10:54 | justin_smith | 3/2*length that is |
| 10:54 | `cbp | that's the only sure way i know to check for boxing |
| 10:54 | justin_smith | also, TIL each bool is 8 bytes in size minimum, even when optimized |
| 10:55 | TEttinger | 8 BYTES? |
| 10:55 | TEttinger | for 64-bit stuff? |
| 10:55 | justin_smith | "a normal object requires 8 bytes of "housekeeping" space;" |
| 10:55 | clgv | `cbp: Luyten is much better than jd-gui (and the jd-gui website is down, isnt it?) |
| 10:55 | justin_smith | unboxed 8 bits, sorry |
| 10:55 | justin_smith | oh, so my math above is way off |
| 10:56 | justin_smith | 9/2*count + seq-stuff/8 |
| 10:56 | justin_smith | for sequence of char vs. string |
| 10:56 | `cbp | clgv: it seems up for me: http://jd.benow.ca/ |
| 10:56 | `cbp | clgv: Ive never used luyten though |
| 10:56 | clgv | oh on a new URL? |
| 10:57 | justin_smith | TEttinger so the minimum size of a bool is 8 bits, 9 bytes if it is a standalone boxed bool |
| 10:57 | justin_smith | crazy |
| 10:57 | clgv | `cbp: Luyten is a small frontend for procyon which had much ebtter results on the class files I got from clojure |
| 10:58 | `cbp | i'll check it out |
| 10:58 | clgv | `cbp: I upgraded it to use the latest version of procyon overhere: https://github.com/guv/Luyten/releases |
| 10:58 | justin_smith | TEttinger: which is a good argument for using bytes as bit-vectors |
| 10:58 | clgv | `cbp: the original developer seems not very reactive |
| 10:59 | `cbp | :P |
| 10:59 | clgv | oh jd-gui has no 0.3,6 release for linux? |
| 10:59 | justin_smith | clgv: so is that the decompiler you would recommend? |
| 11:00 | clgv | justin_smith: you mean procyon via Luyten GUI? |
| 11:00 | ea- | newbie question here.. if I have a string, and a vector, how can I prepend the string into the vector? |
| 11:00 | justin_smith | I recently got the "clojure high performance programming" book and it recommended jd-gui |
| 11:00 | justin_smith | clgv: yeah |
| 11:01 | `cbp | that book sounds interesting :) |
| 11:01 | ea- | right now im doing (into [mystring] myvector) and it's adding each character from the string into the vector as an element |
| 11:01 | clgv | justin_smith: it managed to decompile class files where jd-gui/jd-core failed (showed only bytecode) |
| 11:01 | Profpatsch | I’m trying to configure ac-nrepl. It works for the REPL, is there a way to couple it into my clojure-mode buffer? |
| 11:01 | arcatan | justin_smith: what's this book? |
| 11:01 | ea- | also tried (conj myvector mystring) and it still adds each character fmor the string into the vector |
| 11:01 | justin_smith | ,(apply vector "your string" [1 2 3]) ; ea-: |
| 11:01 | clojurebot | ["your string" 1 2 3] |
| 11:02 | clgv | justin_smith: I think you should install both and on failure check if the other one manages decompilation of the class file |
| 11:02 | arcatan | ah, found it |
| 11:02 | justin_smith | ea-: if you don't mind the string being at the end instead, you can use conj, and that is much more efficient |
| 11:02 | justin_smith | clgv: cool, sounds like a plan |
| 11:02 | justin_smith | ,(conj [1 2 3] "your string") ; ea-: |
| 11:02 | clojurebot | [1 2 3 "your string"] |
| 11:03 | justin_smith | ea-: or use a list and conj, that will put it on the front |
| 11:03 | justin_smith | ,(conj (list 1 2 3) "your string") |
| 11:03 | clojurebot | ("your string" 1 2 3) |
| 11:03 | ea- | hmm.. still seem to be getting the same issue |
| 11:03 | justin_smith | arcatan: shantanu kumar, clojure high performance programming |
| 11:04 | justin_smith | it's good, though slim |
| 11:04 | justin_smith | not much filler though |
| 11:04 | ea- | (csv/write-csv *out* (apply vector [url (re-seq re-expn line)])) |
| 11:04 | justin_smith | http://www.packtpub.com/clojure-high-performance-programming/book |
| 11:04 | justin_smith | ea-: what issue |
| 11:04 | ea- | seems to add each character of the "url" into the vector instead of the whole string. |
| 11:04 | justin_smith | ea-: the order of the args is wrong |
| 11:05 | ea- | basically just trying to prepend the vector returned by re-seq with the string "url" |
| 11:05 | justin_smith | you are putting the vector into the string |
| 11:05 | ea- | oh, damn! |
| 11:05 | ea- | haha |
| 11:05 | justin_smith | ea-: sorry, missed where you described that above |
| 11:05 | justin_smith | ,[(into "hello" [:a :b :c]) (into [:a :b :c] "hello")] |
| 11:05 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IPersistentCollection> |
| 11:05 | justin_smith | err |
| 11:06 | justin_smith | ea-: no, I was right the first time |
| 11:06 | justin_smith | use conj |
| 11:06 | justin_smith | into treats the string as a collection |
| 11:06 | ea- | ok let me try into |
| 11:07 | justin_smith | ,(into [:a :b :c] ["hello"]) |
| 11:07 | clojurebot | [:a :b :c "hello"] |
| 11:07 | justin_smith | that is one way to do it |
| 11:07 | justin_smith | but really you could just conj |
| 11:07 | justin_smith | ,(conj [:a :b :c] "hello") |
| 11:07 | clojurebot | [:a :b :c "hello"] |
| 11:07 | ea- | i must be missing something reallty obvious |
| 11:07 | ea- | (csv/write-csv *out* (conj (re-seq re-expn line) url)) |
| 11:07 | ea- | that still adds each character of the string URL inrto the vector |
| 11:08 | justin_smith | re-seq returns a lazyseq not a vector |
| 11:09 | ea- | hmm |
| 11:09 | justin_smith | ,(conj (re-seq #"[^ ]+" "this is a test") "hello") |
| 11:09 | clojurebot | ("hello" "this" "is" "a" "test") |
| 11:09 | justin_smith | what else are you doing to url - maybe something else is turning it into a seq before that |
| 11:09 | gtrak | dnolen: managed to make ISeq first/rest work with array-copy, inefficient, but works. |
| 11:09 | justin_smith | if so, (apply str url) |
| 11:10 | justin_smith | ,(apply str [\a \b \c]) |
| 11:10 | clojurebot | "abc" |
| 11:10 | ea- | https://gist.github.com/earle/0a5266fd0ebb4db5cc43 |
| 11:10 | Bronsa | xeqi: any issue working with the source-logging reader? |
| 11:11 | justin_smith | ea-: yeah, don't use apply vector |
| 11:11 | ea- | i have some futures that are grabbing some urls and tokenizing an access log. .trying to prepend the url to the csv returned frmo re-seq |
| 11:11 | justin_smith | ea-: use conj |
| 11:11 | ea- | yeah im using conj, and its tokenizing the string into characters in the vector |
| 11:12 | justin_smith | ea-: that gist is using apply vector |
| 11:12 | `cbp | can you paste what you're actually using? :P |
| 11:13 | ea- | https://gist.github.com/earle/0a5266fd0ebb4db5cc43 |
| 11:13 | ea- | sorry hadnt updated the gist ;) |
| 11:13 | `cbp | the arguments to conj are in reverse order |
| 11:14 | `cbp | oh nevermind me |
| 11:14 | justin_smith | `cbp: I was gonna say :) |
| 11:14 | ea- | my first real clojure program.. figures i get the futures right, but cant figure out how to put a string into the vector ;) |
| 11:15 | justin_smith | ea-: how sure are you that the code in that gist is running when you get a request? |
| 11:15 | ea- | its running, its writing everything to stdout |
| 11:16 | justin_smith | and it is definitely running that version and not an old definition? |
| 11:16 | ea- | yeagh |
| 11:16 | `cbp | I imagine write-csv takes a sequence of [column-names & rows] so i guess you're telling the csv that column-names is the url so it takes each char as a column |
| 11:18 | `cbp | or i may be completely wrong, ea- which library are you using |
| 11:19 | ea- | im using https://github.com/clojure/data.csv |
| 11:19 | ea- | if i take out the conj and url, and just write the csv, it works fine |
| 11:20 | justin_smith | ea-: I just commented something you can try on that gist |
| 11:20 | ea- | trying to prepend the url into it is adding each character of the url instead of the string |
| 11:20 | justin_smith | to see what conj is returning |
| 11:20 | justin_smith | conj really does not work that way, something else is going on |
| 11:21 | justin_smith | the doto form returns what conj would have returned, while also printing |
| 11:22 | justin_smith | wait, I fucked that up, one sec |
| 11:23 | justin_smith | ea-: updated |
| 11:24 | ea- | ok.. |
| 11:25 | ea- | yeah this makes sense.. i changed it to println, and it works: |
| 11:25 | ea- | (println (conj (re-seq re-expn line) url)) |
| 11:25 | justin_smith | err |
| 11:25 | ea- | (http://notebook.cowgar.com/access.log [1.202.218.8 - - [03/Jun/2012:13:51:44 -0400] "GET /robots.txt HTTP/1.0" 404 1.202.218.8 - - 03/Jun/2012:13:51:44 -0400 "GET /robots.txt HTTP/1.0" 404]) |
| 11:25 | justin_smith | right, so conj is doing the right thing |
| 11:25 | ea- | not really |
| 11:25 | ea- | its not adding to the vector.. it returned a new sequence with the url then the vector in it |
| 11:26 | justin_smith | OH |
| 11:26 | justin_smith | shit |
| 11:26 | justin_smith | line is not a string, it is a collection? |
| 11:26 | justin_smith | wait, no |
| 11:27 | ea- | its the result of spit-lines |
| 11:27 | ea- | which should be a string right? |
| 11:27 | AimHere | It's a collection of strings |
| 11:27 | AimHere | Probably a vector |
| 11:27 | `cbp | i dont see how it can work at all haha since write-csv needs a vector of vectors and youre passing it a seq of strings as far as i can tell |
| 11:28 | ea- | https://gist.github.com/earle/0a5266fd0ebb4db5cc43 |
| 11:28 | ea- | is where im at.. im just using println right now |
| 11:29 | `cbp | can you use prn insteand of println |
| 11:29 | justin_smith | what is re-expn |
| 11:29 | justin_smith | I think re-seq re-expn is not returning the data structure you expect |
| 11:29 | justin_smith | does it have any grouping in it? |
| 11:30 | ea- | updated the gist with the whole thing.. re-seq is returnignt he vector |
| 11:31 | ea- | this app is: 1) read urls for access logs from a file 2) grab urls 3) parse into csv prepending with the url of where it came frmo |
| 11:31 | ea- | and re-seq seems to be dong just fine.. i just cant figure out how to prepend the vector retruned by re-seq with the url |
| 11:32 | justin_smith | ea-> when you have multiple groups like that, re-seq returns a nested structure |
| 11:32 | justin_smith | ,(conj (re-seq #".*(s).*" "this is a test") "hello") |
| 11:32 | clojurebot | ("hello" ["this is a test" "s"]) |
| 11:32 | justin_smith | that is your problem |
| 11:32 | ea- | re-seq is returning one vector not nested, its fine |
| 11:32 | justin_smith | you need to massage the output of re-seq |
| 11:32 | justin_smith | no it is not |
| 11:33 | ea- | oh, yeah you're right |
| 11:33 | ea- | hmm |
| 11:33 | justin_smith | ,(re-seq #".*(s).*" "this is a test") |
| 11:33 | clojurebot | (["this is a test" "s"]) |
| 11:33 | justin_smith | nested structure |
| 11:33 | justin_smith | if you conj to that, the conjed thing will be in the outer group, but not the inner |
| 11:33 | ea- | ok i just need to change my regex then |
| 11:33 | justin_smith | so the problem is you did not know the data structure re-seq was returning |
| 11:33 | justin_smith | conj was behaving properly |
| 11:33 | ea- | yup, ok thanks.. so now i just need to fix hte regex |
| 11:34 | ea- | ok this makes me feel better i was really confused ;) |
| 11:34 | justin_smith | glad we sorted it out, I was confused for a moment too, and I should know better |
| 11:35 | ea- | yeah.. thanks.. happen to have a good regex for parsing an apache log? |
| 11:35 | justin_smith | I bet org.apache.something has a log file parser class you can use :) |
| 11:39 | justin_smith | http://stackoverflow.com/questions/6623974/parsing-log4j-layouts-from-log-files |
| 11:40 | justin_smith | if you know apache's patternlayout config, you can use that to generate your parser |
| 11:40 | justin_smith | bonus, if the config changes your parsing still works :) |
| 11:57 | francis_wolke | justin_smith: https://gist.github.com/francis-/7694998 |
| 11:57 | justin_smith | francis_wolke: so you went for the for loop method, nice |
| 11:58 | justin_smith | another option could be decompressing to /tmp |
| 11:59 | justin_smith | but then you would need to manipulate the search path or make a symlink I guess |
| 11:59 | francis_wolke | justin_smith: Yup. |
| 12:02 | justin_smith | the for loop on lein classpath method would have the "advantage" of unpacking all your recursive deps |
| 12:03 | justin_smith | before an rgrep |
| 12:03 | justin_smith | maybe that should be a separate function, if it should even exist :) |
| 12:03 | justin_smith | check for project.clj, query for unpack all deps into a subdir before rgrep |
| 12:07 | francis_wolke | justin_smith: In that case you have to deal with other people, submit a pull request - ect. ect. Personally, I don't feel like doing all that. 10 minutes is about my maximum amount of time I'm willing to invest. Please don't let my negativity prevent you from creating the solution though. |
| 12:07 | justin_smith | why? you can just write a function that calls rgrep |
| 12:07 | justin_smith | but sure |
| 12:24 | francis_wolke | justin_smith: I had to kill emacs, and don't have our previous conversation. Iirc you wanted to tie into lein. I'm not familiar with what lein offers in terms of running functions on startup. Also, if at all possible, I'd prefer to do things from emacs, that way if at some point in the future I'd like to change something, it's a M-. or two away. |
| 12:24 | francis_wolke | Emacs has more staying power that either the JVM or clojure. I'd prefer to invest in it, and it's model rather than a particular build tool. |
| 12:24 | justin_smith | francis_wolke: I was just suggesting running lein classpath from the shell |
| 12:25 | justin_smith | I almost have the script working actually, I will share when done |
| 12:26 | justin_smith | http://sprunge.us/LAhN |
| 12:26 | justin_smith | run it from the top level of the project |
| 12:26 | justin_smith | puts everything under alldeps |
| 12:26 | justin_smith | just run it before doing the rgrep |
| 12:27 | justin_smith | I think the only non-standard command in there is basename |
| 12:27 | justin_smith | it could be replaced with anything that takes a file and generates a good directory name out of the full path |
| 12:27 | justin_smith | but I recommend having basename if you ever use the shell |
| 12:28 | francis_wolke | justin_smith: Cool. But what happens when you dynamically pull in a dep with pomogranate? |
| 12:28 | justin_smith | then you can fix the script |
| 12:28 | justin_smith | or do your version of the rgrep from the location that has the lib's jar |
| 12:28 | francis_wolke | justin_smith: Exactly |
| 12:29 | justin_smith | the advantage here is you can semi-instantly have all jars declared in project.clj open for investigation and recursive search |
| 12:30 | justin_smith | and in one tidy place so you can remove them again |
| 12:30 | justin_smith | *all jars required via declarations in project.clj, including nested dependencies |
| 12:39 | poppingtonic | hi |
| 12:40 | poppingtonic | is there anyone who can guide me on how to connect Weka to my leiningen project? |
| 12:40 | justin_smith | poppingtonic: have you found the maven repo and required it in your project.clj? |
| 12:41 | poppingtonic | justin_smith: yes. |
| 12:41 | poppingtonic | Is that all there is? |
| 12:41 | justin_smith | well that is the first step |
| 12:41 | justin_smith | I would have explained how to do it if you had not done it yet |
| 12:42 | justin_smith | I'd say find a simple example / tutorial that gets close to what you want to try, and translate from java to clojure jvm interop |
| 12:42 | poppingtonic | justin_smith: ah, cool. I've downloaded v3.7.10, and extracted it. Where do I put weka.jar? |
| 12:42 | justin_smith | wait |
| 12:42 | justin_smith | I said require it in your project.clj |
| 12:43 | justin_smith | lein will just find it and hand it to you |
| 12:44 | hyPiRion | poppingtonic: could you provide us with the URL to the WEKA maven repo? |
| 12:44 | justin_smith | so you want something like [nz.ac.waikato.cms.weka/weka-stable "3.6.6"] in the project.clj dependencies vector |
| 12:44 | justin_smith | hyPiRion: I think it is this: http://mvnrepository.com/artifact/nz.ac.waikato.cms.weka/weka-stable/3.6.6 |
| 12:44 | poppingtonic | yeah, sec |
| 12:45 | hyPiRion | justin_smith: yeah, except he has 3.7.10 |
| 12:45 | ohcibi | ok, I learned that a vector is a sequence, but why does (seq? [1]) return false? |
| 12:45 | poppingtonic | otoh, justin_smith jsut gave it... |
| 12:45 | poppingtonic | *just |
| 12:46 | justin_smith | ohcibi: it is sequential, but does not implement the ISeq protocol |
| 12:46 | hyPiRion | ohcibi: a vector is seqable/sequential, not a seq itself. It just means it can be converted to a seq |
| 12:46 | ohcibi | ah |
| 12:46 | ohcibi | so what I want is sequential? |
| 12:47 | seangrove | Hrm, what's a good strategy for generating api-keys? |
| 12:47 | seangrove | Incremental integer ids? |
| 12:47 | hyPiRion | ohcibi: I would guess so, yes |
| 12:47 | justin_smith | ,(doc sequential?) ; ohcibi |
| 12:47 | clojurebot | "([coll]); Returns true if coll implements Sequential" |
| 12:47 | hyPiRion | ,(sequential? [1]) |
| 12:47 | clojurebot | true |
| 12:48 | CookedGryphon | seangrove: java.util.UUID/randomUUID perhaps? |
| 12:48 | hyPiRion | seangrove: Wouldn't random UUIDs suffice? |
| 12:48 | poppingtonic | i see... |
| 12:48 | seangrove | CookedGryphon hyPiRion: That was going to be my serious suggestion. So that's not a known bad-idea? |
| 12:49 | CookedGryphon | seangrove: not as far as I know, I've used it for just that purpose in a production system, less chance of screwing it up and getting a collision than incremental IDs |
| 12:49 | justin_smith | poppingtonic: if the version they have on the standard maven is not recent/ good enough, there are ways to do a local install |
| 12:49 | justin_smith | poppingtonic: but everything just works better if you rely on the archives that exist |
| 12:50 | poppingtonic | justin_smith: `lein deps` didn't complain about unavailability or anything... |
| 12:50 | justin_smith | oh OK |
| 12:51 | hyPiRion | seangrove: it's incredibly unlikely to get a collision, so unless you process incredible amounts of data AND need to be 120% sure there aren't any collisions, it should be okay |
| 12:51 | seangrove | CookedGryphon: Heh, the incremental ids was not meant in any seriousness, of course :) |
| 12:51 | justin_smith | if you have the artifact, then you can import it in a repl and start experimenting |
| 12:51 | seangrove | hyPiRion: Cool cool. |
| 12:51 | poppingtonic | So I'm just writing a quick repl form to test everything |
| 12:51 | CookedGryphon | seangrove: oh yeah, I was thinking user names, heh, yeah it would be monumentally bad as an api key :P |
| 12:52 | hyPiRion | afaik it's way more likely to get SHA collisions in your git repo |
| 12:52 | hyPiRion | um wait, I think I take that back. |
| 12:52 | justin_smith | poppingtonic: yeah, I would suggest opening a repl, importing the class, and trying to follow a simple tutorial |
| 12:52 | justin_smith | turning their code into clojure w/ interop |
| 12:53 | poppingtonic | justin_smith: Eric Rochester's data analysis cookbook should be useful for that... |
| 13:35 | xeqi | Bronsa: only issue with hooking the source reader up was the one you helped with about cljs bootstrapping |
| 13:35 | xeqi | its unfortunate that metadata can't go on java objects / primitives though |
| 13:36 | xeqi | took me a moment to realize why reading "3" didn't give back any info |
| 13:38 | Bronsa | xeqi: yeah, that's unfortunate but there's nothing I can do about that |
| 13:41 | xeqi | its a minor inconvience atm, and a work around is possible. It might be a bit uglier for making sourcemaps have more detailed info, but agreed nothing can be done about it at the tools.reader level |
| 13:43 | tangrammer | Hi folks!, any advise about refactor clojure (so far only i'm searching for rename vars) in emacs[-live] |
| 13:44 | tangrammer | I'm trying to use https://github.com/joodie/clojure-refactoring but no success |
| 13:44 | justin_smith | m-x query-replace-regexp |
| 13:44 | justin_smith | or just m-x query-replace |
| 13:44 | justin_smith | also m-x rgrep |
| 13:44 | justin_smith | tangrammer: that only works with slime, it appears |
| 13:44 | justin_smith | slime is out of date |
| 13:45 | arrdem | ooh yeah |
| 13:45 | tangrammer | justin_smith: thanks Justin, i'm using nrepl |
| 13:45 | upwardindex | I'm using enfocus.core/html but it seems that it remove capital letters in my attribute names. Anyone has had the problem? |
| 13:45 | scottj | tangrammer: clojure-refactoring hasn't worked well, even with slime, since clojure 1.1 or maybe 1.2 |
| 13:46 | tangrammer | scottj: i dont know the cause, but i was trying without success |
| 13:47 | tangrammer | scottj: thanks, i'll try justin_smith trick |
| 13:47 | justin_smith | tangrammer: I am sure query-replace-regexp and rgrep are a poor substitute for true refactor tooling, but I don't really know what one expects from that, never having felt a need for it myself |
| 13:47 | justin_smith | beyond rgrepping for the names and adjusting with a query-replace-regexp |
| 13:48 | tangrammer | justin_smith: me neither, but i'm trying to understand the bmaddy 4clojure problem solution |
| 13:48 | tangrammer | (fn [c] |
| 13:48 | tangrammer | (let [f (fn [[b & c :as a] [y & z :as x]] |
| 13:48 | tangrammer | (if (= a x) |
| 13:48 | tangrammer | false |
| 13:48 | tangrammer | (if (= b y) |
| 13:48 | tangrammer | (recur c z) |
| 13:48 | tangrammer | (or (= c x) |
| 13:48 | tangrammer | (= a z) |
| 13:49 | tangrammer | (= c z))))) |
| 13:49 | tangrammer | p (fn p [c] |
| 13:49 | tangrammer | (if (= (count c) 1) |
| 13:49 | tangrammer | (list c) |
| 13:49 | tangrammer | (for [h c |
| 13:49 | tangrammer | t (p (disj (set c) h)) |
| 13:49 | tangrammer | :let [s (cons h t)]] |
| 13:49 | tangrammer | s)))] |
| 13:49 | tangrammer | (reduce #(or % %2) |
| 13:49 | tangrammer | (map (fn [i] |
| 13:49 | tangrammer | (every? true? (map (fn [[x y]] |
| 13:49 | tangrammer | (f (seq x) (seq y))) |
| 13:49 | tangrammer | (partition 2 1 i)))) |
| 13:49 | tangrammer | (p c))))) |
| 13:49 | tangrammer | sorry! |
| 13:49 | tangrammer | i didn't know how to paste that |
| 13:49 | justin_smith | refheap in the future |
| 13:49 | justin_smith | ~refheap |
| 13:49 | clojurebot | refheap is http://gist.github.com/ |
| 13:49 | amalloy | tangrammer: refheap.com |
| 13:49 | hyPiRion | clojurebot: forget refheap |
| 13:49 | clojurebot | Huh? |
| 13:50 | hyPiRion | meh |
| 13:50 | justin_smith | tangrammer: yeah, for something like that query-replace will help make it more readable |
| 13:50 | amalloy | hyPiRion: you'll never get that one to work |
| 13:50 | tangrammer | justin_smith: the code golf! |
| 13:50 | amalloy | it's inferred via refheap is paste, paste is gist, gist is gist.github.com, or some similar madness |
| 13:50 | hyPiRion | oh, wonderful |
| 13:51 | amalloy | clojurebot: forget refheap |is| paste |
| 13:51 | clojurebot | I forgot that refheap is paste |
| 13:51 | justin_smith | tangrammer: m-x query-replace c <return> input-collection <return> |
| 13:51 | justin_smith | for example |
| 13:51 | amalloy | ~refheap |
| 13:51 | clojurebot | refheap is gist.github.com |
| 13:51 | amalloy | ugh |
| 13:51 | `cbp | :) |
| 13:51 | justin_smith | ~gist |
| 13:51 | clojurebot | gist is http://gist.github.com/ |
| 13:52 | hyPiRion | clojurebot: forget gist |is| http://gist.github.com/ |
| 13:52 | justin_smith | ~paste |
| 13:52 | clojurebot | I forgot that gist is http://gist.github.com/ |
| 13:52 | clojurebot | paste is not gist.github.com |
| 13:52 | tangrammer | justin_smith: it seems perfect for that! |
| 13:52 | hyPiRion | ~refheap |
| 13:52 | clojurebot | https://www.refheap.com/ |
| 13:52 | hyPiRion | oh hey |
| 13:53 | amalloy | hyPiRion: i don't know which of us fixed him; i was PMing while you were doing it for all to see. but it does look fixed |
| 13:53 | justin_smith | tangrammer: also if you have a region, or are narrowed, it will only try to operate within that constraint |
| 13:53 | Raynes | lol |
| 13:53 | mimieux | blist |
| 13:53 | hyPiRion | amalloy: Well, we'll see how long it will last |
| 13:53 | Raynes | It's because someone changed 'gist' to be refheap at some point. |
| 13:53 | Raynes | Someone decided to seek revenge, clearly. :P |
| 13:54 | justin_smith | ~paste |
| 13:54 | clojurebot | paste is not gist.github.com |
| 13:54 | hyPiRion | clojurebot: gist is <reply>http://gist.github.com/ |
| 13:54 | clojurebot | Ok. |
| 13:54 | hyPiRion | ~gist |
| 13:54 | clojurebot | http://gist.github.com/ |
| 13:54 | hyPiRion | ~refheap |
| 13:54 | clojurebot | https://www.refheap.com/ |
| 13:54 | hyPiRion | okay, done spamming |
| 13:54 | justin_smith | ~eatpaste |
| 13:54 | clojurebot | Titim gan éirí ort. |
| 13:55 | justin_smith | tangrammer: also paredit helps with refactoring clojure, because for example C-k kills to end of line, then keeps killing until the last fragment killed is balanced |
| 13:56 | justin_smith | so you can easily move blocks around |
| 13:57 | wuschel | Hi folks. |
| 13:58 | hyPiRion | hi there |
| 13:58 | tangrammer | justin_smith: yes, i'm a bit familiar with paraedit, i started to use it from the first time I used clojure on emacs because I was used to use eclipse IDE |
| 13:58 | wuschel | How hard is the transition from scheme to clojure if one is absolutely not into Java? Does it make sense to get a take on clojure-lang, or should I wait a bit and see how alternatives (e.g. Julia-lang) might turn out? |
| 13:59 | wuschel | I am using LightTable right now - but the Java package, building, deploying system really scare me, even when I use leiningne. |
| 13:59 | justin_smith | wuschel: I find the dep management in clojure better than my scheme experiences |
| 13:59 | justin_smith | the ease of having specific per project versions |
| 13:59 | justin_smith | (of various deps) |
| 14:00 | wuschel | ^^ True. Saw the in project.clj |
| 14:00 | wuschel | tat |
| 14:00 | wuschel | h |
| 14:00 | wuschel | (damn) |
| 14:00 | justin_smith | so I can have a project where I try clojure 1.6, and that does not interfere with my clojure 1.5 projects |
| 14:01 | wuschel | Sounds good. I guess I still have little knowledge where those dependencies get downloaded, where clojure is stored, etc. |
| 14:01 | wuschel | Also, how hard is it to include a java package? Say, I want to play with the chemistry development kit (http://cdk.sourceforge.net/). |
| 14:01 | wuschel | What would be the key steps? |
| 14:01 | justin_smith | find out the artifact name and version |
| 14:02 | seangrove | wuschel: I avoided clj-jvm for a long time because of my dislike for the java ecosystem and did everything in cljs |
| 14:02 | justin_smith | put them in project.clj |
| 14:02 | justin_smith | restart |
| 14:02 | justin_smith | done |
| 14:02 | arrdem | the hell... are we standardizing on gists rather than refheaps now? |
| 14:02 | wei__ | for people using migratus: how do you debug a migration error? the stacktrace for java.sql.BatchUpdateException is pretty useless |
| 14:02 | seangrove | I wouldn't recommend it, but it's possible. And once you've got your head around lein, it's really quite nice in hiding almost anything to do with Java |
| 14:02 | amalloy | justin_smith: C-k's paredit-behavior is nice, but you can move blocks around just fine (and more carefully) with the default C-M-k |
| 14:02 | wei__ | my migration runs in plain sql but fails using migratus |
| 14:02 | hyPiRion | wuschel: lein places every dependency in the ~/.m2 directory for development, and if you want to uberjar the thing, everything is packaged in the standalone jar file |
| 14:02 | justin_smith | wuschel: to try a different version of the lib, just change the version in the dep |
| 14:03 | seangrove | wei__: Are you able to catch the exception and call .getNextMessage on it? |
| 14:03 | wei__ | ah, so that's what it means. trying that now |
| 14:03 | seangrove | Let me see what the exact call is... |
| 14:03 | wuschel | hyPiRion / justin_smith: I should have a closer look on that one. Thank you. I am on Win64, but I guess it should be the same concept there. |
| 14:04 | hyPiRion | wuschel: yeah, in a .m2 folder in your home directory |
| 14:04 | seangrove | wei__: This is my migration library https://www.refheap.com/e6d0b7c7e09f6271d228891f5 |
| 14:04 | justin_smith | wuschel: yeah, may not be .m2, but will be in $HOME - that exists under win right? |
| 14:04 | wuschel | It is just that the thought of that giant , unknown Java blob scares me a bit (; Not that the blob would not be powerful. |
| 14:04 | wuschel | justin_smith: yep. |
| 14:04 | justin_smith | wuschel: I just wrote a shell script today to open up all my deps so I could recursively seasrch them |
| 14:05 | hyPiRion | wuschel: There is a pain point if you want to use a java project, which is not in a maven/clojure repository. That's by design, but it is possible to bypass that through some lein plugin (which afaik is not hard to use) |
| 14:05 | justin_smith | wuschel: http://sprunge.us/LAhN |
| 14:05 | wuschel | justin_smith: Thanks! |
| 14:05 | wuschel | hyPiRion: Ok, I guess I will read into that. Cheers! |
| 14:06 | wuschel | Leiningen all the way, then. |
| 14:06 | hyPiRion | apart from that, Leiningen should make stuff easy, although I understand the concern of "I don't understand this" |
| 14:06 | justin_smith | wuschel: the things that still bug me about clojure are the preference of gigo over early reporting of errors, and the long start up time, otherwise as a former lisper / schemer / ocaml user it is awesome |
| 14:06 | hyPiRion | It's a legitimate concern, and it should be documented what Leiningen does behind the covers |
| 14:07 | wuschel | I agree 100%. The startup time sucks, and then as I said: without knowing Java it feels a bit like running in the dark. |
| 14:07 | seangrove | The small pool of lispers is pretty interesting |
| 14:07 | hammerandtongs | http://techbehindtech.com/2010/12/11/leiningen-adding-git-submodule-to-leiningen-project/ # was about to ask if there was some way to do this |
| 14:07 | wei__ | seangrove: thanks for the insight and code. out of curiosity what does v0/migrate! look like-- are you using plain SQL migrations or some DSL? |
| 14:07 | seangrove | I see a lot of people from my chicken scheme and CL days in the clojure community from time to time |
| 14:08 | amalloy | hyPiRion: isn't there a good blog post that goes into a lot of detail about the things lein has to do? |
| 14:08 | seangrove | wei__: https://www.refheap.com/8d3a7c485cde7e370225d687f |
| 14:08 | wuschel | Chicken scheme is great. My favourite so far. |
| 14:08 | amalloy | http://www.flyingmachinestudios.com/programming/how-clojure-babies-are-made-what-leiningen-is/ is what i'm thinking of |
| 14:08 | wuschel | If only the concurrency would be better. |
| 14:08 | amalloy | quite long, but covers a lot |
| 14:09 | justin_smith | if you are looking for good concurrency, clojure is the right place |
| 14:09 | wuschel | Thanks for the links (: |
| 14:09 | hyPiRion | amalloy: I think there was some guy who explained task through task |
| 14:09 | wuschel | I currently having one eye on Clojure, the other on Julia (; |
| 14:10 | seangrove | Yeah, I don't mean to say that the universal migration is every-other-lisp -> clojure, just that there seems to be a fairly small community of lisp people, and they all kind of wander around inside the same lake |
| 14:11 | amalloy | per task? man, i don't want to know that level of detail |
| 14:11 | hyPiRion | amalloy: Well, many people have been burnt by the dependency resolution for example |
| 14:13 | hyPiRion | not saying that a detailed explanation on how `lein repl` is necessary, just some of the magic parts |
| 14:22 | amalloy | "if version ranges are present, lein asks maven to find you a compromise version that nobody will be happy with" belongs in any article about dependency resolution |
| 14:32 | Profpatsch | I’m trying to configure ac-nrepl. It works in the REPL, but can I also use it in my clojure-mode buffer. |
| 14:33 | yedi | while using paredit: i have a form but now i wanna wrap the form in say a str call (+ 1 2) => (str (+ 1 2)), what's the best/quickest way to go about it? |
| 14:34 | yedi | what ive been doing is highlighting the entire form with C-space and then typing open paren |
| 14:34 | justin_smith | Profpatsch: do you have global-auto-complete-mode turned on? |
| 14:34 | yedi | was wondering if there was something quicker |
| 14:34 | justin_smith | yedi: cursor before form: ( + C-<right-arrow> |
| 14:35 | justin_smith | err ( str C-<right-arrow> |
| 14:35 | justin_smith | that is |
| 14:35 | justin_smith | control right-arrow slurps the thing to the right |
| 14:35 | justin_smith | control left-arrow spits out the rightmost thing |
| 14:36 | yedi | oh tiiightt |
| 14:36 | yedi | hm, i have to disable the mac keyboard shortcuts for control-rightarrow though |
| 14:36 | justin_smith | there are other bindings |
| 14:37 | scottj | (+ 1 2|) C-u M-( str |
| 14:37 | justin_smith | C ) is the other option |
| 14:37 | scottj | s/C-u/C-M-u |
| 14:38 | justin_smith | also, everything is much easier if you periodically figure out what your most frequent commands are, and find shorter / simpler keybindings for them |
| 14:39 | justin_smith | Control-c + char (for any single char on your keyboard) is specifically designed to only be bound by users for their personal favorite commands |
| 14:40 | justin_smith | so your first 26 most favorite commands should be very easy to access |
| 14:41 | yedi | ooh C-( and C-) works pretty well |
| 14:41 | justin_smith | yeah, but it's too bad about the chorded control / shift |
| 14:42 | s_kilk | hi all. I've just hit an odd issue with selmer, the 'with' tag doesn't seem to work properly: "Unrecognized tag found {% endwith %} on..." . the relevant code snippet is here: https://gist.github.com/ShaneKilkelly/7697218 |
| 14:42 | s_kilk | any ideas? |
| 14:43 | scottj | justin_smith: if you make your shifts double as parens, then for me it's just control + shift, not control + shift + paren |
| 14:43 | justin_smith | scottj: shifts double as parens? |
| 14:44 | yedi | justin_smith and scottj: so many thanks |
| 14:44 | scottj | justin_smith: you can make shift keys behave as parens when not used as a modifier |
| 14:44 | yedi | that just changed the gam efor me |
| 14:44 | scottj | justin_smith: steve losh cadet keyboard blog article |
| 14:44 | justin_smith | scottj: woah, cool |
| 14:44 | yedi | now i just need to step up my repl-fu |
| 14:45 | scottj | justin_smith: I use xcape in linux. shifts are parens, caps lock is control and escape |
| 14:45 | amalloy | scottj: fascinating. you just made me find out what C-u M-( does, even if it was an accident |
| 14:45 | justin_smith | I will look into that shift-paren thing |
| 14:46 | Bronsa | ( |
| 14:47 | gf3 | Guys, what's a cool hack-day idea I can work on? |
| 14:47 | gf3 | /cc bitemyapp |
| 14:48 | amalloy | justin_smith, scottj: i think swapping number keys with symbols (ie, implicitly pressing shift when on the top row) is a nice alternative change to the shift-as-paren thing |
| 14:49 | justin_smith | hmm, one day hack... - a template that takes all your clojurescript and bundles it with the version of the csound synthesis language that runs inside chrome |
| 14:49 | justin_smith | (they ported the code to nacl) |
| 14:49 | justin_smith | http://vlazzarini.github.io/ |
| 14:50 | amalloy | i don't quite get how shift-as-paren works - i know i often press shift and then decide i didn't want to shift anything after all. having that turned into a paren sounds like quite a pain |
| 14:50 | justin_smith | gf3 allows controlling a synthesizer in the browser via html5 |
| 14:50 | gf3 | justin_smith: o0o0o neat |
| 14:50 | justin_smith | so yeah, hack some clojurescript onto it :) |
| 14:51 | Profpatsch | justin_smith: Yep, indeed. |
| 14:52 | Profpatsch | justin_smith: I have global-auto-complete enabled. |
| 14:53 | Profpatsch | justin_smith: Does it work with you? |
| 14:53 | justin_smith | Profpatsch: try running ac-nrepl-setup |
| 14:53 | justin_smith | Profpatsch: affirmative |
| 14:55 | justin_smith | gf3: you can do real time livecoding synthesis like in overtone (though of course nobody has written the pretty clojure dsl for it yet), but the engine is your browser, so you can serve it up for others to use |
| 15:28 | Profpatsch | justin_smith: I get “Namespace not found.“ |
| 15:29 | justin_smith | require the ns you are in in the repl |
| 15:29 | justin_smith | or load the file |
| 15:29 | justin_smith | then you will start to get hints for it |
| 15:29 | Profpatsch | Hm. |
| 15:29 | justin_smith | that message means it is communicating with the repl, but the repl does not know yet about the function you are typing |
| 15:30 | justin_smith | try constructing a call to a function in clojure.core, you should see ac do its thing |
| 15:32 | Profpatsch | Will do, thanks. |
| 15:37 | allsystemsarego | hi all, what do I need to add to my project dependencies in order to be able to use the keyword "defrel" in core.logic? |
| 15:37 | seangrove | Hrm, was ring.middleware.stacktrace moved somewhere? I don't seem to be able to require it |
| 15:38 | justin_smith | allsystemsarego: if you have core.logic, you just need to refer to defrel |
| 15:38 | justin_smith | allsystemsarego: though using require with an alias is better |
| 15:38 | allsystemsarego | justin_smith, I get an error when attempting to use defrel |
| 15:38 | justin_smith | (ns your-ns (:require [clojure.core.logic :as logic])) (logic/defrel ...) |
| 15:38 | allsystemsarego | oh |
| 15:39 | allsystemsarego | let me try that |
| 15:39 | Profpatsch | justing_smith: It seams to work in clojure files. Do you use it with Clojurescript? |
| 15:40 | justin_smith | Profpatsch: nope, have not tried it in clojurescript |
| 15:40 | Profpatsch | Ok, I guess there’s more to that. |
| 15:40 | justin_smith | it could be it doesn't know how to properly load or resolve the cljs namespaces |
| 15:40 | Profpatsch | But it works now. |
| 15:40 | justin_smith | cool, glad you got it sorted out |
| 15:42 | justin_smith | seangrove: you could unzip your ring jar and see if it is anywhere in the ring/middleware/ directory |
| 15:42 | justin_smith | or just open it if your editor supports that |
| 15:42 | seangrove | justin_smith: Sorry, it was just that I hadn't included ring/ring-devel in my deps list |
| 15:42 | seangrove | err, in my project.clj |
| 15:42 | justin_smith | seangrove: oh, cool |
| 15:43 | justin_smith | seangrove: regarding finding things in your deps I wrote this today https://gist.github.com/noisesmith/7697007 |
| 15:43 | justin_smith | so that I could rgrep in my project dependencies |
| 15:43 | justin_smith | will I trade disk usage for transperency? today I will |
| 15:44 | seangrove | Oh, interesting |
| 15:44 | seangrove | Yeah, with emacs' find-grep-dired worked with jars transparently |
| 15:44 | seangrove | Opening and editing clojure jars like any other file? Awesome. |
| 15:44 | justin_smith | wait, find-grep-dired works with jars? |
| 15:45 | seangrove | No, I *wish* it did |
| 15:45 | seangrove | Emacs can just open them and edit them fine, if only it could f-g-d them as well |
| 15:45 | justin_smith | ahh, yeah, I couldn't find the functionality, thus this hack, after which I can run m-x rgrep and find things to my bliss |
| 15:47 | justin_smith | I will love it until the first time I check in all the sources to all my deps to git |
| 15:47 | justin_smith | then I will hate it |
| 15:49 | seangrove | amend it to add to .gitignore ;) |
| 15:49 | justin_smith | heh, true |
| 15:50 | si14 | I just keep getting "REPL server launch timed out" in my project. Is there any common way to debug huge (around a minute) REPL startup time? |
| 15:51 | justin_smith | si14: try starting a repl from the terminal |
| 15:51 | si14 | justin_smith: I'm already doing this |
| 15:51 | justin_smith | ahh, ok |
| 15:51 | justin_smith | si14: can I see your project.clj? |
| 15:52 | si14 | justin_smith: PMed it to you |
| 15:52 | si14 | justin_smith: it's a bit messy :) |
| 15:52 | justin_smith | looking now, thanks |
| 15:53 | si14 | I suspect that prismatic schema can be at fault |
| 15:53 | justin_smith | hmm, maybe try removing the nrepl-middleware entries? |
| 15:53 | justin_smith | temporarily of course |
| 15:54 | si14 | at least in my experience I've found that in *some* (didn't really find why or when exactly) cases heavy class-based hinting can cause huge loading/compilation times. |
| 15:54 | si14 | justin_smith: trying this. |
| 15:55 | justin_smith | also you could try ammending -main to start an nrepl server; then doing lein uberjar followed by java -jar (your jar) |
| 15:55 | justin_smith | if that works then it is definitely the compilation lag |
| 15:56 | justin_smith | also, if that is the case you could also try lein compile for the aot |
| 15:57 | justin_smith | since you do specify that |
| 15:57 | justin_smith | also it could be that just leaving out the aot would reduce the bootup time |
| 15:58 | si14 | justin_smith: removing lein middlewares had no affect. Moreover, CPU is at 100% during loading, so I suspect it's compilation |
| 15:58 | si14 | the question is why compilation take sooo long? |
| 15:59 | justin_smith | because you have a pile of deps that godzilla would find threatening in size |
| 15:59 | justin_smith | :) |
| 15:59 | si14 | I've tried to omit AOT in dev profile (line 69), doesn't help much |
| 16:00 | si14 | justin_smith: I thought it's quite idiomatic for Clojure projects :) |
| 16:00 | yedi | so simple yet brilliant: http://feedproxy.google.com/~r/KrisJenkinsBlog/~3/6qkWJ-mWM40/clojure-less-than-greater-than-tip.html |
| 16:01 | justin_smith | if only I'd seen that article 15 years ago when I was first learning common lisp |
| 16:05 | seangrove | Uhg... well, might be time to finish off the google apps integration.... need to make sure I have plenty of alcohol for afterwards, though. |
| 16:06 | seangrove | First step: "Pay a small fee using Google Wallet if it's the first time you are publishing an app on the store" |
| 16:06 | seangrove | Lovely. |
| 16:07 | seangrove | Guessing ~$100... |
| 16:07 | hyPiRion | guessing 2 cents |
| 16:08 | mr_rm | &(clojure.data.json/read-str "{\"name\":\"Bob\"}") |
| 16:08 | lazybot | ⇒ {"name" "Bob"} |
| 16:09 | mr_rm | &(clojure.data.json/read-str "{\"name\":\"Bob\"}" {:key-fn keyword}) |
| 16:09 | lazybot | java.lang.IllegalArgumentException: No value supplied for key: {:key-fn #<core$keyword clojure.core$keyword@5d8bde>} |
| 16:09 | bagl | Anyone using Emacs' midje-mode? I can run in repl midje test just fine, I can use midje-mode commands for showing/hidding facts, but I cannot check them (C-c .). It just prints "Mark set" in statusbar... Any ideas? |
| 16:09 | justin_smith | &(clojure.data.json/read-str "{\"name\":\"Bob\"}" :key-fn keyword) |
| 16:09 | lazybot | ⇒ {:name "Bob"} |
| 16:09 | mr_rm | justin_smith: doh! |
| 16:09 | mr_rm | justin_smith: i could swear the doc said to pass it as a map |
| 16:09 | Bronsa | eeew keyword args |
| 16:10 | mr_rm | nope, i was wrong |
| 16:10 | mr_rm | just says to pass the pairs |
| 16:10 | mr_rm | thanks, justin_smith |
| 16:10 | justin_smith | np |
| 16:11 | justin_smith | in general, if your maps are well constructed and you see "no value supplied for key" you called a function that expects an &keys |
| 16:13 | mr_rm | justin_smith: makes sense |
| 16:14 | tommo__ | can some1 explain the meaning of the [[]] in a function such as this: (fn [[a b]] [b (+ a b)])? |
| 16:15 | justin_smith | tommo__: destructuring |
| 16:15 | justin_smith | ,((fn [[a b]] (+ a b)) [1 2]) |
| 16:15 | clojurebot | 3 |
| 16:15 | justin_smith | tommo__: it mirrors the structure inside a collection |
| 16:15 | justin_smith | so you can concisely access the contents |
| 16:15 | justin_smith | tommo__: also works for maps |
| 16:16 | justin_smith | ,((fn [{a :a b :b}] (+ a b)) {:a 1 :b 8}) |
| 16:16 | clojurebot | 9 |
| 16:16 | tommo__ | ah i see, ty |
| 16:17 | justin_smith | I like it because there is less noise in the function body that way, so fewer places bugs can hide |
| 16:24 | patrkris | hi folks. is the prim-seq function shown in the following URL built in to ClojureScript? |
| 16:24 | patrkris | https://github.com/swannodette/swannodette.github.com/blob/master/code/blog/src/blog/utils/dom.cljs#L39 |
| 16:26 | seangrove | patrkris: Yes |
| 16:26 | justin_smith | patricko1: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L716 |
| 16:26 | justin_smith | that is where it is defined |
| 16:27 | patrkris | ah ok |
| 16:27 | seangrove | (inc justin_smith) ; Even though I got there first. |
| 16:27 | lazybot | ⇒ 13 |
| 16:27 | justin_smith | heh |
| 16:28 | justin_smith | sadly, most of the question askers here don't even know how to inc somebody |
| 16:28 | seangrove | I think technomancy is by far the channel leader |
| 16:28 | patrkris | (inc justin_smith) |
| 16:28 | lazybot | ⇒ 14 |
| 16:28 | justin_smith | $karma technomancy |
| 16:28 | lazybot | technomancy has karma 86. |
| 16:29 | justin_smith | $karma seangrove |
| 16:29 | lazybot | seangrove has karma -2. |
| 16:29 | justin_smith | you must have gotten so much it rolled over |
| 16:29 | seangrove | Haha, I'm bringing down the channel average here |
| 16:30 | seangrove | $karma bitemyapp |
| 16:30 | lazybot | bitemyapp has karma 14. |
| 16:30 | seangrove | -.- |
| 16:30 | justin_smith | $karma lazybot |
| 16:30 | lazybot | lazybot has karma 20. |
| 16:30 | patrkris | I guess there is no separate documentation site for ClojureScript's API? |
| 16:30 | justin_smith | $karma clojurebot |
| 16:30 | lazybot | clojurebot has karma 33. |
| 16:31 | seangrove | patrkris: No, but that's a good idea |
| 16:33 | seangrove | Maybe clojuredocs, but with "This function is available in : clojureclr, clj-jvm, cljs", etc. |
| 16:33 | patrkris | yeah |
| 16:34 | patrkris | who, except for David Nolen, would ever have known about prim-seq? ;-) |
| 16:34 | justin_smith | people who read the source for fun |
| 16:34 | patrkris | but i could've just grep'ed clojurescript.git |
| 16:34 | seangrove | But I learned it from dnolen |
| 16:35 | patrkris | yes... I guess there's nothing inherently wrong with having to read the source code :) |
| 16:36 | seangrove | patrkris: How did you find you needed it? |
| 16:36 | patrkris | but I'm on my iPad and too lazy ;-) |
| 16:36 | s_kilk | hi all. im getting a strange error with the selmer html rendering library. I'm using the 'with' tag, but the page is blowing up on the corresponding 'endwith' tag. error: "Unrecognized tag found: {% endwith %}" |
| 16:36 | si14 | justin_smith: thank you! |
| 16:36 | patrkris | just reading through David's blog about core.async and UI's |
| 16:36 | justin_smith | si14: what worked? |
| 16:37 | si14 | justin_smith: nothing. just wanted to thank you for help :) |
| 16:37 | justin_smith | so its still broken? |
| 16:38 | yedi | (inc justin_smith) |
| 16:38 | lazybot | ⇒ 15 |
| 16:40 | tommo__ | which clojure book do you guys reccomend |
| 16:41 | Pupnik | clojure programming |
| 16:41 | seangrove | I've never found much use from programming language-specific books |
| 16:42 | yedi | ugh, everytime i visit prismatic i lose hours of valuable time |
| 16:42 | seangrove | OL, L.I.S.P., LoL, etc. all were more interesting for general concepts, and then blog posts, example projects, and source code for language-specific implementation details |
| 16:42 | tommo__ | me neither, im a java dev by trade but i want to go into clojure with a fresh mind |
| 16:43 | seangrove | yedi: Is it that good? I've never used it. |
| 16:45 | yedi | seangrove: yea, i'm a big procrastinate by reading kinda guy and i have to make sure to never visit prismatic if i have shit i wanna get done |
| 16:46 | si14 | justin_smith: it's still slow. It works, but REPL starts before timeout in 1/2-1/3 of my attempts. |
| 16:46 | yedi | i actually visit hn way more regularly cuz i know there'll only be a tiny # of articles i care about on the front page |
| 16:48 | seangrove | yedi: Hrm, that's pretty interesting. |
| 16:48 | seangrove | As the accuracy of prismatic(s) improve, they cross a threshold and become damaging... |
| 16:51 | algernon | prismatic is bad. it makes it far too easy to sit at the computer for half a day, and not see anything less than very interesting. |
| 16:52 | seangrove | algernon: Well, we knew this day would come. |
| 16:53 | algernon | see you in a week! ;) |
| 16:55 | ohcibi | is there a built in faculty function? |
| 17:00 | bitemyapp | seangrove: http://clojurewiki.com/ |
| 17:00 | bitemyapp | technomancy: http://clojurewiki.com/ |
| 17:00 | bitemyapp | gf3: what's up? |
| 17:01 | bitemyapp | gf3: let me know if you still need a hack-day idea :) |
| 17:03 | seangrove | bitemyapp: Looks like it could be good. It'd be nice if wikis could have structured data/models though |
| 17:03 | seangrove | A standardish-schema for functions in this case |
| 17:03 | bitemyapp | seangrove: yes, it would. Bonus is that it's git-backed, so if somebody really hates websites I can give them a git account. |
| 17:04 | seangrove | Instead of just making a new document, you'd make a new document/fn-def, put in the structured data, and you'd be able to link to it just like another doc |
| 17:06 | seangrove | bitemyapp: Looks like a decent start. Are you thinking about this superseding clojuredocs for function doc string, examples, clojure versions, and platforms? |
| 17:06 | bitemyapp | seangrove: I'm agnostic to the idea. |
| 17:07 | bitemyapp | I'm happy if it does, fine if something else does a better job. API documentation isn't a core strength of wikis, this is more for folklore, informal knowledge, speculation, discussion, gathering, categorization, etc. |
| 17:07 | bitemyapp | but if the wiki becomes the home for that, so be it. |
| 17:07 | arrdem | bitemyapp: what is this? |
| 17:07 | bitemyapp | arrdem: a wiki for Clojure users! |
| 17:07 | seangrove | bitemyapp: That sounds like a good middleground for me. |
| 17:07 | bitemyapp | seangrove: in some places, I link out to ClojureWerkz's tutorials because their work is peerless in the subject described. |
| 17:07 | bitemyapp | in others, I simply write out the material. |
| 17:08 | seangrove | Yeah, I went through a bit and saw that |
| 17:09 | justin_smith | bitemyapp: I hacked together a script for when you just wish you could grep -r (or m-x rgrep) through all your dependencies https://gist.github.com/noisesmith/7697007 |
| 17:10 | bitemyapp | justin_smith: that's quite handy, thank you! |
| 17:10 | bitemyapp | I need to automate the backups for the wiki... |
| 17:11 | justin_smith | is git tag enough, or would you clone it too? |
| 17:11 | bitemyapp | justin_smith: when I run it, I get "unzip: cannot find or open" and then a dump of my directories/.m2 |
| 17:11 | arrdem | bitemyapp: if you copied this from the clojure toolbox then the parsers article needs fixing |
| 17:11 | bitemyapp | justin_smith: I rsync the whole dir. |
| 17:12 | bitemyapp | arrdem: it's not copy-paste and it's not complete. |
| 17:12 | justin_smith | bitemyapp: prereqs are the unzip command, and the basename command |
| 17:12 | bitemyapp | justin_smith: I have both. |
| 17:12 | justin_smith | odd |
| 17:12 | justin_smith | mind sharing the output of lein classpath? |
| 17:13 | justin_smith | that is how it is generating the list |
| 17:13 | bitemyapp | justin_smith: https://www.refheap.com/21337 |
| 17:14 | justin_smith | cool, can I see the lein classpath output it generates that from? |
| 17:14 | justin_smith | oh |
| 17:15 | justin_smith | somewhere \n turned into n |
| 17:15 | justin_smith | that is what it is doing |
| 17:15 | justin_smith | in the sed, the s/:/\n/g is acting like s/:/n/g |
| 17:16 | justin_smith | maybe it is an osx sed incompatibility |
| 17:16 | bitemyapp | that's a common issue. |
| 17:16 | bitemyapp | sadface :( |
| 17:17 | justin_smith | I've fixed sed unportability before |
| 17:18 | justin_smith | mind telling me the variation of 'lein classpath | sed -e "s/:/\n/g"' that outputs one thing per line? |
| 17:18 | justin_smith | since my osx box is at work |
| 17:19 | bitemyapp | justin_smith: looks like one big blog. |
| 17:19 | bitemyapp | blob& |
| 17:19 | bitemyapp | blob* |
| 17:19 | bitemyapp | /Users/callen/code/bulwark/testn/Users/callen/code/bulwark/srcn/Users/callen/code/bulwark/dev-resourcesn/Users/callen/code/bulwark/resourcesn/Users/callen/code/bulwark/target/classesn/Users/callen/.m2 etc etc |
| 17:19 | justin_smith | yeah, that \n needs to be something else |
| 17:19 | justin_smith | but I am not sure what |
| 17:20 | justin_smith | bitemyapp: lein classpath | tr : '\n' |
| 17:21 | justin_smith | does that do it? |
| 17:22 | bitemyapp | justin_smith: that works perfectly. |
| 17:22 | bitemyapp | justin_smith: this would appear to be a lesson in using the simplest tool possible. |
| 17:22 | justin_smith | awesome, gist updated |
| 17:22 | justin_smith | yeah, I so rarely need to use tr, but lesson learned! |
| 17:25 | bitemyapp | justin_smith: ding http://clojurewiki.com/expand-deps |
| 17:25 | bitemyapp | ~clojurewiki is http://clojurewiki.com/ |
| 17:25 | clojurebot | Ok. |
| 17:25 | bitemyapp | ~wiki |
| 17:25 | clojurebot | wiki is http://en.wikibooks.org/wiki/Clojure_Programming |
| 17:25 | bitemyapp | ~wiki is also http://clojurewiki.com/ |
| 17:25 | clojurebot | Ack. Ack. |
| 17:25 | bitemyapp | ~wiki |
| 17:25 | clojurebot | wiki is clojurewiki |
| 17:25 | bitemyapp | hrm. |
| 17:28 | allsystemsarego | Is (require 'pldb) the correct way to import the pldb dependency at the repl? |
| 17:28 | justin_smith | allsystemsarego: it probably has a project name |
| 17:29 | allsystemsarego | the one on github? |
| 17:29 | justin_smith | try pldb.logic |
| 17:29 | allsystemsarego | threatgrid? |
| 17:29 | allsystemsarego | ok |
| 17:29 | justin_smith | pldb is the name of a project, the ns is called logic |
| 17:29 | justin_smith | (require 'pldb.logic) |
| 17:30 | allsystemsarego | I tried it, and it says No such var: l/contains-lvar? |
| 17:30 | justin_smith | if you look at their source they refer to clojure.core.logic as l |
| 17:30 | justin_smith | it could be you have the wrong version of clojure.core.logic for pldb |
| 17:31 | allsystemsarego | ok |
| 17:31 | justin_smith | pldb depends on version 0.8.3 |
| 17:31 | justin_smith | do you require some other version in your project.clj? |
| 17:31 | allsystemsarego | 0.8.5 |
| 17:31 | allsystemsarego | so yeah |
| 17:32 | justin_smith | try downgrading temporarirly |
| 17:32 | allsystemsarego | I'll go back to my project.clj |
| 17:32 | justin_smith | it could be clojure.core.logic dropped or renamed the function pldb needs |
| 17:32 | allsystemsarego | ok, thanks |
| 17:33 | justin_smith | also pldb is so small, updating it to a newer core.logic may actually be pretty easy |
| 17:33 | justin_smith | if you feel ambitious |
| 17:33 | allsystemsarego | that's for when I'm more comfortable with clojure |
| 17:36 | jouiswalker | is there a way to prevent refreshing the page from resending post data? |
| 17:36 | jouiswalker | i'm using compojure, but it isn't obvious to me |
| 17:37 | justin_smith | allsystemsarego: https://github.com/clojure/core.logic/commit/1375f34ef42ee6b288ccb110b5c8c4aeb87a39a9#diff-30dcdb8bdb2cc62ab14e86f0d21703d7 they merged in pldb |
| 17:37 | justin_smith | it is part of core.logic now |
| 17:37 | bitemyapp | I feel like I have marbles in my mouth when I write on Twitter. |
| 17:37 | bitemyapp | is there a Twitter++ where I get 280 characters? |
| 17:37 | indigo | bitemyapp: There's your next project! |
| 17:37 | indigo | ;P |
| 17:37 | seangrove | A working UI is a beautiful thing. |
| 17:38 | allsystemsarego | justin_smith, thanks |
| 17:38 | seangrove | The implementation is slowly catching up as well. |
| 17:38 | bitemyapp | indigo: http://clojurewiki.com/ signup and add things please :) |
| 17:38 | justin_smith | jouiswalker: you can dynamically create a "request key" each time you render and send the page |
| 17:38 | bitemyapp | seangrove: I actually didn't add carica on purpose, if you can believe it :P |
| 17:38 | justin_smith | jouiswalker: and not do anything if it comes in with a request-key you have not issued, or already served |
| 17:39 | indigo | A Clojure wiki written in Haskell, eh |
| 17:39 | justin_smith | it would be a hidden numeric parameter or random string in the form body |
| 17:39 | seangrove | bitemyapp: Well, are you going for an exhautive resource, an opinionated one, or an exhaustive resource with opinionated commentary? |
| 17:40 | seangrove | bitemyapp: Also, ridiculous feature request, but allowing read/write access to it from the channel via a clojurewiki bot would be wonderful |
| 17:40 | justin_smith | jouiswalker: on further consideration, don't use a number for the request key, use a uuid |
| 17:40 | jouiswalker | justin_smith: i'll give this a try. |
| 17:40 | jouiswalker | justin_smith: thanks! |
| 17:41 | justin_smith | np |
| 17:41 | seangrove | But you probably need more structure than a wiki easily provides to do it properly |
| 17:41 | JaredR | sup, justin_smith ? |
| 17:41 | bitemyapp | seangrove: neat idea. |
| 17:41 | justin_smith | JaredR: Sup |
| 17:41 | bitemyapp | seangrove: I'm not opinionated about the form the wiki takes. If people add stuff I left out, I won't remove, just add commentary. |
| 17:43 | seangrove | bitemyapp: I suppose ideally it would have 1.) structural data that 2.) can be edited and expanded as in any wiki and 3.) accessed via an api and finally a 4.) RapGenious overlay to allow meta-conversations to happen cleanly and clearly. |
| 17:44 | seangrove | And a unicorn, while I'm dreaming. |
| 17:44 | bitemyapp | seangrove: a rapgenius-esque open source wiki is something I've wanted for awhile. |
| 17:45 | bitemyapp | seangrove: the wiki is HApps (Haskell) based and backed by git, it's not out of the question. |
| 17:47 | justin_smith | what is rapgenius' backend? google is failing me |
| 17:47 | seangrove | Rails |
| 17:47 | bitemyapp | justin_smith: a poorly maintained Rails application on Heroku |
| 17:47 | justin_smith | ahh ok |
| 17:47 | seangrove | Tom is a crazy skilled coder though. |
| 17:47 | bitemyapp | dev-ops and coding aren't skills that always intersect. |
| 17:50 | bitemyapp | seangrove: I noted that environ was recommended and demonstrated a pattern here: http://clojurewiki.com/Configuring%20Clojure%20Applications |
| 17:53 | arrdem | oh cool clojure-doc got a new theme since last I looked... |
| 17:53 | indigo | Hm, I should expand the Clojure with vim page |
| 17:53 | indigo | Because vim is awesome |
| 18:03 | freshhawk | if I have: (def x 'toUpperCase) and I want to use that java method ... (. "foobar" x) isn't going to work |
| 18:03 | freshhawk | how does one call java methods dynamically with the '.' special form? |
| 18:04 | freshhawk | or without the '.' special form, but I'm not very good with the java interop |
| 18:10 | justin_smith | freshhawk: you can use a macro, or use reflection |
| 18:10 | justin_smith | ,(doc .) |
| 18:10 | clojurebot | Excuse me? |
| 18:11 | justin_smith | ,(clojure.repl/doc .) |
| 18:11 | clojurebot | Pardon? |
| 18:11 | justin_smith | hmm |
| 18:11 | justin_smith | he appears not to like that call, but it works in a repl |
| 18:11 | justin_smith | freshhawk: . needs to have its arguments resolved at compile time |
| 18:12 | justin_smith | as far as methods are concerned at least |
| 18:12 | adhollander | seangrove: if you want to see a wiki platform with structured data, take a look at Semantic MediaWiki. Granted, it inherits all the cruftiness of Mediawiki... |
| 18:12 | cored | hello |
| 18:13 | cored | I'm reading Functional Programming for object oriented programmers, and found out an exercise which I have to implement the second function here is my implementation of that particular function (def second (fn [list] (nth list 1))) and here is the solution from the author (def second (fn [list] (first (rest list)))) |
| 18:14 | cored | it's seems to me that my implementation is clear, but the author took another approach, is there some sort of best way to implement that or something? |
| 18:14 | freshhawk | justin_smith, it will have to be reflection. So the method objects return from reflection are what I will be using? |
| 18:15 | justin_smith | https://groups.google.com/forum/#!topic/clojure/YJNRnGXLr2I here's a thread on the clojure ml that is apropos |
| 18:15 | justin_smith | you really won't know any method names until runtime? |
| 18:16 | justin_smith | because otherwise you can do (def as-string #(.toString %)) and pass in as-string as a function to call |
| 18:16 | justin_smith | for example |
| 18:17 | freshhawk | justin_smith, it's a big ugly soap based api so I unfortunately don't |
| 18:17 | justin_smith | gotcha |
| 18:17 | justin_smith | eval is another option |
| 18:17 | freshhawk | true |
| 18:17 | justin_smith | which is effectively another compile time in the middle of runtime :) |
| 18:18 | bitemyapp | now to play holiday restaurant roulette |
| 18:19 | freshhawk | justin_smith, this thread is gold. thanks very much! |
| 18:21 | bitemyapp | justin_smith: added that to the wiki. |
| 18:21 | bitemyapp | http://clojurewiki.com/FAQ |
| 18:22 | justin_smith | awesome |
| 18:24 | si14 | awesome. my friend's lein can't even start. |
| 18:25 | si14 | just timeout every time. |
| 18:25 | justin_smith | si14: still? |
| 18:25 | si14 | justin_smith: yeah |
| 18:25 | justin_smith | did you try running lein compile first |
| 18:26 | justin_smith | so the aot stuff would be out of the way |
| 18:26 | justin_smith | or can it not even do the compile task? |
| 18:28 | si14 | justin_smith: yes. doesn't help much |
| 18:31 | si14 | meanwhile, SpaceX started countdown again. |
| 18:31 | grim_radical | 9 minutes! |
| 18:32 | si14 | I was impressed by today's shutdown instead of miserable explosion on launchpad. |
| 18:33 | si14 | I mean, a lot of rockets just exploded without this sort of self-contro |
| 18:33 | si14 | *control |
| 18:40 | justin_smith | si14: I just thought of one more thing you could try, the standard voodoo option if things are acting weird |
| 18:40 | justin_smith | lein clean |
| 18:40 | justin_smith | can't hurt |
| 18:43 | si14 | justin_smith: it started at 10th or something attempt, but I'll try lein clean on the next restart, thank you :) |
| 18:43 | justin_smith | are there any other symptoms? running out of memory maybe? |
| 18:45 | si14 | justin_smith: no, just very slow startup |
| 18:46 | si14 | I'll run a profiler eventually. |
| 18:46 | si14 | ...and SpaceX aborted today's launch. |
| 18:47 | si14 | :( |
| 18:47 | johnjelinek | hihi all |
| 18:47 | JaredR | stupid question... is there an editor for Clojure that has autocomplete and such? |
| 18:47 | johnjelinek | how's it goin'? |
| 18:47 | johnjelinek | JaredR: Emacs |
| 18:47 | JaredR | *sigh* I was afraid you were gonna say that... |
| 18:47 | JaredR | VI GODDAMNIT ;) |
| 18:48 | Licenser | isn't Lighttable doing that? |
| 18:48 | johnjelinek | lololol |
| 18:48 | JaredR | I just downloaded lighttable... it doesn't seem to have autocomplete, insert, etc. |
| 18:48 | johnjelinek | JaredR: what's wrong with Emacs? you can use Emacs in evil-mode to get your vim bindings working |
| 18:49 | JaredR | I have memory issues and having to refer to documentation every 10 seconds is exhausting, so I tend to rely on code insight and autocomplete to help me with my productivity |
| 18:49 | johnjelinek | JaredR: I'm in the same boat |
| 18:49 | johnjelinek | but I just taught myself emacs today for clojure |
| 18:49 | JaredR | yeah? |
| 18:49 | JaredR | LOL OK |
| 18:50 | johnjelinek | yea |
| 18:50 | JaredR | well, I'm on OSX so using emacs isn't the end of the world... *coughVIisbettercough* |
| 18:50 | johnjelinek | lol |
| 18:50 | johnjelinek | ditto and ditto |
| 18:51 | johnjelinek | I am having a problem though with running unit tests in emacs |
| 18:51 | johnjelinek | anyone available to help out? |
| 18:52 | johnjelinek | I created a brand new lein project |
| 18:52 | johnjelinek | when I compile the default test it shows "#'command-line-args.core-test/a-test" |
| 18:53 | johnjelinek | which I imagine is correct |
| 18:53 | JaredR | seancorfield: you there somewhere? |
| 18:53 | johnjelinek | but when I run the tests, I get a compile error |
| 18:53 | johnjelinek | clojure.lang.Compiler$CompilerException: java.lang.ClassNotFoundException: clojure.test.mode, compiling:(/private/var/folders/rh/wxb4f7d50151_tzpn2z_whdh0000gp/T/form-init5102129192986648799.clj:1:1) at clojure.lang.Compiler.analyze (Compiler.java:6380) .... |
| 18:54 | johnjelinek | $ lein --version |
| 18:54 | johnjelinek | Leiningen 2.3.4 on Java 1.7.0_45 Java HotSpot(TM) 64-Bit Server VM |
| 18:54 | johnjelinek | any thoughts how to troubleshoot? |
| 18:56 | johnjelinek | fixed it! |
| 18:56 | johnjelinek | wewt! |
| 18:56 | johnjelinek | I had to do cider-jack-in after opening a project file |
| 18:56 | johnjelinek | not before |
| 19:03 | JaredR | johnjelinek: awesome! love it when something works out! |
| 19:15 | justin_smith | johnjelinek: it decides what project to launch based on what file / directory you have open |
| 19:16 | johnjelinek | I've got a new question, I'm trying to change the namespace of the REPL buffer to the one of the file I'm in |
| 19:16 | justin_smith | so you otherwise get a default setup, that is not connected to your project |
| 19:16 | johnjelinek | so I try C-c M-n |
| 19:16 | johnjelinek | but it says "Symbol's function definition is void: cider-repl-set-ns" |
| 19:16 | justin_smith | johnjelinek: sounds like your cider is not up to date, or cider is not ready for prime time |
| 19:16 | justin_smith | could even be both :) |
| 19:16 | justin_smith | nrepl still works |
| 19:16 | johnjelinek | how do I check my cider version? |
| 19:17 | justin_smith | M-x package-list-packages |
| 19:17 | justin_smith | it will also let you update the list, and check to update packages that have new versions from that screen |
| 19:19 | johnjelinek | justin_smith: I have 0.3.1 installed |
| 19:21 | johnjelinek | how could I do it in the nrepl? |
| 19:21 | justin_smith | there is an older nrepl.el package |
| 19:21 | justin_smith | that cider is replacing |
| 19:21 | johnjelinek | ooh, I see |
| 19:21 | justin_smith | but it seems cider may have incomplete coverage right now |
| 19:21 | johnjelinek | it should have this functionality though |
| 19:22 | justin_smith | part of the change is just that clojure nrepl / emacs nrepl.el was confusing people |
| 19:22 | johnjelinek | http://clojure-doc.org/articles/tutorials/emacs.html indicates cider should work fine |
| 19:22 | justin_smith | either your cider is out of date, or they are wrong |
| 19:23 | justin_smith | you can switch the ns in the repl using in-ns |
| 19:23 | johnjelinek | 0.3.1 is latest |
| 19:23 | justin_smith | so they are wrong |
| 19:23 | johnjelinek | couldn't it be something else with my setup that could be borking it? |
| 19:23 | justin_smith | seriously doubt it |
| 19:23 | justin_smith | it is trying to call a function that does not exist |
| 19:24 | justin_smith | that is pretty cut and dried |
| 19:24 | justin_smith | in the repl buffer: (in-ns 'my.namespace) |
| 19:24 | justin_smith | that is all you need to do |
| 19:24 | justin_smith | it's not complicated, you don't need the editor to do it for you |
| 19:25 | justin_smith | personally I don't even use in-ns |
| 19:25 | justin_smith | in the repl I run (require '[my.ns :as n]) |
| 19:25 | justin_smith | then I call (n/whatever) |
| 19:25 | johnjelinek | ok, I'll try that |
| 19:25 | justin_smith | you may need to ammend that to (require '[my.ns :as n] :reload) if you save changes |
| 19:27 | justin_smith | notice that the content on that clojure-doc page is listed for 2012 |
| 19:27 | johnjelinek | cool, it worked |
| 19:27 | justin_smith | it was just a search and replace of nrepl / cider |
| 19:27 | justin_smith | and the docs are not accurate yet, clearly |
| 19:27 | johnjelinek | lol, if it's 2012, you'd think cider would only get better from then |
| 19:27 | justin_smith | cider did not exist in 2012 |
| 19:27 | justin_smith | so I'm saying the docs are not yet correct for cider |
| 19:28 | justin_smith | they switched some strings in the docs, without checking if those commands actually work with cider, I bet |
| 19:29 | johnjelinek | ahh, ok |
| 19:29 | johnjelinek | gotcha |
| 19:33 | johnjelinek | justin_smith: added an issue to the guide: https://github.com/clojuredocs/guides/issues/149 thanks :) |
| 19:42 | justin_smith | np |
| 19:54 | dabd | stole 2 functions from onlisp: https://gist.github.com/dabd/7700137 please comment on style or better ways to define them. ty |
| 20:02 | justin_smith | ,(reduce identity nil nil) ; dabd |
| 20:02 | clojurebot | nil |
| 20:02 | justin_smith | you don't need to test (seq coll) |
| 20:02 | justin_smith | reduce handles empty inputs just fine |
| 20:03 | justin_smith | though where you want to return [nil nil] you could use or |
| 20:03 | dabd | ,(reduce #(if (f %1 %2) %1 %2) nil) |
| 20:03 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: f in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 20:04 | dabd | ,(reduce #(if (> %1 %2) %1 %2) nil) |
| 20:04 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox$eval89$fn> |
| 20:04 | justin_smith | you need the init val |
| 20:05 | dabd | can you post youre definition pls? |
| 20:05 | dabd | your* |
| 20:05 | justin_smith | dabd: working on it |
| 20:07 | justin_smith | dabd: https://gist.github.com/noisesmith/7700208 |
| 20:07 | justin_smith | first one updated, and works |
| 20:08 | justin_smith | for nil or valid inputs |
| 20:11 | justin_smith | both updated and working |
| 20:12 | justin_smith | oops, one bug in the latter |
| 20:12 | dabd | the most fn may raise an exception depends on how the function f handles a nil value |
| 20:12 | justin_smith | yeah, that is the bug |
| 20:12 | justin_smith | fixing |
| 20:14 | dabd | (f h) -> (when-not (nil? h) (f h)) seems to work |
| 20:14 | justin_smith | I was looking for something more concise |
| 20:15 | coventry | (doc fnil) |
| 20:15 | clojurebot | "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched." |
| 20:15 | justin_smith | because otherwise the if seq coll version makes sense |
| 20:15 | coventry | Doesn't quite work. |
| 20:15 | justin_smith | coventry: we don't know a-priori what arg to give f |
| 20:15 | justin_smith | right, I tried that :) |
| 20:18 | justin_smith | https://gist.github.com/noisesmith/7700208 |
| 20:18 | justin_smith | it's a judgement call whether my version of the second is better |
| 20:18 | justin_smith | I am pretty sure my version of the first is |
| 20:18 | justin_smith | that if could be an and |
| 20:18 | justin_smith | that may help clarity wise |
| 20:19 | dabd | ends up being almost as verbose as the when-not nil? version |
| 20:19 | justin_smith | right |
| 20:22 | justin_smith | I'd say use the destructuring so you don't have to call first / rest, but leave the check on seq coll |
| 20:22 | justin_smith | for the second one |
| 20:23 | dabd | ok thanks |
| 20:23 | justin_smith | https://gist.github.com/noisesmith/7700208 updated |
| 20:24 | justin_smith | (I also changed alignment of the last two args of reduce, because I think the extra line is worth the clarity) |
| 20:57 | coventry | Just had a programming interview where the problem was to implement a robot moving on an integer grid. Wrote it in nice functional style, so it hurt a little when the interviewer wanted me to make it throw an exception when it hit an obstacle. :-) |
| 20:58 | justin_smith | hah |
| 20:58 | justin_smith | robots hitting obstacles? how totally out of the ordinary, better throw an exception! |
| 21:01 | emaphis | I take exception to hitting obstacles. |
| 21:05 | dsrx | move :: Location -> Either Collision Location |
| 21:05 | dsrx | bleh add a direction in there somewhere too |
| 21:07 | emaphis | Depends on how much beer I've had. |
| 21:08 | dsrx | hmm, so it's a function of BAC too ;D |
| 21:08 | dsrx | I met a guy at thanksgiving dinner named "T. Scala" |
| 21:08 | dsrx | made me wonder if he had a cousin "L. Clojure" |
| 21:09 | emaphis | :-) |
| 21:09 | justin_smith | Q. PHP never gets invited anywhere |
| 21:10 | justin_smith | (it's a vietnamese name) |
| 21:11 | hyPiRion | You'd be surprised when you hear about Haskell Curry then. |
| 21:53 | `cbp | bitemyapp: The heckle thing kinda works now lol. It feels kinda silly though |
| 21:54 | bitemyapp | `cbp: why? |
| 21:54 | bitemyapp | `cbp: do you need the ability to ignore namespaces or what? |
| 21:54 | `cbp | no, i don't know it just does :D |
| 21:54 | `cbp | Just need to revert clojure.test now to show successes instead of failures |
| 21:55 | `cbp | and uh test selectors too i guess |
| 21:55 | `cbp | oh and mutate more stuff |
| 21:56 | bitemyapp | heh |
| 21:56 | bitemyapp | `cbp: sounds fun :) |
| 21:57 | `cbp | bitemyapp: https://www.refheap.com/21341 :P |
| 21:57 | `cbp | that -231 is randomized stuff |
| 22:02 | bitemyapp | `cbp: oh no, you should just change functions to throw an exception |
| 22:02 | bitemyapp | `cbp: much more reliable that way, and you can use the exception class to determine if it was caused by eris. |
| 22:02 | bitemyapp | (ErisException. "Are you testing this function?") |
| 22:02 | `cbp | well i didnt think of that :) |
| 22:02 | `cbp | but randomizing stuff is more fun |
| 22:03 | bitemyapp | `cbp: you really shouldn't randomize outputs |
| 22:04 | bitemyapp | `cbp: seriously, it'll miss stuff and be harder to understand |
| 22:04 | bitemyapp | `cbp: better to just use an exception class. |
| 22:04 | `cbp | aw |
| 22:07 | coventry | The trouble is, you can only randomize one element at a time to effectively test coverage. So you probably do need to do it a higher granularity for it to be efficient. |
| 22:11 | `cbp | I think i had it all wrong |
| 22:11 | `cbp | oh well time to rewrite |
| 22:12 | logic_prog | are there protocols for (1) map, (2) atom ? In particular, I'd like to implement my own datat structures that can be used in place of standard maps/atoms |
| 22:12 | coventry | `cbp: You might want to take a look at ztellman's sleight. It's useful for this kind of thing. |
| 22:13 | llasram | logic_prog: For JVM Clojure most of that pre-dates protocols, but there are interfaces, and you can define types implementing those interfaces |
| 22:14 | logic_prog | llasram: and if I do so, I can then use assoc/get/update aswell as @/swap! on them ? |
| 22:14 | bitemyapp | coventry: that may not be a good fit. |
| 22:14 | logic_prog | llasram: if so, if ther sample code I can look at? |
| 22:14 | llasram | logic_prog: Not `swap!`, but yes to the rest |
| 22:15 | coventry | bitemyapp: Actually, yeah, if he wants to break things at the function level. I was thinking that looking at what he has on github now. |
| 22:16 | llasram | logic_prog: Someone had a macro which simplified implementing a map-like thing... Who/where it was eludes me at the moment |
| 22:16 | bitemyapp | coventry: would not robert.hooke or alter-var-root suffice? |
| 22:16 | bitemyapp | (fn [] (throw (MyException. "blah"))) |
| 22:16 | coventry | bitemyapp: Yeah, for breaking things at the function level. |
| 22:16 | bitemyapp | well that's all that matters. |
| 22:17 | llasram | logic_prog: For references, `@` is just IDeref and optionally IPending |
| 22:17 | justin_smith | I just answered a stack overflow question about a library I work on. It is a weird feeling. |
| 22:17 | logic_prog | llasram: noted |
| 22:17 | coventry | It seems rather inadequate, actually. You don't learn which forms within each function are being exercised by your tests, that way. But it's the only way for a strategy like heckle to run in reasonable time. |
| 22:17 | logic_prog | llasram: if you don't mind explaining; why is swap! different from @ ? |
| 22:18 | llasram | logic_prog: Because `swap!` is just for atoms and is explicitly defined as such. Check out the source |
| 22:19 | logic_prog | llasram: how shold I be searching the code? https://github.com/clojure/clojure/search?q=defn+swap%21&ref=cmdform is rather useless |
| 22:19 | logic_prog | so I must be doing something wrong |
| 22:20 | justin_smith | logic_prog: (clojure.repl/source swap!) |
| 22:21 | logic_prog | justin_smith: let me try that |
| 22:21 | bitemyapp | coventry: functions alone would be a substantial improvement. branches/forms could follow later *after* something working is released. |
| 22:22 | logic_prog | justin_smith: worked; thanks! |
| 22:22 | coventry | I just don't understand what this strategy gets you over something like cloverage, which actually will look at coverage at the level of forms. |
| 22:22 | bitemyapp | coventry: http://clojurewiki.com/ a wiki page a day keeps the bitemyapp away. |
| 22:22 | bitemyapp | coventry: how can cloverage understand which branches get exercised? |
| 22:22 | `cbp | ooh a wiki! |
| 22:22 | bitemyapp | `cbp: yeah I finally launched one. |
| 22:23 | bitemyapp | `cbp: make an account and write stuff :D |
| 22:23 | coventry | bitemyapp: Tracing instrumentation. https://github.com/lshift/cloverage/blob/master/cloverage/src/cloverage/instrument.clj |
| 22:29 | coventry | And, if the sadomasochism of heckle's marketing is appealing, cloverage is actually way more invasive and controlling. :-) |
| 22:30 | coventry | "I'm going to watch your every thought." :-) |
| 22:43 | bitemyapp | coventry: is lshift or Jacek the official version of cloverage? |
| 22:47 | bitemyapp | coventry: this does seem nice. |
| 23:02 | concur | hey |
| 23:03 | concur | is there any way to paint an array as pixels in seesaw? |
| 23:09 | glosoli | hmm what would you suggest for database migration? |
| 23:11 | bitemyapp | glosoli: http://clojurewiki.com/Libraries#database-migrations |
| 23:16 | justin_smith | what is the predicate to check if you can use a thing as the first arg to get? |
| 23:17 | justin_smith | for some reason I expected associative? to exist |
| 23:17 | justin_smith | never mind, it does |
| 23:17 | bitemyapp | justin_smith: had me proper baffled for a moment there. |
| 23:17 | justin_smith | not nearly as confused as I was, I am sure |
| 23:18 | justin_smith | almost done with a lein plugin that encrypts / decrypts edn data |
| 23:18 | justin_smith | probably mostly useful for config |
| 23:18 | justin_smith | also regular functions to suck that data into your config, of course |
| 23:19 | justin_smith | no more unencrypted passwords in git, yay |
| 23:21 | bitemyapp | justin_smith: that's a good idea. |
| 23:22 | justin_smith | I've been wanting it for a while, the holdup was making it convenient to use |
| 23:22 | justin_smith | because if it is annoying it may as well not be there because people won't use it proplerly |
| 23:23 | justin_smith | so I have lein crypt show - outputs creds (looks for passwords in command line, then env, then a dotfile in home dir, then fallback to project.clj |
| 23:23 | justin_smith | ) |
| 23:23 | justin_smith | lein crypt store |
| 23:23 | cemerick | justin_smith: FWIW, get accepts a lot more than things that are associative |
| 23:23 | justin_smith | and lein crypt update (which acts like swap |
| 23:24 | justin_smith | cemerick: OK, associative is what I wanted actually :) thanks |
| 23:24 | cemerick | associative? indicates that `assoc` will work, if that's what you care about |
| 23:24 | cemerick | ah, cool |
| 23:25 | justin_smith | err s/project.clj/project as merged and passed in by lein |
| 23:25 | justin_smith | so it would more likely be in the profiles.clj of course |
| 23:40 | justin_smith | https://clojars.org/noisesmith/cryptlj https://github.com/noisesmith/cryptlj |
| 23:40 | justin_smith | I still need to update the readme for the lein tasks |
| 23:43 | bitemyapp | justin_smith: I avoid having secure information in my git repos by simply using environment variables, by the by. |
| 23:43 | bitemyapp | justin_smith: you guys have a penchant for finding excuses to write code, it seems. |
| 23:43 | justin_smith | makes sense, but with our workflow we have multiple developers running the server |
| 23:44 | bitemyapp | I'm not sure what that means or what importance it has. |
| 23:44 | justin_smith | easier to just hand them something that works than set them up with a bunch of scripts |
| 23:44 | bitemyapp | justin_smith: when I handed off the clojure app I deployed to my coworkers for them to tweak and re-deploy, it too, just worked. |
| 23:45 | justin_smith | scenario: we have multiple configs (development / staging etc.), someone else who isn't on the project full time needs to switch configs |
| 23:46 | justin_smith | it's best if they can just provide an environment name and everything else works |
| 23:46 | justin_smith | do I had them a script with all the credentials for all the environments in it? |
| 23:46 | justin_smith | that's where this comes in |
| 23:46 | bitemyapp | in my case, there are simply secured env provider scripts |
| 23:46 | bitemyapp | which I can use without writing any code... |
| 23:46 | bitemyapp | you just source them before running the app. |
| 23:46 | bitemyapp | generally not even that is needed. |
| 23:47 | justin_smith | so if someone new joins the project, you give them a copy of the script? |
| 23:47 | justin_smith | the script is in the repo? |
| 23:47 | bitemyapp | no and no |
| 23:47 | justin_smith | do they run the server on their own machine? |
| 23:48 | bitemyapp | they don't run the staging or production environments on their computers |
| 23:48 | bitemyapp | when they're developing, they use the default config (overriding as they desire) and run things like the database locally |
| 23:48 | bitemyapp | when they need to see if it works, they run the staging deploy script |
| 23:49 | bitemyapp | if it works in staging, that is. |
| 23:49 | justin_smith | right |
| 23:49 | bitemyapp | they can run the test suite and poke at anything they want with the default local dev environ. |
| 23:50 | bitemyapp | also nrepl servers are embedded in the app by default, so they can nrepl into staging or prod if they have ssh access. |
| 23:51 | justin_smith | we tend to have a schema and content that is changing rapidly as we develop - especially in early stages - so dev works out better with a shared db |
| 23:51 | justin_smith | and with a cdn |
| 23:51 | justin_smith | soon likely also zookeeper |
| 23:52 | justin_smith | also api keys |
| 23:52 | justin_smith | (client's social network credentials for example is a common one) |
| 23:52 | justin_smith | it is advantageous to provide all that transperently, and keep it all up to date, without credentials in git |
| 23:53 | justin_smith | of course during dev it is not the client's social key - it is some test key for that app |
| 23:53 | bitemyapp | I don't really mind leaving test stuff in the repo at all. |
| 23:56 | justin_smith | this method is an experiment (not tried in production yet), but what I am aiming for is reducing the incedental complexity of some app behaviors coming from the code, some from config files on the server / dev box, some coming from the environment - wanting a streamlining so that I can as much as possible push the config to one place and know it gets where it is needed |