Translator if expression and let

Why is it impossible to model the if-then-else construct as a function in the interpreter that supports the application-application? Is the let function in Scheme similar to if-then-else?

+3
source share
1 answer

The statement ifin the diagram is as follows:

(if <predicate> <consequent> <alternate>)

and is determined in such a way that it <consequent>is evaluated only when <predicate>it is not false, and therefore it <alternate>is evaluated only when it <predicate>is false. So you can see something like

(if #t (display "okay") (shut-down-the-nsa))

would never close the NSA.

But if it ifis a function, for example:

(<operator> <operand> …)

<operand> . if , <consequent>, <alternate> - if.

+4

All Articles