Can you return nothing from a function in Scheme

lispscheme

I'm writing a scheme interpreter, and in the case of an if statement such as:

(if (< 1 0) 'true)

Any interpreter I've tried just returns a new prompt. But when I coded this, I had an if for whether there was an alternative expression. What can I return in the if such that nothing gets printed?

(if (has-alternative if-expr)
  (eval (alternative if-expr))
  #f) ;; what do I return here?

Best Answer

According to the R6RS specification:

If <test> yields #f and no <alternate> is specified, then the result of the expression is unspecified.

So go wild, return anything you want! Although #f or '() are what I, personally, would expect.

Related Topic