Fork me on GitHub
#spacemacs
<
2018-07-23
>
eggsyntax01:07:17

Oh, of course, makes sense. Didn’t know that though, that’s cool! Personally I just either write the whole form on one line, or for anything lengthy, I stick it in whatever other clj/s buffer I have open, & then send it over.

4
Chase17:07:02

say i find myself liking the other route. exploring and creating functions in the repl. when i have it how i like it what is the easiest route to get that function into my program? i'm not seeing a send-to-buffer command. Will I just have to yank and paste?

eggsyntax18:07:50

That's what I always do. Since fns & defs written in the repl often depend on other ones, and you may have gone through multiple iterations of them, I also have a little proof-of-concept lib that (given a var) spits out the most recent versions of your definition of that var, preceded by all dependencies. eg if you've done the following in the repl:

(def x 3)
;; a bunch of other stuff
(def x 5)
;; a bunch of other stuff
(defn f [y] (+ x y))
and you ask it for the construction of f, it'll spit out
((def x 5)
 (defn f [y] (+ x y)))
Makes that copy/paste more pleasant.

eggsyntax18:07:56

Unfortunately def and defn along with the default repl can't support that functionality, so you either have to use the custom repl that comes with the lib, or use the alternate forms of def and defn that come with it. https://github.com/eggsyntax/reconstructorepl

Chase18:07:25

very cool. i've bookmarked and will look into adding this to my workflow. right now i'm trying to keep it at spacemacs defaults for just a little bit to get more familiar. if i have lein, boot, and clj, which exactly is my default repl? I'm guessing lein. is that the repl i get when i use cider jack in in spacemacs? it doesn't tell me when i first initialize the repl though. it just says cider.

eggsyntax18:07:06

Oh, it won't work with any of those -- but you can enter the custom inner repl from any of them. & yeah, if it's a lein project, AFAIK the spacemacs repl you get is a lein repl. I'm reasonably confident that's true, because it picks up the stuff in my ~/.lein/profiles.clj.

Chase19:07:28

that makes sense. i just created that lein profiles file to add ultra. the github made it sound really helpful but i don't think i'm seeing what the screenshots say i should be seeing. but like i said, i need to stay a little focused so trying to learn the defaults more before tweaking too much.

eggsyntax19:07:48

Makes a lot of sense 🙂 . And reconstructorepl in particular has rough edges & is mainly just proof-of-concept -- definitely not one I'd add until you're really familiar w the overall toolchain/workflow. Honestly it just saves a bit of time & hassle, it's not in the least essential 🙂