conjure

:neovim:+:clj: https://github.com/Olical/conjure - If you're enjoying Conjure and want to say thanks: https://github.com/users/Olical/sponsorship :smile: (alt https://conjure.fun/discord)
2020-08-20T00:23:11.063300Z

if i’m on a defn , \ee just redefines the function - i’d like to actually call the function from my editor in the repl

2020-08-20T00:25:28.063800Z

(or sends the function to the repl? i’m not sure the details, i’m just learning this editor/repl life)

dave 2020-08-20T00:32:20.063900Z

a common convention is to add a comment form to the bottom of the file (or maybe even write below the function) and write whatever code you want in there. clojure programmers are generally accepting of keeping scratch code in the same file as the implementation code so for example, you might write something like this:

(defn multiply-by-3
  [x]
  (* x 3))

(comment
  (multiply-by-3 7)
  (multiply-by-3 Math/PI)
  (multiply-by-3 "lol not a number")
  (multiply-by-3 nil))

dave 2020-08-20T00:33:11.065200Z

the clojure reader skips over (i.e. doesn't evaluate) everything in the comment form, so you can put pretty much anything in there meanwhile, you can place your cursor inside any of those (multiply-by-3 ...) forms and press \ee and it will evaluate the form and show you the result

2020-08-20T00:33:18.065500Z

huh…i guess if my defn has arguments, just having cursor over it doesn’t really work

2020-08-20T00:33:25.065700Z

that’s interesting

2020-08-20T00:33:49.066Z

thanks for that, appreciate it!

dave 2020-08-20T00:33:57.066200Z

sure thing!

2020-08-20T11:46:45.001Z

another thing you can do is drop vim marks on each of the forms you have inside the comment and use \em<mark>