2011-02-20
| 00:01 | brehaut | ekoontz: may i suggest also alias emacs="/Applications/Emacs.app/Contents/MacOS/Emacs -nw" |
| 00:01 | brehaut | so that your terminal emacs is the same as your gui emacs |
| 00:02 | ekoontz | hmm it's still showing 22.3.1 |
| 00:04 | ekoontz | oh i still had one running in a terminal duh |
| 00:04 | Patrick-DC | Hey guys, who uses SLIME with swank-clojure? |
| 00:22 | Patrick-DC | are you able to compile from emacs |
| 00:22 | Patrick-DC | using C-c C-k? |
| 00:22 | scottj | yeah |
| 00:22 | Patrick-DC | for some reason it's not working for me |
| 00:22 | Patrick-DC | I can eval |
| 00:22 | Patrick-DC | but not compile |
| 00:22 | scottj | what version of slime? |
| 00:22 | Patrick-DC | 1.2.0 |
| 00:22 | Patrick-DC | i think |
| 00:23 | scottj | that's probably a swank-clojure version num |
| 00:24 | scottj | anyway, try using latest swank-clojure and whatever slime version is recommended in the readme |
| 00:24 | ekoontz | going to set up swank-clojure right now |
| 00:25 | Patrick-DC | it's an unofficial slime from github |
| 00:25 | Patrick-DC | nablaone's |
| 00:25 | tomoj | the version of slime in elpa works with swank-clojure 1.3.0-SNAPSHOT |
| 00:26 | scottj | Patrick-DC: if it has a commit 605f930 from oct 15 2009 that's what I'm using as my head |
| 00:31 | Patrick-DC | I just figured out how to use emacs package manager |
| 00:31 | Patrick-DC | this is heaven |
| 00:32 | Patrick-DC | before I was linking in the emacs lisp files for |
| 00:32 | Patrick-DC | swank-clojure and slime via .bashrc |
| 00:32 | Patrick-DC | it was so inelegant |
| 00:32 | Patrick-DC | this is utterly beautiful |
| 00:32 | scottj | via .bashrc not .emacs? |
| 00:32 | Patrick-DC | I was using both |
| 00:33 | ekoontz | Patrick-DC can you install swank-clojure through the emacs package manager? |
| 00:33 | scottj | install swank clojure through lein |
| 00:33 | Patrick-DC | Hell yea |
| 00:33 | tomoj | there is a swank-clojure package in elpa, but you probably don't need it |
| 00:33 | ekoontz | scotty: yeah i did lein install swank-clojure 1.3.0-SNAPSHOT |
| 00:33 | tomoj | slime and slime-repl there work with clojure, though |
| 00:34 | tomoj | it also has a decent clojure-mode |
| 00:34 | tomoj | but the paredit is too old |
| 00:34 | Patrick-DC | haha there's a facebook package for emacs |
| 00:34 | ekoontz | that's cool |
| 00:34 | brehaut | does it say 'stop procreating and code!' ? |
| 00:35 | Patrick-DC | but unfortunately no lein with the emacs package manager |
| 00:35 | Patrick-DC | (haha (brehaut)) |
| 00:35 | tomoj | lein install is just a wget and chmod and doesn't really have anything to do with emacs, does it? |
| 00:35 | Patrick-DC | yep |
| 00:36 | Patrick-DC | just link it in with .bashrc |
| 00:36 | scottj | what do you mean by linking with .bashrc? |
| 00:37 | Patrick-DC | well, since it isn't in my distro repository |
| 00:37 | Patrick-DC | I wgeted it |
| 00:37 | ekoontz | yeah so i followed https://github.com/technomancy/swank-clojure |
| 00:37 | Patrick-DC | and added: |
| 00:37 | ekoontz | but emacs (M-x slime-connect) doesn't work |
| 00:37 | Patrick-DC | export PATH=$PATH:~/opt/leiningen |
| 00:38 | Patrick-DC | to my .bashrc file in my home folder |
| 00:38 | tomoj | ekoontz: did you run `lein swank`? |
| 00:38 | Patrick-DC | ya |
| 00:38 | ekoontz | tomoj: or is it ~/.lein/bin/swank-clojure |
| 00:38 | tomoj | I don't have that |
| 00:39 | Patrick-DC | they're different setups, but they both work |
| 00:39 | ekoontz | that's what https://github.com/technomancy/swank-clojure says to do |
| 00:39 | scottj | that will be ok for basic testing but not for developing a project with dependencies |
| 00:39 | tomoj | oh, didn't know it could do that |
| 00:39 | Patrick-DC | https://github.com/jochu/swank-clojure |
| 00:40 | scottj | tomoj: fairly recent i think |
| 00:40 | tomoj | do you see "user=> Connection opened on local port 4005" etc? |
| 00:40 | scottj | ekoontz: did M-x slime-connect say slime was there and had problems or is slime not loaded? |
| 00:40 | ekoontz | scottj: M-x sl<tab> doesn't give you slime-connect |
| 00:40 | scottj | ekoontz: you installed it with elpa? |
| 00:40 | ekoontz | no match |
| 00:40 | ekoontz | elpa? what's that |
| 00:41 | scottj | how did you install slime? |
| 00:41 | Patrick-DC | elpa is the emacs package manager |
| 00:41 | ekoontz | oh ok that's what i'm missing i think (slime) |
| 00:41 | ekoontz | trying installing slime through elpa |
| 00:41 | scottj | ekoontz: read connecting with SLIME in readme of url you posted |
| 00:41 | Patrick-DC | http://tromey.com/elpa/ |
| 00:41 | ekoontz | that's a lot guys, i'm just a noob here |
| 00:41 | tomoj | looks like the readme has a better package.el |
| 00:41 | ekoontz | s/that's/thanks |
| 00:41 | sexpbot | <ekoontz> thanks a lot guys, i'm just a noob here |
| 00:42 | tomoj | I've just been using the one from tromey.com |
| 00:43 | ekoontz | awesome, i never knew i could evaluate lisp code in *scratch* |
| 00:44 | ekoontz | that's probably been in emacs since forever |
| 00:44 | scottj | maybe try C-h t while y're at it |
| 00:44 | ekoontz | haha yeah |
| 00:48 | ekoontz | i did http://tromey.com/elpa/install.html |
| 00:48 | ekoontz | now i can see a bunch of packages |
| 00:49 | ekoontz | no slime tho |
| 00:49 | scottj | ekoontz: read connecting with SLIME in readme of url you posted (gh swank clojure) |
| 00:50 | ekoontz | scottj: this url? http://tromey.com/elpa/install.html |
| 00:50 | ekoontz | nothing about slime there |
| 00:50 | scottj | https://github.com/technomancy/swank-clojure |
| 00:50 | ekoontz | ok thanks |
| 00:53 | ekoontz | "Install the "slime-repl" package using package.el" what does that mean |
| 00:54 | ekoontz | oh ok |
| 00:54 | scottj | so when you run M-x package-install it doesn't have slime-repl there? |
| 00:54 | ekoontz | no i see, need to put (add-to-list .. ) in my .emacs |
| 00:56 | ekoontz | argh that causes an error when i start emacs |
| 00:56 | scottj | I'm not sure if that's only meant for emacs 23 |
| 00:56 | ekoontz | but i am using emacs 23 |
| 00:57 | ekoontz | "Symbol's value as variable is void: package-archives" |
| 00:57 | ekoontz | maybe that's why technomancy gives a link to an updated package.el |
| 00:57 | scottj | well one option is to clone https://github.com/technomancy/slime and then checkout 605f930 and then add it's path to your load-path then (require 'slime) |
| 00:58 | ekoontz | tring that |
| 00:58 | scottj | yeah try that first |
| 00:59 | ekoontz | saving that as ~/.emacs.d/elpa/package.el |
| 01:01 | ekoontz | yay no startup errors :) |
| 01:06 | ekoontz | package-install still can't find slime-repl tho |
| 01:10 | ekoontz | oh..i think the problem was my .emacs was preventing .emacs.d/ from being read |
| 01:10 | ekoontz | i moved it, restarted emacs and a huge bunch of .el files got compiled |
| 01:11 | ekoontz | now it's installing slime-reply whohoo |
| 01:14 | scottj | eclipse ain't lookin so bad now is it? :) |
| 01:15 | ekoontz | lol |
| 01:15 | ekoontz | i was thinking the same thing but intellij's clojure thingy |
| 01:15 | scottj | the eclipse plugin seems to be the most actively developed/featureful of the big 3 |
| 01:15 | ekoontz | ok, crap, i installed slime-repl before slime |
| 01:16 | ekoontz | scottj: hmm ok |
| 01:16 | ekoontz | i prefer intellij for java development but will consider eclipse for clojure, thanks :) |
| 01:18 | scottj | oh if you already use intellij I'd probably just use that |
| 01:18 | ekoontz | ok |
| 01:18 | scottj | whatever you want, notepad maybe :) |
| 01:18 | ekoontz | yeah |
| 01:25 | ekoontz | i dunno i just always liked emacs for editing lisp code |
| 01:26 | ekoontz | and i want to learn clojure so it seems like a natural fit |
| 01:26 | tomoj | http://mumble.net/~campbell/emacs/paredit-beta.el that's good |
| 01:28 | ekoontz | will take a look |
| 01:28 | ekoontz | thanks tomoj |
| 02:23 | ekoontz | just tried M-x butterfly in emacs 23..mystfied |
| 02:24 | Derander | ekoontz: xkcd reference |
| 02:24 | ekoontz | lol http://xkcd.com/378/ |
| 02:25 | ekoontz | very cute |
| 02:25 | ekoontz | thanks for the clue Derander :) |
| 02:25 | Derander | mmhmm |
| 02:43 | ekoontz | anyone using compojure? |
| 02:44 | scottj | lots of ppl |
| 02:44 | scottj | sexpbot: anyone? |
| 02:44 | scottj | ,anyone? |
| 02:44 | clojurebot | java.lang.Exception: Unable to resolve symbol: anyone? in this context |
| 02:44 | scottj | $anyone |
| 02:44 | ekoontz | lol |
| 02:44 | ekoontz | i love the bots |
| 02:44 | scottj | #emacs has two nice bot things I like ,salespitch and ,anyone |
| 02:55 | rata_ | does anybody know if there is a multiset implementation in clojure? or if there is an easy way to implement one? |
| 03:11 | ekoontz | scottj, so how do you interact with these bots |
| 03:11 | ekoontz | ,salespitch and ,anyone |
| 03:11 | clojurebot | java.lang.Exception: Unable to resolve symbol: salespitch in this context |
| 03:12 | ekoontz | wow there's a clojurebot |
| 03:13 | brehaut | clojurebot, salespitch? |
| 03:13 | clojurebot | I don't understand. |
| 03:14 | scottj | ekoontz: /msg fsbot ,anyone |
| 03:14 | brehaut | you need to address clojurebot by name for most tasks; prefix comma only works for evaluation |
| 03:14 | ekoontz | ok thanks guys |
| 03:14 | brehaut | clojurebot #21 |
| 03:14 | brehaut | clearly i dont know clojurebot very well |
| 03:15 | brehaut | clojurebot, #24 |
| 03:15 | clojurebot | 24. Perhaps if we wrote programs from childhood on, as adults we'd be able to read them. |
| 03:15 | ekoontz | lol @ "Please do not ask if anyone uses, knows, is good with, can help you with <some program or library>. Instead, ask your real question and someone will answer if they can help." |
| 03:16 | ekoontz | anyone know about foo |
| 03:17 | brehaut | its a metasyntactic variable that has been used in computing for basicly ever |
| 03:17 | ekoontz | hahah sorry, i was trying to trigger the bot |
| 03:18 | brehaut | clojurebot is intentionally pretty reserved |
| 03:18 | brehaut | and sexpbot has most of his really noisy features disabled for @clojure |
| 05:19 | kjeldahl | I'm doing some JSON serialization, which fails whenever Clojure encounters java class instances that can't be converted to strings automatically. Is there a simple way in clojure to figure out if a var is such a "class" (any class), and simply replace it with (str (class somevar))? |
| 05:22 | Licenser | greetings everyone |
| 05:28 | kjeldahl | Ok, maybe class? predicate works. |
| 06:27 | edoloughlin | Confused by http://bit.ly/gDcHpF - why does ({"fred" 1} "fred" 0) return 1 but ({} "fred" 0) return 0? |
| 06:32 | tomoj | maps as functions take two args: the key to look up and the default return value |
| 06:32 | tomoj | (also one arg with nil default return value) |
| 06:33 | tomoj | if the key you pass is in the map, it will return the value for that key |
| 06:33 | tomoj | &({"fred" 23 "bob" 25} "bob" 0) |
| 06:33 | sexpbot | ⟹ 25 |
| 06:33 | tomoj | &({"fred" 23 "bob" 25} "bill" 0) |
| 06:33 | sexpbot | ⟹ 0 |
| 06:34 | edoloughlin | tomoj: Thanks. Must read docs in future. |
| 07:02 | _ulises | morning |
| 07:42 | shortlord | is there an emacs command for swank that evaluates the whole form that the point is in? (like the whole function instead of only the current line) |
| 07:51 | _ulises | shortlord: C-x C-e |
| 07:51 | _ulises | (if I remember correctly) |
| 07:53 | shortlord | _ulises: but that command evaluates from the point where I am currently at to the end of the form. which means if I'm inside a function, it does not evaluate the whole function, but only the the form I'm currently in |
| 07:54 | _ulises | sorry, I meant C-c C-c |
| 07:55 | _ulises | that should compile the whole function (for instance), if it's a def or an expression then it should eval it |
| 07:55 | _ulises | (I could be very wrong here or simply misunderstanding your question though) |
| 07:58 | shortlord | _ulises: that seems to compile the form, but not evaluate it |
| 07:58 | shortlord | could be my fault though, I'm totally new to emacs |
| 07:58 | shortlord | I guess I should read up a bit on clojure development with emacs... |
| 07:59 | _ulises | well, it depends on what you're after |
| 08:00 | shortlord | ah, C-M-x evaluates a whole form |
| 08:02 | _ulises | a whole def form |
| 08:02 | _ulises | (not being pedantic, just saying what's on the assembla wiki) |
| 08:02 | _ulises | :) |
| 08:02 | shortlord | ah, right |
| 08:03 | _ulises | if you're at the end of the form you can do C-x C-e, but I suspect you want to do this from within the form? |
| 08:04 | shortlord | yes, exactly |
| 08:05 | _ulises | hrm, well, I don't know then :( |
| 08:06 | shortlord | _ulises: well, C-M-x seems to work for everything I want. normal function calls seem to be def forms as well, so it works pretty well |
| 08:07 | _ulises | ah, very good then :) |
| 10:03 | raek | does anyone know how to stop emacs-starter-kit from rendering "fn" as "ƒ"? |
| 10:06 | incandenza | raek: there is a little section in starter-kit-lisp.el that turns it on; I just commented it out |
| 10:08 | incandenza | huh... is that better than C-x =? |
| 10:08 | raek | incandenza: found it too. I was hoping that there was some way of "tweaking" it off rather than commenting it out |
| 10:08 | raek | what does C-x = do? |
| 10:09 | raek | all I get is "Char: C-j (10, #o12, #xa) point=1646 of 1646 (100%) column=7" in the minibuffer |
| 10:09 | incandenza | hmm... what does C-c p do then? |
| 10:09 | incandenza | I thought it did the same thing but with less info |
| 10:10 | raek | for me C-c p evaluates the expression before the point, pretty-prints the result and shows it in a new buffer |
| 10:11 | incandenza | oh, I see. he has both a custom global binding and slime binding on that key |
| 10:11 | raek | I found it in starter-kit-lisp.el, where the "fn" code lived |
| 10:11 | incandenza | you should be able to turn it off with font-lock-remove-keywords as well |
| 10:14 | raek | incandenza: ah, thanks |
| 10:28 | siefca | what development environment / editor for Mac OS X supports Clojure? |
| 10:31 | mids | siefca: I use MacVim, some clojure vim plugins and leiningen (via cli) |
| 10:33 | mids | Aquamacs seems to be a nice pick; http://stackoverflow.com/questions/257333/clojure-editor-ide-recommendations-on-mac-os-x http://stackoverflow.com/questions/2120533/how-to-setup-aquamacs-for-clojure-development |
| 10:55 | siefca | mids: thx |
| 10:55 | siefca | mids: trying aquamacs but it foults |
| 10:55 | siefca | faults |
| 10:55 | siefca | 2011-02-20 16:48:03.850 Aquamacs[48128:903] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'AHLookupAnchor failed' |
| 10:56 | siefca | i have to reset launchservices, google tells |
| 11:10 | Cozey | Hi..why is vector not a seq? |
| 11:11 | Cozey | ok.. It's not an ISeq implementation, but still a List |
| 11:11 | Cozey | no.. not a list either |
| 11:22 | raek | Cozey: it is similar to why Java ArrayLists are not Iterators. A seq is a sequential view of a collection and can be seens as a link of a linked list, bit with unspecified implementation. Most of the time the collectoin is not itself a seq. An exception is lists, which are their own seqs. |
| 11:23 | raek | *but with |
| 11:23 | raek | *In most of the cases a collection |
| 11:28 | edoloughlin | This is driving me nuts - I just can't work it out. How do I turn [(:email_addr "x@x.x") (:name "X") (:id 3)] into [:email_addr "x@x.x" :name "X" :id 3] ??? Any help most appreciated. |
| 11:31 | dnolen | ,(apply concat [(:email_addr "x@x.x") (:name "X") (:id 3)]) |
| 11:31 | clojurebot | () |
| 11:32 | mids | ,(flatten ['(:email_addr "x@x.x") '(:name "X") '(:id 3)]) |
| 11:32 | clojurebot | (:email_addr "x@x.x" :name "X" :id 3) |
| 11:32 | dnolen | oops |
| 11:33 | edoloughlin | Thanks - I just realised that I need to quote the ( in the REPL. That explains why everything was coming back as variations of nil! |
| 11:33 | dnolen | ,(apply concat '[(:email_addr "x@x.x") (:name "X") (:id 3)]) |
| 11:33 | clojurebot | (:email_addr "x@x.x" :name "X" :id 3) |
| 11:34 | Cozey | dnolen: why does the quote matter with vector? |
| 11:34 | dnolen | Cozey: keywords are functions |
| 11:34 | Cozey | ah of course |
| 11:34 | dnolen | Cozey: nothing to do w/ vector specifically |
| 11:34 | Cozey | :-) |
| 11:34 | Cozey | right - this is kind of a trap |
| 11:37 | dnolen | flatten is more general I think, so quite a bit slower than (apply concat ...) which in turn looks slower than (reduce concat ...) |
| 11:38 | edoloughlin | dnolen: Thanks, must try it out. Can't use flatten as I want to preserve embedded vectors. |
| 11:58 | thorwil | hmm, why do i get a lazyseq out of this? (str (map #(str % "ix") ["aster" "obel" "idef"])) |
| 12:01 | raek | thorwil: the result of map is a lazy sequence. do you want to turn the data structures into a readable string? use pr-str |
| 12:02 | raek | ,(pr-str (for [word ["aster" "obel" "idef"]] (str word "ix"))) |
| 12:02 | clojurebot | "(\"asterix\" \"obelix\" \"idefix\")" |
| 12:02 | raek | ,(print (pr-str (for [word ["aster" "obel" "idef"]] (str word "ix")))) |
| 12:02 | clojurebot | ("asterix" "obelix" "idefix") |
| 12:03 | raek | hrm. (comp print pr-str) is more elegantly written as 'pr' |
| 12:03 | thorwil | i'm using map not for this case, it's just a reduced example |
| 12:04 | raek | map and for both behave the same way in this case |
| 12:04 | raek | ,(str (map #(str % "ix") ["aster" "obel" "idef"])) |
| 12:04 | clojurebot | "clojure.lang.LazySeq@d8e802df" |
| 12:04 | raek | ,(pr-str (map #(str % "ix") ["aster" "obel" "idef"])) |
| 12:04 | clojurebot | "(\"asterix\" \"obelix\" \"idefix\")" |
| 12:05 | raek | (I just personally prefer 'for' over 'map' and an anonymous function when mapping over one sequence) |
| 12:05 | thorwil | and map itself on the repl does print the words, so that adding str to the mix would then switch to this opaque lazyseq befuddles me |
| 12:06 | dnolen | thorwil: that because the repl knows how to print lazy-sequences. but no reason for str to know about them. |
| 12:06 | thorwil | ah! thanks |
| 12:16 | pdk` | ok, riddle me this |
| 12:16 | pdk` | i have a multimethod (defmulti emit (fn [chain & [max-length]] (:order (meta chain)))) |
| 12:16 | pdk` | and dispatch methods defined for 0 1 and :default |
| 12:17 | pdk` | and 3 testing objects with respective orders of 0 1 and 2 in their metas |
| 12:17 | pdk` | it correctly picks the 0 method for the object with order 0 |
| 12:17 | pdk` | but for the object with order 1 it dispatches to :default |
| 12:18 | raek | pdk`: have you changed the 'defmulti' recently? |
| 12:18 | pdk` | it used to be a fn that returned keywords |
| 12:18 | pauldoo | is (def foobar "hello world" 10) the correct syntax for adding a docstring to a def ? |
| 12:18 | pdk` | :order-0 if order was 0 and nil otherwise but it didn't have a case for returning :order-1 earlier |
| 12:19 | pdk` | gives an error pauldoo |
| 12:19 | raek | if you reevaluate a defmulti form, nothing will happen (like with defonce) |
| 12:19 | pdk` | hm |
| 12:19 | pdk` | maybe since i was reloading repeatedly from a repl with load-file |
| 12:19 | pdk` | should probably restart clojure |
| 12:19 | raek | so you need to (def emit nil) or (ns-unmap 'the-ns 'emit) to clear it out first |
| 12:19 | pdk` | aha |
| 12:19 | pdk` | i was wondering what the equivalent to unintern was |
| 12:19 | raek | and after evaling that, you have to evaluate all defmethods again |
| 12:20 | pauldoo | pdk`: so is clojure.org wrong? http://clojure.org/special_forms#Special Forms--(def symbol doc-string? init?) |
| 12:21 | pdk` | ,(def x "hi" 10) |
| 12:21 | clojurebot | DENIED |
| 12:21 | raek | I wonder that too. I get "Too many arguments to def" in clojure 1.3. |
| 12:21 | raek | (alpha 2) |
| 12:21 | raek | which is old... |
| 12:21 | pdk` | yeah getting that here |
| 12:21 | pdk` | on 1.2 |
| 12:21 | raek | pdk`: you can always do (def ^{:doc "The docstring."} foobar 10) |
| 12:22 | pdk` | yeah looking at the docs there it leans toward that and doesnt indicate any other way |
| 12:23 | pauldoo | raek: that other syntax works fine, but unfortunately Marginalia doesn't pick it up |
| 12:28 | wtetzner | is there a way to extend a byte array with a protocol? |
| 12:51 | joshua__ | chouser, can I talk to you in IMs for a minute? |
| 12:56 | anthony__ | I'm trying to create a fn/macro for a directory monitor. What's the best (idiomatically) way to do the parameters? I have a function now with [path evt key fn], where fn will be executed whenever the evt (:create :modify :delete) happens on path. |
| 12:56 | anthony__ | But you should be able to have a fn execute for multiple evts on multiple paths. |
| 12:57 | anthony__ | (does this make any sense?) |
| 13:03 | TimMc | Huh. I find myself needing something like a dependency manager for my graphics app. |
| 13:04 | TimMc | There are a number of bits of state and GUI components that can become "dirty" (their dependencies have changed) and can propagate their own dirtiness to other elements. |
| 13:04 | TimMc | I think a DSL is called for. |
| 13:18 | TimMc | anthony__: You could certainly allow path and evt to be seqs, and treat non-seqs as collections of one item. |
| 13:20 | anthony__ | TimMc: Thanks, Tim. But, you might want to monitor path1 for :create and :delete, and path2 for just :modify. Won't be too common, but something I want to support. |
| 13:20 | anthony__ | So I need a way to do path-evt associations. Is a vector best? |
| 13:20 | anthony__ | (add-fs-watch [path1 :create :delete path2 :modify] key fn) ? |
| 13:20 | TimMc | You could ask relying code to do that for you. |
| 13:21 | anthony__ | TimMc: I'm not sure what you mean. |
| 13:21 | TimMc | Change the order of params to (key fn evt path) and then clients can (map (partial add-fs-watch ...) ...), etc. |
| 13:22 | TimMc | Or (defn add-fs-watch [key fn & watchers] ...) where watchers is a series of evts and paths. |
| 13:23 | TimMc | That might be more idiomatic. |
| 13:23 | anthony__ | That makes sense. |
| 13:23 | anthony__ | How would I iterate through the watchers? |
| 13:23 | anthony__ | watchers = [path1 :create :delete path2 :modify] |
| 13:23 | anthony__ | I suppose it wouldn't be hard to do that manually, nevermind. |
| 13:24 | TimMc | You would call it like (add-fs-watch key fn path1 :create :delete path2 :modify) |
| 13:24 | TimMc | Or (apply add-fs-watch key fn watchers) |
| 13:24 | anthony__ | Perfect. |
| 13:25 | TimMc | Internally, watchers would be a collection of some sort, could e a vector. |
| 13:25 | dnolen | anthony__: also agents have built in support for watching, if you don't want to build the machinery yourself. |
| 13:26 | anthony__ | dnolen: Is it possible to watch a filesystem directory for changes using agents? |
| 13:27 | dnolen | anthony__: no agents just support propagation. watching a filesystem directory in Java is not even possible w/o NIO/2 as far as I know. |
| 13:28 | anthony__ | dnolen: Yeah, not possible without NIO/2. I'm running it using jdk1.7 (just a personal project running on my machine) |
| 14:17 | cobol_expert | hi, i've got a stackoverflow emacs-related question that's been nagging me if anyone wants to take a stab: http://stackoverflow.com/questions/5058963/how-do-i-associate-a-mode-to-a-particular-file-or-a-set-of-files-based-on-extensi |
| 14:17 | cobol_expert | much appreciated |
| 14:38 | pdk` | jesus christ |
| 14:38 | pdk` | i went to a search bar on a website |
| 14:38 | pdk` | and the first thing i typed was (doc |
| 14:42 | bmh | Can I get better stack traces out of the repl? I'm getting a null pointer exception from an invocation of an incanter function and I can't tell where it's being called from |
| 14:47 | joshua__ | pdk`, yea, your suppose to use (find-doc |
| 14:48 | pdk` | oh you! |
| 14:57 | pdk` | ok this'll probably sound dumb but |
| 14:57 | pdk` | say i have a seq of seqs like [[2]] |
| 14:57 | pdk` | and given another seq to prepend [1] and another to append [3] |
| 14:57 | pdk` | i'd want to go from those to [[1] [2] [3]] |
| 14:58 | TimMc | pdk`: Does it matter that the outer seqs are storing other seqs? |
| 14:58 | pdk` | the seqs [1] and [3] in this case aren't going to be nested |
| 14:59 | TimMc | (concat [v1] v2 [v3]) |
| 14:59 | pdk` | but i want to add them literally |
| 14:59 | pdk` | hm |
| 14:59 | pdk` | there's an idea |
| 14:59 | TimMc | Just off the top of my head. May not be the best way. |
| 14:59 | pdk` | ,(let [main [[2 3]] to-prepend [1] to-append [3]] (concat [to-prepend] main [to-append])) |
| 14:59 | clojurebot | ([1] [2 3] [3]) |
| 15:00 | pdk` | i just tried `(~to-append ~@main ~to-prepend) and it seems to give me what i want |
| 15:00 | pdk` | i dunno if using ` is frowned upon outside of macros/returning a form literally |
| 15:01 | TimMc | good question |
| 15:01 | pdk` | it gives correct results at any rate |
| 15:01 | pdk` | ,(let [main [[2] [3]] to-prepend [1] to-append [3]] (concat [to-prepend] main [to-append])) |
| 15:01 | clojurebot | ([1] [2] [3] [3]) |
| 15:01 | pdk` | as does that apparently |
| 15:02 | dnolen | pdk`: TimMc: that'll work but careful with concat, it's lazy so easy to build up thunks and upon realization stack overflow. best to add a doall. note that might be unweildly performance-wise for large seqs. |
| 15:02 | dnolen | also note: |
| 15:02 | dnolen | ,(macroexpand '`(~to-append ~@main ~to-prepend)) |
| 15:03 | clojurebot | (clojure.core/seq (clojure.core/concat (clojure.core/list to-append) main (clojure.core/list to-prepend))) |
| 15:03 | dnolen | converts to a concat. |
| 15:03 | pdk` | wowzers |
| 15:04 | dnolen | ,'`(~to-append ~@main ~to-prepend) |
| 15:04 | clojurebot | (clojure.core/seq (clojure.core/concat (clojure.core/list to-append) main (clojure.core/list to-prepend))) |
| 15:08 | pdk` | symbol soup is the best |
| 15:08 | pdk` | this is why i want canned lisp alphabet soup |
| 15:08 | pdk` | a hearty bowl of ( ) ~ and ` |
| 15:09 | TimMc | pdk`: I'm pretty sure ou can get that just by breaking up spaghetti into short pieces. |
| 15:10 | joshua__ | $findfn [[2]] [1] [3] [[1] [2] [3]] |
| 15:10 | sexpbot | [] |
| 15:10 | joshua__ | $findfn [1] [[2]] [3] [[1] [2] [3]] |
| 15:10 | sexpbot | [] |
| 15:11 | TimMc | $findfn :NP :P |
| 15:11 | sexpbot | [] |
| 15:11 | TimMc | :-( |
| 15:11 | TimMc | I guess that settles it. |
| 15:13 | joshua__ | $findfn :P := :NP true |
| 15:13 | sexpbot | [clojure.core/not= clojure.core/distinct?] |
| 15:14 | joshua__ | I like how not= and distinct are the two that pop up.. very fitting |
| 15:15 | joshua__ | Whats the best idiomatic way to do decorators in Clojure? |
| 15:16 | brehaut | joshua__: in what sense? |
| 15:17 | joshua__ | I'm making a login-required decorator. Figured I'd ask if there is a preferred way to do it (like in python there is a special syntax). |
| 15:17 | brehaut | also ##(sort (conj [[2]] [1] [3])) |
| 15:17 | sexpbot | ⟹ ([1] [2] [3]) |
| 15:18 | lucian | joshua__: not really in clojure, afaik |
| 15:18 | brehaut | joshua__: just use a function |
| 15:18 | brehaut | ring's middleware is idomatic decoration |
| 15:18 | brehaut | (defn mydecorator [f] (fn [& rest] (apply f rest))) |
| 15:18 | lucian | brehaut: in python it's also just a function, joshua__ was probably wondering if there was anything to make it nicer |
| 15:19 | joshua__ | lucian, yep |
| 15:19 | brehaut | you can use -> |
| 15:19 | brehaut | (-> fn (decorate-b) (decorate-a)) |
| 15:20 | brehaut | if you are using moustache it automatically reverses middlewares for you |
| 15:23 | brehaut | lucian: theres no special syntax because throwing functions around is every day in clojure; rather than special case |
| 15:23 | thorwil | how can i turn a " " into \space (and "." to \.)? |
| 15:23 | lucian | brehaut: yeah, python's decorators aren't very much needed either. it's @decorator instead of func = decorator(func) |
| 15:24 | brehaut | lucian: sure, but thats not idiomatic python |
| 15:24 | lucian | brehaut: not anymore, yes |
| 15:25 | lucian | i think the idiom was used quite a bit even before syntactic decorators |
| 15:25 | lucian | nowadays it's just weird |
| 15:25 | brehaut | thorwil: ##(map first [" " "."]) |
| 15:25 | sexpbot | ⟹ (\space \.) |
| 15:26 | lucian | btw, i was wondering if reader macros are planned |
| 15:27 | joshua__ | '(char " ") |
| 15:27 | dnolen | lucian: nope. |
| 15:27 | joshua__ | `(char " ") |
| 15:27 | lucian | dnolen: any particular reason? |
| 15:27 | brehaut | joshua__: comma |
| 15:27 | joshua__ | &(char " ") |
| 15:27 | sexpbot | java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number |
| 15:27 | joshua__ | brehaut, ;p |
| 15:27 | dnolen | lucian: rhickey said so. more nuanced than that, but search the mailing list if you want more detail. |
| 15:27 | joshua__ | ,(char " ") |
| 15:27 | clojurebot | java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number |
| 15:28 | lucian | dnolen: right. i was wondering if it's a technical no because of the java reader (and temporary) or an ideological one |
| 15:28 | dnolen | lucian: ideological. |
| 15:28 | lucian | dnolen: ok, thanks |
| 15:31 | thorwil | eek, Debugger entered--Lisp error |
| 15:31 | thorwil | gotta be careful with ticks and commas, it seems :) |
| 15:31 | brehaut | thorwil: you dont need then normally. comma, ## and & have special meaning in IRC though |
| 15:32 | pdk` | they're just used to trigger the bots in the channel |
| 15:33 | pdk` | i don't think ## is part of clojure itself but , is whitespace and you'd use & in argument lists |
| 15:34 | TimMc | ## is just a trigger for sexpbot |
| 15:34 | thorwil | i got that much. i'm not sure what exactly catapulted me into the debugger |
| 15:34 | TimMc | ah |
| 15:35 | brehaut | what expression were you evaluating? |
| 15:35 | thorwil | variations on `(char " ") |
| 15:35 | brehaut | well char doesnt work on a string |
| 15:35 | brehaut | it raises an exception |
| 15:35 | thorwil | i just closed emacs, found no other way out |
| 15:36 | brehaut | ,(first " ") |
| 15:36 | clojurebot | \space |
| 15:36 | brehaut | its a bit weird but it works |
| 15:36 | brehaut | (uses string's implementation of seq as a seq of chars) |
| 15:37 | thorwil | btw, what's the reason behind character literals being something different from length 1 strings (expect for space and newline, where special casing is no surprise)? |
| 15:38 | brehaut | thorwil: primary reason is that they are different in the JVM |
| 15:38 | brehaut | and JVM strings are made of chars so native interop with strings as first class clojure requires it |
| 15:38 | brehaut | secondly, if you are actually working at the char level its a bunch faster |
| 15:39 | thorwil | ok, thanks |
| 15:40 | brehaut | personally, i think it makes sense too; if i told you that actually, all numbers are just lists of numbers that only one item long, you'd look at me like i was mental ;) |
| 15:49 | pdk` | java has separate classes for Character and String |
| 15:49 | pdk` | so when you do java interop |
| 15:49 | pdk` | sometimes you have to bite your teeth and put up with java brain damage |
| 16:57 | rata_ | hi all |
| 17:01 | rata_ | why doesn't c.c.generic.math-functions/abs work for ratios? |
| 17:01 | rata_ | isn't it supposed to be generic? |
| 17:14 | rata_ | why lein says "*jure names are no longer allowed"? |
| 17:16 | brehaut | because that pun got old fast |
| 17:20 | rata_ | that means too many people were naming their projects as *jure? |
| 17:20 | Adamant | de jure? |
| 17:20 | brehaut | compojure, scriptjure, etc |
| 17:20 | Adamant | trial by jure |
| 17:21 | rata_ | but is there any problem that there are so many projects named *jure? |
| 17:21 | brehaut | its pretty horrible |
| 17:22 | rata_ | what's pretty horrible? the restriction or *jure names? |
| 17:22 | brehaut | *jure names |
| 17:22 | KirinDave | Wait... |
| 17:22 | KirinDave | Leiningen has code to reject project creation with *jure? |
| 17:22 | brehaut | yup |
| 17:22 | brehaut | has done since about 1.1 i think |
| 17:23 | rata_ | KirinDave: yes |
| 17:23 | KirinDave | Wow. |
| 17:23 | rata_ | I find pretty horrible the restriction |
| 17:23 | rata_ | what the hell has leiningen to say about how ppl want to name their projects |
| 17:23 | brehaut | im happy not having to wade through a sea of extremely similar names |
| 17:23 | rata_ | is it a tool? |
| 17:24 | brehaut | you had come up with a *jure pun and just got burnt by lein ? |
| 17:24 | rata_ | fuck leiningen... has cake the same stupid restriction? |
| 17:24 | KirinDave | technomancy: Ha. Hahaha. |
| 17:24 | rata_ | I don't want a moralist tool |
| 17:24 | KirinDave | technomancy: That's fsckin' awesome |
| 17:25 | rata_ | *opinionated tool |
| 17:25 | rata_ | I want a tool that does the job |
| 17:25 | Adamant | rata_: it's not morality, it's a programmer with an option |
| 17:25 | KirinDave | technomancy: I mean, it's turrible. But it's awesome. |
| 17:25 | Adamant | *opinion |
| 17:25 | Adamant | yah |
| 17:25 | KirinDave | rata_: then clojure may not be your community. |
| 17:26 | rata_ | brehaut: I got that name 3 months and didn't create the project using leiningen, I did it "by hand" |
| 17:26 | rata_ | KirinDave: who are you to say I don't belong here? |
| 17:26 | KirinDave | rata_: I AM THE CLOJURE POLICE> |
| 17:27 | rata_ | Adamant: it's not an option, it's a restriction |
| 17:27 | Adamant | rata_: opinion |
| 17:27 | Adamant | yes it is a restrictin |
| 17:27 | KirinDave | rata_: But seriously, idiosyncrasies and opinionated projects are the norm in the clojure community. |
| 17:27 | morphling | rata_: fork leiningen if you have strong opinions about it.. |
| 17:27 | KirinDave | rata_: You will see it _a lot._ |
| 17:27 | Adamant | morphling: or just have a patch that unfucks it. |
| 17:28 | markskilbeck | KirinDave: those are qualities of most programmers/communities. |
| 17:29 | KirinDave | markskilbeck: I think the Clojure community is by far the most idiosyncratic I interact with |
| 17:29 | Adamant | I am hardly an expert on the Clojure community, but I've seen worse and more annoying than that |
| 17:29 | Adamant | in fairly mainstream communities |
| 17:29 | markskilbeck | I haven't noticed. |
| 17:29 | rata_ | KirinDave: I don't think opinions should get into restrictions, just maybe suggestions, at least in this case |
| 17:30 | KirinDave | Adamant: We leave Python out of it. Python's sanctimony really throws off the mean. ;) |
| 17:30 | Adamant | KirinDave: ha ha, Python isn't even as bad as some I am thinking about. |
| 17:31 | rata_ | well, let's try out cake |
| 17:31 | KirinDave | Adamant: hah. Am I sensing a veiled haskell community reference? |
| 17:31 | Adamant | KirinDave: no |
| 17:32 | __name__ | KirinDave: What's sanctimony about Python? |
| 17:32 | brehaut | the whitespace rule? |
| 17:32 | Adamant | Haskell is idiosyncratic and opinionated, but not especially fascist |
| 17:32 | KirinDave | __name__: OPen up the python shell, type "import this" |
| 17:32 | brehaut | though shall not do fp? |
| 17:32 | KirinDave | But have a barf bag ready |
| 17:32 | __name__ | KirinDave: I know. |
| 17:32 | KirinDave | Because it's like I just told you, "This smells really bad. Smell it." |
| 17:33 | KirinDave | "our 15 year outdated ideas, lets all stroke them." |
| 17:36 | Adamant | __name__: mostly Guido deciding to do half-ass FP support then annoying people who work in the FP style by removing and shuffling around random shit to fit with his programming ideology |
| 17:37 | Adamant | or at least stating he's really gonna do so |
| 17:37 | __name__ | Adamant: Python is not really FP |
| 17:37 | Adamant | __name__: it's not, but they do partially support it |
| 17:37 | Adamant | and in a horribly ugly way |
| 17:37 | __name__ | yeah, i think it's not a good idea |
| 17:37 | __name__ | to partially support it. |
| 17:37 | Adamant | I agree, they should fully support it |
| 17:38 | Adamant | :P |
| 17:39 | Adamant | benevolent dictators are nice until they get behind the power curve. |
| 17:48 | rata_ | thanks cake! you don't have that annoying restriction =) |
| 17:59 | technomancy | KirinDave: the thing is since that restriction has been in place so long people forget how annoying it was |
| 17:59 | technomancy | but then someone created a project called "couveraejure" or some such and I was like "you shall not paaaaaaass" |
| 18:00 | KirinDave | Hahah. |
| 18:01 | KirinDave | technomancy: Well I approve. :D |
| 18:01 | shortlord | woah, functions like filter and map automatically dereference a ref? neat |
| 18:01 | technomancy | http://www.jtbourne.com/wp-content/uploads/2010/07/you-shall-not-pass.jpg |
| 18:03 | mrBliss` | shortlord: how do you mean? ##(let [r (ref [1 2 3])] (map inc r)) |
| 18:03 | sexpbot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Ref |
| 18:06 | technomancy | ,(map (atom [:a :b :c]) [1 2 3]) |
| 18:06 | clojurebot | java.lang.ClassCastException: clojure.lang.Atom cannot be cast to clojure.lang.IFn |
| 18:07 | technomancy | ,(map (ref [:a :b :c]) [0 1 2]) |
| 18:07 | clojurebot | (:a :b :c) |
| 18:07 | technomancy | curious |
| 18:10 | shortlord | well it seems that you can use a ref directly as a function without dereferencing it first. that's really nice, any other situations where something is automatically dereferenced? |
| 18:10 | technomancy | shortlord: vars are too |
| 18:10 | technomancy | ,(#'+ 1 2 3) |
| 18:10 | clojurebot | 6 |
| 18:11 | technomancy | no idea why atoms aren't |
| 18:13 | ossareh | hola all |
| 18:14 | rata_ | technomancy: is kapjure (for kappa + capture + clojure) a wrong name? |
| 18:16 | technomancy | rata_: there's already a library called capjure |
| 18:18 | rata_ | technomancy: well, that's sad... even so, I've been calling my project kapjure for 3 months, so it's too late to change it |
| 18:20 | jjido | rata_: how about "kapjura"? |
| 18:20 | rata_ | jjido: it doesn't sound good I think |
| 18:21 | rata_ | anyway, I don't think my project will be famous, so the similarity between capjure and kapjure is not a real problem probably |
| 18:22 | technomancy | well whatever you do, don't write a third book called "Programming Scala" |
| 18:22 | rata_ | ok |
| 18:23 | rata_ | technomancy: but really, that restriction is pretty annoying |
| 18:23 | technomancy | KirinDave: have you given any thought to a Clojure wrapper for Akka? |
| 18:23 | technomancy | I was looking over it, but it looks like the docs for Java are still being fleshed out, and I couldn't make sense of the docs for Scala. |
| 18:26 | technomancy | might be a strategic project for BankSimple's polyglotism to tackle, hint hint. |
| 18:53 | KirinDave | technomancy: Ha |
| 18:53 | KirinDave | technomancy: I have, though. Yes. |
| 18:53 | KirinDave | technomancy: 1.1 is the place to start that tho |
| 18:55 | TimMc | Any better way to modify each value of a map than (into {} (for [[k v] ...] [k ...]))? |
| 18:56 | TimMc | into+for doesn't allow me to preserve the type of the associative object |
| 18:57 | brehaut | TimMc: (let [m (hash-map :a 1 :b 2) f (juxt type identity)] (f (into (empty m) (map identity m)))) |
| 18:58 | KirinDave | technomancy: It's hard tho. Akka feels like erlang actor stuff because of the DSL capabilities of scala. That specific kind of turtle-shell DSL and the pattern matching that goes with it is not so natural in cojure. |
| 18:58 | KirinDave | technomancy: Orrrrrrr... "insufficient symbol-macrolet" :) |
| 18:59 | TimMc | brehaut: hum... I'll have to digest that. |
| 18:59 | brehaut | TimMc: the part you care about is (empty m) |
| 18:59 | TimMc | yes |
| 19:00 | brehaut | its not necessarily a good solution |
| 19:01 | TimMc | brehaut: Thanks! That looks like it will work. |
| 19:01 | TimMc | I have to build up an entirely new object anyway, so this is fine. |
| 19:01 | brehaut | TimMc: im not convinced it actually does ;) eg, array-maps turn into hash-maps at a certain size |
| 19:02 | TimMc | How is that a problem? |
| 19:02 | TimMc | I'll be building it back up to the same size. |
| 19:03 | brehaut | TimMc: its an it depends problem |
| 19:04 | brehaut | if you care enough about preserving the original type, then having it change on you during the into process might not be ideal |
| 19:04 | brehaut | i dont know your specifics though |
| 19:04 | TimMc | Ah! No, I don't care if changes from an array-map to a hash-map. |
| 19:05 | TimMc | The original might be a record or a struct. |
| 19:05 | TimMc | Maybe it doesn't matter -- I think I can rewrite my code to avoid having to care about preserving type. |
| 19:07 | TimMc | brehaut: I have a set of API calls that all work on an associative object whose type is an implementation detail. I'd rather restrict the number of methods who care about that detail. |
| 19:07 | TimMc | So, I'm using (create) instead of (empty obj). Then only create has to know. |
| 19:11 | TimMc | $findfn true true true false true false |
| 19:11 | sexpbot | [clojure.core/distinct? clojure.core/= clojure.core/and] |
| 19:11 | TimMc | hrmf |
| 19:13 | TimMc | ,(every? true? [true true false true]) |
| 19:13 | clojurebot | false |
| 19:13 | TimMc | ,(every? true? []) |
| 19:14 | clojurebot | true |
| 19:14 | TimMc | nice |
| 20:21 | joshua__ | TimMc, if you don't mind me asking.. what are you working on? |
| 20:29 | devn | (defn me? [] :me), (defmulti handle-command (fn [command nick channel message irc & args] command)) |
| 20:29 | devn | (defmethod handle-command "is that me?" [_ _ _ _ _] (me?)) |
| 20:30 | devn | (handle-command "is that me?") throws an exception for an invalid number of aguments which is fair |
| 20:30 | devn | but in order to get that call to handle-command to work I need to (handle-command "is that me?" nil nil nil nil) |
| 20:30 | devn | I must be doing something wrong there... |
| 20:34 | Stavros | hello |
| 20:34 | devn | maybe i shouldnt be using a multimethod here, but it solves a lot of my issues, the only one remaining seems to be that the arity varies quite a bit and passing in nils seems weird |
| 20:34 | devn | Stavros: hola |
| 20:34 | Stavros | aren't purely functional languages not supposed to have something like the "do" syntax? |
| 20:34 | Stavros | i'm just learning clojure, so i don't know, but it seems weird |
| 20:34 | devn | clojure isn't purely functional like haskell |
| 20:34 | Stavros | ah |
| 20:35 | devn | you can do I/O if you want |
| 20:35 | Stavros | is it a lisp? |
| 20:35 | brehaut | Stavros: it depends if you like to have a language that can do more than heat up your CPU |
| 20:35 | Stavros | brehaut: haha, i see |
| 20:35 | brehaut | yeah :) |
| 20:35 | devn | stuart halloway has referred to clojure as a "consenting adults" language |
| 20:35 | devn | you can do IO -- it can be dangerous, but that's on you |
| 20:35 | Stavros | i'm just wondering whether i should avoid that and loops |
| 20:35 | devn | Stavros: i would avoid do and loops at first |
| 20:36 | Stavros | devn: ah, thanks |
| 20:36 | devn | check out project euler -- that will make you make good use of maps, reduce, filter, etc. |
| 20:36 | Stavros | devn: i am, i'm at the second problem |
| 20:36 | Stavros | i'm trying to get all the fibonacci numbers by recursion up to 4 million |
| 20:36 | devn | :) |
| 20:36 | Stavros | which is tricky |
| 20:36 | devn | Stavros: are you using your REPL? |
| 20:36 | Stavros | i figured i can pass a list to each call and then append to it |
| 20:36 | Stavros | devn: no, it doesn't work very well |
| 20:37 | Stavros | i can't use the up/down arrows for history, etc |
| 20:37 | devn | one thing that i cannot recommend enough to people learning clojure is to leverage the power of the REPL to try lots of stuff quickly |
| 20:37 | devn | Stavros: cake (the clojure build tool) has a better repl than leiningen |
| 20:37 | devn | it has completion and such |
| 20:37 | devn | what editor are you using? |
| 20:37 | Stavros | hmm, do i just apt-get that? |
| 20:37 | Stavros | vim |
| 20:38 | devn | Stavros: https://github.com/ninjudd/cake |
| 20:38 | Stavros | ah, thanks |
| 20:38 | DespiteItAll | Stavros -- do you have vimclojure? |
| 20:38 | DespiteItAll | Actually, nevermind, if you're just getting started you need a real repl. Vimclojure can be painful. |
| 20:38 | Stavros | DespiteItAll: i'm not sure, i installed the plugins on the "getting started" page |
| 20:38 | devn | Stavros: depending on where you came from (language-wise), im guessing you'll have an initial reaction to using the REPL to drive development which (in my experience) was wrong |
| 20:39 | devn | the REPL should drive your programming IMO |
| 20:39 | Stavros | devn: i come from python, so i'm used to a repl |
| 20:39 | devn | Stavros: can i make a really scary suggestion to a VIM user such as yourself? |
| 20:39 | Stavros | awww |
| 20:39 | devn | configure emacs /just enough/ to use slime as your REPL |
| 20:39 | Stavros | i knew you were going to say that :p |
| 20:40 | devn | it is not your mama's REPL |
| 20:40 | DespiteItAll | heheh |
| 20:40 | Stavros | is that hard to do? |
| 20:40 | Stavros | i have emacs installed, but i've never touched it |
| 20:40 | devn | no not really -- i suggest getting technomancy's emacs-starter-kit |
| 20:40 | Stavros | let me do that now |
| 20:40 | devn | and then use M-x package-list-packages to install clojure-mode, slime, slime-repl |
| 20:40 | joshua__ | Stavros, in my experience it was.. well that was easy.. wait its not working.. and than it started working by magic and I loved it |
| 20:41 | Stavros | joshua__: hopefully it'll be the same with me, let me install it because i literally have no idea what all this M-x stuff is :p |
| 20:41 | devn | Stavros: SLIME is an incredible tool -- after you're set up I will show you some stuff that will blow your mind |
| 20:41 | devn | M-. is one that comes to mind :) |
| 20:41 | Stavros | let me install it |
| 20:41 | joshua__ | devn, Blow my mind too! I haven't had my mind blown yet! |
| 20:41 | devn | also, paredit-mode, there is one for vim i believe, consider using it, structural editing is sweet for a lisp |
| 20:42 | devn | joshua__: M-. is pretty awesome, have you used that? |
| 20:42 | DespiteItAll | What does it do? |
| 20:42 | devn | type this at your user> prompt: (defn|) | is your cursor |
| 20:42 | joshua__ | OMG |
| 20:43 | devn | with your cursor in place type M-. |
| 20:43 | Stavros | okay, do i need to put it in .emacs.d/ or .emacs.d/some_subdir? |
| 20:43 | joshua__ | Jumps to declaration. |
| 20:43 | devn | it's even better joshua__ |
| 20:43 | TimMc | joshua__: https://github.com/timmc/CS4300-HW3/ <-- I'm working on a graphics app for a class. |
| 20:43 | devn | let's say you see a function you want to read the source of inside that first M-. |
| 20:43 | devn | hit M-. again and you can jump down another level |
| 20:43 | devn | hit M-, to go back up levels |
| 20:43 | Stavros | hmm, i think i installed it, how do i tell? |
| 20:44 | joshua__ | Dude that is so awesome. Thank you. |
| 20:44 | devn | Stavros: when you launch emacs with it for the first time it should do a whole bunch of compilation and such |
| 20:44 | Stavros | hmm, no then |
| 20:44 | Stavros | aha, now it is installed |
| 20:44 | Stavros | okay, i have a repl on the right |
| 20:44 | devn | Stavros: you need a ~/.emacs that has a (load-file "/Users/username/.emacs.d/init.el") |
| 20:44 | devn | Stavros: with clojure and all, that was fast! |
| 20:45 | Stavros | no, wait, it produced an error :/ |
| 20:45 | devn | :D |
| 20:45 | devn | how are you starting the REPL |
| 20:45 | devn | brb 1s |
| 20:45 | Stavros | i just launched emacs, but it says it can't contact repo.technomancy.us |
| 20:46 | Stavros | oh okay, retried and it's better now |
| 20:46 | Stavros | it's compiling |
| 20:46 | joshua__ | TimMc, "If you share either of these goals, you should probably steer clear of my code. :-P" hilarious!! |
| 20:46 | Stavros | how can i close an emacs pane? |
| 20:47 | joshua__ | c-x 0 |
| 20:47 | Stavros | thanks |
| 20:47 | DespiteItAll | did technomancy do a screencast about paredit? where can I find that? |
| 20:47 | Stavros | although it sort of looks like it's doing things |
| 20:47 | TimMc | joshua__: Actually, the prof has since said that we can look at each others' code for this assignment (since we each are doing a different thing), but the Clojure bit still holds. |
| 20:48 | devn | DespiteItAll: peepcode |
| 20:48 | devn | DespiteItAll: it's a great beginner's screencast |
| 20:49 | devn | once you grok a few bits of terminology and figure out the C-h f,k,a,etc. commands you can figure pretty much anything out yourself |
| 20:49 | DespiteItAll | ah, thanks |
| 20:49 | devn | M-x apropos FTW |
| 20:49 | Stavros | okay, starter kit is done doing things, i think |
| 20:50 | devn | Stavros: my suggestion is to quit emacs, relaunch it, M-x package-list[TAB] to autocomplete to package-list-packages |
| 20:50 | Stavros | devn: done |
| 20:50 | Stavros | i'm trying to install slime-repl |
| 20:50 | Stavros | but it's giving me a syntax error |
| 20:51 | devn | Stavros: it might just be warnings from the compilation |
| 20:51 | Stavros | well i'm clicking on it and pressing enter, neither will work |
| 20:51 | devn | oh, right, either type 'h' or '?' |
| 20:51 | Stavros | wrong number of arguments: called-interactively-p, 1 |
| 20:51 | Stavros | that seems to have worked |
| 20:52 | Stavros | i pressed "i" |
| 20:52 | Stavros | no reaction |
| 20:52 | devn | yes, press i on all of the things you want to mark for installation |
| 20:52 | devn | then press x to make it all run |
| 20:52 | Stavros | ah |
| 20:52 | Stavros | how do i select things? :( |
| 20:52 | devn | how do you mean? |
| 20:53 | Stavros | i place my pointer over the package name, press i, then i press x and it says "no operations specified" |
| 20:53 | Stavros | so i assume i need to select a package in a different way |
| 20:53 | devn | put your pointer at the beginning of each line |
| 20:53 | Stavros | ah |
| 20:53 | Stavros | that worked |
| 20:53 | Stavros | yep |
| 20:53 | Stavros | okay, it did things |
| 20:54 | Stavros | now i have to launch the repl, i guess? |
| 20:54 | Stavros | M-x slime-repl isn't there |
| 20:54 | devn | *nod* |
| 20:54 | Stavros | man, i feel like my users |
| 20:54 | devn | here's how i work with the repl Stavros |
| 20:54 | devn | do you use leiningen or cake yet? |
| 20:54 | Stavros | i'm not sure, i just run "clojure" |
| 20:54 | Stavros | it's not cake |
| 20:55 | devn | okay you should get lein or cake |
| 20:55 | Stavros | will do |
| 20:55 | devn | Stavros: https://github.com/technomancy/leiningen/raw/stable/bin/lein |
| 20:56 | Stavros | i only need this file? |
| 20:56 | devn | put that on your PATH, chmod +x it, then run lein, it'll do it's thing, then do a `lein new myproject` |
| 20:56 | devn | this created a project directory with a project.clj file |
| 20:56 | TimMc | Stavros: It's a self-installer. It loads itself into ~/.lein |
| 20:57 | devn | add this to the project.clj file after :dependencies [[foo "1.2.0"]] |
| 20:57 | devn | :dev-dependencies [[swank-clojure "1.3.0-SNAPSHOT"]] |
| 20:57 | devn | save it, run `lein deps` |
| 20:57 | devn | you'll see it pull down swank-clojure, now you have a new `lein` task in that directory: run `lein swank` |
| 20:57 | devn | in emacs type M-x slime-connect[RET] |
| 20:57 | Stavros | okay, just a second :p |
| 20:57 | devn | hit return for all of the questions |
| 20:58 | Stavros | do i need to put lein in /usr/bin, or will just running it be ok? |
| 20:58 | devn | it should show you a user> prompt, and there you are |
| 20:58 | devn | Stavros: put it on your PATH |
| 20:58 | devn | I have it in ~/bin/lein |
| 20:58 | Stavros | ah great |
| 20:58 | Stavros | let me do the rest |
| 20:58 | devn | and have $HOME/bin on my PATH |
| 20:59 | devn | i really should write a script or something to just set this up automatically for someone new to emacs and clojure |
| 20:59 | clojurebot | lisp is the red pill |
| 20:59 | devn | heh |
| 21:00 | TimMc | devn: yes yes yes yes yes |
| 21:00 | Stavros | okay, emacs says connected |
| 21:00 | Stavros | devn: i wouldn't recommend a script, maybe an instructions page |
| 21:01 | Stavros | i already learnt a few things from this :p |
| 21:01 | devn | Stavros: now type some stuff into that damn REPL and hack the Gibson :) |
| 21:01 | Stavros | oh wow, it adds automatic closed parentheses |
| 21:01 | devn | yeah i think technomancy added paredit-mode by default to the starter kit |
| 21:01 | Stavros | can i make it so the parentheses are a different color? |
| 21:02 | devn | or as a dependency of clojure-mode |
| 21:02 | Stavros | or the scopes |
| 21:02 | Stavros | by the way, this seems to be a buffer |
| 21:02 | Stavros | not a repl |
| 21:02 | Stavros | even though i did connect |
| 21:02 | devn | hm? how do you mean? |
| 21:02 | Stavros | well there's no > |
| 21:02 | devn | like you "connected" in your terminal, or from emacs? |
| 21:02 | Stavros | and pressing enter just adds a new line |
| 21:02 | Stavros | i connected from emacs to swank |
| 21:02 | Stavros | it said connected, etc |
| 21:03 | Stavros | but it didn't open a repl, it dropped me in my buffer again |
| 21:03 | devn | and you did a M-x slime-connect ? |
| 21:03 | Stavros | yes, it was successful |
| 21:03 | devn | try C-x C-b, see anything that says *slime clojure* or something like that? |
| 21:04 | Stavros | scratch, messages, completions, slime-events |
| 21:04 | devn | did you run lein deps, and lein swank from the project directory? |
| 21:04 | Stavros | yes |
| 21:04 | devn | after you added swank-clojure as a dependency |
| 21:04 | Stavros | yes, swank is runninng |
| 21:04 | devn | and what does your terminal say now where you ran lein swank? |
| 21:04 | Stavros | Connection opened on local port 4005 |
| 21:04 | TimMc | I'm going to scroll back and follow along myself. |
| 21:04 | Stavros | #<ServerSocket ServerSocket[addr=localhost/127.0.0.1,port=0,localport=4005]> |
| 21:05 | devn | Stavros: could you quit emacs, and try a fresh M-x slime-connect? |
| 21:05 | Stavros | sure |
| 21:05 | Stavros | now swank crashed, let me restart both |
| 21:06 | devn | kk |
| 21:06 | Stavros | connected again |
| 21:06 | Stavros | is a repl supposed to open up, or what? |
| 21:07 | Stavros | all i get is the scratch buffer |
| 21:08 | devn | Stavros: can you C-x C-b and open the messages buffer and the slime-events buffer |
| 21:08 | devn | and tell me if you see anything that is an obvious error |
| 21:09 | devn | Stavros: what version of emacs |
| 21:09 | Stavros | nope, slime-events seems to contain info about the connection, clojure etc |
| 21:09 | Stavros | 23 |
| 21:09 | Stavros | and messages says "updating buffer list" a few times |
| 21:10 | devn | Stavros: did you install slime-repl, slime, and clojure-mode via the package-list-packages? |
| 21:10 | Stavros | oh, let me check about clojure-mode |
| 21:10 | Stavros | how can i search in an emacs buffer, like / in vim? |
| 21:10 | devn | C-s |
| 21:10 | Stavros | thanks |
| 21:12 | Stavros | i installed clojure-mode now and restarted everything, but still no repl :/ |
| 21:12 | devn | Stavros: could you try a M-x slime and see if that fixes anything for you? |
| 21:12 | Stavros | oh, should i also install swank-clojure? |
| 21:13 | Stavros | M-x slime says it can't find lisp |
| 21:13 | devn | it's weird that it says you're connected but then doesn't open a buffer |
| 21:13 | devn | ive never had that happen |
| 21:13 | DespiteItAll | I thought there was a command for that. slime-scratch or something |
| 21:13 | devn | ill screen share over skype with you if you want |
| 21:13 | devn | err if you want to screen share with me |
| 21:14 | DespiteItAll | yeah, try M-x slime-scratch |
| 21:14 | DespiteItAll | oh wait, that's not what you want |
| 21:15 | Apage43 | fff; Clojure is addictive. I'm supposed to be writing erlang, I am using Clojure with the erlang JInterface.. |
| 21:15 | devn | Stavros: http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Emacs |
| 21:15 | devn | err i dont think that's slime though |
| 21:15 | Stavros | let me read that |
| 21:16 | devn | it's not really worth your time, ive told you everything at the bottom basically |
| 21:16 | Stavros | hmm |
| 21:16 | devn | package-list-packages, install slime-repl, slime, clojure-mode, add swank clojure to your project.clj, lein deps, lein swank, M-x slime-connect [RET] [RET] |
| 21:16 | Stavros | oh there we go |
| 21:16 | Stavros | i installed another package |
| 21:16 | Stavros | slime-clojure i think? |
| 21:17 | devn | i think it's slime-repl you needed |
| 21:17 | Stavros | now it works |
| 21:17 | devn | wooo! |
| 21:17 | Stavros | yay |
| 21:17 | Stavros | i had slime-repl, it was something with clojure in it for sure |
| 21:17 | devn | Stavros: do you know about clojuredocs? |
| 21:17 | Stavros | hm no |
| 21:17 | devn | http://clojuredocs.org/ |
| 21:17 | devn | they're your friend! :) |
| 21:18 | Stavros | oh, very nice |
| 21:18 | devn | Stavros: how about clojars? http://clojars.org |
| 21:18 | devn | search for 'html' for instance, and click on a random library in the list |
| 21:18 | Stavros | i don't know enough to understand what clojars is yet, i think |
| 21:18 | Stavros | oh |
| 21:18 | Stavros | is it libraries i can include? |
| 21:18 | devn | Stavros: basically they're just libraries like swank-clojure was |
| 21:19 | Stavros | so i just add one to project.clj and do lein deps? |
| 21:19 | devn | you add them to :dependencies or :dev-dependecies depending on wha tyou want and lein deps |
| 21:19 | devn | bingo |
| 21:19 | Stavros | don't i have to add the repo somehow? |
| 21:19 | Stavros | how will clojure know where to get the packages from? |
| 21:19 | devn | nope, lein knows |
| 21:19 | Stavros | oh good |
| 21:19 | Stavros | this looks very nice |
| 21:19 | devn | you can specify external repos if you'd like as well |
| 21:19 | Stavros | so what can i do with emacs? |
| 21:19 | Stavros | aha |
| 21:20 | devn | Stavros: well, like i was saying earlier |
| 21:20 | devn | at the user> prompt type: reverse| where | is your cursor |
| 21:21 | Stavros | okay |
| 21:21 | devn | type M-., put your cursor on the word "reduce" in that defn, type M-. |
| 21:21 | devn | type M-, to go back |
| 21:21 | Stavros | haha, nice |
| 21:21 | Stavros | hey, that's great! |
| 21:21 | devn | Stavros: it's not just for clojure-core or contrib either |
| 21:21 | devn | this works for the third party libs i showed you on clojars |
| 21:21 | Stavros | ah |
| 21:22 | Stavros | i'll need to learn how to open buffers and copy stuff between them first, though |
| 21:22 | devn | Stavros: are you on OSX or Linux? |
| 21:22 | Stavros | so i can copy things from the repl to a code file |
| 21:22 | Stavros | linux |
| 21:22 | Stavros | ubuntu |
| 21:22 | devn | and are you using emacs with GTK? |
| 21:22 | devn | so it's a window and not in a terminal buffer? |
| 21:22 | Stavros | it's gtk, yes |
| 21:23 | Stavros | i ran emacs in the terminal, but it popped up the gtk one |
| 21:24 | devn | okay well, the first thing you need to learn in emacs is how to navigate, 1. C-n, C-p, C-f, C-b, 2. M-f, M-b, 3. C-v, M-v |
| 21:25 | Stavros | ah, nice |
| 21:25 | Stavros | i can see why people's pinkies hurt :p |
| 21:25 | devn | buffers: C-x b, C-x C-b, selecting text: C-SPACE M-f M-f C-SPACE M-x |
| 21:25 | TimMc | Stavros: Map CapsLock to Ctrl |
| 21:25 | Stavros | TimMc: i tried that, i couldn't get used to it easily |
| 21:26 | devn | Stavros: in emacs selection is "marking" |
| 21:26 | devn | so C-SPACE begins a mark, C-SPACE closes a mark, then you take action upon the marked "region" |
| 21:26 | devn | M-x is copy |
| 21:26 | devn | C-y is paste |
| 21:27 | devn | C-w is cut, C-k is vim's 'D', but in emacs when you do a C-k you add it to your killring |
| 21:27 | Stavros | okay this doesn't work in the repl |
| 21:27 | devn | Stavros: why doesnt what work? |
| 21:28 | Stavros | i did C-SPACE, marked things and C-SPACE again, but M-x only gave me the thing where i enter commands |
| 21:28 | devn | oh duh i mixed that up Stavros |
| 21:28 | Stavros | and pressing C-SPACE after marking says "mark set" but doesn't do much else |
| 21:28 | devn | M-w is what i meant |
| 21:28 | Stavros | oh |
| 21:29 | Stavros | that works! |
| 21:29 | devn | :D |
| 21:29 | Stavros | how can i switch panes? |
| 21:29 | Stavros | like, go to the left pane |
| 21:29 | devn | C-x o |
| 21:29 | Stavros | ah great |
| 21:30 | Stavros | and how can i close the buffer in this pane? |
| 21:30 | devn | Shift + left,right,up,down arrows i think will also work |
| 21:30 | devn | if technomancy added that to the starter kit |
| 21:30 | Stavros | ah they do |
| 21:30 | Stavros | yep |
| 21:30 | devn | also, C-c C-z might work for you to switch between the repl and a clojure-mode buffer |
| 21:30 | Stavros | hmm no |
| 21:30 | Stavros | it takes me back to the repl window |
| 21:31 | Stavros | how can i close a buffer, though? |
| 21:31 | Stavros | hmm, D |
| 21:31 | Stavros | in the buffer list |
| 21:31 | devn | there are many ways |
| 21:31 | devn | C-x k will "kill" a buffer |
| 21:31 | devn | if you just want it out of your way you can "bury" it |
| 21:32 | devn | C-tab |
| 21:32 | devn | or C-c y |
| 21:32 | devn | C-tab will let you cycle buffers quickly |
| 21:32 | devn | it's like alt+tab |
| 21:32 | Stavros | aha, that looks like it cycles them |
| 21:32 | Stavros | yes |
| 21:32 | TimMc | grah |
| 21:32 | Stavros | although C-tab is undefined for me |
| 21:32 | Stavros | C-c y works |
| 21:32 | TimMc | I installed the starter kit, and now my menubar is gone. |
| 21:33 | devn | :D |
| 21:33 | Stavros | TimMc: mine too |
| 21:33 | TimMc | devn: :-( |
| 21:33 | devn | yeah i have to undo some of technomancy's hackerish changes |
| 21:33 | devn | that's one of them |
| 21:33 | Stavros | not much of a *starter* kit :p |
| 21:33 | TimMc | Screw that, then. |
| 21:33 | devn | let me find the line in my config for you... |
| 21:33 | Stavros | how can i open the config in emacs? |
| 21:33 | TimMc | If it's a starter kit, don't take away starter tools. |
| 21:33 | Stavros | or any file |
| 21:33 | TimMc | Stavros: C-x C-f |
| 21:34 | devn | Stavros: i have a better way! |
| 21:34 | devn | :D |
| 21:34 | devn | C-x r j i |
| 21:34 | devn | (i think this works by default in the starter kit) |
| 21:34 | devn | C-x r[egister] j[ump] i[nit.el] |
| 21:35 | devn | you can define more of those in starter-kit-registers.el |
| 21:35 | Stavros | aha, that works |
| 21:35 | Stavros | although C-x C-f is the general way, so thanks |
| 21:35 | devn | C-x f will list "recent" files |
| 21:35 | devn | which can be handy |
| 21:36 | Stavros | i've readded the menu bar and things, how do i save the file? |
| 21:36 | devn | C-x 5 2 will make a new frame or "window" |
| 21:36 | devn | C-x C-s |
| 21:36 | Stavros | ah yes, new window |
| 21:36 | devn | Stavros: i have to say you're probably one of the only people ive met who weren't immediately dumbfounded and/or annoyed by picking up some basic emacs |
| 21:36 | Stavros | how do i quit emacs, by the way? |
| 21:36 | devn | C-x C-c |
| 21:37 | Stavros | devn: haha, thanks |
| 21:37 | Stavros | okay i have a menu |
| 21:37 | Stavros | so, C-x C-f project file |
| 21:37 | devn | Stavros: if you dont want to reload emacs, if you're in init.el and want to try something out |
| 21:37 | devn | let's say you did (+ 1 2)| and | is your cursor |
| 21:37 | devn | C-x C-e |
| 21:37 | devn | boom, it's now live |
| 21:37 | Stavros | hmm let me try that |
| 21:38 | devn | so if you modify some setting for emacs in your init.el or another .el file and C-x C-e the s-exp |
| 21:38 | Stavros | hmm |
| 21:38 | devn | it will affect the whole environment immediately |
| 21:38 | Stavros | haha yes |
| 21:38 | Stavros | that works |
| 21:38 | Stavros | my menu is gone again, nice |
| 21:39 | Stavros | although now i need to restart it |
| 21:39 | devn | it can be nice when you have 10 things open and you want to add a hotkey quick and dont want to have to restart to load it or make sure everything is "safe" |
| 21:39 | Stavros | because commenting the s-exp i can't C-x C-e it |
| 21:39 | Stavros | yep |
| 21:39 | devn | im guessing it's a (setq ...) or something |
| 21:39 | Stavros | yep |
| 21:39 | devn | instead of it being (setq foo t), make it (setq foo nil) |
| 21:40 | devn | and C-x C-e that |
| 21:40 | Stavros | that's okay, i just commented it out |
| 21:40 | Stavros | how can i abort a command? |
| 21:40 | devn | C-g |
| 21:40 | Stavros | like, say i press M-x by mistake |
| 21:40 | Stavros | then C-g? |
| 21:40 | devn | *nod* |
| 21:40 | Stavros | great |
| 21:40 | Stavros | that's not so hard then |
| 21:40 | Stavros | i can already edit my files in emacs |
| 21:40 | devn | C-h a is awesome |
| 21:41 | devn | C-h a, then type buffer, and hit RET |
| 21:41 | Stavros | does that list all the commands? |
| 21:41 | Stavros | are these commands also lisp functions? |
| 21:41 | devn | that match "buffer", so now you can read documentation about them, find the one you're looking for, map it to a hotkey, etc. |
| 21:42 | Stavros | ah, so can i defn my own function in my init.el and assign it to a hotkey or M-x it? |
| 21:42 | devn | not all of them Stavros, there are variables and functions, |
| 21:42 | devn | Stavros: yes exactly |
| 21:42 | Stavros | ah, that's very nice |
| 21:42 | Stavros | so this entire thing is programmable |
| 21:42 | devn | so if you select a region of text and you're like "how do i make this capitalized" or something |
| 21:42 | devn | you can use apropos to search for a function that does that |
| 21:42 | devn | then M-x myfunction on your selection |
| 21:42 | Stavros | aha, capitalize-region |
| 21:42 | Stavros | interesting |
| 21:43 | devn | you're a natural |
| 21:43 | devn | i dont need to teach you anything else |
| 21:43 | devn | C-h t is the tutorial for what it's worth |
| 21:43 | devn | but i find trial by fire to be a more interesting way to learn |
| 21:43 | Stavros | i think C-h a will be enough, thanks :p |
| 21:43 | Stavros | yep |
| 21:43 | Stavros | i hope i don't forget the basics, though |
| 21:44 | devn | I was relying heavily on the arrow keys as a crutch |
| 21:44 | Stavros | i like the arrow keys, even in vim |
| 21:44 | devn | so i did this: (global-unset-key [right])...etc. |
| 21:44 | devn | to force me to use C-n, p etc |
| 21:44 | Stavros | i think i'll keep them, save my pinky :p |
| 21:45 | Stavros | by the way, what's C-x? |
| 21:45 | devn | also, if you dont remap caps to control |
| 21:45 | devn | you're insane |
| 21:45 | Stavros | haha, i might, later on |
| 21:45 | devn | IIRC C-x is a prefix for file operations mainly |
| 21:45 | devn | but its not completely specific to them |
| 21:45 | Stavros | ah |
| 21:45 | Stavros | yeah because C-x C-b is buffers |
| 21:45 | devn | ive seen things like: C-x ; r u |
| 21:45 | devn | or something |
| 21:45 | Stavros | hmm now i have two repls |
| 21:45 | devn | where C-x ; is a prefix on its own |
| 21:46 | devn | like C-x r j i |
| 21:46 | Stavros | ah |
| 21:46 | devn | C-x r j is the prefix |
| 21:46 | Stavros | yep |
| 21:46 | Stavros | hmm, if i have a clojure file in there, can i run it? |
| 21:47 | devn | also, if you're a hardcore vim guy viper-mode will give you lots of vim-like functionality, but in my experience is a bigger pain because you still have to do some emacs stuff the emacs way |
| 21:47 | Stavros | or do i have to call clojure externally? |
| 21:47 | Stavros | yeah, i think i better stick to the native stuff |
| 21:48 | devn | Stavros: how do you mean? |
| 21:49 | devn | Stavros: a couple more slime tricks before i take off: in your REPL buffer type , and then TAB to see what is available |
| 21:49 | Stavros | haha |
| 21:49 | Stavros | i typed s and it quit |
| 21:50 | devn | weird |
| 21:50 | Stavros | nah it's short for sayonara |
| 21:50 | devn | oh haha |
| 21:50 | Stavros | sayoonara, rather |
| 21:50 | devn | but yeah, basically C-x C-e will let you evaluate an (s-exp)| in the REPL from a clojure-mode file |
| 21:51 | devn | C-c C-k will compile a whole file onto the repl |
| 21:51 | Stavros | oh, let me try that |
| 21:51 | devn | C-c M-p will let you se the namespace of the repl (autocomplete works there) |
| 21:52 | devn | so if you have (ns foo.bar)| C-x C-e, C-c M-p foo[TAB][TAB], you'll see foo.bar, hit RET and now your namespace is foo.bar in your REPL |
| 21:53 | Stavros | oh, i think i'll forget that by the time i learn about namespaces |
| 21:53 | devn | Stavros: one more crazy one for you that blows my mind |
| 21:53 | Stavros | or need to use them, anyway |
| 21:53 | devn | in your REPL type reduce| |
| 21:53 | devn | C-c C-w C-c |
| 21:54 | devn | it shows you were reduce is called in clojure.core -- if you have third party libs it'd show you those places as well |
| 21:54 | Stavros | hahaha |
| 21:54 | devn | there's lots more but you'll discover them on your own |
| 21:54 | Stavros | fantastic |
| 21:54 | Stavros | and if i pick one it shows the source in the other pane |
| 21:54 | devn | SLIME > * |
| 21:54 | devn | best. development. tool. ever. |
| 21:55 | Stavros | i had a question but i forgot now :/ |
| 21:56 | devn | Stavros: i idle pretty much all the time in here, if you ever need some help please msg me |
| 21:56 | TimMc | Still trying to get slime-repl. |
| 21:56 | Stavros | oh yes, it was this |
| 21:56 | Stavros | if i have a command, can i find its hotkey? |
| 21:56 | Stavros | like, deleteline |
| 21:56 | devn | yes |
| 21:56 | devn | C-h k |
| 21:56 | devn | type the hotkey |
| 21:57 | TimMc | devn: I think that's the opposite. |
| 21:57 | Stavros | no, i mean the other way |
| 21:57 | Stavros | although that's also nice |
| 21:57 | Stavros | oh C-h a <command> tells you what it's bound to |
| 21:57 | Stavros | so undo is C-/ |
| 21:57 | devn | C-h f will also work |
| 21:57 | devn | for functions that are bound |
| 21:58 | Stavros | aha |
| 21:58 | devn | C-h m is helpful |
| 21:58 | devn | it is the documentation for the mode |
| 21:58 | devn | C-h a,m,f,k |
| 21:59 | devn | and im probably missing a couple more, but those are the big ones |
| 21:59 | pdk` | yknow |
| 21:59 | Stavros | C-h is help? |
| 21:59 | pdk` | even though i know it's ugly as sin |
| 21:59 | pdk` | realizing how i'm writing stufff like (-> seq (first) (first) (first)) now |
| 21:59 | devn | Stavros: *nod* it's a prefix command for the help commands |
| 21:59 | pdk` | kinda makes you want to reach for cdadr type fns |
| 21:59 | Stavros | devn: that's very useful |
| 22:00 | Stavros | are there any more niceties to editing lisp? |
| 22:00 | Stavros | like, making scopes different colors? |
| 22:00 | Stavros | so i can see right away what's what? |
| 22:00 | devn | Stavros: i dont use that, but yeah im sure there's something like that |
| 22:00 | Stavros | what do you use? |
| 22:00 | Stavros | just the default of no colors? |
| 22:00 | devn | and if there isnt there are two modes on the emacs wiki that could be put together |
| 22:01 | devn | Stavros: in the REPL? |
| 22:01 | Stavros | no, in a buffer |
| 22:01 | devn | for a clojure file? |
| 22:01 | Stavros | yes |
| 22:01 | devn | you dont have syntax hilighting? |
| 22:01 | Stavros | i do, the syntax is highlighted, but not scopes |
| 22:01 | Stavros | although they are indented, so i guess it doesn't matter |
| 22:02 | devn | *nod* -- well, some folks like rainbow parens |
| 22:02 | devn | oh Stavros on that not, technomancy added C-c n to the starter kit |
| 22:02 | devn | that handles reindentation |
| 22:02 | Stavros | oh |
| 22:02 | Stavros | haha it worked |
| 22:02 | devn | but Stavros there are a couple of things i suggest w/r/t to that point |
| 22:02 | devn | 1. paredit mode makes scopes less of an issue |
| 22:03 | devn | and 2. without even googling i know for sure someone has done something like you're suggesting |
| 22:03 | devn | i just dont know what it's called off the top of my head |
| 22:03 | devn | im sure it's been done though, without a doubt |
| 22:03 | Stavros | what's paredit? |
| 22:03 | devn | structural editing |
| 22:03 | Stavros | hmm |
| 22:03 | devn | in your clojure source file do you see "Paredit" on the mode line? |
| 22:04 | Stavros | hmm no, [? clojure 1] Fill |
| 22:05 | devn | Stavros: M-x package-list-packages |
| 22:05 | devn | do you see "durendal" in that list? |
| 22:06 | Stavros | yes |
| 22:06 | Stavros | should i install it? |
| 22:06 | pdk` | [21:53] <Stavros> like, making scopes different colors? <- you can have parens be rainbowed at any rate |
| 22:06 | devn | yeah grab it |
| 22:06 | pdk` | colored differently based on how far nested they are |
| 22:06 | Stavros | done |
| 22:06 | devn | rainbow parens can get kind of nasty |
| 22:06 | Stavros | pdk`: hmm |
| 22:06 | pdk` | eg (((hello))) |
| 22:06 | devn | IMO |
| 22:06 | pdk` | you can have the parens in that case |
| 22:06 | pdk` | go from the outermost level being red |
| 22:06 | pdk` | to fading from red->orange->yellow as it goes inward |
| 22:06 | Stavros | aha |
| 22:07 | pdk` | and in the reverse on the )'s as it goes back outward |
| 22:07 | Stavros | i don't know if it's an issue, really |
| 22:07 | devn | Stavros: I have a hotkey I set |
| 22:07 | Stavros | i've only started learning lisp today |
| 22:07 | devn | (global-set-key (kbd "C-c C-(") 'mark-sexp) |
| 22:07 | Stavros | what does mark-sexp do? |
| 22:07 | pdk` | you'll start building up piles of ))))))))'s at the end of your fns fast :p |
| 22:08 | devn | if you're here: |(foo (bar (baz))) |
| 22:08 | Stavros | pdk`: ah :;p |
| 22:08 | devn | and you type C-c C-( |
| 22:08 | pdk` | you don't really end up with a lot of (((((( though since it's generally going to be a function that's the first item of a seq |
| 22:08 | devn | it selects the whole thing |
| 22:09 | Stavros | oh |
| 22:09 | devn | so you can be in some big composite (foo (foozle (bar (bazzle |(bob alice (cindy 1)))))) |
| 22:09 | devn | and it will select (bob alice (cindy 1)) |
| 22:09 | devn | Stavros: http://www.emacswiki.org/emacs/PareditCheatsheet |
| 22:11 | devn | the ones i use the most are M-s, C-), M-j, M-S, and a couple others |
| 22:11 | Stavros | that's very useful |
| 22:13 | devn | M-s is a huge help, you're in some expression, you realize you dont want it wrapped anymore, M-s, surrounding parens vanish, delete a couple bits, make a new sexp with those bits by typing ( which gives you (|), type C-) to slurp up the args |
| 22:13 | devn | like (foo|) a b c d |
| 22:13 | devn | C-u 4 C-) |
| 22:13 | devn | C-u is like '10 j' in vim |
| 22:14 | devn | C-u 10 C-f goes forward 10 characters |
| 22:14 | Stavros | oh |
| 22:14 | devn | Stavros: http://www.emacswiki.org/emacs/PareditCheatsheet |
| 22:14 | devn | oops wrong link |
| 22:14 | devn | http://www.emacswiki.org/emacs/KeyboardMacros |
| 22:14 | devn | that one |
| 22:14 | Stavros | yep, i'm there |
| 22:14 | Stavros | ah |
| 22:15 | Stavros | that's quite overwhelming :p |
| 22:15 | devn | i generally use M-x and a healthy dose of autocompletion |
| 22:15 | Stavros | how do you autocomplete? |
| 22:15 | Stavros | oh |
| 22:15 | Stavros | you mean in M-x |
| 22:15 | devn | TAB like a sonofabitch :) |
| 22:15 | Stavros | yeah |
| 22:16 | Stavros | is there autocompletion in the buffer? |
| 22:16 | Stavros | for the code? |
| 22:16 | devn | yes and no |
| 22:16 | devn | IIRC the starter kit comes with a basic form of completion that completes symbols that exist in all of the current and open buffers |
| 22:16 | devn | M-/ is "hippie-expand" |
| 22:16 | devn | it is /awesome/ |
| 22:17 | devn | but, there are lots of completion packages for emacs |
| 22:17 | Stavros | oh that works, thanks! |
| 22:17 | devn | also, you may already have completion |
| 22:17 | Stavros | i do |
| 22:17 | devn | type M-[TAB] |
| 22:17 | devn | when you have something like "red|" |
| 22:18 | devn | in your clojure-mode buffer |
| 22:18 | Stavros | alt-tab just switches windows :p |
| 22:18 | devn | try your windows key |
| 22:19 | devn | or command key if its a mac |
| 22:19 | devn | windows + tab |
| 22:19 | Stavros | hmm nope |
| 22:19 | Stavros | M-/ works fine, though |
| 22:19 | devn | my guess is you need to wrangle your keyboard layout a bit with xmodmap |
| 22:19 | devn | but that's a pain and dont do it until you realize you want it |
| 22:20 | devn | seriously consider remapping CAPS to control |
| 22:20 | Stavros | i think it'll be fine, especially with M-/ |
| 22:20 | Stavros | i will, later on : |
| 22:20 | devn | if you can get this far in emacs on your first try |
| 22:20 | Stavros | :P |
| 22:20 | devn | you can do a control key in the CAPS position |
| 22:20 | devn | using CAPS is for losers anyways! this is established fact! |
| 22:20 | Stavros | i tried, but i have a few reflexes mapped to that so it's harder |
| 22:20 | Stavros | i always do ctrl+s while typing :p |
| 22:21 | devn | :) |
| 22:21 | Stavros | damn, it's 5 am |
| 22:21 | Stavros | i better go to sleep and continue tomorrow |
| 22:21 | Stavros | thanks a lot for your help! |
| 22:21 | devn | you're going to find yourself after a few months of doing C-x r j i in rapid speed |
| 22:21 | Stavros | i've always wanted to learn emacs |
| 22:21 | devn | Stavros: glad i could help you out -- i think im going to print this damned conversation and fix my typos and blog it |
| 22:22 | Stavros | you should, it was very helpful as a primer |
| 22:22 | Stavros | plus i know i'll need to go back to it for things |
| 22:22 | devn | cheers, and enjoy the concurrency |
| 22:22 | devn | :) |
| 22:22 | Stavros | thanks :) |
| 22:22 | Stavros | bye! |
| 22:23 | TimMc | devn: I got a .emacs from a friend who writes Clojure for Akamai, I think I'll just start with that. |
| 22:24 | TimMc | Now that I know open, save, undo, cancel, quit, and switchbuffer... I think I'm good. |
| 22:24 | TimMc | The REPL can wait until I'm more familiar with emacs. |
| 22:27 | devn | TimMc: between #emacs and #clojure you should be all good |
| 22:27 | TimMc | heh |
| 22:27 | devn | :) |
| 22:28 | TimMc | The trick is remapping my fingers. |
| 22:28 | TimMc | I am *very* used to CUA. |
| 22:28 | devn | the trick is aliasing all of your editors to emacs ;) |
| 22:28 | TimMc | eep |
| 22:28 | devn | dont let yourself give up -- it takes a little time, but i made the switch from vim and would never go back |
| 22:29 | TimMc | I *really* need to print a cheatsheet out. |
| 22:29 | TimMc | A PDF isn't enough. |
| 22:29 | devn | write your own -- that's my suggestion -- lots of hotkeys are useless for me |
| 22:30 | TimMc | hmm |
| 22:30 | devn | i just go through a mode's documentation and write them down - take note of functions which arent mapped, and have built my own sheet |
| 22:30 | devn | i take a pass through every couple of months and drop stuff ive internalized |
| 22:30 | devn | rinse and repeat |
| 22:31 | TimMc | How do I switch to last active buffer? |
| 22:31 | Derander | c-x b ret |
| 22:31 | devn | :) |
| 22:31 | Derander | probably |
| 22:32 | devn | there's also (switch-to-previous-buffer) |
| 22:33 | TimMc | Derander: Ah, that works. |
| 22:33 | TimMc | I hadn't noticed that they were in most-recently-used order. |
| 22:34 | dnolen | wow writing complex macros in Scheme r5rs is crazy. |
| 22:35 | TimMc | dnolen: I love syntax-rules. |
| 22:35 | TimMc | (For when it is sufficient.) |
| 22:36 | devn | TimMc: http://www.emacswiki.org/emacs/SwitchingBuffers |
| 22:36 | devn | dnolen: hola, defn => devn |
| 22:37 | dnolen | TimMc: yes I like syntax-rules for the commoner tasks. Reading over this paper on Macros written in CPS to get more complex code transformations is a mind-bender. Thank god for Racket's Macro Stepper. |
| 22:37 | dnolen | dev: hullo! |
| 22:37 | dnolen | oops devn |
| 22:38 | devn | dnolen: how goes, buddy |
| 22:38 | TimMc | OK, g'night (UGT) folks. I'm gonna try to sleep on these emacs keybindings. |
| 22:38 | dnolen | not bad, not bad. |
| 22:38 | devn | dnolen: do you have any particularly awesome setup for emacs + scheme? |
| 22:38 | devn | something on the order of swank-clojure etc. |
| 22:39 | dnolen | devn: Geiser rocks. |
| 22:40 | dnolen | http://www.nongnu.org/geiser/ |
| 22:41 | dnolen | I actually use it for writing Racket source, but I fire up the IDE mainly for the Macro Stepper |
| 22:43 | joshua__ | I'm getting: Exception in thread "main" java.lang.Exception: Release versions may not depend upon snapshots. |
| 22:43 | joshua__ | Set the LEIN_SNAPSHOTS_IN_RELEASE environment variable to override this. (NO_SOURCE_FILE:0) |
| 22:44 | joshua__ | When I try try to use lein install on a dev server, but this doesn't happen on the local server.. |
| 22:44 | joshua__ | Anyone have any clue whats going on? |
| 22:47 | DespiteItAll | I think if your deps include SNAPSHOTs it wants your version to be a -SNAPSHOT too |
| 22:47 | DespiteItAll | as to why it works on your local, i'm not sure |
| 22:47 | joshua__ | I managed to do the equivalent of sudo to it by setting the variable and running the command on the same line. |
| 22:48 | joshua__ | and it worked |
| 22:48 | joshua__ | Thanks DespiteItAll, nice to know the 'why' |
| 22:49 | DespiteItAll | It seems to me, though, that too many libs are released only as snapshots for that to be a good rule |
| 23:04 | DespiteItAll | I swear, coming up with ideas is the hardest part of programming. |
| 23:05 | DespiteItAll | I want to mess with ring, but I have no idea what to do with it. |
| 23:06 | robink | DespiteItAll: Use it to port a FastCGI application written in C. |
| 23:07 | joshua__ | DespiteItAll: You say that, but than you have to debug your bad ideas ;) |
| 23:08 | DespiteItAll | oh yeah, debugging stuff you didn't really want to write but wrote anyway because you couldn't think of anything better is the hardest part :) |
| 23:11 | DespiteItAll | Hmm, I should also be getting some experience setting up and managing a cloud environment. I could tie those two things together. |
| 23:55 | rata_ | how do you use c.c.probabilities.monte-carlo? |