Fork me on GitHub
#calva
<
2018-09-27
>
dharrigan19:09:21

So, asking a question here as a suggested place to do so. I have this stupid little hello word program:

dharrigan19:09:28

(ns helloworld.core)

(defn foo
  "I don't do a whole lot."
  [x]
  (println x "Hello, World!"))

(defn foobar
  [x]
  (+ x 3))

(foo (foobar 20))

dharrigan19:09:08

On calva, if I "ctrl+alt+v,e" the "(foo (foobar 20))" I get => nil.

dharrigan19:09:29

On the repl, I get 23 Hello, World!

dharrigan19:09:51

It was kindly explained to me in #beginners that the repl is showing the side-effect

dharrigan19:09:01

Question is, why doesn't calva do the same?

pez19:09:32

@dharrigan you should see the side effect printed in the Output pane Calva says. The inline evaluation shows the result of the evaluation, which is nil in this case.

dharrigan20:09:20

Hi @pez thank you for your reply. I see the output now - that's great! Very helpful and kind of you 🙂

pez20:09:35

That’s cool. BTW, my favorite evaluation command is to evaluate the toplevel form using ctrl+alt+v space. So you can have the cursor anywhere in a form like defn and get the function defined. Then place the cursor in code testing the function and use the same command. It will ignore outermost comment forms so you can keep the testing code in the file if you like (I tend to do that both while developing functions and as documentation).

dharrigan20:09:50

Thank you for the tip! 🙂

metal 1