#clojure logs

2011-02-20

00:01brehautekoontz: may i suggest also alias emacs="/Applications/Emacs.app/Contents/MacOS/Emacs -nw"
00:01brehautso that your terminal emacs is the same as your gui emacs
00:02ekoontzhmm it's still showing 22.3.1
00:04ekoontzoh i still had one running in a terminal duh
00:04Patrick-DCHey guys, who uses SLIME with swank-clojure?
00:22Patrick-DCare you able to compile from emacs
00:22Patrick-DCusing C-c C-k?
00:22scottjyeah
00:22Patrick-DCfor some reason it's not working for me
00:22Patrick-DCI can eval
00:22Patrick-DCbut not compile
00:22scottjwhat version of slime?
00:22Patrick-DC1.2.0
00:22Patrick-DCi think
00:23scottjthat's probably a swank-clojure version num
00:24scottjanyway, try using latest swank-clojure and whatever slime version is recommended in the readme
00:24ekoontzgoing to set up swank-clojure right now
00:25Patrick-DCit's an unofficial slime from github
00:25Patrick-DCnablaone's
00:25tomojthe version of slime in elpa works with swank-clojure 1.3.0-SNAPSHOT
00:26scottjPatrick-DC: if it has a commit 605f930 from oct 15 2009 that's what I'm using as my head
00:31Patrick-DCI just figured out how to use emacs package manager
00:31Patrick-DCthis is heaven
00:32Patrick-DCbefore I was linking in the emacs lisp files for
00:32Patrick-DCswank-clojure and slime via .bashrc
00:32Patrick-DCit was so inelegant
00:32Patrick-DCthis is utterly beautiful
00:32scottjvia .bashrc not .emacs?
00:32Patrick-DCI was using both
00:33ekoontzPatrick-DC can you install swank-clojure through the emacs package manager?
00:33scottjinstall swank clojure through lein
00:33Patrick-DCHell yea
00:33tomojthere is a swank-clojure package in elpa, but you probably don't need it
00:33ekoontzscotty: yeah i did lein install swank-clojure 1.3.0-SNAPSHOT
00:33tomojslime and slime-repl there work with clojure, though
00:34tomojit also has a decent clojure-mode
00:34tomojbut the paredit is too old
00:34Patrick-DChaha there's a facebook package for emacs
00:34ekoontzthat's cool
00:34brehautdoes it say 'stop procreating and code!' ?
00:35Patrick-DCbut unfortunately no lein with the emacs package manager
00:35Patrick-DC(haha (brehaut))
00:35tomojlein install is just a wget and chmod and doesn't really have anything to do with emacs, does it?
00:35Patrick-DCyep
00:36Patrick-DCjust link it in with .bashrc
00:36scottjwhat do you mean by linking with .bashrc?
00:37Patrick-DCwell, since it isn't in my distro repository
00:37Patrick-DCI wgeted it
00:37ekoontzyeah so i followed https://github.com/technomancy/swank-clojure
00:37Patrick-DCand added:
00:37ekoontzbut emacs (M-x slime-connect) doesn't work
00:37Patrick-DCexport PATH=$PATH:~/opt/leiningen
00:38Patrick-DCto my .bashrc file in my home folder
00:38tomojekoontz: did you run `lein swank`?
00:38Patrick-DCya
00:38ekoontztomoj: or is it ~/.lein/bin/swank-clojure
00:38tomojI don't have that
00:39Patrick-DCthey're different setups, but they both work
00:39ekoontzthat's what https://github.com/technomancy/swank-clojure says to do
00:39scottjthat will be ok for basic testing but not for developing a project with dependencies
00:39tomojoh, didn't know it could do that
00:39Patrick-DChttps://github.com/jochu/swank-clojure
00:40scottjtomoj: fairly recent i think
00:40tomojdo you see "user=> Connection opened on local port 4005" etc?
00:40scottjekoontz: did M-x slime-connect say slime was there and had problems or is slime not loaded?
00:40ekoontzscottj: M-x sl<tab> doesn't give you slime-connect
00:40scottjekoontz: you installed it with elpa?
00:40ekoontzno match
00:40ekoontzelpa? what's that
00:41scottjhow did you install slime?
00:41Patrick-DCelpa is the emacs package manager
00:41ekoontzoh ok that's what i'm missing i think (slime)
00:41ekoontztrying installing slime through elpa
00:41scottjekoontz: read connecting with SLIME in readme of url you posted
00:41Patrick-DChttp://tromey.com/elpa/
00:41ekoontzthat's a lot guys, i'm just a noob here
00:41tomojlooks like the readme has a better package.el
00:41ekoontzs/that's/thanks
00:41sexpbot<ekoontz> thanks a lot guys, i'm just a noob here
00:42tomojI've just been using the one from tromey.com
00:43ekoontzawesome, i never knew i could evaluate lisp code in *scratch*
00:44ekoontzthat's probably been in emacs since forever
00:44scottjmaybe try C-h t while y're at it
00:44ekoontzhaha yeah
00:48ekoontzi did http://tromey.com/elpa/install.html
00:48ekoontznow i can see a bunch of packages
00:49ekoontzno slime tho
00:49scottjekoontz: read connecting with SLIME in readme of url you posted (gh swank clojure)
00:50ekoontzscottj: this url? http://tromey.com/elpa/install.html
00:50ekoontznothing about slime there
00:50scottjhttps://github.com/technomancy/swank-clojure
00:50ekoontzok thanks
00:53ekoontz"Install the "slime-repl" package using package.el" what does that mean
00:54ekoontzoh ok
00:54scottjso when you run M-x package-install it doesn't have slime-repl there?
00:54ekoontzno i see, need to put (add-to-list .. ) in my .emacs
00:56ekoontzargh that causes an error when i start emacs
00:56scottjI'm not sure if that's only meant for emacs 23
00:56ekoontzbut i am using emacs 23
00:57ekoontz"Symbol's value as variable is void: package-archives"
00:57ekoontzmaybe that's why technomancy gives a link to an updated package.el
00:57scottjwell 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:58ekoontztring that
00:58scottjyeah try that first
00:59ekoontzsaving that as ~/.emacs.d/elpa/package.el
01:01ekoontzyay no startup errors :)
01:06ekoontzpackage-install still can't find slime-repl tho
01:10ekoontzoh..i think the problem was my .emacs was preventing .emacs.d/ from being read
01:10ekoontzi moved it, restarted emacs and a huge bunch of .el files got compiled
01:11ekoontznow it's installing slime-reply whohoo
01:14scottjeclipse ain't lookin so bad now is it? :)
01:15ekoontzlol
01:15ekoontzi was thinking the same thing but intellij's clojure thingy
01:15scottjthe eclipse plugin seems to be the most actively developed/featureful of the big 3
01:15ekoontzok, crap, i installed slime-repl before slime
01:16ekoontzscottj: hmm ok
01:16ekoontzi prefer intellij for java development but will consider eclipse for clojure, thanks :)
01:18scottjoh if you already use intellij I'd probably just use that
01:18ekoontzok
01:18scottjwhatever you want, notepad maybe :)
01:18ekoontzyeah
01:25ekoontzi dunno i just always liked emacs for editing lisp code
01:26ekoontzand i want to learn clojure so it seems like a natural fit
01:26tomojhttp://mumble.net/~campbell/emacs/paredit-beta.el that's good
01:28ekoontzwill take a look
01:28ekoontzthanks tomoj
02:23ekoontzjust tried M-x butterfly in emacs 23..mystfied
02:24Deranderekoontz: xkcd reference
02:24ekoontzlol http://xkcd.com/378/
02:25ekoontzvery cute
02:25ekoontzthanks for the clue Derander :)
02:25Derandermmhmm
02:43ekoontzanyone using compojure?
02:44scottjlots of ppl
02:44scottjsexpbot: anyone?
02:44scottj,anyone?
02:44clojurebotjava.lang.Exception: Unable to resolve symbol: anyone? in this context
02:44scottj$anyone
02:44ekoontzlol
02:44ekoontzi love the bots
02:44scottj#emacs has two nice bot things I like ,salespitch and ,anyone
02:55rata_does anybody know if there is a multiset implementation in clojure? or if there is an easy way to implement one?
03:11ekoontzscottj, so how do you interact with these bots
03:11ekoontz,salespitch and ,anyone
03:11clojurebotjava.lang.Exception: Unable to resolve symbol: salespitch in this context
03:12ekoontzwow there's a clojurebot
03:13brehautclojurebot, salespitch?
03:13clojurebotI don't understand.
03:14scottjekoontz: /msg fsbot ,anyone
03:14brehautyou need to address clojurebot by name for most tasks; prefix comma only works for evaluation
03:14ekoontzok thanks guys
03:14brehautclojurebot #21
03:14brehautclearly i dont know clojurebot very well
03:15brehautclojurebot, #24
03:15clojurebot24. Perhaps if we wrote programs from childhood on, as adults we'd be able to read them.
03:15ekoontzlol @ "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:16ekoontzanyone know about foo
03:17brehautits a metasyntactic variable that has been used in computing for basicly ever
03:17ekoontzhahah sorry, i was trying to trigger the bot
03:18brehautclojurebot is intentionally pretty reserved
03:18brehautand sexpbot has most of his really noisy features disabled for @clojure
05:19kjeldahlI'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:22Licensergreetings everyone
05:28kjeldahlOk, maybe class? predicate works.
06:27edoloughlinConfused by http://bit.ly/gDcHpF - why does ({"fred" 1} "fred" 0) return 1 but ({} "fred" 0) return 0?
06:32tomojmaps as functions take two args: the key to look up and the default return value
06:32tomoj(also one arg with nil default return value)
06:33tomojif the key you pass is in the map, it will return the value for that key
06:33tomoj&({"fred" 23 "bob" 25} "bob" 0)
06:33sexpbot⟹ 25
06:33tomoj&({"fred" 23 "bob" 25} "bill" 0)
06:33sexpbot⟹ 0
06:34edoloughlintomoj: Thanks. Must read docs in future.
07:02_ulisesmorning
07:42shortlordis 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_ulisesshortlord: C-x C-e
07:51_ulises(if I remember correctly)
07:53shortlord_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_ulisessorry, I meant C-c C-c
07:55_ulisesthat 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:58shortlord_ulises: that seems to compile the form, but not evaluate it
07:58shortlordcould be my fault though, I'm totally new to emacs
07:58shortlordI guess I should read up a bit on clojure development with emacs...
07:59_uliseswell, it depends on what you're after
08:00shortlordah, C-M-x evaluates a whole form
08:02_ulisesa whole def form
08:02_ulises(not being pedantic, just saying what's on the assembla wiki)
08:02_ulises:)
08:02shortlordah, right
08:03_ulisesif 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:04shortlordyes, exactly
08:05_uliseshrm, well, I don't know then :(
08:06shortlord_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_ulisesah, very good then :)
10:03raekdoes anyone know how to stop emacs-starter-kit from rendering "fn" as "ƒ"?
10:06incandenzaraek: there is a little section in starter-kit-lisp.el that turns it on; I just commented it out
10:08incandenzahuh... is that better than C-x =?
10:08raekincandenza: found it too. I was hoping that there was some way of "tweaking" it off rather than commenting it out
10:08raekwhat does C-x = do?
10:09raekall I get is "Char: C-j (10, #o12, #xa) point=1646 of 1646 (100%) column=7" in the minibuffer
10:09incandenzahmm... what does C-c p do then?
10:09incandenzaI thought it did the same thing but with less info
10:10raekfor me C-c p evaluates the expression before the point, pretty-prints the result and shows it in a new buffer
10:11incandenzaoh, I see. he has both a custom global binding and slime binding on that key
10:11raekI found it in starter-kit-lisp.el, where the "fn" code lived
10:11incandenzayou should be able to turn it off with font-lock-remove-keywords as well
10:14raekincandenza: ah, thanks
10:28siefcawhat development environment / editor for Mac OS X supports Clojure?
10:31midssiefca: I use MacVim, some clojure vim plugins and leiningen (via cli)
10:33midsAquamacs 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:55siefcamids: thx
10:55siefcamids: trying aquamacs but it foults
10:55siefcafaults
10:55siefca2011-02-20 16:48:03.850 Aquamacs[48128:903] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'AHLookupAnchor failed'
10:56siefcai have to reset launchservices, google tells
11:10CozeyHi..why is vector not a seq?
11:11Cozeyok.. It's not an ISeq implementation, but still a List
11:11Cozeyno.. not a list either
11:22raekCozey: 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:23raek*but with
11:23raek*In most of the cases a collection
11:28edoloughlinThis 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:31dnolen,(apply concat [(:email_addr "x@x.x") (:name "X") (:id 3)])
11:31clojurebot()
11:32mids,(flatten ['(:email_addr "x@x.x") '(:name "X") '(:id 3)])
11:32clojurebot(:email_addr "x@x.x" :name "X" :id 3)
11:32dnolenoops
11:33edoloughlinThanks - I just realised that I need to quote the ( in the REPL. That explains why everything was coming back as variations of nil!
11:33dnolen,(apply concat '[(:email_addr "x@x.x") (:name "X") (:id 3)])
11:33clojurebot(:email_addr "x@x.x" :name "X" :id 3)
11:34Cozeydnolen: why does the quote matter with vector?
11:34dnolenCozey: keywords are functions
11:34Cozeyah of course
11:34dnolenCozey: nothing to do w/ vector specifically
11:34Cozey:-)
11:34Cozeyright - this is kind of a trap
11:37dnolenflatten is more general I think, so quite a bit slower than (apply concat ...) which in turn looks slower than (reduce concat ...)
11:38edoloughlindnolen: Thanks, must try it out. Can't use flatten as I want to preserve embedded vectors.
11:58thorwilhmm, why do i get a lazyseq out of this? (str (map #(str % "ix") ["aster" "obel" "idef"]))
12:01raekthorwil: the result of map is a lazy sequence. do you want to turn the data structures into a readable string? use pr-str
12:02raek,(pr-str (for [word ["aster" "obel" "idef"]] (str word "ix")))
12:02clojurebot"(\"asterix\" \"obelix\" \"idefix\")"
12:02raek,(print (pr-str (for [word ["aster" "obel" "idef"]] (str word "ix"))))
12:02clojurebot("asterix" "obelix" "idefix")
12:03raekhrm. (comp print pr-str) is more elegantly written as 'pr'
12:03thorwili'm using map not for this case, it's just a reduced example
12:04raekmap and for both behave the same way in this case
12:04raek,(str (map #(str % "ix") ["aster" "obel" "idef"]))
12:04clojurebot"clojure.lang.LazySeq@d8e802df"
12:04raek,(pr-str (map #(str % "ix") ["aster" "obel" "idef"]))
12:04clojurebot"(\"asterix\" \"obelix\" \"idefix\")"
12:05raek(I just personally prefer 'for' over 'map' and an anonymous function when mapping over one sequence)
12:05thorwiland 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:06dnolenthorwil: that because the repl knows how to print lazy-sequences. but no reason for str to know about them.
12:06thorwilah! thanks
12:16pdk`ok, riddle me this
12:16pdk`i have a multimethod (defmulti emit (fn [chain & [max-length]] (:order (meta chain))))
12:16pdk`and dispatch methods defined for 0 1 and :default
12:17pdk`and 3 testing objects with respective orders of 0 1 and 2 in their metas
12:17pdk`it correctly picks the 0 method for the object with order 0
12:17pdk`but for the object with order 1 it dispatches to :default
12:18raekpdk`: have you changed the 'defmulti' recently?
12:18pdk`it used to be a fn that returned keywords
12:18pauldoois (def foobar "hello world" 10) the correct syntax for adding a docstring to a def ?
12:18pdk`:order-0 if order was 0 and nil otherwise but it didn't have a case for returning :order-1 earlier
12:19pdk`gives an error pauldoo
12:19raekif you reevaluate a defmulti form, nothing will happen (like with defonce)
12:19pdk`hm
12:19pdk`maybe since i was reloading repeatedly from a repl with load-file
12:19pdk`should probably restart clojure
12:19raekso you need to (def emit nil) or (ns-unmap 'the-ns 'emit) to clear it out first
12:19pdk`aha
12:19pdk`i was wondering what the equivalent to unintern was
12:19raekand after evaling that, you have to evaluate all defmethods again
12:20pauldoopdk`: so is clojure.org wrong? http://clojure.org/special_forms#Special Forms--(def symbol doc-string? init?)
12:21pdk`,(def x "hi" 10)
12:21clojurebotDENIED
12:21raekI wonder that too. I get "Too many arguments to def" in clojure 1.3.
12:21raek(alpha 2)
12:21raekwhich is old...
12:21pdk`yeah getting that here
12:21pdk`on 1.2
12:21raekpdk`: you can always do (def ^{:doc "The docstring."} foobar 10)
12:22pdk`yeah looking at the docs there it leans toward that and doesnt indicate any other way
12:23pauldooraek: that other syntax works fine, but unfortunately Marginalia doesn't pick it up
12:28wtetzneris there a way to extend a byte array with a protocol?
12:51joshua__chouser, can I talk to you in IMs for a minute?
12:56anthony__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:56anthony__But you should be able to have a fn execute for multiple evts on multiple paths.
12:57anthony__(does this make any sense?)
13:03TimMcHuh. I find myself needing something like a dependency manager for my graphics app.
13:04TimMcThere 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:04TimMcI think a DSL is called for.
13:18TimMcanthony__: You could certainly allow path and evt to be seqs, and treat non-seqs as collections of one item.
13:20anthony__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:20anthony__So I need a way to do path-evt associations. Is a vector best?
13:20anthony__(add-fs-watch [path1 :create :delete path2 :modify] key fn) ?
13:20TimMcYou could ask relying code to do that for you.
13:21anthony__TimMc: I'm not sure what you mean.
13:21TimMcChange the order of params to (key fn evt path) and then clients can (map (partial add-fs-watch ...) ...), etc.
13:22TimMcOr (defn add-fs-watch [key fn & watchers] ...) where watchers is a series of evts and paths.
13:23TimMcThat might be more idiomatic.
13:23anthony__That makes sense.
13:23anthony__How would I iterate through the watchers?
13:23anthony__watchers = [path1 :create :delete path2 :modify]
13:23anthony__I suppose it wouldn't be hard to do that manually, nevermind.
13:24TimMcYou would call it like (add-fs-watch key fn path1 :create :delete path2 :modify)
13:24TimMcOr (apply add-fs-watch key fn watchers)
13:24anthony__Perfect.
13:25TimMcInternally, watchers would be a collection of some sort, could e a vector.
13:25dnolenanthony__: also agents have built in support for watching, if you don't want to build the machinery yourself.
13:26anthony__dnolen: Is it possible to watch a filesystem directory for changes using agents?
13:27dnolenanthony__: 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:28anthony__dnolen: Yeah, not possible without NIO/2. I'm running it using jdk1.7 (just a personal project running on my machine)
14:17cobol_experthi, 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:17cobol_expertmuch appreciated
14:38pdk`jesus christ
14:38pdk`i went to a search bar on a website
14:38pdk`and the first thing i typed was (doc
14:42bmhCan 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:47joshua__pdk`, yea, your suppose to use (find-doc
14:48pdk`oh you!
14:57pdk`ok this'll probably sound dumb but
14:57pdk`say i have a seq of seqs like [[2]]
14:57pdk`and given another seq to prepend [1] and another to append [3]
14:57pdk`i'd want to go from those to [[1] [2] [3]]
14:58TimMcpdk`: Does it matter that the outer seqs are storing other seqs?
14:58pdk`the seqs [1] and [3] in this case aren't going to be nested
14:59TimMc(concat [v1] v2 [v3])
14:59pdk`but i want to add them literally
14:59pdk`hm
14:59pdk`there's an idea
14:59TimMcJust off the top of my head. May not be the best way.
14:59pdk`,(let [main [[2 3]] to-prepend [1] to-append [3]] (concat [to-prepend] main [to-append]))
14:59clojurebot([1] [2 3] [3])
15:00pdk`i just tried `(~to-append ~@main ~to-prepend) and it seems to give me what i want
15:00pdk`i dunno if using ` is frowned upon outside of macros/returning a form literally
15:01TimMcgood question
15:01pdk`it gives correct results at any rate
15:01pdk`,(let [main [[2] [3]] to-prepend [1] to-append [3]] (concat [to-prepend] main [to-append]))
15:01clojurebot([1] [2] [3] [3])
15:01pdk`as does that apparently
15:02dnolenpdk`: 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:02dnolenalso note:
15:02dnolen,(macroexpand '`(~to-append ~@main ~to-prepend))
15:03clojurebot(clojure.core/seq (clojure.core/concat (clojure.core/list to-append) main (clojure.core/list to-prepend)))
15:03dnolenconverts to a concat.
15:03pdk`wowzers
15:04dnolen,'`(~to-append ~@main ~to-prepend)
15:04clojurebot(clojure.core/seq (clojure.core/concat (clojure.core/list to-append) main (clojure.core/list to-prepend)))
15:08pdk`symbol soup is the best
15:08pdk`this is why i want canned lisp alphabet soup
15:08pdk`a hearty bowl of ( ) ~ and `
15:09TimMcpdk`: I'm pretty sure ou can get that just by breaking up spaghetti into short pieces.
15:10joshua__$findfn [[2]] [1] [3] [[1] [2] [3]]
15:10sexpbot[]
15:10joshua__$findfn [1] [[2]] [3] [[1] [2] [3]]
15:10sexpbot[]
15:11TimMc$findfn :NP :P
15:11sexpbot[]
15:11TimMc:-(
15:11TimMcI guess that settles it.
15:13joshua__$findfn :P := :NP true
15:13sexpbot[clojure.core/not= clojure.core/distinct?]
15:14joshua__I like how not= and distinct are the two that pop up.. very fitting
15:15joshua__Whats the best idiomatic way to do decorators in Clojure?
15:16brehautjoshua__: in what sense?
15:17joshua__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:17brehautalso ##(sort (conj [[2]] [1] [3]))
15:17sexpbot⟹ ([1] [2] [3])
15:18lucianjoshua__: not really in clojure, afaik
15:18brehautjoshua__: just use a function
15:18brehautring's middleware is idomatic decoration
15:18brehaut(defn mydecorator [f] (fn [& rest] (apply f rest)))
15:18lucianbrehaut: in python it's also just a function, joshua__ was probably wondering if there was anything to make it nicer
15:19joshua__lucian, yep
15:19brehautyou can use ->
15:19brehaut(-> fn (decorate-b) (decorate-a))
15:20brehautif you are using moustache it automatically reverses middlewares for you
15:23brehautlucian: theres no special syntax because throwing functions around is every day in clojure; rather than special case
15:23thorwilhow can i turn a " " into \space (and "." to \.)?
15:23lucianbrehaut: yeah, python's decorators aren't very much needed either. it's @decorator instead of func = decorator(func)
15:24brehautlucian: sure, but thats not idiomatic python
15:24lucianbrehaut: not anymore, yes
15:25luciani think the idiom was used quite a bit even before syntactic decorators
15:25luciannowadays it's just weird
15:25brehautthorwil: ##(map first [" " "."])
15:25sexpbot⟹ (\space \.)
15:26lucianbtw, i was wondering if reader macros are planned
15:27joshua__'(char " ")
15:27dnolenlucian: nope.
15:27joshua__`(char " ")
15:27luciandnolen: any particular reason?
15:27brehautjoshua__: comma
15:27joshua__&(char " ")
15:27sexpbotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
15:27joshua__brehaut, ;p
15:27dnolenlucian: rhickey said so. more nuanced than that, but search the mailing list if you want more detail.
15:27joshua__,(char " ")
15:27clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
15:28luciandnolen: right. i was wondering if it's a technical no because of the java reader (and temporary) or an ideological one
15:28dnolenlucian: ideological.
15:28luciandnolen: ok, thanks
15:31thorwileek, Debugger entered--Lisp error
15:31thorwilgotta be careful with ticks and commas, it seems :)
15:31brehautthorwil: you dont need then normally. comma, ## and & have special meaning in IRC though
15:32pdk`they're just used to trigger the bots in the channel
15:33pdk`i don't think ## is part of clojure itself but , is whitespace and you'd use & in argument lists
15:34TimMc## is just a trigger for sexpbot
15:34thorwili got that much. i'm not sure what exactly catapulted me into the debugger
15:34TimMcah
15:35brehautwhat expression were you evaluating?
15:35thorwilvariations on `(char " ")
15:35brehautwell char doesnt work on a string
15:35brehautit raises an exception
15:35thorwili just closed emacs, found no other way out
15:36brehaut,(first " ")
15:36clojurebot\space
15:36brehautits a bit weird but it works
15:36brehaut(uses string's implementation of seq as a seq of chars)
15:37thorwilbtw, 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:38brehautthorwil: primary reason is that they are different in the JVM
15:38brehautand JVM strings are made of chars so native interop with strings as first class clojure requires it
15:38brehautsecondly, if you are actually working at the char level its a bunch faster
15:39thorwilok, thanks
15:40brehautpersonally, 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:49pdk`java has separate classes for Character and String
15:49pdk`so when you do java interop
15:49pdk`sometimes you have to bite your teeth and put up with java brain damage
16:57rata_hi all
17:01rata_why doesn't c.c.generic.math-functions/abs work for ratios?
17:01rata_isn't it supposed to be generic?
17:14rata_why lein says "*jure names are no longer allowed"?
17:16brehautbecause that pun got old fast
17:20rata_that means too many people were naming their projects as *jure?
17:20Adamantde jure?
17:20brehautcompojure, scriptjure, etc
17:20Adamanttrial by jure
17:21rata_but is there any problem that there are so many projects named *jure?
17:21brehautits pretty horrible
17:22rata_what's pretty horrible? the restriction or *jure names?
17:22brehaut*jure names
17:22KirinDaveWait...
17:22KirinDaveLeiningen has code to reject project creation with *jure?
17:22brehautyup
17:22brehauthas done since about 1.1 i think
17:23rata_KirinDave: yes
17:23KirinDaveWow.
17:23rata_I find pretty horrible the restriction
17:23rata_what the hell has leiningen to say about how ppl want to name their projects
17:23brehautim happy not having to wade through a sea of extremely similar names
17:23rata_is it a tool?
17:24brehautyou had come up with a *jure pun and just got burnt by lein ?
17:24rata_fuck leiningen... has cake the same stupid restriction?
17:24KirinDavetechnomancy: Ha. Hahaha.
17:24rata_I don't want a moralist tool
17:24KirinDavetechnomancy: That's fsckin' awesome
17:25rata_*opinionated tool
17:25rata_I want a tool that does the job
17:25Adamantrata_: it's not morality, it's a programmer with an option
17:25KirinDavetechnomancy: I mean, it's turrible. But it's awesome.
17:25Adamant*opinion
17:25Adamantyah
17:25KirinDaverata_: then clojure may not be your community.
17:26rata_brehaut: I got that name 3 months and didn't create the project using leiningen, I did it "by hand"
17:26rata_KirinDave: who are you to say I don't belong here?
17:26KirinDaverata_: I AM THE CLOJURE POLICE>
17:27rata_Adamant: it's not an option, it's a restriction
17:27Adamantrata_: opinion
17:27Adamantyes it is a restrictin
17:27KirinDaverata_: But seriously, idiosyncrasies and opinionated projects are the norm in the clojure community.
17:27morphlingrata_: fork leiningen if you have strong opinions about it..
17:27KirinDaverata_: You will see it _a lot._
17:27Adamantmorphling: or just have a patch that unfucks it.
17:28markskilbeckKirinDave: those are qualities of most programmers/communities.
17:29KirinDavemarkskilbeck: I think the Clojure community is by far the most idiosyncratic I interact with
17:29AdamantI am hardly an expert on the Clojure community, but I've seen worse and more annoying than that
17:29Adamantin fairly mainstream communities
17:29markskilbeckI haven't noticed.
17:29rata_KirinDave: I don't think opinions should get into restrictions, just maybe suggestions, at least in this case
17:30KirinDaveAdamant: We leave Python out of it. Python's sanctimony really throws off the mean. ;)
17:30AdamantKirinDave: ha ha, Python isn't even as bad as some I am thinking about.
17:31rata_well, let's try out cake
17:31KirinDaveAdamant: hah. Am I sensing a veiled haskell community reference?
17:31AdamantKirinDave: no
17:32__name__KirinDave: What's sanctimony about Python?
17:32brehautthe whitespace rule?
17:32AdamantHaskell is idiosyncratic and opinionated, but not especially fascist
17:32KirinDave__name__: OPen up the python shell, type "import this"
17:32brehautthough shall not do fp?
17:32KirinDaveBut have a barf bag ready
17:32__name__KirinDave: I know.
17:32KirinDaveBecause it's like I just told you, "This smells really bad. Smell it."
17:33KirinDave"our 15 year outdated ideas, lets all stroke them."
17:36Adamant__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:37Adamantor at least stating he's really gonna do so
17:37__name__Adamant: Python is not really FP
17:37Adamant__name__: it's not, but they do partially support it
17:37Adamantand 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:37AdamantI agree, they should fully support it
17:38Adamant:P
17:39Adamantbenevolent dictators are nice until they get behind the power curve.
17:48rata_thanks cake! you don't have that annoying restriction =)
17:59technomancyKirinDave: the thing is since that restriction has been in place so long people forget how annoying it was
17:59technomancybut then someone created a project called "couveraejure" or some such and I was like "you shall not paaaaaaass"
18:00KirinDaveHahah.
18:01KirinDavetechnomancy: Well I approve. :D
18:01shortlordwoah, functions like filter and map automatically dereference a ref? neat
18:01technomancyhttp://www.jtbourne.com/wp-content/uploads/2010/07/you-shall-not-pass.jpg
18:03mrBliss`shortlord: how do you mean? ##(let [r (ref [1 2 3])] (map inc r))
18:03sexpbotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Ref
18:06technomancy,(map (atom [:a :b :c]) [1 2 3])
18:06clojurebotjava.lang.ClassCastException: clojure.lang.Atom cannot be cast to clojure.lang.IFn
18:07technomancy,(map (ref [:a :b :c]) [0 1 2])
18:07clojurebot(:a :b :c)
18:07technomancycurious
18:10shortlordwell 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:10technomancyshortlord: vars are too
18:10technomancy,(#'+ 1 2 3)
18:10clojurebot6
18:11technomancyno idea why atoms aren't
18:13ossarehhola all
18:14rata_technomancy: is kapjure (for kappa + capture + clojure) a wrong name?
18:16technomancyrata_: there's already a library called capjure
18:18rata_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:20jjidorata_: how about "kapjura"?
18:20rata_jjido: it doesn't sound good I think
18:21rata_anyway, I don't think my project will be famous, so the similarity between capjure and kapjure is not a real problem probably
18:22technomancywell whatever you do, don't write a third book called "Programming Scala"
18:22rata_ok
18:23rata_technomancy: but really, that restriction is pretty annoying
18:23technomancyKirinDave: have you given any thought to a Clojure wrapper for Akka?
18:23technomancyI 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:26technomancymight be a strategic project for BankSimple's polyglotism to tackle, hint hint.
18:53KirinDavetechnomancy: Ha
18:53KirinDavetechnomancy: I have, though. Yes.
18:53KirinDavetechnomancy: 1.1 is the place to start that tho
18:55TimMcAny better way to modify each value of a map than (into {} (for [[k v] ...] [k ...]))?
18:56TimMcinto+for doesn't allow me to preserve the type of the associative object
18:57brehautTimMc: (let [m (hash-map :a 1 :b 2) f (juxt type identity)] (f (into (empty m) (map identity m))))
18:58KirinDavetechnomancy: 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:58KirinDavetechnomancy: Orrrrrrr... "insufficient symbol-macrolet" :)
18:59TimMcbrehaut: hum... I'll have to digest that.
18:59brehautTimMc: the part you care about is (empty m)
18:59TimMcyes
19:00brehautits not necessarily a good solution
19:01TimMcbrehaut: Thanks! That looks like it will work.
19:01TimMcI have to build up an entirely new object anyway, so this is fine.
19:01brehautTimMc: im not convinced it actually does ;) eg, array-maps turn into hash-maps at a certain size
19:02TimMcHow is that a problem?
19:02TimMcI'll be building it back up to the same size.
19:03brehautTimMc: its an it depends problem
19:04brehautif you care enough about preserving the original type, then having it change on you during the into process might not be ideal
19:04brehauti dont know your specifics though
19:04TimMcAh! No, I don't care if changes from an array-map to a hash-map.
19:05TimMcThe original might be a record or a struct.
19:05TimMcMaybe it doesn't matter -- I think I can rewrite my code to avoid having to care about preserving type.
19:07TimMcbrehaut: 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:07TimMcSo, I'm using (create) instead of (empty obj). Then only create has to know.
19:11TimMc$findfn true true true false true false
19:11sexpbot[clojure.core/distinct? clojure.core/= clojure.core/and]
19:11TimMchrmf
19:13TimMc,(every? true? [true true false true])
19:13clojurebotfalse
19:13TimMc,(every? true? [])
19:14clojurebottrue
19:14TimMcnice
20:21joshua__TimMc, if you don't mind me asking.. what are you working on?
20:29devn(defn me? [] :me), (defmulti handle-command (fn [command nick channel message irc & args] command))
20:29devn(defmethod handle-command "is that me?" [_ _ _ _ _] (me?))
20:30devn(handle-command "is that me?") throws an exception for an invalid number of aguments which is fair
20:30devnbut in order to get that call to handle-command to work I need to (handle-command "is that me?" nil nil nil nil)
20:30devnI must be doing something wrong there...
20:34Stavroshello
20:34devnmaybe 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:34devnStavros: hola
20:34Stavrosaren't purely functional languages not supposed to have something like the "do" syntax?
20:34Stavrosi'm just learning clojure, so i don't know, but it seems weird
20:34devnclojure isn't purely functional like haskell
20:34Stavrosah
20:35devnyou can do I/O if you want
20:35Stavrosis it a lisp?
20:35brehautStavros: it depends if you like to have a language that can do more than heat up your CPU
20:35Stavrosbrehaut: haha, i see
20:35brehautyeah :)
20:35devnstuart halloway has referred to clojure as a "consenting adults" language
20:35devnyou can do IO -- it can be dangerous, but that's on you
20:35Stavrosi'm just wondering whether i should avoid that and loops
20:35devnStavros: i would avoid do and loops at first
20:36Stavrosdevn: ah, thanks
20:36devncheck out project euler -- that will make you make good use of maps, reduce, filter, etc.
20:36Stavrosdevn: i am, i'm at the second problem
20:36Stavrosi'm trying to get all the fibonacci numbers by recursion up to 4 million
20:36devn:)
20:36Stavroswhich is tricky
20:36devnStavros: are you using your REPL?
20:36Stavrosi figured i can pass a list to each call and then append to it
20:36Stavrosdevn: no, it doesn't work very well
20:37Stavrosi can't use the up/down arrows for history, etc
20:37devnone 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:37devnStavros: cake (the clojure build tool) has a better repl than leiningen
20:37devnit has completion and such
20:37devnwhat editor are you using?
20:37Stavroshmm, do i just apt-get that?
20:37Stavrosvim
20:38devnStavros: https://github.com/ninjudd/cake
20:38Stavrosah, thanks
20:38DespiteItAllStavros -- do you have vimclojure?
20:38DespiteItAllActually, nevermind, if you're just getting started you need a real repl. Vimclojure can be painful.
20:38StavrosDespiteItAll: i'm not sure, i installed the plugins on the "getting started" page
20:38devnStavros: 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:39devnthe REPL should drive your programming IMO
20:39Stavrosdevn: i come from python, so i'm used to a repl
20:39devnStavros: can i make a really scary suggestion to a VIM user such as yourself?
20:39Stavrosawww
20:39devnconfigure emacs /just enough/ to use slime as your REPL
20:39Stavrosi knew you were going to say that :p
20:40devnit is not your mama's REPL
20:40DespiteItAllheheh
20:40Stavrosis that hard to do?
20:40Stavrosi have emacs installed, but i've never touched it
20:40devnno not really -- i suggest getting technomancy's emacs-starter-kit
20:40Stavroslet me do that now
20:40devnand then use M-x package-list-packages to install clojure-mode, slime, slime-repl
20:40joshua__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:41Stavrosjoshua__: 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:41devnStavros: SLIME is an incredible tool -- after you're set up I will show you some stuff that will blow your mind
20:41devnM-. is one that comes to mind :)
20:41Stavroslet me install it
20:41joshua__devn, Blow my mind too! I haven't had my mind blown yet!
20:41devnalso, paredit-mode, there is one for vim i believe, consider using it, structural editing is sweet for a lisp
20:42devnjoshua__: M-. is pretty awesome, have you used that?
20:42DespiteItAllWhat does it do?
20:42devntype this at your user> prompt: (defn|) | is your cursor
20:42joshua__OMG
20:43devnwith your cursor in place type M-.
20:43Stavrosokay, do i need to put it in .emacs.d/ or .emacs.d/some_subdir?
20:43joshua__Jumps to declaration.
20:43devnit's even better joshua__
20:43TimMcjoshua__: https://github.com/timmc/CS4300-HW3/ <-- I'm working on a graphics app for a class.
20:43devnlet's say you see a function you want to read the source of inside that first M-.
20:43devnhit M-. again and you can jump down another level
20:43devnhit M-, to go back up levels
20:43Stavroshmm, i think i installed it, how do i tell?
20:44joshua__Dude that is so awesome. Thank you.
20:44devnStavros: when you launch emacs with it for the first time it should do a whole bunch of compilation and such
20:44Stavroshmm, no then
20:44Stavrosaha, now it is installed
20:44Stavrosokay, i have a repl on the right
20:44devnStavros: you need a ~/.emacs that has a (load-file "/Users/username/.emacs.d/init.el")
20:44devnStavros: with clojure and all, that was fast!
20:45Stavrosno, wait, it produced an error :/
20:45devn:D
20:45devnhow are you starting the REPL
20:45devnbrb 1s
20:45Stavrosi just launched emacs, but it says it can't contact repo.technomancy.us
20:46Stavrosoh okay, retried and it's better now
20:46Stavrosit's compiling
20:46joshua__TimMc, "If you share either of these goals, you should probably steer clear of my code. :-P" hilarious!!
20:46Stavroshow can i close an emacs pane?
20:47joshua__c-x 0
20:47Stavrosthanks
20:47DespiteItAlldid technomancy do a screencast about paredit? where can I find that?
20:47Stavrosalthough it sort of looks like it's doing things
20:47TimMcjoshua__: 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:48devnDespiteItAll: peepcode
20:48devnDespiteItAll: it's a great beginner's screencast
20:49devnonce 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:49DespiteItAllah, thanks
20:49devnM-x apropos FTW
20:49Stavrosokay, starter kit is done doing things, i think
20:50devnStavros: my suggestion is to quit emacs, relaunch it, M-x package-list[TAB] to autocomplete to package-list-packages
20:50Stavrosdevn: done
20:50Stavrosi'm trying to install slime-repl
20:50Stavrosbut it's giving me a syntax error
20:51devnStavros: it might just be warnings from the compilation
20:51Stavroswell i'm clicking on it and pressing enter, neither will work
20:51devnoh, right, either type 'h' or '?'
20:51Stavroswrong number of arguments: called-interactively-p, 1
20:51Stavrosthat seems to have worked
20:52Stavrosi pressed "i"
20:52Stavrosno reaction
20:52devnyes, press i on all of the things you want to mark for installation
20:52devnthen press x to make it all run
20:52Stavrosah
20:52Stavroshow do i select things? :(
20:52devnhow do you mean?
20:53Stavrosi place my pointer over the package name, press i, then i press x and it says "no operations specified"
20:53Stavrosso i assume i need to select a package in a different way
20:53devnput your pointer at the beginning of each line
20:53Stavrosah
20:53Stavrosthat worked
20:53Stavrosyep
20:53Stavrosokay, it did things
20:54Stavrosnow i have to launch the repl, i guess?
20:54StavrosM-x slime-repl isn't there
20:54devn*nod*
20:54Stavrosman, i feel like my users
20:54devnhere's how i work with the repl Stavros
20:54devndo you use leiningen or cake yet?
20:54Stavrosi'm not sure, i just run "clojure"
20:54Stavrosit's not cake
20:55devnokay you should get lein or cake
20:55Stavroswill do
20:55devnStavros: https://github.com/technomancy/leiningen/raw/stable/bin/lein
20:56Stavrosi only need this file?
20:56devnput that on your PATH, chmod +x it, then run lein, it'll do it's thing, then do a `lein new myproject`
20:56devnthis created a project directory with a project.clj file
20:56TimMcStavros: It's a self-installer. It loads itself into ~/.lein
20:57devnadd this to the project.clj file after :dependencies [[foo "1.2.0"]]
20:57devn:dev-dependencies [[swank-clojure "1.3.0-SNAPSHOT"]]
20:57devnsave it, run `lein deps`
20:57devnyou'll see it pull down swank-clojure, now you have a new `lein` task in that directory: run `lein swank`
20:57devnin emacs type M-x slime-connect[RET]
20:57Stavrosokay, just a second :p
20:57devnhit return for all of the questions
20:58Stavrosdo i need to put lein in /usr/bin, or will just running it be ok?
20:58devnit should show you a user> prompt, and there you are
20:58devnStavros: put it on your PATH
20:58devnI have it in ~/bin/lein
20:58Stavrosah great
20:58Stavroslet me do the rest
20:58devnand have $HOME/bin on my PATH
20:59devni really should write a script or something to just set this up automatically for someone new to emacs and clojure
20:59clojurebotlisp is the red pill
20:59devnheh
21:00TimMcdevn: yes yes yes yes yes
21:00Stavrosokay, emacs says connected
21:00Stavrosdevn: i wouldn't recommend a script, maybe an instructions page
21:01Stavrosi already learnt a few things from this :p
21:01devnStavros: now type some stuff into that damn REPL and hack the Gibson :)
21:01Stavrosoh wow, it adds automatic closed parentheses
21:01devnyeah i think technomancy added paredit-mode by default to the starter kit
21:01Stavroscan i make it so the parentheses are a different color?
21:02devnor as a dependency of clojure-mode
21:02Stavrosor the scopes
21:02Stavrosby the way, this seems to be a buffer
21:02Stavrosnot a repl
21:02Stavroseven though i did connect
21:02devnhm? how do you mean?
21:02Stavroswell there's no >
21:02devnlike you "connected" in your terminal, or from emacs?
21:02Stavrosand pressing enter just adds a new line
21:02Stavrosi connected from emacs to swank
21:02Stavrosit said connected, etc
21:03Stavrosbut it didn't open a repl, it dropped me in my buffer again
21:03devnand you did a M-x slime-connect ?
21:03Stavrosyes, it was successful
21:03devntry C-x C-b, see anything that says *slime clojure* or something like that?
21:04Stavrosscratch, messages, completions, slime-events
21:04devndid you run lein deps, and lein swank from the project directory?
21:04Stavrosyes
21:04devnafter you added swank-clojure as a dependency
21:04Stavrosyes, swank is runninng
21:04devnand what does your terminal say now where you ran lein swank?
21:04Stavros Connection opened on local port 4005
21:04TimMcI'm going to scroll back and follow along myself.
21:04Stavros#<ServerSocket ServerSocket[addr=localhost/127.0.0.1,port=0,localport=4005]>
21:05devnStavros: could you quit emacs, and try a fresh M-x slime-connect?
21:05Stavrossure
21:05Stavrosnow swank crashed, let me restart both
21:06devnkk
21:06Stavrosconnected again
21:06Stavrosis a repl supposed to open up, or what?
21:07Stavrosall i get is the scratch buffer
21:08devnStavros: can you C-x C-b and open the messages buffer and the slime-events buffer
21:08devnand tell me if you see anything that is an obvious error
21:09devnStavros: what version of emacs
21:09Stavrosnope, slime-events seems to contain info about the connection, clojure etc
21:09Stavros23
21:09Stavrosand messages says "updating buffer list" a few times
21:10devnStavros: did you install slime-repl, slime, and clojure-mode via the package-list-packages?
21:10Stavrosoh, let me check about clojure-mode
21:10Stavroshow can i search in an emacs buffer, like / in vim?
21:10devnC-s
21:10Stavrosthanks
21:12Stavrosi installed clojure-mode now and restarted everything, but still no repl :/
21:12devnStavros: could you try a M-x slime and see if that fixes anything for you?
21:12Stavrosoh, should i also install swank-clojure?
21:13StavrosM-x slime says it can't find lisp
21:13devnit's weird that it says you're connected but then doesn't open a buffer
21:13devnive never had that happen
21:13DespiteItAllI thought there was a command for that. slime-scratch or something
21:13devnill screen share over skype with you if you want
21:13devnerr if you want to screen share with me
21:14DespiteItAllyeah, try M-x slime-scratch
21:14DespiteItAlloh wait, that's not what you want
21:15Apage43fff; Clojure is addictive. I'm supposed to be writing erlang, I am using Clojure with the erlang JInterface..
21:15devnStavros: http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Emacs
21:15devnerr i dont think that's slime though
21:15Stavroslet me read that
21:16devnit's not really worth your time, ive told you everything at the bottom basically
21:16Stavroshmm
21:16devnpackage-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:16Stavrosoh there we go
21:16Stavrosi installed another package
21:16Stavrosslime-clojure i think?
21:17devni think it's slime-repl you needed
21:17Stavrosnow it works
21:17devnwooo!
21:17Stavrosyay
21:17Stavrosi had slime-repl, it was something with clojure in it for sure
21:17devnStavros: do you know about clojuredocs?
21:17Stavroshm no
21:17devnhttp://clojuredocs.org/
21:17devnthey're your friend! :)
21:18Stavrosoh, very nice
21:18devnStavros: how about clojars? http://clojars.org
21:18devnsearch for 'html' for instance, and click on a random library in the list
21:18Stavrosi don't know enough to understand what clojars is yet, i think
21:18Stavrosoh
21:18Stavrosis it libraries i can include?
21:18devnStavros: basically they're just libraries like swank-clojure was
21:19Stavrosso i just add one to project.clj and do lein deps?
21:19devnyou add them to :dependencies or :dev-dependecies depending on wha tyou want and lein deps
21:19devnbingo
21:19Stavrosdon't i have to add the repo somehow?
21:19Stavroshow will clojure know where to get the packages from?
21:19devnnope, lein knows
21:19Stavrosoh good
21:19Stavrosthis looks very nice
21:19devnyou can specify external repos if you'd like as well
21:19Stavrosso what can i do with emacs?
21:19Stavrosaha
21:20devnStavros: well, like i was saying earlier
21:20devnat the user> prompt type: reverse| where | is your cursor
21:21Stavrosokay
21:21devntype M-., put your cursor on the word "reduce" in that defn, type M-.
21:21devntype M-, to go back
21:21Stavroshaha, nice
21:21Stavroshey, that's great!
21:21devnStavros: it's not just for clojure-core or contrib either
21:21devnthis works for the third party libs i showed you on clojars
21:21Stavrosah
21:22Stavrosi'll need to learn how to open buffers and copy stuff between them first, though
21:22devnStavros: are you on OSX or Linux?
21:22Stavrosso i can copy things from the repl to a code file
21:22Stavroslinux
21:22Stavrosubuntu
21:22devnand are you using emacs with GTK?
21:22devnso it's a window and not in a terminal buffer?
21:22Stavrosit's gtk, yes
21:23Stavrosi ran emacs in the terminal, but it popped up the gtk one
21:24devnokay 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:25Stavrosah, nice
21:25Stavrosi can see why people's pinkies hurt :p
21:25devnbuffers: C-x b, C-x C-b, selecting text: C-SPACE M-f M-f C-SPACE M-x
21:25TimMcStavros: Map CapsLock to Ctrl
21:25StavrosTimMc: i tried that, i couldn't get used to it easily
21:26devnStavros: in emacs selection is "marking"
21:26devnso C-SPACE begins a mark, C-SPACE closes a mark, then you take action upon the marked "region"
21:26devnM-x is copy
21:26devnC-y is paste
21:27devnC-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:27Stavrosokay this doesn't work in the repl
21:27devnStavros: why doesnt what work?
21:28Stavrosi did C-SPACE, marked things and C-SPACE again, but M-x only gave me the thing where i enter commands
21:28devnoh duh i mixed that up Stavros
21:28Stavrosand pressing C-SPACE after marking says "mark set" but doesn't do much else
21:28devnM-w is what i meant
21:28Stavrosoh
21:29Stavrosthat works!
21:29devn:D
21:29Stavroshow can i switch panes?
21:29Stavroslike, go to the left pane
21:29devnC-x o
21:29Stavrosah great
21:30Stavrosand how can i close the buffer in this pane?
21:30devnShift + left,right,up,down arrows i think will also work
21:30devnif technomancy added that to the starter kit
21:30Stavrosah they do
21:30Stavrosyep
21:30devnalso, C-c C-z might work for you to switch between the repl and a clojure-mode buffer
21:30Stavroshmm no
21:30Stavrosit takes me back to the repl window
21:31Stavroshow can i close a buffer, though?
21:31Stavroshmm, D
21:31Stavrosin the buffer list
21:31devnthere are many ways
21:31devnC-x k will "kill" a buffer
21:31devnif you just want it out of your way you can "bury" it
21:32devnC-tab
21:32devnor C-c y
21:32devnC-tab will let you cycle buffers quickly
21:32devnit's like alt+tab
21:32Stavrosaha, that looks like it cycles them
21:32Stavrosyes
21:32TimMcgrah
21:32Stavrosalthough C-tab is undefined for me
21:32StavrosC-c y works
21:32TimMcI installed the starter kit, and now my menubar is gone.
21:33devn:D
21:33StavrosTimMc: mine too
21:33TimMcdevn: :-(
21:33devnyeah i have to undo some of technomancy's hackerish changes
21:33devnthat's one of them
21:33Stavrosnot much of a *starter* kit :p
21:33TimMcScrew that, then.
21:33devnlet me find the line in my config for you...
21:33Stavroshow can i open the config in emacs?
21:33TimMcIf it's a starter kit, don't take away starter tools.
21:33Stavrosor any file
21:33TimMcStavros: C-x C-f
21:34devnStavros: i have a better way!
21:34devn:D
21:34devnC-x r j i
21:34devn(i think this works by default in the starter kit)
21:34devnC-x r[egister] j[ump] i[nit.el]
21:35devnyou can define more of those in starter-kit-registers.el
21:35Stavrosaha, that works
21:35Stavrosalthough C-x C-f is the general way, so thanks
21:35devnC-x f will list "recent" files
21:35devnwhich can be handy
21:36Stavrosi've readded the menu bar and things, how do i save the file?
21:36devnC-x 5 2 will make a new frame or "window"
21:36devnC-x C-s
21:36Stavrosah yes, new window
21:36devnStavros: 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:36Stavroshow do i quit emacs, by the way?
21:36devnC-x C-c
21:37Stavrosdevn: haha, thanks
21:37Stavrosokay i have a menu
21:37Stavrosso, C-x C-f project file
21:37devnStavros: if you dont want to reload emacs, if you're in init.el and want to try something out
21:37devnlet's say you did (+ 1 2)| and | is your cursor
21:37devnC-x C-e
21:37devnboom, it's now live
21:37Stavroshmm let me try that
21:38devnso if you modify some setting for emacs in your init.el or another .el file and C-x C-e the s-exp
21:38Stavroshmm
21:38devnit will affect the whole environment immediately
21:38Stavroshaha yes
21:38Stavrosthat works
21:38Stavrosmy menu is gone again, nice
21:39Stavrosalthough now i need to restart it
21:39devnit 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:39Stavrosbecause commenting the s-exp i can't C-x C-e it
21:39Stavrosyep
21:39devnim guessing it's a (setq ...) or something
21:39Stavrosyep
21:39devninstead of it being (setq foo t), make it (setq foo nil)
21:40devnand C-x C-e that
21:40Stavrosthat's okay, i just commented it out
21:40Stavroshow can i abort a command?
21:40devnC-g
21:40Stavroslike, say i press M-x by mistake
21:40Stavrosthen C-g?
21:40devn*nod*
21:40Stavrosgreat
21:40Stavrosthat's not so hard then
21:40Stavrosi can already edit my files in emacs
21:40devnC-h a is awesome
21:41devnC-h a, then type buffer, and hit RET
21:41Stavrosdoes that list all the commands?
21:41Stavrosare these commands also lisp functions?
21:41devnthat match "buffer", so now you can read documentation about them, find the one you're looking for, map it to a hotkey, etc.
21:42Stavrosah, so can i defn my own function in my init.el and assign it to a hotkey or M-x it?
21:42devnnot all of them Stavros, there are variables and functions,
21:42devnStavros: yes exactly
21:42Stavrosah, that's very nice
21:42Stavrosso this entire thing is programmable
21:42devnso if you select a region of text and you're like "how do i make this capitalized" or something
21:42devnyou can use apropos to search for a function that does that
21:42devnthen M-x myfunction on your selection
21:42Stavrosaha, capitalize-region
21:42Stavrosinteresting
21:43devnyou're a natural
21:43devni dont need to teach you anything else
21:43devnC-h t is the tutorial for what it's worth
21:43devnbut i find trial by fire to be a more interesting way to learn
21:43Stavrosi think C-h a will be enough, thanks :p
21:43Stavrosyep
21:43Stavrosi hope i don't forget the basics, though
21:44devnI was relying heavily on the arrow keys as a crutch
21:44Stavrosi like the arrow keys, even in vim
21:44devnso i did this: (global-unset-key [right])...etc.
21:44devnto force me to use C-n, p etc
21:44Stavrosi think i'll keep them, save my pinky :p
21:45Stavrosby the way, what's C-x?
21:45devnalso, if you dont remap caps to control
21:45devnyou're insane
21:45Stavroshaha, i might, later on
21:45devnIIRC C-x is a prefix for file operations mainly
21:45devnbut its not completely specific to them
21:45Stavrosah
21:45Stavrosyeah because C-x C-b is buffers
21:45devnive seen things like: C-x ; r u
21:45devnor something
21:45Stavroshmm now i have two repls
21:45devnwhere C-x ; is a prefix on its own
21:46devnlike C-x r j i
21:46Stavrosah
21:46devnC-x r j is the prefix
21:46Stavrosyep
21:46Stavroshmm, if i have a clojure file in there, can i run it?
21:47devnalso, 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:47Stavrosor do i have to call clojure externally?
21:47Stavrosyeah, i think i better stick to the native stuff
21:48devnStavros: how do you mean?
21:49devnStavros: a couple more slime tricks before i take off: in your REPL buffer type , and then TAB to see what is available
21:49Stavroshaha
21:49Stavrosi typed s and it quit
21:50devnweird
21:50Stavrosnah it's short for sayonara
21:50devnoh haha
21:50Stavrossayoonara, rather
21:50devnbut yeah, basically C-x C-e will let you evaluate an (s-exp)| in the REPL from a clojure-mode file
21:51devnC-c C-k will compile a whole file onto the repl
21:51Stavrosoh, let me try that
21:51devnC-c M-p will let you se the namespace of the repl (autocomplete works there)
21:52devnso 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:53Stavrosoh, i think i'll forget that by the time i learn about namespaces
21:53devnStavros: one more crazy one for you that blows my mind
21:53Stavrosor need to use them, anyway
21:53devnin your REPL type reduce|
21:53devnC-c C-w C-c
21:54devnit shows you were reduce is called in clojure.core -- if you have third party libs it'd show you those places as well
21:54Stavroshahaha
21:54devnthere's lots more but you'll discover them on your own
21:54Stavrosfantastic
21:54Stavrosand if i pick one it shows the source in the other pane
21:54devnSLIME > *
21:54devnbest. development. tool. ever.
21:55Stavrosi had a question but i forgot now :/
21:56devnStavros: i idle pretty much all the time in here, if you ever need some help please msg me
21:56TimMcStill trying to get slime-repl.
21:56Stavrosoh yes, it was this
21:56Stavrosif i have a command, can i find its hotkey?
21:56Stavroslike, deleteline
21:56devnyes
21:56devnC-h k
21:56devntype the hotkey
21:57TimMcdevn: I think that's the opposite.
21:57Stavrosno, i mean the other way
21:57Stavrosalthough that's also nice
21:57Stavrosoh C-h a <command> tells you what it's bound to
21:57Stavrosso undo is C-/
21:57devnC-h f will also work
21:57devnfor functions that are bound
21:58Stavrosaha
21:58devnC-h m is helpful
21:58devnit is the documentation for the mode
21:58devnC-h a,m,f,k
21:59devnand im probably missing a couple more, but those are the big ones
21:59pdk`yknow
21:59StavrosC-h is help?
21:59pdk`even though i know it's ugly as sin
21:59pdk`realizing how i'm writing stufff like (-> seq (first) (first) (first)) now
21:59devnStavros: *nod* it's a prefix command for the help commands
21:59pdk`kinda makes you want to reach for cdadr type fns
21:59Stavrosdevn: that's very useful
22:00Stavrosare there any more niceties to editing lisp?
22:00Stavroslike, making scopes different colors?
22:00Stavrosso i can see right away what's what?
22:00devnStavros: i dont use that, but yeah im sure there's something like that
22:00Stavroswhat do you use?
22:00Stavrosjust the default of no colors?
22:00devnand if there isnt there are two modes on the emacs wiki that could be put together
22:01devnStavros: in the REPL?
22:01Stavrosno, in a buffer
22:01devnfor a clojure file?
22:01Stavrosyes
22:01devnyou dont have syntax hilighting?
22:01Stavrosi do, the syntax is highlighted, but not scopes
22:01Stavrosalthough they are indented, so i guess it doesn't matter
22:02devn*nod* -- well, some folks like rainbow parens
22:02devnoh Stavros on that not, technomancy added C-c n to the starter kit
22:02devnthat handles reindentation
22:02Stavrosoh
22:02Stavroshaha it worked
22:02devnbut Stavros there are a couple of things i suggest w/r/t to that point
22:02devn1. paredit mode makes scopes less of an issue
22:03devnand 2. without even googling i know for sure someone has done something like you're suggesting
22:03devni just dont know what it's called off the top of my head
22:03devnim sure it's been done though, without a doubt
22:03Stavroswhat's paredit?
22:03devnstructural editing
22:03Stavroshmm
22:03devnin your clojure source file do you see "Paredit" on the mode line?
22:04Stavroshmm no, [? clojure 1] Fill
22:05devnStavros: M-x package-list-packages
22:05devndo you see "durendal" in that list?
22:06Stavrosyes
22:06Stavrosshould i install it?
22:06pdk`[21:53] <Stavros> like, making scopes different colors? <- you can have parens be rainbowed at any rate
22:06devnyeah grab it
22:06pdk`colored differently based on how far nested they are
22:06Stavrosdone
22:06devnrainbow parens can get kind of nasty
22:06Stavrospdk`: hmm
22:06pdk`eg (((hello)))
22:06devnIMO
22:06pdk`you can have the parens in that case
22:06pdk`go from the outermost level being red
22:06pdk`to fading from red->orange->yellow as it goes inward
22:06Stavrosaha
22:07pdk`and in the reverse on the )'s as it goes back outward
22:07Stavrosi don't know if it's an issue, really
22:07devnStavros: I have a hotkey I set
22:07Stavrosi've only started learning lisp today
22:07devn(global-set-key (kbd "C-c C-(") 'mark-sexp)
22:07Stavroswhat does mark-sexp do?
22:07pdk`you'll start building up piles of ))))))))'s at the end of your fns fast :p
22:08devnif you're here: |(foo (bar (baz)))
22:08Stavrospdk`: ah :;p
22:08devnand you type C-c C-(
22:08pdk`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:08devnit selects the whole thing
22:09Stavrosoh
22:09devnso you can be in some big composite (foo (foozle (bar (bazzle |(bob alice (cindy 1))))))
22:09devnand it will select (bob alice (cindy 1))
22:09devnStavros: http://www.emacswiki.org/emacs/PareditCheatsheet
22:11devnthe ones i use the most are M-s, C-), M-j, M-S, and a couple others
22:11Stavrosthat's very useful
22:13devnM-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:13devnlike (foo|) a b c d
22:13devnC-u 4 C-)
22:13devnC-u is like '10 j' in vim
22:14devnC-u 10 C-f goes forward 10 characters
22:14Stavrosoh
22:14devnStavros: http://www.emacswiki.org/emacs/PareditCheatsheet
22:14devnoops wrong link
22:14devnhttp://www.emacswiki.org/emacs/KeyboardMacros
22:14devnthat one
22:14Stavrosyep, i'm there
22:14Stavrosah
22:15Stavrosthat's quite overwhelming :p
22:15devni generally use M-x and a healthy dose of autocompletion
22:15Stavroshow do you autocomplete?
22:15Stavrosoh
22:15Stavrosyou mean in M-x
22:15devnTAB like a sonofabitch :)
22:15Stavrosyeah
22:16Stavrosis there autocompletion in the buffer?
22:16Stavrosfor the code?
22:16devnyes and no
22:16devnIIRC the starter kit comes with a basic form of completion that completes symbols that exist in all of the current and open buffers
22:16devnM-/ is "hippie-expand"
22:16devnit is /awesome/
22:17devnbut, there are lots of completion packages for emacs
22:17Stavrosoh that works, thanks!
22:17devnalso, you may already have completion
22:17Stavrosi do
22:17devntype M-[TAB]
22:17devnwhen you have something like "red|"
22:18devnin your clojure-mode buffer
22:18Stavrosalt-tab just switches windows :p
22:18devntry your windows key
22:19devnor command key if its a mac
22:19devnwindows + tab
22:19Stavroshmm nope
22:19StavrosM-/ works fine, though
22:19devnmy guess is you need to wrangle your keyboard layout a bit with xmodmap
22:19devnbut that's a pain and dont do it until you realize you want it
22:20devnseriously consider remapping CAPS to control
22:20Stavrosi think it'll be fine, especially with M-/
22:20Stavrosi will, later on :
22:20devnif you can get this far in emacs on your first try
22:20Stavros:P
22:20devnyou can do a control key in the CAPS position
22:20devnusing CAPS is for losers anyways! this is established fact!
22:20Stavrosi tried, but i have a few reflexes mapped to that so it's harder
22:20Stavrosi always do ctrl+s while typing :p
22:21devn:)
22:21Stavrosdamn, it's 5 am
22:21Stavrosi better go to sleep and continue tomorrow
22:21Stavrosthanks a lot for your help!
22:21devnyou're going to find yourself after a few months of doing C-x r j i in rapid speed
22:21Stavrosi've always wanted to learn emacs
22:21devnStavros: glad i could help you out -- i think im going to print this damned conversation and fix my typos and blog it
22:22Stavrosyou should, it was very helpful as a primer
22:22Stavrosplus i know i'll need to go back to it for things
22:22devncheers, and enjoy the concurrency
22:22devn:)
22:22Stavrosthanks :)
22:22Stavrosbye!
22:23TimMcdevn: I got a .emacs from a friend who writes Clojure for Akamai, I think I'll just start with that.
22:24TimMcNow that I know open, save, undo, cancel, quit, and switchbuffer... I think I'm good.
22:24TimMcThe REPL can wait until I'm more familiar with emacs.
22:27devnTimMc: between #emacs and #clojure you should be all good
22:27TimMcheh
22:27devn:)
22:28TimMcThe trick is remapping my fingers.
22:28TimMcI am *very* used to CUA.
22:28devnthe trick is aliasing all of your editors to emacs ;)
22:28TimMceep
22:28devndont let yourself give up -- it takes a little time, but i made the switch from vim and would never go back
22:29TimMcI *really* need to print a cheatsheet out.
22:29TimMcA PDF isn't enough.
22:29devnwrite your own -- that's my suggestion -- lots of hotkeys are useless for me
22:30TimMchmm
22:30devni 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:30devni take a pass through every couple of months and drop stuff ive internalized
22:30devnrinse and repeat
22:31TimMcHow do I switch to last active buffer?
22:31Deranderc-x b ret
22:31devn:)
22:31Deranderprobably
22:32devnthere's also (switch-to-previous-buffer)
22:33TimMcDerander: Ah, that works.
22:33TimMcI hadn't noticed that they were in most-recently-used order.
22:34dnolenwow writing complex macros in Scheme r5rs is crazy.
22:35TimMcdnolen: I love syntax-rules.
22:35TimMc(For when it is sufficient.)
22:36devnTimMc: http://www.emacswiki.org/emacs/SwitchingBuffers
22:36devndnolen: hola, defn => devn
22:37dnolenTimMc: 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:37dnolendev: hullo!
22:37dnolenoops devn
22:38devndnolen: how goes, buddy
22:38TimMcOK, g'night (UGT) folks. I'm gonna try to sleep on these emacs keybindings.
22:38dnolennot bad, not bad.
22:38devndnolen: do you have any particularly awesome setup for emacs + scheme?
22:38devnsomething on the order of swank-clojure etc.
22:39dnolendevn: Geiser rocks.
22:40dnolenhttp://www.nongnu.org/geiser/
22:41dnolenI actually use it for writing Racket source, but I fire up the IDE mainly for the Macro Stepper
22:43joshua__I'm getting: Exception in thread "main" java.lang.Exception: Release versions may not depend upon snapshots.
22:43joshua__Set the LEIN_SNAPSHOTS_IN_RELEASE environment variable to override this. (NO_SOURCE_FILE:0)
22:44joshua__When I try try to use lein install on a dev server, but this doesn't happen on the local server..
22:44joshua__Anyone have any clue whats going on?
22:47DespiteItAllI think if your deps include SNAPSHOTs it wants your version to be a -SNAPSHOT too
22:47DespiteItAllas to why it works on your local, i'm not sure
22:47joshua__I managed to do the equivalent of sudo to it by setting the variable and running the command on the same line.
22:48joshua__and it worked
22:48joshua__Thanks DespiteItAll, nice to know the 'why'
22:49DespiteItAllIt seems to me, though, that too many libs are released only as snapshots for that to be a good rule
23:04DespiteItAllI swear, coming up with ideas is the hardest part of programming.
23:05DespiteItAllI want to mess with ring, but I have no idea what to do with it.
23:06robinkDespiteItAll: Use it to port a FastCGI application written in C.
23:07joshua__DespiteItAll: You say that, but than you have to debug your bad ideas ;)
23:08DespiteItAlloh 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:11DespiteItAllHmm, I should also be getting some experience setting up and managing a cloud environment. I could tie those two things together.
23:55rata_how do you use c.c.probabilities.monte-carlo?