1
0
mirror of https://github.com/PDP-10/its.git synced 2026-01-13 15:27:28 +00:00
PDP-10.its/doc/_info_/11logo.order
Alexey-Slyusar 177f50a3c3 11LOGO documentation.
A GLOSSARY OF 11LOGO BUILT-IN PROCEDURES (PRIMITIVES)
2018-09-12 06:59:35 +02:00

485 lines
14 KiB
Plaintext

A GLOSSARY OF 11LOGO BUILT-IN PROCEDURES (PRIMITIVES)
--------------------------------------------------------------
Adapted from A.I. Memo 315 (LOGO Memo 14) of Abelson and Adams.
ABSTRACT
--------
This is a brief description of the built-in procedures (primitives) in 11LOGO
version 1005 available on PDP-10/ITS. https://github.com/PDP-10/its.
This 11LOGO version is case-sensitive. All the built-in procedures should be
typed in UPPER CASE.
BACK
Takes one input. Commands the display turtle to move backward
the number of units designated by the input.
BUTFIRST
Takes one input. If the input is a list, outputs all but the first
word of the list. If the input is a word, outputs all but the first
character of the word.
BUTFIRST "JOHN outputs OHN
BUTFIRST [JOHN MARY PAUL] outputs [MARY PAUL]
BUTLAST
Takes one input, a word or list. If a word, outputs all but the
last letter of the word. If a list, outputs all but the last word
of the list.
COUNT
Takes one input, a word of a list. If the input is a list, outputs
the number of words in the list. If it is a word, outputs the number
of characters in the word.
COUNT "ELEPHANT outputs 8
COUNT [ L E PHANT ] outputs 3
CTF
This undoes the effect of STF.
DIFFERENCE
Takes two inputs, which must be numbers, and outputs their
difference (subtracts the second from the first).
DIFFERENCE 3 1 outputs 2
DISPLAY
Takes one input which must be a SNAP (i.e., something created
by the SNAP operation) and shows it on the screen at a location
determined by the current position of the turtle. The SNAP
always appears in the orientation in which it was originally
drawn.
DO
Takes one input, a list, and evaluates this list just as if it were
typed in at the console.
?DO [PRINT SUM 18 5]
23
EDIT
Takes one input, the name of a procedure, and puts the user
in editing mode. Allows the user to change the definition to
the specified procedure. When done editing, type END to get
out of editing mode.
ELSE
Can be used with IF and THEN to allow an alternative course of
action to take place if the conditional in an IF-THEN pair is
FALSE.
IF :X>5 THEN PRINT "GOOD ELSE PRINT "BAD
EMPTYP
Takes one argument. Outputs TRUE if the argument is the empty
word of the empty list. FALSE otherwise.
END
Takes no inputs Tells the computer that you are finished defining
or editing a procedure.
EQUAL
Takes two inputs and outputs TRUE if both arguments evaluate to be
the same thing. Otherwise outputs FALSE.
EQUAL "JOHN "JOHN outputs TRUE
EQUAL 2 1+1 outputs TRUE
EQUAL 1 3 outputs FALSE
ERASETRACE
UnTRACEs the procedure. The procedure name must be quoted.
ERASETRACE "PROCEDURE
FIRST
Takes one input, a word of list. It outputs the first character of
a word or the first word of a list.
PRINT FIRST "HELLO outputs H
FORWARD
Takes one input. Tells the display turtle to move ahead the distance
designated in the input.
FORWARD 10 moves the turtle ahead 10.
FPRINT
Like PRINT except that it doesn't print the top-level brackets around
a list.
?PRINT [HELLO THERE]
[HELLO THERE]
?FPRINT [HELLO THERE]
HELLO THERE
FPUT
Takes 2 arguments, the second of which must be a list (The first
may be either a word or a list). Outputs a new list whose FIRST
is the first arg to FPUT and whose BUTFIRST is the second arg to
FPUT.
FPUT "HERE [I AM] outputs HERE I AM See also LPUT.
GO
Takes one input, the number of a line in a procedure. It is used
in a procedure to transfer control to that line.
GREATER
Takes two numeric inputs and outputs TRUE if the first argument is
greater than the second: if this is not so it outputs FALSE.
GREATER 4 2 outputs TRUE
HEADING
Takes no inputs. It asks the computer to output the heading of the
display turtle, i.e., what direction it is pointing in (in degrees).
HERE
Outputs a list of 3 elements, the XCOR, YCOR and HEADING of the
display turtle.
HIDETURTLE
Takes no inputs. Tells the computer to get rid of the little
triangle which is the turtle on your display screen. The turtle
will still leave a track even though you cannot see him. If you
don't want to see the turtle track, type PENUP (see below).
HOME
Takes no inputs. Outputs list [0 0 0].
SETTURTLE HOME
IF
Takes one argument which must evaluate to TRUE of FALSE and causes
execution of the rest of the LOGO line to be conditional upon the
evaluation of the input. If the input evaluates to TRUE, the rest
of the line is executed, otherwise control passes directly to the
next line in the procedure, and the remaining part of the line is
ignored.
IF :N=7 THEN PRINT "HELLO
THEN is optional. See also ELSE.
KILLDISPLAY
Takes no inputs and turns off the display. That causes to exit from 11LOGO.
LAMPOFF
The floor turtle command.
LAMPON
The floor turtle command.
LAST
Takes one input, a word or list. It outputs the last word of a
list or the last character of a word.
LAST [DOG AND CAT] outputs CAT
LEFT
Takes one numeric input. Causes the display turtle to rotate to
to the left the number of degrees given as input.
There is a bug in 11LOGO version 1005. LEFT doesn't work correctly.
https://github.com/PDP-10/its/issues/1194
LESS
Takes two numeric input. It outputs TRUE if the first argument is
less than the second argument, FALSE otherwise.
LEVEL
Takes no inputs. Outputs a number which tells "how many procedures
deep" current execution is. For example,
?PRINT LEVEL
0
>TO WHAM
>10 PRINT LEVEL
>20 WHAM
>END
?WHAM
1
2
etc. (Note that this procedure will not stop by itself and should
be interrupted by pressing Ctrl + G).
LIST
Takes two inputs, each of which may be either a word or
a list. Outputs a two-elements LIST whose element are its
inputs.
LISTP
Takes one input. Outputs TRUE if the input is a list, FALSE
otherwise.
LPUT
Takes 2 arguments, the second of which must be a list. Outputs a
list whose LAST is the first arg to LPUT and whose BUTLAST is the
2nd arg to LPUT:
LPUT "HERE [I AM] outputs [I AM HERE]
MAKE
Takes two inputs. The first input is the NAME, the second is the
THING. MAKE assigns the NAME to the THING. There only two kinds of
THINGS that LOGO can process: WORDS and LISTS.
(Numbers are a special case of WORDS)
MOD
It looks like the intent is to compute the modulo function. But
the procedure doesn't work correctly in 11LOGO version 1005.
https://github.com/PDP-10/its/issues/1215
NEWSNAP
Takes no inputs. Causes the image currently on the screen not to
be part of subsequent snaps. Also sets the starting location of
subsequent snaps to the current position of the turtle rather than
(0,0). See also DISPLAY and SNAP.
NUMBERP
Takes 1 input. Outputs TRUE if the input is a number and FALSE
otherwise.
OF
Noise word. Used to separate inputs from commands or operations,
as in:
SUM OF 3 4
OUTPUT
Takes one input. Can only be used in a procedure: returns control
to the calling procedure and outputs the specified argument.
PENDOWN
Takes no input. It causes the turtle to draw a line when it moves.
PENUP
Takes no inputs. It causes the turtle to not draw a line when it
moves.
PRINT
Takes one input, which evaluates to either a word or a list.
Prints out the evaluated input on the console.
?PRINT SUM 4 4
8
?PRINT [SUM 4 4]
[SUM 4 4]
Please note that procedure PRINT in that version has unusual behavior
and prints the top-level brackets around a list.
PRODUCT
Takes two numeric inputs and outputs their product.
PRINT PRODUCT 2 3 prints 6.
QUOTIENT
Takes two numeric inputs and outputs their quotient. (The first
input is divided by the second).
PRINT QUOTIENT 4 2 prints 2.
REQUEST
No inputs. When encountered in the execution of a procedure,
causes LOGO to pause and wait for a line to be typed in. This
input is treated as a list and printed on the console.
RIGHT
Takes one numeric input. Commands the turtle to turn to the right
(clockwise) the number of degrees which you give as an input.
RIGHT 30 tells the turtle to turn 30 degrees to the right.
RUG
probably jumps to the PDP-11 debugger. We have it (RUG; AR >),
but how to get both that and 11LOGO running we don't know yet.
SENTENCE
Takes two inputs. If both are lists it puts the elements of the
lists together to make a single list and outputs that list. If
either of its inputs is not a list it first changes the input to
a one-element list and then proceeds as above,
SENTENCE [FOO] [FOO BAR] outputs [FOO FOO BAR]
SENTENCE [WHAT IS YOUR] "NAME? outputs [WHAT IS YOUR NAME?]
SETHEADING
Takes one numeric input. Specifies the direction (in degrees) in
which the display turtle points. Zero is straight up.
SETTURTLE
Takes one input which is a list of 3 numbers. This input assigns,
in order, the x-coordinate, the y-coordinate, and the heading of the
display turtle.
SETX
Takes one numeric input. Moves the turtle horizontally to the
specified coordinate.
SETXY
Takes two numeric inputs. Moves the display turtle to the position
designated.
SETY
Takes one numerical input. It moves the display turtle vertically
to the specified coordinate.
SHOW
Takes one input, the name of a procedure, and prints the text of
the procedure on the console. The name of a procedure should be
quoted.
SHOW "PROCEDURE
SHOWTURTLE
Takes no inputs. It tells the computer to put the display turtle
(a little triangle) on the the display screen.
SNAP
Takes no inputs. Outputs a reference to "the stuff on the display
screen." For example,
MAKE "PIC SNAP causes :PIC to refer to whatever is
currently on the screen. Later you can cause another copy to appear by
saying:
DISPLAY :PIC or erase it by saying
WIPE :PIC
Each SNAP has associated with it a "starting location" and an "editing
location which determine where the picture appears when you say DISPLAY.
The starting location is normally the center of the screen (but see also
NEWSNAP) and the ending location is the position of the turtle when the
SNAP command is given.
STARTDISPLAY
Takes no input. Tells the computer to give you a display turtle.
STF
Sets Trace Flag to show cruft that is incomprehensible to all but the
elite. Cleared by CTF.
STOP
No inputs. Used in a procedure, it terminates execution of the procedure
and transfers control to the calling procedure.
SUM
Takes two numeric inputs and outputs their sum.
THEN
Noise word, which separates the conditional clause of an IF-expression
from the statement to be conditionally executed. (see IF.)
TO
Used to define procedures. Takes a variable number of inputs, the first
of which is the name of the procedure to be defined. The rest are names
of inputs to the procedure.
TOOT
The floor turtle command.
TRACE
Takes one input which is a procedure name. The procedure name
must be quoted.
TRACE "PROCEDURE
Causes the computer to print out a message each time the procedure
is executed, indicating the inputs to the procedure and the output,
if any. To get rid of it type ERASETRACE followed by the procedure name.
TYPE
Essentially the same as FPRINT, but does not carriage return.
VERSION
No inputs. Outputs a number which tells which version of LOGO is
currently running.
WIPE
Takes one input, a snap, and erases all appearances of the snap from
the display screen.
WIPECLEAN
Takes no inputs. It tells the computer to get rid of everything on the
screen, leaving the turtle where it is.
WORD
Takes two inputs, which must be words. WORD takes the two inputs
and puts them together to make one word.
WORDP
Takes one input and tests to see if the input is a word. If so,
outputs TRUE, otherwise FALSE.
XCOR
Takes no inputs. Outputs the present X-coordinate of the display turtle
YCOR
Takes no inputs. Outputs the present Y-coordinate of the turtle.
SPECIAL CHARACTERS
! Used for comments. Anything appearing after it on a line is ignored.
# Takes one input which must be a word and evaluates its input, e.g.
#(WORD "POOH 5) will execute the procedure named POOH5
( ) used for grouping.
[ ] used to indicate lists.
* infix PRODUCT
+ infix SUM
- infix DIFFERENCE
/ infix QUOTIENT
: (should be pronounced as "dots") it is an abbreviation for the
THING-quote.
(e.g. THING "VARIABLE_NAME is the same as :VARIABLE_NAME).
11LOGO 1005 version doesn't have THING built-in procedure
so this short form is the only way to outputs the value
assigned to that name: PRINT :VARIABLE_NAME
> infix GREATER
< infix LESS
= infix EQUAL