Lesson 11
Code is data in Underload
^ pops a text and runs it as a program. So (:*) is a function; run on (x), it doubles it.
The lesson
a wraps the top text in parentheses, turning data back into source. In the example (x)(:*)^ runs :* on (x), leaving (xx).
Underload has its own page, and Run opens this example in the editor.
Example
Output
Exercise 1
Print eight x characters with only one x in your program.
Run tries your program on the input below. Check runs it on every test.
| Input | Expected output |
|---|---|
(empty) | xxxxxxxx |
Output
A hint
Doubling three times is eight.
One answer
Answer: Print eight x characters with only one x in your program.
Expected output
xxxxxxxx
| Input | Expected output |
|---|---|
(empty) | xxxxxxxx |
Output
Exercise 2
Print ((hi)).
Run tries your program on the input below. Check runs it on every test.
| Input | Expected output |
|---|---|
(empty) | ((hi)) |
Output
A hint
Each a adds one pair of parentheses.
One answer
Answer: Print ((hi)).
Expected output
((hi))
| Input | Expected output |
|---|---|
(empty) | ((hi)) |
Output