Interactive Code Examples

Note: All examples can be edited and evaluated multiple times.

A recursive function 'my-map' takes a function and a list. It traverses the list and returns a new list. Each element in the new list is a result of applying the function to the corresponding element of the original list.

Evaluate
Output Window

The following script has been passed a 'document' object (named 'page') thus it can make changes to the entire web page. It also shows 'setTimeout' function named 'schedule' in Cofy.

Evaluate
Output Window

The following script has been passed functions 'move', 'line', 'stroke', and 'clear' that can change the canvas bellow. The script has no access to the other parts of the canvas or the page, so it cannot affect anything else unexpectedly.

Evaluate
Output Window