clojure Emacs CIDER Function Evaluation


Example

CIDER function cider-eval-last-sexp can be used to execute the the code while editing the code inside the buffer. This function is by default binded to C-x C-e or C-x C-e.

CIDER manual says C-x C-e or C-c C-e will:

Evaluate the form preceding point and display the result in the echo area and/or in an buffer overlay.

For example:

(defn say-hello
  [username]
  (format "Hello, my name is %s" username))

(defn introducing-bob
  []
  (say-hello "Bob")) => "Hello, my name is Bob"

Performing C-x C-e or C-c C-e while your cursor is just ahead of the ending paren of say-hello function call will output the string Hello, my name is Bob.