We'll learn by fighting this Yeti Monster.
NextYour attacks are here.
Next to each attack is a predicate, like (left? data)
.
In order to perform an attack, we must satisfy a predicate.
Back NextA predicate asks a question about the data.
You can see the data here.
Currently, the data is a red triangle pointing up
Back NextThese three predicates each ask a different question:
(green? the-image)
asks "Is the image colored green?"(star? the-image)
asks "Is the image in the form of a star?"(left? the-image)
asks "Is the image pointing left?"As you can see, none of the predicates answer yes. So we need to change the data.
Back NextWe can change the data by creating a function.
Below is the function definition. Do you see that purple box?
Back NextThis box is our function body.
This is where the magic really happens!
Back NextYou can move the expressions from down here up to the function body.
Back NextTry dragging that Blue Star Facing Right onto the Function Body.
Then click this button to watch the magic happen!
Try it!You landed a nice attack against that Yeti.
Now let's do something more complicated.
NextFirst drag the (greenify <image>)
expression to the function body...
... Then drag this data
expression inside of the (greenify <image>)
expression's slot.
Then click here to run your Nested Expression!
Try it!
Tiles
Table:
data
Hand:
|
FunctionDrag tiles here: |