home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / logo / powerlogo / users-guide.text < prev    next >
Text File  |  1992-11-10  |  80KB  |  2,331 lines

  1.  
  2.    Power LOGO
  3.    Release 1.3
  4.    Copyright 1992
  5.    by Gary Teachout
  6.  
  7. This program is freeware, and may be distributed freely. It may be
  8. distributed along with other freely distributable software. All other
  9. rights reserved. It may not be sold for profit, or included as part of a
  10. commercial product without my permission. Power LOGO should be distributed
  11. together with the entire contents of the 'PowerLOGO' directory. No
  12. donations are required but they are accepted and appreciated.
  13.  
  14. THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
  15. EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO ITS FITNESS FOR ANY
  16. PARTICULAR PURPOSE. This software is experimental and IT HAS DEFECTS, if
  17. you do not accept all of the risks and responsibilities of using defective
  18. software, then DO NOT USE THIS.
  19.  
  20. Table of Contents
  21.  
  22. Preface
  23.  
  24. Acknowledgments
  25.  
  26. Chapter 1  Power LOGO
  27.       Features
  28.       The Power LOGO dialect
  29.  
  30. Chapter 2  Getting started
  31.       Running LOGO
  32.       Startup file
  33.       Command window
  34.       Project Files
  35.  
  36. Chapter 3  Programming
  37.       Words and Lists
  38.       Instructions
  39.       Procedures
  40.       Recursion
  41.  
  42. Chapter 4  Advanced Topics
  43.       Files
  44.       Graphics
  45.       Turtles
  46.       Sound
  47.       Demons
  48.       Messages and Ports
  49.       System Memory
  50.       User Memory
  51.  
  52. Chapter 5  Primitives
  53.  
  54. Appendix A  Errors
  55.  
  56. Appendix B  Limits
  57.  
  58. Appendix C  Compatibility
  59.  
  60. Appendix D  Recommended Reading
  61.  
  62. Preface
  63.  
  64. Programming languages have evolved, and improved a great deal. Modern
  65. versions of BASIC, for example, bare little resemblance to those available
  66. ten years ago. Numbered lines are gone, subprograms have been added, and
  67. they now include support for modern hardware and user interfaces. Most of
  68. this progress has left LOGO behind. Because of its early success with
  69. elementary students, it has acquired a reputation as a toy language for
  70. kiddies. Most versions of LOGO have no modern improvements, like support
  71. for modern hardware or user interfaces.
  72.  
  73. As a dialect of LISP, LOGO is actually a very powerful and versatile
  74. programming language. Power LOGO is an atempt to bring LOGO up to date, by
  75. adding the kind of features you would expect from any modern language. My
  76. priorities for Power LOGO are simplicity, and versatility, before
  77. compatibility.
  78.  
  79. This file covers the details of Power LOGO, but it is not intended to teach
  80. the LOGO programming language. For learning LOGO I recommend Computer
  81. Science Logo Style, Volume 1, by Brian Harvey (see appendix D Recommended
  82. Reading).
  83.  
  84. You can help me to improve this version of LOGO. Please contact me with any
  85. comments or bug reports. I am also interested in how you use LOGO, and
  86. would like to see your program examples, demos, tutorials, etc.
  87.  
  88.       Gary Teachout 
  89.       10532  66 Place, W
  90.       Mukilteo, WA  98275
  91.       USA
  92.  
  93.  
  94. Acknowledgments
  95.  
  96. I would like to thank the following for helping to make PowerLOGO work as
  97. well as it does, and for saving me a lot of work:
  98.  
  99.  * Justin V. McCormick, for the PathMaster file selector (filerequest).
  100.  
  101.  * Software Dissidents, for the ILBM.Library (loadimage, saveimage).
  102.  
  103. Chapter 1  Power LOGO
  104.  
  105. Power LOGO is an experimental dialect of the LOGO programming language. It
  106. is a very high level language, easy to use, and easy to learn. Yet it has
  107. some low level power as well.
  108.  
  109. Features
  110.  
  111.  * Power LOGO uses the simplest subset of LOGO syntax, and is defined by
  112.    the simplest rules.
  113.  
  114.  * User defined procedures are not limited to a fixed number of inputs,
  115.    they may be defined with required inputs, optional inputs, and local
  116.    variables.
  117.  
  118.  * Much of the Amiga graphics capability is supported. Primitives are
  119.    provided to open custom Intuition screens and windows, draw lines,
  120.    patterned lines, text, flood fills, copy regions, etc.
  121.  
  122.  * Turtle graphics with multiple turtles. Each turtle may have its own
  123.    sense of distance, direction, home, line pattern, etc.
  124.  
  125.  * A universal host message port for inter process communication,
  126.    including ARexx support.
  127.  
  128.  * Demons (high-level interrupts) may be programmed to respond to events
  129.    from the keyboard, menus, left mouse button, host message port, reply
  130.    message port, and window close gadgets.
  131.  
  132.  * Menus may be attached to any window. Along with menu demons this allows
  133.    LOGO programs to have friendly user interfaces. You may customize the
  134.    LOGO user interface by attaching your own menus to the LOGO command
  135.    window.
  136.  
  137.  * All arithmetic uses the Amiga 'mathieeedoubbas.library', this includes
  138.    automatic support for 68881.
  139.  
  140.  * Sounds may be played on all four of the Amiga audio channels.
  141.  
  142.  * Power LOGO provides many primitives not typically found in LOGO.
  143.    Primitives for arithmetic (frac, log, power...), flow of control (cond,
  144.    dowhile, whenmenu, while...), words and lists (alphap, items,
  145.    restof...), and more.
  146.  
  147. The Power LOGO dialect
  148.  
  149. Power LOGO differs from traditional LOGO in these important ways:
  150.  
  151.  * It is case sensitive. All primitives and keywords are lower case, all
  152.    names and data defined may be any case.
  153.  
  154.  * Spaces are sacred. All LOGO objects (words, lists, list brackets, and
  155.    parenthesis) must be separated by white space (a space, or a linefeed).
  156.  
  157.  * It uses prefix (polish) notation only. Inputs to a procedure follow to
  158.    the right of the procedure name. There are no infix operations, no
  159.    implied spaces, and no special delimiters.
  160.  
  161.  * It has no 'TO' or 'END' primitive. User defined procedures are just
  162.    variables that contain a special type of list, and are defined using the
  163.    'make' primitive. This idea of programs as data is unusual but can be
  164.    very useful.
  165.  
  166.  * There is no built-in text editor. Project files may be created and
  167.    edited almost any text editor.
  168.  
  169.  * Other differences relate to the name, spelling, inputs, and behavior of
  170.    individual primitives.
  171.  
  172. While some of the above may seem restricting, it keeps Power LOGO simple,
  173. and should not be difficult to learn.
  174.  
  175. Chapter 2  Getting started
  176.  
  177. Running LOGO
  178.  
  179. LOGO may be run in the usual way from the WorkBench or the CLI. You may
  180. exit LOGO by entering the quit command.
  181.  
  182. Power LOGO should run on most Amiga computers, it requires about 250 K
  183. bytes, but can use all available memory if needed. To use the 'saveimage',
  184. and 'loadimage' commands, your LIBS: directory must contain the
  185. 'ILBM.Library' by Software Dissidents. Your LIBS: directory must also
  186. contain the Amiga 'mathieeedoubbas.library'.
  187.  
  188.  
  189. Startup file
  190.  
  191. If a file called LOGO-Startup is found in the same directory with LOGO it
  192. will be loaded to initialize LOGO. This file should contain LOGO code that
  193. will load any project files in the 'argslist'. It may also be used to
  194. configure LOGO the way you like, and to load your own frequently used
  195. procedures, and data.
  196.  
  197. The default 'LOGO-Startup' file will define some useful procedures, install
  198. a menu user interface, and load any project files selected, or named as
  199. arguments.
  200.  
  201.  
  202. Command window
  203.  
  204. LOGO opens a window on the workbench screen as its command input and output
  205. window. You may enter and edit LOGO commands with these special keys.
  206.  
  207.    Backspace            Delete character to the left of the cursor.
  208.    Cursor Right         Move cursor right one space.
  209.    Cursor Left          Move cursor left one space.
  210.    Cursor Up            Move backward through the command history.
  211.    Cursor Down          Move forward through the command history.
  212.    Control-G            Stop program, return to top level.
  213.    Control-K            Delete from cursor to end of line.
  214.    Control-U            Delete from cursor to start of line.
  215.    Control-X            Delete the line.
  216.    Delete               Delete character under the cursor.
  217.    Return               Enter list or instructions.
  218.    Shift Cursor Right   Move cursor to end of line.
  219.    Shift Cursor Left    Move cursor to start of line.
  220.  
  221. The '? ' prompt means LOGO is waiting for a command. If the command line
  222. contains an open list (an open bracket '[' without a closing bracket ']')
  223. you will see the '1 > ' prompt allowing you to continue the list on another
  224. line.
  225.  
  226.    ? repeat 20 [
  227.    1 > setcursor list random 40 random 20
  228.    1 > pr "HELLO! ]
  229.  
  230. Project Files
  231.  
  232. There is no built-in text editor. LOGO stores programs as ASCII text files,
  233. which may be created and modified using any text editor. Some text editors
  234. remove trailing blank spaces from the ends of lines, if this removes a
  235. space following a backslash it will cause problems.
  236.  
  237. The 'save' primitive will save the contents of variables in the LOGO
  238. workspace, as 'make' commands. The 'load' primitive will execute the
  239. instructions in a file just as if typed into the command window. 'load',
  240. and 'save' complement one another. Comments may be included in project
  241. files by prefixing them with a semicolon (;), the semicolon and everything
  242. from it to the end of the line will be ignored (note that the semicolon
  243. must be surrounded by white space to be recognized as a comment character).
  244.  
  245. Chapter 3  Programming
  246.  
  247. Words and Lists
  248.  
  249. In the Power LOGO programming environment, everything is either a word or a
  250. list. Words can be any sequence of characters. Words are separated from
  251. each other by blank spaces, to include a space (or a backslash) in a word
  252. it must be preceded by a backslash (\). Numbers are just a special type of
  253. word. Numbers prefixed with an '@' symbol will be recognized by some
  254. procedures as pointers. Lists can be any sequence of objects, which may be
  255. ether words or lists. Lists are identified by enclosing them in brackets
  256. '[]'.
  257.  
  258.    This-is-a-word!
  259.    [ This is a list! ]
  260.  
  261.  
  262. Instructions
  263.  
  264. Words and lists may be either data or instructions. An instruction is a
  265. procedure name followed by any inputs the procedure may require. When LOGO
  266. tries to evaluate a word it may treat it in one of three ways, as a
  267. literal, as a variable, or as a procedure. Words preceded by a quote (")
  268. character (called quoted words) are literal and evaluate as the word
  269. itself. For words that happen to be numbers or pointers the quote is not
  270. needed. Words preceded by a colon (:) character (called dotted words) refer
  271. to the contents (binding) of a variable name. A word by itself (no dots or
  272. quote) is evaluated as a procedure (unless it is a number or pointer).
  273.  
  274.    ? print 123
  275.    123
  276.  
  277. Here 'print' is a procedure, and the number '123' is its input. The 'print'
  278. procedure simply prints its inputs on next line in the command window.
  279.  
  280.    ? print [ This is a list! ]
  281.    This is a list!
  282.  
  283. In this example the list (everything between the brackets) is the input to
  284. the 'print' command. 
  285.  
  286.    ? print "This-is-a-word!
  287.    This-is-a-word!
  288.  
  289. In this example the quote (") identifies the input as a literal word.
  290.  
  291. The inputs to a procedure need not be literal, they may be the contents of
  292. a variable, or the output of another instruction. Instructions may be
  293. nested as inputs within other instructions.
  294.  
  295.    ? pr * 7 6
  296.    42
  297.  
  298. Here '*' is another procedure '6' and '7' are its inputs. '*' outputs the
  299. product of its inputs to pr ('pr' is just an abbreviation for 'print')
  300. which prints it on the next line. It is important to note that the
  301. sub-instruction '* 7 6' is not the input to 'pr', but is evaluated, and its
  302. output is the input to 'pr'.
  303.  
  304.    ? make "x 100
  305.    ? pr :x
  306.    100
  307.  
  308. In the first line the 'make' procedure assigns 100 as the contents of the
  309. variable 'x'. In the second line ':x' refers to the contents of 'x'.
  310.  
  311. Each procedure has some number of required inputs (zero or more), and some
  312. number of optional inputs (zero or more). To include optional inputs the
  313. entire instruction must be enclosed in parenthesis. If only the required
  314. inputs are used, the parenthesis are not needed. Print requires one input
  315. but may have many.
  316.  
  317.    ? ( pr "PI "= 3.1415 )
  318.    PI = 3.1415
  319.  
  320. In this instruction 'pr' has three inputs.
  321.  
  322.    ? ( pr [ And the answer is ] * 4 ( + 1 2 3 ) )
  323.    And the answer is 24
  324.  
  325. This entire line is one instruction where 'pr' has two inputs, the first 
  326. is the list '[ And the answer is ]', the second is the instruction
  327. '* 4 ( + 1 2 3 )'. This second instruction '*' has two inputs '4' and
  328. another instruction '( + 1 2 3 )'.  
  329.  
  330.  
  331. Procedures
  332.  
  333. Primitives are the procedures that are built-in to LOGO. You may define
  334. your own procedures and add them to LOGO. In Power LOGO a procedure is just
  335. a variable that contains a special type of list, and may be defined using
  336. the 'make' primitive. The first item in a procedure definition list is the
  337. word procedure. The second item is a list of lists of names of the inputs
  338. and local variables used by the procedure (the names list). The rest of the
  339. items in the definition are the instructions executed by the procedure.
  340.  
  341.    ? make "hello [ procedure [ ] pr [ Hello World ! ] ]
  342.    ? hello
  343.    Hello World !
  344.  
  345. Because this example procedure uses no inputs or local variables the names
  346. list may be empty.
  347.  
  348. The first item of the variable names list is a list of required inputs. The
  349. second item is a list of optional inputs or a name to receive a list of
  350. optional inputs. The third item is a list of names of local variables.
  351. Local variables and unused optional inputs contain the empty list at the
  352. start.
  353.  
  354.    ? make "hello [
  355.    1 > procedure [ [ ] [ :n ] ]
  356.    1 > repeat if numberp :n [ :n ] [ 1 ] [
  357.    2 > pr [ Hello World ! ] ] ]
  358.  
  359.    ? hello
  360.    Hello World !
  361.  
  362.    ? ( hello 3 )
  363.    Hello World !
  364.    Hello World !
  365.    Hello World !
  366.  
  367.    ? ( hello 0 )
  368.  
  369. This example uses one optional input. See the example files for other forms
  370. of names lists.
  371.  
  372. Global, free, and local variables all work as they would in lisp. All
  373. variable names in a procedure names list are local within each call to that
  374. procedure. They are free variables to all procedures called from within
  375. that procedure or at a lower level.
  376.  
  377.  
  378. Recursion
  379.  
  380. A procedure that includes a call to itself is called a recursive procedure.
  381.  
  382.    ? make "factorial [
  383.    1 > procedure [ [ :f ] ]
  384.    1 > output if < 1 :f [ * :f factorial - :f 1 ] [ :f ] ]
  385.    ? factorial 5
  386.    120
  387.  
  388. This procedure uses recursion to compute the factorial of its input.
  389.  
  390. A procedure in which the recursive call is the last instruction is called
  391. tail recursive. Tail recursion is handled differently by LOGO because the
  392. local variables need not be preserved. Two cases are recognized as tail
  393. recursion, a recursive operation as the input to an 'output' command, or a
  394. recursive command followed by a 'stop' command.
  395.  
  396.    ? make "count100 [
  397.    1 > procedure [ [ :x ] ]
  398.    1 > pr :x
  399.    1 > if < :x 100 [ output count100 + :x 1 ] [ output :x ] ]
  400.  
  401.    ? make "count-up [
  402.    1 > procedure [ [ :x ] ]
  403.    1 > pr :x
  404.    1 > count-up + :x 1
  405.    1 > stop ]
  406.  
  407. In the second example the 'stop' command is never executed, but it is
  408. necessary for LOGO to recognize the call to 'count-up' as tail recursion,
  409. without it 'count-x' would run out of memory.
  410.  
  411. Chapter 4  Advanced Topics
  412.  
  413. Files
  414.  
  415. Primitives are provided to save and load the contents of variables
  416. (including procedures), read and write data, save and load IFF images,
  417. attach icons to files, and get a filename through a file requester.
  418.  
  419. The 'save' primitive saves the contents of variables to a file as 'make'
  420. commands. The 'load' command executes a text file as if it were typed at
  421. the command window except that comments are ignored (a comment is
  422. everything from a semicolon ';' to the end of the line).
  423.  
  424. The 'saveimage', and 'loadimage' primitives copy the contents of a window
  425. to or from an IFF ILBM file. For these to work the 'ILBM.Library' by
  426. Software Dissidents must be in the LIBS: directory.
  427.  
  428. The 'filerequest' primitive outputs an AmigaDOS file name selected with the
  429. PathMaster file selector by Justin V. McCormick. 'filerequest' may be used
  430. as input to any procedure that requires a file name.
  431.  
  432.    make "file-name filerequest
  433.    load :file-name
  434.  
  435. To read or write a data file it must first be opened with 'open' (a new
  436. file to be written), or 'openold' (an existing file to be read or
  437. appended). Each of these outputs a file pointer (a BCPL pointer to an
  438. AmigaDOS file handle) which must later be closed using 'close'. The
  439. primitives for reading and writing files accept a file-pointer as input and
  440. work much like their command window counterparts. This example will create
  441. or overwrite a file:
  442.  
  443.    make "file-handle open filerequest
  444.    fprint :file-handle [ The quick brown fox... ]
  445.    close :file-handle
  446.  
  447. This example will read an existing text file into a list of lists:
  448.  
  449.    make "text-list [ ]
  450.    make "file-handle openold filerequest
  451.    while [
  452.       make "line freadlist :file-handle
  453.       not wordp :line
  454.       ] [ 
  455.       make "text-list lput :line :text-list ]
  456.    close :file-handle
  457.  
  458. Graphics
  459.  
  460. Much of the Amiga graphics capability is available in Power LOGO.
  461. Primitives are provided to open custom intuition screens and windows, draw
  462. lines, patterned lines, text, flood fills, and copy regions.
  463.  
  464. Graphics are rendered into windows which must first be opened with
  465. 'openwindow'.
  466.  
  467.    make "myscreen ( openscreen 3 2 [ My Screen ] )
  468.    make "mywindow ( openwindow :myscreen 3 [ My Window ] 50 30 500 150 )
  469.  
  470. The window graphics primitives require a pointer to a window as an input.
  471. Coordinates within windows start with (0,0) in the upper left corner and
  472. count pixels to the right and down.
  473.  
  474.    setpen :mywindow 1
  475.    move :mywindow 20 20
  476.    draw :mywindow 400 80
  477.    text :mywindow [ Window Graphics ]
  478.  
  479.    closescreen :myscreen
  480.  
  481. Windows may be closed using 'closewindow', 'closescreen' will also close
  482. any windows that were open on that screen.
  483.  
  484.  
  485. Turtles
  486.  
  487. Turtles are graphics tools based on relative movement. You may open many
  488. turtles, each is opened onto a window, has its own coordinate system, and
  489. has its own sense of location, distance, and direction, as well as its own
  490. foreground pen, background pen, draw mode, and line pattern.
  491.  
  492. Turtles must be opened onto a window with 'openturtle' (the 'Turtle-Shell'
  493. file will do this for you).
  494.  
  495.    make "myscreen ( openscreen 3 2 [ My Screen ] )
  496.    make "mywindow openwindow :myscreen
  497.    make "myturtle openturtle :mywindow
  498.  
  499. By default the turtle commands control all active turtles, but may be
  500. directed to control specific turtles (active or not).
  501.  
  502.    repeat 32 [ fd 50 rt 170 ]
  503.  
  504. Turtle operations output information about one specified turtle.
  505.  
  506.    make "pos tpos :myturtle
  507.    make "head heading :myturtle
  508.  
  509. Turtles may be closed with 'closeturtle', but 'closewindow, and
  510. 'closescreen' will also close any turtles that were open on that window or
  511. screen.
  512.  
  513. Sound
  514.  
  515. Sounds may be played on all four of the Amiga audio channels. Audio
  516. waveform data is an array of one byte signed numbers (-127 to 127) and must
  517. first be placed into chip ram. This will create a simple sound:
  518.  
  519.    make "sound-data allocchip 16
  520.    make "i 0
  521.    make "x 120
  522.    repeat 16 [
  523.       poke 1 psum :sound-data :i :x
  524.       make "i + :i 1
  525.       make "x - :x 16 ]
  526.  
  527.    sound ( se :sound-data 16 250 64 100 ) [ ] [ ] [ ]
  528.    sound ( se :sound-data 16 240 64 100 ) [ ] [ ] [ ]
  529.    sound ( se :sound-data 16 300 64 100 ) [ ] [ ] [ ]
  530.  
  531. The 'sound' command may then be played repeatedly.
  532.  
  533.  
  534. Demons
  535.  
  536. A demon may be thought of as a process separate from your main program,
  537. that keeps testing for a particular kind of event. When the event is
  538. detected the demon interrupts the main program and runs a special
  539. procedure. When the procedure is complete the main program will resume.
  540.  
  541. There are six types of events that may trigger demons, menu selection, left
  542. mouse button, key stroke, window close gadget, host message port, and reply
  543. message port. For each of these there is an event queue, when the event
  544. queue is not empty, the demon procedure will be run. The demon procedure
  545. must execute the appropriate get operation to remove the event from the
  546. queue, or the demon will run again and again.
  547.  
  548. make "m-window openwindow [ @0 131 [ Mouse Paint ] 320 ]
  549. whenmouse [
  550.    while [ mousep ] [ make "m-d getmouse ]      ;  Remove mouse event.
  551.    if = :m-window first :m-d [                  ;  Correct window?
  552.       move :m-window item 2 :m-d item 3 :m-d    ;  Move cursor.
  553.       make "m-d mouse :m-window                 ;  Check mouse.
  554.       while [ = 1 item 3 :m-d ] [               ;  While button is down
  555.          draw :m-window first :m-d item 2 :m-d  ;  Draw to pointer.
  556.          make "m-d mouse :m-window              ;  Check mouse.
  557.       ]
  558.    ] [ ]
  559. ]
  560.  
  561. This simple example of demons in action is from the example file
  562. 'Mouse-Paint'. For more examples of demons see the 'LOGO-Startup',
  563. 'Turtle-Shell', and 'ARexx-Support' files.
  564.  
  565. Messages and Ports
  566.  
  567. A general purpose message port is available for inter process
  568. comunication.
  569.  
  570. A message is just an area of memory, sending a message is just a way of
  571. telling another Amiga program that it can look at or change this message.
  572. When the other program is through with the message it should reply to it.
  573. After sending a message a program must not alter the message until the
  574. reply is received.
  575.  
  576. To receive messages programs must have a message port. Ports are
  577. identified by name, the default name for LOGOs host port is 'LOGO' (it can
  578. be changed). If more than one copy of LOGO is running, they will have names
  579. 'LOGO 2', 'LOGO 3', etc. 
  580.  
  581. A message must be at least twenty bytes long, the first twenty bytes are
  582. used by the Amiga system to keep track of the message when sent. Run two
  583. copies of LOGO, and this example will send lines typed into one copy of
  584. LOGO, and print them on the other:
  585.  
  586. In the first copy of LOGO:
  587.  
  588.    while [ true ] [
  589.       make "message getmessage
  590.       pr convertstring ( peek 0 :message 5 )
  591.       replymessage :message ]
  592.  
  593. In the second copy of LOGO:
  594.  
  595.    make "message allocmem 24
  596.    ( poke 2 :m-packet 24 9 )
  597.    while [ true ] [
  598.       type "message?
  599.       ( poke 0 :message allocstring rl 5 )
  600.       sendmessage "LOGO :message
  601.       make "x getreply
  602.       freemem ( peek 0 :message 5 ) ]
  603.  
  604. The 'host-port-demon' in the 'LOGO-Startup', and 'ARexx-Support' files
  605. allows other programs to send commands to LOGO. These files also include
  606. procedures for sending messages to ARexx, another copy of LOGO, or other
  607. programs.
  608.  
  609.  
  610. System Memory
  611.  
  612. For its own internal use LOGO allocates memory in even 8K byte blocks, and
  613. divides these blocks into small pieces called nodes. When out of nodes,
  614. LOGO runs the garbage collector to search all allocated blocks, and recycle
  615. any nodes that are no longer in use. if the collector finds less than a
  616. certain amount of free memory, it will allocate more blocks. All of this is
  617. dynamic and automatic, and need not be considered when programming in LOGO.
  618. However it is sometimes useful to be able to control this process.
  619.  
  620. How often the collector runs depends on the amount of extra memory it tries
  621. to hold in reserve. The operation:
  622.  
  623.    system 1
  624.  
  625. will output this amount in bytes. The command:
  626.  
  627.    ( system 2 bytes )
  628.  
  629. will set this amount (where 'bytes' is a number). When this number is
  630. large, the collector will run less often, but more slowly.
  631.  
  632. When the garbage collector runs you may notice a brief pause. The command:
  633.  
  634.    ( recycle 1 )
  635.  
  636. will force a normal recycle, and may be used to reduce the chance of the
  637. collector causing a pause at a bad time. The command:
  638.  
  639.    recycle
  640.  
  641. will also force a recycle, but will also deallocate most of the extra
  642. memory LOGO would normally hold in reserve. This may be used prior to
  643. 'openscreen', 'openwindow', or other memory hungry actions. Note that LOGO
  644. will soon reallocate most of this memory.
  645.  
  646.  
  647. User Memory
  648.  
  649. Sometimes you may need an area of memory for a special purpose (see the
  650. Sound, and Messages sections above). The 'allocmem', 'allocchip', and
  651. 'allocstring' primitives each allocate a block of memory and output a
  652. pointer.
  653.  
  654.    make "block allocmem :size
  655.    make "chip allocchip :size
  656.    make "string allocstring [ The frog sat on the log. ]
  657.  
  658. 'allocmem' and  'allocchip' output a pointer to a block of memory of the
  659. size specified. 'allocstring' outputs a pointer to a null-terminated string
  660. compatible with both C and ARexx.
  661.  
  662. When you are through with it you may return the memory with 'freemem'.
  663.  
  664.    freemem :block
  665.    freemem :chip
  666.    freemem :string
  667.  
  668. LOGO also keeps a list of all these blocks and will free them when you give
  669. the command 'new' or 'quit'. If you do not want LOGO to free a block
  670. automatically use 'false' as an optional input (this is used for reply
  671. strings to ARexx).
  672.  
  673.    make "string ( allocstring [ function reply ] false )
  674.  
  675. Or to free a block not in LOGOs user memory list (this is used for reply
  676. strings from ARexx).
  677.  
  678.    ( freemem :string false )
  679.  
  680. To help keep track LOGO allways allocates eight bytes more than needed,
  681. stores the total size in the first four bytes, and outputs a pointer to the
  682. ninth byte instead of the first. 'freemem' requires a pointer of this type.
  683.  
  684. Chapter 5  Primitives
  685.  
  686. Format for descriptions of primitives:
  687.  
  688. NAME           INPUTS ( OPTIONAL-INPUTS )
  689. SYNONYM        ALTERNATIVE INPUTS
  690.          INPUT = DESCRIPTION OF INPUT.
  691.    FUNCTION DESCRIPTION.
  692.  
  693. The Power LOGO primitive set:
  694.  
  695. +              number number ( number... )
  696. sum
  697.          number = Any number.
  698.    Addition, output the sum of all inputs.
  699.  
  700. -              number number ( number... )
  701. difference
  702.          number = Any number.
  703.    Subtraction, output first input minus all of the other inputs.
  704.  
  705. *              number number ( number... )
  706. product
  707.          number = Any number.
  708.    Multiplication, output product of all inputs.
  709.  
  710. /              number number ( number... )
  711. quotient
  712.          number = Any number.
  713.    Division, output first input divided by each of the other inputs.
  714.  
  715. +-             number
  716. negate
  717.          number = Any number.
  718.    Change sign, output opposite of input.
  719.  
  720. >              number number ( number... )
  721.          number = Any number.
  722.    Output true if first input is more than all others.
  723.  
  724. <              number number ( number... )
  725.          number = Any number.
  726.    Output true if first input is less than all others.
  727.  
  728. >=             number number ( number... )
  729.          number = Any number.
  730.    Output true if first input is more than or equal to all others.
  731.  
  732. <=             number number ( number... )
  733.          number = Any number.
  734.    Output true if first input is less than or equal to all others.
  735.  
  736. =0             number ( number... )
  737.          number = Any number.
  738.    Output true if all inputs are equal to zero.
  739.  
  740. <0             number ( number... )
  741.          number = Any number.
  742.    Output true if all inputs are less than zero.
  743.  
  744. >0             number ( number... )
  745.          number = Any number.
  746.    Output true if all inputs are more than zero.
  747.  
  748. >>             number number number ( number ... )
  749.          number = Any number.
  750.    Output true if the rest of the inputs are between the first two.
  751.  
  752. >>=            number number number ( number ... )
  753.          number = Any number.
  754.    Output true if the rest of the inputs are between or equal to
  755.    the first two.
  756.  
  757. abs            number
  758.          number = Any number.
  759.    Output absolute value of number.
  760.  
  761. acos           cosine
  762.          cosine = Number between -1 and 1.
  763.    Inverse cosine, output angle of cosine.
  764.  
  765. activelist
  766.    Output list of pointers to active turtles.
  767.  
  768. allocchip      bytes ( predicate )
  769.          bytes = Number of bytes.
  770.          predicate = true or false.
  771.    Allocate chip memory, output pointer, for sound waveform data, etc. This
  772.    allocates eight bytes more than specified, stores the total size in the
  773.    first long-word, and outputs a pointer to the eighth byte. If
  774.    'predicate' is 'true' (or absent) memory will be placed in the user
  775.    memory list for LOGO to keep track of so it can be deallocated
  776.    automatically. If 'predicate' is 'false' LOGO keeps no record of this
  777.    memory.
  778.    See Also:   freemem
  779.  
  780. allocmem       bytes ( predicate )
  781.          bytes = Number of bytes.
  782.          predicate = true or false.
  783.    Allocate memory, output pointer, for messages, arrays, etc. This
  784.    allocates eight bytes more than specified, stores the total size in the
  785.    first long-word, and outputs a pointer to the eighth byte. If
  786.    'predicate' is 'true' (or absent) memory will be placed in the user
  787.    memory list for LOGO to keep track of so it can be deallocated
  788.    automatically. If 'predicate' is 'false' LOGO keeps no record of this
  789.    memory.
  790.    See Also:   freemem
  791.  
  792. allocstring    object ( predicate )
  793.          object = Any word or list.
  794.          predicate = true or false.
  795.    Create an ARexx argstring out of object, output pointer. This allocates
  796.    eight bytes more than is needed for the string, stores the total size in
  797.    the first long-word, and outputs a pointer to the eighth byte (the first
  798.    byte of the NULL terminated string). If 'predicate' is 'true' (or
  799.    absent) memory will be placed in the user memory list for LOGO to keep
  800.    track of so it can be deallocated automatically. If 'predicate' is
  801.    'false' LOGO keeps no record of this memory.
  802.    See Also:   freemem
  803.  
  804. alphap         word word
  805.          word = Any word.
  806.    Output true if words are in alphabetical order.
  807.  
  808. and            predicate predicate ( predicate... )
  809.          predicate = true or false.
  810.    Output true if all inputs are true.
  811.  
  812. argslist
  813.    Output list of startup arguments, the first item in the argslist is the
  814.    file name of LOGO, the rest are the args from Workbench, or CLI.
  815.  
  816. ascii          word
  817.          word = Any word.
  818.    Output ASCII number of first character in word.
  819.  
  820. asin           sine
  821.          sine = Number between 1 and -1.
  822.    Inverse sine, output angle of sine.
  823.  
  824. atan           tangent
  825.          tangent = Any number.
  826.    Inverse tangent, output angle for tangent.
  827.  
  828. back           distance ( turtle ... )
  829. bk             distance ( turtle-list )
  830.          distance = Number, distance in turtle steps.
  831.          turtle = Pointer to a turtle.
  832.          turtle-list = List of turtle pointers.
  833.    Move turtles backward distance.
  834.  
  835. break
  836.    Jump out of looping primitives ('repeat', 'while', and 'dowhile').
  837.  
  838. buriedp        object
  839.          object = Any word or list.
  840.    Output true if input is a buried variable name.
  841.  
  842. burylist
  843.    Output list of names that are buried.
  844.  
  845. bury           name ( name... )
  846.                name-list ( name-list... )
  847.          name = Word, a variable name.
  848.          name-list = List of names.
  849.    Hide and protect input variable names (hide from make,
  850.    erase, namelist, etc.).
  851.    See Also:   unbury
  852.  
  853. butfirst       object
  854. bf
  855.          object = Any word or list.
  856.    Output all but the first item of the input object.
  857.  
  858. butlast        object
  859. bl
  860.          object = Any word or list.
  861.    Output all but the last item of the input object.
  862.  
  863. catch          label run-list
  864.          label = Any word.
  865.          run-list = List of LOGO instructions.
  866.    Execute run-list, set trap for matching throw. The label 'error' may be
  867.    used to trap errors.
  868.    See Also:   throw
  869.  
  870. cd             ( path )
  871.          path = An AmigaDOS directory name (word or list).
  872.    Set the current directory to the specified path, or output the current
  873.    directory.
  874.  
  875. char           ascii
  876.          ascii = Any number from 1 to 255.
  877.    Output word containing one ASCII character.
  878.  
  879. clean          ( turtle ... )
  880.                ( turtle-list )
  881.          turtle = Pointer to a turtle.
  882.          turtle-list = List of turtle pointers.
  883.    Blank turtles windows without otherwise affecting the turtles.
  884.  
  885. cleartext
  886.    Blank the command window and set the cursor position to the upper
  887.    left corner.
  888.  
  889. close          file ( file... )
  890.          file = BCPL pointer to AmigaDOS file handle.
  891.    Close files.
  892.    See Also:   open, openold
  893.  
  894. closep
  895.    Output true if window-close queue is not empty.
  896.    See Also:   getclose
  897.  
  898. closepalette   predicate
  899.          predicate = true or false.
  900.    Close the palette tool. If predicate is true, any color changes are kept
  901.    (same as the close or 'OK' gadgets). If predicate is false, the colors
  902.    are reset (same as the 'CANCEL' gadget). 
  903.    See Also:   openpalette, palettep
  904.  
  905. closescreen    screen ( screen... )
  906.          screen = Pointer to an intuition screen.
  907.    Close screens.
  908.    See Also:   openscreen
  909.  
  910. closeturtle    turtle ( turtle... )
  911.                turtle-list
  912.          turtle = Pointer to a turtle.
  913.          turtle-list = List of turtle pointers.
  914.    Close turtles.
  915.    See Also:   openturtle
  916.  
  917. closewindow    window ( window... )
  918.          window = Pointer to an intuition window.
  919.    Close windows.
  920.    See Also:   openwindow
  921.  
  922. conditional    conditional-list
  923. cond
  924.          conditional-list = A list: [ predicate-list run-list ... ]
  925.             predicate-list = A run-list that outputs true or false.
  926.             run-list = List of LOGO instructions.
  927.    Execute the run-list following the first true predicate-list.
  928.  
  929. continue
  930.    Skip to next pass in looping primitives ('repeat', 'while',
  931.    and 'dowhile').
  932.  
  933. convertstring  string
  934.          string = Pointer to an ARexx argstring, or any NULL terminated
  935.                   text string.
  936.    Output list of contents from a string. Reads a list from a NULL
  937.    terminated text string.
  938.    See Also:   allocstring
  939.  
  940. copyrect       window X Y window X Y width height ( minterm )
  941.          window = Pointer to an intuition window.
  942.          X = Number, pixel x coordinate.
  943.          Y = Number, pixel y coordinate.
  944.          width = Number, width of region in pixels.
  945.          height = Number, height of region in pixels.
  946.          minterm = Number, 0 to 255:
  947.                   192   plain copy (default)
  948.                   80    ignore source invert destination
  949.                   48    invert copy
  950.             See the Amiga Hardware Refrence Manual for more about minterms.
  951.    Copy a rectangular region from window to window.
  952.  
  953. cos            angle
  954.          angle = Number representing an angle.
  955.    Output cosine of angle.
  956.  
  957. count          object
  958.          object = Any word or list.
  959.    Output number of items in object.
  960.  
  961. cursor
  962.    Output position-list of command window text cursor.
  963.  
  964. dec            name
  965.          name = Word, a variable name that contains a number.
  966.    Decrement variable. Subtract one from the number contained by name.
  967.  
  968. degrees
  969.    Interpret angles as degrees.
  970.    See Also:   radians
  971.  
  972. dir            ( path )
  973.          path = An AmigaDOS directory name (word or list).
  974.    Output list of contents of the specified path, or the current directory.
  975.  
  976. doscommand     command-line
  977.          command-line = List containing an AmigaDOS command line.
  978.    Run list as AmigaDOS command (as if typed at the CLI).
  979.  
  980. dot            ( turtle ... )
  981.                ( turtle-list )
  982.          turtle = Pointer to a turtle.
  983.          turtle-list = List of turtle pointers.
  984.    Mark one pixel at turtles position.
  985.  
  986. dowhile        run-list predicate-list
  987.          run-list = List of LOGO instructions.
  988.          predicate-list = A run-list that outputs true or false.
  989.    Execute run-list while predicate-list is true.
  990.    See Also:   break, continue
  991.  
  992. downp          turtle
  993.          turtle = Pointer to a turtle.
  994.    Output true if turtles pen is down.
  995.  
  996. draw           window X Y
  997.          window = Pointer to an intuition window.
  998.          X = Number, pixel x coordinate.
  999.          Y = Number, pixel y coordinate.
  1000.    Draw from a windows graphics cursor position to position X Y.
  1001.  
  1002. emptyp         object
  1003.          object = Any word or list.
  1004.    Output true if object is the empty list or the empty word.
  1005.  
  1006. eqp            object object ( object... )
  1007.          object = Any word or list.
  1008.    Output true if all inputs refer to the same object. This is a special
  1009.    purpous operation, and is of limited usefulness.
  1010.    See Also:   repitem, represt
  1011.  
  1012. equalp         object object ( object... )
  1013. =
  1014.          object = Any word or list.
  1015.    Output true if objects are identical.
  1016.  
  1017. erase          name ( name... )
  1018.                name-list ( name-list... )
  1019.          name = Word, a variable name.
  1020.          name-list = List of names.
  1021.    Remove bindings (contents) of input names that are not buried.
  1022.    See Also:   make
  1023.  
  1024. error
  1025.    Output list containing the error number, procedure name, primitive name,
  1026.    and the offending input from the most recent error.
  1027.  
  1028. exor           predicate predicate
  1029.          predicate = true or false.
  1030.    Output true if one input is true and one is false.
  1031.  
  1032. filelist
  1033.    Output list of pointers to all open files.
  1034.  
  1035. filerequest    ( title )
  1036.          title = Word, title bar text.
  1037.    Output file path name selected from file requester (or empty word if
  1038.    `cancel' is selected). This uses the PathMaster file selector
  1039.    by Justin V. McCormick.
  1040.  
  1041. findport       port-name
  1042.          port-name = Word or list, name of public message port.
  1043.    Output pointer to the message port if it exists. Output null pointer
  1044.    (@0) if the port does not exist.
  1045.  
  1046. first          object
  1047.          object = Any word or list.
  1048.    Output first item of object.
  1049.  
  1050. firstput       object object
  1051. fput
  1052.          object = Any word or list.
  1053.    Output object made by adding first input to beginning of second input.
  1054.  
  1055. floodol        window X Y
  1056.          window = Pointer to an intuition window.
  1057.          Y = Number, pixel x coordinate.
  1058.          Y = Number, pixel y coordinate.
  1059.    Flood fill to outline. Recolor in all directions from X, Y to a border
  1060.    in the outline pen.
  1061.  
  1062. floodpc        window X Y
  1063.          window = Pointer to an intuition window.
  1064.          Y = Number, pixel x coordinate.
  1065.          Y = Number, pixel y coordinate.
  1066.    Flood fill pixel color. Recolor in all directions from X, Y all
  1067.    adjacent pixels the same color as X, Y.
  1068.  
  1069. forward        distance ( turtle ... )
  1070. fd             distance ( turtle-list )
  1071.          distance = Number, distance in turtle steps.
  1072.          turtle = Pointer to a turtle.
  1073.          turtle-list = List of turtle pointers.
  1074.    Move turtles forward distance.
  1075.  
  1076. fprint         file object ( object... )
  1077.          file = BCPL pointer to AmigaDOS file handle.
  1078.          object = Any word or list.
  1079.    Print object to file, followed by a linefeed. If object is a list
  1080.    outermost brakets will be removed.
  1081.    See Also:   freadlist
  1082.  
  1083. fprintout      file name ( name... )
  1084.                file name-list ( name-list... )
  1085.          file = BCPL pointer to AmigaDOS file handle.
  1086.          name = Word, a variable name.
  1087.          name-list = List of names.
  1088.    Print names and their bindings file. Prints a 'make' command that may
  1089.    then be 'load'ed.
  1090.    See Also:   load, make
  1091.  
  1092. frac           number
  1093.          number = Any number.
  1094.    Output fractional portion of number.
  1095.  
  1096. freadbyte      file
  1097.          file = BCPL pointer to AmigaDOS file handle.
  1098.    Output one byte number read from file, Output the empty list if end
  1099.    of file.
  1100.    See Also:   fwritebyte
  1101.  
  1102. freadlist      file
  1103.          file = BCPL pointer to AmigaDOS file handle.
  1104.    Output list read from file (or the empty word if end of file).
  1105.    See Also:   fprint
  1106.  
  1107. freemem        pointer ( predicate )
  1108.          pointer = Pointer to allocated memory.
  1109.          predicate = true or false.
  1110.    Deallocate memory allocated by 'allocchip', 'allocmem', or
  1111.    'allocstring'. If 'predicate' is 'true' (or absent) memory will only be
  1112.    deallocated if it is found in the user memory list. If 'predicate' is
  1113.    'false' memory will be deallocated even if not found in the user memory
  1114.    list. This may be used to deallocate an ARexx argstring result.
  1115.    See Also:   allocchip, allocmem, allocstring
  1116.  
  1117. fshow          file object ( object... )
  1118.          file = BCPL pointer to AmigaDOS file handle.
  1119.          object = Any word or list.
  1120.    Print object to file, followed by a linefeed.
  1121.  
  1122. ftype          file object ( object... )
  1123.          file = BCPL pointer to AmigaDOS file handle.
  1124.          object = Any word or list.
  1125.    Print object to file, not followed by a linefeed.
  1126.  
  1127. fwritebyte     file number ( number... )
  1128.          file = BCPL pointer to AmigaDOS file handle.
  1129.          number = Any number from 0 to 255.
  1130.    Write one byte numbers to file.
  1131.    See Also:   freadbyte
  1132.  
  1133. getclose
  1134.    Output a pointer to a window from the window close event queue, wait if
  1135.    the event queue is empty.
  1136.    See Also:   closep, whenclose
  1137.  
  1138. getmenu
  1139.    Output list containing a pointer to the window, the menu number, item
  1140.    number, and subitem number of the next item from the menu event queue,
  1141.    wait if the menu event queue is empty.
  1142.    See Also:   menup, whenmenu
  1143.  
  1144. getmessage
  1145.    Output pointer to next message at the host port, wait if its empty.
  1146.    See Also:   messagep, whenmessage, replymessage
  1147.  
  1148. getmouse
  1149.    Output list containing a pointer to the window, the X position, and Y
  1150.    position where the mouse was when the button was pressed, wait if the
  1151.    mouse event queue is empty.
  1152.    See Also:   mousep, whenmouse
  1153.  
  1154. getprop        name property
  1155. gprop
  1156.          name = Word, name of a variable containing a property list.
  1157.          property = Word, label of an object in a property list.
  1158.    Output specified object from a property list.  If `name' does not
  1159.    exist, the empty list is returned.  If `property' does not exist for
  1160.    that `name', the empty list is returned.
  1161.    See Also:   putprop, remprop
  1162.  
  1163. getreply
  1164.    Output pointer to next message at the reply port, wait if its empty.
  1165.    See Also:   replyp, whenreply
  1166.  
  1167. heading        turtle
  1168.          turtle = Pointer to a turtle.
  1169.    Output a turtles heading.
  1170.  
  1171. home           ( turtle ... )
  1172.                ( turtle-list )
  1173.          turtle = Pointer to a turtle.
  1174.          turtle-list = List of turtle pointers.
  1175.    Move turtles to position (0,0) set heading to 0.
  1176.  
  1177. hostport       ( port-name )
  1178.          port-name = Word or list, name for host message port.
  1179.    Without an input, outputs the name of the host port.
  1180.    With an input, changes the name of the host port.
  1181.  
  1182. if             predicate run-list run-list
  1183.          predicate = true or false.
  1184.          run-list = List of LOGO instructions.
  1185.    If predicate is true execute first run-list, if false execute second
  1186.    run-list. Both run-lists are required, if one case is not used, use the 
  1187.    empty list [ ].
  1188.  
  1189. inc            name
  1190.          name = Word, a variable name that contains a number.
  1191.    Increment variable. Add one to the number contained by name.
  1192.  
  1193. int            number
  1194.          number = Any number.
  1195.    Output integer portion of number.
  1196.  
  1197. intuition      action pointer ( ?... )
  1198.          action = A number from 1 to 11, specifying action to be taken.
  1199.          pointer = A pointer to an intuition screen or window.
  1200.          ? = Listed below.
  1201.    Fourteen primitives in one, to modify screens, windows, and menus.
  1202.  
  1203.                1 screen X Y
  1204.          X = Number, pixel x coordinate.
  1205.          Y = Number, pixel y coordinate.
  1206.    Move screen (screen = @0 for workbench screen).
  1207.  
  1208.                2 window X Y
  1209.          X = Number, pixel x coordinate.
  1210.          Y = Number, pixel y coordinate.
  1211.    Move window (window = @0 for command window).
  1212.  
  1213.                3 window menu item subitem
  1214.          menu, item, subitem = Numbers specifying a menu or item.
  1215.    Off menu (window = @0 for command window).
  1216.  
  1217.                4 window menu item subitem
  1218.          menu, item, subitem = Numbers specifying a menu or item.
  1219.    On menu (window = @0 for command window).
  1220.  
  1221.                5 screen
  1222.    Screen to back (screen = @0 for workbench screen).
  1223.  
  1224.                6 screen
  1225.    Screen to front (screen = @0 for workbench screen).
  1226.  
  1227.                7 screen showit
  1228.          showit = Number.
  1229.    Show screen title (number <> 0) hide title (number = 0).
  1230.  
  1231.                8 window width height
  1232.          width = Number, width of window in pixels.
  1233.          height = Number, height of window in pixels.
  1234.    Size window (window = @0 for command window).
  1235.  
  1236.                9 window MinWidth MinHeight MaxWidth MaxHeight
  1237.          MinWidth   \
  1238.          MinHeight   \
  1239.          MaxWidth    /  = Numbers, sizes in pixels.
  1240.          MaxHeight  /
  1241.    Set window limits (window = @0 for command window).
  1242.  
  1243.                10 window
  1244.    Window to back (window = @0 for command window).
  1245.  
  1246.                11 window
  1247.    Window to front (window = @0 for command window).
  1248.  
  1249.                12 window
  1250.    Make window, the active window.
  1251.  
  1252.                13 window menu item subitem
  1253.          menu, item, subitem = Numbers specifying a menu or item.
  1254.    Set menu checkmark.
  1255.  
  1256.                14 window menu item subitem
  1257.          menu, item, subitem = Numbers specifying a menu or item.
  1258.    Clear menu checkmark.
  1259.  
  1260. item           element object
  1261.          element = Number, index to item. 
  1262.          object = Any word or list.
  1263.    Output specified item from object.
  1264.  
  1265. items          first count object
  1266.          first = Number, index to first item.
  1267.          count = Number of items.
  1268.          object = Any word or list.
  1269.    Output specified items from object.
  1270.  
  1271. keyp
  1272.    Output true if character queue is not empty.
  1273.    See Also:   readchar, whenchar
  1274.  
  1275. last           object
  1276.          object = Any word or list.
  1277.    Output last item from object.
  1278.  
  1279. lastput        object object
  1280. lput
  1281.          object = Any word or list.
  1282.    Output object made by adding first input to end of second input.
  1283.  
  1284. launch         run-list
  1285.          run-list = List of LOGO instructions.
  1286.    Add run-list to a queue to be executed once prior to returning to top
  1287.    level.
  1288.  
  1289. left           angle ( turtle ... )
  1290. lt             angle ( turtle-list )
  1291.          angle = Number representing an angle.
  1292.          turtle = Pointer to a turtle.
  1293.          turtle-list = List of turtle pointers.
  1294.    Rotate turtle left.
  1295.  
  1296. linep
  1297.    Output true if command window input line queue is not empty.
  1298.    See Also:   readlist
  1299.  
  1300. listp          object
  1301.          object = Any word or list.
  1302.    Output true if object is a list.
  1303.  
  1304. list           object object ( object... )
  1305.          object = Any word or list.
  1306.    Output list containing input objects.
  1307.  
  1308. load           file-name ( file-name... )
  1309.          file-name = An AmigaDOS file name (word or list).
  1310.    Load file, runs a text file as if it were typed at the keyboard.
  1311.    See Also:   fprintout, save
  1312.  
  1313. loadimage      window file-name
  1314.          window = Pointer to an intuition window.
  1315.          file-name = An AmigaDOS file name (word or list).
  1316.    Load a window from an IFF ILBM file. Requires 'ilbm.library' from
  1317.    Dissidents Software. BUG: sometimes loads entire screen.
  1318.  
  1319. log            base number
  1320.          base = Positive number.
  1321.          number = Positive number.
  1322.    Output logarithm of the number to the base.
  1323.  
  1324. make           name object
  1325.          name = Word, a variable name.
  1326.          object = Any word or list.
  1327.    Make object the contents of name (bind object to name). Make is the LOGO
  1328.    variable assignment operator. 
  1329.    See Also:   erase, bury
  1330.  
  1331. memberp        object object
  1332.          object = Any word or list.
  1333.    Output true if the second object contains the first object. If both
  1334.    objects are words, only the first character of the first object is
  1335.    considered.
  1336.  
  1337. menup
  1338.    Output true if menu queue is not empty.
  1339.    See Also:   getmenu, whenmenu
  1340.  
  1341. messagep
  1342.    Output true if the host port is not empty. 
  1343.    See Also:   getmessage, whenmessage
  1344.  
  1345. mousep
  1346.    Output true if mouse-button queue is not empty.
  1347.    See Also:   getmouse, whenmouse
  1348.  
  1349. mouse          window
  1350.          window = Pointer to an intuition window.
  1351.    Output list containing the X position, Y position and button position of
  1352.    the mouse relative to the window.
  1353.  
  1354. move           window X Y
  1355.          window = Pointer to an intuition window.
  1356.          X = Number, pixel x coordinate.
  1357.          Y = Number, pixel y coordinate.
  1358.    Move a windows graphics cursor to position X Y.
  1359.  
  1360. movecommand    screen ( le te w h )
  1361.          screen = Pointer to an intuition screen, @0 for workbench screen.
  1362.          le = Number, left edge. \
  1363.          te = Number, top edge.   \ _ Dimensions for command window.
  1364.          w  = Number, width.      /
  1365.          h  = Number, height.    /
  1366.    Move the LOGO command window to another screen.
  1367.  
  1368. namelist
  1369.    Output list of variable names in use.
  1370.  
  1371. namep          object
  1372.          object = Any word or list.
  1373.    Outputs true if `object' is a word that is the name of an unburied
  1374.    variable. Outputs false if it is a list, buried name, procedure
  1375.    name, or non-existant name.
  1376.  
  1377. new
  1378.    Remove bindings of all names (erase), close all files, close all
  1379.    turtles, close all windows, close all screens, clear all menus, clear
  1380.    all demons, flush all input queues (eccept message ports), return
  1381.    to top level.  
  1382.  
  1383. not            predicate
  1384.          predicate = true or false.
  1385.    Output true if input is false output false if input is true.
  1386.  
  1387. numberp        object
  1388.          object = Any word or list.
  1389.    Output true if object is a number.
  1390.  
  1391. open           file-name
  1392.          file-name = An AmigaDOS file name (word or list).
  1393.    Create or open file to be written, output BCPL pointer to an AmigaDOS
  1394.    file handle.
  1395.    See Also:   close, openold
  1396.  
  1397. openold        file-name
  1398.          file-name = An AmigaDOS file name (word or list).
  1399.    Open existing file to be read or written, output BCPL pointer to an
  1400.    AmigaDOS file handle.
  1401.    See Also:   close, open
  1402.  
  1403. openpalette    predicate screen ( le te )
  1404.          predicate = true or false.
  1405.          screen = Pointer to an intuition screen, @0 for workbench screen.
  1406.          le = Number, left edge.
  1407.          te = Number, top edge.
  1408.    Open the palette tool, output window pointer. If palette was allready
  1409.    open, it will first be closed based on predicate. Note that the palette
  1410.    is a window and can have menus.
  1411.    See Also:   closepalette, palettep
  1412.  
  1413. openscreen     vm ( d t le te w h dp bp )
  1414.                screen-data-list
  1415.          vm = Number, viewport modes, sum of: 
  1416.                   1     hires
  1417.                   2     lace
  1418.                   4     extra half brite
  1419.          d = Number of bit planes.
  1420.          t = List, title bar text.
  1421.          le = Number, left edge.
  1422.          te = Number, top edge.
  1423.          w = Number, width.
  1424.          h = Number, height.
  1425.          dp = Number, detail pen.
  1426.          bp = Number, block pen.
  1427.          screen-data-list = List containing some or all of the above.
  1428.             Default screen-data-list = [ 0 2 [ ] 0 0 320 200 0 1 ]
  1429.                if view modes = hires then default width = 640
  1430.                if view modes = lace then default height = 400
  1431.                if view modes = extra half brite then default depth = 6
  1432.    Open an intuition graphics screen, output pointer to the screen.
  1433.    See Also:   closescreen
  1434.  
  1435. openturtle     window ( mag ar X Y h t )
  1436.                turtle-data-list
  1437.          window = Pointer to an intuition window.
  1438.          mag = Number, scale or magnification.
  1439.          ar = Number, aspect ratio, pixel width / height.
  1440.          X = Number, pixel x coordinate of home.
  1441.          Y = Number, pixel y coordinate of home.
  1442.          h = Number, heading of home.
  1443.          t = Number, turning direction, >= 0 clockwise,
  1444.              < 0 counterclockwise (right and left are reversed).
  1445.          turtle-data-list = List containing some or all of the above.
  1446.             Defaults:
  1447.                mag   lores    1.8
  1448.                      hires    3.2
  1449.                      This means it takes 200 steps to go from the
  1450.                      left edge to the right edge of a full screen.
  1451.                ar    lores          0.88
  1452.                      hires          0.44
  1453.                      lores lace     1.76
  1454.                      hires lace     0.88
  1455.                      This makes circles look round and squares look
  1456.                      square.
  1457.                X, Y  The current center of the window.
  1458.                h     0  Straight up.
  1459.                t     0  Clockwise.
  1460.    Open a turtle, output pointer to the turtle.
  1461.    See Also:   closeturtle
  1462.  
  1463. openwindow     screen ( f t le te w h dp bp minw minh maxw maxh )
  1464.                window-data-list
  1465.          screen = Pointer to an intuition screen, @0 for workbench screen.
  1466.          f = Number, flags, sum of:
  1467.                   1     drag gadget
  1468.                   2     depth gadget
  1469.                   4     close gadget
  1470.                   8     size gadget
  1471.                   16    give me zero zero
  1472.                   32    backdrop
  1473.                   64    borderless
  1474.                   128   activate
  1475.          t = List, title bar text.
  1476.          le = Number, left edge.
  1477.          te = Number, top edge.
  1478.          w = Number, width.
  1479.          h = Number, height.
  1480.          dp = Number, detail Pen.
  1481.          bp = Number, block Pen.
  1482.          minw = Number, minimum width.
  1483.          minh = Number, minimum height.
  1484.          maxw = Number, maximum width.
  1485.          maxh = Number, maximum height.
  1486.          window-data-list = List containing some or all of the above.
  1487.             Default window-data-list WorkBench screen:
  1488.                   [ @0 3 [ ] 0 0 320 200 0 1 30 30 640 400 ]
  1489.             Default window for custom screen:
  1490.                   Backdrop borderless window to fit the screen.
  1491.    Open an intuition graphics window, output pointer to the window.
  1492.    See Also:   closewindow
  1493.  
  1494. or             predicate predicate ( predicate... )
  1495.          predicate = true or false.
  1496.    Output true if any inputs are true.
  1497.  
  1498. output         object
  1499. op
  1500.          object = Any word or list.
  1501.    Exit procedure, return object as the procedures output.
  1502.  
  1503. palettep       ( window )
  1504.          window = Pointer to an intuition window (the palette tool ?).
  1505.    Test to see if window is the palette tool (is palette open ?), or wait
  1506.    for it to be closed, and or output how it was closed.
  1507.    See Also:   openpalette, closepalette
  1508.  
  1509. pd             ( turtle ... )
  1510.                ( turtle-list )
  1511.          turtle = Pointer to a turtle.
  1512.          turtle-list = List of turtle pointers.
  1513.    Pen down, lower the turtles pen.
  1514.  
  1515. peek           bytes address ( offset )
  1516.          bytes = Number, one of:
  1517.                   0     32 bit pointer
  1518.                   1     8 bit unsigned integer
  1519.                  -1     8 bit signed integer
  1520.                   2     16 bit unsigned integer
  1521.                  -2     16 bit signed integer
  1522.                   4     32 bit unsigned integer
  1523.                  -4     32 bit signed integer
  1524.                   8     64 bit IEEE double floating point number
  1525.          address = Number, or pointer, a memory address.
  1526.          offset = Number, offset in data items.
  1527.    Output number contained at memory address
  1528.    (address + (offset * (data size in bytes))).
  1529.    See Also:   poke, psum
  1530.  
  1531. pen            window ( type )
  1532.          window = Pointer to an intuition window (@0 for command window).
  1533.          type = Number, which pen:
  1534.                   0     foreground pen (default)
  1535.                   1     background pen
  1536.                   2     area outline pen
  1537.    Output the windows pen number.
  1538.  
  1539. poerror
  1540.    Print out error message.
  1541.  
  1542. pointerp       object
  1543.          object = Any word or list.
  1544.    Output true if object is a pointer.
  1545.  
  1546. poke           bytes address number ( offset )
  1547.          bytes = Number of bytes:
  1548.                   1     8 bit integer
  1549.                   2     16 bit integer
  1550.                   4     32 bit integer or pointer
  1551.                   8     64 bit IEEE double floating point number
  1552.          address = Number, or pointer, a memory address.
  1553.          number = Number, or pointer, limited in size by number of bytes.
  1554.          offset = Number, offset in data items.
  1555.    Deposit number at memory address
  1556.    (address + (offset * (data size in bytes))).
  1557.    Compatibility note as of release 1.3 'poke' no longer allows multiple
  1558.    numbers.
  1559.    See Also:   peek, psum
  1560.  
  1561. power          base exponent
  1562.          base = Any number.
  1563.          exponent = Number, if base < 0 then exponent must be an integer.
  1564.    Output base to the power of exponent.
  1565.  
  1566. precision      ( digits )
  1567.          digits = Number from 0 to 15.
  1568.    Sets or outputs precision used by print, fprint, type, ftype, and text
  1569.    when printing numbers.
  1570.  
  1571. primitivep     object
  1572.          object = Any word or list.
  1573.    Output true if object is a primitive.
  1574.  
  1575. print          object ( object... )
  1576. pr
  1577.          object = Any word or list.
  1578.    Print object to command window, followed by a carriage return, with
  1579.    outer brackets removed.
  1580.  
  1581. printout       name ( name... )
  1582. po             name-list ( name-list... )
  1583.          name = Word, a variable name.
  1584.          name-list = List of names.
  1585.    Print names and their bindings (i.e., the entire `make' command) to
  1586.    the command window.
  1587.  
  1588. procedurep     object
  1589.          object = Any word or list.
  1590.    Output true if object is a user defined procedure.
  1591.  
  1592. psum           address number ( number... )
  1593.          address = Number, or pointer, a memory address.
  1594.          number = Any number.
  1595.    Output pointer equal to sum of address and numbers.
  1596.    See Also:   peek, poke
  1597.  
  1598. pu             ( turtle... )
  1599.                ( turtle-list )
  1600.          turtle = Pointer to a turtle.
  1601.          turtle-list = List of turtle pointers.
  1602.    Pen up, raise the turtles pen.
  1603.  
  1604. putprop        name property object
  1605. pprop
  1606.          name = Word, name of a variable containing a property list.
  1607.          property = Word, label of an object in a property list.
  1608.          object = Any word or list.
  1609.    Place object into a property list.
  1610.    See Also:   getprop, remprop
  1611.  
  1612. quit
  1613.    Exit LOGO, return to WorkBench or CLI. LOGO cleans up after itself by
  1614.    closing all screens, windows, turtles, and files, and freeeing allocated
  1615.    memory in the user memory list.
  1616.  
  1617. radians
  1618.    Interpret angles as radians.
  1619.    See Also:   degrees
  1620.  
  1621. rand
  1622.    Output random fraction from zero to less than one.
  1623.  
  1624. random         range
  1625.          range = Number, positive integer.
  1626.    Output random integer from zero to less than number.
  1627.  
  1628. readchar
  1629. rc
  1630.    Output one character word typed at keyboard. Reads characters from
  1631.    windows other than the command window. Waits if character event queue
  1632.    is empty.
  1633.    See Also:   keyp, whenchar
  1634.  
  1635. readlist
  1636. rl
  1637.    Output line typed at keyboard as a list. Reads lines from the command
  1638.    window. Waits if line queue is empty.
  1639.    See Also:   listp
  1640.  
  1641. readpixel      window X Y
  1642.          window = Pointer to an intuition window.
  1643.          X = Number, pixel x coordinate.
  1644.          Y = Number, pixel y coordinate.
  1645.    Output pen number of pixel at position (X,Y).
  1646.  
  1647. rectfill       window l t r b
  1648.          window = Pointer to an intuition window.
  1649.          l = Number, left edge of rectangle in pixels.
  1650.          t = Number, top edge of rectangle in pixels.
  1651.          r = Number, right edge of rectangle in pixels.
  1652.          b = Number, bottom edge of rectangle in pixels.
  1653.    Fill rectangle from (l,t) to (r,b).
  1654.  
  1655. recycle        ( number )
  1656.          number = Any number.
  1657.    Without an input, recycles memory and frees what is normaly held in
  1658.    reserve. With an input, just recycles memory.
  1659.  
  1660. remainder      number number
  1661.          number = Any number.
  1662.    Output remainder after division.
  1663.  
  1664. remprop        name property
  1665.          name = Word, name of a variable containing a property list.
  1666.          property = Word, label of an object in a property list.
  1667.    Remove object from a property list.
  1668.    See Also:   getprop, putprop
  1669.  
  1670. repeat         number run-list
  1671.          number = Number, positive integer.
  1672.          run-list = List of LOGO instructions.
  1673.    Execute run-list number of times.
  1674.    See Also:   break, continue
  1675.  
  1676. repitem        item list object
  1677.          item = Number, index into list.
  1678.          list = Any list.
  1679.          object = Any word or list.
  1680.    Replace specified item of list with object. This special purpous command
  1681.    should NOT be used by any but the most experienced programmers. 
  1682.    WARNING: repitem destructively changes an existing list and you may
  1683.    obtain unexpected results if there is more than one reference to the
  1684.    list. This is similar to 'rplaca' in Lisp.
  1685.    See Also:   eqp, represt
  1686.  
  1687.  
  1688. replymessage   message
  1689.          message = Pointer to an Exec message.
  1690.    Return a message received at the host port.
  1691.    See Also:   getmessage
  1692.  
  1693. replyp
  1694.    Output true if the reply port is not empty. 
  1695.    See Also:   getreply, whenreply, sendmessage
  1696.  
  1697. represt        item list object
  1698.          item = Number, index into list.
  1699.          list = Any list.
  1700.          object = Any word or list.
  1701.    Replace rest of list after specified item with object. This special
  1702.    purpous command should NOT be used by any but the most experienced
  1703.    programmers.  WARNING: represt destructively changes an existing list
  1704.    and you may obtain unexpected results if there is more than one
  1705.    reference to the list. This is similar to 'rplacd' in Lisp.
  1706.    See Also:   eqp, repitem
  1707.  
  1708. restof         item object
  1709.          item = Number, index into object.
  1710.          object = Any word or list.
  1711.    Output rest of object following specified item.
  1712.  
  1713. rgb            screen index
  1714.          screen = Pointer to an intuition screen (@0 for workbench screen).
  1715.          index = Number, index into the screens color table.
  1716.    Output list containing red, green, and blue value of the screens
  1717.    specified color.
  1718.  
  1719. right          angle ( turtle ... )
  1720. rt             angle ( turtle-list )
  1721.          angle = Number representing an angle.
  1722.          turtle = Pointer to a turtle.
  1723.          turtle-list = List of turtle pointers.
  1724.    Rotate turtle right.
  1725.  
  1726. round          number
  1727.          number = Any number.
  1728.    Output number rounded to nearest integer.
  1729.  
  1730. run            run-list
  1731.          run-list = List of LOGO instructions.
  1732.    Execute run-list.
  1733.  
  1734. save           file-name name ( name... )
  1735.                file-name name-list ( name-list... )
  1736.          file-name = An AmigaDOS file name (word or list).
  1737.          name = Word, a variable name.
  1738.          name-list = List of names.
  1739.    Save variable names and their contents to file with a project icon.
  1740.    See Also:   load
  1741.  
  1742. saveicon       file-name ( default-tool tool-types )
  1743.          file-name = An AmigaDOS file name ('.info' will be added).
  1744.          default-tool = Word.
  1745.          tool-types = List of up to three words.
  1746.    Attach icon to file.
  1747.  
  1748. saveimage      window file-name
  1749.          window = Pointer to an intuition window.
  1750.          file-name = An AmigaDOS file name (word or list).
  1751.    Save a window to an IFF ILBM file. Requires 'ilbm.library' from
  1752.    Dissidents Software. BUG: sometimes saves entire screen.
  1753.  
  1754. screenlist
  1755.    Output list of pointers to all open screens.
  1756.  
  1757. seconds
  1758.    Output system clock time in seconds.
  1759.  
  1760. seedrand       ( number )
  1761.          number = Any number.
  1762.    Re-seed random number generator.
  1763.  
  1764. seekend        file
  1765.          file = BCPL pointer to AmigaDOS file handle.
  1766.    Move to end of file.
  1767.  
  1768. seekstart      file
  1769.          file = BCPL pointer to AmigaDOS file handle.
  1770.    Move to start of file.
  1771.  
  1772. sendmessage    port-name message ( predicate )
  1773.          port-name = Word or list, name of public message port.
  1774.          message = Pointer to an Exec message.
  1775.          predicate = true or false.
  1776.    Send a message to the specified message port. 'predicate' indicates
  1777.    whether or not you want a reply.
  1778.    See Also:   getreply, replyp
  1779.  
  1780. sentence       object object ( object... )
  1781. se
  1782.          object = Any word or list.
  1783.    Output list of input objects. Lists in the input to sentence will have
  1784.    their outer brackets removed. 'sentence' always creates a new list.
  1785.  
  1786. setafpt        window pattern-list
  1787.          window = Pointer to an intuition window.
  1788.          pattern-list = A list of up to 16 words, each 16 characters long
  1789.                         where 'x' is an on pixel, any other character is an
  1790.                         off pixel.
  1791.    Set area fill pattern.
  1792.  
  1793. setcursor      position
  1794.          position = List of two numbers, X, and Y coordinates.
  1795.    Set command window text cursor position.
  1796.  
  1797. setdrmode      window mode
  1798.          window = Pointer to an intuition window (@0 for command window).
  1799.          mode = Number, sum of:
  1800.                   0     JAM1
  1801.                   1     JAM2
  1802.                   2     COMPLEMENT
  1803.                   4     INVERSVID
  1804.    Set a windows draw mode.
  1805.  
  1806. setfont        window font-name font-height
  1807.          window = Pointer to an intuition window (@0 for command window).
  1808.          font-name = Word.
  1809.          font-height = Number.
  1810.    Set a windows text font.
  1811.  
  1812. seth           angle ( turtle ... )
  1813.                angle ( turtle-list )
  1814.          angle = Number representing an angle.
  1815.          turtle = Pointer to a turtle.
  1816.          turtle-list = List of turtle pointers.
  1817.    Set turtles heading.
  1818.  
  1819. setlinept      window pattern
  1820.          window = Pointer to an intuition window.
  1821.          pattern = Word 16 characters long where 'x' is an on pixel, any
  1822.                    other character is an off pixel.
  1823.    Set a windows line pattern.
  1824.  
  1825. setmenu        window menu-list ( front-pen back-pen )
  1826.          window = Pointer to an intuition window (@0 for command window).
  1827.          menu-list = List of menu text:
  1828.                            [ menu-name-1 [ item-1-1 K ]
  1829.                                          [ item-1-2 [ subitem-1-2-1 K ]
  1830.                                                     [ subitem-1-2-2 K ] ]
  1831.                              menu-name-2 [ item-2-1 ]
  1832.                                          [ item-2-2 ] ]
  1833.                      (where 'K' is a keyboard short cut)
  1834.          front-pen = Number, pen for menu text.
  1835.          back-pen = Number, pen for menu background.
  1836.    Attach a menu strip to the window.
  1837.  
  1838. setpen         window pen ( type )
  1839.          window = Pointer to an intuition window (@0 for command window).
  1840.          pen = Number of pen.
  1841.          type = Number, which pen:
  1842.                   0     foreground pen (default)
  1843.                   1     background pen
  1844.                   2     area outline pen
  1845.    Set a windows pen number.
  1846.  
  1847. setrgb         screen index rgb-list
  1848.          screen = Pointer to an intuition screen (@0 for workbench screen).
  1849.          index = Number, index into color registers table.
  1850.          rgb-list = List of three numbers, containing red, green, and blue
  1851.                     value of the color.
  1852.    Set a screens color register.
  1853.  
  1854. setstyle       window style
  1855.          window = Pointer to an intuition window (@0 for command window).
  1856.          style = Number, sum of:
  1857.                   0     plain
  1858.                   1     underlined
  1859.                   2     bold
  1860.                   4     italic
  1861.    Set the text rendering style.
  1862.  
  1863. settdm         mode ( turtle ... )
  1864.                mode ( turtle-list )
  1865.          mode = Number, sum of:
  1866.                   0     JAM1
  1867.                   1     JAM2
  1868.                   2     COMPLEMENT
  1869.                   4     INVERSVID
  1870.          turtle = Pointer to a turtle.
  1871.          turtle-list = List of turtle pointers.
  1872.    Set turtles draw mode.
  1873.  
  1874. settlp         pattern ( turtle ... )
  1875.                pattern ( turtle-list )
  1876.          pattern = Word 16 characters long where 'x' is an on pixel, any other
  1877.                    character is an off pixel.
  1878.          turtle = Pointer to a turtle.
  1879.          turtle-list = List of turtle pointers.
  1880.    Set turtle line pattern.
  1881.  
  1882. settpn         pen type ( turtle ... )
  1883.                pen type ( turtle-list )
  1884.          pen = Number of pen.
  1885.          type = Number, which pen:
  1886.                   0     foreground pen
  1887.                   1     background pen
  1888.          turtle = Pointer to a turtle.
  1889.          turtle-list = List of turtle pointers.
  1890.    Set turtles pen number.
  1891.  
  1892. settpos        position ( turtle ... )
  1893.                position ( turtle-list )
  1894.          position = List of two numbers, X, and Y coordinates.
  1895.          turtle = Pointer to a turtle.
  1896.          turtle-list = List of turtle pointers.
  1897.    Set turtles position.
  1898.  
  1899. show           object ( object... )
  1900.          object = Any word or list.
  1901.    Print object to command window, followed by a carriage return, with
  1902.    outer brackets intact.
  1903.  
  1904. sin            angle
  1905.          angle = Number representing an angle.
  1906.    Output sine of angle.
  1907.  
  1908. sleep
  1909.    Wait for an input event (mouse, menu, keyboard, window close, host port,
  1910.    or reply port).
  1911.  
  1912. sound          sound-list sound-list sound-list sound-list
  1913.          sound-list = list containing:
  1914.             sound data, pointer to an array of bytes (in chip ram).
  1915.             length, number of bytes of sound data.
  1916.             period, number, (microseconds per sample)/0.279.
  1917.             volume, number, loudness 0-64.
  1918.             cycles, number of times to repeat the sound.
  1919.    Play sounds and music on all four of the Amiga audio channels. Sound
  1920.    data must be prepared prior to use.
  1921.  
  1922. sqrt           number
  1923.          number = Positive number.
  1924.    Output square root of number.
  1925.  
  1926. stick
  1927.    Output list containing the X position, Y position and button position of
  1928.    a joystick in port number two.
  1929.  
  1930. stop
  1931.    Exit procedure.
  1932.  
  1933. system         action ( ? )
  1934.          action = A number from 1 to 14, specifying action to be taken.
  1935.          ? = Listed below.
  1936.    Fourteen primitives in one, to control memory, libraries, and demons. 
  1937.  
  1938.                1
  1939.    Output the amount of memory LOGO tries to hold in reserve.
  1940.  
  1941.                2 bytes
  1942.          bytes = Number of bytes.
  1943.    Set the amount of memory LOGO tries to hold in reserve.
  1944.  
  1945.                3 bytes
  1946.          bytes = Number of bytes.
  1947.    Allocate memory, this has been replaced by 'allocmem'.
  1948.    See Also:   allocmem
  1949.  
  1950.                4 bytes
  1951.          bytes = Number of bytes.
  1952.    Allocate chip memory, this has been replaced by 'allocchip'.
  1953.    See Also:   allocchip
  1954.  
  1955.                5 pointer
  1956.          pointer = Pointer to allocated memory.
  1957.    Free memory, this has been replaced by 'freemem'.
  1958.    See Also:   allocchip, allocmem, allocstring, freemem
  1959.  
  1960.                6
  1961.    Output list of pointers to allocated memory blocks.
  1962.    See Also:   allocchip, allocmem, allocstring, freemem
  1963.  
  1964.                7
  1965.    Open Diskfont library.
  1966.  
  1967.                8
  1968.    Close Diskfont library.
  1969.  
  1970.                9
  1971.    Open ILBM library.
  1972.  
  1973.                10
  1974.    Close ILBM library.
  1975.  
  1976.                11
  1977.    Enable demons.
  1978.  
  1979.                12
  1980.    Disable demons.
  1981.  
  1982.                13
  1983.    Open Icon library.
  1984.  
  1985.                14
  1986.    Close Icon library.
  1987.  
  1988.                15
  1989.    Output a real pointer to the command window.
  1990.  
  1991.                16
  1992.    Output a real pointer to the workbench screen.
  1993.  
  1994.                17
  1995.    Output launch list.
  1996.  
  1997.                18
  1998.    Output char demon list.
  1999.  
  2000.                19
  2001.    Output close demon list.
  2002.  
  2003.                20
  2004.    Output menu demon list.
  2005.  
  2006.                21
  2007.    Output mouse demon list.
  2008.  
  2009.                22
  2010.    Output host port demon list.
  2011.  
  2012.                23
  2013.    Output reply port demon list.
  2014.  
  2015. tan            angle
  2016.          angle = Number representing an angle.
  2017.    Output tangent of angle.
  2018.  
  2019. tell           turtle ( turtle... )
  2020.                turtle-list
  2021.          turtle = Pointer to a turtle.
  2022.          turtle-list = List of turtle pointers.
  2023.    Make these the active turtles, deactivate any other turtles.
  2024.  
  2025. text           window object
  2026.          window = Pointer to an intuition window.
  2027.          object = Any word or list.
  2028.    Print text to a custom window.
  2029.  
  2030. thing          name
  2031.          name = Word, a variable name.
  2032.    Output object bound to name (contents of variable).
  2033.  
  2034. throw          label
  2035.          label = Any word.
  2036.    Escape to catch with matching label.
  2037.  
  2038. toplevel
  2039.    Stop all LOGO processing and return to the top level prompt.
  2040.  
  2041. toward         position turtle
  2042.          position = List of two numbers, X, and Y coordinates.
  2043.          turtle = Pointer to a turtle.
  2044.    Output heading to point turtle toward position.
  2045.  
  2046. tpen           turtle ( type )
  2047.          turtle = Pointer to a turtle.
  2048.          type = Number, which pen:
  2049.                   0     foreground pen (default)
  2050.                   1     background pen
  2051.    Output the turtles pen number.
  2052.  
  2053. tpos           turtle
  2054.          turtle = Pointer to a turtle.
  2055.    Output a list containing the turtles position.
  2056.  
  2057. turtlelist
  2058.    Output list of pointers to all open turtles.
  2059.  
  2060. turtleoff      ( turtle ... )
  2061.                ( turtle-list )
  2062.          turtle = Pointer to a turtle.
  2063.          turtle-list = List of turtle pointers.
  2064.    Deactivate turtles.
  2065.  
  2066. turtleon       ( turtle ... )
  2067.                ( turtle-list )
  2068.          turtle = Pointer to a turtle.
  2069.          turtle-list = List of turtle pointers.
  2070.    Activate turtles.
  2071.  
  2072. twpos          turtle
  2073.          turtle = Pointer to a turtle.
  2074.    Output Turtles position in window coordinates.
  2075.  
  2076. type           object ( object... )
  2077.          object = Any word or list.
  2078.    Print the object (followed by a space) to the command window with
  2079.    outer brackets removed, and not followed by a carriage return.
  2080.  
  2081. unbury         name ( name... )
  2082.                name-list ( name-list... )
  2083.          name = Word, a variable name.
  2084.          name-list = List of names.
  2085.    Make variable names accessible.
  2086.    See Also:   bury
  2087.  
  2088. wait           seconds
  2089.          seconds = Positive number.
  2090.    Pause for a number of seconds.
  2091.  
  2092. whenchar       run-list
  2093.          run-list = List of LOGO instructions.
  2094.    Set demon to run when key stroke is detected. Run-list must execute a
  2095.    'readchar' to clear the character queue.
  2096.    See Also:   keyp, readchar
  2097.  
  2098. whenclose      run-list
  2099.          run-list = List of LOGO instructions.
  2100.    Set demon to run when window-close is detected. Run-list must execute a
  2101.    'getclose' to clear the window-close queue.
  2102.    See Also:   closep, getclose
  2103.  
  2104. whenmenu       run-list
  2105.          run-list = List of LOGO instructions.
  2106.    Set demon to run when menu item is selected. Run-list must execute a
  2107.    'getmenu' to clear the menu-selection queue.
  2108.    See Also:   getmemu, menup
  2109.  
  2110. whenmessage    run-list
  2111.    Set demon to run when the host port is not empty. Run-list must
  2112.    execute a 'getmessage' to clear the host message port.
  2113.    See Also:   getmessage, messagep, replymessage
  2114.  
  2115. whenmouse      run-list
  2116.          run-list = List of LOGO instructions.
  2117.    Set demon to run when mouse-button is pressed. Run-list must execute a
  2118.    'getmouse' to clear the mouse-button queue.
  2119.    See Also:   getmouse, mousep
  2120.  
  2121. whenreply      run-list
  2122.    Set demon to run when the reply port is not empty. Run-list must
  2123.    execute a 'getreply' to clear the reply port.
  2124.    See Also:   getreply, replyp, sendmessage
  2125.  
  2126. while          predicate-list run-list
  2127.          predicate-list = A run-list that outputs true or false.
  2128.          run-list = List of LOGO instructions.
  2129.    While predicate-list is true, repeat run-list.
  2130.    See Also:   break, continue
  2131.  
  2132. window         ( turtle ... )
  2133.                ( turtle-list )
  2134.          turtle = Pointer to a turtle.
  2135.          turtle-list = List of turtle pointers.
  2136.    Allow turtle to move beyond edges of window.
  2137.  
  2138. windowlist
  2139.    Output list of pointers to all open windows.
  2140.  
  2141. word           word word ( word... )
  2142.          word = Any word.
  2143.    Output word made by concatenating the input words.
  2144.  
  2145. wordp          object
  2146.          object = Any word or list.
  2147.    Output true if object is a word.
  2148.  
  2149. wrap           ( turtle ... )
  2150.                ( turtle-list )
  2151.          turtle = Pointer to a turtle.
  2152.          turtle-list = List of turtle pointers.
  2153.    Make turtle wrap around at edges of window.
  2154.  
  2155. writepixel     window X Y
  2156.          window = Pointer to an intuition window.
  2157.          X = Number, pixel x coordinate.
  2158.          Y = Number, pixel y coordinate.
  2159.    Set pixel (X,Y) to the pen color.
  2160.  
  2161. wtpos          turtle
  2162.          turtle = Pointer to a turtle.
  2163.    Output windows position in turtle coordinates.
  2164.  
  2165. Appendix A  Errors
  2166.  
  2167. Errors in syntax, or anything the interpreter does not recognize as valid
  2168. LOGO instructions, should produce meaningful error messages.
  2169.  
  2170. Primitives that expect a pointer as input may cause LOGO to crash (guru) if
  2171. passed a bad pointer.
  2172.  
  2173. The primitives 'repitem', and 'represt' destructively change an existing
  2174. list and must be used carefully. If there is more than one reference to the
  2175. list all references will be changed. They can also result in circular lists
  2176. which appear infinite, and may cause LOGO to get stuck in a loop.
  2177.  
  2178. Appendix B  Limits
  2179.  
  2180.  * Lines typed at the command window are limited to 250 characters.
  2181.  
  2182.  * Lines in files being loaded are limited to 1000 characters.
  2183.  
  2184.  * Words may be no longer than 500 characters.
  2185.  
  2186.  * Primitives are limited to a maximum of 200 inputs.
  2187.  
  2188.  * Internally lists may be nested to any depth. But stack size will limit
  2189.    list depth for input and output. This is rare but if LOGO crashes while
  2190.    entering, printing, saving, loading, writing, or reading, a deeply
  2191.    nested list, try increasing the stack size.
  2192.  
  2193. Appendix C  Compatibility
  2194.  
  2195. Though there is no official standard for LOGO, two dialects form the de
  2196. facto standard: Those from LOGO Computer Systems Inc. (LCSI) (Apple LOGO
  2197. II, Atari LOGO, Sprite LOGO), and what is called MIT LOGO (Krell, PC,
  2198. Terrapin, Amiga). These are both good, and similar enough to both be called
  2199. standard.
  2200.  
  2201. With the following important exceptions Power LOGO follows the LCSI
  2202. standard:
  2203.  
  2204. Power LOGO is case sensitive. All primitives and keywords are lower case,
  2205. all names and data defined may be any case.
  2206.  
  2207. Spaces are sacred. All LOGO objects (words, lists, list brackets, and
  2208. parenthesis) must be separated by a space, or a linefeed. Other dialects
  2209. may accept lists like this:
  2210.  
  2211.    make "x [abc[12 3 45]ef g]
  2212.  
  2213. In Power LOGO it would be:
  2214.  
  2215.    make "x [ abc [ 12 3 45 ] ef g ]
  2216.  
  2217. Power LOGO uses prefix (polish) notation only. There are no infix
  2218. operations, no implied spaces, no special delimiters, and no exceptions.
  2219. Other dialects may accept arithmetic in this form:
  2220.  
  2221.    pr 5+2*7
  2222.  
  2223. In Power LOGO:
  2224.  
  2225.    pr + 5 * 2 7
  2226.  
  2227. Power LOGO has no 'TO' or 'END' primitive. User defined procedures are just
  2228. variables that contain a special type of list, and are defined using the
  2229. 'make' primitive. Here is a simple procedure that will work in most
  2230. traditional dialects of LOGO:
  2231.  
  2232. 1  TO HELLO
  2233. 2  PR [ HELLO WORLD ]
  2234. 3  END
  2235.  
  2236. And a line by line translation into PowerLOGO:
  2237.  
  2238. 1  make "hello [ procedure [ ]
  2239. 2  pr [ Hello World ]
  2240. 3  ]
  2241.  
  2242. The word 'procedure' identifies this list as a procedure definition. Inputs
  2243. and local variables are declared in a list following the word 'procedure'
  2244. (the empty list indicates that this procedure has no inputs and no local
  2245. variables). The names list is followed by the instructions that make up the
  2246. procedure.
  2247.  
  2248. The first item of the variable names list is a list of names of required
  2249. inputs. The second item is a list of names of optional inputs. The third
  2250. item is a list of names of local variables.
  2251.  
  2252.    TO COUNTUP :FROM :TO
  2253.    LOCAL :X
  2254.    MAKE "X 0
  2255.    REPEAT :TO - :FROM [ PR :FROM + :X MAKE "X :X + 1 ]
  2256.    END
  2257.  
  2258. In Power LOGO:
  2259.  
  2260.    make "countup [ procedure [ [ :from :to ] [ ] [ :x ] ]  
  2261.    make "x 0
  2262.    repeat - :to :from [ pr + :from :x make "x + :x 1 ] ]
  2263.  
  2264. For most procedures the first line and the variable declarations will look
  2265. very different. but the instructions that make up the body of the procedure
  2266. will need little change.
  2267.  
  2268. Other differences relate to the name, spelling, inputs, and behavior of
  2269. individual primitives:
  2270.  
  2271. In many dialects the 'if' primitive may have either two, or three inputs,
  2272. the third input is the else action:
  2273.  
  2274.    if equalp :a :b [ pr true ]
  2275.    if equalp :a :b [ pr true ] [ pr false ]
  2276.  
  2277. In Power LOGO the 'if' primitive always has three inputs. If the third
  2278. input is not needed, use the empty list:
  2279.  
  2280.    if equalp :a :b [ pr true ] [ ]
  2281.    if equalp :a :b [ pr true ] [ pr false ]
  2282.  
  2283. Turtle graphics commands should be compatible with most other dialects, but
  2284. a window and a turtle must have been opened first (the startup, and turtles
  2285. files will do this for you).
  2286.  
  2287. Because of multiple turtles, operations that output data about a turtle
  2288. must have a turtle-pointer as input. If you are using the provided turtle
  2289. package, this will output the heading of the turtle:
  2290.  
  2291.    heading :tg-turtle
  2292.  
  2293. Power LOGO has special primitives for reading and writing data files (open,
  2294. close, fprint, freadlist, ect.).
  2295.  
  2296. Appendix D  Recommended Reading
  2297.  
  2298. This document file describes the differences between Power LOGO and
  2299. traditional versions of LOGO, these books will provide more background
  2300. about LOGO. Two of these books, Computer Science Logo Style volume 1, and
  2301. Visual Modeling with LOGO, include sections that may be helpful to
  2302. beginners.
  2303.  
  2304. Computer Science Logo Style
  2305.    Volume 1:   Intermediate Programming, 1985.
  2306.    Volume 2:   Projects, Styles, and Techniques, 1986.
  2307.    Volume 3:   Advanced Topics, 1987.
  2308.    Brian Harvey
  2309.    MIT Press.
  2310.       These are excellent books for anyone interested in programming, and
  2311.    computer science.
  2312.  
  2313. Mindstorms:   Children, Computers, and Powerful Ideas.
  2314.    Seymour Papert
  2315.    Basic Books, 1980
  2316.       This book is about education and how computers and programming may be
  2317.    used by children, parents, and teachers. Required reading for parents,
  2318.    and teachers interested in how children can make use of computers.
  2319.  
  2320. Turtle Geometry:   The Computer as a Medium for Exploring Mathematics.
  2321.    Harold Abelson, and Andrea diSessa
  2322.    MIT Press 1981
  2323.       About turtles as a tool for the study of mathematics, geometry, and
  2324.    topology.
  2325.  
  2326. Visual Modeling with LOGO:   A Structural Approach to Seeing.
  2327.    James Clayson
  2328.    MIT Press, 1988
  2329.       About using LOGO and turtle graphics for exploring visual ideas and 
  2330.    relationships.
  2331.