Activity Sequence: Racket BSL

This is as an illustrative example for how Expression Tutor activities could be used in a course based on the Racket Beginning Student Language. The content on this page may not be understandable for someone without significant prior knowledge.

The Beginning Student Language (BSL) in Racket provides a few built-in operations such as or and and. If they did not exist, could we implement them using the built-in if?

Implement or using if

To compute the logical or of two values, you can use or in Racket BSL:

(or a b)

What if BSL did not have an or? You could still perform an equivalent computation, but using if:

(if a #true b)

Below is a tree representation of the above expression. You can see nodes.