Small logo Primitive Functions

Functions 1 2 3 4

Here's a slightly more complicated example:

Construct a machine diagram for a function such that, when its input is the list (((taking) a) rest), the output is rest.

Obviously, the first thing we need to do is to get rid of the first data expression in the input list. We can do that by feeding it into a rest machine. The output from that rest machine will be the list (rest). But then it's clear that our desired output is the first — and only — data expression in this list. In other words, we need a hookup of a rest machine followed by a first machine. By obeying the following instructions one after the other, use the Machine Diagram Tool below to verify that this is indeed a solution to the problem.

 

  1. Click the Choose button.

  2. We want a two-machine hookup, so click on the "2 Machines" tab. This causes a new selection of machine diagram templates to be displayed, each involving two machines. In this new selection, click on the hookup that appears in third position in the first row.

  3. Since we know that the hookup we want consists of a rest machine followed by a first machine, click on the little downward-pointing arrow on each machine's label and select the appropriate name from the dropdown list.

  4. Check your selections by clicking the Go button. A suitably encouraging message should appear in the bottom right hand corner of the Machine Diagram Tool.

Previous pageNext page