home *** CD-ROM | disk | FTP | other *** search
- \f3pendown\f1 \(em Command, no inputs. Abbreviation: \f3pd\f1
- .IN
- This command tells the turtle to lower its pen, so that
- later commands will draw lines when the turtle moves.
- .OU
- \f3penerase\f1 \(em Command, no inputs. Abbreviation: \f3pe\f1
- .IN
- This command tells the turtle to "lower its eraser", so that lines
- previously drawn will be erased when retraced by the turtle. It
- only works with the display turtle. The commands \f3penup\f1,
- \f3pendown\f1, \f3penerase\f1, and \f3penreverse\f1
- are mutually exclusive; whichever
- was most recently used is the one which affects the turtle. (Graphics
- terminals which cannot selectively erase lines, such as Tektronix
- displays, will treat \f3penerase\f1 as \f3pendown\f1.)
- .OU
- \f3penreverse\f1 \(em Command, no inputs. Abbreviation: \f3px\f1
- .IN
- This command tells the display turtle to lower its "reversing pen";
- thereafter, when the turtle moves, it turns on any points which were
- off, and turns off any points which were on. The commands \f3penup\f1,
- \f3pendown\f1, \f3penerase\f1, and \f3penreverse\f1 are mutually
- exclusive; whichever was most recently used is the one which affects the
- turtle. (Note: Graphics terminals which cannot penreverse will treat
- this command as \f3pendown\f1.)
- .OU
- \f3penmode\f1 \(em Operation, no inputs.
- .IN
- This operation applies to the floor or the display turtle. It outputs one
- of the words \f3penup\f1, \f3pendown\f1, \f3penerase\f1, or
- \f3penreverse\f1, depending on the current state of the turtle's pen.
- .OU
- \f3lampon\f1 \(em Command, no inputs. Abbreviation: \f3lon\f1
- .IN
- This command applies only to the floor turtle; it turns on the
- headlamps on the front of the turtle.
- .OU
- \f3lampoff\f1 \(em Command, no inputs. Abbreviation: \f3loff\f1
- .IN
- This command turns off the floor turtle's headlamps.
- .OU
- \f3hitoot\f1 \(em Command, one input. Abbreviation: \f3hit\f1
- .IN
- This command applies only to the floor turtle. It sounds the
- turtle's horn at the higher of its two pitches. The input is
- a number which indicates the number of quarter-seconds to toot
- the horn. Note: large numbers are likely to lead to violent
- behavior on the part of other computer users.
- .OU
- \f3lotoot\f1 \(em Command, one input. Abbreviation: \f3lot\f1
- .IN
- This command sounds the floor turtle's horn at the lower of
- its two pitches. The input is the duration of the toot.
- .OU
- \f3ftouch\f1 \(em Operation (predicate), no inputs. Abbreviation: \f3fto\f1
- .IN
- This operation can be used only with the floor turtle. It has as its
- output the word \f3true\f1 if the front of the turtle is touching an
- obstacle; otherwise it has the word \f3false\f1 as its output.
- .OU
- \f3btouch\f1 \(em Operation (predicate), no inputs. Abbreviation: \f3bto\f1
- .IN
- This operation can be used only with the floor turtle. It has as its
- output the word \f3true\f1 if the back of the turtle is touching an
- obstacle; otherwise it has the word \f3false\f1 as its output.
- .OU
- \f3ltouch\f1 \(em Operation (predicate), no inputs. Abbreviation: \f3lto\f1
- .IN
- This operation can be used only with the floor turtle. It has as its
- output the word \f3true\f1 if the left side of the turtle is touching an
- obstacle; otherwise it has the word \f3false\f1 as its output.
- .OU
- \f3rtouch\f1 \(em Operation (predicate), no inputs. Abbreviation: \f3rto\f1
- .IN
- This operation can be used only with the floor turtle. It has as its
- output the word \f3true\f1 if the right side of the turtle is touching an
- obstacle; otherwise it has the word \f3false\f1 as its output.
- .OU
- \f3clearscreen\f1 \(em Command, no inputs. Abbreviation: \f3cs\f1
- .IN
- This command applies only to the display turtle. It erases everything
- on the TV screen, and restores the turtle to its initial position and
- heading (center of the screen, facing toward the top edge).
- .OU
- \f3wipeclean\f1 \(em Command, no inputs. Abbreviation: \f3clean\f1
- .IN
- This command applies only to the display turtle. It erases everything
- on the TV screen, but does not change the turtle's position or heading.
- .OU
- \f3fullscreen\f1 \(em Command, no inputs. Abbreviation: \f3full\f1
- .IN
- This command applies only to the Atari display turtle. It eliminates the
- use of the bottom four lines of the screen to display the commands
- you type; instead, the entire screen is available to show the
- picture drawn by the turtle. However, you can no longer see
- what you're typing. The command may be used after the picture is
- already drawn; the part "hidden" by the text at the bottom of
- the screen will become visible. On other displays, \f3fullscreen\f1 and
- \f3splitscreen\f1 are equivalent; they make the entire screen available
- for graphics, and text appears on the bottom line (Gigis) or superimposed
- (ADMs), or somewhere.
- .OU
- \f3splitscreen\f1 \(em Command, no inputs. Abbreviation: \f3split\f1
- .IN
- This command applies only to the Atari display turtle. It restores the
- normal text display at the bottom of the screen, undoing the
- effect of the \f3full\f1 command. On other displays, \f3fullscreen\f1 and
- \f3splitscreen\f1 are equivalent; they make the entire screen available
- for graphics, with text superimposed in a display-dependent area.
- .OU
- \f3textscreen\f1 \(em Command, no inputs. Abbreviation: \f3text\f1
- .IN
- This command applies only to the display turtle. It temporarily
- removes the turtle display from the screen, making the entire
- screen available for text display. The commands \f3fullscreen\f1 and
- \f3splitscreen\f1 will restore the graphics display. Note: On the Atari
- display, the picture on the screen is remembered, so that when you return
- to \f3fullscreen\f1 or \f3splitscreen\f1 mode, the picture returns to the
- screen. On other displays, the picture is forgotten, and you return to
- an empty graphics screen.
- .OU
- \f3hideturtle\f1 \(em Command, no inputs. Abbreviation: \f3ht\f1
- .IN
- This command applies only to the display turtle. It erases the
- display of the turtle itself from the screen, so that only the
- lines drawn when the turtle moves are visible. The display is
- faster when the turtle is hidden (only slightly faster on the Atari,
- but much faster on other terminals). Also, once a graphics
- program is debugged, it may be prettier to watch without the
- turtle visible. (Note: On the Tektronix display, the turtle is
- never visible, because the terminal cannot erase selectively.)
- .OU
- \f3showturtle\f1 \(em Command, no inputs. Abbreviation: \f3st\f1
- .IN
- This command applies only to the display turtle. It restores
- the display of the turtle, after the \f3hideturtle\f1 command
- has been used. (Note: On the Tektronix display, the turtle is
- never visible.)
- .OU
- \f3shownp\f1 \(em Operation (predicate), no inputs.
- .IN
- This predicate applies only to the display turtle. It outputs the word
- \f3true\f1 if the turtle is visible on the TV screen, \f3false\f1 otherwise.
- .OU
- \f3pencolor\f1 \(em Command, one input. Abbreviation: \f3penc\f1
- .IN
- This command applies only to the display turtle. Its effect is different
- depending on how each type of terminal supports color. For the Atari, the
- input must be
- an integer between 0 and 6. An input of 0 enters black-and-white
- display mode (which is the turtle's initial mode), in which lines
- are as thin as possible but there is no control of color. Any other
- input selects color mode, in which lines are twice as thick, so the
- effective size of the screen is smaller, but colors can be used. There
- are, in color mode, three possible pen colors, numbered 1 to 3. There
- are 256 possible colors, but only three can be on the screen at a time;
- the \f3setcolor\f1 command is used to decide which pen draws in which
- actual color. If the input is 4, 5, or 6, the color is that of pen
- 1, 2, or 3, respectively, but lines are drawn in "fill mode": for each
- point inked, all points to its right are also inked until a point is
- reached which was already inked. On the Gigi, there is only one mode, and
- there is no loss of resolution in using color. The input must be between
- 0 and 7; 0 means black, 7 means white. The ADM, Tektronix, and Sun displays
- do not have multi-color drawing.
- .OU
- \f3setcolor\f1 \(em Command, two inputs. Abbreviation: \f3setc\f1
- .IN
- This command applies only to the Atari display turtle. The first input
- must be an integer between 0 and 3. If the input is nonzero, the
- second input specifies the color for the pen selected by the first
- input. If the first input is zero, the second input specifies the
- background color for the color graphics display. The second input
- is either an integer between 0 and 15, which is a color number, or
- a list of two integers, in which case the first is a color number
- and the second is an intensity number, an integer between 0 and 7.
- .OU
- \f3setxy\f1 \(em Command, two inputs.
- .IN
- The two inputs must be numbers. The turtle is moved to the point
- on the screen whose x (horizontal) coordinate is the first input,
- and whose y (vertical) coordinate is the second input. The center
- of the screen, where the turtle starts, has both coordinates zero.
- If the pen is down, this command draws a line. This command
- applies only to the display turtle.
- .OU
- \f3setheading\f1 \(em Command, one input. Abbreviation: \f3seth\f1
- .IN
- The input must be a number. The turtle's heading is set to the
- input, taken in degrees. Zero points straight up, as the turtle
- starts out; positive headings are clockwise from zero. This command
- applies only to the display turtle.
- .OU
- \f3towardsxy\f1 \(em Operation, two inputs.
- .IN
- This operation applies only to the display turtle. The two inputs must
- be numbers, which are the x and y coordinates of a point on the TV
- screen. The output is a number which is the heading to which the turtle
- must be set, in order to point towards that point from its current
- position. Note: this operation does not actually move or turn the
- turtle. You must use it as the input to \f3setheading\f1 if that is
- what you want.
- .OU
- \f3xcor\f1 \(em Operation, no inputs.
- .IN
- The output is the turtle's current x (horizontal) coordinate. The
- operation works only with the display turtle.
- .OU
- \f3ycor\f1 \(em Operation, no inputs.
- .IN
- The output is the turtle's current y (vertical) coordinate. This
- operation works only with the display turtle.
- .OU
- \f3heading\f1 \(em Operation, no inputs.
- .IN
- The output is the turtle's current heading in degrees. This operation
- works only with the display turtle.
- .OU
- \f3getpen\f1 \(em Operation, no inputs.
- .IN
- The output is the turtle's current pen color, or (on the Atari) zero
- if in black-and-white
- mode. This operation works only with the display turtle.
- .OU
- \f3setscrunch\f1 \(em Command, one input. Abbreviation: \f3setscrun\f1
- .IN
- This command is used only for display turtles. The
- input must be a number. The vertical component of turtle motion is
- multiplied by this number before each motion is taken. If squares come
- out too wide on your screen, you should increase the number; if too tall,
- you should decrease it. (You can also use \f3setscrunch\f1 to deform the
- turtle's motion on purpose, so for example a circle program will draw
- an ellipse instead.) The initial scrunch value depends on the terminal
- you are using: for the Atari and the Gigi, it is around 0.8 (your particular
- computer center will adjust this for the particular TV monitors you use),
- but for the ADM, Tektronix, and Sun, it is 1.0 because these terminals
- display the same size steps horizontally and vertically.
- .OU
- \f3scrunch\f1 \(em Operation, no inputs.
- .IN
- This operation is used only for display turtles. It outputs a number, which
- is the scrunch factor (or aspect ratio) by which vertical motion is
- multiplied before it is displayed. This number is changed using the
- \f3setscrunch\f1 command.
- .OU
- .ti +5
- .UB "Primitive procedures for arithmetic."
- Several procedures
- are available for arithmetic operations on numbers. In all
- cases, the inputs to these procedures must be numbers, except
- as otherwise indicated in the individual descriptions.
- .PP
- In general, procedures are used in Logo by typing first the name
- of the procedure, then its inputs. This is true of arithmetic
- procedures also, e.g.
- .EX
- sum 3 2
- .EC
- However, for some arithmetic operations, Logo also recognizes the
- more traditional \f2infix\f1 notation, with the operation between
- the two inputs:
- .EX
- 3 + 2
- .EC
- Be warned, though, that the use of infix forms makes it difficult
- for Logo to know how to group operations, unless parentheses are
- used. If you stick to the standard (in Logo) prefix notation,
- the grouping is always unambiguous. For example, the first two of
- these three instructions are equivalent, but the third is not:
- .EX
- if equalp count "hello 5 [print "Yes.]
- if (count "hello) = 5 [print "Yes.]
- if count "hello = 5 [print "Yes.]
- .EC
- The reason for the error message produced by the last of those three
- instructions is that Logo interprets it as
- .EX
- if count equalp "hello 5 [print "Yes.]
- .EC
- That is, the equality test is done first, on the word \f3hello\f1
- itself, rather than first taking the count of \f3hello\f1 as
- was intended.
- .sp 1
- \f3sum\f1 \(em Operation, two inputs. Infix: \f3+\f1
- .IN
- The output of this procedure is the sum of the two inputs.
- .OU
- \f3difference\f1 \(em Operation, two inputs. Abbreviation: \f3diff\f1 Infix: \f3-\f1
- .IN
- The output of this procedure is the difference of the two inputs.
- .OU
- \f3product\f1 \(em Operation, two inputs. Infix: \f3*\f1
- .IN
- The output of this procedure is the product of the two inputs.
- .OU
- \f3quotient\f1 \(em Operation, two inputs. Infix: \f3/\f1
- .IN
- The output of this procedure is the quotient of the two inputs.
- .OU
- \f3remainder\f1 \(em Operation, two inputs. Abbreviation: \f3mod\f1 Infix: \f3\\\f1
- .IN
- The inputs to this procedure must be integers. The output is also an
- integer, and is the remainder of dividing the first input by the
- second.
- .OU
- \f3maximum\f1 \(em Operation, two inputs. Abbreviation: \f3max\f1
- .IN
- The output of this procedure is equal to whichever of the two inputs
- is numerically greater.
- .OU
- \f3minimum\f1 \(em Operation, two inputs. Abbreviation: \f3min\f1
- .IN
- The output of this procedure is equal to whichever of the two inputs
- is numerically smaller.
- .OU
- \f3greaterp\f1 \(em Operation (predicate), two inputs. Infix: \f3>\f1
- .IN
- The output of this procedure is the word \f3true\f1 if the first input
- is numerically strictly greater than the second input. Otherwise the
- output is the word \f3false\f1.
- .OU
- \f3lessp\f1 \(em Operation (predicate), two inputs. Infix: \f3<\f1
- .IN
- The output of this procedure is the word \f3true\f1 if the first input
- is numerically strictly less than the second input. Otherwise the
- output is the word \f3false\f1.
- .OU
- \f3equalp\f1 \(em Operation (predicate), two inputs. Infix: \f3=\f1
- .IN
- The two inputs to this procedure may be any Logo objects. If they
- are numbers, then the output is the word \f3true\f1 if they are
- numerically equal, \f3false\f1 if they are numerically unequal. If
- either input is not a number, then the output is the same as for the
- procedure \f3is\f1: it is \f3true\f1 if the two inputs are identical,
- \f3false\f1 if not. For example, the numbers \f32\f1 and \f32.0\f1 are
- numerically equal, but not identical.
- .OU
- \f3numberp\f1 \(em Operation (predicate), one input.
- .IN
- The input may be any Logo object. The output is the word \f3true\f1 if
- the input is a number, \f3false\f1 if not.
- .OU
- \f3zerop\f1 \(em Operation (predicate), one input.
- .IN
- The input must be a number. The output is the word \f3true\f1 if the
- input is numerically equal to zero, \f3false\f1 otherwise.
- .OU
- \f3random\f1 \(em Operation, one input. Abbreviation: \f3rnd\f1
- .IN
- The input must be a positive integer. The output is a randomly
- selected integer between 0 and one less than the input.
- .OU
- \f3sqrt\f1 \(em Operation, one input.
- .IN
- The input must be a nonnegative number. The output is its square root.
- .OU
- \f3pow\f1 \(em Operation, two inputs.
- .IN
- The inputs must be numbers. If the first is negative, the second must
- be an integer. The output is the first number raised to the power of
- the second input.
- .OU
- \f3sin\f1 \(em Operation, one input.
- .IN
- The input must be numeric. The output is the sine of the input, taken
- in degrees, not radians.
- .OU
- \f3cos\f1 \(em Operation, one input.
- .IN
- The input must be numeric. The output is the cosine of the input, taken
- in degrees, not radians.
- .OU
- \f3arctan\f1 \(em Operation, one input. Abbreviation: \f3atan\f1
- .IN
- The input must be numeric. The output is the arctangent, in degrees, of
- the input.
- .OU
- .ti +5
- .UB "Primitive procedures for conditional execution."
- The predicates
- (like \f3wordp\f1) which we've mentioned above can be used to carry out
- some command only if a condition is met. The basic command for the
- purpose is \f3if\f1:
- .sp 1
- \f3if\f1 \(em Command or operation, two or three inputs.
- .IN
- The first input to the \f3if\f1 procedure must be either the word \f3true\f1 or
- the word \f3false\f1. Typically, it is the output from a predicate. The second
- and (optional) third inputs are lists containing instruction lines. The second
- input is executed if the first input is \f3true\f1. The third input, if any,
- is executed if the first input is \f3false\f1:
- .sp 1
- .nf
- \f3to greet :person
- if equalp :person [Ronald Reagan] [print [Hi, turkey!]] \\
- [print sentence "Hi, :person]
- end\f1
- .fi
- .sp 1
- In that example, the first input to \f3if\f1 is the output from the expression
- .br
- \f3equalp :person [Ronald Reagan]\f1.
- .sp 1
- The \f3if\f1 procedure can be used as an operation, producing a value. In this
- case, the third input is required:
- .sp 1
- .nf
- \f3print if equalp :person "Reagan ["Loser] ["Winner]\f1
- .fi
- .OU
- \f3test\f1 \(em Command, one input.
- .IN
- The input must be the word \f3true\f1 or the word \f3false\f1. The command
- remembers its input for use in a later \f3iftrue\f1 or \f3iffalse\f1
- command. This is an alternative to \f3if\f1 which is useful if several
- instructions are to be made conditional on the same condition. The
- remembered truth value is local to the current procedure, if any.
- .OU
- \f3iftrue\f1 \(em Command, one input. Abbreviation: \f3ift\f1
- .IN
- The input must be an instruction list. It is run if the most recent
- \f3test\f1 command saved a \f3true\f1 value.
- .OU
- \f3iffalse\f1 \(em Command, one input. Abbreviation: \f3iff\f1
- .IN
- The input must be an instruction list. It is run if the most recent
- \f3test\f1 command saved a \f3false\f1 value.
- .OU
- \f3both\f1 \(em Operation (predicate), two inputs. Abbreviation: \f3and\f1
- .IN
- The two inputs must both be either \f3true\f1 or \f3false\f1. The output
- is \f3true\f1 if both inputs are \f3true\f1; otherwise the output is
- \f3false\f1.
- .OU
- \f3either\f1 \(em Operation (predicate), two inputs. Abbreviation: \f3or\f1
- .IN
- The two inputs must be either \f3true\f1 or \f3false\f1. The output
- is \f3true\f1 if at least one of the inputs is \f3true\f1; otherwise
- the output is \f3false\f1.
- .OU
- \f3not\f1 \(em Operation (predicate), one input.
- .IN
- The input must be either \f3true\f1 or \f3false\f1. The output is
- \f3true\f1 if the input is \f3false\f1, and vice versa.
- .OU
- .ti +5
- .UB "Primitive procedures for file input and output."
- In the Unix
- operating system, there are two steps in reading or writing files: first,
- the file must be \f2opened\f1, thereby associating a "file descriptor"
- (an integer) with the file name; second, the file descriptor is used
- to specify the file for each read or write operation. Logo has
- primitive procedures for each of these steps.
- .sp 1
- \f3openread\f1 \(em Operation, one input. Abbreviation: \f3openr\f1
- .IN
- The input to this procedure is a word, which must be a Unix filename. It
- can contain slashes to indicate directory names. If the file can be
- opened for reading, the output from the procedure is a file descriptor,
- which should be stored in a variable for use in reading the file. If the
- file cannot be opened, an error results.
- .OU
- \f3fileread\f1 \(em Operation, one input. Abbreviation: \f3fird\f1
- .IN
- The input must be a file descriptor, previously output by \f3openread\f1. The
- procedure reads one line from the file. The output is the line, in the form
- of a list. (That is, the output is the file line as if enclosed in square
- brackets in a program.) If the end of the file has been reached, the output
- is the empty word. If the file line contains mismatched brackets, trouble
- may result.
- .OU
- \f3fileword\f1 \(em Operation, one input. Abbreviation: \f3fiwd\f1
- .IN
- The input must be a file descriptor, open for reading. The procedure
- reads one line from the file. The output is that line, in the form of
- a single word, including spaces and punctuation characters. If the end
- of the file has been reached, the output is the empty list.
- .OU
- \f3openwrite\f1 \(em Operation, one input. Abbreviation: \f3openw\f1
- .IN
- The input must be a Unix filename. The file is opened for writing
- (replacing any previous version), if allowed, and the output is a file
- descriptor, for use by file printing commands below. If the file
- cannot be opened, an error results.
- .OU
- .nf
- \f3fileprint\f1 \(em Command, two inputs. Abbreviation: \f3fip\f1
- \f3filetype\f1 \(em Command, two inputs. Abbreviation: \f3fity\f1
- \f3filefprint\f1 \(em Command, two inputs. Abbreviation: \f3fifp\f1
- \f3fileftype\f1 \(em Command, two inputs. Abbreviation: \f3fifty\f1
- .fi
- .IN
- The first input must be a file descriptor previously output by
- \f3openwrite\f1. The second input is any object. The second input
- is printed (typed, fprinted, ftyped) into the file.
- .OU
- \f3close\f1 \(em Command, one input.
- .IN
- The input must be a file descriptor. The file is closed. This must
- be done when you've finished reading or writing the file.
- .sp 1
- Sample program:
- .sp 1
- .nf
- \f3make "fd openwrite "outfile
- fileprint :fd "Hello.
- close :fd\f1
- .fi
- .sp 1
- This will create a file named \f3outfile\f1 containing the word \f3Hello.\f1
- .OU
- .ti +5
- .UB "Primitive procedures for procedure exit."
- A procedure written by
- a user, in Logo, can be a command or an operation. If it is an operation,
- you must, in the procedure, say what its output should be. If it is a
- command, it can simply stop at the end of the procedure, or you can explicitly
- make it stop before the end.
- .sp 1
- \f3output\f1 \(em Command, one input. Abbreviation: \f3op\f1
- .IN
- This command is used in a user procedure which is meant to be an
- operation. The input to this command becomes the output from the
- user procedure. Please don't be confused by the fact that the user
- procedure is an operation, while the \f3output\f1 primitive
- procedure is a command used in that procedure. Example:
- .sp 1
- .nf
- \f3to nickname :person
- if equalp :person [Peter Parker] [output "Spiderman]
- if equalp :person [Lamont Cranston] [output "Shadow]
- output first :person
- end\f1
- .fi
- .OU
- \f3stop\f1 \(em Command, no inputs.
- .IN
- This command is used in user procedures which are meant to be
- commands. It stops the user procedure. (Note that it does not
- stop all running procedures. If user procedure A runs user procedure
- B, a \f3stop\f1 command in procedure B returns to procedure A, which
- continues after the point where procedure B was invoked.)
- .OU
- \f3toplevel\f1 \(em Command, no inputs.
- .IN
- This command stops all running procedures. The user at the terminal
- is prompted to type another command. This can be used when a user
- procedure discovers some error condition and wants to abort the entire
- program, for example.
- .OU
- .ti +5
- .UB "Property lists."
- It is possible to associate with any name a list
- of "properties". A property list contains property names and property
- values. For example:
- .IN
- .nf
- .sp 1
- \f3pprop "bh "firstname "Brian
- pprop "bh "lastname "Harvey\f1
- .fi
- .OU
- The form of a property list is
- .EX
- [name1 val1 name2 val2 name3 val3]
- .EC
- Although this data structure could be created using other Logo primitives,
- special property list primitives are provided because they are faster. The
- property lists do not share storage with Logo variables, so you can change
- the value of any property without having to recopy the entire property list
- as you would ordinarily. The following primitives manipulate property lists.
- .sp 1
- \f3pprop\f1 \(em Command, three inputs.
- .IN
- The first input, which must be a word, is a name with which a property list
- is associated. The second input, which must be a word, is the name of a
- property. The third input can be any Logo object. It becomes the value
- of the specified property of the specified name.
- .OU
- \f3gprop\f1 \(em Operation, two inputs.
- .IN
- Both inputs must be words. The first is a name, and the second is a
- property name. The output is the value of the indicated property of the
- indicated object. It is not an error if there is no such property;
- the output in that case is the empty list.
- .OU
- \f3remprop\f1 \(em Command, two inputs.
- .IN
- The inputs must be words, as for \f3gprop\f1. The specified property
- is removed from the specified name.
- .OU
- \f3plist\f1 \(em Operation, one input.
- .IN
- The input must be a word, which is a name. The output is the property
- list of the specified name. Note: the output is actually a copy of the
- property list. The real property list is not a Logo list. Any later
- changes to the properties of the specified name will not change the
- list which was output by an earlier \f3plist\f1.
- .OU
- \f3pps\f1 \(em Command, no inputs.
- .IN
- All properties of all names are listed on your terminal.
- .OU
- .ti +5
- .UB "Pausing."
- When you are debugging a complicated Logo program, it is
- very helpful to be able to stop in the middle of a procedure, so that you
- can give interactive commands to examine its inputs and other local
- variables. This is different from stopping a procedure, which destroys
- its local environment. There are three ways a procedure can pause: (1) You
- can include the command \f3pause\f1 in the procedure definition, to make the
- procedure pause at a particular place you choose in advance; (2) you can
- decide to pause a procedure while it is running by typing the system
- "interrupt" character (this is control-C at Lincoln-Sudbury but is different
- on other systems); or (3) you can arrange for an error in the processing of
- the procedure to pause instead of stopping as it usually does.
- .PP
- Note that when you type the system "quit" character (control-G at
- Lincoln-Sudbury) Logo does not pause, but returns to toplevel. All
- information about the local state of your active procedures is lost.
- .PP
- When you are paused, Logo accepts instructions from your terminal as it
- does at toplevel, but local variables can be examined or modified. To let
- you know that you are paused, Logo prompts with the characters "\f3-?\f1"
- instead of just "\f3?\f1" as usual. It is possible to pause within a
- procedure within a pause; in this case your prompt is "\f3--?\f1" to
- indicate two levels of pause. This can be continued to higher levels.
- .PP
- To get out of a pause, there are three things you can do. You can give the
- command \f3toplevel\f1, which stops all pending procedures and returns to
- interactive top level. You can give the command \f3stop\f1 or the command
- \f3output\f1 with an input, which will terminate the current procedure
- (without or with an output respectively) and return to its calling
- procedure. Or you can give the command \f3continue\f1, which will resume
- the procedure at the point where you paused.
- .sp 1
- \f3pause\f1 \(em Command, no inputs.
- .IN
- This command is meaningful only within a procedure. It causes a pause.
- .OU
- \f3continue\f1 \(em Command, no inputs. Abbreviation: \f3co\f1
- .IN
- This command is meaningful only when typed during an interactive pause. It
- continues the current procedure from where it was paused.
- .OU
- \f3errpause\f1 \(em Command, no inputs.
- .IN
- This command tells Logo that any errors which happen during procedure
- execution from now on should cause a pause, rather than a return to
- toplevel.
- .OU
- \f3errquit\f1 \(em Command, no inputs.
- .IN
- This command tells Logo that any errors which happen during procedure
- execution from now on should return to toplevel, rather than pausing. This
- is the initial state of affairs when you start Logo.
- .OU
- \f3setqpause\f1 \(em Command, no inputs.
- .IN
- This command tells Logo that from now on, the system quit character should
- pause, and the system interrupt character should return to toplevel. This
- is the reverse of the usual interpretation. This command is provided for
- people whose systems or keyboards make one of these characters easier to
- type than the other. In particular, under Eunice there is only an interrupt
- character, not a quit character.
- .OU
- \f3setipause\f1 \(em Command, no inputs.
- .IN
- This command tells Logo that from now on, the system interrupt character
- should pause, and the system quit character should return to toplevel. This
- is the initial state of affairs when you start Logo.
- .OU
- .ti +5
- .UB "Miscellaneous primitives."
- The remaining primitives are one
- of a kind, or very obscure, or both.
- .sp 1
- \f3goodbye\f1 \(em Command, no inputs. Abbreviation: \f3bye\f1
- .IN
- This command is used to leave Logo. It is the only way out, unless
- there is a bug somewhere.
- .OU
- \f3thing\f1 \(em Operation, one input.
- .IN
- The input must be a word, and must be the name of a variable. The
- output is the value of the variable. These are equivalent:
- .sp 1
- .nf
- \f3:foo
- thing "foo\f1
- .fi
- .OU
- \f3namep\f1 \(em Operation (predicate), one input.
- .IN
- The input must be a word. The output is \f3true\f1 if that word is the
- name of a variable which has a value assigned to it, \f3false\f1 otherwise.
- .OU
- \f3wait\f1 \(em Command, one input.
- .IN
- The input must be a positive integer. Logo waits that many seconds
- before continuing.
- .OU
- \f3trace\f1 \(em Command, no inputs.
- .IN
- This command is used for debugging your Logo programs. After you use
- this command, every time a user-defined procedure starts or stops, a
- message is typed at your terminal naming the procedure and its inputs
- or its output, if any. The message is indented according to the depth
- in procedure calls.
- .OU
- \f3untrace\f1 \(em Command, no inputs.
- .IN
- This command turns off the trace messages started by the \f3trace\f1
- command.
- .OU
- \f3unix\f1 \(em Command, one input.
- .IN
- The input must be a Unix shell command, which is carried out in a
- forked shell. (/bin/sh is used, not csh.) Example:
- .sp 1
- .nf
- \f3to whois :user
- unix (sentence "grep (word "'^ :user ":') "/etc/inquir)
- end\f1
- .fi
- .OU
- \f3run\f1 \(em Command or operation, one input.
- .IN
- The input must be a list, containing a Logo instruction line. The list is
- run as if you typed it directly to Logo. Example:
- .sp 1
- .nf
- \f3to while :condition :cmd
- if not run :condition [stop]
- run :cmd
- while :condition :cmd
- end
- .sp 1
- make "number 1
- while [:number < 5] [print :number; make "number :number+1]\f1
- .fi
- .sp 1
- The \f3run\f1 procedure can be used as an operation, if its input is a Logo
- expression which produces a value, instead of a complete instruction:
- .sp 1
- \f3print run [sum 2 3]\f1
- .OU
- \f3repeat\f1 \(em Command, two inputs.
- .IN
- The first input must be a positive number. The second is an instruction list,
- as for the \f3run\f1 command. The list is run repeatedly, the number of times
- specified by the first input:
- .sp 1
- \f3repeat 5 [print "hello]\f1
- .OU
- \f3repcount\f1 \(em Operation, no inputs.
- .IN
- This operation may be used only within the range of a \f3repeat\f1 command. It
- outputs the number of repetitions which have been done, including the current
- one. That is, it outputs 1 the first time through, 2 the second time, and
- so on.
- .OU
- \f3break\f1 \(em Command, no inputs.
- .IN
- This command is only meaningful within the range of an \f3if\f1 command
- within the range of a \f3repeat\f1 command. It terminates the repeat
- immediately. If used in other contexts, the results may be strange.
- .OU
- \f3cbreak\f1 \(em Command, one input.
- .IN
- The input must be either the word \f3on\f1 or the word \f3off\f1. If
- the input is \f3on\f1, your terminal is placed in cbreak mode, which
- means that what you type is made available to your program every
- character, rather than every line. This must be done before the
- \f3readchar\f1 procedure, below, will work. This facility is good for
- writing video game programs or text editors. While in cbreak mode, echo
- is turned off also.
- .OU
- \f3readchar\f1 \(em Operation, no inputs. Abbreviation: \f3rc\f1
- .IN
- This operation waits for you to type a single character at your terminal. The
- output is a word containing only that character. This works only if you
- have turned on cbreak mode; see above.
- .OU
- \f3keyp\f1 \(em Operation (predicate), no inputs.
- .IN
- This procedure outputs \f3true\f1 if there is a character waiting to
- be read from the terminal, if you are in cbreak mode. If not, it
- outputs \f3true\f1 if there is an entire line waiting to be read.
- .OU
- \f3cleartext\f1 \(em Command, no inputs. Abbreviation: \f3ct\f1
- .IN
- This command clears the screen. It uses termlib to be terminal-independent.
- .OU
- \f3setcursorxy\f1 \(em Command, two inputs. Abbreviation: \f3setcxy\f1
- .IN
- This command positions the terminal cursor to the column and row specified
- by the two inputs, which must be integers. It uses termlib to support a
- wide variety of terminals, but not every terminal is capable of cursor
- addressing. There is a library procedure setcursor that takes one input,
- a list of two numbers, column and row.
- .OU
- \f3oflush\f1 \(em Command, no inputs.
- .IN
- Normally, when you tell Logo to print something, the printing is not done
- right away. Instead, Logo remembers everything you tell it to print, and the
- printing is done all at once the next time Logo is waiting for you to type
- something. This arrangement makes Logo much faster than it would be if
- everything were printed immediately. The \f3oflush\f1 command tells Logo to
- print whatever you've previously asked for right away, without waiting.
- .OU
- \f3help\f1 \(em Command, no inputs.
- .IN
- This command types at your terminal a brief message about Logo and
- how to use it.
- .OU
- \f3describe\f1 \(em Command, one input.
- .IN
- The input must be the name of a Logo primitive procedure. A brief
- explanation of that primitive is typed at your terminal.
- .OU
- \f3go\f1 \(em Command, one input.
- .IN
- This command can be used only inside a procedure. The input must be a
- number. The same number must appear at the beginning of some line in
- the same procedure. (This line number is otherwise ignored.)
- The next command executed will be
- the one on the indicated line in the definition. Note: there is always
- a better way to do it. If you have previously programmed in BASIC, your
- only hope of ever really learning how to program computers is NEVER EVER
- to use the \f3go\f1 command!
- .OU
- \f3debquit\f1 \(em Command, no inputs.
- .IN
- This command is meant to be used only for debugging Logo itself. It is
- explained here only for completeness. After this command is used, the
- QUIT signal is not caught by Logo, so it will cause a core dump.
- .OU
- \f3memtrace\f1 \(em Command, no inputs.
- .IN
- This command is meant to be used only for debugging Logo itself. It is
- explained here only for completeness. After this command is used, every
- allocation or deallocation of memory, and every character parsed by the
- interpreter, types an incomprehensible message at your terminal.
- .OU
- \f3yaccdebug\f1 \(em Command, no inputs.
- .IN
- This command is meant to be used only for debugging Logo itself. It is
- explained here only for completeness. After this command is used, every
- state transition in the yacc parser types an incomprehensible message
- at your terminal.
- .OU
- .ti +5
- .UB "The Logo library."
- The directory /usr/lib/logo contains Logo
- procedures which are available to all users. They are not listed by
- \f3pots\f1, but can be thought of as pseudo-primitives which happen to
- be written in Logo. Some of these procedures are only useful in conjunction
- with the teaching units used in Introduction to Computers, but others are
- generally useful. This manual does not fully document the Logo
- library, because it changes
- too often. Look through the /usr/lib/logo directory yourself if you want.
- The procedures \f3setcursor\f1,
- \f3listp\f1, \f3home\f1, \f3pos\f1, \f3setpos\f1, \f3towards\f1, \f3setx\f1,
- and \f3sety\f1 in the library are provided for partial compatibility with
- Apple Logo.
-
-