# Teaching programming concepts with a new language: P-Lisp

I once co-wrote a Lisp interpreter that ran entirely in the browser, as part of an exercise in allowing folks to appreciate programmatic control in an easy, syntactically-forgiving environment.

The following is a tutorial for the original interpreter, parts of which have been lost to the ravages of obsolescence.

Enter

## Script for student

In this tutorial, you will come to learn the basics of programming constructs, covering creating and manipulating numbers, text, and computer graphics using a custom programming language, “P-Lisp”

By learning to write basic “functions” – groups of programming instructions –
you’ll learn how different abstractions of instructions can be used for high
and low-level instructions to computers.

Start by entering a simple number at the prompt, and observe that
the value is printed back to the console. This doesn’t do much to the computer,
it doesn’t store “5” in anywhere permanent; it simply shows you the interactivity at
your control today.

The other type of data commonly used is text, which you can enter
within quotation marks to let the computer understand it as raw text, which is data, and not as “code” or instructions for it to try doing anything with:

Next, try printing some text using the ‘print’ command.
Commands are issued within parentheses, like so:

Note that the word ‘print’ is separate from the words ‘Hello World’ in how the computer
expects to treat them. print and () are code, while “Hello World” is data.

Basic arithmetic can be applied in interesting ways on numbers as well as on text:

Each of the operations from the preious step returns a value,
that can be used to create compound expressions:

You can create intermediate values and save it to memory for reference at a future point.
Here’s how you can get that value:

Once saved to memory, it will last as long as your program does.
Try retrieving the value you saved using the ‘get’ command:

Likewise, you can find the coordinates of the dot on the map by
retrieving the values ‘x’ and ‘y’:

To move the line of motion for the dot, try setting its ‘x’ value to
an arbitrary coordinate:

Likewise, you can set the direction of movement by setting the variable ‘direction’.
{0,1,2,3} map to {“Go north”, “Go east”, “Go south”, “Go west”} for this program

Finally, we will try to define ‘functions’ or mini-programs to do this for us using the ‘defun’ method

Try doing the same for west and south.
Test your results by moving arrow keys after clicking on the map.