We'll learn by fighting this Yeti Monster.Next
Your attacks are here.
Next to each attack is a predicate, like
In order to perform an attack, we must satisfy a predicate.Back Next
A predicate asks a question about the data.
You can see the data here.
Currently, the data is a red triangle pointing upBack Next
These 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 Next
We can change the data by creating a function.
Below is the function definition. Do you see that purple box?Back Next
This box is our function body.
This is where the magic really happens!Back Next
You can move the expressions from down here up to the function body.Back Next
Try 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.Next
First 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!
Table: data Hand:
FunctionDrag tiles here: